diff --git a/node_modules/@eslint-community/eslint-utils/LICENSE b/node_modules/@eslint-community/eslint-utils/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..883ee1f612d12cea3642aa8a8473084202bcb220 --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Toru Nagashima + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@eslint-community/eslint-utils/README.md b/node_modules/@eslint-community/eslint-utils/README.md new file mode 100644 index 0000000000000000000000000000000000000000..257954c9ba9f100a2065cabb512cc6045b3c604b --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/README.md @@ -0,0 +1,37 @@ +# @eslint-community/eslint-utils + +[![npm version](https://img.shields.io/npm/v/@eslint-community/eslint-utils.svg)](https://www.npmjs.com/package/@eslint-community/eslint-utils) +[![Downloads/month](https://img.shields.io/npm/dm/@eslint-community/eslint-utils.svg)](http://www.npmtrends.com/@eslint-community/eslint-utils) +[![Build Status](https://github.com/eslint-community/eslint-utils/workflows/CI/badge.svg)](https://github.com/eslint-community/eslint-utils/actions) +[![Coverage Status](https://codecov.io/gh/eslint-community/eslint-utils/branch/main/graph/badge.svg)](https://codecov.io/gh/eslint-community/eslint-utils) + +## ๐Ÿ Goal + +This package provides utility functions and classes for make ESLint custom rules. + +For examples: + +- [`getStaticValue`](https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getstaticvalue) evaluates static value on AST. +- [`ReferenceTracker`](https://eslint-community.github.io/eslint-utils/api/scope-utils.html#referencetracker-class) checks the members of modules/globals as handling assignments and destructuring. + +## ๐Ÿ“– Usage + +See [documentation](https://eslint-community.github.io/eslint-utils). + +## ๐Ÿ“ฐ Changelog + +See [releases](https://github.com/eslint-community/eslint-utils/releases). + +## โค๏ธ Contributing + +Welcome contributing! + +Please use GitHub's Issues/PRs. + +### Development Tools + +- `npm run test-coverage` runs tests and measures coverage. +- `npm run clean` removes the coverage result of `npm run test-coverage` command. +- `npm run coverage` shows the coverage result of the last `npm run test-coverage` command. +- `npm run lint` runs ESLint. +- `npm run watch` runs tests on each file change. diff --git a/node_modules/@eslint-community/eslint-utils/index.d.mts b/node_modules/@eslint-community/eslint-utils/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8ad6f5c984aac374c5eb278237223b3f0d437b5f --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/index.d.mts @@ -0,0 +1,217 @@ +import * as eslint from 'eslint'; +import { Rule, AST } from 'eslint'; +import * as estree from 'estree'; + +declare const READ: unique symbol; +declare const CALL: unique symbol; +declare const CONSTRUCT: unique symbol; +declare const ESM: unique symbol; +declare class ReferenceTracker { + constructor(globalScope: Scope$2, options?: { + mode?: "legacy" | "strict" | undefined; + globalObjectNames?: string[] | undefined; + } | undefined); + private variableStack; + private globalScope; + private mode; + private globalObjectNames; + iterateGlobalReferences(traceMap: TraceMap$2): IterableIterator>; + iterateCjsReferences(traceMap: TraceMap$2): IterableIterator>; + iterateEsmReferences(traceMap: TraceMap$2): IterableIterator>; + iteratePropertyReferences(node: Expression, traceMap: TraceMap$2): IterableIterator>; + private _iterateVariableReferences; + private _iteratePropertyReferences; + private _iterateLhsReferences; + private _iterateImportReferences; +} +declare namespace ReferenceTracker { + export { READ }; + export { CALL }; + export { CONSTRUCT }; + export { ESM }; +} +type Scope$2 = eslint.Scope.Scope; +type Expression = estree.Expression; +type TraceMap$2 = TraceMap$1; +type TrackedReferences$2 = TrackedReferences$1; + +type StaticValue$2 = StaticValueProvided$1 | StaticValueOptional$1; +type StaticValueProvided$1 = { + optional?: undefined; + value: unknown; +}; +type StaticValueOptional$1 = { + optional?: true; + value: undefined; +}; +type ReferenceTrackerOptions$1 = { + globalObjectNames?: string[]; + mode?: "legacy" | "strict"; +}; +type TraceMap$1 = { + [i: string]: TraceMapObject; +}; +type TraceMapObject = { + [i: string]: TraceMapObject; + [CALL]?: T; + [CONSTRUCT]?: T; + [READ]?: T; + [ESM]?: boolean; +}; +type TrackedReferences$1 = { + info: T; + node: Rule.Node; + path: string[]; + type: typeof CALL | typeof CONSTRUCT | typeof READ; +}; +type HasSideEffectOptions$1 = { + considerGetters?: boolean; + considerImplicitTypeConversion?: boolean; +}; +type PunctuatorToken = AST.Token & { + type: "Punctuator"; + value: Value; +}; +type ArrowToken$1 = PunctuatorToken<"=>">; +type CommaToken$1 = PunctuatorToken<",">; +type SemicolonToken$1 = PunctuatorToken<";">; +type ColonToken$1 = PunctuatorToken<":">; +type OpeningParenToken$1 = PunctuatorToken<"(">; +type ClosingParenToken$1 = PunctuatorToken<")">; +type OpeningBracketToken$1 = PunctuatorToken<"[">; +type ClosingBracketToken$1 = PunctuatorToken<"]">; +type OpeningBraceToken$1 = PunctuatorToken<"{">; +type ClosingBraceToken$1 = PunctuatorToken<"}">; + +declare function findVariable(initialScope: Scope$1, nameOrNode: string | Identifier): Variable | null; +type Scope$1 = eslint.Scope.Scope; +type Variable = eslint.Scope.Variable; +type Identifier = estree.Identifier; + +declare function getFunctionHeadLocation(node: FunctionNode$1, sourceCode: SourceCode$2): SourceLocation | null; +type SourceCode$2 = eslint.SourceCode; +type FunctionNode$1 = estree.Function; +type SourceLocation = estree.SourceLocation; + +declare function getFunctionNameWithKind(node: FunctionNode, sourceCode?: eslint.SourceCode | undefined): string; +type FunctionNode = estree.Function; + +declare function getInnermostScope(initialScope: Scope, node: Node$4): Scope; +type Scope = eslint.Scope.Scope; +type Node$4 = estree.Node; + +declare function getPropertyName(node: MemberExpression | MethodDefinition | Property | PropertyDefinition, initialScope?: eslint.Scope.Scope | undefined): string | null | undefined; +type MemberExpression = estree.MemberExpression; +type MethodDefinition = estree.MethodDefinition; +type Property = estree.Property; +type PropertyDefinition = estree.PropertyDefinition; + +declare function getStaticValue(node: Node$3, initialScope?: eslint.Scope.Scope | null | undefined): StaticValue$1 | null; +type StaticValue$1 = StaticValue$2; +type Node$3 = estree.Node; + +declare function getStringIfConstant(node: Node$2, initialScope?: eslint.Scope.Scope | null | undefined): string | null; +type Node$2 = estree.Node; + +declare function hasSideEffect(node: Node$1, sourceCode: SourceCode$1, options?: HasSideEffectOptions$1 | undefined): boolean; +type Node$1 = estree.Node; +type SourceCode$1 = eslint.SourceCode; + +declare function isArrowToken(token: CommentOrToken): token is ArrowToken$1; +declare function isCommaToken(token: CommentOrToken): token is CommaToken$1; +declare function isSemicolonToken(token: CommentOrToken): token is SemicolonToken$1; +declare function isColonToken(token: CommentOrToken): token is ColonToken$1; +declare function isOpeningParenToken(token: CommentOrToken): token is OpeningParenToken$1; +declare function isClosingParenToken(token: CommentOrToken): token is ClosingParenToken$1; +declare function isOpeningBracketToken(token: CommentOrToken): token is OpeningBracketToken$1; +declare function isClosingBracketToken(token: CommentOrToken): token is ClosingBracketToken$1; +declare function isOpeningBraceToken(token: CommentOrToken): token is OpeningBraceToken$1; +declare function isClosingBraceToken(token: CommentOrToken): token is ClosingBraceToken$1; +declare function isCommentToken(token: CommentOrToken): token is estree.Comment; +declare function isNotArrowToken(arg0: CommentOrToken): boolean; +declare function isNotCommaToken(arg0: CommentOrToken): boolean; +declare function isNotSemicolonToken(arg0: CommentOrToken): boolean; +declare function isNotColonToken(arg0: CommentOrToken): boolean; +declare function isNotOpeningParenToken(arg0: CommentOrToken): boolean; +declare function isNotClosingParenToken(arg0: CommentOrToken): boolean; +declare function isNotOpeningBracketToken(arg0: CommentOrToken): boolean; +declare function isNotClosingBracketToken(arg0: CommentOrToken): boolean; +declare function isNotOpeningBraceToken(arg0: CommentOrToken): boolean; +declare function isNotClosingBraceToken(arg0: CommentOrToken): boolean; +declare function isNotCommentToken(arg0: CommentOrToken): boolean; +type Token = eslint.AST.Token; +type Comment = estree.Comment; +type CommentOrToken = Comment | Token; + +declare function isParenthesized(timesOrNode: Node | number, nodeOrSourceCode: Node | SourceCode, optionalSourceCode?: eslint.SourceCode | undefined): boolean; +type Node = estree.Node; +type SourceCode = eslint.SourceCode; + +declare class PatternMatcher { + constructor(pattern: RegExp, options?: { + escaped?: boolean | undefined; + } | undefined); + execAll(str: string): IterableIterator; + test(str: string): boolean; + [Symbol.replace](str: string, replacer: string | ((...strs: string[]) => string)): string; +} + +declare namespace _default { + export { CALL }; + export { CONSTRUCT }; + export { ESM }; + export { findVariable }; + export { getFunctionHeadLocation }; + export { getFunctionNameWithKind }; + export { getInnermostScope }; + export { getPropertyName }; + export { getStaticValue }; + export { getStringIfConstant }; + export { hasSideEffect }; + export { isArrowToken }; + export { isClosingBraceToken }; + export { isClosingBracketToken }; + export { isClosingParenToken }; + export { isColonToken }; + export { isCommaToken }; + export { isCommentToken }; + export { isNotArrowToken }; + export { isNotClosingBraceToken }; + export { isNotClosingBracketToken }; + export { isNotClosingParenToken }; + export { isNotColonToken }; + export { isNotCommaToken }; + export { isNotCommentToken }; + export { isNotOpeningBraceToken }; + export { isNotOpeningBracketToken }; + export { isNotOpeningParenToken }; + export { isNotSemicolonToken }; + export { isOpeningBraceToken }; + export { isOpeningBracketToken }; + export { isOpeningParenToken }; + export { isParenthesized }; + export { isSemicolonToken }; + export { PatternMatcher }; + export { READ }; + export { ReferenceTracker }; +} + +type StaticValue = StaticValue$2; +type StaticValueOptional = StaticValueOptional$1; +type StaticValueProvided = StaticValueProvided$1; +type ReferenceTrackerOptions = ReferenceTrackerOptions$1; +type TraceMap = TraceMap$1; +type TrackedReferences = TrackedReferences$1; +type HasSideEffectOptions = HasSideEffectOptions$1; +type ArrowToken = ArrowToken$1; +type CommaToken = CommaToken$1; +type SemicolonToken = SemicolonToken$1; +type ColonToken = ColonToken$1; +type OpeningParenToken = OpeningParenToken$1; +type ClosingParenToken = ClosingParenToken$1; +type OpeningBracketToken = OpeningBracketToken$1; +type ClosingBracketToken = ClosingBracketToken$1; +type OpeningBraceToken = OpeningBraceToken$1; +type ClosingBraceToken = ClosingBraceToken$1; + +export { ArrowToken, CALL, CONSTRUCT, ClosingBraceToken, ClosingBracketToken, ClosingParenToken, ColonToken, CommaToken, ESM, HasSideEffectOptions, OpeningBraceToken, OpeningBracketToken, OpeningParenToken, PatternMatcher, READ, ReferenceTracker, ReferenceTrackerOptions, SemicolonToken, StaticValue, StaticValueOptional, StaticValueProvided, TraceMap, TrackedReferences, _default as default, findVariable, getFunctionHeadLocation, getFunctionNameWithKind, getInnermostScope, getPropertyName, getStaticValue, getStringIfConstant, hasSideEffect, isArrowToken, isClosingBraceToken, isClosingBracketToken, isClosingParenToken, isColonToken, isCommaToken, isCommentToken, isNotArrowToken, isNotClosingBraceToken, isNotClosingBracketToken, isNotClosingParenToken, isNotColonToken, isNotCommaToken, isNotCommentToken, isNotOpeningBraceToken, isNotOpeningBracketToken, isNotOpeningParenToken, isNotSemicolonToken, isOpeningBraceToken, isOpeningBracketToken, isOpeningParenToken, isParenthesized, isSemicolonToken }; diff --git a/node_modules/@eslint-community/eslint-utils/index.d.ts b/node_modules/@eslint-community/eslint-utils/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ad6f5c984aac374c5eb278237223b3f0d437b5f --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/index.d.ts @@ -0,0 +1,217 @@ +import * as eslint from 'eslint'; +import { Rule, AST } from 'eslint'; +import * as estree from 'estree'; + +declare const READ: unique symbol; +declare const CALL: unique symbol; +declare const CONSTRUCT: unique symbol; +declare const ESM: unique symbol; +declare class ReferenceTracker { + constructor(globalScope: Scope$2, options?: { + mode?: "legacy" | "strict" | undefined; + globalObjectNames?: string[] | undefined; + } | undefined); + private variableStack; + private globalScope; + private mode; + private globalObjectNames; + iterateGlobalReferences(traceMap: TraceMap$2): IterableIterator>; + iterateCjsReferences(traceMap: TraceMap$2): IterableIterator>; + iterateEsmReferences(traceMap: TraceMap$2): IterableIterator>; + iteratePropertyReferences(node: Expression, traceMap: TraceMap$2): IterableIterator>; + private _iterateVariableReferences; + private _iteratePropertyReferences; + private _iterateLhsReferences; + private _iterateImportReferences; +} +declare namespace ReferenceTracker { + export { READ }; + export { CALL }; + export { CONSTRUCT }; + export { ESM }; +} +type Scope$2 = eslint.Scope.Scope; +type Expression = estree.Expression; +type TraceMap$2 = TraceMap$1; +type TrackedReferences$2 = TrackedReferences$1; + +type StaticValue$2 = StaticValueProvided$1 | StaticValueOptional$1; +type StaticValueProvided$1 = { + optional?: undefined; + value: unknown; +}; +type StaticValueOptional$1 = { + optional?: true; + value: undefined; +}; +type ReferenceTrackerOptions$1 = { + globalObjectNames?: string[]; + mode?: "legacy" | "strict"; +}; +type TraceMap$1 = { + [i: string]: TraceMapObject; +}; +type TraceMapObject = { + [i: string]: TraceMapObject; + [CALL]?: T; + [CONSTRUCT]?: T; + [READ]?: T; + [ESM]?: boolean; +}; +type TrackedReferences$1 = { + info: T; + node: Rule.Node; + path: string[]; + type: typeof CALL | typeof CONSTRUCT | typeof READ; +}; +type HasSideEffectOptions$1 = { + considerGetters?: boolean; + considerImplicitTypeConversion?: boolean; +}; +type PunctuatorToken = AST.Token & { + type: "Punctuator"; + value: Value; +}; +type ArrowToken$1 = PunctuatorToken<"=>">; +type CommaToken$1 = PunctuatorToken<",">; +type SemicolonToken$1 = PunctuatorToken<";">; +type ColonToken$1 = PunctuatorToken<":">; +type OpeningParenToken$1 = PunctuatorToken<"(">; +type ClosingParenToken$1 = PunctuatorToken<")">; +type OpeningBracketToken$1 = PunctuatorToken<"[">; +type ClosingBracketToken$1 = PunctuatorToken<"]">; +type OpeningBraceToken$1 = PunctuatorToken<"{">; +type ClosingBraceToken$1 = PunctuatorToken<"}">; + +declare function findVariable(initialScope: Scope$1, nameOrNode: string | Identifier): Variable | null; +type Scope$1 = eslint.Scope.Scope; +type Variable = eslint.Scope.Variable; +type Identifier = estree.Identifier; + +declare function getFunctionHeadLocation(node: FunctionNode$1, sourceCode: SourceCode$2): SourceLocation | null; +type SourceCode$2 = eslint.SourceCode; +type FunctionNode$1 = estree.Function; +type SourceLocation = estree.SourceLocation; + +declare function getFunctionNameWithKind(node: FunctionNode, sourceCode?: eslint.SourceCode | undefined): string; +type FunctionNode = estree.Function; + +declare function getInnermostScope(initialScope: Scope, node: Node$4): Scope; +type Scope = eslint.Scope.Scope; +type Node$4 = estree.Node; + +declare function getPropertyName(node: MemberExpression | MethodDefinition | Property | PropertyDefinition, initialScope?: eslint.Scope.Scope | undefined): string | null | undefined; +type MemberExpression = estree.MemberExpression; +type MethodDefinition = estree.MethodDefinition; +type Property = estree.Property; +type PropertyDefinition = estree.PropertyDefinition; + +declare function getStaticValue(node: Node$3, initialScope?: eslint.Scope.Scope | null | undefined): StaticValue$1 | null; +type StaticValue$1 = StaticValue$2; +type Node$3 = estree.Node; + +declare function getStringIfConstant(node: Node$2, initialScope?: eslint.Scope.Scope | null | undefined): string | null; +type Node$2 = estree.Node; + +declare function hasSideEffect(node: Node$1, sourceCode: SourceCode$1, options?: HasSideEffectOptions$1 | undefined): boolean; +type Node$1 = estree.Node; +type SourceCode$1 = eslint.SourceCode; + +declare function isArrowToken(token: CommentOrToken): token is ArrowToken$1; +declare function isCommaToken(token: CommentOrToken): token is CommaToken$1; +declare function isSemicolonToken(token: CommentOrToken): token is SemicolonToken$1; +declare function isColonToken(token: CommentOrToken): token is ColonToken$1; +declare function isOpeningParenToken(token: CommentOrToken): token is OpeningParenToken$1; +declare function isClosingParenToken(token: CommentOrToken): token is ClosingParenToken$1; +declare function isOpeningBracketToken(token: CommentOrToken): token is OpeningBracketToken$1; +declare function isClosingBracketToken(token: CommentOrToken): token is ClosingBracketToken$1; +declare function isOpeningBraceToken(token: CommentOrToken): token is OpeningBraceToken$1; +declare function isClosingBraceToken(token: CommentOrToken): token is ClosingBraceToken$1; +declare function isCommentToken(token: CommentOrToken): token is estree.Comment; +declare function isNotArrowToken(arg0: CommentOrToken): boolean; +declare function isNotCommaToken(arg0: CommentOrToken): boolean; +declare function isNotSemicolonToken(arg0: CommentOrToken): boolean; +declare function isNotColonToken(arg0: CommentOrToken): boolean; +declare function isNotOpeningParenToken(arg0: CommentOrToken): boolean; +declare function isNotClosingParenToken(arg0: CommentOrToken): boolean; +declare function isNotOpeningBracketToken(arg0: CommentOrToken): boolean; +declare function isNotClosingBracketToken(arg0: CommentOrToken): boolean; +declare function isNotOpeningBraceToken(arg0: CommentOrToken): boolean; +declare function isNotClosingBraceToken(arg0: CommentOrToken): boolean; +declare function isNotCommentToken(arg0: CommentOrToken): boolean; +type Token = eslint.AST.Token; +type Comment = estree.Comment; +type CommentOrToken = Comment | Token; + +declare function isParenthesized(timesOrNode: Node | number, nodeOrSourceCode: Node | SourceCode, optionalSourceCode?: eslint.SourceCode | undefined): boolean; +type Node = estree.Node; +type SourceCode = eslint.SourceCode; + +declare class PatternMatcher { + constructor(pattern: RegExp, options?: { + escaped?: boolean | undefined; + } | undefined); + execAll(str: string): IterableIterator; + test(str: string): boolean; + [Symbol.replace](str: string, replacer: string | ((...strs: string[]) => string)): string; +} + +declare namespace _default { + export { CALL }; + export { CONSTRUCT }; + export { ESM }; + export { findVariable }; + export { getFunctionHeadLocation }; + export { getFunctionNameWithKind }; + export { getInnermostScope }; + export { getPropertyName }; + export { getStaticValue }; + export { getStringIfConstant }; + export { hasSideEffect }; + export { isArrowToken }; + export { isClosingBraceToken }; + export { isClosingBracketToken }; + export { isClosingParenToken }; + export { isColonToken }; + export { isCommaToken }; + export { isCommentToken }; + export { isNotArrowToken }; + export { isNotClosingBraceToken }; + export { isNotClosingBracketToken }; + export { isNotClosingParenToken }; + export { isNotColonToken }; + export { isNotCommaToken }; + export { isNotCommentToken }; + export { isNotOpeningBraceToken }; + export { isNotOpeningBracketToken }; + export { isNotOpeningParenToken }; + export { isNotSemicolonToken }; + export { isOpeningBraceToken }; + export { isOpeningBracketToken }; + export { isOpeningParenToken }; + export { isParenthesized }; + export { isSemicolonToken }; + export { PatternMatcher }; + export { READ }; + export { ReferenceTracker }; +} + +type StaticValue = StaticValue$2; +type StaticValueOptional = StaticValueOptional$1; +type StaticValueProvided = StaticValueProvided$1; +type ReferenceTrackerOptions = ReferenceTrackerOptions$1; +type TraceMap = TraceMap$1; +type TrackedReferences = TrackedReferences$1; +type HasSideEffectOptions = HasSideEffectOptions$1; +type ArrowToken = ArrowToken$1; +type CommaToken = CommaToken$1; +type SemicolonToken = SemicolonToken$1; +type ColonToken = ColonToken$1; +type OpeningParenToken = OpeningParenToken$1; +type ClosingParenToken = ClosingParenToken$1; +type OpeningBracketToken = OpeningBracketToken$1; +type ClosingBracketToken = ClosingBracketToken$1; +type OpeningBraceToken = OpeningBraceToken$1; +type ClosingBraceToken = ClosingBraceToken$1; + +export { ArrowToken, CALL, CONSTRUCT, ClosingBraceToken, ClosingBracketToken, ClosingParenToken, ColonToken, CommaToken, ESM, HasSideEffectOptions, OpeningBraceToken, OpeningBracketToken, OpeningParenToken, PatternMatcher, READ, ReferenceTracker, ReferenceTrackerOptions, SemicolonToken, StaticValue, StaticValueOptional, StaticValueProvided, TraceMap, TrackedReferences, _default as default, findVariable, getFunctionHeadLocation, getFunctionNameWithKind, getInnermostScope, getPropertyName, getStaticValue, getStringIfConstant, hasSideEffect, isArrowToken, isClosingBraceToken, isClosingBracketToken, isClosingParenToken, isColonToken, isCommaToken, isCommentToken, isNotArrowToken, isNotClosingBraceToken, isNotClosingBracketToken, isNotClosingParenToken, isNotColonToken, isNotCommaToken, isNotCommentToken, isNotOpeningBraceToken, isNotOpeningBracketToken, isNotOpeningParenToken, isNotSemicolonToken, isOpeningBraceToken, isOpeningBracketToken, isOpeningParenToken, isParenthesized, isSemicolonToken }; diff --git a/node_modules/@eslint-community/eslint-utils/index.js b/node_modules/@eslint-community/eslint-utils/index.js new file mode 100644 index 0000000000000000000000000000000000000000..9c8998f7a72a6182fb05352c671919a54024f3c8 --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/index.js @@ -0,0 +1,2620 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var eslintVisitorKeys = require('eslint-visitor-keys'); + +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("estree").Node} Node */ + +/** + * Get the innermost scope which contains a given location. + * @param {Scope} initialScope The initial scope to search. + * @param {Node} node The location to search. + * @returns {Scope} The innermost scope. + */ +function getInnermostScope(initialScope, node) { + const location = /** @type {[number, number]} */ (node.range)[0]; + + let scope = initialScope; + let found = false; + do { + found = false; + for (const childScope of scope.childScopes) { + const range = /** @type {[number, number]} */ ( + childScope.block.range + ); + + if (range[0] <= location && location < range[1]) { + scope = childScope; + found = true; + break + } + } + } while (found) + + return scope +} + +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("eslint").Scope.Variable} Variable */ +/** @typedef {import("estree").Identifier} Identifier */ + +/** + * Find the variable of a given name. + * @param {Scope} initialScope The scope to start finding. + * @param {string|Identifier} nameOrNode The variable name to find. If this is a Node object then it should be an Identifier node. + * @returns {Variable|null} The found variable or null. + */ +function findVariable(initialScope, nameOrNode) { + let name = ""; + /** @type {Scope|null} */ + let scope = initialScope; + + if (typeof nameOrNode === "string") { + name = nameOrNode; + } else { + name = nameOrNode.name; + scope = getInnermostScope(scope, nameOrNode); + } + + while (scope != null) { + const variable = scope.set.get(name); + if (variable != null) { + return variable + } + scope = scope.upper; + } + + return null +} + +/** @typedef {import("eslint").AST.Token} Token */ +/** @typedef {import("estree").Comment} Comment */ +/** @typedef {import("./types.mjs").ArrowToken} ArrowToken */ +/** @typedef {import("./types.mjs").CommaToken} CommaToken */ +/** @typedef {import("./types.mjs").SemicolonToken} SemicolonToken */ +/** @typedef {import("./types.mjs").ColonToken} ColonToken */ +/** @typedef {import("./types.mjs").OpeningParenToken} OpeningParenToken */ +/** @typedef {import("./types.mjs").ClosingParenToken} ClosingParenToken */ +/** @typedef {import("./types.mjs").OpeningBracketToken} OpeningBracketToken */ +/** @typedef {import("./types.mjs").ClosingBracketToken} ClosingBracketToken */ +/** @typedef {import("./types.mjs").OpeningBraceToken} OpeningBraceToken */ +/** @typedef {import("./types.mjs").ClosingBraceToken} ClosingBraceToken */ +/** + * @template {string} Value + * @typedef {import("./types.mjs").PunctuatorToken} PunctuatorToken + */ + +/** @typedef {Comment | Token} CommentOrToken */ + +/** + * Creates the negate function of the given function. + * @param {function(CommentOrToken):boolean} f - The function to negate. + * @returns {function(CommentOrToken):boolean} Negated function. + */ +function negate(f) { + return (token) => !f(token) +} + +/** + * Checks if the given token is a PunctuatorToken with the given value + * @template {string} Value + * @param {CommentOrToken} token - The token to check. + * @param {Value} value - The value to check. + * @returns {token is PunctuatorToken} `true` if the token is a PunctuatorToken with the given value. + */ +function isPunctuatorTokenWithValue(token, value) { + return token.type === "Punctuator" && token.value === value +} + +/** + * Checks if the given token is an arrow token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is ArrowToken} `true` if the token is an arrow token. + */ +function isArrowToken(token) { + return isPunctuatorTokenWithValue(token, "=>") +} + +/** + * Checks if the given token is a comma token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is CommaToken} `true` if the token is a comma token. + */ +function isCommaToken(token) { + return isPunctuatorTokenWithValue(token, ",") +} + +/** + * Checks if the given token is a semicolon token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is SemicolonToken} `true` if the token is a semicolon token. + */ +function isSemicolonToken(token) { + return isPunctuatorTokenWithValue(token, ";") +} + +/** + * Checks if the given token is a colon token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is ColonToken} `true` if the token is a colon token. + */ +function isColonToken(token) { + return isPunctuatorTokenWithValue(token, ":") +} + +/** + * Checks if the given token is an opening parenthesis token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is OpeningParenToken} `true` if the token is an opening parenthesis token. + */ +function isOpeningParenToken(token) { + return isPunctuatorTokenWithValue(token, "(") +} + +/** + * Checks if the given token is a closing parenthesis token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is ClosingParenToken} `true` if the token is a closing parenthesis token. + */ +function isClosingParenToken(token) { + return isPunctuatorTokenWithValue(token, ")") +} + +/** + * Checks if the given token is an opening square bracket token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is OpeningBracketToken} `true` if the token is an opening square bracket token. + */ +function isOpeningBracketToken(token) { + return isPunctuatorTokenWithValue(token, "[") +} + +/** + * Checks if the given token is a closing square bracket token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is ClosingBracketToken} `true` if the token is a closing square bracket token. + */ +function isClosingBracketToken(token) { + return isPunctuatorTokenWithValue(token, "]") +} + +/** + * Checks if the given token is an opening brace token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is OpeningBraceToken} `true` if the token is an opening brace token. + */ +function isOpeningBraceToken(token) { + return isPunctuatorTokenWithValue(token, "{") +} + +/** + * Checks if the given token is a closing brace token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is ClosingBraceToken} `true` if the token is a closing brace token. + */ +function isClosingBraceToken(token) { + return isPunctuatorTokenWithValue(token, "}") +} + +/** + * Checks if the given token is a comment token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is Comment} `true` if the token is a comment token. + */ +function isCommentToken(token) { + return ["Block", "Line", "Shebang"].includes(token.type) +} + +const isNotArrowToken = negate(isArrowToken); +const isNotCommaToken = negate(isCommaToken); +const isNotSemicolonToken = negate(isSemicolonToken); +const isNotColonToken = negate(isColonToken); +const isNotOpeningParenToken = negate(isOpeningParenToken); +const isNotClosingParenToken = negate(isClosingParenToken); +const isNotOpeningBracketToken = negate(isOpeningBracketToken); +const isNotClosingBracketToken = negate(isClosingBracketToken); +const isNotOpeningBraceToken = negate(isOpeningBraceToken); +const isNotClosingBraceToken = negate(isClosingBraceToken); +const isNotCommentToken = negate(isCommentToken); + +/** @typedef {import("eslint").Rule.Node} RuleNode */ +/** @typedef {import("eslint").SourceCode} SourceCode */ +/** @typedef {import("eslint").AST.Token} Token */ +/** @typedef {import("estree").Function} FunctionNode */ +/** @typedef {import("estree").FunctionDeclaration} FunctionDeclaration */ +/** @typedef {import("estree").FunctionExpression} FunctionExpression */ +/** @typedef {import("estree").SourceLocation} SourceLocation */ +/** @typedef {import("estree").Position} Position */ + +/** + * Get the `(` token of the given function node. + * @param {FunctionExpression | FunctionDeclaration} node - The function node to get. + * @param {SourceCode} sourceCode - The source code object to get tokens. + * @returns {Token} `(` token. + */ +function getOpeningParenOfParams(node, sourceCode) { + return node.id + ? /** @type {Token} */ ( + sourceCode.getTokenAfter(node.id, isOpeningParenToken) + ) + : /** @type {Token} */ ( + sourceCode.getFirstToken(node, isOpeningParenToken) + ) +} + +/** + * Get the location of the given function node for reporting. + * @param {FunctionNode} node - The function node to get. + * @param {SourceCode} sourceCode - The source code object to get tokens. + * @returns {SourceLocation|null} The location of the function node for reporting. + */ +function getFunctionHeadLocation(node, sourceCode) { + const parent = /** @type {RuleNode} */ (node).parent; + + /** @type {Position|null} */ + let start = null; + /** @type {Position|null} */ + let end = null; + + if (node.type === "ArrowFunctionExpression") { + const arrowToken = /** @type {Token} */ ( + sourceCode.getTokenBefore(node.body, isArrowToken) + ); + + start = arrowToken.loc.start; + end = arrowToken.loc.end; + } else if ( + parent && + (parent.type === "Property" || + parent.type === "MethodDefinition" || + parent.type === "PropertyDefinition") + ) { + start = /** @type {SourceLocation} */ (parent.loc).start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } else { + start = /** @type {SourceLocation} */ (node.loc).start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } + + return { + start: { ...start }, + end: { ...end }, + } +} + +/* globals globalThis, global, self, window */ +/** @typedef {import("./types.mjs").StaticValue} StaticValue */ +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("eslint").Scope.Variable} Variable */ +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("@typescript-eslint/types").TSESTree.Node} TSESTreeNode */ +/** @typedef {import("@typescript-eslint/types").TSESTree.AST_NODE_TYPES} TSESTreeNodeTypes */ +/** @typedef {import("@typescript-eslint/types").TSESTree.MemberExpression} MemberExpression */ +/** @typedef {import("@typescript-eslint/types").TSESTree.Property} Property */ +/** @typedef {import("@typescript-eslint/types").TSESTree.RegExpLiteral} RegExpLiteral */ +/** @typedef {import("@typescript-eslint/types").TSESTree.BigIntLiteral} BigIntLiteral */ +/** @typedef {import("@typescript-eslint/types").TSESTree.Literal} Literal */ + +const globalObject = + typeof globalThis !== "undefined" + ? globalThis + : // @ts-ignore + typeof self !== "undefined" + ? // @ts-ignore + self + : // @ts-ignore + typeof window !== "undefined" + ? // @ts-ignore + window + : typeof global !== "undefined" + ? global + : {}; + +const builtinNames = Object.freeze( + new Set([ + "Array", + "ArrayBuffer", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "Boolean", + "DataView", + "Date", + "decodeURI", + "decodeURIComponent", + "encodeURI", + "encodeURIComponent", + "escape", + "Float32Array", + "Float64Array", + "Function", + "Infinity", + "Int16Array", + "Int32Array", + "Int8Array", + "isFinite", + "isNaN", + "isPrototypeOf", + "JSON", + "Map", + "Math", + "NaN", + "Number", + "Object", + "parseFloat", + "parseInt", + "Promise", + "Proxy", + "Reflect", + "RegExp", + "Set", + "String", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "undefined", + "unescape", + "WeakMap", + "WeakSet", + ]), +); +const callAllowed = new Set( + [ + Array.isArray, + Array.of, + Array.prototype.at, + Array.prototype.concat, + Array.prototype.entries, + Array.prototype.every, + Array.prototype.filter, + Array.prototype.find, + Array.prototype.findIndex, + Array.prototype.flat, + Array.prototype.includes, + Array.prototype.indexOf, + Array.prototype.join, + Array.prototype.keys, + Array.prototype.lastIndexOf, + Array.prototype.slice, + Array.prototype.some, + Array.prototype.toString, + Array.prototype.values, + typeof BigInt === "function" ? BigInt : undefined, + Boolean, + Date, + Date.parse, + decodeURI, + decodeURIComponent, + encodeURI, + encodeURIComponent, + escape, + isFinite, + isNaN, + // @ts-ignore + isPrototypeOf, + Map, + Map.prototype.entries, + Map.prototype.get, + Map.prototype.has, + Map.prototype.keys, + Map.prototype.values, + .../** @type {(keyof typeof Math)[]} */ ( + Object.getOwnPropertyNames(Math) + ) + .filter((k) => k !== "random") + .map((k) => Math[k]) + .filter((f) => typeof f === "function"), + Number, + Number.isFinite, + Number.isNaN, + Number.parseFloat, + Number.parseInt, + Number.prototype.toExponential, + Number.prototype.toFixed, + Number.prototype.toPrecision, + Number.prototype.toString, + Object, + Object.entries, + Object.is, + Object.isExtensible, + Object.isFrozen, + Object.isSealed, + Object.keys, + Object.values, + parseFloat, + parseInt, + RegExp, + Set, + Set.prototype.entries, + Set.prototype.has, + Set.prototype.keys, + Set.prototype.values, + String, + String.fromCharCode, + String.fromCodePoint, + String.raw, + String.prototype.at, + String.prototype.charAt, + String.prototype.charCodeAt, + String.prototype.codePointAt, + String.prototype.concat, + String.prototype.endsWith, + String.prototype.includes, + String.prototype.indexOf, + String.prototype.lastIndexOf, + String.prototype.normalize, + String.prototype.padEnd, + String.prototype.padStart, + String.prototype.slice, + String.prototype.startsWith, + String.prototype.substr, + String.prototype.substring, + String.prototype.toLowerCase, + String.prototype.toString, + String.prototype.toUpperCase, + String.prototype.trim, + String.prototype.trimEnd, + String.prototype.trimLeft, + String.prototype.trimRight, + String.prototype.trimStart, + Symbol.for, + Symbol.keyFor, + unescape, + ].filter((f) => typeof f === "function"), +); +const callPassThrough = new Set([ + Object.freeze, + Object.preventExtensions, + Object.seal, +]); + +/** @type {ReadonlyArray]>} */ +const getterAllowed = [ + [Map, new Set(["size"])], + [ + RegExp, + new Set([ + "dotAll", + "flags", + "global", + "hasIndices", + "ignoreCase", + "multiline", + "source", + "sticky", + "unicode", + ]), + ], + [Set, new Set(["size"])], +]; + +/** + * Get the property descriptor. + * @param {object} object The object to get. + * @param {string|number|symbol} name The property name to get. + */ +function getPropertyDescriptor(object, name) { + let x = object; + while ((typeof x === "object" || typeof x === "function") && x !== null) { + const d = Object.getOwnPropertyDescriptor(x, name); + if (d) { + return d + } + x = Object.getPrototypeOf(x); + } + return null +} + +/** + * Check if a property is getter or not. + * @param {object} object The object to check. + * @param {string|number|symbol} name The property name to check. + */ +function isGetter(object, name) { + const d = getPropertyDescriptor(object, name); + return d != null && d.get != null +} + +/** + * Get the element values of a given node list. + * @param {(Node|TSESTreeNode|null)[]} nodeList The node list to get values. + * @param {Scope|undefined|null} initialScope The initial scope to find variables. + * @returns {any[]|null} The value list if all nodes are constant. Otherwise, null. + */ +function getElementValues(nodeList, initialScope) { + const valueList = []; + + for (let i = 0; i < nodeList.length; ++i) { + const elementNode = nodeList[i]; + + if (elementNode == null) { + valueList.length = i + 1; + } else if (elementNode.type === "SpreadElement") { + const argument = getStaticValueR(elementNode.argument, initialScope); + if (argument == null) { + return null + } + valueList.push(.../** @type {Iterable} */ (argument.value)); + } else { + const element = getStaticValueR(elementNode, initialScope); + if (element == null) { + return null + } + valueList.push(element.value); + } + } + + return valueList +} + +/** + * Checks if a variable is a built-in global. + * @param {Variable|null} variable The variable to check. + * @returns {variable is Variable & {defs:[]}} + */ +function isBuiltinGlobal(variable) { + return ( + variable != null && + variable.defs.length === 0 && + builtinNames.has(variable.name) && + variable.name in globalObject + ) +} + +/** + * Checks if a variable can be considered as a constant. + * @param {Variable} variable + * @returns {variable is Variable & {defs: [import("eslint").Scope.Definition & { type: "Variable" }]}} True if the variable can be considered as a constant. + */ +function canBeConsideredConst(variable) { + if (variable.defs.length !== 1) { + return false + } + const def = variable.defs[0]; + return Boolean( + def.parent && + def.type === "Variable" && + (def.parent.kind === "const" || isEffectivelyConst(variable)), + ) +} + +/** + * Returns whether the given variable is never written to after initialization. + * @param {Variable} variable + * @returns {boolean} + */ +function isEffectivelyConst(variable) { + const refs = variable.references; + + const inits = refs.filter((r) => r.init).length; + const reads = refs.filter((r) => r.isReadOnly()).length; + if (inits === 1 && reads + inits === refs.length) { + // there is only one init and all other references only read + return true + } + return false +} + +/** + * Checks if a variable has mutation in its property. + * @param {Variable} variable The variable to check. + * @param {Scope|null} initialScope The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it. + * @returns {boolean} True if the variable has mutation in its property. + */ +function hasMutationInProperty(variable, initialScope) { + for (const ref of variable.references) { + let node = /** @type {TSESTreeNode} */ (ref.identifier); + while (node && node.parent && node.parent.type === "MemberExpression") { + node = node.parent; + } + if (!node || !node.parent) { + continue + } + if ( + (node.parent.type === "AssignmentExpression" && + node.parent.left === node) || + (node.parent.type === "UpdateExpression" && + node.parent.argument === node) + ) { + // This is a mutation. + return true + } + if ( + node.parent.type === "CallExpression" && + node.parent.callee === node && + node.type === "MemberExpression" + ) { + const methodName = getStaticPropertyNameValue(node, initialScope); + if (isNameOfMutationArrayMethod(methodName)) { + // This is a mutation. + return true + } + } + } + return false + + /** + * Checks if a method name is one of the mutation array methods. + * @param {StaticValue|null} methodName The method name to check. + * @returns {boolean} True if the method name is a mutation array method. + */ + function isNameOfMutationArrayMethod(methodName) { + if (methodName == null || methodName.value == null) { + return false + } + const name = methodName.value; + return ( + name === "copyWithin" || + name === "fill" || + name === "pop" || + name === "push" || + name === "reverse" || + name === "shift" || + name === "sort" || + name === "splice" || + name === "unshift" + ) + } +} + +/** + * @template {TSESTreeNodeTypes} T + * @callback VisitorCallback + * @param {TSESTreeNode & { type: T }} node + * @param {Scope|undefined|null} initialScope + * @returns {StaticValue | null} + */ +/** + * @typedef { { [K in TSESTreeNodeTypes]?: VisitorCallback } } Operations + */ +/** + * @type {Operations} + */ +const operations = Object.freeze({ + ArrayExpression(node, initialScope) { + const elements = getElementValues(node.elements, initialScope); + return elements != null ? { value: elements } : null + }, + + AssignmentExpression(node, initialScope) { + if (node.operator === "=") { + return getStaticValueR(node.right, initialScope) + } + return null + }, + + //eslint-disable-next-line complexity + BinaryExpression(node, initialScope) { + if (node.operator === "in" || node.operator === "instanceof") { + // Not supported. + return null + } + + const left = getStaticValueR(node.left, initialScope); + const right = getStaticValueR(node.right, initialScope); + if (left != null && right != null) { + switch (node.operator) { + case "==": + return { value: left.value == right.value } //eslint-disable-line eqeqeq + case "!=": + return { value: left.value != right.value } //eslint-disable-line eqeqeq + case "===": + return { value: left.value === right.value } + case "!==": + return { value: left.value !== right.value } + case "<": + return { + value: + /** @type {any} */ (left.value) < + /** @type {any} */ (right.value), + } + case "<=": + return { + value: + /** @type {any} */ (left.value) <= + /** @type {any} */ (right.value), + } + case ">": + return { + value: + /** @type {any} */ (left.value) > + /** @type {any} */ (right.value), + } + case ">=": + return { + value: + /** @type {any} */ (left.value) >= + /** @type {any} */ (right.value), + } + case "<<": + return { + value: + /** @type {any} */ (left.value) << + /** @type {any} */ (right.value), + } + case ">>": + return { + value: + /** @type {any} */ (left.value) >> + /** @type {any} */ (right.value), + } + case ">>>": + return { + value: + /** @type {any} */ (left.value) >>> + /** @type {any} */ (right.value), + } + case "+": + return { + value: + /** @type {any} */ (left.value) + + /** @type {any} */ (right.value), + } + case "-": + return { + value: + /** @type {any} */ (left.value) - + /** @type {any} */ (right.value), + } + case "*": + return { + value: + /** @type {any} */ (left.value) * + /** @type {any} */ (right.value), + } + case "/": + return { + value: + /** @type {any} */ (left.value) / + /** @type {any} */ (right.value), + } + case "%": + return { + value: + /** @type {any} */ (left.value) % + /** @type {any} */ (right.value), + } + case "**": + return { + value: + /** @type {any} */ (left.value) ** + /** @type {any} */ (right.value), + } + case "|": + return { + value: + /** @type {any} */ (left.value) | + /** @type {any} */ (right.value), + } + case "^": + return { + value: + /** @type {any} */ (left.value) ^ + /** @type {any} */ (right.value), + } + case "&": + return { + value: + /** @type {any} */ (left.value) & + /** @type {any} */ (right.value), + } + + // no default + } + } + + return null + }, + + CallExpression(node, initialScope) { + const calleeNode = node.callee; + const args = getElementValues(node.arguments, initialScope); + + if (args != null) { + if (calleeNode.type === "MemberExpression") { + if (calleeNode.property.type === "PrivateIdentifier") { + return null + } + const object = getStaticValueR(calleeNode.object, initialScope); + if (object != null) { + if ( + object.value == null && + (object.optional || node.optional) + ) { + return { value: undefined, optional: true } + } + const property = getStaticPropertyNameValue( + calleeNode, + initialScope, + ); + + if (property != null) { + const receiver = + /** @type {Record any>} */ ( + object.value + ); + const methodName = /** @type {PropertyKey} */ ( + property.value + ); + if (callAllowed.has(receiver[methodName])) { + return { + value: receiver[methodName](...args), + } + } + if (callPassThrough.has(receiver[methodName])) { + return { value: args[0] } + } + } + } + } else { + const callee = getStaticValueR(calleeNode, initialScope); + if (callee != null) { + if (callee.value == null && node.optional) { + return { value: undefined, optional: true } + } + const func = /** @type {(...args: any[]) => any} */ ( + callee.value + ); + if (callAllowed.has(func)) { + return { value: func(...args) } + } + if (callPassThrough.has(func)) { + return { value: args[0] } + } + } + } + } + + return null + }, + + ConditionalExpression(node, initialScope) { + const test = getStaticValueR(node.test, initialScope); + if (test != null) { + return test.value + ? getStaticValueR(node.consequent, initialScope) + : getStaticValueR(node.alternate, initialScope) + } + return null + }, + + ExpressionStatement(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + + Identifier(node, initialScope) { + if (initialScope != null) { + const variable = findVariable(initialScope, node); + + if (variable != null) { + // Built-in globals. + if (isBuiltinGlobal(variable)) { + return { value: globalObject[variable.name] } + } + + // Constants. + if (canBeConsideredConst(variable)) { + const def = variable.defs[0]; + if ( + // TODO(mysticatea): don't support destructuring here. + def.node.id.type === "Identifier" + ) { + const init = getStaticValueR( + def.node.init, + initialScope, + ); + if ( + init && + typeof init.value === "object" && + init.value !== null + ) { + if (hasMutationInProperty(variable, initialScope)) { + // This variable has mutation in its property. + return null + } + } + return init + } + } + } + } + return null + }, + + Literal(node) { + const literal = + /** @type {Partial & Partial & Partial} */ ( + node + ); + //istanbul ignore if : this is implementation-specific behavior. + if ( + (literal.regex != null || literal.bigint != null) && + literal.value == null + ) { + // It was a RegExp/BigInt literal, but Node.js didn't support it. + return null + } + return { value: literal.value } + }, + + LogicalExpression(node, initialScope) { + const left = getStaticValueR(node.left, initialScope); + if (left != null) { + if ( + (node.operator === "||" && Boolean(left.value) === true) || + (node.operator === "&&" && Boolean(left.value) === false) || + (node.operator === "??" && left.value != null) + ) { + return left + } + + const right = getStaticValueR(node.right, initialScope); + if (right != null) { + return right + } + } + + return null + }, + + MemberExpression(node, initialScope) { + if (node.property.type === "PrivateIdentifier") { + return null + } + const object = getStaticValueR(node.object, initialScope); + if (object != null) { + if (object.value == null && (object.optional || node.optional)) { + return { value: undefined, optional: true } + } + const property = getStaticPropertyNameValue(node, initialScope); + + if (property != null) { + if ( + !isGetter( + /** @type {object} */ (object.value), + /** @type {PropertyKey} */ (property.value), + ) + ) { + return { + value: /** @type {Record} */ ( + object.value + )[/** @type {PropertyKey} */ (property.value)], + } + } + + for (const [classFn, allowed] of getterAllowed) { + if ( + object.value instanceof classFn && + allowed.has(/** @type {string} */ (property.value)) + ) { + return { + value: /** @type {Record} */ ( + object.value + )[/** @type {PropertyKey} */ (property.value)], + } + } + } + } + } + return null + }, + + ChainExpression(node, initialScope) { + const expression = getStaticValueR(node.expression, initialScope); + if (expression != null) { + return { value: expression.value } + } + return null + }, + + NewExpression(node, initialScope) { + const callee = getStaticValueR(node.callee, initialScope); + const args = getElementValues(node.arguments, initialScope); + + if (callee != null && args != null) { + const Func = /** @type {new (...args: any[]) => any} */ ( + callee.value + ); + if (callAllowed.has(Func)) { + return { value: new Func(...args) } + } + } + + return null + }, + + ObjectExpression(node, initialScope) { + /** @type {Record} */ + const object = {}; + + for (const propertyNode of node.properties) { + if (propertyNode.type === "Property") { + if (propertyNode.kind !== "init") { + return null + } + const key = getStaticPropertyNameValue( + propertyNode, + initialScope, + ); + const value = getStaticValueR(propertyNode.value, initialScope); + if (key == null || value == null) { + return null + } + object[/** @type {PropertyKey} */ (key.value)] = value.value; + } else if ( + propertyNode.type === "SpreadElement" || + // @ts-expect-error -- Backward compatibility + propertyNode.type === "ExperimentalSpreadProperty" + ) { + const argument = getStaticValueR( + propertyNode.argument, + initialScope, + ); + if (argument == null) { + return null + } + Object.assign(object, argument.value); + } else { + return null + } + } + + return { value: object } + }, + + SequenceExpression(node, initialScope) { + const last = node.expressions[node.expressions.length - 1]; + return getStaticValueR(last, initialScope) + }, + + TaggedTemplateExpression(node, initialScope) { + const tag = getStaticValueR(node.tag, initialScope); + const expressions = getElementValues( + node.quasi.expressions, + initialScope, + ); + + if (tag != null && expressions != null) { + const func = /** @type {(...args: any[]) => any} */ (tag.value); + /** @type {any[] & { raw?: string[] }} */ + const strings = node.quasi.quasis.map((q) => q.value.cooked); + strings.raw = node.quasi.quasis.map((q) => q.value.raw); + + if (func === String.raw) { + return { value: func(strings, ...expressions) } + } + } + + return null + }, + + TemplateLiteral(node, initialScope) { + const expressions = getElementValues(node.expressions, initialScope); + if (expressions != null) { + let value = node.quasis[0].value.cooked; + for (let i = 0; i < expressions.length; ++i) { + value += expressions[i]; + value += /** @type {string} */ (node.quasis[i + 1].value.cooked); + } + return { value } + } + return null + }, + + UnaryExpression(node, initialScope) { + if (node.operator === "delete") { + // Not supported. + return null + } + if (node.operator === "void") { + return { value: undefined } + } + + const arg = getStaticValueR(node.argument, initialScope); + if (arg != null) { + switch (node.operator) { + case "-": + return { value: -(/** @type {any} */ (arg.value)) } + case "+": + return { value: +(/** @type {any} */ (arg.value)) } //eslint-disable-line no-implicit-coercion + case "!": + return { value: !arg.value } + case "~": + return { value: ~(/** @type {any} */ (arg.value)) } + case "typeof": + return { value: typeof arg.value } + + // no default + } + } + + return null + }, + TSAsExpression(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + TSSatisfiesExpression(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + TSTypeAssertion(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + TSNonNullExpression(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + TSInstantiationExpression(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, +}); + +/** + * Get the value of a given node if it's a static value. + * @param {Node|TSESTreeNode|null|undefined} node The node to get. + * @param {Scope|undefined|null} initialScope The scope to start finding variable. + * @returns {StaticValue|null} The static value of the node, or `null`. + */ +function getStaticValueR(node, initialScope) { + if (node != null && Object.hasOwnProperty.call(operations, node.type)) { + return /** @type {VisitorCallback} */ (operations[node.type])( + /** @type {TSESTreeNode} */ (node), + initialScope, + ) + } + return null +} + +/** + * Get the static value of property name from a MemberExpression node or a Property node. + * @param {MemberExpression|Property} node The node to get. + * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it. + * @returns {StaticValue|null} The static value of the property name of the node, or `null`. + */ +function getStaticPropertyNameValue(node, initialScope) { + const nameNode = node.type === "Property" ? node.key : node.property; + + if (node.computed) { + return getStaticValueR(nameNode, initialScope) + } + + if (nameNode.type === "Identifier") { + return { value: nameNode.name } + } + + if (nameNode.type === "Literal") { + if (/** @type {Partial} */ (nameNode).bigint) { + return { value: /** @type {BigIntLiteral} */ (nameNode).bigint } + } + return { value: String(nameNode.value) } + } + + return null +} + +/** + * Get the value of a given node if it's a static value. + * @param {Node} node The node to get. + * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If this scope was given, this tries to resolve identifier references which are in the given node as much as possible. + * @returns {StaticValue | null} The static value of the node, or `null`. + */ +function getStaticValue(node, initialScope = null) { + try { + return getStaticValueR(node, initialScope) + } catch (_error) { + return null + } +} + +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("estree").RegExpLiteral} RegExpLiteral */ +/** @typedef {import("estree").BigIntLiteral} BigIntLiteral */ +/** @typedef {import("estree").SimpleLiteral} SimpleLiteral */ + +/** + * Get the value of a given node if it's a literal or a template literal. + * @param {Node} node The node to get. + * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If the node is an Identifier node and this scope was given, this checks the variable of the identifier, and returns the value of it if the variable is a constant. + * @returns {string|null} The value of the node, or `null`. + */ +function getStringIfConstant(node, initialScope = null) { + // Handle the literals that the platform doesn't support natively. + if (node && node.type === "Literal" && node.value === null) { + const literal = + /** @type {Partial & Partial & Partial} */ ( + node + ); + if (literal.regex) { + return `/${literal.regex.pattern}/${literal.regex.flags}` + } + if (literal.bigint) { + return literal.bigint + } + } + + const evaluated = getStaticValue(node, initialScope); + + if (evaluated) { + // `String(Symbol.prototype)` throws error + try { + return String(evaluated.value) + } catch { + // No op + } + } + + return null +} + +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("estree").MemberExpression} MemberExpression */ +/** @typedef {import("estree").MethodDefinition} MethodDefinition */ +/** @typedef {import("estree").Property} Property */ +/** @typedef {import("estree").PropertyDefinition} PropertyDefinition */ +/** @typedef {import("estree").Identifier} Identifier */ + +/** + * Get the property name from a MemberExpression node or a Property node. + * @param {MemberExpression | MethodDefinition | Property | PropertyDefinition} node The node to get. + * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it. + * @returns {string|null|undefined} The property name of the node. + */ +function getPropertyName(node, initialScope) { + switch (node.type) { + case "MemberExpression": + if (node.computed) { + return getStringIfConstant(node.property, initialScope) + } + if (node.property.type === "PrivateIdentifier") { + return null + } + return /** @type {Partial} */ (node.property).name + + case "Property": + case "MethodDefinition": + case "PropertyDefinition": + if (node.computed) { + return getStringIfConstant(node.key, initialScope) + } + if (node.key.type === "Literal") { + return String(node.key.value) + } + if (node.key.type === "PrivateIdentifier") { + return null + } + return /** @type {Partial} */ (node.key).name + } + + return null +} + +/** @typedef {import("eslint").Rule.Node} RuleNode */ +/** @typedef {import("eslint").SourceCode} SourceCode */ +/** @typedef {import("estree").Function} FunctionNode */ +/** @typedef {import("estree").FunctionDeclaration} FunctionDeclaration */ +/** @typedef {import("estree").FunctionExpression} FunctionExpression */ +/** @typedef {import("estree").Identifier} Identifier */ + +/** + * Get the name and kind of the given function node. + * @param {FunctionNode} node - The function node to get. + * @param {SourceCode} [sourceCode] The source code object to get the code of computed property keys. + * @returns {string} The name and kind of the function node. + */ +// eslint-disable-next-line complexity +function getFunctionNameWithKind(node, sourceCode) { + const parent = /** @type {RuleNode} */ (node).parent; + + if (!parent) { + return "" + } + + const tokens = []; + const isObjectMethod = parent.type === "Property" && parent.value === node; + const isClassMethod = + parent.type === "MethodDefinition" && parent.value === node; + const isClassFieldMethod = + parent.type === "PropertyDefinition" && parent.value === node; + + // Modifiers. + if (isClassMethod || isClassFieldMethod) { + if (parent.static) { + tokens.push("static"); + } + if (parent.key.type === "PrivateIdentifier") { + tokens.push("private"); + } + } + if (node.async) { + tokens.push("async"); + } + if (node.generator) { + tokens.push("generator"); + } + + // Kinds. + if (isObjectMethod || isClassMethod) { + if (parent.kind === "constructor") { + return "constructor" + } + if (parent.kind === "get") { + tokens.push("getter"); + } else if (parent.kind === "set") { + tokens.push("setter"); + } else { + tokens.push("method"); + } + } else if (isClassFieldMethod) { + tokens.push("method"); + } else { + if (node.type === "ArrowFunctionExpression") { + tokens.push("arrow"); + } + tokens.push("function"); + } + + // Names. + if (isObjectMethod || isClassMethod || isClassFieldMethod) { + if (parent.key.type === "PrivateIdentifier") { + tokens.push(`#${parent.key.name}`); + } else { + const name = getPropertyName(parent); + if (name) { + tokens.push(`'${name}'`); + } else if (sourceCode) { + const keyText = sourceCode.getText(parent.key); + if (!keyText.includes("\n")) { + tokens.push(`[${keyText}]`); + } + } + } + } else if (hasId(node)) { + tokens.push(`'${node.id.name}'`); + } else if ( + parent.type === "VariableDeclarator" && + parent.id && + parent.id.type === "Identifier" + ) { + tokens.push(`'${parent.id.name}'`); + } else if ( + (parent.type === "AssignmentExpression" || + parent.type === "AssignmentPattern") && + parent.left && + parent.left.type === "Identifier" + ) { + tokens.push(`'${parent.left.name}'`); + } else if ( + parent.type === "ExportDefaultDeclaration" && + parent.declaration === node + ) { + tokens.push("'default'"); + } + + return tokens.join(" ") +} + +/** + * @param {FunctionNode} node + * @returns {node is FunctionDeclaration | FunctionExpression & { id: Identifier }} + */ +function hasId(node) { + return Boolean( + /** @type {Partial} */ (node) + .id, + ) +} + +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("eslint").SourceCode} SourceCode */ +/** @typedef {import("./types.mjs").HasSideEffectOptions} HasSideEffectOptions */ +/** @typedef {import("estree").BinaryExpression} BinaryExpression */ +/** @typedef {import("estree").MemberExpression} MemberExpression */ +/** @typedef {import("estree").MethodDefinition} MethodDefinition */ +/** @typedef {import("estree").Property} Property */ +/** @typedef {import("estree").PropertyDefinition} PropertyDefinition */ +/** @typedef {import("estree").UnaryExpression} UnaryExpression */ + +const typeConversionBinaryOps = Object.freeze( + new Set([ + "==", + "!=", + "<", + "<=", + ">", + ">=", + "<<", + ">>", + ">>>", + "+", + "-", + "*", + "/", + "%", + "|", + "^", + "&", + "in", + ]), +); +const typeConversionUnaryOps = Object.freeze(new Set(["-", "+", "!", "~"])); + +/** + * Check whether the given value is an ASTNode or not. + * @param {any} x The value to check. + * @returns {x is Node} `true` if the value is an ASTNode. + */ +function isNode(x) { + return x !== null && typeof x === "object" && typeof x.type === "string" +} + +const visitor = Object.freeze( + Object.assign(Object.create(null), { + /** + * @param {Node} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + $visit(node, options, visitorKeys) { + const { type } = node; + + if (typeof (/** @type {any} */ (this)[type]) === "function") { + return /** @type {any} */ (this)[type]( + node, + options, + visitorKeys, + ) + } + + return this.$visitChildren(node, options, visitorKeys) + }, + + /** + * @param {Node} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + $visitChildren(node, options, visitorKeys) { + const { type } = node; + + for (const key of /** @type {(keyof Node)[]} */ ( + visitorKeys[type] || eslintVisitorKeys.getKeys(node) + )) { + const value = node[key]; + + if (Array.isArray(value)) { + for (const element of value) { + if ( + isNode(element) && + this.$visit(element, options, visitorKeys) + ) { + return true + } + } + } else if ( + isNode(value) && + this.$visit(value, options, visitorKeys) + ) { + return true + } + } + + return false + }, + + ArrowFunctionExpression() { + return false + }, + AssignmentExpression() { + return true + }, + AwaitExpression() { + return true + }, + /** + * @param {BinaryExpression} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + BinaryExpression(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + typeConversionBinaryOps.has(node.operator) && + (node.left.type !== "Literal" || node.right.type !== "Literal") + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + CallExpression() { + return true + }, + FunctionExpression() { + return false + }, + ImportExpression() { + return true + }, + /** + * @param {MemberExpression} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + MemberExpression(node, options, visitorKeys) { + if (options.considerGetters) { + return true + } + if ( + options.considerImplicitTypeConversion && + node.computed && + node.property.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + /** + * @param {MethodDefinition} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + MethodDefinition(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + NewExpression() { + return true + }, + /** + * @param {Property} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + Property(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + /** + * @param {PropertyDefinition} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + PropertyDefinition(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + /** + * @param {UnaryExpression} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + UnaryExpression(node, options, visitorKeys) { + if (node.operator === "delete") { + return true + } + if ( + options.considerImplicitTypeConversion && + typeConversionUnaryOps.has(node.operator) && + node.argument.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + UpdateExpression() { + return true + }, + YieldExpression() { + return true + }, + }), +); + +/** + * Check whether a given node has any side effect or not. + * @param {Node} node The node to get. + * @param {SourceCode} sourceCode The source code object. + * @param {HasSideEffectOptions} [options] The option object. + * @returns {boolean} `true` if the node has a certain side effect. + */ +function hasSideEffect(node, sourceCode, options = {}) { + const { considerGetters = false, considerImplicitTypeConversion = false } = + options; + return visitor.$visit( + node, + { considerGetters, considerImplicitTypeConversion }, + sourceCode.visitorKeys || eslintVisitorKeys.KEYS, + ) +} + +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("@typescript-eslint/types").TSESTree.NewExpression} TSNewExpression */ +/** @typedef {import("@typescript-eslint/types").TSESTree.CallExpression} TSCallExpression */ +/** @typedef {import("eslint").SourceCode} SourceCode */ +/** @typedef {import("eslint").AST.Token} Token */ +/** @typedef {import("eslint").Rule.Node} RuleNode */ + +/** + * Get the left parenthesis of the parent node syntax if it exists. + * E.g., `if (a) {}` then the `(`. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {Token|null} The left parenthesis of the parent node syntax + */ +// eslint-disable-next-line complexity +function getParentSyntaxParen(node, sourceCode) { + const parent = /** @type {RuleNode} */ (node).parent; + + if (!parent) { + return null + } + + switch (parent.type) { + case "CallExpression": + case "NewExpression": + if (parent.arguments.length === 1 && parent.arguments[0] === node) { + return sourceCode.getTokenAfter( + // @ts-expect-error https://github.com/typescript-eslint/typescript-eslint/pull/5384 + parent.typeArguments || + /** @type {RuleNode} */ ( + /** @type {unknown} */ ( + /** @type {TSNewExpression | TSCallExpression} */ ( + parent + ).typeParameters + ) + ) || + parent.callee, + isOpeningParenToken, + ) + } + return null + + case "DoWhileStatement": + if (parent.test === node) { + return sourceCode.getTokenAfter( + parent.body, + isOpeningParenToken, + ) + } + return null + + case "IfStatement": + case "WhileStatement": + if (parent.test === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "ImportExpression": + if (parent.source === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "SwitchStatement": + if (parent.discriminant === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "WithStatement": + if (parent.object === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + default: + return null + } +} + +/** + * Check whether a given node is parenthesized or not. + * @param {number} times The number of parantheses. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {boolean} `true` if the node is parenthesized the given times. + */ +/** + * Check whether a given node is parenthesized or not. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {boolean} `true` if the node is parenthesized. + */ +/** + * Check whether a given node is parenthesized or not. + * @param {Node|number} timesOrNode The first parameter. + * @param {Node|SourceCode} nodeOrSourceCode The second parameter. + * @param {SourceCode} [optionalSourceCode] The third parameter. + * @returns {boolean} `true` if the node is parenthesized. + */ +function isParenthesized( + timesOrNode, + nodeOrSourceCode, + optionalSourceCode, +) { + /** @type {number} */ + let times, + /** @type {RuleNode} */ + node, + /** @type {SourceCode} */ + sourceCode, + maybeLeftParen, + maybeRightParen; + if (typeof timesOrNode === "number") { + times = timesOrNode | 0; + node = /** @type {RuleNode} */ (nodeOrSourceCode); + sourceCode = /** @type {SourceCode} */ (optionalSourceCode); + if (!(times >= 1)) { + throw new TypeError("'times' should be a positive integer.") + } + } else { + times = 1; + node = /** @type {RuleNode} */ (timesOrNode); + sourceCode = /** @type {SourceCode} */ (nodeOrSourceCode); + } + + if ( + node == null || + // `Program` can't be parenthesized + node.parent == null || + // `CatchClause.param` can't be parenthesized, example `try {} catch (error) {}` + (node.parent.type === "CatchClause" && node.parent.param === node) + ) { + return false + } + + maybeLeftParen = maybeRightParen = node; + do { + maybeLeftParen = sourceCode.getTokenBefore(maybeLeftParen); + maybeRightParen = sourceCode.getTokenAfter(maybeRightParen); + } while ( + maybeLeftParen != null && + maybeRightParen != null && + isOpeningParenToken(maybeLeftParen) && + isClosingParenToken(maybeRightParen) && + // Avoid false positive such as `if (a) {}` + maybeLeftParen !== getParentSyntaxParen(node, sourceCode) && + --times > 0 + ) + + return times === 0 +} + +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ + +const placeholder = /\$(?:[$&`']|[1-9][0-9]?)/gu; + +/** @type {WeakMap} */ +const internal = new WeakMap(); + +/** + * Check whether a given character is escaped or not. + * @param {string} str The string to check. + * @param {number} index The location of the character to check. + * @returns {boolean} `true` if the character is escaped. + */ +function isEscaped(str, index) { + let escaped = false; + for (let i = index - 1; i >= 0 && str.charCodeAt(i) === 0x5c; --i) { + escaped = !escaped; + } + return escaped +} + +/** + * Replace a given string by a given matcher. + * @param {PatternMatcher} matcher The pattern matcher. + * @param {string} str The string to be replaced. + * @param {string} replacement The new substring to replace each matched part. + * @returns {string} The replaced string. + */ +function replaceS(matcher, str, replacement) { + const chunks = []; + let index = 0; + + /** + * @param {string} key The placeholder. + * @param {RegExpExecArray} match The matched information. + * @returns {string} The replaced string. + */ + function replacer(key, match) { + switch (key) { + case "$$": + return "$" + case "$&": + return match[0] + case "$`": + return str.slice(0, match.index) + case "$'": + return str.slice(match.index + match[0].length) + default: { + const i = key.slice(1); + if (i in match) { + return match[/** @type {any} */ (i)] + } + return key + } + } + } + + for (const match of matcher.execAll(str)) { + chunks.push(str.slice(index, match.index)); + chunks.push( + replacement.replace(placeholder, (key) => replacer(key, match)), + ); + index = match.index + match[0].length; + } + chunks.push(str.slice(index)); + + return chunks.join("") +} + +/** + * Replace a given string by a given matcher. + * @param {PatternMatcher} matcher The pattern matcher. + * @param {string} str The string to be replaced. + * @param {(substring: string, ...args: any[]) => string} replace The function to replace each matched part. + * @returns {string} The replaced string. + */ +function replaceF(matcher, str, replace) { + const chunks = []; + let index = 0; + + for (const match of matcher.execAll(str)) { + chunks.push(str.slice(index, match.index)); + chunks.push( + String( + replace( + .../** @type {[string, ...string[]]} */ ( + /** @type {string[]} */ (match) + ), + match.index, + match.input, + ), + ), + ); + index = match.index + match[0].length; + } + chunks.push(str.slice(index)); + + return chunks.join("") +} + +/** + * The class to find patterns as considering escape sequences. + */ +class PatternMatcher { + /** + * Initialize this matcher. + * @param {RegExp} pattern The pattern to match. + * @param {{escaped?:boolean}} [options] The options. + */ + constructor(pattern, options = {}) { + const { escaped = false } = options; + if (!(pattern instanceof RegExp)) { + throw new TypeError("'pattern' should be a RegExp instance.") + } + if (!pattern.flags.includes("g")) { + throw new Error("'pattern' should contains 'g' flag.") + } + + internal.set(this, { + pattern: new RegExp(pattern.source, pattern.flags), + escaped: Boolean(escaped), + }); + } + + /** + * Find the pattern in a given string. + * @param {string} str The string to find. + * @returns {IterableIterator} The iterator which iterate the matched information. + */ + *execAll(str) { + const { pattern, escaped } = + /** @type {{pattern:RegExp,escaped:boolean}} */ (internal.get(this)); + let match = null; + let lastIndex = 0; + + pattern.lastIndex = 0; + while ((match = pattern.exec(str)) != null) { + if (escaped || !isEscaped(str, match.index)) { + lastIndex = pattern.lastIndex; + yield match; + pattern.lastIndex = lastIndex; + } + } + } + + /** + * Check whether the pattern is found in a given string. + * @param {string} str The string to check. + * @returns {boolean} `true` if the pattern was found in the string. + */ + test(str) { + const it = this.execAll(str); + const ret = it.next(); + return !ret.done + } + + /** + * Replace a given string. + * @param {string} str The string to be replaced. + * @param {(string|((...strs:string[])=>string))} replacer The string or function to replace. This is the same as the 2nd argument of `String.prototype.replace`. + * @returns {string} The replaced string. + */ + [Symbol.replace](str, replacer) { + return typeof replacer === "function" + ? replaceF(this, String(str), replacer) + : replaceS(this, String(str), String(replacer)) + } +} + +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("eslint").Scope.Variable} Variable */ +/** @typedef {import("eslint").Rule.Node} RuleNode */ +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("estree").Expression} Expression */ +/** @typedef {import("estree").Pattern} Pattern */ +/** @typedef {import("estree").Identifier} Identifier */ +/** @typedef {import("estree").SimpleCallExpression} CallExpression */ +/** @typedef {import("estree").Program} Program */ +/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */ +/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclaration */ +/** @typedef {import("estree").ExportDefaultDeclaration} ExportDefaultDeclaration */ +/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */ +/** @typedef {import("estree").ImportSpecifier} ImportSpecifier */ +/** @typedef {import("estree").ImportDefaultSpecifier} ImportDefaultSpecifier */ +/** @typedef {import("estree").ImportNamespaceSpecifier} ImportNamespaceSpecifier */ +/** @typedef {import("estree").ExportSpecifier} ExportSpecifier */ +/** @typedef {import("estree").Property} Property */ +/** @typedef {import("estree").AssignmentProperty} AssignmentProperty */ +/** @typedef {import("estree").Literal} Literal */ +/** @typedef {import("@typescript-eslint/types").TSESTree.Node} TSESTreeNode */ +/** @typedef {import("./types.mjs").ReferenceTrackerOptions} ReferenceTrackerOptions */ +/** + * @template T + * @typedef {import("./types.mjs").TraceMap} TraceMap + */ +/** + * @template T + * @typedef {import("./types.mjs").TraceMapObject} TraceMapObject + */ +/** + * @template T + * @typedef {import("./types.mjs").TrackedReferences} TrackedReferences + */ + +const IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u; + +/** + * Check whether a given node is an import node or not. + * @param {Node} node + * @returns {node is ImportDeclaration|ExportAllDeclaration|ExportNamedDeclaration&{source: Literal}} `true` if the node is an import node. + */ +function isHasSource(node) { + return ( + IMPORT_TYPE.test(node.type) && + /** @type {ImportDeclaration|ExportAllDeclaration|ExportNamedDeclaration} */ ( + node + ).source != null + ) +} +const has = + /** @type {(traceMap: TraceMap, v: T) => v is (string extends T ? string : T)} */ ( + Function.call.bind(Object.hasOwnProperty) + ); + +const READ = Symbol("read"); +const CALL = Symbol("call"); +const CONSTRUCT = Symbol("construct"); +const ESM = Symbol("esm"); + +const requireCall = { require: { [CALL]: true } }; + +/** + * Check whether a given variable is modified or not. + * @param {Variable|undefined} variable The variable to check. + * @returns {boolean} `true` if the variable is modified. + */ +function isModifiedGlobal(variable) { + return ( + variable == null || + variable.defs.length !== 0 || + variable.references.some((r) => r.isWrite()) + ) +} + +/** + * Check if the value of a given node is passed through to the parent syntax as-is. + * For example, `a` and `b` in (`a || b` and `c ? a : b`) are passed through. + * @param {Node} node A node to check. + * @returns {node is RuleNode & {parent: Expression}} `true` if the node is passed through. + */ +function isPassThrough(node) { + const parent = /** @type {TSESTreeNode} */ (node).parent; + + if (parent) { + switch (parent.type) { + case "ConditionalExpression": + return parent.consequent === node || parent.alternate === node + case "LogicalExpression": + return true + case "SequenceExpression": + return ( + parent.expressions[parent.expressions.length - 1] === node + ) + case "ChainExpression": + return true + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSTypeAssertion": + case "TSNonNullExpression": + case "TSInstantiationExpression": + return true + + default: + return false + } + } + return false +} + +/** + * The reference tracker. + */ +class ReferenceTracker { + /** + * Initialize this tracker. + * @param {Scope} globalScope The global scope. + * @param {object} [options] The options. + * @param {"legacy"|"strict"} [options.mode="strict"] The mode to determine the ImportDeclaration's behavior for CJS modules. + * @param {string[]} [options.globalObjectNames=["global","globalThis","self","window"]] The variable names for Global Object. + */ + constructor(globalScope, options = {}) { + const { + mode = "strict", + globalObjectNames = ["global", "globalThis", "self", "window"], + } = options; + /** @private @type {Variable[]} */ + this.variableStack = []; + /** @private */ + this.globalScope = globalScope; + /** @private */ + this.mode = mode; + /** @private */ + this.globalObjectNames = globalObjectNames.slice(0); + } + + /** + * Iterate the references of global variables. + * @template T + * @param {TraceMap} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *iterateGlobalReferences(traceMap) { + for (const key of Object.keys(traceMap)) { + const nextTraceMap = traceMap[key]; + const path = [key]; + const variable = this.globalScope.set.get(key); + + if (isModifiedGlobal(variable)) { + continue + } + + yield* this._iterateVariableReferences( + /** @type {Variable} */ (variable), + path, + nextTraceMap, + true, + ); + } + + for (const key of this.globalObjectNames) { + /** @type {string[]} */ + const path = []; + const variable = this.globalScope.set.get(key); + + if (isModifiedGlobal(variable)) { + continue + } + + yield* this._iterateVariableReferences( + /** @type {Variable} */ (variable), + path, + traceMap, + false, + ); + } + } + + /** + * Iterate the references of CommonJS modules. + * @template T + * @param {TraceMap} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *iterateCjsReferences(traceMap) { + for (const { node } of this.iterateGlobalReferences(requireCall)) { + const key = getStringIfConstant( + /** @type {CallExpression} */ (node).arguments[0], + ); + if (key == null || !has(traceMap, key)) { + continue + } + + const nextTraceMap = traceMap[key]; + const path = [key]; + + if (nextTraceMap[READ]) { + yield { + node, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iteratePropertyReferences( + /** @type {CallExpression} */ (node), + path, + nextTraceMap, + ); + } + } + + /** + * Iterate the references of ES modules. + * @template T + * @param {TraceMap} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *iterateEsmReferences(traceMap) { + const programNode = /** @type {Program} */ (this.globalScope.block); + + for (const node of programNode.body) { + if (!isHasSource(node)) { + continue + } + const moduleId = /** @type {string} */ (node.source.value); + + if (!has(traceMap, moduleId)) { + continue + } + const nextTraceMap = traceMap[moduleId]; + const path = [moduleId]; + + if (nextTraceMap[READ]) { + yield { + // eslint-disable-next-line object-shorthand -- apply type + node: /** @type {RuleNode} */ (node), + path, + type: READ, + info: nextTraceMap[READ], + }; + } + + if (node.type === "ExportAllDeclaration") { + for (const key of Object.keys(nextTraceMap)) { + const exportTraceMap = nextTraceMap[key]; + if (exportTraceMap[READ]) { + yield { + // eslint-disable-next-line object-shorthand -- apply type + node: /** @type {RuleNode} */ (node), + path: path.concat(key), + type: READ, + info: exportTraceMap[READ], + }; + } + } + } else { + for (const specifier of node.specifiers) { + const esm = has(nextTraceMap, ESM); + const it = this._iterateImportReferences( + specifier, + path, + esm + ? nextTraceMap + : this.mode === "legacy" + ? { default: nextTraceMap, ...nextTraceMap } + : { default: nextTraceMap }, + ); + + if (esm) { + yield* it; + } else { + for (const report of it) { + report.path = report.path.filter(exceptDefault); + if ( + report.path.length >= 2 || + report.type !== READ + ) { + yield report; + } + } + } + } + } + } + } + + /** + * Iterate the property references for a given expression AST node. + * @template T + * @param {Expression} node The expression AST node to iterate property references. + * @param {TraceMap} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate property references. + */ + *iteratePropertyReferences(node, traceMap) { + yield* this._iteratePropertyReferences(node, [], traceMap); + } + + /** + * Iterate the references for a given variable. + * @private + * @template T + * @param {Variable} variable The variable to iterate that references. + * @param {string[]} path The current path. + * @param {TraceMapObject} traceMap The trace map. + * @param {boolean} shouldReport = The flag to report those references. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *_iterateVariableReferences(variable, path, traceMap, shouldReport) { + if (this.variableStack.includes(variable)) { + return + } + this.variableStack.push(variable); + try { + for (const reference of variable.references) { + if (!reference.isRead()) { + continue + } + const node = /** @type {RuleNode & Identifier} */ ( + reference.identifier + ); + + if (shouldReport && traceMap[READ]) { + yield { node, path, type: READ, info: traceMap[READ] }; + } + yield* this._iteratePropertyReferences(node, path, traceMap); + } + } finally { + this.variableStack.pop(); + } + } + + /** + * Iterate the references for a given AST node. + * @private + * @template T + * @param {Expression} rootNode The AST node to iterate references. + * @param {string[]} path The current path. + * @param {TraceMapObject} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + //eslint-disable-next-line complexity + *_iteratePropertyReferences(rootNode, path, traceMap) { + let node = rootNode; + while (isPassThrough(node)) { + node = node.parent; + } + + const parent = /** @type {RuleNode} */ (node).parent; + if (!parent) { + return + } + if (parent.type === "MemberExpression") { + if (parent.object === node) { + const key = getPropertyName(parent); + if (key == null || !has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: parent, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iteratePropertyReferences( + parent, + path, + nextTraceMap, + ); + } + return + } + if (parent.type === "CallExpression") { + if (parent.callee === node && traceMap[CALL]) { + yield { node: parent, path, type: CALL, info: traceMap[CALL] }; + } + return + } + if (parent.type === "NewExpression") { + if (parent.callee === node && traceMap[CONSTRUCT]) { + yield { + node: parent, + path, + type: CONSTRUCT, + info: traceMap[CONSTRUCT], + }; + } + return + } + if (parent.type === "AssignmentExpression") { + if (parent.right === node) { + yield* this._iterateLhsReferences(parent.left, path, traceMap); + yield* this._iteratePropertyReferences(parent, path, traceMap); + } + return + } + if (parent.type === "AssignmentPattern") { + if (parent.right === node) { + yield* this._iterateLhsReferences(parent.left, path, traceMap); + } + return + } + if (parent.type === "VariableDeclarator") { + if (parent.init === node) { + yield* this._iterateLhsReferences(parent.id, path, traceMap); + } + } + } + + /** + * Iterate the references for a given Pattern node. + * @private + * @template T + * @param {Pattern} patternNode The Pattern node to iterate references. + * @param {string[]} path The current path. + * @param {TraceMapObject} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *_iterateLhsReferences(patternNode, path, traceMap) { + if (patternNode.type === "Identifier") { + const variable = findVariable(this.globalScope, patternNode); + if (variable != null) { + yield* this._iterateVariableReferences( + variable, + path, + traceMap, + false, + ); + } + return + } + if (patternNode.type === "ObjectPattern") { + for (const property of patternNode.properties) { + const key = getPropertyName( + /** @type {AssignmentProperty} */ (property), + ); + + if (key == null || !has(traceMap, key)) { + continue + } + + const nextPath = path.concat(key); + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: /** @type {RuleNode} */ (property), + path: nextPath, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iterateLhsReferences( + /** @type {AssignmentProperty} */ (property).value, + nextPath, + nextTraceMap, + ); + } + return + } + if (patternNode.type === "AssignmentPattern") { + yield* this._iterateLhsReferences(patternNode.left, path, traceMap); + } + } + + /** + * Iterate the references for a given ModuleSpecifier node. + * @private + * @template T + * @param {ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier} specifierNode The ModuleSpecifier node to iterate references. + * @param {string[]} path The current path. + * @param {TraceMapObject} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *_iterateImportReferences(specifierNode, path, traceMap) { + const type = specifierNode.type; + + if (type === "ImportSpecifier" || type === "ImportDefaultSpecifier") { + const key = + type === "ImportDefaultSpecifier" + ? "default" + : specifierNode.imported.type === "Identifier" + ? specifierNode.imported.name + : specifierNode.imported.value; + if (!has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: /** @type {RuleNode} */ (specifierNode), + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iterateVariableReferences( + /** @type {Variable} */ ( + findVariable(this.globalScope, specifierNode.local) + ), + path, + nextTraceMap, + false, + ); + + return + } + + if (type === "ImportNamespaceSpecifier") { + yield* this._iterateVariableReferences( + /** @type {Variable} */ ( + findVariable(this.globalScope, specifierNode.local) + ), + path, + traceMap, + false, + ); + return + } + + if (type === "ExportSpecifier") { + const key = + specifierNode.local.type === "Identifier" + ? specifierNode.local.name + : specifierNode.local.value; + if (!has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: /** @type {RuleNode} */ (specifierNode), + path, + type: READ, + info: nextTraceMap[READ], + }; + } + } + } +} + +ReferenceTracker.READ = READ; +ReferenceTracker.CALL = CALL; +ReferenceTracker.CONSTRUCT = CONSTRUCT; +ReferenceTracker.ESM = ESM; + +/** + * This is a predicate function for Array#filter. + * @param {string} name A name part. + * @param {number} index The index of the name. + * @returns {boolean} `false` if it's default. + */ +function exceptDefault(name, index) { + return !(index === 1 && name === "default") +} + +/** @typedef {import("./types.mjs").StaticValue} StaticValue */ + +var index = { + CALL, + CONSTRUCT, + ESM, + findVariable, + getFunctionHeadLocation, + getFunctionNameWithKind, + getInnermostScope, + getPropertyName, + getStaticValue, + getStringIfConstant, + hasSideEffect, + isArrowToken, + isClosingBraceToken, + isClosingBracketToken, + isClosingParenToken, + isColonToken, + isCommaToken, + isCommentToken, + isNotArrowToken, + isNotClosingBraceToken, + isNotClosingBracketToken, + isNotClosingParenToken, + isNotColonToken, + isNotCommaToken, + isNotCommentToken, + isNotOpeningBraceToken, + isNotOpeningBracketToken, + isNotOpeningParenToken, + isNotSemicolonToken, + isOpeningBraceToken, + isOpeningBracketToken, + isOpeningParenToken, + isParenthesized, + isSemicolonToken, + PatternMatcher, + READ, + ReferenceTracker, +}; + +exports.CALL = CALL; +exports.CONSTRUCT = CONSTRUCT; +exports.ESM = ESM; +exports.PatternMatcher = PatternMatcher; +exports.READ = READ; +exports.ReferenceTracker = ReferenceTracker; +exports["default"] = index; +exports.findVariable = findVariable; +exports.getFunctionHeadLocation = getFunctionHeadLocation; +exports.getFunctionNameWithKind = getFunctionNameWithKind; +exports.getInnermostScope = getInnermostScope; +exports.getPropertyName = getPropertyName; +exports.getStaticValue = getStaticValue; +exports.getStringIfConstant = getStringIfConstant; +exports.hasSideEffect = hasSideEffect; +exports.isArrowToken = isArrowToken; +exports.isClosingBraceToken = isClosingBraceToken; +exports.isClosingBracketToken = isClosingBracketToken; +exports.isClosingParenToken = isClosingParenToken; +exports.isColonToken = isColonToken; +exports.isCommaToken = isCommaToken; +exports.isCommentToken = isCommentToken; +exports.isNotArrowToken = isNotArrowToken; +exports.isNotClosingBraceToken = isNotClosingBraceToken; +exports.isNotClosingBracketToken = isNotClosingBracketToken; +exports.isNotClosingParenToken = isNotClosingParenToken; +exports.isNotColonToken = isNotColonToken; +exports.isNotCommaToken = isNotCommaToken; +exports.isNotCommentToken = isNotCommentToken; +exports.isNotOpeningBraceToken = isNotOpeningBraceToken; +exports.isNotOpeningBracketToken = isNotOpeningBracketToken; +exports.isNotOpeningParenToken = isNotOpeningParenToken; +exports.isNotSemicolonToken = isNotSemicolonToken; +exports.isOpeningBraceToken = isOpeningBraceToken; +exports.isOpeningBracketToken = isOpeningBracketToken; +exports.isOpeningParenToken = isOpeningParenToken; +exports.isParenthesized = isParenthesized; +exports.isSemicolonToken = isSemicolonToken; +//# sourceMappingURL=index.js.map diff --git a/node_modules/@eslint-community/eslint-utils/index.js.map b/node_modules/@eslint-community/eslint-utils/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..47913acdbc723a1edea78976860daf800f996f3f --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["src/get-innermost-scope.mjs","src/find-variable.mjs","src/token-predicate.mjs","src/get-function-head-location.mjs","src/get-static-value.mjs","src/get-string-if-constant.mjs","src/get-property-name.mjs","src/get-function-name-with-kind.mjs","src/has-side-effect.mjs","src/is-parenthesized.mjs","src/pattern-matcher.mjs","src/reference-tracker.mjs","src/index.mjs"],"sourcesContent":["/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"estree\").Node} Node */\n\n/**\n * Get the innermost scope which contains a given location.\n * @param {Scope} initialScope The initial scope to search.\n * @param {Node} node The location to search.\n * @returns {Scope} The innermost scope.\n */\nexport function getInnermostScope(initialScope, node) {\n const location = /** @type {[number, number]} */ (node.range)[0]\n\n let scope = initialScope\n let found = false\n do {\n found = false\n for (const childScope of scope.childScopes) {\n const range = /** @type {[number, number]} */ (\n childScope.block.range\n )\n\n if (range[0] <= location && location < range[1]) {\n scope = childScope\n found = true\n break\n }\n }\n } while (found)\n\n return scope\n}\n","import { getInnermostScope } from \"./get-innermost-scope.mjs\"\n/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"eslint\").Scope.Variable} Variable */\n/** @typedef {import(\"estree\").Identifier} Identifier */\n\n/**\n * Find the variable of a given name.\n * @param {Scope} initialScope The scope to start finding.\n * @param {string|Identifier} nameOrNode The variable name to find. If this is a Node object then it should be an Identifier node.\n * @returns {Variable|null} The found variable or null.\n */\nexport function findVariable(initialScope, nameOrNode) {\n let name = \"\"\n /** @type {Scope|null} */\n let scope = initialScope\n\n if (typeof nameOrNode === \"string\") {\n name = nameOrNode\n } else {\n name = nameOrNode.name\n scope = getInnermostScope(scope, nameOrNode)\n }\n\n while (scope != null) {\n const variable = scope.set.get(name)\n if (variable != null) {\n return variable\n }\n scope = scope.upper\n }\n\n return null\n}\n","/** @typedef {import(\"eslint\").AST.Token} Token */\n/** @typedef {import(\"estree\").Comment} Comment */\n/** @typedef {import(\"./types.mjs\").ArrowToken} ArrowToken */\n/** @typedef {import(\"./types.mjs\").CommaToken} CommaToken */\n/** @typedef {import(\"./types.mjs\").SemicolonToken} SemicolonToken */\n/** @typedef {import(\"./types.mjs\").ColonToken} ColonToken */\n/** @typedef {import(\"./types.mjs\").OpeningParenToken} OpeningParenToken */\n/** @typedef {import(\"./types.mjs\").ClosingParenToken} ClosingParenToken */\n/** @typedef {import(\"./types.mjs\").OpeningBracketToken} OpeningBracketToken */\n/** @typedef {import(\"./types.mjs\").ClosingBracketToken} ClosingBracketToken */\n/** @typedef {import(\"./types.mjs\").OpeningBraceToken} OpeningBraceToken */\n/** @typedef {import(\"./types.mjs\").ClosingBraceToken} ClosingBraceToken */\n/**\n * @template {string} Value\n * @typedef {import(\"./types.mjs\").PunctuatorToken} PunctuatorToken\n */\n\n/** @typedef {Comment | Token} CommentOrToken */\n\n/**\n * Creates the negate function of the given function.\n * @param {function(CommentOrToken):boolean} f - The function to negate.\n * @returns {function(CommentOrToken):boolean} Negated function.\n */\nfunction negate(f) {\n return (token) => !f(token)\n}\n\n/**\n * Checks if the given token is a PunctuatorToken with the given value\n * @template {string} Value\n * @param {CommentOrToken} token - The token to check.\n * @param {Value} value - The value to check.\n * @returns {token is PunctuatorToken} `true` if the token is a PunctuatorToken with the given value.\n */\nfunction isPunctuatorTokenWithValue(token, value) {\n return token.type === \"Punctuator\" && token.value === value\n}\n\n/**\n * Checks if the given token is an arrow token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is ArrowToken} `true` if the token is an arrow token.\n */\nexport function isArrowToken(token) {\n return isPunctuatorTokenWithValue(token, \"=>\")\n}\n\n/**\n * Checks if the given token is a comma token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is CommaToken} `true` if the token is a comma token.\n */\nexport function isCommaToken(token) {\n return isPunctuatorTokenWithValue(token, \",\")\n}\n\n/**\n * Checks if the given token is a semicolon token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is SemicolonToken} `true` if the token is a semicolon token.\n */\nexport function isSemicolonToken(token) {\n return isPunctuatorTokenWithValue(token, \";\")\n}\n\n/**\n * Checks if the given token is a colon token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is ColonToken} `true` if the token is a colon token.\n */\nexport function isColonToken(token) {\n return isPunctuatorTokenWithValue(token, \":\")\n}\n\n/**\n * Checks if the given token is an opening parenthesis token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is OpeningParenToken} `true` if the token is an opening parenthesis token.\n */\nexport function isOpeningParenToken(token) {\n return isPunctuatorTokenWithValue(token, \"(\")\n}\n\n/**\n * Checks if the given token is a closing parenthesis token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is ClosingParenToken} `true` if the token is a closing parenthesis token.\n */\nexport function isClosingParenToken(token) {\n return isPunctuatorTokenWithValue(token, \")\")\n}\n\n/**\n * Checks if the given token is an opening square bracket token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is OpeningBracketToken} `true` if the token is an opening square bracket token.\n */\nexport function isOpeningBracketToken(token) {\n return isPunctuatorTokenWithValue(token, \"[\")\n}\n\n/**\n * Checks if the given token is a closing square bracket token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is ClosingBracketToken} `true` if the token is a closing square bracket token.\n */\nexport function isClosingBracketToken(token) {\n return isPunctuatorTokenWithValue(token, \"]\")\n}\n\n/**\n * Checks if the given token is an opening brace token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is OpeningBraceToken} `true` if the token is an opening brace token.\n */\nexport function isOpeningBraceToken(token) {\n return isPunctuatorTokenWithValue(token, \"{\")\n}\n\n/**\n * Checks if the given token is a closing brace token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is ClosingBraceToken} `true` if the token is a closing brace token.\n */\nexport function isClosingBraceToken(token) {\n return isPunctuatorTokenWithValue(token, \"}\")\n}\n\n/**\n * Checks if the given token is a comment token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is Comment} `true` if the token is a comment token.\n */\nexport function isCommentToken(token) {\n return [\"Block\", \"Line\", \"Shebang\"].includes(token.type)\n}\n\nexport const isNotArrowToken = negate(isArrowToken)\nexport const isNotCommaToken = negate(isCommaToken)\nexport const isNotSemicolonToken = negate(isSemicolonToken)\nexport const isNotColonToken = negate(isColonToken)\nexport const isNotOpeningParenToken = negate(isOpeningParenToken)\nexport const isNotClosingParenToken = negate(isClosingParenToken)\nexport const isNotOpeningBracketToken = negate(isOpeningBracketToken)\nexport const isNotClosingBracketToken = negate(isClosingBracketToken)\nexport const isNotOpeningBraceToken = negate(isOpeningBraceToken)\nexport const isNotClosingBraceToken = negate(isClosingBraceToken)\nexport const isNotCommentToken = negate(isCommentToken)\n","import { isArrowToken, isOpeningParenToken } from \"./token-predicate.mjs\"\n/** @typedef {import(\"eslint\").Rule.Node} RuleNode */\n/** @typedef {import(\"eslint\").SourceCode} SourceCode */\n/** @typedef {import(\"eslint\").AST.Token} Token */\n/** @typedef {import(\"estree\").Function} FunctionNode */\n/** @typedef {import(\"estree\").FunctionDeclaration} FunctionDeclaration */\n/** @typedef {import(\"estree\").FunctionExpression} FunctionExpression */\n/** @typedef {import(\"estree\").SourceLocation} SourceLocation */\n/** @typedef {import(\"estree\").Position} Position */\n\n/**\n * Get the `(` token of the given function node.\n * @param {FunctionExpression | FunctionDeclaration} node - The function node to get.\n * @param {SourceCode} sourceCode - The source code object to get tokens.\n * @returns {Token} `(` token.\n */\nfunction getOpeningParenOfParams(node, sourceCode) {\n return node.id\n ? /** @type {Token} */ (\n sourceCode.getTokenAfter(node.id, isOpeningParenToken)\n )\n : /** @type {Token} */ (\n sourceCode.getFirstToken(node, isOpeningParenToken)\n )\n}\n\n/**\n * Get the location of the given function node for reporting.\n * @param {FunctionNode} node - The function node to get.\n * @param {SourceCode} sourceCode - The source code object to get tokens.\n * @returns {SourceLocation|null} The location of the function node for reporting.\n */\nexport function getFunctionHeadLocation(node, sourceCode) {\n const parent = /** @type {RuleNode} */ (node).parent\n\n /** @type {Position|null} */\n let start = null\n /** @type {Position|null} */\n let end = null\n\n if (node.type === \"ArrowFunctionExpression\") {\n const arrowToken = /** @type {Token} */ (\n sourceCode.getTokenBefore(node.body, isArrowToken)\n )\n\n start = arrowToken.loc.start\n end = arrowToken.loc.end\n } else if (\n parent &&\n (parent.type === \"Property\" ||\n parent.type === \"MethodDefinition\" ||\n parent.type === \"PropertyDefinition\")\n ) {\n start = /** @type {SourceLocation} */ (parent.loc).start\n end = getOpeningParenOfParams(node, sourceCode).loc.start\n } else {\n start = /** @type {SourceLocation} */ (node.loc).start\n end = getOpeningParenOfParams(node, sourceCode).loc.start\n }\n\n return {\n start: { ...start },\n end: { ...end },\n }\n}\n","/* globals globalThis, global, self, window */\n\nimport { findVariable } from \"./find-variable.mjs\"\n/** @typedef {import(\"./types.mjs\").StaticValue} StaticValue */\n/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"eslint\").Scope.Variable} Variable */\n/** @typedef {import(\"estree\").Node} Node */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.Node} TSESTreeNode */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.AST_NODE_TYPES} TSESTreeNodeTypes */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.MemberExpression} MemberExpression */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.Property} Property */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.RegExpLiteral} RegExpLiteral */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.BigIntLiteral} BigIntLiteral */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.Literal} Literal */\n\nconst globalObject =\n typeof globalThis !== \"undefined\"\n ? globalThis\n : // @ts-ignore\n typeof self !== \"undefined\"\n ? // @ts-ignore\n self\n : // @ts-ignore\n typeof window !== \"undefined\"\n ? // @ts-ignore\n window\n : typeof global !== \"undefined\"\n ? global\n : {}\n\nconst builtinNames = Object.freeze(\n new Set([\n \"Array\",\n \"ArrayBuffer\",\n \"BigInt\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n \"Boolean\",\n \"DataView\",\n \"Date\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"Float32Array\",\n \"Float64Array\",\n \"Function\",\n \"Infinity\",\n \"Int16Array\",\n \"Int32Array\",\n \"Int8Array\",\n \"isFinite\",\n \"isNaN\",\n \"isPrototypeOf\",\n \"JSON\",\n \"Map\",\n \"Math\",\n \"NaN\",\n \"Number\",\n \"Object\",\n \"parseFloat\",\n \"parseInt\",\n \"Promise\",\n \"Proxy\",\n \"Reflect\",\n \"RegExp\",\n \"Set\",\n \"String\",\n \"Symbol\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"undefined\",\n \"unescape\",\n \"WeakMap\",\n \"WeakSet\",\n ]),\n)\nconst callAllowed = new Set(\n [\n Array.isArray,\n Array.of,\n Array.prototype.at,\n Array.prototype.concat,\n Array.prototype.entries,\n Array.prototype.every,\n Array.prototype.filter,\n Array.prototype.find,\n Array.prototype.findIndex,\n Array.prototype.flat,\n Array.prototype.includes,\n Array.prototype.indexOf,\n Array.prototype.join,\n Array.prototype.keys,\n Array.prototype.lastIndexOf,\n Array.prototype.slice,\n Array.prototype.some,\n Array.prototype.toString,\n Array.prototype.values,\n typeof BigInt === \"function\" ? BigInt : undefined,\n Boolean,\n Date,\n Date.parse,\n decodeURI,\n decodeURIComponent,\n encodeURI,\n encodeURIComponent,\n escape,\n isFinite,\n isNaN,\n // @ts-ignore\n isPrototypeOf,\n Map,\n Map.prototype.entries,\n Map.prototype.get,\n Map.prototype.has,\n Map.prototype.keys,\n Map.prototype.values,\n .../** @type {(keyof typeof Math)[]} */ (\n Object.getOwnPropertyNames(Math)\n )\n .filter((k) => k !== \"random\")\n .map((k) => Math[k])\n .filter((f) => typeof f === \"function\"),\n Number,\n Number.isFinite,\n Number.isNaN,\n Number.parseFloat,\n Number.parseInt,\n Number.prototype.toExponential,\n Number.prototype.toFixed,\n Number.prototype.toPrecision,\n Number.prototype.toString,\n Object,\n Object.entries,\n Object.is,\n Object.isExtensible,\n Object.isFrozen,\n Object.isSealed,\n Object.keys,\n Object.values,\n parseFloat,\n parseInt,\n RegExp,\n Set,\n Set.prototype.entries,\n Set.prototype.has,\n Set.prototype.keys,\n Set.prototype.values,\n String,\n String.fromCharCode,\n String.fromCodePoint,\n String.raw,\n String.prototype.at,\n String.prototype.charAt,\n String.prototype.charCodeAt,\n String.prototype.codePointAt,\n String.prototype.concat,\n String.prototype.endsWith,\n String.prototype.includes,\n String.prototype.indexOf,\n String.prototype.lastIndexOf,\n String.prototype.normalize,\n String.prototype.padEnd,\n String.prototype.padStart,\n String.prototype.slice,\n String.prototype.startsWith,\n String.prototype.substr,\n String.prototype.substring,\n String.prototype.toLowerCase,\n String.prototype.toString,\n String.prototype.toUpperCase,\n String.prototype.trim,\n String.prototype.trimEnd,\n String.prototype.trimLeft,\n String.prototype.trimRight,\n String.prototype.trimStart,\n Symbol.for,\n Symbol.keyFor,\n unescape,\n ].filter((f) => typeof f === \"function\"),\n)\nconst callPassThrough = new Set([\n Object.freeze,\n Object.preventExtensions,\n Object.seal,\n])\n\n/** @type {ReadonlyArray]>} */\nconst getterAllowed = [\n [Map, new Set([\"size\"])],\n [\n RegExp,\n new Set([\n \"dotAll\",\n \"flags\",\n \"global\",\n \"hasIndices\",\n \"ignoreCase\",\n \"multiline\",\n \"source\",\n \"sticky\",\n \"unicode\",\n ]),\n ],\n [Set, new Set([\"size\"])],\n]\n\n/**\n * Get the property descriptor.\n * @param {object} object The object to get.\n * @param {string|number|symbol} name The property name to get.\n */\nfunction getPropertyDescriptor(object, name) {\n let x = object\n while ((typeof x === \"object\" || typeof x === \"function\") && x !== null) {\n const d = Object.getOwnPropertyDescriptor(x, name)\n if (d) {\n return d\n }\n x = Object.getPrototypeOf(x)\n }\n return null\n}\n\n/**\n * Check if a property is getter or not.\n * @param {object} object The object to check.\n * @param {string|number|symbol} name The property name to check.\n */\nfunction isGetter(object, name) {\n const d = getPropertyDescriptor(object, name)\n return d != null && d.get != null\n}\n\n/**\n * Get the element values of a given node list.\n * @param {(Node|TSESTreeNode|null)[]} nodeList The node list to get values.\n * @param {Scope|undefined|null} initialScope The initial scope to find variables.\n * @returns {any[]|null} The value list if all nodes are constant. Otherwise, null.\n */\nfunction getElementValues(nodeList, initialScope) {\n const valueList = []\n\n for (let i = 0; i < nodeList.length; ++i) {\n const elementNode = nodeList[i]\n\n if (elementNode == null) {\n valueList.length = i + 1\n } else if (elementNode.type === \"SpreadElement\") {\n const argument = getStaticValueR(elementNode.argument, initialScope)\n if (argument == null) {\n return null\n }\n valueList.push(.../** @type {Iterable} */ (argument.value))\n } else {\n const element = getStaticValueR(elementNode, initialScope)\n if (element == null) {\n return null\n }\n valueList.push(element.value)\n }\n }\n\n return valueList\n}\n\n/**\n * Checks if a variable is a built-in global.\n * @param {Variable|null} variable The variable to check.\n * @returns {variable is Variable & {defs:[]}}\n */\nfunction isBuiltinGlobal(variable) {\n return (\n variable != null &&\n variable.defs.length === 0 &&\n builtinNames.has(variable.name) &&\n variable.name in globalObject\n )\n}\n\n/**\n * Checks if a variable can be considered as a constant.\n * @param {Variable} variable\n * @returns {variable is Variable & {defs: [import(\"eslint\").Scope.Definition & { type: \"Variable\" }]}} True if the variable can be considered as a constant.\n */\nfunction canBeConsideredConst(variable) {\n if (variable.defs.length !== 1) {\n return false\n }\n const def = variable.defs[0]\n return Boolean(\n def.parent &&\n def.type === \"Variable\" &&\n (def.parent.kind === \"const\" || isEffectivelyConst(variable)),\n )\n}\n\n/**\n * Returns whether the given variable is never written to after initialization.\n * @param {Variable} variable\n * @returns {boolean}\n */\nfunction isEffectivelyConst(variable) {\n const refs = variable.references\n\n const inits = refs.filter((r) => r.init).length\n const reads = refs.filter((r) => r.isReadOnly()).length\n if (inits === 1 && reads + inits === refs.length) {\n // there is only one init and all other references only read\n return true\n }\n return false\n}\n\n/**\n * Checks if a variable has mutation in its property.\n * @param {Variable} variable The variable to check.\n * @param {Scope|null} initialScope The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it.\n * @returns {boolean} True if the variable has mutation in its property.\n */\nfunction hasMutationInProperty(variable, initialScope) {\n for (const ref of variable.references) {\n let node = /** @type {TSESTreeNode} */ (ref.identifier)\n while (node && node.parent && node.parent.type === \"MemberExpression\") {\n node = node.parent\n }\n if (!node || !node.parent) {\n continue\n }\n if (\n (node.parent.type === \"AssignmentExpression\" &&\n node.parent.left === node) ||\n (node.parent.type === \"UpdateExpression\" &&\n node.parent.argument === node)\n ) {\n // This is a mutation.\n return true\n }\n if (\n node.parent.type === \"CallExpression\" &&\n node.parent.callee === node &&\n node.type === \"MemberExpression\"\n ) {\n const methodName = getStaticPropertyNameValue(node, initialScope)\n if (isNameOfMutationArrayMethod(methodName)) {\n // This is a mutation.\n return true\n }\n }\n }\n return false\n\n /**\n * Checks if a method name is one of the mutation array methods.\n * @param {StaticValue|null} methodName The method name to check.\n * @returns {boolean} True if the method name is a mutation array method.\n */\n function isNameOfMutationArrayMethod(methodName) {\n if (methodName == null || methodName.value == null) {\n return false\n }\n const name = methodName.value\n return (\n name === \"copyWithin\" ||\n name === \"fill\" ||\n name === \"pop\" ||\n name === \"push\" ||\n name === \"reverse\" ||\n name === \"shift\" ||\n name === \"sort\" ||\n name === \"splice\" ||\n name === \"unshift\"\n )\n }\n}\n\n/**\n * @template {TSESTreeNodeTypes} T\n * @callback VisitorCallback\n * @param {TSESTreeNode & { type: T }} node\n * @param {Scope|undefined|null} initialScope\n * @returns {StaticValue | null}\n */\n/**\n * @typedef { { [K in TSESTreeNodeTypes]?: VisitorCallback } } Operations\n */\n/**\n * @type {Operations}\n */\nconst operations = Object.freeze({\n ArrayExpression(node, initialScope) {\n const elements = getElementValues(node.elements, initialScope)\n return elements != null ? { value: elements } : null\n },\n\n AssignmentExpression(node, initialScope) {\n if (node.operator === \"=\") {\n return getStaticValueR(node.right, initialScope)\n }\n return null\n },\n\n //eslint-disable-next-line complexity\n BinaryExpression(node, initialScope) {\n if (node.operator === \"in\" || node.operator === \"instanceof\") {\n // Not supported.\n return null\n }\n\n const left = getStaticValueR(node.left, initialScope)\n const right = getStaticValueR(node.right, initialScope)\n if (left != null && right != null) {\n switch (node.operator) {\n case \"==\":\n return { value: left.value == right.value } //eslint-disable-line eqeqeq\n case \"!=\":\n return { value: left.value != right.value } //eslint-disable-line eqeqeq\n case \"===\":\n return { value: left.value === right.value }\n case \"!==\":\n return { value: left.value !== right.value }\n case \"<\":\n return {\n value:\n /** @type {any} */ (left.value) <\n /** @type {any} */ (right.value),\n }\n case \"<=\":\n return {\n value:\n /** @type {any} */ (left.value) <=\n /** @type {any} */ (right.value),\n }\n case \">\":\n return {\n value:\n /** @type {any} */ (left.value) >\n /** @type {any} */ (right.value),\n }\n case \">=\":\n return {\n value:\n /** @type {any} */ (left.value) >=\n /** @type {any} */ (right.value),\n }\n case \"<<\":\n return {\n value:\n /** @type {any} */ (left.value) <<\n /** @type {any} */ (right.value),\n }\n case \">>\":\n return {\n value:\n /** @type {any} */ (left.value) >>\n /** @type {any} */ (right.value),\n }\n case \">>>\":\n return {\n value:\n /** @type {any} */ (left.value) >>>\n /** @type {any} */ (right.value),\n }\n case \"+\":\n return {\n value:\n /** @type {any} */ (left.value) +\n /** @type {any} */ (right.value),\n }\n case \"-\":\n return {\n value:\n /** @type {any} */ (left.value) -\n /** @type {any} */ (right.value),\n }\n case \"*\":\n return {\n value:\n /** @type {any} */ (left.value) *\n /** @type {any} */ (right.value),\n }\n case \"/\":\n return {\n value:\n /** @type {any} */ (left.value) /\n /** @type {any} */ (right.value),\n }\n case \"%\":\n return {\n value:\n /** @type {any} */ (left.value) %\n /** @type {any} */ (right.value),\n }\n case \"**\":\n return {\n value:\n /** @type {any} */ (left.value) **\n /** @type {any} */ (right.value),\n }\n case \"|\":\n return {\n value:\n /** @type {any} */ (left.value) |\n /** @type {any} */ (right.value),\n }\n case \"^\":\n return {\n value:\n /** @type {any} */ (left.value) ^\n /** @type {any} */ (right.value),\n }\n case \"&\":\n return {\n value:\n /** @type {any} */ (left.value) &\n /** @type {any} */ (right.value),\n }\n\n // no default\n }\n }\n\n return null\n },\n\n CallExpression(node, initialScope) {\n const calleeNode = node.callee\n const args = getElementValues(node.arguments, initialScope)\n\n if (args != null) {\n if (calleeNode.type === \"MemberExpression\") {\n if (calleeNode.property.type === \"PrivateIdentifier\") {\n return null\n }\n const object = getStaticValueR(calleeNode.object, initialScope)\n if (object != null) {\n if (\n object.value == null &&\n (object.optional || node.optional)\n ) {\n return { value: undefined, optional: true }\n }\n const property = getStaticPropertyNameValue(\n calleeNode,\n initialScope,\n )\n\n if (property != null) {\n const receiver =\n /** @type {Record any>} */ (\n object.value\n )\n const methodName = /** @type {PropertyKey} */ (\n property.value\n )\n if (callAllowed.has(receiver[methodName])) {\n return {\n value: receiver[methodName](...args),\n }\n }\n if (callPassThrough.has(receiver[methodName])) {\n return { value: args[0] }\n }\n }\n }\n } else {\n const callee = getStaticValueR(calleeNode, initialScope)\n if (callee != null) {\n if (callee.value == null && node.optional) {\n return { value: undefined, optional: true }\n }\n const func = /** @type {(...args: any[]) => any} */ (\n callee.value\n )\n if (callAllowed.has(func)) {\n return { value: func(...args) }\n }\n if (callPassThrough.has(func)) {\n return { value: args[0] }\n }\n }\n }\n }\n\n return null\n },\n\n ConditionalExpression(node, initialScope) {\n const test = getStaticValueR(node.test, initialScope)\n if (test != null) {\n return test.value\n ? getStaticValueR(node.consequent, initialScope)\n : getStaticValueR(node.alternate, initialScope)\n }\n return null\n },\n\n ExpressionStatement(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n\n Identifier(node, initialScope) {\n if (initialScope != null) {\n const variable = findVariable(initialScope, node)\n\n if (variable != null) {\n // Built-in globals.\n if (isBuiltinGlobal(variable)) {\n return { value: globalObject[variable.name] }\n }\n\n // Constants.\n if (canBeConsideredConst(variable)) {\n const def = variable.defs[0]\n if (\n // TODO(mysticatea): don't support destructuring here.\n def.node.id.type === \"Identifier\"\n ) {\n const init = getStaticValueR(\n def.node.init,\n initialScope,\n )\n if (\n init &&\n typeof init.value === \"object\" &&\n init.value !== null\n ) {\n if (hasMutationInProperty(variable, initialScope)) {\n // This variable has mutation in its property.\n return null\n }\n }\n return init\n }\n }\n }\n }\n return null\n },\n\n Literal(node) {\n const literal =\n /** @type {Partial & Partial & Partial} */ (\n node\n )\n //istanbul ignore if : this is implementation-specific behavior.\n if (\n (literal.regex != null || literal.bigint != null) &&\n literal.value == null\n ) {\n // It was a RegExp/BigInt literal, but Node.js didn't support it.\n return null\n }\n return { value: literal.value }\n },\n\n LogicalExpression(node, initialScope) {\n const left = getStaticValueR(node.left, initialScope)\n if (left != null) {\n if (\n (node.operator === \"||\" && Boolean(left.value) === true) ||\n (node.operator === \"&&\" && Boolean(left.value) === false) ||\n (node.operator === \"??\" && left.value != null)\n ) {\n return left\n }\n\n const right = getStaticValueR(node.right, initialScope)\n if (right != null) {\n return right\n }\n }\n\n return null\n },\n\n MemberExpression(node, initialScope) {\n if (node.property.type === \"PrivateIdentifier\") {\n return null\n }\n const object = getStaticValueR(node.object, initialScope)\n if (object != null) {\n if (object.value == null && (object.optional || node.optional)) {\n return { value: undefined, optional: true }\n }\n const property = getStaticPropertyNameValue(node, initialScope)\n\n if (property != null) {\n if (\n !isGetter(\n /** @type {object} */ (object.value),\n /** @type {PropertyKey} */ (property.value),\n )\n ) {\n return {\n value: /** @type {Record} */ (\n object.value\n )[/** @type {PropertyKey} */ (property.value)],\n }\n }\n\n for (const [classFn, allowed] of getterAllowed) {\n if (\n object.value instanceof classFn &&\n allowed.has(/** @type {string} */ (property.value))\n ) {\n return {\n value: /** @type {Record} */ (\n object.value\n )[/** @type {PropertyKey} */ (property.value)],\n }\n }\n }\n }\n }\n return null\n },\n\n ChainExpression(node, initialScope) {\n const expression = getStaticValueR(node.expression, initialScope)\n if (expression != null) {\n return { value: expression.value }\n }\n return null\n },\n\n NewExpression(node, initialScope) {\n const callee = getStaticValueR(node.callee, initialScope)\n const args = getElementValues(node.arguments, initialScope)\n\n if (callee != null && args != null) {\n const Func = /** @type {new (...args: any[]) => any} */ (\n callee.value\n )\n if (callAllowed.has(Func)) {\n return { value: new Func(...args) }\n }\n }\n\n return null\n },\n\n ObjectExpression(node, initialScope) {\n /** @type {Record} */\n const object = {}\n\n for (const propertyNode of node.properties) {\n if (propertyNode.type === \"Property\") {\n if (propertyNode.kind !== \"init\") {\n return null\n }\n const key = getStaticPropertyNameValue(\n propertyNode,\n initialScope,\n )\n const value = getStaticValueR(propertyNode.value, initialScope)\n if (key == null || value == null) {\n return null\n }\n object[/** @type {PropertyKey} */ (key.value)] = value.value\n } else if (\n propertyNode.type === \"SpreadElement\" ||\n // @ts-expect-error -- Backward compatibility\n propertyNode.type === \"ExperimentalSpreadProperty\"\n ) {\n const argument = getStaticValueR(\n propertyNode.argument,\n initialScope,\n )\n if (argument == null) {\n return null\n }\n Object.assign(object, argument.value)\n } else {\n return null\n }\n }\n\n return { value: object }\n },\n\n SequenceExpression(node, initialScope) {\n const last = node.expressions[node.expressions.length - 1]\n return getStaticValueR(last, initialScope)\n },\n\n TaggedTemplateExpression(node, initialScope) {\n const tag = getStaticValueR(node.tag, initialScope)\n const expressions = getElementValues(\n node.quasi.expressions,\n initialScope,\n )\n\n if (tag != null && expressions != null) {\n const func = /** @type {(...args: any[]) => any} */ (tag.value)\n /** @type {any[] & { raw?: string[] }} */\n const strings = node.quasi.quasis.map((q) => q.value.cooked)\n strings.raw = node.quasi.quasis.map((q) => q.value.raw)\n\n if (func === String.raw) {\n return { value: func(strings, ...expressions) }\n }\n }\n\n return null\n },\n\n TemplateLiteral(node, initialScope) {\n const expressions = getElementValues(node.expressions, initialScope)\n if (expressions != null) {\n let value = node.quasis[0].value.cooked\n for (let i = 0; i < expressions.length; ++i) {\n value += expressions[i]\n value += /** @type {string} */ (node.quasis[i + 1].value.cooked)\n }\n return { value }\n }\n return null\n },\n\n UnaryExpression(node, initialScope) {\n if (node.operator === \"delete\") {\n // Not supported.\n return null\n }\n if (node.operator === \"void\") {\n return { value: undefined }\n }\n\n const arg = getStaticValueR(node.argument, initialScope)\n if (arg != null) {\n switch (node.operator) {\n case \"-\":\n return { value: -(/** @type {any} */ (arg.value)) }\n case \"+\":\n return { value: +(/** @type {any} */ (arg.value)) } //eslint-disable-line no-implicit-coercion\n case \"!\":\n return { value: !arg.value }\n case \"~\":\n return { value: ~(/** @type {any} */ (arg.value)) }\n case \"typeof\":\n return { value: typeof arg.value }\n\n // no default\n }\n }\n\n return null\n },\n TSAsExpression(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n TSSatisfiesExpression(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n TSTypeAssertion(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n TSNonNullExpression(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n TSInstantiationExpression(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n})\n\n/**\n * Get the value of a given node if it's a static value.\n * @param {Node|TSESTreeNode|null|undefined} node The node to get.\n * @param {Scope|undefined|null} initialScope The scope to start finding variable.\n * @returns {StaticValue|null} The static value of the node, or `null`.\n */\nfunction getStaticValueR(node, initialScope) {\n if (node != null && Object.hasOwnProperty.call(operations, node.type)) {\n return /** @type {VisitorCallback} */ (operations[node.type])(\n /** @type {TSESTreeNode} */ (node),\n initialScope,\n )\n }\n return null\n}\n\n/**\n * Get the static value of property name from a MemberExpression node or a Property node.\n * @param {MemberExpression|Property} node The node to get.\n * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it.\n * @returns {StaticValue|null} The static value of the property name of the node, or `null`.\n */\nfunction getStaticPropertyNameValue(node, initialScope) {\n const nameNode = node.type === \"Property\" ? node.key : node.property\n\n if (node.computed) {\n return getStaticValueR(nameNode, initialScope)\n }\n\n if (nameNode.type === \"Identifier\") {\n return { value: nameNode.name }\n }\n\n if (nameNode.type === \"Literal\") {\n if (/** @type {Partial} */ (nameNode).bigint) {\n return { value: /** @type {BigIntLiteral} */ (nameNode).bigint }\n }\n return { value: String(nameNode.value) }\n }\n\n return null\n}\n\n/**\n * Get the value of a given node if it's a static value.\n * @param {Node} node The node to get.\n * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If this scope was given, this tries to resolve identifier references which are in the given node as much as possible.\n * @returns {StaticValue | null} The static value of the node, or `null`.\n */\nexport function getStaticValue(node, initialScope = null) {\n try {\n return getStaticValueR(node, initialScope)\n } catch (_error) {\n return null\n }\n}\n","import { getStaticValue } from \"./get-static-value.mjs\"\n/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"estree\").Node} Node */\n/** @typedef {import(\"estree\").RegExpLiteral} RegExpLiteral */\n/** @typedef {import(\"estree\").BigIntLiteral} BigIntLiteral */\n/** @typedef {import(\"estree\").SimpleLiteral} SimpleLiteral */\n\n/**\n * Get the value of a given node if it's a literal or a template literal.\n * @param {Node} node The node to get.\n * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If the node is an Identifier node and this scope was given, this checks the variable of the identifier, and returns the value of it if the variable is a constant.\n * @returns {string|null} The value of the node, or `null`.\n */\nexport function getStringIfConstant(node, initialScope = null) {\n // Handle the literals that the platform doesn't support natively.\n if (node && node.type === \"Literal\" && node.value === null) {\n const literal =\n /** @type {Partial & Partial & Partial} */ (\n node\n )\n if (literal.regex) {\n return `/${literal.regex.pattern}/${literal.regex.flags}`\n }\n if (literal.bigint) {\n return literal.bigint\n }\n }\n\n const evaluated = getStaticValue(node, initialScope)\n\n if (evaluated) {\n // `String(Symbol.prototype)` throws error\n try {\n return String(evaluated.value)\n } catch {\n // No op\n }\n }\n\n return null\n}\n","import { getStringIfConstant } from \"./get-string-if-constant.mjs\"\n/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"estree\").MemberExpression} MemberExpression */\n/** @typedef {import(\"estree\").MethodDefinition} MethodDefinition */\n/** @typedef {import(\"estree\").Property} Property */\n/** @typedef {import(\"estree\").PropertyDefinition} PropertyDefinition */\n/** @typedef {import(\"estree\").Identifier} Identifier */\n\n/**\n * Get the property name from a MemberExpression node or a Property node.\n * @param {MemberExpression | MethodDefinition | Property | PropertyDefinition} node The node to get.\n * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it.\n * @returns {string|null|undefined} The property name of the node.\n */\nexport function getPropertyName(node, initialScope) {\n switch (node.type) {\n case \"MemberExpression\":\n if (node.computed) {\n return getStringIfConstant(node.property, initialScope)\n }\n if (node.property.type === \"PrivateIdentifier\") {\n return null\n }\n return /** @type {Partial} */ (node.property).name\n\n case \"Property\":\n case \"MethodDefinition\":\n case \"PropertyDefinition\":\n if (node.computed) {\n return getStringIfConstant(node.key, initialScope)\n }\n if (node.key.type === \"Literal\") {\n return String(node.key.value)\n }\n if (node.key.type === \"PrivateIdentifier\") {\n return null\n }\n return /** @type {Partial} */ (node.key).name\n\n default:\n break\n }\n\n return null\n}\n","import { getPropertyName } from \"./get-property-name.mjs\"\n/** @typedef {import(\"eslint\").Rule.Node} RuleNode */\n/** @typedef {import(\"eslint\").SourceCode} SourceCode */\n/** @typedef {import(\"estree\").Function} FunctionNode */\n/** @typedef {import(\"estree\").FunctionDeclaration} FunctionDeclaration */\n/** @typedef {import(\"estree\").FunctionExpression} FunctionExpression */\n/** @typedef {import(\"estree\").Identifier} Identifier */\n\n/**\n * Get the name and kind of the given function node.\n * @param {FunctionNode} node - The function node to get.\n * @param {SourceCode} [sourceCode] The source code object to get the code of computed property keys.\n * @returns {string} The name and kind of the function node.\n */\n// eslint-disable-next-line complexity\nexport function getFunctionNameWithKind(node, sourceCode) {\n const parent = /** @type {RuleNode} */ (node).parent\n\n if (!parent) {\n return \"\"\n }\n\n const tokens = []\n const isObjectMethod = parent.type === \"Property\" && parent.value === node\n const isClassMethod =\n parent.type === \"MethodDefinition\" && parent.value === node\n const isClassFieldMethod =\n parent.type === \"PropertyDefinition\" && parent.value === node\n\n // Modifiers.\n if (isClassMethod || isClassFieldMethod) {\n if (parent.static) {\n tokens.push(\"static\")\n }\n if (parent.key.type === \"PrivateIdentifier\") {\n tokens.push(\"private\")\n }\n }\n if (node.async) {\n tokens.push(\"async\")\n }\n if (node.generator) {\n tokens.push(\"generator\")\n }\n\n // Kinds.\n if (isObjectMethod || isClassMethod) {\n if (parent.kind === \"constructor\") {\n return \"constructor\"\n }\n if (parent.kind === \"get\") {\n tokens.push(\"getter\")\n } else if (parent.kind === \"set\") {\n tokens.push(\"setter\")\n } else {\n tokens.push(\"method\")\n }\n } else if (isClassFieldMethod) {\n tokens.push(\"method\")\n } else {\n if (node.type === \"ArrowFunctionExpression\") {\n tokens.push(\"arrow\")\n }\n tokens.push(\"function\")\n }\n\n // Names.\n if (isObjectMethod || isClassMethod || isClassFieldMethod) {\n if (parent.key.type === \"PrivateIdentifier\") {\n tokens.push(`#${parent.key.name}`)\n } else {\n const name = getPropertyName(parent)\n if (name) {\n tokens.push(`'${name}'`)\n } else if (sourceCode) {\n const keyText = sourceCode.getText(parent.key)\n if (!keyText.includes(\"\\n\")) {\n tokens.push(`[${keyText}]`)\n }\n }\n }\n } else if (hasId(node)) {\n tokens.push(`'${node.id.name}'`)\n } else if (\n parent.type === \"VariableDeclarator\" &&\n parent.id &&\n parent.id.type === \"Identifier\"\n ) {\n tokens.push(`'${parent.id.name}'`)\n } else if (\n (parent.type === \"AssignmentExpression\" ||\n parent.type === \"AssignmentPattern\") &&\n parent.left &&\n parent.left.type === \"Identifier\"\n ) {\n tokens.push(`'${parent.left.name}'`)\n } else if (\n parent.type === \"ExportDefaultDeclaration\" &&\n parent.declaration === node\n ) {\n tokens.push(\"'default'\")\n }\n\n return tokens.join(\" \")\n}\n\n/**\n * @param {FunctionNode} node\n * @returns {node is FunctionDeclaration | FunctionExpression & { id: Identifier }}\n */\nfunction hasId(node) {\n return Boolean(\n /** @type {Partial} */ (node)\n .id,\n )\n}\n","import { getKeys, KEYS } from \"eslint-visitor-keys\"\n/** @typedef {import(\"estree\").Node} Node */\n/** @typedef {import(\"eslint\").SourceCode} SourceCode */\n/** @typedef {import(\"./types.mjs\").HasSideEffectOptions} HasSideEffectOptions */\n/** @typedef {import(\"estree\").BinaryExpression} BinaryExpression */\n/** @typedef {import(\"estree\").MemberExpression} MemberExpression */\n/** @typedef {import(\"estree\").MethodDefinition} MethodDefinition */\n/** @typedef {import(\"estree\").Property} Property */\n/** @typedef {import(\"estree\").PropertyDefinition} PropertyDefinition */\n/** @typedef {import(\"estree\").UnaryExpression} UnaryExpression */\n\nconst typeConversionBinaryOps = Object.freeze(\n new Set([\n \"==\",\n \"!=\",\n \"<\",\n \"<=\",\n \">\",\n \">=\",\n \"<<\",\n \">>\",\n \">>>\",\n \"+\",\n \"-\",\n \"*\",\n \"/\",\n \"%\",\n \"|\",\n \"^\",\n \"&\",\n \"in\",\n ]),\n)\nconst typeConversionUnaryOps = Object.freeze(new Set([\"-\", \"+\", \"!\", \"~\"]))\n\n/**\n * Check whether the given value is an ASTNode or not.\n * @param {any} x The value to check.\n * @returns {x is Node} `true` if the value is an ASTNode.\n */\nfunction isNode(x) {\n return x !== null && typeof x === \"object\" && typeof x.type === \"string\"\n}\n\nconst visitor = Object.freeze(\n Object.assign(Object.create(null), {\n /**\n * @param {Node} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n $visit(node, options, visitorKeys) {\n const { type } = node\n\n if (typeof (/** @type {any} */ (this)[type]) === \"function\") {\n return /** @type {any} */ (this)[type](\n node,\n options,\n visitorKeys,\n )\n }\n\n return this.$visitChildren(node, options, visitorKeys)\n },\n\n /**\n * @param {Node} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n $visitChildren(node, options, visitorKeys) {\n const { type } = node\n\n for (const key of /** @type {(keyof Node)[]} */ (\n visitorKeys[type] || getKeys(node)\n )) {\n const value = node[key]\n\n if (Array.isArray(value)) {\n for (const element of value) {\n if (\n isNode(element) &&\n this.$visit(element, options, visitorKeys)\n ) {\n return true\n }\n }\n } else if (\n isNode(value) &&\n this.$visit(value, options, visitorKeys)\n ) {\n return true\n }\n }\n\n return false\n },\n\n ArrowFunctionExpression() {\n return false\n },\n AssignmentExpression() {\n return true\n },\n AwaitExpression() {\n return true\n },\n /**\n * @param {BinaryExpression} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n BinaryExpression(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n typeConversionBinaryOps.has(node.operator) &&\n (node.left.type !== \"Literal\" || node.right.type !== \"Literal\")\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n CallExpression() {\n return true\n },\n FunctionExpression() {\n return false\n },\n ImportExpression() {\n return true\n },\n /**\n * @param {MemberExpression} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n MemberExpression(node, options, visitorKeys) {\n if (options.considerGetters) {\n return true\n }\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.property.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n /**\n * @param {MethodDefinition} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n MethodDefinition(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n NewExpression() {\n return true\n },\n /**\n * @param {Property} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n Property(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n /**\n * @param {PropertyDefinition} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n PropertyDefinition(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n /**\n * @param {UnaryExpression} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n UnaryExpression(node, options, visitorKeys) {\n if (node.operator === \"delete\") {\n return true\n }\n if (\n options.considerImplicitTypeConversion &&\n typeConversionUnaryOps.has(node.operator) &&\n node.argument.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n UpdateExpression() {\n return true\n },\n YieldExpression() {\n return true\n },\n }),\n)\n\n/**\n * Check whether a given node has any side effect or not.\n * @param {Node} node The node to get.\n * @param {SourceCode} sourceCode The source code object.\n * @param {HasSideEffectOptions} [options] The option object.\n * @returns {boolean} `true` if the node has a certain side effect.\n */\nexport function hasSideEffect(node, sourceCode, options = {}) {\n const { considerGetters = false, considerImplicitTypeConversion = false } =\n options\n return visitor.$visit(\n node,\n { considerGetters, considerImplicitTypeConversion },\n sourceCode.visitorKeys || KEYS,\n )\n}\n","import { isClosingParenToken, isOpeningParenToken } from \"./token-predicate.mjs\"\n/** @typedef {import(\"estree\").Node} Node */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.NewExpression} TSNewExpression */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.CallExpression} TSCallExpression */\n/** @typedef {import(\"eslint\").SourceCode} SourceCode */\n/** @typedef {import(\"eslint\").AST.Token} Token */\n/** @typedef {import(\"eslint\").Rule.Node} RuleNode */\n\n/**\n * Get the left parenthesis of the parent node syntax if it exists.\n * E.g., `if (a) {}` then the `(`.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {Token|null} The left parenthesis of the parent node syntax\n */\n// eslint-disable-next-line complexity\nfunction getParentSyntaxParen(node, sourceCode) {\n const parent = /** @type {RuleNode} */ (node).parent\n\n if (!parent) {\n return null\n }\n\n switch (parent.type) {\n case \"CallExpression\":\n case \"NewExpression\":\n if (parent.arguments.length === 1 && parent.arguments[0] === node) {\n return sourceCode.getTokenAfter(\n // @ts-expect-error https://github.com/typescript-eslint/typescript-eslint/pull/5384\n parent.typeArguments ||\n /** @type {RuleNode} */ (\n /** @type {unknown} */ (\n /** @type {TSNewExpression | TSCallExpression} */ (\n parent\n ).typeParameters\n )\n ) ||\n parent.callee,\n isOpeningParenToken,\n )\n }\n return null\n\n case \"DoWhileStatement\":\n if (parent.test === node) {\n return sourceCode.getTokenAfter(\n parent.body,\n isOpeningParenToken,\n )\n }\n return null\n\n case \"IfStatement\":\n case \"WhileStatement\":\n if (parent.test === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"ImportExpression\":\n if (parent.source === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"SwitchStatement\":\n if (parent.discriminant === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"WithStatement\":\n if (parent.object === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n default:\n return null\n }\n}\n\n/**\n * Check whether a given node is parenthesized or not.\n * @param {number} times The number of parantheses.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {boolean} `true` if the node is parenthesized the given times.\n */\n/**\n * Check whether a given node is parenthesized or not.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {boolean} `true` if the node is parenthesized.\n */\n/**\n * Check whether a given node is parenthesized or not.\n * @param {Node|number} timesOrNode The first parameter.\n * @param {Node|SourceCode} nodeOrSourceCode The second parameter.\n * @param {SourceCode} [optionalSourceCode] The third parameter.\n * @returns {boolean} `true` if the node is parenthesized.\n */\nexport function isParenthesized(\n timesOrNode,\n nodeOrSourceCode,\n optionalSourceCode,\n) {\n /** @type {number} */\n let times,\n /** @type {RuleNode} */\n node,\n /** @type {SourceCode} */\n sourceCode,\n maybeLeftParen,\n maybeRightParen\n if (typeof timesOrNode === \"number\") {\n times = timesOrNode | 0\n node = /** @type {RuleNode} */ (nodeOrSourceCode)\n sourceCode = /** @type {SourceCode} */ (optionalSourceCode)\n if (!(times >= 1)) {\n throw new TypeError(\"'times' should be a positive integer.\")\n }\n } else {\n times = 1\n node = /** @type {RuleNode} */ (timesOrNode)\n sourceCode = /** @type {SourceCode} */ (nodeOrSourceCode)\n }\n\n if (\n node == null ||\n // `Program` can't be parenthesized\n node.parent == null ||\n // `CatchClause.param` can't be parenthesized, example `try {} catch (error) {}`\n (node.parent.type === \"CatchClause\" && node.parent.param === node)\n ) {\n return false\n }\n\n maybeLeftParen = maybeRightParen = node\n do {\n maybeLeftParen = sourceCode.getTokenBefore(maybeLeftParen)\n maybeRightParen = sourceCode.getTokenAfter(maybeRightParen)\n } while (\n maybeLeftParen != null &&\n maybeRightParen != null &&\n isOpeningParenToken(maybeLeftParen) &&\n isClosingParenToken(maybeRightParen) &&\n // Avoid false positive such as `if (a) {}`\n maybeLeftParen !== getParentSyntaxParen(node, sourceCode) &&\n --times > 0\n )\n\n return times === 0\n}\n","/**\n * @author Toru Nagashima \n * See LICENSE file in root directory for full license.\n */\n\nconst placeholder = /\\$(?:[$&`']|[1-9][0-9]?)/gu\n\n/** @type {WeakMap} */\nconst internal = new WeakMap()\n\n/**\n * Check whether a given character is escaped or not.\n * @param {string} str The string to check.\n * @param {number} index The location of the character to check.\n * @returns {boolean} `true` if the character is escaped.\n */\nfunction isEscaped(str, index) {\n let escaped = false\n for (let i = index - 1; i >= 0 && str.charCodeAt(i) === 0x5c; --i) {\n escaped = !escaped\n }\n return escaped\n}\n\n/**\n * Replace a given string by a given matcher.\n * @param {PatternMatcher} matcher The pattern matcher.\n * @param {string} str The string to be replaced.\n * @param {string} replacement The new substring to replace each matched part.\n * @returns {string} The replaced string.\n */\nfunction replaceS(matcher, str, replacement) {\n const chunks = []\n let index = 0\n\n /**\n * @param {string} key The placeholder.\n * @param {RegExpExecArray} match The matched information.\n * @returns {string} The replaced string.\n */\n function replacer(key, match) {\n switch (key) {\n case \"$$\":\n return \"$\"\n case \"$&\":\n return match[0]\n case \"$`\":\n return str.slice(0, match.index)\n case \"$'\":\n return str.slice(match.index + match[0].length)\n default: {\n const i = key.slice(1)\n if (i in match) {\n return match[/** @type {any} */ (i)]\n }\n return key\n }\n }\n }\n\n for (const match of matcher.execAll(str)) {\n chunks.push(str.slice(index, match.index))\n chunks.push(\n replacement.replace(placeholder, (key) => replacer(key, match)),\n )\n index = match.index + match[0].length\n }\n chunks.push(str.slice(index))\n\n return chunks.join(\"\")\n}\n\n/**\n * Replace a given string by a given matcher.\n * @param {PatternMatcher} matcher The pattern matcher.\n * @param {string} str The string to be replaced.\n * @param {(substring: string, ...args: any[]) => string} replace The function to replace each matched part.\n * @returns {string} The replaced string.\n */\nfunction replaceF(matcher, str, replace) {\n const chunks = []\n let index = 0\n\n for (const match of matcher.execAll(str)) {\n chunks.push(str.slice(index, match.index))\n chunks.push(\n String(\n replace(\n .../** @type {[string, ...string[]]} */ (\n /** @type {string[]} */ (match)\n ),\n match.index,\n match.input,\n ),\n ),\n )\n index = match.index + match[0].length\n }\n chunks.push(str.slice(index))\n\n return chunks.join(\"\")\n}\n\n/**\n * The class to find patterns as considering escape sequences.\n */\nexport class PatternMatcher {\n /**\n * Initialize this matcher.\n * @param {RegExp} pattern The pattern to match.\n * @param {{escaped?:boolean}} [options] The options.\n */\n constructor(pattern, options = {}) {\n const { escaped = false } = options\n if (!(pattern instanceof RegExp)) {\n throw new TypeError(\"'pattern' should be a RegExp instance.\")\n }\n if (!pattern.flags.includes(\"g\")) {\n throw new Error(\"'pattern' should contains 'g' flag.\")\n }\n\n internal.set(this, {\n pattern: new RegExp(pattern.source, pattern.flags),\n escaped: Boolean(escaped),\n })\n }\n\n /**\n * Find the pattern in a given string.\n * @param {string} str The string to find.\n * @returns {IterableIterator} The iterator which iterate the matched information.\n */\n *execAll(str) {\n const { pattern, escaped } =\n /** @type {{pattern:RegExp,escaped:boolean}} */ (internal.get(this))\n let match = null\n let lastIndex = 0\n\n pattern.lastIndex = 0\n while ((match = pattern.exec(str)) != null) {\n if (escaped || !isEscaped(str, match.index)) {\n lastIndex = pattern.lastIndex\n yield match\n pattern.lastIndex = lastIndex\n }\n }\n }\n\n /**\n * Check whether the pattern is found in a given string.\n * @param {string} str The string to check.\n * @returns {boolean} `true` if the pattern was found in the string.\n */\n test(str) {\n const it = this.execAll(str)\n const ret = it.next()\n return !ret.done\n }\n\n /**\n * Replace a given string.\n * @param {string} str The string to be replaced.\n * @param {(string|((...strs:string[])=>string))} replacer The string or function to replace. This is the same as the 2nd argument of `String.prototype.replace`.\n * @returns {string} The replaced string.\n */\n [Symbol.replace](str, replacer) {\n return typeof replacer === \"function\"\n ? replaceF(this, String(str), replacer)\n : replaceS(this, String(str), String(replacer))\n }\n}\n","import { findVariable } from \"./find-variable.mjs\"\nimport { getPropertyName } from \"./get-property-name.mjs\"\nimport { getStringIfConstant } from \"./get-string-if-constant.mjs\"\n/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"eslint\").Scope.Variable} Variable */\n/** @typedef {import(\"eslint\").Rule.Node} RuleNode */\n/** @typedef {import(\"estree\").Node} Node */\n/** @typedef {import(\"estree\").Expression} Expression */\n/** @typedef {import(\"estree\").Pattern} Pattern */\n/** @typedef {import(\"estree\").Identifier} Identifier */\n/** @typedef {import(\"estree\").SimpleCallExpression} CallExpression */\n/** @typedef {import(\"estree\").Program} Program */\n/** @typedef {import(\"estree\").ImportDeclaration} ImportDeclaration */\n/** @typedef {import(\"estree\").ExportAllDeclaration} ExportAllDeclaration */\n/** @typedef {import(\"estree\").ExportDefaultDeclaration} ExportDefaultDeclaration */\n/** @typedef {import(\"estree\").ExportNamedDeclaration} ExportNamedDeclaration */\n/** @typedef {import(\"estree\").ImportSpecifier} ImportSpecifier */\n/** @typedef {import(\"estree\").ImportDefaultSpecifier} ImportDefaultSpecifier */\n/** @typedef {import(\"estree\").ImportNamespaceSpecifier} ImportNamespaceSpecifier */\n/** @typedef {import(\"estree\").ExportSpecifier} ExportSpecifier */\n/** @typedef {import(\"estree\").Property} Property */\n/** @typedef {import(\"estree\").AssignmentProperty} AssignmentProperty */\n/** @typedef {import(\"estree\").Literal} Literal */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.Node} TSESTreeNode */\n/** @typedef {import(\"./types.mjs\").ReferenceTrackerOptions} ReferenceTrackerOptions */\n/**\n * @template T\n * @typedef {import(\"./types.mjs\").TraceMap} TraceMap\n */\n/**\n * @template T\n * @typedef {import(\"./types.mjs\").TraceMapObject} TraceMapObject\n */\n/**\n * @template T\n * @typedef {import(\"./types.mjs\").TrackedReferences} TrackedReferences\n */\n\nconst IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u\n\n/**\n * Check whether a given node is an import node or not.\n * @param {Node} node\n * @returns {node is ImportDeclaration|ExportAllDeclaration|ExportNamedDeclaration&{source: Literal}} `true` if the node is an import node.\n */\nfunction isHasSource(node) {\n return (\n IMPORT_TYPE.test(node.type) &&\n /** @type {ImportDeclaration|ExportAllDeclaration|ExportNamedDeclaration} */ (\n node\n ).source != null\n )\n}\nconst has =\n /** @type {(traceMap: TraceMap, v: T) => v is (string extends T ? string : T)} */ (\n Function.call.bind(Object.hasOwnProperty)\n )\n\nexport const READ = Symbol(\"read\")\nexport const CALL = Symbol(\"call\")\nexport const CONSTRUCT = Symbol(\"construct\")\nexport const ESM = Symbol(\"esm\")\n\nconst requireCall = { require: { [CALL]: true } }\n\n/**\n * Check whether a given variable is modified or not.\n * @param {Variable|undefined} variable The variable to check.\n * @returns {boolean} `true` if the variable is modified.\n */\nfunction isModifiedGlobal(variable) {\n return (\n variable == null ||\n variable.defs.length !== 0 ||\n variable.references.some((r) => r.isWrite())\n )\n}\n\n/**\n * Check if the value of a given node is passed through to the parent syntax as-is.\n * For example, `a` and `b` in (`a || b` and `c ? a : b`) are passed through.\n * @param {Node} node A node to check.\n * @returns {node is RuleNode & {parent: Expression}} `true` if the node is passed through.\n */\nfunction isPassThrough(node) {\n const parent = /** @type {TSESTreeNode} */ (node).parent\n\n if (parent) {\n switch (parent.type) {\n case \"ConditionalExpression\":\n return parent.consequent === node || parent.alternate === node\n case \"LogicalExpression\":\n return true\n case \"SequenceExpression\":\n return (\n parent.expressions[parent.expressions.length - 1] === node\n )\n case \"ChainExpression\":\n return true\n case \"TSAsExpression\":\n case \"TSSatisfiesExpression\":\n case \"TSTypeAssertion\":\n case \"TSNonNullExpression\":\n case \"TSInstantiationExpression\":\n return true\n\n default:\n return false\n }\n }\n return false\n}\n\n/**\n * The reference tracker.\n */\nexport class ReferenceTracker {\n /**\n * Initialize this tracker.\n * @param {Scope} globalScope The global scope.\n * @param {object} [options] The options.\n * @param {\"legacy\"|\"strict\"} [options.mode=\"strict\"] The mode to determine the ImportDeclaration's behavior for CJS modules.\n * @param {string[]} [options.globalObjectNames=[\"global\",\"globalThis\",\"self\",\"window\"]] The variable names for Global Object.\n */\n constructor(globalScope, options = {}) {\n const {\n mode = \"strict\",\n globalObjectNames = [\"global\", \"globalThis\", \"self\", \"window\"],\n } = options\n /** @private @type {Variable[]} */\n this.variableStack = []\n /** @private */\n this.globalScope = globalScope\n /** @private */\n this.mode = mode\n /** @private */\n this.globalObjectNames = globalObjectNames.slice(0)\n }\n\n /**\n * Iterate the references of global variables.\n * @template T\n * @param {TraceMap} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *iterateGlobalReferences(traceMap) {\n for (const key of Object.keys(traceMap)) {\n const nextTraceMap = traceMap[key]\n const path = [key]\n const variable = this.globalScope.set.get(key)\n\n if (isModifiedGlobal(variable)) {\n continue\n }\n\n yield* this._iterateVariableReferences(\n /** @type {Variable} */ (variable),\n path,\n nextTraceMap,\n true,\n )\n }\n\n for (const key of this.globalObjectNames) {\n /** @type {string[]} */\n const path = []\n const variable = this.globalScope.set.get(key)\n\n if (isModifiedGlobal(variable)) {\n continue\n }\n\n yield* this._iterateVariableReferences(\n /** @type {Variable} */ (variable),\n path,\n traceMap,\n false,\n )\n }\n }\n\n /**\n * Iterate the references of CommonJS modules.\n * @template T\n * @param {TraceMap} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *iterateCjsReferences(traceMap) {\n for (const { node } of this.iterateGlobalReferences(requireCall)) {\n const key = getStringIfConstant(\n /** @type {CallExpression} */ (node).arguments[0],\n )\n if (key == null || !has(traceMap, key)) {\n continue\n }\n\n const nextTraceMap = traceMap[key]\n const path = [key]\n\n if (nextTraceMap[READ]) {\n yield {\n node,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iteratePropertyReferences(\n /** @type {CallExpression} */ (node),\n path,\n nextTraceMap,\n )\n }\n }\n\n /**\n * Iterate the references of ES modules.\n * @template T\n * @param {TraceMap} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *iterateEsmReferences(traceMap) {\n const programNode = /** @type {Program} */ (this.globalScope.block)\n\n for (const node of programNode.body) {\n if (!isHasSource(node)) {\n continue\n }\n const moduleId = /** @type {string} */ (node.source.value)\n\n if (!has(traceMap, moduleId)) {\n continue\n }\n const nextTraceMap = traceMap[moduleId]\n const path = [moduleId]\n\n if (nextTraceMap[READ]) {\n yield {\n // eslint-disable-next-line object-shorthand -- apply type\n node: /** @type {RuleNode} */ (node),\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n\n if (node.type === \"ExportAllDeclaration\") {\n for (const key of Object.keys(nextTraceMap)) {\n const exportTraceMap = nextTraceMap[key]\n if (exportTraceMap[READ]) {\n yield {\n // eslint-disable-next-line object-shorthand -- apply type\n node: /** @type {RuleNode} */ (node),\n path: path.concat(key),\n type: READ,\n info: exportTraceMap[READ],\n }\n }\n }\n } else {\n for (const specifier of node.specifiers) {\n const esm = has(nextTraceMap, ESM)\n const it = this._iterateImportReferences(\n specifier,\n path,\n esm\n ? nextTraceMap\n : this.mode === \"legacy\"\n ? { default: nextTraceMap, ...nextTraceMap }\n : { default: nextTraceMap },\n )\n\n if (esm) {\n yield* it\n } else {\n for (const report of it) {\n report.path = report.path.filter(exceptDefault)\n if (\n report.path.length >= 2 ||\n report.type !== READ\n ) {\n yield report\n }\n }\n }\n }\n }\n }\n }\n\n /**\n * Iterate the property references for a given expression AST node.\n * @template T\n * @param {Expression} node The expression AST node to iterate property references.\n * @param {TraceMap} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate property references.\n */\n *iteratePropertyReferences(node, traceMap) {\n yield* this._iteratePropertyReferences(node, [], traceMap)\n }\n\n /**\n * Iterate the references for a given variable.\n * @private\n * @template T\n * @param {Variable} variable The variable to iterate that references.\n * @param {string[]} path The current path.\n * @param {TraceMapObject} traceMap The trace map.\n * @param {boolean} shouldReport = The flag to report those references.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *_iterateVariableReferences(variable, path, traceMap, shouldReport) {\n if (this.variableStack.includes(variable)) {\n return\n }\n this.variableStack.push(variable)\n try {\n for (const reference of variable.references) {\n if (!reference.isRead()) {\n continue\n }\n const node = /** @type {RuleNode & Identifier} */ (\n reference.identifier\n )\n\n if (shouldReport && traceMap[READ]) {\n yield { node, path, type: READ, info: traceMap[READ] }\n }\n yield* this._iteratePropertyReferences(node, path, traceMap)\n }\n } finally {\n this.variableStack.pop()\n }\n }\n\n /**\n * Iterate the references for a given AST node.\n * @private\n * @template T\n * @param {Expression} rootNode The AST node to iterate references.\n * @param {string[]} path The current path.\n * @param {TraceMapObject} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n //eslint-disable-next-line complexity\n *_iteratePropertyReferences(rootNode, path, traceMap) {\n let node = rootNode\n while (isPassThrough(node)) {\n node = node.parent\n }\n\n const parent = /** @type {RuleNode} */ (node).parent\n if (!parent) {\n return\n }\n if (parent.type === \"MemberExpression\") {\n if (parent.object === node) {\n const key = getPropertyName(parent)\n if (key == null || !has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: parent,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iteratePropertyReferences(\n parent,\n path,\n nextTraceMap,\n )\n }\n return\n }\n if (parent.type === \"CallExpression\") {\n if (parent.callee === node && traceMap[CALL]) {\n yield { node: parent, path, type: CALL, info: traceMap[CALL] }\n }\n return\n }\n if (parent.type === \"NewExpression\") {\n if (parent.callee === node && traceMap[CONSTRUCT]) {\n yield {\n node: parent,\n path,\n type: CONSTRUCT,\n info: traceMap[CONSTRUCT],\n }\n }\n return\n }\n if (parent.type === \"AssignmentExpression\") {\n if (parent.right === node) {\n yield* this._iterateLhsReferences(parent.left, path, traceMap)\n yield* this._iteratePropertyReferences(parent, path, traceMap)\n }\n return\n }\n if (parent.type === \"AssignmentPattern\") {\n if (parent.right === node) {\n yield* this._iterateLhsReferences(parent.left, path, traceMap)\n }\n return\n }\n if (parent.type === \"VariableDeclarator\") {\n if (parent.init === node) {\n yield* this._iterateLhsReferences(parent.id, path, traceMap)\n }\n }\n }\n\n /**\n * Iterate the references for a given Pattern node.\n * @private\n * @template T\n * @param {Pattern} patternNode The Pattern node to iterate references.\n * @param {string[]} path The current path.\n * @param {TraceMapObject} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *_iterateLhsReferences(patternNode, path, traceMap) {\n if (patternNode.type === \"Identifier\") {\n const variable = findVariable(this.globalScope, patternNode)\n if (variable != null) {\n yield* this._iterateVariableReferences(\n variable,\n path,\n traceMap,\n false,\n )\n }\n return\n }\n if (patternNode.type === \"ObjectPattern\") {\n for (const property of patternNode.properties) {\n const key = getPropertyName(\n /** @type {AssignmentProperty} */ (property),\n )\n\n if (key == null || !has(traceMap, key)) {\n continue\n }\n\n const nextPath = path.concat(key)\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: /** @type {RuleNode} */ (property),\n path: nextPath,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iterateLhsReferences(\n /** @type {AssignmentProperty} */ (property).value,\n nextPath,\n nextTraceMap,\n )\n }\n return\n }\n if (patternNode.type === \"AssignmentPattern\") {\n yield* this._iterateLhsReferences(patternNode.left, path, traceMap)\n }\n }\n\n /**\n * Iterate the references for a given ModuleSpecifier node.\n * @private\n * @template T\n * @param {ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier} specifierNode The ModuleSpecifier node to iterate references.\n * @param {string[]} path The current path.\n * @param {TraceMapObject} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *_iterateImportReferences(specifierNode, path, traceMap) {\n const type = specifierNode.type\n\n if (type === \"ImportSpecifier\" || type === \"ImportDefaultSpecifier\") {\n const key =\n type === \"ImportDefaultSpecifier\"\n ? \"default\"\n : specifierNode.imported.type === \"Identifier\"\n ? specifierNode.imported.name\n : specifierNode.imported.value\n if (!has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: /** @type {RuleNode} */ (specifierNode),\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iterateVariableReferences(\n /** @type {Variable} */ (\n findVariable(this.globalScope, specifierNode.local)\n ),\n path,\n nextTraceMap,\n false,\n )\n\n return\n }\n\n if (type === \"ImportNamespaceSpecifier\") {\n yield* this._iterateVariableReferences(\n /** @type {Variable} */ (\n findVariable(this.globalScope, specifierNode.local)\n ),\n path,\n traceMap,\n false,\n )\n return\n }\n\n if (type === \"ExportSpecifier\") {\n const key =\n specifierNode.local.type === \"Identifier\"\n ? specifierNode.local.name\n : specifierNode.local.value\n if (!has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: /** @type {RuleNode} */ (specifierNode),\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n }\n }\n}\n\nReferenceTracker.READ = READ\nReferenceTracker.CALL = CALL\nReferenceTracker.CONSTRUCT = CONSTRUCT\nReferenceTracker.ESM = ESM\n\n/**\n * This is a predicate function for Array#filter.\n * @param {string} name A name part.\n * @param {number} index The index of the name.\n * @returns {boolean} `false` if it's default.\n */\nfunction exceptDefault(name, index) {\n return !(index === 1 && name === \"default\")\n}\n","/** @typedef {import(\"./types.mjs\").StaticValue} StaticValue */\n/** @typedef {import(\"./types.mjs\").StaticValueOptional} StaticValueOptional */\n/** @typedef {import(\"./types.mjs\").StaticValueProvided} StaticValueProvided */\n/** @typedef {import(\"./types.mjs\").ReferenceTrackerOptions} ReferenceTrackerOptions */\n/**\n * @template T\n * @typedef {import(\"./types.mjs\").TraceMap} TraceMap\n */\n/**\n * @template T\n * @typedef {import(\"./types.mjs\").TrackedReferences} TrackedReferences\n */\n/** @typedef {import(\"./types.mjs\").HasSideEffectOptions} HasSideEffectOptions */\n/** @typedef {import(\"./types.mjs\").ArrowToken} ArrowToken */\n/** @typedef {import(\"./types.mjs\").CommaToken} CommaToken */\n/** @typedef {import(\"./types.mjs\").SemicolonToken} SemicolonToken */\n/** @typedef {import(\"./types.mjs\").ColonToken} ColonToken */\n/** @typedef {import(\"./types.mjs\").OpeningParenToken} OpeningParenToken */\n/** @typedef {import(\"./types.mjs\").ClosingParenToken} ClosingParenToken */\n/** @typedef {import(\"./types.mjs\").OpeningBracketToken} OpeningBracketToken */\n/** @typedef {import(\"./types.mjs\").ClosingBracketToken} ClosingBracketToken */\n/** @typedef {import(\"./types.mjs\").OpeningBraceToken} OpeningBraceToken */\n/** @typedef {import(\"./types.mjs\").ClosingBraceToken} ClosingBraceToken */\n\nimport { findVariable } from \"./find-variable.mjs\"\nimport { getFunctionHeadLocation } from \"./get-function-head-location.mjs\"\nimport { getFunctionNameWithKind } from \"./get-function-name-with-kind.mjs\"\nimport { getInnermostScope } from \"./get-innermost-scope.mjs\"\nimport { getPropertyName } from \"./get-property-name.mjs\"\nimport { getStaticValue } from \"./get-static-value.mjs\"\nimport { getStringIfConstant } from \"./get-string-if-constant.mjs\"\nimport { hasSideEffect } from \"./has-side-effect.mjs\"\nimport { isParenthesized } from \"./is-parenthesized.mjs\"\nimport { PatternMatcher } from \"./pattern-matcher.mjs\"\nimport {\n CALL,\n CONSTRUCT,\n ESM,\n READ,\n ReferenceTracker,\n} from \"./reference-tracker.mjs\"\nimport {\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isSemicolonToken,\n} from \"./token-predicate.mjs\"\n\nexport default {\n CALL,\n CONSTRUCT,\n ESM,\n findVariable,\n getFunctionHeadLocation,\n getFunctionNameWithKind,\n getInnermostScope,\n getPropertyName,\n getStaticValue,\n getStringIfConstant,\n hasSideEffect,\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isParenthesized,\n isSemicolonToken,\n PatternMatcher,\n READ,\n ReferenceTracker,\n}\nexport {\n CALL,\n CONSTRUCT,\n ESM,\n findVariable,\n getFunctionHeadLocation,\n getFunctionNameWithKind,\n getInnermostScope,\n getPropertyName,\n getStaticValue,\n getStringIfConstant,\n hasSideEffect,\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isParenthesized,\n isSemicolonToken,\n PatternMatcher,\n READ,\n ReferenceTracker,\n}\n"],"names":["getKeys","KEYS"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,YAAY,EAAE,IAAI,EAAE;AACtD,IAAI,MA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vB,IAAI,qBAAqB;AACzB,IAAI,mBAAmB;AACvB,IAAI,eAAe;AACnB,IAAI,gBAAgB;AACpB,IAAI,cAAc;AAClB,IAAI,IAAI;AACR,IAAI,gBAAgB;AACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@eslint-community/eslint-utils/index.mjs b/node_modules/@eslint-community/eslint-utils/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..469b23388f8a427b7bdefaeb0f8a90f7edeb1b47 --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/index.mjs @@ -0,0 +1,2579 @@ +import { getKeys, KEYS } from 'eslint-visitor-keys'; + +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("estree").Node} Node */ + +/** + * Get the innermost scope which contains a given location. + * @param {Scope} initialScope The initial scope to search. + * @param {Node} node The location to search. + * @returns {Scope} The innermost scope. + */ +function getInnermostScope(initialScope, node) { + const location = /** @type {[number, number]} */ (node.range)[0]; + + let scope = initialScope; + let found = false; + do { + found = false; + for (const childScope of scope.childScopes) { + const range = /** @type {[number, number]} */ ( + childScope.block.range + ); + + if (range[0] <= location && location < range[1]) { + scope = childScope; + found = true; + break + } + } + } while (found) + + return scope +} + +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("eslint").Scope.Variable} Variable */ +/** @typedef {import("estree").Identifier} Identifier */ + +/** + * Find the variable of a given name. + * @param {Scope} initialScope The scope to start finding. + * @param {string|Identifier} nameOrNode The variable name to find. If this is a Node object then it should be an Identifier node. + * @returns {Variable|null} The found variable or null. + */ +function findVariable(initialScope, nameOrNode) { + let name = ""; + /** @type {Scope|null} */ + let scope = initialScope; + + if (typeof nameOrNode === "string") { + name = nameOrNode; + } else { + name = nameOrNode.name; + scope = getInnermostScope(scope, nameOrNode); + } + + while (scope != null) { + const variable = scope.set.get(name); + if (variable != null) { + return variable + } + scope = scope.upper; + } + + return null +} + +/** @typedef {import("eslint").AST.Token} Token */ +/** @typedef {import("estree").Comment} Comment */ +/** @typedef {import("./types.mjs").ArrowToken} ArrowToken */ +/** @typedef {import("./types.mjs").CommaToken} CommaToken */ +/** @typedef {import("./types.mjs").SemicolonToken} SemicolonToken */ +/** @typedef {import("./types.mjs").ColonToken} ColonToken */ +/** @typedef {import("./types.mjs").OpeningParenToken} OpeningParenToken */ +/** @typedef {import("./types.mjs").ClosingParenToken} ClosingParenToken */ +/** @typedef {import("./types.mjs").OpeningBracketToken} OpeningBracketToken */ +/** @typedef {import("./types.mjs").ClosingBracketToken} ClosingBracketToken */ +/** @typedef {import("./types.mjs").OpeningBraceToken} OpeningBraceToken */ +/** @typedef {import("./types.mjs").ClosingBraceToken} ClosingBraceToken */ +/** + * @template {string} Value + * @typedef {import("./types.mjs").PunctuatorToken} PunctuatorToken + */ + +/** @typedef {Comment | Token} CommentOrToken */ + +/** + * Creates the negate function of the given function. + * @param {function(CommentOrToken):boolean} f - The function to negate. + * @returns {function(CommentOrToken):boolean} Negated function. + */ +function negate(f) { + return (token) => !f(token) +} + +/** + * Checks if the given token is a PunctuatorToken with the given value + * @template {string} Value + * @param {CommentOrToken} token - The token to check. + * @param {Value} value - The value to check. + * @returns {token is PunctuatorToken} `true` if the token is a PunctuatorToken with the given value. + */ +function isPunctuatorTokenWithValue(token, value) { + return token.type === "Punctuator" && token.value === value +} + +/** + * Checks if the given token is an arrow token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is ArrowToken} `true` if the token is an arrow token. + */ +function isArrowToken(token) { + return isPunctuatorTokenWithValue(token, "=>") +} + +/** + * Checks if the given token is a comma token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is CommaToken} `true` if the token is a comma token. + */ +function isCommaToken(token) { + return isPunctuatorTokenWithValue(token, ",") +} + +/** + * Checks if the given token is a semicolon token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is SemicolonToken} `true` if the token is a semicolon token. + */ +function isSemicolonToken(token) { + return isPunctuatorTokenWithValue(token, ";") +} + +/** + * Checks if the given token is a colon token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is ColonToken} `true` if the token is a colon token. + */ +function isColonToken(token) { + return isPunctuatorTokenWithValue(token, ":") +} + +/** + * Checks if the given token is an opening parenthesis token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is OpeningParenToken} `true` if the token is an opening parenthesis token. + */ +function isOpeningParenToken(token) { + return isPunctuatorTokenWithValue(token, "(") +} + +/** + * Checks if the given token is a closing parenthesis token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is ClosingParenToken} `true` if the token is a closing parenthesis token. + */ +function isClosingParenToken(token) { + return isPunctuatorTokenWithValue(token, ")") +} + +/** + * Checks if the given token is an opening square bracket token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is OpeningBracketToken} `true` if the token is an opening square bracket token. + */ +function isOpeningBracketToken(token) { + return isPunctuatorTokenWithValue(token, "[") +} + +/** + * Checks if the given token is a closing square bracket token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is ClosingBracketToken} `true` if the token is a closing square bracket token. + */ +function isClosingBracketToken(token) { + return isPunctuatorTokenWithValue(token, "]") +} + +/** + * Checks if the given token is an opening brace token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is OpeningBraceToken} `true` if the token is an opening brace token. + */ +function isOpeningBraceToken(token) { + return isPunctuatorTokenWithValue(token, "{") +} + +/** + * Checks if the given token is a closing brace token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is ClosingBraceToken} `true` if the token is a closing brace token. + */ +function isClosingBraceToken(token) { + return isPunctuatorTokenWithValue(token, "}") +} + +/** + * Checks if the given token is a comment token or not. + * @param {CommentOrToken} token - The token to check. + * @returns {token is Comment} `true` if the token is a comment token. + */ +function isCommentToken(token) { + return ["Block", "Line", "Shebang"].includes(token.type) +} + +const isNotArrowToken = negate(isArrowToken); +const isNotCommaToken = negate(isCommaToken); +const isNotSemicolonToken = negate(isSemicolonToken); +const isNotColonToken = negate(isColonToken); +const isNotOpeningParenToken = negate(isOpeningParenToken); +const isNotClosingParenToken = negate(isClosingParenToken); +const isNotOpeningBracketToken = negate(isOpeningBracketToken); +const isNotClosingBracketToken = negate(isClosingBracketToken); +const isNotOpeningBraceToken = negate(isOpeningBraceToken); +const isNotClosingBraceToken = negate(isClosingBraceToken); +const isNotCommentToken = negate(isCommentToken); + +/** @typedef {import("eslint").Rule.Node} RuleNode */ +/** @typedef {import("eslint").SourceCode} SourceCode */ +/** @typedef {import("eslint").AST.Token} Token */ +/** @typedef {import("estree").Function} FunctionNode */ +/** @typedef {import("estree").FunctionDeclaration} FunctionDeclaration */ +/** @typedef {import("estree").FunctionExpression} FunctionExpression */ +/** @typedef {import("estree").SourceLocation} SourceLocation */ +/** @typedef {import("estree").Position} Position */ + +/** + * Get the `(` token of the given function node. + * @param {FunctionExpression | FunctionDeclaration} node - The function node to get. + * @param {SourceCode} sourceCode - The source code object to get tokens. + * @returns {Token} `(` token. + */ +function getOpeningParenOfParams(node, sourceCode) { + return node.id + ? /** @type {Token} */ ( + sourceCode.getTokenAfter(node.id, isOpeningParenToken) + ) + : /** @type {Token} */ ( + sourceCode.getFirstToken(node, isOpeningParenToken) + ) +} + +/** + * Get the location of the given function node for reporting. + * @param {FunctionNode} node - The function node to get. + * @param {SourceCode} sourceCode - The source code object to get tokens. + * @returns {SourceLocation|null} The location of the function node for reporting. + */ +function getFunctionHeadLocation(node, sourceCode) { + const parent = /** @type {RuleNode} */ (node).parent; + + /** @type {Position|null} */ + let start = null; + /** @type {Position|null} */ + let end = null; + + if (node.type === "ArrowFunctionExpression") { + const arrowToken = /** @type {Token} */ ( + sourceCode.getTokenBefore(node.body, isArrowToken) + ); + + start = arrowToken.loc.start; + end = arrowToken.loc.end; + } else if ( + parent && + (parent.type === "Property" || + parent.type === "MethodDefinition" || + parent.type === "PropertyDefinition") + ) { + start = /** @type {SourceLocation} */ (parent.loc).start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } else { + start = /** @type {SourceLocation} */ (node.loc).start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } + + return { + start: { ...start }, + end: { ...end }, + } +} + +/* globals globalThis, global, self, window */ +/** @typedef {import("./types.mjs").StaticValue} StaticValue */ +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("eslint").Scope.Variable} Variable */ +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("@typescript-eslint/types").TSESTree.Node} TSESTreeNode */ +/** @typedef {import("@typescript-eslint/types").TSESTree.AST_NODE_TYPES} TSESTreeNodeTypes */ +/** @typedef {import("@typescript-eslint/types").TSESTree.MemberExpression} MemberExpression */ +/** @typedef {import("@typescript-eslint/types").TSESTree.Property} Property */ +/** @typedef {import("@typescript-eslint/types").TSESTree.RegExpLiteral} RegExpLiteral */ +/** @typedef {import("@typescript-eslint/types").TSESTree.BigIntLiteral} BigIntLiteral */ +/** @typedef {import("@typescript-eslint/types").TSESTree.Literal} Literal */ + +const globalObject = + typeof globalThis !== "undefined" + ? globalThis + : // @ts-ignore + typeof self !== "undefined" + ? // @ts-ignore + self + : // @ts-ignore + typeof window !== "undefined" + ? // @ts-ignore + window + : typeof global !== "undefined" + ? global + : {}; + +const builtinNames = Object.freeze( + new Set([ + "Array", + "ArrayBuffer", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "Boolean", + "DataView", + "Date", + "decodeURI", + "decodeURIComponent", + "encodeURI", + "encodeURIComponent", + "escape", + "Float32Array", + "Float64Array", + "Function", + "Infinity", + "Int16Array", + "Int32Array", + "Int8Array", + "isFinite", + "isNaN", + "isPrototypeOf", + "JSON", + "Map", + "Math", + "NaN", + "Number", + "Object", + "parseFloat", + "parseInt", + "Promise", + "Proxy", + "Reflect", + "RegExp", + "Set", + "String", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "undefined", + "unescape", + "WeakMap", + "WeakSet", + ]), +); +const callAllowed = new Set( + [ + Array.isArray, + Array.of, + Array.prototype.at, + Array.prototype.concat, + Array.prototype.entries, + Array.prototype.every, + Array.prototype.filter, + Array.prototype.find, + Array.prototype.findIndex, + Array.prototype.flat, + Array.prototype.includes, + Array.prototype.indexOf, + Array.prototype.join, + Array.prototype.keys, + Array.prototype.lastIndexOf, + Array.prototype.slice, + Array.prototype.some, + Array.prototype.toString, + Array.prototype.values, + typeof BigInt === "function" ? BigInt : undefined, + Boolean, + Date, + Date.parse, + decodeURI, + decodeURIComponent, + encodeURI, + encodeURIComponent, + escape, + isFinite, + isNaN, + // @ts-ignore + isPrototypeOf, + Map, + Map.prototype.entries, + Map.prototype.get, + Map.prototype.has, + Map.prototype.keys, + Map.prototype.values, + .../** @type {(keyof typeof Math)[]} */ ( + Object.getOwnPropertyNames(Math) + ) + .filter((k) => k !== "random") + .map((k) => Math[k]) + .filter((f) => typeof f === "function"), + Number, + Number.isFinite, + Number.isNaN, + Number.parseFloat, + Number.parseInt, + Number.prototype.toExponential, + Number.prototype.toFixed, + Number.prototype.toPrecision, + Number.prototype.toString, + Object, + Object.entries, + Object.is, + Object.isExtensible, + Object.isFrozen, + Object.isSealed, + Object.keys, + Object.values, + parseFloat, + parseInt, + RegExp, + Set, + Set.prototype.entries, + Set.prototype.has, + Set.prototype.keys, + Set.prototype.values, + String, + String.fromCharCode, + String.fromCodePoint, + String.raw, + String.prototype.at, + String.prototype.charAt, + String.prototype.charCodeAt, + String.prototype.codePointAt, + String.prototype.concat, + String.prototype.endsWith, + String.prototype.includes, + String.prototype.indexOf, + String.prototype.lastIndexOf, + String.prototype.normalize, + String.prototype.padEnd, + String.prototype.padStart, + String.prototype.slice, + String.prototype.startsWith, + String.prototype.substr, + String.prototype.substring, + String.prototype.toLowerCase, + String.prototype.toString, + String.prototype.toUpperCase, + String.prototype.trim, + String.prototype.trimEnd, + String.prototype.trimLeft, + String.prototype.trimRight, + String.prototype.trimStart, + Symbol.for, + Symbol.keyFor, + unescape, + ].filter((f) => typeof f === "function"), +); +const callPassThrough = new Set([ + Object.freeze, + Object.preventExtensions, + Object.seal, +]); + +/** @type {ReadonlyArray]>} */ +const getterAllowed = [ + [Map, new Set(["size"])], + [ + RegExp, + new Set([ + "dotAll", + "flags", + "global", + "hasIndices", + "ignoreCase", + "multiline", + "source", + "sticky", + "unicode", + ]), + ], + [Set, new Set(["size"])], +]; + +/** + * Get the property descriptor. + * @param {object} object The object to get. + * @param {string|number|symbol} name The property name to get. + */ +function getPropertyDescriptor(object, name) { + let x = object; + while ((typeof x === "object" || typeof x === "function") && x !== null) { + const d = Object.getOwnPropertyDescriptor(x, name); + if (d) { + return d + } + x = Object.getPrototypeOf(x); + } + return null +} + +/** + * Check if a property is getter or not. + * @param {object} object The object to check. + * @param {string|number|symbol} name The property name to check. + */ +function isGetter(object, name) { + const d = getPropertyDescriptor(object, name); + return d != null && d.get != null +} + +/** + * Get the element values of a given node list. + * @param {(Node|TSESTreeNode|null)[]} nodeList The node list to get values. + * @param {Scope|undefined|null} initialScope The initial scope to find variables. + * @returns {any[]|null} The value list if all nodes are constant. Otherwise, null. + */ +function getElementValues(nodeList, initialScope) { + const valueList = []; + + for (let i = 0; i < nodeList.length; ++i) { + const elementNode = nodeList[i]; + + if (elementNode == null) { + valueList.length = i + 1; + } else if (elementNode.type === "SpreadElement") { + const argument = getStaticValueR(elementNode.argument, initialScope); + if (argument == null) { + return null + } + valueList.push(.../** @type {Iterable} */ (argument.value)); + } else { + const element = getStaticValueR(elementNode, initialScope); + if (element == null) { + return null + } + valueList.push(element.value); + } + } + + return valueList +} + +/** + * Checks if a variable is a built-in global. + * @param {Variable|null} variable The variable to check. + * @returns {variable is Variable & {defs:[]}} + */ +function isBuiltinGlobal(variable) { + return ( + variable != null && + variable.defs.length === 0 && + builtinNames.has(variable.name) && + variable.name in globalObject + ) +} + +/** + * Checks if a variable can be considered as a constant. + * @param {Variable} variable + * @returns {variable is Variable & {defs: [import("eslint").Scope.Definition & { type: "Variable" }]}} True if the variable can be considered as a constant. + */ +function canBeConsideredConst(variable) { + if (variable.defs.length !== 1) { + return false + } + const def = variable.defs[0]; + return Boolean( + def.parent && + def.type === "Variable" && + (def.parent.kind === "const" || isEffectivelyConst(variable)), + ) +} + +/** + * Returns whether the given variable is never written to after initialization. + * @param {Variable} variable + * @returns {boolean} + */ +function isEffectivelyConst(variable) { + const refs = variable.references; + + const inits = refs.filter((r) => r.init).length; + const reads = refs.filter((r) => r.isReadOnly()).length; + if (inits === 1 && reads + inits === refs.length) { + // there is only one init and all other references only read + return true + } + return false +} + +/** + * Checks if a variable has mutation in its property. + * @param {Variable} variable The variable to check. + * @param {Scope|null} initialScope The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it. + * @returns {boolean} True if the variable has mutation in its property. + */ +function hasMutationInProperty(variable, initialScope) { + for (const ref of variable.references) { + let node = /** @type {TSESTreeNode} */ (ref.identifier); + while (node && node.parent && node.parent.type === "MemberExpression") { + node = node.parent; + } + if (!node || !node.parent) { + continue + } + if ( + (node.parent.type === "AssignmentExpression" && + node.parent.left === node) || + (node.parent.type === "UpdateExpression" && + node.parent.argument === node) + ) { + // This is a mutation. + return true + } + if ( + node.parent.type === "CallExpression" && + node.parent.callee === node && + node.type === "MemberExpression" + ) { + const methodName = getStaticPropertyNameValue(node, initialScope); + if (isNameOfMutationArrayMethod(methodName)) { + // This is a mutation. + return true + } + } + } + return false + + /** + * Checks if a method name is one of the mutation array methods. + * @param {StaticValue|null} methodName The method name to check. + * @returns {boolean} True if the method name is a mutation array method. + */ + function isNameOfMutationArrayMethod(methodName) { + if (methodName == null || methodName.value == null) { + return false + } + const name = methodName.value; + return ( + name === "copyWithin" || + name === "fill" || + name === "pop" || + name === "push" || + name === "reverse" || + name === "shift" || + name === "sort" || + name === "splice" || + name === "unshift" + ) + } +} + +/** + * @template {TSESTreeNodeTypes} T + * @callback VisitorCallback + * @param {TSESTreeNode & { type: T }} node + * @param {Scope|undefined|null} initialScope + * @returns {StaticValue | null} + */ +/** + * @typedef { { [K in TSESTreeNodeTypes]?: VisitorCallback } } Operations + */ +/** + * @type {Operations} + */ +const operations = Object.freeze({ + ArrayExpression(node, initialScope) { + const elements = getElementValues(node.elements, initialScope); + return elements != null ? { value: elements } : null + }, + + AssignmentExpression(node, initialScope) { + if (node.operator === "=") { + return getStaticValueR(node.right, initialScope) + } + return null + }, + + //eslint-disable-next-line complexity + BinaryExpression(node, initialScope) { + if (node.operator === "in" || node.operator === "instanceof") { + // Not supported. + return null + } + + const left = getStaticValueR(node.left, initialScope); + const right = getStaticValueR(node.right, initialScope); + if (left != null && right != null) { + switch (node.operator) { + case "==": + return { value: left.value == right.value } //eslint-disable-line eqeqeq + case "!=": + return { value: left.value != right.value } //eslint-disable-line eqeqeq + case "===": + return { value: left.value === right.value } + case "!==": + return { value: left.value !== right.value } + case "<": + return { + value: + /** @type {any} */ (left.value) < + /** @type {any} */ (right.value), + } + case "<=": + return { + value: + /** @type {any} */ (left.value) <= + /** @type {any} */ (right.value), + } + case ">": + return { + value: + /** @type {any} */ (left.value) > + /** @type {any} */ (right.value), + } + case ">=": + return { + value: + /** @type {any} */ (left.value) >= + /** @type {any} */ (right.value), + } + case "<<": + return { + value: + /** @type {any} */ (left.value) << + /** @type {any} */ (right.value), + } + case ">>": + return { + value: + /** @type {any} */ (left.value) >> + /** @type {any} */ (right.value), + } + case ">>>": + return { + value: + /** @type {any} */ (left.value) >>> + /** @type {any} */ (right.value), + } + case "+": + return { + value: + /** @type {any} */ (left.value) + + /** @type {any} */ (right.value), + } + case "-": + return { + value: + /** @type {any} */ (left.value) - + /** @type {any} */ (right.value), + } + case "*": + return { + value: + /** @type {any} */ (left.value) * + /** @type {any} */ (right.value), + } + case "/": + return { + value: + /** @type {any} */ (left.value) / + /** @type {any} */ (right.value), + } + case "%": + return { + value: + /** @type {any} */ (left.value) % + /** @type {any} */ (right.value), + } + case "**": + return { + value: + /** @type {any} */ (left.value) ** + /** @type {any} */ (right.value), + } + case "|": + return { + value: + /** @type {any} */ (left.value) | + /** @type {any} */ (right.value), + } + case "^": + return { + value: + /** @type {any} */ (left.value) ^ + /** @type {any} */ (right.value), + } + case "&": + return { + value: + /** @type {any} */ (left.value) & + /** @type {any} */ (right.value), + } + + // no default + } + } + + return null + }, + + CallExpression(node, initialScope) { + const calleeNode = node.callee; + const args = getElementValues(node.arguments, initialScope); + + if (args != null) { + if (calleeNode.type === "MemberExpression") { + if (calleeNode.property.type === "PrivateIdentifier") { + return null + } + const object = getStaticValueR(calleeNode.object, initialScope); + if (object != null) { + if ( + object.value == null && + (object.optional || node.optional) + ) { + return { value: undefined, optional: true } + } + const property = getStaticPropertyNameValue( + calleeNode, + initialScope, + ); + + if (property != null) { + const receiver = + /** @type {Record any>} */ ( + object.value + ); + const methodName = /** @type {PropertyKey} */ ( + property.value + ); + if (callAllowed.has(receiver[methodName])) { + return { + value: receiver[methodName](...args), + } + } + if (callPassThrough.has(receiver[methodName])) { + return { value: args[0] } + } + } + } + } else { + const callee = getStaticValueR(calleeNode, initialScope); + if (callee != null) { + if (callee.value == null && node.optional) { + return { value: undefined, optional: true } + } + const func = /** @type {(...args: any[]) => any} */ ( + callee.value + ); + if (callAllowed.has(func)) { + return { value: func(...args) } + } + if (callPassThrough.has(func)) { + return { value: args[0] } + } + } + } + } + + return null + }, + + ConditionalExpression(node, initialScope) { + const test = getStaticValueR(node.test, initialScope); + if (test != null) { + return test.value + ? getStaticValueR(node.consequent, initialScope) + : getStaticValueR(node.alternate, initialScope) + } + return null + }, + + ExpressionStatement(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + + Identifier(node, initialScope) { + if (initialScope != null) { + const variable = findVariable(initialScope, node); + + if (variable != null) { + // Built-in globals. + if (isBuiltinGlobal(variable)) { + return { value: globalObject[variable.name] } + } + + // Constants. + if (canBeConsideredConst(variable)) { + const def = variable.defs[0]; + if ( + // TODO(mysticatea): don't support destructuring here. + def.node.id.type === "Identifier" + ) { + const init = getStaticValueR( + def.node.init, + initialScope, + ); + if ( + init && + typeof init.value === "object" && + init.value !== null + ) { + if (hasMutationInProperty(variable, initialScope)) { + // This variable has mutation in its property. + return null + } + } + return init + } + } + } + } + return null + }, + + Literal(node) { + const literal = + /** @type {Partial & Partial & Partial} */ ( + node + ); + //istanbul ignore if : this is implementation-specific behavior. + if ( + (literal.regex != null || literal.bigint != null) && + literal.value == null + ) { + // It was a RegExp/BigInt literal, but Node.js didn't support it. + return null + } + return { value: literal.value } + }, + + LogicalExpression(node, initialScope) { + const left = getStaticValueR(node.left, initialScope); + if (left != null) { + if ( + (node.operator === "||" && Boolean(left.value) === true) || + (node.operator === "&&" && Boolean(left.value) === false) || + (node.operator === "??" && left.value != null) + ) { + return left + } + + const right = getStaticValueR(node.right, initialScope); + if (right != null) { + return right + } + } + + return null + }, + + MemberExpression(node, initialScope) { + if (node.property.type === "PrivateIdentifier") { + return null + } + const object = getStaticValueR(node.object, initialScope); + if (object != null) { + if (object.value == null && (object.optional || node.optional)) { + return { value: undefined, optional: true } + } + const property = getStaticPropertyNameValue(node, initialScope); + + if (property != null) { + if ( + !isGetter( + /** @type {object} */ (object.value), + /** @type {PropertyKey} */ (property.value), + ) + ) { + return { + value: /** @type {Record} */ ( + object.value + )[/** @type {PropertyKey} */ (property.value)], + } + } + + for (const [classFn, allowed] of getterAllowed) { + if ( + object.value instanceof classFn && + allowed.has(/** @type {string} */ (property.value)) + ) { + return { + value: /** @type {Record} */ ( + object.value + )[/** @type {PropertyKey} */ (property.value)], + } + } + } + } + } + return null + }, + + ChainExpression(node, initialScope) { + const expression = getStaticValueR(node.expression, initialScope); + if (expression != null) { + return { value: expression.value } + } + return null + }, + + NewExpression(node, initialScope) { + const callee = getStaticValueR(node.callee, initialScope); + const args = getElementValues(node.arguments, initialScope); + + if (callee != null && args != null) { + const Func = /** @type {new (...args: any[]) => any} */ ( + callee.value + ); + if (callAllowed.has(Func)) { + return { value: new Func(...args) } + } + } + + return null + }, + + ObjectExpression(node, initialScope) { + /** @type {Record} */ + const object = {}; + + for (const propertyNode of node.properties) { + if (propertyNode.type === "Property") { + if (propertyNode.kind !== "init") { + return null + } + const key = getStaticPropertyNameValue( + propertyNode, + initialScope, + ); + const value = getStaticValueR(propertyNode.value, initialScope); + if (key == null || value == null) { + return null + } + object[/** @type {PropertyKey} */ (key.value)] = value.value; + } else if ( + propertyNode.type === "SpreadElement" || + // @ts-expect-error -- Backward compatibility + propertyNode.type === "ExperimentalSpreadProperty" + ) { + const argument = getStaticValueR( + propertyNode.argument, + initialScope, + ); + if (argument == null) { + return null + } + Object.assign(object, argument.value); + } else { + return null + } + } + + return { value: object } + }, + + SequenceExpression(node, initialScope) { + const last = node.expressions[node.expressions.length - 1]; + return getStaticValueR(last, initialScope) + }, + + TaggedTemplateExpression(node, initialScope) { + const tag = getStaticValueR(node.tag, initialScope); + const expressions = getElementValues( + node.quasi.expressions, + initialScope, + ); + + if (tag != null && expressions != null) { + const func = /** @type {(...args: any[]) => any} */ (tag.value); + /** @type {any[] & { raw?: string[] }} */ + const strings = node.quasi.quasis.map((q) => q.value.cooked); + strings.raw = node.quasi.quasis.map((q) => q.value.raw); + + if (func === String.raw) { + return { value: func(strings, ...expressions) } + } + } + + return null + }, + + TemplateLiteral(node, initialScope) { + const expressions = getElementValues(node.expressions, initialScope); + if (expressions != null) { + let value = node.quasis[0].value.cooked; + for (let i = 0; i < expressions.length; ++i) { + value += expressions[i]; + value += /** @type {string} */ (node.quasis[i + 1].value.cooked); + } + return { value } + } + return null + }, + + UnaryExpression(node, initialScope) { + if (node.operator === "delete") { + // Not supported. + return null + } + if (node.operator === "void") { + return { value: undefined } + } + + const arg = getStaticValueR(node.argument, initialScope); + if (arg != null) { + switch (node.operator) { + case "-": + return { value: -(/** @type {any} */ (arg.value)) } + case "+": + return { value: +(/** @type {any} */ (arg.value)) } //eslint-disable-line no-implicit-coercion + case "!": + return { value: !arg.value } + case "~": + return { value: ~(/** @type {any} */ (arg.value)) } + case "typeof": + return { value: typeof arg.value } + + // no default + } + } + + return null + }, + TSAsExpression(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + TSSatisfiesExpression(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + TSTypeAssertion(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + TSNonNullExpression(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, + TSInstantiationExpression(node, initialScope) { + return getStaticValueR(node.expression, initialScope) + }, +}); + +/** + * Get the value of a given node if it's a static value. + * @param {Node|TSESTreeNode|null|undefined} node The node to get. + * @param {Scope|undefined|null} initialScope The scope to start finding variable. + * @returns {StaticValue|null} The static value of the node, or `null`. + */ +function getStaticValueR(node, initialScope) { + if (node != null && Object.hasOwnProperty.call(operations, node.type)) { + return /** @type {VisitorCallback} */ (operations[node.type])( + /** @type {TSESTreeNode} */ (node), + initialScope, + ) + } + return null +} + +/** + * Get the static value of property name from a MemberExpression node or a Property node. + * @param {MemberExpression|Property} node The node to get. + * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it. + * @returns {StaticValue|null} The static value of the property name of the node, or `null`. + */ +function getStaticPropertyNameValue(node, initialScope) { + const nameNode = node.type === "Property" ? node.key : node.property; + + if (node.computed) { + return getStaticValueR(nameNode, initialScope) + } + + if (nameNode.type === "Identifier") { + return { value: nameNode.name } + } + + if (nameNode.type === "Literal") { + if (/** @type {Partial} */ (nameNode).bigint) { + return { value: /** @type {BigIntLiteral} */ (nameNode).bigint } + } + return { value: String(nameNode.value) } + } + + return null +} + +/** + * Get the value of a given node if it's a static value. + * @param {Node} node The node to get. + * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If this scope was given, this tries to resolve identifier references which are in the given node as much as possible. + * @returns {StaticValue | null} The static value of the node, or `null`. + */ +function getStaticValue(node, initialScope = null) { + try { + return getStaticValueR(node, initialScope) + } catch (_error) { + return null + } +} + +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("estree").RegExpLiteral} RegExpLiteral */ +/** @typedef {import("estree").BigIntLiteral} BigIntLiteral */ +/** @typedef {import("estree").SimpleLiteral} SimpleLiteral */ + +/** + * Get the value of a given node if it's a literal or a template literal. + * @param {Node} node The node to get. + * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If the node is an Identifier node and this scope was given, this checks the variable of the identifier, and returns the value of it if the variable is a constant. + * @returns {string|null} The value of the node, or `null`. + */ +function getStringIfConstant(node, initialScope = null) { + // Handle the literals that the platform doesn't support natively. + if (node && node.type === "Literal" && node.value === null) { + const literal = + /** @type {Partial & Partial & Partial} */ ( + node + ); + if (literal.regex) { + return `/${literal.regex.pattern}/${literal.regex.flags}` + } + if (literal.bigint) { + return literal.bigint + } + } + + const evaluated = getStaticValue(node, initialScope); + + if (evaluated) { + // `String(Symbol.prototype)` throws error + try { + return String(evaluated.value) + } catch { + // No op + } + } + + return null +} + +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("estree").MemberExpression} MemberExpression */ +/** @typedef {import("estree").MethodDefinition} MethodDefinition */ +/** @typedef {import("estree").Property} Property */ +/** @typedef {import("estree").PropertyDefinition} PropertyDefinition */ +/** @typedef {import("estree").Identifier} Identifier */ + +/** + * Get the property name from a MemberExpression node or a Property node. + * @param {MemberExpression | MethodDefinition | Property | PropertyDefinition} node The node to get. + * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it. + * @returns {string|null|undefined} The property name of the node. + */ +function getPropertyName(node, initialScope) { + switch (node.type) { + case "MemberExpression": + if (node.computed) { + return getStringIfConstant(node.property, initialScope) + } + if (node.property.type === "PrivateIdentifier") { + return null + } + return /** @type {Partial} */ (node.property).name + + case "Property": + case "MethodDefinition": + case "PropertyDefinition": + if (node.computed) { + return getStringIfConstant(node.key, initialScope) + } + if (node.key.type === "Literal") { + return String(node.key.value) + } + if (node.key.type === "PrivateIdentifier") { + return null + } + return /** @type {Partial} */ (node.key).name + } + + return null +} + +/** @typedef {import("eslint").Rule.Node} RuleNode */ +/** @typedef {import("eslint").SourceCode} SourceCode */ +/** @typedef {import("estree").Function} FunctionNode */ +/** @typedef {import("estree").FunctionDeclaration} FunctionDeclaration */ +/** @typedef {import("estree").FunctionExpression} FunctionExpression */ +/** @typedef {import("estree").Identifier} Identifier */ + +/** + * Get the name and kind of the given function node. + * @param {FunctionNode} node - The function node to get. + * @param {SourceCode} [sourceCode] The source code object to get the code of computed property keys. + * @returns {string} The name and kind of the function node. + */ +// eslint-disable-next-line complexity +function getFunctionNameWithKind(node, sourceCode) { + const parent = /** @type {RuleNode} */ (node).parent; + + if (!parent) { + return "" + } + + const tokens = []; + const isObjectMethod = parent.type === "Property" && parent.value === node; + const isClassMethod = + parent.type === "MethodDefinition" && parent.value === node; + const isClassFieldMethod = + parent.type === "PropertyDefinition" && parent.value === node; + + // Modifiers. + if (isClassMethod || isClassFieldMethod) { + if (parent.static) { + tokens.push("static"); + } + if (parent.key.type === "PrivateIdentifier") { + tokens.push("private"); + } + } + if (node.async) { + tokens.push("async"); + } + if (node.generator) { + tokens.push("generator"); + } + + // Kinds. + if (isObjectMethod || isClassMethod) { + if (parent.kind === "constructor") { + return "constructor" + } + if (parent.kind === "get") { + tokens.push("getter"); + } else if (parent.kind === "set") { + tokens.push("setter"); + } else { + tokens.push("method"); + } + } else if (isClassFieldMethod) { + tokens.push("method"); + } else { + if (node.type === "ArrowFunctionExpression") { + tokens.push("arrow"); + } + tokens.push("function"); + } + + // Names. + if (isObjectMethod || isClassMethod || isClassFieldMethod) { + if (parent.key.type === "PrivateIdentifier") { + tokens.push(`#${parent.key.name}`); + } else { + const name = getPropertyName(parent); + if (name) { + tokens.push(`'${name}'`); + } else if (sourceCode) { + const keyText = sourceCode.getText(parent.key); + if (!keyText.includes("\n")) { + tokens.push(`[${keyText}]`); + } + } + } + } else if (hasId(node)) { + tokens.push(`'${node.id.name}'`); + } else if ( + parent.type === "VariableDeclarator" && + parent.id && + parent.id.type === "Identifier" + ) { + tokens.push(`'${parent.id.name}'`); + } else if ( + (parent.type === "AssignmentExpression" || + parent.type === "AssignmentPattern") && + parent.left && + parent.left.type === "Identifier" + ) { + tokens.push(`'${parent.left.name}'`); + } else if ( + parent.type === "ExportDefaultDeclaration" && + parent.declaration === node + ) { + tokens.push("'default'"); + } + + return tokens.join(" ") +} + +/** + * @param {FunctionNode} node + * @returns {node is FunctionDeclaration | FunctionExpression & { id: Identifier }} + */ +function hasId(node) { + return Boolean( + /** @type {Partial} */ (node) + .id, + ) +} + +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("eslint").SourceCode} SourceCode */ +/** @typedef {import("./types.mjs").HasSideEffectOptions} HasSideEffectOptions */ +/** @typedef {import("estree").BinaryExpression} BinaryExpression */ +/** @typedef {import("estree").MemberExpression} MemberExpression */ +/** @typedef {import("estree").MethodDefinition} MethodDefinition */ +/** @typedef {import("estree").Property} Property */ +/** @typedef {import("estree").PropertyDefinition} PropertyDefinition */ +/** @typedef {import("estree").UnaryExpression} UnaryExpression */ + +const typeConversionBinaryOps = Object.freeze( + new Set([ + "==", + "!=", + "<", + "<=", + ">", + ">=", + "<<", + ">>", + ">>>", + "+", + "-", + "*", + "/", + "%", + "|", + "^", + "&", + "in", + ]), +); +const typeConversionUnaryOps = Object.freeze(new Set(["-", "+", "!", "~"])); + +/** + * Check whether the given value is an ASTNode or not. + * @param {any} x The value to check. + * @returns {x is Node} `true` if the value is an ASTNode. + */ +function isNode(x) { + return x !== null && typeof x === "object" && typeof x.type === "string" +} + +const visitor = Object.freeze( + Object.assign(Object.create(null), { + /** + * @param {Node} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + $visit(node, options, visitorKeys) { + const { type } = node; + + if (typeof (/** @type {any} */ (this)[type]) === "function") { + return /** @type {any} */ (this)[type]( + node, + options, + visitorKeys, + ) + } + + return this.$visitChildren(node, options, visitorKeys) + }, + + /** + * @param {Node} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + $visitChildren(node, options, visitorKeys) { + const { type } = node; + + for (const key of /** @type {(keyof Node)[]} */ ( + visitorKeys[type] || getKeys(node) + )) { + const value = node[key]; + + if (Array.isArray(value)) { + for (const element of value) { + if ( + isNode(element) && + this.$visit(element, options, visitorKeys) + ) { + return true + } + } + } else if ( + isNode(value) && + this.$visit(value, options, visitorKeys) + ) { + return true + } + } + + return false + }, + + ArrowFunctionExpression() { + return false + }, + AssignmentExpression() { + return true + }, + AwaitExpression() { + return true + }, + /** + * @param {BinaryExpression} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + BinaryExpression(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + typeConversionBinaryOps.has(node.operator) && + (node.left.type !== "Literal" || node.right.type !== "Literal") + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + CallExpression() { + return true + }, + FunctionExpression() { + return false + }, + ImportExpression() { + return true + }, + /** + * @param {MemberExpression} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + MemberExpression(node, options, visitorKeys) { + if (options.considerGetters) { + return true + } + if ( + options.considerImplicitTypeConversion && + node.computed && + node.property.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + /** + * @param {MethodDefinition} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + MethodDefinition(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + NewExpression() { + return true + }, + /** + * @param {Property} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + Property(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + /** + * @param {PropertyDefinition} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + PropertyDefinition(node, options, visitorKeys) { + if ( + options.considerImplicitTypeConversion && + node.computed && + node.key.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + /** + * @param {UnaryExpression} node + * @param {HasSideEffectOptions} options + * @param {Record} visitorKeys + */ + UnaryExpression(node, options, visitorKeys) { + if (node.operator === "delete") { + return true + } + if ( + options.considerImplicitTypeConversion && + typeConversionUnaryOps.has(node.operator) && + node.argument.type !== "Literal" + ) { + return true + } + return this.$visitChildren(node, options, visitorKeys) + }, + UpdateExpression() { + return true + }, + YieldExpression() { + return true + }, + }), +); + +/** + * Check whether a given node has any side effect or not. + * @param {Node} node The node to get. + * @param {SourceCode} sourceCode The source code object. + * @param {HasSideEffectOptions} [options] The option object. + * @returns {boolean} `true` if the node has a certain side effect. + */ +function hasSideEffect(node, sourceCode, options = {}) { + const { considerGetters = false, considerImplicitTypeConversion = false } = + options; + return visitor.$visit( + node, + { considerGetters, considerImplicitTypeConversion }, + sourceCode.visitorKeys || KEYS, + ) +} + +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("@typescript-eslint/types").TSESTree.NewExpression} TSNewExpression */ +/** @typedef {import("@typescript-eslint/types").TSESTree.CallExpression} TSCallExpression */ +/** @typedef {import("eslint").SourceCode} SourceCode */ +/** @typedef {import("eslint").AST.Token} Token */ +/** @typedef {import("eslint").Rule.Node} RuleNode */ + +/** + * Get the left parenthesis of the parent node syntax if it exists. + * E.g., `if (a) {}` then the `(`. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {Token|null} The left parenthesis of the parent node syntax + */ +// eslint-disable-next-line complexity +function getParentSyntaxParen(node, sourceCode) { + const parent = /** @type {RuleNode} */ (node).parent; + + if (!parent) { + return null + } + + switch (parent.type) { + case "CallExpression": + case "NewExpression": + if (parent.arguments.length === 1 && parent.arguments[0] === node) { + return sourceCode.getTokenAfter( + // @ts-expect-error https://github.com/typescript-eslint/typescript-eslint/pull/5384 + parent.typeArguments || + /** @type {RuleNode} */ ( + /** @type {unknown} */ ( + /** @type {TSNewExpression | TSCallExpression} */ ( + parent + ).typeParameters + ) + ) || + parent.callee, + isOpeningParenToken, + ) + } + return null + + case "DoWhileStatement": + if (parent.test === node) { + return sourceCode.getTokenAfter( + parent.body, + isOpeningParenToken, + ) + } + return null + + case "IfStatement": + case "WhileStatement": + if (parent.test === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "ImportExpression": + if (parent.source === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "SwitchStatement": + if (parent.discriminant === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + case "WithStatement": + if (parent.object === node) { + return sourceCode.getFirstToken(parent, 1) + } + return null + + default: + return null + } +} + +/** + * Check whether a given node is parenthesized or not. + * @param {number} times The number of parantheses. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {boolean} `true` if the node is parenthesized the given times. + */ +/** + * Check whether a given node is parenthesized or not. + * @param {Node} node The AST node to check. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {boolean} `true` if the node is parenthesized. + */ +/** + * Check whether a given node is parenthesized or not. + * @param {Node|number} timesOrNode The first parameter. + * @param {Node|SourceCode} nodeOrSourceCode The second parameter. + * @param {SourceCode} [optionalSourceCode] The third parameter. + * @returns {boolean} `true` if the node is parenthesized. + */ +function isParenthesized( + timesOrNode, + nodeOrSourceCode, + optionalSourceCode, +) { + /** @type {number} */ + let times, + /** @type {RuleNode} */ + node, + /** @type {SourceCode} */ + sourceCode, + maybeLeftParen, + maybeRightParen; + if (typeof timesOrNode === "number") { + times = timesOrNode | 0; + node = /** @type {RuleNode} */ (nodeOrSourceCode); + sourceCode = /** @type {SourceCode} */ (optionalSourceCode); + if (!(times >= 1)) { + throw new TypeError("'times' should be a positive integer.") + } + } else { + times = 1; + node = /** @type {RuleNode} */ (timesOrNode); + sourceCode = /** @type {SourceCode} */ (nodeOrSourceCode); + } + + if ( + node == null || + // `Program` can't be parenthesized + node.parent == null || + // `CatchClause.param` can't be parenthesized, example `try {} catch (error) {}` + (node.parent.type === "CatchClause" && node.parent.param === node) + ) { + return false + } + + maybeLeftParen = maybeRightParen = node; + do { + maybeLeftParen = sourceCode.getTokenBefore(maybeLeftParen); + maybeRightParen = sourceCode.getTokenAfter(maybeRightParen); + } while ( + maybeLeftParen != null && + maybeRightParen != null && + isOpeningParenToken(maybeLeftParen) && + isClosingParenToken(maybeRightParen) && + // Avoid false positive such as `if (a) {}` + maybeLeftParen !== getParentSyntaxParen(node, sourceCode) && + --times > 0 + ) + + return times === 0 +} + +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ + +const placeholder = /\$(?:[$&`']|[1-9][0-9]?)/gu; + +/** @type {WeakMap} */ +const internal = new WeakMap(); + +/** + * Check whether a given character is escaped or not. + * @param {string} str The string to check. + * @param {number} index The location of the character to check. + * @returns {boolean} `true` if the character is escaped. + */ +function isEscaped(str, index) { + let escaped = false; + for (let i = index - 1; i >= 0 && str.charCodeAt(i) === 0x5c; --i) { + escaped = !escaped; + } + return escaped +} + +/** + * Replace a given string by a given matcher. + * @param {PatternMatcher} matcher The pattern matcher. + * @param {string} str The string to be replaced. + * @param {string} replacement The new substring to replace each matched part. + * @returns {string} The replaced string. + */ +function replaceS(matcher, str, replacement) { + const chunks = []; + let index = 0; + + /** + * @param {string} key The placeholder. + * @param {RegExpExecArray} match The matched information. + * @returns {string} The replaced string. + */ + function replacer(key, match) { + switch (key) { + case "$$": + return "$" + case "$&": + return match[0] + case "$`": + return str.slice(0, match.index) + case "$'": + return str.slice(match.index + match[0].length) + default: { + const i = key.slice(1); + if (i in match) { + return match[/** @type {any} */ (i)] + } + return key + } + } + } + + for (const match of matcher.execAll(str)) { + chunks.push(str.slice(index, match.index)); + chunks.push( + replacement.replace(placeholder, (key) => replacer(key, match)), + ); + index = match.index + match[0].length; + } + chunks.push(str.slice(index)); + + return chunks.join("") +} + +/** + * Replace a given string by a given matcher. + * @param {PatternMatcher} matcher The pattern matcher. + * @param {string} str The string to be replaced. + * @param {(substring: string, ...args: any[]) => string} replace The function to replace each matched part. + * @returns {string} The replaced string. + */ +function replaceF(matcher, str, replace) { + const chunks = []; + let index = 0; + + for (const match of matcher.execAll(str)) { + chunks.push(str.slice(index, match.index)); + chunks.push( + String( + replace( + .../** @type {[string, ...string[]]} */ ( + /** @type {string[]} */ (match) + ), + match.index, + match.input, + ), + ), + ); + index = match.index + match[0].length; + } + chunks.push(str.slice(index)); + + return chunks.join("") +} + +/** + * The class to find patterns as considering escape sequences. + */ +class PatternMatcher { + /** + * Initialize this matcher. + * @param {RegExp} pattern The pattern to match. + * @param {{escaped?:boolean}} [options] The options. + */ + constructor(pattern, options = {}) { + const { escaped = false } = options; + if (!(pattern instanceof RegExp)) { + throw new TypeError("'pattern' should be a RegExp instance.") + } + if (!pattern.flags.includes("g")) { + throw new Error("'pattern' should contains 'g' flag.") + } + + internal.set(this, { + pattern: new RegExp(pattern.source, pattern.flags), + escaped: Boolean(escaped), + }); + } + + /** + * Find the pattern in a given string. + * @param {string} str The string to find. + * @returns {IterableIterator} The iterator which iterate the matched information. + */ + *execAll(str) { + const { pattern, escaped } = + /** @type {{pattern:RegExp,escaped:boolean}} */ (internal.get(this)); + let match = null; + let lastIndex = 0; + + pattern.lastIndex = 0; + while ((match = pattern.exec(str)) != null) { + if (escaped || !isEscaped(str, match.index)) { + lastIndex = pattern.lastIndex; + yield match; + pattern.lastIndex = lastIndex; + } + } + } + + /** + * Check whether the pattern is found in a given string. + * @param {string} str The string to check. + * @returns {boolean} `true` if the pattern was found in the string. + */ + test(str) { + const it = this.execAll(str); + const ret = it.next(); + return !ret.done + } + + /** + * Replace a given string. + * @param {string} str The string to be replaced. + * @param {(string|((...strs:string[])=>string))} replacer The string or function to replace. This is the same as the 2nd argument of `String.prototype.replace`. + * @returns {string} The replaced string. + */ + [Symbol.replace](str, replacer) { + return typeof replacer === "function" + ? replaceF(this, String(str), replacer) + : replaceS(this, String(str), String(replacer)) + } +} + +/** @typedef {import("eslint").Scope.Scope} Scope */ +/** @typedef {import("eslint").Scope.Variable} Variable */ +/** @typedef {import("eslint").Rule.Node} RuleNode */ +/** @typedef {import("estree").Node} Node */ +/** @typedef {import("estree").Expression} Expression */ +/** @typedef {import("estree").Pattern} Pattern */ +/** @typedef {import("estree").Identifier} Identifier */ +/** @typedef {import("estree").SimpleCallExpression} CallExpression */ +/** @typedef {import("estree").Program} Program */ +/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */ +/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclaration */ +/** @typedef {import("estree").ExportDefaultDeclaration} ExportDefaultDeclaration */ +/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */ +/** @typedef {import("estree").ImportSpecifier} ImportSpecifier */ +/** @typedef {import("estree").ImportDefaultSpecifier} ImportDefaultSpecifier */ +/** @typedef {import("estree").ImportNamespaceSpecifier} ImportNamespaceSpecifier */ +/** @typedef {import("estree").ExportSpecifier} ExportSpecifier */ +/** @typedef {import("estree").Property} Property */ +/** @typedef {import("estree").AssignmentProperty} AssignmentProperty */ +/** @typedef {import("estree").Literal} Literal */ +/** @typedef {import("@typescript-eslint/types").TSESTree.Node} TSESTreeNode */ +/** @typedef {import("./types.mjs").ReferenceTrackerOptions} ReferenceTrackerOptions */ +/** + * @template T + * @typedef {import("./types.mjs").TraceMap} TraceMap + */ +/** + * @template T + * @typedef {import("./types.mjs").TraceMapObject} TraceMapObject + */ +/** + * @template T + * @typedef {import("./types.mjs").TrackedReferences} TrackedReferences + */ + +const IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u; + +/** + * Check whether a given node is an import node or not. + * @param {Node} node + * @returns {node is ImportDeclaration|ExportAllDeclaration|ExportNamedDeclaration&{source: Literal}} `true` if the node is an import node. + */ +function isHasSource(node) { + return ( + IMPORT_TYPE.test(node.type) && + /** @type {ImportDeclaration|ExportAllDeclaration|ExportNamedDeclaration} */ ( + node + ).source != null + ) +} +const has = + /** @type {(traceMap: TraceMap, v: T) => v is (string extends T ? string : T)} */ ( + Function.call.bind(Object.hasOwnProperty) + ); + +const READ = Symbol("read"); +const CALL = Symbol("call"); +const CONSTRUCT = Symbol("construct"); +const ESM = Symbol("esm"); + +const requireCall = { require: { [CALL]: true } }; + +/** + * Check whether a given variable is modified or not. + * @param {Variable|undefined} variable The variable to check. + * @returns {boolean} `true` if the variable is modified. + */ +function isModifiedGlobal(variable) { + return ( + variable == null || + variable.defs.length !== 0 || + variable.references.some((r) => r.isWrite()) + ) +} + +/** + * Check if the value of a given node is passed through to the parent syntax as-is. + * For example, `a` and `b` in (`a || b` and `c ? a : b`) are passed through. + * @param {Node} node A node to check. + * @returns {node is RuleNode & {parent: Expression}} `true` if the node is passed through. + */ +function isPassThrough(node) { + const parent = /** @type {TSESTreeNode} */ (node).parent; + + if (parent) { + switch (parent.type) { + case "ConditionalExpression": + return parent.consequent === node || parent.alternate === node + case "LogicalExpression": + return true + case "SequenceExpression": + return ( + parent.expressions[parent.expressions.length - 1] === node + ) + case "ChainExpression": + return true + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSTypeAssertion": + case "TSNonNullExpression": + case "TSInstantiationExpression": + return true + + default: + return false + } + } + return false +} + +/** + * The reference tracker. + */ +class ReferenceTracker { + /** + * Initialize this tracker. + * @param {Scope} globalScope The global scope. + * @param {object} [options] The options. + * @param {"legacy"|"strict"} [options.mode="strict"] The mode to determine the ImportDeclaration's behavior for CJS modules. + * @param {string[]} [options.globalObjectNames=["global","globalThis","self","window"]] The variable names for Global Object. + */ + constructor(globalScope, options = {}) { + const { + mode = "strict", + globalObjectNames = ["global", "globalThis", "self", "window"], + } = options; + /** @private @type {Variable[]} */ + this.variableStack = []; + /** @private */ + this.globalScope = globalScope; + /** @private */ + this.mode = mode; + /** @private */ + this.globalObjectNames = globalObjectNames.slice(0); + } + + /** + * Iterate the references of global variables. + * @template T + * @param {TraceMap} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *iterateGlobalReferences(traceMap) { + for (const key of Object.keys(traceMap)) { + const nextTraceMap = traceMap[key]; + const path = [key]; + const variable = this.globalScope.set.get(key); + + if (isModifiedGlobal(variable)) { + continue + } + + yield* this._iterateVariableReferences( + /** @type {Variable} */ (variable), + path, + nextTraceMap, + true, + ); + } + + for (const key of this.globalObjectNames) { + /** @type {string[]} */ + const path = []; + const variable = this.globalScope.set.get(key); + + if (isModifiedGlobal(variable)) { + continue + } + + yield* this._iterateVariableReferences( + /** @type {Variable} */ (variable), + path, + traceMap, + false, + ); + } + } + + /** + * Iterate the references of CommonJS modules. + * @template T + * @param {TraceMap} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *iterateCjsReferences(traceMap) { + for (const { node } of this.iterateGlobalReferences(requireCall)) { + const key = getStringIfConstant( + /** @type {CallExpression} */ (node).arguments[0], + ); + if (key == null || !has(traceMap, key)) { + continue + } + + const nextTraceMap = traceMap[key]; + const path = [key]; + + if (nextTraceMap[READ]) { + yield { + node, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iteratePropertyReferences( + /** @type {CallExpression} */ (node), + path, + nextTraceMap, + ); + } + } + + /** + * Iterate the references of ES modules. + * @template T + * @param {TraceMap} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *iterateEsmReferences(traceMap) { + const programNode = /** @type {Program} */ (this.globalScope.block); + + for (const node of programNode.body) { + if (!isHasSource(node)) { + continue + } + const moduleId = /** @type {string} */ (node.source.value); + + if (!has(traceMap, moduleId)) { + continue + } + const nextTraceMap = traceMap[moduleId]; + const path = [moduleId]; + + if (nextTraceMap[READ]) { + yield { + // eslint-disable-next-line object-shorthand -- apply type + node: /** @type {RuleNode} */ (node), + path, + type: READ, + info: nextTraceMap[READ], + }; + } + + if (node.type === "ExportAllDeclaration") { + for (const key of Object.keys(nextTraceMap)) { + const exportTraceMap = nextTraceMap[key]; + if (exportTraceMap[READ]) { + yield { + // eslint-disable-next-line object-shorthand -- apply type + node: /** @type {RuleNode} */ (node), + path: path.concat(key), + type: READ, + info: exportTraceMap[READ], + }; + } + } + } else { + for (const specifier of node.specifiers) { + const esm = has(nextTraceMap, ESM); + const it = this._iterateImportReferences( + specifier, + path, + esm + ? nextTraceMap + : this.mode === "legacy" + ? { default: nextTraceMap, ...nextTraceMap } + : { default: nextTraceMap }, + ); + + if (esm) { + yield* it; + } else { + for (const report of it) { + report.path = report.path.filter(exceptDefault); + if ( + report.path.length >= 2 || + report.type !== READ + ) { + yield report; + } + } + } + } + } + } + } + + /** + * Iterate the property references for a given expression AST node. + * @template T + * @param {Expression} node The expression AST node to iterate property references. + * @param {TraceMap} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate property references. + */ + *iteratePropertyReferences(node, traceMap) { + yield* this._iteratePropertyReferences(node, [], traceMap); + } + + /** + * Iterate the references for a given variable. + * @private + * @template T + * @param {Variable} variable The variable to iterate that references. + * @param {string[]} path The current path. + * @param {TraceMapObject} traceMap The trace map. + * @param {boolean} shouldReport = The flag to report those references. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *_iterateVariableReferences(variable, path, traceMap, shouldReport) { + if (this.variableStack.includes(variable)) { + return + } + this.variableStack.push(variable); + try { + for (const reference of variable.references) { + if (!reference.isRead()) { + continue + } + const node = /** @type {RuleNode & Identifier} */ ( + reference.identifier + ); + + if (shouldReport && traceMap[READ]) { + yield { node, path, type: READ, info: traceMap[READ] }; + } + yield* this._iteratePropertyReferences(node, path, traceMap); + } + } finally { + this.variableStack.pop(); + } + } + + /** + * Iterate the references for a given AST node. + * @private + * @template T + * @param {Expression} rootNode The AST node to iterate references. + * @param {string[]} path The current path. + * @param {TraceMapObject} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + //eslint-disable-next-line complexity + *_iteratePropertyReferences(rootNode, path, traceMap) { + let node = rootNode; + while (isPassThrough(node)) { + node = node.parent; + } + + const parent = /** @type {RuleNode} */ (node).parent; + if (!parent) { + return + } + if (parent.type === "MemberExpression") { + if (parent.object === node) { + const key = getPropertyName(parent); + if (key == null || !has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: parent, + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iteratePropertyReferences( + parent, + path, + nextTraceMap, + ); + } + return + } + if (parent.type === "CallExpression") { + if (parent.callee === node && traceMap[CALL]) { + yield { node: parent, path, type: CALL, info: traceMap[CALL] }; + } + return + } + if (parent.type === "NewExpression") { + if (parent.callee === node && traceMap[CONSTRUCT]) { + yield { + node: parent, + path, + type: CONSTRUCT, + info: traceMap[CONSTRUCT], + }; + } + return + } + if (parent.type === "AssignmentExpression") { + if (parent.right === node) { + yield* this._iterateLhsReferences(parent.left, path, traceMap); + yield* this._iteratePropertyReferences(parent, path, traceMap); + } + return + } + if (parent.type === "AssignmentPattern") { + if (parent.right === node) { + yield* this._iterateLhsReferences(parent.left, path, traceMap); + } + return + } + if (parent.type === "VariableDeclarator") { + if (parent.init === node) { + yield* this._iterateLhsReferences(parent.id, path, traceMap); + } + } + } + + /** + * Iterate the references for a given Pattern node. + * @private + * @template T + * @param {Pattern} patternNode The Pattern node to iterate references. + * @param {string[]} path The current path. + * @param {TraceMapObject} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *_iterateLhsReferences(patternNode, path, traceMap) { + if (patternNode.type === "Identifier") { + const variable = findVariable(this.globalScope, patternNode); + if (variable != null) { + yield* this._iterateVariableReferences( + variable, + path, + traceMap, + false, + ); + } + return + } + if (patternNode.type === "ObjectPattern") { + for (const property of patternNode.properties) { + const key = getPropertyName( + /** @type {AssignmentProperty} */ (property), + ); + + if (key == null || !has(traceMap, key)) { + continue + } + + const nextPath = path.concat(key); + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: /** @type {RuleNode} */ (property), + path: nextPath, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iterateLhsReferences( + /** @type {AssignmentProperty} */ (property).value, + nextPath, + nextTraceMap, + ); + } + return + } + if (patternNode.type === "AssignmentPattern") { + yield* this._iterateLhsReferences(patternNode.left, path, traceMap); + } + } + + /** + * Iterate the references for a given ModuleSpecifier node. + * @private + * @template T + * @param {ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier} specifierNode The ModuleSpecifier node to iterate references. + * @param {string[]} path The current path. + * @param {TraceMapObject} traceMap The trace map. + * @returns {IterableIterator>} The iterator to iterate references. + */ + *_iterateImportReferences(specifierNode, path, traceMap) { + const type = specifierNode.type; + + if (type === "ImportSpecifier" || type === "ImportDefaultSpecifier") { + const key = + type === "ImportDefaultSpecifier" + ? "default" + : specifierNode.imported.type === "Identifier" + ? specifierNode.imported.name + : specifierNode.imported.value; + if (!has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: /** @type {RuleNode} */ (specifierNode), + path, + type: READ, + info: nextTraceMap[READ], + }; + } + yield* this._iterateVariableReferences( + /** @type {Variable} */ ( + findVariable(this.globalScope, specifierNode.local) + ), + path, + nextTraceMap, + false, + ); + + return + } + + if (type === "ImportNamespaceSpecifier") { + yield* this._iterateVariableReferences( + /** @type {Variable} */ ( + findVariable(this.globalScope, specifierNode.local) + ), + path, + traceMap, + false, + ); + return + } + + if (type === "ExportSpecifier") { + const key = + specifierNode.local.type === "Identifier" + ? specifierNode.local.name + : specifierNode.local.value; + if (!has(traceMap, key)) { + return + } + + path = path.concat(key); //eslint-disable-line no-param-reassign + const nextTraceMap = traceMap[key]; + if (nextTraceMap[READ]) { + yield { + node: /** @type {RuleNode} */ (specifierNode), + path, + type: READ, + info: nextTraceMap[READ], + }; + } + } + } +} + +ReferenceTracker.READ = READ; +ReferenceTracker.CALL = CALL; +ReferenceTracker.CONSTRUCT = CONSTRUCT; +ReferenceTracker.ESM = ESM; + +/** + * This is a predicate function for Array#filter. + * @param {string} name A name part. + * @param {number} index The index of the name. + * @returns {boolean} `false` if it's default. + */ +function exceptDefault(name, index) { + return !(index === 1 && name === "default") +} + +/** @typedef {import("./types.mjs").StaticValue} StaticValue */ + +var index = { + CALL, + CONSTRUCT, + ESM, + findVariable, + getFunctionHeadLocation, + getFunctionNameWithKind, + getInnermostScope, + getPropertyName, + getStaticValue, + getStringIfConstant, + hasSideEffect, + isArrowToken, + isClosingBraceToken, + isClosingBracketToken, + isClosingParenToken, + isColonToken, + isCommaToken, + isCommentToken, + isNotArrowToken, + isNotClosingBraceToken, + isNotClosingBracketToken, + isNotClosingParenToken, + isNotColonToken, + isNotCommaToken, + isNotCommentToken, + isNotOpeningBraceToken, + isNotOpeningBracketToken, + isNotOpeningParenToken, + isNotSemicolonToken, + isOpeningBraceToken, + isOpeningBracketToken, + isOpeningParenToken, + isParenthesized, + isSemicolonToken, + PatternMatcher, + READ, + ReferenceTracker, +}; + +export { CALL, CONSTRUCT, ESM, PatternMatcher, READ, ReferenceTracker, index as default, findVariable, getFunctionHeadLocation, getFunctionNameWithKind, getInnermostScope, getPropertyName, getStaticValue, getStringIfConstant, hasSideEffect, isArrowToken, isClosingBraceToken, isClosingBracketToken, isClosingParenToken, isColonToken, isCommaToken, isCommentToken, isNotArrowToken, isNotClosingBraceToken, isNotClosingBracketToken, isNotClosingParenToken, isNotColonToken, isNotCommaToken, isNotCommentToken, isNotOpeningBraceToken, isNotOpeningBracketToken, isNotOpeningParenToken, isNotSemicolonToken, isOpeningBraceToken, isOpeningBracketToken, isOpeningParenToken, isParenthesized, isSemicolonToken }; +//# sourceMappingURL=index.mjs.map diff --git a/node_modules/@eslint-community/eslint-utils/index.mjs.map b/node_modules/@eslint-community/eslint-utils/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..05bc640101383306b9c8eb0b753f16cfba9dabe4 --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["src/get-innermost-scope.mjs","src/find-variable.mjs","src/token-predicate.mjs","src/get-function-head-location.mjs","src/get-static-value.mjs","src/get-string-if-constant.mjs","src/get-property-name.mjs","src/get-function-name-with-kind.mjs","src/has-side-effect.mjs","src/is-parenthesized.mjs","src/pattern-matcher.mjs","src/reference-tracker.mjs","src/index.mjs"],"sourcesContent":["/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"estree\").Node} Node */\n\n/**\n * Get the innermost scope which contains a given location.\n * @param {Scope} initialScope The initial scope to search.\n * @param {Node} node The location to search.\n * @returns {Scope} The innermost scope.\n */\nexport function getInnermostScope(initialScope, node) {\n const location = /** @type {[number, number]} */ (node.range)[0]\n\n let scope = initialScope\n let found = false\n do {\n found = false\n for (const childScope of scope.childScopes) {\n const range = /** @type {[number, number]} */ (\n childScope.block.range\n )\n\n if (range[0] <= location && location < range[1]) {\n scope = childScope\n found = true\n break\n }\n }\n } while (found)\n\n return scope\n}\n","import { getInnermostScope } from \"./get-innermost-scope.mjs\"\n/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"eslint\").Scope.Variable} Variable */\n/** @typedef {import(\"estree\").Identifier} Identifier */\n\n/**\n * Find the variable of a given name.\n * @param {Scope} initialScope The scope to start finding.\n * @param {string|Identifier} nameOrNode The variable name to find. If this is a Node object then it should be an Identifier node.\n * @returns {Variable|null} The found variable or null.\n */\nexport function findVariable(initialScope, nameOrNode) {\n let name = \"\"\n /** @type {Scope|null} */\n let scope = initialScope\n\n if (typeof nameOrNode === \"string\") {\n name = nameOrNode\n } else {\n name = nameOrNode.name\n scope = getInnermostScope(scope, nameOrNode)\n }\n\n while (scope != null) {\n const variable = scope.set.get(name)\n if (variable != null) {\n return variable\n }\n scope = scope.upper\n }\n\n return null\n}\n","/** @typedef {import(\"eslint\").AST.Token} Token */\n/** @typedef {import(\"estree\").Comment} Comment */\n/** @typedef {import(\"./types.mjs\").ArrowToken} ArrowToken */\n/** @typedef {import(\"./types.mjs\").CommaToken} CommaToken */\n/** @typedef {import(\"./types.mjs\").SemicolonToken} SemicolonToken */\n/** @typedef {import(\"./types.mjs\").ColonToken} ColonToken */\n/** @typedef {import(\"./types.mjs\").OpeningParenToken} OpeningParenToken */\n/** @typedef {import(\"./types.mjs\").ClosingParenToken} ClosingParenToken */\n/** @typedef {import(\"./types.mjs\").OpeningBracketToken} OpeningBracketToken */\n/** @typedef {import(\"./types.mjs\").ClosingBracketToken} ClosingBracketToken */\n/** @typedef {import(\"./types.mjs\").OpeningBraceToken} OpeningBraceToken */\n/** @typedef {import(\"./types.mjs\").ClosingBraceToken} ClosingBraceToken */\n/**\n * @template {string} Value\n * @typedef {import(\"./types.mjs\").PunctuatorToken} PunctuatorToken\n */\n\n/** @typedef {Comment | Token} CommentOrToken */\n\n/**\n * Creates the negate function of the given function.\n * @param {function(CommentOrToken):boolean} f - The function to negate.\n * @returns {function(CommentOrToken):boolean} Negated function.\n */\nfunction negate(f) {\n return (token) => !f(token)\n}\n\n/**\n * Checks if the given token is a PunctuatorToken with the given value\n * @template {string} Value\n * @param {CommentOrToken} token - The token to check.\n * @param {Value} value - The value to check.\n * @returns {token is PunctuatorToken} `true` if the token is a PunctuatorToken with the given value.\n */\nfunction isPunctuatorTokenWithValue(token, value) {\n return token.type === \"Punctuator\" && token.value === value\n}\n\n/**\n * Checks if the given token is an arrow token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is ArrowToken} `true` if the token is an arrow token.\n */\nexport function isArrowToken(token) {\n return isPunctuatorTokenWithValue(token, \"=>\")\n}\n\n/**\n * Checks if the given token is a comma token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is CommaToken} `true` if the token is a comma token.\n */\nexport function isCommaToken(token) {\n return isPunctuatorTokenWithValue(token, \",\")\n}\n\n/**\n * Checks if the given token is a semicolon token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is SemicolonToken} `true` if the token is a semicolon token.\n */\nexport function isSemicolonToken(token) {\n return isPunctuatorTokenWithValue(token, \";\")\n}\n\n/**\n * Checks if the given token is a colon token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is ColonToken} `true` if the token is a colon token.\n */\nexport function isColonToken(token) {\n return isPunctuatorTokenWithValue(token, \":\")\n}\n\n/**\n * Checks if the given token is an opening parenthesis token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is OpeningParenToken} `true` if the token is an opening parenthesis token.\n */\nexport function isOpeningParenToken(token) {\n return isPunctuatorTokenWithValue(token, \"(\")\n}\n\n/**\n * Checks if the given token is a closing parenthesis token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is ClosingParenToken} `true` if the token is a closing parenthesis token.\n */\nexport function isClosingParenToken(token) {\n return isPunctuatorTokenWithValue(token, \")\")\n}\n\n/**\n * Checks if the given token is an opening square bracket token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is OpeningBracketToken} `true` if the token is an opening square bracket token.\n */\nexport function isOpeningBracketToken(token) {\n return isPunctuatorTokenWithValue(token, \"[\")\n}\n\n/**\n * Checks if the given token is a closing square bracket token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is ClosingBracketToken} `true` if the token is a closing square bracket token.\n */\nexport function isClosingBracketToken(token) {\n return isPunctuatorTokenWithValue(token, \"]\")\n}\n\n/**\n * Checks if the given token is an opening brace token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is OpeningBraceToken} `true` if the token is an opening brace token.\n */\nexport function isOpeningBraceToken(token) {\n return isPunctuatorTokenWithValue(token, \"{\")\n}\n\n/**\n * Checks if the given token is a closing brace token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is ClosingBraceToken} `true` if the token is a closing brace token.\n */\nexport function isClosingBraceToken(token) {\n return isPunctuatorTokenWithValue(token, \"}\")\n}\n\n/**\n * Checks if the given token is a comment token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is Comment} `true` if the token is a comment token.\n */\nexport function isCommentToken(token) {\n return [\"Block\", \"Line\", \"Shebang\"].includes(token.type)\n}\n\nexport const isNotArrowToken = negate(isArrowToken)\nexport const isNotCommaToken = negate(isCommaToken)\nexport const isNotSemicolonToken = negate(isSemicolonToken)\nexport const isNotColonToken = negate(isColonToken)\nexport const isNotOpeningParenToken = negate(isOpeningParenToken)\nexport const isNotClosingParenToken = negate(isClosingParenToken)\nexport const isNotOpeningBracketToken = negate(isOpeningBracketToken)\nexport const isNotClosingBracketToken = negate(isClosingBracketToken)\nexport const isNotOpeningBraceToken = negate(isOpeningBraceToken)\nexport const isNotClosingBraceToken = negate(isClosingBraceToken)\nexport const isNotCommentToken = negate(isCommentToken)\n","import { isArrowToken, isOpeningParenToken } from \"./token-predicate.mjs\"\n/** @typedef {import(\"eslint\").Rule.Node} RuleNode */\n/** @typedef {import(\"eslint\").SourceCode} SourceCode */\n/** @typedef {import(\"eslint\").AST.Token} Token */\n/** @typedef {import(\"estree\").Function} FunctionNode */\n/** @typedef {import(\"estree\").FunctionDeclaration} FunctionDeclaration */\n/** @typedef {import(\"estree\").FunctionExpression} FunctionExpression */\n/** @typedef {import(\"estree\").SourceLocation} SourceLocation */\n/** @typedef {import(\"estree\").Position} Position */\n\n/**\n * Get the `(` token of the given function node.\n * @param {FunctionExpression | FunctionDeclaration} node - The function node to get.\n * @param {SourceCode} sourceCode - The source code object to get tokens.\n * @returns {Token} `(` token.\n */\nfunction getOpeningParenOfParams(node, sourceCode) {\n return node.id\n ? /** @type {Token} */ (\n sourceCode.getTokenAfter(node.id, isOpeningParenToken)\n )\n : /** @type {Token} */ (\n sourceCode.getFirstToken(node, isOpeningParenToken)\n )\n}\n\n/**\n * Get the location of the given function node for reporting.\n * @param {FunctionNode} node - The function node to get.\n * @param {SourceCode} sourceCode - The source code object to get tokens.\n * @returns {SourceLocation|null} The location of the function node for reporting.\n */\nexport function getFunctionHeadLocation(node, sourceCode) {\n const parent = /** @type {RuleNode} */ (node).parent\n\n /** @type {Position|null} */\n let start = null\n /** @type {Position|null} */\n let end = null\n\n if (node.type === \"ArrowFunctionExpression\") {\n const arrowToken = /** @type {Token} */ (\n sourceCode.getTokenBefore(node.body, isArrowToken)\n )\n\n start = arrowToken.loc.start\n end = arrowToken.loc.end\n } else if (\n parent &&\n (parent.type === \"Property\" ||\n parent.type === \"MethodDefinition\" ||\n parent.type === \"PropertyDefinition\")\n ) {\n start = /** @type {SourceLocation} */ (parent.loc).start\n end = getOpeningParenOfParams(node, sourceCode).loc.start\n } else {\n start = /** @type {SourceLocation} */ (node.loc).start\n end = getOpeningParenOfParams(node, sourceCode).loc.start\n }\n\n return {\n start: { ...start },\n end: { ...end },\n }\n}\n","/* globals globalThis, global, self, window */\n\nimport { findVariable } from \"./find-variable.mjs\"\n/** @typedef {import(\"./types.mjs\").StaticValue} StaticValue */\n/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"eslint\").Scope.Variable} Variable */\n/** @typedef {import(\"estree\").Node} Node */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.Node} TSESTreeNode */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.AST_NODE_TYPES} TSESTreeNodeTypes */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.MemberExpression} MemberExpression */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.Property} Property */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.RegExpLiteral} RegExpLiteral */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.BigIntLiteral} BigIntLiteral */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.Literal} Literal */\n\nconst globalObject =\n typeof globalThis !== \"undefined\"\n ? globalThis\n : // @ts-ignore\n typeof self !== \"undefined\"\n ? // @ts-ignore\n self\n : // @ts-ignore\n typeof window !== \"undefined\"\n ? // @ts-ignore\n window\n : typeof global !== \"undefined\"\n ? global\n : {}\n\nconst builtinNames = Object.freeze(\n new Set([\n \"Array\",\n \"ArrayBuffer\",\n \"BigInt\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n \"Boolean\",\n \"DataView\",\n \"Date\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"Float32Array\",\n \"Float64Array\",\n \"Function\",\n \"Infinity\",\n \"Int16Array\",\n \"Int32Array\",\n \"Int8Array\",\n \"isFinite\",\n \"isNaN\",\n \"isPrototypeOf\",\n \"JSON\",\n \"Map\",\n \"Math\",\n \"NaN\",\n \"Number\",\n \"Object\",\n \"parseFloat\",\n \"parseInt\",\n \"Promise\",\n \"Proxy\",\n \"Reflect\",\n \"RegExp\",\n \"Set\",\n \"String\",\n \"Symbol\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"undefined\",\n \"unescape\",\n \"WeakMap\",\n \"WeakSet\",\n ]),\n)\nconst callAllowed = new Set(\n [\n Array.isArray,\n Array.of,\n Array.prototype.at,\n Array.prototype.concat,\n Array.prototype.entries,\n Array.prototype.every,\n Array.prototype.filter,\n Array.prototype.find,\n Array.prototype.findIndex,\n Array.prototype.flat,\n Array.prototype.includes,\n Array.prototype.indexOf,\n Array.prototype.join,\n Array.prototype.keys,\n Array.prototype.lastIndexOf,\n Array.prototype.slice,\n Array.prototype.some,\n Array.prototype.toString,\n Array.prototype.values,\n typeof BigInt === \"function\" ? BigInt : undefined,\n Boolean,\n Date,\n Date.parse,\n decodeURI,\n decodeURIComponent,\n encodeURI,\n encodeURIComponent,\n escape,\n isFinite,\n isNaN,\n // @ts-ignore\n isPrototypeOf,\n Map,\n Map.prototype.entries,\n Map.prototype.get,\n Map.prototype.has,\n Map.prototype.keys,\n Map.prototype.values,\n .../** @type {(keyof typeof Math)[]} */ (\n Object.getOwnPropertyNames(Math)\n )\n .filter((k) => k !== \"random\")\n .map((k) => Math[k])\n .filter((f) => typeof f === \"function\"),\n Number,\n Number.isFinite,\n Number.isNaN,\n Number.parseFloat,\n Number.parseInt,\n Number.prototype.toExponential,\n Number.prototype.toFixed,\n Number.prototype.toPrecision,\n Number.prototype.toString,\n Object,\n Object.entries,\n Object.is,\n Object.isExtensible,\n Object.isFrozen,\n Object.isSealed,\n Object.keys,\n Object.values,\n parseFloat,\n parseInt,\n RegExp,\n Set,\n Set.prototype.entries,\n Set.prototype.has,\n Set.prototype.keys,\n Set.prototype.values,\n String,\n String.fromCharCode,\n String.fromCodePoint,\n String.raw,\n String.prototype.at,\n String.prototype.charAt,\n String.prototype.charCodeAt,\n String.prototype.codePointAt,\n String.prototype.concat,\n String.prototype.endsWith,\n String.prototype.includes,\n String.prototype.indexOf,\n String.prototype.lastIndexOf,\n String.prototype.normalize,\n String.prototype.padEnd,\n String.prototype.padStart,\n String.prototype.slice,\n String.prototype.startsWith,\n String.prototype.substr,\n String.prototype.substring,\n String.prototype.toLowerCase,\n String.prototype.toString,\n String.prototype.toUpperCase,\n String.prototype.trim,\n String.prototype.trimEnd,\n String.prototype.trimLeft,\n String.prototype.trimRight,\n String.prototype.trimStart,\n Symbol.for,\n Symbol.keyFor,\n unescape,\n ].filter((f) => typeof f === \"function\"),\n)\nconst callPassThrough = new Set([\n Object.freeze,\n Object.preventExtensions,\n Object.seal,\n])\n\n/** @type {ReadonlyArray]>} */\nconst getterAllowed = [\n [Map, new Set([\"size\"])],\n [\n RegExp,\n new Set([\n \"dotAll\",\n \"flags\",\n \"global\",\n \"hasIndices\",\n \"ignoreCase\",\n \"multiline\",\n \"source\",\n \"sticky\",\n \"unicode\",\n ]),\n ],\n [Set, new Set([\"size\"])],\n]\n\n/**\n * Get the property descriptor.\n * @param {object} object The object to get.\n * @param {string|number|symbol} name The property name to get.\n */\nfunction getPropertyDescriptor(object, name) {\n let x = object\n while ((typeof x === \"object\" || typeof x === \"function\") && x !== null) {\n const d = Object.getOwnPropertyDescriptor(x, name)\n if (d) {\n return d\n }\n x = Object.getPrototypeOf(x)\n }\n return null\n}\n\n/**\n * Check if a property is getter or not.\n * @param {object} object The object to check.\n * @param {string|number|symbol} name The property name to check.\n */\nfunction isGetter(object, name) {\n const d = getPropertyDescriptor(object, name)\n return d != null && d.get != null\n}\n\n/**\n * Get the element values of a given node list.\n * @param {(Node|TSESTreeNode|null)[]} nodeList The node list to get values.\n * @param {Scope|undefined|null} initialScope The initial scope to find variables.\n * @returns {any[]|null} The value list if all nodes are constant. Otherwise, null.\n */\nfunction getElementValues(nodeList, initialScope) {\n const valueList = []\n\n for (let i = 0; i < nodeList.length; ++i) {\n const elementNode = nodeList[i]\n\n if (elementNode == null) {\n valueList.length = i + 1\n } else if (elementNode.type === \"SpreadElement\") {\n const argument = getStaticValueR(elementNode.argument, initialScope)\n if (argument == null) {\n return null\n }\n valueList.push(.../** @type {Iterable} */ (argument.value))\n } else {\n const element = getStaticValueR(elementNode, initialScope)\n if (element == null) {\n return null\n }\n valueList.push(element.value)\n }\n }\n\n return valueList\n}\n\n/**\n * Checks if a variable is a built-in global.\n * @param {Variable|null} variable The variable to check.\n * @returns {variable is Variable & {defs:[]}}\n */\nfunction isBuiltinGlobal(variable) {\n return (\n variable != null &&\n variable.defs.length === 0 &&\n builtinNames.has(variable.name) &&\n variable.name in globalObject\n )\n}\n\n/**\n * Checks if a variable can be considered as a constant.\n * @param {Variable} variable\n * @returns {variable is Variable & {defs: [import(\"eslint\").Scope.Definition & { type: \"Variable\" }]}} True if the variable can be considered as a constant.\n */\nfunction canBeConsideredConst(variable) {\n if (variable.defs.length !== 1) {\n return false\n }\n const def = variable.defs[0]\n return Boolean(\n def.parent &&\n def.type === \"Variable\" &&\n (def.parent.kind === \"const\" || isEffectivelyConst(variable)),\n )\n}\n\n/**\n * Returns whether the given variable is never written to after initialization.\n * @param {Variable} variable\n * @returns {boolean}\n */\nfunction isEffectivelyConst(variable) {\n const refs = variable.references\n\n const inits = refs.filter((r) => r.init).length\n const reads = refs.filter((r) => r.isReadOnly()).length\n if (inits === 1 && reads + inits === refs.length) {\n // there is only one init and all other references only read\n return true\n }\n return false\n}\n\n/**\n * Checks if a variable has mutation in its property.\n * @param {Variable} variable The variable to check.\n * @param {Scope|null} initialScope The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it.\n * @returns {boolean} True if the variable has mutation in its property.\n */\nfunction hasMutationInProperty(variable, initialScope) {\n for (const ref of variable.references) {\n let node = /** @type {TSESTreeNode} */ (ref.identifier)\n while (node && node.parent && node.parent.type === \"MemberExpression\") {\n node = node.parent\n }\n if (!node || !node.parent) {\n continue\n }\n if (\n (node.parent.type === \"AssignmentExpression\" &&\n node.parent.left === node) ||\n (node.parent.type === \"UpdateExpression\" &&\n node.parent.argument === node)\n ) {\n // This is a mutation.\n return true\n }\n if (\n node.parent.type === \"CallExpression\" &&\n node.parent.callee === node &&\n node.type === \"MemberExpression\"\n ) {\n const methodName = getStaticPropertyNameValue(node, initialScope)\n if (isNameOfMutationArrayMethod(methodName)) {\n // This is a mutation.\n return true\n }\n }\n }\n return false\n\n /**\n * Checks if a method name is one of the mutation array methods.\n * @param {StaticValue|null} methodName The method name to check.\n * @returns {boolean} True if the method name is a mutation array method.\n */\n function isNameOfMutationArrayMethod(methodName) {\n if (methodName == null || methodName.value == null) {\n return false\n }\n const name = methodName.value\n return (\n name === \"copyWithin\" ||\n name === \"fill\" ||\n name === \"pop\" ||\n name === \"push\" ||\n name === \"reverse\" ||\n name === \"shift\" ||\n name === \"sort\" ||\n name === \"splice\" ||\n name === \"unshift\"\n )\n }\n}\n\n/**\n * @template {TSESTreeNodeTypes} T\n * @callback VisitorCallback\n * @param {TSESTreeNode & { type: T }} node\n * @param {Scope|undefined|null} initialScope\n * @returns {StaticValue | null}\n */\n/**\n * @typedef { { [K in TSESTreeNodeTypes]?: VisitorCallback } } Operations\n */\n/**\n * @type {Operations}\n */\nconst operations = Object.freeze({\n ArrayExpression(node, initialScope) {\n const elements = getElementValues(node.elements, initialScope)\n return elements != null ? { value: elements } : null\n },\n\n AssignmentExpression(node, initialScope) {\n if (node.operator === \"=\") {\n return getStaticValueR(node.right, initialScope)\n }\n return null\n },\n\n //eslint-disable-next-line complexity\n BinaryExpression(node, initialScope) {\n if (node.operator === \"in\" || node.operator === \"instanceof\") {\n // Not supported.\n return null\n }\n\n const left = getStaticValueR(node.left, initialScope)\n const right = getStaticValueR(node.right, initialScope)\n if (left != null && right != null) {\n switch (node.operator) {\n case \"==\":\n return { value: left.value == right.value } //eslint-disable-line eqeqeq\n case \"!=\":\n return { value: left.value != right.value } //eslint-disable-line eqeqeq\n case \"===\":\n return { value: left.value === right.value }\n case \"!==\":\n return { value: left.value !== right.value }\n case \"<\":\n return {\n value:\n /** @type {any} */ (left.value) <\n /** @type {any} */ (right.value),\n }\n case \"<=\":\n return {\n value:\n /** @type {any} */ (left.value) <=\n /** @type {any} */ (right.value),\n }\n case \">\":\n return {\n value:\n /** @type {any} */ (left.value) >\n /** @type {any} */ (right.value),\n }\n case \">=\":\n return {\n value:\n /** @type {any} */ (left.value) >=\n /** @type {any} */ (right.value),\n }\n case \"<<\":\n return {\n value:\n /** @type {any} */ (left.value) <<\n /** @type {any} */ (right.value),\n }\n case \">>\":\n return {\n value:\n /** @type {any} */ (left.value) >>\n /** @type {any} */ (right.value),\n }\n case \">>>\":\n return {\n value:\n /** @type {any} */ (left.value) >>>\n /** @type {any} */ (right.value),\n }\n case \"+\":\n return {\n value:\n /** @type {any} */ (left.value) +\n /** @type {any} */ (right.value),\n }\n case \"-\":\n return {\n value:\n /** @type {any} */ (left.value) -\n /** @type {any} */ (right.value),\n }\n case \"*\":\n return {\n value:\n /** @type {any} */ (left.value) *\n /** @type {any} */ (right.value),\n }\n case \"/\":\n return {\n value:\n /** @type {any} */ (left.value) /\n /** @type {any} */ (right.value),\n }\n case \"%\":\n return {\n value:\n /** @type {any} */ (left.value) %\n /** @type {any} */ (right.value),\n }\n case \"**\":\n return {\n value:\n /** @type {any} */ (left.value) **\n /** @type {any} */ (right.value),\n }\n case \"|\":\n return {\n value:\n /** @type {any} */ (left.value) |\n /** @type {any} */ (right.value),\n }\n case \"^\":\n return {\n value:\n /** @type {any} */ (left.value) ^\n /** @type {any} */ (right.value),\n }\n case \"&\":\n return {\n value:\n /** @type {any} */ (left.value) &\n /** @type {any} */ (right.value),\n }\n\n // no default\n }\n }\n\n return null\n },\n\n CallExpression(node, initialScope) {\n const calleeNode = node.callee\n const args = getElementValues(node.arguments, initialScope)\n\n if (args != null) {\n if (calleeNode.type === \"MemberExpression\") {\n if (calleeNode.property.type === \"PrivateIdentifier\") {\n return null\n }\n const object = getStaticValueR(calleeNode.object, initialScope)\n if (object != null) {\n if (\n object.value == null &&\n (object.optional || node.optional)\n ) {\n return { value: undefined, optional: true }\n }\n const property = getStaticPropertyNameValue(\n calleeNode,\n initialScope,\n )\n\n if (property != null) {\n const receiver =\n /** @type {Record any>} */ (\n object.value\n )\n const methodName = /** @type {PropertyKey} */ (\n property.value\n )\n if (callAllowed.has(receiver[methodName])) {\n return {\n value: receiver[methodName](...args),\n }\n }\n if (callPassThrough.has(receiver[methodName])) {\n return { value: args[0] }\n }\n }\n }\n } else {\n const callee = getStaticValueR(calleeNode, initialScope)\n if (callee != null) {\n if (callee.value == null && node.optional) {\n return { value: undefined, optional: true }\n }\n const func = /** @type {(...args: any[]) => any} */ (\n callee.value\n )\n if (callAllowed.has(func)) {\n return { value: func(...args) }\n }\n if (callPassThrough.has(func)) {\n return { value: args[0] }\n }\n }\n }\n }\n\n return null\n },\n\n ConditionalExpression(node, initialScope) {\n const test = getStaticValueR(node.test, initialScope)\n if (test != null) {\n return test.value\n ? getStaticValueR(node.consequent, initialScope)\n : getStaticValueR(node.alternate, initialScope)\n }\n return null\n },\n\n ExpressionStatement(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n\n Identifier(node, initialScope) {\n if (initialScope != null) {\n const variable = findVariable(initialScope, node)\n\n if (variable != null) {\n // Built-in globals.\n if (isBuiltinGlobal(variable)) {\n return { value: globalObject[variable.name] }\n }\n\n // Constants.\n if (canBeConsideredConst(variable)) {\n const def = variable.defs[0]\n if (\n // TODO(mysticatea): don't support destructuring here.\n def.node.id.type === \"Identifier\"\n ) {\n const init = getStaticValueR(\n def.node.init,\n initialScope,\n )\n if (\n init &&\n typeof init.value === \"object\" &&\n init.value !== null\n ) {\n if (hasMutationInProperty(variable, initialScope)) {\n // This variable has mutation in its property.\n return null\n }\n }\n return init\n }\n }\n }\n }\n return null\n },\n\n Literal(node) {\n const literal =\n /** @type {Partial & Partial & Partial} */ (\n node\n )\n //istanbul ignore if : this is implementation-specific behavior.\n if (\n (literal.regex != null || literal.bigint != null) &&\n literal.value == null\n ) {\n // It was a RegExp/BigInt literal, but Node.js didn't support it.\n return null\n }\n return { value: literal.value }\n },\n\n LogicalExpression(node, initialScope) {\n const left = getStaticValueR(node.left, initialScope)\n if (left != null) {\n if (\n (node.operator === \"||\" && Boolean(left.value) === true) ||\n (node.operator === \"&&\" && Boolean(left.value) === false) ||\n (node.operator === \"??\" && left.value != null)\n ) {\n return left\n }\n\n const right = getStaticValueR(node.right, initialScope)\n if (right != null) {\n return right\n }\n }\n\n return null\n },\n\n MemberExpression(node, initialScope) {\n if (node.property.type === \"PrivateIdentifier\") {\n return null\n }\n const object = getStaticValueR(node.object, initialScope)\n if (object != null) {\n if (object.value == null && (object.optional || node.optional)) {\n return { value: undefined, optional: true }\n }\n const property = getStaticPropertyNameValue(node, initialScope)\n\n if (property != null) {\n if (\n !isGetter(\n /** @type {object} */ (object.value),\n /** @type {PropertyKey} */ (property.value),\n )\n ) {\n return {\n value: /** @type {Record} */ (\n object.value\n )[/** @type {PropertyKey} */ (property.value)],\n }\n }\n\n for (const [classFn, allowed] of getterAllowed) {\n if (\n object.value instanceof classFn &&\n allowed.has(/** @type {string} */ (property.value))\n ) {\n return {\n value: /** @type {Record} */ (\n object.value\n )[/** @type {PropertyKey} */ (property.value)],\n }\n }\n }\n }\n }\n return null\n },\n\n ChainExpression(node, initialScope) {\n const expression = getStaticValueR(node.expression, initialScope)\n if (expression != null) {\n return { value: expression.value }\n }\n return null\n },\n\n NewExpression(node, initialScope) {\n const callee = getStaticValueR(node.callee, initialScope)\n const args = getElementValues(node.arguments, initialScope)\n\n if (callee != null && args != null) {\n const Func = /** @type {new (...args: any[]) => any} */ (\n callee.value\n )\n if (callAllowed.has(Func)) {\n return { value: new Func(...args) }\n }\n }\n\n return null\n },\n\n ObjectExpression(node, initialScope) {\n /** @type {Record} */\n const object = {}\n\n for (const propertyNode of node.properties) {\n if (propertyNode.type === \"Property\") {\n if (propertyNode.kind !== \"init\") {\n return null\n }\n const key = getStaticPropertyNameValue(\n propertyNode,\n initialScope,\n )\n const value = getStaticValueR(propertyNode.value, initialScope)\n if (key == null || value == null) {\n return null\n }\n object[/** @type {PropertyKey} */ (key.value)] = value.value\n } else if (\n propertyNode.type === \"SpreadElement\" ||\n // @ts-expect-error -- Backward compatibility\n propertyNode.type === \"ExperimentalSpreadProperty\"\n ) {\n const argument = getStaticValueR(\n propertyNode.argument,\n initialScope,\n )\n if (argument == null) {\n return null\n }\n Object.assign(object, argument.value)\n } else {\n return null\n }\n }\n\n return { value: object }\n },\n\n SequenceExpression(node, initialScope) {\n const last = node.expressions[node.expressions.length - 1]\n return getStaticValueR(last, initialScope)\n },\n\n TaggedTemplateExpression(node, initialScope) {\n const tag = getStaticValueR(node.tag, initialScope)\n const expressions = getElementValues(\n node.quasi.expressions,\n initialScope,\n )\n\n if (tag != null && expressions != null) {\n const func = /** @type {(...args: any[]) => any} */ (tag.value)\n /** @type {any[] & { raw?: string[] }} */\n const strings = node.quasi.quasis.map((q) => q.value.cooked)\n strings.raw = node.quasi.quasis.map((q) => q.value.raw)\n\n if (func === String.raw) {\n return { value: func(strings, ...expressions) }\n }\n }\n\n return null\n },\n\n TemplateLiteral(node, initialScope) {\n const expressions = getElementValues(node.expressions, initialScope)\n if (expressions != null) {\n let value = node.quasis[0].value.cooked\n for (let i = 0; i < expressions.length; ++i) {\n value += expressions[i]\n value += /** @type {string} */ (node.quasis[i + 1].value.cooked)\n }\n return { value }\n }\n return null\n },\n\n UnaryExpression(node, initialScope) {\n if (node.operator === \"delete\") {\n // Not supported.\n return null\n }\n if (node.operator === \"void\") {\n return { value: undefined }\n }\n\n const arg = getStaticValueR(node.argument, initialScope)\n if (arg != null) {\n switch (node.operator) {\n case \"-\":\n return { value: -(/** @type {any} */ (arg.value)) }\n case \"+\":\n return { value: +(/** @type {any} */ (arg.value)) } //eslint-disable-line no-implicit-coercion\n case \"!\":\n return { value: !arg.value }\n case \"~\":\n return { value: ~(/** @type {any} */ (arg.value)) }\n case \"typeof\":\n return { value: typeof arg.value }\n\n // no default\n }\n }\n\n return null\n },\n TSAsExpression(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n TSSatisfiesExpression(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n TSTypeAssertion(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n TSNonNullExpression(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n TSInstantiationExpression(node, initialScope) {\n return getStaticValueR(node.expression, initialScope)\n },\n})\n\n/**\n * Get the value of a given node if it's a static value.\n * @param {Node|TSESTreeNode|null|undefined} node The node to get.\n * @param {Scope|undefined|null} initialScope The scope to start finding variable.\n * @returns {StaticValue|null} The static value of the node, or `null`.\n */\nfunction getStaticValueR(node, initialScope) {\n if (node != null && Object.hasOwnProperty.call(operations, node.type)) {\n return /** @type {VisitorCallback} */ (operations[node.type])(\n /** @type {TSESTreeNode} */ (node),\n initialScope,\n )\n }\n return null\n}\n\n/**\n * Get the static value of property name from a MemberExpression node or a Property node.\n * @param {MemberExpression|Property} node The node to get.\n * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it.\n * @returns {StaticValue|null} The static value of the property name of the node, or `null`.\n */\nfunction getStaticPropertyNameValue(node, initialScope) {\n const nameNode = node.type === \"Property\" ? node.key : node.property\n\n if (node.computed) {\n return getStaticValueR(nameNode, initialScope)\n }\n\n if (nameNode.type === \"Identifier\") {\n return { value: nameNode.name }\n }\n\n if (nameNode.type === \"Literal\") {\n if (/** @type {Partial} */ (nameNode).bigint) {\n return { value: /** @type {BigIntLiteral} */ (nameNode).bigint }\n }\n return { value: String(nameNode.value) }\n }\n\n return null\n}\n\n/**\n * Get the value of a given node if it's a static value.\n * @param {Node} node The node to get.\n * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If this scope was given, this tries to resolve identifier references which are in the given node as much as possible.\n * @returns {StaticValue | null} The static value of the node, or `null`.\n */\nexport function getStaticValue(node, initialScope = null) {\n try {\n return getStaticValueR(node, initialScope)\n } catch (_error) {\n return null\n }\n}\n","import { getStaticValue } from \"./get-static-value.mjs\"\n/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"estree\").Node} Node */\n/** @typedef {import(\"estree\").RegExpLiteral} RegExpLiteral */\n/** @typedef {import(\"estree\").BigIntLiteral} BigIntLiteral */\n/** @typedef {import(\"estree\").SimpleLiteral} SimpleLiteral */\n\n/**\n * Get the value of a given node if it's a literal or a template literal.\n * @param {Node} node The node to get.\n * @param {Scope|null} [initialScope] The scope to start finding variable. Optional. If the node is an Identifier node and this scope was given, this checks the variable of the identifier, and returns the value of it if the variable is a constant.\n * @returns {string|null} The value of the node, or `null`.\n */\nexport function getStringIfConstant(node, initialScope = null) {\n // Handle the literals that the platform doesn't support natively.\n if (node && node.type === \"Literal\" && node.value === null) {\n const literal =\n /** @type {Partial & Partial & Partial} */ (\n node\n )\n if (literal.regex) {\n return `/${literal.regex.pattern}/${literal.regex.flags}`\n }\n if (literal.bigint) {\n return literal.bigint\n }\n }\n\n const evaluated = getStaticValue(node, initialScope)\n\n if (evaluated) {\n // `String(Symbol.prototype)` throws error\n try {\n return String(evaluated.value)\n } catch {\n // No op\n }\n }\n\n return null\n}\n","import { getStringIfConstant } from \"./get-string-if-constant.mjs\"\n/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"estree\").MemberExpression} MemberExpression */\n/** @typedef {import(\"estree\").MethodDefinition} MethodDefinition */\n/** @typedef {import(\"estree\").Property} Property */\n/** @typedef {import(\"estree\").PropertyDefinition} PropertyDefinition */\n/** @typedef {import(\"estree\").Identifier} Identifier */\n\n/**\n * Get the property name from a MemberExpression node or a Property node.\n * @param {MemberExpression | MethodDefinition | Property | PropertyDefinition} node The node to get.\n * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it.\n * @returns {string|null|undefined} The property name of the node.\n */\nexport function getPropertyName(node, initialScope) {\n switch (node.type) {\n case \"MemberExpression\":\n if (node.computed) {\n return getStringIfConstant(node.property, initialScope)\n }\n if (node.property.type === \"PrivateIdentifier\") {\n return null\n }\n return /** @type {Partial} */ (node.property).name\n\n case \"Property\":\n case \"MethodDefinition\":\n case \"PropertyDefinition\":\n if (node.computed) {\n return getStringIfConstant(node.key, initialScope)\n }\n if (node.key.type === \"Literal\") {\n return String(node.key.value)\n }\n if (node.key.type === \"PrivateIdentifier\") {\n return null\n }\n return /** @type {Partial} */ (node.key).name\n\n default:\n break\n }\n\n return null\n}\n","import { getPropertyName } from \"./get-property-name.mjs\"\n/** @typedef {import(\"eslint\").Rule.Node} RuleNode */\n/** @typedef {import(\"eslint\").SourceCode} SourceCode */\n/** @typedef {import(\"estree\").Function} FunctionNode */\n/** @typedef {import(\"estree\").FunctionDeclaration} FunctionDeclaration */\n/** @typedef {import(\"estree\").FunctionExpression} FunctionExpression */\n/** @typedef {import(\"estree\").Identifier} Identifier */\n\n/**\n * Get the name and kind of the given function node.\n * @param {FunctionNode} node - The function node to get.\n * @param {SourceCode} [sourceCode] The source code object to get the code of computed property keys.\n * @returns {string} The name and kind of the function node.\n */\n// eslint-disable-next-line complexity\nexport function getFunctionNameWithKind(node, sourceCode) {\n const parent = /** @type {RuleNode} */ (node).parent\n\n if (!parent) {\n return \"\"\n }\n\n const tokens = []\n const isObjectMethod = parent.type === \"Property\" && parent.value === node\n const isClassMethod =\n parent.type === \"MethodDefinition\" && parent.value === node\n const isClassFieldMethod =\n parent.type === \"PropertyDefinition\" && parent.value === node\n\n // Modifiers.\n if (isClassMethod || isClassFieldMethod) {\n if (parent.static) {\n tokens.push(\"static\")\n }\n if (parent.key.type === \"PrivateIdentifier\") {\n tokens.push(\"private\")\n }\n }\n if (node.async) {\n tokens.push(\"async\")\n }\n if (node.generator) {\n tokens.push(\"generator\")\n }\n\n // Kinds.\n if (isObjectMethod || isClassMethod) {\n if (parent.kind === \"constructor\") {\n return \"constructor\"\n }\n if (parent.kind === \"get\") {\n tokens.push(\"getter\")\n } else if (parent.kind === \"set\") {\n tokens.push(\"setter\")\n } else {\n tokens.push(\"method\")\n }\n } else if (isClassFieldMethod) {\n tokens.push(\"method\")\n } else {\n if (node.type === \"ArrowFunctionExpression\") {\n tokens.push(\"arrow\")\n }\n tokens.push(\"function\")\n }\n\n // Names.\n if (isObjectMethod || isClassMethod || isClassFieldMethod) {\n if (parent.key.type === \"PrivateIdentifier\") {\n tokens.push(`#${parent.key.name}`)\n } else {\n const name = getPropertyName(parent)\n if (name) {\n tokens.push(`'${name}'`)\n } else if (sourceCode) {\n const keyText = sourceCode.getText(parent.key)\n if (!keyText.includes(\"\\n\")) {\n tokens.push(`[${keyText}]`)\n }\n }\n }\n } else if (hasId(node)) {\n tokens.push(`'${node.id.name}'`)\n } else if (\n parent.type === \"VariableDeclarator\" &&\n parent.id &&\n parent.id.type === \"Identifier\"\n ) {\n tokens.push(`'${parent.id.name}'`)\n } else if (\n (parent.type === \"AssignmentExpression\" ||\n parent.type === \"AssignmentPattern\") &&\n parent.left &&\n parent.left.type === \"Identifier\"\n ) {\n tokens.push(`'${parent.left.name}'`)\n } else if (\n parent.type === \"ExportDefaultDeclaration\" &&\n parent.declaration === node\n ) {\n tokens.push(\"'default'\")\n }\n\n return tokens.join(\" \")\n}\n\n/**\n * @param {FunctionNode} node\n * @returns {node is FunctionDeclaration | FunctionExpression & { id: Identifier }}\n */\nfunction hasId(node) {\n return Boolean(\n /** @type {Partial} */ (node)\n .id,\n )\n}\n","import { getKeys, KEYS } from \"eslint-visitor-keys\"\n/** @typedef {import(\"estree\").Node} Node */\n/** @typedef {import(\"eslint\").SourceCode} SourceCode */\n/** @typedef {import(\"./types.mjs\").HasSideEffectOptions} HasSideEffectOptions */\n/** @typedef {import(\"estree\").BinaryExpression} BinaryExpression */\n/** @typedef {import(\"estree\").MemberExpression} MemberExpression */\n/** @typedef {import(\"estree\").MethodDefinition} MethodDefinition */\n/** @typedef {import(\"estree\").Property} Property */\n/** @typedef {import(\"estree\").PropertyDefinition} PropertyDefinition */\n/** @typedef {import(\"estree\").UnaryExpression} UnaryExpression */\n\nconst typeConversionBinaryOps = Object.freeze(\n new Set([\n \"==\",\n \"!=\",\n \"<\",\n \"<=\",\n \">\",\n \">=\",\n \"<<\",\n \">>\",\n \">>>\",\n \"+\",\n \"-\",\n \"*\",\n \"/\",\n \"%\",\n \"|\",\n \"^\",\n \"&\",\n \"in\",\n ]),\n)\nconst typeConversionUnaryOps = Object.freeze(new Set([\"-\", \"+\", \"!\", \"~\"]))\n\n/**\n * Check whether the given value is an ASTNode or not.\n * @param {any} x The value to check.\n * @returns {x is Node} `true` if the value is an ASTNode.\n */\nfunction isNode(x) {\n return x !== null && typeof x === \"object\" && typeof x.type === \"string\"\n}\n\nconst visitor = Object.freeze(\n Object.assign(Object.create(null), {\n /**\n * @param {Node} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n $visit(node, options, visitorKeys) {\n const { type } = node\n\n if (typeof (/** @type {any} */ (this)[type]) === \"function\") {\n return /** @type {any} */ (this)[type](\n node,\n options,\n visitorKeys,\n )\n }\n\n return this.$visitChildren(node, options, visitorKeys)\n },\n\n /**\n * @param {Node} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n $visitChildren(node, options, visitorKeys) {\n const { type } = node\n\n for (const key of /** @type {(keyof Node)[]} */ (\n visitorKeys[type] || getKeys(node)\n )) {\n const value = node[key]\n\n if (Array.isArray(value)) {\n for (const element of value) {\n if (\n isNode(element) &&\n this.$visit(element, options, visitorKeys)\n ) {\n return true\n }\n }\n } else if (\n isNode(value) &&\n this.$visit(value, options, visitorKeys)\n ) {\n return true\n }\n }\n\n return false\n },\n\n ArrowFunctionExpression() {\n return false\n },\n AssignmentExpression() {\n return true\n },\n AwaitExpression() {\n return true\n },\n /**\n * @param {BinaryExpression} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n BinaryExpression(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n typeConversionBinaryOps.has(node.operator) &&\n (node.left.type !== \"Literal\" || node.right.type !== \"Literal\")\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n CallExpression() {\n return true\n },\n FunctionExpression() {\n return false\n },\n ImportExpression() {\n return true\n },\n /**\n * @param {MemberExpression} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n MemberExpression(node, options, visitorKeys) {\n if (options.considerGetters) {\n return true\n }\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.property.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n /**\n * @param {MethodDefinition} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n MethodDefinition(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n NewExpression() {\n return true\n },\n /**\n * @param {Property} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n Property(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n /**\n * @param {PropertyDefinition} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n PropertyDefinition(node, options, visitorKeys) {\n if (\n options.considerImplicitTypeConversion &&\n node.computed &&\n node.key.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n /**\n * @param {UnaryExpression} node\n * @param {HasSideEffectOptions} options\n * @param {Record} visitorKeys\n */\n UnaryExpression(node, options, visitorKeys) {\n if (node.operator === \"delete\") {\n return true\n }\n if (\n options.considerImplicitTypeConversion &&\n typeConversionUnaryOps.has(node.operator) &&\n node.argument.type !== \"Literal\"\n ) {\n return true\n }\n return this.$visitChildren(node, options, visitorKeys)\n },\n UpdateExpression() {\n return true\n },\n YieldExpression() {\n return true\n },\n }),\n)\n\n/**\n * Check whether a given node has any side effect or not.\n * @param {Node} node The node to get.\n * @param {SourceCode} sourceCode The source code object.\n * @param {HasSideEffectOptions} [options] The option object.\n * @returns {boolean} `true` if the node has a certain side effect.\n */\nexport function hasSideEffect(node, sourceCode, options = {}) {\n const { considerGetters = false, considerImplicitTypeConversion = false } =\n options\n return visitor.$visit(\n node,\n { considerGetters, considerImplicitTypeConversion },\n sourceCode.visitorKeys || KEYS,\n )\n}\n","import { isClosingParenToken, isOpeningParenToken } from \"./token-predicate.mjs\"\n/** @typedef {import(\"estree\").Node} Node */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.NewExpression} TSNewExpression */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.CallExpression} TSCallExpression */\n/** @typedef {import(\"eslint\").SourceCode} SourceCode */\n/** @typedef {import(\"eslint\").AST.Token} Token */\n/** @typedef {import(\"eslint\").Rule.Node} RuleNode */\n\n/**\n * Get the left parenthesis of the parent node syntax if it exists.\n * E.g., `if (a) {}` then the `(`.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {Token|null} The left parenthesis of the parent node syntax\n */\n// eslint-disable-next-line complexity\nfunction getParentSyntaxParen(node, sourceCode) {\n const parent = /** @type {RuleNode} */ (node).parent\n\n if (!parent) {\n return null\n }\n\n switch (parent.type) {\n case \"CallExpression\":\n case \"NewExpression\":\n if (parent.arguments.length === 1 && parent.arguments[0] === node) {\n return sourceCode.getTokenAfter(\n // @ts-expect-error https://github.com/typescript-eslint/typescript-eslint/pull/5384\n parent.typeArguments ||\n /** @type {RuleNode} */ (\n /** @type {unknown} */ (\n /** @type {TSNewExpression | TSCallExpression} */ (\n parent\n ).typeParameters\n )\n ) ||\n parent.callee,\n isOpeningParenToken,\n )\n }\n return null\n\n case \"DoWhileStatement\":\n if (parent.test === node) {\n return sourceCode.getTokenAfter(\n parent.body,\n isOpeningParenToken,\n )\n }\n return null\n\n case \"IfStatement\":\n case \"WhileStatement\":\n if (parent.test === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"ImportExpression\":\n if (parent.source === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"SwitchStatement\":\n if (parent.discriminant === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n case \"WithStatement\":\n if (parent.object === node) {\n return sourceCode.getFirstToken(parent, 1)\n }\n return null\n\n default:\n return null\n }\n}\n\n/**\n * Check whether a given node is parenthesized or not.\n * @param {number} times The number of parantheses.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {boolean} `true` if the node is parenthesized the given times.\n */\n/**\n * Check whether a given node is parenthesized or not.\n * @param {Node} node The AST node to check.\n * @param {SourceCode} sourceCode The source code object to get tokens.\n * @returns {boolean} `true` if the node is parenthesized.\n */\n/**\n * Check whether a given node is parenthesized or not.\n * @param {Node|number} timesOrNode The first parameter.\n * @param {Node|SourceCode} nodeOrSourceCode The second parameter.\n * @param {SourceCode} [optionalSourceCode] The third parameter.\n * @returns {boolean} `true` if the node is parenthesized.\n */\nexport function isParenthesized(\n timesOrNode,\n nodeOrSourceCode,\n optionalSourceCode,\n) {\n /** @type {number} */\n let times,\n /** @type {RuleNode} */\n node,\n /** @type {SourceCode} */\n sourceCode,\n maybeLeftParen,\n maybeRightParen\n if (typeof timesOrNode === \"number\") {\n times = timesOrNode | 0\n node = /** @type {RuleNode} */ (nodeOrSourceCode)\n sourceCode = /** @type {SourceCode} */ (optionalSourceCode)\n if (!(times >= 1)) {\n throw new TypeError(\"'times' should be a positive integer.\")\n }\n } else {\n times = 1\n node = /** @type {RuleNode} */ (timesOrNode)\n sourceCode = /** @type {SourceCode} */ (nodeOrSourceCode)\n }\n\n if (\n node == null ||\n // `Program` can't be parenthesized\n node.parent == null ||\n // `CatchClause.param` can't be parenthesized, example `try {} catch (error) {}`\n (node.parent.type === \"CatchClause\" && node.parent.param === node)\n ) {\n return false\n }\n\n maybeLeftParen = maybeRightParen = node\n do {\n maybeLeftParen = sourceCode.getTokenBefore(maybeLeftParen)\n maybeRightParen = sourceCode.getTokenAfter(maybeRightParen)\n } while (\n maybeLeftParen != null &&\n maybeRightParen != null &&\n isOpeningParenToken(maybeLeftParen) &&\n isClosingParenToken(maybeRightParen) &&\n // Avoid false positive such as `if (a) {}`\n maybeLeftParen !== getParentSyntaxParen(node, sourceCode) &&\n --times > 0\n )\n\n return times === 0\n}\n","/**\n * @author Toru Nagashima \n * See LICENSE file in root directory for full license.\n */\n\nconst placeholder = /\\$(?:[$&`']|[1-9][0-9]?)/gu\n\n/** @type {WeakMap} */\nconst internal = new WeakMap()\n\n/**\n * Check whether a given character is escaped or not.\n * @param {string} str The string to check.\n * @param {number} index The location of the character to check.\n * @returns {boolean} `true` if the character is escaped.\n */\nfunction isEscaped(str, index) {\n let escaped = false\n for (let i = index - 1; i >= 0 && str.charCodeAt(i) === 0x5c; --i) {\n escaped = !escaped\n }\n return escaped\n}\n\n/**\n * Replace a given string by a given matcher.\n * @param {PatternMatcher} matcher The pattern matcher.\n * @param {string} str The string to be replaced.\n * @param {string} replacement The new substring to replace each matched part.\n * @returns {string} The replaced string.\n */\nfunction replaceS(matcher, str, replacement) {\n const chunks = []\n let index = 0\n\n /**\n * @param {string} key The placeholder.\n * @param {RegExpExecArray} match The matched information.\n * @returns {string} The replaced string.\n */\n function replacer(key, match) {\n switch (key) {\n case \"$$\":\n return \"$\"\n case \"$&\":\n return match[0]\n case \"$`\":\n return str.slice(0, match.index)\n case \"$'\":\n return str.slice(match.index + match[0].length)\n default: {\n const i = key.slice(1)\n if (i in match) {\n return match[/** @type {any} */ (i)]\n }\n return key\n }\n }\n }\n\n for (const match of matcher.execAll(str)) {\n chunks.push(str.slice(index, match.index))\n chunks.push(\n replacement.replace(placeholder, (key) => replacer(key, match)),\n )\n index = match.index + match[0].length\n }\n chunks.push(str.slice(index))\n\n return chunks.join(\"\")\n}\n\n/**\n * Replace a given string by a given matcher.\n * @param {PatternMatcher} matcher The pattern matcher.\n * @param {string} str The string to be replaced.\n * @param {(substring: string, ...args: any[]) => string} replace The function to replace each matched part.\n * @returns {string} The replaced string.\n */\nfunction replaceF(matcher, str, replace) {\n const chunks = []\n let index = 0\n\n for (const match of matcher.execAll(str)) {\n chunks.push(str.slice(index, match.index))\n chunks.push(\n String(\n replace(\n .../** @type {[string, ...string[]]} */ (\n /** @type {string[]} */ (match)\n ),\n match.index,\n match.input,\n ),\n ),\n )\n index = match.index + match[0].length\n }\n chunks.push(str.slice(index))\n\n return chunks.join(\"\")\n}\n\n/**\n * The class to find patterns as considering escape sequences.\n */\nexport class PatternMatcher {\n /**\n * Initialize this matcher.\n * @param {RegExp} pattern The pattern to match.\n * @param {{escaped?:boolean}} [options] The options.\n */\n constructor(pattern, options = {}) {\n const { escaped = false } = options\n if (!(pattern instanceof RegExp)) {\n throw new TypeError(\"'pattern' should be a RegExp instance.\")\n }\n if (!pattern.flags.includes(\"g\")) {\n throw new Error(\"'pattern' should contains 'g' flag.\")\n }\n\n internal.set(this, {\n pattern: new RegExp(pattern.source, pattern.flags),\n escaped: Boolean(escaped),\n })\n }\n\n /**\n * Find the pattern in a given string.\n * @param {string} str The string to find.\n * @returns {IterableIterator} The iterator which iterate the matched information.\n */\n *execAll(str) {\n const { pattern, escaped } =\n /** @type {{pattern:RegExp,escaped:boolean}} */ (internal.get(this))\n let match = null\n let lastIndex = 0\n\n pattern.lastIndex = 0\n while ((match = pattern.exec(str)) != null) {\n if (escaped || !isEscaped(str, match.index)) {\n lastIndex = pattern.lastIndex\n yield match\n pattern.lastIndex = lastIndex\n }\n }\n }\n\n /**\n * Check whether the pattern is found in a given string.\n * @param {string} str The string to check.\n * @returns {boolean} `true` if the pattern was found in the string.\n */\n test(str) {\n const it = this.execAll(str)\n const ret = it.next()\n return !ret.done\n }\n\n /**\n * Replace a given string.\n * @param {string} str The string to be replaced.\n * @param {(string|((...strs:string[])=>string))} replacer The string or function to replace. This is the same as the 2nd argument of `String.prototype.replace`.\n * @returns {string} The replaced string.\n */\n [Symbol.replace](str, replacer) {\n return typeof replacer === \"function\"\n ? replaceF(this, String(str), replacer)\n : replaceS(this, String(str), String(replacer))\n }\n}\n","import { findVariable } from \"./find-variable.mjs\"\nimport { getPropertyName } from \"./get-property-name.mjs\"\nimport { getStringIfConstant } from \"./get-string-if-constant.mjs\"\n/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"eslint\").Scope.Variable} Variable */\n/** @typedef {import(\"eslint\").Rule.Node} RuleNode */\n/** @typedef {import(\"estree\").Node} Node */\n/** @typedef {import(\"estree\").Expression} Expression */\n/** @typedef {import(\"estree\").Pattern} Pattern */\n/** @typedef {import(\"estree\").Identifier} Identifier */\n/** @typedef {import(\"estree\").SimpleCallExpression} CallExpression */\n/** @typedef {import(\"estree\").Program} Program */\n/** @typedef {import(\"estree\").ImportDeclaration} ImportDeclaration */\n/** @typedef {import(\"estree\").ExportAllDeclaration} ExportAllDeclaration */\n/** @typedef {import(\"estree\").ExportDefaultDeclaration} ExportDefaultDeclaration */\n/** @typedef {import(\"estree\").ExportNamedDeclaration} ExportNamedDeclaration */\n/** @typedef {import(\"estree\").ImportSpecifier} ImportSpecifier */\n/** @typedef {import(\"estree\").ImportDefaultSpecifier} ImportDefaultSpecifier */\n/** @typedef {import(\"estree\").ImportNamespaceSpecifier} ImportNamespaceSpecifier */\n/** @typedef {import(\"estree\").ExportSpecifier} ExportSpecifier */\n/** @typedef {import(\"estree\").Property} Property */\n/** @typedef {import(\"estree\").AssignmentProperty} AssignmentProperty */\n/** @typedef {import(\"estree\").Literal} Literal */\n/** @typedef {import(\"@typescript-eslint/types\").TSESTree.Node} TSESTreeNode */\n/** @typedef {import(\"./types.mjs\").ReferenceTrackerOptions} ReferenceTrackerOptions */\n/**\n * @template T\n * @typedef {import(\"./types.mjs\").TraceMap} TraceMap\n */\n/**\n * @template T\n * @typedef {import(\"./types.mjs\").TraceMapObject} TraceMapObject\n */\n/**\n * @template T\n * @typedef {import(\"./types.mjs\").TrackedReferences} TrackedReferences\n */\n\nconst IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u\n\n/**\n * Check whether a given node is an import node or not.\n * @param {Node} node\n * @returns {node is ImportDeclaration|ExportAllDeclaration|ExportNamedDeclaration&{source: Literal}} `true` if the node is an import node.\n */\nfunction isHasSource(node) {\n return (\n IMPORT_TYPE.test(node.type) &&\n /** @type {ImportDeclaration|ExportAllDeclaration|ExportNamedDeclaration} */ (\n node\n ).source != null\n )\n}\nconst has =\n /** @type {(traceMap: TraceMap, v: T) => v is (string extends T ? string : T)} */ (\n Function.call.bind(Object.hasOwnProperty)\n )\n\nexport const READ = Symbol(\"read\")\nexport const CALL = Symbol(\"call\")\nexport const CONSTRUCT = Symbol(\"construct\")\nexport const ESM = Symbol(\"esm\")\n\nconst requireCall = { require: { [CALL]: true } }\n\n/**\n * Check whether a given variable is modified or not.\n * @param {Variable|undefined} variable The variable to check.\n * @returns {boolean} `true` if the variable is modified.\n */\nfunction isModifiedGlobal(variable) {\n return (\n variable == null ||\n variable.defs.length !== 0 ||\n variable.references.some((r) => r.isWrite())\n )\n}\n\n/**\n * Check if the value of a given node is passed through to the parent syntax as-is.\n * For example, `a` and `b` in (`a || b` and `c ? a : b`) are passed through.\n * @param {Node} node A node to check.\n * @returns {node is RuleNode & {parent: Expression}} `true` if the node is passed through.\n */\nfunction isPassThrough(node) {\n const parent = /** @type {TSESTreeNode} */ (node).parent\n\n if (parent) {\n switch (parent.type) {\n case \"ConditionalExpression\":\n return parent.consequent === node || parent.alternate === node\n case \"LogicalExpression\":\n return true\n case \"SequenceExpression\":\n return (\n parent.expressions[parent.expressions.length - 1] === node\n )\n case \"ChainExpression\":\n return true\n case \"TSAsExpression\":\n case \"TSSatisfiesExpression\":\n case \"TSTypeAssertion\":\n case \"TSNonNullExpression\":\n case \"TSInstantiationExpression\":\n return true\n\n default:\n return false\n }\n }\n return false\n}\n\n/**\n * The reference tracker.\n */\nexport class ReferenceTracker {\n /**\n * Initialize this tracker.\n * @param {Scope} globalScope The global scope.\n * @param {object} [options] The options.\n * @param {\"legacy\"|\"strict\"} [options.mode=\"strict\"] The mode to determine the ImportDeclaration's behavior for CJS modules.\n * @param {string[]} [options.globalObjectNames=[\"global\",\"globalThis\",\"self\",\"window\"]] The variable names for Global Object.\n */\n constructor(globalScope, options = {}) {\n const {\n mode = \"strict\",\n globalObjectNames = [\"global\", \"globalThis\", \"self\", \"window\"],\n } = options\n /** @private @type {Variable[]} */\n this.variableStack = []\n /** @private */\n this.globalScope = globalScope\n /** @private */\n this.mode = mode\n /** @private */\n this.globalObjectNames = globalObjectNames.slice(0)\n }\n\n /**\n * Iterate the references of global variables.\n * @template T\n * @param {TraceMap} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *iterateGlobalReferences(traceMap) {\n for (const key of Object.keys(traceMap)) {\n const nextTraceMap = traceMap[key]\n const path = [key]\n const variable = this.globalScope.set.get(key)\n\n if (isModifiedGlobal(variable)) {\n continue\n }\n\n yield* this._iterateVariableReferences(\n /** @type {Variable} */ (variable),\n path,\n nextTraceMap,\n true,\n )\n }\n\n for (const key of this.globalObjectNames) {\n /** @type {string[]} */\n const path = []\n const variable = this.globalScope.set.get(key)\n\n if (isModifiedGlobal(variable)) {\n continue\n }\n\n yield* this._iterateVariableReferences(\n /** @type {Variable} */ (variable),\n path,\n traceMap,\n false,\n )\n }\n }\n\n /**\n * Iterate the references of CommonJS modules.\n * @template T\n * @param {TraceMap} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *iterateCjsReferences(traceMap) {\n for (const { node } of this.iterateGlobalReferences(requireCall)) {\n const key = getStringIfConstant(\n /** @type {CallExpression} */ (node).arguments[0],\n )\n if (key == null || !has(traceMap, key)) {\n continue\n }\n\n const nextTraceMap = traceMap[key]\n const path = [key]\n\n if (nextTraceMap[READ]) {\n yield {\n node,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iteratePropertyReferences(\n /** @type {CallExpression} */ (node),\n path,\n nextTraceMap,\n )\n }\n }\n\n /**\n * Iterate the references of ES modules.\n * @template T\n * @param {TraceMap} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *iterateEsmReferences(traceMap) {\n const programNode = /** @type {Program} */ (this.globalScope.block)\n\n for (const node of programNode.body) {\n if (!isHasSource(node)) {\n continue\n }\n const moduleId = /** @type {string} */ (node.source.value)\n\n if (!has(traceMap, moduleId)) {\n continue\n }\n const nextTraceMap = traceMap[moduleId]\n const path = [moduleId]\n\n if (nextTraceMap[READ]) {\n yield {\n // eslint-disable-next-line object-shorthand -- apply type\n node: /** @type {RuleNode} */ (node),\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n\n if (node.type === \"ExportAllDeclaration\") {\n for (const key of Object.keys(nextTraceMap)) {\n const exportTraceMap = nextTraceMap[key]\n if (exportTraceMap[READ]) {\n yield {\n // eslint-disable-next-line object-shorthand -- apply type\n node: /** @type {RuleNode} */ (node),\n path: path.concat(key),\n type: READ,\n info: exportTraceMap[READ],\n }\n }\n }\n } else {\n for (const specifier of node.specifiers) {\n const esm = has(nextTraceMap, ESM)\n const it = this._iterateImportReferences(\n specifier,\n path,\n esm\n ? nextTraceMap\n : this.mode === \"legacy\"\n ? { default: nextTraceMap, ...nextTraceMap }\n : { default: nextTraceMap },\n )\n\n if (esm) {\n yield* it\n } else {\n for (const report of it) {\n report.path = report.path.filter(exceptDefault)\n if (\n report.path.length >= 2 ||\n report.type !== READ\n ) {\n yield report\n }\n }\n }\n }\n }\n }\n }\n\n /**\n * Iterate the property references for a given expression AST node.\n * @template T\n * @param {Expression} node The expression AST node to iterate property references.\n * @param {TraceMap} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate property references.\n */\n *iteratePropertyReferences(node, traceMap) {\n yield* this._iteratePropertyReferences(node, [], traceMap)\n }\n\n /**\n * Iterate the references for a given variable.\n * @private\n * @template T\n * @param {Variable} variable The variable to iterate that references.\n * @param {string[]} path The current path.\n * @param {TraceMapObject} traceMap The trace map.\n * @param {boolean} shouldReport = The flag to report those references.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *_iterateVariableReferences(variable, path, traceMap, shouldReport) {\n if (this.variableStack.includes(variable)) {\n return\n }\n this.variableStack.push(variable)\n try {\n for (const reference of variable.references) {\n if (!reference.isRead()) {\n continue\n }\n const node = /** @type {RuleNode & Identifier} */ (\n reference.identifier\n )\n\n if (shouldReport && traceMap[READ]) {\n yield { node, path, type: READ, info: traceMap[READ] }\n }\n yield* this._iteratePropertyReferences(node, path, traceMap)\n }\n } finally {\n this.variableStack.pop()\n }\n }\n\n /**\n * Iterate the references for a given AST node.\n * @private\n * @template T\n * @param {Expression} rootNode The AST node to iterate references.\n * @param {string[]} path The current path.\n * @param {TraceMapObject} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n //eslint-disable-next-line complexity\n *_iteratePropertyReferences(rootNode, path, traceMap) {\n let node = rootNode\n while (isPassThrough(node)) {\n node = node.parent\n }\n\n const parent = /** @type {RuleNode} */ (node).parent\n if (!parent) {\n return\n }\n if (parent.type === \"MemberExpression\") {\n if (parent.object === node) {\n const key = getPropertyName(parent)\n if (key == null || !has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: parent,\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iteratePropertyReferences(\n parent,\n path,\n nextTraceMap,\n )\n }\n return\n }\n if (parent.type === \"CallExpression\") {\n if (parent.callee === node && traceMap[CALL]) {\n yield { node: parent, path, type: CALL, info: traceMap[CALL] }\n }\n return\n }\n if (parent.type === \"NewExpression\") {\n if (parent.callee === node && traceMap[CONSTRUCT]) {\n yield {\n node: parent,\n path,\n type: CONSTRUCT,\n info: traceMap[CONSTRUCT],\n }\n }\n return\n }\n if (parent.type === \"AssignmentExpression\") {\n if (parent.right === node) {\n yield* this._iterateLhsReferences(parent.left, path, traceMap)\n yield* this._iteratePropertyReferences(parent, path, traceMap)\n }\n return\n }\n if (parent.type === \"AssignmentPattern\") {\n if (parent.right === node) {\n yield* this._iterateLhsReferences(parent.left, path, traceMap)\n }\n return\n }\n if (parent.type === \"VariableDeclarator\") {\n if (parent.init === node) {\n yield* this._iterateLhsReferences(parent.id, path, traceMap)\n }\n }\n }\n\n /**\n * Iterate the references for a given Pattern node.\n * @private\n * @template T\n * @param {Pattern} patternNode The Pattern node to iterate references.\n * @param {string[]} path The current path.\n * @param {TraceMapObject} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *_iterateLhsReferences(patternNode, path, traceMap) {\n if (patternNode.type === \"Identifier\") {\n const variable = findVariable(this.globalScope, patternNode)\n if (variable != null) {\n yield* this._iterateVariableReferences(\n variable,\n path,\n traceMap,\n false,\n )\n }\n return\n }\n if (patternNode.type === \"ObjectPattern\") {\n for (const property of patternNode.properties) {\n const key = getPropertyName(\n /** @type {AssignmentProperty} */ (property),\n )\n\n if (key == null || !has(traceMap, key)) {\n continue\n }\n\n const nextPath = path.concat(key)\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: /** @type {RuleNode} */ (property),\n path: nextPath,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iterateLhsReferences(\n /** @type {AssignmentProperty} */ (property).value,\n nextPath,\n nextTraceMap,\n )\n }\n return\n }\n if (patternNode.type === \"AssignmentPattern\") {\n yield* this._iterateLhsReferences(patternNode.left, path, traceMap)\n }\n }\n\n /**\n * Iterate the references for a given ModuleSpecifier node.\n * @private\n * @template T\n * @param {ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier} specifierNode The ModuleSpecifier node to iterate references.\n * @param {string[]} path The current path.\n * @param {TraceMapObject} traceMap The trace map.\n * @returns {IterableIterator>} The iterator to iterate references.\n */\n *_iterateImportReferences(specifierNode, path, traceMap) {\n const type = specifierNode.type\n\n if (type === \"ImportSpecifier\" || type === \"ImportDefaultSpecifier\") {\n const key =\n type === \"ImportDefaultSpecifier\"\n ? \"default\"\n : specifierNode.imported.type === \"Identifier\"\n ? specifierNode.imported.name\n : specifierNode.imported.value\n if (!has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: /** @type {RuleNode} */ (specifierNode),\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n yield* this._iterateVariableReferences(\n /** @type {Variable} */ (\n findVariable(this.globalScope, specifierNode.local)\n ),\n path,\n nextTraceMap,\n false,\n )\n\n return\n }\n\n if (type === \"ImportNamespaceSpecifier\") {\n yield* this._iterateVariableReferences(\n /** @type {Variable} */ (\n findVariable(this.globalScope, specifierNode.local)\n ),\n path,\n traceMap,\n false,\n )\n return\n }\n\n if (type === \"ExportSpecifier\") {\n const key =\n specifierNode.local.type === \"Identifier\"\n ? specifierNode.local.name\n : specifierNode.local.value\n if (!has(traceMap, key)) {\n return\n }\n\n path = path.concat(key) //eslint-disable-line no-param-reassign\n const nextTraceMap = traceMap[key]\n if (nextTraceMap[READ]) {\n yield {\n node: /** @type {RuleNode} */ (specifierNode),\n path,\n type: READ,\n info: nextTraceMap[READ],\n }\n }\n }\n }\n}\n\nReferenceTracker.READ = READ\nReferenceTracker.CALL = CALL\nReferenceTracker.CONSTRUCT = CONSTRUCT\nReferenceTracker.ESM = ESM\n\n/**\n * This is a predicate function for Array#filter.\n * @param {string} name A name part.\n * @param {number} index The index of the name.\n * @returns {boolean} `false` if it's default.\n */\nfunction exceptDefault(name, index) {\n return !(index === 1 && name === \"default\")\n}\n","/** @typedef {import(\"./types.mjs\").StaticValue} StaticValue */\n/** @typedef {import(\"./types.mjs\").StaticValueOptional} StaticValueOptional */\n/** @typedef {import(\"./types.mjs\").StaticValueProvided} StaticValueProvided */\n/** @typedef {import(\"./types.mjs\").ReferenceTrackerOptions} ReferenceTrackerOptions */\n/**\n * @template T\n * @typedef {import(\"./types.mjs\").TraceMap} TraceMap\n */\n/**\n * @template T\n * @typedef {import(\"./types.mjs\").TrackedReferences} TrackedReferences\n */\n/** @typedef {import(\"./types.mjs\").HasSideEffectOptions} HasSideEffectOptions */\n/** @typedef {import(\"./types.mjs\").ArrowToken} ArrowToken */\n/** @typedef {import(\"./types.mjs\").CommaToken} CommaToken */\n/** @typedef {import(\"./types.mjs\").SemicolonToken} SemicolonToken */\n/** @typedef {import(\"./types.mjs\").ColonToken} ColonToken */\n/** @typedef {import(\"./types.mjs\").OpeningParenToken} OpeningParenToken */\n/** @typedef {import(\"./types.mjs\").ClosingParenToken} ClosingParenToken */\n/** @typedef {import(\"./types.mjs\").OpeningBracketToken} OpeningBracketToken */\n/** @typedef {import(\"./types.mjs\").ClosingBracketToken} ClosingBracketToken */\n/** @typedef {import(\"./types.mjs\").OpeningBraceToken} OpeningBraceToken */\n/** @typedef {import(\"./types.mjs\").ClosingBraceToken} ClosingBraceToken */\n\nimport { findVariable } from \"./find-variable.mjs\"\nimport { getFunctionHeadLocation } from \"./get-function-head-location.mjs\"\nimport { getFunctionNameWithKind } from \"./get-function-name-with-kind.mjs\"\nimport { getInnermostScope } from \"./get-innermost-scope.mjs\"\nimport { getPropertyName } from \"./get-property-name.mjs\"\nimport { getStaticValue } from \"./get-static-value.mjs\"\nimport { getStringIfConstant } from \"./get-string-if-constant.mjs\"\nimport { hasSideEffect } from \"./has-side-effect.mjs\"\nimport { isParenthesized } from \"./is-parenthesized.mjs\"\nimport { PatternMatcher } from \"./pattern-matcher.mjs\"\nimport {\n CALL,\n CONSTRUCT,\n ESM,\n READ,\n ReferenceTracker,\n} from \"./reference-tracker.mjs\"\nimport {\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isSemicolonToken,\n} from \"./token-predicate.mjs\"\n\nexport default {\n CALL,\n CONSTRUCT,\n ESM,\n findVariable,\n getFunctionHeadLocation,\n getFunctionNameWithKind,\n getInnermostScope,\n getPropertyName,\n getStaticValue,\n getStringIfConstant,\n hasSideEffect,\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isParenthesized,\n isSemicolonToken,\n PatternMatcher,\n READ,\n ReferenceTracker,\n}\nexport {\n CALL,\n CONSTRUCT,\n ESM,\n findVariable,\n getFunctionHeadLocation,\n getFunctionNameWithKind,\n getInnermostScope,\n getPropertyName,\n getStaticValue,\n getStringIfConstant,\n hasSideEffect,\n isArrowToken,\n isClosingBraceToken,\n isClosingBracketToken,\n isClosingParenToken,\n isColonToken,\n isCommaToken,\n isCommentToken,\n isNotArrowToken,\n isNotClosingBraceToken,\n isNotClosingBracketToken,\n isNotClosingParenToken,\n isNotColonToken,\n isNotCommaToken,\n isNotCommentToken,\n isNotOpeningBraceToken,\n isNotOpeningBracketToken,\n isNotOpeningParenToken,\n isNotSemicolonToken,\n isOpeningBraceToken,\n isOpeningBracketToken,\n isOpeningParenToken,\n isParenthesized,\n isSemicolonToken,\n PatternMatcher,\n READ,\n ReferenceTracker,\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,YAAY,EAAE,IAAI,EAAE;AACtD,IAAI,MAAM,QAAQ,mCAAmC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAC;AACpE;AACA,IAAI,IAAI,KAAK,GAAG,aAAY;AAC5B,IAAI,IAAI,KAAK,GAAG,MAAK;AACrB,IAAI,GAAG;AACP,QAAQ,KAAK,GAAG,MAAK;AACrB,QAAQ,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,WAAW,EAAE;AACpD,YAAY,MAAM,KAAK;AACvB,gBAAgB,UAAU,CAAC,KAAK,CAAC,KAAK;AACtC,cAAa;AACb;AACA,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,QAAQ,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;AAC7D,gBAAgB,KAAK,GAAG,WAAU;AAClC,gBAAgB,KAAK,GAAG,KAAI;AAC5B,gBAAgB,KAAK;AACrB,aAAa;AACb,SAAS;AACT,KAAK,QAAQ,KAAK,CAAC;AACnB;AACA,IAAI,OAAO,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AC;AAC/C;;ACrjBA;AAiEA;AACA,YAAe;AACf,IAAI,IAAI;AACR,IAAI,SAAS;AACb,IAAI,GAAG;AACP,IAAI,YAAY;AAChB,IAAI,uBAAuB;AAC3B,IAAI,uBAAuB;AAC3B,IAAI,iBAAiB;AACrB,IAAI,eAAe;AACnB,IAAI,cAAc;AAClB,IAAI,mBAAmB;AACvB,IAAI,aAAa;AACjB,IAAI,YAAY;AAChB,IAAI,mBAAmB;AACvB,IAAI,qBAAqB;AACzB,IAAI,mBAAmB;AACvB,IAAI,YAAY;AAChB,IAAI,YAAY;AAChB,IAAI,cAAc;AAClB,IAAI,eAAe;AACnB,IAAI,sBAAsB;AAC1B,IAAI,wBAAwB;AAC5B,IAAI,sBAAsB;AAC1B,IAAI,eAAe;AACnB,IAAI,eAAe;AACnB,IAAI,iBAAiB;AACrB,IAAI,sBAAsB;AAC1B,IAAI,wBAAwB;AAC5B,IAAI,sBAAsB;AAC1B,IAAI,mBAAmB;AACvB,IAAI,mBAAmB;AACvB,IAAI,qBAAqB;AACzB,IAAI,mBAAmB;AACvB,IAAI,eAAe;AACnB,IAAI,gBAAgB;AACpB,IAAI,cAAc;AAClB,IAAI,IAAI;AACR,IAAI,gBAAgB;AACpB;;;;"} \ No newline at end of file diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/LICENSE b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..17a25538d9bd634bc079642d35d7a6422a0d850d --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright contributors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/README.md b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/README.md new file mode 100644 index 0000000000000000000000000000000000000000..cab81032030e33e6011feccc4701fbd0d56b47da --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/README.md @@ -0,0 +1,105 @@ +# eslint-visitor-keys + +[![npm version](https://img.shields.io/npm/v/eslint-visitor-keys.svg)](https://www.npmjs.com/package/eslint-visitor-keys) +[![Downloads/month](https://img.shields.io/npm/dm/eslint-visitor-keys.svg)](http://www.npmtrends.com/eslint-visitor-keys) +[![Build Status](https://github.com/eslint/eslint-visitor-keys/workflows/CI/badge.svg)](https://github.com/eslint/eslint-visitor-keys/actions) + +Constants and utilities about visitor keys to traverse AST. + +## ๐Ÿ’ฟ Installation + +Use [npm] to install. + +```bash +$ npm install eslint-visitor-keys +``` + +### Requirements + +- [Node.js] `^12.22.0`, `^14.17.0`, or `>=16.0.0` + + +## ๐Ÿ“– Usage + +To use in an ESM file: + +```js +import * as evk from "eslint-visitor-keys" +``` + +To use in a CommonJS file: + +```js +const evk = require("eslint-visitor-keys") +``` + +### evk.KEYS + +> type: `{ [type: string]: string[] | undefined }` + +Visitor keys. This keys are frozen. + +This is an object. Keys are the type of [ESTree] nodes. Their values are an array of property names which have child nodes. + +For example: + +``` +console.log(evk.KEYS.AssignmentExpression) // โ†’ ["left", "right"] +``` + +### evk.getKeys(node) + +> type: `(node: object) => string[]` + +Get the visitor keys of a given AST node. + +This is similar to `Object.keys(node)` of ES Standard, but some keys are excluded: `parent`, `leadingComments`, `trailingComments`, and names which start with `_`. + +This will be used to traverse unknown nodes. + +For example: + +```js +const node = { + type: "AssignmentExpression", + left: { type: "Identifier", name: "foo" }, + right: { type: "Literal", value: 0 } +} +console.log(evk.getKeys(node)) // โ†’ ["type", "left", "right"] +``` + +### evk.unionWith(additionalKeys) + +> type: `(additionalKeys: object) => { [type: string]: string[] | undefined }` + +Make the union set with `evk.KEYS` and the given keys. + +- The order of keys is, `additionalKeys` is at first, then `evk.KEYS` is concatenated after that. +- It removes duplicated keys as keeping the first one. + +For example: + +```js +console.log(evk.unionWith({ + MethodDefinition: ["decorators"] +})) // โ†’ { ..., MethodDefinition: ["decorators", "key", "value"], ... } +``` + +## ๐Ÿ“ฐ Change log + +See [GitHub releases](https://github.com/eslint/eslint-visitor-keys/releases). + +## ๐Ÿป Contributing + +Welcome. See [ESLint contribution guidelines](https://eslint.org/docs/developer-guide/contributing/). + +### Development commands + +- `npm test` runs tests and measures code coverage. +- `npm run lint` checks source codes with ESLint. +- `npm run test:open-coverage` opens the code coverage report of the previous test with your default browser. + + +[npm]: https://www.npmjs.com/ +[Node.js]: https://nodejs.org/ +[ESTree]: https://github.com/estree/estree diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs new file mode 100644 index 0000000000000000000000000000000000000000..00f91bcc4834d65e473572c1df966dcb7fe4d5a9 --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs @@ -0,0 +1,384 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +/** + * @typedef {{ readonly [type: string]: ReadonlyArray }} VisitorKeys + */ + +/** + * @type {VisitorKeys} + */ +const KEYS = { + ArrayExpression: [ + "elements" + ], + ArrayPattern: [ + "elements" + ], + ArrowFunctionExpression: [ + "params", + "body" + ], + AssignmentExpression: [ + "left", + "right" + ], + AssignmentPattern: [ + "left", + "right" + ], + AwaitExpression: [ + "argument" + ], + BinaryExpression: [ + "left", + "right" + ], + BlockStatement: [ + "body" + ], + BreakStatement: [ + "label" + ], + CallExpression: [ + "callee", + "arguments" + ], + CatchClause: [ + "param", + "body" + ], + ChainExpression: [ + "expression" + ], + ClassBody: [ + "body" + ], + ClassDeclaration: [ + "id", + "superClass", + "body" + ], + ClassExpression: [ + "id", + "superClass", + "body" + ], + ConditionalExpression: [ + "test", + "consequent", + "alternate" + ], + ContinueStatement: [ + "label" + ], + DebuggerStatement: [], + DoWhileStatement: [ + "body", + "test" + ], + EmptyStatement: [], + ExperimentalRestProperty: [ + "argument" + ], + ExperimentalSpreadProperty: [ + "argument" + ], + ExportAllDeclaration: [ + "exported", + "source" + ], + ExportDefaultDeclaration: [ + "declaration" + ], + ExportNamedDeclaration: [ + "declaration", + "specifiers", + "source" + ], + ExportSpecifier: [ + "exported", + "local" + ], + ExpressionStatement: [ + "expression" + ], + ForInStatement: [ + "left", + "right", + "body" + ], + ForOfStatement: [ + "left", + "right", + "body" + ], + ForStatement: [ + "init", + "test", + "update", + "body" + ], + FunctionDeclaration: [ + "id", + "params", + "body" + ], + FunctionExpression: [ + "id", + "params", + "body" + ], + Identifier: [], + IfStatement: [ + "test", + "consequent", + "alternate" + ], + ImportDeclaration: [ + "specifiers", + "source" + ], + ImportDefaultSpecifier: [ + "local" + ], + ImportExpression: [ + "source" + ], + ImportNamespaceSpecifier: [ + "local" + ], + ImportSpecifier: [ + "imported", + "local" + ], + JSXAttribute: [ + "name", + "value" + ], + JSXClosingElement: [ + "name" + ], + JSXClosingFragment: [], + JSXElement: [ + "openingElement", + "children", + "closingElement" + ], + JSXEmptyExpression: [], + JSXExpressionContainer: [ + "expression" + ], + JSXFragment: [ + "openingFragment", + "children", + "closingFragment" + ], + JSXIdentifier: [], + JSXMemberExpression: [ + "object", + "property" + ], + JSXNamespacedName: [ + "namespace", + "name" + ], + JSXOpeningElement: [ + "name", + "attributes" + ], + JSXOpeningFragment: [], + JSXSpreadAttribute: [ + "argument" + ], + JSXSpreadChild: [ + "expression" + ], + JSXText: [], + LabeledStatement: [ + "label", + "body" + ], + Literal: [], + LogicalExpression: [ + "left", + "right" + ], + MemberExpression: [ + "object", + "property" + ], + MetaProperty: [ + "meta", + "property" + ], + MethodDefinition: [ + "key", + "value" + ], + NewExpression: [ + "callee", + "arguments" + ], + ObjectExpression: [ + "properties" + ], + ObjectPattern: [ + "properties" + ], + PrivateIdentifier: [], + Program: [ + "body" + ], + Property: [ + "key", + "value" + ], + PropertyDefinition: [ + "key", + "value" + ], + RestElement: [ + "argument" + ], + ReturnStatement: [ + "argument" + ], + SequenceExpression: [ + "expressions" + ], + SpreadElement: [ + "argument" + ], + StaticBlock: [ + "body" + ], + Super: [], + SwitchCase: [ + "test", + "consequent" + ], + SwitchStatement: [ + "discriminant", + "cases" + ], + TaggedTemplateExpression: [ + "tag", + "quasi" + ], + TemplateElement: [], + TemplateLiteral: [ + "quasis", + "expressions" + ], + ThisExpression: [], + ThrowStatement: [ + "argument" + ], + TryStatement: [ + "block", + "handler", + "finalizer" + ], + UnaryExpression: [ + "argument" + ], + UpdateExpression: [ + "argument" + ], + VariableDeclaration: [ + "declarations" + ], + VariableDeclarator: [ + "id", + "init" + ], + WhileStatement: [ + "test", + "body" + ], + WithStatement: [ + "object", + "body" + ], + YieldExpression: [ + "argument" + ] +}; + +// Types. +const NODE_TYPES = Object.keys(KEYS); + +// Freeze the keys. +for (const type of NODE_TYPES) { + Object.freeze(KEYS[type]); +} +Object.freeze(KEYS); + +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ + +/** + * @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys + */ + +// List to ignore keys. +const KEY_BLACKLIST = new Set([ + "parent", + "leadingComments", + "trailingComments" +]); + +/** + * Check whether a given key should be used or not. + * @param {string} key The key to check. + * @returns {boolean} `true` if the key should be used. + */ +function filterKey(key) { + return !KEY_BLACKLIST.has(key) && key[0] !== "_"; +} + +/** + * Get visitor keys of a given node. + * @param {object} node The AST node to get keys. + * @returns {readonly string[]} Visitor keys of the node. + */ +function getKeys(node) { + return Object.keys(node).filter(filterKey); +} + +// Disable valid-jsdoc rule because it reports syntax error on the type of @returns. +// eslint-disable-next-line valid-jsdoc +/** + * Make the union set with `KEYS` and given keys. + * @param {VisitorKeys} additionalKeys The additional keys. + * @returns {VisitorKeys} The union set. + */ +function unionWith(additionalKeys) { + const retv = /** @type {{ + [type: string]: ReadonlyArray + }} */ (Object.assign({}, KEYS)); + + for (const type of Object.keys(additionalKeys)) { + if (Object.prototype.hasOwnProperty.call(retv, type)) { + const keys = new Set(additionalKeys[type]); + + for (const key of retv[type]) { + keys.add(key); + } + + retv[type] = Object.freeze(Array.from(keys)); + } else { + retv[type] = Object.freeze(Array.from(additionalKeys[type])); + } + } + + return Object.freeze(retv); +} + +exports.KEYS = KEYS; +exports.getKeys = getKeys; +exports.unionWith = unionWith; diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..c7c28ed37b805f63cf990f7eec69c5c39863347d --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts @@ -0,0 +1,27 @@ +type VisitorKeys$1 = { + readonly [type: string]: readonly string[]; +}; +/** + * @typedef {{ readonly [type: string]: ReadonlyArray }} VisitorKeys + */ +/** + * @type {VisitorKeys} + */ +declare const KEYS: VisitorKeys$1; + +/** + * Get visitor keys of a given node. + * @param {object} node The AST node to get keys. + * @returns {readonly string[]} Visitor keys of the node. + */ +declare function getKeys(node: object): readonly string[]; +/** + * Make the union set with `KEYS` and given keys. + * @param {VisitorKeys} additionalKeys The additional keys. + * @returns {VisitorKeys} The union set. + */ +declare function unionWith(additionalKeys: VisitorKeys): VisitorKeys; + +type VisitorKeys = VisitorKeys$1; + +export { KEYS, VisitorKeys, getKeys, unionWith }; diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/index.d.ts b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46bd87e27ae608a7e79541c2bb8da410336d52b3 --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/index.d.ts @@ -0,0 +1,16 @@ +/** + * Get visitor keys of a given node. + * @param {object} node The AST node to get keys. + * @returns {readonly string[]} Visitor keys of the node. + */ +export function getKeys(node: object): readonly string[]; +/** + * Make the union set with `KEYS` and given keys. + * @param {VisitorKeys} additionalKeys The additional keys. + * @returns {VisitorKeys} The union set. + */ +export function unionWith(additionalKeys: VisitorKeys): VisitorKeys; +export { KEYS }; +export type VisitorKeys = import('./visitor-keys.js').VisitorKeys; +import KEYS from "./visitor-keys.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..57a952c508f00e95eaafcedf14bc35124c6c8b08 --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts @@ -0,0 +1,12 @@ +export default KEYS; +export type VisitorKeys = { + readonly [type: string]: readonly string[]; +}; +/** + * @typedef {{ readonly [type: string]: ReadonlyArray }} VisitorKeys + */ +/** + * @type {VisitorKeys} + */ +declare const KEYS: VisitorKeys; +//# sourceMappingURL=visitor-keys.d.ts.map \ No newline at end of file diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3622816d632da0a6d7559a49bdcee96ff25735d6 --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js @@ -0,0 +1,65 @@ +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ +import KEYS from "./visitor-keys.js"; + +/** + * @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys + */ + +// List to ignore keys. +const KEY_BLACKLIST = new Set([ + "parent", + "leadingComments", + "trailingComments" +]); + +/** + * Check whether a given key should be used or not. + * @param {string} key The key to check. + * @returns {boolean} `true` if the key should be used. + */ +function filterKey(key) { + return !KEY_BLACKLIST.has(key) && key[0] !== "_"; +} + +/** + * Get visitor keys of a given node. + * @param {object} node The AST node to get keys. + * @returns {readonly string[]} Visitor keys of the node. + */ +export function getKeys(node) { + return Object.keys(node).filter(filterKey); +} + +// Disable valid-jsdoc rule because it reports syntax error on the type of @returns. +// eslint-disable-next-line valid-jsdoc +/** + * Make the union set with `KEYS` and given keys. + * @param {VisitorKeys} additionalKeys The additional keys. + * @returns {VisitorKeys} The union set. + */ +export function unionWith(additionalKeys) { + const retv = /** @type {{ + [type: string]: ReadonlyArray + }} */ (Object.assign({}, KEYS)); + + for (const type of Object.keys(additionalKeys)) { + if (Object.prototype.hasOwnProperty.call(retv, type)) { + const keys = new Set(additionalKeys[type]); + + for (const key of retv[type]) { + keys.add(key); + } + + retv[type] = Object.freeze(Array.from(keys)); + } else { + retv[type] = Object.freeze(Array.from(additionalKeys[type])); + } + } + + return Object.freeze(retv); +} + +export { KEYS }; diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.js b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.js new file mode 100644 index 0000000000000000000000000000000000000000..ccf2b1f9a3fe8924d606bd88b34d2956a028834c --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.js @@ -0,0 +1,315 @@ +/** + * @typedef {{ readonly [type: string]: ReadonlyArray }} VisitorKeys + */ + +/** + * @type {VisitorKeys} + */ +const KEYS = { + ArrayExpression: [ + "elements" + ], + ArrayPattern: [ + "elements" + ], + ArrowFunctionExpression: [ + "params", + "body" + ], + AssignmentExpression: [ + "left", + "right" + ], + AssignmentPattern: [ + "left", + "right" + ], + AwaitExpression: [ + "argument" + ], + BinaryExpression: [ + "left", + "right" + ], + BlockStatement: [ + "body" + ], + BreakStatement: [ + "label" + ], + CallExpression: [ + "callee", + "arguments" + ], + CatchClause: [ + "param", + "body" + ], + ChainExpression: [ + "expression" + ], + ClassBody: [ + "body" + ], + ClassDeclaration: [ + "id", + "superClass", + "body" + ], + ClassExpression: [ + "id", + "superClass", + "body" + ], + ConditionalExpression: [ + "test", + "consequent", + "alternate" + ], + ContinueStatement: [ + "label" + ], + DebuggerStatement: [], + DoWhileStatement: [ + "body", + "test" + ], + EmptyStatement: [], + ExperimentalRestProperty: [ + "argument" + ], + ExperimentalSpreadProperty: [ + "argument" + ], + ExportAllDeclaration: [ + "exported", + "source" + ], + ExportDefaultDeclaration: [ + "declaration" + ], + ExportNamedDeclaration: [ + "declaration", + "specifiers", + "source" + ], + ExportSpecifier: [ + "exported", + "local" + ], + ExpressionStatement: [ + "expression" + ], + ForInStatement: [ + "left", + "right", + "body" + ], + ForOfStatement: [ + "left", + "right", + "body" + ], + ForStatement: [ + "init", + "test", + "update", + "body" + ], + FunctionDeclaration: [ + "id", + "params", + "body" + ], + FunctionExpression: [ + "id", + "params", + "body" + ], + Identifier: [], + IfStatement: [ + "test", + "consequent", + "alternate" + ], + ImportDeclaration: [ + "specifiers", + "source" + ], + ImportDefaultSpecifier: [ + "local" + ], + ImportExpression: [ + "source" + ], + ImportNamespaceSpecifier: [ + "local" + ], + ImportSpecifier: [ + "imported", + "local" + ], + JSXAttribute: [ + "name", + "value" + ], + JSXClosingElement: [ + "name" + ], + JSXClosingFragment: [], + JSXElement: [ + "openingElement", + "children", + "closingElement" + ], + JSXEmptyExpression: [], + JSXExpressionContainer: [ + "expression" + ], + JSXFragment: [ + "openingFragment", + "children", + "closingFragment" + ], + JSXIdentifier: [], + JSXMemberExpression: [ + "object", + "property" + ], + JSXNamespacedName: [ + "namespace", + "name" + ], + JSXOpeningElement: [ + "name", + "attributes" + ], + JSXOpeningFragment: [], + JSXSpreadAttribute: [ + "argument" + ], + JSXSpreadChild: [ + "expression" + ], + JSXText: [], + LabeledStatement: [ + "label", + "body" + ], + Literal: [], + LogicalExpression: [ + "left", + "right" + ], + MemberExpression: [ + "object", + "property" + ], + MetaProperty: [ + "meta", + "property" + ], + MethodDefinition: [ + "key", + "value" + ], + NewExpression: [ + "callee", + "arguments" + ], + ObjectExpression: [ + "properties" + ], + ObjectPattern: [ + "properties" + ], + PrivateIdentifier: [], + Program: [ + "body" + ], + Property: [ + "key", + "value" + ], + PropertyDefinition: [ + "key", + "value" + ], + RestElement: [ + "argument" + ], + ReturnStatement: [ + "argument" + ], + SequenceExpression: [ + "expressions" + ], + SpreadElement: [ + "argument" + ], + StaticBlock: [ + "body" + ], + Super: [], + SwitchCase: [ + "test", + "consequent" + ], + SwitchStatement: [ + "discriminant", + "cases" + ], + TaggedTemplateExpression: [ + "tag", + "quasi" + ], + TemplateElement: [], + TemplateLiteral: [ + "quasis", + "expressions" + ], + ThisExpression: [], + ThrowStatement: [ + "argument" + ], + TryStatement: [ + "block", + "handler", + "finalizer" + ], + UnaryExpression: [ + "argument" + ], + UpdateExpression: [ + "argument" + ], + VariableDeclaration: [ + "declarations" + ], + VariableDeclarator: [ + "id", + "init" + ], + WhileStatement: [ + "test", + "body" + ], + WithStatement: [ + "object", + "body" + ], + YieldExpression: [ + "argument" + ] +}; + +// Types. +const NODE_TYPES = Object.keys(KEYS); + +// Freeze the keys. +for (const type of NODE_TYPES) { + Object.freeze(KEYS[type]); +} +Object.freeze(KEYS); + +export default KEYS; diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/package.json b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b9d51ce0e68900ede192e66520cb541fb2198004 --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/package.json @@ -0,0 +1,74 @@ +{ + "name": "eslint-visitor-keys", + "version": "3.4.3", + "description": "Constants and utilities about visitor keys to traverse AST.", + "type": "module", + "main": "dist/eslint-visitor-keys.cjs", + "types": "./dist/index.d.ts", + "exports": { + ".": [ + { + "import": "./lib/index.js", + "require": "./dist/eslint-visitor-keys.cjs" + }, + "./dist/eslint-visitor-keys.cjs" + ], + "./package.json": "./package.json" + }, + "files": [ + "dist/index.d.ts", + "dist/visitor-keys.d.ts", + "dist/eslint-visitor-keys.cjs", + "dist/eslint-visitor-keys.d.cts", + "lib" + ], + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "devDependencies": { + "@types/estree": "^0.0.51", + "@types/estree-jsx": "^0.0.1", + "@typescript-eslint/parser": "^5.14.0", + "c8": "^7.11.0", + "chai": "^4.3.6", + "eslint": "^7.29.0", + "eslint-config-eslint": "^7.0.0", + "eslint-plugin-jsdoc": "^35.4.0", + "eslint-plugin-node": "^11.1.0", + "eslint-release": "^3.2.0", + "esquery": "^1.4.0", + "json-diff": "^0.7.3", + "mocha": "^9.2.1", + "opener": "^1.5.2", + "rollup": "^2.70.0", + "rollup-plugin-dts": "^4.2.3", + "tsd": "^0.19.1", + "typescript": "^4.6.2" + }, + "scripts": { + "build": "npm run build:cjs && npm run build:types", + "build:cjs": "rollup -c", + "build:debug": "npm run build:cjs -- -m && npm run build:types", + "build:keys": "node tools/build-keys-from-ts", + "build:types": "tsc", + "lint": "eslint .", + "prepare": "npm run build", + "release:generate:latest": "eslint-generate-release", + "release:generate:alpha": "eslint-generate-prerelease alpha", + "release:generate:beta": "eslint-generate-prerelease beta", + "release:generate:rc": "eslint-generate-prerelease rc", + "release:publish": "eslint-publish-release", + "test": "mocha tests/lib/**/*.cjs && c8 mocha tests/lib/**/*.js && npm run test:types", + "test:open-coverage": "c8 report --reporter lcov && opener coverage/lcov-report/index.html", + "test:types": "tsd" + }, + "repository": "eslint/eslint-visitor-keys", + "funding": "https://opencollective.com/eslint", + "keywords": [], + "author": "Toru Nagashima (https://github.com/mysticatea)", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/eslint/eslint-visitor-keys/issues" + }, + "homepage": "https://github.com/eslint/eslint-visitor-keys#readme" +} diff --git a/node_modules/@eslint-community/eslint-utils/package.json b/node_modules/@eslint-community/eslint-utils/package.json new file mode 100644 index 0000000000000000000000000000000000000000..77dc06ba12993a3227f89625c8b6ca9d2a1784d4 --- /dev/null +++ b/node_modules/@eslint-community/eslint-utils/package.json @@ -0,0 +1,89 @@ +{ + "name": "@eslint-community/eslint-utils", + "version": "4.9.1", + "description": "Utilities for ESLint plugins.", + "keywords": [ + "eslint" + ], + "homepage": "https://github.com/eslint-community/eslint-utils#readme", + "bugs": { + "url": "https://github.com/eslint-community/eslint-utils/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/eslint-community/eslint-utils" + }, + "license": "MIT", + "author": "Toru Nagashima", + "sideEffects": false, + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js" + }, + "./package.json": "./package.json" + }, + "main": "index", + "module": "index.mjs", + "files": [ + "index.*" + ], + "scripts": { + "prebuild": "npm run -s clean", + "build": "npm run build:dts && npm run build:rollup", + "build:dts": "tsc -p tsconfig.build.json", + "build:rollup": "rollup -c", + "clean": "rimraf .nyc_output coverage index.* dist", + "coverage": "opener ./coverage/lcov-report/index.html", + "docs:build": "vitepress build docs", + "docs:watch": "vitepress dev docs", + "format": "npm run -s format:prettier -- --write", + "format:prettier": "prettier .", + "format:check": "npm run -s format:prettier -- --check", + "lint:eslint": "eslint .", + "lint:format": "npm run -s format:check", + "lint:installed-check": "installed-check -v -i installed-check -i npm-run-all2 -i knip -i rollup-plugin-dts", + "lint:knip": "knip", + "lint": "run-p lint:*", + "test-coverage": "c8 mocha --reporter dot \"test/*.mjs\"", + "test": "mocha --reporter dot \"test/*.mjs\"", + "preversion": "npm run test-coverage && npm run -s build", + "postversion": "git push && git push --tags", + "prewatch": "npm run -s clean", + "watch": "warun \"{src,test}/**/*.mjs\" -- npm run -s test:mocha" + }, + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "devDependencies": { + "@eslint-community/eslint-plugin-mysticatea": "^15.6.1", + "@types/eslint": "^9.6.1", + "@types/estree": "^1.0.7", + "@typescript-eslint/parser": "^5.62.0", + "@typescript-eslint/types": "^5.62.0", + "c8": "^8.0.1", + "dot-prop": "^7.2.0", + "eslint": "^8.57.1", + "installed-check": "^8.0.1", + "knip": "^5.33.3", + "mocha": "^9.2.2", + "npm-run-all2": "^6.2.3", + "opener": "^1.5.2", + "prettier": "2.8.8", + "rimraf": "^3.0.2", + "rollup": "^2.79.2", + "rollup-plugin-dts": "^4.2.3", + "rollup-plugin-sourcemaps": "^0.6.3", + "semver": "^7.6.3", + "typescript": "^4.9.5", + "vitepress": "^1.4.1", + "warun": "^1.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": "https://opencollective.com/eslint" +} diff --git a/node_modules/@eslint-community/regexpp/LICENSE b/node_modules/@eslint-community/regexpp/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..883ee1f612d12cea3642aa8a8473084202bcb220 --- /dev/null +++ b/node_modules/@eslint-community/regexpp/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Toru Nagashima + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@eslint-community/regexpp/README.md b/node_modules/@eslint-community/regexpp/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9728af519c62be6d82c73fabd3f72c7c34bd86a0 --- /dev/null +++ b/node_modules/@eslint-community/regexpp/README.md @@ -0,0 +1,177 @@ +# @eslint-community/regexpp + +[![npm version](https://img.shields.io/npm/v/@eslint-community/regexpp.svg)](https://www.npmjs.com/package/@eslint-community/regexpp) +[![Downloads/month](https://img.shields.io/npm/dm/@eslint-community/regexpp.svg)](http://www.npmtrends.com/@eslint-community/regexpp) +[![Build Status](https://github.com/eslint-community/regexpp/workflows/CI/badge.svg)](https://github.com/eslint-community/regexpp/actions) +[![codecov](https://codecov.io/gh/eslint-community/regexpp/branch/main/graph/badge.svg)](https://codecov.io/gh/eslint-community/regexpp) + +A regular expression parser for ECMAScript. + +## ๐Ÿ’ฟ Installation + +```bash +$ npm install @eslint-community/regexpp +``` + +- require Node@^12.0.0 || ^14.0.0 || >=16.0.0. + +## ๐Ÿ“– Usage + +```ts +import { + AST, + RegExpParser, + RegExpValidator, + RegExpVisitor, + parseRegExpLiteral, + validateRegExpLiteral, + visitRegExpAST +} from "@eslint-community/regexpp" +``` + +### parseRegExpLiteral(source, options?) + +Parse a given regular expression literal then make AST object. + +This is equivalent to `new RegExpParser(options).parseLiteral(source)`. + +- **Parameters:** + - `source` (`string | RegExp`) The source code to parse. + - `options?` ([`RegExpParser.Options`]) The options to parse. +- **Return:** + - The AST of the regular expression. + +### validateRegExpLiteral(source, options?) + +Validate a given regular expression literal. + +This is equivalent to `new RegExpValidator(options).validateLiteral(source)`. + +- **Parameters:** + - `source` (`string`) The source code to validate. + - `options?` ([`RegExpValidator.Options`]) The options to validate. + +### visitRegExpAST(ast, handlers) + +Visit each node of a given AST. + +This is equivalent to `new RegExpVisitor(handlers).visit(ast)`. + +- **Parameters:** + - `ast` ([`AST.Node`]) The AST to visit. + - `handlers` ([`RegExpVisitor.Handlers`]) The callbacks. + +### RegExpParser + +#### new RegExpParser(options?) + +- **Parameters:** + - `options?` ([`RegExpParser.Options`]) The options to parse. + +#### parser.parseLiteral(source, start?, end?) + +Parse a regular expression literal. + +- **Parameters:** + - `source` (`string`) The source code to parse. E.g. `"/abc/g"`. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. +- **Return:** + - The AST of the regular expression. + +#### parser.parsePattern(source, start?, end?, flags?) + +Parse a regular expression pattern. + +- **Parameters:** + - `source` (`string`) The source code to parse. E.g. `"abc"`. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. + - `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set mode. +- **Return:** + - The AST of the regular expression pattern. + +#### parser.parseFlags(source, start?, end?) + +Parse a regular expression flags. + +- **Parameters:** + - `source` (`string`) The source code to parse. E.g. `"gim"`. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. +- **Return:** + - The AST of the regular expression flags. + +### RegExpValidator + +#### new RegExpValidator(options) + +- **Parameters:** + - `options` ([`RegExpValidator.Options`]) The options to validate. + +#### validator.validateLiteral(source, start, end) + +Validate a regular expression literal. + +- **Parameters:** + - `source` (`string`) The source code to validate. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. + +#### validator.validatePattern(source, start, end, flags) + +Validate a regular expression pattern. + +- **Parameters:** + - `source` (`string`) The source code to validate. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. + - `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set mode. + +#### validator.validateFlags(source, start, end) + +Validate a regular expression flags. + +- **Parameters:** + - `source` (`string`) The source code to validate. + - `start?` (`number`) The start index in the source code. Default is `0`. + - `end?` (`number`) The end index in the source code. Default is `source.length`. + +### RegExpVisitor + +#### new RegExpVisitor(handlers) + +- **Parameters:** + - `handlers` ([`RegExpVisitor.Handlers`]) The callbacks. + +#### visitor.visit(ast) + +Validate a regular expression literal. + +- **Parameters:** + - `ast` ([`AST.Node`]) The AST to visit. + +## ๐Ÿ“ฐ Changelog + +- [GitHub Releases](https://github.com/eslint-community/regexpp/releases) + +## ๐Ÿป Contributing + +Welcome contributing! + +Please use GitHub's Issues/PRs. + +### Development Tools + +- `npm test` runs tests and measures coverage. +- `npm run build` compiles TypeScript source code to `index.js`, `index.js.map`, and `index.d.ts`. +- `npm run clean` removes the temporary files which are created by `npm test` and `npm run build`. +- `npm run lint` runs ESLint. +- `npm run update:test` updates test fixtures. +- `npm run update:ids` updates `src/unicode/ids.ts`. +- `npm run watch` runs tests with `--watch` option. + +[`AST.Node`]: src/ast.ts#L4 +[`RegExpParser.Options`]: src/parser.ts#L743 +[`RegExpValidator.Options`]: src/validator.ts#L220 +[`RegExpVisitor.Handlers`]: src/visitor.ts#L291 diff --git a/node_modules/@eslint-community/regexpp/index.d.ts b/node_modules/@eslint-community/regexpp/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c75657aadab2e5ddedb0090eaeb1415936f402a5 --- /dev/null +++ b/node_modules/@eslint-community/regexpp/index.d.ts @@ -0,0 +1,1163 @@ +// Generated by dts-bundle v0.7.3 + +declare module "@eslint-community/regexpp" { + import * as AST from "@eslint-community/regexpp/ast"; + import { RegExpParser } from "@eslint-community/regexpp/parser"; + import { RegExpValidator } from "@eslint-community/regexpp/validator"; + import { RegExpVisitor } from "@eslint-community/regexpp/visitor"; + export { RegExpSyntaxError } from "@eslint-community/regexpp/regexp-syntax-error"; + export { AST, RegExpParser, RegExpValidator }; + /** + * Parse a given regular expression literal then make AST object. + * @param source The source code to parse. + * @param options The options to parse. + * @returns The AST of the regular expression. + */ + export function parseRegExpLiteral( + source: RegExp | string, + options?: RegExpParser.Options + ): AST.RegExpLiteral; + /** + * Validate a given regular expression literal. + * @param source The source code to validate. + * @param options The options to validate. + */ + export function validateRegExpLiteral( + source: string, + options?: RegExpValidator.Options + ): void; + export function visitRegExpAST( + node: AST.Node, + handlers: RegExpVisitor.Handlers + ): void; +} + +declare module "@eslint-community/regexpp/ast" { + /** + * The type which includes all nodes. + */ + export type Node = BranchNode | LeafNode; + /** + * The type which includes all branch nodes. + */ + export type BranchNode = + | Alternative + | CapturingGroup + | CharacterClass + | CharacterClassRange + | ClassIntersection + | ClassStringDisjunction + | ClassSubtraction + | ExpressionCharacterClass + | Group + | LookaroundAssertion + | Modifiers + | Pattern + | Quantifier + | RegExpLiteral + | StringAlternative; + /** + * The type which includes all leaf nodes. + */ + export type LeafNode = + | Backreference + | BoundaryAssertion + | Character + | CharacterSet + | Flags + | ModifierFlags; + /** + * The type which includes all atom nodes. + */ + export type Element = Assertion | QuantifiableElement | Quantifier; + /** + * The type which includes all atom nodes that Quantifier node can have as children. + */ + export type QuantifiableElement = + | Backreference + | CapturingGroup + | Character + | CharacterClass + | CharacterSet + | ExpressionCharacterClass + | Group + | LookaheadAssertion; + /** + * The type which includes all character class atom nodes. + */ + export type CharacterClassElement = + | ClassRangesCharacterClassElement + | UnicodeSetsCharacterClassElement; + export type ClassRangesCharacterClassElement = + | Character + | CharacterClassRange + | CharacterUnicodePropertyCharacterSet + | EscapeCharacterSet; + export type UnicodeSetsCharacterClassElement = + | Character + | CharacterClassRange + | ClassStringDisjunction + | EscapeCharacterSet + | ExpressionCharacterClass + | UnicodePropertyCharacterSet + | UnicodeSetsCharacterClass; + /** + * The type which defines common properties for all node types. + */ + export interface NodeBase { + /** The node type. */ + type: Node["type"]; + /** The parent node. */ + parent: Node["parent"]; + /** The 0-based index that this node starts. */ + start: number; + /** The 0-based index that this node ends. */ + end: number; + /** The raw text of this node. */ + raw: string; + } + /** + * The root node. + */ + export interface RegExpLiteral extends NodeBase { + type: "RegExpLiteral"; + parent: null; + pattern: Pattern; + flags: Flags; + } + /** + * The pattern. + */ + export interface Pattern extends NodeBase { + type: "Pattern"; + parent: RegExpLiteral | null; + alternatives: Alternative[]; + } + /** + * The alternative. + * E.g. `a|b` + */ + export interface Alternative extends NodeBase { + type: "Alternative"; + parent: CapturingGroup | Group | LookaroundAssertion | Pattern; + elements: Element[]; + } + /** + * The uncapturing group. + * E.g. `(?:ab)` + */ + export interface Group extends NodeBase { + type: "Group"; + parent: Alternative | Quantifier; + modifiers: Modifiers | null; + alternatives: Alternative[]; + } + /** + * The capturing group. + * E.g. `(ab)`, `(?ab)` + */ + export interface CapturingGroup extends NodeBase { + type: "CapturingGroup"; + parent: Alternative | Quantifier; + name: string | null; + alternatives: Alternative[]; + references: Backreference[]; + } + /** + * The lookaround assertion. + */ + export type LookaroundAssertion = LookaheadAssertion | LookbehindAssertion; + /** + * The lookahead assertion. + * E.g. `(?=ab)`, `(?!ab)` + */ + export interface LookaheadAssertion extends NodeBase { + type: "Assertion"; + parent: Alternative | Quantifier; + kind: "lookahead"; + negate: boolean; + alternatives: Alternative[]; + } + /** + * The lookbehind assertion. + * E.g. `(?<=ab)`, `(?` + */ + export type Backreference = AmbiguousBackreference | UnambiguousBackreference; + interface BaseBackreference extends NodeBase { + type: "Backreference"; + parent: Alternative | Quantifier; + ref: number | string; + ambiguous: boolean; + resolved: CapturingGroup | CapturingGroup[]; + } + export interface AmbiguousBackreference extends BaseBackreference { + ref: string; + ambiguous: true; + resolved: CapturingGroup[]; + } + export interface UnambiguousBackreference extends BaseBackreference { + ambiguous: false; + resolved: CapturingGroup; + } + /** + * The modifiers. + */ + export interface Modifiers extends NodeBase { + type: "Modifiers"; + parent: Group; + /** + * The add modifier flags. + */ + add: ModifierFlags; + /** + * The remove modifier flags. + * + * `null` means no remove modifier flags. e.g. `(?ims:x)` + * The reason for `null` is that there is no position where the remove modifier flags appears. Must be behind the minus mark. + */ + remove: ModifierFlags | null; + } + /** + * The modifier flags. + */ + export interface ModifierFlags extends NodeBase { + type: "ModifierFlags"; + parent: Modifiers; + dotAll: boolean; + ignoreCase: boolean; + multiline: boolean; + } + /** + * The flags. + */ + export interface Flags extends NodeBase { + type: "Flags"; + parent: RegExpLiteral | null; + dotAll: boolean; + global: boolean; + hasIndices: boolean; + ignoreCase: boolean; + multiline: boolean; + sticky: boolean; + unicode: boolean; + unicodeSets: boolean; + } + export {}; +} + +declare module "@eslint-community/regexpp/parser" { + import type { + Flags, + RegExpLiteral, + Pattern, + } from "@eslint-community/regexpp/ast"; + import type { EcmaVersion } from "@eslint-community/regexpp/ecma-versions"; + export namespace RegExpParser { + /** + * The options for RegExpParser construction. + */ + interface Options { + /** + * The flag to disable Annex B syntax. Default is `false`. + */ + strict?: boolean; + /** + * ECMAScript version. Default is `2025`. + * - `2015` added `u` and `y` flags. + * - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion, + * and Unicode Property Escape. + * - `2019`, `2020`, and `2021` added more valid Unicode Property Escapes. + * - `2022` added `d` flag. + * - `2023` added more valid Unicode Property Escapes. + * - `2024` added `v` flag. + * - `2025` added duplicate named capturing groups, modifiers. + */ + ecmaVersion?: EcmaVersion; + } + } + export class RegExpParser { + /** + * Initialize this parser. + * @param options The options of parser. + */ + constructor(options?: RegExpParser.Options); + /** + * Parse a regular expression literal. E.g. "/abc/g" + * @param source The source code to parse. + * @param start The start index in the source code. + * @param end The end index in the source code. + * @returns The AST of the given regular expression. + */ + parseLiteral(source: string, start?: number, end?: number): RegExpLiteral; + /** + * Parse a regular expression flags. E.g. "gim" + * @param source The source code to parse. + * @param start The start index in the source code. + * @param end The end index in the source code. + * @returns The AST of the given flags. + */ + parseFlags(source: string, start?: number, end?: number): Flags; + /** + * Parse a regular expression pattern. E.g. "abc" + * @param source The source code to parse. + * @param start The start index in the source code. + * @param end The end index in the source code. + * @param flags The flags. + * @returns The AST of the given pattern. + */ + parsePattern( + source: string, + start?: number, + end?: number, + flags?: { + unicode?: boolean; + unicodeSets?: boolean; + } + ): Pattern; + /** + * @deprecated Backward compatibility + * Use object `flags` instead of boolean `uFlag`. + * + * @param source The source code to parse. + * @param start The start index in the source code. + * @param end The end index in the source code. + * @param uFlag The flag to set unicode mode. + * @returns The AST of the given pattern. + */ + parsePattern( + source: string, + start?: number, + end?: number, + uFlag?: boolean + ): Pattern; + } +} + +declare module "@eslint-community/regexpp/validator" { + import type { EcmaVersion } from "@eslint-community/regexpp/ecma-versions"; + export type RegExpValidatorSourceContext = { + readonly source: string; + readonly start: number; + readonly end: number; + readonly kind: "flags" | "literal" | "pattern"; + }; + export namespace RegExpValidator { + /** + * The options for RegExpValidator construction. + */ + interface Options { + /** + * The flag to disable Annex B syntax. Default is `false`. + */ + strict?: boolean; + /** + * ECMAScript version. Default is `2025`. + * - `2015` added `u` and `y` flags. + * - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion, + * and Unicode Property Escape. + * - `2019`, `2020`, and `2021` added more valid Unicode Property Escapes. + * - `2022` added `d` flag. + * - `2023` added more valid Unicode Property Escapes. + * - `2024` added `v` flag. + * - `2025` added duplicate named capturing groups, modifiers. + */ + ecmaVersion?: EcmaVersion; + /** + * A function that is called when the validator entered a RegExp literal. + * @param start The 0-based index of the first character. + */ + onLiteralEnter?: (start: number) => void; + /** + * A function that is called when the validator left a RegExp literal. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + */ + onLiteralLeave?: (start: number, end: number) => void; + /** + * A function that is called when the validator found flags. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param flags.global `g` flag. + * @param flags.ignoreCase `i` flag. + * @param flags.multiline `m` flag. + * @param flags.unicode `u` flag. + * @param flags.sticky `y` flag. + * @param flags.dotAll `s` flag. + * @param flags.hasIndices `d` flag. + * @param flags.unicodeSets `v` flag. + */ + onRegExpFlags?: ( + start: number, + end: number, + flags: { + global: boolean; + ignoreCase: boolean; + multiline: boolean; + unicode: boolean; + sticky: boolean; + dotAll: boolean; + hasIndices: boolean; + unicodeSets: boolean; + } + ) => void; + /** + * A function that is called when the validator found flags. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param global `g` flag. + * @param ignoreCase `i` flag. + * @param multiline `m` flag. + * @param unicode `u` flag. + * @param sticky `y` flag. + * @param dotAll `s` flag. + * @param hasIndices `d` flag. + * + * @deprecated Use `onRegExpFlags` instead. + */ + onFlags?: ( + start: number, + end: number, + global: boolean, + ignoreCase: boolean, + multiline: boolean, + unicode: boolean, + sticky: boolean, + dotAll: boolean, + hasIndices: boolean + ) => void; + /** + * A function that is called when the validator entered a pattern. + * @param start The 0-based index of the first character. + */ + onPatternEnter?: (start: number) => void; + /** + * A function that is called when the validator left a pattern. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + */ + onPatternLeave?: (start: number, end: number) => void; + /** + * A function that is called when the validator entered a disjunction. + * @param start The 0-based index of the first character. + */ + onDisjunctionEnter?: (start: number) => void; + /** + * A function that is called when the validator left a disjunction. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + */ + onDisjunctionLeave?: (start: number, end: number) => void; + /** + * A function that is called when the validator entered an alternative. + * @param start The 0-based index of the first character. + * @param index The 0-based index of alternatives in a disjunction. + */ + onAlternativeEnter?: (start: number, index: number) => void; + /** + * A function that is called when the validator left an alternative. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param index The 0-based index of alternatives in a disjunction. + */ + onAlternativeLeave?: (start: number, end: number, index: number) => void; + /** + * A function that is called when the validator entered an uncapturing group. + * @param start The 0-based index of the first character. + */ + onGroupEnter?: (start: number) => void; + /** + * A function that is called when the validator left an uncapturing group. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + */ + onGroupLeave?: (start: number, end: number) => void; + /** + * A function that is called when the validator entered a modifiers. + * @param start The 0-based index of the first character. + */ + onModifiersEnter?: (start: number) => void; + /** + * A function that is called when the validator left a modifiers. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + */ + onModifiersLeave?: (start: number, end: number) => void; + /** + * A function that is called when the validator found an add modifiers. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param flags flags. + * @param flags.ignoreCase `i` flag. + * @param flags.multiline `m` flag. + * @param flags.dotAll `s` flag. + */ + onAddModifiers?: ( + start: number, + end: number, + flags: { + ignoreCase: boolean; + multiline: boolean; + dotAll: boolean; + } + ) => void; + /** + * A function that is called when the validator found a remove modifiers. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param flags flags. + * @param flags.ignoreCase `i` flag. + * @param flags.multiline `m` flag. + * @param flags.dotAll `s` flag. + */ + onRemoveModifiers?: ( + start: number, + end: number, + flags: { + ignoreCase: boolean; + multiline: boolean; + dotAll: boolean; + } + ) => void; + /** + * A function that is called when the validator entered a capturing group. + * @param start The 0-based index of the first character. + * @param name The group name. + */ + onCapturingGroupEnter?: (start: number, name: string | null) => void; + /** + * A function that is called when the validator left a capturing group. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param name The group name. + */ + onCapturingGroupLeave?: ( + start: number, + end: number, + name: string | null + ) => void; + /** + * A function that is called when the validator found a quantifier. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param min The minimum number of repeating. + * @param max The maximum number of repeating. + * @param greedy The flag to choose the longest matching. + */ + onQuantifier?: ( + start: number, + end: number, + min: number, + max: number, + greedy: boolean + ) => void; + /** + * A function that is called when the validator entered a lookahead/lookbehind assertion. + * @param start The 0-based index of the first character. + * @param kind The kind of the assertion. + * @param negate The flag which represents that the assertion is negative. + */ + onLookaroundAssertionEnter?: ( + start: number, + kind: "lookahead" | "lookbehind", + negate: boolean + ) => void; + /** + * A function that is called when the validator left a lookahead/lookbehind assertion. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param kind The kind of the assertion. + * @param negate The flag which represents that the assertion is negative. + */ + onLookaroundAssertionLeave?: ( + start: number, + end: number, + kind: "lookahead" | "lookbehind", + negate: boolean + ) => void; + /** + * A function that is called when the validator found an edge boundary assertion. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param kind The kind of the assertion. + */ + onEdgeAssertion?: ( + start: number, + end: number, + kind: "end" | "start" + ) => void; + /** + * A function that is called when the validator found a word boundary assertion. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param kind The kind of the assertion. + * @param negate The flag which represents that the assertion is negative. + */ + onWordBoundaryAssertion?: ( + start: number, + end: number, + kind: "word", + negate: boolean + ) => void; + /** + * A function that is called when the validator found a dot. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param kind The kind of the character set. + */ + onAnyCharacterSet?: (start: number, end: number, kind: "any") => void; + /** + * A function that is called when the validator found a character set escape. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param kind The kind of the character set. + * @param negate The flag which represents that the character set is negative. + */ + onEscapeCharacterSet?: ( + start: number, + end: number, + kind: "digit" | "space" | "word", + negate: boolean + ) => void; + /** + * A function that is called when the validator found a Unicode proerty escape. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param kind The kind of the character set. + * @param key The property name. + * @param value The property value. + * @param negate The flag which represents that the character set is negative. + * @param strings If true, the given property is property of strings. + */ + onUnicodePropertyCharacterSet?: ( + start: number, + end: number, + kind: "property", + key: string, + value: string | null, + negate: boolean, + strings: boolean + ) => void; + /** + * A function that is called when the validator found a character. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param value The code point of the character. + */ + onCharacter?: (start: number, end: number, value: number) => void; + /** + * A function that is called when the validator found a backreference. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param ref The key of the referred capturing group. + */ + onBackreference?: ( + start: number, + end: number, + ref: number | string + ) => void; + /** + * A function that is called when the validator entered a character class. + * @param start The 0-based index of the first character. + * @param negate The flag which represents that the character class is negative. + * @param unicodeSets `true` if unicodeSets mode. + */ + onCharacterClassEnter?: ( + start: number, + negate: boolean, + unicodeSets: boolean + ) => void; + /** + * A function that is called when the validator left a character class. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param negate The flag which represents that the character class is negative. + */ + onCharacterClassLeave?: ( + start: number, + end: number, + negate: boolean + ) => void; + /** + * A function that is called when the validator found a character class range. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param min The minimum code point of the range. + * @param max The maximum code point of the range. + */ + onCharacterClassRange?: ( + start: number, + end: number, + min: number, + max: number + ) => void; + /** + * A function that is called when the validator found a class intersection. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + */ + onClassIntersection?: (start: number, end: number) => void; + /** + * A function that is called when the validator found a class subtraction. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + */ + onClassSubtraction?: (start: number, end: number) => void; + /** + * A function that is called when the validator entered a class string disjunction. + * @param start The 0-based index of the first character. + */ + onClassStringDisjunctionEnter?: (start: number) => void; + /** + * A function that is called when the validator left a class string disjunction. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + */ + onClassStringDisjunctionLeave?: (start: number, end: number) => void; + /** + * A function that is called when the validator entered a string alternative. + * @param start The 0-based index of the first character. + * @param index The 0-based index of alternatives in a disjunction. + */ + onStringAlternativeEnter?: (start: number, index: number) => void; + /** + * A function that is called when the validator left a string alternative. + * @param start The 0-based index of the first character. + * @param end The next 0-based index of the last character. + * @param index The 0-based index of alternatives in a disjunction. + */ + onStringAlternativeLeave?: ( + start: number, + end: number, + index: number + ) => void; + } + } + /** + * The regular expression validator. + */ + export class RegExpValidator { + /** + * Initialize this validator. + * @param options The options of validator. + */ + constructor(options?: RegExpValidator.Options); + /** + * Validate a regular expression literal. E.g. "/abc/g" + * @param source The source code to validate. + * @param start The start index in the source code. + * @param end The end index in the source code. + */ + validateLiteral(source: string, start?: number, end?: number): void; + /** + * Validate a regular expression flags. E.g. "gim" + * @param source The source code to validate. + * @param start The start index in the source code. + * @param end The end index in the source code. + */ + validateFlags(source: string, start?: number, end?: number): void; + /** + * Validate a regular expression pattern. E.g. "abc" + * @param source The source code to validate. + * @param start The start index in the source code. + * @param end The end index in the source code. + * @param flags The flags. + */ + validatePattern( + source: string, + start?: number, + end?: number, + flags?: { + unicode?: boolean; + unicodeSets?: boolean; + } + ): void; + /** + * @deprecated Backward compatibility + * Use object `flags` instead of boolean `uFlag`. + * @param source The source code to validate. + * @param start The start index in the source code. + * @param end The end index in the source code. + * @param uFlag The flag to set unicode mode. + */ + validatePattern( + source: string, + start?: number, + end?: number, + uFlag?: boolean + ): void; + } +} + +declare module "@eslint-community/regexpp/visitor" { + import type { + Alternative, + Assertion, + Backreference, + CapturingGroup, + Character, + CharacterClass, + CharacterClassRange, + CharacterSet, + ClassIntersection, + ClassStringDisjunction, + ClassSubtraction, + ExpressionCharacterClass, + Flags, + Group, + ModifierFlags, + Modifiers, + Node, + Pattern, + Quantifier, + RegExpLiteral, + StringAlternative, + } from "@eslint-community/regexpp/ast"; + /** + * The visitor to walk on AST. + */ + export class RegExpVisitor { + /** + * Initialize this visitor. + * @param handlers Callbacks for each node. + */ + constructor(handlers: RegExpVisitor.Handlers); + /** + * Visit a given node and descendant nodes. + * @param node The root node to visit tree. + */ + visit(node: Node): void; + } + export namespace RegExpVisitor { + interface Handlers { + onAlternativeEnter?: (node: Alternative) => void; + onAlternativeLeave?: (node: Alternative) => void; + onAssertionEnter?: (node: Assertion) => void; + onAssertionLeave?: (node: Assertion) => void; + onBackreferenceEnter?: (node: Backreference) => void; + onBackreferenceLeave?: (node: Backreference) => void; + onCapturingGroupEnter?: (node: CapturingGroup) => void; + onCapturingGroupLeave?: (node: CapturingGroup) => void; + onCharacterEnter?: (node: Character) => void; + onCharacterLeave?: (node: Character) => void; + onCharacterClassEnter?: (node: CharacterClass) => void; + onCharacterClassLeave?: (node: CharacterClass) => void; + onCharacterClassRangeEnter?: (node: CharacterClassRange) => void; + onCharacterClassRangeLeave?: (node: CharacterClassRange) => void; + onCharacterSetEnter?: (node: CharacterSet) => void; + onCharacterSetLeave?: (node: CharacterSet) => void; + onClassIntersectionEnter?: (node: ClassIntersection) => void; + onClassIntersectionLeave?: (node: ClassIntersection) => void; + onClassStringDisjunctionEnter?: (node: ClassStringDisjunction) => void; + onClassStringDisjunctionLeave?: (node: ClassStringDisjunction) => void; + onClassSubtractionEnter?: (node: ClassSubtraction) => void; + onClassSubtractionLeave?: (node: ClassSubtraction) => void; + onExpressionCharacterClassEnter?: ( + node: ExpressionCharacterClass + ) => void; + onExpressionCharacterClassLeave?: ( + node: ExpressionCharacterClass + ) => void; + onFlagsEnter?: (node: Flags) => void; + onFlagsLeave?: (node: Flags) => void; + onGroupEnter?: (node: Group) => void; + onGroupLeave?: (node: Group) => void; + onModifierFlagsEnter?: (node: ModifierFlags) => void; + onModifierFlagsLeave?: (node: ModifierFlags) => void; + onModifiersEnter?: (node: Modifiers) => void; + onModifiersLeave?: (node: Modifiers) => void; + onPatternEnter?: (node: Pattern) => void; + onPatternLeave?: (node: Pattern) => void; + onQuantifierEnter?: (node: Quantifier) => void; + onQuantifierLeave?: (node: Quantifier) => void; + onRegExpLiteralEnter?: (node: RegExpLiteral) => void; + onRegExpLiteralLeave?: (node: RegExpLiteral) => void; + onStringAlternativeEnter?: (node: StringAlternative) => void; + onStringAlternativeLeave?: (node: StringAlternative) => void; + } + } +} + +declare module "@eslint-community/regexpp/regexp-syntax-error" { + import type { RegExpValidatorSourceContext } from "@eslint-community/regexpp/validator"; + export class RegExpSyntaxError extends SyntaxError { + index: number; + constructor(message: string, index: number); + } + export function newRegExpSyntaxError( + srcCtx: RegExpValidatorSourceContext, + flags: { + unicode: boolean; + unicodeSets: boolean; + }, + index: number, + message: string + ): RegExpSyntaxError; +} + +declare module "@eslint-community/regexpp/ecma-versions" { + export type EcmaVersion = + | 5 + | 2015 + | 2016 + | 2017 + | 2018 + | 2019 + | 2020 + | 2021 + | 2022 + | 2023 + | 2024 + | 2025; + export const latestEcmaVersion = 2025; +} diff --git a/node_modules/@eslint-community/regexpp/index.js b/node_modules/@eslint-community/regexpp/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d9b9026d298fd4f025fb4f264ac71eeb45a7a97b --- /dev/null +++ b/node_modules/@eslint-community/regexpp/index.js @@ -0,0 +1,3042 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var ast = /*#__PURE__*/Object.freeze({ + __proto__: null +}); + +const latestEcmaVersion = 2025; + +let largeIdStartRanges = undefined; +let largeIdContinueRanges = undefined; +function isIdStart(cp) { + if (cp < 0x41) + return false; + if (cp < 0x5b) + return true; + if (cp < 0x61) + return false; + if (cp < 0x7b) + return true; + return isLargeIdStart(cp); +} +function isIdContinue(cp) { + if (cp < 0x30) + return false; + if (cp < 0x3a) + return true; + if (cp < 0x41) + return false; + if (cp < 0x5b) + return true; + if (cp === 0x5f) + return true; + if (cp < 0x61) + return false; + if (cp < 0x7b) + return true; + return isLargeIdStart(cp) || isLargeIdContinue(cp); +} +function isLargeIdStart(cp) { + return isInRange(cp, largeIdStartRanges !== null && largeIdStartRanges !== void 0 ? largeIdStartRanges : (largeIdStartRanges = initLargeIdStartRanges())); +} +function isLargeIdContinue(cp) { + return isInRange(cp, largeIdContinueRanges !== null && largeIdContinueRanges !== void 0 ? largeIdContinueRanges : (largeIdContinueRanges = initLargeIdContinueRanges())); +} +function initLargeIdStartRanges() { + return restoreRanges("4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 2 0 7 0 2 2 2 0 2 j 2 2a 2 3u 9 4l 2 11 3 0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 2 6 2 6 2 6 2 6 fb 2 q 8 8 4 3 4 5 2d 5 4 2 2h 2 3 6 16 2 2l i v 1d f e9 533 1t h3g 1w 19 3 7g 4 f b 1 l 1a h u 3 27 14 8 3 2u 3 29 l g 2 2 2 3 2 m u 1f f 1d 1r 5 4 0 2 1 c r b m q s 8 1a t 0 h 4 2 9 b 4 2 14 o 2 2 7 l m 4 0 4 1d 2 0 4 1 3 4 3 0 2 0 p 2 3 a 8 2 d 5 3 5 3 5 a 6 2 6 2 16 2 d 7 36 u 8mb d m 5 1c 6it a5 3 2x 13 6 d 4 6 0 2 9 2 c 2 4 2 0 2 1 2 1 2 2z y a2 j 1r 3 1h 15 b 39 4 2 3q 11 p 7 p c 2g 4 5 3 5 3 5 3 2 10 b 2 p 2 i 2 1 2 e 3 d z 3e 1y 1g 7g s 4 1c 1c v e t 6 11 b t 3 z 5 7 2 4 17 4d j z 5 z 5 13 9 1f d a 2 e 2 6 2 1 2 a 2 e 2 6 2 1 4 1f d 8m a l b 7 p 5 2 15 2 8 1y 5 3 0 2 17 2 1 4 0 3 m b m a u 1u i 2 1 b l b p 7 p 13 1j 7 1 1t 0 g 3 2 2 2 s 17 s 4 s 10 7 2 r s 1h b l b i e h 33 20 1k 1e e 1e e z 13 r a m 6z 15 7 1 h 5 1l s b 0 9 l 17 h 1b k s m d 1g 1m 1 3 0 e 18 x o r z u 0 3 0 9 y 4 0 d 1b f 3 m 0 2 0 10 h 2 o k 1 1s 6 2 0 2 3 2 e 2 9 8 1a 13 7 3 1 3 l 2 6 2 1 2 4 4 0 j 0 d 4 v 9 2 0 3 0 2 11 2 0 q 0 2 0 19 1g j 3 l 2 v 1b l 1 2 0 55 1a 16 3 11 1b l 0 1o 16 e 0 20 q 12 6 56 17 39 1r w 7 3 0 3 7 2 1 2 n g 0 2 0 2n 7 3 12 h 0 2 0 t 0 b 13 8 0 m 0 c 19 k 0 j 20 5k w w 8 2 10 i 0 1e t 35 6 2 1 2 11 m 0 q 5 2 1 2 v f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6 4 4 e a 44m 0 7 e 8uh r 1t3 9 2f 9 13 4 1o 6 q 9 ev 9 d2 0 2 1i 8 3 2a 0 c 1 f58 1 382 9 ef 19 3 m f3 4 4 5 9 7 3 6 v 3 45 2 13e 1d e9 1i 5 1d 9 0 f 0 n 4 2 e 11t 6 2 g 3 6 2 1 2 4 2t 0 4h 6 a 9 9x 0 1q d dv d 6t 1 2 9 6h 0 3 0 8 1 6 0 d7 6 32 6 6 9 3o7 9 gvt3 6n"); +} +function isInRange(cp, ranges) { + let l = 0, r = (ranges.length / 2) | 0, i = 0, min = 0, max = 0; + while (l < r) { + i = ((l + r) / 2) | 0; + min = ranges[2 * i]; + max = ranges[2 * i + 1]; + if (cp < min) { + r = i; + } + else if (cp > max) { + l = i + 1; + } + else { + return true; + } + } + return false; +} +function restoreRanges(data) { + let last = 0; + return data.split(" ").map((s) => (last += parseInt(s, 36) | 0)); +} + +class DataSet { + constructor(raw2018, raw2019, raw2020, raw2021, raw2022, raw2023, raw2024, raw2025, raw2026) { + this._raw2018 = raw2018; + this._raw2019 = raw2019; + this._raw2020 = raw2020; + this._raw2021 = raw2021; + this._raw2022 = raw2022; + this._raw2023 = raw2023; + this._raw2024 = raw2024; + this._raw2025 = raw2025; + this._raw2026 = raw2026; + } + get es2018() { + var _a; + return ((_a = this._set2018) !== null && _a !== void 0 ? _a : (this._set2018 = new Set(this._raw2018.split(" ")))); + } + get es2019() { + var _a; + return ((_a = this._set2019) !== null && _a !== void 0 ? _a : (this._set2019 = new Set(this._raw2019.split(" ")))); + } + get es2020() { + var _a; + return ((_a = this._set2020) !== null && _a !== void 0 ? _a : (this._set2020 = new Set(this._raw2020.split(" ")))); + } + get es2021() { + var _a; + return ((_a = this._set2021) !== null && _a !== void 0 ? _a : (this._set2021 = new Set(this._raw2021.split(" ")))); + } + get es2022() { + var _a; + return ((_a = this._set2022) !== null && _a !== void 0 ? _a : (this._set2022 = new Set(this._raw2022.split(" ")))); + } + get es2023() { + var _a; + return ((_a = this._set2023) !== null && _a !== void 0 ? _a : (this._set2023 = new Set(this._raw2023.split(" ")))); + } + get es2024() { + var _a; + return ((_a = this._set2024) !== null && _a !== void 0 ? _a : (this._set2024 = new Set(this._raw2024.split(" ")))); + } + get es2025() { + var _a; + return ((_a = this._set2025) !== null && _a !== void 0 ? _a : (this._set2025 = new Set(this._raw2025.split(" ")))); + } + get es2026() { + var _a; + return ((_a = this._set2026) !== null && _a !== void 0 ? _a : (this._set2026 = new Set(this._raw2026.split(" ")))); + } +} +const gcNameSet = new Set(["General_Category", "gc"]); +const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"]); +const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", "", "", "", "", "", ""); +const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", "", "", ""); +const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict", "", "", "", "", ""); +const binPropertyOfStringsSets = new DataSet("", "", "", "", "", "", "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence", "", ""); +function isValidUnicodeProperty(version, name, value) { + if (gcNameSet.has(name)) { + return version >= 2018 && gcValueSets.es2018.has(value); + } + if (scNameSet.has(name)) { + return ((version >= 2018 && scValueSets.es2018.has(value)) || + (version >= 2019 && scValueSets.es2019.has(value)) || + (version >= 2020 && scValueSets.es2020.has(value)) || + (version >= 2021 && scValueSets.es2021.has(value)) || + (version >= 2022 && scValueSets.es2022.has(value)) || + (version >= 2023 && scValueSets.es2023.has(value))); + } + return false; +} +function isValidLoneUnicodeProperty(version, value) { + return ((version >= 2018 && binPropertySets.es2018.has(value)) || + (version >= 2019 && binPropertySets.es2019.has(value)) || + (version >= 2021 && binPropertySets.es2021.has(value))); +} +function isValidLoneUnicodePropertyOfString(version, value) { + return version >= 2024 && binPropertyOfStringsSets.es2024.has(value); +} + +const BACKSPACE = 0x08; +const CHARACTER_TABULATION = 0x09; +const LINE_FEED = 0x0a; +const LINE_TABULATION = 0x0b; +const FORM_FEED = 0x0c; +const CARRIAGE_RETURN = 0x0d; +const EXCLAMATION_MARK = 0x21; +const NUMBER_SIGN = 0x23; +const DOLLAR_SIGN = 0x24; +const PERCENT_SIGN = 0x25; +const AMPERSAND = 0x26; +const LEFT_PARENTHESIS = 0x28; +const RIGHT_PARENTHESIS = 0x29; +const ASTERISK = 0x2a; +const PLUS_SIGN = 0x2b; +const COMMA = 0x2c; +const HYPHEN_MINUS = 0x2d; +const FULL_STOP = 0x2e; +const SOLIDUS = 0x2f; +const DIGIT_ZERO = 0x30; +const DIGIT_ONE = 0x31; +const DIGIT_SEVEN = 0x37; +const DIGIT_NINE = 0x39; +const COLON = 0x3a; +const SEMICOLON = 0x3b; +const LESS_THAN_SIGN = 0x3c; +const EQUALS_SIGN = 0x3d; +const GREATER_THAN_SIGN = 0x3e; +const QUESTION_MARK = 0x3f; +const COMMERCIAL_AT = 0x40; +const LATIN_CAPITAL_LETTER_A = 0x41; +const LATIN_CAPITAL_LETTER_B = 0x42; +const LATIN_CAPITAL_LETTER_D = 0x44; +const LATIN_CAPITAL_LETTER_F = 0x46; +const LATIN_CAPITAL_LETTER_P = 0x50; +const LATIN_CAPITAL_LETTER_S = 0x53; +const LATIN_CAPITAL_LETTER_W = 0x57; +const LATIN_CAPITAL_LETTER_Z = 0x5a; +const LOW_LINE = 0x5f; +const LATIN_SMALL_LETTER_A = 0x61; +const LATIN_SMALL_LETTER_B = 0x62; +const LATIN_SMALL_LETTER_C = 0x63; +const LATIN_SMALL_LETTER_D = 0x64; +const LATIN_SMALL_LETTER_F = 0x66; +const LATIN_SMALL_LETTER_G = 0x67; +const LATIN_SMALL_LETTER_I = 0x69; +const LATIN_SMALL_LETTER_K = 0x6b; +const LATIN_SMALL_LETTER_M = 0x6d; +const LATIN_SMALL_LETTER_N = 0x6e; +const LATIN_SMALL_LETTER_P = 0x70; +const LATIN_SMALL_LETTER_Q = 0x71; +const LATIN_SMALL_LETTER_R = 0x72; +const LATIN_SMALL_LETTER_S = 0x73; +const LATIN_SMALL_LETTER_T = 0x74; +const LATIN_SMALL_LETTER_U = 0x75; +const LATIN_SMALL_LETTER_V = 0x76; +const LATIN_SMALL_LETTER_W = 0x77; +const LATIN_SMALL_LETTER_X = 0x78; +const LATIN_SMALL_LETTER_Y = 0x79; +const LATIN_SMALL_LETTER_Z = 0x7a; +const LEFT_SQUARE_BRACKET = 0x5b; +const REVERSE_SOLIDUS = 0x5c; +const RIGHT_SQUARE_BRACKET = 0x5d; +const CIRCUMFLEX_ACCENT = 0x5e; +const GRAVE_ACCENT = 0x60; +const LEFT_CURLY_BRACKET = 0x7b; +const VERTICAL_LINE = 0x7c; +const RIGHT_CURLY_BRACKET = 0x7d; +const TILDE = 0x7e; +const ZERO_WIDTH_NON_JOINER = 0x200c; +const ZERO_WIDTH_JOINER = 0x200d; +const LINE_SEPARATOR = 0x2028; +const PARAGRAPH_SEPARATOR = 0x2029; +const MIN_CODE_POINT = 0x00; +const MAX_CODE_POINT = 0x10ffff; +function isLatinLetter(code) { + return ((code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_Z) || + (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_Z)); +} +function isDecimalDigit(code) { + return code >= DIGIT_ZERO && code <= DIGIT_NINE; +} +function isOctalDigit(code) { + return code >= DIGIT_ZERO && code <= DIGIT_SEVEN; +} +function isHexDigit(code) { + return ((code >= DIGIT_ZERO && code <= DIGIT_NINE) || + (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) || + (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F)); +} +function isLineTerminator(code) { + return (code === LINE_FEED || + code === CARRIAGE_RETURN || + code === LINE_SEPARATOR || + code === PARAGRAPH_SEPARATOR); +} +function isValidUnicode(code) { + return code >= MIN_CODE_POINT && code <= MAX_CODE_POINT; +} +function digitToInt(code) { + if (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F) { + return code - LATIN_SMALL_LETTER_A + 10; + } + if (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) { + return code - LATIN_CAPITAL_LETTER_A + 10; + } + return code - DIGIT_ZERO; +} +function isLeadSurrogate(code) { + return code >= 0xd800 && code <= 0xdbff; +} +function isTrailSurrogate(code) { + return code >= 0xdc00 && code <= 0xdfff; +} +function combineSurrogatePair(lead, trail) { + return (lead - 0xd800) * 0x400 + (trail - 0xdc00) + 0x10000; +} + +class GroupSpecifiersAsES2018 { + constructor() { + this.groupName = new Set(); + } + clear() { + this.groupName.clear(); + } + isEmpty() { + return !this.groupName.size; + } + hasInPattern(name) { + return this.groupName.has(name); + } + hasInScope(name) { + return this.hasInPattern(name); + } + addToScope(name) { + this.groupName.add(name); + } + enterDisjunction() { + } + enterAlternative() { + } + leaveDisjunction() { + } +} +class BranchID { + constructor(parent, base) { + this.parent = parent; + this.base = base !== null && base !== void 0 ? base : this; + } + separatedFrom(other) { + var _a, _b; + if (this.base === other.base && this !== other) { + return true; + } + if (other.parent && this.separatedFrom(other.parent)) { + return true; + } + return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.separatedFrom(other)) !== null && _b !== void 0 ? _b : false; + } + child() { + return new BranchID(this, null); + } + sibling() { + return new BranchID(this.parent, this.base); + } +} +class GroupSpecifiersAsES2025 { + constructor() { + this.branchID = new BranchID(null, null); + this.groupNames = new Map(); + } + clear() { + this.branchID = new BranchID(null, null); + this.groupNames.clear(); + } + isEmpty() { + return !this.groupNames.size; + } + enterDisjunction() { + this.branchID = this.branchID.child(); + } + enterAlternative(index) { + if (index === 0) { + return; + } + this.branchID = this.branchID.sibling(); + } + leaveDisjunction() { + this.branchID = this.branchID.parent; + } + hasInPattern(name) { + return this.groupNames.has(name); + } + hasInScope(name) { + const branches = this.groupNames.get(name); + if (!branches) { + return false; + } + for (const branch of branches) { + if (!branch.separatedFrom(this.branchID)) { + return true; + } + } + return false; + } + addToScope(name) { + const branches = this.groupNames.get(name); + if (branches) { + branches.push(this.branchID); + return; + } + this.groupNames.set(name, [this.branchID]); + } +} + +const legacyImpl = { + at(s, end, i) { + return i < end ? s.charCodeAt(i) : -1; + }, + width(c) { + return 1; + }, +}; +const unicodeImpl = { + at(s, end, i) { + return i < end ? s.codePointAt(i) : -1; + }, + width(c) { + return c > 0xffff ? 2 : 1; + }, +}; +class Reader { + constructor() { + this._impl = legacyImpl; + this._s = ""; + this._i = 0; + this._end = 0; + this._cp1 = -1; + this._w1 = 1; + this._cp2 = -1; + this._w2 = 1; + this._cp3 = -1; + this._w3 = 1; + this._cp4 = -1; + } + get source() { + return this._s; + } + get index() { + return this._i; + } + get currentCodePoint() { + return this._cp1; + } + get nextCodePoint() { + return this._cp2; + } + get nextCodePoint2() { + return this._cp3; + } + get nextCodePoint3() { + return this._cp4; + } + reset(source, start, end, uFlag) { + this._impl = uFlag ? unicodeImpl : legacyImpl; + this._s = source; + this._end = end; + this.rewind(start); + } + rewind(index) { + const impl = this._impl; + this._i = index; + this._cp1 = impl.at(this._s, this._end, index); + this._w1 = impl.width(this._cp1); + this._cp2 = impl.at(this._s, this._end, index + this._w1); + this._w2 = impl.width(this._cp2); + this._cp3 = impl.at(this._s, this._end, index + this._w1 + this._w2); + this._w3 = impl.width(this._cp3); + this._cp4 = impl.at(this._s, this._end, index + this._w1 + this._w2 + this._w3); + } + advance() { + if (this._cp1 !== -1) { + const impl = this._impl; + this._i += this._w1; + this._cp1 = this._cp2; + this._w1 = this._w2; + this._cp2 = this._cp3; + this._w2 = impl.width(this._cp2); + this._cp3 = this._cp4; + this._w3 = impl.width(this._cp3); + this._cp4 = impl.at(this._s, this._end, this._i + this._w1 + this._w2 + this._w3); + } + } + eat(cp) { + if (this._cp1 === cp) { + this.advance(); + return true; + } + return false; + } + eat2(cp1, cp2) { + if (this._cp1 === cp1 && this._cp2 === cp2) { + this.advance(); + this.advance(); + return true; + } + return false; + } + eat3(cp1, cp2, cp3) { + if (this._cp1 === cp1 && this._cp2 === cp2 && this._cp3 === cp3) { + this.advance(); + this.advance(); + this.advance(); + return true; + } + return false; + } +} + +class RegExpSyntaxError extends SyntaxError { + constructor(message, index) { + super(message); + this.index = index; + } +} +function newRegExpSyntaxError(srcCtx, flags, index, message) { + let source = ""; + if (srcCtx.kind === "literal") { + const literal = srcCtx.source.slice(srcCtx.start, srcCtx.end); + if (literal) { + source = `: ${literal}`; + } + } + else if (srcCtx.kind === "pattern") { + const pattern = srcCtx.source.slice(srcCtx.start, srcCtx.end); + const flagsText = `${flags.unicode ? "u" : ""}${flags.unicodeSets ? "v" : ""}`; + source = `: /${pattern}/${flagsText}`; + } + return new RegExpSyntaxError(`Invalid regular expression${source}: ${message}`, index); +} + +const SYNTAX_CHARACTER = new Set([ + CIRCUMFLEX_ACCENT, + DOLLAR_SIGN, + REVERSE_SOLIDUS, + FULL_STOP, + ASTERISK, + PLUS_SIGN, + QUESTION_MARK, + LEFT_PARENTHESIS, + RIGHT_PARENTHESIS, + LEFT_SQUARE_BRACKET, + RIGHT_SQUARE_BRACKET, + LEFT_CURLY_BRACKET, + RIGHT_CURLY_BRACKET, + VERTICAL_LINE, +]); +const CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR_CHARACTER = new Set([ + AMPERSAND, + EXCLAMATION_MARK, + NUMBER_SIGN, + DOLLAR_SIGN, + PERCENT_SIGN, + ASTERISK, + PLUS_SIGN, + COMMA, + FULL_STOP, + COLON, + SEMICOLON, + LESS_THAN_SIGN, + EQUALS_SIGN, + GREATER_THAN_SIGN, + QUESTION_MARK, + COMMERCIAL_AT, + CIRCUMFLEX_ACCENT, + GRAVE_ACCENT, + TILDE, +]); +const CLASS_SET_SYNTAX_CHARACTER = new Set([ + LEFT_PARENTHESIS, + RIGHT_PARENTHESIS, + LEFT_SQUARE_BRACKET, + RIGHT_SQUARE_BRACKET, + LEFT_CURLY_BRACKET, + RIGHT_CURLY_BRACKET, + SOLIDUS, + HYPHEN_MINUS, + REVERSE_SOLIDUS, + VERTICAL_LINE, +]); +const CLASS_SET_RESERVED_PUNCTUATOR = new Set([ + AMPERSAND, + HYPHEN_MINUS, + EXCLAMATION_MARK, + NUMBER_SIGN, + PERCENT_SIGN, + COMMA, + COLON, + SEMICOLON, + LESS_THAN_SIGN, + EQUALS_SIGN, + GREATER_THAN_SIGN, + COMMERCIAL_AT, + GRAVE_ACCENT, + TILDE, +]); +const FLAG_PROP_TO_CODEPOINT = { + global: LATIN_SMALL_LETTER_G, + ignoreCase: LATIN_SMALL_LETTER_I, + multiline: LATIN_SMALL_LETTER_M, + unicode: LATIN_SMALL_LETTER_U, + sticky: LATIN_SMALL_LETTER_Y, + dotAll: LATIN_SMALL_LETTER_S, + hasIndices: LATIN_SMALL_LETTER_D, + unicodeSets: LATIN_SMALL_LETTER_V, +}; +const FLAG_CODEPOINT_TO_PROP = Object.fromEntries(Object.entries(FLAG_PROP_TO_CODEPOINT).map(([k, v]) => [v, k])); +function isSyntaxCharacter(cp) { + return SYNTAX_CHARACTER.has(cp); +} +function isClassSetReservedDoublePunctuatorCharacter(cp) { + return CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR_CHARACTER.has(cp); +} +function isClassSetSyntaxCharacter(cp) { + return CLASS_SET_SYNTAX_CHARACTER.has(cp); +} +function isClassSetReservedPunctuator(cp) { + return CLASS_SET_RESERVED_PUNCTUATOR.has(cp); +} +function isIdentifierStartChar(cp) { + return isIdStart(cp) || cp === DOLLAR_SIGN || cp === LOW_LINE; +} +function isIdentifierPartChar(cp) { + return (isIdContinue(cp) || + cp === DOLLAR_SIGN || + cp === ZERO_WIDTH_NON_JOINER || + cp === ZERO_WIDTH_JOINER); +} +function isUnicodePropertyNameCharacter(cp) { + return isLatinLetter(cp) || cp === LOW_LINE; +} +function isUnicodePropertyValueCharacter(cp) { + return isUnicodePropertyNameCharacter(cp) || isDecimalDigit(cp); +} +function isRegularExpressionModifier(ch) { + return (ch === LATIN_SMALL_LETTER_I || + ch === LATIN_SMALL_LETTER_M || + ch === LATIN_SMALL_LETTER_S); +} +class RegExpValidator { + constructor(options) { + this._reader = new Reader(); + this._unicodeMode = false; + this._unicodeSetsMode = false; + this._nFlag = false; + this._lastIntValue = 0; + this._lastRange = { + min: 0, + max: Number.POSITIVE_INFINITY, + }; + this._lastStrValue = ""; + this._lastAssertionIsQuantifiable = false; + this._numCapturingParens = 0; + this._backreferenceNames = new Set(); + this._srcCtx = null; + this._options = options !== null && options !== void 0 ? options : {}; + this._groupSpecifiers = + this.ecmaVersion >= 2025 + ? new GroupSpecifiersAsES2025() + : new GroupSpecifiersAsES2018(); + } + validateLiteral(source, start = 0, end = source.length) { + this._srcCtx = { source, start, end, kind: "literal" }; + this._unicodeSetsMode = this._unicodeMode = this._nFlag = false; + this.reset(source, start, end); + this.onLiteralEnter(start); + if (this.eat(SOLIDUS) && this.eatRegExpBody() && this.eat(SOLIDUS)) { + const flagStart = this.index; + const unicode = source.includes("u", flagStart); + const unicodeSets = source.includes("v", flagStart); + this.validateFlagsInternal(source, flagStart, end); + this.validatePatternInternal(source, start + 1, flagStart - 1, { + unicode, + unicodeSets, + }); + } + else if (start >= end) { + this.raise("Empty"); + } + else { + const c = String.fromCodePoint(this.currentCodePoint); + this.raise(`Unexpected character '${c}'`); + } + this.onLiteralLeave(start, end); + } + validateFlags(source, start = 0, end = source.length) { + this._srcCtx = { source, start, end, kind: "flags" }; + this.validateFlagsInternal(source, start, end); + } + validatePattern(source, start = 0, end = source.length, uFlagOrFlags = undefined) { + this._srcCtx = { source, start, end, kind: "pattern" }; + this.validatePatternInternal(source, start, end, uFlagOrFlags); + } + validatePatternInternal(source, start = 0, end = source.length, uFlagOrFlags = undefined) { + const mode = this._parseFlagsOptionToMode(uFlagOrFlags, end); + this._unicodeMode = mode.unicodeMode; + this._nFlag = mode.nFlag; + this._unicodeSetsMode = mode.unicodeSetsMode; + this.reset(source, start, end); + this.consumePattern(); + if (!this._nFlag && + this.ecmaVersion >= 2018 && + !this._groupSpecifiers.isEmpty()) { + this._nFlag = true; + this.rewind(start); + this.consumePattern(); + } + } + validateFlagsInternal(source, start, end) { + const flags = this.parseFlags(source, start, end); + this.onRegExpFlags(start, end, flags); + } + _parseFlagsOptionToMode(uFlagOrFlags, sourceEnd) { + let unicode = false; + let unicodeSets = false; + if (uFlagOrFlags && this.ecmaVersion >= 2015) { + if (typeof uFlagOrFlags === "object") { + unicode = Boolean(uFlagOrFlags.unicode); + if (this.ecmaVersion >= 2024) { + unicodeSets = Boolean(uFlagOrFlags.unicodeSets); + } + } + else { + unicode = uFlagOrFlags; + } + } + if (unicode && unicodeSets) { + this.raise("Invalid regular expression flags", { + index: sourceEnd + 1, + unicode, + unicodeSets, + }); + } + const unicodeMode = unicode || unicodeSets; + const nFlag = (unicode && this.ecmaVersion >= 2018) || + unicodeSets || + Boolean(this._options.strict && this.ecmaVersion >= 2023); + const unicodeSetsMode = unicodeSets; + return { unicodeMode, nFlag, unicodeSetsMode }; + } + get strict() { + return Boolean(this._options.strict) || this._unicodeMode; + } + get ecmaVersion() { + var _a; + return (_a = this._options.ecmaVersion) !== null && _a !== void 0 ? _a : latestEcmaVersion; + } + onLiteralEnter(start) { + if (this._options.onLiteralEnter) { + this._options.onLiteralEnter(start); + } + } + onLiteralLeave(start, end) { + if (this._options.onLiteralLeave) { + this._options.onLiteralLeave(start, end); + } + } + onRegExpFlags(start, end, flags) { + if (this._options.onRegExpFlags) { + this._options.onRegExpFlags(start, end, flags); + } + if (this._options.onFlags) { + this._options.onFlags(start, end, flags.global, flags.ignoreCase, flags.multiline, flags.unicode, flags.sticky, flags.dotAll, flags.hasIndices); + } + } + onPatternEnter(start) { + if (this._options.onPatternEnter) { + this._options.onPatternEnter(start); + } + } + onPatternLeave(start, end) { + if (this._options.onPatternLeave) { + this._options.onPatternLeave(start, end); + } + } + onDisjunctionEnter(start) { + if (this._options.onDisjunctionEnter) { + this._options.onDisjunctionEnter(start); + } + } + onDisjunctionLeave(start, end) { + if (this._options.onDisjunctionLeave) { + this._options.onDisjunctionLeave(start, end); + } + } + onAlternativeEnter(start, index) { + if (this._options.onAlternativeEnter) { + this._options.onAlternativeEnter(start, index); + } + } + onAlternativeLeave(start, end, index) { + if (this._options.onAlternativeLeave) { + this._options.onAlternativeLeave(start, end, index); + } + } + onGroupEnter(start) { + if (this._options.onGroupEnter) { + this._options.onGroupEnter(start); + } + } + onGroupLeave(start, end) { + if (this._options.onGroupLeave) { + this._options.onGroupLeave(start, end); + } + } + onModifiersEnter(start) { + if (this._options.onModifiersEnter) { + this._options.onModifiersEnter(start); + } + } + onModifiersLeave(start, end) { + if (this._options.onModifiersLeave) { + this._options.onModifiersLeave(start, end); + } + } + onAddModifiers(start, end, flags) { + if (this._options.onAddModifiers) { + this._options.onAddModifiers(start, end, flags); + } + } + onRemoveModifiers(start, end, flags) { + if (this._options.onRemoveModifiers) { + this._options.onRemoveModifiers(start, end, flags); + } + } + onCapturingGroupEnter(start, name) { + if (this._options.onCapturingGroupEnter) { + this._options.onCapturingGroupEnter(start, name); + } + } + onCapturingGroupLeave(start, end, name) { + if (this._options.onCapturingGroupLeave) { + this._options.onCapturingGroupLeave(start, end, name); + } + } + onQuantifier(start, end, min, max, greedy) { + if (this._options.onQuantifier) { + this._options.onQuantifier(start, end, min, max, greedy); + } + } + onLookaroundAssertionEnter(start, kind, negate) { + if (this._options.onLookaroundAssertionEnter) { + this._options.onLookaroundAssertionEnter(start, kind, negate); + } + } + onLookaroundAssertionLeave(start, end, kind, negate) { + if (this._options.onLookaroundAssertionLeave) { + this._options.onLookaroundAssertionLeave(start, end, kind, negate); + } + } + onEdgeAssertion(start, end, kind) { + if (this._options.onEdgeAssertion) { + this._options.onEdgeAssertion(start, end, kind); + } + } + onWordBoundaryAssertion(start, end, kind, negate) { + if (this._options.onWordBoundaryAssertion) { + this._options.onWordBoundaryAssertion(start, end, kind, negate); + } + } + onAnyCharacterSet(start, end, kind) { + if (this._options.onAnyCharacterSet) { + this._options.onAnyCharacterSet(start, end, kind); + } + } + onEscapeCharacterSet(start, end, kind, negate) { + if (this._options.onEscapeCharacterSet) { + this._options.onEscapeCharacterSet(start, end, kind, negate); + } + } + onUnicodePropertyCharacterSet(start, end, kind, key, value, negate, strings) { + if (this._options.onUnicodePropertyCharacterSet) { + this._options.onUnicodePropertyCharacterSet(start, end, kind, key, value, negate, strings); + } + } + onCharacter(start, end, value) { + if (this._options.onCharacter) { + this._options.onCharacter(start, end, value); + } + } + onBackreference(start, end, ref) { + if (this._options.onBackreference) { + this._options.onBackreference(start, end, ref); + } + } + onCharacterClassEnter(start, negate, unicodeSets) { + if (this._options.onCharacterClassEnter) { + this._options.onCharacterClassEnter(start, negate, unicodeSets); + } + } + onCharacterClassLeave(start, end, negate) { + if (this._options.onCharacterClassLeave) { + this._options.onCharacterClassLeave(start, end, negate); + } + } + onCharacterClassRange(start, end, min, max) { + if (this._options.onCharacterClassRange) { + this._options.onCharacterClassRange(start, end, min, max); + } + } + onClassIntersection(start, end) { + if (this._options.onClassIntersection) { + this._options.onClassIntersection(start, end); + } + } + onClassSubtraction(start, end) { + if (this._options.onClassSubtraction) { + this._options.onClassSubtraction(start, end); + } + } + onClassStringDisjunctionEnter(start) { + if (this._options.onClassStringDisjunctionEnter) { + this._options.onClassStringDisjunctionEnter(start); + } + } + onClassStringDisjunctionLeave(start, end) { + if (this._options.onClassStringDisjunctionLeave) { + this._options.onClassStringDisjunctionLeave(start, end); + } + } + onStringAlternativeEnter(start, index) { + if (this._options.onStringAlternativeEnter) { + this._options.onStringAlternativeEnter(start, index); + } + } + onStringAlternativeLeave(start, end, index) { + if (this._options.onStringAlternativeLeave) { + this._options.onStringAlternativeLeave(start, end, index); + } + } + get index() { + return this._reader.index; + } + get currentCodePoint() { + return this._reader.currentCodePoint; + } + get nextCodePoint() { + return this._reader.nextCodePoint; + } + get nextCodePoint2() { + return this._reader.nextCodePoint2; + } + get nextCodePoint3() { + return this._reader.nextCodePoint3; + } + reset(source, start, end) { + this._reader.reset(source, start, end, this._unicodeMode); + } + rewind(index) { + this._reader.rewind(index); + } + advance() { + this._reader.advance(); + } + eat(cp) { + return this._reader.eat(cp); + } + eat2(cp1, cp2) { + return this._reader.eat2(cp1, cp2); + } + eat3(cp1, cp2, cp3) { + return this._reader.eat3(cp1, cp2, cp3); + } + raise(message, context) { + var _a, _b, _c; + throw newRegExpSyntaxError(this._srcCtx, { + unicode: (_a = context === null || context === void 0 ? void 0 : context.unicode) !== null && _a !== void 0 ? _a : (this._unicodeMode && !this._unicodeSetsMode), + unicodeSets: (_b = context === null || context === void 0 ? void 0 : context.unicodeSets) !== null && _b !== void 0 ? _b : this._unicodeSetsMode, + }, (_c = context === null || context === void 0 ? void 0 : context.index) !== null && _c !== void 0 ? _c : this.index, message); + } + eatRegExpBody() { + const start = this.index; + let inClass = false; + let escaped = false; + for (;;) { + const cp = this.currentCodePoint; + if (cp === -1 || isLineTerminator(cp)) { + const kind = inClass ? "character class" : "regular expression"; + this.raise(`Unterminated ${kind}`); + } + if (escaped) { + escaped = false; + } + else if (cp === REVERSE_SOLIDUS) { + escaped = true; + } + else if (cp === LEFT_SQUARE_BRACKET) { + inClass = true; + } + else if (cp === RIGHT_SQUARE_BRACKET) { + inClass = false; + } + else if ((cp === SOLIDUS && !inClass) || + (cp === ASTERISK && this.index === start)) { + break; + } + this.advance(); + } + return this.index !== start; + } + consumePattern() { + const start = this.index; + this._numCapturingParens = this.countCapturingParens(); + this._groupSpecifiers.clear(); + this._backreferenceNames.clear(); + this.onPatternEnter(start); + this.consumeDisjunction(); + const cp = this.currentCodePoint; + if (this.currentCodePoint !== -1) { + if (cp === RIGHT_PARENTHESIS) { + this.raise("Unmatched ')'"); + } + if (cp === REVERSE_SOLIDUS) { + this.raise("\\ at end of pattern"); + } + if (cp === RIGHT_SQUARE_BRACKET || cp === RIGHT_CURLY_BRACKET) { + this.raise("Lone quantifier brackets"); + } + const c = String.fromCodePoint(cp); + this.raise(`Unexpected character '${c}'`); + } + for (const name of this._backreferenceNames) { + if (!this._groupSpecifiers.hasInPattern(name)) { + this.raise("Invalid named capture referenced"); + } + } + this.onPatternLeave(start, this.index); + } + countCapturingParens() { + const start = this.index; + let inClass = false; + let escaped = false; + let count = 0; + let cp = 0; + while ((cp = this.currentCodePoint) !== -1) { + if (escaped) { + escaped = false; + } + else if (cp === REVERSE_SOLIDUS) { + escaped = true; + } + else if (cp === LEFT_SQUARE_BRACKET) { + inClass = true; + } + else if (cp === RIGHT_SQUARE_BRACKET) { + inClass = false; + } + else if (cp === LEFT_PARENTHESIS && + !inClass && + (this.nextCodePoint !== QUESTION_MARK || + (this.nextCodePoint2 === LESS_THAN_SIGN && + this.nextCodePoint3 !== EQUALS_SIGN && + this.nextCodePoint3 !== EXCLAMATION_MARK))) { + count += 1; + } + this.advance(); + } + this.rewind(start); + return count; + } + consumeDisjunction() { + const start = this.index; + let i = 0; + this._groupSpecifiers.enterDisjunction(); + this.onDisjunctionEnter(start); + do { + this.consumeAlternative(i++); + } while (this.eat(VERTICAL_LINE)); + if (this.consumeQuantifier(true)) { + this.raise("Nothing to repeat"); + } + if (this.eat(LEFT_CURLY_BRACKET)) { + this.raise("Lone quantifier brackets"); + } + this.onDisjunctionLeave(start, this.index); + this._groupSpecifiers.leaveDisjunction(); + } + consumeAlternative(i) { + const start = this.index; + this._groupSpecifiers.enterAlternative(i); + this.onAlternativeEnter(start, i); + while (this.currentCodePoint !== -1 && this.consumeTerm()) { + } + this.onAlternativeLeave(start, this.index, i); + } + consumeTerm() { + if (this._unicodeMode || this.strict) { + return (this.consumeAssertion() || + (this.consumeAtom() && this.consumeOptionalQuantifier())); + } + return ((this.consumeAssertion() && + (!this._lastAssertionIsQuantifiable || + this.consumeOptionalQuantifier())) || + (this.consumeExtendedAtom() && this.consumeOptionalQuantifier())); + } + consumeOptionalQuantifier() { + this.consumeQuantifier(); + return true; + } + consumeAssertion() { + const start = this.index; + this._lastAssertionIsQuantifiable = false; + if (this.eat(CIRCUMFLEX_ACCENT)) { + this.onEdgeAssertion(start, this.index, "start"); + return true; + } + if (this.eat(DOLLAR_SIGN)) { + this.onEdgeAssertion(start, this.index, "end"); + return true; + } + if (this.eat2(REVERSE_SOLIDUS, LATIN_CAPITAL_LETTER_B)) { + this.onWordBoundaryAssertion(start, this.index, "word", true); + return true; + } + if (this.eat2(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_B)) { + this.onWordBoundaryAssertion(start, this.index, "word", false); + return true; + } + if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) { + const lookbehind = this.ecmaVersion >= 2018 && this.eat(LESS_THAN_SIGN); + let negate = false; + if (this.eat(EQUALS_SIGN) || + (negate = this.eat(EXCLAMATION_MARK))) { + const kind = lookbehind ? "lookbehind" : "lookahead"; + this.onLookaroundAssertionEnter(start, kind, negate); + this.consumeDisjunction(); + if (!this.eat(RIGHT_PARENTHESIS)) { + this.raise("Unterminated group"); + } + this._lastAssertionIsQuantifiable = !lookbehind && !this.strict; + this.onLookaroundAssertionLeave(start, this.index, kind, negate); + return true; + } + this.rewind(start); + } + return false; + } + consumeQuantifier(noConsume = false) { + const start = this.index; + let min = 0; + let max = 0; + let greedy = false; + if (this.eat(ASTERISK)) { + min = 0; + max = Number.POSITIVE_INFINITY; + } + else if (this.eat(PLUS_SIGN)) { + min = 1; + max = Number.POSITIVE_INFINITY; + } + else if (this.eat(QUESTION_MARK)) { + min = 0; + max = 1; + } + else if (this.eatBracedQuantifier(noConsume)) { + ({ min, max } = this._lastRange); + } + else { + return false; + } + greedy = !this.eat(QUESTION_MARK); + if (!noConsume) { + this.onQuantifier(start, this.index, min, max, greedy); + } + return true; + } + eatBracedQuantifier(noError) { + const start = this.index; + if (this.eat(LEFT_CURLY_BRACKET)) { + if (this.eatDecimalDigits()) { + const min = this._lastIntValue; + let max = min; + if (this.eat(COMMA)) { + max = this.eatDecimalDigits() + ? this._lastIntValue + : Number.POSITIVE_INFINITY; + } + if (this.eat(RIGHT_CURLY_BRACKET)) { + if (!noError && max < min) { + this.raise("numbers out of order in {} quantifier"); + } + this._lastRange = { min, max }; + return true; + } + } + if (!noError && (this._unicodeMode || this.strict)) { + this.raise("Incomplete quantifier"); + } + this.rewind(start); + } + return false; + } + consumeAtom() { + return (this.consumePatternCharacter() || + this.consumeDot() || + this.consumeReverseSolidusAtomEscape() || + Boolean(this.consumeCharacterClass()) || + this.consumeCapturingGroup() || + this.consumeUncapturingGroup()); + } + consumeDot() { + if (this.eat(FULL_STOP)) { + this.onAnyCharacterSet(this.index - 1, this.index, "any"); + return true; + } + return false; + } + consumeReverseSolidusAtomEscape() { + const start = this.index; + if (this.eat(REVERSE_SOLIDUS)) { + if (this.consumeAtomEscape()) { + return true; + } + this.rewind(start); + } + return false; + } + consumeUncapturingGroup() { + const start = this.index; + if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) { + this.onGroupEnter(start); + if (this.ecmaVersion >= 2025) { + this.consumeModifiers(); + } + if (!this.eat(COLON)) { + this.rewind(start + 1); + this.raise("Invalid group"); + } + this.consumeDisjunction(); + if (!this.eat(RIGHT_PARENTHESIS)) { + this.raise("Unterminated group"); + } + this.onGroupLeave(start, this.index); + return true; + } + return false; + } + consumeModifiers() { + const start = this.index; + const hasAddModifiers = this.eatModifiers(); + const addModifiersEnd = this.index; + const hasHyphen = this.eat(HYPHEN_MINUS); + if (!hasAddModifiers && !hasHyphen) { + return false; + } + this.onModifiersEnter(start); + const addModifiers = this.parseModifiers(start, addModifiersEnd); + this.onAddModifiers(start, addModifiersEnd, addModifiers); + if (hasHyphen) { + const modifiersStart = this.index; + if (!this.eatModifiers() && + !hasAddModifiers && + this.currentCodePoint === COLON) { + this.raise("Invalid empty flags"); + } + const modifiers = this.parseModifiers(modifiersStart, this.index); + for (const [flagName] of Object.entries(modifiers).filter(([, enable]) => enable)) { + if (addModifiers[flagName]) { + this.raise(`Duplicated flag '${String.fromCodePoint(FLAG_PROP_TO_CODEPOINT[flagName])}'`); + } + } + this.onRemoveModifiers(modifiersStart, this.index, modifiers); + } + this.onModifiersLeave(start, this.index); + return true; + } + consumeCapturingGroup() { + const start = this.index; + if (this.eat(LEFT_PARENTHESIS)) { + let name = null; + if (this.ecmaVersion >= 2018) { + if (this.consumeGroupSpecifier()) { + name = this._lastStrValue; + } + else if (this.currentCodePoint === QUESTION_MARK) { + this.rewind(start); + return false; + } + } + else if (this.currentCodePoint === QUESTION_MARK) { + this.rewind(start); + return false; + } + this.onCapturingGroupEnter(start, name); + this.consumeDisjunction(); + if (!this.eat(RIGHT_PARENTHESIS)) { + this.raise("Unterminated group"); + } + this.onCapturingGroupLeave(start, this.index, name); + return true; + } + return false; + } + consumeExtendedAtom() { + return (this.consumeDot() || + this.consumeReverseSolidusAtomEscape() || + this.consumeReverseSolidusFollowedByC() || + Boolean(this.consumeCharacterClass()) || + this.consumeCapturingGroup() || + this.consumeUncapturingGroup() || + this.consumeInvalidBracedQuantifier() || + this.consumeExtendedPatternCharacter()); + } + consumeReverseSolidusFollowedByC() { + const start = this.index; + if (this.currentCodePoint === REVERSE_SOLIDUS && + this.nextCodePoint === LATIN_SMALL_LETTER_C) { + this._lastIntValue = this.currentCodePoint; + this.advance(); + this.onCharacter(start, this.index, REVERSE_SOLIDUS); + return true; + } + return false; + } + consumeInvalidBracedQuantifier() { + if (this.eatBracedQuantifier(true)) { + this.raise("Nothing to repeat"); + } + return false; + } + consumePatternCharacter() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && !isSyntaxCharacter(cp)) { + this.advance(); + this.onCharacter(start, this.index, cp); + return true; + } + return false; + } + consumeExtendedPatternCharacter() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && + cp !== CIRCUMFLEX_ACCENT && + cp !== DOLLAR_SIGN && + cp !== REVERSE_SOLIDUS && + cp !== FULL_STOP && + cp !== ASTERISK && + cp !== PLUS_SIGN && + cp !== QUESTION_MARK && + cp !== LEFT_PARENTHESIS && + cp !== RIGHT_PARENTHESIS && + cp !== LEFT_SQUARE_BRACKET && + cp !== VERTICAL_LINE) { + this.advance(); + this.onCharacter(start, this.index, cp); + return true; + } + return false; + } + consumeGroupSpecifier() { + const start = this.index; + if (this.eat(QUESTION_MARK)) { + if (this.eatGroupName()) { + if (!this._groupSpecifiers.hasInScope(this._lastStrValue)) { + this._groupSpecifiers.addToScope(this._lastStrValue); + return true; + } + this.raise("Duplicate capture group name"); + } + this.rewind(start); + } + return false; + } + consumeAtomEscape() { + if (this.consumeBackreference() || + this.consumeCharacterClassEscape() || + this.consumeCharacterEscape() || + (this._nFlag && this.consumeKGroupName())) { + return true; + } + if (this.strict || this._unicodeMode) { + this.raise("Invalid escape"); + } + return false; + } + consumeBackreference() { + const start = this.index; + if (this.eatDecimalEscape()) { + const n = this._lastIntValue; + if (n <= this._numCapturingParens) { + this.onBackreference(start - 1, this.index, n); + return true; + } + if (this.strict || this._unicodeMode) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + consumeCharacterClassEscape() { + var _a; + const start = this.index; + if (this.eat(LATIN_SMALL_LETTER_D)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "digit", false); + return {}; + } + if (this.eat(LATIN_CAPITAL_LETTER_D)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "digit", true); + return {}; + } + if (this.eat(LATIN_SMALL_LETTER_S)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "space", false); + return {}; + } + if (this.eat(LATIN_CAPITAL_LETTER_S)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "space", true); + return {}; + } + if (this.eat(LATIN_SMALL_LETTER_W)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "word", false); + return {}; + } + if (this.eat(LATIN_CAPITAL_LETTER_W)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "word", true); + return {}; + } + let negate = false; + if (this._unicodeMode && + this.ecmaVersion >= 2018 && + (this.eat(LATIN_SMALL_LETTER_P) || + (negate = this.eat(LATIN_CAPITAL_LETTER_P)))) { + this._lastIntValue = -1; + let result = null; + if (this.eat(LEFT_CURLY_BRACKET) && + (result = this.eatUnicodePropertyValueExpression()) && + this.eat(RIGHT_CURLY_BRACKET)) { + if (negate && result.strings) { + this.raise("Invalid property name"); + } + this.onUnicodePropertyCharacterSet(start - 1, this.index, "property", result.key, result.value, negate, (_a = result.strings) !== null && _a !== void 0 ? _a : false); + return { mayContainStrings: result.strings }; + } + this.raise("Invalid property name"); + } + return null; + } + consumeCharacterEscape() { + const start = this.index; + if (this.eatControlEscape() || + this.eatCControlLetter() || + this.eatZero() || + this.eatHexEscapeSequence() || + this.eatRegExpUnicodeEscapeSequence() || + (!this.strict && + !this._unicodeMode && + this.eatLegacyOctalEscapeSequence()) || + this.eatIdentityEscape()) { + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + return false; + } + consumeKGroupName() { + const start = this.index; + if (this.eat(LATIN_SMALL_LETTER_K)) { + if (this.eatGroupName()) { + const groupName = this._lastStrValue; + this._backreferenceNames.add(groupName); + this.onBackreference(start - 1, this.index, groupName); + return true; + } + this.raise("Invalid named reference"); + } + return false; + } + consumeCharacterClass() { + const start = this.index; + if (this.eat(LEFT_SQUARE_BRACKET)) { + const negate = this.eat(CIRCUMFLEX_ACCENT); + this.onCharacterClassEnter(start, negate, this._unicodeSetsMode); + const result = this.consumeClassContents(); + if (!this.eat(RIGHT_SQUARE_BRACKET)) { + if (this.currentCodePoint === -1) { + this.raise("Unterminated character class"); + } + this.raise("Invalid character in character class"); + } + if (negate && result.mayContainStrings) { + this.raise("Negated character class may contain strings"); + } + this.onCharacterClassLeave(start, this.index, negate); + return result; + } + return null; + } + consumeClassContents() { + if (this._unicodeSetsMode) { + if (this.currentCodePoint === RIGHT_SQUARE_BRACKET) { + return {}; + } + const result = this.consumeClassSetExpression(); + return result; + } + const strict = this.strict || this._unicodeMode; + for (;;) { + const rangeStart = this.index; + if (!this.consumeClassAtom()) { + break; + } + const min = this._lastIntValue; + if (!this.eat(HYPHEN_MINUS)) { + continue; + } + this.onCharacter(this.index - 1, this.index, HYPHEN_MINUS); + if (!this.consumeClassAtom()) { + break; + } + const max = this._lastIntValue; + if (min === -1 || max === -1) { + if (strict) { + this.raise("Invalid character class"); + } + continue; + } + if (min > max) { + this.raise("Range out of order in character class"); + } + this.onCharacterClassRange(rangeStart, this.index, min, max); + } + return {}; + } + consumeClassAtom() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && + cp !== REVERSE_SOLIDUS && + cp !== RIGHT_SQUARE_BRACKET) { + this.advance(); + this._lastIntValue = cp; + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + if (this.eat(REVERSE_SOLIDUS)) { + if (this.consumeClassEscape()) { + return true; + } + if (!this.strict && + this.currentCodePoint === LATIN_SMALL_LETTER_C) { + this._lastIntValue = REVERSE_SOLIDUS; + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + if (this.strict || this._unicodeMode) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + consumeClassEscape() { + const start = this.index; + if (this.eat(LATIN_SMALL_LETTER_B)) { + this._lastIntValue = BACKSPACE; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + if (this._unicodeMode && this.eat(HYPHEN_MINUS)) { + this._lastIntValue = HYPHEN_MINUS; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + let cp = 0; + if (!this.strict && + !this._unicodeMode && + this.currentCodePoint === LATIN_SMALL_LETTER_C && + (isDecimalDigit((cp = this.nextCodePoint)) || cp === LOW_LINE)) { + this.advance(); + this.advance(); + this._lastIntValue = cp % 0x20; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + return (Boolean(this.consumeCharacterClassEscape()) || + this.consumeCharacterEscape()); + } + consumeClassSetExpression() { + const start = this.index; + let mayContainStrings = false; + let result = null; + if (this.consumeClassSetCharacter()) { + if (this.consumeClassSetRangeFromOperator(start)) { + this.consumeClassUnionRight({}); + return {}; + } + mayContainStrings = false; + } + else if ((result = this.consumeClassSetOperand())) { + mayContainStrings = result.mayContainStrings; + } + else { + const cp = this.currentCodePoint; + if (cp === REVERSE_SOLIDUS) { + this.advance(); + this.raise("Invalid escape"); + } + if (cp === this.nextCodePoint && + isClassSetReservedDoublePunctuatorCharacter(cp)) { + this.raise("Invalid set operation in character class"); + } + this.raise("Invalid character in character class"); + } + if (this.eat2(AMPERSAND, AMPERSAND)) { + while (this.currentCodePoint !== AMPERSAND && + (result = this.consumeClassSetOperand())) { + this.onClassIntersection(start, this.index); + if (!result.mayContainStrings) { + mayContainStrings = false; + } + if (this.eat2(AMPERSAND, AMPERSAND)) { + continue; + } + return { mayContainStrings }; + } + this.raise("Invalid character in character class"); + } + if (this.eat2(HYPHEN_MINUS, HYPHEN_MINUS)) { + while (this.consumeClassSetOperand()) { + this.onClassSubtraction(start, this.index); + if (this.eat2(HYPHEN_MINUS, HYPHEN_MINUS)) { + continue; + } + return { mayContainStrings }; + } + this.raise("Invalid character in character class"); + } + return this.consumeClassUnionRight({ mayContainStrings }); + } + consumeClassUnionRight(leftResult) { + let mayContainStrings = leftResult.mayContainStrings; + for (;;) { + const start = this.index; + if (this.consumeClassSetCharacter()) { + this.consumeClassSetRangeFromOperator(start); + continue; + } + const result = this.consumeClassSetOperand(); + if (result) { + if (result.mayContainStrings) { + mayContainStrings = true; + } + continue; + } + break; + } + return { mayContainStrings }; + } + consumeClassSetRangeFromOperator(start) { + const currentStart = this.index; + const min = this._lastIntValue; + if (this.eat(HYPHEN_MINUS)) { + if (this.consumeClassSetCharacter()) { + const max = this._lastIntValue; + if (min === -1 || max === -1) { + this.raise("Invalid character class"); + } + if (min > max) { + this.raise("Range out of order in character class"); + } + this.onCharacterClassRange(start, this.index, min, max); + return true; + } + this.rewind(currentStart); + } + return false; + } + consumeClassSetOperand() { + let result = null; + if ((result = this.consumeNestedClass())) { + return result; + } + if ((result = this.consumeClassStringDisjunction())) { + return result; + } + if (this.consumeClassSetCharacter()) { + return {}; + } + return null; + } + consumeNestedClass() { + const start = this.index; + if (this.eat(LEFT_SQUARE_BRACKET)) { + const negate = this.eat(CIRCUMFLEX_ACCENT); + this.onCharacterClassEnter(start, negate, true); + const result = this.consumeClassContents(); + if (!this.eat(RIGHT_SQUARE_BRACKET)) { + this.raise("Unterminated character class"); + } + if (negate && result.mayContainStrings) { + this.raise("Negated character class may contain strings"); + } + this.onCharacterClassLeave(start, this.index, negate); + return result; + } + if (this.eat(REVERSE_SOLIDUS)) { + const result = this.consumeCharacterClassEscape(); + if (result) { + return result; + } + this.rewind(start); + } + return null; + } + consumeClassStringDisjunction() { + const start = this.index; + if (this.eat3(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_Q, LEFT_CURLY_BRACKET)) { + this.onClassStringDisjunctionEnter(start); + let i = 0; + let mayContainStrings = false; + do { + if (this.consumeClassString(i++).mayContainStrings) { + mayContainStrings = true; + } + } while (this.eat(VERTICAL_LINE)); + if (this.eat(RIGHT_CURLY_BRACKET)) { + this.onClassStringDisjunctionLeave(start, this.index); + return { mayContainStrings }; + } + this.raise("Unterminated class string disjunction"); + } + return null; + } + consumeClassString(i) { + const start = this.index; + let count = 0; + this.onStringAlternativeEnter(start, i); + while (this.currentCodePoint !== -1 && + this.consumeClassSetCharacter()) { + count++; + } + this.onStringAlternativeLeave(start, this.index, i); + return { mayContainStrings: count !== 1 }; + } + consumeClassSetCharacter() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== this.nextCodePoint || + !isClassSetReservedDoublePunctuatorCharacter(cp)) { + if (cp !== -1 && !isClassSetSyntaxCharacter(cp)) { + this._lastIntValue = cp; + this.advance(); + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + } + if (this.eat(REVERSE_SOLIDUS)) { + if (this.consumeCharacterEscape()) { + return true; + } + if (isClassSetReservedPunctuator(this.currentCodePoint)) { + this._lastIntValue = this.currentCodePoint; + this.advance(); + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + if (this.eat(LATIN_SMALL_LETTER_B)) { + this._lastIntValue = BACKSPACE; + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + this.rewind(start); + } + return false; + } + eatGroupName() { + if (this.eat(LESS_THAN_SIGN)) { + if (this.eatRegExpIdentifierName() && this.eat(GREATER_THAN_SIGN)) { + return true; + } + this.raise("Invalid capture group name"); + } + return false; + } + eatRegExpIdentifierName() { + if (this.eatRegExpIdentifierStart()) { + this._lastStrValue = String.fromCodePoint(this._lastIntValue); + while (this.eatRegExpIdentifierPart()) { + this._lastStrValue += String.fromCodePoint(this._lastIntValue); + } + return true; + } + return false; + } + eatRegExpIdentifierStart() { + const start = this.index; + const forceUFlag = !this._unicodeMode && this.ecmaVersion >= 2020; + let cp = this.currentCodePoint; + this.advance(); + if (cp === REVERSE_SOLIDUS && + this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { + cp = this._lastIntValue; + } + else if (forceUFlag && + isLeadSurrogate(cp) && + isTrailSurrogate(this.currentCodePoint)) { + cp = combineSurrogatePair(cp, this.currentCodePoint); + this.advance(); + } + if (isIdentifierStartChar(cp)) { + this._lastIntValue = cp; + return true; + } + if (this.index !== start) { + this.rewind(start); + } + return false; + } + eatRegExpIdentifierPart() { + const start = this.index; + const forceUFlag = !this._unicodeMode && this.ecmaVersion >= 2020; + let cp = this.currentCodePoint; + this.advance(); + if (cp === REVERSE_SOLIDUS && + this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { + cp = this._lastIntValue; + } + else if (forceUFlag && + isLeadSurrogate(cp) && + isTrailSurrogate(this.currentCodePoint)) { + cp = combineSurrogatePair(cp, this.currentCodePoint); + this.advance(); + } + if (isIdentifierPartChar(cp)) { + this._lastIntValue = cp; + return true; + } + if (this.index !== start) { + this.rewind(start); + } + return false; + } + eatCControlLetter() { + const start = this.index; + if (this.eat(LATIN_SMALL_LETTER_C)) { + if (this.eatControlLetter()) { + return true; + } + this.rewind(start); + } + return false; + } + eatZero() { + if (this.currentCodePoint === DIGIT_ZERO && + !isDecimalDigit(this.nextCodePoint)) { + this._lastIntValue = 0; + this.advance(); + return true; + } + return false; + } + eatControlEscape() { + if (this.eat(LATIN_SMALL_LETTER_F)) { + this._lastIntValue = FORM_FEED; + return true; + } + if (this.eat(LATIN_SMALL_LETTER_N)) { + this._lastIntValue = LINE_FEED; + return true; + } + if (this.eat(LATIN_SMALL_LETTER_R)) { + this._lastIntValue = CARRIAGE_RETURN; + return true; + } + if (this.eat(LATIN_SMALL_LETTER_T)) { + this._lastIntValue = CHARACTER_TABULATION; + return true; + } + if (this.eat(LATIN_SMALL_LETTER_V)) { + this._lastIntValue = LINE_TABULATION; + return true; + } + return false; + } + eatControlLetter() { + const cp = this.currentCodePoint; + if (isLatinLetter(cp)) { + this.advance(); + this._lastIntValue = cp % 0x20; + return true; + } + return false; + } + eatRegExpUnicodeEscapeSequence(forceUFlag = false) { + const start = this.index; + const uFlag = forceUFlag || this._unicodeMode; + if (this.eat(LATIN_SMALL_LETTER_U)) { + if ((uFlag && this.eatRegExpUnicodeSurrogatePairEscape()) || + this.eatFixedHexDigits(4) || + (uFlag && this.eatRegExpUnicodeCodePointEscape())) { + return true; + } + if (this.strict || uFlag) { + this.raise("Invalid unicode escape"); + } + this.rewind(start); + } + return false; + } + eatRegExpUnicodeSurrogatePairEscape() { + const start = this.index; + if (this.eatFixedHexDigits(4)) { + const lead = this._lastIntValue; + if (isLeadSurrogate(lead) && + this.eat(REVERSE_SOLIDUS) && + this.eat(LATIN_SMALL_LETTER_U) && + this.eatFixedHexDigits(4)) { + const trail = this._lastIntValue; + if (isTrailSurrogate(trail)) { + this._lastIntValue = combineSurrogatePair(lead, trail); + return true; + } + } + this.rewind(start); + } + return false; + } + eatRegExpUnicodeCodePointEscape() { + const start = this.index; + if (this.eat(LEFT_CURLY_BRACKET) && + this.eatHexDigits() && + this.eat(RIGHT_CURLY_BRACKET) && + isValidUnicode(this._lastIntValue)) { + return true; + } + this.rewind(start); + return false; + } + eatIdentityEscape() { + const cp = this.currentCodePoint; + if (this.isValidIdentityEscape(cp)) { + this._lastIntValue = cp; + this.advance(); + return true; + } + return false; + } + isValidIdentityEscape(cp) { + if (cp === -1) { + return false; + } + if (this._unicodeMode) { + return isSyntaxCharacter(cp) || cp === SOLIDUS; + } + if (this.strict) { + return !isIdContinue(cp); + } + if (this._nFlag) { + return !(cp === LATIN_SMALL_LETTER_C || cp === LATIN_SMALL_LETTER_K); + } + return cp !== LATIN_SMALL_LETTER_C; + } + eatDecimalEscape() { + this._lastIntValue = 0; + let cp = this.currentCodePoint; + if (cp >= DIGIT_ONE && cp <= DIGIT_NINE) { + do { + this._lastIntValue = 10 * this._lastIntValue + (cp - DIGIT_ZERO); + this.advance(); + } while ((cp = this.currentCodePoint) >= DIGIT_ZERO && + cp <= DIGIT_NINE); + return true; + } + return false; + } + eatUnicodePropertyValueExpression() { + const start = this.index; + if (this.eatUnicodePropertyName() && this.eat(EQUALS_SIGN)) { + const key = this._lastStrValue; + if (this.eatUnicodePropertyValue()) { + const value = this._lastStrValue; + if (isValidUnicodeProperty(this.ecmaVersion, key, value)) { + return { + key, + value: value || null, + }; + } + this.raise("Invalid property name"); + } + } + this.rewind(start); + if (this.eatLoneUnicodePropertyNameOrValue()) { + const nameOrValue = this._lastStrValue; + if (isValidUnicodeProperty(this.ecmaVersion, "General_Category", nameOrValue)) { + return { + key: "General_Category", + value: nameOrValue || null, + }; + } + if (isValidLoneUnicodeProperty(this.ecmaVersion, nameOrValue)) { + return { + key: nameOrValue, + value: null, + }; + } + if (this._unicodeSetsMode && + isValidLoneUnicodePropertyOfString(this.ecmaVersion, nameOrValue)) { + return { + key: nameOrValue, + value: null, + strings: true, + }; + } + this.raise("Invalid property name"); + } + return null; + } + eatUnicodePropertyName() { + this._lastStrValue = ""; + while (isUnicodePropertyNameCharacter(this.currentCodePoint)) { + this._lastStrValue += String.fromCodePoint(this.currentCodePoint); + this.advance(); + } + return this._lastStrValue !== ""; + } + eatUnicodePropertyValue() { + this._lastStrValue = ""; + while (isUnicodePropertyValueCharacter(this.currentCodePoint)) { + this._lastStrValue += String.fromCodePoint(this.currentCodePoint); + this.advance(); + } + return this._lastStrValue !== ""; + } + eatLoneUnicodePropertyNameOrValue() { + return this.eatUnicodePropertyValue(); + } + eatHexEscapeSequence() { + const start = this.index; + if (this.eat(LATIN_SMALL_LETTER_X)) { + if (this.eatFixedHexDigits(2)) { + return true; + } + if (this._unicodeMode || this.strict) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + eatDecimalDigits() { + const start = this.index; + this._lastIntValue = 0; + while (isDecimalDigit(this.currentCodePoint)) { + this._lastIntValue = + 10 * this._lastIntValue + digitToInt(this.currentCodePoint); + this.advance(); + } + return this.index !== start; + } + eatHexDigits() { + const start = this.index; + this._lastIntValue = 0; + while (isHexDigit(this.currentCodePoint)) { + this._lastIntValue = + 16 * this._lastIntValue + digitToInt(this.currentCodePoint); + this.advance(); + } + return this.index !== start; + } + eatLegacyOctalEscapeSequence() { + if (this.eatOctalDigit()) { + const n1 = this._lastIntValue; + if (this.eatOctalDigit()) { + const n2 = this._lastIntValue; + if (n1 <= 3 && this.eatOctalDigit()) { + this._lastIntValue = n1 * 64 + n2 * 8 + this._lastIntValue; + } + else { + this._lastIntValue = n1 * 8 + n2; + } + } + else { + this._lastIntValue = n1; + } + return true; + } + return false; + } + eatOctalDigit() { + const cp = this.currentCodePoint; + if (isOctalDigit(cp)) { + this.advance(); + this._lastIntValue = cp - DIGIT_ZERO; + return true; + } + this._lastIntValue = 0; + return false; + } + eatFixedHexDigits(length) { + const start = this.index; + this._lastIntValue = 0; + for (let i = 0; i < length; ++i) { + const cp = this.currentCodePoint; + if (!isHexDigit(cp)) { + this.rewind(start); + return false; + } + this._lastIntValue = 16 * this._lastIntValue + digitToInt(cp); + this.advance(); + } + return true; + } + eatModifiers() { + let ate = false; + while (isRegularExpressionModifier(this.currentCodePoint)) { + this.advance(); + ate = true; + } + return ate; + } + parseModifiers(start, end) { + const { ignoreCase, multiline, dotAll } = this.parseFlags(this._reader.source, start, end); + return { ignoreCase, multiline, dotAll }; + } + parseFlags(source, start, end) { + const flags = { + global: false, + ignoreCase: false, + multiline: false, + unicode: false, + sticky: false, + dotAll: false, + hasIndices: false, + unicodeSets: false, + }; + const validFlags = new Set(); + validFlags.add(LATIN_SMALL_LETTER_G); + validFlags.add(LATIN_SMALL_LETTER_I); + validFlags.add(LATIN_SMALL_LETTER_M); + if (this.ecmaVersion >= 2015) { + validFlags.add(LATIN_SMALL_LETTER_U); + validFlags.add(LATIN_SMALL_LETTER_Y); + if (this.ecmaVersion >= 2018) { + validFlags.add(LATIN_SMALL_LETTER_S); + if (this.ecmaVersion >= 2022) { + validFlags.add(LATIN_SMALL_LETTER_D); + if (this.ecmaVersion >= 2024) { + validFlags.add(LATIN_SMALL_LETTER_V); + } + } + } + } + for (let i = start; i < end; ++i) { + const flag = source.charCodeAt(i); + if (validFlags.has(flag)) { + const prop = FLAG_CODEPOINT_TO_PROP[flag]; + if (flags[prop]) { + this.raise(`Duplicated flag '${source[i]}'`, { + index: start, + }); + } + flags[prop] = true; + } + else { + this.raise(`Invalid flag '${source[i]}'`, { index: start }); + } + } + return flags; + } +} + +const DUMMY_PATTERN = {}; +const DUMMY_FLAGS = {}; +const DUMMY_CAPTURING_GROUP = {}; +function isClassSetOperand(node) { + return (node.type === "Character" || + node.type === "CharacterSet" || + node.type === "CharacterClass" || + node.type === "ExpressionCharacterClass" || + node.type === "ClassStringDisjunction"); +} +class RegExpParserState { + constructor(options) { + var _a; + this._node = DUMMY_PATTERN; + this._expressionBufferMap = new Map(); + this._flags = DUMMY_FLAGS; + this._backreferences = []; + this._capturingGroups = []; + this.source = ""; + this.strict = Boolean(options === null || options === void 0 ? void 0 : options.strict); + this.ecmaVersion = (_a = options === null || options === void 0 ? void 0 : options.ecmaVersion) !== null && _a !== void 0 ? _a : latestEcmaVersion; + } + get pattern() { + if (this._node.type !== "Pattern") { + throw new Error("UnknownError"); + } + return this._node; + } + get flags() { + if (this._flags.type !== "Flags") { + throw new Error("UnknownError"); + } + return this._flags; + } + onRegExpFlags(start, end, { global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices, unicodeSets, }) { + this._flags = { + type: "Flags", + parent: null, + start, + end, + raw: this.source.slice(start, end), + global, + ignoreCase, + multiline, + unicode, + sticky, + dotAll, + hasIndices, + unicodeSets, + }; + } + onPatternEnter(start) { + this._node = { + type: "Pattern", + parent: null, + start, + end: start, + raw: "", + alternatives: [], + }; + this._backreferences.length = 0; + this._capturingGroups.length = 0; + } + onPatternLeave(start, end) { + this._node.end = end; + this._node.raw = this.source.slice(start, end); + for (const reference of this._backreferences) { + const ref = reference.ref; + const groups = typeof ref === "number" + ? [this._capturingGroups[ref - 1]] + : this._capturingGroups.filter((g) => g.name === ref); + if (groups.length === 1) { + const group = groups[0]; + reference.ambiguous = false; + reference.resolved = group; + } + else { + reference.ambiguous = true; + reference.resolved = groups; + } + for (const group of groups) { + group.references.push(reference); + } + } + } + onAlternativeEnter(start) { + const parent = this._node; + if (parent.type !== "Assertion" && + parent.type !== "CapturingGroup" && + parent.type !== "Group" && + parent.type !== "Pattern") { + throw new Error("UnknownError"); + } + this._node = { + type: "Alternative", + parent, + start, + end: start, + raw: "", + elements: [], + }; + parent.alternatives.push(this._node); + } + onAlternativeLeave(start, end) { + const node = this._node; + if (node.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onGroupEnter(start) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const group = { + type: "Group", + parent, + start, + end: start, + raw: "", + modifiers: null, + alternatives: [], + }; + this._node = group; + parent.elements.push(this._node); + } + onGroupLeave(start, end) { + const node = this._node; + if (node.type !== "Group" || node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onModifiersEnter(start) { + const parent = this._node; + if (parent.type !== "Group") { + throw new Error("UnknownError"); + } + this._node = { + type: "Modifiers", + parent, + start, + end: start, + raw: "", + add: null, + remove: null, + }; + parent.modifiers = this._node; + } + onModifiersLeave(start, end) { + const node = this._node; + if (node.type !== "Modifiers" || node.parent.type !== "Group") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onAddModifiers(start, end, { ignoreCase, multiline, dotAll, }) { + const parent = this._node; + if (parent.type !== "Modifiers") { + throw new Error("UnknownError"); + } + parent.add = { + type: "ModifierFlags", + parent, + start, + end, + raw: this.source.slice(start, end), + ignoreCase, + multiline, + dotAll, + }; + } + onRemoveModifiers(start, end, { ignoreCase, multiline, dotAll, }) { + const parent = this._node; + if (parent.type !== "Modifiers") { + throw new Error("UnknownError"); + } + parent.remove = { + type: "ModifierFlags", + parent, + start, + end, + raw: this.source.slice(start, end), + ignoreCase, + multiline, + dotAll, + }; + } + onCapturingGroupEnter(start, name) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + this._node = { + type: "CapturingGroup", + parent, + start, + end: start, + raw: "", + name, + alternatives: [], + references: [], + }; + parent.elements.push(this._node); + this._capturingGroups.push(this._node); + } + onCapturingGroupLeave(start, end) { + const node = this._node; + if (node.type !== "CapturingGroup" || + node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onQuantifier(start, end, min, max, greedy) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const element = parent.elements.pop(); + if (element == null || + element.type === "Quantifier" || + (element.type === "Assertion" && element.kind !== "lookahead")) { + throw new Error("UnknownError"); + } + const node = { + type: "Quantifier", + parent, + start: element.start, + end, + raw: this.source.slice(element.start, end), + min, + max, + greedy, + element, + }; + parent.elements.push(node); + element.parent = node; + } + onLookaroundAssertionEnter(start, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const node = (this._node = { + type: "Assertion", + parent, + start, + end: start, + raw: "", + kind, + negate, + alternatives: [], + }); + parent.elements.push(node); + } + onLookaroundAssertionLeave(start, end) { + const node = this._node; + if (node.type !== "Assertion" || node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onEdgeAssertion(start, end, kind) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Assertion", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + }); + } + onWordBoundaryAssertion(start, end, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Assertion", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + negate, + }); + } + onAnyCharacterSet(start, end, kind) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "CharacterSet", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + }); + } + onEscapeCharacterSet(start, end, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "CharacterSet", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + negate, + }); + } + onUnicodePropertyCharacterSet(start, end, kind, key, value, negate, strings) { + const parent = this._node; + if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + const base = { + type: "CharacterSet", + parent: null, + start, + end, + raw: this.source.slice(start, end), + kind, + strings: null, + key, + }; + if (strings) { + if ((parent.type === "CharacterClass" && !parent.unicodeSets) || + negate || + value !== null) { + throw new Error("UnknownError"); + } + parent.elements.push(Object.assign(Object.assign({}, base), { parent, strings, value, negate })); + } + else { + parent.elements.push(Object.assign(Object.assign({}, base), { parent, strings, value, negate })); + } + } + onCharacter(start, end, value) { + const parent = this._node; + if (parent.type !== "Alternative" && + parent.type !== "CharacterClass" && + parent.type !== "StringAlternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Character", + parent, + start, + end, + raw: this.source.slice(start, end), + value, + }); + } + onBackreference(start, end, ref) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const node = { + type: "Backreference", + parent, + start, + end, + raw: this.source.slice(start, end), + ref, + ambiguous: false, + resolved: DUMMY_CAPTURING_GROUP, + }; + parent.elements.push(node); + this._backreferences.push(node); + } + onCharacterClassEnter(start, negate, unicodeSets) { + const parent = this._node; + const base = { + type: "CharacterClass", + parent, + start, + end: start, + raw: "", + unicodeSets, + negate, + elements: [], + }; + if (parent.type === "Alternative") { + const node = Object.assign(Object.assign({}, base), { parent }); + this._node = node; + parent.elements.push(node); + } + else if (parent.type === "CharacterClass" && + parent.unicodeSets && + unicodeSets) { + const node = Object.assign(Object.assign({}, base), { parent, + unicodeSets }); + this._node = node; + parent.elements.push(node); + } + else { + throw new Error("UnknownError"); + } + } + onCharacterClassLeave(start, end) { + const node = this._node; + if (node.type !== "CharacterClass" || + (node.parent.type !== "Alternative" && + node.parent.type !== "CharacterClass")) { + throw new Error("UnknownError"); + } + const parent = node.parent; + node.end = end; + node.raw = this.source.slice(start, end); + this._node = parent; + const expression = this._expressionBufferMap.get(node); + if (!expression) { + return; + } + if (node.elements.length > 0) { + throw new Error("UnknownError"); + } + this._expressionBufferMap.delete(node); + const newNode = { + type: "ExpressionCharacterClass", + parent, + start: node.start, + end: node.end, + raw: node.raw, + negate: node.negate, + expression, + }; + expression.parent = newNode; + if (node !== parent.elements.pop()) { + throw new Error("UnknownError"); + } + parent.elements.push(newNode); + } + onCharacterClassRange(start, end) { + const parent = this._node; + if (parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + const elements = parent.elements; + const max = elements.pop(); + if (!max || max.type !== "Character") { + throw new Error("UnknownError"); + } + if (!parent.unicodeSets) { + const hyphen = elements.pop(); + if (!hyphen || + hyphen.type !== "Character" || + hyphen.value !== HYPHEN_MINUS) { + throw new Error("UnknownError"); + } + } + const min = elements.pop(); + if (!min || min.type !== "Character") { + throw new Error("UnknownError"); + } + const node = { + type: "CharacterClassRange", + parent, + start, + end, + raw: this.source.slice(start, end), + min, + max, + }; + min.parent = node; + max.parent = node; + elements.push(node); + } + onClassIntersection(start, end) { + var _a; + const parent = this._node; + if (parent.type !== "CharacterClass" || !parent.unicodeSets) { + throw new Error("UnknownError"); + } + const right = parent.elements.pop(); + const left = (_a = this._expressionBufferMap.get(parent)) !== null && _a !== void 0 ? _a : parent.elements.pop(); + if (!left || + !right || + left.type === "ClassSubtraction" || + (left.type !== "ClassIntersection" && !isClassSetOperand(left)) || + !isClassSetOperand(right)) { + throw new Error("UnknownError"); + } + const node = { + type: "ClassIntersection", + parent: parent, + start, + end, + raw: this.source.slice(start, end), + left, + right, + }; + left.parent = node; + right.parent = node; + this._expressionBufferMap.set(parent, node); + } + onClassSubtraction(start, end) { + var _a; + const parent = this._node; + if (parent.type !== "CharacterClass" || !parent.unicodeSets) { + throw new Error("UnknownError"); + } + const right = parent.elements.pop(); + const left = (_a = this._expressionBufferMap.get(parent)) !== null && _a !== void 0 ? _a : parent.elements.pop(); + if (!left || + !right || + left.type === "ClassIntersection" || + (left.type !== "ClassSubtraction" && !isClassSetOperand(left)) || + !isClassSetOperand(right)) { + throw new Error("UnknownError"); + } + const node = { + type: "ClassSubtraction", + parent: parent, + start, + end, + raw: this.source.slice(start, end), + left, + right, + }; + left.parent = node; + right.parent = node; + this._expressionBufferMap.set(parent, node); + } + onClassStringDisjunctionEnter(start) { + const parent = this._node; + if (parent.type !== "CharacterClass" || !parent.unicodeSets) { + throw new Error("UnknownError"); + } + this._node = { + type: "ClassStringDisjunction", + parent, + start, + end: start, + raw: "", + alternatives: [], + }; + parent.elements.push(this._node); + } + onClassStringDisjunctionLeave(start, end) { + const node = this._node; + if (node.type !== "ClassStringDisjunction" || + node.parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onStringAlternativeEnter(start) { + const parent = this._node; + if (parent.type !== "ClassStringDisjunction") { + throw new Error("UnknownError"); + } + this._node = { + type: "StringAlternative", + parent, + start, + end: start, + raw: "", + elements: [], + }; + parent.alternatives.push(this._node); + } + onStringAlternativeLeave(start, end) { + const node = this._node; + if (node.type !== "StringAlternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } +} +class RegExpParser { + constructor(options) { + this._state = new RegExpParserState(options); + this._validator = new RegExpValidator(this._state); + } + parseLiteral(source, start = 0, end = source.length) { + this._state.source = source; + this._validator.validateLiteral(source, start, end); + const pattern = this._state.pattern; + const flags = this._state.flags; + const literal = { + type: "RegExpLiteral", + parent: null, + start, + end, + raw: source, + pattern, + flags, + }; + pattern.parent = literal; + flags.parent = literal; + return literal; + } + parseFlags(source, start = 0, end = source.length) { + this._state.source = source; + this._validator.validateFlags(source, start, end); + return this._state.flags; + } + parsePattern(source, start = 0, end = source.length, uFlagOrFlags = undefined) { + this._state.source = source; + this._validator.validatePattern(source, start, end, uFlagOrFlags); + return this._state.pattern; + } +} + +class RegExpVisitor { + constructor(handlers) { + this._handlers = handlers; + } + visit(node) { + switch (node.type) { + case "Alternative": + this.visitAlternative(node); + break; + case "Assertion": + this.visitAssertion(node); + break; + case "Backreference": + this.visitBackreference(node); + break; + case "CapturingGroup": + this.visitCapturingGroup(node); + break; + case "Character": + this.visitCharacter(node); + break; + case "CharacterClass": + this.visitCharacterClass(node); + break; + case "CharacterClassRange": + this.visitCharacterClassRange(node); + break; + case "CharacterSet": + this.visitCharacterSet(node); + break; + case "ClassIntersection": + this.visitClassIntersection(node); + break; + case "ClassStringDisjunction": + this.visitClassStringDisjunction(node); + break; + case "ClassSubtraction": + this.visitClassSubtraction(node); + break; + case "ExpressionCharacterClass": + this.visitExpressionCharacterClass(node); + break; + case "Flags": + this.visitFlags(node); + break; + case "Group": + this.visitGroup(node); + break; + case "Modifiers": + this.visitModifiers(node); + break; + case "ModifierFlags": + this.visitModifierFlags(node); + break; + case "Pattern": + this.visitPattern(node); + break; + case "Quantifier": + this.visitQuantifier(node); + break; + case "RegExpLiteral": + this.visitRegExpLiteral(node); + break; + case "StringAlternative": + this.visitStringAlternative(node); + break; + default: + throw new Error(`Unknown type: ${node.type}`); + } + } + visitAlternative(node) { + if (this._handlers.onAlternativeEnter) { + this._handlers.onAlternativeEnter(node); + } + node.elements.forEach(this.visit, this); + if (this._handlers.onAlternativeLeave) { + this._handlers.onAlternativeLeave(node); + } + } + visitAssertion(node) { + if (this._handlers.onAssertionEnter) { + this._handlers.onAssertionEnter(node); + } + if (node.kind === "lookahead" || node.kind === "lookbehind") { + node.alternatives.forEach(this.visit, this); + } + if (this._handlers.onAssertionLeave) { + this._handlers.onAssertionLeave(node); + } + } + visitBackreference(node) { + if (this._handlers.onBackreferenceEnter) { + this._handlers.onBackreferenceEnter(node); + } + if (this._handlers.onBackreferenceLeave) { + this._handlers.onBackreferenceLeave(node); + } + } + visitCapturingGroup(node) { + if (this._handlers.onCapturingGroupEnter) { + this._handlers.onCapturingGroupEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onCapturingGroupLeave) { + this._handlers.onCapturingGroupLeave(node); + } + } + visitCharacter(node) { + if (this._handlers.onCharacterEnter) { + this._handlers.onCharacterEnter(node); + } + if (this._handlers.onCharacterLeave) { + this._handlers.onCharacterLeave(node); + } + } + visitCharacterClass(node) { + if (this._handlers.onCharacterClassEnter) { + this._handlers.onCharacterClassEnter(node); + } + node.elements.forEach(this.visit, this); + if (this._handlers.onCharacterClassLeave) { + this._handlers.onCharacterClassLeave(node); + } + } + visitCharacterClassRange(node) { + if (this._handlers.onCharacterClassRangeEnter) { + this._handlers.onCharacterClassRangeEnter(node); + } + this.visitCharacter(node.min); + this.visitCharacter(node.max); + if (this._handlers.onCharacterClassRangeLeave) { + this._handlers.onCharacterClassRangeLeave(node); + } + } + visitCharacterSet(node) { + if (this._handlers.onCharacterSetEnter) { + this._handlers.onCharacterSetEnter(node); + } + if (this._handlers.onCharacterSetLeave) { + this._handlers.onCharacterSetLeave(node); + } + } + visitClassIntersection(node) { + if (this._handlers.onClassIntersectionEnter) { + this._handlers.onClassIntersectionEnter(node); + } + this.visit(node.left); + this.visit(node.right); + if (this._handlers.onClassIntersectionLeave) { + this._handlers.onClassIntersectionLeave(node); + } + } + visitClassStringDisjunction(node) { + if (this._handlers.onClassStringDisjunctionEnter) { + this._handlers.onClassStringDisjunctionEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onClassStringDisjunctionLeave) { + this._handlers.onClassStringDisjunctionLeave(node); + } + } + visitClassSubtraction(node) { + if (this._handlers.onClassSubtractionEnter) { + this._handlers.onClassSubtractionEnter(node); + } + this.visit(node.left); + this.visit(node.right); + if (this._handlers.onClassSubtractionLeave) { + this._handlers.onClassSubtractionLeave(node); + } + } + visitExpressionCharacterClass(node) { + if (this._handlers.onExpressionCharacterClassEnter) { + this._handlers.onExpressionCharacterClassEnter(node); + } + this.visit(node.expression); + if (this._handlers.onExpressionCharacterClassLeave) { + this._handlers.onExpressionCharacterClassLeave(node); + } + } + visitFlags(node) { + if (this._handlers.onFlagsEnter) { + this._handlers.onFlagsEnter(node); + } + if (this._handlers.onFlagsLeave) { + this._handlers.onFlagsLeave(node); + } + } + visitGroup(node) { + if (this._handlers.onGroupEnter) { + this._handlers.onGroupEnter(node); + } + if (node.modifiers) { + this.visit(node.modifiers); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onGroupLeave) { + this._handlers.onGroupLeave(node); + } + } + visitModifiers(node) { + if (this._handlers.onModifiersEnter) { + this._handlers.onModifiersEnter(node); + } + if (node.add) { + this.visit(node.add); + } + if (node.remove) { + this.visit(node.remove); + } + if (this._handlers.onModifiersLeave) { + this._handlers.onModifiersLeave(node); + } + } + visitModifierFlags(node) { + if (this._handlers.onModifierFlagsEnter) { + this._handlers.onModifierFlagsEnter(node); + } + if (this._handlers.onModifierFlagsLeave) { + this._handlers.onModifierFlagsLeave(node); + } + } + visitPattern(node) { + if (this._handlers.onPatternEnter) { + this._handlers.onPatternEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onPatternLeave) { + this._handlers.onPatternLeave(node); + } + } + visitQuantifier(node) { + if (this._handlers.onQuantifierEnter) { + this._handlers.onQuantifierEnter(node); + } + this.visit(node.element); + if (this._handlers.onQuantifierLeave) { + this._handlers.onQuantifierLeave(node); + } + } + visitRegExpLiteral(node) { + if (this._handlers.onRegExpLiteralEnter) { + this._handlers.onRegExpLiteralEnter(node); + } + this.visitPattern(node.pattern); + this.visitFlags(node.flags); + if (this._handlers.onRegExpLiteralLeave) { + this._handlers.onRegExpLiteralLeave(node); + } + } + visitStringAlternative(node) { + if (this._handlers.onStringAlternativeEnter) { + this._handlers.onStringAlternativeEnter(node); + } + node.elements.forEach(this.visit, this); + if (this._handlers.onStringAlternativeLeave) { + this._handlers.onStringAlternativeLeave(node); + } + } +} + +function parseRegExpLiteral(source, options) { + return new RegExpParser(options).parseLiteral(String(source)); +} +function validateRegExpLiteral(source, options) { + new RegExpValidator(options).validateLiteral(source); +} +function visitRegExpAST(node, handlers) { + new RegExpVisitor(handlers).visit(node); +} + +exports.AST = ast; +exports.RegExpParser = RegExpParser; +exports.RegExpSyntaxError = RegExpSyntaxError; +exports.RegExpValidator = RegExpValidator; +exports.parseRegExpLiteral = parseRegExpLiteral; +exports.validateRegExpLiteral = validateRegExpLiteral; +exports.visitRegExpAST = visitRegExpAST; +//# sourceMappingURL=index.js.map diff --git a/node_modules/@eslint-community/regexpp/index.js.map b/node_modules/@eslint-community/regexpp/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8e0a4d6b7e4d1946c23ecf21ebbdd329e67f4bbf --- /dev/null +++ b/node_modules/@eslint-community/regexpp/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js.map","sources":[".temp/src/ecma-versions.ts",".temp/unicode/src/unicode/ids.ts",".temp/unicode/src/unicode/properties.ts",".temp/unicode/src/unicode/index.ts",".temp/src/group-specifiers.ts",".temp/src/reader.ts",".temp/src/regexp-syntax-error.ts",".temp/src/validator.ts",".temp/src/parser.ts",".temp/src/visitor.ts",".temp/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;AAaO,MAAM,iBAAiB,GAAG,IAAI;;ACTrC,IAAI,kBAAkB,GAAyB,SAAS,CAAA;AACxD,IAAI,qBAAqB,GAAyB,SAAS,CAAA;AAErD,SAAU,SAAS,CAAC,EAAU,EAAA;IAChC,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,IAAI,CAAA;IAC1B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,IAAI,CAAA;AAC1B,IAAA,OAAO,cAAc,CAAC,EAAE,CAAC,C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AAA,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAA;AAChD,SAAA;KACJ;AACJ;;ACpTe,SAAA,kBAAkB,CAC9B,MAAuB,EACvB,OAA8B,EAAA;AAE9B,IAAA,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;AACjE,CAAC;AAOe,SAAA,qBAAqB,CACjC,MAAc,EACd,OAAiC,EAAA;IAEjC,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;AACxD,CAAC;AAEe,SAAA,cAAc,CAC1B,IAAc,EACd,QAAgC,EAAA;IAEhC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC3C;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@eslint-community/regexpp/index.mjs b/node_modules/@eslint-community/regexpp/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ad7ab27f74c72249b0dbf46a6c10cb98e74aefef --- /dev/null +++ b/node_modules/@eslint-community/regexpp/index.mjs @@ -0,0 +1,3032 @@ +var ast = /*#__PURE__*/Object.freeze({ + __proto__: null +}); + +const latestEcmaVersion = 2025; + +let largeIdStartRanges = undefined; +let largeIdContinueRanges = undefined; +function isIdStart(cp) { + if (cp < 0x41) + return false; + if (cp < 0x5b) + return true; + if (cp < 0x61) + return false; + if (cp < 0x7b) + return true; + return isLargeIdStart(cp); +} +function isIdContinue(cp) { + if (cp < 0x30) + return false; + if (cp < 0x3a) + return true; + if (cp < 0x41) + return false; + if (cp < 0x5b) + return true; + if (cp === 0x5f) + return true; + if (cp < 0x61) + return false; + if (cp < 0x7b) + return true; + return isLargeIdStart(cp) || isLargeIdContinue(cp); +} +function isLargeIdStart(cp) { + return isInRange(cp, largeIdStartRanges !== null && largeIdStartRanges !== void 0 ? largeIdStartRanges : (largeIdStartRanges = initLargeIdStartRanges())); +} +function isLargeIdContinue(cp) { + return isInRange(cp, largeIdContinueRanges !== null && largeIdContinueRanges !== void 0 ? largeIdContinueRanges : (largeIdContinueRanges = initLargeIdContinueRanges())); +} +function initLargeIdStartRanges() { + return restoreRanges("4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 2 0 7 0 2 2 2 0 2 j 2 2a 2 3u 9 4l 2 11 3 0 7 14 20 q 5 3 1a 16 10 1 2 2q 2 0 g 1 8 1 b 2 3 0 h 0 2 t u 2g c 0 p w a 1 5 0 6 l 5 0 a 0 4 0 o o 8 a 6 n 2 6 h 15 1n 1h 4 0 j 0 8 9 g f 5 7 3 1 3 l 2 6 2 0 4 3 4 0 h 0 e 1 2 2 f 1 b 0 9 5 5 1 3 l 2 6 2 1 2 1 2 1 w 3 2 0 k 2 h 8 2 2 2 l 2 6 2 1 2 4 4 0 j 0 g 1 o 0 c 7 3 1 3 l 2 6 2 1 2 4 4 0 v 1 2 2 g 0 i 0 2 5 4 2 2 3 4 1 2 0 2 1 4 1 4 2 4 b n 0 1h 7 2 2 2 m 2 f 4 0 r 2 2 1 3 1 v 0 5 7 2 2 2 m 2 9 2 4 4 0 v 2 2 1 g 1 i 8 2 2 2 14 3 0 h 0 6 2 9 2 p 5 6 h 4 n 2 8 2 0 3 6 1n 1b 2 1 d 6 1n 1 2 0 2 4 2 n 2 0 2 9 2 1 a 0 3 4 2 0 m 3 x 0 1s 7 2 z s 4 38 16 l 0 h 5 5 3 4 0 4 1 8 2 5 c d 0 i 11 2 0 6 0 3 16 2 98 2 3 3 6 2 0 2 3 3 14 2 3 3 w 2 3 3 6 2 0 2 3 3 e 2 1k 2 3 3 1u 12 f h 2d 3 5 4 h7 3 g 2 p 6 22 4 a 8 h e i f h f c 2 2 g 1f 10 0 5 0 1w 2g 8 14 2 0 6 1x b u 1e t 3 4 c 17 5 p 1j m a 1g 2b 0 2m 1a i 7 1j t e 1 b 17 r z 16 2 b z 3 a 6 16 3 2 16 3 2 5 2 1 4 0 6 5b 1t 7p 3 5 3 11 3 5 3 7 2 0 2 0 2 0 2 u 3 1g 2 6 2 0 4 2 2 6 4 3 3 5 5 c 6 2 2 6 39 0 e 0 h c 2u 0 5 0 3 9 2 0 3 5 7 0 2 0 2 0 2 f 3 3 6 4 5 0 i 14 22g 6c 7 3 4 1 d 11 2 0 6 0 3 1j 8 0 h m a 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 fb 2 q 8 8 4 3 4 5 2d 5 4 2 2h 2 3 6 16 2 2l i v 1d f e9 533 1t h3g 1w 19 3 7g 4 f b 1 l 1a h u 3 27 14 8 3 2u 3 29 l g 2 2 2 3 2 m u 1f f 1d 1r 5 4 0 2 1 c r b m q s 8 1a t 0 h 4 2 9 b 4 2 14 o 2 2 7 l m 4 0 4 1d 2 0 4 1 3 4 3 0 2 0 p 2 3 a 8 2 d 5 3 5 3 5 a 6 2 6 2 16 2 d 7 36 u 8mb d m 5 1c 6it a5 3 2x 13 6 d 4 6 0 2 9 2 c 2 4 2 0 2 1 2 1 2 2z y a2 j 1r 3 1h 15 b 39 4 2 3q 11 p 7 p c 2g 4 5 3 5 3 5 3 2 10 b 2 p 2 i 2 1 2 e 3 d z 3e 1y 1g 7g s 4 1c 1c v e t 6 11 b t 3 z 5 7 2 4 17 4d j z 5 z 5 13 9 1f d a 2 e 2 6 2 1 2 a 2 e 2 6 2 1 4 1f d 8m a l b 7 p 5 2 15 2 8 1y 5 3 0 2 17 2 1 4 0 3 m b m a u 1u i 2 1 b l b p 7 p 13 1j 7 1 1t 0 g 3 2 2 2 s 17 s 4 s 10 7 2 r s 1h b l b i e h 33 20 1k 1e e 1e e z 13 r a m 6z 15 7 1 h 5 1l s b 0 9 l 17 h 1b k s m d 1g 1m 1 3 0 e 18 x o r z u 0 3 0 9 y 4 0 d 1b f 3 m 0 2 0 10 h 2 o k 1 1s 6 2 0 2 3 2 e 2 9 8 1a 13 7 3 1 3 l 2 6 2 1 2 4 4 0 j 0 d 4 v 9 2 0 3 0 2 11 2 0 q 0 2 0 19 1g j 3 l 2 v 1b l 1 2 0 55 1a 16 3 11 1b l 0 1o 16 e 0 20 q 12 6 56 17 39 1r w 7 3 0 3 7 2 1 2 n g 0 2 0 2n 7 3 12 h 0 2 0 t 0 b 13 8 0 m 0 c 19 k 0 j 20 5k w w 8 2 10 i 0 1e t 35 6 2 1 2 11 m 0 q 5 2 1 2 v f 0 o 17 79 i g 0 2 c 2 x 3h 0 28 pl 2v 32 i 5f 219 2o g tr i 5 q 32y 6 g6 5a2 t 1cz fs 8 u i 26 i t j 1b h 3 w k 6 i c1 18 5w 1r x o 3 o 19 22 6 0 1v c 1t 1 2 0 f 4 a 5p1 16 v 2q 36 6pq 3 2 6 2 1 2 82 g 0 u 2 3 0 f 3 9 az 1s5 2y 6 c 4 8 8 9 4mf 2c 2 1y 2 1 3 0 3 1 3 3 2 b 2 0 2 6 2 1s 2 3 3 7 2 6 2 r 2 3 2 4 2 0 4 6 2 9f 3 o 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 7 1f9 u 7 5 7a 1p 43 18 b 6 h 0 8y t j 17 dh r 6d t 3 0 5s u 2 2 2 1 2 6 3 4 a 1 69 6 2 3 2 1 2 e 2 5g 1o 1v 8 0 xh 3 2 q 2 1 2 0 3 0 2 9 2 3 2 0 2 0 7 0 5 0 2 0 2 0 2 2 2 1 2 0 3 0 2 0 2 0 2 0 2 0 2 1 2 0 3 3 2 6 2 3 2 3 2 0 2 9 2 g 6 2 2 4 2 g 3et wyn x 3dp 3 4gd 3 5rk g h9 1wj f1 15v 3t6 6 6jt"); +} +function initLargeIdContinueRanges() { + return restoreRanges("53 0 g9 33 o 0 70 4 7e 18 2 0 2 1 2 1 2 0 21 a 1d u 7 0 2u 6 3 5 3 1 2 3 3 9 o 0 v q 2k a g 9 y 8 a 0 p 3 2 8 2 2 2 4 18 2 1o 8 17 n 2 w 1j 2 2 h 2 6 b 1 3 9 i 2 1l 0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 2b h a 9 5 0 2a j d 9 5y 6 3 8 s 1 2b g g 9 2a c 9 9 7 j 1m e 5 9 6r e 4m 9 1z 5 2 1 3 3 2 0 2 1 d 9 3c 6 3 6 4 0 t 9 15 6 2 3 9 0 a a 1b f 5j 7 3t 9 1i 7 2 7 h 9 1l l 2 d 3f 5 4 0 2 1 2 6 2 0 9 9 1d 4 2 1 2 4 9 9 1j 9 7e 3 a 1 2 0 1d 6 4 4 e a 44m 0 7 e 8uh r 1t3 9 2f 9 13 4 1o 6 q 9 ev 9 d2 0 2 1i 8 3 2a 0 c 1 f58 1 382 9 ef 19 3 m f3 4 4 5 9 7 3 6 v 3 45 2 13e 1d e9 1i 5 1d 9 0 f 0 n 4 2 e 11t 6 2 g 3 6 2 1 2 4 2t 0 4h 6 a 9 9x 0 1q d dv d 6t 1 2 9 6h 0 3 0 8 1 6 0 d7 6 32 6 6 9 3o7 9 gvt3 6n"); +} +function isInRange(cp, ranges) { + let l = 0, r = (ranges.length / 2) | 0, i = 0, min = 0, max = 0; + while (l < r) { + i = ((l + r) / 2) | 0; + min = ranges[2 * i]; + max = ranges[2 * i + 1]; + if (cp < min) { + r = i; + } + else if (cp > max) { + l = i + 1; + } + else { + return true; + } + } + return false; +} +function restoreRanges(data) { + let last = 0; + return data.split(" ").map((s) => (last += parseInt(s, 36) | 0)); +} + +class DataSet { + constructor(raw2018, raw2019, raw2020, raw2021, raw2022, raw2023, raw2024, raw2025, raw2026) { + this._raw2018 = raw2018; + this._raw2019 = raw2019; + this._raw2020 = raw2020; + this._raw2021 = raw2021; + this._raw2022 = raw2022; + this._raw2023 = raw2023; + this._raw2024 = raw2024; + this._raw2025 = raw2025; + this._raw2026 = raw2026; + } + get es2018() { + var _a; + return ((_a = this._set2018) !== null && _a !== void 0 ? _a : (this._set2018 = new Set(this._raw2018.split(" ")))); + } + get es2019() { + var _a; + return ((_a = this._set2019) !== null && _a !== void 0 ? _a : (this._set2019 = new Set(this._raw2019.split(" ")))); + } + get es2020() { + var _a; + return ((_a = this._set2020) !== null && _a !== void 0 ? _a : (this._set2020 = new Set(this._raw2020.split(" ")))); + } + get es2021() { + var _a; + return ((_a = this._set2021) !== null && _a !== void 0 ? _a : (this._set2021 = new Set(this._raw2021.split(" ")))); + } + get es2022() { + var _a; + return ((_a = this._set2022) !== null && _a !== void 0 ? _a : (this._set2022 = new Set(this._raw2022.split(" ")))); + } + get es2023() { + var _a; + return ((_a = this._set2023) !== null && _a !== void 0 ? _a : (this._set2023 = new Set(this._raw2023.split(" ")))); + } + get es2024() { + var _a; + return ((_a = this._set2024) !== null && _a !== void 0 ? _a : (this._set2024 = new Set(this._raw2024.split(" ")))); + } + get es2025() { + var _a; + return ((_a = this._set2025) !== null && _a !== void 0 ? _a : (this._set2025 = new Set(this._raw2025.split(" ")))); + } + get es2026() { + var _a; + return ((_a = this._set2026) !== null && _a !== void 0 ? _a : (this._set2026 = new Set(this._raw2026.split(" ")))); + } +} +const gcNameSet = new Set(["General_Category", "gc"]); +const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"]); +const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", "", "", "", "", "", ""); +const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", "", "", ""); +const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict", "", "", "", "", ""); +const binPropertyOfStringsSets = new DataSet("", "", "", "", "", "", "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence", "", ""); +function isValidUnicodeProperty(version, name, value) { + if (gcNameSet.has(name)) { + return version >= 2018 && gcValueSets.es2018.has(value); + } + if (scNameSet.has(name)) { + return ((version >= 2018 && scValueSets.es2018.has(value)) || + (version >= 2019 && scValueSets.es2019.has(value)) || + (version >= 2020 && scValueSets.es2020.has(value)) || + (version >= 2021 && scValueSets.es2021.has(value)) || + (version >= 2022 && scValueSets.es2022.has(value)) || + (version >= 2023 && scValueSets.es2023.has(value))); + } + return false; +} +function isValidLoneUnicodeProperty(version, value) { + return ((version >= 2018 && binPropertySets.es2018.has(value)) || + (version >= 2019 && binPropertySets.es2019.has(value)) || + (version >= 2021 && binPropertySets.es2021.has(value))); +} +function isValidLoneUnicodePropertyOfString(version, value) { + return version >= 2024 && binPropertyOfStringsSets.es2024.has(value); +} + +const BACKSPACE = 0x08; +const CHARACTER_TABULATION = 0x09; +const LINE_FEED = 0x0a; +const LINE_TABULATION = 0x0b; +const FORM_FEED = 0x0c; +const CARRIAGE_RETURN = 0x0d; +const EXCLAMATION_MARK = 0x21; +const NUMBER_SIGN = 0x23; +const DOLLAR_SIGN = 0x24; +const PERCENT_SIGN = 0x25; +const AMPERSAND = 0x26; +const LEFT_PARENTHESIS = 0x28; +const RIGHT_PARENTHESIS = 0x29; +const ASTERISK = 0x2a; +const PLUS_SIGN = 0x2b; +const COMMA = 0x2c; +const HYPHEN_MINUS = 0x2d; +const FULL_STOP = 0x2e; +const SOLIDUS = 0x2f; +const DIGIT_ZERO = 0x30; +const DIGIT_ONE = 0x31; +const DIGIT_SEVEN = 0x37; +const DIGIT_NINE = 0x39; +const COLON = 0x3a; +const SEMICOLON = 0x3b; +const LESS_THAN_SIGN = 0x3c; +const EQUALS_SIGN = 0x3d; +const GREATER_THAN_SIGN = 0x3e; +const QUESTION_MARK = 0x3f; +const COMMERCIAL_AT = 0x40; +const LATIN_CAPITAL_LETTER_A = 0x41; +const LATIN_CAPITAL_LETTER_B = 0x42; +const LATIN_CAPITAL_LETTER_D = 0x44; +const LATIN_CAPITAL_LETTER_F = 0x46; +const LATIN_CAPITAL_LETTER_P = 0x50; +const LATIN_CAPITAL_LETTER_S = 0x53; +const LATIN_CAPITAL_LETTER_W = 0x57; +const LATIN_CAPITAL_LETTER_Z = 0x5a; +const LOW_LINE = 0x5f; +const LATIN_SMALL_LETTER_A = 0x61; +const LATIN_SMALL_LETTER_B = 0x62; +const LATIN_SMALL_LETTER_C = 0x63; +const LATIN_SMALL_LETTER_D = 0x64; +const LATIN_SMALL_LETTER_F = 0x66; +const LATIN_SMALL_LETTER_G = 0x67; +const LATIN_SMALL_LETTER_I = 0x69; +const LATIN_SMALL_LETTER_K = 0x6b; +const LATIN_SMALL_LETTER_M = 0x6d; +const LATIN_SMALL_LETTER_N = 0x6e; +const LATIN_SMALL_LETTER_P = 0x70; +const LATIN_SMALL_LETTER_Q = 0x71; +const LATIN_SMALL_LETTER_R = 0x72; +const LATIN_SMALL_LETTER_S = 0x73; +const LATIN_SMALL_LETTER_T = 0x74; +const LATIN_SMALL_LETTER_U = 0x75; +const LATIN_SMALL_LETTER_V = 0x76; +const LATIN_SMALL_LETTER_W = 0x77; +const LATIN_SMALL_LETTER_X = 0x78; +const LATIN_SMALL_LETTER_Y = 0x79; +const LATIN_SMALL_LETTER_Z = 0x7a; +const LEFT_SQUARE_BRACKET = 0x5b; +const REVERSE_SOLIDUS = 0x5c; +const RIGHT_SQUARE_BRACKET = 0x5d; +const CIRCUMFLEX_ACCENT = 0x5e; +const GRAVE_ACCENT = 0x60; +const LEFT_CURLY_BRACKET = 0x7b; +const VERTICAL_LINE = 0x7c; +const RIGHT_CURLY_BRACKET = 0x7d; +const TILDE = 0x7e; +const ZERO_WIDTH_NON_JOINER = 0x200c; +const ZERO_WIDTH_JOINER = 0x200d; +const LINE_SEPARATOR = 0x2028; +const PARAGRAPH_SEPARATOR = 0x2029; +const MIN_CODE_POINT = 0x00; +const MAX_CODE_POINT = 0x10ffff; +function isLatinLetter(code) { + return ((code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_Z) || + (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_Z)); +} +function isDecimalDigit(code) { + return code >= DIGIT_ZERO && code <= DIGIT_NINE; +} +function isOctalDigit(code) { + return code >= DIGIT_ZERO && code <= DIGIT_SEVEN; +} +function isHexDigit(code) { + return ((code >= DIGIT_ZERO && code <= DIGIT_NINE) || + (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) || + (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F)); +} +function isLineTerminator(code) { + return (code === LINE_FEED || + code === CARRIAGE_RETURN || + code === LINE_SEPARATOR || + code === PARAGRAPH_SEPARATOR); +} +function isValidUnicode(code) { + return code >= MIN_CODE_POINT && code <= MAX_CODE_POINT; +} +function digitToInt(code) { + if (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F) { + return code - LATIN_SMALL_LETTER_A + 10; + } + if (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) { + return code - LATIN_CAPITAL_LETTER_A + 10; + } + return code - DIGIT_ZERO; +} +function isLeadSurrogate(code) { + return code >= 0xd800 && code <= 0xdbff; +} +function isTrailSurrogate(code) { + return code >= 0xdc00 && code <= 0xdfff; +} +function combineSurrogatePair(lead, trail) { + return (lead - 0xd800) * 0x400 + (trail - 0xdc00) + 0x10000; +} + +class GroupSpecifiersAsES2018 { + constructor() { + this.groupName = new Set(); + } + clear() { + this.groupName.clear(); + } + isEmpty() { + return !this.groupName.size; + } + hasInPattern(name) { + return this.groupName.has(name); + } + hasInScope(name) { + return this.hasInPattern(name); + } + addToScope(name) { + this.groupName.add(name); + } + enterDisjunction() { + } + enterAlternative() { + } + leaveDisjunction() { + } +} +class BranchID { + constructor(parent, base) { + this.parent = parent; + this.base = base !== null && base !== void 0 ? base : this; + } + separatedFrom(other) { + var _a, _b; + if (this.base === other.base && this !== other) { + return true; + } + if (other.parent && this.separatedFrom(other.parent)) { + return true; + } + return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.separatedFrom(other)) !== null && _b !== void 0 ? _b : false; + } + child() { + return new BranchID(this, null); + } + sibling() { + return new BranchID(this.parent, this.base); + } +} +class GroupSpecifiersAsES2025 { + constructor() { + this.branchID = new BranchID(null, null); + this.groupNames = new Map(); + } + clear() { + this.branchID = new BranchID(null, null); + this.groupNames.clear(); + } + isEmpty() { + return !this.groupNames.size; + } + enterDisjunction() { + this.branchID = this.branchID.child(); + } + enterAlternative(index) { + if (index === 0) { + return; + } + this.branchID = this.branchID.sibling(); + } + leaveDisjunction() { + this.branchID = this.branchID.parent; + } + hasInPattern(name) { + return this.groupNames.has(name); + } + hasInScope(name) { + const branches = this.groupNames.get(name); + if (!branches) { + return false; + } + for (const branch of branches) { + if (!branch.separatedFrom(this.branchID)) { + return true; + } + } + return false; + } + addToScope(name) { + const branches = this.groupNames.get(name); + if (branches) { + branches.push(this.branchID); + return; + } + this.groupNames.set(name, [this.branchID]); + } +} + +const legacyImpl = { + at(s, end, i) { + return i < end ? s.charCodeAt(i) : -1; + }, + width(c) { + return 1; + }, +}; +const unicodeImpl = { + at(s, end, i) { + return i < end ? s.codePointAt(i) : -1; + }, + width(c) { + return c > 0xffff ? 2 : 1; + }, +}; +class Reader { + constructor() { + this._impl = legacyImpl; + this._s = ""; + this._i = 0; + this._end = 0; + this._cp1 = -1; + this._w1 = 1; + this._cp2 = -1; + this._w2 = 1; + this._cp3 = -1; + this._w3 = 1; + this._cp4 = -1; + } + get source() { + return this._s; + } + get index() { + return this._i; + } + get currentCodePoint() { + return this._cp1; + } + get nextCodePoint() { + return this._cp2; + } + get nextCodePoint2() { + return this._cp3; + } + get nextCodePoint3() { + return this._cp4; + } + reset(source, start, end, uFlag) { + this._impl = uFlag ? unicodeImpl : legacyImpl; + this._s = source; + this._end = end; + this.rewind(start); + } + rewind(index) { + const impl = this._impl; + this._i = index; + this._cp1 = impl.at(this._s, this._end, index); + this._w1 = impl.width(this._cp1); + this._cp2 = impl.at(this._s, this._end, index + this._w1); + this._w2 = impl.width(this._cp2); + this._cp3 = impl.at(this._s, this._end, index + this._w1 + this._w2); + this._w3 = impl.width(this._cp3); + this._cp4 = impl.at(this._s, this._end, index + this._w1 + this._w2 + this._w3); + } + advance() { + if (this._cp1 !== -1) { + const impl = this._impl; + this._i += this._w1; + this._cp1 = this._cp2; + this._w1 = this._w2; + this._cp2 = this._cp3; + this._w2 = impl.width(this._cp2); + this._cp3 = this._cp4; + this._w3 = impl.width(this._cp3); + this._cp4 = impl.at(this._s, this._end, this._i + this._w1 + this._w2 + this._w3); + } + } + eat(cp) { + if (this._cp1 === cp) { + this.advance(); + return true; + } + return false; + } + eat2(cp1, cp2) { + if (this._cp1 === cp1 && this._cp2 === cp2) { + this.advance(); + this.advance(); + return true; + } + return false; + } + eat3(cp1, cp2, cp3) { + if (this._cp1 === cp1 && this._cp2 === cp2 && this._cp3 === cp3) { + this.advance(); + this.advance(); + this.advance(); + return true; + } + return false; + } +} + +class RegExpSyntaxError extends SyntaxError { + constructor(message, index) { + super(message); + this.index = index; + } +} +function newRegExpSyntaxError(srcCtx, flags, index, message) { + let source = ""; + if (srcCtx.kind === "literal") { + const literal = srcCtx.source.slice(srcCtx.start, srcCtx.end); + if (literal) { + source = `: ${literal}`; + } + } + else if (srcCtx.kind === "pattern") { + const pattern = srcCtx.source.slice(srcCtx.start, srcCtx.end); + const flagsText = `${flags.unicode ? "u" : ""}${flags.unicodeSets ? "v" : ""}`; + source = `: /${pattern}/${flagsText}`; + } + return new RegExpSyntaxError(`Invalid regular expression${source}: ${message}`, index); +} + +const SYNTAX_CHARACTER = new Set([ + CIRCUMFLEX_ACCENT, + DOLLAR_SIGN, + REVERSE_SOLIDUS, + FULL_STOP, + ASTERISK, + PLUS_SIGN, + QUESTION_MARK, + LEFT_PARENTHESIS, + RIGHT_PARENTHESIS, + LEFT_SQUARE_BRACKET, + RIGHT_SQUARE_BRACKET, + LEFT_CURLY_BRACKET, + RIGHT_CURLY_BRACKET, + VERTICAL_LINE, +]); +const CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR_CHARACTER = new Set([ + AMPERSAND, + EXCLAMATION_MARK, + NUMBER_SIGN, + DOLLAR_SIGN, + PERCENT_SIGN, + ASTERISK, + PLUS_SIGN, + COMMA, + FULL_STOP, + COLON, + SEMICOLON, + LESS_THAN_SIGN, + EQUALS_SIGN, + GREATER_THAN_SIGN, + QUESTION_MARK, + COMMERCIAL_AT, + CIRCUMFLEX_ACCENT, + GRAVE_ACCENT, + TILDE, +]); +const CLASS_SET_SYNTAX_CHARACTER = new Set([ + LEFT_PARENTHESIS, + RIGHT_PARENTHESIS, + LEFT_SQUARE_BRACKET, + RIGHT_SQUARE_BRACKET, + LEFT_CURLY_BRACKET, + RIGHT_CURLY_BRACKET, + SOLIDUS, + HYPHEN_MINUS, + REVERSE_SOLIDUS, + VERTICAL_LINE, +]); +const CLASS_SET_RESERVED_PUNCTUATOR = new Set([ + AMPERSAND, + HYPHEN_MINUS, + EXCLAMATION_MARK, + NUMBER_SIGN, + PERCENT_SIGN, + COMMA, + COLON, + SEMICOLON, + LESS_THAN_SIGN, + EQUALS_SIGN, + GREATER_THAN_SIGN, + COMMERCIAL_AT, + GRAVE_ACCENT, + TILDE, +]); +const FLAG_PROP_TO_CODEPOINT = { + global: LATIN_SMALL_LETTER_G, + ignoreCase: LATIN_SMALL_LETTER_I, + multiline: LATIN_SMALL_LETTER_M, + unicode: LATIN_SMALL_LETTER_U, + sticky: LATIN_SMALL_LETTER_Y, + dotAll: LATIN_SMALL_LETTER_S, + hasIndices: LATIN_SMALL_LETTER_D, + unicodeSets: LATIN_SMALL_LETTER_V, +}; +const FLAG_CODEPOINT_TO_PROP = Object.fromEntries(Object.entries(FLAG_PROP_TO_CODEPOINT).map(([k, v]) => [v, k])); +function isSyntaxCharacter(cp) { + return SYNTAX_CHARACTER.has(cp); +} +function isClassSetReservedDoublePunctuatorCharacter(cp) { + return CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR_CHARACTER.has(cp); +} +function isClassSetSyntaxCharacter(cp) { + return CLASS_SET_SYNTAX_CHARACTER.has(cp); +} +function isClassSetReservedPunctuator(cp) { + return CLASS_SET_RESERVED_PUNCTUATOR.has(cp); +} +function isIdentifierStartChar(cp) { + return isIdStart(cp) || cp === DOLLAR_SIGN || cp === LOW_LINE; +} +function isIdentifierPartChar(cp) { + return (isIdContinue(cp) || + cp === DOLLAR_SIGN || + cp === ZERO_WIDTH_NON_JOINER || + cp === ZERO_WIDTH_JOINER); +} +function isUnicodePropertyNameCharacter(cp) { + return isLatinLetter(cp) || cp === LOW_LINE; +} +function isUnicodePropertyValueCharacter(cp) { + return isUnicodePropertyNameCharacter(cp) || isDecimalDigit(cp); +} +function isRegularExpressionModifier(ch) { + return (ch === LATIN_SMALL_LETTER_I || + ch === LATIN_SMALL_LETTER_M || + ch === LATIN_SMALL_LETTER_S); +} +class RegExpValidator { + constructor(options) { + this._reader = new Reader(); + this._unicodeMode = false; + this._unicodeSetsMode = false; + this._nFlag = false; + this._lastIntValue = 0; + this._lastRange = { + min: 0, + max: Number.POSITIVE_INFINITY, + }; + this._lastStrValue = ""; + this._lastAssertionIsQuantifiable = false; + this._numCapturingParens = 0; + this._backreferenceNames = new Set(); + this._srcCtx = null; + this._options = options !== null && options !== void 0 ? options : {}; + this._groupSpecifiers = + this.ecmaVersion >= 2025 + ? new GroupSpecifiersAsES2025() + : new GroupSpecifiersAsES2018(); + } + validateLiteral(source, start = 0, end = source.length) { + this._srcCtx = { source, start, end, kind: "literal" }; + this._unicodeSetsMode = this._unicodeMode = this._nFlag = false; + this.reset(source, start, end); + this.onLiteralEnter(start); + if (this.eat(SOLIDUS) && this.eatRegExpBody() && this.eat(SOLIDUS)) { + const flagStart = this.index; + const unicode = source.includes("u", flagStart); + const unicodeSets = source.includes("v", flagStart); + this.validateFlagsInternal(source, flagStart, end); + this.validatePatternInternal(source, start + 1, flagStart - 1, { + unicode, + unicodeSets, + }); + } + else if (start >= end) { + this.raise("Empty"); + } + else { + const c = String.fromCodePoint(this.currentCodePoint); + this.raise(`Unexpected character '${c}'`); + } + this.onLiteralLeave(start, end); + } + validateFlags(source, start = 0, end = source.length) { + this._srcCtx = { source, start, end, kind: "flags" }; + this.validateFlagsInternal(source, start, end); + } + validatePattern(source, start = 0, end = source.length, uFlagOrFlags = undefined) { + this._srcCtx = { source, start, end, kind: "pattern" }; + this.validatePatternInternal(source, start, end, uFlagOrFlags); + } + validatePatternInternal(source, start = 0, end = source.length, uFlagOrFlags = undefined) { + const mode = this._parseFlagsOptionToMode(uFlagOrFlags, end); + this._unicodeMode = mode.unicodeMode; + this._nFlag = mode.nFlag; + this._unicodeSetsMode = mode.unicodeSetsMode; + this.reset(source, start, end); + this.consumePattern(); + if (!this._nFlag && + this.ecmaVersion >= 2018 && + !this._groupSpecifiers.isEmpty()) { + this._nFlag = true; + this.rewind(start); + this.consumePattern(); + } + } + validateFlagsInternal(source, start, end) { + const flags = this.parseFlags(source, start, end); + this.onRegExpFlags(start, end, flags); + } + _parseFlagsOptionToMode(uFlagOrFlags, sourceEnd) { + let unicode = false; + let unicodeSets = false; + if (uFlagOrFlags && this.ecmaVersion >= 2015) { + if (typeof uFlagOrFlags === "object") { + unicode = Boolean(uFlagOrFlags.unicode); + if (this.ecmaVersion >= 2024) { + unicodeSets = Boolean(uFlagOrFlags.unicodeSets); + } + } + else { + unicode = uFlagOrFlags; + } + } + if (unicode && unicodeSets) { + this.raise("Invalid regular expression flags", { + index: sourceEnd + 1, + unicode, + unicodeSets, + }); + } + const unicodeMode = unicode || unicodeSets; + const nFlag = (unicode && this.ecmaVersion >= 2018) || + unicodeSets || + Boolean(this._options.strict && this.ecmaVersion >= 2023); + const unicodeSetsMode = unicodeSets; + return { unicodeMode, nFlag, unicodeSetsMode }; + } + get strict() { + return Boolean(this._options.strict) || this._unicodeMode; + } + get ecmaVersion() { + var _a; + return (_a = this._options.ecmaVersion) !== null && _a !== void 0 ? _a : latestEcmaVersion; + } + onLiteralEnter(start) { + if (this._options.onLiteralEnter) { + this._options.onLiteralEnter(start); + } + } + onLiteralLeave(start, end) { + if (this._options.onLiteralLeave) { + this._options.onLiteralLeave(start, end); + } + } + onRegExpFlags(start, end, flags) { + if (this._options.onRegExpFlags) { + this._options.onRegExpFlags(start, end, flags); + } + if (this._options.onFlags) { + this._options.onFlags(start, end, flags.global, flags.ignoreCase, flags.multiline, flags.unicode, flags.sticky, flags.dotAll, flags.hasIndices); + } + } + onPatternEnter(start) { + if (this._options.onPatternEnter) { + this._options.onPatternEnter(start); + } + } + onPatternLeave(start, end) { + if (this._options.onPatternLeave) { + this._options.onPatternLeave(start, end); + } + } + onDisjunctionEnter(start) { + if (this._options.onDisjunctionEnter) { + this._options.onDisjunctionEnter(start); + } + } + onDisjunctionLeave(start, end) { + if (this._options.onDisjunctionLeave) { + this._options.onDisjunctionLeave(start, end); + } + } + onAlternativeEnter(start, index) { + if (this._options.onAlternativeEnter) { + this._options.onAlternativeEnter(start, index); + } + } + onAlternativeLeave(start, end, index) { + if (this._options.onAlternativeLeave) { + this._options.onAlternativeLeave(start, end, index); + } + } + onGroupEnter(start) { + if (this._options.onGroupEnter) { + this._options.onGroupEnter(start); + } + } + onGroupLeave(start, end) { + if (this._options.onGroupLeave) { + this._options.onGroupLeave(start, end); + } + } + onModifiersEnter(start) { + if (this._options.onModifiersEnter) { + this._options.onModifiersEnter(start); + } + } + onModifiersLeave(start, end) { + if (this._options.onModifiersLeave) { + this._options.onModifiersLeave(start, end); + } + } + onAddModifiers(start, end, flags) { + if (this._options.onAddModifiers) { + this._options.onAddModifiers(start, end, flags); + } + } + onRemoveModifiers(start, end, flags) { + if (this._options.onRemoveModifiers) { + this._options.onRemoveModifiers(start, end, flags); + } + } + onCapturingGroupEnter(start, name) { + if (this._options.onCapturingGroupEnter) { + this._options.onCapturingGroupEnter(start, name); + } + } + onCapturingGroupLeave(start, end, name) { + if (this._options.onCapturingGroupLeave) { + this._options.onCapturingGroupLeave(start, end, name); + } + } + onQuantifier(start, end, min, max, greedy) { + if (this._options.onQuantifier) { + this._options.onQuantifier(start, end, min, max, greedy); + } + } + onLookaroundAssertionEnter(start, kind, negate) { + if (this._options.onLookaroundAssertionEnter) { + this._options.onLookaroundAssertionEnter(start, kind, negate); + } + } + onLookaroundAssertionLeave(start, end, kind, negate) { + if (this._options.onLookaroundAssertionLeave) { + this._options.onLookaroundAssertionLeave(start, end, kind, negate); + } + } + onEdgeAssertion(start, end, kind) { + if (this._options.onEdgeAssertion) { + this._options.onEdgeAssertion(start, end, kind); + } + } + onWordBoundaryAssertion(start, end, kind, negate) { + if (this._options.onWordBoundaryAssertion) { + this._options.onWordBoundaryAssertion(start, end, kind, negate); + } + } + onAnyCharacterSet(start, end, kind) { + if (this._options.onAnyCharacterSet) { + this._options.onAnyCharacterSet(start, end, kind); + } + } + onEscapeCharacterSet(start, end, kind, negate) { + if (this._options.onEscapeCharacterSet) { + this._options.onEscapeCharacterSet(start, end, kind, negate); + } + } + onUnicodePropertyCharacterSet(start, end, kind, key, value, negate, strings) { + if (this._options.onUnicodePropertyCharacterSet) { + this._options.onUnicodePropertyCharacterSet(start, end, kind, key, value, negate, strings); + } + } + onCharacter(start, end, value) { + if (this._options.onCharacter) { + this._options.onCharacter(start, end, value); + } + } + onBackreference(start, end, ref) { + if (this._options.onBackreference) { + this._options.onBackreference(start, end, ref); + } + } + onCharacterClassEnter(start, negate, unicodeSets) { + if (this._options.onCharacterClassEnter) { + this._options.onCharacterClassEnter(start, negate, unicodeSets); + } + } + onCharacterClassLeave(start, end, negate) { + if (this._options.onCharacterClassLeave) { + this._options.onCharacterClassLeave(start, end, negate); + } + } + onCharacterClassRange(start, end, min, max) { + if (this._options.onCharacterClassRange) { + this._options.onCharacterClassRange(start, end, min, max); + } + } + onClassIntersection(start, end) { + if (this._options.onClassIntersection) { + this._options.onClassIntersection(start, end); + } + } + onClassSubtraction(start, end) { + if (this._options.onClassSubtraction) { + this._options.onClassSubtraction(start, end); + } + } + onClassStringDisjunctionEnter(start) { + if (this._options.onClassStringDisjunctionEnter) { + this._options.onClassStringDisjunctionEnter(start); + } + } + onClassStringDisjunctionLeave(start, end) { + if (this._options.onClassStringDisjunctionLeave) { + this._options.onClassStringDisjunctionLeave(start, end); + } + } + onStringAlternativeEnter(start, index) { + if (this._options.onStringAlternativeEnter) { + this._options.onStringAlternativeEnter(start, index); + } + } + onStringAlternativeLeave(start, end, index) { + if (this._options.onStringAlternativeLeave) { + this._options.onStringAlternativeLeave(start, end, index); + } + } + get index() { + return this._reader.index; + } + get currentCodePoint() { + return this._reader.currentCodePoint; + } + get nextCodePoint() { + return this._reader.nextCodePoint; + } + get nextCodePoint2() { + return this._reader.nextCodePoint2; + } + get nextCodePoint3() { + return this._reader.nextCodePoint3; + } + reset(source, start, end) { + this._reader.reset(source, start, end, this._unicodeMode); + } + rewind(index) { + this._reader.rewind(index); + } + advance() { + this._reader.advance(); + } + eat(cp) { + return this._reader.eat(cp); + } + eat2(cp1, cp2) { + return this._reader.eat2(cp1, cp2); + } + eat3(cp1, cp2, cp3) { + return this._reader.eat3(cp1, cp2, cp3); + } + raise(message, context) { + var _a, _b, _c; + throw newRegExpSyntaxError(this._srcCtx, { + unicode: (_a = context === null || context === void 0 ? void 0 : context.unicode) !== null && _a !== void 0 ? _a : (this._unicodeMode && !this._unicodeSetsMode), + unicodeSets: (_b = context === null || context === void 0 ? void 0 : context.unicodeSets) !== null && _b !== void 0 ? _b : this._unicodeSetsMode, + }, (_c = context === null || context === void 0 ? void 0 : context.index) !== null && _c !== void 0 ? _c : this.index, message); + } + eatRegExpBody() { + const start = this.index; + let inClass = false; + let escaped = false; + for (;;) { + const cp = this.currentCodePoint; + if (cp === -1 || isLineTerminator(cp)) { + const kind = inClass ? "character class" : "regular expression"; + this.raise(`Unterminated ${kind}`); + } + if (escaped) { + escaped = false; + } + else if (cp === REVERSE_SOLIDUS) { + escaped = true; + } + else if (cp === LEFT_SQUARE_BRACKET) { + inClass = true; + } + else if (cp === RIGHT_SQUARE_BRACKET) { + inClass = false; + } + else if ((cp === SOLIDUS && !inClass) || + (cp === ASTERISK && this.index === start)) { + break; + } + this.advance(); + } + return this.index !== start; + } + consumePattern() { + const start = this.index; + this._numCapturingParens = this.countCapturingParens(); + this._groupSpecifiers.clear(); + this._backreferenceNames.clear(); + this.onPatternEnter(start); + this.consumeDisjunction(); + const cp = this.currentCodePoint; + if (this.currentCodePoint !== -1) { + if (cp === RIGHT_PARENTHESIS) { + this.raise("Unmatched ')'"); + } + if (cp === REVERSE_SOLIDUS) { + this.raise("\\ at end of pattern"); + } + if (cp === RIGHT_SQUARE_BRACKET || cp === RIGHT_CURLY_BRACKET) { + this.raise("Lone quantifier brackets"); + } + const c = String.fromCodePoint(cp); + this.raise(`Unexpected character '${c}'`); + } + for (const name of this._backreferenceNames) { + if (!this._groupSpecifiers.hasInPattern(name)) { + this.raise("Invalid named capture referenced"); + } + } + this.onPatternLeave(start, this.index); + } + countCapturingParens() { + const start = this.index; + let inClass = false; + let escaped = false; + let count = 0; + let cp = 0; + while ((cp = this.currentCodePoint) !== -1) { + if (escaped) { + escaped = false; + } + else if (cp === REVERSE_SOLIDUS) { + escaped = true; + } + else if (cp === LEFT_SQUARE_BRACKET) { + inClass = true; + } + else if (cp === RIGHT_SQUARE_BRACKET) { + inClass = false; + } + else if (cp === LEFT_PARENTHESIS && + !inClass && + (this.nextCodePoint !== QUESTION_MARK || + (this.nextCodePoint2 === LESS_THAN_SIGN && + this.nextCodePoint3 !== EQUALS_SIGN && + this.nextCodePoint3 !== EXCLAMATION_MARK))) { + count += 1; + } + this.advance(); + } + this.rewind(start); + return count; + } + consumeDisjunction() { + const start = this.index; + let i = 0; + this._groupSpecifiers.enterDisjunction(); + this.onDisjunctionEnter(start); + do { + this.consumeAlternative(i++); + } while (this.eat(VERTICAL_LINE)); + if (this.consumeQuantifier(true)) { + this.raise("Nothing to repeat"); + } + if (this.eat(LEFT_CURLY_BRACKET)) { + this.raise("Lone quantifier brackets"); + } + this.onDisjunctionLeave(start, this.index); + this._groupSpecifiers.leaveDisjunction(); + } + consumeAlternative(i) { + const start = this.index; + this._groupSpecifiers.enterAlternative(i); + this.onAlternativeEnter(start, i); + while (this.currentCodePoint !== -1 && this.consumeTerm()) { + } + this.onAlternativeLeave(start, this.index, i); + } + consumeTerm() { + if (this._unicodeMode || this.strict) { + return (this.consumeAssertion() || + (this.consumeAtom() && this.consumeOptionalQuantifier())); + } + return ((this.consumeAssertion() && + (!this._lastAssertionIsQuantifiable || + this.consumeOptionalQuantifier())) || + (this.consumeExtendedAtom() && this.consumeOptionalQuantifier())); + } + consumeOptionalQuantifier() { + this.consumeQuantifier(); + return true; + } + consumeAssertion() { + const start = this.index; + this._lastAssertionIsQuantifiable = false; + if (this.eat(CIRCUMFLEX_ACCENT)) { + this.onEdgeAssertion(start, this.index, "start"); + return true; + } + if (this.eat(DOLLAR_SIGN)) { + this.onEdgeAssertion(start, this.index, "end"); + return true; + } + if (this.eat2(REVERSE_SOLIDUS, LATIN_CAPITAL_LETTER_B)) { + this.onWordBoundaryAssertion(start, this.index, "word", true); + return true; + } + if (this.eat2(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_B)) { + this.onWordBoundaryAssertion(start, this.index, "word", false); + return true; + } + if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) { + const lookbehind = this.ecmaVersion >= 2018 && this.eat(LESS_THAN_SIGN); + let negate = false; + if (this.eat(EQUALS_SIGN) || + (negate = this.eat(EXCLAMATION_MARK))) { + const kind = lookbehind ? "lookbehind" : "lookahead"; + this.onLookaroundAssertionEnter(start, kind, negate); + this.consumeDisjunction(); + if (!this.eat(RIGHT_PARENTHESIS)) { + this.raise("Unterminated group"); + } + this._lastAssertionIsQuantifiable = !lookbehind && !this.strict; + this.onLookaroundAssertionLeave(start, this.index, kind, negate); + return true; + } + this.rewind(start); + } + return false; + } + consumeQuantifier(noConsume = false) { + const start = this.index; + let min = 0; + let max = 0; + let greedy = false; + if (this.eat(ASTERISK)) { + min = 0; + max = Number.POSITIVE_INFINITY; + } + else if (this.eat(PLUS_SIGN)) { + min = 1; + max = Number.POSITIVE_INFINITY; + } + else if (this.eat(QUESTION_MARK)) { + min = 0; + max = 1; + } + else if (this.eatBracedQuantifier(noConsume)) { + ({ min, max } = this._lastRange); + } + else { + return false; + } + greedy = !this.eat(QUESTION_MARK); + if (!noConsume) { + this.onQuantifier(start, this.index, min, max, greedy); + } + return true; + } + eatBracedQuantifier(noError) { + const start = this.index; + if (this.eat(LEFT_CURLY_BRACKET)) { + if (this.eatDecimalDigits()) { + const min = this._lastIntValue; + let max = min; + if (this.eat(COMMA)) { + max = this.eatDecimalDigits() + ? this._lastIntValue + : Number.POSITIVE_INFINITY; + } + if (this.eat(RIGHT_CURLY_BRACKET)) { + if (!noError && max < min) { + this.raise("numbers out of order in {} quantifier"); + } + this._lastRange = { min, max }; + return true; + } + } + if (!noError && (this._unicodeMode || this.strict)) { + this.raise("Incomplete quantifier"); + } + this.rewind(start); + } + return false; + } + consumeAtom() { + return (this.consumePatternCharacter() || + this.consumeDot() || + this.consumeReverseSolidusAtomEscape() || + Boolean(this.consumeCharacterClass()) || + this.consumeCapturingGroup() || + this.consumeUncapturingGroup()); + } + consumeDot() { + if (this.eat(FULL_STOP)) { + this.onAnyCharacterSet(this.index - 1, this.index, "any"); + return true; + } + return false; + } + consumeReverseSolidusAtomEscape() { + const start = this.index; + if (this.eat(REVERSE_SOLIDUS)) { + if (this.consumeAtomEscape()) { + return true; + } + this.rewind(start); + } + return false; + } + consumeUncapturingGroup() { + const start = this.index; + if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) { + this.onGroupEnter(start); + if (this.ecmaVersion >= 2025) { + this.consumeModifiers(); + } + if (!this.eat(COLON)) { + this.rewind(start + 1); + this.raise("Invalid group"); + } + this.consumeDisjunction(); + if (!this.eat(RIGHT_PARENTHESIS)) { + this.raise("Unterminated group"); + } + this.onGroupLeave(start, this.index); + return true; + } + return false; + } + consumeModifiers() { + const start = this.index; + const hasAddModifiers = this.eatModifiers(); + const addModifiersEnd = this.index; + const hasHyphen = this.eat(HYPHEN_MINUS); + if (!hasAddModifiers && !hasHyphen) { + return false; + } + this.onModifiersEnter(start); + const addModifiers = this.parseModifiers(start, addModifiersEnd); + this.onAddModifiers(start, addModifiersEnd, addModifiers); + if (hasHyphen) { + const modifiersStart = this.index; + if (!this.eatModifiers() && + !hasAddModifiers && + this.currentCodePoint === COLON) { + this.raise("Invalid empty flags"); + } + const modifiers = this.parseModifiers(modifiersStart, this.index); + for (const [flagName] of Object.entries(modifiers).filter(([, enable]) => enable)) { + if (addModifiers[flagName]) { + this.raise(`Duplicated flag '${String.fromCodePoint(FLAG_PROP_TO_CODEPOINT[flagName])}'`); + } + } + this.onRemoveModifiers(modifiersStart, this.index, modifiers); + } + this.onModifiersLeave(start, this.index); + return true; + } + consumeCapturingGroup() { + const start = this.index; + if (this.eat(LEFT_PARENTHESIS)) { + let name = null; + if (this.ecmaVersion >= 2018) { + if (this.consumeGroupSpecifier()) { + name = this._lastStrValue; + } + else if (this.currentCodePoint === QUESTION_MARK) { + this.rewind(start); + return false; + } + } + else if (this.currentCodePoint === QUESTION_MARK) { + this.rewind(start); + return false; + } + this.onCapturingGroupEnter(start, name); + this.consumeDisjunction(); + if (!this.eat(RIGHT_PARENTHESIS)) { + this.raise("Unterminated group"); + } + this.onCapturingGroupLeave(start, this.index, name); + return true; + } + return false; + } + consumeExtendedAtom() { + return (this.consumeDot() || + this.consumeReverseSolidusAtomEscape() || + this.consumeReverseSolidusFollowedByC() || + Boolean(this.consumeCharacterClass()) || + this.consumeCapturingGroup() || + this.consumeUncapturingGroup() || + this.consumeInvalidBracedQuantifier() || + this.consumeExtendedPatternCharacter()); + } + consumeReverseSolidusFollowedByC() { + const start = this.index; + if (this.currentCodePoint === REVERSE_SOLIDUS && + this.nextCodePoint === LATIN_SMALL_LETTER_C) { + this._lastIntValue = this.currentCodePoint; + this.advance(); + this.onCharacter(start, this.index, REVERSE_SOLIDUS); + return true; + } + return false; + } + consumeInvalidBracedQuantifier() { + if (this.eatBracedQuantifier(true)) { + this.raise("Nothing to repeat"); + } + return false; + } + consumePatternCharacter() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && !isSyntaxCharacter(cp)) { + this.advance(); + this.onCharacter(start, this.index, cp); + return true; + } + return false; + } + consumeExtendedPatternCharacter() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && + cp !== CIRCUMFLEX_ACCENT && + cp !== DOLLAR_SIGN && + cp !== REVERSE_SOLIDUS && + cp !== FULL_STOP && + cp !== ASTERISK && + cp !== PLUS_SIGN && + cp !== QUESTION_MARK && + cp !== LEFT_PARENTHESIS && + cp !== RIGHT_PARENTHESIS && + cp !== LEFT_SQUARE_BRACKET && + cp !== VERTICAL_LINE) { + this.advance(); + this.onCharacter(start, this.index, cp); + return true; + } + return false; + } + consumeGroupSpecifier() { + const start = this.index; + if (this.eat(QUESTION_MARK)) { + if (this.eatGroupName()) { + if (!this._groupSpecifiers.hasInScope(this._lastStrValue)) { + this._groupSpecifiers.addToScope(this._lastStrValue); + return true; + } + this.raise("Duplicate capture group name"); + } + this.rewind(start); + } + return false; + } + consumeAtomEscape() { + if (this.consumeBackreference() || + this.consumeCharacterClassEscape() || + this.consumeCharacterEscape() || + (this._nFlag && this.consumeKGroupName())) { + return true; + } + if (this.strict || this._unicodeMode) { + this.raise("Invalid escape"); + } + return false; + } + consumeBackreference() { + const start = this.index; + if (this.eatDecimalEscape()) { + const n = this._lastIntValue; + if (n <= this._numCapturingParens) { + this.onBackreference(start - 1, this.index, n); + return true; + } + if (this.strict || this._unicodeMode) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + consumeCharacterClassEscape() { + var _a; + const start = this.index; + if (this.eat(LATIN_SMALL_LETTER_D)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "digit", false); + return {}; + } + if (this.eat(LATIN_CAPITAL_LETTER_D)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "digit", true); + return {}; + } + if (this.eat(LATIN_SMALL_LETTER_S)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "space", false); + return {}; + } + if (this.eat(LATIN_CAPITAL_LETTER_S)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "space", true); + return {}; + } + if (this.eat(LATIN_SMALL_LETTER_W)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "word", false); + return {}; + } + if (this.eat(LATIN_CAPITAL_LETTER_W)) { + this._lastIntValue = -1; + this.onEscapeCharacterSet(start - 1, this.index, "word", true); + return {}; + } + let negate = false; + if (this._unicodeMode && + this.ecmaVersion >= 2018 && + (this.eat(LATIN_SMALL_LETTER_P) || + (negate = this.eat(LATIN_CAPITAL_LETTER_P)))) { + this._lastIntValue = -1; + let result = null; + if (this.eat(LEFT_CURLY_BRACKET) && + (result = this.eatUnicodePropertyValueExpression()) && + this.eat(RIGHT_CURLY_BRACKET)) { + if (negate && result.strings) { + this.raise("Invalid property name"); + } + this.onUnicodePropertyCharacterSet(start - 1, this.index, "property", result.key, result.value, negate, (_a = result.strings) !== null && _a !== void 0 ? _a : false); + return { mayContainStrings: result.strings }; + } + this.raise("Invalid property name"); + } + return null; + } + consumeCharacterEscape() { + const start = this.index; + if (this.eatControlEscape() || + this.eatCControlLetter() || + this.eatZero() || + this.eatHexEscapeSequence() || + this.eatRegExpUnicodeEscapeSequence() || + (!this.strict && + !this._unicodeMode && + this.eatLegacyOctalEscapeSequence()) || + this.eatIdentityEscape()) { + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + return false; + } + consumeKGroupName() { + const start = this.index; + if (this.eat(LATIN_SMALL_LETTER_K)) { + if (this.eatGroupName()) { + const groupName = this._lastStrValue; + this._backreferenceNames.add(groupName); + this.onBackreference(start - 1, this.index, groupName); + return true; + } + this.raise("Invalid named reference"); + } + return false; + } + consumeCharacterClass() { + const start = this.index; + if (this.eat(LEFT_SQUARE_BRACKET)) { + const negate = this.eat(CIRCUMFLEX_ACCENT); + this.onCharacterClassEnter(start, negate, this._unicodeSetsMode); + const result = this.consumeClassContents(); + if (!this.eat(RIGHT_SQUARE_BRACKET)) { + if (this.currentCodePoint === -1) { + this.raise("Unterminated character class"); + } + this.raise("Invalid character in character class"); + } + if (negate && result.mayContainStrings) { + this.raise("Negated character class may contain strings"); + } + this.onCharacterClassLeave(start, this.index, negate); + return result; + } + return null; + } + consumeClassContents() { + if (this._unicodeSetsMode) { + if (this.currentCodePoint === RIGHT_SQUARE_BRACKET) { + return {}; + } + const result = this.consumeClassSetExpression(); + return result; + } + const strict = this.strict || this._unicodeMode; + for (;;) { + const rangeStart = this.index; + if (!this.consumeClassAtom()) { + break; + } + const min = this._lastIntValue; + if (!this.eat(HYPHEN_MINUS)) { + continue; + } + this.onCharacter(this.index - 1, this.index, HYPHEN_MINUS); + if (!this.consumeClassAtom()) { + break; + } + const max = this._lastIntValue; + if (min === -1 || max === -1) { + if (strict) { + this.raise("Invalid character class"); + } + continue; + } + if (min > max) { + this.raise("Range out of order in character class"); + } + this.onCharacterClassRange(rangeStart, this.index, min, max); + } + return {}; + } + consumeClassAtom() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== -1 && + cp !== REVERSE_SOLIDUS && + cp !== RIGHT_SQUARE_BRACKET) { + this.advance(); + this._lastIntValue = cp; + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + if (this.eat(REVERSE_SOLIDUS)) { + if (this.consumeClassEscape()) { + return true; + } + if (!this.strict && + this.currentCodePoint === LATIN_SMALL_LETTER_C) { + this._lastIntValue = REVERSE_SOLIDUS; + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + if (this.strict || this._unicodeMode) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + consumeClassEscape() { + const start = this.index; + if (this.eat(LATIN_SMALL_LETTER_B)) { + this._lastIntValue = BACKSPACE; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + if (this._unicodeMode && this.eat(HYPHEN_MINUS)) { + this._lastIntValue = HYPHEN_MINUS; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + let cp = 0; + if (!this.strict && + !this._unicodeMode && + this.currentCodePoint === LATIN_SMALL_LETTER_C && + (isDecimalDigit((cp = this.nextCodePoint)) || cp === LOW_LINE)) { + this.advance(); + this.advance(); + this._lastIntValue = cp % 0x20; + this.onCharacter(start - 1, this.index, this._lastIntValue); + return true; + } + return (Boolean(this.consumeCharacterClassEscape()) || + this.consumeCharacterEscape()); + } + consumeClassSetExpression() { + const start = this.index; + let mayContainStrings = false; + let result = null; + if (this.consumeClassSetCharacter()) { + if (this.consumeClassSetRangeFromOperator(start)) { + this.consumeClassUnionRight({}); + return {}; + } + mayContainStrings = false; + } + else if ((result = this.consumeClassSetOperand())) { + mayContainStrings = result.mayContainStrings; + } + else { + const cp = this.currentCodePoint; + if (cp === REVERSE_SOLIDUS) { + this.advance(); + this.raise("Invalid escape"); + } + if (cp === this.nextCodePoint && + isClassSetReservedDoublePunctuatorCharacter(cp)) { + this.raise("Invalid set operation in character class"); + } + this.raise("Invalid character in character class"); + } + if (this.eat2(AMPERSAND, AMPERSAND)) { + while (this.currentCodePoint !== AMPERSAND && + (result = this.consumeClassSetOperand())) { + this.onClassIntersection(start, this.index); + if (!result.mayContainStrings) { + mayContainStrings = false; + } + if (this.eat2(AMPERSAND, AMPERSAND)) { + continue; + } + return { mayContainStrings }; + } + this.raise("Invalid character in character class"); + } + if (this.eat2(HYPHEN_MINUS, HYPHEN_MINUS)) { + while (this.consumeClassSetOperand()) { + this.onClassSubtraction(start, this.index); + if (this.eat2(HYPHEN_MINUS, HYPHEN_MINUS)) { + continue; + } + return { mayContainStrings }; + } + this.raise("Invalid character in character class"); + } + return this.consumeClassUnionRight({ mayContainStrings }); + } + consumeClassUnionRight(leftResult) { + let mayContainStrings = leftResult.mayContainStrings; + for (;;) { + const start = this.index; + if (this.consumeClassSetCharacter()) { + this.consumeClassSetRangeFromOperator(start); + continue; + } + const result = this.consumeClassSetOperand(); + if (result) { + if (result.mayContainStrings) { + mayContainStrings = true; + } + continue; + } + break; + } + return { mayContainStrings }; + } + consumeClassSetRangeFromOperator(start) { + const currentStart = this.index; + const min = this._lastIntValue; + if (this.eat(HYPHEN_MINUS)) { + if (this.consumeClassSetCharacter()) { + const max = this._lastIntValue; + if (min === -1 || max === -1) { + this.raise("Invalid character class"); + } + if (min > max) { + this.raise("Range out of order in character class"); + } + this.onCharacterClassRange(start, this.index, min, max); + return true; + } + this.rewind(currentStart); + } + return false; + } + consumeClassSetOperand() { + let result = null; + if ((result = this.consumeNestedClass())) { + return result; + } + if ((result = this.consumeClassStringDisjunction())) { + return result; + } + if (this.consumeClassSetCharacter()) { + return {}; + } + return null; + } + consumeNestedClass() { + const start = this.index; + if (this.eat(LEFT_SQUARE_BRACKET)) { + const negate = this.eat(CIRCUMFLEX_ACCENT); + this.onCharacterClassEnter(start, negate, true); + const result = this.consumeClassContents(); + if (!this.eat(RIGHT_SQUARE_BRACKET)) { + this.raise("Unterminated character class"); + } + if (negate && result.mayContainStrings) { + this.raise("Negated character class may contain strings"); + } + this.onCharacterClassLeave(start, this.index, negate); + return result; + } + if (this.eat(REVERSE_SOLIDUS)) { + const result = this.consumeCharacterClassEscape(); + if (result) { + return result; + } + this.rewind(start); + } + return null; + } + consumeClassStringDisjunction() { + const start = this.index; + if (this.eat3(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_Q, LEFT_CURLY_BRACKET)) { + this.onClassStringDisjunctionEnter(start); + let i = 0; + let mayContainStrings = false; + do { + if (this.consumeClassString(i++).mayContainStrings) { + mayContainStrings = true; + } + } while (this.eat(VERTICAL_LINE)); + if (this.eat(RIGHT_CURLY_BRACKET)) { + this.onClassStringDisjunctionLeave(start, this.index); + return { mayContainStrings }; + } + this.raise("Unterminated class string disjunction"); + } + return null; + } + consumeClassString(i) { + const start = this.index; + let count = 0; + this.onStringAlternativeEnter(start, i); + while (this.currentCodePoint !== -1 && + this.consumeClassSetCharacter()) { + count++; + } + this.onStringAlternativeLeave(start, this.index, i); + return { mayContainStrings: count !== 1 }; + } + consumeClassSetCharacter() { + const start = this.index; + const cp = this.currentCodePoint; + if (cp !== this.nextCodePoint || + !isClassSetReservedDoublePunctuatorCharacter(cp)) { + if (cp !== -1 && !isClassSetSyntaxCharacter(cp)) { + this._lastIntValue = cp; + this.advance(); + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + } + if (this.eat(REVERSE_SOLIDUS)) { + if (this.consumeCharacterEscape()) { + return true; + } + if (isClassSetReservedPunctuator(this.currentCodePoint)) { + this._lastIntValue = this.currentCodePoint; + this.advance(); + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + if (this.eat(LATIN_SMALL_LETTER_B)) { + this._lastIntValue = BACKSPACE; + this.onCharacter(start, this.index, this._lastIntValue); + return true; + } + this.rewind(start); + } + return false; + } + eatGroupName() { + if (this.eat(LESS_THAN_SIGN)) { + if (this.eatRegExpIdentifierName() && this.eat(GREATER_THAN_SIGN)) { + return true; + } + this.raise("Invalid capture group name"); + } + return false; + } + eatRegExpIdentifierName() { + if (this.eatRegExpIdentifierStart()) { + this._lastStrValue = String.fromCodePoint(this._lastIntValue); + while (this.eatRegExpIdentifierPart()) { + this._lastStrValue += String.fromCodePoint(this._lastIntValue); + } + return true; + } + return false; + } + eatRegExpIdentifierStart() { + const start = this.index; + const forceUFlag = !this._unicodeMode && this.ecmaVersion >= 2020; + let cp = this.currentCodePoint; + this.advance(); + if (cp === REVERSE_SOLIDUS && + this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { + cp = this._lastIntValue; + } + else if (forceUFlag && + isLeadSurrogate(cp) && + isTrailSurrogate(this.currentCodePoint)) { + cp = combineSurrogatePair(cp, this.currentCodePoint); + this.advance(); + } + if (isIdentifierStartChar(cp)) { + this._lastIntValue = cp; + return true; + } + if (this.index !== start) { + this.rewind(start); + } + return false; + } + eatRegExpIdentifierPart() { + const start = this.index; + const forceUFlag = !this._unicodeMode && this.ecmaVersion >= 2020; + let cp = this.currentCodePoint; + this.advance(); + if (cp === REVERSE_SOLIDUS && + this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { + cp = this._lastIntValue; + } + else if (forceUFlag && + isLeadSurrogate(cp) && + isTrailSurrogate(this.currentCodePoint)) { + cp = combineSurrogatePair(cp, this.currentCodePoint); + this.advance(); + } + if (isIdentifierPartChar(cp)) { + this._lastIntValue = cp; + return true; + } + if (this.index !== start) { + this.rewind(start); + } + return false; + } + eatCControlLetter() { + const start = this.index; + if (this.eat(LATIN_SMALL_LETTER_C)) { + if (this.eatControlLetter()) { + return true; + } + this.rewind(start); + } + return false; + } + eatZero() { + if (this.currentCodePoint === DIGIT_ZERO && + !isDecimalDigit(this.nextCodePoint)) { + this._lastIntValue = 0; + this.advance(); + return true; + } + return false; + } + eatControlEscape() { + if (this.eat(LATIN_SMALL_LETTER_F)) { + this._lastIntValue = FORM_FEED; + return true; + } + if (this.eat(LATIN_SMALL_LETTER_N)) { + this._lastIntValue = LINE_FEED; + return true; + } + if (this.eat(LATIN_SMALL_LETTER_R)) { + this._lastIntValue = CARRIAGE_RETURN; + return true; + } + if (this.eat(LATIN_SMALL_LETTER_T)) { + this._lastIntValue = CHARACTER_TABULATION; + return true; + } + if (this.eat(LATIN_SMALL_LETTER_V)) { + this._lastIntValue = LINE_TABULATION; + return true; + } + return false; + } + eatControlLetter() { + const cp = this.currentCodePoint; + if (isLatinLetter(cp)) { + this.advance(); + this._lastIntValue = cp % 0x20; + return true; + } + return false; + } + eatRegExpUnicodeEscapeSequence(forceUFlag = false) { + const start = this.index; + const uFlag = forceUFlag || this._unicodeMode; + if (this.eat(LATIN_SMALL_LETTER_U)) { + if ((uFlag && this.eatRegExpUnicodeSurrogatePairEscape()) || + this.eatFixedHexDigits(4) || + (uFlag && this.eatRegExpUnicodeCodePointEscape())) { + return true; + } + if (this.strict || uFlag) { + this.raise("Invalid unicode escape"); + } + this.rewind(start); + } + return false; + } + eatRegExpUnicodeSurrogatePairEscape() { + const start = this.index; + if (this.eatFixedHexDigits(4)) { + const lead = this._lastIntValue; + if (isLeadSurrogate(lead) && + this.eat(REVERSE_SOLIDUS) && + this.eat(LATIN_SMALL_LETTER_U) && + this.eatFixedHexDigits(4)) { + const trail = this._lastIntValue; + if (isTrailSurrogate(trail)) { + this._lastIntValue = combineSurrogatePair(lead, trail); + return true; + } + } + this.rewind(start); + } + return false; + } + eatRegExpUnicodeCodePointEscape() { + const start = this.index; + if (this.eat(LEFT_CURLY_BRACKET) && + this.eatHexDigits() && + this.eat(RIGHT_CURLY_BRACKET) && + isValidUnicode(this._lastIntValue)) { + return true; + } + this.rewind(start); + return false; + } + eatIdentityEscape() { + const cp = this.currentCodePoint; + if (this.isValidIdentityEscape(cp)) { + this._lastIntValue = cp; + this.advance(); + return true; + } + return false; + } + isValidIdentityEscape(cp) { + if (cp === -1) { + return false; + } + if (this._unicodeMode) { + return isSyntaxCharacter(cp) || cp === SOLIDUS; + } + if (this.strict) { + return !isIdContinue(cp); + } + if (this._nFlag) { + return !(cp === LATIN_SMALL_LETTER_C || cp === LATIN_SMALL_LETTER_K); + } + return cp !== LATIN_SMALL_LETTER_C; + } + eatDecimalEscape() { + this._lastIntValue = 0; + let cp = this.currentCodePoint; + if (cp >= DIGIT_ONE && cp <= DIGIT_NINE) { + do { + this._lastIntValue = 10 * this._lastIntValue + (cp - DIGIT_ZERO); + this.advance(); + } while ((cp = this.currentCodePoint) >= DIGIT_ZERO && + cp <= DIGIT_NINE); + return true; + } + return false; + } + eatUnicodePropertyValueExpression() { + const start = this.index; + if (this.eatUnicodePropertyName() && this.eat(EQUALS_SIGN)) { + const key = this._lastStrValue; + if (this.eatUnicodePropertyValue()) { + const value = this._lastStrValue; + if (isValidUnicodeProperty(this.ecmaVersion, key, value)) { + return { + key, + value: value || null, + }; + } + this.raise("Invalid property name"); + } + } + this.rewind(start); + if (this.eatLoneUnicodePropertyNameOrValue()) { + const nameOrValue = this._lastStrValue; + if (isValidUnicodeProperty(this.ecmaVersion, "General_Category", nameOrValue)) { + return { + key: "General_Category", + value: nameOrValue || null, + }; + } + if (isValidLoneUnicodeProperty(this.ecmaVersion, nameOrValue)) { + return { + key: nameOrValue, + value: null, + }; + } + if (this._unicodeSetsMode && + isValidLoneUnicodePropertyOfString(this.ecmaVersion, nameOrValue)) { + return { + key: nameOrValue, + value: null, + strings: true, + }; + } + this.raise("Invalid property name"); + } + return null; + } + eatUnicodePropertyName() { + this._lastStrValue = ""; + while (isUnicodePropertyNameCharacter(this.currentCodePoint)) { + this._lastStrValue += String.fromCodePoint(this.currentCodePoint); + this.advance(); + } + return this._lastStrValue !== ""; + } + eatUnicodePropertyValue() { + this._lastStrValue = ""; + while (isUnicodePropertyValueCharacter(this.currentCodePoint)) { + this._lastStrValue += String.fromCodePoint(this.currentCodePoint); + this.advance(); + } + return this._lastStrValue !== ""; + } + eatLoneUnicodePropertyNameOrValue() { + return this.eatUnicodePropertyValue(); + } + eatHexEscapeSequence() { + const start = this.index; + if (this.eat(LATIN_SMALL_LETTER_X)) { + if (this.eatFixedHexDigits(2)) { + return true; + } + if (this._unicodeMode || this.strict) { + this.raise("Invalid escape"); + } + this.rewind(start); + } + return false; + } + eatDecimalDigits() { + const start = this.index; + this._lastIntValue = 0; + while (isDecimalDigit(this.currentCodePoint)) { + this._lastIntValue = + 10 * this._lastIntValue + digitToInt(this.currentCodePoint); + this.advance(); + } + return this.index !== start; + } + eatHexDigits() { + const start = this.index; + this._lastIntValue = 0; + while (isHexDigit(this.currentCodePoint)) { + this._lastIntValue = + 16 * this._lastIntValue + digitToInt(this.currentCodePoint); + this.advance(); + } + return this.index !== start; + } + eatLegacyOctalEscapeSequence() { + if (this.eatOctalDigit()) { + const n1 = this._lastIntValue; + if (this.eatOctalDigit()) { + const n2 = this._lastIntValue; + if (n1 <= 3 && this.eatOctalDigit()) { + this._lastIntValue = n1 * 64 + n2 * 8 + this._lastIntValue; + } + else { + this._lastIntValue = n1 * 8 + n2; + } + } + else { + this._lastIntValue = n1; + } + return true; + } + return false; + } + eatOctalDigit() { + const cp = this.currentCodePoint; + if (isOctalDigit(cp)) { + this.advance(); + this._lastIntValue = cp - DIGIT_ZERO; + return true; + } + this._lastIntValue = 0; + return false; + } + eatFixedHexDigits(length) { + const start = this.index; + this._lastIntValue = 0; + for (let i = 0; i < length; ++i) { + const cp = this.currentCodePoint; + if (!isHexDigit(cp)) { + this.rewind(start); + return false; + } + this._lastIntValue = 16 * this._lastIntValue + digitToInt(cp); + this.advance(); + } + return true; + } + eatModifiers() { + let ate = false; + while (isRegularExpressionModifier(this.currentCodePoint)) { + this.advance(); + ate = true; + } + return ate; + } + parseModifiers(start, end) { + const { ignoreCase, multiline, dotAll } = this.parseFlags(this._reader.source, start, end); + return { ignoreCase, multiline, dotAll }; + } + parseFlags(source, start, end) { + const flags = { + global: false, + ignoreCase: false, + multiline: false, + unicode: false, + sticky: false, + dotAll: false, + hasIndices: false, + unicodeSets: false, + }; + const validFlags = new Set(); + validFlags.add(LATIN_SMALL_LETTER_G); + validFlags.add(LATIN_SMALL_LETTER_I); + validFlags.add(LATIN_SMALL_LETTER_M); + if (this.ecmaVersion >= 2015) { + validFlags.add(LATIN_SMALL_LETTER_U); + validFlags.add(LATIN_SMALL_LETTER_Y); + if (this.ecmaVersion >= 2018) { + validFlags.add(LATIN_SMALL_LETTER_S); + if (this.ecmaVersion >= 2022) { + validFlags.add(LATIN_SMALL_LETTER_D); + if (this.ecmaVersion >= 2024) { + validFlags.add(LATIN_SMALL_LETTER_V); + } + } + } + } + for (let i = start; i < end; ++i) { + const flag = source.charCodeAt(i); + if (validFlags.has(flag)) { + const prop = FLAG_CODEPOINT_TO_PROP[flag]; + if (flags[prop]) { + this.raise(`Duplicated flag '${source[i]}'`, { + index: start, + }); + } + flags[prop] = true; + } + else { + this.raise(`Invalid flag '${source[i]}'`, { index: start }); + } + } + return flags; + } +} + +const DUMMY_PATTERN = {}; +const DUMMY_FLAGS = {}; +const DUMMY_CAPTURING_GROUP = {}; +function isClassSetOperand(node) { + return (node.type === "Character" || + node.type === "CharacterSet" || + node.type === "CharacterClass" || + node.type === "ExpressionCharacterClass" || + node.type === "ClassStringDisjunction"); +} +class RegExpParserState { + constructor(options) { + var _a; + this._node = DUMMY_PATTERN; + this._expressionBufferMap = new Map(); + this._flags = DUMMY_FLAGS; + this._backreferences = []; + this._capturingGroups = []; + this.source = ""; + this.strict = Boolean(options === null || options === void 0 ? void 0 : options.strict); + this.ecmaVersion = (_a = options === null || options === void 0 ? void 0 : options.ecmaVersion) !== null && _a !== void 0 ? _a : latestEcmaVersion; + } + get pattern() { + if (this._node.type !== "Pattern") { + throw new Error("UnknownError"); + } + return this._node; + } + get flags() { + if (this._flags.type !== "Flags") { + throw new Error("UnknownError"); + } + return this._flags; + } + onRegExpFlags(start, end, { global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices, unicodeSets, }) { + this._flags = { + type: "Flags", + parent: null, + start, + end, + raw: this.source.slice(start, end), + global, + ignoreCase, + multiline, + unicode, + sticky, + dotAll, + hasIndices, + unicodeSets, + }; + } + onPatternEnter(start) { + this._node = { + type: "Pattern", + parent: null, + start, + end: start, + raw: "", + alternatives: [], + }; + this._backreferences.length = 0; + this._capturingGroups.length = 0; + } + onPatternLeave(start, end) { + this._node.end = end; + this._node.raw = this.source.slice(start, end); + for (const reference of this._backreferences) { + const ref = reference.ref; + const groups = typeof ref === "number" + ? [this._capturingGroups[ref - 1]] + : this._capturingGroups.filter((g) => g.name === ref); + if (groups.length === 1) { + const group = groups[0]; + reference.ambiguous = false; + reference.resolved = group; + } + else { + reference.ambiguous = true; + reference.resolved = groups; + } + for (const group of groups) { + group.references.push(reference); + } + } + } + onAlternativeEnter(start) { + const parent = this._node; + if (parent.type !== "Assertion" && + parent.type !== "CapturingGroup" && + parent.type !== "Group" && + parent.type !== "Pattern") { + throw new Error("UnknownError"); + } + this._node = { + type: "Alternative", + parent, + start, + end: start, + raw: "", + elements: [], + }; + parent.alternatives.push(this._node); + } + onAlternativeLeave(start, end) { + const node = this._node; + if (node.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onGroupEnter(start) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const group = { + type: "Group", + parent, + start, + end: start, + raw: "", + modifiers: null, + alternatives: [], + }; + this._node = group; + parent.elements.push(this._node); + } + onGroupLeave(start, end) { + const node = this._node; + if (node.type !== "Group" || node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onModifiersEnter(start) { + const parent = this._node; + if (parent.type !== "Group") { + throw new Error("UnknownError"); + } + this._node = { + type: "Modifiers", + parent, + start, + end: start, + raw: "", + add: null, + remove: null, + }; + parent.modifiers = this._node; + } + onModifiersLeave(start, end) { + const node = this._node; + if (node.type !== "Modifiers" || node.parent.type !== "Group") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onAddModifiers(start, end, { ignoreCase, multiline, dotAll, }) { + const parent = this._node; + if (parent.type !== "Modifiers") { + throw new Error("UnknownError"); + } + parent.add = { + type: "ModifierFlags", + parent, + start, + end, + raw: this.source.slice(start, end), + ignoreCase, + multiline, + dotAll, + }; + } + onRemoveModifiers(start, end, { ignoreCase, multiline, dotAll, }) { + const parent = this._node; + if (parent.type !== "Modifiers") { + throw new Error("UnknownError"); + } + parent.remove = { + type: "ModifierFlags", + parent, + start, + end, + raw: this.source.slice(start, end), + ignoreCase, + multiline, + dotAll, + }; + } + onCapturingGroupEnter(start, name) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + this._node = { + type: "CapturingGroup", + parent, + start, + end: start, + raw: "", + name, + alternatives: [], + references: [], + }; + parent.elements.push(this._node); + this._capturingGroups.push(this._node); + } + onCapturingGroupLeave(start, end) { + const node = this._node; + if (node.type !== "CapturingGroup" || + node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onQuantifier(start, end, min, max, greedy) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const element = parent.elements.pop(); + if (element == null || + element.type === "Quantifier" || + (element.type === "Assertion" && element.kind !== "lookahead")) { + throw new Error("UnknownError"); + } + const node = { + type: "Quantifier", + parent, + start: element.start, + end, + raw: this.source.slice(element.start, end), + min, + max, + greedy, + element, + }; + parent.elements.push(node); + element.parent = node; + } + onLookaroundAssertionEnter(start, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const node = (this._node = { + type: "Assertion", + parent, + start, + end: start, + raw: "", + kind, + negate, + alternatives: [], + }); + parent.elements.push(node); + } + onLookaroundAssertionLeave(start, end) { + const node = this._node; + if (node.type !== "Assertion" || node.parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onEdgeAssertion(start, end, kind) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Assertion", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + }); + } + onWordBoundaryAssertion(start, end, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Assertion", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + negate, + }); + } + onAnyCharacterSet(start, end, kind) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "CharacterSet", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + }); + } + onEscapeCharacterSet(start, end, kind, negate) { + const parent = this._node; + if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "CharacterSet", + parent, + start, + end, + raw: this.source.slice(start, end), + kind, + negate, + }); + } + onUnicodePropertyCharacterSet(start, end, kind, key, value, negate, strings) { + const parent = this._node; + if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + const base = { + type: "CharacterSet", + parent: null, + start, + end, + raw: this.source.slice(start, end), + kind, + strings: null, + key, + }; + if (strings) { + if ((parent.type === "CharacterClass" && !parent.unicodeSets) || + negate || + value !== null) { + throw new Error("UnknownError"); + } + parent.elements.push(Object.assign(Object.assign({}, base), { parent, strings, value, negate })); + } + else { + parent.elements.push(Object.assign(Object.assign({}, base), { parent, strings, value, negate })); + } + } + onCharacter(start, end, value) { + const parent = this._node; + if (parent.type !== "Alternative" && + parent.type !== "CharacterClass" && + parent.type !== "StringAlternative") { + throw new Error("UnknownError"); + } + parent.elements.push({ + type: "Character", + parent, + start, + end, + raw: this.source.slice(start, end), + value, + }); + } + onBackreference(start, end, ref) { + const parent = this._node; + if (parent.type !== "Alternative") { + throw new Error("UnknownError"); + } + const node = { + type: "Backreference", + parent, + start, + end, + raw: this.source.slice(start, end), + ref, + ambiguous: false, + resolved: DUMMY_CAPTURING_GROUP, + }; + parent.elements.push(node); + this._backreferences.push(node); + } + onCharacterClassEnter(start, negate, unicodeSets) { + const parent = this._node; + const base = { + type: "CharacterClass", + parent, + start, + end: start, + raw: "", + unicodeSets, + negate, + elements: [], + }; + if (parent.type === "Alternative") { + const node = Object.assign(Object.assign({}, base), { parent }); + this._node = node; + parent.elements.push(node); + } + else if (parent.type === "CharacterClass" && + parent.unicodeSets && + unicodeSets) { + const node = Object.assign(Object.assign({}, base), { parent, + unicodeSets }); + this._node = node; + parent.elements.push(node); + } + else { + throw new Error("UnknownError"); + } + } + onCharacterClassLeave(start, end) { + const node = this._node; + if (node.type !== "CharacterClass" || + (node.parent.type !== "Alternative" && + node.parent.type !== "CharacterClass")) { + throw new Error("UnknownError"); + } + const parent = node.parent; + node.end = end; + node.raw = this.source.slice(start, end); + this._node = parent; + const expression = this._expressionBufferMap.get(node); + if (!expression) { + return; + } + if (node.elements.length > 0) { + throw new Error("UnknownError"); + } + this._expressionBufferMap.delete(node); + const newNode = { + type: "ExpressionCharacterClass", + parent, + start: node.start, + end: node.end, + raw: node.raw, + negate: node.negate, + expression, + }; + expression.parent = newNode; + if (node !== parent.elements.pop()) { + throw new Error("UnknownError"); + } + parent.elements.push(newNode); + } + onCharacterClassRange(start, end) { + const parent = this._node; + if (parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + const elements = parent.elements; + const max = elements.pop(); + if (!max || max.type !== "Character") { + throw new Error("UnknownError"); + } + if (!parent.unicodeSets) { + const hyphen = elements.pop(); + if (!hyphen || + hyphen.type !== "Character" || + hyphen.value !== HYPHEN_MINUS) { + throw new Error("UnknownError"); + } + } + const min = elements.pop(); + if (!min || min.type !== "Character") { + throw new Error("UnknownError"); + } + const node = { + type: "CharacterClassRange", + parent, + start, + end, + raw: this.source.slice(start, end), + min, + max, + }; + min.parent = node; + max.parent = node; + elements.push(node); + } + onClassIntersection(start, end) { + var _a; + const parent = this._node; + if (parent.type !== "CharacterClass" || !parent.unicodeSets) { + throw new Error("UnknownError"); + } + const right = parent.elements.pop(); + const left = (_a = this._expressionBufferMap.get(parent)) !== null && _a !== void 0 ? _a : parent.elements.pop(); + if (!left || + !right || + left.type === "ClassSubtraction" || + (left.type !== "ClassIntersection" && !isClassSetOperand(left)) || + !isClassSetOperand(right)) { + throw new Error("UnknownError"); + } + const node = { + type: "ClassIntersection", + parent: parent, + start, + end, + raw: this.source.slice(start, end), + left, + right, + }; + left.parent = node; + right.parent = node; + this._expressionBufferMap.set(parent, node); + } + onClassSubtraction(start, end) { + var _a; + const parent = this._node; + if (parent.type !== "CharacterClass" || !parent.unicodeSets) { + throw new Error("UnknownError"); + } + const right = parent.elements.pop(); + const left = (_a = this._expressionBufferMap.get(parent)) !== null && _a !== void 0 ? _a : parent.elements.pop(); + if (!left || + !right || + left.type === "ClassIntersection" || + (left.type !== "ClassSubtraction" && !isClassSetOperand(left)) || + !isClassSetOperand(right)) { + throw new Error("UnknownError"); + } + const node = { + type: "ClassSubtraction", + parent: parent, + start, + end, + raw: this.source.slice(start, end), + left, + right, + }; + left.parent = node; + right.parent = node; + this._expressionBufferMap.set(parent, node); + } + onClassStringDisjunctionEnter(start) { + const parent = this._node; + if (parent.type !== "CharacterClass" || !parent.unicodeSets) { + throw new Error("UnknownError"); + } + this._node = { + type: "ClassStringDisjunction", + parent, + start, + end: start, + raw: "", + alternatives: [], + }; + parent.elements.push(this._node); + } + onClassStringDisjunctionLeave(start, end) { + const node = this._node; + if (node.type !== "ClassStringDisjunction" || + node.parent.type !== "CharacterClass") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } + onStringAlternativeEnter(start) { + const parent = this._node; + if (parent.type !== "ClassStringDisjunction") { + throw new Error("UnknownError"); + } + this._node = { + type: "StringAlternative", + parent, + start, + end: start, + raw: "", + elements: [], + }; + parent.alternatives.push(this._node); + } + onStringAlternativeLeave(start, end) { + const node = this._node; + if (node.type !== "StringAlternative") { + throw new Error("UnknownError"); + } + node.end = end; + node.raw = this.source.slice(start, end); + this._node = node.parent; + } +} +class RegExpParser { + constructor(options) { + this._state = new RegExpParserState(options); + this._validator = new RegExpValidator(this._state); + } + parseLiteral(source, start = 0, end = source.length) { + this._state.source = source; + this._validator.validateLiteral(source, start, end); + const pattern = this._state.pattern; + const flags = this._state.flags; + const literal = { + type: "RegExpLiteral", + parent: null, + start, + end, + raw: source, + pattern, + flags, + }; + pattern.parent = literal; + flags.parent = literal; + return literal; + } + parseFlags(source, start = 0, end = source.length) { + this._state.source = source; + this._validator.validateFlags(source, start, end); + return this._state.flags; + } + parsePattern(source, start = 0, end = source.length, uFlagOrFlags = undefined) { + this._state.source = source; + this._validator.validatePattern(source, start, end, uFlagOrFlags); + return this._state.pattern; + } +} + +class RegExpVisitor { + constructor(handlers) { + this._handlers = handlers; + } + visit(node) { + switch (node.type) { + case "Alternative": + this.visitAlternative(node); + break; + case "Assertion": + this.visitAssertion(node); + break; + case "Backreference": + this.visitBackreference(node); + break; + case "CapturingGroup": + this.visitCapturingGroup(node); + break; + case "Character": + this.visitCharacter(node); + break; + case "CharacterClass": + this.visitCharacterClass(node); + break; + case "CharacterClassRange": + this.visitCharacterClassRange(node); + break; + case "CharacterSet": + this.visitCharacterSet(node); + break; + case "ClassIntersection": + this.visitClassIntersection(node); + break; + case "ClassStringDisjunction": + this.visitClassStringDisjunction(node); + break; + case "ClassSubtraction": + this.visitClassSubtraction(node); + break; + case "ExpressionCharacterClass": + this.visitExpressionCharacterClass(node); + break; + case "Flags": + this.visitFlags(node); + break; + case "Group": + this.visitGroup(node); + break; + case "Modifiers": + this.visitModifiers(node); + break; + case "ModifierFlags": + this.visitModifierFlags(node); + break; + case "Pattern": + this.visitPattern(node); + break; + case "Quantifier": + this.visitQuantifier(node); + break; + case "RegExpLiteral": + this.visitRegExpLiteral(node); + break; + case "StringAlternative": + this.visitStringAlternative(node); + break; + default: + throw new Error(`Unknown type: ${node.type}`); + } + } + visitAlternative(node) { + if (this._handlers.onAlternativeEnter) { + this._handlers.onAlternativeEnter(node); + } + node.elements.forEach(this.visit, this); + if (this._handlers.onAlternativeLeave) { + this._handlers.onAlternativeLeave(node); + } + } + visitAssertion(node) { + if (this._handlers.onAssertionEnter) { + this._handlers.onAssertionEnter(node); + } + if (node.kind === "lookahead" || node.kind === "lookbehind") { + node.alternatives.forEach(this.visit, this); + } + if (this._handlers.onAssertionLeave) { + this._handlers.onAssertionLeave(node); + } + } + visitBackreference(node) { + if (this._handlers.onBackreferenceEnter) { + this._handlers.onBackreferenceEnter(node); + } + if (this._handlers.onBackreferenceLeave) { + this._handlers.onBackreferenceLeave(node); + } + } + visitCapturingGroup(node) { + if (this._handlers.onCapturingGroupEnter) { + this._handlers.onCapturingGroupEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onCapturingGroupLeave) { + this._handlers.onCapturingGroupLeave(node); + } + } + visitCharacter(node) { + if (this._handlers.onCharacterEnter) { + this._handlers.onCharacterEnter(node); + } + if (this._handlers.onCharacterLeave) { + this._handlers.onCharacterLeave(node); + } + } + visitCharacterClass(node) { + if (this._handlers.onCharacterClassEnter) { + this._handlers.onCharacterClassEnter(node); + } + node.elements.forEach(this.visit, this); + if (this._handlers.onCharacterClassLeave) { + this._handlers.onCharacterClassLeave(node); + } + } + visitCharacterClassRange(node) { + if (this._handlers.onCharacterClassRangeEnter) { + this._handlers.onCharacterClassRangeEnter(node); + } + this.visitCharacter(node.min); + this.visitCharacter(node.max); + if (this._handlers.onCharacterClassRangeLeave) { + this._handlers.onCharacterClassRangeLeave(node); + } + } + visitCharacterSet(node) { + if (this._handlers.onCharacterSetEnter) { + this._handlers.onCharacterSetEnter(node); + } + if (this._handlers.onCharacterSetLeave) { + this._handlers.onCharacterSetLeave(node); + } + } + visitClassIntersection(node) { + if (this._handlers.onClassIntersectionEnter) { + this._handlers.onClassIntersectionEnter(node); + } + this.visit(node.left); + this.visit(node.right); + if (this._handlers.onClassIntersectionLeave) { + this._handlers.onClassIntersectionLeave(node); + } + } + visitClassStringDisjunction(node) { + if (this._handlers.onClassStringDisjunctionEnter) { + this._handlers.onClassStringDisjunctionEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onClassStringDisjunctionLeave) { + this._handlers.onClassStringDisjunctionLeave(node); + } + } + visitClassSubtraction(node) { + if (this._handlers.onClassSubtractionEnter) { + this._handlers.onClassSubtractionEnter(node); + } + this.visit(node.left); + this.visit(node.right); + if (this._handlers.onClassSubtractionLeave) { + this._handlers.onClassSubtractionLeave(node); + } + } + visitExpressionCharacterClass(node) { + if (this._handlers.onExpressionCharacterClassEnter) { + this._handlers.onExpressionCharacterClassEnter(node); + } + this.visit(node.expression); + if (this._handlers.onExpressionCharacterClassLeave) { + this._handlers.onExpressionCharacterClassLeave(node); + } + } + visitFlags(node) { + if (this._handlers.onFlagsEnter) { + this._handlers.onFlagsEnter(node); + } + if (this._handlers.onFlagsLeave) { + this._handlers.onFlagsLeave(node); + } + } + visitGroup(node) { + if (this._handlers.onGroupEnter) { + this._handlers.onGroupEnter(node); + } + if (node.modifiers) { + this.visit(node.modifiers); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onGroupLeave) { + this._handlers.onGroupLeave(node); + } + } + visitModifiers(node) { + if (this._handlers.onModifiersEnter) { + this._handlers.onModifiersEnter(node); + } + if (node.add) { + this.visit(node.add); + } + if (node.remove) { + this.visit(node.remove); + } + if (this._handlers.onModifiersLeave) { + this._handlers.onModifiersLeave(node); + } + } + visitModifierFlags(node) { + if (this._handlers.onModifierFlagsEnter) { + this._handlers.onModifierFlagsEnter(node); + } + if (this._handlers.onModifierFlagsLeave) { + this._handlers.onModifierFlagsLeave(node); + } + } + visitPattern(node) { + if (this._handlers.onPatternEnter) { + this._handlers.onPatternEnter(node); + } + node.alternatives.forEach(this.visit, this); + if (this._handlers.onPatternLeave) { + this._handlers.onPatternLeave(node); + } + } + visitQuantifier(node) { + if (this._handlers.onQuantifierEnter) { + this._handlers.onQuantifierEnter(node); + } + this.visit(node.element); + if (this._handlers.onQuantifierLeave) { + this._handlers.onQuantifierLeave(node); + } + } + visitRegExpLiteral(node) { + if (this._handlers.onRegExpLiteralEnter) { + this._handlers.onRegExpLiteralEnter(node); + } + this.visitPattern(node.pattern); + this.visitFlags(node.flags); + if (this._handlers.onRegExpLiteralLeave) { + this._handlers.onRegExpLiteralLeave(node); + } + } + visitStringAlternative(node) { + if (this._handlers.onStringAlternativeEnter) { + this._handlers.onStringAlternativeEnter(node); + } + node.elements.forEach(this.visit, this); + if (this._handlers.onStringAlternativeLeave) { + this._handlers.onStringAlternativeLeave(node); + } + } +} + +function parseRegExpLiteral(source, options) { + return new RegExpParser(options).parseLiteral(String(source)); +} +function validateRegExpLiteral(source, options) { + new RegExpValidator(options).validateLiteral(source); +} +function visitRegExpAST(node, handlers) { + new RegExpVisitor(handlers).visit(node); +} + +export { ast as AST, RegExpParser, RegExpSyntaxError, RegExpValidator, parseRegExpLiteral, validateRegExpLiteral, visitRegExpAST }; +//# sourceMappingURL=index.mjs.map diff --git a/node_modules/@eslint-community/regexpp/index.mjs.map b/node_modules/@eslint-community/regexpp/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..65cf8afa18e7542d59d0653ca1020151494ed44e --- /dev/null +++ b/node_modules/@eslint-community/regexpp/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs.map","sources":[".temp/src/ecma-versions.ts",".temp/unicode/src/unicode/ids.ts",".temp/unicode/src/unicode/properties.ts",".temp/unicode/src/unicode/index.ts",".temp/src/group-specifiers.ts",".temp/src/reader.ts",".temp/src/regexp-syntax-error.ts",".temp/src/validator.ts",".temp/src/parser.ts",".temp/src/visitor.ts",".temp/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;AAaO,MAAM,iBAAiB,GAAG,IAAI;;ACTrC,IAAI,kBAAkB,GAAyB,SAAS,CAAA;AACxD,IAAI,qBAAqB,GAAyB,SAAS,CAAA;AAErD,SAAU,SAAS,CAAC,EAAU,EAAA;IAChC,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,IAAI,CAAA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C,CAAA;AAChD,SAAA;QACD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACvC,QAAA,IAAI,IAAI,CAAC,SAAS,CAAC,wBAAwB,EAAE;AACzC,YAAA,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAA;AAChD,SAAA;KACJ;AACJ;;ACpTe,SAAA,kBAAkB,CAC9B,MAAuB,EACvB,OAA8B,EAAA;AAE9B,IAAA,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;AACjE,CAAC;AAOe,SAAA,qBAAqB,CACjC,MAAc,EACd,OAAiC,EAAA;IAEjC,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;AACxD,CAAC;AAEe,SAAA,cAAc,CAC1B,IAAc,EACd,QAAgC,EAAA;IAEhC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC3C;;;;"} \ No newline at end of file diff --git a/node_modules/@eslint-community/regexpp/package.json b/node_modules/@eslint-community/regexpp/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0ccb8da95743ecc9893ce6770ee1e0aea129a855 --- /dev/null +++ b/node_modules/@eslint-community/regexpp/package.json @@ -0,0 +1,91 @@ +{ + "name": "@eslint-community/regexpp", + "version": "4.12.2", + "description": "Regular expression parser for ECMAScript.", + "keywords": [ + "regexp", + "regular", + "expression", + "parser", + "validator", + "ast", + "abstract", + "syntax", + "tree", + "ecmascript", + "es2015", + "es2016", + "es2017", + "es2018", + "es2019", + "es2020", + "es2021", + "annexB" + ], + "homepage": "https://github.com/eslint-community/regexpp#readme", + "bugs": { + "url": "https://github.com/eslint-community/regexpp/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/eslint-community/regexpp" + }, + "license": "MIT", + "author": "Toru Nagashima", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.mjs", + "default": "./index.js" + }, + "./package.json": "./package.json" + }, + "main": "index", + "files": [ + "index.*" + ], + "scripts": { + "prebuild": "npm run -s clean", + "build": "run-s build:*", + "build:tsc": "tsc --module es2015", + "build:rollup": "rollup -c", + "build:dts": "npm run -s build:tsc -- --removeComments false && dts-bundle --name @eslint-community/regexpp --main .temp/index.d.ts --out ../index.d.ts && prettier --write index.d.ts", + "clean": "rimraf .temp index.*", + "lint": "eslint . --ext .ts", + "test": "nyc _mocha \"test/*.ts\" --reporter dot --timeout 10000", + "debug": "mocha --require ts-node/register/transpile-only \"test/*.ts\" --reporter dot --timeout 10000", + "update:test": "ts-node scripts/update-fixtures.ts", + "update:unicode": "run-s update:unicode:*", + "update:unicode:ids": "ts-node scripts/update-unicode-ids.ts", + "update:unicode:props": "ts-node scripts/update-unicode-properties.ts", + "update:test262:extract": "ts-node -T scripts/extract-test262.ts", + "preversion": "npm test && npm run -s build", + "postversion": "git push && git push --tags", + "prewatch": "npm run -s clean", + "watch": "_mocha \"test/*.ts\" --require ts-node/register --reporter dot --timeout 10000 --watch-extensions ts --watch --growl" + }, + "dependencies": {}, + "devDependencies": { + "@eslint-community/eslint-plugin-mysticatea": "^15.5.1", + "@rollup/plugin-node-resolve": "^14.1.0", + "@types/eslint": "^8.44.3", + "@types/jsdom": "^16.2.15", + "@types/mocha": "^9.1.1", + "@types/node": "^12.20.55", + "dts-bundle": "^0.7.3", + "eslint": "^8.50.0", + "js-tokens": "^8.0.2", + "jsdom": "^19.0.0", + "mocha": "^9.2.2", + "npm-run-all2": "^6.2.2", + "nyc": "^14.1.1", + "rimraf": "^3.0.2", + "rollup": "^2.79.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "ts-node": "^10.9.1", + "typescript": "~5.0.2" + }, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } +} diff --git a/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/license b/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/license new file mode 100644 index 0000000000000000000000000000000000000000..fa7ceba3eb4a9657a9db7f3ffca4e4e97a9019de --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/package.json b/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ce7875aa0d1963cc7b61f349d6062159af6555f1 --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/package.json @@ -0,0 +1,47 @@ +{ + "name": "strip-json-comments", + "version": "3.1.1", + "description": "Strip comments from JSON. Lets you use comments in your JSON files!", + "license": "MIT", + "repository": "sindresorhus/strip-json-comments", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "bench": "matcha benchmark.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "json", + "strip", + "comments", + "remove", + "delete", + "trim", + "multiline", + "parse", + "config", + "configuration", + "settings", + "util", + "env", + "environment", + "jsonc" + ], + "devDependencies": { + "ava": "^1.4.1", + "matcha": "^0.7.0", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/readme.md b/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..cc542e50cf10fb29a610af736a312a246acf775a --- /dev/null +++ b/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/readme.md @@ -0,0 +1,78 @@ +# strip-json-comments [![Build Status](https://travis-ci.com/sindresorhus/strip-json-comments.svg?branch=master)](https://travis-ci.com/github/sindresorhus/strip-json-comments) + +> Strip comments from JSON. Lets you use comments in your JSON files! + +This is now possible: + +```js +{ + // Rainbows + "unicorn": /* โค */ "cake" +} +``` + +It will replace single-line comments `//` and multi-line comments `/**/` with whitespace. This allows JSON error positions to remain as close as possible to the original source. + +Also available as a [Gulp](https://github.com/sindresorhus/gulp-strip-json-comments)/[Grunt](https://github.com/sindresorhus/grunt-strip-json-comments)/[Broccoli](https://github.com/sindresorhus/broccoli-strip-json-comments) plugin. + +## Install + +``` +$ npm install strip-json-comments +``` + +## Usage + +```js +const json = `{ + // Rainbows + "unicorn": /* โค */ "cake" +}`; + +JSON.parse(stripJsonComments(json)); +//=> {unicorn: 'cake'} +``` + +## API + +### stripJsonComments(jsonString, options?) + +#### jsonString + +Type: `string` + +Accepts a string with JSON and returns a string without comments. + +#### options + +Type: `object` + +##### whitespace + +Type: `boolean`\ +Default: `true` + +Replace comments with whitespace instead of stripping them entirely. + +## Benchmark + +``` +$ npm run bench +``` + +## Related + +- [strip-json-comments-cli](https://github.com/sindresorhus/strip-json-comments-cli) - CLI for this module +- [strip-css-comments](https://github.com/sindresorhus/strip-css-comments) - Strip comments from CSS + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/@eslint/eslintrc/package.json b/node_modules/@eslint/eslintrc/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8c75a4441e5361db5bdb431e07eabbc6452b4b29 --- /dev/null +++ b/node_modules/@eslint/eslintrc/package.json @@ -0,0 +1,78 @@ +{ + "name": "@eslint/eslintrc", + "version": "3.3.5", + "description": "The legacy ESLintRC config file format for ESLint", + "type": "module", + "main": "./dist/eslintrc.cjs", + "types": "./dist/eslintrc.d.cts", + "exports": { + ".": { + "import": "./lib/index.js", + "require": "./dist/eslintrc.cjs", + "types": "./lib/types/index.d.ts" + }, + "./package.json": "./package.json", + "./universal": { + "import": "./lib/index-universal.js", + "require": "./dist/eslintrc-universal.cjs" + } + }, + "files": [ + "lib", + "conf", + "LICENSE", + "dist", + "universal.js" + ], + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "rollup -c && node -e \"fs.copyFileSync('./lib/types/index.d.ts', './dist/eslintrc.d.cts')\"", + "lint": "eslint . --report-unused-disable-directives", + "lint:fix": "npm run lint -- --fix", + "prepare": "npm run build", + "test": "mocha -R progress -c 'tests/lib/*.cjs' && c8 mocha -R progress -c 'tests/lib/**/*.js'", + "test:types": "tsc -p tests/lib/types/tsconfig.json" + }, + "repository": "eslint/eslintrc", + "funding": "https://opencollective.com/eslint", + "keywords": [ + "ESLint", + "ESLintRC", + "Configuration" + ], + "author": "Nicholas C. Zakas", + "license": "MIT", + "bugs": { + "url": "https://github.com/eslint/eslintrc/issues" + }, + "homepage": "https://github.com/eslint/eslintrc#readme", + "devDependencies": { + "c8": "^7.7.3", + "chai": "^4.3.4", + "eslint": "^9.20.1", + "eslint-config-eslint": "^11.0.0", + "fs-teardown": "^0.1.3", + "mocha": "^9.0.3", + "rollup": "^2.70.1", + "shelljs": "^0.8.5", + "sinon": "^11.1.2", + "temp-dir": "^2.0.0", + "typescript": "^5.7.3" + }, + "dependencies": { + "ajv": "^6.14.0", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.1", + "minimatch": "^3.1.5", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } +} diff --git a/node_modules/@eslint/eslintrc/universal.js b/node_modules/@eslint/eslintrc/universal.js new file mode 100644 index 0000000000000000000000000000000000000000..2257383ea563a5358f067f92798d6edc71953d95 --- /dev/null +++ b/node_modules/@eslint/eslintrc/universal.js @@ -0,0 +1,10 @@ +/* global module, require -- required for CJS file */ + +// Jest (and probably some other runtimes with custom implementations of +// `require`) doesn't support `exports` in `package.json`, so this file is here +// to help them load this module. Note that it is also `.js` and not `.cjs` for +// the same reason - `cjs` files requires to be loaded with an extension, but +// since Jest doesn't respect `module` outside of ESM mode it still works in +// this case (and the `require` in _this_ file does specify the extension). + +module.exports = require("./dist/eslintrc-universal.cjs"); diff --git a/node_modules/@eslint/js/LICENSE b/node_modules/@eslint/js/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..b607bb36e96c33fd8ef50897db0336c585b6137a --- /dev/null +++ b/node_modules/@eslint/js/LICENSE @@ -0,0 +1,19 @@ +Copyright OpenJS Foundation and other contributors, + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/@eslint/js/README.md b/node_modules/@eslint/js/README.md new file mode 100644 index 0000000000000000000000000000000000000000..eae3d22e06c6fea6599596c25edf8c6b59e29f3b --- /dev/null +++ b/node_modules/@eslint/js/README.md @@ -0,0 +1,103 @@ +[![npm version](https://img.shields.io/npm/v/@eslint/js.svg)](https://www.npmjs.com/package/@eslint/js) +[![Downloads](https://img.shields.io/npm/dm/@eslint/js.svg)](https://www.npmjs.com/package/@eslint/js) +[![Build Status](https://github.com/eslint/eslint/workflows/CI/badge.svg)](https://github.com/eslint/eslint/actions) +
+[![Open Collective Backers](https://img.shields.io/opencollective/backers/eslint)](https://opencollective.com/eslint) +[![Open Collective Sponsors](https://img.shields.io/opencollective/sponsors/eslint)](https://opencollective.com/eslint) + +# ESLint JavaScript Plugin + +[Website](https://eslint.org) | +[Configure ESLint](https://eslint.org/docs/latest/use/configure) | +[Rules](https://eslint.org/docs/rules/) | +[Contribute to ESLint](https://eslint.org/docs/latest/contribute) | +[Report Bugs](https://eslint.org/docs/latest/contribute/report-bugs) | +[Code of Conduct](https://eslint.org/conduct) | +[X](https://x.com/geteslint) | +[Discord](https://eslint.org/chat) | +[Mastodon](https://fosstodon.org/@eslint) | +[Bluesky](https://bsky.app/profile/eslint.org) + +The beginnings of separating out JavaScript-specific functionality from ESLint. + +Right now, this plugin contains two configurations: + +- `recommended` - enables the rules recommended by the ESLint team (the replacement for `"eslint:recommended"`) +- `all` - enables all ESLint rules (the replacement for `"eslint:all"`) + +## Installation + +You can install ESLint using npm or other package managers: + +```shell +npm install eslint -D +# or +yarn add eslint -D +# or +pnpm install eslint -D +# or +bun add eslint -D +``` + +Then install this plugin: + +```shell +npm install @eslint/js -D +# or +yarn add @eslint/js -D +# or +pnpm install @eslint/js -D +# or +bun add @eslint/js -D +``` + +## Usage + +Use in your `eslint.config.js` file anytime you want to extend one of the configs: + +```js +import { defineConfig } from "eslint/config"; +import js from "@eslint/js"; + +export default defineConfig([ + // apply recommended rules to JS files + { + name: "your-project/recommended-rules", + files: ["**/*.js"], + plugins: { + js, + }, + extends: ["js/recommended"], + }, + + // apply recommended rules to JS files with an override + { + name: "your-project/recommended-rules-with-override", + files: ["**/*.js"], + plugins: { + js, + }, + extends: ["js/recommended"], + rules: { + "no-unused-vars": "warn", + }, + }, + + // apply all rules to JS files + { + name: "your-project/all-rules", + files: ["**/*.js"], + plugins: { + js, + }, + extends: ["js/all"], + rules: { + "no-unused-vars": "warn", + }, + }, +]); +``` + +## License + +MIT diff --git a/node_modules/@eslint/js/package.json b/node_modules/@eslint/js/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3a86691dc435d46f289e68143456a7574808ab98 --- /dev/null +++ b/node_modules/@eslint/js/package.json @@ -0,0 +1,44 @@ +{ + "name": "@eslint/js", + "version": "10.0.1", + "description": "ESLint JavaScript language implementation", + "funding": "https://eslint.org/donate", + "main": "./src/index.js", + "types": "./types/index.d.ts", + "scripts": { + "test:types": "tsc -p tests/types/tsconfig.json" + }, + "files": [ + "LICENSE", + "README.md", + "src", + "types" + ], + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/eslint/eslint.git", + "directory": "packages/js" + }, + "homepage": "https://eslint.org", + "bugs": "https://github.com/eslint/eslint/issues/", + "keywords": [ + "javascript", + "eslint-plugin", + "eslint" + ], + "license": "MIT", + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } +} diff --git a/node_modules/@eslint/js/src/configs/eslint-all.js b/node_modules/@eslint/js/src/configs/eslint-all.js new file mode 100644 index 0000000000000000000000000000000000000000..43ee2ae3a9d6c57940577dddacd823e9ddd1d2ac --- /dev/null +++ b/node_modules/@eslint/js/src/configs/eslint-all.js @@ -0,0 +1,210 @@ +/* + * WARNING: This file is autogenerated using the tools/update-eslint-all.js + * script. Do not edit manually. + */ +"use strict"; + +module.exports = Object.freeze({ + name: "@eslint/js/all", + rules: Object.freeze({ + "accessor-pairs": "error", + "array-callback-return": "error", + "arrow-body-style": "error", + "block-scoped-var": "error", + "camelcase": "error", + "capitalized-comments": "error", + "class-methods-use-this": "error", + "complexity": "error", + "consistent-return": "error", + "consistent-this": "error", + "constructor-super": "error", + "curly": "error", + "default-case": "error", + "default-case-last": "error", + "default-param-last": "error", + "dot-notation": "error", + "eqeqeq": "error", + "for-direction": "error", + "func-name-matching": "error", + "func-names": "error", + "func-style": "error", + "getter-return": "error", + "grouped-accessor-pairs": "error", + "guard-for-in": "error", + "id-denylist": "error", + "id-length": "error", + "id-match": "error", + "init-declarations": "error", + "logical-assignment-operators": "error", + "max-classes-per-file": "error", + "max-depth": "error", + "max-lines": "error", + "max-lines-per-function": "error", + "max-nested-callbacks": "error", + "max-params": "error", + "max-statements": "error", + "new-cap": "error", + "no-alert": "error", + "no-array-constructor": "error", + "no-async-promise-executor": "error", + "no-await-in-loop": "error", + "no-bitwise": "error", + "no-caller": "error", + "no-case-declarations": "error", + "no-class-assign": "error", + "no-compare-neg-zero": "error", + "no-cond-assign": "error", + "no-console": "error", + "no-const-assign": "error", + "no-constant-binary-expression": "error", + "no-constant-condition": "error", + "no-constructor-return": "error", + "no-continue": "error", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "error", + "no-div-regex": "error", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + "no-dupe-else-if": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + "no-duplicate-imports": "error", + "no-else-return": "error", + "no-empty": "error", + "no-empty-character-class": "error", + "no-empty-function": "error", + "no-empty-pattern": "error", + "no-empty-static-block": "error", + "no-eq-null": "error", + "no-eval": "error", + "no-ex-assign": "error", + "no-extend-native": "error", + "no-extra-bind": "error", + "no-extra-boolean-cast": "error", + "no-extra-label": "error", + "no-fallthrough": "error", + "no-func-assign": "error", + "no-global-assign": "error", + "no-implicit-coercion": "error", + "no-implicit-globals": "error", + "no-implied-eval": "error", + "no-import-assign": "error", + "no-inline-comments": "error", + "no-inner-declarations": "error", + "no-invalid-regexp": "error", + "no-invalid-this": "error", + "no-irregular-whitespace": "error", + "no-iterator": "error", + "no-label-var": "error", + "no-labels": "error", + "no-lone-blocks": "error", + "no-lonely-if": "error", + "no-loop-func": "error", + "no-loss-of-precision": "error", + "no-magic-numbers": "error", + "no-misleading-character-class": "error", + "no-multi-assign": "error", + "no-multi-str": "error", + "no-negated-condition": "error", + "no-nested-ternary": "error", + "no-new": "error", + "no-new-func": "error", + "no-new-native-nonconstructor": "error", + "no-new-wrappers": "error", + "no-nonoctal-decimal-escape": "error", + "no-obj-calls": "error", + "no-object-constructor": "error", + "no-octal": "error", + "no-octal-escape": "error", + "no-param-reassign": "error", + "no-plusplus": "error", + "no-promise-executor-return": "error", + "no-proto": "error", + "no-prototype-builtins": "error", + "no-redeclare": "error", + "no-regex-spaces": "error", + "no-restricted-exports": "error", + "no-restricted-globals": "error", + "no-restricted-imports": "error", + "no-restricted-properties": "error", + "no-restricted-syntax": "error", + "no-return-assign": "error", + "no-script-url": "error", + "no-self-assign": "error", + "no-self-compare": "error", + "no-sequences": "error", + "no-setter-return": "error", + "no-shadow": "error", + "no-shadow-restricted-names": "error", + "no-sparse-arrays": "error", + "no-template-curly-in-string": "error", + "no-ternary": "error", + "no-this-before-super": "error", + "no-throw-literal": "error", + "no-unassigned-vars": "error", + "no-undef": "error", + "no-undef-init": "error", + "no-undefined": "error", + "no-underscore-dangle": "error", + "no-unexpected-multiline": "error", + "no-unmodified-loop-condition": "error", + "no-unneeded-ternary": "error", + "no-unreachable": "error", + "no-unreachable-loop": "error", + "no-unsafe-finally": "error", + "no-unsafe-negation": "error", + "no-unsafe-optional-chaining": "error", + "no-unused-expressions": "error", + "no-unused-labels": "error", + "no-unused-private-class-members": "error", + "no-unused-vars": "error", + "no-use-before-define": "error", + "no-useless-assignment": "error", + "no-useless-backreference": "error", + "no-useless-call": "error", + "no-useless-catch": "error", + "no-useless-computed-key": "error", + "no-useless-concat": "error", + "no-useless-constructor": "error", + "no-useless-escape": "error", + "no-useless-rename": "error", + "no-useless-return": "error", + "no-var": "error", + "no-void": "error", + "no-warning-comments": "error", + "no-with": "error", + "object-shorthand": "error", + "one-var": "error", + "operator-assignment": "error", + "prefer-arrow-callback": "error", + "prefer-const": "error", + "prefer-destructuring": "error", + "prefer-exponentiation-operator": "error", + "prefer-named-capture-group": "error", + "prefer-numeric-literals": "error", + "prefer-object-has-own": "error", + "prefer-object-spread": "error", + "prefer-promise-reject-errors": "error", + "prefer-regex-literals": "error", + "prefer-rest-params": "error", + "prefer-spread": "error", + "prefer-template": "error", + "preserve-caught-error": "error", + "radix": "error", + "require-atomic-updates": "error", + "require-await": "error", + "require-unicode-regexp": "error", + "require-yield": "error", + "sort-imports": "error", + "sort-keys": "error", + "sort-vars": "error", + "strict": "error", + "symbol-description": "error", + "unicode-bom": "error", + "use-isnan": "error", + "valid-typeof": "error", + "vars-on-top": "error", + "yoda": "error" + }) +}); diff --git a/node_modules/@eslint/js/src/configs/eslint-recommended.js b/node_modules/@eslint/js/src/configs/eslint-recommended.js new file mode 100644 index 0000000000000000000000000000000000000000..fb27b4f6f7f4bffdc844ee69793bee65f57657af --- /dev/null +++ b/node_modules/@eslint/js/src/configs/eslint-recommended.js @@ -0,0 +1,75 @@ +/* + * WARNING: This file is autogenerated using the tools/update-eslint-recommended.js + * script. Do not edit manually. + */ +"use strict"; + +module.exports = Object.freeze({ + name: "@eslint/js/recommended", + rules: Object.freeze({ + "constructor-super": "error", + "for-direction": "error", + "getter-return": "error", + "no-async-promise-executor": "error", + "no-case-declarations": "error", + "no-class-assign": "error", + "no-compare-neg-zero": "error", + "no-cond-assign": "error", + "no-const-assign": "error", + "no-constant-binary-expression": "error", + "no-constant-condition": "error", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "error", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + "no-dupe-else-if": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + "no-empty": "error", + "no-empty-character-class": "error", + "no-empty-pattern": "error", + "no-empty-static-block": "error", + "no-ex-assign": "error", + "no-extra-boolean-cast": "error", + "no-fallthrough": "error", + "no-func-assign": "error", + "no-global-assign": "error", + "no-import-assign": "error", + "no-invalid-regexp": "error", + "no-irregular-whitespace": "error", + "no-loss-of-precision": "error", + "no-misleading-character-class": "error", + "no-new-native-nonconstructor": "error", + "no-nonoctal-decimal-escape": "error", + "no-obj-calls": "error", + "no-octal": "error", + "no-prototype-builtins": "error", + "no-redeclare": "error", + "no-regex-spaces": "error", + "no-self-assign": "error", + "no-setter-return": "error", + "no-shadow-restricted-names": "error", + "no-sparse-arrays": "error", + "no-this-before-super": "error", + "no-unassigned-vars": "error", + "no-undef": "error", + "no-unexpected-multiline": "error", + "no-unreachable": "error", + "no-unsafe-finally": "error", + "no-unsafe-negation": "error", + "no-unsafe-optional-chaining": "error", + "no-unused-labels": "error", + "no-unused-private-class-members": "error", + "no-unused-vars": "error", + "no-useless-assignment": "error", + "no-useless-backreference": "error", + "no-useless-catch": "error", + "no-useless-escape": "error", + "no-with": "error", + "preserve-caught-error": "error", + "require-yield": "error", + "use-isnan": "error", + "valid-typeof": "error" + }), +}); diff --git a/node_modules/@eslint/js/src/index.js b/node_modules/@eslint/js/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ff6a21d8756426f0b21e79e05a09b795edfa8bc4 --- /dev/null +++ b/node_modules/@eslint/js/src/index.js @@ -0,0 +1,23 @@ +/** + * @fileoverview Main package entrypoint. + * @author Nicholas C. Zakas + */ + +"use strict"; + +const { name, version } = require("../package.json"); + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = { + meta: { + name, + version, + }, + configs: { + all: require("./configs/eslint-all"), + recommended: require("./configs/eslint-recommended"), + }, +}; diff --git a/node_modules/@eslint/js/types/index.d.ts b/node_modules/@eslint/js/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d4921d8bfbfd66e585017ba7c51db3c8cbd6f952 --- /dev/null +++ b/node_modules/@eslint/js/types/index.d.ts @@ -0,0 +1,14 @@ +import type { Linter } from "eslint"; + +declare const js: { + readonly meta: { + readonly name: string; + readonly version: string; + }; + readonly configs: { + readonly recommended: { readonly rules: Readonly }; + readonly all: { readonly rules: Readonly }; + }; +}; + +export = js; diff --git a/node_modules/@eslint/object-schema/LICENSE b/node_modules/@eslint/object-schema/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/node_modules/@eslint/object-schema/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/@eslint/object-schema/README.md b/node_modules/@eslint/object-schema/README.md new file mode 100644 index 0000000000000000000000000000000000000000..75b77e314b01b61f193ca9bc5bdaa4e25770446d --- /dev/null +++ b/node_modules/@eslint/object-schema/README.md @@ -0,0 +1,275 @@ +# ObjectSchema Package + +## Overview + +A JavaScript object merge/validation utility where you can define a different merge and validation strategy for each key. This is helpful when you need to validate complex data structures and then merge them in a way that is more complex than `Object.assign()`. This is used in the [`@eslint/config-array`](https://npmjs.com/package/@eslint/config-array) package but can also be used on its own. + +## Installation + +For Node.js and compatible runtimes: + +```shell +npm install @eslint/object-schema +# or +yarn add @eslint/object-schema +# or +pnpm install @eslint/object-schema +# or +bun add @eslint/object-schema +``` + +For Deno: + +```shell +deno add @eslint/object-schema +``` + +## Usage + +Import the `ObjectSchema` constructor: + +```js +// using ESM +import { ObjectSchema } from "@eslint/object-schema"; + +// using CommonJS +const { ObjectSchema } = require("@eslint/object-schema"); + +const schema = new ObjectSchema({ + // define a definition for the "downloads" key + downloads: { + required: true, + merge(value1 = 0, value2) { + return value1 + value2; + }, + validate(value) { + if (typeof value !== "number") { + throw new Error("Expected downloads to be a number."); + } + }, + }, + + // define a strategy for the "versions" key + versions: { + required: true, + merge(value1 = [], value2) { + return value1.concat(value2); + }, + validate(value) { + if (!Array.isArray(value)) { + throw new Error("Expected versions to be an array."); + } + }, + }, +}); + +const record1 = { + downloads: 25, + versions: ["v1.0.0", "v1.1.0", "v1.2.0"], +}; + +const record2 = { + downloads: 125, + versions: ["v2.0.0", "v2.1.0", "v3.0.0"], +}; + +// make sure the records are valid +schema.validate(record1); +schema.validate(record2); + +// merge together (schema.merge() accepts any number of objects) +const result = schema.merge(record1, record2); + +// result looks like this: +// { +// downloads: 150, +// versions: ["v1.0.0", "v1.1.0", "v1.2.0", "v2.0.0", "v2.1.0", "v3.0.0"], +// } +``` + +## Tips and Tricks + +### Named merge strategies + +Instead of specifying a `merge()` method, you can specify one of the following strings to use a default merge strategy: + +- `"assign"` - use `Object.assign()` to merge the two values into one object. +- `"overwrite"` - the second value always replaces the first. +- `"replace"` - the second value replaces the first if the second is not `undefined`. + +For example: + +```js +const schema = new ObjectSchema({ + name: { + merge: "replace", + validate() {}, + }, +}); +``` + +### Named validation strategies + +Instead of specifying a `validate()` method, you can specify one of the following strings to use a default validation strategy: + +- `"array"` - value must be an array. +- `"boolean"` - value must be a boolean. +- `"number"` - value must be a number. +- `"object"` - value must be a non-null object, including arrays and non-plain objects. +- `"object?"` - value must be an object or null, including arrays and non-plain objects. +- `"string"` - value must be a string. +- `"string!"` - value must be a non-empty string. + +For example: + +```js +const schema = new ObjectSchema({ + name: { + merge: "replace", + validate: "string", + }, +}); +``` + +### Built-in strategy classes + +The package also exports the built-in merge and validation strategies as two classes with static methods: + +- `MergeStrategy` - built-in merge functions (`assign`, `overwrite`, `replace`). +- `ValidationStrategy` - built-in validation functions (`array`, `boolean`, `number`, `object`, `object?`, `string`, `string!`). + +These are the same strategies used when you specify a strategy by name (for example, `merge: "replace"`). You can reference the functions directly if you prefer passing a function instead of a string: + +```js +import { + ObjectSchema, + MergeStrategy, + ValidationStrategy, +} from "@eslint/object-schema"; + +const schema = new ObjectSchema({ + name: { + required: true, + merge: MergeStrategy.replace, + validate: ValidationStrategy["string!"], + }, + options: { + required: false, + merge: MergeStrategy.assign, + validate: ValidationStrategy["object?"], + }, +}); +``` + +Note: Because `object?` and `string!` aren't valid identifiers, you must access them using bracket notation (for example, `ValidationStrategy["object?"]`). + +### Subschemas + +If you are defining a key that is, itself, an object, you can simplify the process by using a subschema. Instead of defining `merge()` and `validate()`, set a `schema` property that contains a schema definition, like this: + +```js +const schema = new ObjectSchema({ + name: { + schema: { + first: { + merge: "replace", + validate: "string", + }, + last: { + merge: "replace", + validate: "string", + }, + }, + }, +}); + +schema.validate({ + name: { + first: "n", + last: "z", + }, +}); +``` + +### Remove Keys During Merge + +If the merge strategy for a key returns `undefined`, then the key will not appear in the final object. For example: + +```js +const schema = new ObjectSchema({ + date: { + merge() { + return undefined; + }, + validate(value) { + if (isNaN(Date.parse(value))) { + throw new Error("Invalid date."); + } + }, + }, +}); + +const object1 = { date: "5/5/2005" }; +const object2 = { date: "6/6/2006" }; + +const result = schema.merge(object1, object2); + +console.log("date" in result); // false +``` + +### Requiring Another Key Be Present + +If you'd like the presence of one key to require the presence of another key, you can use the `requires` property to specify an array of other properties that any key requires. For example: + +```js +const schema = new ObjectSchema({ + date: { + merge() { + return undefined; + }, + validate(value) { + if (isNaN(Date.parse(value))) { + throw new Error("Invalid date."); + } + }, + }, + time: { + requires: ["date"], + merge(first, second) { + return second; + }, + validate(value) { + // ... + }, + }, +}); + +// throws error: Key "time" requires keys "date". +schema.validate({ + time: "13:45", +}); +``` + +In this example, even though `date` is an optional key, it is required to be present whenever `time` is present. + +## License + +Apache 2.0 + + + + +## Sponsors + +The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) +to get your logo on our READMEs and [website](https://eslint.org/sponsors). + +

Platinum Sponsors

+

Automattic

Gold Sponsors

+

Qlty Software

Silver Sponsors

+

Vite Liftoff StackBlitz

Bronze Sponsors

+

Cybozu SAP CrawlJobs aeriusventilation's Org Depot Icons8 Discord GitBook HeroCoders TestMu AI Open Source Office (Formerly LambdaTest)

+

Technology Sponsors

+Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work. +

Netlify Algolia 1Password

+ diff --git a/node_modules/@eslint/object-schema/dist/cjs/index.cjs b/node_modules/@eslint/object-schema/dist/cjs/index.cjs new file mode 100644 index 0000000000000000000000000000000000000000..9ce73ee1381574ad4918b5788dde6ee23d5ab057 --- /dev/null +++ b/node_modules/@eslint/object-schema/dist/cjs/index.cjs @@ -0,0 +1,470 @@ +'use strict'; + +/** + * @fileoverview Merge Strategy + */ + +//----------------------------------------------------------------------------- +// Class +//----------------------------------------------------------------------------- + +/** + * Container class for several different merge strategies. + */ +class MergeStrategy { + /** + * Merges two keys by overwriting the first with the second. + * @template TValue1 The type of the value from the first object key. + * @template TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {TValue2} The second value. + */ + static overwrite(value1, value2) { + return value2; + } + + /** + * Merges two keys by replacing the first with the second only if the + * second is defined. + * @template TValue1 The type of the value from the first object key. + * @template TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {TValue1 | TValue2} The second value if it is defined. + */ + static replace(value1, value2) { + if (typeof value2 !== "undefined") { + return value2; + } + + return value1; + } + + /** + * Merges two properties by assigning properties from the second to the first. + * @template {Record | undefined} TValue1 The type of the value from the first object key. + * @template {Record} TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {Omit & TValue2} A new object containing properties from both value1 and + * value2. + */ + static assign(value1, value2) { + return Object.assign({}, value1, value2); + } +} + +/** + * @fileoverview Validation Strategy + */ + +//----------------------------------------------------------------------------- +// Class +//----------------------------------------------------------------------------- + +/** + * Container class for several different validation strategies. + */ +class ValidationStrategy { + /** + * Validates that a value is an array. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static array(value) { + if (!Array.isArray(value)) { + throw new TypeError("Expected an array."); + } + } + + /** + * Validates that a value is a boolean. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static boolean(value) { + if (typeof value !== "boolean") { + throw new TypeError("Expected a boolean."); + } + } + + /** + * Validates that a value is a number. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static number(value) { + if (typeof value !== "number") { + throw new TypeError("Expected a number."); + } + } + + /** + * Validates that a value is an object. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static object(value) { + if (!value || typeof value !== "object") { + throw new TypeError("Expected an object."); + } + } + + /** + * Validates that a value is an object or null. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static "object?"(value) { + if (typeof value !== "object") { + throw new TypeError("Expected an object or null."); + } + } + + /** + * Validates that a value is a string. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static string(value) { + if (typeof value !== "string") { + throw new TypeError("Expected a string."); + } + } + + /** + * Validates that a value is a non-empty string. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static "string!"(value) { + if (typeof value !== "string" || value.length === 0) { + throw new TypeError("Expected a non-empty string."); + } + } +} + +/** + * @fileoverview Object Schema + */ + + +//----------------------------------------------------------------------------- +// Types +//----------------------------------------------------------------------------- + +/** @import * as $typests from "./types.ts"; */ +/** @typedef {$typests.BuiltInMergeStrategy} BuiltInMergeStrategy */ +/** @typedef {$typests.BuiltInValidationStrategy} BuiltInValidationStrategy */ +/** @typedef {$typests.CustomMergeStrategy} CustomMergeStrategy */ +/** @typedef {$typests.CustomValidationStrategy} CustomValidationStrategy */ +/** @typedef {$typests.ObjectDefinition} ObjectDefinition */ +/** @typedef {$typests.PropertyDefinition} PropertyDefinition */ +/** @typedef {$typests.PropertyDefinitionWithSchema} PropertyDefinitionWithSchema */ +/** @typedef {$typests.PropertyDefinitionWithStrategies} PropertyDefinitionWithStrategies */ + +//----------------------------------------------------------------------------- +// Private +//----------------------------------------------------------------------------- + +/** + * Validates a schema strategy. + * @param {string} name The name of the key this strategy is for. + * @param {PropertyDefinition} definition The strategy for the object key. + * @returns {void} + * @throws {TypeError} When the strategy is missing a name. + * @throws {TypeError} When the strategy is missing a merge() method. + * @throws {TypeError} When the strategy is missing a validate() method. + */ +function validateDefinition(name, definition) { + let hasSchema = false; + if (definition.schema) { + if (typeof definition.schema === "object") { + hasSchema = true; + } else { + throw new TypeError("Schema must be an object."); + } + } + + if (typeof definition.merge === "string") { + if (!(definition.merge in MergeStrategy)) { + throw new TypeError( + `Definition for key "${name}" missing valid merge strategy.`, + ); + } + } else if (!hasSchema && typeof definition.merge !== "function") { + throw new TypeError( + `Definition for key "${name}" must have a merge property.`, + ); + } + + if (typeof definition.validate === "string") { + if (!(definition.validate in ValidationStrategy)) { + throw new TypeError( + `Definition for key "${name}" missing valid validation strategy.`, + ); + } + } else if (!hasSchema && typeof definition.validate !== "function") { + throw new TypeError( + `Definition for key "${name}" must have a validate() method.`, + ); + } +} + +//----------------------------------------------------------------------------- +// Errors +//----------------------------------------------------------------------------- + +/** + * Error when an unexpected key is found. + */ +class UnexpectedKeyError extends Error { + /** + * Creates a new instance. + * @param {string} key The key that was unexpected. + */ + constructor(key) { + super(`Unexpected key "${key}" found.`); + } +} + +/** + * Error when a required key is missing. + */ +class MissingKeyError extends Error { + /** + * Creates a new instance. + * @param {string} key The key that was missing. + */ + constructor(key) { + super(`Missing required key "${key}".`); + } +} + +/** + * Error when a key requires other keys that are missing. + */ +class MissingDependentKeysError extends Error { + /** + * Creates a new instance. + * @param {string} key The key that was unexpected. + * @param {Array} requiredKeys The keys that are required. + */ + constructor(key, requiredKeys) { + super(`Key "${key}" requires keys "${requiredKeys.join('", "')}".`); + } +} + +/** + * Wrapper error for errors occuring during a merge or validate operation. + */ +class WrapperError extends Error { + /** + * Creates a new instance. + * @param {string} key The object key causing the error. + * @param {Error} source The source error. + */ + constructor(key, source) { + super(`Key "${key}": ${source.message}`, { cause: source }); + + // copy over custom properties that aren't represented + for (const sourceKey of Object.keys(source)) { + if (!(sourceKey in this)) { + this[sourceKey] = source[sourceKey]; + } + } + } +} + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- + +/** + * Represents an object validation/merging schema. + */ +class ObjectSchema { + /** + * Track all definitions in the schema by key. + * @type {Map} + */ + #definitions = new Map(); + + /** + * Separately track any keys that are required for faster validation. + * @type {Map} + */ + #requiredKeys = new Map(); + + /** + * Creates a new instance. + * @param {ObjectDefinition} definitions The schema definitions. + * @throws {Error} When the definitions are missing or invalid. + */ + constructor(definitions) { + if (!definitions) { + throw new Error("Schema definitions missing."); + } + + // add in all strategies + for (const key of Object.keys(definitions)) { + const definition = definitions[key]; + + validateDefinition(key, definition); + + let normalizedDefinition = definition; + + // normalize merge and validate methods if subschema is present + if (typeof normalizedDefinition.schema === "object") { + const schema = new ObjectSchema(normalizedDefinition.schema); + normalizedDefinition = { + ...normalizedDefinition, + merge(first = {}, second = {}) { + return schema.merge(first, second); + }, + validate(value) { + ValidationStrategy.object(value); + schema.validate(value); + }, + }; + } + + // normalize the merge method in case there's a string + if (typeof normalizedDefinition.merge === "string") { + normalizedDefinition = { + ...normalizedDefinition, + merge: MergeStrategy[normalizedDefinition.merge], + }; + } + + // normalize the validate method in case there's a string + if (typeof normalizedDefinition.validate === "string") { + normalizedDefinition = { + ...normalizedDefinition, + validate: ValidationStrategy[normalizedDefinition.validate], + }; + } + + this.#definitions.set(key, normalizedDefinition); + + if (normalizedDefinition.required) { + this.#requiredKeys.set(key, normalizedDefinition); + } + } + } + + /** + * Determines if a strategy has been registered for the given object key. + * @param {string} key The object key to find a strategy for. + * @returns {boolean} True if the key has a strategy registered, false if not. + */ + hasKey(key) { + return this.#definitions.has(key); + } + + /** + * Merges objects together to create a new object comprised of the keys + * of the all objects. Keys are merged based on the each key's merge + * strategy. + * @param {...Object} objects The objects to merge. + * @returns {Object} A new object with a mix of all objects' keys. + * @throws {TypeError} If any object is invalid. + */ + merge(...objects) { + // double check arguments + if (objects.length < 2) { + throw new TypeError("merge() requires at least two arguments."); + } + + if ( + objects.some( + object => object === null || typeof object !== "object", + ) + ) { + throw new TypeError("All arguments must be objects."); + } + + return objects.reduce((result, object) => { + this.validate(object); + + for (const [key, strategy] of this.#definitions) { + try { + if (key in result || key in object) { + const merge = /** @type {Function} */ (strategy.merge); + const value = merge.call( + this, + result[key], + object[key], + ); + if (value !== undefined) { + result[key] = value; + } + } + } catch (ex) { + throw new WrapperError(key, ex); + } + } + return result; + }, {}); + } + + /** + * Validates an object's keys based on the validate strategy for each key. + * @param {Object} object The object to validate. + * @returns {void} + * @throws {Error} When the object is invalid. + */ + validate(object) { + // check existing keys first + for (const key of Object.keys(object)) { + // check to see if the key is defined + if (!this.hasKey(key)) { + throw new UnexpectedKeyError(key); + } + + // validate existing keys + const definition = /** @type {PropertyDefinition} */ ( + this.#definitions.get(key) + ); // `definition` is guaranteed to exist since we check with `hasKey()` above. + + // first check to see if any other keys are required + if (Array.isArray(definition.requires)) { + if ( + !definition.requires.every(otherKey => otherKey in object) + ) { + throw new MissingDependentKeysError( + key, + definition.requires, + ); + } + } + + // now apply remaining validation strategy + try { + const validate = /** @type {Function} */ (definition.validate); + validate.call(definition, object[key]); + } catch (ex) { + throw new WrapperError(key, ex); + } + } + + // ensure required keys aren't missing + for (const [key] of this.#requiredKeys) { + if (!(key in object)) { + throw new MissingKeyError(key); + } + } + } +} + +exports.MergeStrategy = MergeStrategy; +exports.ObjectSchema = ObjectSchema; +exports.ValidationStrategy = ValidationStrategy; diff --git a/node_modules/@eslint/object-schema/dist/cjs/index.d.cts b/node_modules/@eslint/object-schema/dist/cjs/index.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..b7a26969e384e2624c8bc12da3d2bae57ae17594 --- /dev/null +++ b/node_modules/@eslint/object-schema/dist/cjs/index.d.cts @@ -0,0 +1,137 @@ +export type BuiltInMergeStrategy = $typests.BuiltInMergeStrategy; +export type BuiltInValidationStrategy = $typests.BuiltInValidationStrategy; +export type CustomMergeStrategy = $typests.CustomMergeStrategy; +export type CustomValidationStrategy = $typests.CustomValidationStrategy; +export type ObjectDefinition = $typests.ObjectDefinition; +export type PropertyDefinition = $typests.PropertyDefinition; +export type PropertyDefinitionWithSchema = $typests.PropertyDefinitionWithSchema; +export type PropertyDefinitionWithStrategies = $typests.PropertyDefinitionWithStrategies; +/** + * @fileoverview Merge Strategy + */ +/** + * Container class for several different merge strategies. + */ +export class MergeStrategy { + /** + * Merges two keys by overwriting the first with the second. + * @template TValue1 The type of the value from the first object key. + * @template TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {TValue2} The second value. + */ + static overwrite(value1: TValue1, value2: TValue2): TValue2; + /** + * Merges two keys by replacing the first with the second only if the + * second is defined. + * @template TValue1 The type of the value from the first object key. + * @template TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {TValue1 | TValue2} The second value if it is defined. + */ + static replace(value1: TValue1, value2: TValue2): TValue1 | TValue2; + /** + * Merges two properties by assigning properties from the second to the first. + * @template {Record | undefined} TValue1 The type of the value from the first object key. + * @template {Record} TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {Omit & TValue2} A new object containing properties from both value1 and + * value2. + */ + static assign | undefined, TValue2 extends Record>(value1: TValue1, value2: TValue2): Omit & TValue2; +} +/** + * Represents an object validation/merging schema. + */ +export class ObjectSchema { + /** + * Creates a new instance. + * @param {ObjectDefinition} definitions The schema definitions. + * @throws {Error} When the definitions are missing or invalid. + */ + constructor(definitions: ObjectDefinition); + /** + * Determines if a strategy has been registered for the given object key. + * @param {string} key The object key to find a strategy for. + * @returns {boolean} True if the key has a strategy registered, false if not. + */ + hasKey(key: string): boolean; + /** + * Merges objects together to create a new object comprised of the keys + * of the all objects. Keys are merged based on the each key's merge + * strategy. + * @param {...Object} objects The objects to merge. + * @returns {Object} A new object with a mix of all objects' keys. + * @throws {TypeError} If any object is invalid. + */ + merge(...objects: any[]): any; + /** + * Validates an object's keys based on the validate strategy for each key. + * @param {Object} object The object to validate. + * @returns {void} + * @throws {Error} When the object is invalid. + */ + validate(object: any): void; + #private; +} +/** + * @fileoverview Validation Strategy + */ +/** + * Container class for several different validation strategies. + */ +export class ValidationStrategy { + /** + * Validates that a value is an array. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static array(value: unknown): void; + /** + * Validates that a value is a boolean. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static boolean(value: unknown): void; + /** + * Validates that a value is a number. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static number(value: unknown): void; + /** + * Validates that a value is an object. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static object(value: unknown): void; + /** + * Validates that a value is an object or null. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static "object?"(value: unknown): void; + /** + * Validates that a value is a string. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static string(value: unknown): void; + /** + * Validates that a value is a non-empty string. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static "string!"(value: unknown): void; +} +import type * as $typests from "./types.cts"; diff --git a/node_modules/@eslint/object-schema/dist/cjs/types.cts b/node_modules/@eslint/object-schema/dist/cjs/types.cts new file mode 100644 index 0000000000000000000000000000000000000000..4c27291b94eaf9836b92f4675a6b71619ccb0c28 --- /dev/null +++ b/node_modules/@eslint/object-schema/dist/cjs/types.cts @@ -0,0 +1,98 @@ +/** + * @fileoverview Types for object-schema package. + */ + +/** + * Built-in validation strategies. + */ +export type BuiltInValidationStrategy = + | "array" + | "boolean" + | "number" + | "object" + | "object?" + | "string" + | "string!"; + +/** + * Built-in merge strategies. + */ +export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace"; + +/** + * Custom merge strategy. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213 +export type CustomMergeStrategy = (target: any, source: any) => any; + +/** + * Custom validation strategy. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213 +export type CustomValidationStrategy = (value: any) => void; + +interface BasePropertyDefinition { + /** + * Indicates if the property is required. + */ + required?: boolean; + + /** + * The other properties that must be present when this property is used. + */ + requires?: string[]; +} + +/** + * Property definition that specifies explicit merge and validation strategies. + * This form cannot include a `schema`. + */ +export interface PropertyDefinitionWithStrategies extends BasePropertyDefinition { + /** + * The schema for the object value of this property. + */ + schema?: never; + + /** + * The strategy to merge the property. + */ + merge: BuiltInMergeStrategy | CustomMergeStrategy; + + /** + * The strategy to validate the property. + */ + validate: BuiltInValidationStrategy | CustomValidationStrategy; +} + +/** + * Property definition that uses a nested `schema`. + * When `schema` is present, merge and validation strategies are optional. + */ +export interface PropertyDefinitionWithSchema extends BasePropertyDefinition { + /** + * The schema for the object value of this property. + */ + schema: ObjectDefinition; + + /** + * The strategy to merge the property. + */ + merge?: BuiltInMergeStrategy | CustomMergeStrategy; + + /** + * The strategy to validate the property. + */ + validate?: BuiltInValidationStrategy | CustomValidationStrategy; +} + +/** + * Property definition. + */ +export type PropertyDefinition = + | PropertyDefinitionWithStrategies + | PropertyDefinitionWithSchema; + +/** + * Object definition. + */ +export type ObjectDefinition = Record; diff --git a/node_modules/@eslint/object-schema/dist/esm/index.d.ts b/node_modules/@eslint/object-schema/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..89301c93683012e825b5c1f538f117439436e35e --- /dev/null +++ b/node_modules/@eslint/object-schema/dist/esm/index.d.ts @@ -0,0 +1,137 @@ +export type BuiltInMergeStrategy = $typests.BuiltInMergeStrategy; +export type BuiltInValidationStrategy = $typests.BuiltInValidationStrategy; +export type CustomMergeStrategy = $typests.CustomMergeStrategy; +export type CustomValidationStrategy = $typests.CustomValidationStrategy; +export type ObjectDefinition = $typests.ObjectDefinition; +export type PropertyDefinition = $typests.PropertyDefinition; +export type PropertyDefinitionWithSchema = $typests.PropertyDefinitionWithSchema; +export type PropertyDefinitionWithStrategies = $typests.PropertyDefinitionWithStrategies; +/** + * @fileoverview Merge Strategy + */ +/** + * Container class for several different merge strategies. + */ +export class MergeStrategy { + /** + * Merges two keys by overwriting the first with the second. + * @template TValue1 The type of the value from the first object key. + * @template TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {TValue2} The second value. + */ + static overwrite(value1: TValue1, value2: TValue2): TValue2; + /** + * Merges two keys by replacing the first with the second only if the + * second is defined. + * @template TValue1 The type of the value from the first object key. + * @template TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {TValue1 | TValue2} The second value if it is defined. + */ + static replace(value1: TValue1, value2: TValue2): TValue1 | TValue2; + /** + * Merges two properties by assigning properties from the second to the first. + * @template {Record | undefined} TValue1 The type of the value from the first object key. + * @template {Record} TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {Omit & TValue2} A new object containing properties from both value1 and + * value2. + */ + static assign | undefined, TValue2 extends Record>(value1: TValue1, value2: TValue2): Omit & TValue2; +} +/** + * Represents an object validation/merging schema. + */ +export class ObjectSchema { + /** + * Creates a new instance. + * @param {ObjectDefinition} definitions The schema definitions. + * @throws {Error} When the definitions are missing or invalid. + */ + constructor(definitions: ObjectDefinition); + /** + * Determines if a strategy has been registered for the given object key. + * @param {string} key The object key to find a strategy for. + * @returns {boolean} True if the key has a strategy registered, false if not. + */ + hasKey(key: string): boolean; + /** + * Merges objects together to create a new object comprised of the keys + * of the all objects. Keys are merged based on the each key's merge + * strategy. + * @param {...Object} objects The objects to merge. + * @returns {Object} A new object with a mix of all objects' keys. + * @throws {TypeError} If any object is invalid. + */ + merge(...objects: any[]): any; + /** + * Validates an object's keys based on the validate strategy for each key. + * @param {Object} object The object to validate. + * @returns {void} + * @throws {Error} When the object is invalid. + */ + validate(object: any): void; + #private; +} +/** + * @fileoverview Validation Strategy + */ +/** + * Container class for several different validation strategies. + */ +export class ValidationStrategy { + /** + * Validates that a value is an array. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static array(value: unknown): void; + /** + * Validates that a value is a boolean. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static boolean(value: unknown): void; + /** + * Validates that a value is a number. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static number(value: unknown): void; + /** + * Validates that a value is an object. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static object(value: unknown): void; + /** + * Validates that a value is an object or null. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static "object?"(value: unknown): void; + /** + * Validates that a value is a string. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static string(value: unknown): void; + /** + * Validates that a value is a non-empty string. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static "string!"(value: unknown): void; +} +import type * as $typests from "./types.ts"; diff --git a/node_modules/@eslint/object-schema/dist/esm/index.js b/node_modules/@eslint/object-schema/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ca5cb099cd051ad5043310a091987840643e1486 --- /dev/null +++ b/node_modules/@eslint/object-schema/dist/esm/index.js @@ -0,0 +1,467 @@ +// @ts-self-types="./index.d.ts" +/** + * @fileoverview Merge Strategy + */ + +//----------------------------------------------------------------------------- +// Class +//----------------------------------------------------------------------------- + +/** + * Container class for several different merge strategies. + */ +class MergeStrategy { + /** + * Merges two keys by overwriting the first with the second. + * @template TValue1 The type of the value from the first object key. + * @template TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {TValue2} The second value. + */ + static overwrite(value1, value2) { + return value2; + } + + /** + * Merges two keys by replacing the first with the second only if the + * second is defined. + * @template TValue1 The type of the value from the first object key. + * @template TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {TValue1 | TValue2} The second value if it is defined. + */ + static replace(value1, value2) { + if (typeof value2 !== "undefined") { + return value2; + } + + return value1; + } + + /** + * Merges two properties by assigning properties from the second to the first. + * @template {Record | undefined} TValue1 The type of the value from the first object key. + * @template {Record} TValue2 The type of the value from the second object key. + * @param {TValue1} value1 The value from the first object key. + * @param {TValue2} value2 The value from the second object key. + * @returns {Omit & TValue2} A new object containing properties from both value1 and + * value2. + */ + static assign(value1, value2) { + return Object.assign({}, value1, value2); + } +} + +/** + * @fileoverview Validation Strategy + */ + +//----------------------------------------------------------------------------- +// Class +//----------------------------------------------------------------------------- + +/** + * Container class for several different validation strategies. + */ +class ValidationStrategy { + /** + * Validates that a value is an array. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static array(value) { + if (!Array.isArray(value)) { + throw new TypeError("Expected an array."); + } + } + + /** + * Validates that a value is a boolean. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static boolean(value) { + if (typeof value !== "boolean") { + throw new TypeError("Expected a boolean."); + } + } + + /** + * Validates that a value is a number. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static number(value) { + if (typeof value !== "number") { + throw new TypeError("Expected a number."); + } + } + + /** + * Validates that a value is an object. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static object(value) { + if (!value || typeof value !== "object") { + throw new TypeError("Expected an object."); + } + } + + /** + * Validates that a value is an object or null. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static "object?"(value) { + if (typeof value !== "object") { + throw new TypeError("Expected an object or null."); + } + } + + /** + * Validates that a value is a string. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static string(value) { + if (typeof value !== "string") { + throw new TypeError("Expected a string."); + } + } + + /** + * Validates that a value is a non-empty string. + * @param {unknown} value The value to validate. + * @returns {void} + * @throws {TypeError} If the value is invalid. + */ + static "string!"(value) { + if (typeof value !== "string" || value.length === 0) { + throw new TypeError("Expected a non-empty string."); + } + } +} + +/** + * @fileoverview Object Schema + */ + + +//----------------------------------------------------------------------------- +// Types +//----------------------------------------------------------------------------- + +/** @import * as $typests from "./types.ts"; */ +/** @typedef {$typests.BuiltInMergeStrategy} BuiltInMergeStrategy */ +/** @typedef {$typests.BuiltInValidationStrategy} BuiltInValidationStrategy */ +/** @typedef {$typests.CustomMergeStrategy} CustomMergeStrategy */ +/** @typedef {$typests.CustomValidationStrategy} CustomValidationStrategy */ +/** @typedef {$typests.ObjectDefinition} ObjectDefinition */ +/** @typedef {$typests.PropertyDefinition} PropertyDefinition */ +/** @typedef {$typests.PropertyDefinitionWithSchema} PropertyDefinitionWithSchema */ +/** @typedef {$typests.PropertyDefinitionWithStrategies} PropertyDefinitionWithStrategies */ + +//----------------------------------------------------------------------------- +// Private +//----------------------------------------------------------------------------- + +/** + * Validates a schema strategy. + * @param {string} name The name of the key this strategy is for. + * @param {PropertyDefinition} definition The strategy for the object key. + * @returns {void} + * @throws {TypeError} When the strategy is missing a name. + * @throws {TypeError} When the strategy is missing a merge() method. + * @throws {TypeError} When the strategy is missing a validate() method. + */ +function validateDefinition(name, definition) { + let hasSchema = false; + if (definition.schema) { + if (typeof definition.schema === "object") { + hasSchema = true; + } else { + throw new TypeError("Schema must be an object."); + } + } + + if (typeof definition.merge === "string") { + if (!(definition.merge in MergeStrategy)) { + throw new TypeError( + `Definition for key "${name}" missing valid merge strategy.`, + ); + } + } else if (!hasSchema && typeof definition.merge !== "function") { + throw new TypeError( + `Definition for key "${name}" must have a merge property.`, + ); + } + + if (typeof definition.validate === "string") { + if (!(definition.validate in ValidationStrategy)) { + throw new TypeError( + `Definition for key "${name}" missing valid validation strategy.`, + ); + } + } else if (!hasSchema && typeof definition.validate !== "function") { + throw new TypeError( + `Definition for key "${name}" must have a validate() method.`, + ); + } +} + +//----------------------------------------------------------------------------- +// Errors +//----------------------------------------------------------------------------- + +/** + * Error when an unexpected key is found. + */ +class UnexpectedKeyError extends Error { + /** + * Creates a new instance. + * @param {string} key The key that was unexpected. + */ + constructor(key) { + super(`Unexpected key "${key}" found.`); + } +} + +/** + * Error when a required key is missing. + */ +class MissingKeyError extends Error { + /** + * Creates a new instance. + * @param {string} key The key that was missing. + */ + constructor(key) { + super(`Missing required key "${key}".`); + } +} + +/** + * Error when a key requires other keys that are missing. + */ +class MissingDependentKeysError extends Error { + /** + * Creates a new instance. + * @param {string} key The key that was unexpected. + * @param {Array} requiredKeys The keys that are required. + */ + constructor(key, requiredKeys) { + super(`Key "${key}" requires keys "${requiredKeys.join('", "')}".`); + } +} + +/** + * Wrapper error for errors occuring during a merge or validate operation. + */ +class WrapperError extends Error { + /** + * Creates a new instance. + * @param {string} key The object key causing the error. + * @param {Error} source The source error. + */ + constructor(key, source) { + super(`Key "${key}": ${source.message}`, { cause: source }); + + // copy over custom properties that aren't represented + for (const sourceKey of Object.keys(source)) { + if (!(sourceKey in this)) { + this[sourceKey] = source[sourceKey]; + } + } + } +} + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- + +/** + * Represents an object validation/merging schema. + */ +class ObjectSchema { + /** + * Track all definitions in the schema by key. + * @type {Map} + */ + #definitions = new Map(); + + /** + * Separately track any keys that are required for faster validation. + * @type {Map} + */ + #requiredKeys = new Map(); + + /** + * Creates a new instance. + * @param {ObjectDefinition} definitions The schema definitions. + * @throws {Error} When the definitions are missing or invalid. + */ + constructor(definitions) { + if (!definitions) { + throw new Error("Schema definitions missing."); + } + + // add in all strategies + for (const key of Object.keys(definitions)) { + const definition = definitions[key]; + + validateDefinition(key, definition); + + let normalizedDefinition = definition; + + // normalize merge and validate methods if subschema is present + if (typeof normalizedDefinition.schema === "object") { + const schema = new ObjectSchema(normalizedDefinition.schema); + normalizedDefinition = { + ...normalizedDefinition, + merge(first = {}, second = {}) { + return schema.merge(first, second); + }, + validate(value) { + ValidationStrategy.object(value); + schema.validate(value); + }, + }; + } + + // normalize the merge method in case there's a string + if (typeof normalizedDefinition.merge === "string") { + normalizedDefinition = { + ...normalizedDefinition, + merge: MergeStrategy[normalizedDefinition.merge], + }; + } + + // normalize the validate method in case there's a string + if (typeof normalizedDefinition.validate === "string") { + normalizedDefinition = { + ...normalizedDefinition, + validate: ValidationStrategy[normalizedDefinition.validate], + }; + } + + this.#definitions.set(key, normalizedDefinition); + + if (normalizedDefinition.required) { + this.#requiredKeys.set(key, normalizedDefinition); + } + } + } + + /** + * Determines if a strategy has been registered for the given object key. + * @param {string} key The object key to find a strategy for. + * @returns {boolean} True if the key has a strategy registered, false if not. + */ + hasKey(key) { + return this.#definitions.has(key); + } + + /** + * Merges objects together to create a new object comprised of the keys + * of the all objects. Keys are merged based on the each key's merge + * strategy. + * @param {...Object} objects The objects to merge. + * @returns {Object} A new object with a mix of all objects' keys. + * @throws {TypeError} If any object is invalid. + */ + merge(...objects) { + // double check arguments + if (objects.length < 2) { + throw new TypeError("merge() requires at least two arguments."); + } + + if ( + objects.some( + object => object === null || typeof object !== "object", + ) + ) { + throw new TypeError("All arguments must be objects."); + } + + return objects.reduce((result, object) => { + this.validate(object); + + for (const [key, strategy] of this.#definitions) { + try { + if (key in result || key in object) { + const merge = /** @type {Function} */ (strategy.merge); + const value = merge.call( + this, + result[key], + object[key], + ); + if (value !== undefined) { + result[key] = value; + } + } + } catch (ex) { + throw new WrapperError(key, ex); + } + } + return result; + }, {}); + } + + /** + * Validates an object's keys based on the validate strategy for each key. + * @param {Object} object The object to validate. + * @returns {void} + * @throws {Error} When the object is invalid. + */ + validate(object) { + // check existing keys first + for (const key of Object.keys(object)) { + // check to see if the key is defined + if (!this.hasKey(key)) { + throw new UnexpectedKeyError(key); + } + + // validate existing keys + const definition = /** @type {PropertyDefinition} */ ( + this.#definitions.get(key) + ); // `definition` is guaranteed to exist since we check with `hasKey()` above. + + // first check to see if any other keys are required + if (Array.isArray(definition.requires)) { + if ( + !definition.requires.every(otherKey => otherKey in object) + ) { + throw new MissingDependentKeysError( + key, + definition.requires, + ); + } + } + + // now apply remaining validation strategy + try { + const validate = /** @type {Function} */ (definition.validate); + validate.call(definition, object[key]); + } catch (ex) { + throw new WrapperError(key, ex); + } + } + + // ensure required keys aren't missing + for (const [key] of this.#requiredKeys) { + if (!(key in object)) { + throw new MissingKeyError(key); + } + } + } +} + +export { MergeStrategy, ObjectSchema, ValidationStrategy }; diff --git a/node_modules/@eslint/object-schema/dist/esm/types.d.ts b/node_modules/@eslint/object-schema/dist/esm/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..836d1cf343cf9fe2105619032b62357e4f0de428 --- /dev/null +++ b/node_modules/@eslint/object-schema/dist/esm/types.d.ts @@ -0,0 +1,74 @@ +/** + * @fileoverview Types for object-schema package. + */ +/** + * Built-in validation strategies. + */ +export type BuiltInValidationStrategy = "array" | "boolean" | "number" | "object" | "object?" | "string" | "string!"; +/** + * Built-in merge strategies. + */ +export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace"; +/** + * Custom merge strategy. + */ +export type CustomMergeStrategy = (target: any, source: any) => any; +/** + * Custom validation strategy. + */ +export type CustomValidationStrategy = (value: any) => void; +interface BasePropertyDefinition { + /** + * Indicates if the property is required. + */ + required?: boolean; + /** + * The other properties that must be present when this property is used. + */ + requires?: string[]; +} +/** + * Property definition that specifies explicit merge and validation strategies. + * This form cannot include a `schema`. + */ +export interface PropertyDefinitionWithStrategies extends BasePropertyDefinition { + /** + * The schema for the object value of this property. + */ + schema?: never; + /** + * The strategy to merge the property. + */ + merge: BuiltInMergeStrategy | CustomMergeStrategy; + /** + * The strategy to validate the property. + */ + validate: BuiltInValidationStrategy | CustomValidationStrategy; +} +/** + * Property definition that uses a nested `schema`. + * When `schema` is present, merge and validation strategies are optional. + */ +export interface PropertyDefinitionWithSchema extends BasePropertyDefinition { + /** + * The schema for the object value of this property. + */ + schema: ObjectDefinition; + /** + * The strategy to merge the property. + */ + merge?: BuiltInMergeStrategy | CustomMergeStrategy; + /** + * The strategy to validate the property. + */ + validate?: BuiltInValidationStrategy | CustomValidationStrategy; +} +/** + * Property definition. + */ +export type PropertyDefinition = PropertyDefinitionWithStrategies | PropertyDefinitionWithSchema; +/** + * Object definition. + */ +export type ObjectDefinition = Record; +export {}; diff --git a/node_modules/@eslint/object-schema/dist/esm/types.ts b/node_modules/@eslint/object-schema/dist/esm/types.ts new file mode 100644 index 0000000000000000000000000000000000000000..4c27291b94eaf9836b92f4675a6b71619ccb0c28 --- /dev/null +++ b/node_modules/@eslint/object-schema/dist/esm/types.ts @@ -0,0 +1,98 @@ +/** + * @fileoverview Types for object-schema package. + */ + +/** + * Built-in validation strategies. + */ +export type BuiltInValidationStrategy = + | "array" + | "boolean" + | "number" + | "object" + | "object?" + | "string" + | "string!"; + +/** + * Built-in merge strategies. + */ +export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace"; + +/** + * Custom merge strategy. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213 +export type CustomMergeStrategy = (target: any, source: any) => any; + +/** + * Custom validation strategy. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213 +export type CustomValidationStrategy = (value: any) => void; + +interface BasePropertyDefinition { + /** + * Indicates if the property is required. + */ + required?: boolean; + + /** + * The other properties that must be present when this property is used. + */ + requires?: string[]; +} + +/** + * Property definition that specifies explicit merge and validation strategies. + * This form cannot include a `schema`. + */ +export interface PropertyDefinitionWithStrategies extends BasePropertyDefinition { + /** + * The schema for the object value of this property. + */ + schema?: never; + + /** + * The strategy to merge the property. + */ + merge: BuiltInMergeStrategy | CustomMergeStrategy; + + /** + * The strategy to validate the property. + */ + validate: BuiltInValidationStrategy | CustomValidationStrategy; +} + +/** + * Property definition that uses a nested `schema`. + * When `schema` is present, merge and validation strategies are optional. + */ +export interface PropertyDefinitionWithSchema extends BasePropertyDefinition { + /** + * The schema for the object value of this property. + */ + schema: ObjectDefinition; + + /** + * The strategy to merge the property. + */ + merge?: BuiltInMergeStrategy | CustomMergeStrategy; + + /** + * The strategy to validate the property. + */ + validate?: BuiltInValidationStrategy | CustomValidationStrategy; +} + +/** + * Property definition. + */ +export type PropertyDefinition = + | PropertyDefinitionWithStrategies + | PropertyDefinitionWithSchema; + +/** + * Object definition. + */ +export type ObjectDefinition = Record; diff --git a/node_modules/@eslint/object-schema/package.json b/node_modules/@eslint/object-schema/package.json new file mode 100644 index 0000000000000000000000000000000000000000..82fe388d60e60f46a23e53f7f5f557e6617a8b63 --- /dev/null +++ b/node_modules/@eslint/object-schema/package.json @@ -0,0 +1,62 @@ +{ + "name": "@eslint/object-schema", + "version": "3.0.5", + "description": "An object schema merger/validator", + "type": "module", + "main": "dist/esm/index.js", + "types": "dist/esm/index.d.ts", + "exports": { + "require": { + "types": "./dist/cjs/index.d.cts", + "default": "./dist/cjs/index.cjs" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + } + }, + "files": [ + "dist" + ], + "publishConfig": { + "access": "public" + }, + "directories": { + "test": "tests" + }, + "scripts": { + "build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js", + "build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts", + "build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts", + "lint:types": "attw --pack", + "pretest": "npm run build", + "test": "npm run test:types && npm run test:unit", + "test:coverage": "c8 npm run test:unit", + "test:jsr": "npx -y jsr@latest publish --dry-run", + "test:types": "tsc -p tests/types/tsconfig.json", + "test:unit": "mocha \"tests/**/*.test.js\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/eslint/rewrite.git", + "directory": "packages/object-schema" + }, + "keywords": [ + "object", + "validation", + "schema", + "merge" + ], + "author": "Nicholas C. Zakas", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/eslint/rewrite/issues" + }, + "homepage": "https://github.com/eslint/rewrite/tree/main/packages/object-schema#readme", + "devDependencies": { + "rollup-plugin-copy": "^3.5.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } +} diff --git a/node_modules/@eslint/plugin-kit/LICENSE b/node_modules/@eslint/plugin-kit/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/node_modules/@eslint/plugin-kit/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/@eslint/plugin-kit/README.md b/node_modules/@eslint/plugin-kit/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6e131b888d10ec1fc0a0e02d17c2eaad49e1fad3 --- /dev/null +++ b/node_modules/@eslint/plugin-kit/README.md @@ -0,0 +1,273 @@ +# ESLint Plugin Kit + +## Description + +A collection of utilities to help build ESLint plugins. + +## Installation + +For Node.js and compatible runtimes: + +```shell +npm install @eslint/plugin-kit +# or +yarn add @eslint/plugin-kit +# or +pnpm install @eslint/plugin-kit +# or +bun add @eslint/plugin-kit +``` + +For Deno: + +```shell +deno add @eslint/plugin-kit +``` + +## Usage + +This package exports the following utilities: + +- [`ConfigCommentParser`](#configcommentparser) - used to parse ESLint configuration comments (i.e., `/* eslint-disable rule */`) +- [`VisitNodeStep` and `CallMethodStep`](#visitnodestep-and-callmethodstep) - used to help implement `SourceCode#traverse()` +- [`Directive`](#directive) - used to help implement `SourceCode#getDisableDirectives()` +- [`TextSourceCodeBase`](#textsourcecodebase) - base class to help implement the `SourceCode` interface + +### `ConfigCommentParser` + +To use the `ConfigCommentParser` class, import it from the package and create a new instance, such as: + +```js +import { ConfigCommentParser } from "@eslint/plugin-kit"; + +// create a new instance +const commentParser = new ConfigCommentParser(); + +// pass in a comment string without the comment delimiters +const directive = commentParser.parseDirective( + "eslint-disable prefer-const, no-var -- I don't want to use these.", +); + +// will be undefined when a directive can't be parsed +if (directive) { + console.log(directive.label); // "eslint-disable" + console.log(directive.value); // "prefer-const, no-var" + console.log(directive.justification); // "I don't want to use these." +} +``` + +There are different styles of directive values that you'll need to parse separately to get the correct format: + +```js +import { ConfigCommentParser } from "@eslint/plugin-kit"; + +// create a new instance +const commentParser = new ConfigCommentParser(); + +// list format +const list = commentParser.parseListConfig("prefer-const, no-var"); +console.log(Object.entries(list)); // [["prefer-const", true], ["no-var", true]] + +// string format +const strings = commentParser.parseStringConfig("foo:off, bar"); +console.log(Object.entries(strings)); // [["foo", "off"], ["bar", null]] + +// JSON-like config format +const jsonLike = commentParser.parseJSONLikeConfig( + "radix:[error, always], prefer-const: warn", +); +console.log(Object.entries(jsonLike.config)); // [["radix", ["error", "always"]], ["prefer-const", "warn"]] +``` + +### `VisitNodeStep` and `CallMethodStep` + +The `VisitNodeStep` and `CallMethodStep` classes represent steps in the traversal of source code. They implement the correct interfaces to return from the `SourceCode#traverse()` method. + +The `VisitNodeStep` class is the more common of the two, where you are describing a visit to a particular node during the traversal. The constructor accepts three arguments: + +- `target` - the node being visited. This is used to determine the method to call inside of a rule. For instance, if the node's type is `Literal` then ESLint will call a method named `Literal()` on the rule (if present). +- `phase` - either 1 for enter or 2 for exit. +- `args` - an array of arguments to pass into the visitor method of a rule. + +For example: + +```js +import { VisitNodeStep } from "@eslint/plugin-kit"; + +class MySourceCode { + traverse() { + const steps = []; + + for (const { node, parent, phase } of iterator(this.ast)) { + steps.push( + new VisitNodeStep({ + target: node, + phase: phase === "enter" ? 1 : 2, + args: [node, parent], + }), + ); + } + + return steps; + } +} +``` + +The `CallMethodStep` class is less common and is used to tell ESLint to call a specific method on the rule. The constructor accepts two arguments: + +- `target` - the name of the method to call, frequently beginning with `"on"` such as `"onCodePathStart"`. +- `args` - an array of arguments to pass to the method. + +For example: + +```js +import { VisitNodeStep, CallMethodStep } from "@eslint/plugin-kit"; + +class MySourceCode { + traverse() { + const steps = []; + + for (const { node, parent, phase } of iterator(this.ast)) { + steps.push( + new VisitNodeStep({ + target: node, + phase: phase === "enter" ? 1 : 2, + args: [node, parent], + }), + ); + + // call a method indicating how many times we've been through the loop + steps.push( + new CallMethodStep({ + target: "onIteration", + args: [steps.length] + }); + ) + } + + return steps; + } +} +``` + +### `Directive` + +The `Directive` class represents a disable directive in the source code and implements the `Directive` interface from `@eslint/core`. You can tell ESLint about disable directives using the `SourceCode#getDisableDirectives()` method, where part of the return value is an array of `Directive` objects. Here's an example: + +```js +import { Directive, ConfigCommentParser } from "@eslint/plugin-kit"; + +class MySourceCode { + getDisableDirectives() { + const directives = []; + const problems = []; + const commentParser = new ConfigCommentParser(); + + // read in the inline config nodes to check each one + this.getInlineConfigNodes().forEach(comment => { + // Step 1: Parse the directive + const { label, value, justification } = + commentParser.parseDirective(comment.value); + + // Step 2: Extract the directive value and create the `Directive` object + switch (label) { + case "eslint-disable": + case "eslint-enable": + case "eslint-disable-next-line": + case "eslint-disable-line": { + const directiveType = label.slice("eslint-".length); + + directives.push( + new Directive({ + type: directiveType, + node: comment, + value, + justification, + }), + ); + } + + // ignore any comments that don't begin with known labels + } + }); + + return { + directives, + problems, + }; + } +} +``` + +### `TextSourceCodeBase` + +The `TextSourceCodeBase` class is intended to be a base class that has several of the common members found in `SourceCode` objects already implemented. Those members are: + +- `lines` - an array of text lines that is created automatically when the constructor is called. +- `getLoc(nodeOrToken)` - gets the location of a node or token. Works for nodes that have the ESLint-style `loc` property and nodes that have the Unist-style [`position` property](https://github.com/syntax-tree/unist?tab=readme-ov-file#position). If you're using an AST with a different location format, you'll still need to implement this method yourself. +- `getLocFromIndex(index)` - Converts a source text index into a `{ line: number, column: number }` pair. (For this method to work, the root node should always cover the entire source code text, and the `getLoc()` method needs to be implemented correctly.) +- `getIndexFromLoc(loc)` - Converts a `{ line: number, column: number }` pair into a source text index. (For this method to work, the root node should always cover the entire source code text, and the `getLoc()` method needs to be implemented correctly.) +- `getRange(nodeOrToken)` - gets the range of a node or token within the source text. Works for nodes that have the ESLint-style `range` property and nodes that have the Unist-style [`position` property](https://github.com/syntax-tree/unist?tab=readme-ov-file#position). If you're using an AST with a different range format, you'll still need to implement this method yourself. +- `getText(node, beforeCount, afterCount)` - gets the source text for the given node that has range information attached. Optionally, can return additional characters before and after the given node. As long as `getRange()` is properly implemented, this method will just work. +- `getAncestors(node)` - returns the ancestry of the node. In order for this to work, you must implement the `getParent()` method yourself. + +Here's an example: + +```js +import { TextSourceCodeBase } from "@eslint/plugin-kit"; + +export class MySourceCode extends TextSourceCodeBase { + #parents = new Map(); + + constructor({ ast, text }) { + super({ ast, text }); + } + + getParent(node) { + return this.#parents.get(node); + } + + traverse() { + const steps = []; + + for (const { node, parent, phase } of iterator(this.ast)) { + //save the parent information + this.#parent.set(node, parent); + + steps.push( + new VisitNodeStep({ + target: node, + phase: phase === "enter" ? 1 : 2, + args: [node, parent], + }), + ); + } + + return steps; + } +} +``` + +In general, it's safe to collect the parent information during the `traverse()` method as `getParent()` and `getAncestor()` will only be called from rules once the AST has been traversed at least once. + +## License + +Apache 2.0 + + + + +## Sponsors + +The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) +to get your logo on our READMEs and [website](https://eslint.org/sponsors). + +

Platinum Sponsors

+

Automattic

Gold Sponsors

+

Qlty Software

Silver Sponsors

+

Vite Liftoff StackBlitz

Bronze Sponsors

+

Cybozu SAP CrawlJobs Syntax Depot Icons8 Discord GitBook HeroCoders Citadel AI

+

Technology Sponsors

+Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work. +

Netlify Algolia 1Password

+ diff --git a/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs b/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs new file mode 100644 index 0000000000000000000000000000000000000000..00b7fcff60f29177fbf3c9e3eb9dbf1a9a7d6acc --- /dev/null +++ b/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs @@ -0,0 +1,895 @@ +'use strict'; + +var levn = require('levn'); + +/** + * @fileoverview Config Comment Parser + * @author Nicholas C. Zakas + */ + + +//----------------------------------------------------------------------------- +// Type Definitions +//----------------------------------------------------------------------------- + +/** @import * as $eslintcore from "@eslint/core"; */ +/** @typedef {$eslintcore.RuleConfig} RuleConfig */ +/** @typedef {$eslintcore.RulesConfig} RulesConfig */ +/** @import * as $typests from "./types.ts"; */ +/** @typedef {$typests.StringConfig} StringConfig */ +/** @typedef {$typests.BooleanConfig} BooleanConfig */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +const directivesPattern = /^([a-z]+(?:-[a-z]+)*)(?:\s|$)/u; +const validSeverities = new Set([0, 1, 2, "off", "warn", "error"]); + +/** + * Determines if the severity in the rule configuration is valid. + * @param {RuleConfig} ruleConfig A rule's configuration. + * @returns {boolean} `true` if the severity is valid, otherwise `false`. + */ +function isSeverityValid(ruleConfig) { + const severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; + return validSeverities.has(severity); +} + +/** + * Determines if all severities in the rules configuration are valid. + * @param {RulesConfig} rulesConfig The rules configuration to check. + * @returns {boolean} `true` if all severities are valid, otherwise `false`. + */ +function isEverySeverityValid(rulesConfig) { + return Object.values(rulesConfig).every(isSeverityValid); +} + +/** + * Represents a directive comment. + */ +class DirectiveComment { + /** + * The label of the directive, such as "eslint", "eslint-disable", etc. + * @type {string} + */ + label = ""; + + /** + * The value of the directive (the string after the label). + * @type {string} + */ + value = ""; + + /** + * The justification of the directive (the string after the --). + * @type {string} + */ + justification = ""; + + /** + * Creates a new directive comment. + * @param {string} label The label of the directive. + * @param {string} value The value of the directive. + * @param {string} justification The justification of the directive. + */ + constructor(label, value, justification) { + this.label = label; + this.value = value; + this.justification = justification; + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Object to parse ESLint configuration comments. + */ +class ConfigCommentParser { + /** + * Parses a list of "name:string_value" or/and "name" options divided by comma or + * whitespace. Used for "global" comments. + * @param {string} string The string to parse. + * @returns {StringConfig} Result map object of names and string values, or null values if no value was provided. + */ + parseStringConfig(string) { + const items = /** @type {StringConfig} */ ({}); + + // Collapse whitespace around `:` and `,` to make parsing easier + const trimmedString = string + .trim() + .replace(/(? { + if (!name) { + return; + } + + // value defaults to null (if not provided), e.g: "foo" => ["foo", null] + const [key, value = null] = name.split(":"); + + items[key] = value; + }); + + return items; + } + + /** + * Parses a JSON-like config. + * @param {string} string The string to parse. + * @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object + */ + parseJSONLikeConfig(string) { + // Parses a JSON-like comment by the same way as parsing CLI option. + try { + const items = + /** @type {RulesConfig} */ (levn.parse("Object", string)) || {}; + + /* + * When the configuration has any invalid severities, it should be completely + * ignored. This is because the configuration is not valid and should not be + * applied. + * + * For example, the following configuration is invalid: + * + * "no-alert: 2 no-console: 2" + * + * This results in a configuration of { "no-alert": "2 no-console: 2" }, which is + * not valid. In this case, the configuration should be ignored. + */ + if (isEverySeverityValid(items)) { + return { + ok: true, + config: items, + }; + } + } catch { + // levn parsing error: ignore to parse the string by a fallback. + } + + /* + * Optionator cannot parse commaless notations. + * But we are supporting that. So this is a fallback for that. + */ + const normalizedString = string + .replace(/(? { + const trimmedName = name + .trim() + .replace( + /^(?['"]?)(?.*)\k$/su, + "$", + ); + + if (trimmedName) { + items[trimmedName] = true; + } + }); + + return items; + } + + /** + * Extract the directive and the justification from a given directive comment and trim them. + * @param {string} value The comment text to extract. + * @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification. + */ + #extractDirectiveComment(value) { + const match = /\s-{2,}\s/u.exec(value); + + if (!match) { + return { directivePart: value.trim(), justificationPart: "" }; + } + + const directive = value.slice(0, match.index).trim(); + const justification = value.slice(match.index + match[0].length).trim(); + + return { directivePart: directive, justificationPart: justification }; + } + + /** + * Parses a directive comment into directive text and value. + * @param {string} string The string with the directive to be parsed. + * @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid. + */ + parseDirective(string) { + const { directivePart, justificationPart } = + this.#extractDirectiveComment(string); + const match = directivesPattern.exec(directivePart); + + if (!match) { + return undefined; + } + + const directiveText = match[1]; + const directiveValue = directivePart.slice( + match.index + directiveText.length, + ); + + return new DirectiveComment( + directiveText, + directiveValue.trim(), + justificationPart, + ); + } +} + +/** + * @fileoverview A collection of helper classes for implementing `SourceCode`. + * @author Nicholas C. Zakas + */ + +/* eslint class-methods-use-this: off -- Required to complete interface. */ + +//----------------------------------------------------------------------------- +// Type Definitions +//----------------------------------------------------------------------------- + +/** @typedef {$eslintcore.VisitTraversalStep} VisitTraversalStep */ +/** @typedef {$eslintcore.CallTraversalStep} CallTraversalStep */ +/** @typedef {$eslintcore.TraversalStep} TraversalStep */ +/** @typedef {$eslintcore.SourceLocation} SourceLocation */ +/** @typedef {$eslintcore.SourceLocationWithOffset} SourceLocationWithOffset */ +/** @typedef {$eslintcore.SourceRange} SourceRange */ +/** @typedef {$eslintcore.Directive} IDirective */ +/** @typedef {$eslintcore.DirectiveType} DirectiveType */ +/** @typedef {$eslintcore.SourceCodeBaseTypeOptions} SourceCodeBaseTypeOptions */ +/** + * @typedef {import("@eslint/core").TextSourceCode} TextSourceCode + * @template {SourceCodeBaseTypeOptions} [Options=SourceCodeBaseTypeOptions] + */ +/** @typedef {$eslintcore.RuleVisitor} RuleVisitor */ +/** + * @typedef {import("./types.ts").CustomRuleVisitorWithExit} CustomRuleVisitorWithExit + * @template {RuleVisitor} RuleVisitorType + */ +/** @typedef {$typests.CustomRuleTypeDefinitions} CustomRuleTypeDefinitions */ +/** + * @typedef {import("./types.ts").CustomRuleDefinitionType} CustomRuleDefinitionType + * @template {Omit} LanguageSpecificOptions + * @template {Partial} Options + */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/** + * Determines if a node has ESTree-style loc information. + * @param {object} node The node to check. + * @returns {node is {loc:SourceLocation}} `true` if the node has ESTree-style loc information, `false` if not. + */ +function hasESTreeStyleLoc(node) { + return "loc" in node; +} + +/** + * Determines if a node has position-style loc information. + * @param {object} node The node to check. + * @returns {node is {position:SourceLocation}} `true` if the node has position-style range information, `false` if not. + */ +function hasPosStyleLoc(node) { + return "position" in node; +} + +/** + * Determines if a node has ESTree-style range information. + * @param {object} node The node to check. + * @returns {node is {range:SourceRange}} `true` if the node has ESTree-style range information, `false` if not. + */ +function hasESTreeStyleRange(node) { + return "range" in node; +} + +/** + * Determines if a node has position-style range information. + * @param {object} node The node to check. + * @returns {node is {position:SourceLocationWithOffset}} `true` if the node has position-style range information, `false` if not. + */ +function hasPosStyleRange(node) { + return "position" in node; +} + +/** + * Performs binary search to find the line number containing a given target index. + * Returns the lower bound - the index of the first element greater than the target. + * **Please note that the `lineStartIndices` should be sorted in ascending order**. + * - Time Complexity: O(log n) - Significantly faster than linear search for large files. + * @param {number[]} lineStartIndices Sorted array of line start indices. + * @param {number} targetIndex The target index to find the line number for. + * @returns {number} The line number for the target index. + */ +function findLineNumberBinarySearch(lineStartIndices, targetIndex) { + let low = 0; + let high = lineStartIndices.length - 1; + + while (low < high) { + const mid = ((low + high) / 2) | 0; // Use bitwise OR to floor the division. + + if (targetIndex < lineStartIndices[mid]) { + high = mid; + } else { + low = mid + 1; + } + } + + return low; +} + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * A class to represent a step in the traversal process where a node is visited. + * @implements {VisitTraversalStep} + */ +class VisitNodeStep { + /** + * The type of the step. + * @type {"visit"} + * @readonly + */ + type = "visit"; + + /** + * The kind of the step. Represents the same data as the `type` property + * but it's a number for performance. + * @type {1} + * @readonly + */ + kind = 1; + + /** + * The target of the step. + * @type {object} + */ + target; + + /** + * The phase of the step. + * @type {1|2} + */ + phase; + + /** + * The arguments of the step. + * @type {Array} + */ + args; + + /** + * Creates a new instance. + * @param {Object} options The options for the step. + * @param {object} options.target The target of the step. + * @param {1|2} options.phase The phase of the step. + * @param {Array} options.args The arguments of the step. + */ + constructor({ target, phase, args }) { + this.target = target; + this.phase = phase; + this.args = args; + } +} + +/** + * A class to represent a step in the traversal process where a + * method is called. + * @implements {CallTraversalStep} + */ +class CallMethodStep { + /** + * The type of the step. + * @type {"call"} + * @readonly + */ + type = "call"; + + /** + * The kind of the step. Represents the same data as the `type` property + * but it's a number for performance. + * @type {2} + * @readonly + */ + kind = 2; + + /** + * The name of the method to call. + * @type {string} + */ + target; + + /** + * The arguments to pass to the method. + * @type {Array} + */ + args; + + /** + * Creates a new instance. + * @param {Object} options The options for the step. + * @param {string} options.target The target of the step. + * @param {Array} options.args The arguments of the step. + */ + constructor({ target, args }) { + this.target = target; + this.args = args; + } +} + +/** + * A class to represent a directive comment. + * @implements {IDirective} + */ +class Directive { + /** + * The type of directive. + * @type {DirectiveType} + * @readonly + */ + type; + + /** + * The node representing the directive. + * @type {unknown} + * @readonly + */ + node; + + /** + * Everything after the "eslint-disable" portion of the directive, + * but before the "--" that indicates the justification. + * @type {string} + * @readonly + */ + value; + + /** + * The justification for the directive. + * @type {string} + * @readonly + */ + justification; + + /** + * Creates a new instance. + * @param {Object} options The options for the directive. + * @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive. + * @param {unknown} options.node The node representing the directive. + * @param {string} options.value The value of the directive. + * @param {string} options.justification The justification for the directive. + */ + constructor({ type, node, value, justification }) { + this.type = type; + this.node = node; + this.value = value; + this.justification = justification; + } +} + +/** + * Source Code Base Object + * @template {SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}} [Options=SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}] + * @implements {TextSourceCode} + */ +class TextSourceCodeBase { + /** + * The lines of text in the source code. + * @type {Array} + */ + #lines = []; + + /** + * The indices of the start of each line in the source code. + * @type {Array} + */ + #lineStartIndices = [0]; + + /** + * The pattern to match lineEndings in the source code. + * @type {RegExp} + */ + #lineEndingPattern; + + /** + * The AST of the source code. + * @type {Options['RootNode']} + */ + ast; + + /** + * The text of the source code. + * @type {string} + */ + text; + + /** + * Creates a new instance. + * @param {Object} options The options for the instance. + * @param {string} options.text The source code text. + * @param {Options['RootNode']} options.ast The root AST node. + * @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. Defaults to `/\r?\n/u`. + */ + constructor({ text, ast, lineEndingPattern = /\r?\n/u }) { + this.ast = ast; + this.text = text; + // Remove the global(`g`) and sticky(`y`) flags from the `lineEndingPattern` to avoid issues with lastIndex. + this.#lineEndingPattern = new RegExp( + lineEndingPattern.source, + lineEndingPattern.flags.replace(/[gy]/gu, ""), + ); + } + + /** + * Finds the next line in the source text and updates `#lines` and `#lineStartIndices`. + * @param {string} text The text to search for the next line. + * @returns {boolean} `true` if a next line was found, `false` otherwise. + */ + #findNextLine(text) { + const match = this.#lineEndingPattern.exec(text); + + if (!match) { + return false; + } + + this.#lines.push(text.slice(0, match.index)); + this.#lineStartIndices.push( + (this.#lineStartIndices.at(-1) ?? 0) + + match.index + + match[0].length, + ); + + return true; + } + + /** + * Ensures `#lines` is lazily calculated from the source text. + * @returns {void} + */ + #ensureLines() { + // If `#lines` has already been calculated, do nothing. + if (this.#lines.length === this.#lineStartIndices.length) { + return; + } + + while ( + this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1))) + ) { + // Continue parsing until no more matches are found. + } + + this.#lines.push(this.text.slice(this.#lineStartIndices.at(-1))); + + Object.freeze(this.#lines); + } + + /** + * Ensures `#lineStartIndices` is lazily calculated up to the specified index. + * @param {number} index The index of a character in a file. + * @returns {void} + */ + #ensureLineStartIndicesFromIndex(index) { + // If we've already parsed up to or beyond this index, do nothing. + if (index <= (this.#lineStartIndices.at(-1) ?? 0)) { + return; + } + + while ( + index > (this.#lineStartIndices.at(-1) ?? 0) && + this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1))) + ) { + // Continue parsing until no more matches are found. + } + } + + /** + * Ensures `#lineStartIndices` is lazily calculated up to the specified loc. + * @param {Object} loc A line/column location. + * @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.) + * @param {number} lineStart The line number at which the parser starts counting. + * @returns {void} + */ + #ensureLineStartIndicesFromLoc(loc, lineStart) { + // Calculate line indices up to the potentially next line, as it is needed for the followโ€‘up calculation. + const nextLocLineIndex = loc.line - lineStart + 1; + const lastCalculatedLineIndex = this.#lineStartIndices.length - 1; + let additionalLinesNeeded = nextLocLineIndex - lastCalculatedLineIndex; + + // If we've already parsed up to or beyond this line, do nothing. + if (additionalLinesNeeded <= 0) { + return; + } + + while ( + additionalLinesNeeded > 0 && + this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1))) + ) { + // Continue parsing until no more matches are found or we have enough lines. + additionalLinesNeeded -= 1; + } + } + + /** + * Returns the loc information for the given node or token. + * @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the loc information for. + * @returns {SourceLocation} The loc information for the node or token. + * @throws {Error} If the node or token does not have loc information. + */ + getLoc(nodeOrToken) { + if (hasESTreeStyleLoc(nodeOrToken)) { + return nodeOrToken.loc; + } + + if (hasPosStyleLoc(nodeOrToken)) { + return nodeOrToken.position; + } + + throw new Error( + "Custom getLoc() method must be implemented in the subclass.", + ); + } + + /** + * Converts a source text index into a `{ line: number, column: number }` pair. + * @param {number} index The index of a character in a file. + * @throws {TypeError|RangeError} If non-numeric index or index out of range. + * @returns {{line: number, column: number}} A `{ line: number, column: number }` location object with 0 or 1-indexed line and 0 or 1-indexed column based on language. + * @public + */ + getLocFromIndex(index) { + if (typeof index !== "number") { + throw new TypeError("Expected `index` to be a number."); + } + + if (index < 0 || index > this.text.length) { + throw new RangeError( + `Index out of range (requested index ${index}, but source text has length ${this.text.length}).`, + ); + } + + const { + start: { line: lineStart, column: columnStart }, + end: { line: lineEnd, column: columnEnd }, + } = this.getLoc(this.ast); + + // If the index is at the start, return the start location of the root node. + if (index === 0) { + return { + line: lineStart, + column: columnStart, + }; + } + + // If the index is `this.text.length`, return the location one "spot" past the last character of the file. + if (index === this.text.length) { + return { + line: lineEnd, + column: columnEnd, + }; + } + + // Ensure `#lineStartIndices` are lazily calculated. + this.#ensureLineStartIndicesFromIndex(index); + + /* + * To figure out which line `index` is on, determine the last place at which index could + * be inserted into `#lineStartIndices` to keep the list sorted. + */ + const lineNumber = + (index >= (this.#lineStartIndices.at(-1) ?? 0) + ? this.#lineStartIndices.length + : findLineNumberBinarySearch(this.#lineStartIndices, index)) - + 1 + + lineStart; + + return { + line: lineNumber, + column: + index - + this.#lineStartIndices[lineNumber - lineStart] + + columnStart, + }; + } + + /** + * Converts a `{ line: number, column: number }` pair into a source text index. + * @param {Object} loc A line/column location. + * @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.) + * @param {number} loc.column The column number of the location. (0 or 1-indexed based on language.) + * @throws {TypeError|RangeError} If `loc` is not an object with a numeric + * `line` and `column`, if the `line` is less than or equal to zero or + * the `line` or `column` is out of the expected range. + * @returns {number} The index of the line/column location in a file. + * @public + */ + getIndexFromLoc(loc) { + if ( + loc === null || + typeof loc !== "object" || + typeof loc.line !== "number" || + typeof loc.column !== "number" + ) { + throw new TypeError( + "Expected `loc` to be an object with numeric `line` and `column` properties.", + ); + } + + const { + start: { line: lineStart, column: columnStart }, + end: { line: lineEnd, column: columnEnd }, + } = this.getLoc(this.ast); + + if (loc.line < lineStart || lineEnd < loc.line) { + throw new RangeError( + `Line number out of range (line ${loc.line} requested). Valid range: ${lineStart}-${lineEnd}`, + ); + } + + // If the loc is at the start, return the start index of the root node. + if (loc.line === lineStart && loc.column === columnStart) { + return 0; + } + + // If the loc is at the end, return the index one "spot" past the last character of the file. + if (loc.line === lineEnd && loc.column === columnEnd) { + return this.text.length; + } + + // Ensure `#lineStartIndices` are lazily calculated. + this.#ensureLineStartIndicesFromLoc(loc, lineStart); + + const isLastLine = loc.line === lineEnd; + const lineStartIndex = this.#lineStartIndices[loc.line - lineStart]; + const lineEndIndex = isLastLine + ? this.text.length + : this.#lineStartIndices[loc.line - lineStart + 1]; + const positionIndex = lineStartIndex + loc.column - columnStart; + + if ( + loc.column < columnStart || + (isLastLine && positionIndex > lineEndIndex) || + (!isLastLine && positionIndex >= lineEndIndex) + ) { + throw new RangeError( + `Column number out of range (column ${loc.column} requested). Valid range for line ${loc.line}: ${columnStart}-${lineEndIndex - lineStartIndex + columnStart + (isLastLine ? 0 : -1)}`, + ); + } + + return positionIndex; + } + + /** + * Returns the range information for the given node or token. + * @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the range information for. + * @returns {SourceRange} The range information for the node or token. + * @throws {Error} If the node or token does not have range information. + */ + getRange(nodeOrToken) { + if (hasESTreeStyleRange(nodeOrToken)) { + return nodeOrToken.range; + } + + if (hasPosStyleRange(nodeOrToken)) { + return [ + nodeOrToken.position.start.offset, + nodeOrToken.position.end.offset, + ]; + } + + throw new Error( + "Custom getRange() method must be implemented in the subclass.", + ); + } + + /* eslint-disable no-unused-vars -- Required to complete interface. */ + /** + * Returns the parent of the given node. + * @param {Options['SyntaxElementWithLoc']} node The node to get the parent of. + * @returns {Options['SyntaxElementWithLoc']|undefined} The parent of the node. + * @throws {Error} If the method is not implemented in the subclass. + */ + getParent(node) { + throw new Error("Not implemented."); + } + /* eslint-enable no-unused-vars -- Required to complete interface. */ + + /** + * Gets all the ancestors of a given node + * @param {Options['SyntaxElementWithLoc']} node The node + * @returns {Array} All the ancestor nodes in the AST, not including the provided node, starting + * from the root node at index 0 and going inwards to the parent node. + * @throws {TypeError} When `node` is missing. + */ + getAncestors(node) { + if (!node) { + throw new TypeError("Missing required argument: node."); + } + + const ancestorsStartingAtParent = []; + + for ( + let ancestor = this.getParent(node); + ancestor; + ancestor = this.getParent(ancestor) + ) { + ancestorsStartingAtParent.push(ancestor); + } + + return ancestorsStartingAtParent.reverse(); + } + + /** + * Gets the source code for the given node. + * @param {Options['SyntaxElementWithLoc']} [node] The AST node to get the text for. + * @param {number} [beforeCount] The number of characters before the node to retrieve. + * @param {number} [afterCount] The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + * @public + */ + getText(node, beforeCount, afterCount) { + if (node) { + const range = this.getRange(node); + return this.text.slice( + Math.max(range[0] - (beforeCount || 0), 0), + range[1] + (afterCount || 0), + ); + } + return this.text; + } + + /** + * Gets the entire source text split into an array of lines. + * @returns {Array} The source text as an array of lines. + * @public + */ + get lines() { + this.#ensureLines(); // Ensure `#lines` is lazily calculated. + + return this.#lines; + } + + /** + * Traverse the source code and return the steps that were taken. + * @returns {Iterable} The steps that were taken while traversing the source code. + */ + traverse() { + throw new Error("Not implemented."); + } +} + +exports.CallMethodStep = CallMethodStep; +exports.ConfigCommentParser = ConfigCommentParser; +exports.Directive = Directive; +exports.TextSourceCodeBase = TextSourceCodeBase; +exports.VisitNodeStep = VisitNodeStep; diff --git a/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts b/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..fbaf42e1b8ed6f979dcab422c4ff93720f83cbb6 --- /dev/null +++ b/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts @@ -0,0 +1,329 @@ +export type VisitTraversalStep = $eslintcore.VisitTraversalStep; +export type CallTraversalStep = $eslintcore.CallTraversalStep; +export type TraversalStep = $eslintcore.TraversalStep; +export type SourceLocation = $eslintcore.SourceLocation; +export type SourceLocationWithOffset = $eslintcore.SourceLocationWithOffset; +export type SourceRange = $eslintcore.SourceRange; +export type IDirective = $eslintcore.Directive; +export type DirectiveType = $eslintcore.DirectiveType; +export type SourceCodeBaseTypeOptions = $eslintcore.SourceCodeBaseTypeOptions; +export type TextSourceCode = import("@eslint/core").TextSourceCode; +export type RuleVisitor = $eslintcore.RuleVisitor; +export type CustomRuleVisitorWithExit = import("./types.cts").CustomRuleVisitorWithExit; +export type CustomRuleTypeDefinitions = $typests.CustomRuleTypeDefinitions; +export type CustomRuleDefinitionType, Options extends Partial> = import("./types.cts").CustomRuleDefinitionType; +export type RuleConfig = $eslintcore.RuleConfig; +export type RulesConfig = $eslintcore.RulesConfig; +export type StringConfig = $typests.StringConfig; +export type BooleanConfig = $typests.BooleanConfig; +/** + * A class to represent a step in the traversal process where a + * method is called. + * @implements {CallTraversalStep} + */ +export class CallMethodStep implements CallTraversalStep { + /** + * Creates a new instance. + * @param {Object} options The options for the step. + * @param {string} options.target The target of the step. + * @param {Array} options.args The arguments of the step. + */ + constructor({ target, args }: { + target: string; + args: Array; + }); + /** + * The type of the step. + * @type {"call"} + * @readonly + */ + readonly type: "call"; + /** + * The kind of the step. Represents the same data as the `type` property + * but it's a number for performance. + * @type {2} + * @readonly + */ + readonly kind: 2; + /** + * The name of the method to call. + * @type {string} + */ + target: string; + /** + * The arguments to pass to the method. + * @type {Array} + */ + args: Array; +} +/** + * Object to parse ESLint configuration comments. + */ +export class ConfigCommentParser { + /** + * Parses a list of "name:string_value" or/and "name" options divided by comma or + * whitespace. Used for "global" comments. + * @param {string} string The string to parse. + * @returns {StringConfig} Result map object of names and string values, or null values if no value was provided. + */ + parseStringConfig(string: string): StringConfig; + /** + * Parses a JSON-like config. + * @param {string} string The string to parse. + * @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object + */ + parseJSONLikeConfig(string: string): ({ + ok: true; + config: RulesConfig; + } | { + ok: false; + error: { + message: string; + }; + }); + /** + * Parses a config of values separated by comma. + * @param {string} string The string to parse. + * @returns {BooleanConfig} Result map of values and true values + */ + parseListConfig(string: string): BooleanConfig; + /** + * Parses a directive comment into directive text and value. + * @param {string} string The string with the directive to be parsed. + * @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid. + */ + parseDirective(string: string): DirectiveComment | undefined; + #private; +} +/** + * A class to represent a directive comment. + * @implements {IDirective} + */ +export class Directive implements IDirective { + /** + * Creates a new instance. + * @param {Object} options The options for the directive. + * @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive. + * @param {unknown} options.node The node representing the directive. + * @param {string} options.value The value of the directive. + * @param {string} options.justification The justification for the directive. + */ + constructor({ type, node, value, justification }: { + type: "disable" | "enable" | "disable-next-line" | "disable-line"; + node: unknown; + value: string; + justification: string; + }); + /** + * The type of directive. + * @type {DirectiveType} + * @readonly + */ + readonly type: DirectiveType; + /** + * The node representing the directive. + * @type {unknown} + * @readonly + */ + readonly node: unknown; + /** + * Everything after the "eslint-disable" portion of the directive, + * but before the "--" that indicates the justification. + * @type {string} + * @readonly + */ + readonly value: string; + /** + * The justification for the directive. + * @type {string} + * @readonly + */ + readonly justification: string; +} +/** + * Source Code Base Object + * @template {SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}} [Options=SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}] + * @implements {TextSourceCode} + */ +export class TextSourceCodeBase implements TextSourceCode { + /** + * Creates a new instance. + * @param {Object} options The options for the instance. + * @param {string} options.text The source code text. + * @param {Options['RootNode']} options.ast The root AST node. + * @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. Defaults to `/\r?\n/u`. + */ + constructor({ text, ast, lineEndingPattern }: { + text: string; + ast: Options["RootNode"]; + lineEndingPattern?: RegExp; + }); + /** + * The AST of the source code. + * @type {Options['RootNode']} + */ + ast: Options["RootNode"]; + /** + * The text of the source code. + * @type {string} + */ + text: string; + /** + * Returns the loc information for the given node or token. + * @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the loc information for. + * @returns {SourceLocation} The loc information for the node or token. + * @throws {Error} If the node or token does not have loc information. + */ + getLoc(nodeOrToken: Options["SyntaxElementWithLoc"]): SourceLocation; + /** + * Converts a source text index into a `{ line: number, column: number }` pair. + * @param {number} index The index of a character in a file. + * @throws {TypeError|RangeError} If non-numeric index or index out of range. + * @returns {{line: number, column: number}} A `{ line: number, column: number }` location object with 0 or 1-indexed line and 0 or 1-indexed column based on language. + * @public + */ + public getLocFromIndex(index: number): { + line: number; + column: number; + }; + /** + * Converts a `{ line: number, column: number }` pair into a source text index. + * @param {Object} loc A line/column location. + * @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.) + * @param {number} loc.column The column number of the location. (0 or 1-indexed based on language.) + * @throws {TypeError|RangeError} If `loc` is not an object with a numeric + * `line` and `column`, if the `line` is less than or equal to zero or + * the `line` or `column` is out of the expected range. + * @returns {number} The index of the line/column location in a file. + * @public + */ + public getIndexFromLoc(loc: { + line: number; + column: number; + }): number; + /** + * Returns the range information for the given node or token. + * @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the range information for. + * @returns {SourceRange} The range information for the node or token. + * @throws {Error} If the node or token does not have range information. + */ + getRange(nodeOrToken: Options["SyntaxElementWithLoc"]): SourceRange; + /** + * Returns the parent of the given node. + * @param {Options['SyntaxElementWithLoc']} node The node to get the parent of. + * @returns {Options['SyntaxElementWithLoc']|undefined} The parent of the node. + * @throws {Error} If the method is not implemented in the subclass. + */ + getParent(node: Options["SyntaxElementWithLoc"]): Options["SyntaxElementWithLoc"] | undefined; + /** + * Gets all the ancestors of a given node + * @param {Options['SyntaxElementWithLoc']} node The node + * @returns {Array} All the ancestor nodes in the AST, not including the provided node, starting + * from the root node at index 0 and going inwards to the parent node. + * @throws {TypeError} When `node` is missing. + */ + getAncestors(node: Options["SyntaxElementWithLoc"]): Array; + /** + * Gets the source code for the given node. + * @param {Options['SyntaxElementWithLoc']} [node] The AST node to get the text for. + * @param {number} [beforeCount] The number of characters before the node to retrieve. + * @param {number} [afterCount] The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + * @public + */ + public getText(node?: Options["SyntaxElementWithLoc"], beforeCount?: number, afterCount?: number): string; + /** + * Gets the entire source text split into an array of lines. + * @returns {Array} The source text as an array of lines. + * @public + */ + public get lines(): Array; + /** + * Traverse the source code and return the steps that were taken. + * @returns {Iterable} The steps that were taken while traversing the source code. + */ + traverse(): Iterable; + #private; +} +/** + * A class to represent a step in the traversal process where a node is visited. + * @implements {VisitTraversalStep} + */ +export class VisitNodeStep implements VisitTraversalStep { + /** + * Creates a new instance. + * @param {Object} options The options for the step. + * @param {object} options.target The target of the step. + * @param {1|2} options.phase The phase of the step. + * @param {Array} options.args The arguments of the step. + */ + constructor({ target, phase, args }: { + target: object; + phase: 1 | 2; + args: Array; + }); + /** + * The type of the step. + * @type {"visit"} + * @readonly + */ + readonly type: "visit"; + /** + * The kind of the step. Represents the same data as the `type` property + * but it's a number for performance. + * @type {1} + * @readonly + */ + readonly kind: 1; + /** + * The target of the step. + * @type {object} + */ + target: object; + /** + * The phase of the step. + * @type {1|2} + */ + phase: 1 | 2; + /** + * The arguments of the step. + * @type {Array} + */ + args: Array; +} +import type * as $eslintcore from "@eslint/core"; +import type * as $typests from "./types.cts"; +/** + * Represents a directive comment. + */ +declare class DirectiveComment { + /** + * Creates a new directive comment. + * @param {string} label The label of the directive. + * @param {string} value The value of the directive. + * @param {string} justification The justification of the directive. + */ + constructor(label: string, value: string, justification: string); + /** + * The label of the directive, such as "eslint", "eslint-disable", etc. + * @type {string} + */ + label: string; + /** + * The value of the directive (the string after the label). + * @type {string} + */ + value: string; + /** + * The justification of the directive (the string after the --). + * @type {string} + */ + justification: string; +} +export {}; diff --git a/node_modules/@eslint/plugin-kit/dist/cjs/types.cts b/node_modules/@eslint/plugin-kit/dist/cjs/types.cts new file mode 100644 index 0000000000000000000000000000000000000000..19a5c672cf7f13dba8c084e50bb46a9a63184ad4 --- /dev/null +++ b/node_modules/@eslint/plugin-kit/dist/cjs/types.cts @@ -0,0 +1,81 @@ +/** + * @fileoverview Types for the plugin-kit package. + * @author Nicholas C. Zakas + */ + +//------------------------------------------------------------------------------ +// Imports +//------------------------------------------------------------------------------ + +import type { + RuleDefinition, + RuleDefinitionTypeOptions, + RuleVisitor, +} from "@eslint/core"; + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * Defaults for non-language-related `RuleDefinition` options. + */ +export interface CustomRuleTypeDefinitions { + RuleOptions: unknown[]; + MessageIds: string; + ExtRuleDocs: Record; +} + +/** + * A helper type to define language specific specializations of the `RuleDefinition` type. + * + * @example + * ```ts + * type YourRuleDefinition< + * Options extends Partial = {}, + * > = CustomRuleDefinitionType< + * { + * LangOptions: YourLanguageOptions; + * Code: YourSourceCode; + * Visitor: YourRuleVisitor; + * Node: YourNode; + * }, + * Options + * >; + * ``` + */ +export type CustomRuleDefinitionType< + LanguageSpecificOptions extends Omit< + RuleDefinitionTypeOptions, + keyof CustomRuleTypeDefinitions + >, + Options extends Partial, +> = RuleDefinition< + // Language specific type options (non-configurable) + LanguageSpecificOptions & + Required< + // Rule specific type options (custom) + Options & + // Rule specific type options (defaults) + Omit + > +>; + +/** + * Adds matching `:exit` selector properties for each key of a `RuleVisitor`. + */ +export type CustomRuleVisitorWithExit = { + [Key in keyof RuleVisitorType as + | Key + | `${Key & string}:exit`]: RuleVisitorType[Key]; +}; + +/** + * A map of names to string values, or `null` when no value is provided. + */ +export type StringConfig = Record; + +/** + * A map of names to boolean flags. + */ +export type BooleanConfig = Record; diff --git a/node_modules/@eslint/plugin-kit/dist/cjs/types.d.cts b/node_modules/@eslint/plugin-kit/dist/cjs/types.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..71c4b47e85cfba7a9599d497d4a002426204e32b --- /dev/null +++ b/node_modules/@eslint/plugin-kit/dist/cjs/types.d.cts @@ -0,0 +1,46 @@ +/** + * @fileoverview Types for the plugin-kit package. + * @author Nicholas C. Zakas + */ +import type { RuleDefinition, RuleDefinitionTypeOptions, RuleVisitor } from "@eslint/core"; +/** + * Defaults for non-language-related `RuleDefinition` options. + */ +export interface CustomRuleTypeDefinitions { + RuleOptions: unknown[]; + MessageIds: string; + ExtRuleDocs: Record; +} +/** + * A helper type to define language specific specializations of the `RuleDefinition` type. + * + * @example + * ```ts + * type YourRuleDefinition< + * Options extends Partial = {}, + * > = CustomRuleDefinitionType< + * { + * LangOptions: YourLanguageOptions; + * Code: YourSourceCode; + * Visitor: YourRuleVisitor; + * Node: YourNode; + * }, + * Options + * >; + * ``` + */ +export type CustomRuleDefinitionType, Options extends Partial> = RuleDefinition>>; +/** + * Adds matching `:exit` selector properties for each key of a `RuleVisitor`. + */ +export type CustomRuleVisitorWithExit = { + [Key in keyof RuleVisitorType as Key | `${Key & string}:exit`]: RuleVisitorType[Key]; +}; +/** + * A map of names to string values, or `null` when no value is provided. + */ +export type StringConfig = Record; +/** + * A map of names to boolean flags. + */ +export type BooleanConfig = Record; diff --git a/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts b/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6ade6e0d35d727a6ac33aa857b5841217ee67444 --- /dev/null +++ b/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts @@ -0,0 +1,329 @@ +export type VisitTraversalStep = $eslintcore.VisitTraversalStep; +export type CallTraversalStep = $eslintcore.CallTraversalStep; +export type TraversalStep = $eslintcore.TraversalStep; +export type SourceLocation = $eslintcore.SourceLocation; +export type SourceLocationWithOffset = $eslintcore.SourceLocationWithOffset; +export type SourceRange = $eslintcore.SourceRange; +export type IDirective = $eslintcore.Directive; +export type DirectiveType = $eslintcore.DirectiveType; +export type SourceCodeBaseTypeOptions = $eslintcore.SourceCodeBaseTypeOptions; +export type TextSourceCode = import("@eslint/core").TextSourceCode; +export type RuleVisitor = $eslintcore.RuleVisitor; +export type CustomRuleVisitorWithExit = import("./types.ts").CustomRuleVisitorWithExit; +export type CustomRuleTypeDefinitions = $typests.CustomRuleTypeDefinitions; +export type CustomRuleDefinitionType, Options extends Partial> = import("./types.ts").CustomRuleDefinitionType; +export type RuleConfig = $eslintcore.RuleConfig; +export type RulesConfig = $eslintcore.RulesConfig; +export type StringConfig = $typests.StringConfig; +export type BooleanConfig = $typests.BooleanConfig; +/** + * A class to represent a step in the traversal process where a + * method is called. + * @implements {CallTraversalStep} + */ +export class CallMethodStep implements CallTraversalStep { + /** + * Creates a new instance. + * @param {Object} options The options for the step. + * @param {string} options.target The target of the step. + * @param {Array} options.args The arguments of the step. + */ + constructor({ target, args }: { + target: string; + args: Array; + }); + /** + * The type of the step. + * @type {"call"} + * @readonly + */ + readonly type: "call"; + /** + * The kind of the step. Represents the same data as the `type` property + * but it's a number for performance. + * @type {2} + * @readonly + */ + readonly kind: 2; + /** + * The name of the method to call. + * @type {string} + */ + target: string; + /** + * The arguments to pass to the method. + * @type {Array} + */ + args: Array; +} +/** + * Object to parse ESLint configuration comments. + */ +export class ConfigCommentParser { + /** + * Parses a list of "name:string_value" or/and "name" options divided by comma or + * whitespace. Used for "global" comments. + * @param {string} string The string to parse. + * @returns {StringConfig} Result map object of names and string values, or null values if no value was provided. + */ + parseStringConfig(string: string): StringConfig; + /** + * Parses a JSON-like config. + * @param {string} string The string to parse. + * @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object + */ + parseJSONLikeConfig(string: string): ({ + ok: true; + config: RulesConfig; + } | { + ok: false; + error: { + message: string; + }; + }); + /** + * Parses a config of values separated by comma. + * @param {string} string The string to parse. + * @returns {BooleanConfig} Result map of values and true values + */ + parseListConfig(string: string): BooleanConfig; + /** + * Parses a directive comment into directive text and value. + * @param {string} string The string with the directive to be parsed. + * @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid. + */ + parseDirective(string: string): DirectiveComment | undefined; + #private; +} +/** + * A class to represent a directive comment. + * @implements {IDirective} + */ +export class Directive implements IDirective { + /** + * Creates a new instance. + * @param {Object} options The options for the directive. + * @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive. + * @param {unknown} options.node The node representing the directive. + * @param {string} options.value The value of the directive. + * @param {string} options.justification The justification for the directive. + */ + constructor({ type, node, value, justification }: { + type: "disable" | "enable" | "disable-next-line" | "disable-line"; + node: unknown; + value: string; + justification: string; + }); + /** + * The type of directive. + * @type {DirectiveType} + * @readonly + */ + readonly type: DirectiveType; + /** + * The node representing the directive. + * @type {unknown} + * @readonly + */ + readonly node: unknown; + /** + * Everything after the "eslint-disable" portion of the directive, + * but before the "--" that indicates the justification. + * @type {string} + * @readonly + */ + readonly value: string; + /** + * The justification for the directive. + * @type {string} + * @readonly + */ + readonly justification: string; +} +/** + * Source Code Base Object + * @template {SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}} [Options=SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}] + * @implements {TextSourceCode} + */ +export class TextSourceCodeBase implements TextSourceCode { + /** + * Creates a new instance. + * @param {Object} options The options for the instance. + * @param {string} options.text The source code text. + * @param {Options['RootNode']} options.ast The root AST node. + * @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. Defaults to `/\r?\n/u`. + */ + constructor({ text, ast, lineEndingPattern }: { + text: string; + ast: Options["RootNode"]; + lineEndingPattern?: RegExp; + }); + /** + * The AST of the source code. + * @type {Options['RootNode']} + */ + ast: Options["RootNode"]; + /** + * The text of the source code. + * @type {string} + */ + text: string; + /** + * Returns the loc information for the given node or token. + * @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the loc information for. + * @returns {SourceLocation} The loc information for the node or token. + * @throws {Error} If the node or token does not have loc information. + */ + getLoc(nodeOrToken: Options["SyntaxElementWithLoc"]): SourceLocation; + /** + * Converts a source text index into a `{ line: number, column: number }` pair. + * @param {number} index The index of a character in a file. + * @throws {TypeError|RangeError} If non-numeric index or index out of range. + * @returns {{line: number, column: number}} A `{ line: number, column: number }` location object with 0 or 1-indexed line and 0 or 1-indexed column based on language. + * @public + */ + public getLocFromIndex(index: number): { + line: number; + column: number; + }; + /** + * Converts a `{ line: number, column: number }` pair into a source text index. + * @param {Object} loc A line/column location. + * @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.) + * @param {number} loc.column The column number of the location. (0 or 1-indexed based on language.) + * @throws {TypeError|RangeError} If `loc` is not an object with a numeric + * `line` and `column`, if the `line` is less than or equal to zero or + * the `line` or `column` is out of the expected range. + * @returns {number} The index of the line/column location in a file. + * @public + */ + public getIndexFromLoc(loc: { + line: number; + column: number; + }): number; + /** + * Returns the range information for the given node or token. + * @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the range information for. + * @returns {SourceRange} The range information for the node or token. + * @throws {Error} If the node or token does not have range information. + */ + getRange(nodeOrToken: Options["SyntaxElementWithLoc"]): SourceRange; + /** + * Returns the parent of the given node. + * @param {Options['SyntaxElementWithLoc']} node The node to get the parent of. + * @returns {Options['SyntaxElementWithLoc']|undefined} The parent of the node. + * @throws {Error} If the method is not implemented in the subclass. + */ + getParent(node: Options["SyntaxElementWithLoc"]): Options["SyntaxElementWithLoc"] | undefined; + /** + * Gets all the ancestors of a given node + * @param {Options['SyntaxElementWithLoc']} node The node + * @returns {Array} All the ancestor nodes in the AST, not including the provided node, starting + * from the root node at index 0 and going inwards to the parent node. + * @throws {TypeError} When `node` is missing. + */ + getAncestors(node: Options["SyntaxElementWithLoc"]): Array; + /** + * Gets the source code for the given node. + * @param {Options['SyntaxElementWithLoc']} [node] The AST node to get the text for. + * @param {number} [beforeCount] The number of characters before the node to retrieve. + * @param {number} [afterCount] The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + * @public + */ + public getText(node?: Options["SyntaxElementWithLoc"], beforeCount?: number, afterCount?: number): string; + /** + * Gets the entire source text split into an array of lines. + * @returns {Array} The source text as an array of lines. + * @public + */ + public get lines(): Array; + /** + * Traverse the source code and return the steps that were taken. + * @returns {Iterable} The steps that were taken while traversing the source code. + */ + traverse(): Iterable; + #private; +} +/** + * A class to represent a step in the traversal process where a node is visited. + * @implements {VisitTraversalStep} + */ +export class VisitNodeStep implements VisitTraversalStep { + /** + * Creates a new instance. + * @param {Object} options The options for the step. + * @param {object} options.target The target of the step. + * @param {1|2} options.phase The phase of the step. + * @param {Array} options.args The arguments of the step. + */ + constructor({ target, phase, args }: { + target: object; + phase: 1 | 2; + args: Array; + }); + /** + * The type of the step. + * @type {"visit"} + * @readonly + */ + readonly type: "visit"; + /** + * The kind of the step. Represents the same data as the `type` property + * but it's a number for performance. + * @type {1} + * @readonly + */ + readonly kind: 1; + /** + * The target of the step. + * @type {object} + */ + target: object; + /** + * The phase of the step. + * @type {1|2} + */ + phase: 1 | 2; + /** + * The arguments of the step. + * @type {Array} + */ + args: Array; +} +import type * as $eslintcore from "@eslint/core"; +import type * as $typests from "./types.ts"; +/** + * Represents a directive comment. + */ +declare class DirectiveComment { + /** + * Creates a new directive comment. + * @param {string} label The label of the directive. + * @param {string} value The value of the directive. + * @param {string} justification The justification of the directive. + */ + constructor(label: string, value: string, justification: string); + /** + * The label of the directive, such as "eslint", "eslint-disable", etc. + * @type {string} + */ + label: string; + /** + * The value of the directive (the string after the label). + * @type {string} + */ + value: string; + /** + * The justification of the directive (the string after the --). + * @type {string} + */ + justification: string; +} +export {}; diff --git a/node_modules/@eslint/plugin-kit/dist/esm/index.js b/node_modules/@eslint/plugin-kit/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e2ba99d2e79426d9522f6cf180a483b6f7658628 --- /dev/null +++ b/node_modules/@eslint/plugin-kit/dist/esm/index.js @@ -0,0 +1,890 @@ +// @ts-self-types="./index.d.ts" +import levn from 'levn'; + +/** + * @fileoverview Config Comment Parser + * @author Nicholas C. Zakas + */ + + +//----------------------------------------------------------------------------- +// Type Definitions +//----------------------------------------------------------------------------- + +/** @import * as $eslintcore from "@eslint/core"; */ +/** @typedef {$eslintcore.RuleConfig} RuleConfig */ +/** @typedef {$eslintcore.RulesConfig} RulesConfig */ +/** @import * as $typests from "./types.ts"; */ +/** @typedef {$typests.StringConfig} StringConfig */ +/** @typedef {$typests.BooleanConfig} BooleanConfig */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +const directivesPattern = /^([a-z]+(?:-[a-z]+)*)(?:\s|$)/u; +const validSeverities = new Set([0, 1, 2, "off", "warn", "error"]); + +/** + * Determines if the severity in the rule configuration is valid. + * @param {RuleConfig} ruleConfig A rule's configuration. + * @returns {boolean} `true` if the severity is valid, otherwise `false`. + */ +function isSeverityValid(ruleConfig) { + const severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; + return validSeverities.has(severity); +} + +/** + * Determines if all severities in the rules configuration are valid. + * @param {RulesConfig} rulesConfig The rules configuration to check. + * @returns {boolean} `true` if all severities are valid, otherwise `false`. + */ +function isEverySeverityValid(rulesConfig) { + return Object.values(rulesConfig).every(isSeverityValid); +} + +/** + * Represents a directive comment. + */ +class DirectiveComment { + /** + * The label of the directive, such as "eslint", "eslint-disable", etc. + * @type {string} + */ + label = ""; + + /** + * The value of the directive (the string after the label). + * @type {string} + */ + value = ""; + + /** + * The justification of the directive (the string after the --). + * @type {string} + */ + justification = ""; + + /** + * Creates a new directive comment. + * @param {string} label The label of the directive. + * @param {string} value The value of the directive. + * @param {string} justification The justification of the directive. + */ + constructor(label, value, justification) { + this.label = label; + this.value = value; + this.justification = justification; + } +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * Object to parse ESLint configuration comments. + */ +class ConfigCommentParser { + /** + * Parses a list of "name:string_value" or/and "name" options divided by comma or + * whitespace. Used for "global" comments. + * @param {string} string The string to parse. + * @returns {StringConfig} Result map object of names and string values, or null values if no value was provided. + */ + parseStringConfig(string) { + const items = /** @type {StringConfig} */ ({}); + + // Collapse whitespace around `:` and `,` to make parsing easier + const trimmedString = string + .trim() + .replace(/(? { + if (!name) { + return; + } + + // value defaults to null (if not provided), e.g: "foo" => ["foo", null] + const [key, value = null] = name.split(":"); + + items[key] = value; + }); + + return items; + } + + /** + * Parses a JSON-like config. + * @param {string} string The string to parse. + * @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object + */ + parseJSONLikeConfig(string) { + // Parses a JSON-like comment by the same way as parsing CLI option. + try { + const items = + /** @type {RulesConfig} */ (levn.parse("Object", string)) || {}; + + /* + * When the configuration has any invalid severities, it should be completely + * ignored. This is because the configuration is not valid and should not be + * applied. + * + * For example, the following configuration is invalid: + * + * "no-alert: 2 no-console: 2" + * + * This results in a configuration of { "no-alert": "2 no-console: 2" }, which is + * not valid. In this case, the configuration should be ignored. + */ + if (isEverySeverityValid(items)) { + return { + ok: true, + config: items, + }; + } + } catch { + // levn parsing error: ignore to parse the string by a fallback. + } + + /* + * Optionator cannot parse commaless notations. + * But we are supporting that. So this is a fallback for that. + */ + const normalizedString = string + .replace(/(? { + const trimmedName = name + .trim() + .replace( + /^(?['"]?)(?.*)\k$/su, + "$", + ); + + if (trimmedName) { + items[trimmedName] = true; + } + }); + + return items; + } + + /** + * Extract the directive and the justification from a given directive comment and trim them. + * @param {string} value The comment text to extract. + * @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification. + */ + #extractDirectiveComment(value) { + const match = /\s-{2,}\s/u.exec(value); + + if (!match) { + return { directivePart: value.trim(), justificationPart: "" }; + } + + const directive = value.slice(0, match.index).trim(); + const justification = value.slice(match.index + match[0].length).trim(); + + return { directivePart: directive, justificationPart: justification }; + } + + /** + * Parses a directive comment into directive text and value. + * @param {string} string The string with the directive to be parsed. + * @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid. + */ + parseDirective(string) { + const { directivePart, justificationPart } = + this.#extractDirectiveComment(string); + const match = directivesPattern.exec(directivePart); + + if (!match) { + return undefined; + } + + const directiveText = match[1]; + const directiveValue = directivePart.slice( + match.index + directiveText.length, + ); + + return new DirectiveComment( + directiveText, + directiveValue.trim(), + justificationPart, + ); + } +} + +/** + * @fileoverview A collection of helper classes for implementing `SourceCode`. + * @author Nicholas C. Zakas + */ + +/* eslint class-methods-use-this: off -- Required to complete interface. */ + +//----------------------------------------------------------------------------- +// Type Definitions +//----------------------------------------------------------------------------- + +/** @typedef {$eslintcore.VisitTraversalStep} VisitTraversalStep */ +/** @typedef {$eslintcore.CallTraversalStep} CallTraversalStep */ +/** @typedef {$eslintcore.TraversalStep} TraversalStep */ +/** @typedef {$eslintcore.SourceLocation} SourceLocation */ +/** @typedef {$eslintcore.SourceLocationWithOffset} SourceLocationWithOffset */ +/** @typedef {$eslintcore.SourceRange} SourceRange */ +/** @typedef {$eslintcore.Directive} IDirective */ +/** @typedef {$eslintcore.DirectiveType} DirectiveType */ +/** @typedef {$eslintcore.SourceCodeBaseTypeOptions} SourceCodeBaseTypeOptions */ +/** + * @typedef {import("@eslint/core").TextSourceCode} TextSourceCode + * @template {SourceCodeBaseTypeOptions} [Options=SourceCodeBaseTypeOptions] + */ +/** @typedef {$eslintcore.RuleVisitor} RuleVisitor */ +/** + * @typedef {import("./types.ts").CustomRuleVisitorWithExit} CustomRuleVisitorWithExit + * @template {RuleVisitor} RuleVisitorType + */ +/** @typedef {$typests.CustomRuleTypeDefinitions} CustomRuleTypeDefinitions */ +/** + * @typedef {import("./types.ts").CustomRuleDefinitionType} CustomRuleDefinitionType + * @template {Omit} LanguageSpecificOptions + * @template {Partial} Options + */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/** + * Determines if a node has ESTree-style loc information. + * @param {object} node The node to check. + * @returns {node is {loc:SourceLocation}} `true` if the node has ESTree-style loc information, `false` if not. + */ +function hasESTreeStyleLoc(node) { + return "loc" in node; +} + +/** + * Determines if a node has position-style loc information. + * @param {object} node The node to check. + * @returns {node is {position:SourceLocation}} `true` if the node has position-style range information, `false` if not. + */ +function hasPosStyleLoc(node) { + return "position" in node; +} + +/** + * Determines if a node has ESTree-style range information. + * @param {object} node The node to check. + * @returns {node is {range:SourceRange}} `true` if the node has ESTree-style range information, `false` if not. + */ +function hasESTreeStyleRange(node) { + return "range" in node; +} + +/** + * Determines if a node has position-style range information. + * @param {object} node The node to check. + * @returns {node is {position:SourceLocationWithOffset}} `true` if the node has position-style range information, `false` if not. + */ +function hasPosStyleRange(node) { + return "position" in node; +} + +/** + * Performs binary search to find the line number containing a given target index. + * Returns the lower bound - the index of the first element greater than the target. + * **Please note that the `lineStartIndices` should be sorted in ascending order**. + * - Time Complexity: O(log n) - Significantly faster than linear search for large files. + * @param {number[]} lineStartIndices Sorted array of line start indices. + * @param {number} targetIndex The target index to find the line number for. + * @returns {number} The line number for the target index. + */ +function findLineNumberBinarySearch(lineStartIndices, targetIndex) { + let low = 0; + let high = lineStartIndices.length - 1; + + while (low < high) { + const mid = ((low + high) / 2) | 0; // Use bitwise OR to floor the division. + + if (targetIndex < lineStartIndices[mid]) { + high = mid; + } else { + low = mid + 1; + } + } + + return low; +} + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * A class to represent a step in the traversal process where a node is visited. + * @implements {VisitTraversalStep} + */ +class VisitNodeStep { + /** + * The type of the step. + * @type {"visit"} + * @readonly + */ + type = "visit"; + + /** + * The kind of the step. Represents the same data as the `type` property + * but it's a number for performance. + * @type {1} + * @readonly + */ + kind = 1; + + /** + * The target of the step. + * @type {object} + */ + target; + + /** + * The phase of the step. + * @type {1|2} + */ + phase; + + /** + * The arguments of the step. + * @type {Array} + */ + args; + + /** + * Creates a new instance. + * @param {Object} options The options for the step. + * @param {object} options.target The target of the step. + * @param {1|2} options.phase The phase of the step. + * @param {Array} options.args The arguments of the step. + */ + constructor({ target, phase, args }) { + this.target = target; + this.phase = phase; + this.args = args; + } +} + +/** + * A class to represent a step in the traversal process where a + * method is called. + * @implements {CallTraversalStep} + */ +class CallMethodStep { + /** + * The type of the step. + * @type {"call"} + * @readonly + */ + type = "call"; + + /** + * The kind of the step. Represents the same data as the `type` property + * but it's a number for performance. + * @type {2} + * @readonly + */ + kind = 2; + + /** + * The name of the method to call. + * @type {string} + */ + target; + + /** + * The arguments to pass to the method. + * @type {Array} + */ + args; + + /** + * Creates a new instance. + * @param {Object} options The options for the step. + * @param {string} options.target The target of the step. + * @param {Array} options.args The arguments of the step. + */ + constructor({ target, args }) { + this.target = target; + this.args = args; + } +} + +/** + * A class to represent a directive comment. + * @implements {IDirective} + */ +class Directive { + /** + * The type of directive. + * @type {DirectiveType} + * @readonly + */ + type; + + /** + * The node representing the directive. + * @type {unknown} + * @readonly + */ + node; + + /** + * Everything after the "eslint-disable" portion of the directive, + * but before the "--" that indicates the justification. + * @type {string} + * @readonly + */ + value; + + /** + * The justification for the directive. + * @type {string} + * @readonly + */ + justification; + + /** + * Creates a new instance. + * @param {Object} options The options for the directive. + * @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive. + * @param {unknown} options.node The node representing the directive. + * @param {string} options.value The value of the directive. + * @param {string} options.justification The justification for the directive. + */ + constructor({ type, node, value, justification }) { + this.type = type; + this.node = node; + this.value = value; + this.justification = justification; + } +} + +/** + * Source Code Base Object + * @template {SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}} [Options=SourceCodeBaseTypeOptions & {RootNode: object, SyntaxElementWithLoc: object}] + * @implements {TextSourceCode} + */ +class TextSourceCodeBase { + /** + * The lines of text in the source code. + * @type {Array} + */ + #lines = []; + + /** + * The indices of the start of each line in the source code. + * @type {Array} + */ + #lineStartIndices = [0]; + + /** + * The pattern to match lineEndings in the source code. + * @type {RegExp} + */ + #lineEndingPattern; + + /** + * The AST of the source code. + * @type {Options['RootNode']} + */ + ast; + + /** + * The text of the source code. + * @type {string} + */ + text; + + /** + * Creates a new instance. + * @param {Object} options The options for the instance. + * @param {string} options.text The source code text. + * @param {Options['RootNode']} options.ast The root AST node. + * @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. Defaults to `/\r?\n/u`. + */ + constructor({ text, ast, lineEndingPattern = /\r?\n/u }) { + this.ast = ast; + this.text = text; + // Remove the global(`g`) and sticky(`y`) flags from the `lineEndingPattern` to avoid issues with lastIndex. + this.#lineEndingPattern = new RegExp( + lineEndingPattern.source, + lineEndingPattern.flags.replace(/[gy]/gu, ""), + ); + } + + /** + * Finds the next line in the source text and updates `#lines` and `#lineStartIndices`. + * @param {string} text The text to search for the next line. + * @returns {boolean} `true` if a next line was found, `false` otherwise. + */ + #findNextLine(text) { + const match = this.#lineEndingPattern.exec(text); + + if (!match) { + return false; + } + + this.#lines.push(text.slice(0, match.index)); + this.#lineStartIndices.push( + (this.#lineStartIndices.at(-1) ?? 0) + + match.index + + match[0].length, + ); + + return true; + } + + /** + * Ensures `#lines` is lazily calculated from the source text. + * @returns {void} + */ + #ensureLines() { + // If `#lines` has already been calculated, do nothing. + if (this.#lines.length === this.#lineStartIndices.length) { + return; + } + + while ( + this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1))) + ) { + // Continue parsing until no more matches are found. + } + + this.#lines.push(this.text.slice(this.#lineStartIndices.at(-1))); + + Object.freeze(this.#lines); + } + + /** + * Ensures `#lineStartIndices` is lazily calculated up to the specified index. + * @param {number} index The index of a character in a file. + * @returns {void} + */ + #ensureLineStartIndicesFromIndex(index) { + // If we've already parsed up to or beyond this index, do nothing. + if (index <= (this.#lineStartIndices.at(-1) ?? 0)) { + return; + } + + while ( + index > (this.#lineStartIndices.at(-1) ?? 0) && + this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1))) + ) { + // Continue parsing until no more matches are found. + } + } + + /** + * Ensures `#lineStartIndices` is lazily calculated up to the specified loc. + * @param {Object} loc A line/column location. + * @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.) + * @param {number} lineStart The line number at which the parser starts counting. + * @returns {void} + */ + #ensureLineStartIndicesFromLoc(loc, lineStart) { + // Calculate line indices up to the potentially next line, as it is needed for the followโ€‘up calculation. + const nextLocLineIndex = loc.line - lineStart + 1; + const lastCalculatedLineIndex = this.#lineStartIndices.length - 1; + let additionalLinesNeeded = nextLocLineIndex - lastCalculatedLineIndex; + + // If we've already parsed up to or beyond this line, do nothing. + if (additionalLinesNeeded <= 0) { + return; + } + + while ( + additionalLinesNeeded > 0 && + this.#findNextLine(this.text.slice(this.#lineStartIndices.at(-1))) + ) { + // Continue parsing until no more matches are found or we have enough lines. + additionalLinesNeeded -= 1; + } + } + + /** + * Returns the loc information for the given node or token. + * @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the loc information for. + * @returns {SourceLocation} The loc information for the node or token. + * @throws {Error} If the node or token does not have loc information. + */ + getLoc(nodeOrToken) { + if (hasESTreeStyleLoc(nodeOrToken)) { + return nodeOrToken.loc; + } + + if (hasPosStyleLoc(nodeOrToken)) { + return nodeOrToken.position; + } + + throw new Error( + "Custom getLoc() method must be implemented in the subclass.", + ); + } + + /** + * Converts a source text index into a `{ line: number, column: number }` pair. + * @param {number} index The index of a character in a file. + * @throws {TypeError|RangeError} If non-numeric index or index out of range. + * @returns {{line: number, column: number}} A `{ line: number, column: number }` location object with 0 or 1-indexed line and 0 or 1-indexed column based on language. + * @public + */ + getLocFromIndex(index) { + if (typeof index !== "number") { + throw new TypeError("Expected `index` to be a number."); + } + + if (index < 0 || index > this.text.length) { + throw new RangeError( + `Index out of range (requested index ${index}, but source text has length ${this.text.length}).`, + ); + } + + const { + start: { line: lineStart, column: columnStart }, + end: { line: lineEnd, column: columnEnd }, + } = this.getLoc(this.ast); + + // If the index is at the start, return the start location of the root node. + if (index === 0) { + return { + line: lineStart, + column: columnStart, + }; + } + + // If the index is `this.text.length`, return the location one "spot" past the last character of the file. + if (index === this.text.length) { + return { + line: lineEnd, + column: columnEnd, + }; + } + + // Ensure `#lineStartIndices` are lazily calculated. + this.#ensureLineStartIndicesFromIndex(index); + + /* + * To figure out which line `index` is on, determine the last place at which index could + * be inserted into `#lineStartIndices` to keep the list sorted. + */ + const lineNumber = + (index >= (this.#lineStartIndices.at(-1) ?? 0) + ? this.#lineStartIndices.length + : findLineNumberBinarySearch(this.#lineStartIndices, index)) - + 1 + + lineStart; + + return { + line: lineNumber, + column: + index - + this.#lineStartIndices[lineNumber - lineStart] + + columnStart, + }; + } + + /** + * Converts a `{ line: number, column: number }` pair into a source text index. + * @param {Object} loc A line/column location. + * @param {number} loc.line The line number of the location. (0 or 1-indexed based on language.) + * @param {number} loc.column The column number of the location. (0 or 1-indexed based on language.) + * @throws {TypeError|RangeError} If `loc` is not an object with a numeric + * `line` and `column`, if the `line` is less than or equal to zero or + * the `line` or `column` is out of the expected range. + * @returns {number} The index of the line/column location in a file. + * @public + */ + getIndexFromLoc(loc) { + if ( + loc === null || + typeof loc !== "object" || + typeof loc.line !== "number" || + typeof loc.column !== "number" + ) { + throw new TypeError( + "Expected `loc` to be an object with numeric `line` and `column` properties.", + ); + } + + const { + start: { line: lineStart, column: columnStart }, + end: { line: lineEnd, column: columnEnd }, + } = this.getLoc(this.ast); + + if (loc.line < lineStart || lineEnd < loc.line) { + throw new RangeError( + `Line number out of range (line ${loc.line} requested). Valid range: ${lineStart}-${lineEnd}`, + ); + } + + // If the loc is at the start, return the start index of the root node. + if (loc.line === lineStart && loc.column === columnStart) { + return 0; + } + + // If the loc is at the end, return the index one "spot" past the last character of the file. + if (loc.line === lineEnd && loc.column === columnEnd) { + return this.text.length; + } + + // Ensure `#lineStartIndices` are lazily calculated. + this.#ensureLineStartIndicesFromLoc(loc, lineStart); + + const isLastLine = loc.line === lineEnd; + const lineStartIndex = this.#lineStartIndices[loc.line - lineStart]; + const lineEndIndex = isLastLine + ? this.text.length + : this.#lineStartIndices[loc.line - lineStart + 1]; + const positionIndex = lineStartIndex + loc.column - columnStart; + + if ( + loc.column < columnStart || + (isLastLine && positionIndex > lineEndIndex) || + (!isLastLine && positionIndex >= lineEndIndex) + ) { + throw new RangeError( + `Column number out of range (column ${loc.column} requested). Valid range for line ${loc.line}: ${columnStart}-${lineEndIndex - lineStartIndex + columnStart + (isLastLine ? 0 : -1)}`, + ); + } + + return positionIndex; + } + + /** + * Returns the range information for the given node or token. + * @param {Options['SyntaxElementWithLoc']} nodeOrToken The node or token to get the range information for. + * @returns {SourceRange} The range information for the node or token. + * @throws {Error} If the node or token does not have range information. + */ + getRange(nodeOrToken) { + if (hasESTreeStyleRange(nodeOrToken)) { + return nodeOrToken.range; + } + + if (hasPosStyleRange(nodeOrToken)) { + return [ + nodeOrToken.position.start.offset, + nodeOrToken.position.end.offset, + ]; + } + + throw new Error( + "Custom getRange() method must be implemented in the subclass.", + ); + } + + /* eslint-disable no-unused-vars -- Required to complete interface. */ + /** + * Returns the parent of the given node. + * @param {Options['SyntaxElementWithLoc']} node The node to get the parent of. + * @returns {Options['SyntaxElementWithLoc']|undefined} The parent of the node. + * @throws {Error} If the method is not implemented in the subclass. + */ + getParent(node) { + throw new Error("Not implemented."); + } + /* eslint-enable no-unused-vars -- Required to complete interface. */ + + /** + * Gets all the ancestors of a given node + * @param {Options['SyntaxElementWithLoc']} node The node + * @returns {Array} All the ancestor nodes in the AST, not including the provided node, starting + * from the root node at index 0 and going inwards to the parent node. + * @throws {TypeError} When `node` is missing. + */ + getAncestors(node) { + if (!node) { + throw new TypeError("Missing required argument: node."); + } + + const ancestorsStartingAtParent = []; + + for ( + let ancestor = this.getParent(node); + ancestor; + ancestor = this.getParent(ancestor) + ) { + ancestorsStartingAtParent.push(ancestor); + } + + return ancestorsStartingAtParent.reverse(); + } + + /** + * Gets the source code for the given node. + * @param {Options['SyntaxElementWithLoc']} [node] The AST node to get the text for. + * @param {number} [beforeCount] The number of characters before the node to retrieve. + * @param {number} [afterCount] The number of characters after the node to retrieve. + * @returns {string} The text representing the AST node. + * @public + */ + getText(node, beforeCount, afterCount) { + if (node) { + const range = this.getRange(node); + return this.text.slice( + Math.max(range[0] - (beforeCount || 0), 0), + range[1] + (afterCount || 0), + ); + } + return this.text; + } + + /** + * Gets the entire source text split into an array of lines. + * @returns {Array} The source text as an array of lines. + * @public + */ + get lines() { + this.#ensureLines(); // Ensure `#lines` is lazily calculated. + + return this.#lines; + } + + /** + * Traverse the source code and return the steps that were taken. + * @returns {Iterable} The steps that were taken while traversing the source code. + */ + traverse() { + throw new Error("Not implemented."); + } +} + +export { CallMethodStep, ConfigCommentParser, Directive, TextSourceCodeBase, VisitNodeStep }; diff --git a/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts b/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..71c4b47e85cfba7a9599d497d4a002426204e32b --- /dev/null +++ b/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts @@ -0,0 +1,46 @@ +/** + * @fileoverview Types for the plugin-kit package. + * @author Nicholas C. Zakas + */ +import type { RuleDefinition, RuleDefinitionTypeOptions, RuleVisitor } from "@eslint/core"; +/** + * Defaults for non-language-related `RuleDefinition` options. + */ +export interface CustomRuleTypeDefinitions { + RuleOptions: unknown[]; + MessageIds: string; + ExtRuleDocs: Record; +} +/** + * A helper type to define language specific specializations of the `RuleDefinition` type. + * + * @example + * ```ts + * type YourRuleDefinition< + * Options extends Partial = {}, + * > = CustomRuleDefinitionType< + * { + * LangOptions: YourLanguageOptions; + * Code: YourSourceCode; + * Visitor: YourRuleVisitor; + * Node: YourNode; + * }, + * Options + * >; + * ``` + */ +export type CustomRuleDefinitionType, Options extends Partial> = RuleDefinition>>; +/** + * Adds matching `:exit` selector properties for each key of a `RuleVisitor`. + */ +export type CustomRuleVisitorWithExit = { + [Key in keyof RuleVisitorType as Key | `${Key & string}:exit`]: RuleVisitorType[Key]; +}; +/** + * A map of names to string values, or `null` when no value is provided. + */ +export type StringConfig = Record; +/** + * A map of names to boolean flags. + */ +export type BooleanConfig = Record; diff --git a/node_modules/@eslint/plugin-kit/dist/esm/types.ts b/node_modules/@eslint/plugin-kit/dist/esm/types.ts new file mode 100644 index 0000000000000000000000000000000000000000..19a5c672cf7f13dba8c084e50bb46a9a63184ad4 --- /dev/null +++ b/node_modules/@eslint/plugin-kit/dist/esm/types.ts @@ -0,0 +1,81 @@ +/** + * @fileoverview Types for the plugin-kit package. + * @author Nicholas C. Zakas + */ + +//------------------------------------------------------------------------------ +// Imports +//------------------------------------------------------------------------------ + +import type { + RuleDefinition, + RuleDefinitionTypeOptions, + RuleVisitor, +} from "@eslint/core"; + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * Defaults for non-language-related `RuleDefinition` options. + */ +export interface CustomRuleTypeDefinitions { + RuleOptions: unknown[]; + MessageIds: string; + ExtRuleDocs: Record; +} + +/** + * A helper type to define language specific specializations of the `RuleDefinition` type. + * + * @example + * ```ts + * type YourRuleDefinition< + * Options extends Partial = {}, + * > = CustomRuleDefinitionType< + * { + * LangOptions: YourLanguageOptions; + * Code: YourSourceCode; + * Visitor: YourRuleVisitor; + * Node: YourNode; + * }, + * Options + * >; + * ``` + */ +export type CustomRuleDefinitionType< + LanguageSpecificOptions extends Omit< + RuleDefinitionTypeOptions, + keyof CustomRuleTypeDefinitions + >, + Options extends Partial, +> = RuleDefinition< + // Language specific type options (non-configurable) + LanguageSpecificOptions & + Required< + // Rule specific type options (custom) + Options & + // Rule specific type options (defaults) + Omit + > +>; + +/** + * Adds matching `:exit` selector properties for each key of a `RuleVisitor`. + */ +export type CustomRuleVisitorWithExit = { + [Key in keyof RuleVisitorType as + | Key + | `${Key & string}:exit`]: RuleVisitorType[Key]; +}; + +/** + * A map of names to string values, or `null` when no value is provided. + */ +export type StringConfig = Record; + +/** + * A map of names to boolean flags. + */ +export type BooleanConfig = Record; diff --git a/node_modules/@eslint/plugin-kit/package.json b/node_modules/@eslint/plugin-kit/package.json new file mode 100644 index 0000000000000000000000000000000000000000..97166b5821d320b9cded6a31cc9afb8ff4e2a670 --- /dev/null +++ b/node_modules/@eslint/plugin-kit/package.json @@ -0,0 +1,63 @@ +{ + "name": "@eslint/plugin-kit", + "version": "0.7.2", + "description": "Utilities for building ESLint plugins.", + "author": "Nicholas C. Zakas", + "type": "module", + "main": "dist/esm/index.js", + "types": "dist/esm/index.d.ts", + "exports": { + "require": { + "types": "./dist/cjs/index.d.cts", + "default": "./dist/cjs/index.cjs" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + } + }, + "files": [ + "dist" + ], + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/eslint/rewrite.git", + "directory": "packages/plugin-kit" + }, + "bugs": { + "url": "https://github.com/eslint/rewrite/issues" + }, + "homepage": "https://github.com/eslint/rewrite/tree/main/packages/plugin-kit#readme", + "scripts": { + "build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js", + "build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts && node -e \"fs.cpSync('dist/esm/types.d.ts', 'dist/cjs/types.d.cts')\"", + "build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts", + "lint:types": "attw --pack", + "pretest": "npm run build", + "test": "npm run test:types && npm run test:unit", + "test:coverage": "npm run build && c8 npm run test:unit", + "test:jsr": "npx -y jsr@latest publish --dry-run", + "test:types": "tsc -p tests/types/tsconfig.json", + "test:unit": "mocha \"tests/**/*.test.js\"" + }, + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin" + ], + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "devDependencies": { + "@types/levn": "^0.4.0", + "rollup-plugin-copy": "^3.5.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } +} diff --git a/node_modules/@exodus/bytes/LICENSE b/node_modules/@exodus/bytes/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9971d41c9579b1b978f3fb341e48028a1b3f6e72 --- /dev/null +++ b/node_modules/@exodus/bytes/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024-2025 Exodus Movement + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@exodus/bytes/README.md b/node_modules/@exodus/bytes/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a2e9580fecbb992daa22a186331f9e5395069c16 --- /dev/null +++ b/node_modules/@exodus/bytes/README.md @@ -0,0 +1,818 @@ +# @exodus/bytes + +[![](https://img.shields.io/npm/v/@exodus/bytes?style=flat-square)](https://npmjs.org/package/@exodus/bytes) +[![](https://img.shields.io/github/release/ExodusOSS/bytes?style=flat-square&logo=github)](https://github.com/ExodusOSS/bytes/releases) +[![](https://img.shields.io/npm/dm/@exodus/bytes?style=flat-square)](https://www.npmcharts.com/compare/@exodus/bytes?minimal=true) +[![](https://img.shields.io/npm/l/@exodus/bytes?style=flat-square&color=blue)](https://github.com/ExodusOSS/bytes/blob/HEAD/LICENSE) +[![](https://img.shields.io/github/check-runs/ExodusOSS/bytes/main?style=flat-square&logo=github)](https://github.com/ExodusOSS/bytes/actions/workflows/test.yml?query=branch%3Amain) +[![](https://img.shields.io/badge/Documentation-3178c6?style=flat-square&logo=TypeScript&logoColor=fff)](https://exodusoss.github.io/bytes/) + +`Uint8Array` conversion to and from `base64`, `base32`, `base58`, `hex`, `utf8`, `utf16`, `bech32` and `wif` + +And a [`TextEncoder` / `TextDecoder` polyfill](#textencoder--textdecoder-polyfill) + +See [documentation](https://exodusoss.github.io/bytes/). + +## Strict + +Performs proper input validation, ensures no garbage-in-garbage-out + +Tested in CI with [@exodus/test](https://github.com/ExodusMovement/test#exodustest) on: + +[![Node.js](https://img.shields.io/badge/Node.js-338750?style=for-the-badge&logo=Node.js&logoColor=FFF)](https://nodejs.org/api/test.html) +[![Deno](https://img.shields.io/badge/Deno-121417?style=for-the-badge&logo=Deno&logoColor=FFF)](https://deno.com/) +[![Bun](https://img.shields.io/badge/Bun-F472B6?style=for-the-badge&logo=Bun&logoColor=FFF)](https://bun.sh/) +[![Electron](https://img.shields.io/badge/Electron-2F3242?style=for-the-badge&logo=Electron&logoColor=A2ECFB)](http://electronjs.org/) +[![workerd](https://img.shields.io/badge/workerd-F38020?style=for-the-badge&logo=cloudflareworkers&logoColor=FFF)](https://github.com/cloudflare/workerd)\ +[![Chrome](https://img.shields.io/badge/Chrome-4285F4?style=for-the-badge&logo=GoogleChrome&logoColor=FFF)](https://www.chromium.org/Home/) +[![WebKit](https://img.shields.io/badge/WebKit-006CFF?style=for-the-badge&logo=Safari&logoColor=FFF)](http://webkit.org/) +[![Firefox](https://img.shields.io/badge/Firefox-FF7139?style=for-the-badge&logo=Firefox&logoColor=FFF)](https://github.com/mozilla-firefox) +[![Servo](https://img.shields.io/badge/Servo-009D9A?style=for-the-badge)](https://servo.org/)\ +[![Hermes](https://img.shields.io/badge/Hermes-282C34?style=for-the-badge&logo=React)](https://hermesengine.dev) +[![V8](https://img.shields.io/badge/V8-4285F4?style=for-the-badge&logo=V8&logoColor=white)](https://v8.dev/docs/d8) +[![JavaScriptCore](https://img.shields.io/badge/JavaScriptCore-006CFF?style=for-the-badge)](https://docs.webkit.org/Deep%20Dive/JSC/JavaScriptCore.html) +[![SpiderMonkey](https://img.shields.io/badge/SpiderMonkey-FFD681?style=for-the-badge)](https://spidermonkey.dev/)\ +[![QuickJS](https://img.shields.io/badge/QuickJS-E58200?style=for-the-badge)](https://github.com/quickjs-ng/quickjs) +[![XS](https://img.shields.io/badge/XS-0B307A?style=for-the-badge)](https://github.com/Moddable-OpenSource/moddable) +[![GraalJS](https://img.shields.io/badge/GraalJS-C74634?style=for-the-badge)](https://github.com/oracle/graaljs) + +## Fast + +* `10-20x` faster than `Buffer` polyfill +* `2-10x` faster than `iconv-lite` + +The above was for the js fallback + +It's up to `100x` when native impl is available \ +e.g. in `utf8fromString` on Hermes / React Native or `fromHex` in Chrome + +Also: +* `3-8x` faster than `bs58` +* `10-30x` faster than `@scure/base` (or `>100x` on Node.js <25) +* Faster in `utf8toString` / `utf8fromString` than `Buffer` or `TextDecoder` / `TextEncoder` on Node.js + +See [Performance](./Performance.md) for more info + +## TextEncoder / TextDecoder polyfill + +```js +import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding.js' +import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding.js' // Requires Streams +``` + +Less than half the bundle size of [text-encoding](https://npmjs.com/text-encoding), [whatwg-encoding](https://npmjs.com/whatwg-encoding) or [iconv-lite](https://npmjs.com/iconv-lite) (gzipped or not).\ +Also [much faster](#fast) than all of those. + +> [!TIP] +> See also the [lite version](#lite-version) to get this down to 8 KiB gzipped. + +Spec compliant, passing WPT and covered with extra tests.\ +Moreover, tests for this library uncovered [bugs in all major implementations](https://docs.google.com/spreadsheets/d/1pdEefRG6r9fZy61WHGz0TKSt8cO4ISWqlpBN5KntIvQ/edit).\ +Including all three major browser engines being wrong at UTF-8.\ +See [WPT pull request](https://github.com/web-platform-tests/wpt/pull/56892). + +It works correctly even in environments that have native implementations broken (that's all of them currently).\ +Runs (and passes WPT) on Node.js built without ICU. + +> [!NOTE] +> [Faster than Node.js native implementation on Node.js](https://github.com/nodejs/node/issues/61041#issuecomment-3649242024). +> +> The JS multi-byte version is as fast as native impl in Node.js and browsers, but (unlike them) returns correct results. +> +> For encodings where native version is known to be fast and correct, it is automatically used.\ +> Some single-byte encodings are faster than native in all three major browser engines. + +See [analysis table](https://docs.google.com/spreadsheets/d/1pdEefRG6r9fZy61WHGz0TKSt8cO4ISWqlpBN5KntIvQ/edit) for more info. + +### Caveat: `TextDecoder` / `TextEncoder` APIs are lossy by default per spec + +_These are only provided as a compatibility layer, prefer hardened APIs instead in new code._ + + * `TextDecoder` can (and should) be used with `{ fatal: true }` option for all purposes demanding correctness / lossless transforms + + * `TextEncoder` does not support a fatal mode per spec, it always performs replacement. + + That is not suitable for hashing, cryptography or consensus applications.\ + Otherwise there would be non-equal strings with equal signatures and hashes โ€” the collision is caused by the lossy transform of a JS string to bytes. + Those also survive e.g. `JSON.stringify`/`JSON.parse` or being sent over network. + + Use strict APIs in new applications, see `utf8fromString` / `utf16fromString` below.\ + Those throw on non-well-formed strings by default. + +### Lite version + +Alternate exports exist that can help reduce bundle size, see comparison: + +| import | size | +| - | - | +| [@exodus/bytes/encoding-browser.js](#exodusbytesencoding-browserjs-) | ![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-browser.js?style=flat-square) | +| [@exodus/bytes/encoding-lite.js](#exodusbytesencoding-litejs-) | ![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-lite.js?style=flat-square) | +| [@exodus/bytes/encoding.js](#exodusbytesencodingjs-) | ![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding.js?style=flat-square) | +| `text-encoding` | ![](https://img.shields.io/bundlejs/size/text-encoding?style=flat-square) | +| `iconv-lite` | ![](https://img.shields.io/bundlejs/size/iconv-lite/lib/index.js?style=flat-square) | +| `whatwg-encoding` | ![](https://img.shields.io/bundlejs/size/whatwg-encoding?style=flat-square) | + +Libraries are advised to use single-purpose hardened `@exodus/bytes/utf8.js` / `@exodus/bytes/utf16.js` APIs for Unicode. + +Applications (including React Native apps) are advised to load either `@exodus/bytes/encoding-lite.js` or `@exodus/bytes/encoding.js` +(depending on whether legacy multi-byte support is needed) and use that as a global polyfill. + +#### `@exodus/bytes/encoding-lite.js` + +If you don't need support for legacy multi-byte encodings. + +Reduces the bundle size ~12x, while still keeping `utf-8`, `utf-16le`, `utf-16be` and all single-byte encodings specified by the spec. +The only difference is support for legacy multi-byte encodings. + +See [the list of encodings](https://encoding.spec.whatwg.org/#names-and-labels). + +This can be useful for example in React Native global TextDecoder polyfill, +if you are sure that you don't need legacy multi-byte encodings support. + +#### `@exodus/bytes/encoding-browser.js` + +Resolves to a tiny import in browser bundles, preferring native `TextDecoder` / `TextEncoder`. + +For non-browsers (Node.js, React Native), loads a full implementation. + +> [!NOTE] +> This is not the default behavior for `@exodus/bytes/encoding.js` because all major browser implementations have bugs, +> which `@exodus/bytes/encoding.js` fixes. Only use if you are ok with that. + +## API + +### @exodus/bytes/utf8.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/utf8.js?style=flat-square) + +UTF-8 encoding/decoding + +```js +import { utf8fromString, utf8toString } from '@exodus/bytes/utf8.js' + +// loose +import { utf8fromStringLoose, utf8toStringLoose } from '@exodus/bytes/utf8.js' +``` + +_These methods by design encode/decode BOM (codepoint `U+FEFF` Byte Order Mark) as-is._\ +_If you need BOM handling or detection, use `@exodus/bytes/encoding.js`_ + +#### `utf8fromString(string, format = 'uint8')` + +Encode a string to UTF-8 bytes (strict mode) + +Throws on invalid Unicode (unpaired surrogates) + +This is similar to the following snippet (but works on all engines): +```js +// Strict encode, requiring Unicode codepoints to be valid +if (typeof string !== 'string' || !string.isWellFormed()) throw new TypeError() +return new TextEncoder().encode(string) +``` + +#### `utf8fromStringLoose(string, format = 'uint8')` + +Encode a string to UTF-8 bytes (loose mode) + +Replaces invalid Unicode (unpaired surrogates) with replacement codepoints `U+FFFD` +per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification. + +_Such replacement is a non-injective function, is irreversable and causes collisions.\ +Prefer using strict throwing methods for cryptography applications._ + +This is similar to the following snippet (but works on all engines): +```js +// Loose encode, replacing invalid Unicode codepoints with U+FFFD +if (typeof string !== 'string') throw new TypeError() +return new TextEncoder().encode(string) +``` + +#### `utf8toString(arr)` + +Decode UTF-8 bytes to a string (strict mode) + +Throws on invalid UTF-8 byte sequences + +This is similar to `new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(arr)`, +but works on all engines. + +#### `utf8toStringLoose(arr)` + +Decode UTF-8 bytes to a string (loose mode) + +Replaces invalid UTF-8 byte sequences with replacement codepoints `U+FFFD` +per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification. + +_Such replacement is a non-injective function, is irreversable and causes collisions.\ +Prefer using strict throwing methods for cryptography applications._ + +This is similar to `new TextDecoder('utf-8', { ignoreBOM: true }).decode(arr)`, +but works on all engines. + +### @exodus/bytes/utf16.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/utf16.js?style=flat-square) + +UTF-16 encoding/decoding + +```js +import { utf16fromString, utf16toString } from '@exodus/bytes/utf16.js' + +// loose +import { utf16fromStringLoose, utf16toStringLoose } from '@exodus/bytes/utf16.js' +``` + +_These methods by design encode/decode BOM (codepoint `U+FEFF` Byte Order Mark) as-is._\ +_If you need BOM handling or detection, use `@exodus/bytes/encoding.js`_ + +#### `utf16fromString(string, format = 'uint16')` + +Encode a string to UTF-16 bytes (strict mode) + +Throws on invalid Unicode (unpaired surrogates) + +#### `utf16fromStringLoose(string, format = 'uint16')` + +Encode a string to UTF-16 bytes (loose mode) + +Replaces invalid Unicode (unpaired surrogates) with replacement codepoints `U+FFFD` +per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification. + +_Such replacement is a non-injective function, is irreversible and causes collisions.\ +Prefer using strict throwing methods for cryptography applications._ + +#### `utf16toString(arr, format = 'uint16')` + +Decode UTF-16 bytes to a string (strict mode) + +Throws on invalid UTF-16 byte sequences + +Throws on non-even byte length. + +#### `utf16toStringLoose(arr, format = 'uint16')` + +Decode UTF-16 bytes to a string (loose mode) + +Replaces invalid UTF-16 byte sequences with replacement codepoints `U+FFFD` +per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification. + +_Such replacement is a non-injective function, is irreversible and causes collisions.\ +Prefer using strict throwing methods for cryptography applications._ + +Throws on non-even byte length. + +### @exodus/bytes/bigint.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/bigint.js?style=flat-square) + +Convert between BigInt and Uint8Array + +```js +import { fromBigInt, toBigInt } from '@exodus/bytes/bigint.js' +``` + +#### `fromBigInt(bigint, { length, format = 'uint8' })` + +Convert a BigInt to a Uint8Array or Buffer + +The output bytes are in big-endian format. + +Throws if the BigInt is negative or cannot fit into the specified length. + +#### `toBigInt(arr)` + +Convert a Uint8Array or Buffer to a BigInt + +The bytes are interpreted as a big-endian unsigned integer. + +### @exodus/bytes/hex.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/hex.js?style=flat-square) + +Implements Base16 from [RFC4648](https://datatracker.ietf.org/doc/html/rfc4648) +(no differences from [RFC3548](https://datatracker.ietf.org/doc/html/rfc4648)). + +```js +import { fromHex, toHex } from '@exodus/bytes/hex.js' +``` + +#### `fromHex(string, format = 'uint8')` + +Decode a hex string to bytes + +Unlike `Buffer.from()`, throws on invalid input + +#### `toHex(arr)` + +Encode a `Uint8Array` to a lowercase hex string + +### @exodus/bytes/base64.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/base64.js?style=flat-square) + +Implements base64 and base64url from [RFC4648](https://datatracker.ietf.org/doc/html/rfc4648) +(no differences from [RFC3548](https://datatracker.ietf.org/doc/html/rfc4648)). + +```js +import { fromBase64, toBase64 } from '@exodus/bytes/base64.js' +import { fromBase64url, toBase64url } from '@exodus/bytes/base64.js' +import { fromBase64any } from '@exodus/bytes/base64.js' +``` + +#### `fromBase64(string, { format = 'uint8', padding = 'both' })` + +Decode a base64 string to bytes + +Operates in strict mode for last chunk, does not allow whitespace + +#### `fromBase64url(string, { format = 'uint8', padding = false })` + +Decode a base64url string to bytes + +Operates in strict mode for last chunk, does not allow whitespace + +#### `fromBase64any(string, { format = 'uint8', padding = 'both' })` + +Decode either base64 or base64url string to bytes + +Automatically detects the variant based on characters present + +#### `toBase64(arr, { padding = true })` + +Encode a `Uint8Array` to a base64 string (RFC 4648) + +#### `toBase64url(arr, { padding = false })` + +Encode a `Uint8Array` to a base64url string (RFC 4648) + +### @exodus/bytes/base32.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/base32.js?style=flat-square) + +Implements base32 and base32hex from [RFC4648](https://datatracker.ietf.org/doc/html/rfc4648) +(no differences from [RFC3548](https://datatracker.ietf.org/doc/html/rfc4648)). + +```js +import { fromBase32, toBase32 } from '@exodus/bytes/base32.js' +import { fromBase32hex, toBase32hex } from '@exodus/bytes/base32.js' +``` + +#### `fromBase32(string, { format = 'uint8', padding = 'both' })` + +Decode a base32 string to bytes + +Operates in strict mode for last chunk, does not allow whitespace + +#### `fromBase32hex(string, { format = 'uint8', padding = 'both' })` + +Decode a base32hex string to bytes + +Operates in strict mode for last chunk, does not allow whitespace + +#### `fromBase32crockford(string, options)` + +Decode a Crockford base32 string to bytes + +Operates in strict mode for last chunk, does not allow whitespace + +Crockford base32 decoding follows extra mapping per spec: `LIli -> 1, Oo -> 0` + +#### `toBase32(arr, { padding = false })` + +Encode a `Uint8Array` to a base32 string (RFC 4648) + +#### `toBase32hex(arr, { padding = false })` + +Encode a `Uint8Array` to a base32hex string (RFC 4648) + +#### `toBase32crockford(arr, options)` + +Encode a `Uint8Array` to a Crockford base32 string + +### @exodus/bytes/bech32.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/bech32.js?style=flat-square) + +Implements bech32 and bech32m from +[BIP-0173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#specification) +and [BIP-0350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki#specification). + +```js +import { fromBech32, toBech32 } from '@exodus/bytes/bech32.js' +import { fromBech32m, toBech32m } from '@exodus/bytes/bech32.js' +import { getPrefix } from '@exodus/bytes/bech32.js' +``` + +#### `getPrefix(string, limit = 90)` + +Extract the prefix from a bech32 or bech32m string without full validation + +This is a quick check that skips most validation. + +#### `fromBech32(string, limit = 90)` + +Decode a bech32 string to bytes + +#### `toBech32(prefix, bytes, limit = 90)` + +Encode bytes to a bech32 string + +#### `fromBech32m(string, limit = 90)` + +Decode a bech32m string to bytes + +#### `toBech32m(prefix, bytes, limit = 90)` + +Encode bytes to a bech32m string + +### @exodus/bytes/base58.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/base58.js?style=flat-square) + +Implements [base58](https://www.ietf.org/archive/id/draft-msporny-base58-03.txt) encoding. + +Supports both standard base58 and XRP variant alphabets. + +```js +import { fromBase58, toBase58 } from '@exodus/bytes/base58.js' +import { fromBase58xrp, toBase58xrp } from '@exodus/bytes/base58.js' +``` + +#### `fromBase58(string, format = 'uint8')` + +Decode a base58 string to bytes + +Uses the standard Bitcoin base58 alphabet + +#### `toBase58(arr)` + +Encode a `Uint8Array` to a base58 string + +Uses the standard Bitcoin base58 alphabet + +#### `fromBase58xrp(string, format = 'uint8')` + +Decode a base58 string to bytes using XRP alphabet + +Uses the XRP variant base58 alphabet + +#### `toBase58xrp(arr)` + +Encode a `Uint8Array` to a base58 string using XRP alphabet + +Uses the XRP variant base58 alphabet + +### @exodus/bytes/base58check.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/base58check.js?style=flat-square) + +Implements [base58check](https://en.bitcoin.it/wiki/Base58Check_encoding) encoding. + +```js +import { fromBase58check, toBase58check } from '@exodus/bytes/base58check.js' +import { fromBase58checkSync, toBase58checkSync } from '@exodus/bytes/base58check.js' +import { makeBase58check } from '@exodus/bytes/base58check.js' +``` + +On non-Node.js, requires peer dependency [@noble/hashes](https://www.npmjs.com/package/@noble/hashes) to be installed. + +#### `async fromBase58check(string, format = 'uint8')` + +Decode a base58check string to bytes asynchronously + +Validates the checksum using double SHA-256 + +#### `async toBase58check(arr)` + +Encode bytes to base58check string asynchronously + +Uses double SHA-256 for checksum calculation + +#### `fromBase58checkSync(string, format = 'uint8')` + +Decode a base58check string to bytes synchronously + +Validates the checksum using double SHA-256 + +#### `toBase58checkSync(arr)` + +Encode bytes to base58check string synchronously + +Uses double SHA-256 for checksum calculation + +#### `makeBase58check(hashAlgo, hashAlgoSync)` + +Create a base58check encoder/decoder with custom hash functions + +### @exodus/bytes/wif.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/wif.js?style=flat-square) + +Wallet Import Format (WIF) encoding and decoding. + +```js +import { fromWifString, toWifString } from '@exodus/bytes/wif.js' +import { fromWifStringSync, toWifStringSync } from '@exodus/bytes/wif.js' +``` + +On non-Node.js, requires peer dependency [@noble/hashes](https://www.npmjs.com/package/@noble/hashes) to be installed. + +#### `async fromWifString(string[, version])` + +Decode a WIF string to WIF data + +Returns a promise that resolves to an object with `{ version, privateKey, compressed }`. + +The optional `version` parameter validates the version byte. + +Throws if the WIF string is invalid or version doesn't match. + +#### `fromWifStringSync(string[, version])` + +Decode a WIF string to WIF data (synchronous) + +Returns an object with `{ version, privateKey, compressed }`. + +The optional `version` parameter validates the version byte. + +Throws if the WIF string is invalid or version doesn't match. + +#### `async toWifString({ version, privateKey, compressed })` + +Encode WIF data to a WIF string + +#### `toWifStringSync({ version, privateKey, compressed })` + +Encode WIF data to a WIF string (synchronous) + +### @exodus/bytes/array.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/array.js?style=flat-square) + +TypedArray utils and conversions. + +```js +import { typedCopyBytes, typedView } from '@exodus/bytes/array.js' +``` + +#### `typedCopyBytes(arr, format = 'uint8')` + +Create a copy of TypedArray underlying bytes in the specified format (`'uint8'`, `'buffer'`, or `'arraybuffer'`) + +This does not copy _values_, but copies the underlying bytes. +The result is similar to that of `typedView()`, but this function provides a copy, not a view of the same memory. + +> [!WARNING] +> Copying underlying bytes from `Uint16Array` (or other with `BYTES_PER_ELEMENT > 1`) +> is platform endianness-dependent. + +> [!NOTE] +> Buffer might be pooled. +> Uint8Array return values are not pooled and match their underlying ArrayBuffer. + +#### `typedView(arr, format = 'uint8')` + +Create a view of a TypedArray in the specified format (`'uint8'` or `'buffer'`) + +> [!IMPORTANT] +> Does not copy data, returns a view on the same underlying buffer + +> [!WARNING] +> Viewing `Uint16Array` (or other with `BYTES_PER_ELEMENT > 1`) as bytes +> is platform endianness-dependent. + +### @exodus/bytes/encoding.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding.js?style=flat-square) + +Implements the [Encoding standard](https://encoding.spec.whatwg.org/): +[TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder), +[TextEncoder](https://encoding.spec.whatwg.org/#interface-textencoder), +[TextDecoderStream](https://encoding.spec.whatwg.org/#interface-textdecoderstream), +[TextEncoderStream](https://encoding.spec.whatwg.org/#interface-textencoderstream), +some [hooks](https://encoding.spec.whatwg.org/#specification-hooks). + +```js +import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding.js' +import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding.js' // Requires Streams +import { isomorphicDecode, isomorphicEncode } from '@exodus/bytes/encoding.js' + +// Hooks for standards +import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding.js' +``` + +#### `new TextDecoder(label = 'utf-8', { fatal = false, ignoreBOM = false })` + +[TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder) implementation/polyfill. + +Decode bytes to strings according to [WHATWG Encoding](https://encoding.spec.whatwg.org) specification. + +#### `new TextEncoder()` + +[TextEncoder](https://encoding.spec.whatwg.org/#interface-textencoder) implementation/polyfill. + +Encode strings to UTF-8 bytes according to [WHATWG Encoding](https://encoding.spec.whatwg.org) specification. + +#### `new TextDecoderStream(label = 'utf-8', { fatal = false, ignoreBOM = false })` + +[TextDecoderStream](https://encoding.spec.whatwg.org/#interface-textdecoderstream) implementation/polyfill. + +A [Streams](https://streams.spec.whatwg.org/) wrapper for `TextDecoder`. + +Requires [Streams](https://streams.spec.whatwg.org/) to be either supported by the platform or +[polyfilled](https://npmjs.com/package/web-streams-polyfill). + +#### `new TextEncoderStream()` + +[TextEncoderStream](https://encoding.spec.whatwg.org/#interface-textencoderstream) implementation/polyfill. + +A [Streams](https://streams.spec.whatwg.org/) wrapper for `TextEncoder`. + +Requires [Streams](https://streams.spec.whatwg.org/) to be either supported by the platform or +[polyfilled](https://npmjs.com/package/web-streams-polyfill). + +#### `isomorphicDecode(input)` + +Implements [isomorphic decode](https://infra.spec.whatwg.org/#isomorphic-decode). + +Given a `TypedArray` or an `ArrayBuffer` instance `input`, creates a string of the same length +as input byteLength, using bytes from input as codepoints. + +E.g. for `Uint8Array` input, this is similar to `String.fromCodePoint(...input)`. + +Wider `TypedArray` inputs, e.g. `Uint16Array`, are interpreted as underlying _bytes_. + +#### `isomorphicEncode(str)` + +Implements [isomorphic encode](https://infra.spec.whatwg.org/#isomorphic-encode). + +Given a string, creates an `Uint8Array` of the same length with the string codepoints as byte values. + +Accepts only [isomorphic string](https://infra.spec.whatwg.org/#isomorphic-string) input +and asserts that, throwing on any strings containing codepoints higher than `U+00FF`. + +#### `labelToName(label)` + +Implements [get an encoding from a string `label`](https://encoding.spec.whatwg.org/#concept-encoding-get). + +Convert an encoding [label](https://encoding.spec.whatwg.org/#names-and-labels) to its name, +as a case-sensitive string. + +If an encoding with that label does not exist, returns `null`. + +All encoding names are also valid labels for corresponding encodings. + +#### `normalizeEncoding(label)` + +Convert an encoding [label](https://encoding.spec.whatwg.org/#names-and-labels) to its name, +as an ASCII-lowercased string. + +If an encoding with that label does not exist, returns `null`. + +This is the same as [`decoder.encoding` getter](https://encoding.spec.whatwg.org/#dom-textdecoder-encoding), +except that it: + 1. Supports [`replacement` encoding](https://encoding.spec.whatwg.org/#replacement) and its + [labels](https://encoding.spec.whatwg.org/#ref-for-replacement%E2%91%A1) + 2. Does not throw for invalid labels and instead returns `null` + +It is identical to: +```js +labelToName(label)?.toLowerCase() ?? null +``` + +All encoding names are also valid labels for corresponding encodings. + +#### `getBOMEncoding(input)` + +Implements [BOM sniff](https://encoding.spec.whatwg.org/#bom-sniff) legacy hook. + +Given a `TypedArray` or an `ArrayBuffer` instance `input`, returns either of: +- `'utf-8'`, if `input` starts with UTF-8 byte order mark. +- `'utf-16le'`, if `input` starts with UTF-16LE byte order mark. +- `'utf-16be'`, if `input` starts with UTF-16BE byte order mark. +- `null` otherwise. + +#### `legacyHookDecode(input, fallbackEncoding = 'utf-8')` + +Implements [decode](https://encoding.spec.whatwg.org/#decode) legacy hook. + +Given a `TypedArray` or an `ArrayBuffer` instance `input` and an optional `fallbackEncoding` +encoding [label](https://encoding.spec.whatwg.org/#names-and-labels), +sniffs encoding from BOM with `fallbackEncoding` fallback and then +decodes the `input` using that encoding, skipping BOM if it was present. + +Notes: + +- BOM-sniffed encoding takes precedence over `fallbackEncoding` option per spec. + Use with care. +- Always operates in non-fatal [mode](https://encoding.spec.whatwg.org/#textdecoder-error-mode), + aka replacement. It can convert different byte sequences to equal strings. + +This method is similar to the following code, except that it doesn't support encoding labels and +only expects lowercased encoding name: + +```js +new TextDecoder(getBOMEncoding(input) ?? fallbackEncoding).decode(input) +``` + +### @exodus/bytes/encoding-lite.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-lite.js?style=flat-square) + +The exact same exports as `@exodus/bytes/encoding.js` are also exported as +`@exodus/bytes/encoding-lite.js`, with the difference that the lite version does not load +multi-byte `TextDecoder` encodings by default to reduce bundle size ~12x. + +```js +import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding-lite.js' +import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding-lite.js' // Requires Streams +import { isomorphicDecode, isomorphicEncode } from '@exodus/bytes/encoding-lite.js' + +// Hooks for standards +import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding-lite.js' +``` + +The only affected encodings are: `gbk`, `gb18030`, `big5`, `euc-jp`, `iso-2022-jp`, `shift_jis` +and their [labels](https://encoding.spec.whatwg.org/#names-and-labels) when used with `TextDecoder`. + +Legacy single-byte encodingds are loaded by default in both cases. + +`TextEncoder` and hooks for standards (including `labelToName` / `normalizeEncoding`) do not have any behavior +differences in the lite version and support full range if inputs. + +To avoid inconsistencies, the exported classes and methods are exactly the same objects. + +```console +> lite = require('@exodus/bytes/encoding-lite.js') +[Module: null prototype] { + TextDecoder: [class TextDecoder], + TextDecoderStream: [class TextDecoderStream], + TextEncoder: [class TextEncoder], + TextEncoderStream: [class TextEncoderStream], + getBOMEncoding: [Function: getBOMEncoding], + labelToName: [Function: labelToName], + legacyHookDecode: [Function: legacyHookDecode], + normalizeEncoding: [Function: normalizeEncoding] +} +> new lite.TextDecoder('big5').decode(Uint8Array.of(0x25)) +Uncaught: +Error: Legacy multi-byte encodings are disabled in /encoding-lite.js, use /encoding.js for full encodings range support + +> full = require('@exodus/bytes/encoding.js') +[Module: null prototype] { + TextDecoder: [class TextDecoder], + TextDecoderStream: [class TextDecoderStream], + TextEncoder: [class TextEncoder], + TextEncoderStream: [class TextEncoderStream], + getBOMEncoding: [Function: getBOMEncoding], + labelToName: [Function: labelToName], + legacyHookDecode: [Function: legacyHookDecode], + normalizeEncoding: [Function: normalizeEncoding] +} +> full.TextDecoder === lite.TextDecoder +true +> new full.TextDecoder('big5').decode(Uint8Array.of(0x25)) +'%' +> new lite.TextDecoder('big5').decode(Uint8Array.of(0x25)) +'%' +``` + +### @exodus/bytes/encoding-browser.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/encoding-browser.js?style=flat-square) + +Same as `@exodus/bytes/encoding.js`, but in browsers instead of polyfilling just uses whatever the +browser provides, drastically reducing the bundle size (to less than 2 KiB gzipped). + +Does not provide `isomorphicDecode` and `isomorphicEncode` exports. + +```js +import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding-browser.js' +import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding-browser.js' // Requires Streams + +// Hooks for standards +import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding-browser.js' +``` + +Under non-browser engines (Node.js, React Native, etc.) a full polyfill is used as those platforms +do not provide sufficiently complete / non-buggy `TextDecoder` APIs. + +> [!NOTE] +> Implementations in browsers [have bugs](https://docs.google.com/spreadsheets/d/1pdEefRG6r9fZy61WHGz0TKSt8cO4ISWqlpBN5KntIvQ/edit), +> but they are fixing them and the expected update window is short.\ +> If you want to circumvent browser bugs, use full `@exodus/bytes/encoding.js` import. + +### @exodus/bytes/whatwg.js ![](https://img.shields.io/bundlejs/size/@exodus/bytes/whatwg.js?style=flat-square) + +WHATWG helpers + +```js +import '@exodus/bytes/encoding.js' // For full legacy multi-byte encodings support +import { percentEncodeAfterEncoding } from '@exodus/bytes/whatwg.js' +``` + +#### `percentEncodeAfterEncoding(encoding, input, percentEncodeSet, spaceAsPlus = false)` + +Implements [percent-encode after encoding](https://url.spec.whatwg.org/#string-percent-encode-after-encoding) +per WHATWG URL specification. + +> [!IMPORTANT] +> You must import `@exodus/bytes/encoding.js` for this API to accept legacy multi-byte encodings. + +Encodings `utf16-le`, `utf16-be`, and `replacement` are not accepted. + +[C0 control percent-encode set](https://url.spec.whatwg.org/#c0-control-percent-encode-set) is +always percent-encoded. + +`percentEncodeSet` is an addition to that, and must be a string of unique increasing codepoints +in range 0x20 - 0x7e, e.g. `' "#<>'`. + +This method accepts [DOMStrings](https://webidl.spec.whatwg.org/#idl-DOMString) and converts them +to [USVStrings](https://webidl.spec.whatwg.org/#idl-USVString). +This is different from e.g. `encodeURI` and `encodeURIComponent` which throw on surrogates: +```js +> percentEncodeAfterEncoding('utf8', '\ud800', ' "#$%&+,/:;<=>?@[\\]^`{|}') // component +'%EF%BF%BD' +> encodeURIComponent('\ud800') +Uncaught URIError: URI malformed +``` + +## Changelog + +See [GitHub Releases](https://github.com/ExodusOSS/bytes/releases) tab + +## License + +[MIT](./LICENSE) diff --git a/node_modules/@exodus/bytes/array.d.ts b/node_modules/@exodus/bytes/array.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..67f036f34b77958979f5d8b0c4268f288c021b55 --- /dev/null +++ b/node_modules/@exodus/bytes/array.d.ts @@ -0,0 +1,89 @@ +/** + * TypedArray utils and conversions. + * + * ```js + * import { typedCopyBytes, typedView } from '@exodus/bytes/array.js' + * ``` + * + * @module @exodus/bytes/array.js + */ + +/// + +// >= TypeScript 5.9 made Uint8Array templated with <> and defaulted to ArrayBufferLike +// which would incorrectly accept SharedArrayBuffer instances. +// < TypeScript 5.7 doesn't support templates for Uint8Array. +// So this type is defined as a workaround to evaluate to Uint8Array on all versions of TypeScript. + +/** + * This is `Uint8Array` + * (as opposed to `Uint8Array` and `Uint8Array`) + * on TypeScript versions that support that distinction. + * + * On TypeScript < 5.7, this is just `Uint8Array`, as it's not a template there. + */ +export type Uint8ArrayBuffer = ReturnType; + +/** + * This is `Uint16Array` + * (as opposed to `Uint16Array` and `Uint16Array`) + * on TypeScript versions that support that distinction. + * + * On TypeScript < 5.7, this is just `Uint16Array`, as it's not a template there. + */ +export type Uint16ArrayBuffer = ReturnType; + +/** + * This is `Uint32Array` + * (as opposed to `Uint32Array` and `Uint32Array`) + * on TypeScript versions that support that distinction. + * + * On TypeScript < 5.7, this is just `Uint32Array`, as it's not a template there. + */ +export type Uint32ArrayBuffer = ReturnType; + +/** + * Output format for typed array conversions + */ +export type OutputFormat = 'uint8' | 'arraybuffer' | 'buffer'; + +/** + * Create a view of a TypedArray in the specified format (`'uint8'` or `'buffer'`) + * + * > [!IMPORTANT] + * > Does not copy data, returns a view on the same underlying buffer + * + * > [!WARNING] + * > Viewing `Uint16Array` (or other with `BYTES_PER_ELEMENT > 1`) as bytes + * > is platform endianness-dependent. + * + * @param arr - The input TypedArray + * @param format - The desired output format (`'uint8'` or `'buffer'`) + * @returns A view on the same underlying buffer + */ +export function typedView(arr: ArrayBufferView, format: 'uint8'): Uint8Array; +export function typedView(arr: ArrayBufferView, format: 'buffer'): Buffer; +export function typedView(arr: ArrayBufferView, format: 'uint8' | 'buffer'): Uint8Array | Buffer; + +/** + * Create a copy of TypedArray underlying bytes in the specified format (`'uint8'`, `'buffer'`, or `'arraybuffer'`) + * + * This does not copy _values_, but copies the underlying bytes. + * The result is similar to that of `typedView()`, but this function provides a copy, not a view of the same memory. + * + * > [!WARNING] + * > Copying underlying bytes from `Uint16Array` (or other with `BYTES_PER_ELEMENT > 1`) + * > is platform endianness-dependent. + * + * > [!NOTE] + * > Buffer might be pooled. + * > Uint8Array return values are not pooled and match their underlying ArrayBuffer. + * + * @param arr - The input TypedArray + * @param format - The desired output format (`'uint8'`, `'buffer'`, or `'arraybuffer'`) + * @returns A copy of the underlying buffer + */ +export function typedCopyBytes(arr: ArrayBufferView, format: 'uint8'): Uint8Array; +export function typedCopyBytes(arr: ArrayBufferView, format: 'arraybuffer'): ArrayBuffer; +export function typedCopyBytes(arr: ArrayBufferView, format: 'buffer'): Buffer; +export function typedCopyBytes(arr: ArrayBufferView, format: OutputFormat): Uint8Array | ArrayBuffer | Buffer; diff --git a/node_modules/@exodus/bytes/array.js b/node_modules/@exodus/bytes/array.js new file mode 100644 index 0000000000000000000000000000000000000000..9d4db17547e2c823599c661ceda5117ae2545c64 --- /dev/null +++ b/node_modules/@exodus/bytes/array.js @@ -0,0 +1,35 @@ +import { assertTypedArray } from './assert.js' + +const Buffer = globalThis.Buffer // Buffer is optional + +export function typedView(arr, format) { + assertTypedArray(arr) + switch (format) { + case 'uint8': + if (arr.constructor === Uint8Array) return arr // fast path + return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength) + case 'buffer': + if (arr.constructor === Buffer && Buffer.isBuffer(arr)) return arr + return Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength) + } + + throw new TypeError('Unexpected format') +} + +export function typedCopyBytes(arr, format) { + assertTypedArray(arr) + if (!(arr instanceof Uint8Array)) { + arr = new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength) + } + + switch (format) { + case 'uint8': + return Uint8Array.from(arr) // never pooled + case 'buffer': + return Buffer.from(arr) + case 'arraybuffer': + return Uint8Array.from(arr).buffer + } + + throw new TypeError('Unexpected format') +} diff --git a/node_modules/@exodus/bytes/assert.js b/node_modules/@exodus/bytes/assert.js new file mode 100644 index 0000000000000000000000000000000000000000..f033b7fc7f110d777d3cacd5e045851d94cb8dc3 --- /dev/null +++ b/node_modules/@exodus/bytes/assert.js @@ -0,0 +1,26 @@ +export function assertEmptyRest(rest) { + if (Object.keys(rest).length > 0) throw new TypeError('Unexpected extra options') +} + +// eslint-disable-next-line sonarjs/no-nested-template-literals +const makeMessage = (name, extra) => `Expected${name ? ` ${name} to be` : ''} an Uint8Array${extra}` + +const TypedArray = Object.getPrototypeOf(Uint8Array) + +export function assertTypedArray(arr) { + if (arr && arr instanceof TypedArray) return + throw new TypeError('Expected a TypedArray instance') +} + +export function assertUint8(arr, options) { + if (!options) { + // fast path + if (arr instanceof Uint8Array) return + throw new TypeError('Expected an Uint8Array') + } + + const { name, length, ...rest } = options + assertEmptyRest(rest) + if (arr instanceof Uint8Array && (length === undefined || arr.length === length)) return + throw new TypeError(makeMessage(name, length === undefined ? '' : ` of size ${Number(length)}`)) +} diff --git a/node_modules/@exodus/bytes/base32.d.ts b/node_modules/@exodus/bytes/base32.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6e68bc36114c1e56957df0fb5170317dbb99091 --- /dev/null +++ b/node_modules/@exodus/bytes/base32.d.ts @@ -0,0 +1,112 @@ +/** + * Implements base32 and base32hex from [RFC4648](https://datatracker.ietf.org/doc/html/rfc4648) + * (no differences from [RFC3548](https://datatracker.ietf.org/doc/html/rfc4648)). + * + * ```js + * import { fromBase32, toBase32 } from '@exodus/bytes/base32.js' + * import { fromBase32hex, toBase32hex } from '@exodus/bytes/base32.js' + * ``` + * + * @module @exodus/bytes/base32.js + */ + +/// + +import type { OutputFormat, Uint8ArrayBuffer } from './array.js'; + +/** + * Options for base32 encoding + */ +export interface ToBase32Options { + /** Whether to include padding characters (default: false) */ + padding?: boolean; +} + +/** + * Padding mode for base32 decoding + * - `true`: padding is required + * - `false`: padding is not allowed + * - `'both'`: padding is optional (default) + */ +export type PaddingMode = boolean | 'both'; + +/** + * Options for base32 decoding + */ +export interface FromBase32Options { + /** Output format (default: 'uint8') */ + format?: OutputFormat; + /** Padding mode */ + padding?: PaddingMode; +} + +/** + * Encode a `Uint8Array` to a base32 string (RFC 4648) + * + * @param arr - The input bytes + * @param options - Encoding options + * @returns The base32 encoded string + */ +export function toBase32(arr: Uint8Array, options?: ToBase32Options): string; + +/** + * Encode a `Uint8Array` to a base32hex string (RFC 4648) + * + * @param arr - The input bytes + * @param options - Encoding options (padding defaults to false) + * @returns The base32hex encoded string + */ +export function toBase32hex(arr: Uint8Array, options?: ToBase32Options): string; + +/** + * Encode a `Uint8Array` to a Crockford base32 string + * + * @param arr - The input bytes + * @param options - Encoding options (padding defaults to false) + * @returns The Crockford base32 encoded string + */ +export function toBase32crockford(arr: Uint8Array, options?: ToBase32Options): string; + +/** + * Decode a base32 string to bytes + * + * Operates in strict mode for last chunk, does not allow whitespace + * + * @param string - The base32 encoded string + * @param options - Decoding options + * @returns The decoded bytes + */ +export function fromBase32(string: string, options?: FromBase32Options & { format?: 'uint8' }): Uint8ArrayBuffer; +export function fromBase32(string: string, options: FromBase32Options & { format: 'arraybuffer' }): ArrayBuffer; +export function fromBase32(string: string, options: FromBase32Options & { format: 'buffer' }): Buffer; +export function fromBase32(string: string, options?: FromBase32Options): Uint8ArrayBuffer | ArrayBuffer | Buffer; + +/** + * Decode a base32hex string to bytes + * + * Operates in strict mode for last chunk, does not allow whitespace + * + * @param string - The base32hex encoded string + * @param options - Decoding options + * @returns The decoded bytes + */ +export function fromBase32hex(string: string, options?: FromBase32Options & { format?: 'uint8' }): Uint8ArrayBuffer; +export function fromBase32hex(string: string, options: FromBase32Options & { format: 'arraybuffer' }): ArrayBuffer; +export function fromBase32hex(string: string, options: FromBase32Options & { format: 'buffer' }): Buffer; +export function fromBase32hex(string: string, options?: FromBase32Options): Uint8ArrayBuffer | ArrayBuffer | Buffer; + +/** + * Decode a Crockford base32 string to bytes + * + * Operates in strict mode for last chunk, does not allow whitespace + * + * Crockford base32 decoding follows extra mapping per spec: `LIli -> 1, Oo -> 0` + * + * @param string - The Crockford base32 encoded string + * @param options - Decoding options + * @returns The decoded bytes + */ +export function fromBase32crockford(string: string, options?: FromBase32Options & { format?: 'uint8' }): Uint8ArrayBuffer; +export function fromBase32crockford(string: string, options: FromBase32Options & { format: 'arraybuffer' }): ArrayBuffer; +export function fromBase32crockford(string: string, options: FromBase32Options & { format: 'buffer' }): Buffer; +export function fromBase32crockford(string: string, options?: FromBase32Options): Uint8ArrayBuffer | ArrayBuffer | Buffer; diff --git a/node_modules/@exodus/bytes/base32.js b/node_modules/@exodus/bytes/base32.js new file mode 100644 index 0000000000000000000000000000000000000000..b4d34bf4fa0bbf6667119214a889eeb31f8c5bdc --- /dev/null +++ b/node_modules/@exodus/bytes/base32.js @@ -0,0 +1,37 @@ +import { assertEmptyRest } from './assert.js' +import { fromUint8, E_STRING } from './fallback/_utils.js' +import * as js from './fallback/base32.js' + +// See https://datatracker.ietf.org/doc/html/rfc4648 + +// 8 chars per 5 bytes + +function fromBase32common(str, mode, padding, format, rest) { + if (typeof str !== 'string') throw new TypeError(E_STRING) + if (rest !== null) assertEmptyRest(rest) + + if (padding === true) { + if (str.length % 8 !== 0) throw new SyntaxError(js.E_PADDING) + } else if (padding === false) { + if (str.endsWith('=')) throw new SyntaxError('Did not expect padding in base32 input') + } else if (padding !== 'both') { + throw new TypeError('Invalid padding option') + } + + return fromUint8(js.fromBase32(str, mode), format) +} + +// By default, valid padding is accepted but not required +const fromBase32wrap = (mode) => (str, options) => { + if (!options) return fromBase32common(str, mode, 'both', 'uint8', null) + const { format = 'uint8', padding = 'both', ...rest } = options + return fromBase32common(str, mode, padding, format, rest) +} + +export const fromBase32 = fromBase32wrap(0) +export const fromBase32hex = fromBase32wrap(1) +export const fromBase32crockford = fromBase32wrap(2) + +export const toBase32 = (arr, { padding = false } = {}) => js.toBase32(arr, 0, padding) +export const toBase32hex = (arr, { padding = false } = {}) => js.toBase32(arr, 1, padding) +export const toBase32crockford = (arr, { padding = false } = {}) => js.toBase32(arr, 2, padding) diff --git a/node_modules/@exodus/bytes/base58.d.ts b/node_modules/@exodus/bytes/base58.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fa229500feeac4b35a81ed3b632045ef21289b13 --- /dev/null +++ b/node_modules/@exodus/bytes/base58.d.ts @@ -0,0 +1,64 @@ +/** + * Implements [base58](https://www.ietf.org/archive/id/draft-msporny-base58-03.txt) encoding. + * + * Supports both standard base58 and XRP variant alphabets. + * + * ```js + * import { fromBase58, toBase58 } from '@exodus/bytes/base58.js' + * import { fromBase58xrp, toBase58xrp } from '@exodus/bytes/base58.js' + * ``` + * + * @module @exodus/bytes/base58.js + */ + +/// + +import type { OutputFormat, Uint8ArrayBuffer } from './array.js'; + +/** + * Encode a `Uint8Array` to a base58 string + * + * Uses the standard Bitcoin base58 alphabet + * + * @param arr - The input bytes + * @returns The base58 encoded string + */ +export function toBase58(arr: Uint8Array): string; + +/** + * Decode a base58 string to bytes + * + * Uses the standard Bitcoin base58 alphabet + * + * @param string - The base58 encoded string + * @param format - Output format (default: 'uint8') + * @returns The decoded bytes + */ +export function fromBase58(string: string, format?: 'uint8'): Uint8ArrayBuffer; +export function fromBase58(string: string, format: 'arraybuffer'): ArrayBuffer; +export function fromBase58(string: string, format: 'buffer'): Buffer; +export function fromBase58(string: string, format?: OutputFormat): Uint8ArrayBuffer | ArrayBuffer | Buffer; + +/** + * Encode a `Uint8Array` to a base58 string using XRP alphabet + * + * Uses the XRP variant base58 alphabet + * + * @param arr - The input bytes + * @returns The base58 encoded string + */ +export function toBase58xrp(arr: Uint8Array): string; + +/** + * Decode a base58 string to bytes using XRP alphabet + * + * Uses the XRP variant base58 alphabet + * + * @param string - The base58 encoded string + * @param format - Output format (default: 'uint8') + * @returns The decoded bytes + */ +export function fromBase58xrp(string: string, format?: 'uint8'): Uint8ArrayBuffer; +export function fromBase58xrp(string: string, format: 'arraybuffer'): ArrayBuffer; +export function fromBase58xrp(string: string, format: 'buffer'): Buffer; +export function fromBase58xrp(string: string, format?: OutputFormat): Uint8ArrayBuffer | ArrayBuffer | Buffer; diff --git a/node_modules/@exodus/bytes/base58.js b/node_modules/@exodus/bytes/base58.js new file mode 100644 index 0000000000000000000000000000000000000000..d487d9deb7d1c7dae4c26ac25128d29d149250e0 --- /dev/null +++ b/node_modules/@exodus/bytes/base58.js @@ -0,0 +1,219 @@ +import { assertU8, fromUint8, E_STRING } from './fallback/_utils.js' +import { nativeDecoder, nativeEncoder, isHermes } from './fallback/platform.js' +import { encodeAscii, decodeAscii } from './fallback/latin1.js' + +const alphabet58 = [...'123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'] +const alphabetXRP = [...'rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz'] +const codes58 = new Uint8Array(alphabet58.map((x) => x.charCodeAt(0))) +const codesXRP = new Uint8Array(alphabetXRP.map((x) => x.charCodeAt(0))) + +const _0n = BigInt(0) +const _1n = BigInt(1) +const _8n = BigInt(8) +const _32n = BigInt(32) +const _58n = BigInt(58) +const _0xffffffffn = BigInt(0xff_ff_ff_ff) + +let table // 15 * 82, diagonal, <1kb +const fromMaps = new Map() + +const E_CHAR = 'Invalid character in base58 input' + +const shouldUseBigIntFrom = isHermes // faster only on Hermes, numbers path beats it on normal engines + +function toBase58core(arr, alphabet, codes) { + assertU8(arr) + const length = arr.length + if (length === 0) return '' + + const ZERO = alphabet[0] + let zeros = 0 + while (zeros < length && arr[zeros] === 0) zeros++ + + if (length > 60) { + // Slow path. Can be optimized ~10%, but the main factor is /58n division anyway, so doesn't matter much + let x = _0n + for (let i = 0; i < arr.length; i++) x = (x << _8n) | BigInt(arr[i]) + + let out = '' + while (x) { + const d = x / _58n + out = alphabet[Number(x - _58n * d)] + out + x = d + } + + return ZERO.repeat(zeros) + out + } + + // We run fast mode operations only on short (<=60 bytes) inputs, via precomputation table + if (!table) { + table = [] + let x = _1n + for (let i = 0; i < 15; i++) { + // Convert x to base 58 digits + const in58 = [] + let y = x + while (y) { + const d = y / _58n + in58.push(Number(y - _58n * d)) + y = d + } + + table.push(new Uint8Array(in58)) + x <<= _32n + } + } + + const res = [] + { + let j = 0 + // We group each 4 bytes into 32-bit chunks + // Not using u32arr to not deal with remainder + BE/LE differences + for (let i = length - 1; i >= 0; i -= 4) { + let c + if (i > 2) { + c = (arr[i] | (arr[i - 1] << 8) | (arr[i - 2] << 16) | (arr[i - 3] << 24)) >>> 0 + } else if (i > 1) { + c = arr[i] | (arr[i - 1] << 8) | (arr[i - 2] << 16) + } else { + c = i === 1 ? arr[i] | (arr[i - 1] << 8) : arr[i] + } + + const row = table[j++] + if (c === 0) continue + const olen = res.length + const nlen = row.length + let k = 0 + for (; k < olen; k++) res[k] += c * row[k] + while (k < nlen) res.push(c * row[k++]) + } + } + + // We can now do a single scan over regular numbers under MAX_SAFE_INTEGER + // Note: can't use int32 operations on them, as they are outside of 2**32 range + // This is faster though + { + let carry = 0 + let i = 0 + while (i < res.length) { + const c = res[i] + carry + carry = Math.floor(c / 58) + res[i++] = c - carry * 58 + } + + while (carry) { + const c = carry + carry = Math.floor(c / 58) + res.push(c - carry * 58) + } + } + + if (nativeDecoder) { + const oa = new Uint8Array(res.length) + let j = 0 + for (let i = res.length - 1; i >= 0; i--) oa[j++] = codes[res[i]] + return ZERO.repeat(zeros) + decodeAscii(oa) + } + + let out = '' + for (let i = res.length - 1; i >= 0; i--) out += alphabet[res[i]] + return ZERO.repeat(zeros) + out +} + +function fromBase58core(str, alphabet, codes, format = 'uint8') { + if (typeof str !== 'string') throw new TypeError(E_STRING) + const length = str.length + if (length === 0) return fromUint8(new Uint8Array(), format) + + const zeroC = codes[0] + let zeros = 0 + while (zeros < length && str.charCodeAt(zeros) === zeroC) zeros++ + + let fromMap = fromMaps.get(alphabet) + if (!fromMap) { + fromMap = new Int8Array(256).fill(-1) + for (let i = 0; i < 58; i++) fromMap[alphabet[i].charCodeAt(0)] = i + fromMaps.set(alphabet, fromMap) + } + + const size = zeros + (((length - zeros + 1) * 3) >> 2) // 3/4 rounded up, larger than ~0.73 coef to fit everything + const res = new Uint8Array(size) + let at = size // where is the first significant byte written + + if (shouldUseBigIntFrom) { + let x = _0n + + // nativeEncoder gives a benefit here + if (nativeEncoder) { + const codes = encodeAscii(str, E_CHAR) + for (let i = zeros; i < length; i++) { + const c = fromMap[codes[i]] + if (c < 0) throw new SyntaxError(E_CHAR) + x = x * _58n + BigInt(c) + } + } else { + for (let i = zeros; i < length; i++) { + const charCode = str.charCodeAt(i) + const c = fromMap[charCode] + if (charCode > 255 || c < 0) throw new SyntaxError(E_CHAR) + x = x * _58n + BigInt(c) + } + } + + while (x) { + let y = Number(x & _0xffffffffn) + x >>= _32n + res[--at] = y & 0xff + y >>>= 8 + if (!x && !y) break + res[--at] = y & 0xff + y >>>= 8 + if (!x && !y) break + res[--at] = y & 0xff + y >>>= 8 + if (!x && !y) break + res[--at] = y & 0xff + } + } else { + for (let i = zeros; i < length; i++) { + const charCode = str.charCodeAt(i) + let c = fromMap[charCode] + if (charCode > 255 || c < 0) throw new SyntaxError(E_CHAR) + + let k = size - 1 + for (;;) { + if (c === 0 && k < at) break + c += 58 * res[k] + res[k] = c & 0xff + c >>>= 8 + k-- + // unroll a bit + if (c === 0 && k < at) break + c += 58 * res[k] + res[k] = c & 0xff + c >>>= 8 + k-- + if (c === 0 && k < at) break + c += 58 * res[k] + res[k] = c & 0xff + c >>>= 8 + k-- + if (c === 0 && k < at) break + c += 58 * res[k] + res[k] = c & 0xff + c >>>= 8 + k-- + } + + at = k + 1 + if (c !== 0 || at < zeros) /* c8 ignore next */ throw new Error('Unexpected') // unreachable + } + } + + return fromUint8(res.slice(at - zeros), format) +} + +export const toBase58 = (arr) => toBase58core(arr, alphabet58, codes58) +export const fromBase58 = (str, format) => fromBase58core(str, alphabet58, codes58, format) +export const toBase58xrp = (arr) => toBase58core(arr, alphabetXRP, codesXRP) +export const fromBase58xrp = (str, format) => fromBase58core(str, alphabetXRP, codesXRP, format) diff --git a/node_modules/@exodus/bytes/base58check.d.ts b/node_modules/@exodus/bytes/base58check.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6fa6f876079dd8aa896cc617f189d0debc3bfb64 --- /dev/null +++ b/node_modules/@exodus/bytes/base58check.d.ts @@ -0,0 +1,135 @@ +/** + * Implements [base58check](https://en.bitcoin.it/wiki/Base58Check_encoding) encoding. + * + * ```js + * import { fromBase58check, toBase58check } from '@exodus/bytes/base58check.js' + * import { fromBase58checkSync, toBase58checkSync } from '@exodus/bytes/base58check.js' + * import { makeBase58check } from '@exodus/bytes/base58check.js' + * ``` + * + * On non-Node.js, requires peer dependency [@noble/hashes](https://www.npmjs.com/package/@noble/hashes) to be installed. + * + * @module @exodus/bytes/base58check.js + */ + +/// + +import type { OutputFormat, Uint8ArrayBuffer } from './array.js'; + +/** + * Hash function type that takes Uint8Array and returns a Promise of Uint8Array + */ +export type HashFunction = (data: Uint8Array) => Promise; + +/** + * Synchronous hash function type that takes Uint8Array and returns Uint8Array + */ +export type HashFunctionSync = (data: Uint8Array) => Uint8Array; + +/** + * Base58Check encoder/decoder instance with async methods + */ +export interface Base58CheckAsync { + /** + * Encode bytes to base58check string asynchronously + * + * @param arr - The input bytes to encode + * @returns A Promise that resolves to the base58check encoded string + */ + encode(arr: Uint8Array): Promise; + + /** + * Decode a base58check string to bytes asynchronously + * + * @param string - The base58check encoded string + * @param format - Output format (default: 'uint8') + * @returns A Promise that resolves to the decoded bytes + */ + decode(string: string, format?: 'uint8'): Promise; + decode(string: string, format: 'arraybuffer'): Promise; + decode(string: string, format: 'buffer'): Promise; + decode(string: string, format?: OutputFormat): Promise; +} + +/** + * Base58Check encoder/decoder instance with both async and sync methods + */ +export interface Base58CheckSync extends Base58CheckAsync { + /** + * Encode bytes to base58check string synchronously + * + * @param arr - The input bytes to encode + * @returns The base58check encoded string + */ + encodeSync(arr: Uint8Array): string; + + /** + * Decode a base58check string to bytes synchronously + * + * @param string - The base58check encoded string + * @param format - Output format (default: 'uint8') + * @returns The decoded bytes + */ + decodeSync(string: string, format?: 'uint8'): Uint8ArrayBuffer; + decodeSync(string: string, format: 'arraybuffer'): ArrayBuffer; + decodeSync(string: string, format: 'buffer'): Buffer; + decodeSync(string: string, format?: OutputFormat): Uint8ArrayBuffer | ArrayBuffer | Buffer; +} + +/** + * Create a base58check encoder/decoder with custom hash functions + * + * @param hashAlgo - Async hash function (typically double SHA-256) + * @param hashAlgoSync - Optional sync hash function + * @returns Base58Check encoder/decoder instance + */ +export function makeBase58check(hashAlgo: HashFunction | HashFunctionSync, hashAlgoSync: HashFunctionSync): Base58CheckSync; +export function makeBase58check(hashAlgo: HashFunction | HashFunctionSync, hashAlgoSync?: undefined): Base58CheckAsync; + +/** + * Encode bytes to base58check string asynchronously + * + * Uses double SHA-256 for checksum calculation + * + * @param arr - The input bytes to encode + * @returns A Promise that resolves to the base58check encoded string + */ +export function toBase58check(arr: Uint8Array): Promise; + +/** + * Decode a base58check string to bytes asynchronously + * + * Validates the checksum using double SHA-256 + * + * @param string - The base58check encoded string + * @param format - Output format (default: 'uint8') + * @returns A Promise that resolves to the decoded bytes + */ +export function fromBase58check(string: string, format?: 'uint8'): Promise; +export function fromBase58check(string: string, format: 'arraybuffer'): Promise; +export function fromBase58check(string: string, format: 'buffer'): Promise; +export function fromBase58check(string: string, format?: OutputFormat): Promise; + +/** + * Encode bytes to base58check string synchronously + * + * Uses double SHA-256 for checksum calculation + * + * @param arr - The input bytes to encode + * @returns The base58check encoded string + */ +export function toBase58checkSync(arr: Uint8Array): string; + +/** + * Decode a base58check string to bytes synchronously + * + * Validates the checksum using double SHA-256 + * + * @param string - The base58check encoded string + * @param format - Output format (default: 'uint8') + * @returns The decoded bytes + */ +export function fromBase58checkSync(string: string, format?: 'uint8'): Uint8ArrayBuffer; +export function fromBase58checkSync(string: string, format: 'arraybuffer'): ArrayBuffer; +export function fromBase58checkSync(string: string, format: 'buffer'): Buffer; +export function fromBase58checkSync(string: string, format?: OutputFormat): Uint8ArrayBuffer | ArrayBuffer | Buffer; diff --git a/node_modules/@exodus/bytes/base58check.js b/node_modules/@exodus/bytes/base58check.js new file mode 100644 index 0000000000000000000000000000000000000000..7b2f911d09c50ab15223cf7be93a0b2397f37d57 --- /dev/null +++ b/node_modules/@exodus/bytes/base58check.js @@ -0,0 +1,18 @@ +import { sha256 } from '@noble/hashes/sha2.js' +import { makeBase58check } from './fallback/base58check.js' + +// Note: while API is async, we use hashSync for now until we improve webcrypto perf for hash256 +// Inputs to base58 are typically very small, and that makes a difference + +// Note: using native WebCrypto will have to have account for SharedArrayBuffer + +const hash256sync = (x) => sha256(sha256(x)) +const hash256 = hash256sync // See note at the top + +const b58c = /* @__PURE__ */ makeBase58check(hash256, hash256sync) +export const toBase58check = /* @__PURE__ */ (() => b58c.encode)() +export const fromBase58check = /* @__PURE__ */ (() => b58c.decode)() +export const toBase58checkSync = /* @__PURE__ */ (() => b58c.encodeSync)() +export const fromBase58checkSync = /* @__PURE__ */ (() => b58c.decodeSync)() + +export { makeBase58check } from './fallback/base58check.js' diff --git a/node_modules/@exodus/bytes/base58check.node.js b/node_modules/@exodus/bytes/base58check.node.js new file mode 100644 index 0000000000000000000000000000000000000000..ea8d58b0a86e1e74937f1d803115d4fe1665021b --- /dev/null +++ b/node_modules/@exodus/bytes/base58check.node.js @@ -0,0 +1,14 @@ +import { hash } from 'node:crypto' +import { makeBase58check } from './fallback/base58check.js' + +const sha256 = (x) => hash('sha256', x, 'buffer') +const hash256 = (x) => sha256(sha256(x)) +const { + encode: toBase58check, + decode: fromBase58check, + encodeSync: toBase58checkSync, + decodeSync: fromBase58checkSync, +} = makeBase58check(hash256, hash256) + +export { makeBase58check } from './fallback/base58check.js' +export { toBase58check, fromBase58check, toBase58checkSync, fromBase58checkSync } diff --git a/node_modules/@exodus/bytes/base64.d.ts b/node_modules/@exodus/bytes/base64.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8779c84cac3541d399ff2d0176804e7fdcd4c660 --- /dev/null +++ b/node_modules/@exodus/bytes/base64.d.ts @@ -0,0 +1,102 @@ +/** + * Implements base64 and base64url from [RFC4648](https://datatracker.ietf.org/doc/html/rfc4648) + * (no differences from [RFC3548](https://datatracker.ietf.org/doc/html/rfc4648)). + * + * ```js + * import { fromBase64, toBase64 } from '@exodus/bytes/base64.js' + * import { fromBase64url, toBase64url } from '@exodus/bytes/base64.js' + * import { fromBase64any } from '@exodus/bytes/base64.js' + * ``` + * + * @module @exodus/bytes/base64.js + */ + +/// + +import type { OutputFormat, Uint8ArrayBuffer } from './array.js'; + +/** + * Options for base64 encoding + */ +export interface ToBase64Options { + /** Whether to include padding characters (default: true for base64, false for base64url) */ + padding?: boolean; +} + +/** + * Padding mode for base64 decoding + * - `true`: padding is required + * - `false`: padding is not allowed (default for base64url) + * - `'both'`: padding is optional (default for base64) + */ +export type PaddingMode = boolean | 'both'; + +/** + * Options for base64 decoding + */ +export interface FromBase64Options { + /** Output format (default: 'uint8') */ + format?: OutputFormat; + /** Padding mode */ + padding?: PaddingMode; +} + +/** + * Encode a `Uint8Array` to a base64 string (RFC 4648) + * + * @param arr - The input bytes + * @param options - Encoding options + * @returns The base64 encoded string + */ +export function toBase64(arr: Uint8Array, options?: ToBase64Options): string; + +/** + * Encode a `Uint8Array` to a base64url string (RFC 4648) + * + * @param arr - The input bytes + * @param options - Encoding options (padding defaults to false) + * @returns The base64url encoded string + */ +export function toBase64url(arr: Uint8Array, options?: ToBase64Options): string; + +/** + * Decode a base64 string to bytes + * + * Operates in strict mode for last chunk, does not allow whitespace + * + * @param string - The base64 encoded string + * @param options - Decoding options + * @returns The decoded bytes + */ +export function fromBase64(string: string, options?: FromBase64Options & { format?: 'uint8' }): Uint8ArrayBuffer; +export function fromBase64(string: string, options: FromBase64Options & { format: 'arraybuffer' }): ArrayBuffer; +export function fromBase64(string: string, options: FromBase64Options & { format: 'buffer' }): Buffer; +export function fromBase64(string: string, options?: FromBase64Options): Uint8ArrayBuffer | ArrayBuffer | Buffer; + +/** + * Decode a base64url string to bytes + * + * Operates in strict mode for last chunk, does not allow whitespace + * + * @param string - The base64url encoded string + * @param options - Decoding options (padding defaults to false) + * @returns The decoded bytes + */ +export function fromBase64url(string: string, options?: FromBase64Options & { format?: 'uint8' }): Uint8ArrayBuffer; +export function fromBase64url(string: string, options: FromBase64Options & { format: 'arraybuffer' }): ArrayBuffer; +export function fromBase64url(string: string, options: FromBase64Options & { format: 'buffer' }): Buffer; +export function fromBase64url(string: string, options?: FromBase64Options): Uint8ArrayBuffer | ArrayBuffer | Buffer; + +/** + * Decode either base64 or base64url string to bytes + * + * Automatically detects the variant based on characters present + * + * @param string - The base64 or base64url encoded string + * @param options - Decoding options + * @returns The decoded bytes + */ +export function fromBase64any(string: string, options?: FromBase64Options & { format?: 'uint8' }): Uint8ArrayBuffer; +export function fromBase64any(string: string, options: FromBase64Options & { format: 'arraybuffer' }): ArrayBuffer; +export function fromBase64any(string: string, options: FromBase64Options & { format: 'buffer' }): Buffer; +export function fromBase64url(string: string, options?: FromBase64Options): Uint8ArrayBuffer | ArrayBuffer | Buffer; diff --git a/node_modules/@exodus/bytes/base64.js b/node_modules/@exodus/bytes/base64.js new file mode 100644 index 0000000000000000000000000000000000000000..03b25333040a8965d964e05e3444987a1b31ef36 --- /dev/null +++ b/node_modules/@exodus/bytes/base64.js @@ -0,0 +1,181 @@ +import { assertEmptyRest } from './assert.js' +import { assertU8, fromUint8, fromBuffer, E_STRING } from './fallback/_utils.js' +import { isHermes } from './fallback/platform.js' +import { decodeLatin1, encodeLatin1 } from './fallback/latin1.js' +import * as js from './fallback/base64.js' + +// See https://datatracker.ietf.org/doc/html/rfc4648 + +// base64: A-Za-z0-9+/ and = if padding not disabled +// base64url: A-Za-z0-9_- and = if padding enabled + +const { Buffer, atob, btoa } = globalThis // Buffer is optional, only used when native +const haveNativeBuffer = Buffer && !Buffer.TYPED_ARRAY_SUPPORT +const { toBase64: web64 } = Uint8Array.prototype // Modern engines have this + +const { E_CHAR, E_PADDING, E_LENGTH, E_LAST } = js + +// faster only on Hermes (and a little in old Chrome), js path beats it on normal engines +const shouldUseBtoa = btoa && isHermes +const shouldUseAtob = atob && isHermes + +// For native Buffer codepaths only +const isBuffer = (x) => x.constructor === Buffer && Buffer.isBuffer(x) +const toBuffer = (x) => (isBuffer(x) ? x : Buffer.from(x.buffer, x.byteOffset, x.byteLength)) + +function maybeUnpad(res, padding) { + if (padding) return res + const at = res.indexOf('=', res.length - 3) + return at === -1 ? res : res.slice(0, at) +} + +function maybePad(res, padding) { + return padding && res.length % 4 !== 0 ? res + '='.repeat(4 - (res.length % 4)) : res +} + +const toUrl = (x) => x.replaceAll('+', '-').replaceAll('/', '_') +const haveWeb = (x) => web64 && x.toBase64 === web64 + +export function toBase64(x, { padding = true } = {}) { + assertU8(x) + if (haveWeb(x)) return padding ? x.toBase64() : x.toBase64({ omitPadding: !padding }) // Modern, optionless is slightly faster + if (haveNativeBuffer) return maybeUnpad(toBuffer(x).base64Slice(0, x.byteLength), padding) // Older Node.js + if (shouldUseBtoa) return maybeUnpad(btoa(decodeLatin1(x)), padding) + return js.toBase64(x, false, padding) // Fallback +} + +// NOTE: base64url omits padding by default +export function toBase64url(x, { padding = false } = {}) { + assertU8(x) + if (haveWeb(x)) return x.toBase64({ alphabet: 'base64url', omitPadding: !padding }) // Modern + if (haveNativeBuffer) return maybePad(toBuffer(x).base64urlSlice(0, x.byteLength), padding) // Older Node.js + if (shouldUseBtoa) return maybeUnpad(toUrl(btoa(decodeLatin1(x))), padding) + return js.toBase64(x, true, padding) // Fallback +} + +// Unlike Buffer.from(), throws on invalid input (non-base64 symbols and incomplete chunks) +// Unlike Buffer.from() and Uint8Array.fromBase64(), does not allow spaces +// NOTE: Always operates in strict mode for last chunk + +// By default accepts both padded and non-padded variants, only strict base64 +export function fromBase64(str, options) { + if (typeof options === 'string') options = { format: options } // Compat due to usage, TODO: remove + if (!options) return fromBase64common(str, false, 'both', 'uint8', null) + const { format = 'uint8', padding = 'both', ...rest } = options + return fromBase64common(str, false, padding, format, rest) +} + +// By default accepts only non-padded strict base64url +export function fromBase64url(str, options) { + if (!options) return fromBase64common(str, true, false, 'uint8', null) + const { format = 'uint8', padding = false, ...rest } = options + return fromBase64common(str, true, padding, format, rest) +} + +// By default accepts both padded and non-padded variants, base64 or base64url +export function fromBase64any(str, { format = 'uint8', padding = 'both', ...rest } = {}) { + if (typeof str !== 'string') throw new TypeError(E_STRING) + const isBase64url = !str.includes('+') && !str.includes('/') // likely to fail fast, as most input is non-url, also double scan is faster than regex + return fromBase64common(str, isBase64url, padding, format, rest) +} + +function fromBase64common(str, isBase64url, padding, format, rest) { + if (typeof str !== 'string') throw new TypeError(E_STRING) + if (rest !== null) assertEmptyRest(rest) + const auto = padding === 'both' ? str.endsWith('=') : undefined + // Older JSC supporting Uint8Array.fromBase64 lacks proper checks + if (padding === true || auto === true) { + if (str.length % 4 !== 0) throw new SyntaxError(E_PADDING) // JSC misses this + if (str[str.length - 3] === '=') throw new SyntaxError(E_PADDING) // no more than two = at the end + } else if (padding === false || auto === false) { + if (str.length % 4 === 1) throw new SyntaxError(E_LENGTH) // JSC misses this in fromBase64 + if (padding === false && str.endsWith('=')) { + throw new SyntaxError('Did not expect padding in base64 input') // inclusion is checked separately + } + } else { + throw new TypeError('Invalid padding option') + } + + return fromBase64impl(str, isBase64url, padding, format) +} + +// ASCII whitespace is U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020 SPACE +const ASCII_WHITESPACE = /[\t\n\f\r ]/ // non-u for JSC perf + +function noWhitespaceSeen(str, arr) { + const at = str.indexOf('=', str.length - 3) + const paddingLength = at >= 0 ? str.length - at : 0 + const chars = str.length - paddingLength + const e = chars % 4 // extra chars past blocks of 4 + const b = arr.length - ((chars - e) / 4) * 3 // remaining bytes not covered by full blocks of chars + return (e === 0 && b === 0) || (e === 2 && b === 1) || (e === 3 && b === 2) +} + +let fromBase64impl +if (Uint8Array.fromBase64) { + // NOTICE: this is actually slower than our JS impl in older JavaScriptCore and (slightly) in SpiderMonkey, but faster on V8 and new JavaScriptCore + fromBase64impl = (str, isBase64url, padding, format) => { + const alphabet = isBase64url ? 'base64url' : 'base64' + + let arr + if (padding === true) { + // Padding is required from user, and we already checked that string length is divisible by 4 + // Padding might still be wrong due to whitespace, but in that case native impl throws expected error + arr = Uint8Array.fromBase64(str, { alphabet, lastChunkHandling: 'strict' }) + } else { + try { + const padded = str.length % 4 > 0 ? `${str}${'='.repeat(4 - (str.length % 4))}` : str + arr = Uint8Array.fromBase64(padded, { alphabet, lastChunkHandling: 'strict' }) + } catch (err) { + // Normalize error: whitespace in input could have caused added padding to be invalid + // But reporting that as a padding error would be confusing + throw ASCII_WHITESPACE.test(str) ? new SyntaxError(E_CHAR) : err + } + } + + // We don't allow whitespace in input, but that can be rechecked based on output length + // All other chars are checked natively + if (!noWhitespaceSeen(str, arr)) throw new SyntaxError(E_CHAR) + return fromUint8(arr, format) + } +} else if (haveNativeBuffer) { + fromBase64impl = (str, isBase64url, padding, format) => { + const size = Buffer.byteLength(str, 'base64') + const arr = Buffer.allocUnsafeSlow(size) // non-pooled + if (arr.base64Write(str) !== size) throw new SyntaxError(E_PADDING) + // Rechecking by re-encoding is cheaper than regexes on Node.js + const got = isBase64url ? maybeUnpad(str, padding === false) : maybePad(str, padding !== true) + const valid = isBase64url ? arr.base64urlSlice(0, arr.length) : arr.base64Slice(0, arr.length) + if (got !== valid) throw new SyntaxError(E_PADDING) + return fromBuffer(arr, format) // fully checked + } +} else if (shouldUseAtob) { + // atob is faster than manual parsing on Hermes + fromBase64impl = (str, isBase64url, padding, format) => { + let arr + if (isBase64url) { + if (/[\t\n\f\r +/]/.test(str)) throw new SyntaxError(E_CHAR) // atob verifies other invalid input + str = str.replaceAll('-', '+').replaceAll('_', '/') // from url to normal + } + + try { + arr = encodeLatin1(atob(str)) + } catch { + throw new SyntaxError(E_CHAR) // convert atob errors + } + + if (!isBase64url && !noWhitespaceSeen(str, arr)) throw new SyntaxError(E_CHAR) // base64url checks input above + + if (arr.length % 3 !== 0) { + // Check last chunk to be strict if it was incomplete + const expected = toBase64(arr.subarray(-(arr.length % 3))) // str is normalized to non-url already + const end = str.length % 4 === 0 ? str.slice(-4) : str.slice(-(str.length % 4)).padEnd(4, '=') + if (expected !== end) throw new SyntaxError(E_LAST) + } + + return fromUint8(arr, format) + } +} else { + fromBase64impl = (str, isBase64url, padding, format) => + fromUint8(js.fromBase64(str, isBase64url), format) // validated in js +} diff --git a/node_modules/@exodus/bytes/bech32.d.ts b/node_modules/@exodus/bytes/bech32.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..67d6476facd1128063458b024540527b74aba568 --- /dev/null +++ b/node_modules/@exodus/bytes/bech32.d.ts @@ -0,0 +1,76 @@ +/** + * Implements bech32 and bech32m from + * [BIP-0173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#specification) + * and [BIP-0350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki#specification). + * + * ```js + * import { fromBech32, toBech32 } from '@exodus/bytes/bech32.js' + * import { fromBech32m, toBech32m } from '@exodus/bytes/bech32.js' + * import { getPrefix } from '@exodus/bytes/bech32.js' + * ``` + * + * @module @exodus/bytes/bech32.js + */ + +/// + +import type { Uint8ArrayBuffer } from './array.js'; + +/** + * Result of decoding a bech32 or bech32m string + */ +export interface Bech32DecodeResult { + /** The human-readable prefix */ + prefix: string; + /** The decoded bytes */ + bytes: Uint8ArrayBuffer; +} + +/** + * Encode bytes to a bech32 string + * + * @param prefix - The human-readable prefix (e.g., 'bc' for Bitcoin) + * @param bytes - The input bytes to encode + * @param limit - Maximum length of the encoded string (default: 90) + * @returns The bech32 encoded string + */ +export function toBech32(prefix: string, bytes: Uint8Array, limit?: number): string; + +/** + * Decode a bech32 string to bytes + * + * @param string - The bech32 encoded string + * @param limit - Maximum length of the input string (default: 90) + * @returns The decoded prefix and bytes + */ +export function fromBech32(string: string, limit?: number): Bech32DecodeResult; + +/** + * Encode bytes to a bech32m string + * + * @param prefix - The human-readable prefix (e.g., 'bc' for Bitcoin) + * @param bytes - The input bytes to encode + * @param limit - Maximum length of the encoded string (default: 90) + * @returns The bech32m encoded string + */ +export function toBech32m(prefix: string, bytes: Uint8Array, limit?: number): string; + +/** + * Decode a bech32m string to bytes + * + * @param string - The bech32m encoded string + * @param limit - Maximum length of the input string (default: 90) + * @returns The decoded prefix and bytes + */ +export function fromBech32m(string: string, limit?: number): Bech32DecodeResult; + +/** + * Extract the prefix from a bech32 or bech32m string without full validation + * + * This is a quick check that skips most validation. + * + * @param string - The bech32/bech32m encoded string + * @param limit - Maximum length of the input string (default: 90) + * @returns The lowercase prefix + */ +export function getPrefix(string: string, limit?: number): string; diff --git a/node_modules/@exodus/bytes/bech32.js b/node_modules/@exodus/bytes/bech32.js new file mode 100644 index 0000000000000000000000000000000000000000..8f9c6b5385366143ea456c3cac9da930b4ecdefd --- /dev/null +++ b/node_modules/@exodus/bytes/bech32.js @@ -0,0 +1,257 @@ +import { assertU8, E_STRING } from './fallback/_utils.js' +import { nativeEncoder } from './fallback/platform.js' +import { decodeAscii, encodeAscii, encodeLatin1 } from './fallback/latin1.js' + +const alphabet = [...'qpzry9x8gf2tvdw0s3jn54khce6mua7l'] +const BECH32 = 1 +const BECH32M = 0x2b_c8_30_a3 + +const E_SIZE = 'Input length is out of range' +const E_PREFIX = 'Missing or invalid prefix' +const E_MIXED = 'Mixed-case string' +const E_PADDING = 'Padding is invalid' +const E_CHECKSUM = 'Invalid checksum' +const E_CHARACTER = 'Non-bech32 character' + +// nativeEncoder path uses encodeAscii which asserts ascii, otherwise we have 0-255 bytes from encodeLatin1 +const c2x = new Int8Array(nativeEncoder ? 128 : 256).fill(-1) +const x2c = new Uint8Array(32) +for (let i = 0; i < alphabet.length; i++) { + const c = alphabet[i].charCodeAt(0) + c2x[c] = i + x2c[i] = c +} + +// checksum size is 30 bits, 0x3f_ff_ff_ff +// The good thing about the checksum is that it's linear over every bit +const poly0 = new Uint32Array(32) // just precache all possible ones, it's only 1 KiB +const p = (x) => ((x & 0x1_ff_ff_ff) << 5) ^ poly0[x >> 25] +for (let i = 0; i < 32; i++) { + poly0[i] = + (i & 0b0_0001 ? 0x3b_6a_57_b2 : 0) ^ + (i & 0b0_0010 ? 0x26_50_8e_6d : 0) ^ + (i & 0b0_0100 ? 0x1e_a1_19_fa : 0) ^ + (i & 0b0_1000 ? 0x3d_42_33_dd : 0) ^ + (i & 0b1_0000 ? 0x2a_14_62_b3 : 0) +} + +// 7 KiB more for faster p6/p8 +const poly1 = new Uint32Array(32) +const poly2 = new Uint32Array(32) +const poly3 = new Uint32Array(32) +const poly4 = new Uint32Array(32) +const poly5 = new Uint32Array(32) +const poly6 = new Uint32Array(32) +const poly7 = new Uint32Array(32) +for (let i = 0; i < 32; i++) { + // poly0[i] === p(p(p(p(p(p(i)))))) + poly1[i] = p(poly0[i]) // aka p(p(p(p(p(p(i << 5)))))) + poly2[i] = p(poly1[i]) // aka p(p(p(p(p(p(i << 10)))))) + poly3[i] = p(poly2[i]) // aka p(p(p(p(p(p(i << 15)))))) + poly4[i] = p(poly3[i]) // aka p(p(p(p(p(p(i << 20)))))) + poly5[i] = p(poly4[i]) // aka p(p(p(p(p(p(i << 25)))))) + poly6[i] = p(poly5[i]) + poly7[i] = p(poly6[i]) +} + +function p6(x) { + // Same as: return p(p(p(p(p(p(x)))))) + const x0 = x & 0x1f + const x1 = (x >> 5) & 0x1f + const x2 = (x >> 10) & 0x1f + const x3 = (x >> 15) & 0x1f + const x4 = (x >> 20) & 0x1f + const x5 = (x >> 25) & 0x1f + return poly0[x0] ^ poly1[x1] ^ poly2[x2] ^ poly3[x3] ^ poly4[x4] ^ poly5[x5] +} + +function p8(x) { + // Same as: return p(p(p(p(p(p(p(p(x)))))))) + const x0 = x & 0x1f + const x1 = (x >> 5) & 0x1f + const x2 = (x >> 10) & 0x1f + const x3 = (x >> 15) & 0x1f + const x4 = (x >> 20) & 0x1f + const x5 = (x >> 25) & 0x1f + return poly2[x0] ^ poly3[x1] ^ poly4[x2] ^ poly5[x3] ^ poly6[x4] ^ poly7[x5] +} + +// p(p(p(p(p(p(chk) ^ x0) ^ x1) ^ x2) ^ x3) ^ x4) ^ x5 === p6(chk) ^ merge(x0, x1, x2, x3, x4, x5) +const merge = (a, b, c, d, e, f) => f ^ (e << 5) ^ (d << 10) ^ (c << 15) ^ (b << 20) ^ (a << 25) + +const prefixCache = new Map() // Cache 10 of them + +function pPrefix(prefix) { + if (prefix === 'bc') return 0x2_31_80_43 // perf + const cached = prefixCache.get(prefix) + if (cached !== undefined) return cached + + // bech32_hrp_expand(s): [ord(x) >> 5 for x in s] + [0] + [ord(x) & 31 for x in s] + // We can do this in a single scan due to linearity, but it's not very beneficial + let chk = 1 // it starts with one (see def bech32_polymod in BIP_0173) + const length = prefix.length + for (let i = 0; i < length; i++) { + const c = prefix.charCodeAt(i) + if (c < 33 || c > 126) throw new Error(E_PREFIX) // each character having a value in the range [33-126] + chk = p(chk) ^ (c >> 5) + } + + chk = p(chk) // <= for + [0] + for (let i = 0; i < length; i++) { + const c = prefix.charCodeAt(i) + chk = p(chk) ^ (c & 0x1f) + } + + if (prefixCache.size < 10) prefixCache.set(prefix, chk) + return chk +} + +function toBech32enc(prefix, bytes, limit, encoding) { + if (typeof prefix !== 'string' || !prefix) throw new TypeError(E_PREFIX) + if (typeof limit !== 'number') throw new TypeError(E_SIZE) + assertU8(bytes) + const bytesLength = bytes.length + const wordsLength = Math.ceil((bytesLength * 8) / 5) + if (!(prefix.length + 7 + wordsLength <= limit)) throw new TypeError(E_SIZE) + prefix = prefix.toLowerCase() + const out = new Uint8Array(wordsLength + 6) + + let chk = pPrefix(prefix) + let i = 0, j = 0 // prettier-ignore + + // This loop is just an optimization of the next one + for (const length4 = bytesLength - 4; i < length4; i += 5, j += 8) { + const b0 = bytes[i], b1 = bytes[i + 1], b2 = bytes[i + 2], b3 = bytes[i + 3], b4 = bytes[i + 4] // prettier-ignore + const x0 = b0 >> 3 + const x1 = ((b0 << 2) & 0x1f) | (b1 >> 6) + const x2 = (b1 >> 1) & 0x1f + const x3 = ((b1 << 4) & 0x1f) | (b2 >> 4) + const x4 = ((b2 << 1) & 0x1f) | (b3 >> 7) + const x5 = (b3 >> 2) & 0x1f + const x6 = ((b3 << 3) & 0x1f) | (b4 >> 5) + const x7 = b4 & 0x1f + chk = merge(x2, x3, x4, x5, x6, x7) ^ poly0[x1] ^ poly1[x0] ^ p8(chk) + out[j] = x2c[x0] + out[j + 1] = x2c[x1] + out[j + 2] = x2c[x2] + out[j + 3] = x2c[x3] + out[j + 4] = x2c[x4] + out[j + 5] = x2c[x5] + out[j + 6] = x2c[x6] + out[j + 7] = x2c[x7] + } + + let value = 0, bits = 0 // prettier-ignore + for (; i < bytesLength; i++) { + value = ((value & 0xf) << 8) | bytes[i] + bits += 3 + const x = (value >> bits) & 0x1f + chk = p(chk) ^ x + out[j++] = x2c[x] + if (bits >= 5) { + bits -= 5 + const x = (value >> bits) & 0x1f + chk = p(chk) ^ x + out[j++] = x2c[x] + } + } + + if (bits > 0) { + const x = (value << (5 - bits)) & 0x1f + chk = p(chk) ^ x + out[j++] = x2c[x] + } + + chk = encoding ^ p6(chk) + out[j++] = x2c[(chk >> 25) & 0x1f] + out[j++] = x2c[(chk >> 20) & 0x1f] + out[j++] = x2c[(chk >> 15) & 0x1f] + out[j++] = x2c[(chk >> 10) & 0x1f] + out[j++] = x2c[(chk >> 5) & 0x1f] + out[j++] = x2c[(chk >> 0) & 0x1f] + + return prefix + '1' + decodeAscii(out) // suboptimal in barebones, but actually ok in Hermes for not to care atm +} + +function assertDecodeArgs(str, limit) { + if (typeof str !== 'string') throw new TypeError(E_STRING) + if (typeof limit !== 'number' || str.length < 8 || !(str.length <= limit)) throw new Error(E_SIZE) +} + +// this is instant on 8-bit strings +const NON_LATIN = /[^\x00-\xFF]/ // eslint-disable-line no-control-regex + +function fromBech32enc(str, limit, encoding) { + assertDecodeArgs(str, limit) + const lower = str.toLowerCase() + if (str !== lower) { + if (str !== str.toUpperCase()) throw new Error(E_MIXED) + str = lower + } + + const split = str.lastIndexOf('1') + if (split <= 0) throw new Error(E_PREFIX) + const prefix = str.slice(0, split) + const charsLength = str.length - split - 1 + const wordsLength = charsLength - 6 + if (wordsLength < 0) throw new Error(E_SIZE) + const bytesLength = (wordsLength * 5) >> 3 + const slice = str.slice(split + 1) + if (!nativeEncoder && NON_LATIN.test(slice)) throw new SyntaxError(E_CHARACTER) // otherwise can't use encodeLatin1 + const c = nativeEncoder ? encodeAscii(slice, E_CHARACTER) : encodeLatin1(slice) // suboptimal, but only affects non-Hermes barebones + const bytes = new Uint8Array(bytesLength) + + let chk = pPrefix(prefix) + let i = 0, j = 0 // prettier-ignore + + // This loop is just an optimization of the next one + for (const length7 = wordsLength - 7; i < length7; i += 8, j += 5) { + const c0 = c[i], c1 = c[i + 1], c2 = c[i + 2], c3 = c[i + 3], c4 = c[i + 4], c5 = c[i + 5], c6 = c[i + 6], c7 = c[i + 7] // prettier-ignore + const x0 = c2x[c0], x1 = c2x[c1], x2 = c2x[c2], x3 = c2x[c3], x4 = c2x[c4], x5 = c2x[c5], x6 = c2x[c6], x7 = c2x[c7] // prettier-ignore + if (x0 < 0 || x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || x5 < 0 || x6 < 0 || x7 < 0) throw new SyntaxError(E_CHARACTER) // prettier-ignore + chk = merge(x2, x3, x4, x5, x6, x7) ^ poly0[x1] ^ poly1[x0] ^ p8(chk) + bytes[j] = (x0 << 3) | (x1 >> 2) + bytes[j + 1] = (((x1 << 6) | (x2 << 1)) & 0xff) | (x3 >> 4) + bytes[j + 2] = ((x3 << 4) & 0xff) | (x4 >> 1) + bytes[j + 3] = ((((x4 << 5) | x5) << 2) & 0xff) | (x6 >> 3) + bytes[j + 4] = ((x6 << 5) & 0xff) | x7 + } + + let value = 0, bits = 0 // prettier-ignore + for (; i < wordsLength; i++) { + const x = c2x[c[i]] + if (x < 0) throw new SyntaxError(E_CHARACTER) + chk = p(chk) ^ x + value = (value << 5) | x + bits += 5 + if (bits >= 8) { + bits -= 8 + bytes[j++] = (value >> bits) & 0xff + } + } + + if (bits >= 5 || (value << (8 - bits)) & 0xff) throw new Error(E_PADDING) + + // Checksum + { + const c0 = c[i], c1 = c[i + 1], c2 = c[i + 2], c3 = c[i + 3], c4 = c[i + 4], c5 = c[i + 5] // prettier-ignore + const x0 = c2x[c0], x1 = c2x[c1], x2 = c2x[c2], x3 = c2x[c3], x4 = c2x[c4], x5 = c2x[c5] // prettier-ignore + if (x0 < 0 || x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 || x5 < 0) throw new SyntaxError(E_CHARACTER) + if ((merge(x0, x1, x2, x3, x4, x5) ^ p6(chk)) !== encoding) throw new Error(E_CHECKSUM) + } + + return { prefix, bytes } +} + +// This is designed to be a very quick check, skipping all other validation +export function getPrefix(str, limit = 90) { + assertDecodeArgs(str, limit) + const split = str.lastIndexOf('1') + if (split <= 0) throw new Error(E_PREFIX) + return str.slice(0, split).toLowerCase() +} + +export const toBech32 = (prefix, bytes, limit = 90) => toBech32enc(prefix, bytes, limit, BECH32) +export const fromBech32 = (str, limit = 90) => fromBech32enc(str, limit, BECH32) +export const toBech32m = (prefix, bytes, limit = 90) => toBech32enc(prefix, bytes, limit, BECH32M) +export const fromBech32m = (str, limit = 90) => fromBech32enc(str, limit, BECH32M) diff --git a/node_modules/@exodus/bytes/bigint.d.ts b/node_modules/@exodus/bytes/bigint.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7df97979d5d0d5e79db051dac150fa22ef05cd2c --- /dev/null +++ b/node_modules/@exodus/bytes/bigint.d.ts @@ -0,0 +1,49 @@ +/** + * Convert between BigInt and Uint8Array + * + * ```js + * import { fromBigInt, toBigInt } from '@exodus/bytes/bigint.js' + * ``` + * + * @module @exodus/bytes/bigint.js + */ + +/// + +import type { OutputFormat, Uint8ArrayBuffer } from './array.js'; + +/** + * Options for converting BigInt to bytes + */ +export interface FromBigIntOptions { + /** The length in bytes of the output array */ + length: number; + /** Output format (default: 'uint8') */ + format?: OutputFormat; +} + +/** + * Convert a BigInt to a Uint8Array or Buffer + * + * The output bytes are in big-endian format. + * + * Throws if the BigInt is negative or cannot fit into the specified length. + * + * @param bigint - The BigInt to convert (must be non-negative) + * @param options - Conversion options + * @returns The converted bytes in big-endian format + */ +export function fromBigInt(bigint: bigint, options: { length: number; format?: 'uint8' }): Uint8ArrayBuffer; +export function fromBigInt(bigint: bigint, options: { length: number; format: 'arraybuffer' }): ArrayBuffer; +export function fromBigInt(bigint: bigint, options: { length: number; format: 'buffer' }): Buffer; +export function fromBigInt(bigint: bigint, options: FromBigIntOptions): Uint8ArrayBuffer | ArrayBuffer | Buffer; + +/** + * Convert a Uint8Array or Buffer to a BigInt + * + * The bytes are interpreted as a big-endian unsigned integer. + * + * @param arr - The bytes to convert + * @returns The BigInt representation + */ +export function toBigInt(arr: Uint8Array): bigint; diff --git a/node_modules/@exodus/bytes/bigint.js b/node_modules/@exodus/bytes/bigint.js new file mode 100644 index 0000000000000000000000000000000000000000..a51f90996060fdf852edd78cdb18e8c8919f0f4c --- /dev/null +++ b/node_modules/@exodus/bytes/bigint.js @@ -0,0 +1,14 @@ +import { toHex, fromHex } from '@exodus/bytes/hex.js' +import { assert } from './fallback/_utils.js' + +const _0n = BigInt(0) + +export function fromBigInt(x, { length, format } = {}) { + assert(Number.isSafeInteger(length) && length > 0, 'Expected length arg to be a positive integer') + assert(typeof x === 'bigint' && x >= _0n, 'Expected a non-negative bigint') + const hex = x.toString(16) + assert(length * 2 >= hex.length, `Can not fit supplied number into ${length} bytes`) + return fromHex(hex.padStart(length * 2, '0'), format) +} + +export const toBigInt = (a) => BigInt('0x' + (toHex(a) || '0')) diff --git a/node_modules/@exodus/bytes/encoding-browser.browser.js b/node_modules/@exodus/bytes/encoding-browser.browser.js new file mode 100644 index 0000000000000000000000000000000000000000..e8333b4cf30b4aee9702671ff87b1b7284c8c5bd --- /dev/null +++ b/node_modules/@exodus/bytes/encoding-browser.browser.js @@ -0,0 +1,55 @@ +import { getBOMEncoding } from './fallback/encoding.api.js' + +// Lite-weight version which re-exports existing implementations on browsers, +// while still being aliased to the full impl in RN and Node.js + +// WARNING: Note that browsers have bugs (which hopefully will get fixed soon) + +const { TextDecoder, TextEncoder, TextDecoderStream, TextEncoderStream } = globalThis + +export { getBOMEncoding } from './fallback/encoding.api.js' +export { TextDecoder, TextEncoder, TextDecoderStream, TextEncoderStream } + +export function normalizeEncoding(label) { + if (label === 'utf-8' || label === 'utf8' || label === 'UTF-8' || label === 'UTF8') return 'utf-8' + if (label === 'windows-1252' || label === 'ascii' || label === 'latin1') return 'windows-1252' + if (/[^\w\t\n\f\r .:-]/i.test(label)) return null + const l = `${label}`.trim().toLowerCase() + try { + return new TextDecoder(l).encoding + } catch {} + + if (l === 'x-user-defined') return l + if ( + l === 'replacement' || + l === 'csiso2022kr' || + l === 'hz-gb-2312' || + l === 'iso-2022-cn' || + l === 'iso-2022-cn-ext' || + l === 'iso-2022-kr' + ) { + return 'replacement' + } + + return null +} + +export function legacyHookDecode(input, fallbackEncoding = 'utf-8') { + const enc = getBOMEncoding(input) ?? normalizeEncoding(fallbackEncoding) + if (enc === 'replacement') return input.byteLength > 0 ? '\uFFFD' : '' + return new TextDecoder(enc).decode(input) +} + +export function labelToName(label) { + const enc = normalizeEncoding(label) + if (enc === 'utf-8') return 'UTF-8' + if (!enc) return enc + const p = enc.slice(0, 3) + if (p === 'utf' || p === 'iso' || p === 'koi' || p === 'euc' || p === 'ibm' || p === 'gbk') { + return enc.toUpperCase() + } + + if (enc === 'big5') return 'Big5' + if (enc === 'shift_jis') return 'Shift_JIS' + return enc +} diff --git a/node_modules/@exodus/bytes/encoding-browser.d.ts b/node_modules/@exodus/bytes/encoding-browser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..703859627cfda5a6ac8138973337de3eb85264c2 --- /dev/null +++ b/node_modules/@exodus/bytes/encoding-browser.d.ts @@ -0,0 +1,35 @@ +/** + * Same as `@exodus/bytes/encoding.js`, but in browsers instead of polyfilling just uses whatever the + * browser provides, drastically reducing the bundle size (to less than 2 KiB gzipped). + * + * Does not provide `isomorphicDecode` and `isomorphicEncode` exports. + * + * ```js + * import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding-browser.js' + * import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding-browser.js' // Requires Streams + * + * // Hooks for standards + * import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding-browser.js' + * ``` + * + * Under non-browser engines (Node.js, React Native, etc.) a full polyfill is used as those platforms + * do not provide sufficiently complete / non-buggy `TextDecoder` APIs. + * + * > [!NOTE] + * > Implementations in browsers [have bugs](https://docs.google.com/spreadsheets/d/1pdEefRG6r9fZy61WHGz0TKSt8cO4ISWqlpBN5KntIvQ/edit), + * > but they are fixing them and the expected update window is short.\ + * > If you want to circumvent browser bugs, use full `@exodus/bytes/encoding.js` import. + * + * @module @exodus/bytes/encoding-browser.js + */ + +export { + TextDecoder, + TextEncoder, + TextDecoderStream, + TextEncoderStream, + normalizeEncoding, + getBOMEncoding, + labelToName, + legacyHookDecode, +} from './encoding.js' diff --git a/node_modules/@exodus/bytes/encoding-browser.js b/node_modules/@exodus/bytes/encoding-browser.js new file mode 100644 index 0000000000000000000000000000000000000000..f948b33e58bf0785ec9b529fb01b74158af3b905 --- /dev/null +++ b/node_modules/@exodus/bytes/encoding-browser.js @@ -0,0 +1 @@ +export * from './encoding-browser.native.js' diff --git a/node_modules/@exodus/bytes/encoding-browser.native.js b/node_modules/@exodus/bytes/encoding-browser.native.js new file mode 100644 index 0000000000000000000000000000000000000000..ad7c28a33d207cbf4af55ea41baef9d077a77b92 --- /dev/null +++ b/node_modules/@exodus/bytes/encoding-browser.native.js @@ -0,0 +1,10 @@ +export { + TextDecoder, + TextEncoder, + TextDecoderStream, + TextEncoderStream, + normalizeEncoding, + getBOMEncoding, + labelToName, + legacyHookDecode, +} from './encoding.js' diff --git a/node_modules/@exodus/bytes/encoding-lite.d.ts b/node_modules/@exodus/bytes/encoding-lite.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..63bd517ce2629267da05a3af31b3ba9708782eb1 --- /dev/null +++ b/node_modules/@exodus/bytes/encoding-lite.d.ts @@ -0,0 +1,63 @@ +/** + * The exact same exports as `@exodus/bytes/encoding.js` are also exported as + * `@exodus/bytes/encoding-lite.js`, with the difference that the lite version does not load + * multi-byte `TextDecoder` encodings by default to reduce bundle size ~12x. + * + * ```js + * import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding-lite.js' + * import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding-lite.js' // Requires Streams + * import { isomorphicDecode, isomorphicEncode } from '@exodus/bytes/encoding-lite.js' + * + * // Hooks for standards + * import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding-lite.js' + * ``` + * + * The only affected encodings are: `gbk`, `gb18030`, `big5`, `euc-jp`, `iso-2022-jp`, `shift_jis` + * and their [labels](https://encoding.spec.whatwg.org/#names-and-labels) when used with `TextDecoder`. + * + * Legacy single-byte encodingds are loaded by default in both cases. + * + * `TextEncoder` and hooks for standards (including `labelToName` / `normalizeEncoding`) do not have any behavior + * differences in the lite version and support full range if inputs. + * + * To avoid inconsistencies, the exported classes and methods are exactly the same objects. + * + * ```console + * > lite = require('@exodus/bytes/encoding-lite.js') + * [Module: null prototype] { + * TextDecoder: [class TextDecoder], + * TextDecoderStream: [class TextDecoderStream], + * TextEncoder: [class TextEncoder], + * TextEncoderStream: [class TextEncoderStream], + * getBOMEncoding: [Function: getBOMEncoding], + * labelToName: [Function: labelToName], + * legacyHookDecode: [Function: legacyHookDecode], + * normalizeEncoding: [Function: normalizeEncoding] + * } + * > new lite.TextDecoder('big5').decode(Uint8Array.of(0x25)) + * Uncaught: + * Error: Legacy multi-byte encodings are disabled in /encoding-lite.js, use /encoding.js for full encodings range support + * + * > full = require('@exodus/bytes/encoding.js') + * [Module: null prototype] { + * TextDecoder: [class TextDecoder], + * TextDecoderStream: [class TextDecoderStream], + * TextEncoder: [class TextEncoder], + * TextEncoderStream: [class TextEncoderStream], + * getBOMEncoding: [Function: getBOMEncoding], + * labelToName: [Function: labelToName], + * legacyHookDecode: [Function: legacyHookDecode], + * normalizeEncoding: [Function: normalizeEncoding] + * } + * > full.TextDecoder === lite.TextDecoder + * true + * > new full.TextDecoder('big5').decode(Uint8Array.of(0x25)) + * '%' + * > new lite.TextDecoder('big5').decode(Uint8Array.of(0x25)) + * '%' + * ``` + * + * @module @exodus/bytes/encoding-lite.js + */ + +export * from './encoding.js' diff --git a/node_modules/@exodus/bytes/encoding-lite.js b/node_modules/@exodus/bytes/encoding-lite.js new file mode 100644 index 0000000000000000000000000000000000000000..0fa600b6c2d83f340a41b400ccb5a3134a7888c7 --- /dev/null +++ b/node_modules/@exodus/bytes/encoding-lite.js @@ -0,0 +1,12 @@ +export { + TextDecoder, + TextEncoder, + TextDecoderStream, + TextEncoderStream, + normalizeEncoding, + getBOMEncoding, + labelToName, + legacyHookDecode, + isomorphicDecode, + isomorphicEncode, +} from './fallback/encoding.js' diff --git a/node_modules/@exodus/bytes/encoding.d.ts b/node_modules/@exodus/bytes/encoding.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..25d66ee44948f2cefc74f7afc387c5a61c0590c2 --- /dev/null +++ b/node_modules/@exodus/bytes/encoding.d.ts @@ -0,0 +1,169 @@ +/** + * Implements the [Encoding standard](https://encoding.spec.whatwg.org/): + * [TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder), + * [TextEncoder](https://encoding.spec.whatwg.org/#interface-textencoder), + * [TextDecoderStream](https://encoding.spec.whatwg.org/#interface-textdecoderstream), + * [TextEncoderStream](https://encoding.spec.whatwg.org/#interface-textencoderstream), + * some [hooks](https://encoding.spec.whatwg.org/#specification-hooks). + * + * ```js + * import { TextDecoder, TextEncoder } from '@exodus/bytes/encoding.js' + * import { TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding.js' // Requires Streams + * import { isomorphicDecode, isomorphicEncode } from '@exodus/bytes/encoding.js' + * + * // Hooks for standards + * import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding.js' + * ``` + * + * @module @exodus/bytes/encoding.js + */ + +/// + +/** + * Convert an encoding [label](https://encoding.spec.whatwg.org/#names-and-labels) to its name, + * as an ASCII-lowercased string. + * + * If an encoding with that label does not exist, returns `null`. + * + * This is the same as [`decoder.encoding` getter](https://encoding.spec.whatwg.org/#dom-textdecoder-encoding), + * except that it: + * 1. Supports [`replacement` encoding](https://encoding.spec.whatwg.org/#replacement) and its + * [labels](https://encoding.spec.whatwg.org/#ref-for-replacement%E2%91%A1) + * 2. Does not throw for invalid labels and instead returns `null` + * + * It is identical to: + * ```js + * labelToName(label)?.toLowerCase() ?? null + * ``` + * + * All encoding names are also valid labels for corresponding encodings. + * + * @param label - The encoding label to normalize + * @returns The normalized encoding name, or null if invalid + */ +export function normalizeEncoding(label: string): string | null; + +/** + * Implements [BOM sniff](https://encoding.spec.whatwg.org/#bom-sniff) legacy hook. + * + * Given a `TypedArray` or an `ArrayBuffer` instance `input`, returns either of: + * - `'utf-8'`, if `input` starts with UTF-8 byte order mark. + * - `'utf-16le'`, if `input` starts with UTF-16LE byte order mark. + * - `'utf-16be'`, if `input` starts with UTF-16BE byte order mark. + * - `null` otherwise. + * + * @param input - The bytes to check for BOM + * @returns The encoding ('utf-8', 'utf-16le', 'utf-16be'), or null if no BOM found + */ +export function getBOMEncoding( + input: ArrayBufferLike | ArrayBufferView +): 'utf-8' | 'utf-16le' | 'utf-16be' | null; + +/** + * Implements [decode](https://encoding.spec.whatwg.org/#decode) legacy hook. + * + * Given a `TypedArray` or an `ArrayBuffer` instance `input` and an optional `fallbackEncoding` + * encoding [label](https://encoding.spec.whatwg.org/#names-and-labels), + * sniffs encoding from BOM with `fallbackEncoding` fallback and then + * decodes the `input` using that encoding, skipping BOM if it was present. + * + * Notes: + * + * - BOM-sniffed encoding takes precedence over `fallbackEncoding` option per spec. + * Use with care. + * - Always operates in non-fatal [mode](https://encoding.spec.whatwg.org/#textdecoder-error-mode), + * aka replacement. It can convert different byte sequences to equal strings. + * + * This method is similar to the following code, except that it doesn't support encoding labels and + * only expects lowercased encoding name: + * + * ```js + * new TextDecoder(getBOMEncoding(input) ?? fallbackEncoding).decode(input) + * ``` + * + * @param input - The bytes to decode + * @param fallbackEncoding - The encoding to use if no BOM detected (default: 'utf-8') + * @returns The decoded string + */ +export function legacyHookDecode( + input: ArrayBufferLike | ArrayBufferView, + fallbackEncoding?: string +): string; + +/** + * Implements [isomorphic decode](https://infra.spec.whatwg.org/#isomorphic-decode). + * + * Given a `TypedArray` or an `ArrayBuffer` instance `input`, creates a string of the same length + * as input byteLength, using bytes from input as codepoints. + * + * E.g. for `Uint8Array` input, this is similar to `String.fromCodePoint(...input)`. + * + * Wider `TypedArray` inputs, e.g. `Uint16Array`, are interpreted as underlying _bytes_. + * + * @param input - The bytes to decode + * @returns The decoded string + */ +export function isomorphicDecode(input: ArrayBufferLike | ArrayBufferView): string; + +/** + * Implements [isomorphic encode](https://infra.spec.whatwg.org/#isomorphic-encode). + * + * Given a string, creates an `Uint8Array` of the same length with the string codepoints as byte values. + * + * Accepts only [isomorphic string](https://infra.spec.whatwg.org/#isomorphic-string) input + * and asserts that, throwing on any strings containing codepoints higher than `U+00FF`. + * + * @param input - The bytes to decode + * @returns An Uint8Array containing the input bytes. + */ +export function isomorphicEncode(str: string): Uint8Array; + +/** + * Implements [get an encoding from a string `label`](https://encoding.spec.whatwg.org/#concept-encoding-get). + * + * Convert an encoding [label](https://encoding.spec.whatwg.org/#names-and-labels) to its name, + * as a case-sensitive string. + * + * If an encoding with that label does not exist, returns `null`. + * + * All encoding names are also valid labels for corresponding encodings. + * + * @param label - The encoding label + * @returns The proper case encoding name, or null if invalid + */ +export function labelToName(label: string): string | null; + +/** + * [TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder) implementation/polyfill. + * + * Decode bytes to strings according to [WHATWG Encoding](https://encoding.spec.whatwg.org) specification. + */ +export const TextDecoder: typeof globalThis.TextDecoder; + +/** + * [TextEncoder](https://encoding.spec.whatwg.org/#interface-textencoder) implementation/polyfill. + * + * Encode strings to UTF-8 bytes according to [WHATWG Encoding](https://encoding.spec.whatwg.org) specification. + */ +export const TextEncoder: typeof globalThis.TextEncoder; + +/** + * [TextDecoderStream](https://encoding.spec.whatwg.org/#interface-textdecoderstream) implementation/polyfill. + * + * A [Streams](https://streams.spec.whatwg.org/) wrapper for `TextDecoder`. + * + * Requires [Streams](https://streams.spec.whatwg.org/) to be either supported by the platform or + * [polyfilled](https://npmjs.com/package/web-streams-polyfill). + */ +export const TextDecoderStream: typeof globalThis.TextDecoderStream; + +/** + * [TextEncoderStream](https://encoding.spec.whatwg.org/#interface-textencoderstream) implementation/polyfill. + * + * A [Streams](https://streams.spec.whatwg.org/) wrapper for `TextEncoder`. + * + * Requires [Streams](https://streams.spec.whatwg.org/) to be either supported by the platform or + * [polyfilled](https://npmjs.com/package/web-streams-polyfill). + */ +export const TextEncoderStream: typeof globalThis.TextEncoderStream; diff --git a/node_modules/@exodus/bytes/encoding.js b/node_modules/@exodus/bytes/encoding.js new file mode 100644 index 0000000000000000000000000000000000000000..3478b243bc2ad4fe2dfa052982c8f0c50d634059 --- /dev/null +++ b/node_modules/@exodus/bytes/encoding.js @@ -0,0 +1,18 @@ +import { createMultibyteDecoder } from '@exodus/bytes/multi-byte.js' +import { multibyteEncoder } from './fallback/multi-byte.js' +import { setMultibyte } from './fallback/encoding.js' + +setMultibyte(createMultibyteDecoder, multibyteEncoder) + +export { + TextDecoder, + TextEncoder, + TextDecoderStream, + TextEncoderStream, + normalizeEncoding, + getBOMEncoding, + labelToName, + legacyHookDecode, + isomorphicDecode, + isomorphicEncode, +} from './fallback/encoding.js' diff --git a/node_modules/@exodus/bytes/fallback/_utils.js b/node_modules/@exodus/bytes/fallback/_utils.js new file mode 100644 index 0000000000000000000000000000000000000000..d397de2bfe348aa4a99ad94bb0c2bac305633b3f --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/_utils.js @@ -0,0 +1,60 @@ +export * from './platform.js' + +const Buffer = /* @__PURE__ */ (() => globalThis.Buffer)() + +export function assert(condition, msg) { + if (!condition) throw new Error(msg) +} + +export function assertU8(arg) { + if (arg && arg instanceof Uint8Array) return + throw new TypeError('Expected an Uint8Array') +} + +// On arrays in heap (<= 64) it's cheaper to copy into a pooled buffer than lazy-create the ArrayBuffer storage +export const toBuf = (x) => + x.byteLength <= 64 && x.BYTES_PER_ELEMENT === 1 + ? Buffer.from(x) + : Buffer.from(x.buffer, x.byteOffset, x.byteLength) + +export const E_STRING = 'Input is not a string' +export const E_STRICT_UNICODE = 'Input is not well-formed Unicode' + +// Input is never pooled +export function fromUint8(arr, format) { + switch (format) { + case 'uint8': + if (arr.constructor !== Uint8Array) throw new Error('Unexpected') + return arr + case 'arraybuffer': + if (arr.byteLength !== arr.buffer.byteLength) throw new Error('Unexpected') + return arr.buffer + case 'buffer': + if (arr.length <= 64) return Buffer.from(arr) + return Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength) + } + + throw new TypeError('Unexpected format') +} + +// Input can be pooled +export function fromBuffer(arr, format) { + switch (format) { + case 'uint8': + // byteOffset check is slightly faster and covers most pooling, so it comes first + if (arr.length <= 64 || arr.byteOffset !== 0 || arr.byteLength !== arr.buffer.byteLength) { + return new Uint8Array(arr) + } + + return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength) + case 'arraybuffer': + return arr.buffer.byteLength === arr.byteLength + ? arr.buffer + : arr.buffer.slice(arr.byteOffset, arr.byteOffset + arr.byteLength) + case 'buffer': + if (arr.constructor !== Buffer) throw new Error('Unexpected') + return arr + } + + throw new TypeError('Unexpected format') +} diff --git a/node_modules/@exodus/bytes/fallback/base32.js b/node_modules/@exodus/bytes/fallback/base32.js new file mode 100644 index 0000000000000000000000000000000000000000..ae170b8afb8739d196827c08be0f2b089d5b446f --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/base32.js @@ -0,0 +1,242 @@ +import { assertU8 } from './_utils.js' +import { nativeEncoder, nativeDecoder, isHermes } from './platform.js' +import { encodeAscii, decodeAscii } from './latin1.js' + +// See https://datatracker.ietf.org/doc/html/rfc4648 + +const BASE32_HELPERS = [{}, {}, {}] +const BASE32_ALPHABETS = [ + [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'], // RFC 4648, #6 + [...'0123456789ABCDEFGHIJKLMNOPQRSTUV'], // RFC 4648, #7 + [...'0123456789ABCDEFGHJKMNPQRSTVWXYZ'], // Crockford, base (see extra below in fromMap) +] + +export const E_CHAR = 'Invalid character in base32 input' +export const E_PADDING = 'Invalid base32 padding' +export const E_LENGTH = 'Invalid base32 length' +export const E_LAST = 'Invalid last chunk' + +const useTemplates = isHermes // Faster on Hermes and JSC, but we use it only on Hermes + +// We construct output by concatenating chars, this seems to be fine enough on modern JS engines +export function toBase32(arr, mode, padding) { + assertU8(arr) + const fullChunks = Math.floor(arr.length / 5) + const fullChunksBytes = fullChunks * 5 + let o = '' + let i = 0 + + const alphabet = BASE32_ALPHABETS[mode] + const helpers = BASE32_HELPERS[mode] + if (!helpers.pairs) { + helpers.pairs = [] + if (nativeDecoder) { + // Lazy to save memory in case if this is not needed + helpers.codepairs = new Uint16Array(32 * 32) + const u16 = helpers.codepairs + const u8 = new Uint8Array(u16.buffer, u16.byteOffset, u16.byteLength) // write as 1-byte to ignore BE/LE difference + for (let i = 0; i < 32; i++) { + const ic = alphabet[i].charCodeAt(0) + for (let j = 0; j < 32; j++) u8[(i << 6) | (j << 1)] = u8[(j << 6) | ((i << 1) + 1)] = ic + } + } else { + const p = helpers.pairs + for (let i = 0; i < 32; i++) { + for (let j = 0; j < 32; j++) p.push(`${alphabet[i]}${alphabet[j]}`) + } + } + } + + const { pairs, codepairs } = helpers + + // Fast path for complete blocks + // This whole loop can be commented out, the algorithm won't change, it's just an optimization of the next loop + if (nativeDecoder) { + const oa = new Uint16Array(fullChunks * 4) + for (let j = 0; i < fullChunksBytes; i += 5) { + const a = arr[i] + const b = arr[i + 1] + const c = arr[i + 2] + const d = arr[i + 3] + const e = arr[i + 4] + const x0 = (a << 2) | (b >> 6) // 8 + 8 - 5 - 5 = 6 left + const x1 = ((b & 0x3f) << 4) | (c >> 4) // 6 + 8 - 5 - 5 = 4 left + const x2 = ((c & 0xf) << 6) | (d >> 2) // 4 + 8 - 5 - 5 = 2 left + const x3 = ((d & 0x3) << 8) | e // 2 + 8 - 5 - 5 = 0 left + oa[j] = codepairs[x0] + oa[j + 1] = codepairs[x1] + oa[j + 2] = codepairs[x2] + oa[j + 3] = codepairs[x3] + j += 4 + } + + o = decodeAscii(oa) + } else if (useTemplates) { + // Templates are faster only on Hermes and JSC. Browsers have TextDecoder anyway + for (; i < fullChunksBytes; i += 5) { + const a = arr[i] + const b = arr[i + 1] + const c = arr[i + 2] + const d = arr[i + 3] + const e = arr[i + 4] + const x0 = (a << 2) | (b >> 6) // 8 + 8 - 5 - 5 = 6 left + const x1 = ((b & 0x3f) << 4) | (c >> 4) // 6 + 8 - 5 - 5 = 4 left + const x2 = ((c & 0xf) << 6) | (d >> 2) // 4 + 8 - 5 - 5 = 2 left + const x3 = ((d & 0x3) << 8) | e // 2 + 8 - 5 - 5 = 0 left + o += `${pairs[x0]}${pairs[x1]}${pairs[x2]}${pairs[x3]}` + } + } else { + for (; i < fullChunksBytes; i += 5) { + const a = arr[i] + const b = arr[i + 1] + const c = arr[i + 2] + const d = arr[i + 3] + const e = arr[i + 4] + const x0 = (a << 2) | (b >> 6) // 8 + 8 - 5 - 5 = 6 left + const x1 = ((b & 0x3f) << 4) | (c >> 4) // 6 + 8 - 5 - 5 = 4 left + const x2 = ((c & 0xf) << 6) | (d >> 2) // 4 + 8 - 5 - 5 = 2 left + const x3 = ((d & 0x3) << 8) | e // 2 + 8 - 5 - 5 = 0 left + o += pairs[x0] + o += pairs[x1] + o += pairs[x2] + o += pairs[x3] + } + } + + // If we have something left, process it with a full algo + let carry = 0 + let shift = 3 // First byte needs to be shifted by 3 to get 5 bits + for (; i < arr.length; i++) { + const x = arr[i] + o += alphabet[carry | (x >> shift)] // shift >= 3, so this fits + if (shift >= 5) { + shift -= 5 + o += alphabet[(x >> shift) & 0x1f] + } + + carry = (x << (5 - shift)) & 0x1f + shift += 3 // Each byte prints 5 bits and leaves 3 bits + } + + if (shift !== 3) o += alphabet[carry] // shift 3 means we have no carry left + if (padding) o += ['', '======', '====', '===', '='][arr.length - fullChunksBytes] + + return o +} + +// TODO: can this be optimized? This only affects non-Hermes barebone engines though +const mapSize = nativeEncoder ? 128 : 65_536 // we have to store 64 KiB map or recheck everything if we can't decode to byte array + +export function fromBase32(str, mode) { + let inputLength = str.length + while (str[inputLength - 1] === '=') inputLength-- + const paddingLength = str.length - inputLength + const tailLength = inputLength % 8 + const mainLength = inputLength - tailLength // multiples of 8 + if (![0, 2, 4, 5, 7].includes(tailLength)) throw new SyntaxError(E_LENGTH) // fast verification + if (paddingLength > 7 || (paddingLength !== 0 && str.length % 8 !== 0)) { + throw new SyntaxError(E_PADDING) + } + + const alphabet = BASE32_ALPHABETS[mode] + const helpers = BASE32_HELPERS[mode] + + if (!helpers.fromMap) { + helpers.fromMap = new Int8Array(mapSize).fill(-1) // no regex input validation here, so we map all other bytes to -1 and recheck sign + const m = helpers.fromMap + alphabet.forEach((c, i) => { + m[c.charCodeAt(0)] = m[c.toLowerCase().charCodeAt(0)] = i + }) + + if (mode === 2) { + // Extra Crockford mapping + m[73] = m[76] = m[105] = m[108] = m[49] // ILil -> 1 + m[79] = m[111] = m[48] // Oo -> 0 + } + } + + const m = helpers.fromMap + + const arr = new Uint8Array(Math.floor((inputLength * 5) / 8)) + let at = 0 + let i = 0 + + if (nativeEncoder) { + const codes = encodeAscii(str, E_CHAR) + for (; i < mainLength; i += 8) { + // each 5 bits, grouped 5 * 4 = 20 + const x0 = codes[i] + const x1 = codes[i + 1] + const x2 = codes[i + 2] + const x3 = codes[i + 3] + const x4 = codes[i + 4] + const x5 = codes[i + 5] + const x6 = codes[i + 6] + const x7 = codes[i + 7] + const a = (m[x0] << 15) | (m[x1] << 10) | (m[x2] << 5) | m[x3] + const b = (m[x4] << 15) | (m[x5] << 10) | (m[x6] << 5) | m[x7] + if (a < 0 || b < 0) throw new SyntaxError(E_CHAR) + arr[at] = a >> 12 + arr[at + 1] = (a >> 4) & 0xff + arr[at + 2] = ((a << 4) & 0xff) | (b >> 16) + arr[at + 3] = (b >> 8) & 0xff + arr[at + 4] = b & 0xff + at += 5 + } + } else { + for (; i < mainLength; i += 8) { + // each 5 bits, grouped 5 * 4 = 20 + const x0 = str.charCodeAt(i) + const x1 = str.charCodeAt(i + 1) + const x2 = str.charCodeAt(i + 2) + const x3 = str.charCodeAt(i + 3) + const x4 = str.charCodeAt(i + 4) + const x5 = str.charCodeAt(i + 5) + const x6 = str.charCodeAt(i + 6) + const x7 = str.charCodeAt(i + 7) + const a = (m[x0] << 15) | (m[x1] << 10) | (m[x2] << 5) | m[x3] + const b = (m[x4] << 15) | (m[x5] << 10) | (m[x6] << 5) | m[x7] + if (a < 0 || b < 0) throw new SyntaxError(E_CHAR) + arr[at] = a >> 12 + arr[at + 1] = (a >> 4) & 0xff + arr[at + 2] = ((a << 4) & 0xff) | (b >> 16) + arr[at + 3] = (b >> 8) & 0xff + arr[at + 4] = b & 0xff + at += 5 + } + } + + // Last block, valid tailLength: 0 2 4 5 7, checked already + // We check last chunk to be strict + if (tailLength < 2) return arr + const ab = (m[str.charCodeAt(i++)] << 5) | m[str.charCodeAt(i++)] + if (ab < 0) throw new SyntaxError(E_CHAR) + arr[at++] = ab >> 2 + if (tailLength < 4) { + if (ab & 0x3) throw new SyntaxError(E_LAST) + return arr + } + + const cd = (m[str.charCodeAt(i++)] << 5) | m[str.charCodeAt(i++)] + if (cd < 0) throw new SyntaxError(E_CHAR) + arr[at++] = ((ab << 6) & 0xff) | (cd >> 4) + if (tailLength < 5) { + if (cd & 0xf) throw new SyntaxError(E_LAST) + return arr + } + + const e = m[str.charCodeAt(i++)] + if (e < 0) throw new SyntaxError(E_CHAR) + arr[at++] = ((cd << 4) & 0xff) | (e >> 1) // 4 + 4 + if (tailLength < 7) { + if (e & 0x1) throw new SyntaxError(E_LAST) + return arr + } + + const fg = (m[str.charCodeAt(i++)] << 5) | m[str.charCodeAt(i++)] + if (fg < 0) throw new SyntaxError(E_CHAR) + arr[at++] = ((e << 7) & 0xff) | (fg >> 3) // 1 + 5 + 2 + // Can't be 8, so no h + if (fg & 0x7) throw new SyntaxError(E_LAST) + return arr +} diff --git a/node_modules/@exodus/bytes/fallback/base58check.js b/node_modules/@exodus/bytes/fallback/base58check.js new file mode 100644 index 0000000000000000000000000000000000000000..7d41c5cb8df7f12ca9265539015cb01e1e1f0748 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/base58check.js @@ -0,0 +1,52 @@ +import { toBase58, fromBase58 } from '@exodus/bytes/base58.js' +import { assertU8, fromUint8 } from './_utils.js' + +const E_CHECKSUM = 'Invalid checksum' + +// checksum length is 4, i.e. only the first 4 bytes of the hash are used + +function encodeWithChecksum(arr, checksum) { + // arr type in already validated in input + const res = new Uint8Array(arr.length + 4) + res.set(arr, 0) + res.set(checksum.slice(0, 4), arr.length) + return toBase58(res) +} + +function decodeWithChecksum(str) { + const arr = fromBase58(str) // checks input + const payloadSize = arr.length - 4 + if (payloadSize < 0) throw new Error(E_CHECKSUM) + return [arr.slice(0, payloadSize), arr.slice(payloadSize)] +} + +function assertChecksum(c, r) { + if ((c[0] ^ r[0]) | (c[1] ^ r[1]) | (c[2] ^ r[2]) | (c[3] ^ r[3])) throw new Error(E_CHECKSUM) +} + +export const makeBase58check = (hashAlgo, hashAlgoSync) => { + const apis = { + async encode(arr) { + assertU8(arr) + return encodeWithChecksum(arr, await hashAlgo(arr)) + }, + async decode(str, format = 'uint8') { + const [payload, checksum] = decodeWithChecksum(str) + assertChecksum(checksum, await hashAlgo(payload)) + return fromUint8(payload, format) + }, + } + if (!hashAlgoSync) return apis + return { + ...apis, + encodeSync(arr) { + assertU8(arr) + return encodeWithChecksum(arr, hashAlgoSync(arr)) + }, + decodeSync(str, format = 'uint8') { + const [payload, checksum] = decodeWithChecksum(str) + assertChecksum(checksum, hashAlgoSync(payload)) + return fromUint8(payload, format) + }, + } +} diff --git a/node_modules/@exodus/bytes/fallback/base64.js b/node_modules/@exodus/bytes/fallback/base64.js new file mode 100644 index 0000000000000000000000000000000000000000..02e4ec882b7ade0373f37755102bf35d8392ab17 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/base64.js @@ -0,0 +1,191 @@ +import { nativeEncoder, nativeDecoder } from './platform.js' +import { encodeAscii, decodeAscii } from './latin1.js' + +// See https://datatracker.ietf.org/doc/html/rfc4648 + +const BASE64 = [...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'] +const BASE64URL = [...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'] +const BASE64_HELPERS = {} +const BASE64URL_HELPERS = {} + +export const E_CHAR = 'Invalid character in base64 input' +export const E_PADDING = 'Invalid base64 padding' +export const E_LENGTH = 'Invalid base64 length' +export const E_LAST = 'Invalid last chunk' + +// We construct output by concatenating chars, this seems to be fine enough on modern JS engines +// Expects a checked Uint8Array +export function toBase64(arr, isURL, padding) { + const fullChunks = (arr.length / 3) | 0 + const fullChunksBytes = fullChunks * 3 + let o = '' + let i = 0 + + const alphabet = isURL ? BASE64URL : BASE64 + const helpers = isURL ? BASE64URL_HELPERS : BASE64_HELPERS + if (!helpers.pairs) { + helpers.pairs = [] + if (nativeDecoder) { + // Lazy to save memory in case if this is not needed + helpers.codepairs = new Uint16Array(64 * 64) + const u16 = helpers.codepairs + const u8 = new Uint8Array(u16.buffer, u16.byteOffset, u16.byteLength) // write as 1-byte to ignore BE/LE difference + for (let i = 0; i < 64; i++) { + const ic = alphabet[i].charCodeAt(0) + for (let j = 0; j < 64; j++) u8[(i << 7) | (j << 1)] = u8[(j << 7) | ((i << 1) + 1)] = ic + } + } else { + const p = helpers.pairs + for (let i = 0; i < 64; i++) { + for (let j = 0; j < 64; j++) p.push(`${alphabet[i]}${alphabet[j]}`) + } + } + } + + const { pairs, codepairs } = helpers + + // Fast path for complete blocks + // This whole loop can be commented out, the algorithm won't change, it's just an optimization of the next loop + if (nativeDecoder) { + const oa = new Uint16Array(fullChunks * 2) + let j = 0 + for (const last = arr.length - 11; i < last; i += 12, j += 8) { + const x0 = arr[i] + const x1 = arr[i + 1] + const x2 = arr[i + 2] + const x3 = arr[i + 3] + const x4 = arr[i + 4] + const x5 = arr[i + 5] + const x6 = arr[i + 6] + const x7 = arr[i + 7] + const x8 = arr[i + 8] + const x9 = arr[i + 9] + const x10 = arr[i + 10] + const x11 = arr[i + 11] + oa[j] = codepairs[(x0 << 4) | (x1 >> 4)] + oa[j + 1] = codepairs[((x1 & 0x0f) << 8) | x2] + oa[j + 2] = codepairs[(x3 << 4) | (x4 >> 4)] + oa[j + 3] = codepairs[((x4 & 0x0f) << 8) | x5] + oa[j + 4] = codepairs[(x6 << 4) | (x7 >> 4)] + oa[j + 5] = codepairs[((x7 & 0x0f) << 8) | x8] + oa[j + 6] = codepairs[(x9 << 4) | (x10 >> 4)] + oa[j + 7] = codepairs[((x10 & 0x0f) << 8) | x11] + } + + // i < last here is equivalent to i < fullChunksBytes + for (const last = arr.length - 2; i < last; i += 3, j += 2) { + const a = arr[i] + const b = arr[i + 1] + const c = arr[i + 2] + oa[j] = codepairs[(a << 4) | (b >> 4)] + oa[j + 1] = codepairs[((b & 0x0f) << 8) | c] + } + + o = decodeAscii(oa) + } else { + // This can be optimized by ~25% with templates on Hermes, but this codepath is not called on Hermes, it uses btoa + // Check git history for templates version + for (; i < fullChunksBytes; i += 3) { + const a = arr[i] + const b = arr[i + 1] + const c = arr[i + 2] + o += pairs[(a << 4) | (b >> 4)] + o += pairs[((b & 0x0f) << 8) | c] + } + } + + // If we have something left, process it with a full algo + let carry = 0 + let shift = 2 // First byte needs to be shifted by 2 to get 6 bits + const length = arr.length + for (; i < length; i++) { + const x = arr[i] + o += alphabet[carry | (x >> shift)] // shift >= 2, so this fits + if (shift === 6) { + shift = 0 + o += alphabet[x & 0x3f] + } + + carry = (x << (6 - shift)) & 0x3f + shift += 2 // Each byte prints 6 bits and leaves 2 bits + } + + if (shift !== 2) o += alphabet[carry] // shift 2 means we have no carry left + if (padding) o += ['', '==', '='][length - fullChunksBytes] + + return o +} + +// TODO: can this be optimized? This only affects non-Hermes barebone engines though +const mapSize = nativeEncoder ? 128 : 65_536 // we have to store 64 KiB map or recheck everything if we can't decode to byte array + +export function fromBase64(str, isURL) { + let inputLength = str.length + while (str[inputLength - 1] === '=') inputLength-- + const paddingLength = str.length - inputLength + const tailLength = inputLength % 4 + const mainLength = inputLength - tailLength // multiples of 4 + if (tailLength === 1) throw new SyntaxError(E_LENGTH) + if (paddingLength > 3 || (paddingLength !== 0 && str.length % 4 !== 0)) { + throw new SyntaxError(E_PADDING) + } + + const alphabet = isURL ? BASE64URL : BASE64 + const helpers = isURL ? BASE64URL_HELPERS : BASE64_HELPERS + + if (!helpers.fromMap) { + helpers.fromMap = new Int8Array(mapSize).fill(-1) // no regex input validation here, so we map all other bytes to -1 and recheck sign + alphabet.forEach((c, i) => (helpers.fromMap[c.charCodeAt(0)] = i)) + } + + const m = helpers.fromMap + + const arr = new Uint8Array(Math.floor((inputLength * 3) / 4)) + let at = 0 + let i = 0 + + if (nativeEncoder) { + const codes = encodeAscii(str, E_CHAR) + for (; i < mainLength; i += 4) { + const c0 = codes[i] + const c1 = codes[i + 1] + const c2 = codes[i + 2] + const c3 = codes[i + 3] + const a = (m[c0] << 18) | (m[c1] << 12) | (m[c2] << 6) | m[c3] + if (a < 0) throw new SyntaxError(E_CHAR) + arr[at] = a >> 16 + arr[at + 1] = (a >> 8) & 0xff + arr[at + 2] = a & 0xff + at += 3 + } + } else { + for (; i < mainLength; i += 4) { + const c0 = str.charCodeAt(i) + const c1 = str.charCodeAt(i + 1) + const c2 = str.charCodeAt(i + 2) + const c3 = str.charCodeAt(i + 3) + const a = (m[c0] << 18) | (m[c1] << 12) | (m[c2] << 6) | m[c3] + if (a < 0) throw new SyntaxError(E_CHAR) + arr[at] = a >> 16 + arr[at + 1] = (a >> 8) & 0xff + arr[at + 2] = a & 0xff + at += 3 + } + } + + // Can be 0, 2 or 3, verified by padding checks already + if (tailLength < 2) return arr // 0 + const ab = (m[str.charCodeAt(i++)] << 6) | m[str.charCodeAt(i++)] + if (ab < 0) throw new SyntaxError(E_CHAR) + arr[at++] = ab >> 4 + if (tailLength < 3) { + if (ab & 0xf) throw new SyntaxError(E_LAST) + return arr // 2 + } + + const c = m[str.charCodeAt(i++)] + if (c < 0) throw new SyntaxError(E_CHAR) + arr[at++] = ((ab << 4) & 0xff) | (c >> 2) + if (c & 0x3) throw new SyntaxError(E_LAST) + return arr // 3 +} diff --git a/node_modules/@exodus/bytes/fallback/encoding.api.js b/node_modules/@exodus/bytes/fallback/encoding.api.js new file mode 100644 index 0000000000000000000000000000000000000000..8dc5243a823deb422d1b57ba23ecc717c07b2c93 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/encoding.api.js @@ -0,0 +1,38 @@ +// TODO: make this more strict against Symbol.toStringTag +// Is not very significant though, anything faking Symbol.toStringTag could as well override +// prototypes, which is not something we protect against + +function isAnyArrayBuffer(x) { + if (x instanceof ArrayBuffer) return true + if (globalThis.SharedArrayBuffer && x instanceof SharedArrayBuffer) return true + if (!x || typeof x.byteLength !== 'number') return false + const s = Object.prototype.toString.call(x) + return s === '[object ArrayBuffer]' || s === '[object SharedArrayBuffer]' +} + +export function fromSource(x) { + if (x instanceof Uint8Array) return x + if (ArrayBuffer.isView(x)) return new Uint8Array(x.buffer, x.byteOffset, x.byteLength) + if (isAnyArrayBuffer(x)) { + if ('detached' in x) return x.detached === true ? new Uint8Array() : new Uint8Array(x) + // Old engines without .detached, try-catch + try { + return new Uint8Array(x) + } catch { + return new Uint8Array() + } + } + + throw new TypeError('Argument must be a SharedArrayBuffer, ArrayBuffer or ArrayBufferView') +} + +// Warning: unlike whatwg-encoding, returns lowercased labels +// Those are case-insensitive and that's how TextDecoder encoding getter normalizes them +export function getBOMEncoding(input) { + const u8 = fromSource(input) // asserts + if (u8.length >= 3 && u8[0] === 0xef && u8[1] === 0xbb && u8[2] === 0xbf) return 'utf-8' + if (u8.length < 2) return null + if (u8[0] === 0xff && u8[1] === 0xfe) return 'utf-16le' + if (u8[0] === 0xfe && u8[1] === 0xff) return 'utf-16be' + return null +} diff --git a/node_modules/@exodus/bytes/fallback/encoding.js b/node_modules/@exodus/bytes/fallback/encoding.js new file mode 100644 index 0000000000000000000000000000000000000000..c69b6420ccc339cddbcf4e819b1b2d3adbbc5fd5 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/encoding.js @@ -0,0 +1,369 @@ +// We can't return native TextDecoder if it's present, as Node.js one is broken on windows-1252 and we fix that +// We are also faster than Node.js built-in on both TextEncoder and TextDecoder + +import { utf16toString, utf16toStringLoose } from '@exodus/bytes/utf16.js' +import { utf8fromStringLoose, utf8toString, utf8toStringLoose } from '@exodus/bytes/utf8.js' +import { + createSinglebyteDecoder, + latin1toString, + latin1fromString, +} from '@exodus/bytes/single-byte.js' +import labels from './encoding.labels.js' +import { fromSource, getBOMEncoding } from './encoding.api.js' +import { unfinishedBytes, mergePrefix } from './encoding.util.js' + +export { getBOMEncoding } from './encoding.api.js' + +export const E_ENCODING = 'Unknown encoding' +const E_MULTI = "import '@exodus/bytes/encoding.js' for legacy multi-byte encodings support" +const E_OPTIONS = 'The "options" argument must be of type object' +const replacementChar = '\uFFFD' +const multibyteSet = new Set(['big5', 'euc-kr', 'euc-jp', 'iso-2022-jp', 'shift_jis', 'gbk', 'gb18030']) // prettier-ignore +let createMultibyteDecoder, multibyteEncoder + +let labelsMap +// Warning: unlike whatwg-encoding, returns lowercased labels +// Those are case-insensitive and that's how TextDecoder encoding getter normalizes them +// https://encoding.spec.whatwg.org/#names-and-labels +export function normalizeEncoding(label) { + // fast path + if (label === 'utf-8' || label === 'utf8' || label === 'UTF-8' || label === 'UTF8') return 'utf-8' + if (label === 'windows-1252' || label === 'ascii' || label === 'latin1') return 'windows-1252' + // full map + if (/[^\w\t\n\f\r .:-]/i.test(label)) return null // must be ASCII (with ASCII whitespace) + const low = `${label}`.trim().toLowerCase() + if (Object.hasOwn(labels, low)) return low + if (!labelsMap) { + labelsMap = new Map() + for (const [name, aliases] of Object.entries(labels)) { + for (const alias of aliases) labelsMap.set(alias, name) + } + } + + const mapped = labelsMap.get(low) + if (mapped) return mapped + return null +} + +const uppercasePrefixes = new Set(['utf', 'iso', 'koi', 'euc', 'ibm', 'gbk']) + +// Unlike normalizeEncoding, case-sensitive +// https://encoding.spec.whatwg.org/#names-and-labels +export function labelToName(label) { + const enc = normalizeEncoding(label) + if (enc === 'utf-8') return 'UTF-8' // fast path + if (!enc) return enc + if (uppercasePrefixes.has(enc.slice(0, 3))) return enc.toUpperCase() + if (enc === 'big5') return 'Big5' + if (enc === 'shift_jis') return 'Shift_JIS' + return enc +} + +export const isMultibyte = (enc) => multibyteSet.has(enc) +export function setMultibyte(createDecoder, createEncoder) { + createMultibyteDecoder = createDecoder + multibyteEncoder = createEncoder +} + +export function getMultibyteEncoder() { + if (!multibyteEncoder) throw new Error(E_MULTI) + return multibyteEncoder +} + +const define = (obj, key, value) => Object.defineProperty(obj, key, { value, writable: false }) + +function isAnyUint8Array(x) { + if (x instanceof Uint8Array) return true + if (!x || !ArrayBuffer.isView(x) || x.BYTES_PER_ELEMENT !== 1) return false + return Object.prototype.toString.call(x) === '[object Uint8Array]' +} + +function unicodeDecoder(encoding, loose) { + if (encoding === 'utf-8') return loose ? utf8toStringLoose : utf8toString // likely + const form = encoding === 'utf-16le' ? 'uint8-le' : 'uint8-be' + return loose ? (u) => utf16toStringLoose(u, form) : (u) => utf16toString(u, form) +} + +export class TextDecoder { + #decode + #unicode + #multibyte + #chunk + #canBOM + + constructor(encoding = 'utf-8', options = {}) { + if (typeof options !== 'object') throw new TypeError(E_OPTIONS) + const enc = normalizeEncoding(encoding) + if (!enc || enc === 'replacement') throw new RangeError(E_ENCODING) + define(this, 'encoding', enc) + define(this, 'fatal', !!options.fatal) + define(this, 'ignoreBOM', !!options.ignoreBOM) + this.#unicode = enc === 'utf-8' || enc === 'utf-16le' || enc === 'utf-16be' + this.#multibyte = !this.#unicode && isMultibyte(enc) + this.#canBOM = this.#unicode && !this.ignoreBOM + } + + get [Symbol.toStringTag]() { + return 'TextDecoder' + } + + decode(input, options = {}) { + if (typeof options !== 'object') throw new TypeError(E_OPTIONS) + const stream = !!options.stream + let u = input === undefined ? new Uint8Array() : fromSource(input) + const empty = u.length === 0 // also can't be streaming after next line + if (empty && stream) return '' // no state change + + if (this.#unicode) { + let prefix + if (this.#chunk) { + const merged = mergePrefix(u, this.#chunk, this.encoding) + if (u.length < 3) { + u = merged // might be unfinished, but fully consumed old u + } else { + prefix = merged // stops at complete chunk + const add = prefix.length - this.#chunk.length + if (add > 0) u = u.subarray(add) + } + + this.#chunk = null + } else if (empty) { + this.#canBOM = !this.ignoreBOM // not streaming + return '' + } + + // For non-stream utf-8 we don't have to do this as it matches utf8toStringLoose already + // For non-stream loose utf-16 we still have to do this as this API supports uneven byteLength unlike utf16toStringLoose + let suffix = '' + if (stream || (!this.fatal && this.encoding !== 'utf-8')) { + const trail = unfinishedBytes(u, u.byteLength, this.encoding) + if (trail > 0) { + if (stream) { + this.#chunk = Uint8Array.from(u.subarray(-trail)) // copy + } else { + // non-fatal mode as already checked + suffix = replacementChar + } + + u = u.subarray(0, -trail) + } + } + + let seenBOM = false + if (this.#canBOM) { + const bom = this.#findBom(prefix ?? u) + if (bom) { + seenBOM = true + if (prefix) { + prefix = prefix.subarray(bom) + } else { + u = u.subarray(bom) + } + } + } else if (!stream && !this.ignoreBOM) { + this.#canBOM = true + } + + if (!this.#decode) this.#decode = unicodeDecoder(this.encoding, !this.fatal) + try { + const res = (prefix ? this.#decode(prefix) : '') + this.#decode(u) + suffix + // "BOM seen" is set on the current decode call only if it did not error, in "serialize I/O queue" after decoding + if (stream && (seenBOM || res.length > 0)) this.#canBOM = false + return res + } catch (err) { + this.#chunk = null // reset unfinished chunk on errors + // The correct way per spec seems to be not destroying the decoder state (aka BOM here) in stream mode + // See also multi-byte.js + throw err + } + + // eslint-disable-next-line no-else-return + } else if (this.#multibyte) { + if (!createMultibyteDecoder) throw new Error(E_MULTI) + if (!this.#decode) this.#decode = createMultibyteDecoder(this.encoding, !this.fatal) // can contain state! + return this.#decode(u, stream) + } else { + if (!this.#decode) this.#decode = createSinglebyteDecoder(this.encoding, !this.fatal) + return this.#decode(u) + } + } + + #findBom(u) { + switch (this.encoding) { + case 'utf-8': + return u.byteLength >= 3 && u[0] === 0xef && u[1] === 0xbb && u[2] === 0xbf ? 3 : 0 + case 'utf-16le': + return u.byteLength >= 2 && u[0] === 0xff && u[1] === 0xfe ? 2 : 0 + case 'utf-16be': + return u.byteLength >= 2 && u[0] === 0xfe && u[1] === 0xff ? 2 : 0 + } + + /* c8 ignore next */ + throw new Error('Unreachable') + } +} + +export class TextEncoder { + constructor() { + define(this, 'encoding', 'utf-8') + } + + get [Symbol.toStringTag]() { + return 'TextEncoder' + } + + encode(str = '') { + if (typeof str !== 'string') str = `${str}` + return utf8fromStringLoose(str) // non-pooled + } + + encodeInto(str, target) { + if (typeof str !== 'string') str = `${str}` + if (!isAnyUint8Array(target)) throw new TypeError('Target must be an Uint8Array') + if (target.buffer.detached) return { read: 0, written: 0 } // Until https://github.com/whatwg/encoding/issues/324 is resolved + + const tlen = target.length + if (tlen < str.length) str = str.slice(0, tlen) + let u8 = utf8fromStringLoose(str) + let read + if (tlen >= u8.length) { + read = str.length + } else if (u8.length === str.length) { + if (u8.length > tlen) u8 = u8.subarray(0, tlen) // ascii can be truncated + read = u8.length + } else { + u8 = u8.subarray(0, tlen) + const unfinished = unfinishedBytes(u8, u8.length, 'utf-8') + if (unfinished > 0) u8 = u8.subarray(0, u8.length - unfinished) + + // We can do this because loose str -> u8 -> str preserves length, unlike loose u8 -> str -> u8 + // Each unpaired surrogate (1 charcode) is replaced with a single charcode + read = utf8toStringLoose(u8).length // FIXME: Converting back is very inefficient + } + + try { + target.set(u8) + } catch { + return { read: 0, written: 0 } // see above, likely detached but no .detached property support + } + + return { read, written: u8.length } + } +} + +const E_NO_STREAMS = 'TransformStream global not present in the environment' + +// https://encoding.spec.whatwg.org/#interface-textdecoderstream +export class TextDecoderStream { + constructor(encoding = 'utf-8', options = {}) { + if (!globalThis.TransformStream) throw new Error(E_NO_STREAMS) + const decoder = new TextDecoder(encoding, options) + const transform = new TransformStream({ + transform: (chunk, controller) => { + const value = decoder.decode(fromSource(chunk), { stream: true }) + if (value) controller.enqueue(value) + }, + flush: (controller) => { + // https://streams.spec.whatwg.org/#dom-transformer-flush + const value = decoder.decode() + if (value) controller.enqueue(value) + // No need to call .terminate() (Node.js is wrong) + }, + }) + + define(this, 'encoding', decoder.encoding) + define(this, 'fatal', decoder.fatal) + define(this, 'ignoreBOM', decoder.ignoreBOM) + define(this, 'readable', transform.readable) + define(this, 'writable', transform.writable) + } + + get [Symbol.toStringTag]() { + return 'TextDecoderStream' + } +} + +// https://encoding.spec.whatwg.org/#interface-textencoderstream +// Only UTF-8 per spec +export class TextEncoderStream { + constructor() { + if (!globalThis.TransformStream) throw new Error(E_NO_STREAMS) + let lead + const transform = new TransformStream({ + // https://encoding.spec.whatwg.org/#encode-and-enqueue-a-chunk + // Not identical in code, but reuses loose mode to have identical behavior + transform: (chunk, controller) => { + let s = String(chunk) // DOMString, might contain unpaired surrogates + if (s.length === 0) return + if (lead) { + s = lead + s + lead = null + } + + const last = s.charCodeAt(s.length - 1) // Can't come from previous lead due to length check + if ((last & 0xfc_00) === 0xd8_00) { + lead = s[s.length - 1] + s = s.slice(0, -1) + } + + if (s) controller.enqueue(utf8fromStringLoose(s)) + }, + // https://encoding.spec.whatwg.org/#encode-and-flush + flush: (controller) => { + if (lead) controller.enqueue(Uint8Array.of(0xef, 0xbf, 0xbd)) + }, + }) + + define(this, 'encoding', 'utf-8') + define(this, 'readable', transform.readable) + define(this, 'writable', transform.writable) + } + + get [Symbol.toStringTag]() { + return 'TextEncoderStream' + } +} + +// https://encoding.spec.whatwg.org/#decode +// Warning: encoding sniffed from BOM takes preference over the supplied one +// Warning: lossy, performs replacement, no option of throwing +// Completely ignores encoding and even skips validation when BOM is found +// Unlike TextDecoder public API, additionally supports 'replacement' encoding +export function legacyHookDecode(input, fallbackEncoding = 'utf-8') { + let u8 = fromSource(input) + const bomEncoding = getBOMEncoding(u8) + if (bomEncoding) u8 = u8.subarray(bomEncoding === 'utf-8' ? 3 : 2) + const enc = bomEncoding ?? normalizeEncoding(fallbackEncoding) // "the byte order mark is more authoritative than anything else" + + if (enc === 'utf-8') return utf8toStringLoose(u8) + if (enc === 'utf-16le' || enc === 'utf-16be') { + let suffix = '' + if (u8.byteLength % 2 !== 0) { + suffix = replacementChar + u8 = u8.subarray(0, -unfinishedBytes(u8, u8.byteLength, enc)) + } + + return utf16toStringLoose(u8, enc === 'utf-16le' ? 'uint8-le' : 'uint8-be') + suffix + } + + if (!Object.hasOwn(labels, enc)) throw new RangeError(E_ENCODING) + + if (isMultibyte(enc)) { + if (!createMultibyteDecoder) throw new Error(E_MULTI) + return createMultibyteDecoder(enc, true)(u8) + } + + // https://encoding.spec.whatwg.org/#replacement-decoder + // On non-streaming non-fatal case, it just replaces any non-empty input with a single replacement char + if (enc === 'replacement') return input.byteLength > 0 ? replacementChar : '' + + return createSinglebyteDecoder(enc, true)(u8) +} + +export function isomorphicDecode(input) { + return latin1toString(fromSource(input)) +} + +export function isomorphicEncode(str) { + return latin1fromString(str) +} diff --git a/node_modules/@exodus/bytes/fallback/encoding.labels.js b/node_modules/@exodus/bytes/fallback/encoding.labels.js new file mode 100644 index 0000000000000000000000000000000000000000..62b8224c2c82080321eae4b73202bb422b121887 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/encoding.labels.js @@ -0,0 +1,50 @@ +// See https://encoding.spec.whatwg.org/#names-and-labels + +/* eslint-disable @exodus/export-default/named */ +// prettier-ignore +const labels = { + 'utf-8': ['unicode-1-1-utf-8', 'unicode11utf8', 'unicode20utf8', 'utf8', 'x-unicode20utf8'], + 'utf-16be': ['unicodefffe'], + 'utf-16le': ['csunicode', 'iso-10646-ucs-2', 'ucs-2', 'unicode', 'unicodefeff', 'utf-16'], + 'iso-8859-2': ['iso-ir-101'], + 'iso-8859-3': ['iso-ir-109'], + 'iso-8859-4': ['iso-ir-110'], + 'iso-8859-5': ['csisolatincyrillic', 'cyrillic', 'iso-ir-144'], + 'iso-8859-6': ['arabic', 'asmo-708', 'csiso88596e', 'csiso88596i', 'csisolatinarabic', 'ecma-114', 'iso-8859-6-e', 'iso-8859-6-i', 'iso-ir-127'], + 'iso-8859-7': ['csisolatingreek', 'ecma-118', 'elot_928', 'greek', 'greek8', 'iso-ir-126', 'sun_eu_greek'], + 'iso-8859-8': ['csiso88598e', 'csisolatinhebrew', 'hebrew', 'iso-8859-8-e', 'iso-ir-138', 'visual'], + 'iso-8859-8-i': ['csiso88598i', 'logical'], + 'iso-8859-16': [], + 'koi8-r': ['cskoi8r', 'koi', 'koi8', 'koi8_r'], + 'koi8-u': ['koi8-ru'], + 'windows-874': ['dos-874', 'iso-8859-11', 'iso8859-11', 'iso885911', 'tis-620'], + ibm866: ['866', 'cp866', 'csibm866'], + 'x-mac-cyrillic': ['x-mac-ukrainian'], + macintosh: ['csmacintosh', 'mac', 'x-mac-roman'], + gbk: ['chinese', 'csgb2312', 'csiso58gb231280', 'gb2312', 'gb_2312', 'gb_2312-80', 'iso-ir-58', 'x-gbk'], + gb18030: [], + big5: ['big5-hkscs', 'cn-big5', 'csbig5', 'x-x-big5'], + 'euc-jp': ['cseucpkdfmtjapanese', 'x-euc-jp'], + shift_jis: ['csshiftjis', 'ms932', 'ms_kanji', 'shift-jis', 'sjis', 'windows-31j', 'x-sjis'], + 'euc-kr': ['cseuckr', 'csksc56011987', 'iso-ir-149', 'korean', 'ks_c_5601-1987', 'ks_c_5601-1989', 'ksc5601', 'ksc_5601', 'windows-949'], + 'iso-2022-jp': ['csiso2022jp'], + replacement: ['csiso2022kr', 'hz-gb-2312', 'iso-2022-cn', 'iso-2022-cn-ext', 'iso-2022-kr'], + 'x-user-defined': [], +} + +for (const i of [10, 13, 14, 15]) labels[`iso-8859-${i}`] = [`iso8859-${i}`, `iso8859${i}`] +for (const i of [2, 6, 7]) labels[`iso-8859-${i}`].push(`iso_8859-${i}:1987`) +for (const i of [3, 4, 5, 8]) labels[`iso-8859-${i}`].push(`iso_8859-${i}:1988`) +// prettier-ignore +for (let i = 2; i < 9; i++) labels[`iso-8859-${i}`].push(`iso8859-${i}`, `iso8859${i}`, `iso_8859-${i}`) +for (let i = 2; i < 5; i++) labels[`iso-8859-${i}`].push(`csisolatin${i}`, `l${i}`, `latin${i}`) +for (let i = 0; i < 9; i++) labels[`windows-125${i}`] = [`cp125${i}`, `x-cp125${i}`] + +// prettier-ignore +labels['windows-1252'].push('ansi_x3.4-1968', 'ascii', 'cp819', 'csisolatin1', 'ibm819', 'iso-8859-1', 'iso-ir-100', 'iso8859-1', 'iso88591', 'iso_8859-1', 'iso_8859-1:1987', 'l1', 'latin1', 'us-ascii') +// prettier-ignore +labels['windows-1254'].push('csisolatin5', 'iso-8859-9', 'iso-ir-148', 'iso8859-9', 'iso88599', 'iso_8859-9', 'iso_8859-9:1989', 'l5', 'latin5') +labels['iso-8859-10'].push('csisolatin6', 'iso-ir-157', 'l6', 'latin6') +labels['iso-8859-15'].push('csisolatin9', 'iso_8859-15', 'l9') + +export default labels diff --git a/node_modules/@exodus/bytes/fallback/encoding.util.js b/node_modules/@exodus/bytes/fallback/encoding.util.js new file mode 100644 index 0000000000000000000000000000000000000000..06fa2a44e56c7953f413ca15a7cdd34e0550ac26 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/encoding.util.js @@ -0,0 +1,65 @@ +// Get a number of last bytes in an Uint8Array `u` ending at `len` that don't +// form a codepoint yet, but can be a part of a single codepoint on more data +export function unfinishedBytes(u, len, enc) { + switch (enc) { + case 'utf-8': { + // 0-3 + let p = 0 + while (p < 2 && p < len && (u[len - p - 1] & 0xc0) === 0x80) p++ // go back 0-2 trailing bytes + if (p === len) return 0 // no space for lead + const l = u[len - p - 1] + if (l < 0xc2 || l > 0xf4) return 0 // not a lead + if (p === 0) return 1 // nothing to recheck, we have only lead, return it. 2-byte must return here + if (l < 0xe0 || (l < 0xf0 && p >= 2)) return 0 // 2-byte, or 3-byte or less and we already have 2 trailing + const lower = l === 0xf0 ? 0x90 : l === 0xe0 ? 0xa0 : 0x80 + const upper = l === 0xf4 ? 0x8f : l === 0xed ? 0x9f : 0xbf + const n = u[len - p] + return n >= lower && n <= upper ? p + 1 : 0 + } + + case 'utf-16le': + case 'utf-16be': { + // 0-3 + const p = len % 2 // uneven byte length adds 1 + if (len < 2) return p + const l = len - p - 1 + const last = enc === 'utf-16le' ? (u[l] << 8) ^ u[l - 1] : (u[l - 1] << 8) ^ u[l] + return last >= 0xd8_00 && last < 0xdc_00 ? p + 2 : p // lone lead adds 2 + } + } + + throw new Error('Unsupported encoding') +} + +// Merge prefix `chunk` with `u` and return new combined prefix +// For u.length < 3, fully consumes u and can return unfinished data, +// otherwise returns a prefix with no unfinished bytes +export function mergePrefix(u, chunk, enc) { + if (u.length === 0) return chunk + const cl = chunk.length + if (u.length < 3) { + // No reason to bruteforce offsets, also it's possible this doesn't yet end the sequence + const a = new Uint8Array(cl + u.length) + a.set(chunk) + a.set(u, cl) + return a + } + + // Slice off a small portion of u into prefix chunk so we can decode them separately without extending array size + const t = new Uint8Array(cl + 3) // We have 1-3 bytes and need 1-3 more bytes + t.set(chunk) + t.set(u.subarray(0, 3), cl) + + // Stop at the first offset where unfinished bytes reaches 0 or fits into u + // If that doesn't happen (u too short), just concat chunk and u completely (above) + for (let i = 1; i <= 3; i++) { + const unfinished = unfinishedBytes(t, cl + i, enc) // 0-3 + if (unfinished <= i) { + // Always reachable at 3, but we still need 'unfinished' value for it + const add = i - unfinished // 0-3 + return add > 0 ? t.subarray(0, cl + add) : chunk + } + } + + // Unreachable +} diff --git a/node_modules/@exodus/bytes/fallback/hex.js b/node_modules/@exodus/bytes/fallback/hex.js new file mode 100644 index 0000000000000000000000000000000000000000..3f2166dca0b35c9f3364878f469ec9904627fed5 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/hex.js @@ -0,0 +1,126 @@ +import { E_STRING } from './_utils.js' +import { nativeDecoder, nativeEncoder, decode2string } from './platform.js' +import { encodeAscii, decodeAscii } from './latin1.js' + +let hexArray // array of 256 bytes converted to two-char hex strings +let hexCodes // hexArray converted to u16 code pairs +let dehexArray +const _00 = 0x30_30 // '00' string in hex, the only allowed char pair to generate 0 byte +const _ff = 0x66_66 // 'ff' string in hex, max allowed char pair (larger than 'FF' string) +const allowed = '0123456789ABCDEFabcdef' + +export const E_HEX = 'Input is not a hex string' + +// Expects a checked Uint8Array +export function toHex(arr) { + if (!hexArray) hexArray = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')) + const length = arr.length // this helps Hermes + + // Only old browsers use this, barebone engines don't have TextDecoder + // But Hermes can use this when it (hopefully) implements TextDecoder + if (nativeDecoder) { + if (!hexCodes) { + hexCodes = new Uint16Array(256) + const u8 = new Uint8Array(hexCodes.buffer, hexCodes.byteOffset, hexCodes.byteLength) + for (let i = 0; i < 256; i++) { + const pair = hexArray[i] + u8[2 * i] = pair.charCodeAt(0) + u8[2 * i + 1] = pair.charCodeAt(1) + } + } + + const oa = new Uint16Array(length) + let i = 0 + for (const last3 = arr.length - 3; ; i += 4) { + if (i >= last3) break // loop is fast enough for moving this here to be useful on JSC + const x0 = arr[i] + const x1 = arr[i + 1] + const x2 = arr[i + 2] + const x3 = arr[i + 3] + oa[i] = hexCodes[x0] + oa[i + 1] = hexCodes[x1] + oa[i + 2] = hexCodes[x2] + oa[i + 3] = hexCodes[x3] + } + + for (; i < length; i++) oa[i] = hexCodes[arr[i]] + return decodeAscii(oa) + } + + return decode2string(arr, 0, length, hexArray) +} + +export function fromHex(str) { + if (typeof str !== 'string') throw new TypeError(E_STRING) + if (str.length % 2 !== 0) throw new SyntaxError(E_HEX) + + const length = str.length / 2 // this helps Hermes in loops + const arr = new Uint8Array(length) + + // Native encoder path is beneficial even for small arrays in Hermes + if (nativeEncoder) { + if (!dehexArray) { + dehexArray = new Uint8Array(_ff + 1) // 26 KiB cache, >2x perf improvement on Hermes + const u8 = new Uint8Array(2) + const u16 = new Uint16Array(u8.buffer, u8.byteOffset, 1) // for endianess-agnostic transform + const map = [...allowed].map((c) => [c.charCodeAt(0), parseInt(c, 16)]) + for (const [ch, vh] of map) { + u8[0] = ch // first we read high hex char + for (const [cl, vl] of map) { + u8[1] = cl // then we read low hex char + dehexArray[u16[0]] = (vh << 4) | vl + } + } + } + + const codes = encodeAscii(str, E_HEX) // aligned + const codes16 = new Uint16Array(codes.buffer, codes.byteOffset, codes.byteLength / 2) + let i = 0 + for (const last3 = length - 3; i < last3; i += 4) { + const ai = codes16[i] + const bi = codes16[i + 1] + const ci = codes16[i + 2] + const di = codes16[i + 3] + const a = dehexArray[ai] + const b = dehexArray[bi] + const c = dehexArray[ci] + const d = dehexArray[di] + if ((!a && ai !== _00) || (!b && bi !== _00) || (!c && ci !== _00) || (!d && di !== _00)) { + throw new SyntaxError(E_HEX) + } + + arr[i] = a + arr[i + 1] = b + arr[i + 2] = c + arr[i + 3] = d + } + + while (i < length) { + const ai = codes16[i] + const a = dehexArray[ai] + if (!a && ai !== _00) throw new SyntaxError(E_HEX) + arr[i++] = a + } + } else { + if (!dehexArray) { + // no regex input validation here, so we map all other bytes to -1 and recheck sign + // non-ASCII chars throw already though, so we should process only 0-127 + dehexArray = new Int8Array(128).fill(-1) + for (let i = 0; i < 16; i++) { + const s = i.toString(16) + dehexArray[s.charCodeAt(0)] = dehexArray[s.toUpperCase().charCodeAt(0)] = i + } + } + + let j = 0 + for (let i = 0; i < length; i++) { + const a = str.charCodeAt(j++) + const b = str.charCodeAt(j++) + const res = (dehexArray[a] << 4) | dehexArray[b] + if (res < 0 || (0x7f | a | b) !== 0x7f) throw new SyntaxError(E_HEX) // 0-127 + arr[i] = res + } + } + + return arr +} diff --git a/node_modules/@exodus/bytes/fallback/latin1.js b/node_modules/@exodus/bytes/fallback/latin1.js new file mode 100644 index 0000000000000000000000000000000000000000..5851061804ab744ff706384ed0fb64d66efeafd7 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/latin1.js @@ -0,0 +1,152 @@ +import { + nativeEncoder, + nativeDecoder, + nativeDecoderLatin1, + nativeBuffer, + encodeCharcodes, + isHermes, + isDeno, + isLE, +} from './platform.js' + +const atob = /* @__PURE__ */ (() => globalThis.atob)() +const web64 = /* @__PURE__ */ (() => Uint8Array.prototype.toBase64)() + +// See http://stackoverflow.com/a/22747272/680742, which says that lowest limit is in Chrome, with 0xffff args +// On Hermes, actual max is 0x20_000 minus current stack depth, 1/16 of that should be safe +const maxFunctionArgs = 0x20_00 + +// toBase64+atob path is faster on everything where fromBase64 is fast +const useLatin1atob = web64 && atob + +export function asciiPrefix(arr) { + let p = 0 // verified ascii bytes + const length = arr.length + // Threshold tested on Hermes (worse on <=48, better on >=52) + // Also on v8 arrs of size <=64 might be on heap and using Uint32Array on them is unoptimal + if (length > 64) { + // Speedup with u32 + const u32start = (4 - (arr.byteOffset & 3)) % 4 // offset start by this many bytes for alignment + for (; p < u32start; p++) if (arr[p] >= 0x80) return p + const u32length = ((arr.byteLength - u32start) / 4) | 0 + const u32 = new Uint32Array(arr.buffer, arr.byteOffset + u32start, u32length) + let i = 0 + for (const last3 = u32length - 3; ; p += 16, i += 4) { + if (i >= last3) break // loop is fast enough for moving this here to be _very_ useful, likely due to array access checks + const a = u32[i] + const b = u32[i + 1] + const c = u32[i + 2] + const d = u32[i + 3] + // "(a | b | c | d) & mask" is slower on Hermes though faster on v8 + if (a & 0x80_80_80_80 || b & 0x80_80_80_80 || c & 0x80_80_80_80 || d & 0x80_80_80_80) break + } + + for (; i < u32length; p += 4, i++) if (u32[i] & 0x80_80_80_80) break + } + + for (; p < length; p++) if (arr[p] >= 0x80) return p + return length +} + +// Capable of decoding Uint16Array to UTF-16 as well as Uint8Array to Latin-1 +export function decodeLatin1(arr, start = 0, stop = arr.length) { + start |= 0 + stop |= 0 + const total = stop - start + if (total === 0) return '' + + if ( + useLatin1atob && + total >= 256 && + total < 1e8 && + arr.toBase64 === web64 && + arr.BYTES_PER_ELEMENT === 1 + ) { + const sliced = start === 0 && stop === arr.length ? arr : arr.subarray(start, stop) + return atob(sliced.toBase64()) + } + + if (total > maxFunctionArgs) { + let prefix = '' + for (let i = start; i < stop; ) { + const i1 = Math.min(stop, i + maxFunctionArgs) + prefix += String.fromCharCode.apply(String, arr.subarray(i, i1)) + i = i1 + } + + return prefix + } + + const sliced = start === 0 && stop === arr.length ? arr : arr.subarray(start, stop) + return String.fromCharCode.apply(String, sliced) +} + +// Unchecked for well-formedness, raw. Expects Uint16Array input +export const decodeUCS2 = + nativeBuffer && isLE && !isDeno + ? (u16, stop = u16.length) => { + // TODO: fast path for BE, perhaps faster path for Deno. Note that decoder replaces, this function doesn't + if (stop > 32) return nativeBuffer.from(u16.buffer, u16.byteOffset, stop * 2).ucs2Slice() // from 64 bytes, below are in heap + return decodeLatin1(u16, 0, stop) + } + : (u16, stop = u16.length) => decodeLatin1(u16, 0, stop) + +// Does not check input, uses best available method +// Building an array for this is only faster than proper string concatenation when TextDecoder or native Buffer are available +export const decodeAscii = nativeBuffer + ? (a) => + // Buffer is faster on Node.js (but only for long enough data), if we know that output is ascii + a.byteLength >= 0x3_00 && !isDeno + ? nativeBuffer.from(a.buffer, a.byteOffset, a.byteLength).latin1Slice(0, a.byteLength) // .latin1Slice is faster than .asciiSlice + : nativeDecoder.decode(a) // On Node.js, utf8 decoder is faster than latin1 + : nativeDecoderLatin1 + ? (a) => nativeDecoderLatin1.decode(a) // On browsers (specifically WebKit), latin1 decoder is faster than utf8 + : (a) => + decodeLatin1( + a instanceof Uint8Array ? a : new Uint8Array(a.buffer, a.byteOffset, a.byteLength) + ) + +/* eslint-disable @exodus/mutable/no-param-reassign-prop-only */ + +export function encodeAsciiPrefix(x, s) { + let i = 0 + for (const len3 = s.length - 3; i < len3; i += 4) { + const x0 = s.charCodeAt(i), x1 = s.charCodeAt(i + 1), x2 = s.charCodeAt(i + 2), x3 = s.charCodeAt(i + 3) // prettier-ignore + if ((x0 | x1 | x2 | x3) >= 128) break + x[i] = x0 + x[i + 1] = x1 + x[i + 2] = x2 + x[i + 3] = x3 + } + + return i +} + +/* eslint-enable @exodus/mutable/no-param-reassign-prop-only */ + +// Warning: can be used only on checked strings, converts strings to 8-bit +export const encodeLatin1 = (str) => encodeCharcodes(str, new Uint8Array(str.length)) + +// Expects nativeEncoder to be present +const useEncodeInto = /* @__PURE__ */ (() => isHermes && nativeEncoder?.encodeInto)() +export const encodeAscii = useEncodeInto + ? (str, ERR) => { + // Much faster in Hermes + const codes = new Uint8Array(str.length + 4) // overshoot by a full utf8 char + const info = nativeEncoder.encodeInto(str, codes) + if (info.read !== str.length || info.written !== str.length) throw new SyntaxError(ERR) // non-ascii + return codes.subarray(0, str.length) + } + : nativeBuffer + ? (str, ERR) => { + // TextEncoder is slow on Node.js 24 / 25 (was ok on 22) + // Node.js Buffer.from always returns 8-byte aligned allocations, this is safe for e.g. conversion to Uint32Array + const codes = nativeBuffer.from(str, 'utf8') // ascii/latin1 coerces, we need to check + if (codes.length !== str.length) throw new SyntaxError(ERR) // non-ascii + return new Uint8Array(codes.buffer, codes.byteOffset, codes.byteLength) + } + : (str, ERR) => { + const codes = nativeEncoder.encode(str) + if (codes.length !== str.length) throw new SyntaxError(ERR) // non-ascii + return codes + } diff --git a/node_modules/@exodus/bytes/fallback/multi-byte.encodings.cjs b/node_modules/@exodus/bytes/fallback/multi-byte.encodings.cjs new file mode 100644 index 0000000000000000000000000000000000000000..114710bac5011fccabd7151cf73ed9595cd7bd96 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/multi-byte.encodings.cjs @@ -0,0 +1 @@ +module.exports = () => require('./multi-byte.encodings.json') // lazy-load diff --git a/node_modules/@exodus/bytes/fallback/multi-byte.encodings.json b/node_modules/@exodus/bytes/fallback/multi-byte.encodings.json new file mode 100644 index 0000000000000000000000000000000000000000..bb2d7e9d1484976814161379007ecc6542d74028 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/multi-byte.encodings.json @@ -0,0 +1,546 @@ +{ + "$C": [6,1040,1,-21,26,20], + "$c": [6,1072,1,27,26,-28], + "$1": [17,913,7,1], + "$2": [17,945,7,1], + "$3": ["AAEJAwf7Bw_3DwfEAQsDB_sLD_cPD9QO-A4H3RL0EgklAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"], + "$4": [1,9490,1,-2,1,8,1,-2,1,-4,1,-2,1,-8,1,-2,2,16,2,1,2,3,2,1,2,2,2,2,2,2,2,2,2,2,2,1], + "$5": ["Bv7FA_74_tr-Ev4mAP8AAAAAAAAAAA"], + "$6": ["$5",1,9661,1,-2], + "$7": [2,12541,2,-98,1,-156,1,7897,3,-7897,1,244], + "$8": ["E9UxzELB4htgpd4feI7ZJNwBAQEfAf8B_wH_Af8B_wH_Af8B_wEAAAD_"], + "$9": [1,26142,4,2,1,1,4,2,1,1,1,1], + "$j": [ + "ipErP1Ps8XWWMAFJ4rgaAwI1HDv3D_k4cuHcHicp0VFf43EZOCAtKIYJGRokBhxNIB4qMI3tHlWG0gtGG_5HAI0TWEcHAQVAFZtpbqgTMYcTOjErvTAqSgAWUBIyTyZ-JwRT9krRHiX4Z3qSTmo8MH-xFCXNJO8FQPEBuGAlBhEMOhMaPFSWbUBCikNUq4NJTTraLApjAfFoHCnoaimC5yYVIij5CTwiyhSCyCw_DwEgXCVj9FfpAM2rPLIMZfFgRQsMDO407TAD_gQzJhVhbRIZAfwKcC5ocSwVFbV-Cwr_8ssh9gIq1PnvAAABAAAAAAAAAAABAP8BAAAAAAAAAQAAAAABAAAAAAEAAAAAAACnWgAAAAECAAAAAKMAXgABAAAAAAAAAgAa5gABAAAAAQCdYwAAAAACAAAAAAEAAAAAAf8BAAAAAQABAQAAAQEAAAAAAAAAAACUbAAAAAAAAZJuAAH_AQAAkm-RbwABAAAAAAAAAQEAAAAAAQAAAAAAAAAAAQAAAAABAAABAAAAAAEAAAAAiXcAAQABh3kAAAAAAAH_AQAAAAAAAAEAAQAAAACEfdsmAAAAAQ", + 3,32999, + "lIZ_NRU0zrJ-KhNa6DV79Fl84mAcRy5Ra54FEbOQbwDl7RwkQS0WIELTXCtwAx1jrKtUAEF2R-4RsvwGDgD1ACAJ-S8F-xEK9-ctP88Abu8B9latCvJR-9ks9eAd5G3mTCEXGTgTAklJTHMRgwcHCQEBAwENxAD7BHGvigKY_BwhCURv-sHrt3mBfwEAgIABf4MAAAAAAQEAe4kAAAAAAQABAAB1i3UAjgACAAAAAABwkAEAAQABAG2UbACWAGqXAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAABomAAAAQD_aJn_AQAAAAAAAAABAAABZAGcAAEAAAAAAAABAGIAn2GfAQAAAQAAAAABAQBdpAA" + ], + "jis0208": [ + 3,12288,"DAHsHgAD4ZkAF4tnlaRb_wAxzwAAADEA0P8B_wAA","$7","Ffr-LCHGNsn-8gACAOoACgAlAR0BIADfAAAj3SEAAAAAAN8AMQDPAAAA",10,-53078, + "CwGjJR8lQrsBRwC2FQ39b4EAz-Ee2wAj_QIDFYb_AAEAAP8j3QAjAAAABADaIAAB3gAAAAAAAAAAAQ","$6","O9Z__QABfyAQ8QAAAA8",0,11,1,-3596,-2,2,122,2,-6,1,-90,1,-2,0,8,2,-3,"4u8BKwL_IgABAA",0,11, + "IIRs7wRZ8BcAriLfF_UAIgAB_wAAAAAAAAAAAAAA",0,7,"KwQ-_fy1AJQh_wYAAPoA4A",0,4,1,9528,0,15,10,55584,0,7,26,7,0,6,26,6,0,4,83,-53018,0,11,86,13,0,8,"$1",0,8,"$2",0,38,"$C",0,15,"$c",0,13,"$3",0,438, + 20,-3223,10,-788,0,1,"ScoNKsoO2zIaBbUY_Ace8DMAAAAAAAAAAAAAAAAAAAA",3,96,2,-17,1,52,1,-36,0,8,"e6EB9rZTM_0A8RLu",5,4482,2,-120,"OUT-_tUOyQLiCIp6_p918wAyAQAA7wAAAAAAAAAAAAAAAA",0,190, + "nHnsO4BaDM0rUqYzWTZDx3g_Tp2Tec8pNKp4bVvPh4gX0StTjbB-xcGVJEJPq6hEnCwH1S9gov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wEOdikAAAAAAAAA",3,-5,2,4,"bP0M-gMeBgOOl5EKd7yfAAAAAAAAALkRJ-TdIA",0,464,"$j",0,2,10,-20522,"4gEi-v8AAAA",0,2068,10,-56723, + 10,-26,"4gEi-i7kChP_AAAAM-8AAQ","$j" + ], + "jis0212": [ + 0,108,"2O7wIAPRK_6DJQACAP4CAP4CAP0EAA",0,8,1,-741,1,4,1,24,0,38,"uu_-BHOBcQAAAAAh3yE",0,359,1,-7569,3,1,1,31,0,1,1,-31,0,1,-1,1,28,0,1,1,-29,0,4,4,28,"ysU79Qr95B0DAAAAAAAAAA",0,35,11,51,2,1,0,35, + 11,66,2,1,0,94,1,-922,1,73,0,1,1,21,0,1,1,11,0,1,1,14,1,-3,0,1,"So15Af8B",0,1,1,19,1,-137,0,16,"5ireNgkBBAn9CAGsWouHlgAB_wEAAAAAAAAA_wH_Af8",0,46, + "wf4D_T_KMgPA_UIBA7pCA7r-Av5P-_sFAAAAAAEAAAD_AAEAAP8BAP8AAAABAAAA",0,1, + "HAED_QOo_gL-AGD5A_kLAQID_QcD_YsB_gP9_H77iH4D_QMBA_0F_Xf-Av6QZpz5B_v5bgP9-55omv0CA_0BAAAAAP8AAAABAAAAAAAAAAAAAAAA_wAAAAABAAD_AQAAAAAAAAAA_wAAAAEAAAAAAAAAAAAAAP8BAAAAAA",0,7, + "4f4D_SDKMgPf_SMBA9kjA9n-Av4w-_sF2ycBAAAAAAEAAAD_AAEAAP8BAP8AAAABAAAAAAAA",0,1,-1,-3,1,-57,1,-2,-2,1,-2,1,225,0,1, + "KwP5CwECA_0HA_2qAf4D_d1--6dfA_0DAQP9Bf2W_gL-cWac-Qf7-W4D_fuehwF3AgP9AQAAAAAAAAAAAAD_AAAAAAEAAP8BAAAAAAAAAAD_AAAAAQAAAAAAAAAAAAAA_wABAAAA",0,383,1,19589,2,1,1,6,1,5,1,12,2,3,-3,-2,3,2,1,4,2,10,-2, + -2,1,9,1,8,-1,1,6,2,4,2,10,-3,1,5,1,13,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,0,6,17,0,2,2,2,1,-2,5,1,-2,-1,2,2,-2,59,13605,1,170,33,-170,1,133,2,-13830,-1,-1,2,1,4,1,-2,6,3,2,2,3,1,4,1,0,6,3,0,-2,6,3,3,1,13,1,0,6,3,0,29,1, + 94,-39190,5,39096,2,2,3,1,7,1,-2,6,3,2,1,0,6,18,0,6,1,2,1,0,6,17,0,15,1,10,-43320,0,5,10,-26,0,7,"$1",0,8,"$2",0,6,20,43326,2,2,3,1,-1,0,6,6,0,-2,-1,-1,4,1,6,2,7,1,0,6,4,0,7,1,19,1,2,1,"$3","$4", + 8,-42440,0,26,5,42432,3,1,3,1,7,1,8,2,0,6,23,0,3,1,0,6,3,0,2,2,3,1,7,1,3,2,6,1,8,1,3,-38872,"E4QrIRIA",4,-34,10,-14,1,39,3,-62,1,63,2,-72,1,62,2,-34,10,7,5,-58,6,53,5,-48,1,-4719,2,4761,3,-56, + 1,73,1,-18,3,-25,1,43,4,-51,"3fIC7wUS6TMAAAAAAAA",0,15,11,38822,15,2,0,6,19,0,7,1,0,6,20,0,12,1,"xgnZewAAAAE",0,1,1,11,0,1,"PwGWeWcjh-MBAP8B_wABAA",0,1,28,12565,26,-3500,15,-138,"vZUAZwEAIQDfAA", + 4,8348,15,43622,11,1,0,6,4,0,2,1,-1,19,1,0,6,15,0,2,2,3,1,7,1,3,2,2,2,"5ireNgkBBAcBtVqLHmjj_QAB_wEAAAAAAP8B_wABAAA",28,12470,26,-3456,15,-66,1,-9162,2,-8,1,8128,1,10,4,1,2,43936,2,3,-1,-1,7,1,-2, + 5,4,2,2,3,1,2,1,0,6,5,0,-2,6,3,3,1,-1,-1,7,1,2,1,0,6,2,0,30,1,83,-40019,0,11,4,39936,2,2,3,1,7,1,-2,6,3,2,2,-1,0,6,2,0,7,1,-2,-1,6,1,3,1,6,1,0,6,9,0,7,1,3,1,13,1,86,-40029,0,8,3,39943,6,1,2,2,3,1, + 7,1,-2,-1,3,1,0,6,3,0,3,1,3,1,12,1,5,1,0,6,29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EGwAIDMICAAEECwEIAgrcIBIJB9IDBRsEC2BtBSE", + 0,96,"PMrjQSB3NO5adAo4dhnjwXJSS_8Ya1HpT_L_O5e4nCMr3j_e4JTFfsxtMcaGl3e_wMw6PnylTDvr1ADfqhvkvlpLAKdLMcl50lEMZwlbi9K-ARcySzDLfeKMTbNWC5teWgQCCgYKBQIAAggFBAMFvQUeBggPZ3HnAQAQBgEtugIADwQDAQsHBwEGAgQKYFULCwIECgUACQYAAXCavAQNAgoRANEDJgnPAAIABAEBAAACAAACAQEAAQEDAwA", + 0,96,2,314,"Xmz4mtroWQRE0I0DVyDUBgFtUQUAMRpquc19Jl6LNvguqQK9brwAVSw3q5LkZXzZjtAAD8kmwS9nAQACAQEAAAEGAQAAAAEAAwABAAAAAgIAAgEAAAoBAQEGAAUBAQAABN_SBQ4GKcT8qABhB5hpAA",6,38414,1,-26737,5,26736,1,-28187,4,28186,"loY4xwDDPC4q3Mlt0BKuFGaTeIgAnWNqAPCmbgIFi3w",3,33771, + 0,96,"DRgASldNfXwAj84E",5,40719,"Q-k54KcfHUQAJS8qdluya-_ShES06E6rWAgOGXlgBQYV5gECAfgA96dgBgE",3,39197,1,-34010,6,34009,1,-24424,11,24423,"w4AAefI-VAAe4QD1b4oAiA7RmQCIeABj",8,40202,"6TtVlFow3RY",6,31809,"_VoA4qhZel8bgHkAYxDnG-sq", + 0,96,"OXyPZ2mujmAumTSXnwEuv-zGnyhfArs9mwH2bBnyGXkRSzZSeYNBQ5LEc78Auk2y8VUJpJZBlV_cNPqk5bjlo4ROrqzRRpAs0VCpMfte7S_lHiG2UZWUGuspVHeNK04AAQYCAQcGAAUBAwkDAgEJAgkC0QsEAhvFAgoDAgcBAQAGCwEEBAEBCNkJBhMCxQMABgQCBA0HCxewCQACAwACAQMCDw4HBAoIvQQB8AIABQEABAAAAQEBAQMAAQQ", + 0,96,"-cgVSLIPGd2cN4nIpEMFVLoQPqlPKGX1M1FJxfpbJLbkKB2elsDNkaqQuFkTW84gBza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EN4QAA6QwNEgPOAQQBAAMCAwMAAQQACwAAAQcBBQs" + ], + "iso-2022-jp-katakana":[12290,9,0,-13,249,-10,-82,1,1,1,1,57,1,1,-37,56,-91,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,0,0,0,0,0,2,2,2,2,2,0,0,0,0,1,1,1,0,0,0,0,0,1,3,-89,0], + "gb18030-ranges": [0,128,36,37,2,4,7,9,5,6,31,32,8,10,6,9,1,3,4,6,3,4,1,3,1,2,4,5,17,18,7,8,15,16,24,25,3,4,4,5,29,30,98,99,1,2,1,2,1,2,1,2,1,2,1,2,1,2,28,29,87,88,15,16,101,102,1,4,13,14,183,200,1,8,7,24,1,8,55,56,14,78,1,2,7102,7103,2,6,1,3,2,4,7,9,9,10,1,3,1,2,5,6,112,113,86,87,1,2,3,4,12,13,10,11,62,74,4,14,22,26,2,6,110,111,6,7,1,2,3,4,4,5,2,6,2,3,1,2,1,6,2,3,5,9,5,6,10,11,3,4,5,6,13,15,2,6,6,8,37,38,3,4,11,12,25,26,82,83,333,343,10,50,100,176,4,40,13,28,3,6,10,12,16,18,8,10,8,10,3,4,2,4,18,22,31,33,2,3,54,55,1,2,2110,2111,2,3,3,4,2,4,10,11,15,16,2,3,3,4,4,5,2,4,3,4,14,15,293,305,4,8,1,20,5,7,2,11,20,21,2,85,7,11,2,88,5,8,6,43,246,256,7,8,113,114,234,236,12,15,2,3,34,35,9,10,2,4,2,3,113,114,43,44,298,299,111,112,11,12,765,766,85,86,96,98,14,15,147,148,218,219,287,288,113,114,885,886,264,265,471,472,116,117,4,5,43,44,248,249,373,374,20,21,193,194,5,6,82,83,16,17,441,442,50,51,2,3,4,6,1,3,20,21,3,4,22,24,703,704,39,44,111,118,148,149,81,20983,14426,18374,1,92,1,31,13,46,1,4,5,6,7,8,4,6,4,6,8,9,7,8,16,18,14,15,4295,4296,76,77,27,28,81,82,9,10,26,30,1,2,1,3,3,4,6,9,1,3,2,5,1030,1032,1,19,4,14,1,5,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6P0a_t4u4op_-vGGkQIy6vv030INAPQAuBb-Df1vgQDPAJ87AE52bgAAACIAAAAAAAAAAAAAAAAB_wAAAAAAAAAAAAAAAAAAAAQA2iAAAd4B_wAh4CE","$5",1,-220,1,342,2,-3,-1,1,3711,96,46354,10,-50198,6,50668,20,-49892, + 20,-40,10,-40,"rMAgxw",10,-46414,2,46404,12,-50704,2,50692,95,-492,1,-46565,3,52992,1,225,89,-225,1,133,96,-6654,83,-46597,11,46814,96,-311,86,-46597,8,46726,96,-223,"$1",8,127,"$2",1,5763,-1, + 1,-2,4,1,2,30,2,2,2,4,2,-4,4,2,2,-46,2,34,2,-6,1,-8,1,-25,2,25,9,-5790,96,-154,"$C",15,58,"$c",13,0,2,-58610,"2TkBDw_PAwIeAAAAAQA",4,140,1,123,1,9,-3,1,46,2,19,1,87,36,656,15,13,3,3,2,38,4,36, + 1,35,1,-885,1,3452,2,10,11,47005,"Ad_sEQH_Af8","$8","6mbtBAOwZwACHOMAAAE",4,58727,37,-46792,21,46755,9,-47041,1,633,2,234,3,12,"oSIJAgACWrEB_T4PsSwzAAAAAADLAQDoOhG1OQ",3,51155,1,-46827,2,-98,2,96, + 1,-249,2,150,10,52650,4,1,14,1,4,1,1,-52782,12,-79,1,11,13,47084,76,-49921,15,49845,2,-30004,-1,6,2,2,2,2,9,-2,4,3,-1,6,1,3,1,4,1,-1,3,3,2,4,2,2,3,1,1,4,2,1,2,1,2,1,4,3,13,2,2,1,-1,4,1,8,1,11,1, + -2,2,1,94,27790,12,-27884,5,1,2,1,-1,-1,2,1,2,1,4,1,4,1,3,1,2,1,6,1,-1,2,1,-3,3,2,2,1,4,2,-1,5,1,2,3,-1,7,3,4,1,-1,4,1,-1,-1,3,1,4,1,5,1,94,27750,11,-27844,-1,2,2,4,2,9,2,6,2,2,1,-2,-1,-1,-1,-1, + 2,1,5,4,4,1,19,1,-1,-1,1,4,13,2,2,1,5,1,3,2,94,27713,3,-27807,-1,-2,3,1,3,1,2,1,-1,11,1,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,-1,-1,5,2,11,1,45,2,2,2,12,10,3,3,5,2, + "LEwbUQn5AAAAAA",94,-5608,4,5540,-1,2,1,-3,3,6,2,1,3,2,1,-52137,3,47508, + "hO7TQAIo6XvzfQrWqZwZD5Nc5QCWH3HGiYbxqwhOiHsCAIN1-g4h-IrqbGkFUhA8fDICBAABABj7G_4Dmk0uBgD6AHGWAQD4AAsAZpoAAf9mAJwBAPK6t48SAe0V6wAAulsA6xUBAgBZqAAAAOcbAAAAAAAAAAAAAFZJZA",3,-5,1,-43,1,42,7,112, + "rgxNUg",94,17580 + ], + "big5": [ + 0,942,"8EHQotHjCg87q1EwfGXPoA0C-A9ujclE9Qgv0HWEEOj9iqrZDJqc_LjIATD98RzrtkgR661DCfr_AJMGb_iTBHCMBF8MAAUAjAb6BvoH-Qb6BHCMB2j-B4wEcf38kgeTZgb6BvoG-geH8A",0,1, + "lYdEVjo_KZDraxZFgEFIIOVEcSTS3hs719EL-VC5yMpphxYGmrgQAKo-nVdHwRGreRGYAOKCs823YS3Ic654vKki9p_dkmEMAOt7HOQbQIlZ6wYpHqws-NVBFJpyC4B3h39_gvw6SG34FRaJk8GsXH3cfwdeWkEHfH0FfdyiBnwBAQseUwWXAMSgBfsG-gRimgReQCU5BfsF-wX7BvoGZUEb9bU90j_75wHsBB7sB-wT2D6kP2UFlyu48gvtlwZ6Il4HrLuSBmOXBZ5dBMM5BPwE_ATD5lMFY1-llAWFDi8", + 0,31,5,-28172,"QMu4epBujPgAeIp7oN93idgFVKcE_ARVAKcE_AdSpwQ",4,-118530,"QM2-ADHAC_JRtlCtg4b9ANgFVADQ_wH_Af8B_wH_Af8",0,1,1,7659,0,1,"wAk23-wRcB7iAf8B_wI","$8",0,1,1,7277,0,1,-1,1,-7640,1,374, + 2,8568,0,84,1,163789,1,-37477,0,1,"CmU",0,2,"PZ9wkE4gL_Q",0,2, + "XddbiA1_rR0nR7wGkhKCBgkNEwIqATE3APrrtE10BWDobXhuBw0MBw8mMEJUn1b3I4MABq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Yd4h5Avxq4ACsAJAHZANsAIwDVACkAzQAxAMkANQDLADMAywAzAP8h3iLeJ9kAAQD_AAEA_wAyAM4AMgDOADIAzgAyAM4AMgDOADIAzgA",6,20,2,-56903,2,2,2,4095, + "NfzQAgMwa1vHA-P-Gzf-wf7a_hz-5mGpM1uNewACAPwAIADfAAAh4DD1AAAAAAEA_wAAAAAADe_f_wAD_AAAAAAA",3,18,"CwHJH7loAQH-SAD4vTMO_wABAAAi3QAAIwAAAAAA",5,56320, + "XsoAenr-nxL-WQIG_gsBUgP3AfwBAwAB_oz96yzYUpvgLM0AIxriBf8jAAAAAAARAO8AAAAEAPwA_wAAAAAAAAABAN0AI9wBADHPAAAAIgA",3,56671,1,-51863,3,-58,"ztLsADTrqAEC_gMBgwHkMwAAAADNUQAAAAAABB8I",8,-22350, + "j_7-_v7-_rL39_f3d2sBknYDAwNUAAH-4A0L9oAAAf4lAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",3,-116,10,55708,10,-56762,9,3767,1,8983,2,2,26,43995,26,6,"$1","$2",37,-52822,1,-11857,2,-17,1,-4,-3, + 32,8500,-1,1,-886,0,29,"AFinAT8ZKAUthCUFdB8AmXkrGmtAAfwBIAyoYwIW_i8SnsL2SIUZO8spEUvcAAGkFhIVOGsHTgAAAAAAAAAAAwAAAAEAAAEAAAD7AAAAAAAD_QAAAAAAAwEAAQAABAEBAAACAAAAAQAAAAEA",3,11, + "_nOLDAc5w_78HwIIEe1OCAP8AQ0e_gICAAX8APh-_SUFAP0qXl0BAAEAA-wAAAAAAAAO8gAAAAAAAAAAAAAAAAAAAwAAAAAAAAA",3,15, + "-wIAFiIO_v0YJUb-Ah48Af4CJrwSFTSEhoMUAK1ELRQC4FcPDBQrChcf90EWUQgGMyQ2vgsECxEBUN6N_P7-AyIRAf6W8lIAAAEAAAAAAAAAAAAFAQAAAAIBAAAAAQEAAQAAAwAAAAMAAAAAAAEBAAQAAAAAAAEABAIAAAAAAAAB2wAAA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-QSFdwf5BYTYnwX7BIQBBP51BYV2B4N2BoV1BV0q_3UH-QeFC2kGukAE_AeFADCmKtYrCmkG-gaHAABzBIlzBW4a25gEiQD6eQSKcgX7BYlyBfsFiXIGiHIFiQByBvoG-gX7BfsHmGEEvc5xB_kGXS5vB4gAAHEF-wSL3SQGJNZwB_kFi3AEjQFuBov_cAWMANT9ngZdLAJvBmQnANKdB6TNGW8G-gWNbgeL0SwDbgVfL20FgwsAbQePagb6B_kFWh2EB4xtBo0BbAT8BPwHjRbqbAVnlAX7BfsF-wX7BFoGnAW-PQX7BKPpcAX7BfsFkAABAWkF-wT8BqdTB3IbAhZUB49qBpZkB5r17H4Ek8g4aQaQagT8BGlO3ADOMmkFYDJpBZJpBPwF-wT8B_kH-QV0hwX7BfsF-wWTAAAAAAAAANH8NABnBpMA6RcA63wHkiJFBpNnBPwG-gaTZweRAiLe5zveIUUGlABmBYsKAMyaBIwHAwEAZQT8BGyQBJcAAABlBPwGlQFkBfsG-gaI0KIF-wX7BZYB9W8GlmQFYTZkBJhkBpb_AQ_xwz0f1wrVjwb6BfsG-gd8fQT8BJhkBZj_AWMG-gZ9fQa14gAAAGMHYJkFmP8BAAEAAAAAAGIHlwu2oQX7BZkAAABiB6VUBPwF-waZAADtdAaZYQaZYQX7BfsGmQFgB_kGihAAAB7jXwWbAf9gBrH5UAf5BPwGmxDgEF8EnV8HmgD1agVhO18FnA" + ] +} diff --git a/node_modules/@exodus/bytes/fallback/multi-byte.js b/node_modules/@exodus/bytes/fallback/multi-byte.js new file mode 100644 index 0000000000000000000000000000000000000000..d078cebba85233b2f65abb154fbdb3f13f088a30 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/multi-byte.js @@ -0,0 +1,962 @@ +import { E_STRING } from './_utils.js' +import { nativeEncoder } from './platform.js' +import { asciiPrefix, decodeAscii, decodeLatin1, decodeUCS2 } from './latin1.js' +import { getTable } from './multi-byte.table.js' + +export const E_STRICT = 'Input is not well-formed for this encoding' + +/* Decoders */ + +// If the decoder is not cleared properly, state can be preserved between non-streaming calls! +// See comment about fatal stream + +// All except iso-2022-jp are ASCII supersets +// When adding something that is not an ASCII superset, ajust the ASCII fast path +const mappers = { + // https://encoding.spec.whatwg.org/#euc-kr-decoder + 'euc-kr': (err) => { + const euc = getTable('euc-kr') + let lead = 0 + let oi = 0 + let o16 + + const decodeLead = (b) => { + if (b < 0x41 || b > 0xfe) { + lead = 0 + o16[oi++] = err() + if (b < 128) o16[oi++] = b + } else { + const p = euc[(lead - 0x81) * 190 + b - 0x41] + lead = 0 + if (p) { + o16[oi++] = p + } else { + o16[oi++] = err() + if (b < 128) o16[oi++] = b + } + } + } + + const decode = (arr, start, end, stream) => { + let i = start + o16 = new Uint16Array(end - start + (lead ? 1 : 0)) // there are pairs but they consume more than one byte + oi = 0 + + // Fast path + if (!lead) { + for (const last1 = end - 1; i < last1; ) { + const l = arr[i] + if (l < 128) { + o16[oi++] = l + i++ + } else { + if (l === 0x80 || l === 0xff) break + const b = arr[i + 1] + if (b < 0x41 || b === 0xff) break + const p = euc[(l - 0x81) * 190 + b - 0x41] + if (!p) break + o16[oi++] = p + i += 2 + } + } + } + + if (lead && i < end) decodeLead(arr[i++]) + while (i < end) { + const b = arr[i++] + if (b < 128) { + o16[oi++] = b + } else if (b === 0x80 || b === 0xff) { + o16[oi++] = err() + } else { + lead = b + if (i < end) decodeLead(arr[i++]) + } + } + + if (lead && !stream) { + lead = 0 + o16[oi++] = err() + } + + const res = decodeUCS2(o16, oi) + o16 = null + return res + } + + return { decode, isAscii: () => lead === 0 } + }, + // https://encoding.spec.whatwg.org/#euc-jp-decoder + 'euc-jp': (err) => { + const jis0208 = getTable('jis0208') + const jis0212 = getTable('jis0212') + let j12 = false + let lead = 0 + let oi = 0 + let o16 + + const decodeLead = (b) => { + if (lead === 0x8e && b >= 0xa1 && b <= 0xdf) { + lead = 0 + o16[oi++] = 0xfe_c0 + b + } else if (lead === 0x8f && b >= 0xa1 && b <= 0xfe) { + j12 = true + lead = b + } else { + let cp + if (lead >= 0xa1 && lead <= 0xfe && b >= 0xa1 && b <= 0xfe) { + cp = (j12 ? jis0212 : jis0208)[(lead - 0xa1) * 94 + b - 0xa1] + } + + lead = 0 + j12 = false + if (cp) { + o16[oi++] = cp + } else { + o16[oi++] = err() + if (b < 128) o16[oi++] = b + } + } + } + + const decode = (arr, start, end, stream) => { + let i = start + o16 = new Uint16Array(end - start + (lead ? 1 : 0)) + oi = 0 + + // Fast path, non-j12 + // lead = 0 means j12 = 0 + if (!lead) { + for (const last1 = end - 1; i < last1; ) { + const l = arr[i] + if (l < 128) { + o16[oi++] = l + i++ + } else { + const b = arr[i + 1] + if (l === 0x8e && b >= 0xa1 && b <= 0xdf) { + o16[oi++] = 0xfe_c0 + b + i += 2 + } else { + if (l < 0xa1 || l === 0xff || b < 0xa1 || b === 0xff) break + const cp = jis0208[(l - 0xa1) * 94 + b - 0xa1] + if (!cp) break + o16[oi++] = cp + i += 2 + } + } + } + } + + if (lead && i < end) decodeLead(arr[i++]) + if (lead && i < end) decodeLead(arr[i++]) // could be two leads, but no more + while (i < end) { + const b = arr[i++] + if (b < 128) { + o16[oi++] = b + } else if ((b < 0xa1 && b !== 0x8e && b !== 0x8f) || b === 0xff) { + o16[oi++] = err() + } else { + lead = b + if (i < end) decodeLead(arr[i++]) + if (lead && i < end) decodeLead(arr[i++]) // could be two leads + } + } + + if (lead && !stream) { + lead = 0 + j12 = false // can be true only when lead is non-zero + o16[oi++] = err() + } + + const res = decodeUCS2(o16, oi) + o16 = null + return res + } + + return { decode, isAscii: () => lead === 0 } // j12 can be true only when lead is non-zero + }, + // https://encoding.spec.whatwg.org/#iso-2022-jp-decoder + 'iso-2022-jp': (err) => { + const jis0208 = getTable('jis0208') + let dState = 1 + let oState = 1 + let lead = 0 // 0 or 0x21-0x7e + let out = false + + const bytes = (pushback, b) => { + if (dState < 5 && b === 0x1b) { + dState = 6 // escape start + return + } + + switch (dState) { + case 1: + case 2: + // ASCII, Roman (common) + out = false + if (dState === 2) { + if (b === 0x5c) return 0xa5 + if (b === 0x7e) return 0x20_3e + } + + if (b <= 0x7f && b !== 0x0e && b !== 0x0f) return b + return err() + case 3: + // Katakana + out = false + if (b >= 0x21 && b <= 0x5f) return 0xff_40 + b + return err() + case 4: + // Leading byte + out = false + if (b < 0x21 || b > 0x7e) return err() + lead = b + dState = 5 + return + case 5: + // Trailing byte + out = false + if (b === 0x1b) { + dState = 6 // escape start + return err() + } + + dState = 4 + if (b >= 0x21 && b <= 0x7e) { + const cp = jis0208[(lead - 0x21) * 94 + b - 0x21] + if (cp) return cp + } + + return err() + case 6: + // Escape start + if (b === 0x24 || b === 0x28) { + lead = b + dState = 7 + return + } + + out = false + dState = oState + pushback.push(b) + return err() + case 7: { + // Escape + const l = lead + lead = 0 + let s + if (l === 0x28) { + // eslint-disable-next-line unicorn/prefer-switch + if (b === 0x42) { + s = 1 + } else if (b === 0x4a) { + s = 2 + } else if (b === 0x49) { + s = 3 + } + } else if (l === 0x24 && (b === 0x40 || b === 0x42)) { + s = 4 + } + + if (s) { + dState = oState = s + const output = out + out = true + return output ? err() : undefined + } + + out = false + dState = oState + pushback.push(b, l) + return err() + } + } + } + + const eof = (pushback) => { + if (dState < 5) return null + out = false + switch (dState) { + case 5: + dState = 4 + return err() + case 6: + dState = oState + return err() + case 7: { + dState = oState + pushback.push(lead) + lead = 0 + return err() + } + } + } + + const decode = (arr, start, end, stream) => { + const o16 = new Uint16Array(end - start + 2) // err in eof + lead from state + let oi = 0 + let i = start + const pushback = [] // local and auto-cleared + + // First, dump everything until EOF + // Same as the full loop, but without EOF handling + while (i < end || pushback.length > 0) { + const c = bytes(pushback, pushback.length > 0 ? pushback.pop() : arr[i++]) + if (c !== undefined) o16[oi++] = c // 16-bit + } + + // Then, dump EOF. This needs the same loop as the characters can be pushed back + if (!stream) { + while (i <= end || pushback.length > 0) { + if (i < end || pushback.length > 0) { + const c = bytes(pushback, pushback.length > 0 ? pushback.pop() : arr[i++]) + if (c !== undefined) o16[oi++] = c // 16-bit + } else { + const c = eof(pushback) + if (c === null) break // clean exit + o16[oi++] = c + } + } + } + + // Chrome and WebKit fail on this, we don't: completely destroy the old decoder state when finished streaming + // > If thisโ€™s do not flush is false, then set thisโ€™s decoder to a new instance of thisโ€™s encodingโ€™s decoder, + // > Set thisโ€™s do not flush to options["stream"] + if (!stream) { + dState = oState = 1 + lead = 0 + out = false + } + + return decodeUCS2(o16, oi) + } + + return { decode, isAscii: () => false } + }, + // https://encoding.spec.whatwg.org/#shift_jis-decoder + shift_jis: (err) => { + const jis0208 = getTable('jis0208') + let lead = 0 + let oi = 0 + let o16 + + const decodeLead = (b) => { + const l = lead + lead = 0 + if (b >= 0x40 && b <= 0xfc && b !== 0x7f) { + const p = (l - (l < 0xa0 ? 0x81 : 0xc1)) * 188 + b - (b < 0x7f ? 0x40 : 0x41) + if (p >= 8836 && p <= 10_715) { + o16[oi++] = 0xe0_00 - 8836 + p + return + } + + const cp = jis0208[p] + if (cp) { + o16[oi++] = cp + return + } + } + + o16[oi++] = err() + if (b < 128) o16[oi++] = b + } + + const decode = (arr, start, end, stream) => { + o16 = new Uint16Array(end - start + (lead ? 1 : 0)) + oi = 0 + let i = start + + // Fast path + if (!lead) { + for (const last1 = end - 1; i < last1; ) { + const l = arr[i] + if (l <= 0x80) { + o16[oi++] = l + i++ + } else if (l >= 0xa1 && l <= 0xdf) { + o16[oi++] = 0xfe_c0 + l + i++ + } else { + if (l === 0xa0 || l > 0xfc) break + const b = arr[i + 1] + if (b < 0x40 || b > 0xfc || b === 0x7f) break + const p = (l - (l < 0xa0 ? 0x81 : 0xc1)) * 188 + b - (b < 0x7f ? 0x40 : 0x41) + if (p >= 8836 && p <= 10_715) { + o16[oi++] = 0xe0_00 - 8836 + p + i += 2 + } else { + const cp = jis0208[p] + if (!cp) break + o16[oi++] = cp + i += 2 + } + } + } + } + + if (lead && i < end) decodeLead(arr[i++]) + while (i < end) { + const b = arr[i++] + if (b <= 0x80) { + o16[oi++] = b // 0x80 is allowed + } else if (b >= 0xa1 && b <= 0xdf) { + o16[oi++] = 0xfe_c0 + b + } else if (b === 0xa0 || b > 0xfc) { + o16[oi++] = err() + } else { + lead = b + if (i < end) decodeLead(arr[i++]) + } + } + + if (lead && !stream) { + lead = 0 + o16[oi++] = err() + } + + const res = decodeUCS2(o16, oi) + o16 = null + return res + } + + return { decode, isAscii: () => lead === 0 } + }, + // https://encoding.spec.whatwg.org/#gbk-decoder + gbk: (err) => mappers.gb18030(err), // 10.1.1. GBKโ€™s decoder is gb18030โ€™s decoder + // https://encoding.spec.whatwg.org/#gb18030-decoder + gb18030: (err) => { + const gb18030 = getTable('gb18030') + const gb18030r = getTable('gb18030-ranges') + let g1 = 0, g2 = 0, g3 = 0 // prettier-ignore + const index = (p) => { + if ((p > 39_419 && p < 189_000) || p > 1_237_575) return + if (p === 7457) return 0xe7_c7 + let a = 0, b = 0 // prettier-ignore + for (const [c, d] of gb18030r) { + if (c > p) break + a = c + b = d + } + + return b + p - a + } + + // g1 is 0 or 0x81-0xfe + // g2 is 0 or 0x30-0x39 + // g3 is 0 or 0x81-0xfe + + const decode = (arr, start, end, stream) => { + const o16 = new Uint16Array(end - start + (g1 ? 3 : 0)) // even with pushback it's at most 1 char per byte + let oi = 0 + let i = start + const pushback = [] // local and auto-cleared + + // Fast path for 2-byte only + // pushback is always empty ad start, and g1 = 0 means g2 = g3 = 0 + if (g1 === 0) { + for (const last1 = end - 1; i < last1; ) { + const b = arr[i] + if (b < 128) { + o16[oi++] = b + i++ + } else if (b === 0x80) { + o16[oi++] = 0x20_ac + i++ + } else { + if (b === 0xff) break + const n = arr[i + 1] + let cp + if (n < 0x7f) { + if (n < 0x40) break + cp = gb18030[(b - 0x81) * 190 + n - 0x40] + } else { + if (n === 0xff || n === 0x7f) break + cp = gb18030[(b - 0x81) * 190 + n - 0x41] + } + + if (!cp) break + o16[oi++] = cp // 16-bit + i += 2 + } + } + } + + // First, dump everything until EOF + // Same as the full loop, but without EOF handling + while (i < end || pushback.length > 0) { + const b = pushback.length > 0 ? pushback.pop() : arr[i++] + if (g1) { + // g2 can be set only when g1 is set, g3 can be set only when g2 is set + // hence, 3 checks for g3 is faster than 3 checks for g1 + if (g2) { + if (g3) { + if (b <= 0x39 && b >= 0x30) { + const p = index( + (g1 - 0x81) * 12_600 + (g2 - 0x30) * 1260 + (g3 - 0x81) * 10 + b - 0x30 + ) + g1 = g2 = g3 = 0 + if (p === undefined) { + o16[oi++] = err() + } else if (p <= 0xff_ff) { + o16[oi++] = p // Can validly return replacement + } else { + const d = p - 0x1_00_00 + o16[oi++] = 0xd8_00 | (d >> 10) + o16[oi++] = 0xdc_00 | (d & 0x3_ff) + } + } else { + pushback.push(b, g3, g2) + g1 = g2 = g3 = 0 + o16[oi++] = err() + } + } else if (b >= 0x81 && b <= 0xfe) { + g3 = b + } else { + pushback.push(b, g2) + g1 = g2 = 0 + o16[oi++] = err() + } + } else if (b <= 0x39 && b >= 0x30) { + g2 = b + } else { + let cp + if (b >= 0x40 && b <= 0xfe && b !== 0x7f) { + cp = gb18030[(g1 - 0x81) * 190 + b - (b < 0x7f ? 0x40 : 0x41)] + } + + g1 = 0 + if (cp) { + o16[oi++] = cp // 16-bit + } else { + o16[oi++] = err() + if (b < 128) o16[oi++] = b // can be processed immediately + } + } + } else if (b < 128) { + o16[oi++] = b + } else if (b === 0x80) { + o16[oi++] = 0x20_ac + } else if (b === 0xff) { + o16[oi++] = err() + } else { + g1 = b + } + } + + // if g1 = 0 then g2 = g3 = 0 + if (g1 && !stream) { + g1 = g2 = g3 = 0 + o16[oi++] = err() + } + + return decodeUCS2(o16, oi) + } + + return { decode, isAscii: () => g1 === 0 } // if g1 = 0 then g2 = g3 = 0 + }, + // https://encoding.spec.whatwg.org/#big5 + big5: (err) => { + // The only decoder which returns multiple codepoints per byte, also has non-charcode codepoints + // We store that as strings + const big5 = getTable('big5') + let lead = 0 + let oi = 0 + let o16 + + const decodeLead = (b) => { + if (b < 0x40 || (b > 0x7e && b < 0xa1) || b === 0xff) { + lead = 0 + o16[oi++] = err() + if (b < 128) o16[oi++] = b + } else { + const p = big5[(lead - 0x81) * 157 + b - (b < 0x7f ? 0x40 : 0x62)] + lead = 0 + if (p > 0x1_00_00) { + o16[oi++] = p >> 16 + o16[oi++] = p & 0xff_ff + } else if (p) { + o16[oi++] = p + } else { + o16[oi++] = err() + if (b < 128) o16[oi++] = b + } + } + } + + // eslint-disable-next-line sonarjs/no-identical-functions + const decode = (arr, start, end, stream) => { + let i = start + o16 = new Uint16Array(end - start + (lead ? 1 : 0)) // there are pairs but they consume more than one byte + oi = 0 + + // Fast path + if (!lead) { + for (const last1 = end - 1; i < last1; ) { + const l = arr[i] + if (l < 128) { + o16[oi++] = l + i++ + } else { + if (l === 0x80 || l === 0xff) break + const b = arr[i + 1] + if (b < 0x40 || (b > 0x7e && b < 0xa1) || b === 0xff) break + const p = big5[(l - 0x81) * 157 + b - (b < 0x7f ? 0x40 : 0x62)] + if (p > 0x1_00_00) { + o16[oi++] = p >> 16 + o16[oi++] = p & 0xff_ff + } else { + if (!p) break + o16[oi++] = p + } + + i += 2 + } + } + } + + if (lead && i < end) decodeLead(arr[i++]) + while (i < end) { + const b = arr[i++] + if (b < 128) { + o16[oi++] = b + } else if (b === 0x80 || b === 0xff) { + o16[oi++] = err() + } else { + lead = b + if (i < end) decodeLead(arr[i++]) + } + } + + if (lead && !stream) { + lead = 0 + o16[oi++] = err() + } + + const res = decodeUCS2(o16, oi) + o16 = null + return res + } + + return { decode, isAscii: () => lead === 0 } + }, +} + +export const isAsciiSuperset = (enc) => enc !== 'iso-2022-jp' // all others are ASCII supersets and can use fast path + +export function multibyteDecoder(enc, loose = false) { + if (typeof loose !== 'boolean') throw new TypeError('loose option should be boolean') + if (!Object.hasOwn(mappers, enc)) throw new RangeError('Unsupported encoding') + + // Input is assumed to be typechecked already + let mapper + const asciiSuperset = isAsciiSuperset(enc) + let streaming // because onErr is cached in mapper + const onErr = loose + ? () => 0xff_fd + : () => { + // The correct way per spec seems to be not destoying the decoder state in stream mode, even when fatal + // Decoders big5, euc-jp, euc-kr, shift_jis, gb18030 / gbk - all clear state before throwing unless EOF, so not affected + // iso-2022-jp is the only tricky one one where this !stream check matters in non-stream mode + if (!streaming) mapper = null // destroy state, effectively the same as 'do not flush' = false, but early + throw new TypeError(E_STRICT) + } + + return (arr, stream = false) => { + let res = '' + if (asciiSuperset && (!mapper || mapper.isAscii?.())) { + const prefixLen = asciiPrefix(arr) + if (prefixLen === arr.length) return decodeAscii(arr) // ascii + res = decodeLatin1(arr, 0, prefixLen) // TODO: check if decodeAscii with subarray is faster for small prefixes too + } + + streaming = stream // affects onErr + if (!mapper) mapper = mappers[enc](onErr) + return res + mapper.decode(arr, res.length, arr.length, stream) + } +} + +/* Encoders */ + +const maps = new Map() +const e7 = [[148, 236], [149, 237], [150, 243]] // prettier-ignore +const e8 = [[30, 89], [38, 97], [43, 102], [44, 103], [50, 109], [67, 126], [84, 144], [100, 160]] // prettier-ignore +const preencoders = { + __proto__: null, + big5: (p) => ((((p / 157) | 0) + 0x81) << 8) | ((p % 157 < 0x3f ? 0x40 : 0x62) + (p % 157)), + shift_jis: (p) => { + const l = (p / 188) | 0 + const t = p % 188 + return ((l + (l < 0x1f ? 0x81 : 0xc1)) << 8) | ((t < 0x3f ? 0x40 : 0x41) + t) + }, + 'iso-2022-jp': (p) => ((((p / 94) | 0) + 0x21) << 8) | ((p % 94) + 0x21), + 'euc-jp': (p) => ((((p / 94) | 0) + 0xa1) << 8) | ((p % 94) + 0xa1), + 'euc-kr': (p) => ((((p / 190) | 0) + 0x81) << 8) | ((p % 190) + 0x41), + gb18030: (p) => ((((p / 190) | 0) + 0x81) << 8) | ((p % 190 < 0x3f ? 0x40 : 0x41) + (p % 190)), +} + +preencoders.gbk = preencoders.gb18030 + +// We accept that encoders use non-trivial amount of mem, for perf +// most are are 128 KiB mem, big5 is 380 KiB, lazy-loaded at first use +function getMap(id, size, ascii) { + const cached = maps.get(id) + if (cached) return cached + let tname = id + const sjis = id === 'shift_jis' + const iso2022jp = id === 'iso-2022-jp' + if (iso2022jp) tname = 'jis0208' + if (id === 'gbk') tname = 'gb18030' + if (id === 'euc-jp' || sjis) tname = 'jis0208' + const table = getTable(tname) + const map = new Uint16Array(size) + const enc = preencoders[id] || ((p) => p + 1) + for (let i = 0; i < table.length; i++) { + const c = table[i] + if (!c) continue + if (id === 'big5') { + if (i < 5024) continue // this also skips multi-codepoint strings + // In big5, all return first entries except for these + if ( + map[c] && + c !== 0x25_50 && + c !== 0x25_5e && + c !== 0x25_61 && + c !== 0x25_6a && + c !== 0x53_41 && + c !== 0x53_45 + ) { + continue + } + } else { + if (sjis && i >= 8272 && i <= 8835) continue + if (map[c]) continue + } + + if (c > 0xff_ff) { + // always a single codepoint here + const s = String.fromCharCode(c >> 16, c & 0xff_ff) + map[s.codePointAt(0)] = enc(i) + } else { + map[c] = enc(i) + } + } + + if (ascii) for (let i = 0; i < 0x80; i++) map[i] = i + if (sjis || id === 'euc-jp') { + if (sjis) map[0x80] = 0x80 + const d = sjis ? 0xfe_c0 : 0x70_c0 + for (let i = 0xff_61; i <= 0xff_9f; i++) map[i] = i - d + map[0x22_12] = map[0xff_0d] + map[0xa5] = 0x5c + map[0x20_3e] = 0x7e + } else if (tname === 'gb18030') { + if (id === 'gbk') map[0x20_ac] = 0x80 + for (let i = 0xe7_8d; i <= 0xe7_93; i++) map[i] = i - 0x40_b4 + for (const [a, b] of e7) map[0xe7_00 | a] = 0xa6_00 | b + for (const [a, b] of e8) map[0xe8_00 | a] = 0xfe_00 | b + } + + maps.set(id, map) + return map +} + +const NON_LATIN = /[^\x00-\xFF]/ // eslint-disable-line no-control-regex +let gb18030r, katakana + +export function multibyteEncoder(enc, onError) { + if (!Object.hasOwn(mappers, enc)) throw new RangeError('Unsupported encoding') + const size = enc === 'big5' ? 0x2_f8_a7 : 0x1_00_00 // for big5, max codepoint in table + 1 + const iso2022jp = enc === 'iso-2022-jp' + const gb18030 = enc === 'gb18030' + const ascii = isAsciiSuperset(enc) + const width = iso2022jp ? 5 : gb18030 ? 4 : 2 + const tailsize = iso2022jp ? 3 : 0 + const map = getMap(enc, size, ascii) + if (gb18030 && !gb18030r) gb18030r = getTable('gb18030-ranges') + if (iso2022jp && !katakana) katakana = getTable('iso-2022-jp-katakana') + return (str) => { + if (typeof str !== 'string') throw new TypeError(E_STRING) + if (ascii && nativeEncoder && !NON_LATIN.test(str)) { + const u8 = nativeEncoder.encode(str) + if (u8.length === str.length) return u8 + } + + const length = str.length + const u8 = new Uint8Array(length * width + tailsize) + let i = 0 + + if (ascii) { + while (i < length) { + const x = str.charCodeAt(i) + if (x >= 128) break + u8[i++] = x + } + } + + // eslint-disable-next-line unicorn/consistent-function-scoping + const err = (code) => { + if (onError) return onError(code, u8, i) + throw new TypeError(E_STRICT) + } + + if (!map || map.length < size) /* c8 ignore next */ throw new Error('Unreachable') // Important for perf + + if (iso2022jp) { + let state = 0 // 0 = ASCII, 1 = Roman, 2 = jis0208 + const restore = () => { + state = 0 + u8[i++] = 0x1b + u8[i++] = 0x28 + u8[i++] = 0x42 + } + + for (let j = 0; j < length; j++) { + let x = str.charCodeAt(j) + if (x >= 0xd8_00 && x < 0xe0_00) { + if (state === 2) restore() + if (x >= 0xdc_00 || j + 1 === length) { + i += err(x) // lone + } else { + const x1 = str.charCodeAt(j + 1) + if (x1 < 0xdc_00 || x1 >= 0xe0_00) { + i += err(x) // lone + } else { + j++ // consume x1 + i += err(0x1_00_00 + ((x1 & 0x3_ff) | ((x & 0x3_ff) << 10))) + } + } + } else if (x < 0x80) { + if (state === 2 || (state === 1 && (x === 0x5c || x === 0x7e))) restore() + if (x === 0xe || x === 0xf || x === 0x1b) { + i += err(0xff_fd) // 12.2.2. step 3: This returns U+FFFD rather than codePoint to prevent attacks + } else { + u8[i++] = x + } + } else if (x === 0xa5 || x === 0x20_3e) { + if (state !== 1) { + state = 1 + u8[i++] = 0x1b + u8[i++] = 0x28 + u8[i++] = 0x4a + } + + u8[i++] = x === 0xa5 ? 0x5c : 0x7e + } else { + if (x === 0x22_12) x = 0xff_0d + if (x >= 0xff_61 && x <= 0xff_9f) x = katakana[x - 0xff_61] + const e = map[x] + if (e) { + if (state !== 2) { + state = 2 + u8[i++] = 0x1b + u8[i++] = 0x24 + u8[i++] = 0x42 + } + + u8[i++] = e >> 8 + u8[i++] = e & 0xff + } else { + if (state === 2) restore() + i += err(x) + } + } + } + + if (state) restore() + } else if (gb18030) { + // Deduping this branch hurts other encoders perf + const encode = (cp) => { + let a = 0, b = 0 // prettier-ignore + for (const [c, d] of gb18030r) { + if (d > cp) break + a = c + b = d + } + + let rp = cp === 0xe7_c7 ? 7457 : a + cp - b + u8[i++] = 0x81 + ((rp / 12_600) | 0) + rp %= 12_600 + u8[i++] = 0x30 + ((rp / 1260) | 0) + rp %= 1260 + u8[i++] = 0x81 + ((rp / 10) | 0) + u8[i++] = 0x30 + (rp % 10) + } + + for (let j = i; j < length; j++) { + const x = str.charCodeAt(j) + if (x >= 0xd8_00 && x < 0xe0_00) { + if (x >= 0xdc_00 || j + 1 === length) { + i += err(x) // lone + } else { + const x1 = str.charCodeAt(j + 1) + if (x1 < 0xdc_00 || x1 >= 0xe0_00) { + i += err(x) // lone + } else { + j++ // consume x1 + encode(0x1_00_00 + ((x1 & 0x3_ff) | ((x & 0x3_ff) << 10))) + } + } + } else { + const e = map[x] + if (e & 0xff_00) { + u8[i++] = e >> 8 + u8[i++] = e & 0xff + } else if (e || x === 0) { + u8[i++] = e + } else if (x === 0xe5_e5) { + i += err(x) + } else { + encode(x) + } + } + } + } else { + const long = + enc === 'big5' + ? (x) => { + const e = map[x] + if (e & 0xff_00) { + u8[i++] = e >> 8 + u8[i++] = e & 0xff + } else if (e || x === 0) { + u8[i++] = e + } else { + i += err(x) + } + } + : (x) => { + i += err(x) + } + + for (let j = i; j < length; j++) { + const x = str.charCodeAt(j) + if (x >= 0xd8_00 && x < 0xe0_00) { + if (x >= 0xdc_00 || j + 1 === length) { + i += err(x) // lone + } else { + const x1 = str.charCodeAt(j + 1) + if (x1 < 0xdc_00 || x1 >= 0xe0_00) { + i += err(x) // lone + } else { + j++ // consume x1 + long(0x1_00_00 + ((x1 & 0x3_ff) | ((x & 0x3_ff) << 10))) + } + } + } else { + const e = map[x] + if (e & 0xff_00) { + u8[i++] = e >> 8 + u8[i++] = e & 0xff + } else if (e || x === 0) { + u8[i++] = e + } else { + i += err(x) + } + } + } + } + + return i === u8.length ? u8 : u8.slice(0, i) + } +} diff --git a/node_modules/@exodus/bytes/fallback/multi-byte.table.js b/node_modules/@exodus/bytes/fallback/multi-byte.table.js new file mode 100644 index 0000000000000000000000000000000000000000..c7dfeb2011533aa6c00153c8f9dda4e2205e7b66 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/multi-byte.table.js @@ -0,0 +1,118 @@ +import { fromBase64url } from '@exodus/bytes/base64.js' +import { utf16toString } from '@exodus/bytes/utf16.js' +import loadEncodings from './multi-byte.encodings.cjs' + +export const sizes = { + jis0208: 11_104, + jis0212: 7211, + 'euc-kr': 23_750, + gb18030: 23_940, + big5: 19_782, +} + +// This is huge. It's _much_ smaller than https://npmjs.com/text-encoding though +// Exactly as mapped by the index table +// 0,x - hole of x empty elements +// n,c - continious [c, ...] of length n +// $.. - references to common chunks +// -{x} - same as 1,{x} + +// See tests/multi-byte.test.js to verify that this data decodes exactly into the encoding spec tables + +let indices +const tables = new Map() +/* eslint-disable @exodus/mutable/no-param-reassign-prop-only */ + +function loadBase64(str) { + const x = fromBase64url(str) + const len = x.length + const len2 = len >> 1 + const y = new Uint8Array(len) + let a = -1, b = 0 // prettier-ignore + for (let i = 0, j = 0; i < len; i += 2, j++) { + a = (a + x[j] + 1) & 0xff + b = (b + x[len2 + j]) & 0xff + y[i] = a + y[i + 1] = b + } + + return y +} + +function unwrap(res, t, pos) { + let code = 0 + for (let i = 0; i < t.length; i++) { + let x = t[i] + if (typeof x === 'number') { + if (x === 0) { + pos += t[++i] + } else { + if (x < 0) { + code -= x + x = 1 + } else { + code += t[++i] + } + + for (let k = 0; k < x; k++, pos++, code++) { + if (code <= 0xff_ff) { + res[pos] = code + } else { + const c = String.fromCodePoint(code) + res[pos] = (c.charCodeAt(0) << 16) | c.charCodeAt(1) + } + } + } + } else if (x[0] === '$' && Object.hasOwn(indices, x)) { + pos = unwrap(res, indices[x], pos) // self-reference using shared chunks + } else { + let last + // splits by codepoints + for (const c of utf16toString(loadBase64(x), 'uint8-le')) { + last = c + res[pos++] = c.length === 1 ? c.charCodeAt(0) : (c.charCodeAt(0) << 16) | c.charCodeAt(1) + } + + code = last.codePointAt(0) + 1 + } + } + + return pos +} + +export function getTable(id) { + const cached = tables.get(id) + if (cached) return cached + + if (!indices) indices = loadEncodings() // lazy-load + if (!Object.hasOwn(indices, id)) throw new Error('Unknown encoding') + if (!indices[id]) throw new Error('Table already used (likely incorrect bundler dedupe)') + + let res + if (id.endsWith('-ranges')) { + res = [] + let a = 0, b = 0 // prettier-ignore + const idx = indices[id] + while (idx.length > 0) res.push([(a += idx.shift()), (b += idx.shift())]) // destroying, we remove it later anyway + } else if (id.endsWith('-katakana')) { + let a = -1 + res = new Uint16Array(indices[id].map((x) => (a += x + 1))) + } else if (id === 'big5') { + res = new Uint32Array(sizes[id]) // single or double charcodes + unwrap(res, indices[id], 0) + // Pointer code updates are embedded into the table + // These are skipped in encoder as encoder uses only pointers >= (0xA1 - 0x81) * 157 + res[1133] = 0xca_03_04 + res[1135] = 0xca_03_0c + res[1164] = 0xea_03_04 + res[1166] = 0xea_03_0c + } else { + if (!Object.hasOwn(sizes, id)) throw new Error('Unknown encoding') + res = new Uint16Array(sizes[id]) + unwrap(res, indices[id], 0) + } + + indices[id] = null // gc + tables.set(id, res) + return res +} diff --git a/node_modules/@exodus/bytes/fallback/percent.js b/node_modules/@exodus/bytes/fallback/percent.js new file mode 100644 index 0000000000000000000000000000000000000000..c024d90ac249b479bf5d4f3fda533121ce9f5ecf --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/percent.js @@ -0,0 +1,31 @@ +import { decodeAscii, encodeLatin1 } from './latin1.js' +import { decode2string } from './platform.js' + +const ERR = 'percentEncodeSet must be a string of unique increasing codepoints in range 0x20 - 0x7e' +const percentMap = new Map() +let hex, base + +export function percentEncoder(set, spaceAsPlus = false) { + if (typeof set !== 'string' || /[^\x20-\x7E]/.test(set)) throw new TypeError(ERR) + if (typeof spaceAsPlus !== 'boolean') throw new TypeError('spaceAsPlus must be boolean') + const id = set + +spaceAsPlus + const cached = percentMap.get(id) + if (cached) return cached + + const n = encodeLatin1(set).sort() // string checked above to be ascii + if (decodeAscii(n) !== set || new Set(n).size !== n.length) throw new TypeError(ERR) + + if (!base) { + hex = Array.from({ length: 256 }, (_, i) => `%${i.toString(16).padStart(2, '0').toUpperCase()}`) + base = hex.map((h, i) => (i < 0x20 || i > 0x7e ? h : String.fromCharCode(i))) + } + + const map = base.slice() // copy + for (const c of n) map[c] = hex[c] + if (spaceAsPlus) map[0x20] = '+' // overrides whatever percentEncodeSet thinks about it + + // Input is not typechecked, for internal use only + const percentEncode = (u8, start = 0, end = u8.length) => decode2string(u8, start, end, map) + percentMap.set(id, percentEncode) + return percentEncode +} diff --git a/node_modules/@exodus/bytes/fallback/platform.browser.js b/node_modules/@exodus/bytes/fallback/platform.browser.js new file mode 100644 index 0000000000000000000000000000000000000000..7131a731f2899af4e944111c03c65b43b25e2149 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/platform.browser.js @@ -0,0 +1,31 @@ +import { decodePartAddition as decodePart } from './platform.native.js' + +export { isLE, encodeCharcodesPure as encodeCharcodes } from './platform.native.js' + +export const nativeBuffer = null +export const isHermes = false +export const isDeno = false +export const nativeEncoder = /* @__PURE__ */ (() => new TextEncoder())() +export const nativeDecoder = /* @__PURE__ */ (() => new TextDecoder('utf-8', { ignoreBOM: true }))() +export const nativeDecoderLatin1 = /* @__PURE__ */ (() => + new TextDecoder('latin1', { ignoreBOM: true }))() + +export function decode2string(arr, start, end, m) { + if (end - start > 30_000) { + // Limit concatenation to avoid excessive GC + // Thresholds checked on Hermes for toHex + const concat = [] + for (let i = start; i < end; ) { + const step = i + 500 + const iNext = step > end ? end : step + concat.push(decodePart(arr, i, iNext, m)) + i = iNext + } + + const res = concat.join('') + concat.length = 0 + return res + } + + return decodePart(arr, start, end, m) +} diff --git a/node_modules/@exodus/bytes/fallback/platform.js b/node_modules/@exodus/bytes/fallback/platform.js new file mode 100644 index 0000000000000000000000000000000000000000..f4dbf7549d66d9fd742b4a0308201772396e6ba9 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/platform.js @@ -0,0 +1,2 @@ +// platform.native actually hosts Node.js / Deno detection too +export * from './platform.native.js' diff --git a/node_modules/@exodus/bytes/fallback/platform.native.js b/node_modules/@exodus/bytes/fallback/platform.native.js new file mode 100644 index 0000000000000000000000000000000000000000..4f3ae444937502489e3e04859ba7e9b9db240060 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/platform.native.js @@ -0,0 +1,122 @@ +const { Buffer } = globalThis +const haveNativeBuffer = Buffer && !Buffer.TYPED_ARRAY_SUPPORT +export const nativeBuffer = haveNativeBuffer ? Buffer : null +export const isHermes = /* @__PURE__ */ (() => !!globalThis.HermesInternal)() +export const isDeno = /* @__PURE__ */ (() => !!globalThis.Deno)() +export const isLE = /* @__PURE__ */ (() => new Uint8Array(Uint16Array.of(258).buffer)[0] === 2)() + +// We consider Node.js TextDecoder/TextEncoder native +// Still needed in platform.native.js as this is re-exported to platform.js +let isNative = (x) => x && (haveNativeBuffer || `${x}`.includes('[native code]')) +if (!haveNativeBuffer && isNative(() => {})) isNative = () => false // e.g. XS, we don't want false positives + +export const nativeEncoder = /* @__PURE__ */ (() => + isNative(globalThis.TextEncoder) ? new TextEncoder() : null)() +export const nativeDecoder = /* @__PURE__ */ (() => + isNative(globalThis.TextDecoder) ? new TextDecoder('utf-8', { ignoreBOM: true }) : null)() + +// Actually windows-1252, compatible with ascii and latin1 decoding +// Beware that on non-latin1, i.e. on windows-1252, this is broken in ~all Node.js versions released +// in 2025 due to a regression, so we call it Latin1 as it's usable only for that +export const nativeDecoderLatin1 = /* @__PURE__ */ (() => { + // Not all barebone engines with TextDecoder support something except utf-8, detect + if (nativeDecoder) { + try { + return new TextDecoder('latin1', { ignoreBOM: true }) + } catch {} + } + + return null +})() + +export function decodePartAddition(a, start, end, m) { + let o = '' + let i = start + for (const last3 = end - 3; i < last3; i += 4) { + const x0 = a[i] + const x1 = a[i + 1] + const x2 = a[i + 2] + const x3 = a[i + 3] + o += m[x0] + o += m[x1] + o += m[x2] + o += m[x3] + } + + while (i < end) o += m[a[i++]] + return o +} + +// Decoding with templates is faster on Hermes +export function decodePartTemplates(a, start, end, m) { + let o = '' + let i = start + for (const last15 = end - 15; i < last15; i += 16) { + const x0 = a[i] + const x1 = a[i + 1] + const x2 = a[i + 2] + const x3 = a[i + 3] + const x4 = a[i + 4] + const x5 = a[i + 5] + const x6 = a[i + 6] + const x7 = a[i + 7] + const x8 = a[i + 8] + const x9 = a[i + 9] + const x10 = a[i + 10] + const x11 = a[i + 11] + const x12 = a[i + 12] + const x13 = a[i + 13] + const x14 = a[i + 14] + const x15 = a[i + 15] + o += `${m[x0]}${m[x1]}${m[x2]}${m[x3]}${m[x4]}${m[x5]}${m[x6]}${m[x7]}${m[x8]}${m[x9]}${m[x10]}${m[x11]}${m[x12]}${m[x13]}${m[x14]}${m[x15]}` + } + + while (i < end) o += m[a[i++]] + return o +} + +const decodePart = isHermes ? decodePartTemplates : decodePartAddition +export function decode2string(arr, start, end, m) { + if (end - start > 30_000) { + // Limit concatenation to avoid excessive GC + // Thresholds checked on Hermes for toHex + const concat = [] + for (let i = start; i < end; ) { + const step = i + 500 + const iNext = step > end ? end : step + concat.push(decodePart(arr, i, iNext, m)) + i = iNext + } + + const res = concat.join('') + concat.length = 0 + return res + } + + return decodePart(arr, start, end, m) +} + +/* eslint-disable @exodus/mutable/no-param-reassign-prop-only */ + +function encodeCharcodesHermes(str, arr) { + const length = str.length + if (length > 64) { + const at = str.charCodeAt.bind(str) // faster on strings from ~64 chars on Hermes, but can be 10x slower on e.g. JSC + for (let i = 0; i < length; i++) arr[i] = at(i) + } else { + for (let i = 0; i < length; i++) arr[i] = str.charCodeAt(i) + } + + return arr +} + +export function encodeCharcodesPure(str, arr) { + const length = str.length + // Can be optimized with unrolling, but this is not used on non-Hermes atm + for (let i = 0; i < length; i++) arr[i] = str.charCodeAt(i) + return arr +} + +/* eslint-enable @exodus/mutable/no-param-reassign-prop-only */ + +export const encodeCharcodes = isHermes ? encodeCharcodesHermes : encodeCharcodesPure diff --git a/node_modules/@exodus/bytes/fallback/single-byte.encodings.js b/node_modules/@exodus/bytes/fallback/single-byte.encodings.js new file mode 100644 index 0000000000000000000000000000000000000000..edf38c576b72c856f032e0424b3bb753d434a105 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/single-byte.encodings.js @@ -0,0 +1,73 @@ +// See tests/encoding/fixtures/single-byte/dump.js for generator + +const r = 0xff_fd + +/* eslint-disable unicorn/numeric-separators-style, @exodus/export-default/named */ + +// Common ranges + +// prettier-ignore +const i2 = [189,148,0,0,63,0,116,64,0,68,0,78,0,78,0,0,63,64,114,117,0,0,123,0,0,128,149,0,149,0,0,132,0,117,0,0,32,0,85,33,0,37,0,47,0,47,0,0,32,33,83,86,0,0,92,0,0,97,118,0,118,0,0,101,474] +// prettier-ignore +const iB = [[58,3424],[4,r],[29,3424],[4,r]] +const i9 = [[47], 78, [12], 83, 128, [17], 47, [12], 52, 97] +const w1 = [8236, 0, 8088, 0, 8090, 8097, 8090, 8090, 0, 8103] +const w2 = [8236, 0, 8088, 271, 8090, 8097, 8090, 8090, 574, 8103] +// prettier-ignore +const w7 = [64,0,157,[4],39,68,109,62,67,0,0,82,75,68,0,175,75,86,105,92,108,144,114,115,0,120,[3],154,104,128,143,0,158,159,0,37,78,31,36,0,0,51,44,37,0,144,44,55,74,61,77,113,83,84,0,89,[3],123,73,97,112,0,127,128] +const w8 = [8071, 8071, 8073, 8073, 8077, 8061, 8061] +// prettier-ignore +const k8b = [-22,910,879,879,899,880,880,894,876,893,[8,879],894,[4,878],864,859,884,882,861,877,881,876,873,875,846,815,815,835,816,816,830,812,829,[8,815],830,[4,814],800,795,820,818,797,813,817,812,809,811] +// prettier-ignore +const k8a = [9344,9345,9354,9357,9360,9363,9366,9373,9380,9387,9394,9461,9464,9467,9470,[4,9473],8845,9484,8580,8580,8625,8652,8652,6,8838,20,21,25,88,[3,9392],942] + +// prettier-ignore +const maps = { + ibm866: [[48,912],[3,9441],...[29,62,122,122,109,107,120,101,106,111,109,107,31,34,65,56,39,10,69,102,102,96,89,109,105,98,81,108,102,102,97,97,84,82,75,75,98,96,13,0,123,118,125,128,111].map(x=>x+9266),[16,864],785,864,786,865,787,866,792,871,-72,8480,-67,8479,8218,-89,9378,-95], + 'koi8-u': [...k8a,944,9391,944,944,[5,9391],996,944,[4,9391],846,848,9390,848,848,[5,9390],979,848,...k8b], + 'koi8-r': [...k8a,[15,9391],846,[11,9390],...k8b], + macintosh: [68,68,69,70,77,81,86,90,88,89,90,88,89,90,91,89,90,90,91,89,90,90,91,92,90,91,92,90,94,92,93,93,8064,15,0,0,3,8061,16,56,6,0,8312,9,-4,8627,24,41,8558,0,8626,8626,-15,0,8524,8538,8535,775,8561,-17,-2,748,40,57,-1,-32,-22,8535,206,8579,8512,-28,-13,8029,-42,-11,-9,8,132,132,8003,8003,8010,8010,8004,8004,33,9459,39,159,8042,8145,8029,8029,64035,64035,8001,-42,7992,7995,8012,-35,-28,-38,-29,-33,[3,-29],-33,-27,-27,63503,-31,-24,-24,-27,60,464,485,-73,[3,479],-68,480,477,456], + 'x-mac-cyrillic': [[32,912],8064,15,1006,0,3,8061,16,863,6,0,8312,855,934,8627,853,932,8558,0,8626,8626,930,0,987,849,844,923,845,924,845,924,844,923,920,836,-22,8535,206,8579,8512,-28,-13,8029,-42,832,911,831,910,902,8003,8003,8010,8010,8004,8004,33,8007,822,901,821,900,8250,804,883,880,[31,848],8109], + 'windows-874': [8236,[4],8097,[11],...w8,[9],...iB], +} + +// windows-1250 - windows-1258 +// prettier-ignore +;[ + [...w1,214,8110,206,215,239,234,0,...w8,0,8329,199,8095,191,200,224,219,0,550,566,158,0,95,[4],180,[4],204,0,0,553,143,[5],76,165,0,129,544,128,...i2], + [898,898,8088,976,8090,8097,8090,8090,8228,8103,895,8110,894,895,893,896,962,...w8,0,8329,959,8095,958,959,957,960,0,877,956,869,0,1003,0,0,857,0,858,[4],856,0,0,852,931,989,[3],921,8285,922,0,924,840,919,920,[64,848]], + [...w2,214,8110,198,0,239,0,0,...w8,580,8329,199,8095,183,0,224,217], + [8236,0,8088,271,8090,8097,8090,8090,0,8103,0,8110,[5],...w8,0,8329,0,8095,[5],740,740,[7],r,[4],8038,[4],720,[3],[3,720],0,720,0,[20,720],r,[44,720],r], + [...w2,214,8110,198,[4],...w8,580,8329,199,8095,183,0,0,217,0,...i9], + [...w2,0,8110,[5],...w8,580,8329,0,8095,[8],8198,[5],45,[15],61,[5],[20,1264],[5,1308],[7,r],[27,1264],r,r,7953,7953,r], + [8236,1533,8088,271,8090,8097,8090,8090,574,8103,1519,8110,198,1529,1546,1529,1567,...w8,1553,8329,1527,8095,183,8047,8047,1563,0,1387,[8],1556,[15],1377,[4],1376,1537,[22,1376],0,[4,1375],[4,1380],0,1379,0,[4,1378],[5],1373,1373,0,0,[4,1371],0,1370,1370,0,1369,0,1368,0,0,7953,7953,1491], + [...w1,0,8110,0,27,569,41,0,...w8,0,8329,0,8095,0,18,573,0,0,r,[3],r,0,0,48,0,172,[4],23,[8],...w7,474], + [...w2,0,8110,198,[4],...w8,580,8329,0,8095,183,0,0,217,[35],63,[8],564,[3],64,0,567,0,0,203,[7],210,549,[4],32,[8],533,[3],33,0,561,0,0,172,[7],179,8109], +].forEach((m, i) => { + maps[`windows-${i + 1250}`] = m +}); + +// iso-8859-1 - iso-8859-16 +// prettier-ignore +;[ + [], // Actual Latin1 / Unicode subset, non-WHATWG, which maps iso-8859-1 to windows-1252 + [99,566,158,0,152,180,0,0,183,180,185,205,0,207,204,0,84,553,143,0,137,165,528,0,168,165,170,190,544,192,...i2], + [133,566,0,0,r,126,0,0,135,180,115,136,0,r,204,0,118,[4],111,0,0,120,165,100,121,0,r,189,[3],r,0,69,66,[9],r,[4],75,0,0,68,[4],143,126,[4],r,0,38,35,[9],r,[4],44,0,0,37,[4],112,95,474], + [99,150,179,0,131,149,0,0,183,104,119,186,0,207,0,0,84,553,164,0,116,134,528,0,168,89,104,171,141,192,140,64,[6],103,68,0,78,0,74,0,0,91,64,116,122,99,[5],153,[3],139,140,0,33,[6],72,37,0,47,0,43,0,0,60,33,85,91,68,[5],122,[3],108,109,474], + [[12,864],0,[66,864],8230,[12,864],-86,864,864], + [[3,r],0,[7,r],1376,0,[13,r],1376,[3,r],1376,r,[26,1376],[5,r],[19,1376],[13,r]], + [8055,8055,0,8200,8202,[4],720,[3],r,8038,[4],[3,720],0,[3,720],0,720,0,[20,720],r,[44,720],r], + [r,[8],45,[15],61,[4],[32,r],7992,[27,1264],r,r,7953,7953,r], + i9, // non-WHATWG, which maps iso-8859-9 to windows-1254 + [99,112,127,134,131,144,0,147,103,182,187,209,0,188,155,0,84,97,112,119,116,129,0,132,88,167,172,194,8024,173,140,64,[6],103,68,0,78,0,74,[4],116,122,[4],145,0,153,[6],33,[6],72,37,0,47,0,43,[4],85,91,[4],114,0,122,[5],57], + iB, // non-WHATWG, which maps iso-8859-11 to windows-874 + null, // no 12 + [8060,[3],8057,0,0,48,0,172,[4],23,[4],8040,[3],...w7,7962], + [7521,7521,0,102,102,7524,0,7640,0,7640,7520,7750,0,0,201,7534,7534,110,110,7564,7564,0,7583,7625,7582,7625,7589,7735,7623,7623,7586,[16],164,[6],7571,[6],152,[17],133,[6],7540,[6],121], + [[3],8200,0,186,0,185,[11],201,[3],198,[3],150,150,186], + [99,99,158,8200,8057,186,0,185,0,366,0,205,0,204,204,0,0,90,143,201,8040,0,0,198,84,351,0,150,150,186,189,[3],63,0,65,[10],64,114,[3],123,0,131,152,[4],59,316,[4],32,0,34,[10],33,83,[3],92,0,100,121,[4],28,285], +].forEach((m, i) => { + if (m) maps[`iso-8859-${i + 1}`] = [[33], ...m] +}); + +export default maps diff --git a/node_modules/@exodus/bytes/fallback/single-byte.js b/node_modules/@exodus/bytes/fallback/single-byte.js new file mode 100644 index 0000000000000000000000000000000000000000..f7f5ec910fe1d12f9ee0d163b8fcec9808f540b1 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/single-byte.js @@ -0,0 +1,110 @@ +import { asciiPrefix, decodeAscii, decodeLatin1 } from './latin1.js' +import encodings from './single-byte.encodings.js' +import { decode2string, nativeDecoder } from './platform.js' + +export const E_STRICT = 'Input is not well-formed for this encoding' +const xUserDefined = 'x-user-defined' +const iso8i = 'iso-8859-8-i' + +export const assertEncoding = (encoding) => { + if (Object.hasOwn(encodings, encoding) || encoding === xUserDefined || encoding === iso8i) return + throw new RangeError('Unsupported encoding') +} + +const r = 0xff_fd + +export function getEncoding(encoding) { + assertEncoding(encoding) + if (encoding === xUserDefined) return Array.from({ length: 128 }, (_, i) => 0xf7_80 + i) + if (encoding === iso8i) encoding = 'iso-8859-8' + const enc = encodings[encoding] + const deltas = enc.flatMap((x) => (Array.isArray(x) ? new Array(x[0]).fill(x[1] ?? 0) : x)) + return deltas.map((x, i) => (x === r ? x : x + 128 + i)) +} + +const mappers = new Map() +const decoders = new Map() +const encmaps = new Map() + +// Used only on Node.js, no reason to optimize for anything else +// E.g. avoiding .from and filling zero-initialized arr manually is faster on Hermes, but we avoid this codepath on Hermes completely +export function encodingMapper(encoding) { + const cached = mappers.get(encoding) + if (cached) return cached + + const codes = getEncoding(encoding) + const incomplete = codes.includes(r) + let map + const mapper = (arr, start = 0) => { + if (!map) { + map = new Uint16Array(256).map((_, i) => i) // Unicode subset + map.set(Uint16Array.from(codes), 128) + } + + const o = Uint16Array.from(start === 0 ? arr : arr.subarray(start)) // copy to modify in-place, also those are 16-bit now + let i = 0 + for (const end7 = o.length - 7; i < end7; i += 8) { + o[i] = map[o[i]] + o[i + 1] = map[o[i + 1]] + o[i + 2] = map[o[i + 2]] + o[i + 3] = map[o[i + 3]] + o[i + 4] = map[o[i + 4]] + o[i + 5] = map[o[i + 5]] + o[i + 6] = map[o[i + 6]] + o[i + 7] = map[o[i + 7]] + } + + for (const end = o.length; i < end; i++) o[i] = map[o[i]] + return o + } + + mappers.set(encoding, { mapper, incomplete }) + return { mapper, incomplete } +} + +export function encodingDecoder(encoding) { + const cached = decoders.get(encoding) + if (cached) return cached + const isLatin1 = encoding === 'iso-8859-1' + if (isLatin1 && !nativeDecoder) return (arr, loose = false) => decodeLatin1(arr) // native decoder is faster for ascii below + + let strings + const codes = getEncoding(encoding) + const incomplete = codes.includes(r) + const decoder = (arr, loose = false) => { + if (!strings) { + const allCodes = Array.from({ length: 128 }, (_, i) => i).concat(codes) + while (allCodes.length < 256) allCodes.push(allCodes.length) + strings = allCodes.map((c) => String.fromCharCode(c)) + } + + const prefixLen = asciiPrefix(arr) + if (prefixLen === arr.length) return decodeAscii(arr) + if (isLatin1) return decodeLatin1(arr) // TODO: check if decodeAscii with subarray is faster for small prefixes too + const prefix = decodeLatin1(arr, 0, prefixLen) // TODO: check if decodeAscii with subarray is faster for small prefixes too + const suffix = decode2string(arr, prefix.length, arr.length, strings) + if (!loose && incomplete && suffix.includes('\uFFFD')) throw new TypeError(E_STRICT) + return prefix + suffix + } + + decoders.set(encoding, decoder) + return decoder +} + +export function encodeMap(encoding) { + const cached = encmaps.get(encoding) + if (cached) return cached + + const codes = getEncoding(encoding) + let max = 128 + while (codes.length < 128) codes.push(128 + codes.length) + for (const code of codes) if (code > max && code !== r) max = code + const map = new Uint8Array(max + 1) // < 10 KiB for all except macintosh, 63 KiB for macintosh + for (let i = 0; i < 128; i++) { + map[i] = i + if (codes[i] !== r) map[codes[i]] = 128 + i + } + + encmaps.set(encoding, map) + return map +} diff --git a/node_modules/@exodus/bytes/fallback/utf16.js b/node_modules/@exodus/bytes/fallback/utf16.js new file mode 100644 index 0000000000000000000000000000000000000000..a6f906f0bcfde17589e84935a197d752aa5c72ed --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/utf16.js @@ -0,0 +1,266 @@ +import { decodeUCS2 } from './latin1.js' +import { assertU8, E_STRING, E_STRICT_UNICODE } from './_utils.js' +import { nativeDecoder, isLE, encodeCharcodes } from './platform.js' + +export const E_STRICT = 'Input is not well-formed utf16' +const isWellFormedStr = /* @__PURE__ */ (() => String.prototype.isWellFormed)() +const toWellFormedStr = /* @__PURE__ */ (() => String.prototype.toWellFormed)() + +const replacementCodepoint = 0xff_fd +const replacementCodepointSwapped = 0xfd_ff + +const to16 = (a) => new Uint16Array(a.buffer, a.byteOffset, a.byteLength / 2) // Requires checked length and alignment! + +export function encodeApi(str, loose, format) { + if (typeof str !== 'string') throw new TypeError(E_STRING) + if (format !== 'uint16' && format !== 'uint8-le' && format !== 'uint8-be') { + throw new TypeError('Unknown format') + } + + // On v8 and SpiderMonkey, check via isWellFormed is faster than js + // On JSC, check during loop is faster than isWellFormed + // If isWellFormed is available, we skip check during decoding and recheck after + // If isWellFormed is unavailable, we check in js during decoding + if (!loose && isWellFormedStr && !isWellFormedStr.call(str)) throw new TypeError(E_STRICT_UNICODE) + const shouldSwap = (isLE && format === 'uint8-be') || (!isLE && format === 'uint8-le') + const u16 = encode(str, loose, !loose && isWellFormedStr, shouldSwap) + + // Bytes are already swapped and format is already checked, we need to just cast the view + return format === 'uint16' ? u16 : new Uint8Array(u16.buffer, u16.byteOffset, u16.byteLength) +} + +const fatalLE = nativeDecoder ? new TextDecoder('utf-16le', { ignoreBOM: true, fatal: true }) : null +const looseLE = nativeDecoder ? new TextDecoder('utf-16le', { ignoreBOM: true }) : null +const fatalBE = nativeDecoder ? new TextDecoder('utf-16be', { ignoreBOM: true, fatal: true }) : null +const looseBE = nativeDecoder ? new TextDecoder('utf-16be', { ignoreBOM: true }) : null + +export function decodeApiDecoders(input, loose, format) { + if (format === 'uint16') { + if (!(input instanceof Uint16Array)) throw new TypeError('Expected an Uint16Array') + } else if (format === 'uint8-le' || format === 'uint8-be') { + assertU8(input) + if (input.byteLength % 2 !== 0) throw new TypeError('Expected even number of bytes') + } else { + throw new TypeError('Unknown format') + } + + const le = format === 'uint8-le' || (format === 'uint16' && isLE) + return (le ? (loose ? looseLE : fatalLE) : loose ? looseBE : fatalBE).decode(input) +} + +export function decodeApiJS(input, loose, format) { + let u16 + switch (format) { + case 'uint16': + if (!(input instanceof Uint16Array)) throw new TypeError('Expected an Uint16Array') + u16 = input + break + case 'uint8-le': + assertU8(input) + if (input.byteLength % 2 !== 0) throw new TypeError('Expected even number of bytes') + u16 = to16input(input, true) + break + case 'uint8-be': + assertU8(input) + if (input.byteLength % 2 !== 0) throw new TypeError('Expected even number of bytes') + u16 = to16input(input, false) + break + default: + throw new TypeError('Unknown format') + } + + const str = decode(u16, loose, (!loose && isWellFormedStr) || (loose && toWellFormedStr)) + if (!loose && isWellFormedStr && !isWellFormedStr.call(str)) throw new TypeError(E_STRICT) + if (loose && toWellFormedStr) return toWellFormedStr.call(str) + + return str +} + +export function to16input(u8, le) { + // Assume even number of bytes + if (le === isLE) return to16(u8.byteOffset % 2 === 0 ? u8 : Uint8Array.from(u8)) + return to16(swap16(Uint8Array.from(u8))) +} + +export const decode = (u16, loose = false, checked = false) => { + if (checked || isWellFormed(u16)) return decodeUCS2(u16) + if (!loose) throw new TypeError(E_STRICT) + return decodeUCS2(toWellFormed(Uint16Array.from(u16))) // cloned for replacement +} + +export function encode(str, loose = false, checked = false, swapped = false) { + const arr = new Uint16Array(str.length) + if (checked) return swapped ? encodeCheckedSwapped(str, arr) : encodeChecked(str, arr) + return swapped ? encodeUncheckedSwapped(str, arr, loose) : encodeUnchecked(str, arr, loose) +} + +/* eslint-disable @exodus/mutable/no-param-reassign-prop-only */ + +// Assumes checked length % 2 === 0, otherwise does not swap tail +function swap16(u8) { + let i = 0 + for (const last3 = u8.length - 3; i < last3; i += 4) { + const x0 = u8[i] + const x1 = u8[i + 1] + const x2 = u8[i + 2] + const x3 = u8[i + 3] + u8[i] = x1 + u8[i + 1] = x0 + u8[i + 2] = x3 + u8[i + 3] = x2 + } + + for (const last = u8.length - 1; i < last; i += 2) { + const x0 = u8[i] + const x1 = u8[i + 1] + u8[i] = x1 + u8[i + 1] = x0 + } + + return u8 +} + +// Splitting paths into small functions helps (at least on SpiderMonkey) + +const encodeChecked = (str, arr) => encodeCharcodes(str, arr) // Same as encodeLatin1, but with Uint16Array + +function encodeCheckedSwapped(str, arr) { + // TODO: faster path for Hermes? See encodeCharcodes + const length = str.length + for (let i = 0; i < length; i++) { + const x = str.charCodeAt(i) + arr[i] = ((x & 0xff) << 8) | (x >> 8) + } + + return arr +} + +// lead: d800 - dbff, trail: dc00 - dfff + +function encodeUnchecked(str, arr, loose = false) { + // TODO: faster path for Hermes? See encodeCharcodes + const length = str.length + for (let i = 0; i < length; i++) { + const code = str.charCodeAt(i) + arr[i] = code + if (code >= 0xd8_00 && code < 0xe0_00) { + // An unexpected trail or a lead at the very end of input + if (code > 0xdb_ff || i + 1 >= length) { + if (!loose) throw new TypeError(E_STRICT_UNICODE) + arr[i] = replacementCodepoint + } else { + const next = str.charCodeAt(i + 1) // Process valid pairs immediately + if (next < 0xdc_00 || next >= 0xe0_00) { + if (!loose) throw new TypeError(E_STRICT_UNICODE) + arr[i] = replacementCodepoint + } else { + i++ // consume next + arr[i] = next + } + } + } + } + + return arr +} + +function encodeUncheckedSwapped(str, arr, loose = false) { + // TODO: faster path for Hermes? See encodeCharcodes + const length = str.length + for (let i = 0; i < length; i++) { + const code = str.charCodeAt(i) + arr[i] = ((code & 0xff) << 8) | (code >> 8) + if (code >= 0xd8_00 && code < 0xe0_00) { + // An unexpected trail or a lead at the very end of input + if (code > 0xdb_ff || i + 1 >= length) { + if (!loose) throw new TypeError(E_STRICT_UNICODE) + arr[i] = replacementCodepointSwapped + } else { + const next = str.charCodeAt(i + 1) // Process valid pairs immediately + if (next < 0xdc_00 || next >= 0xe0_00) { + if (!loose) throw new TypeError(E_STRICT_UNICODE) + arr[i] = replacementCodepointSwapped + } else { + i++ // consume next + arr[i] = ((next & 0xff) << 8) | (next >> 8) + } + } + } + } + + return arr +} + +// Only needed on Hermes, everything else has native impl +export function toWellFormed(u16) { + const length = u16.length + for (let i = 0; i < length; i++) { + const code = u16[i] + if (code >= 0xd8_00 && code < 0xe0_00) { + // An unexpected trail or a lead at the very end of input + if (code > 0xdb_ff || i + 1 >= length) { + u16[i] = replacementCodepoint + } else { + const next = u16[i + 1] // Process valid pairs immediately + if (next < 0xdc_00 || next >= 0xe0_00) { + u16[i] = replacementCodepoint + } else { + i++ // consume next + } + } + } + } + + return u16 +} + +// Only needed on Hermes, everything else has native impl +export function isWellFormed(u16) { + const length = u16.length + let i = 0 + + const m = 0x80_00_80_00 + const l = 0xd8_00 + const h = 0xe0_00 + + // Speedup with u32, by skipping to the first surrogate + // Only implemented for aligned input for now, but almost all input is aligned (pooled Buffer or 0 offset) + if (length > 32 && u16.byteOffset % 4 === 0) { + const u32length = (u16.byteLength / 4) | 0 + const u32 = new Uint32Array(u16.buffer, u16.byteOffset, u32length) + for (const last3 = u32length - 3; ; i += 4) { + if (i >= last3) break // loop is fast enough for moving this here to be _very_ useful, likely due to array access checks + const a = u32[i] + const b = u32[i + 1] + const c = u32[i + 2] + const d = u32[i + 3] + if (a & m || b & m || c & m || d & m) break // bitwise OR does not make this faster on Hermes + } + + for (; i < u32length; i++) if (u32[i] & m) break + i *= 2 + } + + // An extra loop gives ~30-40% speedup e.g. on English text without surrogates but with other symbols above 0x80_00 + for (const last3 = length - 3; ; i += 4) { + if (i >= last3) break + const a = u16[i] + const b = u16[i + 1] + const c = u16[i + 2] + const d = u16[i + 3] + if ((a >= l && a < h) || (b >= l && b < h) || (c >= l && c < h) || (d >= l && d < h)) break + } + + for (; i < length; i++) { + const code = u16[i] + if (code >= l && code < h) { + // An unexpected trail or a lead at the very end of input + if (code >= 0xdc_00 || i + 1 >= length) return false + i++ // consume next + const next = u16[i] // Process valid pairs immediately + if (next < 0xdc_00 || next >= h) return false + } + } + + return true +} diff --git a/node_modules/@exodus/bytes/fallback/utf8.auto.browser.js b/node_modules/@exodus/bytes/fallback/utf8.auto.browser.js new file mode 100644 index 0000000000000000000000000000000000000000..2ad51386a644504004dc01f73205380bfa946869 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/utf8.auto.browser.js @@ -0,0 +1,2 @@ +export const decodeFast = null +export const encode = null diff --git a/node_modules/@exodus/bytes/fallback/utf8.auto.js b/node_modules/@exodus/bytes/fallback/utf8.auto.js new file mode 100644 index 0000000000000000000000000000000000000000..bb641ec61479843cc105e96f607d24e0269b60b8 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/utf8.auto.js @@ -0,0 +1 @@ +export { decodeFast, encode } from './utf8.js' diff --git a/node_modules/@exodus/bytes/fallback/utf8.auto.native.js b/node_modules/@exodus/bytes/fallback/utf8.auto.native.js new file mode 100644 index 0000000000000000000000000000000000000000..bb641ec61479843cc105e96f607d24e0269b60b8 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/utf8.auto.native.js @@ -0,0 +1 @@ +export { decodeFast, encode } from './utf8.js' diff --git a/node_modules/@exodus/bytes/fallback/utf8.js b/node_modules/@exodus/bytes/fallback/utf8.js new file mode 100644 index 0000000000000000000000000000000000000000..d1467bc226a6ea73db172fd77ffc6c5223f219f0 --- /dev/null +++ b/node_modules/@exodus/bytes/fallback/utf8.js @@ -0,0 +1,270 @@ +import { E_STRICT_UNICODE } from './_utils.js' +import { isHermes } from './platform.js' +import { asciiPrefix, decodeLatin1, encodeAsciiPrefix } from './latin1.js' + +export const E_STRICT = 'Input is not well-formed utf8' + +const replacementPoint = 0xff_fd +const shouldUseEscapePath = isHermes // faster only on Hermes, js path beats it on normal engines +const { decodeURIComponent, escape } = globalThis + +export function decodeFast(arr, loose) { + // Fast path for ASCII prefix, this is faster than all alternatives below + const prefix = decodeLatin1(arr, 0, asciiPrefix(arr)) // No native decoder to use, so decodeAscii is useless here + if (prefix.length === arr.length) return prefix + + // This codepath gives a ~3x perf boost on Hermes + if (shouldUseEscapePath && escape && decodeURIComponent) { + const o = escape(decodeLatin1(arr, prefix.length, arr.length)) + try { + return prefix + decodeURIComponent(o) // Latin1 to utf8 + } catch { + if (!loose) throw new TypeError(E_STRICT) + // Ok, we have to use manual implementation for loose decoder + } + } + + return prefix + decode(arr, loose, prefix.length) +} + +// https://encoding.spec.whatwg.org/#utf-8-decoder +// We are most likely in loose mode, for non-loose escape & decodeURIComponent solved everything +export function decode(arr, loose, start = 0) { + start |= 0 + const end = arr.length + let out = '' + const chunkSize = 0x2_00 // far below MAX_ARGUMENTS_LENGTH in npmjs.com/buffer, we use smaller chunks + const tmpSize = Math.min(end - start, chunkSize + 1) // need 1 extra slot for last codepoint, which can be 2 charcodes + const tmp = new Array(tmpSize).fill(0) + let ti = 0 + + for (let i = start; i < end; i++) { + if (ti >= chunkSize) { + tmp.length = ti // can be larger by 1 if last codepoint is two charcodes + out += String.fromCharCode.apply(String, tmp) + if (tmp.length <= chunkSize) tmp.push(0) // restore 1 extra slot for last codepoint + ti = 0 + } + + const byte = arr[i] + if (byte < 0x80) { + tmp[ti++] = byte + // ascii fast path is in decodeFast(), this is called only on non-ascii input + // so we don't unroll this anymore + } else if (byte < 0xc2) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + } else if (byte < 0xe0) { + // need 1 more + if (i + 1 >= end) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + break + } + + const byte1 = arr[i + 1] + if (byte1 < 0x80 || byte1 > 0xbf) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + continue + } + + i++ + tmp[ti++] = ((byte & 0x1f) << 6) | (byte1 & 0x3f) + } else if (byte < 0xf0) { + // need 2 more + if (i + 1 >= end) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + break + } + + const lower = byte === 0xe0 ? 0xa0 : 0x80 + const upper = byte === 0xed ? 0x9f : 0xbf + const byte1 = arr[i + 1] + if (byte1 < lower || byte1 > upper) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + continue + } + + i++ + if (i + 1 >= end) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + break + } + + const byte2 = arr[i + 1] + if (byte2 < 0x80 || byte2 > 0xbf) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + continue + } + + i++ + tmp[ti++] = ((byte & 0xf) << 12) | ((byte1 & 0x3f) << 6) | (byte2 & 0x3f) + } else if (byte <= 0xf4) { + // need 3 more + if (i + 1 >= end) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + break + } + + const lower = byte === 0xf0 ? 0x90 : 0x80 + const upper = byte === 0xf4 ? 0x8f : 0xbf + const byte1 = arr[i + 1] + if (byte1 < lower || byte1 > upper) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + continue + } + + i++ + if (i + 1 >= end) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + break + } + + const byte2 = arr[i + 1] + if (byte2 < 0x80 || byte2 > 0xbf) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + continue + } + + i++ + if (i + 1 >= end) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + break + } + + const byte3 = arr[i + 1] + if (byte3 < 0x80 || byte3 > 0xbf) { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + continue + } + + i++ + const codePoint = + ((byte & 0xf) << 18) | ((byte1 & 0x3f) << 12) | ((byte2 & 0x3f) << 6) | (byte3 & 0x3f) + if (codePoint > 0xff_ff) { + // split into char codes as String.fromCharCode is faster than String.fromCodePoint + const u = codePoint - 0x1_00_00 + tmp[ti++] = 0xd8_00 + ((u >> 10) & 0x3_ff) + tmp[ti++] = 0xdc_00 + (u & 0x3_ff) + } else { + tmp[ti++] = codePoint + } + // eslint-disable-next-line sonarjs/no-duplicated-branches + } else { + if (!loose) throw new TypeError(E_STRICT) + tmp[ti++] = replacementPoint + } + } + + if (ti === 0) return out + tmp.length = ti + return out + String.fromCharCode.apply(String, tmp) +} + +export function encode(string, loose) { + const length = string.length + let small = true + let bytes = new Uint8Array(length) // assume ascii + + let i = encodeAsciiPrefix(bytes, string) + let p = i + for (; i < length; i++) { + let code = string.charCodeAt(i) + if (code < 0x80) { + bytes[p++] = code + // Unroll the loop a bit for faster ops + while (true) { + i++ + if (i >= length) break + code = string.charCodeAt(i) + if (code >= 0x80) break + bytes[p++] = code + i++ + if (i >= length) break + code = string.charCodeAt(i) + if (code >= 0x80) break + bytes[p++] = code + i++ + if (i >= length) break + code = string.charCodeAt(i) + if (code >= 0x80) break + bytes[p++] = code + i++ + if (i >= length) break + code = string.charCodeAt(i) + if (code >= 0x80) break + bytes[p++] = code + } + + if (i >= length) break + // now, code is present and >= 0x80 + } + + if (small) { + // TODO: use resizable array buffers? will have to return a non-resizeable one + if (p !== i) /* c8 ignore next */ throw new Error('Unreachable') // Here, p === i (only when small is still true) + const bytesNew = new Uint8Array(p + (length - i) * 3) // maximium can be 3x of the string length in charcodes + bytesNew.set(bytes) + bytes = bytesNew + small = false + } + + // surrogate, charcodes = [d800 + a & 3ff, dc00 + b & 3ff]; codePoint = 0x1_00_00 | (a << 10) | b + // lead: d800 - dbff + // trail: dc00 - dfff + if (code >= 0xd8_00 && code < 0xe0_00) { + // Can't be a valid trail as we already processed that below + + if (code > 0xdb_ff || i + 1 >= length) { + // An unexpected trail or a lead at the very end of input + if (!loose) throw new TypeError(E_STRICT_UNICODE) + bytes[p++] = 0xef + bytes[p++] = 0xbf + bytes[p++] = 0xbd + continue + } + + const next = string.charCodeAt(i + 1) // Process valid pairs immediately + if (next >= 0xdc_00 && next < 0xe0_00) { + // here, codePoint is always between 0x1_00_00 and 0x11_00_00, we encode as 4 bytes + const codePoint = (((code - 0xd8_00) << 10) | (next - 0xdc_00)) + 0x1_00_00 + bytes[p++] = (codePoint >> 18) | 0xf0 + bytes[p++] = ((codePoint >> 12) & 0x3f) | 0x80 + bytes[p++] = ((codePoint >> 6) & 0x3f) | 0x80 + bytes[p++] = (codePoint & 0x3f) | 0x80 + i++ // consume next + } else { + // Next is not a trail, leave next unconsumed but process unmatched lead error + if (!loose) throw new TypeError(E_STRICT_UNICODE) + bytes[p++] = 0xef + bytes[p++] = 0xbf + bytes[p++] = 0xbd + } + + continue + } + + // We are left with a non-pair char code above ascii, it gets encoded to 2 or 3 bytes + if (code < 0x8_00) { + bytes[p++] = (code >> 6) | 0xc0 + bytes[p++] = (code & 0x3f) | 0x80 + } else { + bytes[p++] = (code >> 12) | 0xe0 + bytes[p++] = ((code >> 6) & 0x3f) | 0x80 + bytes[p++] = (code & 0x3f) | 0x80 + } + } + + return bytes.length === p ? bytes : bytes.slice(0, p) +} diff --git a/node_modules/@exodus/bytes/hex.d.ts b/node_modules/@exodus/bytes/hex.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..863a308ad11e36d18bb007656fcfb1a18af7c57b --- /dev/null +++ b/node_modules/@exodus/bytes/hex.d.ts @@ -0,0 +1,36 @@ +/** + * Implements Base16 from [RFC4648](https://datatracker.ietf.org/doc/html/rfc4648) + * (no differences from [RFC3548](https://datatracker.ietf.org/doc/html/rfc4648)). + * + * ```js + * import { fromHex, toHex } from '@exodus/bytes/hex.js' + * ``` + * + * @module @exodus/bytes/hex.js + */ + +/// + +import type { OutputFormat, Uint8ArrayBuffer } from './array.js'; + +/** + * Encode a `Uint8Array` to a lowercase hex string + * + * @param arr - The input bytes + * @returns The hex encoded string + */ +export function toHex(arr: Uint8Array): string; + +/** + * Decode a hex string to bytes + * + * Unlike `Buffer.from()`, throws on invalid input + * + * @param string - The hex encoded string (case-insensitive) + * @param format - Output format (default: 'uint8') + * @returns The decoded bytes + */ +export function fromHex(string: string, format?: 'uint8'): Uint8ArrayBuffer; +export function fromHex(string: string, format: 'arraybuffer'): ArrayBuffer; +export function fromHex(string: string, format: 'buffer'): Buffer; +export function fromHex(string: string, format?: OutputFormat): Uint8ArrayBuffer | ArrayBuffer | Buffer; diff --git a/node_modules/@exodus/bytes/hex.js b/node_modules/@exodus/bytes/hex.js new file mode 100644 index 0000000000000000000000000000000000000000..b109e2add6ece21f0cbcd1b3181a98c1fdc60966 --- /dev/null +++ b/node_modules/@exodus/bytes/hex.js @@ -0,0 +1,16 @@ +import { assertU8, fromUint8 } from './fallback/_utils.js' +import * as js from './fallback/hex.js' + +const { toHex: webHex } = Uint8Array.prototype // Modern engines have this + +export function toHex(arr) { + assertU8(arr) + if (arr.length === 0) return '' + if (webHex && arr.toHex === webHex) return arr.toHex() + return js.toHex(arr) +} + +// Unlike Buffer.from(), throws on invalid input +export const fromHex = Uint8Array.fromHex + ? (str, format = 'uint8') => fromUint8(Uint8Array.fromHex(str), format) + : (str, format = 'uint8') => fromUint8(js.fromHex(str), format) diff --git a/node_modules/@exodus/bytes/hex.node.js b/node_modules/@exodus/bytes/hex.node.js new file mode 100644 index 0000000000000000000000000000000000000000..784b9c47c0cfd09f5c932d086a8fff373c116720 --- /dev/null +++ b/node_modules/@exodus/bytes/hex.node.js @@ -0,0 +1,37 @@ +import { assertU8, fromBuffer, fromUint8, E_STRING } from './fallback/_utils.js' +import { E_HEX } from './fallback/hex.js' + +if (Buffer.TYPED_ARRAY_SUPPORT) throw new Error('Unexpected Buffer polyfill') + +const { toHex: webHex } = Uint8Array.prototype // Modern engines have this +const denoBug = Buffer.from('ag', 'hex').length > 0 + +export function toHex(arr) { + assertU8(arr) + if (arr.length === 0) return '' + if (webHex && arr.toHex === webHex) return arr.toHex() + if (arr.constructor === Buffer && Buffer.isBuffer(arr)) return arr.hexSlice(0, arr.byteLength) + return Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength).hexSlice(0, arr.byteLength) +} + +// Unlike Buffer.from(), throws on invalid input +export const fromHex = Uint8Array.fromHex + ? (str, format = 'uint8') => fromUint8(Uint8Array.fromHex(str), format) + : (str, format = 'uint8') => { + if (typeof str !== 'string') throw new TypeError(E_STRING) + if (str.length % 2 !== 0) throw new SyntaxError(E_HEX) + if (denoBug && /[^\dA-Fa-f]/.test(str)) throw new SyntaxError(E_HEX) + + // 64 bytes or less, in heap + if (str.length <= 128) { + const buf = Buffer.from(str, 'hex') + if (buf.length * 2 !== str.length) throw new SyntaxError(E_HEX) + return fromBuffer(buf, format) + } + + const length = str.length / 2 + const buf = format === 'buffer' ? Buffer.allocUnsafe(length) : Buffer.allocUnsafeSlow(length) // avoid pooling + const count = buf.hexWrite(str, 0, length) + if (count !== length) throw new SyntaxError(E_HEX) // will stop on first non-hex character, so we can just validate length + return fromBuffer(buf, format) + } diff --git a/node_modules/@exodus/bytes/index.d.ts b/node_modules/@exodus/bytes/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c67945927e73fc00687395e9b06b9b0fce19df27 --- /dev/null +++ b/node_modules/@exodus/bytes/index.d.ts @@ -0,0 +1,43 @@ +/** + * ### The `@exodus/bytes` package consists of submodules, there is no single export. + * Import specific submodules instead. + * + * See [README](https://github.com/ExodusOSS/bytes/blob/main/README.md). + * + * Example: + * ```js + * import { fromHex, toHex } from '@exodus/bytes/hex.js' + * import { fromBase64, toBase64, fromBase64url, toBase64url, fromBase64any } from '@exodus/bytes/base64.js' + * import { fromBase32, toBase32, fromBase32hex, toBase32hex } from '@exodus/bytes/base32.js' + * import { fromBase58, toBase58, fromBase58xrp, toBase58xrp } from '@exodus/bytes/base58.js' + * import { fromBech32, toBech32, fromBech32m, toBech32m, getPrefix } from '@exodus/bytes/bech32.js' + * import { fromBigInt, toBigInt } from '@exodus/bytes/bigint.js' + * + * import { utf8fromString, utf8toString, utf8fromStringLoose, utf8toStringLoose } from '@exodus/bytes/utf8.js' + * import { utf16fromString, utf16toString, utf16fromStringLoose, utf16toStringLoose } from '@exodus/bytes/utf16.js' + * import { + * createSinglebyteDecoder, createSinglebyteEncoder, + * windows1252toString, windows1252fromString, + * latin1toString, latin1fromString } from '@exodus/bytes/single-byte.js' + * import { createMultibyteDecoder, createMultibyteEncoder } from '@exodus/bytes/multi-byte.js' + * + * import { + * fromBase58check, toBase58check, + * fromBase58checkSync, toBase58checkSync, + * makeBase58check } from '@exodus/bytes/base58check.js' + * import { fromWifString, toWifString, fromWifStringSync, toWifStringSync } from '@exodus/bytes/wif.js' + * + * // All encodings from the WHATWG Encoding spec + * import { TextDecoder, TextEncoder, TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding.js' + * import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding.js' + * + * // Omits legacy multi-byte decoders to save bundle size + * import { TextDecoder, TextEncoder, TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding-lite.js' + * import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding-lite.js' + * + * // In browser bundles, uses built-in TextDecoder / TextEncoder to save bundle size + * import { TextDecoder, TextEncoder, TextDecoderStream, TextEncoderStream } from '@exodus/bytes/encoding-browser.js' + * import { getBOMEncoding, legacyHookDecode, labelToName, normalizeEncoding } from '@exodus/bytes/encoding-browser.js' + * ``` + */ +declare module '@exodus/bytes' {} diff --git a/node_modules/@exodus/bytes/index.js b/node_modules/@exodus/bytes/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4d5292b10d2204aba24e3fd9ad9ab12adfd43e75 --- /dev/null +++ b/node_modules/@exodus/bytes/index.js @@ -0,0 +1,5 @@ +throw new Error( + `This package consists of submodules, there is no single export. Import specific submodules instead. +See README: https://github.com/ExodusOSS/bytes/blob/main/README.md +` +) diff --git a/node_modules/@exodus/bytes/multi-byte.d.ts b/node_modules/@exodus/bytes/multi-byte.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a62313faf5e13381615c3ad4e8e7d7a9fdbd4693 --- /dev/null +++ b/node_modules/@exodus/bytes/multi-byte.d.ts @@ -0,0 +1,64 @@ +/** + * Decode / encode the legacy multi-byte encodings according to the + * [Encoding standard](https://encoding.spec.whatwg.org/) + * ([ยง10](https://encoding.spec.whatwg.org/#legacy-multi-byte-chinese-(simplified)-encodings), + * [ยง11](https://encoding.spec.whatwg.org/#legacy-multi-byte-chinese-(traditional)-encodings), + * [ยง12](https://encoding.spec.whatwg.org/#legacy-multi-byte-japanese-encodings), + * [ยง13](https://encoding.spec.whatwg.org/#legacy-multi-byte-korean-encodings)). + * + * ```js + * import { createMultibyteDecoder, createMultibyteEncoder } from '@exodus/bytes/multi-byte.js' + * ``` + * + * > [!WARNING] + * > This is a lower-level API for legacy multi-byte encodings. + * > + * > For a safe WHATWG Encoding-compatible API, see `@exodus/bytes/encoding.js` import (and variants of it). + * > + * > Be sure to know what you are doing and check documentation when directly using encodings from this file. + * + * Supports all legacy multi-byte encodings listed in the WHATWG Encoding standard: + * `gbk`, `gb18030`, `big5`, `euc-jp`, `iso-2022-jp`, `shift_jis`, `euc-kr`. + * + * @module @exodus/bytes/multi-byte.js + */ + +/// + +import type { Uint8ArrayBuffer } from './array.js'; + +/** + * Create a decoder for a supported legacy multi-byte `encoding`, given its lowercased name `encoding`. + * + * Returns a function `decode(arr, stream = false)` that decodes bytes to a string. + * + * The returned function will maintain internal state while `stream = true` is used, allowing it to + * handle incomplete multi-byte sequences across multiple calls. + * State is reset when `stream = false` or when the function is called without the `stream` parameter. + * + * @param encoding - The encoding name (e.g., 'gbk', 'gb18030', 'big5', 'euc-jp', 'iso-2022-jp', 'shift_jis', 'euc-kr') + * @param loose - If true, replaces unmapped bytes with replacement character instead of throwing (default: false) + * @returns A function that decodes bytes to string, with optional streaming support + */ +export function createMultibyteDecoder( + encoding: string, + loose?: boolean +): (arr: Uint8Array, stream?: boolean) => string; + +/** + * Create an encoder for a supported legacy multi-byte `encoding`, given its lowercased name `encoding`. + * + * Returns a function `encode(string)` that encodes a string to bytes. + * + * In `'fatal'` mode (default), will throw on non well-formed strings or any codepoints which could + * not be encoded in the target encoding. + * + * @param encoding - The encoding name (e.g., 'gbk', 'gb18030', 'big5', 'euc-jp', 'iso-2022-jp', 'shift_jis', 'euc-kr') + * @param options - Encoding options + * @param options.mode - Encoding mode (default: 'fatal'). Currently, only 'fatal' mode is supported. + * @returns A function that encodes string to bytes + */ +export function createMultibyteEncoder( + encoding: string, + options?: { mode?: 'fatal' } +): (string: string) => Uint8ArrayBuffer; diff --git a/node_modules/@exodus/bytes/multi-byte.js b/node_modules/@exodus/bytes/multi-byte.js new file mode 100644 index 0000000000000000000000000000000000000000..46dd60fddf30e9b2a09a76324d2dc92936a9abe5 --- /dev/null +++ b/node_modules/@exodus/bytes/multi-byte.js @@ -0,0 +1,19 @@ +import { assertU8 } from './fallback/_utils.js' +import { multibyteDecoder, multibyteEncoder } from './fallback/multi-byte.js' + +export function createMultibyteDecoder(encoding, loose = false) { + const jsDecoder = multibyteDecoder(encoding, loose) // asserts + let streaming = false + return (arr, stream = false) => { + assertU8(arr) + if (!streaming && arr.byteLength === 0) return '' + streaming = stream + return jsDecoder(arr, stream) + } +} + +export function createMultibyteEncoder(encoding, { mode = 'fatal' } = {}) { + // TODO: replacement, truncate (replacement will need varying length) + if (mode !== 'fatal') throw new Error('Unsupported mode') + return multibyteEncoder(encoding) // asserts +} diff --git a/node_modules/@exodus/bytes/multi-byte.node.js b/node_modules/@exodus/bytes/multi-byte.node.js new file mode 100644 index 0000000000000000000000000000000000000000..0c605f21502a428b82fe7805a1e95f584552dc79 --- /dev/null +++ b/node_modules/@exodus/bytes/multi-byte.node.js @@ -0,0 +1,29 @@ +import { assertU8, toBuf } from './fallback/_utils.js' +import { isDeno } from './fallback/platform.js' +import { isAsciiSuperset, multibyteDecoder, multibyteEncoder } from './fallback/multi-byte.js' +import { isAscii } from 'node:buffer' + +export function createMultibyteDecoder(encoding, loose = false) { + const jsDecoder = multibyteDecoder(encoding, loose) // asserts + let streaming = false + const asciiSuperset = isAsciiSuperset(encoding) + return (arr, stream = false) => { + assertU8(arr) + if (!streaming) { + if (arr.byteLength === 0) return '' + if (asciiSuperset && isAscii(arr)) { + if (isDeno) return toBuf(arr).toString() + return toBuf(arr).latin1Slice(0, arr.byteLength) // .latin1Slice is faster than .asciiSlice + } + } + + streaming = stream + return jsDecoder(arr, stream) + } +} + +export function createMultibyteEncoder(encoding, { mode = 'fatal' } = {}) { + // TODO: replacement, truncate (replacement will need varying length) + if (mode !== 'fatal') throw new Error('Unsupported mode') + return multibyteEncoder(encoding) // asserts +} diff --git a/node_modules/@exodus/bytes/package.json b/node_modules/@exodus/bytes/package.json new file mode 100644 index 0000000000000000000000000000000000000000..37ea78c415215ef5f99d6a05f4fdf1674a5cc4ef --- /dev/null +++ b/node_modules/@exodus/bytes/package.json @@ -0,0 +1,298 @@ +{ + "name": "@exodus/bytes", + "version": "1.15.1", + "description": "Various operations on Uint8Array data", + "keywords": [ + "encoding", + "Uint8Array", + "TextDecoder", + "TextEncoder", + "utf8", + "utf16", + "hex", + "base64", + "base32", + "base58", + "base58check", + "bech32", + "bech32m", + "wif" + ], + "scripts": { + "lint": "eslint .", + "typedoc": "typedoc && mkdir -p doc/assets && cp -r theme/styles doc/assets/", + "test:javascriptcore": "npm run test:jsc --", + "test:v8": "exodus-test --engine=v8:bundle", + "test:jsc": "exodus-test --engine=jsc:bundle", + "test:spidermonkey": "exodus-test --engine=spidermonkey:bundle", + "test:hermes": "exodus-test --engine=hermes:bundle", + "test:quickjs": "exodus-test --engine=quickjs:bundle", + "test:xs": "exodus-test --engine=xs:bundle", + "test:engine262": "exodus-test --engine=engine262:bundle", + "test:graaljs": "exodus-test --engine=graaljs:bundle", + "test:escargot": "exodus-test --engine=escargot:bundle", + "test:boa": "exodus-test --engine=boa:bundle", + "test:deno": "exodus-test --engine=deno:pure", + "test:bun": "exodus-test --engine=bun:pure", + "test:workerd": "exodus-test --engine=workerd:bundle", + "test:electron:bundle": "exodus-test --engine=electron:bundle", + "test:electron:as-node": "exodus-test --engine=electron-as-node:test", + "test:chrome:puppeteer": "exodus-test --engine=chrome:puppeteer", + "test:chromium:playwright": "exodus-test --engine=chromium:playwright", + "test:webkit:playwright": "exodus-test --engine=webkit:playwright", + "test:firefox:puppeteer": "exodus-test --engine=firefox:puppeteer --testTimeout=60000", + "test:firefox:playwright": "exodus-test --engine=firefox:playwright --testTimeout=60000", + "test:servo:bundle": "exodus-test --engine=servo:bundle", + "test": "exodus-test", + "size": "esbuild --minify --bundle", + "jsvu": "jsvu", + "playwright": "exodus-test --playwright", + "benchmark": "exodus-test --concurrency=1 benchmarks/*.bench.js", + "coverage": "exodus-test --coverage" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ExodusOSS/bytes.git" + }, + "author": "Exodus Movement, Inc.", + "license": "MIT", + "bugs": { + "url": "https://github.com/ExodusOSS/bytes/issues" + }, + "homepage": "https://github.com/ExodusOSS/bytes", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "type": "module", + "files": [ + "/fallback/_utils.js", + "/fallback/base32.js", + "/fallback/base58check.js", + "/fallback/base64.js", + "/fallback/encoding.js", + "/fallback/encoding.api.js", + "/fallback/encoding.labels.js", + "/fallback/encoding.util.js", + "/fallback/hex.js", + "/fallback/latin1.js", + "/fallback/percent.js", + "/fallback/platform.js", + "/fallback/platform.browser.js", + "/fallback/platform.native.js", + "/fallback/multi-byte.encodings.cjs", + "/fallback/multi-byte.encodings.json", + "/fallback/multi-byte.js", + "/fallback/multi-byte.table.js", + "/fallback/single-byte.encodings.js", + "/fallback/single-byte.js", + "/fallback/utf16.js", + "/fallback/utf8.js", + "/fallback/utf8.auto.js", + "/fallback/utf8.auto.browser.js", + "/fallback/utf8.auto.native.js", + "/array.js", + "/array.d.ts", + "/assert.js", + "/base32.js", + "/base32.d.ts", + "/base58.js", + "/base58.d.ts", + "/base58check.js", + "/base58check.d.ts", + "/base58check.node.js", + "/base64.js", + "/base64.d.ts", + "/bech32.js", + "/bech32.d.ts", + "/bigint.js", + "/bigint.d.ts", + "/encoding-browser.js", + "/encoding-browser.browser.js", + "/encoding-browser.native.js", + "/encoding-browser.d.ts", + "/encoding.js", + "/encoding.d.ts", + "/encoding-lite.js", + "/encoding-lite.d.ts", + "/hex.js", + "/hex.d.ts", + "/hex.node.js", + "/index.js", + "/index.d.ts", + "/multi-byte.js", + "/multi-byte.d.ts", + "/multi-byte.node.js", + "/single-byte.js", + "/single-byte.d.ts", + "/single-byte.node.js", + "/utf16.js", + "/utf16.d.ts", + "/utf16.browser.js", + "/utf16.native.js", + "/utf16.node.js", + "/utf8.js", + "/utf8.d.ts", + "/utf8.node.js", + "/whatwg.js", + "/whatwg.d.ts", + "/wif.js", + "/wif.d.ts" + ], + "main": "index.js", + "module": "index.js", + "types": "index.d.ts", + "exports": { + ".": { + "types": "./index.d.ts", + "default": "./index.js" + }, + "./array.js": { + "types": "./array.d.ts", + "default": "./array.js" + }, + "./base32.js": { + "types": "./base32.d.ts", + "default": "./base32.js" + }, + "./base58.js": { + "types": "./base58.d.ts", + "default": "./base58.js" + }, + "./base58check.js": { + "types": "./base58check.d.ts", + "node": "./base58check.node.js", + "default": "./base58check.js" + }, + "./base64.js": { + "types": "./base64.d.ts", + "default": "./base64.js" + }, + "./bech32.js": { + "types": "./bech32.d.ts", + "default": "./bech32.js" + }, + "./bigint.js": { + "types": "./bigint.d.ts", + "default": "./bigint.js" + }, + "./hex.js": { + "types": "./hex.d.ts", + "node": "./hex.node.js", + "default": "./hex.js" + }, + "./multi-byte.js": { + "types": "./multi-byte.d.ts", + "node": "./multi-byte.node.js", + "default": "./multi-byte.js" + }, + "./single-byte.js": { + "types": "./single-byte.d.ts", + "node": "./single-byte.node.js", + "default": "./single-byte.js" + }, + "./encoding.js": { + "types": "./encoding.d.ts", + "default": "./encoding.js" + }, + "./encoding-lite.js": { + "types": "./encoding-lite.d.ts", + "default": "./encoding-lite.js" + }, + "./encoding-browser.js": { + "types": "./encoding-browser.d.ts", + "node": "./encoding-browser.js", + "react-native": "./encoding-browser.native.js", + "browser": "./encoding-browser.browser.js", + "default": "./encoding-browser.js" + }, + "./utf16.js": { + "types": "./utf16.d.ts", + "node": "./utf16.node.js", + "react-native": "./utf16.native.js", + "browser": "./utf16.browser.js", + "default": "./utf16.js" + }, + "./utf8.js": { + "types": "./utf8.d.ts", + "node": "./utf8.node.js", + "default": "./utf8.js" + }, + "./whatwg.js": { + "types": "./whatwg.d.ts", + "default": "./whatwg.js" + }, + "./wif.js": { + "types": "./wif.d.ts", + "default": "./wif.js" + } + }, + "browser": { + "./utf16.js": "./utf16.browser.js", + "./fallback/platform.js": "./fallback/platform.browser.js", + "./fallback/utf8.auto.js": "./fallback/utf8.auto.browser.js" + }, + "react-native": { + "./encoding-browser.js": "./encoding-browser.native.js", + "./utf16.js": "./utf16.native.js", + "./fallback/platform.js": "./fallback/platform.native.js", + "./fallback/utf8.auto.js": "./fallback/utf8.auto.native.js" + }, + "sideEffects": [ + "./encoding.js" + ], + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + }, + "devDependencies": { + "@ethersproject/strings": "^5.8.0", + "@exodus/crypto": "^1.0.0-rc.30", + "@exodus/eslint-config": "^5.24.0", + "@exodus/prettier": "^1.0.0", + "@exodus/test": "1.0.0-rc.115", + "@hexagon/base64": "^2.0.4", + "@noble/hashes": "^2.0.1", + "@oslojs/encoding": "^1.1.0", + "@petamoriken/float16": "^3.9.3", + "@scure/base": "^1.2.6", + "@stablelib/base64": "^2.0.1", + "@stablelib/hex": "^2.0.1", + "@types/node": "^22.12.0", + "base-x": "^5.0.1", + "base32.js": "^0.1.0", + "base58-js": "^3.0.3", + "base64-js": "^1.5.1", + "bech32": "^2.0.0", + "bs58": "^6.0.0", + "bs58check": "^4.0.0", + "bstring": "^0.3.9", + "buffer": "^6.0.3", + "c8": "^10.1.3", + "decode-utf8": "^1.0.1", + "electron": "39.4.0", + "encode-utf8": "^2.0.0", + "esbuild": "^0.27.3", + "eslint": "^8.44.0", + "fast-base64-decode": "^2.0.0", + "fast-base64-encode": "^1.0.0", + "hextreme": "^1.0.7", + "hi-base32": "^0.5.1", + "iconv-lite": "^0.7.0", + "jsvu": "^3.0.3", + "punycode": "^2.3.1", + "text-encoding": "^0.7.0", + "typedoc": "^0.28.16", + "typescript": "^5.9.3", + "uint8array-tools": "^0.0.9", + "utf8": "^3.0.0", + "web-streams-polyfill": "^4.2.0", + "wif": "^5.0.0", + "workerd": "^1.20260301.1" + }, + "prettier": "@exodus/prettier", + "packageManager": "pnpm@10.12.1+sha256.889bac470ec93ccc3764488a19d6ba8f9c648ad5e50a9a6e4be3768a5de387a3" +} diff --git a/node_modules/@exodus/bytes/single-byte.d.ts b/node_modules/@exodus/bytes/single-byte.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f8a0ccb11ba099a4c37265f4390058e8ebde7932 --- /dev/null +++ b/node_modules/@exodus/bytes/single-byte.d.ts @@ -0,0 +1,166 @@ +/** + * Decode / encode the legacy single-byte encodings according to the + * [Encoding standard](https://encoding.spec.whatwg.org/) + * ([ยง9](https://encoding.spec.whatwg.org/#legacy-single-byte-encodings), + * [ยง14.5](https://encoding.spec.whatwg.org/#x-user-defined)), + * and [unicode.org](https://unicode.org/Public/MAPPINGS/ISO8859) `iso-8859-*` mappings. + * + * ```js + * import { createSinglebyteDecoder, createSinglebyteEncoder } from '@exodus/bytes/single-byte.js' + * import { windows1252toString, windows1252fromString } from '@exodus/bytes/single-byte.js' + * import { latin1toString, latin1fromString } from '@exodus/bytes/single-byte.js' + * ``` + * + * > [!WARNING] + * > This is a lower-level API for single-byte encodings. + * > It might not match what you expect, as it supports both WHATWG and unicode.org encodings under + * > different names, with the main intended usecase for the latter being either non-web or legacy contexts. + * > + * > For a safe WHATWG Encoding-compatible API, see `@exodus/bytes/encoding.js` import (and variants of it). + * > + * > Be sure to know what you are doing and check documentation when directly using encodings from this file. + * + * Supports all single-byte encodings listed in the WHATWG Encoding standard: + * `ibm866`, `iso-8859-2`, `iso-8859-3`, `iso-8859-4`, `iso-8859-5`, `iso-8859-6`, `iso-8859-7`, `iso-8859-8`, + * `iso-8859-8-i`, `iso-8859-10`, `iso-8859-13`, `iso-8859-14`, `iso-8859-15`, `iso-8859-16`, `koi8-r`, `koi8-u`, + * `macintosh`, `windows-874`, `windows-1250`, `windows-1251`, `windows-1252`, `windows-1253`, `windows-1254`, + * `windows-1255`, `windows-1256`, `windows-1257`, `windows-1258`, `x-mac-cyrillic` and `x-user-defined`. + * + * Also supports `iso-8859-1`, `iso-8859-9`, `iso-8859-11` as defined at + * [unicode.org](https://unicode.org/Public/MAPPINGS/ISO8859) + * (and all other `iso-8859-*` encodings there as they match WHATWG). + * + * > [!NOTE] + * > While all `iso-8859-*` encodings supported by the [WHATWG Encoding standard](https://encoding.spec.whatwg.org/) match + * > [unicode.org](https://unicode.org/Public/MAPPINGS/ISO8859), the WHATWG Encoding spec doesn't support + * > `iso-8859-1`, `iso-8859-9`, `iso-8859-11`, and instead maps them as labels to `windows-1252`, `windows-1254`, `windows-874`.\ + * > `createSinglebyteDecoder()` (unlike `TextDecoder` or `legacyHookDecode()`) does not do such mapping, + * > so its results will differ from `TextDecoder` for those encoding names. + * + * ```js + * > new TextDecoder('iso-8859-1').encoding + * 'windows-1252' + * > new TextDecoder('iso-8859-9').encoding + * 'windows-1254' + * > new TextDecoder('iso-8859-11').encoding + * 'windows-874' + * > new TextDecoder('iso-8859-9').decode(Uint8Array.of(0x80, 0x81, 0xd0)) + * 'โ‚ฌ\x81ฤž' // this is actually decoded according to windows-1254 per TextDecoder spec + * > createSinglebyteDecoder('iso-8859-9')(Uint8Array.of(0x80, 0x81, 0xd0)) + * '\x80\x81ฤž' // this is iso-8859-9 as defined at https://unicode.org/Public/MAPPINGS/ISO8859/8859-9.txt + * ``` + * + * All WHATWG Encoding spec [`windows-*` encodings](https://encoding.spec.whatwg.org/#windows-874) are supersets of + * corresponding [unicode.org encodings](https://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/), meaning that + * they encode/decode all the old valid (non-replacement) strings / byte sequences identically, but can also support + * a wider range of inputs. + * + * @module @exodus/bytes/single-byte.js + */ + +/// + +import type { Uint8ArrayBuffer } from './array.js'; + +/** + * Create a decoder for a supported one-byte `encoding`, given its lowercased name `encoding`. + * + * Returns a function `decode(arr)` that decodes bytes to a string. + * + * @param encoding - The encoding name (e.g., 'iso-8859-1', 'windows-1252') + * @param loose - If true, replaces unmapped bytes with replacement character instead of throwing (default: false) + * @returns A function that decodes bytes to string + */ +export function createSinglebyteDecoder( + encoding: string, + loose?: boolean +): (arr: Uint8Array) => string; + +/** + * Create an encoder for a supported one-byte `encoding`, given its lowercased name `encoding`. + * + * Returns a function `encode(string)` that encodes a string to bytes. + * + * In `'fatal'` mode (default), will throw on non well-formed strings or any codepoints which could + * not be encoded in the target encoding. + * + * @param encoding - The encoding name (e.g., 'iso-8859-1', 'windows-1252') + * @param options - Encoding options + * @param options.mode - Encoding mode (default: 'fatal'). Currently, only 'fatal' mode is supported. + * @returns A function that encodes string to bytes + */ +export function createSinglebyteEncoder( + encoding: string, + options?: { mode?: 'fatal' } +): (string: string) => Uint8ArrayBuffer; + +/** + * Decode `iso-8859-1` bytes to a string. + * + * There is no loose variant for this encoding, all bytes can be decoded. + * + * Same as: + * ```js + * const latin1toString = createSinglebyteDecoder('iso-8859-1') + * ``` + * + * > [!NOTE] + * > This is different from `new TextDecoder('iso-8859-1')` and `new TextDecoder('latin1')`, as those + * > alias to `new TextDecoder('windows-1252')`. + * + * Prefer using `isomorphicDecode()` from `@exodus/bytes/encoding.js` or `@exodus/bytes/encoding-lite.js`, + * which is identical to this but allows more input types. + * + * @deprecated Use `import { isomorphicDecode } from '@exodus/bytes/encoding-lite.js'` + * @param arr - The bytes to decode + * @returns The decoded string + */ +export function latin1toString(arr: Uint8Array): string; + +/** + * Encode a string to `iso-8859-1` bytes. + * + * Throws on non well-formed strings or any codepoints which could not be encoded in `iso-8859-1`. + * + * Same as: + * ```js + * const latin1fromString = createSinglebyteEncoder('iso-8859-1', { mode: 'fatal' }) + * ``` + * + * Prefer using `isomorphicEncode()` from `@exodus/bytes/encoding.js` or `@exodus/bytes/encoding-lite.js`. + * + * @deprecated Use `import { isomorphicEncode } from '@exodus/bytes/encoding-lite.js'` + * @param string - The string to encode + * @returns The encoded bytes + */ +export function latin1fromString(string: string): Uint8ArrayBuffer; + +/** + * Decode `windows-1252` bytes to a string. + * + * There is no loose variant for this encoding, all bytes can be decoded. + * + * Same as: + * ```js + * const windows1252toString = createSinglebyteDecoder('windows-1252') + * ``` + * + * @param arr - The bytes to decode + * @returns The decoded string + */ +export function windows1252toString(arr: Uint8Array): string; + +/** + * Encode a string to `windows-1252` bytes. + * + * Throws on non well-formed strings or any codepoints which could not be encoded in `windows-1252`. + * + * Same as: + * ```js + * const windows1252fromString = createSinglebyteEncoder('windows-1252', { mode: 'fatal' }) + * ``` + * + * @param string - The string to encode + * @returns The encoded bytes + */ +export function windows1252fromString(string: string): Uint8ArrayBuffer; diff --git a/node_modules/@exodus/bytes/single-byte.js b/node_modules/@exodus/bytes/single-byte.js new file mode 100644 index 0000000000000000000000000000000000000000..419a2da0c4a104fbcf095323d385f3e1b1957c5d --- /dev/null +++ b/node_modules/@exodus/bytes/single-byte.js @@ -0,0 +1,135 @@ +import { assertU8, E_STRING } from './fallback/_utils.js' +import { nativeDecoderLatin1, nativeEncoder } from './fallback/platform.js' +import { encodeAsciiPrefix, encodeLatin1 } from './fallback/latin1.js' +import { assertEncoding, encodingDecoder, encodeMap, E_STRICT } from './fallback/single-byte.js' + +const { TextDecoder, btoa } = globalThis + +let windows1252works + +// prettier-ignore +const skipNative = new Set([ + 'iso-8859-1', 'iso-8859-9', 'iso-8859-11', // non-WHATWG + 'iso-8859-6', 'iso-8859-8', 'iso-8859-8-i', // slow in all 3 engines + 'iso-8859-16', // iso-8859-16 is somehow broken in WebKit, at least on CI +]) + +function shouldUseNative(enc) { + // https://issues.chromium.org/issues/468458388 + // Also might be incorrectly imlemented on platforms as Latin1 (e.g. in Node.js) or regress + // This is the most significant single-byte encoding, 'ascii' and 'latin1' alias to this + // Even after Chrome bug is fixed, this should serve as a quick correctness check that it's actually windows-1252 + if (enc === 'windows-1252') { + if (windows1252works === undefined) { + windows1252works = false + try { + const u = new Uint8Array(9) // using 9 bytes is significant to catch the bug + u[8] = 128 + windows1252works = new TextDecoder(enc).decode(u).codePointAt(8) === 0x20_ac + } catch {} + } + + return windows1252works + } + + return !skipNative.has(enc) +} + +export function createSinglebyteDecoder(encoding, loose = false) { + if (typeof loose !== 'boolean') throw new TypeError('loose option should be boolean') + assertEncoding(encoding) + + if (nativeDecoderLatin1 && shouldUseNative(encoding)) { + // In try, as not all encodings might be implemented in all engines which have native TextDecoder + try { + const decoder = new TextDecoder(encoding, { fatal: !loose }) + return (arr) => { + assertU8(arr) + if (arr.byteLength === 0) return '' + return decoder.decode(arr) + } + } catch {} + } + + const jsDecoder = encodingDecoder(encoding) + return (arr) => { + assertU8(arr) + if (arr.byteLength === 0) return '' + return jsDecoder(arr, loose) + } +} + +const NON_LATIN = /[^\x00-\xFF]/ // eslint-disable-line no-control-regex + +function encode(s, m) { + const len = s.length + const x = new Uint8Array(len) + let i = nativeEncoder ? 0 : encodeAsciiPrefix(x, s) + + for (const len3 = len - 3; i < len3; i += 4) { + const x0 = s.charCodeAt(i), x1 = s.charCodeAt(i + 1), x2 = s.charCodeAt(i + 2), x3 = s.charCodeAt(i + 3) // prettier-ignore + const c0 = m[x0], c1 = m[x1], c2 = m[x2], c3 = m[x3] // prettier-ignore + if ((!c0 && x0) || (!c1 && x1) || (!c2 && x2) || (!c3 && x3)) return null + + x[i] = c0 + x[i + 1] = c1 + x[i + 2] = c2 + x[i + 3] = c3 + } + + for (; i < len; i++) { + const x0 = s.charCodeAt(i) + const c0 = m[x0] + if (!c0 && x0) return null + x[i] = c0 + } + + return x +} + +// fromBase64+btoa path is faster on everything where fromBase64 is fast +const useLatin1btoa = Uint8Array.fromBase64 && btoa + +export function latin1fromString(s) { + if (typeof s !== 'string') throw new TypeError(E_STRING) + // max limit is to not produce base64 strings that are too long + if (useLatin1btoa && s.length >= 1024 && s.length < 1e8) { + try { + return Uint8Array.fromBase64(btoa(s)) // fails on non-latin1 + } catch { + throw new TypeError(E_STRICT) + } + } + + if (NON_LATIN.test(s)) throw new TypeError(E_STRICT) + return encodeLatin1(s) +} + +export function createSinglebyteEncoder(encoding, { mode = 'fatal' } = {}) { + // TODO: replacement, truncate (replacement will need varying length) + if (mode !== 'fatal') throw new Error('Unsupported mode') + if (encoding === 'iso-8859-1') return latin1fromString + const m = encodeMap(encoding) // asserts + + // No single-byte encoder produces surrogate pairs, so any surrogate is invalid + // This needs special treatment only to decide how many replacement chars to output, one or two + // Not much use in running isWellFormed, most likely cause of error is unmapped chars, not surrogate pairs + return (s) => { + if (typeof s !== 'string') throw new TypeError(E_STRING) + + // Instead of an ASCII regex check, encode optimistically - this is faster + // Check for 8-bit string with a regex though, this is instant on 8-bit strings so doesn't hurt the ASCII fast path + if (nativeEncoder && !NON_LATIN.test(s)) { + const u8 = nativeEncoder.encode(s) + if (u8.length === s.length) return u8 + } + + const res = encode(s, m) + if (!res) throw new TypeError(E_STRICT) + return res + } +} + +export const latin1toString = /* @__PURE__ */ createSinglebyteDecoder('iso-8859-1') +export const windows1252toString = /* @__PURE__ */ createSinglebyteDecoder('windows-1252') +export const windows1252fromString = /* @__PURE__ */ createSinglebyteEncoder('windows-1252') diff --git a/node_modules/@exodus/bytes/single-byte.node.js b/node_modules/@exodus/bytes/single-byte.node.js new file mode 100644 index 0000000000000000000000000000000000000000..fddae71678dbd5a3378ac7de11192679a9882d0b --- /dev/null +++ b/node_modules/@exodus/bytes/single-byte.node.js @@ -0,0 +1,127 @@ +import { isAscii } from 'node:buffer' +import { assertU8, toBuf, E_STRING } from './fallback/_utils.js' +import { isDeno, isLE } from './fallback/platform.js' +import { asciiPrefix } from './fallback/latin1.js' +import { encodingMapper, encodingDecoder, encodeMap, E_STRICT } from './fallback/single-byte.js' + +function latin1Prefix(arr, start) { + let p = start | 0 + const length = arr.length + for (const len3 = length - 3; p < len3; p += 4) { + if ((arr[p] & 0xe0) === 0x80) return p + if ((arr[p + 1] & 0xe0) === 0x80) return p + 1 + if ((arr[p + 2] & 0xe0) === 0x80) return p + 2 + if ((arr[p + 3] & 0xe0) === 0x80) return p + 3 + } + + for (; p < length; p++) { + if ((arr[p] & 0xe0) === 0x80) return p + } + + return length +} + +export function createSinglebyteDecoder(encoding, loose = false) { + if (typeof loose !== 'boolean') throw new TypeError('loose option should be boolean') + if (isDeno) { + const jsDecoder = encodingDecoder(encoding) // asserts + return (arr) => { + assertU8(arr) + if (arr.byteLength === 0) return '' + if (isAscii(arr)) return toBuf(arr).toString() + return jsDecoder(arr, loose) // somewhy faster on Deno anyway, TODO: optimize? + } + } + + const isLatin1 = encoding === 'iso-8859-1' + const latin1path = encoding === 'windows-1252' + const { incomplete, mapper } = encodingMapper(encoding) // asserts + return (arr) => { + assertU8(arr) + if (arr.byteLength === 0) return '' + if (isLatin1 || isAscii(arr)) return toBuf(arr).latin1Slice(0, arr.byteLength) // .latin1Slice is faster than .asciiSlice + + // Node.js TextDecoder is broken, so we can't use it. It's also slow anyway + + let prefixBytes = asciiPrefix(arr) + let prefix = '' + if (latin1path) prefixBytes = latin1Prefix(arr, prefixBytes) + if (prefixBytes > 64 || prefixBytes === arr.length) { + prefix = toBuf(arr).latin1Slice(0, prefixBytes) // .latin1Slice is faster than .asciiSlice + if (prefixBytes === arr.length) return prefix + } + + const b = toBuf(mapper(arr, prefix.length)) // prefix.length can mismatch prefixBytes + if (!isLE) b.swap16() + const suffix = b.ucs2Slice(0, b.byteLength) + if (!loose && incomplete && suffix.includes('\uFFFD')) throw new TypeError(E_STRICT) + return prefix + suffix + } +} + +const NON_LATIN = /[^\x00-\xFF]/ // eslint-disable-line no-control-regex + +function encode(s, m) { + const len = s.length + let i = 0 + const b = Buffer.from(s, 'utf-16le') // aligned + if (!isLE) b.swap16() + const x = new Uint16Array(b.buffer, b.byteOffset, b.byteLength / 2) + for (const len3 = len - 3; i < len3; i += 4) { + const x0 = x[i], x1 = x[i + 1], x2 = x[i + 2], x3 = x[i + 3] // prettier-ignore + const c0 = m[x0], c1 = m[x1], c2 = m[x2], c3 = m[x3] // prettier-ignore + if (!(c0 && c1 && c2 && c3) && ((!c0 && x0) || (!c1 && x1) || (!c2 && x2) || (!c3 && x3))) return null // prettier-ignore + x[i] = c0 + x[i + 1] = c1 + x[i + 2] = c2 + x[i + 3] = c3 + } + + for (; i < len; i++) { + const x0 = x[i] + const c0 = m[x0] + if (!c0 && x0) return null + x[i] = c0 + } + + return new Uint8Array(x) +} + +export function latin1fromString(s) { + if (typeof s !== 'string') throw new TypeError(E_STRING) + if (NON_LATIN.test(s)) throw new TypeError(E_STRICT) + const ab = new ArrayBuffer(s.length) + Buffer.from(ab).latin1Write(s) + return new Uint8Array(ab) +} + +export function createSinglebyteEncoder(encoding, { mode = 'fatal' } = {}) { + // TODO: replacement, truncate (replacement will need varying length) + if (mode !== 'fatal') throw new Error('Unsupported mode') + if (encoding === 'iso-8859-1') return latin1fromString + const m = encodeMap(encoding) // asserts + + return (s) => { + if (typeof s !== 'string') throw new TypeError(E_STRING) + + // Instead of an ASCII regex check, encode optimistically - this is faster + // Check for 8-bit string with a regex though, this is instant on 8-bit strings so doesn't hurt the ASCII fast path + if (!NON_LATIN.test(s)) { + const byteLength = Buffer.byteLength(s) + // ascii/latin1 coerces, we need to check + if (byteLength === s.length) { + const ab = new ArrayBuffer(byteLength) + Buffer.from(ab).latin1Write(s) + return new Uint8Array(ab) + } + } + + const res = encode(s, m) + if (!res) throw new TypeError(E_STRICT) + return res + } +} + +export const latin1toString = /* @__PURE__ */ createSinglebyteDecoder('iso-8859-1') +export const windows1252toString = /* @__PURE__ */ createSinglebyteDecoder('windows-1252') +export const windows1252fromString = /* @__PURE__ */ createSinglebyteEncoder('windows-1252') diff --git a/node_modules/@exodus/bytes/utf16.browser.js b/node_modules/@exodus/bytes/utf16.browser.js new file mode 100644 index 0000000000000000000000000000000000000000..0c6ecbdf415444b0ded1c5c7455c5a920f1a207b --- /dev/null +++ b/node_modules/@exodus/bytes/utf16.browser.js @@ -0,0 +1,8 @@ +// We trust browsers to always have correct TextDecoder for utf-16le/utf-16be with ignoreBOM without streaming + +import { encodeApi, decodeApiDecoders } from './fallback/utf16.js' + +export const utf16fromString = (str, format = 'uint16') => encodeApi(str, false, format) +export const utf16fromStringLoose = (str, format = 'uint16') => encodeApi(str, true, format) +export const utf16toString = (arr, format = 'uint16') => decodeApiDecoders(arr, false, format) +export const utf16toStringLoose = (arr, format = 'uint16') => decodeApiDecoders(arr, true, format) diff --git a/node_modules/@exodus/bytes/utf16.d.ts b/node_modules/@exodus/bytes/utf16.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..96a789a12d8935a5efad4919baaf5c1bbdf52434 --- /dev/null +++ b/node_modules/@exodus/bytes/utf16.d.ts @@ -0,0 +1,92 @@ +/** + * UTF-16 encoding/decoding + * + * ```js + * import { utf16fromString, utf16toString } from '@exodus/bytes/utf16.js' + * + * // loose + * import { utf16fromStringLoose, utf16toStringLoose } from '@exodus/bytes/utf16.js' + * ``` + * + * _These methods by design encode/decode BOM (codepoint `U+FEFF` Byte Order Mark) as-is._\ + * _If you need BOM handling or detection, use `@exodus/bytes/encoding.js`_ + * + * @module @exodus/bytes/utf16.js + */ + +/// + +import type { Uint8ArrayBuffer, Uint16ArrayBuffer } from './array.js'; + +/** + * Output format for UTF-16 encoding + */ +export type Utf16Format = 'uint16' | 'uint8-le' | 'uint8-be'; + +/** + * Encode a string to UTF-16 bytes (strict mode) + * + * Throws on invalid Unicode (unpaired surrogates) + * + * @param string - The string to encode + * @param format - Output format (default: 'uint16') + * @returns The encoded bytes + */ +export function utf16fromString(string: string, format?: 'uint16'): Uint16ArrayBuffer; +export function utf16fromString(string: string, format: 'uint8-le'): Uint8ArrayBuffer; +export function utf16fromString(string: string, format: 'uint8-be'): Uint8ArrayBuffer; +export function utf16fromString(string: string, format?: Utf16Format): Uint16ArrayBuffer | Uint8ArrayBuffer; + +/** + * Encode a string to UTF-16 bytes (loose mode) + * + * Replaces invalid Unicode (unpaired surrogates) with replacement codepoints `U+FFFD` + * per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification. + * + * _Such replacement is a non-injective function, is irreversible and causes collisions.\ + * Prefer using strict throwing methods for cryptography applications._ + * + * @param string - The string to encode + * @param format - Output format (default: 'uint16') + * @returns The encoded bytes + */ +export function utf16fromStringLoose(string: string, format?: 'uint16'): Uint16ArrayBuffer; +export function utf16fromStringLoose(string: string, format: 'uint8-le'): Uint8ArrayBuffer; +export function utf16fromStringLoose(string: string, format: 'uint8-be'): Uint8ArrayBuffer; +export function utf16fromStringLoose(string: string, format?: Utf16Format): Uint16ArrayBuffer | Uint8ArrayBuffer; + +/** + * Decode UTF-16 bytes to a string (strict mode) + * + * Throws on invalid UTF-16 byte sequences + * + * Throws on non-even byte length. + * + * @param arr - The bytes to decode + * @param format - Input format (default: 'uint16') + * @returns The decoded string + */ +export function utf16toString(arr: Uint16Array, format?: 'uint16'): string; +export function utf16toString(arr: Uint8Array, format: 'uint8-le'): string; +export function utf16toString(arr: Uint8Array, format: 'uint8-be'): string; +export function utf16toString(arr: Uint16Array | Uint8Array, format?: Utf16Format): string; + +/** + * Decode UTF-16 bytes to a string (loose mode) + * + * Replaces invalid UTF-16 byte sequences with replacement codepoints `U+FFFD` + * per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification. + * + * _Such replacement is a non-injective function, is irreversible and causes collisions.\ + * Prefer using strict throwing methods for cryptography applications._ + * + * Throws on non-even byte length. + * + * @param arr - The bytes to decode + * @param format - Input format (default: 'uint16') + * @returns The decoded string + */ +export function utf16toStringLoose(arr: Uint16Array, format?: 'uint16'): string; +export function utf16toStringLoose(arr: Uint8Array, format: 'uint8-le'): string; +export function utf16toStringLoose(arr: Uint8Array, format: 'uint8-be'): string; +export function utf16toStringLoose(arr: Uint16Array | Uint8Array, format?: Utf16Format): string; diff --git a/node_modules/@exodus/bytes/utf16.js b/node_modules/@exodus/bytes/utf16.js new file mode 100644 index 0000000000000000000000000000000000000000..3170fc094590ec0a876fe5f726a367cf601329dd --- /dev/null +++ b/node_modules/@exodus/bytes/utf16.js @@ -0,0 +1 @@ +export * from './utf16.native.js' diff --git a/node_modules/@exodus/bytes/utf16.native.js b/node_modules/@exodus/bytes/utf16.native.js new file mode 100644 index 0000000000000000000000000000000000000000..2d943570a391d391865d2c9d987daae47b10fb81 --- /dev/null +++ b/node_modules/@exodus/bytes/utf16.native.js @@ -0,0 +1,22 @@ +import { encodeApi, decodeApiDecoders, decodeApiJS } from './fallback/utf16.js' +import { nativeDecoder } from './fallback/platform.native.js' + +function checkDecoders() { + // Not all barebone engines with TextDecoder support something except utf-8 + // Also workerd specifically has a broken utf-16le implementation + if (!nativeDecoder) return false + try { + const a = new TextDecoder('utf-16le').decode(Uint8Array.of(1, 2, 3, 0xd8)) + const b = new TextDecoder('utf-16be').decode(Uint8Array.of(2, 1, 0xd8, 3)) + return a === b && a === '\u0201\uFFFD' + } catch {} + + return false +} + +const decode = checkDecoders() ? decodeApiDecoders : decodeApiJS + +export const utf16fromString = (str, format = 'uint16') => encodeApi(str, false, format) +export const utf16fromStringLoose = (str, format = 'uint16') => encodeApi(str, true, format) +export const utf16toString = (arr, format = 'uint16') => decode(arr, false, format) +export const utf16toStringLoose = (arr, format = 'uint16') => decode(arr, true, format) diff --git a/node_modules/@exodus/bytes/utf16.node.js b/node_modules/@exodus/bytes/utf16.node.js new file mode 100644 index 0000000000000000000000000000000000000000..54a407d6abb2022f1213117223bfcb77b9be6a76 --- /dev/null +++ b/node_modules/@exodus/bytes/utf16.node.js @@ -0,0 +1,71 @@ +import { assertU8, E_STRING, E_STRICT_UNICODE } from './fallback/_utils.js' +import { isDeno, isLE } from './fallback/platform.js' +import { E_STRICT, decodeApiDecoders } from './fallback/utf16.js' + +if (Buffer.TYPED_ARRAY_SUPPORT) throw new Error('Unexpected Buffer polyfill') + +const { isWellFormed, toWellFormed } = String.prototype +const to8 = (a) => new Uint8Array(a.buffer, a.byteOffset, a.byteLength) + +// Unlike utf8, operates on Uint16Arrays by default + +function encode(str, loose = false, format = 'uint16') { + if (typeof str !== 'string') throw new TypeError(E_STRING) + if (format !== 'uint16' && format !== 'uint8-le' && format !== 'uint8-be') { + throw new TypeError('Unknown format') + } + + if (loose) { + str = toWellFormed.call(str) // Buffer doesn't do this with utf16 encoding + } else if (!isWellFormed.call(str)) { + throw new TypeError(E_STRICT_UNICODE) + } + + const ble = Buffer.allocUnsafeSlow(str.length * 2) // non-pooled + ble.ucs2Write(str) + + if (format === 'uint8-le') return to8(ble) + if (format === 'uint8-be') return to8(ble.swap16()) + if (format === 'uint16') { + const b = ble.byteOffset % 2 === 0 ? ble : Buffer.from(ble) // it should be already aligned, but just in case + if (!isLE) b.swap16() + return new Uint16Array(b.buffer, b.byteOffset, b.byteLength / 2) + } + + /* c8 ignore next */ + throw new Error('Unreachable') +} + +// Convert to Buffer view or a swapped Buffer copy +const swapped = (x, swap) => { + const b = Buffer.from(x.buffer, x.byteOffset, x.byteLength) + return swap ? Buffer.from(b).swap16() : b +} + +// We skip TextDecoder on Node.js, as it's is somewhy significantly slower than Buffer for utf16 +// Also, it incorrectly misses replacements with Node.js is built without ICU, we fix that +function decodeNode(input, loose = false, format = 'uint16') { + let ble + if (format === 'uint16') { + if (!(input instanceof Uint16Array)) throw new TypeError('Expected an Uint16Array') + ble = swapped(input, !isLE) + } else if (format === 'uint8-le' || format === 'uint8-be') { + assertU8(input) + if (input.byteLength % 2 !== 0) throw new TypeError('Expected even number of bytes') + ble = swapped(input, format === 'uint8-be') + } else { + throw new TypeError('Unknown format') + } + + const str = ble.ucs2Slice(0, ble.byteLength) + if (loose) return toWellFormed.call(str) + if (isWellFormed.call(str)) return str + throw new TypeError(E_STRICT) +} + +const decode = isDeno ? decodeApiDecoders : decodeNode + +export const utf16fromString = (str, format = 'uint16') => encode(str, false, format) +export const utf16fromStringLoose = (str, format = 'uint16') => encode(str, true, format) +export const utf16toString = (arr, format = 'uint16') => decode(arr, false, format) +export const utf16toStringLoose = (arr, format = 'uint16') => decode(arr, true, format) diff --git a/node_modules/@exodus/bytes/utf8.d.ts b/node_modules/@exodus/bytes/utf8.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..091115a67db444e6e06699c2173b3ec3a2531d3b --- /dev/null +++ b/node_modules/@exodus/bytes/utf8.d.ts @@ -0,0 +1,98 @@ +/** + * UTF-8 encoding/decoding + * + * ```js + * import { utf8fromString, utf8toString } from '@exodus/bytes/utf8.js' + * + * // loose + * import { utf8fromStringLoose, utf8toStringLoose } from '@exodus/bytes/utf8.js' + * ``` + * + * _These methods by design encode/decode BOM (codepoint `U+FEFF` Byte Order Mark) as-is._\ + * _If you need BOM handling or detection, use `@exodus/bytes/encoding.js`_ + * + * @module @exodus/bytes/utf8.js + */ + +/// + +import type { OutputFormat, Uint8ArrayBuffer } from './array.js'; + +/** + * Encode a string to UTF-8 bytes (strict mode) + * + * Throws on invalid Unicode (unpaired surrogates) + * + * This is similar to the following snippet (but works on all engines): + * ```js + * // Strict encode, requiring Unicode codepoints to be valid + * if (typeof string !== 'string' || !string.isWellFormed()) throw new TypeError() + * return new TextEncoder().encode(string) + * ``` + * + * @param string - The string to encode + * @param format - Output format (default: 'uint8') + * @returns The encoded bytes + */ +export function utf8fromString(string: string, format?: 'uint8'): Uint8ArrayBuffer; +export function utf8fromString(string: string, format: 'arraybuffer'): ArrayBuffer; +export function utf8fromString(string: string, format: 'buffer'): Buffer; +export function utf8fromString(string: string, format?: OutputFormat): Uint8ArrayBuffer | ArrayBuffer | Buffer; + +/** + * Encode a string to UTF-8 bytes (loose mode) + * + * Replaces invalid Unicode (unpaired surrogates) with replacement codepoints `U+FFFD` + * per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification. + * + * _Such replacement is a non-injective function, is irreversable and causes collisions.\ + * Prefer using strict throwing methods for cryptography applications._ + * + * This is similar to the following snippet (but works on all engines): + * ```js + * // Loose encode, replacing invalid Unicode codepoints with U+FFFD + * if (typeof string !== 'string') throw new TypeError() + * return new TextEncoder().encode(string) + * ``` + * + * @param string - The string to encode + * @param format - Output format (default: 'uint8') + * @returns The encoded bytes + */ +export function utf8fromStringLoose(string: string, format?: 'uint8'): Uint8ArrayBuffer; +export function utf8fromStringLoose(string: string, format: 'arraybuffer'): ArrayBuffer; +export function utf8fromStringLoose(string: string, format: 'buffer'): Buffer; +export function utf8fromStringLoose( + string: string, + format?: OutputFormat +): Uint8ArrayBuffer | ArrayBuffer | Buffer; + +/** + * Decode UTF-8 bytes to a string (strict mode) + * + * Throws on invalid UTF-8 byte sequences + * + * This is similar to `new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(arr)`, + * but works on all engines. + * + * @param arr - The bytes to decode + * @returns The decoded string + */ +export function utf8toString(arr: Uint8Array): string; + +/** + * Decode UTF-8 bytes to a string (loose mode) + * + * Replaces invalid UTF-8 byte sequences with replacement codepoints `U+FFFD` + * per [WHATWG Encoding](https://encoding.spec.whatwg.org/) specification. + * + * _Such replacement is a non-injective function, is irreversable and causes collisions.\ + * Prefer using strict throwing methods for cryptography applications._ + * + * This is similar to `new TextDecoder('utf-8', { ignoreBOM: true }).decode(arr)`, + * but works on all engines. + * + * @param arr - The bytes to decode + * @returns The decoded string + */ +export function utf8toStringLoose(arr: Uint8Array): string; diff --git a/node_modules/@exodus/bytes/utf8.js b/node_modules/@exodus/bytes/utf8.js new file mode 100644 index 0000000000000000000000000000000000000000..3a46cb4183d46463a2d8bfaa9c7ab44a582a2344 --- /dev/null +++ b/node_modules/@exodus/bytes/utf8.js @@ -0,0 +1,65 @@ +import { assertU8, fromUint8, E_STRING, E_STRICT_UNICODE } from './fallback/_utils.js' +import { nativeDecoder, nativeEncoder } from './fallback/platform.js' +import * as js from './fallback/utf8.auto.js' + +// ignoreBOM: true means that BOM will be left as-is, i.e. will be present in the output +// We don't want to strip anything unexpectedly +const decoderLoose = nativeDecoder +const decoderFatal = nativeDecoder + ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) + : null +const { isWellFormed } = String.prototype + +function deLoose(str, loose, res) { + if (loose || str.length === res.length) return res // length is equal only for ascii, which is automatically fine + if (isWellFormed) { + // We have a fast native method + if (isWellFormed.call(str)) return res + throw new TypeError(E_STRICT_UNICODE) + } + + // Recheck if the string was encoded correctly + let start = 0 + const last = res.length - 3 + // Search for EFBFBD (3-byte sequence) + while (start <= last) { + const pos = res.indexOf(0xef, start) + if (pos === -1 || pos > last) break + start = pos + 1 + if (res[pos + 1] === 0xbf && res[pos + 2] === 0xbd) { + // Found a replacement char in output, need to recheck if we encoded the input correctly + if (js.decodeFast && !nativeDecoder && str.length < 1e7) { + // This is ~2x faster than decode in Hermes + try { + if (encodeURI(str) !== null) return res // guard against optimizing out + } catch {} + } else if (str === decode(res)) return res + throw new TypeError(E_STRICT_UNICODE) + } + } + + return res +} + +function encode(str, loose = false) { + if (typeof str !== 'string') throw new TypeError(E_STRING) + if (str.length === 0) return new Uint8Array() // faster than Uint8Array.of + if (nativeEncoder || !js.encode) return deLoose(str, loose, nativeEncoder.encode(str)) + // No reason to use unescape + encodeURIComponent: it's slower than JS on normal engines, and modern Hermes already has TextEncoder + return js.encode(str, loose) +} + +function decode(arr, loose = false) { + assertU8(arr) + if (arr.byteLength === 0) return '' + if (nativeDecoder || !js.decodeFast) { + return loose ? decoderLoose.decode(arr) : decoderFatal.decode(arr) // Node.js and browsers + } + + return js.decodeFast(arr, loose) +} + +export const utf8fromString = (str, format = 'uint8') => fromUint8(encode(str, false), format) +export const utf8fromStringLoose = (str, format = 'uint8') => fromUint8(encode(str, true), format) +export const utf8toString = (arr) => decode(arr, false) +export const utf8toStringLoose = (arr) => decode(arr, true) diff --git a/node_modules/@exodus/bytes/utf8.node.js b/node_modules/@exodus/bytes/utf8.node.js new file mode 100644 index 0000000000000000000000000000000000000000..a3de2727afc6a3e13dbfa035cec0799762e09e64 --- /dev/null +++ b/node_modules/@exodus/bytes/utf8.node.js @@ -0,0 +1,67 @@ +import { assertU8, fromBuffer, E_STRING, E_STRICT_UNICODE } from './fallback/_utils.js' +import { E_STRICT } from './fallback/utf8.js' +import { isAscii } from 'node:buffer' + +if (Buffer.TYPED_ARRAY_SUPPORT) throw new Error('Unexpected Buffer polyfill') + +let decoderFatal +const decoderLoose = new TextDecoder('utf-8', { ignoreBOM: true }) +const { isWellFormed } = String.prototype +const isDeno = !!globalThis.Deno + +try { + decoderFatal = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) +} catch { + // Without ICU, Node.js doesn't support fatal option for utf-8 +} + +function encode(str, loose, format) { + if (typeof str !== 'string') throw new TypeError(E_STRING) + const strLength = str.length + if (strLength === 0) return new Uint8Array() // faster than Uint8Array.of + let res + if (strLength > 0x4_00 && !isDeno) { + // Faster for large strings + const byteLength = Buffer.byteLength(str) + res = format === 'buffer' ? Buffer.allocUnsafe(byteLength) : Buffer.allocUnsafeSlow(byteLength) + const written = byteLength === strLength ? res.latin1Write(str) : res.utf8Write(str) + if (written !== byteLength) throw new Error('Failed to write all bytes') // safeguard just in case + } else { + res = Buffer.from(str) + } + + // Loose and ascii do not need the check + if (!loose && res.length !== strLength && !isWellFormed.call(str)) { + throw new TypeError(E_STRICT_UNICODE) + } + + return fromBuffer(res, format) +} + +function decode(arr, loose = false) { + assertU8(arr) + const byteLength = arr.byteLength + if (byteLength === 0) return '' + if (byteLength > 0x6_00 && !(isDeno && loose) && isAscii(arr)) { + // On non-ascii strings, this loses ~10% * [relative position of the first non-ascii byte] (up to 10% total) + // On ascii strings, this wins 1.5x on loose = false and 1.3x on loose = true + // Only makes sense for large enough strings + const buf = Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength) + if (isDeno) return buf.toString() // Deno suffers from .latin1Slice + return buf.latin1Slice(0, arr.byteLength) // .latin1Slice is faster than .asciiSlice + } + + if (loose) return decoderLoose.decode(arr) + if (decoderFatal) return decoderFatal.decode(arr) + + // We are in an env without native fatal decoder support (non-fixed Node.js without ICU) + // Well, just recheck against encode if it contains replacement then, this is still faster than js impl + const str = decoderLoose.decode(arr) + if (str.includes('\uFFFD') && !Buffer.from(str).equals(arr)) throw new TypeError(E_STRICT) + return str +} + +export const utf8fromString = (str, format = 'uint8') => encode(str, false, format) +export const utf8fromStringLoose = (str, format = 'uint8') => encode(str, true, format) +export const utf8toString = (arr) => decode(arr, false) +export const utf8toStringLoose = (arr) => decode(arr, true) diff --git a/node_modules/@exodus/bytes/whatwg.d.ts b/node_modules/@exodus/bytes/whatwg.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0bbed7b8d6b602340f14fe86ca8a0523c1f367c --- /dev/null +++ b/node_modules/@exodus/bytes/whatwg.d.ts @@ -0,0 +1,48 @@ +/** + * WHATWG helpers + * + * ```js + * import '@exodus/bytes/encoding.js' // For full legacy multi-byte encodings support + * import { percentEncodeAfterEncoding } from '@exodus/bytes/whatwg.js' + * ``` + * + * @module @exodus/bytes/whatwg.js + */ + +/** + * Implements [percent-encode after encoding](https://url.spec.whatwg.org/#string-percent-encode-after-encoding) + * per WHATWG URL specification. + * + * > [!IMPORTANT] + * > You must import `@exodus/bytes/encoding.js` for this API to accept legacy multi-byte encodings. + * + * Encodings `utf16-le`, `utf16-be`, and `replacement` are not accepted. + * + * [C0 control percent-encode set](https://url.spec.whatwg.org/#c0-control-percent-encode-set) is + * always percent-encoded. + * + * `percentEncodeSet` is an addition to that, and must be a string of unique increasing codepoints + * in range 0x20 - 0x7e, e.g. `' "#<>'`. + * + * This method accepts [DOMStrings](https://webidl.spec.whatwg.org/#idl-DOMString) and converts them + * to [USVStrings](https://webidl.spec.whatwg.org/#idl-USVString). + * This is different from e.g. `encodeURI` and `encodeURIComponent` which throw on surrogates: + * ```js + * > percentEncodeAfterEncoding('utf8', '\ud800', ' "#$%&+,/:;<=>?@[\\]^`{|}') // component + * '%EF%BF%BD' + * > encodeURIComponent('\ud800') + * Uncaught URIError: URI malformed + * ``` + * + * @param encoding - The encoding label per WHATWG Encoding spec + * @param input - Input scalar-value string to encode + * @param percentEncodeSet - A string of ASCII chars to escape in addition to C0 control percent-encode set + * @param spaceAsPlus - Whether to encode space as `'+'` instead of `'%20'` or `' '` (default: false) + * @returns The percent-encoded string + */ +export function percentEncodeAfterEncoding( + encoding: string, + input: string, + percentEncodeSet: string, + spaceAsPlus?: boolean +): string; diff --git a/node_modules/@exodus/bytes/whatwg.js b/node_modules/@exodus/bytes/whatwg.js new file mode 100644 index 0000000000000000000000000000000000000000..7f4d05ce96e90af89ea47bbf14c12e044ad79406 --- /dev/null +++ b/node_modules/@exodus/bytes/whatwg.js @@ -0,0 +1,80 @@ +import { utf8fromStringLoose } from '@exodus/bytes/utf8.js' +import { createSinglebyteEncoder } from '@exodus/bytes/single-byte.js' +import { + isMultibyte, + getMultibyteEncoder, + normalizeEncoding, + E_ENCODING, +} from './fallback/encoding.js' +import { percentEncoder } from './fallback/percent.js' +import { encodeMap } from './fallback/single-byte.js' +import { E_STRING } from './fallback/_utils.js' + +// https://url.spec.whatwg.org/#string-percent-encode-after-encoding +// Codepoints below 0x20, 0x7F specifically, and above 0x7F (non-ASCII) are always encoded +// > A C0 control is a code point in the range U+0000 NULL to U+001F INFORMATION SEPARATOR ONE, inclusive. +// > The C0 control percent-encode set are the C0 controls and all code points greater than U+007E (~). +export function percentEncodeAfterEncoding(encoding, input, percentEncodeSet, spaceAsPlus = false) { + const enc = normalizeEncoding(encoding) + // Ref: https://encoding.spec.whatwg.org/#get-an-encoder + if (!enc || enc === 'replacement' || enc === 'utf-16le' || enc === 'utf-16be') { + throw new RangeError(E_ENCODING) + } + + const percent = percentEncoder(percentEncodeSet, spaceAsPlus) + if (enc === 'utf-8') return percent(utf8fromStringLoose(input)) + + const multi = isMultibyte(enc) + const encoder = multi ? getMultibyteEncoder() : createSinglebyteEncoder + const fatal = encoder(enc) + try { + return percent(fatal(input)) + } catch {} + + let res = '' + let last = 0 + if (multi) { + const rep = enc === 'gb18030' ? percent(fatal('\uFFFD')) : `%26%23${0xff_fd}%3B` // only gb18030 can encode it + const escaping = encoder(enc, (cp, u, i) => { + res += percent(u, last, i) + res += cp >= 0xd8_00 && cp < 0xe0_00 ? rep : `%26%23${cp}%3B` // &#cp; + last = i + return 0 // no bytes emitted + }) + + const u = escaping(input) // has side effects on res + res += percent(u, last) + } else { + if (typeof input !== 'string') throw new TypeError(E_STRING) // all other paths have their own validation + const m = encodeMap(enc) + const len = input.length + const u = new Uint8Array(len) + for (let i = 0; i < len; i++) { + const x = input.charCodeAt(i) + const b = m[x] + if (!b && x) { + let cp = x + const i0 = i + if (x >= 0xd8_00 && x < 0xe0_00) { + cp = 0xff_fd + if (x < 0xdc_00 && i + 1 < len) { + const x1 = input.charCodeAt(i + 1) + if (x1 >= 0xdc_00 && x1 < 0xe0_00) { + cp = 0x1_00_00 + ((x1 & 0x3_ff) | ((x & 0x3_ff) << 10)) + i++ + } + } + } + + res += `${percent(u, last, i0)}%26%23${cp}%3B` // &#cp; + last = i + 1 // skip current + } else { + u[i] = b + } + } + + res += percent(u, last) + } + + return res +} diff --git a/node_modules/@exodus/bytes/wif.d.ts b/node_modules/@exodus/bytes/wif.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6e038a10afabbd8eba13424bffa6076d7d4c7e7a --- /dev/null +++ b/node_modules/@exodus/bytes/wif.d.ts @@ -0,0 +1,76 @@ +/** + * Wallet Import Format (WIF) encoding and decoding. + * + * ```js + * import { fromWifString, toWifString } from '@exodus/bytes/wif.js' + * import { fromWifStringSync, toWifStringSync } from '@exodus/bytes/wif.js' + * ``` + * + * On non-Node.js, requires peer dependency [@noble/hashes](https://www.npmjs.com/package/@noble/hashes) to be installed. + * + * @module @exodus/bytes/wif.js + */ + +/// + +import type { Uint8ArrayBuffer } from './array.js'; + +/** + * WIF (Wallet Import Format) data structure + */ +export interface Wif { + /** Network version byte */ + version: number; + /** 32-byte private key */ + privateKey: Uint8ArrayBuffer; + /** Whether the key is compressed */ + compressed: boolean; +} + +/** + * Decode a WIF string to WIF data + * + * Returns a promise that resolves to an object with `{ version, privateKey, compressed }`. + * + * The optional `version` parameter validates the version byte. + * + * Throws if the WIF string is invalid or version doesn't match. + * + * @param string - The WIF encoded string + * @param version - Optional expected version byte to validate against + * @returns The decoded WIF data + * @throws Error if the WIF string is invalid or version doesn't match + */ +export function fromWifString(string: string, version?: number): Promise; + +/** + * Decode a WIF string to WIF data (synchronous) + * + * Returns an object with `{ version, privateKey, compressed }`. + * + * The optional `version` parameter validates the version byte. + * + * Throws if the WIF string is invalid or version doesn't match. + * + * @param string - The WIF encoded string + * @param version - Optional expected version byte to validate against + * @returns The decoded WIF data + * @throws Error if the WIF string is invalid or version doesn't match + */ +export function fromWifStringSync(string: string, version?: number): Wif; + +/** + * Encode WIF data to a WIF string + * + * @param wif - The WIF data to encode + * @returns The WIF encoded string + */ +export function toWifString(wif: Wif): Promise; + +/** + * Encode WIF data to a WIF string (synchronous) + * + * @param wif - The WIF data to encode + * @returns The WIF encoded string + */ +export function toWifStringSync(wif: Wif): string; diff --git a/node_modules/@exodus/bytes/wif.js b/node_modules/@exodus/bytes/wif.js new file mode 100644 index 0000000000000000000000000000000000000000..690477ea4d3bac124bb31e0bf564c13b5cbf090c --- /dev/null +++ b/node_modules/@exodus/bytes/wif.js @@ -0,0 +1,41 @@ +import { toBase58checkSync, fromBase58checkSync } from '@exodus/bytes/base58check.js' +import { assertUint8 } from './assert.js' + +// Mostly matches npmjs.com/wif, but with extra checks + using our base58check +// Also no inconsistent behavior on Buffer/Uint8Array input + +function from(arr, expectedVersion) { + assertUint8(arr) + if (arr.length !== 33 && arr.length !== 34) throw new Error('Invalid WIF length') + const version = arr[0] + if (expectedVersion !== undefined && version !== expectedVersion) { + throw new Error('Invalid network version') + } + + // Makes a copy, regardless of input being a Buffer or a Uint8Array (unlike .slice) + const privateKey = Uint8Array.from(arr.subarray(1, 33)) + if (arr.length === 33) return { version, privateKey, compressed: false } + if (arr[33] !== 1) throw new Error('Invalid compression flag') + return { version, privateKey, compressed: true } +} + +function to({ version: v, privateKey, compressed }) { + if (!Number.isSafeInteger(v) || v < 0 || v > 0xff) throw new Error('Missing or invalid version') + assertUint8(privateKey, { length: 32, name: 'privateKey' }) + const out = new Uint8Array(compressed ? 34 : 33) + out[0] = v + out.set(privateKey, 1) + if (compressed) out[33] = 1 + return out +} + +// Async performance is worse here, so expose the same internal methods as sync for now +// ./base58check is sync internally anyway for now, so doesn't matter until that is changed + +export const fromWifStringSync = (string, version) => from(fromBase58checkSync(string), version) +// export const fromWifString = async (string, version) => from(await fromBase58check(string), version) +export const fromWifString = async (string, version) => from(fromBase58checkSync(string), version) + +export const toWifStringSync = (wif) => toBase58checkSync(to(wif)) +// export const toWifString = async (wif) => toBase58check(to(wif)) +export const toWifString = async (wif) => toBase58checkSync(to(wif)) diff --git a/node_modules/@hexagon/base64/LICENSE b/node_modules/@hexagon/base64/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..92787a9ca50978551715bf5914137d50704b0924 --- /dev/null +++ b/node_modules/@hexagon/base64/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2021-2022 Hexagon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/@hexagon/base64/README.md b/node_modules/@hexagon/base64/README.md new file mode 100644 index 0000000000000000000000000000000000000000..46eb1a1f60513d718f934f8988aa047cfbf1865b --- /dev/null +++ b/node_modules/@hexagon/base64/README.md @@ -0,0 +1,69 @@ +

+ @hexagon/base64
+
Probably the only JavaScript base64 library you'll ever need!
+

+ +# @hexagon/base64 + +Encode, decode and validate base64/base64url to string/arraybuffer and vice-versa. Works in Node, Deno and browser. + +[![Node.js CI](https://github.com/Hexagon/base64/actions/workflows/node.js.yml/badge.svg)](https://github.com/Hexagon/base64/actions/workflows/node.js.yml) [![Deno CI](https://github.com/Hexagon/base64/actions/workflows/deno.yml/badge.svg)](https://github.com/Hexagon/base64/actions/workflows/deno.yml) +[![npm version](https://badge.fury.io/js/@hexagon%2Fbase64.svg)](https://badge.fury.io/js/@hexagon%2Fbase64) [![NPM Downloads](https://img.shields.io/npm/dm/@hexagon/base64.svg)](https://www.npmjs.org/package/@hexagon/base64) [![jsdelivr](https://data.jsdelivr.com/v1/package/npm/@hexagon/base64/badge?style=rounded)](https://www.jsdelivr.com/package/npm/@hexagon/base64) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4978bdbf495941c087ecb32b120f28ff)](https://www.codacy.com/gh/Hexagon/base64/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Hexagon/base64&utm_campaign=Badge_Grade) +[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Hexagon/base64/blob/master/LICENSE) + +* Supports regular base64 and base64url +* Convert to/from string or arraybuffer +* Validate / identify base64 and base64url +* Works in Node.js >=4.0 (both require and import). +* Works in Deno >=1.16. +* Works in browsers as standalone, UMD or ES-module. +* Includes [TypeScript](https://www.typescriptlang.org/) typings. + + +```javascript +// Encode string as regular base64 +const example1enc = base64.fromString("Hellรถ Wรถrld, how are you doing today?!"); +console.log(example1enc); +// > SGVsbMO2IFfDtnJsZCwgaG93IGFyZSB5b3UgZG9pbmcgdG9kYXk/IQ== + +// Decode string as regular base64 +const example1dec = base64.toString("SGVsbMO2IFfDtnJsZCwgaG93IGFyZSB5b3UgZG9pbmcgdG9kYXk/IQ=="); +console.log(example1dec); +// > Hellรถ Wรถrld, how are you doing today?! +``` + +Full documentation available at [base64.56k.guru](https://base64.56k.guru) + +## Quick Installation + +Node.js: `npm install @hexagon/base64 --save` + +Deno: `import base64 from "https://deno.land/x/b64@1.1.28/src/base64.js";` + +For browser/cdn usage, refer to the documentation. + +### Quick API + + - __fromArrayBuffer(buffer, urlMode)__ - Encodes `ArrayBuffer` into base64 or base64url if urlMode(optional) is true + - __toArrayBuffer(str, urlMode)__ - Decodes base64url string (or base64url string if urlMode is true) to `ArrayBuffer` + + - __fromString(str, urlMode)__ - Encodes `String` into base64 string(base64url string if urlMode is true) + - __toString(str, urlMode)__ - Decodes base64 or base64url string to `String` + +- __validate(str, urlMode)__ - Returns true if `String` str is valid base64/base64 dependending on urlMode + +## Contributing + +See [Contribution Guide](https://base64.56k.guru/contributing.html) + +## Donations + +If you found this library helpful and wish to support its development, consider making a donation through [Hexagon's GitHub Sponsors page](https://github.com/sponsors/hexagon). Your generosity ensures the library's continued development and maintenance. + +### Contributors + +The underlying code is loosely based on [github.com/niklasvh/base64-arraybuffer](https://github.com/niklasvh/base64-arraybuffer) + +## License + +MIT diff --git a/node_modules/@hexagon/base64/SECURITY.md b/node_modules/@hexagon/base64/SECURITY.md new file mode 100644 index 0000000000000000000000000000000000000000..315b843c4fdbc4e32acbb564e3962e739214df43 --- /dev/null +++ b/node_modules/@hexagon/base64/SECURITY.md @@ -0,0 +1,12 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | +| ------- | ------------------ | +| 4.0.x | :white_check_mark: | +| < 4.0 | :x: | + +## Reporting a Vulnerability + +Email hexagon@56k.guru. Do NOT report an issue, we will have a look at it asap. diff --git a/node_modules/@hexagon/base64/dist/base64.cjs b/node_modules/@hexagon/base64/dist/base64.cjs new file mode 100644 index 0000000000000000000000000000000000000000..a3276d454e5d9c729e5ef6714a1842c7a94c483e --- /dev/null +++ b/node_modules/@hexagon/base64/dist/base64.cjs @@ -0,0 +1,198 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.base64 = factory()); +})(this, (function () { 'use strict'; + + /* ------------------------------------------------------------------------------------ + + base64 - MIT License - Hexagon + + ------------------------------------------------------------------------------------ + + License: + + Copyright (c) 2021 Hexagon + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + ------------------------------------------------------------------------------------ */ + + const + // Regular base64 characters + chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", + + // Base64url characters + charsUrl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", + + genLookup = (target) => { + const lookupTemp = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256); + const len = chars.length; + for (let i = 0; i < len; i++) { + lookupTemp[target.charCodeAt(i)] = i; + } + return lookupTemp; + }, + + // Use a lookup table to find the index. + lookup = genLookup(chars), + lookupUrl = genLookup(charsUrl); + + /** + * Pre-calculated regexes for validating base64 and base64url + */ + const base64UrlPattern = /^[-A-Za-z0-9\-_]*$/; + const base64Pattern = /^[-A-Za-z0-9+/]*={0,3}$/; + + /** + * @namespace base64 + */ + const base64 = {}; + + /** + * Convenience function for converting a base64 encoded string to an ArrayBuffer instance + * @public + * + * @param {string} data - Base64 representation of data + * @param {boolean} [urlMode] - If set to true, URL mode string will be expected + * @returns {ArrayBuffer} - Decoded data + */ + base64.toArrayBuffer = (data, urlMode) => { + const + len = data.length; + let bufferLength = data.length * 0.75, + i, + p = 0, + encoded1, + encoded2, + encoded3, + encoded4; + + if (data[data.length - 1] === "=") { + bufferLength--; + if (data[data.length - 2] === "=") { + bufferLength--; + } + } + + const + arraybuffer = new ArrayBuffer(bufferLength), + bytes = new Uint8Array(arraybuffer), + target = urlMode ? lookupUrl : lookup; + + for (i = 0; i < len; i += 4) { + encoded1 = target[data.charCodeAt(i)]; + encoded2 = target[data.charCodeAt(i + 1)]; + encoded3 = target[data.charCodeAt(i + 2)]; + encoded4 = target[data.charCodeAt(i + 3)]; + + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); + } + + return arraybuffer; + + }; + + /** + * Convenience function for creating a base64 encoded string from an ArrayBuffer instance + * @public + * + * @param {ArrayBuffer} arrBuf - ArrayBuffer to be encoded + * @param {boolean} [urlMode] - If set to true, URL mode string will be returned + * @returns {string} - Base64 representation of data + */ + base64.fromArrayBuffer = (arrBuf, urlMode) => { + const bytes = new Uint8Array(arrBuf); + let + i, + result = ""; + + const + len = bytes.length, + target = urlMode ? charsUrl : chars; + + for (i = 0; i < len; i += 3) { + result += target[bytes[i] >> 2]; + result += target[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; + result += target[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; + result += target[bytes[i + 2] & 63]; + } + + const remainder = len % 3; + if (remainder === 2) { + result = result.substring(0, result.length - 1) + (urlMode ? "" : "="); + } else if (remainder === 1) { + result = result.substring(0, result.length - 2) + (urlMode ? "" : "=="); + } + + return result; + + }; + + /** + * Convenience function for converting base64 to string + * @public + * + * @param {string} str - Base64 encoded string to be decoded + * @param {boolean} [urlMode] - If set to true, URL mode string will be expected + * @returns {string} - Decoded string + */ + base64.toString = (str, urlMode) => { + return new TextDecoder().decode(base64.toArrayBuffer(str, urlMode)); + }; + + /** + * Convenience function for converting a javascript string to base64 + * @public + * + * @param {string} str - String to be converted to base64 + * @param {boolean} [urlMode] - If set to true, URL mode string will be returned + * @returns {string} - Base64 encoded string + */ + base64.fromString = (str, urlMode) => { + return base64.fromArrayBuffer(new TextEncoder().encode(str), urlMode); + }; + + /** + * Function to validate base64 + * @public + * @param {string} encoded - Base64 or Base64url encoded data + * @param {boolean} [urlMode] - If set to true, base64url will be expected + * @returns {boolean} - Valid base64/base64url? + */ + base64.validate = (encoded, urlMode) => { + + // Bail out if not string + if (!(typeof encoded === "string" || encoded instanceof String)) { + return false; + } + + // Go on validate + try { + return urlMode ? base64UrlPattern.test(encoded) : base64Pattern.test(encoded); + } catch (_e) { + return false; + } + }; + + base64.base64 = base64; + + return base64; + +})); diff --git a/node_modules/@hexagon/base64/dist/base64.min.js b/node_modules/@hexagon/base64/dist/base64.min.js new file mode 100644 index 0000000000000000000000000000000000000000..361148c206ef82c5034107f17721bb2cbb062d6c --- /dev/null +++ b/node_modules/@hexagon/base64/dist/base64.min.js @@ -0,0 +1 @@ +(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,global.base64=factory())})(this,function(){"use strict";const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",charsUrl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",genLookup=target=>{const lookupTemp=typeof Uint8Array==="undefined"?[]:new Uint8Array(256);const len=chars.length;for(let i=0;i{const len=data.length;let bufferLength=data.length*.75,i,p=0,encoded1,encoded2,encoded3,encoded4;if(data[data.length-1]==="="){bufferLength--;if(data[data.length-2]==="="){bufferLength--}}const arraybuffer=new ArrayBuffer(bufferLength),bytes=new Uint8Array(arraybuffer),target=urlMode?lookupUrl:lookup;for(i=0;i>4;bytes[p++]=(encoded2&15)<<4|encoded3>>2;bytes[p++]=(encoded3&3)<<6|encoded4&63}return arraybuffer};base64.fromArrayBuffer=(arrBuf,urlMode)=>{const bytes=new Uint8Array(arrBuf);let i,result="";const len=bytes.length,target=urlMode?charsUrl:chars;for(i=0;i>2];result+=target[(bytes[i]&3)<<4|bytes[i+1]>>4];result+=target[(bytes[i+1]&15)<<2|bytes[i+2]>>6];result+=target[bytes[i+2]&63]}const remainder=len%3;if(remainder===2){result=result.substring(0,result.length-1)+(urlMode?"":"=")}else if(remainder===1){result=result.substring(0,result.length-2)+(urlMode?"":"==")}return result};base64.toString=(str,urlMode)=>{return(new TextDecoder).decode(base64.toArrayBuffer(str,urlMode))};base64.fromString=(str,urlMode)=>{return base64.fromArrayBuffer((new TextEncoder).encode(str),urlMode)};base64.validate=(encoded,urlMode)=>{if(!(typeof encoded==="string"||encoded instanceof String)){return false}try{return urlMode?base64UrlPattern.test(encoded):base64Pattern.test(encoded)}catch(_e){return false}};base64.base64=base64;return base64}); \ No newline at end of file diff --git a/node_modules/@hexagon/base64/dist/base64.min.js.map b/node_modules/@hexagon/base64/dist/base64.min.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f11926428d5f46756d11f44232911c4295fd4ada --- /dev/null +++ b/node_modules/@hexagon/base64/dist/base64.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["dist/base64.cjs"],"names":["global","factory","exports","module","define","amd","globalThis","self","base64","this","chars","charsUrl","genLookup","lookupTemp","Uint8Array","len","length","let","i","target","charCodeAt","lookup","lookupUrl","base64UrlPattern","base64Pattern","toArrayBuffer","data","urlMode","bufferLength","p","encoded1","encoded2","encoded3","encoded4","arraybuffer","ArrayBuffer","bytes","fromArrayBuffer","arrBuf","result","remainder","substring","toString","str","TextDecoder","decode","fromString","TextEncoder","encode","validate","encoded","String","test","_e"],"mappings":"CAAA,SAAWA,OAAQC,SAClB,OAAOC,UAAY,UAAY,OAAOC,SAAW,YAAcA,OAAOD,QAAUD,QAAQ,EACxF,OAAOG,SAAW,YAAcA,OAAOC,IAAMD,OAAOH,OAAO,GAC1DD,OAAS,OAAOM,aAAe,YAAcA,WAAaN,QAAUO,KAAMP,OAAOQ,OAASP,QAAQ,EACnG,GAAEQ,KAAM,WAAe,aA8BvB,MAECC,MAAQ,mEAGRC,SAAW,mEAEXC,UAAY,SACX,MAAMC,WAAa,OAAOC,aAAe,YAAc,GAAK,IAAIA,WAAW,GAAG,EAC9E,MAAMC,IAAML,MAAMM,OAClB,IAAKC,IAAIC,EAAI,EAAGA,EAAIH,IAAKG,CAAC,GAAI,CAC7BL,WAAWM,OAAOC,WAAWF,CAAC,GAAKA,CACpC,CACA,OAAOL,UACR,EAGAQ,OAAST,UAAUF,KAAK,EACxBY,UAAYV,UAAUD,QAAQ,EAK/B,MAAMY,iBAAmB,qBACzB,MAAMC,cAAgB,0BAKtB,MAAMhB,OAAS,GAUfA,OAAOiB,cAAgB,CAACC,KAAMC,WAC7B,MACCZ,IAAMW,KAAKV,OACZC,IAAIW,aAAeF,KAAKV,OAAS,IAChCE,EACAW,EAAI,EACJC,SACAC,SACAC,SACAC,SAED,GAAIP,KAAKA,KAAKV,OAAS,KAAO,IAAK,CAClCY,YAAY,G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3BD,OAASA,OAAOE,UAAU,EAAGF,OAAOvB,OAAS,CAAC,GAAKW,QAAU,GAAK,KACnE,CAEA,OAAOY,MAER,EAUA/B,OAAOkC,SAAW,CAACC,IAAKhB,WACvB,OAAO,IAAIiB,aAAcC,OAAOrC,OAAOiB,cAAckB,IAAKhB,OAAO,CAAC,CACnE,EAUAnB,OAAOsC,WAAa,CAACH,IAAKhB,WACzB,OAAOnB,OAAO6B,iBAAgB,IAAIU,aAAcC,OAAOL,GAAG,EAAGhB,OAAO,CACrE,EASAnB,OAAOyC,SAAW,CAACC,QAASvB,WAG3B,GAAI,EAAE,OAAOuB,UAAY,UAAYA,mBAAmBC,QAAS,CAChE,OAAO,KACR,CAGA,IACC,OAAOxB,QAAUJ,iBAAiB6B,KAAKF,OAAO,EAAI1B,cAAc4B,KAAKF,OAAO,CAG7E,CAFE,MAAOG,IACR,OAAO,KACR,CACD,EAEA7C,OAAOA,OAASA,OAEhB,OAAOA,MAEP,CAAC"} \ No newline at end of file diff --git a/node_modules/@hexagon/base64/dist/base64.min.mjs b/node_modules/@hexagon/base64/dist/base64.min.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7fa07b57f2b75dc06fd311f83bb36913747ccf59 --- /dev/null +++ b/node_modules/@hexagon/base64/dist/base64.min.mjs @@ -0,0 +1 @@ +const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",charsUrl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",genLookup=target=>{const lookupTemp=typeof Uint8Array==="undefined"?[]:new Uint8Array(256);const len=chars.length;for(let i=0;i{const len=data.length;let bufferLength=data.length*.75,i,p=0,encoded1,encoded2,encoded3,encoded4;if(data[data.length-1]==="="){bufferLength--;if(data[data.length-2]==="="){bufferLength--}}const arraybuffer=new ArrayBuffer(bufferLength),bytes=new Uint8Array(arraybuffer),target=urlMode?lookupUrl:lookup;for(i=0;i>4;bytes[p++]=(encoded2&15)<<4|encoded3>>2;bytes[p++]=(encoded3&3)<<6|encoded4&63}return arraybuffer};base64.fromArrayBuffer=(arrBuf,urlMode)=>{const bytes=new Uint8Array(arrBuf);let i,result="";const len=bytes.length,target=urlMode?charsUrl:chars;for(i=0;i>2];result+=target[(bytes[i]&3)<<4|bytes[i+1]>>4];result+=target[(bytes[i+1]&15)<<2|bytes[i+2]>>6];result+=target[bytes[i+2]&63]}const remainder=len%3;if(remainder===2){result=result.substring(0,result.length-1)+(urlMode?"":"=")}else if(remainder===1){result=result.substring(0,result.length-2)+(urlMode?"":"==")}return result};base64.toString=(str,urlMode)=>{return(new TextDecoder).decode(base64.toArrayBuffer(str,urlMode))};base64.fromString=(str,urlMode)=>{return base64.fromArrayBuffer((new TextEncoder).encode(str),urlMode)};base64.validate=(encoded,urlMode)=>{if(!(typeof encoded==="string"||encoded instanceof String)){return false}try{return urlMode?base64UrlPattern.test(encoded):base64Pattern.test(encoded)}catch(_e){return false}};base64.base64=base64;export{base64,base64 as default}; \ No newline at end of file diff --git a/node_modules/@hexagon/base64/dist/base64.min.mjs.map b/node_modules/@hexagon/base64/dist/base64.min.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..f19f5ff5b78d645ed049b066c059d2e944f023d1 --- /dev/null +++ b/node_modules/@hexagon/base64/dist/base64.min.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["dist/base64.mjs"],"names":["chars","charsUrl","genLookup","lookupTemp","Uint8Array","len","length","let","i","target","charCodeAt","lookup","lookupUrl","base64UrlPattern","base64Pattern","base64","toArrayBuffer","data","urlMode","bufferLength","p","encoded1","encoded2","encoded3","encoded4","arraybuffer","ArrayBuffer","bytes","fromArrayBuffer","arrBuf","result","remainder","substring","toString","str","TextDecoder","decode","fromString","TextEncoder","encode","validate","encoded","String","test","_e"],"mappings":"AA4BA,MAECA,MAAQ,mEAGRC,SAAW,mEAEXC,UAAY,SACX,MAAMC,WAAa,OAAOC,aAAe,YAAc,GAAK,IAAIA,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G,OAASS,QAAUjB,SAAWD,MAE/B,IAAKQ,EAAI,EAAGA,EAAIH,IAAKG,GAAK,EAAG,CAC5BsB,QAAUrB,OAAOkB,MAAMnB,IAAM,GAC7BsB,QAAUrB,QAASkB,MAAMnB,GAAK,IAAM,EAAMmB,MAAMnB,EAAI,IAAM,GAC1DsB,QAAUrB,QAASkB,MAAMnB,EAAI,GAAK,KAAO,EAAMmB,MAAMnB,EAAI,IAAM,GAC/DsB,QAAUrB,OAAOkB,MAAMnB,EAAI,GAAK,GACjC,CAEA,MAAMuB,UAAY1B,IAAM,EACxB,GAAI0B,YAAc,EAAG,CACpBD,OAASA,OAAOE,UAAU,EAAGF,OAAOxB,OAAS,CAAC,GAAKY,QAAU,GAAK,IACnE,MAAO,GAAIa,YAAc,EAAG,CAC3BD,OAASA,OAAOE,UAAU,EAAGF,OAAOxB,OAAS,CAAC,GAAKY,QAAU,GAAK,KACnE,CAEA,OAAOY,MAER,EAUAf,OAAOkB,SAAW,CAACC,IAAKhB,WACvB,OAAO,IAAIiB,aAAcC,OAAOrB,OAAOC,cAAckB,IAAKhB,OAAO,CAAC,CACnE,EAUAH,OAAOsB,WAAa,CAACH,IAAKhB,WACzB,OAAOH,OAAOa,iBAAgB,IAAIU,aAAcC,OAAOL,GAAG,EAAGhB,OAAO,CACrE,EASAH,OAAOyB,SAAW,CAACC,QAASvB,WAG3B,GAAI,EAAE,OAAOuB,UAAY,UAAYA,mBAAmBC,QAAS,CAChE,OAAO,KACR,CAGA,IACC,OAAOxB,QAAUL,iBAAiB8B,KAAKF,OAAO,EAAI3B,cAAc6B,KAAKF,OAAO,CAG7E,CAFE,MAAOG,IACR,OAAO,KACR,CACD,EAEA7B,OAAOA,OAASA,cAEPA,OAAQA,iBAAmB"} \ No newline at end of file diff --git a/node_modules/@hexagon/base64/package.json b/node_modules/@hexagon/base64/package.json new file mode 100644 index 0000000000000000000000000000000000000000..cb62241befa0d0e76ebf64194683b2c4d3e9c035 --- /dev/null +++ b/node_modules/@hexagon/base64/package.json @@ -0,0 +1,73 @@ +{ + "name": "@hexagon/base64", + "version": "1.1.28", + "description": "Base64 and base64url to string or arraybuffer, and back. Node, Deno or browser.", + "author": "Hexagon ", + "contributors": [ + { + "name": "Niklas von Hertzen", + "email": "niklasvh@gmail.com", + "url": "https://hertzen.com" + } + ], + "homepage": "https://base64.56k.guru", + "repository": { + "type": "git", + "url": "https://github.com/hexagon/base64" + }, + "bugs": { + "url": "https://github.com/hexagon/base64/issues" + }, + "files": [ + "dist/*", + "src/*", + "types/*", + "SECURITY.md" + ], + "keywords": [ + "base64", + "base64url", + "parser", + "base64", + "isomorphic", + "arraybuffer", + "string" + ], + "scripts": { + "test": "uvu test test.base64.js", + "test:dist": "uvu test/node/js && npm run test:ts", + "test:coverage": "c8 --include=src npm test", + "test:lint": "eslint ./**/*.js ./**/*.cjs", + "test:lint:fix": "eslint --fix ./**/*.js ./**/*.cjs", + "test:ts": "tsc --strict --noEmit ./test/node/ts/basics.ts", + "build": "npm update && npm run build:precleanup && npm run test:lint && npm run build:typings && npm run build:dist && npm run build:minify && npm run build:cleanup && npm run test:coverage && npm run test:dist", + "build:ci": "npm run test:lint && npm run build:typings && npm run build:dist && npm run build:minify && npm run build:cleanup && npm run test:coverage && npm run test:dist", + "build:precleanup": "(rm -rf types/* || del /Q types\\*) && (rm -rf dist/* || del /Q dist\\*)", + "build:dist": "rollup -c ./rollup.config.js", + "build:minify": "uglifyjs dist/base64.cjs --source-map -o dist/base64.min.js && uglifyjs dist/base64.mjs --source-map -o dist/base64.min.mjs", + "build:typings": "tsc", + "build:cleanup": "(rm dist/base64.mjs || del dist\\base64.mjs)" + }, + "type": "module", + "main": "./dist/base64.cjs", + "browser": "./dist/base64.min.js", + "module": "./src/base64.js", + "types": "types/base64.single.d.ts", + "exports": { + ".": { + "import": "./src/base64.js", + "require": "./dist/base64.cjs", + "browser": "./dist/base64.min.js" + } + }, + "devDependencies": { + "c8": "^8.0.1", + "eslint": "^8.46.0", + "jsdoc": "^4.0.2", + "rollup": "^3.27.2", + "typescript": "^5.2.2", + "uglify-js": "^3.17.4", + "uvu": "^0.5.6" + }, + "license": "MIT" +} diff --git a/node_modules/@hexagon/base64/src/base64.js b/node_modules/@hexagon/base64/src/base64.js new file mode 100644 index 0000000000000000000000000000000000000000..449e9d2b8277ca80f1a458a195835fac1e1e25e3 --- /dev/null +++ b/node_modules/@hexagon/base64/src/base64.js @@ -0,0 +1,190 @@ +/* ------------------------------------------------------------------------------------ + + base64 - MIT License - Hexagon + + ------------------------------------------------------------------------------------ + + License: + + Copyright (c) 2021 Hexagon + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + ------------------------------------------------------------------------------------ */ + +const + // Regular base64 characters + chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", + + // Base64url characters + charsUrl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", + + genLookup = (target) => { + const lookupTemp = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256); + const len = chars.length; + for (let i = 0; i < len; i++) { + lookupTemp[target.charCodeAt(i)] = i; + } + return lookupTemp; + }, + + // Use a lookup table to find the index. + lookup = genLookup(chars), + lookupUrl = genLookup(charsUrl); + +/** + * Pre-calculated regexes for validating base64 and base64url + */ +const base64UrlPattern = /^[-A-Za-z0-9\-_]*$/; +const base64Pattern = /^[-A-Za-z0-9+/]*={0,3}$/; + +/** + * @namespace base64 + */ +const base64 = {}; + +/** + * Convenience function for converting a base64 encoded string to an ArrayBuffer instance + * @public + * + * @param {string} data - Base64 representation of data + * @param {boolean} [urlMode] - If set to true, URL mode string will be expected + * @returns {ArrayBuffer} - Decoded data + */ +base64.toArrayBuffer = (data, urlMode) => { + const + len = data.length; + let bufferLength = data.length * 0.75, + i, + p = 0, + encoded1, + encoded2, + encoded3, + encoded4; + + if (data[data.length - 1] === "=") { + bufferLength--; + if (data[data.length - 2] === "=") { + bufferLength--; + } + } + + const + arraybuffer = new ArrayBuffer(bufferLength), + bytes = new Uint8Array(arraybuffer), + target = urlMode ? lookupUrl : lookup; + + for (i = 0; i < len; i += 4) { + encoded1 = target[data.charCodeAt(i)]; + encoded2 = target[data.charCodeAt(i + 1)]; + encoded3 = target[data.charCodeAt(i + 2)]; + encoded4 = target[data.charCodeAt(i + 3)]; + + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); + } + + return arraybuffer; + +}; + +/** + * Convenience function for creating a base64 encoded string from an ArrayBuffer instance + * @public + * + * @param {ArrayBuffer} arrBuf - ArrayBuffer to be encoded + * @param {boolean} [urlMode] - If set to true, URL mode string will be returned + * @returns {string} - Base64 representation of data + */ +base64.fromArrayBuffer = (arrBuf, urlMode) => { + const bytes = new Uint8Array(arrBuf); + let + i, + result = ""; + + const + len = bytes.length, + target = urlMode ? charsUrl : chars; + + for (i = 0; i < len; i += 3) { + result += target[bytes[i] >> 2]; + result += target[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; + result += target[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; + result += target[bytes[i + 2] & 63]; + } + + const remainder = len % 3; + if (remainder === 2) { + result = result.substring(0, result.length - 1) + (urlMode ? "" : "="); + } else if (remainder === 1) { + result = result.substring(0, result.length - 2) + (urlMode ? "" : "=="); + } + + return result; + +}; + +/** + * Convenience function for converting base64 to string + * @public + * + * @param {string} str - Base64 encoded string to be decoded + * @param {boolean} [urlMode] - If set to true, URL mode string will be expected + * @returns {string} - Decoded string + */ +base64.toString = (str, urlMode) => { + return new TextDecoder().decode(base64.toArrayBuffer(str, urlMode)); +}; + +/** + * Convenience function for converting a javascript string to base64 + * @public + * + * @param {string} str - String to be converted to base64 + * @param {boolean} [urlMode] - If set to true, URL mode string will be returned + * @returns {string} - Base64 encoded string + */ +base64.fromString = (str, urlMode) => { + return base64.fromArrayBuffer(new TextEncoder().encode(str), urlMode); +}; + +/** + * Function to validate base64 + * @public + * @param {string} encoded - Base64 or Base64url encoded data + * @param {boolean} [urlMode] - If set to true, base64url will be expected + * @returns {boolean} - Valid base64/base64url? + */ +base64.validate = (encoded, urlMode) => { + + // Bail out if not string + if (!(typeof encoded === "string" || encoded instanceof String)) { + return false; + } + + // Go on validate + try { + return urlMode ? base64UrlPattern.test(encoded) : base64Pattern.test(encoded); + } catch (_e) { + return false; + } +}; + +base64.base64 = base64; +export default base64; +export { base64 }; \ No newline at end of file diff --git a/node_modules/@hexagon/base64/src/base64.single.js b/node_modules/@hexagon/base64/src/base64.single.js new file mode 100644 index 0000000000000000000000000000000000000000..cd6b3215fc24cd20506a6e555369a7353571804f --- /dev/null +++ b/node_modules/@hexagon/base64/src/base64.single.js @@ -0,0 +1,3 @@ +import base64 from "./base64.js"; + +export default base64; \ No newline at end of file diff --git a/node_modules/@hexagon/base64/types/base64.d.ts b/node_modules/@hexagon/base64/types/base64.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..17f83436f97b8a310d6158ffe0a2c018a5e17cf5 --- /dev/null +++ b/node_modules/@hexagon/base64/types/base64.d.ts @@ -0,0 +1,48 @@ +export default base64; +export namespace base64 { + /** + * Convenience function for converting a base64 encoded string to an ArrayBuffer instance + * @public + * + * @param {string} data - Base64 representation of data + * @param {boolean} [urlMode] - If set to true, URL mode string will be expected + * @returns {ArrayBuffer} - Decoded data + */ + export function toArrayBuffer(data: string, urlMode?: boolean): ArrayBuffer; + /** + * Convenience function for creating a base64 encoded string from an ArrayBuffer instance + * @public + * + * @param {ArrayBuffer} arrBuf - ArrayBuffer to be encoded + * @param {boolean} [urlMode] - If set to true, URL mode string will be returned + * @returns {string} - Base64 representation of data + */ + export function fromArrayBuffer(arrBuf: ArrayBuffer, urlMode?: boolean): string; + /** + * Convenience function for converting base64 to string + * @public + * + * @param {string} str - Base64 encoded string to be decoded + * @param {boolean} [urlMode] - If set to true, URL mode string will be expected + * @returns {string} - Decoded string + */ + export function toString(str: string, urlMode?: boolean): string; + /** + * Convenience function for converting a javascript string to base64 + * @public + * + * @param {string} str - String to be converted to base64 + * @param {boolean} [urlMode] - If set to true, URL mode string will be returned + * @returns {string} - Base64 encoded string + */ + export function fromString(str: string, urlMode?: boolean): string; + /** + * Function to validate base64 + * @public + * @param {string} encoded - Base64 or Base64url encoded data + * @param {boolean} [urlMode] - If set to true, base64url will be expected + * @returns {boolean} - Valid base64/base64url? + */ + export function validate(encoded: string, urlMode?: boolean): boolean; + export { base64 }; +} diff --git a/node_modules/@hexagon/base64/types/base64.single.d.ts b/node_modules/@hexagon/base64/types/base64.single.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6f08cbf8d658305c9327e7b79e35ff3c389557b3 --- /dev/null +++ b/node_modules/@hexagon/base64/types/base64.single.d.ts @@ -0,0 +1,2 @@ +export default base64; +import base64 from "./base64.js"; diff --git a/node_modules/@hono/node-server/LICENSE b/node_modules/@hono/node-server/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..5f84afaffca9d97354629d65996ae21c316782c0 --- /dev/null +++ b/node_modules/@hono/node-server/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 - present, Yusuke Wada and Hono contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@hono/node-server/README.md b/node_modules/@hono/node-server/README.md new file mode 100644 index 0000000000000000000000000000000000000000..af0e9311a077b9b72fa2e368fa837598b8b36aaa --- /dev/null +++ b/node_modules/@hono/node-server/README.md @@ -0,0 +1,358 @@ +# Node.js Adapter for Hono + +This adapter `@hono/node-server` allows you to run your Hono application on Node.js. +Initially, Hono wasn't designed for Node.js, but with this adapter, you can now use Hono on Node.js. +It utilizes web standard APIs implemented in Node.js version 18 or higher. + +## Benchmarks + +Hono is 3.5 times faster than Express. + +Express: + +```txt +$ bombardier -d 10s --fasthttp http://localhost:3000/ + +Statistics Avg Stdev Max + Reqs/sec 16438.94 1603.39 19155.47 + Latency 7.60ms 7.51ms 559.89ms + HTTP codes: + 1xx - 0, 2xx - 164494, 3xx - 0, 4xx - 0, 5xx - 0 + others - 0 + Throughput: 4.55MB/s +``` + +Hono + `@hono/node-server`: + +```txt +$ bombardier -d 10s --fasthttp http://localhost:3000/ + +Statistics Avg Stdev Max + Reqs/sec 58296.56 5512.74 74403.56 + Latency 2.14ms 1.46ms 190.92ms + HTTP codes: + 1xx - 0, 2xx - 583059, 3xx - 0, 4xx - 0, 5xx - 0 + others - 0 + Throughput: 12.56MB/s +``` + +## Requirements + +It works on Node.js versions greater than 18.x. The specific required Node.js versions are as follows: + +- 18.x => 18.14.1+ +- 19.x => 19.7.0+ +- 20.x => 20.0.0+ + +Essentially, you can simply use the latest version of each major release. + +## Installation + +You can install it from the npm registry with `npm` command: + +```sh +npm install @hono/node-server +``` + +Or use `yarn`: + +```sh +yarn add @hono/node-server +``` + +## Usage + +Just import `@hono/node-server` at the top and write the code as usual. +The same code that runs on Cloudflare Workers, Deno, and Bun will work. + +```ts +import { serve } from '@hono/node-server' +import { Hono } from 'hono' + +const app = new Hono() +app.get('/', (c) => c.text('Hono meets Node.js')) + +serve(app, (info) => { + console.log(`Listening on http://localhost:${info.port}`) // Listening on http://localhost:3000 +}) +``` + +For example, run it using `ts-node`. Then an HTTP server will be launched. The default port is `3000`. + +```sh +ts-node ./index.ts +``` + +Open `http://localhost:3000` with your browser. + +## Options + +### `port` + +```ts +serve({ + fetch: app.fetch, + port: 8787, // Port number, default is 3000 +}) +``` + +### `createServer` + +```ts +import { createServer } from 'node:https' +import fs from 'node:fs' + +//... + +serve({ + fetch: app.fetch, + createServer: createServer, + serverOptions: { + key: fs.readFileSync('test/fixtures/keys/agent1-key.pem'), + cert: fs.readFileSync('test/fixtures/keys/agent1-cert.pem'), + }, +}) +``` + +### `overrideGlobalObjects` + +The default value is `true`. The Node.js Adapter rewrites the global Request/Response and uses a lightweight Request/Response to improve performance. If you don't want to do that, set `false`. + +```ts +serve({ + fetch: app.fetch, + overrideGlobalObjects: false, +}) +``` + +### `autoCleanupIncoming` + +The default value is `true`. The Node.js Adapter automatically cleans up (explicitly call `destroy()` method) if application is not finished to consume the incoming request. If you don't want to do that, set `false`. + +If the application accepts connections from arbitrary clients, this cleanup must be done otherwise incomplete requests from clients may cause the application to stop responding. If your application only accepts connections from trusted clients, such as in a reverse proxy environment and there is no process that returns a response without reading the body of the POST request all the way through, you can improve performance by setting it to `false`. + +```ts +serve({ + fetch: app.fetch, + autoCleanupIncoming: false, +}) +``` + +## Middleware + +Most built-in middleware also works with Node.js. +Read [the documentation](https://hono.dev/middleware/builtin/basic-auth) and use the Middleware of your liking. + +```ts +import { serve } from '@hono/node-server' +import { Hono } from 'hono' +import { prettyJSON } from 'hono/pretty-json' + +const app = new Hono() + +app.get('*', prettyJSON()) +app.get('/', (c) => c.json({ 'Hono meets': 'Node.js' })) + +serve(app) +``` + +## Serve Static Middleware + +Use Serve Static Middleware that has been created for Node.js. + +```ts +import { serveStatic } from '@hono/node-server/serve-static' + +//... + +app.use('/static/*', serveStatic({ root: './' })) +``` + +If using a relative path, `root` will be relative to the current working directory from which the app was started. + +This can cause confusion when running your application locally. + +Imagine your project structure is: + +``` +my-hono-project/ + src/ + index.ts + static/ + index.html +``` + +Typically, you would run your app from the project's root directory (`my-hono-project`), +so you would need the following code to serve the `static` folder: + +```ts +app.use('/static/*', serveStatic({ root: './static' })) +``` + +Notice that `root` here is not relative to `src/index.ts`, rather to `my-hono-project`. + +### Options + +#### `rewriteRequestPath` + +If you want to serve files in `./.foojs` with the request path `/__foo/*`, you can write like the following. + +```ts +app.use( + '/__foo/*', + serveStatic({ + root: './.foojs/', + rewriteRequestPath: (path: string) => path.replace(/^\/__foo/, ''), + }) +) +``` + +#### `onFound` + +You can specify handling when the requested file is found with `onFound`. + +```ts +app.use( + '/static/*', + serveStatic({ + // ... + onFound: (_path, c) => { + c.header('Cache-Control', `public, immutable, max-age=31536000`) + }, + }) +) +``` + +#### `onNotFound` + +The `onNotFound` is useful for debugging. You can write a handle for when a file is not found. + +```ts +app.use( + '/static/*', + serveStatic({ + root: './non-existent-dir', + onNotFound: (path, c) => { + console.log(`${path} is not found, request to ${c.req.path}`) + }, + }) +) +``` + +#### `precompressed` + +The `precompressed` option checks if files with extensions like `.br` or `.gz` are available and serves them based on the `Accept-Encoding` header. It prioritizes Brotli, then Zstd, and Gzip. If none are available, it serves the original file. + +```ts +app.use( + '/static/*', + serveStatic({ + precompressed: true, + }) +) +``` + +## ConnInfo Helper + +You can use the [ConnInfo Helper](https://hono.dev/docs/helpers/conninfo) by importing `getConnInfo` from `@hono/node-server/conninfo`. + +```ts +import { getConnInfo } from '@hono/node-server/conninfo' + +app.get('/', (c) => { + const info = getConnInfo(c) // info is `ConnInfo` + return c.text(`Your remote address is ${info.remote.address}`) +}) +``` + +## Accessing Node.js API + +You can access the Node.js API from `c.env` in Node.js. For example, if you want to specify a type, you can write the following. + +```ts +import { serve } from '@hono/node-server' +import type { HttpBindings } from '@hono/node-server' +import { Hono } from 'hono' + +const app = new Hono<{ Bindings: HttpBindings }>() + +app.get('/', (c) => { + return c.json({ + remoteAddress: c.env.incoming.socket.remoteAddress, + }) +}) + +serve(app) +``` + +The APIs that you can get from `c.env` are as follows. + +```ts +type HttpBindings = { + incoming: IncomingMessage + outgoing: ServerResponse +} + +type Http2Bindings = { + incoming: Http2ServerRequest + outgoing: Http2ServerResponse +} +``` + +## Direct response from Node.js API + +You can directly respond to the client from the Node.js API. +In that case, the response from Hono should be ignored, so return `RESPONSE_ALREADY_SENT`. + +> [!NOTE] +> This feature can be used when migrating existing Node.js applications to Hono, but we recommend using Hono's API for new applications. + +```ts +import { serve } from '@hono/node-server' +import type { HttpBindings } from '@hono/node-server' +import { RESPONSE_ALREADY_SENT } from '@hono/node-server/utils/response' +import { Hono } from 'hono' + +const app = new Hono<{ Bindings: HttpBindings }>() + +app.get('/', (c) => { + const { outgoing } = c.env + outgoing.writeHead(200, { 'Content-Type': 'text/plain' }) + outgoing.end('Hello World\n') + + return RESPONSE_ALREADY_SENT +}) + +serve(app) +``` + +## Listen to a UNIX domain socket + +You can configure the HTTP server to listen to a UNIX domain socket instead of a TCP port. + +```ts +import { createAdaptorServer } from '@hono/node-server' + +// ... + +const socketPath = '/tmp/example.sock' + +const server = createAdaptorServer(app) +server.listen(socketPath, () => { + console.log(`Listening on ${socketPath}`) +}) +``` + +## Related projects + +- Hono - +- Hono GitHub repository - + +## Authors + +- Yusuke Wada +- Taku Amano + +## License + +MIT diff --git a/node_modules/@hono/node-server/dist/conninfo.d.mts b/node_modules/@hono/node-server/dist/conninfo.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4c756d13985dd0794c11f8c150843b0dae919996 --- /dev/null +++ b/node_modules/@hono/node-server/dist/conninfo.d.mts @@ -0,0 +1,10 @@ +import { GetConnInfo } from 'hono/conninfo'; + +/** + * ConnInfo Helper for Node.js + * @param c Context + * @returns ConnInfo + */ +declare const getConnInfo: GetConnInfo; + +export { getConnInfo }; diff --git a/node_modules/@hono/node-server/dist/conninfo.d.ts b/node_modules/@hono/node-server/dist/conninfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4c756d13985dd0794c11f8c150843b0dae919996 --- /dev/null +++ b/node_modules/@hono/node-server/dist/conninfo.d.ts @@ -0,0 +1,10 @@ +import { GetConnInfo } from 'hono/conninfo'; + +/** + * ConnInfo Helper for Node.js + * @param c Context + * @returns ConnInfo + */ +declare const getConnInfo: GetConnInfo; + +export { getConnInfo }; diff --git a/node_modules/@hono/node-server/dist/conninfo.js b/node_modules/@hono/node-server/dist/conninfo.js new file mode 100644 index 0000000000000000000000000000000000000000..131934dbccf7d5addf46bcb2b6c1db5782d8f51c --- /dev/null +++ b/node_modules/@hono/node-server/dist/conninfo.js @@ -0,0 +1,42 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/conninfo.ts +var conninfo_exports = {}; +__export(conninfo_exports, { + getConnInfo: () => getConnInfo +}); +module.exports = __toCommonJS(conninfo_exports); +var getConnInfo = (c) => { + const bindings = c.env.server ? c.env.server : c.env; + const address = bindings.incoming.socket.remoteAddress; + const port = bindings.incoming.socket.remotePort; + const family = bindings.incoming.socket.remoteFamily; + return { + remote: { + address, + port, + addressType: family === "IPv4" ? "IPv4" : family === "IPv6" ? "IPv6" : void 0 + } + }; +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + getConnInfo +}); diff --git a/node_modules/@hono/node-server/dist/conninfo.mjs b/node_modules/@hono/node-server/dist/conninfo.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ab3cc95ba17a6750c270dac0f24021b4bfed2af7 --- /dev/null +++ b/node_modules/@hono/node-server/dist/conninfo.mjs @@ -0,0 +1,17 @@ +// src/conninfo.ts +var getConnInfo = (c) => { + const bindings = c.env.server ? c.env.server : c.env; + const address = bindings.incoming.socket.remoteAddress; + const port = bindings.incoming.socket.remotePort; + const family = bindings.incoming.socket.remoteFamily; + return { + remote: { + address, + port, + addressType: family === "IPv4" ? "IPv4" : family === "IPv6" ? "IPv6" : void 0 + } + }; +}; +export { + getConnInfo +}; diff --git a/node_modules/@hono/node-server/dist/globals.d.mts b/node_modules/@hono/node-server/dist/globals.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..223e65e89e5605c9bd8dc28e102c4f31074dec8a --- /dev/null +++ b/node_modules/@hono/node-server/dist/globals.d.mts @@ -0,0 +1,2 @@ + +export { } diff --git a/node_modules/@hono/node-server/dist/globals.d.ts b/node_modules/@hono/node-server/dist/globals.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..223e65e89e5605c9bd8dc28e102c4f31074dec8a --- /dev/null +++ b/node_modules/@hono/node-server/dist/globals.d.ts @@ -0,0 +1,2 @@ + +export { } diff --git a/node_modules/@hono/node-server/dist/globals.js b/node_modules/@hono/node-server/dist/globals.js new file mode 100644 index 0000000000000000000000000000000000000000..4704d2c0013e2be77df54c2b7fcfa1eb4ac16768 --- /dev/null +++ b/node_modules/@hono/node-server/dist/globals.js @@ -0,0 +1,29 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); + +// src/globals.ts +var import_node_crypto = __toESM(require("crypto")); +if (typeof global.crypto === "undefined") { + global.crypto = import_node_crypto.default; +} diff --git a/node_modules/@hono/node-server/dist/globals.mjs b/node_modules/@hono/node-server/dist/globals.mjs new file mode 100644 index 0000000000000000000000000000000000000000..45daa06f687188fcda43914209336e174975ff05 --- /dev/null +++ b/node_modules/@hono/node-server/dist/globals.mjs @@ -0,0 +1,5 @@ +// src/globals.ts +import crypto from "crypto"; +if (typeof global.crypto === "undefined") { + global.crypto = crypto; +} diff --git a/node_modules/@hono/node-server/dist/index.d.mts b/node_modules/@hono/node-server/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b9f383b1f7d79093cd41e3456a2861df0fdb99f8 --- /dev/null +++ b/node_modules/@hono/node-server/dist/index.d.mts @@ -0,0 +1,8 @@ +export { createAdaptorServer, serve } from './server.mjs'; +export { getRequestListener } from './listener.mjs'; +export { RequestError } from './request.mjs'; +export { Http2Bindings, HttpBindings, ServerType } from './types.mjs'; +import 'node:net'; +import 'node:http'; +import 'node:http2'; +import 'node:https'; diff --git a/node_modules/@hono/node-server/dist/index.d.ts b/node_modules/@hono/node-server/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a03b52a291f9e7c240c5cca5b72a76e97e51fa7 --- /dev/null +++ b/node_modules/@hono/node-server/dist/index.d.ts @@ -0,0 +1,8 @@ +export { createAdaptorServer, serve } from './server.js'; +export { getRequestListener } from './listener.js'; +export { RequestError } from './request.js'; +export { Http2Bindings, HttpBindings, ServerType } from './types.js'; +import 'node:net'; +import 'node:http'; +import 'node:http2'; +import 'node:https'; diff --git a/node_modules/@hono/node-server/dist/index.js b/node_modules/@hono/node-server/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..35f72a956727fde717972442a9ad9cd079717d5f --- /dev/null +++ b/node_modules/@hono/node-server/dist/index.js @@ -0,0 +1,702 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/index.ts +var src_exports = {}; +__export(src_exports, { + RequestError: () => RequestError, + createAdaptorServer: () => createAdaptorServer, + getRequestListener: () => getRequestListener, + serve: () => serve +}); +module.exports = __toCommonJS(src_exports); + +// src/server.ts +var import_node_http = require("http"); + +// src/listener.ts +var import_node_http22 = require("http2"); + +// src/request.ts +var import_node_http2 = require("http2"); +var import_node_stream = require("stream"); +var RequestError = class extends Error { + constructor(message, options) { + super(message, options); + this.name = "RequestError"; + } +}; +var toRequestError = (e) => { + if (e instanceof RequestError) { + return e; + } + return new RequestError(e.message, { cause: e }); +}; +var GlobalRequest = global.Request; +var Request = class extends GlobalRequest { + constructor(input, options) { + if (typeof input === "object" && getRequestCache in input) { + input = input[getRequestCache](); + } + if (typeof options?.body?.getReader !== "undefined") { + ; + options.duplex ??= "half"; + } + super(input, options); + } +}; +var newHeadersFromIncoming = (incoming) => { + const headerRecord = []; + const rawHeaders = incoming.rawHeaders; + for (let i = 0; i < rawHeaders.length; i += 2) { + const { [i]: key, [i + 1]: value } = rawHeaders; + if (key.charCodeAt(0) !== /*:*/ + 58) { + headerRecord.push([key, value]); + } + } + return new Headers(headerRecord); +}; +var wrapBodyStream = Symbol("wrapBodyStream"); +var newRequestFromIncoming = (method, url, headers, incoming, abortController) => { + const init = { + method, + headers, + signal: abortController.signal + }; + if (method === "TRACE") { + init.method = "GET"; + const req = new Request(url, init); + Object.defineProperty(req, "method", { + get() { + return "TRACE"; + } + }); + return req; + } + if (!(method === "GET" || method === "HEAD")) { + if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) { + init.body = new ReadableStream({ + start(controller) { + controller.enqueue(incoming.rawBody); + controller.close(); + } + }); + } else if (incoming[wrapBodyStream]) { + let reader; + init.body = new ReadableStream({ + async pull(controller) { + try { + reader ||= import_node_stream.Readable.toWeb(incoming).getReader(); + const { done, value } = await reader.read(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + } catch (error) { + controller.error(error); + } + } + }); + } else { + init.body = import_node_stream.Readable.toWeb(incoming); + } + } + return new Request(url, init); +}; +var getRequestCache = Symbol("getRequestCache"); +var requestCache = Symbol("requestCache"); +var incomingKey = Symbol("incomingKey"); +var urlKey = Symbol("urlKey"); +var headersKey = Symbol("headersKey"); +var abortControllerKey = Symbol("abortControllerKey"); +var getAbortController = Symbol("getAbortController"); +var requestPrototype = { + get method() { + return this[incomingKey].method || "GET"; + }, + get url() { + return this[urlKey]; + }, + get headers() { + return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]); + }, + [getAbortController]() { + this[getRequestCache](); + return this[abortControllerKey]; + }, + [getRequestCache]() { + this[abortControllerKey] ||= new AbortController(); + return this[requestCache] ||= newRequestFromIncoming( + this.method, + this[urlKey], + this.headers, + this[incomingKey], + this[abortControllerKey] + ); + } +}; +[ + "body", + "bodyUsed", + "cache", + "credentials", + "destination", + "integrity", + "mode", + "redirect", + "referrer", + "referrerPolicy", + "signal", + "keepalive" +].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + get() { + return this[getRequestCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + value: function() { + return this[getRequestCache]()[k](); + } + }); +}); +Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + method: this.method, + url: this.url, + headers: this.headers, + nativeRequest: this[requestCache] + }; + return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(requestPrototype, Request.prototype); +var newRequest = (incoming, defaultHostname) => { + const req = Object.create(requestPrototype); + req[incomingKey] = incoming; + const incomingUrl = incoming.url || ""; + if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL. + (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) { + if (incoming instanceof import_node_http2.Http2ServerRequest) { + throw new RequestError("Absolute URL for :path is not allowed in HTTP/2"); + } + try { + const url2 = new URL(incomingUrl); + req[urlKey] = url2.href; + } catch (e) { + throw new RequestError("Invalid absolute URL", { cause: e }); + } + return req; + } + const host = (incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname; + if (!host) { + throw new RequestError("Missing host header"); + } + let scheme; + if (incoming instanceof import_node_http2.Http2ServerRequest) { + scheme = incoming.scheme; + if (!(scheme === "http" || scheme === "https")) { + throw new RequestError("Unsupported scheme"); + } + } else { + scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http"; + } + const url = new URL(`${scheme}://${host}${incomingUrl}`); + if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) { + throw new RequestError("Invalid host header"); + } + req[urlKey] = url.href; + return req; +}; + +// src/response.ts +var responseCache = Symbol("responseCache"); +var getResponseCache = Symbol("getResponseCache"); +var cacheKey = Symbol("cache"); +var GlobalResponse = global.Response; +var Response2 = class _Response { + #body; + #init; + [getResponseCache]() { + delete this[cacheKey]; + return this[responseCache] ||= new GlobalResponse(this.#body, this.#init); + } + constructor(body, init) { + let headers; + this.#body = body; + if (init instanceof _Response) { + const cachedGlobalResponse = init[responseCache]; + if (cachedGlobalResponse) { + this.#init = cachedGlobalResponse; + this[getResponseCache](); + return; + } else { + this.#init = init.#init; + headers = new Headers(init.#init.headers); + } + } else { + this.#init = init; + } + if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) { + ; + this[cacheKey] = [init?.status || 200, body, headers || init?.headers]; + } + } + get headers() { + const cache = this[cacheKey]; + if (cache) { + if (!(cache[2] instanceof Headers)) { + cache[2] = new Headers( + cache[2] || { "content-type": "text/plain; charset=UTF-8" } + ); + } + return cache[2]; + } + return this[getResponseCache]().headers; + } + get status() { + return this[cacheKey]?.[0] ?? this[getResponseCache]().status; + } + get ok() { + const status = this.status; + return status >= 200 && status < 300; + } +}; +["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + get() { + return this[getResponseCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + value: function() { + return this[getResponseCache]()[k](); + } + }); +}); +Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + status: this.status, + headers: this.headers, + ok: this.ok, + nativeResponse: this[responseCache] + }; + return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(Response2, GlobalResponse); +Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype); + +// src/utils.ts +async function readWithoutBlocking(readPromise) { + return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]); +} +function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) { + const cancel = (error) => { + reader.cancel(error).catch(() => { + }); + }; + writable.on("close", cancel); + writable.on("error", cancel); + (currentReadPromise ?? reader.read()).then(flow, handleStreamError); + return reader.closed.finally(() => { + writable.off("close", cancel); + writable.off("error", cancel); + }); + function handleStreamError(error) { + if (error) { + writable.destroy(error); + } + } + function onDrain() { + reader.read().then(flow, handleStreamError); + } + function flow({ done, value }) { + try { + if (done) { + writable.end(); + } else if (!writable.write(value)) { + writable.once("drain", onDrain); + } else { + return reader.read().then(flow, handleStreamError); + } + } catch (e) { + handleStreamError(e); + } + } +} +function writeFromReadableStream(stream, writable) { + if (stream.locked) { + throw new TypeError("ReadableStream is locked."); + } else if (writable.destroyed) { + return; + } + return writeFromReadableStreamDefaultReader(stream.getReader(), writable); +} +var buildOutgoingHttpHeaders = (headers) => { + const res = {}; + if (!(headers instanceof Headers)) { + headers = new Headers(headers ?? void 0); + } + const cookies = []; + for (const [k, v] of headers) { + if (k === "set-cookie") { + cookies.push(v); + } else { + res[k] = v; + } + } + if (cookies.length > 0) { + res["set-cookie"] = cookies; + } + res["content-type"] ??= "text/plain; charset=UTF-8"; + return res; +}; + +// src/utils/response/constants.ts +var X_ALREADY_SENT = "x-hono-already-sent"; + +// src/globals.ts +var import_node_crypto = __toESM(require("crypto")); +if (typeof global.crypto === "undefined") { + global.crypto = import_node_crypto.default; +} + +// src/listener.ts +var outgoingEnded = Symbol("outgoingEnded"); +var incomingDraining = Symbol("incomingDraining"); +var DRAIN_TIMEOUT_MS = 500; +var MAX_DRAIN_BYTES = 64 * 1024 * 1024; +var drainIncoming = (incoming) => { + const incomingWithDrainState = incoming; + if (incoming.destroyed || incomingWithDrainState[incomingDraining]) { + return; + } + incomingWithDrainState[incomingDraining] = true; + if (incoming instanceof import_node_http22.Http2ServerRequest) { + try { + ; + incoming.stream?.close?.(import_node_http22.constants.NGHTTP2_NO_ERROR); + } catch { + } + return; + } + let bytesRead = 0; + const cleanup = () => { + clearTimeout(timer); + incoming.off("data", onData); + incoming.off("end", cleanup); + incoming.off("error", cleanup); + }; + const forceClose = () => { + cleanup(); + const socket = incoming.socket; + if (socket && !socket.destroyed) { + socket.destroySoon(); + } + }; + const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS); + timer.unref?.(); + const onData = (chunk) => { + bytesRead += chunk.length; + if (bytesRead > MAX_DRAIN_BYTES) { + forceClose(); + } + }; + incoming.on("data", onData); + incoming.on("end", cleanup); + incoming.on("error", cleanup); + incoming.resume(); +}; +var handleRequestError = () => new Response(null, { + status: 400 +}); +var handleFetchError = (e) => new Response(null, { + status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 +}); +var handleResponseError = (e, outgoing) => { + const err = e instanceof Error ? e : new Error("unknown error", { cause: e }); + if (err.code === "ERR_STREAM_PREMATURE_CLOSE") { + console.info("The user aborted a request."); + } else { + console.error(e); + if (!outgoing.headersSent) { + outgoing.writeHead(500, { "Content-Type": "text/plain" }); + } + outgoing.end(`Error: ${err.message}`); + outgoing.destroy(err); + } +}; +var flushHeaders = (outgoing) => { + if ("flushHeaders" in outgoing && outgoing.writable) { + outgoing.flushHeaders(); + } +}; +var responseViaCache = async (res, outgoing) => { + let [status, body, header] = res[cacheKey]; + let hasContentLength = false; + if (!header) { + header = { "content-type": "text/plain; charset=UTF-8" }; + } else if (header instanceof Headers) { + hasContentLength = header.has("content-length"); + header = buildOutgoingHttpHeaders(header); + } else if (Array.isArray(header)) { + const headerObj = new Headers(header); + hasContentLength = headerObj.has("content-length"); + header = buildOutgoingHttpHeaders(headerObj); + } else { + for (const key in header) { + if (key.length === 14 && key.toLowerCase() === "content-length") { + hasContentLength = true; + break; + } + } + } + if (!hasContentLength) { + if (typeof body === "string") { + header["Content-Length"] = Buffer.byteLength(body); + } else if (body instanceof Uint8Array) { + header["Content-Length"] = body.byteLength; + } else if (body instanceof Blob) { + header["Content-Length"] = body.size; + } + } + outgoing.writeHead(status, header); + if (typeof body === "string" || body instanceof Uint8Array) { + outgoing.end(body); + } else if (body instanceof Blob) { + outgoing.end(new Uint8Array(await body.arrayBuffer())); + } else { + flushHeaders(outgoing); + await writeFromReadableStream(body, outgoing)?.catch( + (e) => handleResponseError(e, outgoing) + ); + } + ; + outgoing[outgoingEnded]?.(); +}; +var isPromise = (res) => typeof res.then === "function"; +var responseViaResponseObject = async (res, outgoing, options = {}) => { + if (isPromise(res)) { + if (options.errorHandler) { + try { + res = await res; + } catch (err) { + const errRes = await options.errorHandler(err); + if (!errRes) { + return; + } + res = errRes; + } + } else { + res = await res.catch(handleFetchError); + } + } + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + const resHeaderRecord = buildOutgoingHttpHeaders(res.headers); + if (res.body) { + const reader = res.body.getReader(); + const values = []; + let done = false; + let currentReadPromise = void 0; + if (resHeaderRecord["transfer-encoding"] !== "chunked") { + let maxReadCount = 2; + for (let i = 0; i < maxReadCount; i++) { + currentReadPromise ||= reader.read(); + const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => { + console.error(e); + done = true; + }); + if (!chunk) { + if (i === 1) { + await new Promise((resolve) => setTimeout(resolve)); + maxReadCount = 3; + continue; + } + break; + } + currentReadPromise = void 0; + if (chunk.value) { + values.push(chunk.value); + } + if (chunk.done) { + done = true; + break; + } + } + if (done && !("content-length" in resHeaderRecord)) { + resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0); + } + } + outgoing.writeHead(res.status, resHeaderRecord); + values.forEach((value) => { + ; + outgoing.write(value); + }); + if (done) { + outgoing.end(); + } else { + if (values.length === 0) { + flushHeaders(outgoing); + } + await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise); + } + } else if (resHeaderRecord[X_ALREADY_SENT]) { + } else { + outgoing.writeHead(res.status, resHeaderRecord); + outgoing.end(); + } + ; + outgoing[outgoingEnded]?.(); +}; +var getRequestListener = (fetchCallback, options = {}) => { + const autoCleanupIncoming = options.autoCleanupIncoming ?? true; + if (options.overrideGlobalObjects !== false && global.Request !== Request) { + Object.defineProperty(global, "Request", { + value: Request + }); + Object.defineProperty(global, "Response", { + value: Response2 + }); + } + return async (incoming, outgoing) => { + let res, req; + try { + req = newRequest(incoming, options.hostname); + let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD"; + if (!incomingEnded) { + ; + incoming[wrapBodyStream] = true; + incoming.on("end", () => { + incomingEnded = true; + }); + if (incoming instanceof import_node_http22.Http2ServerRequest) { + ; + outgoing[outgoingEnded] = () => { + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }; + } + outgoing.on("finish", () => { + if (!incomingEnded) { + drainIncoming(incoming); + } + }); + } + outgoing.on("close", () => { + const abortController = req[abortControllerKey]; + if (abortController) { + if (incoming.errored) { + req[abortControllerKey].abort(incoming.errored.toString()); + } else if (!outgoing.writableFinished) { + req[abortControllerKey].abort("Client connection prematurely closed."); + } + } + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }); + res = fetchCallback(req, { incoming, outgoing }); + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + } catch (e) { + if (!res) { + if (options.errorHandler) { + res = await options.errorHandler(req ? e : toRequestError(e)); + if (!res) { + return; + } + } else if (!req) { + res = handleRequestError(); + } else { + res = handleFetchError(e); + } + } else { + return handleResponseError(e, outgoing); + } + } + try { + return await responseViaResponseObject(res, outgoing, options); + } catch (e) { + return handleResponseError(e, outgoing); + } + }; +}; + +// src/server.ts +var createAdaptorServer = (options) => { + const fetchCallback = options.fetch; + const requestListener = getRequestListener(fetchCallback, { + hostname: options.hostname, + overrideGlobalObjects: options.overrideGlobalObjects, + autoCleanupIncoming: options.autoCleanupIncoming + }); + const createServer = options.createServer || import_node_http.createServer; + const server = createServer(options.serverOptions || {}, requestListener); + return server; +}; +var serve = (options, listeningListener) => { + const server = createAdaptorServer(options); + server.listen(options?.port ?? 3e3, options.hostname, () => { + const serverInfo = server.address(); + listeningListener && listeningListener(serverInfo); + }); + return server; +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + RequestError, + createAdaptorServer, + getRequestListener, + serve +}); diff --git a/node_modules/@hono/node-server/dist/index.mjs b/node_modules/@hono/node-server/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4a699b73eb1ce21581aa5dd426e1870cb0723070 --- /dev/null +++ b/node_modules/@hono/node-server/dist/index.mjs @@ -0,0 +1,662 @@ +// src/server.ts +import { createServer as createServerHTTP } from "http"; + +// src/listener.ts +import { Http2ServerRequest as Http2ServerRequest2, constants as h2constants } from "http2"; + +// src/request.ts +import { Http2ServerRequest } from "http2"; +import { Readable } from "stream"; +var RequestError = class extends Error { + constructor(message, options) { + super(message, options); + this.name = "RequestError"; + } +}; +var toRequestError = (e) => { + if (e instanceof RequestError) { + return e; + } + return new RequestError(e.message, { cause: e }); +}; +var GlobalRequest = global.Request; +var Request = class extends GlobalRequest { + constructor(input, options) { + if (typeof input === "object" && getRequestCache in input) { + input = input[getRequestCache](); + } + if (typeof options?.body?.getReader !== "undefined") { + ; + options.duplex ??= "half"; + } + super(input, options); + } +}; +var newHeadersFromIncoming = (incoming) => { + const headerRecord = []; + const rawHeaders = incoming.rawHeaders; + for (let i = 0; i < rawHeaders.length; i += 2) { + const { [i]: key, [i + 1]: value } = rawHeaders; + if (key.charCodeAt(0) !== /*:*/ + 58) { + headerRecord.push([key, value]); + } + } + return new Headers(headerRecord); +}; +var wrapBodyStream = Symbol("wrapBodyStream"); +var newRequestFromIncoming = (method, url, headers, incoming, abortController) => { + const init = { + method, + headers, + signal: abortController.signal + }; + if (method === "TRACE") { + init.method = "GET"; + const req = new Request(url, init); + Object.defineProperty(req, "method", { + get() { + return "TRACE"; + } + }); + return req; + } + if (!(method === "GET" || method === "HEAD")) { + if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) { + init.body = new ReadableStream({ + start(controller) { + controller.enqueue(incoming.rawBody); + controller.close(); + } + }); + } else if (incoming[wrapBodyStream]) { + let reader; + init.body = new ReadableStream({ + async pull(controller) { + try { + reader ||= Readable.toWeb(incoming).getReader(); + const { done, value } = await reader.read(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + } catch (error) { + controller.error(error); + } + } + }); + } else { + init.body = Readable.toWeb(incoming); + } + } + return new Request(url, init); +}; +var getRequestCache = Symbol("getRequestCache"); +var requestCache = Symbol("requestCache"); +var incomingKey = Symbol("incomingKey"); +var urlKey = Symbol("urlKey"); +var headersKey = Symbol("headersKey"); +var abortControllerKey = Symbol("abortControllerKey"); +var getAbortController = Symbol("getAbortController"); +var requestPrototype = { + get method() { + return this[incomingKey].method || "GET"; + }, + get url() { + return this[urlKey]; + }, + get headers() { + return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]); + }, + [getAbortController]() { + this[getRequestCache](); + return this[abortControllerKey]; + }, + [getRequestCache]() { + this[abortControllerKey] ||= new AbortController(); + return this[requestCache] ||= newRequestFromIncoming( + this.method, + this[urlKey], + this.headers, + this[incomingKey], + this[abortControllerKey] + ); + } +}; +[ + "body", + "bodyUsed", + "cache", + "credentials", + "destination", + "integrity", + "mode", + "redirect", + "referrer", + "referrerPolicy", + "signal", + "keepalive" +].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + get() { + return this[getRequestCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + value: function() { + return this[getRequestCache]()[k](); + } + }); +}); +Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + method: this.method, + url: this.url, + headers: this.headers, + nativeRequest: this[requestCache] + }; + return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(requestPrototype, Request.prototype); +var newRequest = (incoming, defaultHostname) => { + const req = Object.create(requestPrototype); + req[incomingKey] = incoming; + const incomingUrl = incoming.url || ""; + if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL. + (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) { + if (incoming instanceof Http2ServerRequest) { + throw new RequestError("Absolute URL for :path is not allowed in HTTP/2"); + } + try { + const url2 = new URL(incomingUrl); + req[urlKey] = url2.href; + } catch (e) { + throw new RequestError("Invalid absolute URL", { cause: e }); + } + return req; + } + const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname; + if (!host) { + throw new RequestError("Missing host header"); + } + let scheme; + if (incoming instanceof Http2ServerRequest) { + scheme = incoming.scheme; + if (!(scheme === "http" || scheme === "https")) { + throw new RequestError("Unsupported scheme"); + } + } else { + scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http"; + } + const url = new URL(`${scheme}://${host}${incomingUrl}`); + if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) { + throw new RequestError("Invalid host header"); + } + req[urlKey] = url.href; + return req; +}; + +// src/response.ts +var responseCache = Symbol("responseCache"); +var getResponseCache = Symbol("getResponseCache"); +var cacheKey = Symbol("cache"); +var GlobalResponse = global.Response; +var Response2 = class _Response { + #body; + #init; + [getResponseCache]() { + delete this[cacheKey]; + return this[responseCache] ||= new GlobalResponse(this.#body, this.#init); + } + constructor(body, init) { + let headers; + this.#body = body; + if (init instanceof _Response) { + const cachedGlobalResponse = init[responseCache]; + if (cachedGlobalResponse) { + this.#init = cachedGlobalResponse; + this[getResponseCache](); + return; + } else { + this.#init = init.#init; + headers = new Headers(init.#init.headers); + } + } else { + this.#init = init; + } + if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) { + ; + this[cacheKey] = [init?.status || 200, body, headers || init?.headers]; + } + } + get headers() { + const cache = this[cacheKey]; + if (cache) { + if (!(cache[2] instanceof Headers)) { + cache[2] = new Headers( + cache[2] || { "content-type": "text/plain; charset=UTF-8" } + ); + } + return cache[2]; + } + return this[getResponseCache]().headers; + } + get status() { + return this[cacheKey]?.[0] ?? this[getResponseCache]().status; + } + get ok() { + const status = this.status; + return status >= 200 && status < 300; + } +}; +["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + get() { + return this[getResponseCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + value: function() { + return this[getResponseCache]()[k](); + } + }); +}); +Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + status: this.status, + headers: this.headers, + ok: this.ok, + nativeResponse: this[responseCache] + }; + return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(Response2, GlobalResponse); +Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype); + +// src/utils.ts +async function readWithoutBlocking(readPromise) { + return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]); +} +function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) { + const cancel = (error) => { + reader.cancel(error).catch(() => { + }); + }; + writable.on("close", cancel); + writable.on("error", cancel); + (currentReadPromise ?? reader.read()).then(flow, handleStreamError); + return reader.closed.finally(() => { + writable.off("close", cancel); + writable.off("error", cancel); + }); + function handleStreamError(error) { + if (error) { + writable.destroy(error); + } + } + function onDrain() { + reader.read().then(flow, handleStreamError); + } + function flow({ done, value }) { + try { + if (done) { + writable.end(); + } else if (!writable.write(value)) { + writable.once("drain", onDrain); + } else { + return reader.read().then(flow, handleStreamError); + } + } catch (e) { + handleStreamError(e); + } + } +} +function writeFromReadableStream(stream, writable) { + if (stream.locked) { + throw new TypeError("ReadableStream is locked."); + } else if (writable.destroyed) { + return; + } + return writeFromReadableStreamDefaultReader(stream.getReader(), writable); +} +var buildOutgoingHttpHeaders = (headers) => { + const res = {}; + if (!(headers instanceof Headers)) { + headers = new Headers(headers ?? void 0); + } + const cookies = []; + for (const [k, v] of headers) { + if (k === "set-cookie") { + cookies.push(v); + } else { + res[k] = v; + } + } + if (cookies.length > 0) { + res["set-cookie"] = cookies; + } + res["content-type"] ??= "text/plain; charset=UTF-8"; + return res; +}; + +// src/utils/response/constants.ts +var X_ALREADY_SENT = "x-hono-already-sent"; + +// src/globals.ts +import crypto from "crypto"; +if (typeof global.crypto === "undefined") { + global.crypto = crypto; +} + +// src/listener.ts +var outgoingEnded = Symbol("outgoingEnded"); +var incomingDraining = Symbol("incomingDraining"); +var DRAIN_TIMEOUT_MS = 500; +var MAX_DRAIN_BYTES = 64 * 1024 * 1024; +var drainIncoming = (incoming) => { + const incomingWithDrainState = incoming; + if (incoming.destroyed || incomingWithDrainState[incomingDraining]) { + return; + } + incomingWithDrainState[incomingDraining] = true; + if (incoming instanceof Http2ServerRequest2) { + try { + ; + incoming.stream?.close?.(h2constants.NGHTTP2_NO_ERROR); + } catch { + } + return; + } + let bytesRead = 0; + const cleanup = () => { + clearTimeout(timer); + incoming.off("data", onData); + incoming.off("end", cleanup); + incoming.off("error", cleanup); + }; + const forceClose = () => { + cleanup(); + const socket = incoming.socket; + if (socket && !socket.destroyed) { + socket.destroySoon(); + } + }; + const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS); + timer.unref?.(); + const onData = (chunk) => { + bytesRead += chunk.length; + if (bytesRead > MAX_DRAIN_BYTES) { + forceClose(); + } + }; + incoming.on("data", onData); + incoming.on("end", cleanup); + incoming.on("error", cleanup); + incoming.resume(); +}; +var handleRequestError = () => new Response(null, { + status: 400 +}); +var handleFetchError = (e) => new Response(null, { + status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 +}); +var handleResponseError = (e, outgoing) => { + const err = e instanceof Error ? e : new Error("unknown error", { cause: e }); + if (err.code === "ERR_STREAM_PREMATURE_CLOSE") { + console.info("The user aborted a request."); + } else { + console.error(e); + if (!outgoing.headersSent) { + outgoing.writeHead(500, { "Content-Type": "text/plain" }); + } + outgoing.end(`Error: ${err.message}`); + outgoing.destroy(err); + } +}; +var flushHeaders = (outgoing) => { + if ("flushHeaders" in outgoing && outgoing.writable) { + outgoing.flushHeaders(); + } +}; +var responseViaCache = async (res, outgoing) => { + let [status, body, header] = res[cacheKey]; + let hasContentLength = false; + if (!header) { + header = { "content-type": "text/plain; charset=UTF-8" }; + } else if (header instanceof Headers) { + hasContentLength = header.has("content-length"); + header = buildOutgoingHttpHeaders(header); + } else if (Array.isArray(header)) { + const headerObj = new Headers(header); + hasContentLength = headerObj.has("content-length"); + header = buildOutgoingHttpHeaders(headerObj); + } else { + for (const key in header) { + if (key.length === 14 && key.toLowerCase() === "content-length") { + hasContentLength = true; + break; + } + } + } + if (!hasContentLength) { + if (typeof body === "string") { + header["Content-Length"] = Buffer.byteLength(body); + } else if (body instanceof Uint8Array) { + header["Content-Length"] = body.byteLength; + } else if (body instanceof Blob) { + header["Content-Length"] = body.size; + } + } + outgoing.writeHead(status, header); + if (typeof body === "string" || body instanceof Uint8Array) { + outgoing.end(body); + } else if (body instanceof Blob) { + outgoing.end(new Uint8Array(await body.arrayBuffer())); + } else { + flushHeaders(outgoing); + await writeFromReadableStream(body, outgoing)?.catch( + (e) => handleResponseError(e, outgoing) + ); + } + ; + outgoing[outgoingEnded]?.(); +}; +var isPromise = (res) => typeof res.then === "function"; +var responseViaResponseObject = async (res, outgoing, options = {}) => { + if (isPromise(res)) { + if (options.errorHandler) { + try { + res = await res; + } catch (err) { + const errRes = await options.errorHandler(err); + if (!errRes) { + return; + } + res = errRes; + } + } else { + res = await res.catch(handleFetchError); + } + } + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + const resHeaderRecord = buildOutgoingHttpHeaders(res.headers); + if (res.body) { + const reader = res.body.getReader(); + const values = []; + let done = false; + let currentReadPromise = void 0; + if (resHeaderRecord["transfer-encoding"] !== "chunked") { + let maxReadCount = 2; + for (let i = 0; i < maxReadCount; i++) { + currentReadPromise ||= reader.read(); + const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => { + console.error(e); + done = true; + }); + if (!chunk) { + if (i === 1) { + await new Promise((resolve) => setTimeout(resolve)); + maxReadCount = 3; + continue; + } + break; + } + currentReadPromise = void 0; + if (chunk.value) { + values.push(chunk.value); + } + if (chunk.done) { + done = true; + break; + } + } + if (done && !("content-length" in resHeaderRecord)) { + resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0); + } + } + outgoing.writeHead(res.status, resHeaderRecord); + values.forEach((value) => { + ; + outgoing.write(value); + }); + if (done) { + outgoing.end(); + } else { + if (values.length === 0) { + flushHeaders(outgoing); + } + await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise); + } + } else if (resHeaderRecord[X_ALREADY_SENT]) { + } else { + outgoing.writeHead(res.status, resHeaderRecord); + outgoing.end(); + } + ; + outgoing[outgoingEnded]?.(); +}; +var getRequestListener = (fetchCallback, options = {}) => { + const autoCleanupIncoming = options.autoCleanupIncoming ?? true; + if (options.overrideGlobalObjects !== false && global.Request !== Request) { + Object.defineProperty(global, "Request", { + value: Request + }); + Object.defineProperty(global, "Response", { + value: Response2 + }); + } + return async (incoming, outgoing) => { + let res, req; + try { + req = newRequest(incoming, options.hostname); + let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD"; + if (!incomingEnded) { + ; + incoming[wrapBodyStream] = true; + incoming.on("end", () => { + incomingEnded = true; + }); + if (incoming instanceof Http2ServerRequest2) { + ; + outgoing[outgoingEnded] = () => { + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }; + } + outgoing.on("finish", () => { + if (!incomingEnded) { + drainIncoming(incoming); + } + }); + } + outgoing.on("close", () => { + const abortController = req[abortControllerKey]; + if (abortController) { + if (incoming.errored) { + req[abortControllerKey].abort(incoming.errored.toString()); + } else if (!outgoing.writableFinished) { + req[abortControllerKey].abort("Client connection prematurely closed."); + } + } + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }); + res = fetchCallback(req, { incoming, outgoing }); + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + } catch (e) { + if (!res) { + if (options.errorHandler) { + res = await options.errorHandler(req ? e : toRequestError(e)); + if (!res) { + return; + } + } else if (!req) { + res = handleRequestError(); + } else { + res = handleFetchError(e); + } + } else { + return handleResponseError(e, outgoing); + } + } + try { + return await responseViaResponseObject(res, outgoing, options); + } catch (e) { + return handleResponseError(e, outgoing); + } + }; +}; + +// src/server.ts +var createAdaptorServer = (options) => { + const fetchCallback = options.fetch; + const requestListener = getRequestListener(fetchCallback, { + hostname: options.hostname, + overrideGlobalObjects: options.overrideGlobalObjects, + autoCleanupIncoming: options.autoCleanupIncoming + }); + const createServer = options.createServer || createServerHTTP; + const server = createServer(options.serverOptions || {}, requestListener); + return server; +}; +var serve = (options, listeningListener) => { + const server = createAdaptorServer(options); + server.listen(options?.port ?? 3e3, options.hostname, () => { + const serverInfo = server.address(); + listeningListener && listeningListener(serverInfo); + }); + return server; +}; +export { + RequestError, + createAdaptorServer, + getRequestListener, + serve +}; diff --git a/node_modules/@hono/node-server/dist/listener.d.mts b/node_modules/@hono/node-server/dist/listener.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a48eaffde054f273afe06f08ef991fceff71240f --- /dev/null +++ b/node_modules/@hono/node-server/dist/listener.d.mts @@ -0,0 +1,13 @@ +import { IncomingMessage, ServerResponse } from 'node:http'; +import { Http2ServerRequest, Http2ServerResponse } from 'node:http2'; +import { FetchCallback, CustomErrorHandler } from './types.mjs'; +import 'node:https'; + +declare const getRequestListener: (fetchCallback: FetchCallback, options?: { + hostname?: string; + errorHandler?: CustomErrorHandler; + overrideGlobalObjects?: boolean; + autoCleanupIncoming?: boolean; +}) => (incoming: IncomingMessage | Http2ServerRequest, outgoing: ServerResponse | Http2ServerResponse) => Promise; + +export { getRequestListener }; diff --git a/node_modules/@hono/node-server/dist/listener.d.ts b/node_modules/@hono/node-server/dist/listener.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2bb0b8fa100ab0f2a80da13c663f4cf9ea826d4b --- /dev/null +++ b/node_modules/@hono/node-server/dist/listener.d.ts @@ -0,0 +1,13 @@ +import { IncomingMessage, ServerResponse } from 'node:http'; +import { Http2ServerRequest, Http2ServerResponse } from 'node:http2'; +import { FetchCallback, CustomErrorHandler } from './types.js'; +import 'node:https'; + +declare const getRequestListener: (fetchCallback: FetchCallback, options?: { + hostname?: string; + errorHandler?: CustomErrorHandler; + overrideGlobalObjects?: boolean; + autoCleanupIncoming?: boolean; +}) => (incoming: IncomingMessage | Http2ServerRequest, outgoing: ServerResponse | Http2ServerResponse) => Promise; + +export { getRequestListener }; diff --git a/node_modules/@hono/node-server/dist/listener.js b/node_modules/@hono/node-server/dist/listener.js new file mode 100644 index 0000000000000000000000000000000000000000..ca27851e8346dedfbf16e3e2e4b9dababbe43c9a --- /dev/null +++ b/node_modules/@hono/node-server/dist/listener.js @@ -0,0 +1,670 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/listener.ts +var listener_exports = {}; +__export(listener_exports, { + getRequestListener: () => getRequestListener +}); +module.exports = __toCommonJS(listener_exports); +var import_node_http22 = require("http2"); + +// src/request.ts +var import_node_http2 = require("http2"); +var import_node_stream = require("stream"); +var RequestError = class extends Error { + constructor(message, options) { + super(message, options); + this.name = "RequestError"; + } +}; +var toRequestError = (e) => { + if (e instanceof RequestError) { + return e; + } + return new RequestError(e.message, { cause: e }); +}; +var GlobalRequest = global.Request; +var Request = class extends GlobalRequest { + constructor(input, options) { + if (typeof input === "object" && getRequestCache in input) { + input = input[getRequestCache](); + } + if (typeof options?.body?.getReader !== "undefined") { + ; + options.duplex ??= "half"; + } + super(input, options); + } +}; +var newHeadersFromIncoming = (incoming) => { + const headerRecord = []; + const rawHeaders = incoming.rawHeaders; + for (let i = 0; i < rawHeaders.length; i += 2) { + const { [i]: key, [i + 1]: value } = rawHeaders; + if (key.charCodeAt(0) !== /*:*/ + 58) { + headerRecord.push([key, value]); + } + } + return new Headers(headerRecord); +}; +var wrapBodyStream = Symbol("wrapBodyStream"); +var newRequestFromIncoming = (method, url, headers, incoming, abortController) => { + const init = { + method, + headers, + signal: abortController.signal + }; + if (method === "TRACE") { + init.method = "GET"; + const req = new Request(url, init); + Object.defineProperty(req, "method", { + get() { + return "TRACE"; + } + }); + return req; + } + if (!(method === "GET" || method === "HEAD")) { + if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) { + init.body = new ReadableStream({ + start(controller) { + controller.enqueue(incoming.rawBody); + controller.close(); + } + }); + } else if (incoming[wrapBodyStream]) { + let reader; + init.body = new ReadableStream({ + async pull(controller) { + try { + reader ||= import_node_stream.Readable.toWeb(incoming).getReader(); + const { done, value } = await reader.read(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + } catch (error) { + controller.error(error); + } + } + }); + } else { + init.body = import_node_stream.Readable.toWeb(incoming); + } + } + return new Request(url, init); +}; +var getRequestCache = Symbol("getRequestCache"); +var requestCache = Symbol("requestCache"); +var incomingKey = Symbol("incomingKey"); +var urlKey = Symbol("urlKey"); +var headersKey = Symbol("headersKey"); +var abortControllerKey = Symbol("abortControllerKey"); +var getAbortController = Symbol("getAbortController"); +var requestPrototype = { + get method() { + return this[incomingKey].method || "GET"; + }, + get url() { + return this[urlKey]; + }, + get headers() { + return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]); + }, + [getAbortController]() { + this[getRequestCache](); + return this[abortControllerKey]; + }, + [getRequestCache]() { + this[abortControllerKey] ||= new AbortController(); + return this[requestCache] ||= newRequestFromIncoming( + this.method, + this[urlKey], + this.headers, + this[incomingKey], + this[abortControllerKey] + ); + } +}; +[ + "body", + "bodyUsed", + "cache", + "credentials", + "destination", + "integrity", + "mode", + "redirect", + "referrer", + "referrerPolicy", + "signal", + "keepalive" +].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + get() { + return this[getRequestCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + value: function() { + return this[getRequestCache]()[k](); + } + }); +}); +Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + method: this.method, + url: this.url, + headers: this.headers, + nativeRequest: this[requestCache] + }; + return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(requestPrototype, Request.prototype); +var newRequest = (incoming, defaultHostname) => { + const req = Object.create(requestPrototype); + req[incomingKey] = incoming; + const incomingUrl = incoming.url || ""; + if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL. + (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) { + if (incoming instanceof import_node_http2.Http2ServerRequest) { + throw new RequestError("Absolute URL for :path is not allowed in HTTP/2"); + } + try { + const url2 = new URL(incomingUrl); + req[urlKey] = url2.href; + } catch (e) { + throw new RequestError("Invalid absolute URL", { cause: e }); + } + return req; + } + const host = (incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname; + if (!host) { + throw new RequestError("Missing host header"); + } + let scheme; + if (incoming instanceof import_node_http2.Http2ServerRequest) { + scheme = incoming.scheme; + if (!(scheme === "http" || scheme === "https")) { + throw new RequestError("Unsupported scheme"); + } + } else { + scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http"; + } + const url = new URL(`${scheme}://${host}${incomingUrl}`); + if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) { + throw new RequestError("Invalid host header"); + } + req[urlKey] = url.href; + return req; +}; + +// src/response.ts +var responseCache = Symbol("responseCache"); +var getResponseCache = Symbol("getResponseCache"); +var cacheKey = Symbol("cache"); +var GlobalResponse = global.Response; +var Response2 = class _Response { + #body; + #init; + [getResponseCache]() { + delete this[cacheKey]; + return this[responseCache] ||= new GlobalResponse(this.#body, this.#init); + } + constructor(body, init) { + let headers; + this.#body = body; + if (init instanceof _Response) { + const cachedGlobalResponse = init[responseCache]; + if (cachedGlobalResponse) { + this.#init = cachedGlobalResponse; + this[getResponseCache](); + return; + } else { + this.#init = init.#init; + headers = new Headers(init.#init.headers); + } + } else { + this.#init = init; + } + if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) { + ; + this[cacheKey] = [init?.status || 200, body, headers || init?.headers]; + } + } + get headers() { + const cache = this[cacheKey]; + if (cache) { + if (!(cache[2] instanceof Headers)) { + cache[2] = new Headers( + cache[2] || { "content-type": "text/plain; charset=UTF-8" } + ); + } + return cache[2]; + } + return this[getResponseCache]().headers; + } + get status() { + return this[cacheKey]?.[0] ?? this[getResponseCache]().status; + } + get ok() { + const status = this.status; + return status >= 200 && status < 300; + } +}; +["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + get() { + return this[getResponseCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + value: function() { + return this[getResponseCache]()[k](); + } + }); +}); +Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + status: this.status, + headers: this.headers, + ok: this.ok, + nativeResponse: this[responseCache] + }; + return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(Response2, GlobalResponse); +Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype); + +// src/utils.ts +async function readWithoutBlocking(readPromise) { + return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]); +} +function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) { + const cancel = (error) => { + reader.cancel(error).catch(() => { + }); + }; + writable.on("close", cancel); + writable.on("error", cancel); + (currentReadPromise ?? reader.read()).then(flow, handleStreamError); + return reader.closed.finally(() => { + writable.off("close", cancel); + writable.off("error", cancel); + }); + function handleStreamError(error) { + if (error) { + writable.destroy(error); + } + } + function onDrain() { + reader.read().then(flow, handleStreamError); + } + function flow({ done, value }) { + try { + if (done) { + writable.end(); + } else if (!writable.write(value)) { + writable.once("drain", onDrain); + } else { + return reader.read().then(flow, handleStreamError); + } + } catch (e) { + handleStreamError(e); + } + } +} +function writeFromReadableStream(stream, writable) { + if (stream.locked) { + throw new TypeError("ReadableStream is locked."); + } else if (writable.destroyed) { + return; + } + return writeFromReadableStreamDefaultReader(stream.getReader(), writable); +} +var buildOutgoingHttpHeaders = (headers) => { + const res = {}; + if (!(headers instanceof Headers)) { + headers = new Headers(headers ?? void 0); + } + const cookies = []; + for (const [k, v] of headers) { + if (k === "set-cookie") { + cookies.push(v); + } else { + res[k] = v; + } + } + if (cookies.length > 0) { + res["set-cookie"] = cookies; + } + res["content-type"] ??= "text/plain; charset=UTF-8"; + return res; +}; + +// src/utils/response/constants.ts +var X_ALREADY_SENT = "x-hono-already-sent"; + +// src/globals.ts +var import_node_crypto = __toESM(require("crypto")); +if (typeof global.crypto === "undefined") { + global.crypto = import_node_crypto.default; +} + +// src/listener.ts +var outgoingEnded = Symbol("outgoingEnded"); +var incomingDraining = Symbol("incomingDraining"); +var DRAIN_TIMEOUT_MS = 500; +var MAX_DRAIN_BYTES = 64 * 1024 * 1024; +var drainIncoming = (incoming) => { + const incomingWithDrainState = incoming; + if (incoming.destroyed || incomingWithDrainState[incomingDraining]) { + return; + } + incomingWithDrainState[incomingDraining] = true; + if (incoming instanceof import_node_http22.Http2ServerRequest) { + try { + ; + incoming.stream?.close?.(import_node_http22.constants.NGHTTP2_NO_ERROR); + } catch { + } + return; + } + let bytesRead = 0; + const cleanup = () => { + clearTimeout(timer); + incoming.off("data", onData); + incoming.off("end", cleanup); + incoming.off("error", cleanup); + }; + const forceClose = () => { + cleanup(); + const socket = incoming.socket; + if (socket && !socket.destroyed) { + socket.destroySoon(); + } + }; + const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS); + timer.unref?.(); + const onData = (chunk) => { + bytesRead += chunk.length; + if (bytesRead > MAX_DRAIN_BYTES) { + forceClose(); + } + }; + incoming.on("data", onData); + incoming.on("end", cleanup); + incoming.on("error", cleanup); + incoming.resume(); +}; +var handleRequestError = () => new Response(null, { + status: 400 +}); +var handleFetchError = (e) => new Response(null, { + status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 +}); +var handleResponseError = (e, outgoing) => { + const err = e instanceof Error ? e : new Error("unknown error", { cause: e }); + if (err.code === "ERR_STREAM_PREMATURE_CLOSE") { + console.info("The user aborted a request."); + } else { + console.error(e); + if (!outgoing.headersSent) { + outgoing.writeHead(500, { "Content-Type": "text/plain" }); + } + outgoing.end(`Error: ${err.message}`); + outgoing.destroy(err); + } +}; +var flushHeaders = (outgoing) => { + if ("flushHeaders" in outgoing && outgoing.writable) { + outgoing.flushHeaders(); + } +}; +var responseViaCache = async (res, outgoing) => { + let [status, body, header] = res[cacheKey]; + let hasContentLength = false; + if (!header) { + header = { "content-type": "text/plain; charset=UTF-8" }; + } else if (header instanceof Headers) { + hasContentLength = header.has("content-length"); + header = buildOutgoingHttpHeaders(header); + } else if (Array.isArray(header)) { + const headerObj = new Headers(header); + hasContentLength = headerObj.has("content-length"); + header = buildOutgoingHttpHeaders(headerObj); + } else { + for (const key in header) { + if (key.length === 14 && key.toLowerCase() === "content-length") { + hasContentLength = true; + break; + } + } + } + if (!hasContentLength) { + if (typeof body === "string") { + header["Content-Length"] = Buffer.byteLength(body); + } else if (body instanceof Uint8Array) { + header["Content-Length"] = body.byteLength; + } else if (body instanceof Blob) { + header["Content-Length"] = body.size; + } + } + outgoing.writeHead(status, header); + if (typeof body === "string" || body instanceof Uint8Array) { + outgoing.end(body); + } else if (body instanceof Blob) { + outgoing.end(new Uint8Array(await body.arrayBuffer())); + } else { + flushHeaders(outgoing); + await writeFromReadableStream(body, outgoing)?.catch( + (e) => handleResponseError(e, outgoing) + ); + } + ; + outgoing[outgoingEnded]?.(); +}; +var isPromise = (res) => typeof res.then === "function"; +var responseViaResponseObject = async (res, outgoing, options = {}) => { + if (isPromise(res)) { + if (options.errorHandler) { + try { + res = await res; + } catch (err) { + const errRes = await options.errorHandler(err); + if (!errRes) { + return; + } + res = errRes; + } + } else { + res = await res.catch(handleFetchError); + } + } + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + const resHeaderRecord = buildOutgoingHttpHeaders(res.headers); + if (res.body) { + const reader = res.body.getReader(); + const values = []; + let done = false; + let currentReadPromise = void 0; + if (resHeaderRecord["transfer-encoding"] !== "chunked") { + let maxReadCount = 2; + for (let i = 0; i < maxReadCount; i++) { + currentReadPromise ||= reader.read(); + const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => { + console.error(e); + done = true; + }); + if (!chunk) { + if (i === 1) { + await new Promise((resolve) => setTimeout(resolve)); + maxReadCount = 3; + continue; + } + break; + } + currentReadPromise = void 0; + if (chunk.value) { + values.push(chunk.value); + } + if (chunk.done) { + done = true; + break; + } + } + if (done && !("content-length" in resHeaderRecord)) { + resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0); + } + } + outgoing.writeHead(res.status, resHeaderRecord); + values.forEach((value) => { + ; + outgoing.write(value); + }); + if (done) { + outgoing.end(); + } else { + if (values.length === 0) { + flushHeaders(outgoing); + } + await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise); + } + } else if (resHeaderRecord[X_ALREADY_SENT]) { + } else { + outgoing.writeHead(res.status, resHeaderRecord); + outgoing.end(); + } + ; + outgoing[outgoingEnded]?.(); +}; +var getRequestListener = (fetchCallback, options = {}) => { + const autoCleanupIncoming = options.autoCleanupIncoming ?? true; + if (options.overrideGlobalObjects !== false && global.Request !== Request) { + Object.defineProperty(global, "Request", { + value: Request + }); + Object.defineProperty(global, "Response", { + value: Response2 + }); + } + return async (incoming, outgoing) => { + let res, req; + try { + req = newRequest(incoming, options.hostname); + let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD"; + if (!incomingEnded) { + ; + incoming[wrapBodyStream] = true; + incoming.on("end", () => { + incomingEnded = true; + }); + if (incoming instanceof import_node_http22.Http2ServerRequest) { + ; + outgoing[outgoingEnded] = () => { + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }; + } + outgoing.on("finish", () => { + if (!incomingEnded) { + drainIncoming(incoming); + } + }); + } + outgoing.on("close", () => { + const abortController = req[abortControllerKey]; + if (abortController) { + if (incoming.errored) { + req[abortControllerKey].abort(incoming.errored.toString()); + } else if (!outgoing.writableFinished) { + req[abortControllerKey].abort("Client connection prematurely closed."); + } + } + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }); + res = fetchCallback(req, { incoming, outgoing }); + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + } catch (e) { + if (!res) { + if (options.errorHandler) { + res = await options.errorHandler(req ? e : toRequestError(e)); + if (!res) { + return; + } + } else if (!req) { + res = handleRequestError(); + } else { + res = handleFetchError(e); + } + } else { + return handleResponseError(e, outgoing); + } + } + try { + return await responseViaResponseObject(res, outgoing, options); + } catch (e) { + return handleResponseError(e, outgoing); + } + }; +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + getRequestListener +}); diff --git a/node_modules/@hono/node-server/dist/listener.mjs b/node_modules/@hono/node-server/dist/listener.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e9c75a9f94dd3465b6297aff638f546431a20157 --- /dev/null +++ b/node_modules/@hono/node-server/dist/listener.mjs @@ -0,0 +1,635 @@ +// src/listener.ts +import { Http2ServerRequest as Http2ServerRequest2, constants as h2constants } from "http2"; + +// src/request.ts +import { Http2ServerRequest } from "http2"; +import { Readable } from "stream"; +var RequestError = class extends Error { + constructor(message, options) { + super(message, options); + this.name = "RequestError"; + } +}; +var toRequestError = (e) => { + if (e instanceof RequestError) { + return e; + } + return new RequestError(e.message, { cause: e }); +}; +var GlobalRequest = global.Request; +var Request = class extends GlobalRequest { + constructor(input, options) { + if (typeof input === "object" && getRequestCache in input) { + input = input[getRequestCache](); + } + if (typeof options?.body?.getReader !== "undefined") { + ; + options.duplex ??= "half"; + } + super(input, options); + } +}; +var newHeadersFromIncoming = (incoming) => { + const headerRecord = []; + const rawHeaders = incoming.rawHeaders; + for (let i = 0; i < rawHeaders.length; i += 2) { + const { [i]: key, [i + 1]: value } = rawHeaders; + if (key.charCodeAt(0) !== /*:*/ + 58) { + headerRecord.push([key, value]); + } + } + return new Headers(headerRecord); +}; +var wrapBodyStream = Symbol("wrapBodyStream"); +var newRequestFromIncoming = (method, url, headers, incoming, abortController) => { + const init = { + method, + headers, + signal: abortController.signal + }; + if (method === "TRACE") { + init.method = "GET"; + const req = new Request(url, init); + Object.defineProperty(req, "method", { + get() { + return "TRACE"; + } + }); + return req; + } + if (!(method === "GET" || method === "HEAD")) { + if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) { + init.body = new ReadableStream({ + start(controller) { + controller.enqueue(incoming.rawBody); + controller.close(); + } + }); + } else if (incoming[wrapBodyStream]) { + let reader; + init.body = new ReadableStream({ + async pull(controller) { + try { + reader ||= Readable.toWeb(incoming).getReader(); + const { done, value } = await reader.read(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + } catch (error) { + controller.error(error); + } + } + }); + } else { + init.body = Readable.toWeb(incoming); + } + } + return new Request(url, init); +}; +var getRequestCache = Symbol("getRequestCache"); +var requestCache = Symbol("requestCache"); +var incomingKey = Symbol("incomingKey"); +var urlKey = Symbol("urlKey"); +var headersKey = Symbol("headersKey"); +var abortControllerKey = Symbol("abortControllerKey"); +var getAbortController = Symbol("getAbortController"); +var requestPrototype = { + get method() { + return this[incomingKey].method || "GET"; + }, + get url() { + return this[urlKey]; + }, + get headers() { + return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]); + }, + [getAbortController]() { + this[getRequestCache](); + return this[abortControllerKey]; + }, + [getRequestCache]() { + this[abortControllerKey] ||= new AbortController(); + return this[requestCache] ||= newRequestFromIncoming( + this.method, + this[urlKey], + this.headers, + this[incomingKey], + this[abortControllerKey] + ); + } +}; +[ + "body", + "bodyUsed", + "cache", + "credentials", + "destination", + "integrity", + "mode", + "redirect", + "referrer", + "referrerPolicy", + "signal", + "keepalive" +].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + get() { + return this[getRequestCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + value: function() { + return this[getRequestCache]()[k](); + } + }); +}); +Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + method: this.method, + url: this.url, + headers: this.headers, + nativeRequest: this[requestCache] + }; + return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(requestPrototype, Request.prototype); +var newRequest = (incoming, defaultHostname) => { + const req = Object.create(requestPrototype); + req[incomingKey] = incoming; + const incomingUrl = incoming.url || ""; + if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL. + (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) { + if (incoming instanceof Http2ServerRequest) { + throw new RequestError("Absolute URL for :path is not allowed in HTTP/2"); + } + try { + const url2 = new URL(incomingUrl); + req[urlKey] = url2.href; + } catch (e) { + throw new RequestError("Invalid absolute URL", { cause: e }); + } + return req; + } + const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname; + if (!host) { + throw new RequestError("Missing host header"); + } + let scheme; + if (incoming instanceof Http2ServerRequest) { + scheme = incoming.scheme; + if (!(scheme === "http" || scheme === "https")) { + throw new RequestError("Unsupported scheme"); + } + } else { + scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http"; + } + const url = new URL(`${scheme}://${host}${incomingUrl}`); + if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) { + throw new RequestError("Invalid host header"); + } + req[urlKey] = url.href; + return req; +}; + +// src/response.ts +var responseCache = Symbol("responseCache"); +var getResponseCache = Symbol("getResponseCache"); +var cacheKey = Symbol("cache"); +var GlobalResponse = global.Response; +var Response2 = class _Response { + #body; + #init; + [getResponseCache]() { + delete this[cacheKey]; + return this[responseCache] ||= new GlobalResponse(this.#body, this.#init); + } + constructor(body, init) { + let headers; + this.#body = body; + if (init instanceof _Response) { + const cachedGlobalResponse = init[responseCache]; + if (cachedGlobalResponse) { + this.#init = cachedGlobalResponse; + this[getResponseCache](); + return; + } else { + this.#init = init.#init; + headers = new Headers(init.#init.headers); + } + } else { + this.#init = init; + } + if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) { + ; + this[cacheKey] = [init?.status || 200, body, headers || init?.headers]; + } + } + get headers() { + const cache = this[cacheKey]; + if (cache) { + if (!(cache[2] instanceof Headers)) { + cache[2] = new Headers( + cache[2] || { "content-type": "text/plain; charset=UTF-8" } + ); + } + return cache[2]; + } + return this[getResponseCache]().headers; + } + get status() { + return this[cacheKey]?.[0] ?? this[getResponseCache]().status; + } + get ok() { + const status = this.status; + return status >= 200 && status < 300; + } +}; +["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + get() { + return this[getResponseCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + value: function() { + return this[getResponseCache]()[k](); + } + }); +}); +Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + status: this.status, + headers: this.headers, + ok: this.ok, + nativeResponse: this[responseCache] + }; + return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(Response2, GlobalResponse); +Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype); + +// src/utils.ts +async function readWithoutBlocking(readPromise) { + return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]); +} +function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) { + const cancel = (error) => { + reader.cancel(error).catch(() => { + }); + }; + writable.on("close", cancel); + writable.on("error", cancel); + (currentReadPromise ?? reader.read()).then(flow, handleStreamError); + return reader.closed.finally(() => { + writable.off("close", cancel); + writable.off("error", cancel); + }); + function handleStreamError(error) { + if (error) { + writable.destroy(error); + } + } + function onDrain() { + reader.read().then(flow, handleStreamError); + } + function flow({ done, value }) { + try { + if (done) { + writable.end(); + } else if (!writable.write(value)) { + writable.once("drain", onDrain); + } else { + return reader.read().then(flow, handleStreamError); + } + } catch (e) { + handleStreamError(e); + } + } +} +function writeFromReadableStream(stream, writable) { + if (stream.locked) { + throw new TypeError("ReadableStream is locked."); + } else if (writable.destroyed) { + return; + } + return writeFromReadableStreamDefaultReader(stream.getReader(), writable); +} +var buildOutgoingHttpHeaders = (headers) => { + const res = {}; + if (!(headers instanceof Headers)) { + headers = new Headers(headers ?? void 0); + } + const cookies = []; + for (const [k, v] of headers) { + if (k === "set-cookie") { + cookies.push(v); + } else { + res[k] = v; + } + } + if (cookies.length > 0) { + res["set-cookie"] = cookies; + } + res["content-type"] ??= "text/plain; charset=UTF-8"; + return res; +}; + +// src/utils/response/constants.ts +var X_ALREADY_SENT = "x-hono-already-sent"; + +// src/globals.ts +import crypto from "crypto"; +if (typeof global.crypto === "undefined") { + global.crypto = crypto; +} + +// src/listener.ts +var outgoingEnded = Symbol("outgoingEnded"); +var incomingDraining = Symbol("incomingDraining"); +var DRAIN_TIMEOUT_MS = 500; +var MAX_DRAIN_BYTES = 64 * 1024 * 1024; +var drainIncoming = (incoming) => { + const incomingWithDrainState = incoming; + if (incoming.destroyed || incomingWithDrainState[incomingDraining]) { + return; + } + incomingWithDrainState[incomingDraining] = true; + if (incoming instanceof Http2ServerRequest2) { + try { + ; + incoming.stream?.close?.(h2constants.NGHTTP2_NO_ERROR); + } catch { + } + return; + } + let bytesRead = 0; + const cleanup = () => { + clearTimeout(timer); + incoming.off("data", onData); + incoming.off("end", cleanup); + incoming.off("error", cleanup); + }; + const forceClose = () => { + cleanup(); + const socket = incoming.socket; + if (socket && !socket.destroyed) { + socket.destroySoon(); + } + }; + const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS); + timer.unref?.(); + const onData = (chunk) => { + bytesRead += chunk.length; + if (bytesRead > MAX_DRAIN_BYTES) { + forceClose(); + } + }; + incoming.on("data", onData); + incoming.on("end", cleanup); + incoming.on("error", cleanup); + incoming.resume(); +}; +var handleRequestError = () => new Response(null, { + status: 400 +}); +var handleFetchError = (e) => new Response(null, { + status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 +}); +var handleResponseError = (e, outgoing) => { + const err = e instanceof Error ? e : new Error("unknown error", { cause: e }); + if (err.code === "ERR_STREAM_PREMATURE_CLOSE") { + console.info("The user aborted a request."); + } else { + console.error(e); + if (!outgoing.headersSent) { + outgoing.writeHead(500, { "Content-Type": "text/plain" }); + } + outgoing.end(`Error: ${err.message}`); + outgoing.destroy(err); + } +}; +var flushHeaders = (outgoing) => { + if ("flushHeaders" in outgoing && outgoing.writable) { + outgoing.flushHeaders(); + } +}; +var responseViaCache = async (res, outgoing) => { + let [status, body, header] = res[cacheKey]; + let hasContentLength = false; + if (!header) { + header = { "content-type": "text/plain; charset=UTF-8" }; + } else if (header instanceof Headers) { + hasContentLength = header.has("content-length"); + header = buildOutgoingHttpHeaders(header); + } else if (Array.isArray(header)) { + const headerObj = new Headers(header); + hasContentLength = headerObj.has("content-length"); + header = buildOutgoingHttpHeaders(headerObj); + } else { + for (const key in header) { + if (key.length === 14 && key.toLowerCase() === "content-length") { + hasContentLength = true; + break; + } + } + } + if (!hasContentLength) { + if (typeof body === "string") { + header["Content-Length"] = Buffer.byteLength(body); + } else if (body instanceof Uint8Array) { + header["Content-Length"] = body.byteLength; + } else if (body instanceof Blob) { + header["Content-Length"] = body.size; + } + } + outgoing.writeHead(status, header); + if (typeof body === "string" || body instanceof Uint8Array) { + outgoing.end(body); + } else if (body instanceof Blob) { + outgoing.end(new Uint8Array(await body.arrayBuffer())); + } else { + flushHeaders(outgoing); + await writeFromReadableStream(body, outgoing)?.catch( + (e) => handleResponseError(e, outgoing) + ); + } + ; + outgoing[outgoingEnded]?.(); +}; +var isPromise = (res) => typeof res.then === "function"; +var responseViaResponseObject = async (res, outgoing, options = {}) => { + if (isPromise(res)) { + if (options.errorHandler) { + try { + res = await res; + } catch (err) { + const errRes = await options.errorHandler(err); + if (!errRes) { + return; + } + res = errRes; + } + } else { + res = await res.catch(handleFetchError); + } + } + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + const resHeaderRecord = buildOutgoingHttpHeaders(res.headers); + if (res.body) { + const reader = res.body.getReader(); + const values = []; + let done = false; + let currentReadPromise = void 0; + if (resHeaderRecord["transfer-encoding"] !== "chunked") { + let maxReadCount = 2; + for (let i = 0; i < maxReadCount; i++) { + currentReadPromise ||= reader.read(); + const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => { + console.error(e); + done = true; + }); + if (!chunk) { + if (i === 1) { + await new Promise((resolve) => setTimeout(resolve)); + maxReadCount = 3; + continue; + } + break; + } + currentReadPromise = void 0; + if (chunk.value) { + values.push(chunk.value); + } + if (chunk.done) { + done = true; + break; + } + } + if (done && !("content-length" in resHeaderRecord)) { + resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0); + } + } + outgoing.writeHead(res.status, resHeaderRecord); + values.forEach((value) => { + ; + outgoing.write(value); + }); + if (done) { + outgoing.end(); + } else { + if (values.length === 0) { + flushHeaders(outgoing); + } + await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise); + } + } else if (resHeaderRecord[X_ALREADY_SENT]) { + } else { + outgoing.writeHead(res.status, resHeaderRecord); + outgoing.end(); + } + ; + outgoing[outgoingEnded]?.(); +}; +var getRequestListener = (fetchCallback, options = {}) => { + const autoCleanupIncoming = options.autoCleanupIncoming ?? true; + if (options.overrideGlobalObjects !== false && global.Request !== Request) { + Object.defineProperty(global, "Request", { + value: Request + }); + Object.defineProperty(global, "Response", { + value: Response2 + }); + } + return async (incoming, outgoing) => { + let res, req; + try { + req = newRequest(incoming, options.hostname); + let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD"; + if (!incomingEnded) { + ; + incoming[wrapBodyStream] = true; + incoming.on("end", () => { + incomingEnded = true; + }); + if (incoming instanceof Http2ServerRequest2) { + ; + outgoing[outgoingEnded] = () => { + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }; + } + outgoing.on("finish", () => { + if (!incomingEnded) { + drainIncoming(incoming); + } + }); + } + outgoing.on("close", () => { + const abortController = req[abortControllerKey]; + if (abortController) { + if (incoming.errored) { + req[abortControllerKey].abort(incoming.errored.toString()); + } else if (!outgoing.writableFinished) { + req[abortControllerKey].abort("Client connection prematurely closed."); + } + } + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }); + res = fetchCallback(req, { incoming, outgoing }); + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + } catch (e) { + if (!res) { + if (options.errorHandler) { + res = await options.errorHandler(req ? e : toRequestError(e)); + if (!res) { + return; + } + } else if (!req) { + res = handleRequestError(); + } else { + res = handleFetchError(e); + } + } else { + return handleResponseError(e, outgoing); + } + } + try { + return await responseViaResponseObject(res, outgoing, options); + } catch (e) { + return handleResponseError(e, outgoing); + } + }; +}; +export { + getRequestListener +}; diff --git a/node_modules/@hono/node-server/dist/request.d.mts b/node_modules/@hono/node-server/dist/request.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e3045ccd9d06dafe6f4aeee41efeefed73b1e8a0 --- /dev/null +++ b/node_modules/@hono/node-server/dist/request.d.mts @@ -0,0 +1,25 @@ +import { IncomingMessage } from 'node:http'; +import { Http2ServerRequest } from 'node:http2'; + +declare class RequestError extends Error { + constructor(message: string, options?: { + cause?: unknown; + }); +} +declare const toRequestError: (e: unknown) => RequestError; +declare const GlobalRequest: { + new (input: RequestInfo | URL, init?: RequestInit): globalThis.Request; + prototype: globalThis.Request; +}; +declare class Request extends GlobalRequest { + constructor(input: string | Request, options?: RequestInit); +} +type IncomingMessageWithWrapBodyStream = IncomingMessage & { + [wrapBodyStream]: boolean; +}; +declare const wrapBodyStream: unique symbol; +declare const abortControllerKey: unique symbol; +declare const getAbortController: unique symbol; +declare const newRequest: (incoming: IncomingMessage | Http2ServerRequest, defaultHostname?: string) => any; + +export { GlobalRequest, type IncomingMessageWithWrapBodyStream, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError, wrapBodyStream }; diff --git a/node_modules/@hono/node-server/dist/request.d.ts b/node_modules/@hono/node-server/dist/request.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e3045ccd9d06dafe6f4aeee41efeefed73b1e8a0 --- /dev/null +++ b/node_modules/@hono/node-server/dist/request.d.ts @@ -0,0 +1,25 @@ +import { IncomingMessage } from 'node:http'; +import { Http2ServerRequest } from 'node:http2'; + +declare class RequestError extends Error { + constructor(message: string, options?: { + cause?: unknown; + }); +} +declare const toRequestError: (e: unknown) => RequestError; +declare const GlobalRequest: { + new (input: RequestInfo | URL, init?: RequestInit): globalThis.Request; + prototype: globalThis.Request; +}; +declare class Request extends GlobalRequest { + constructor(input: string | Request, options?: RequestInit); +} +type IncomingMessageWithWrapBodyStream = IncomingMessage & { + [wrapBodyStream]: boolean; +}; +declare const wrapBodyStream: unique symbol; +declare const abortControllerKey: unique symbol; +declare const getAbortController: unique symbol; +declare const newRequest: (incoming: IncomingMessage | Http2ServerRequest, defaultHostname?: string) => any; + +export { GlobalRequest, type IncomingMessageWithWrapBodyStream, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError, wrapBodyStream }; diff --git a/node_modules/@hono/node-server/dist/request.js b/node_modules/@hono/node-server/dist/request.js new file mode 100644 index 0000000000000000000000000000000000000000..d6d674070182a5ccb6d06ed6131a8d380028e0b6 --- /dev/null +++ b/node_modules/@hono/node-server/dist/request.js @@ -0,0 +1,238 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/request.ts +var request_exports = {}; +__export(request_exports, { + GlobalRequest: () => GlobalRequest, + Request: () => Request, + RequestError: () => RequestError, + abortControllerKey: () => abortControllerKey, + getAbortController: () => getAbortController, + newRequest: () => newRequest, + toRequestError: () => toRequestError, + wrapBodyStream: () => wrapBodyStream +}); +module.exports = __toCommonJS(request_exports); +var import_node_http2 = require("http2"); +var import_node_stream = require("stream"); +var RequestError = class extends Error { + constructor(message, options) { + super(message, options); + this.name = "RequestError"; + } +}; +var toRequestError = (e) => { + if (e instanceof RequestError) { + return e; + } + return new RequestError(e.message, { cause: e }); +}; +var GlobalRequest = global.Request; +var Request = class extends GlobalRequest { + constructor(input, options) { + if (typeof input === "object" && getRequestCache in input) { + input = input[getRequestCache](); + } + if (typeof options?.body?.getReader !== "undefined") { + ; + options.duplex ??= "half"; + } + super(input, options); + } +}; +var newHeadersFromIncoming = (incoming) => { + const headerRecord = []; + const rawHeaders = incoming.rawHeaders; + for (let i = 0; i < rawHeaders.length; i += 2) { + const { [i]: key, [i + 1]: value } = rawHeaders; + if (key.charCodeAt(0) !== /*:*/ + 58) { + headerRecord.push([key, value]); + } + } + return new Headers(headerRecord); +}; +var wrapBodyStream = Symbol("wrapBodyStream"); +var newRequestFromIncoming = (method, url, headers, incoming, abortController) => { + const init = { + method, + headers, + signal: abortController.signal + }; + if (method === "TRACE") { + init.method = "GET"; + const req = new Request(url, init); + Object.defineProperty(req, "method", { + get() { + return "TRACE"; + } + }); + return req; + } + if (!(method === "GET" || method === "HEAD")) { + if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) { + init.body = new ReadableStream({ + start(controller) { + controller.enqueue(incoming.rawBody); + controller.close(); + } + }); + } else if (incoming[wrapBodyStream]) { + let reader; + init.body = new ReadableStream({ + async pull(controller) { + try { + reader ||= import_node_stream.Readable.toWeb(incoming).getReader(); + const { done, value } = await reader.read(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + } catch (error) { + controller.error(error); + } + } + }); + } else { + init.body = import_node_stream.Readable.toWeb(incoming); + } + } + return new Request(url, init); +}; +var getRequestCache = Symbol("getRequestCache"); +var requestCache = Symbol("requestCache"); +var incomingKey = Symbol("incomingKey"); +var urlKey = Symbol("urlKey"); +var headersKey = Symbol("headersKey"); +var abortControllerKey = Symbol("abortControllerKey"); +var getAbortController = Symbol("getAbortController"); +var requestPrototype = { + get method() { + return this[incomingKey].method || "GET"; + }, + get url() { + return this[urlKey]; + }, + get headers() { + return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]); + }, + [getAbortController]() { + this[getRequestCache](); + return this[abortControllerKey]; + }, + [getRequestCache]() { + this[abortControllerKey] ||= new AbortController(); + return this[requestCache] ||= newRequestFromIncoming( + this.method, + this[urlKey], + this.headers, + this[incomingKey], + this[abortControllerKey] + ); + } +}; +[ + "body", + "bodyUsed", + "cache", + "credentials", + "destination", + "integrity", + "mode", + "redirect", + "referrer", + "referrerPolicy", + "signal", + "keepalive" +].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + get() { + return this[getRequestCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + value: function() { + return this[getRequestCache]()[k](); + } + }); +}); +Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + method: this.method, + url: this.url, + headers: this.headers, + nativeRequest: this[requestCache] + }; + return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(requestPrototype, Request.prototype); +var newRequest = (incoming, defaultHostname) => { + const req = Object.create(requestPrototype); + req[incomingKey] = incoming; + const incomingUrl = incoming.url || ""; + if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL. + (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) { + if (incoming instanceof import_node_http2.Http2ServerRequest) { + throw new RequestError("Absolute URL for :path is not allowed in HTTP/2"); + } + try { + const url2 = new URL(incomingUrl); + req[urlKey] = url2.href; + } catch (e) { + throw new RequestError("Invalid absolute URL", { cause: e }); + } + return req; + } + const host = (incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname; + if (!host) { + throw new RequestError("Missing host header"); + } + let scheme; + if (incoming instanceof import_node_http2.Http2ServerRequest) { + scheme = incoming.scheme; + if (!(scheme === "http" || scheme === "https")) { + throw new RequestError("Unsupported scheme"); + } + } else { + scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http"; + } + const url = new URL(`${scheme}://${host}${incomingUrl}`); + if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) { + throw new RequestError("Invalid host header"); + } + req[urlKey] = url.href; + return req; +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + GlobalRequest, + Request, + RequestError, + abortControllerKey, + getAbortController, + newRequest, + toRequestError, + wrapBodyStream +}); diff --git a/node_modules/@hono/node-server/dist/request.mjs b/node_modules/@hono/node-server/dist/request.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8f57cd481e82a3997fffe4ed2fe69e0c0d18ceb2 --- /dev/null +++ b/node_modules/@hono/node-server/dist/request.mjs @@ -0,0 +1,206 @@ +// src/request.ts +import { Http2ServerRequest } from "http2"; +import { Readable } from "stream"; +var RequestError = class extends Error { + constructor(message, options) { + super(message, options); + this.name = "RequestError"; + } +}; +var toRequestError = (e) => { + if (e instanceof RequestError) { + return e; + } + return new RequestError(e.message, { cause: e }); +}; +var GlobalRequest = global.Request; +var Request = class extends GlobalRequest { + constructor(input, options) { + if (typeof input === "object" && getRequestCache in input) { + input = input[getRequestCache](); + } + if (typeof options?.body?.getReader !== "undefined") { + ; + options.duplex ??= "half"; + } + super(input, options); + } +}; +var newHeadersFromIncoming = (incoming) => { + const headerRecord = []; + const rawHeaders = incoming.rawHeaders; + for (let i = 0; i < rawHeaders.length; i += 2) { + const { [i]: key, [i + 1]: value } = rawHeaders; + if (key.charCodeAt(0) !== /*:*/ + 58) { + headerRecord.push([key, value]); + } + } + return new Headers(headerRecord); +}; +var wrapBodyStream = Symbol("wrapBodyStream"); +var newRequestFromIncoming = (method, url, headers, incoming, abortController) => { + const init = { + method, + headers, + signal: abortController.signal + }; + if (method === "TRACE") { + init.method = "GET"; + const req = new Request(url, init); + Object.defineProperty(req, "method", { + get() { + return "TRACE"; + } + }); + return req; + } + if (!(method === "GET" || method === "HEAD")) { + if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) { + init.body = new ReadableStream({ + start(controller) { + controller.enqueue(incoming.rawBody); + controller.close(); + } + }); + } else if (incoming[wrapBodyStream]) { + let reader; + init.body = new ReadableStream({ + async pull(controller) { + try { + reader ||= Readable.toWeb(incoming).getReader(); + const { done, value } = await reader.read(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + } catch (error) { + controller.error(error); + } + } + }); + } else { + init.body = Readable.toWeb(incoming); + } + } + return new Request(url, init); +}; +var getRequestCache = Symbol("getRequestCache"); +var requestCache = Symbol("requestCache"); +var incomingKey = Symbol("incomingKey"); +var urlKey = Symbol("urlKey"); +var headersKey = Symbol("headersKey"); +var abortControllerKey = Symbol("abortControllerKey"); +var getAbortController = Symbol("getAbortController"); +var requestPrototype = { + get method() { + return this[incomingKey].method || "GET"; + }, + get url() { + return this[urlKey]; + }, + get headers() { + return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]); + }, + [getAbortController]() { + this[getRequestCache](); + return this[abortControllerKey]; + }, + [getRequestCache]() { + this[abortControllerKey] ||= new AbortController(); + return this[requestCache] ||= newRequestFromIncoming( + this.method, + this[urlKey], + this.headers, + this[incomingKey], + this[abortControllerKey] + ); + } +}; +[ + "body", + "bodyUsed", + "cache", + "credentials", + "destination", + "integrity", + "mode", + "redirect", + "referrer", + "referrerPolicy", + "signal", + "keepalive" +].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + get() { + return this[getRequestCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + value: function() { + return this[getRequestCache]()[k](); + } + }); +}); +Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + method: this.method, + url: this.url, + headers: this.headers, + nativeRequest: this[requestCache] + }; + return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(requestPrototype, Request.prototype); +var newRequest = (incoming, defaultHostname) => { + const req = Object.create(requestPrototype); + req[incomingKey] = incoming; + const incomingUrl = incoming.url || ""; + if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL. + (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) { + if (incoming instanceof Http2ServerRequest) { + throw new RequestError("Absolute URL for :path is not allowed in HTTP/2"); + } + try { + const url2 = new URL(incomingUrl); + req[urlKey] = url2.href; + } catch (e) { + throw new RequestError("Invalid absolute URL", { cause: e }); + } + return req; + } + const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname; + if (!host) { + throw new RequestError("Missing host header"); + } + let scheme; + if (incoming instanceof Http2ServerRequest) { + scheme = incoming.scheme; + if (!(scheme === "http" || scheme === "https")) { + throw new RequestError("Unsupported scheme"); + } + } else { + scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http"; + } + const url = new URL(`${scheme}://${host}${incomingUrl}`); + if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) { + throw new RequestError("Invalid host header"); + } + req[urlKey] = url.href; + return req; +}; +export { + GlobalRequest, + Request, + RequestError, + abortControllerKey, + getAbortController, + newRequest, + toRequestError, + wrapBodyStream +}; diff --git a/node_modules/@hono/node-server/dist/response.d.mts b/node_modules/@hono/node-server/dist/response.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..57775edb7a080688c828f3ae3adb1dbcb4342f3c --- /dev/null +++ b/node_modules/@hono/node-server/dist/response.d.mts @@ -0,0 +1,26 @@ +import { OutgoingHttpHeaders } from 'node:http'; + +declare const getResponseCache: unique symbol; +declare const cacheKey: unique symbol; +type InternalCache = [ + number, + string | ReadableStream, + Record | [string, string][] | Headers | OutgoingHttpHeaders | undefined +]; +declare const GlobalResponse: { + new (body?: BodyInit | null, init?: ResponseInit): globalThis.Response; + prototype: globalThis.Response; + error(): globalThis.Response; + json(data: any, init?: ResponseInit): globalThis.Response; + redirect(url: string | URL, status?: number): globalThis.Response; +}; +declare class Response { + #private; + [getResponseCache](): globalThis.Response; + constructor(body?: BodyInit | null, init?: ResponseInit); + get headers(): Headers; + get status(): number; + get ok(): boolean; +} + +export { GlobalResponse, type InternalCache, Response, cacheKey }; diff --git a/node_modules/@hono/node-server/dist/response.d.ts b/node_modules/@hono/node-server/dist/response.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..57775edb7a080688c828f3ae3adb1dbcb4342f3c --- /dev/null +++ b/node_modules/@hono/node-server/dist/response.d.ts @@ -0,0 +1,26 @@ +import { OutgoingHttpHeaders } from 'node:http'; + +declare const getResponseCache: unique symbol; +declare const cacheKey: unique symbol; +type InternalCache = [ + number, + string | ReadableStream, + Record | [string, string][] | Headers | OutgoingHttpHeaders | undefined +]; +declare const GlobalResponse: { + new (body?: BodyInit | null, init?: ResponseInit): globalThis.Response; + prototype: globalThis.Response; + error(): globalThis.Response; + json(data: any, init?: ResponseInit): globalThis.Response; + redirect(url: string | URL, status?: number): globalThis.Response; +}; +declare class Response { + #private; + [getResponseCache](): globalThis.Response; + constructor(body?: BodyInit | null, init?: ResponseInit); + get headers(): Headers; + get status(): number; + get ok(): boolean; +} + +export { GlobalResponse, type InternalCache, Response, cacheKey }; diff --git a/node_modules/@hono/node-server/dist/response.js b/node_modules/@hono/node-server/dist/response.js new file mode 100644 index 0000000000000000000000000000000000000000..7661dda49b4202855615c0afb7cd05cfaadf2aff --- /dev/null +++ b/node_modules/@hono/node-server/dist/response.js @@ -0,0 +1,112 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/response.ts +var response_exports = {}; +__export(response_exports, { + GlobalResponse: () => GlobalResponse, + Response: () => Response, + cacheKey: () => cacheKey +}); +module.exports = __toCommonJS(response_exports); +var responseCache = Symbol("responseCache"); +var getResponseCache = Symbol("getResponseCache"); +var cacheKey = Symbol("cache"); +var GlobalResponse = global.Response; +var Response = class _Response { + #body; + #init; + [getResponseCache]() { + delete this[cacheKey]; + return this[responseCache] ||= new GlobalResponse(this.#body, this.#init); + } + constructor(body, init) { + let headers; + this.#body = body; + if (init instanceof _Response) { + const cachedGlobalResponse = init[responseCache]; + if (cachedGlobalResponse) { + this.#init = cachedGlobalResponse; + this[getResponseCache](); + return; + } else { + this.#init = init.#init; + headers = new Headers(init.#init.headers); + } + } else { + this.#init = init; + } + if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) { + ; + this[cacheKey] = [init?.status || 200, body, headers || init?.headers]; + } + } + get headers() { + const cache = this[cacheKey]; + if (cache) { + if (!(cache[2] instanceof Headers)) { + cache[2] = new Headers( + cache[2] || { "content-type": "text/plain; charset=UTF-8" } + ); + } + return cache[2]; + } + return this[getResponseCache]().headers; + } + get status() { + return this[cacheKey]?.[0] ?? this[getResponseCache]().status; + } + get ok() { + const status = this.status; + return status >= 200 && status < 300; + } +}; +["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => { + Object.defineProperty(Response.prototype, k, { + get() { + return this[getResponseCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(Response.prototype, k, { + value: function() { + return this[getResponseCache]()[k](); + } + }); +}); +Object.defineProperty(Response.prototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + status: this.status, + headers: this.headers, + ok: this.ok, + nativeResponse: this[responseCache] + }; + return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(Response, GlobalResponse); +Object.setPrototypeOf(Response.prototype, GlobalResponse.prototype); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + GlobalResponse, + Response, + cacheKey +}); diff --git a/node_modules/@hono/node-server/dist/response.mjs b/node_modules/@hono/node-server/dist/response.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2855e1c9e0771fb5f42f7392efa396746ec274bb --- /dev/null +++ b/node_modules/@hono/node-server/dist/response.mjs @@ -0,0 +1,85 @@ +// src/response.ts +var responseCache = Symbol("responseCache"); +var getResponseCache = Symbol("getResponseCache"); +var cacheKey = Symbol("cache"); +var GlobalResponse = global.Response; +var Response = class _Response { + #body; + #init; + [getResponseCache]() { + delete this[cacheKey]; + return this[responseCache] ||= new GlobalResponse(this.#body, this.#init); + } + constructor(body, init) { + let headers; + this.#body = body; + if (init instanceof _Response) { + const cachedGlobalResponse = init[responseCache]; + if (cachedGlobalResponse) { + this.#init = cachedGlobalResponse; + this[getResponseCache](); + return; + } else { + this.#init = init.#init; + headers = new Headers(init.#init.headers); + } + } else { + this.#init = init; + } + if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) { + ; + this[cacheKey] = [init?.status || 200, body, headers || init?.headers]; + } + } + get headers() { + const cache = this[cacheKey]; + if (cache) { + if (!(cache[2] instanceof Headers)) { + cache[2] = new Headers( + cache[2] || { "content-type": "text/plain; charset=UTF-8" } + ); + } + return cache[2]; + } + return this[getResponseCache]().headers; + } + get status() { + return this[cacheKey]?.[0] ?? this[getResponseCache]().status; + } + get ok() { + const status = this.status; + return status >= 200 && status < 300; + } +}; +["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => { + Object.defineProperty(Response.prototype, k, { + get() { + return this[getResponseCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(Response.prototype, k, { + value: function() { + return this[getResponseCache]()[k](); + } + }); +}); +Object.defineProperty(Response.prototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + status: this.status, + headers: this.headers, + ok: this.ok, + nativeResponse: this[responseCache] + }; + return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(Response, GlobalResponse); +Object.setPrototypeOf(Response.prototype, GlobalResponse.prototype); +export { + GlobalResponse, + Response, + cacheKey +}; diff --git a/node_modules/@hono/node-server/dist/serve-static.d.mts b/node_modules/@hono/node-server/dist/serve-static.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9a1c83d6850162aeca9e8617c9bce9ff52f41026 --- /dev/null +++ b/node_modules/@hono/node-server/dist/serve-static.d.mts @@ -0,0 +1,17 @@ +import { Env, Context, MiddlewareHandler } from 'hono'; + +type ServeStaticOptions = { + /** + * Root path, relative to current working directory from which the app was started. Absolute paths are not supported. + */ + root?: string; + path?: string; + index?: string; + precompressed?: boolean; + rewriteRequestPath?: (path: string, c: Context) => string; + onFound?: (path: string, c: Context) => void | Promise; + onNotFound?: (path: string, c: Context) => void | Promise; +}; +declare const serveStatic: (options?: ServeStaticOptions) => MiddlewareHandler; + +export { type ServeStaticOptions, serveStatic }; diff --git a/node_modules/@hono/node-server/dist/serve-static.d.ts b/node_modules/@hono/node-server/dist/serve-static.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9a1c83d6850162aeca9e8617c9bce9ff52f41026 --- /dev/null +++ b/node_modules/@hono/node-server/dist/serve-static.d.ts @@ -0,0 +1,17 @@ +import { Env, Context, MiddlewareHandler } from 'hono'; + +type ServeStaticOptions = { + /** + * Root path, relative to current working directory from which the app was started. Absolute paths are not supported. + */ + root?: string; + path?: string; + index?: string; + precompressed?: boolean; + rewriteRequestPath?: (path: string, c: Context) => string; + onFound?: (path: string, c: Context) => void | Promise; + onNotFound?: (path: string, c: Context) => void | Promise; +}; +declare const serveStatic: (options?: ServeStaticOptions) => MiddlewareHandler; + +export { type ServeStaticOptions, serveStatic }; diff --git a/node_modules/@hono/node-server/dist/serve-static.js b/node_modules/@hono/node-server/dist/serve-static.js new file mode 100644 index 0000000000000000000000000000000000000000..b89e33132ffd1a495f0798f1c3e4d9a6ab2877bd --- /dev/null +++ b/node_modules/@hono/node-server/dist/serve-static.js @@ -0,0 +1,177 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/serve-static.ts +var serve_static_exports = {}; +__export(serve_static_exports, { + serveStatic: () => serveStatic +}); +module.exports = __toCommonJS(serve_static_exports); +var import_mime = require("hono/utils/mime"); +var import_node_fs = require("fs"); +var import_node_path = require("path"); +var import_node_process = require("process"); +var import_node_stream = require("stream"); +var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i; +var ENCODINGS = { + br: ".br", + zstd: ".zst", + gzip: ".gz" +}; +var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS); +var pr54206Applied = () => { + const [major, minor] = import_node_process.versions.node.split(".").map((component) => parseInt(component)); + return major >= 23 || major === 22 && minor >= 7 || major === 20 && minor >= 18; +}; +var useReadableToWeb = pr54206Applied(); +var createStreamBody = (stream) => { + if (useReadableToWeb) { + return import_node_stream.Readable.toWeb(stream); + } + const body = new ReadableStream({ + start(controller) { + stream.on("data", (chunk) => { + controller.enqueue(chunk); + }); + stream.on("error", (err) => { + controller.error(err); + }); + stream.on("end", () => { + controller.close(); + }); + }, + cancel() { + stream.destroy(); + } + }); + return body; +}; +var getStats = (path) => { + let stats; + try { + stats = (0, import_node_fs.statSync)(path); + } catch { + } + return stats; +}; +var tryDecode = (str, decoder) => { + try { + return decoder(str); + } catch { + return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => { + try { + return decoder(match); + } catch { + return match; + } + }); + } +}; +var tryDecodeURI = (str) => tryDecode(str, decodeURI); +var serveStatic = (options = { root: "" }) => { + const root = options.root || ""; + const optionPath = options.path; + if (root !== "" && !(0, import_node_fs.existsSync)(root)) { + console.error(`serveStatic: root path '${root}' is not found, are you sure it's correct?`); + } + return async (c, next) => { + if (c.finalized) { + return next(); + } + let filename; + if (optionPath) { + filename = optionPath; + } else { + try { + filename = tryDecodeURI(c.req.path); + if (/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}/.test(filename)) { + throw new Error(); + } + } catch { + await options.onNotFound?.(c.req.path, c); + return next(); + } + } + let path = (0, import_node_path.join)( + root, + !optionPath && options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename + ); + let stats = getStats(path); + if (stats && stats.isDirectory()) { + const indexFile = options.index ?? "index.html"; + path = (0, import_node_path.join)(path, indexFile); + stats = getStats(path); + } + if (!stats) { + await options.onNotFound?.(path, c); + return next(); + } + const mimeType = (0, import_mime.getMimeType)(path); + c.header("Content-Type", mimeType || "application/octet-stream"); + if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) { + const acceptEncodingSet = new Set( + c.req.header("Accept-Encoding")?.split(",").map((encoding) => encoding.trim()) + ); + for (const encoding of ENCODINGS_ORDERED_KEYS) { + if (!acceptEncodingSet.has(encoding)) { + continue; + } + const precompressedStats = getStats(path + ENCODINGS[encoding]); + if (precompressedStats) { + c.header("Content-Encoding", encoding); + c.header("Vary", "Accept-Encoding", { append: true }); + stats = precompressedStats; + path = path + ENCODINGS[encoding]; + break; + } + } + } + let result; + const size = stats.size; + const range = c.req.header("range") || ""; + if (c.req.method == "HEAD" || c.req.method == "OPTIONS") { + c.header("Content-Length", size.toString()); + c.status(200); + result = c.body(null); + } else if (!range) { + c.header("Content-Length", size.toString()); + result = c.body(createStreamBody((0, import_node_fs.createReadStream)(path)), 200); + } else { + c.header("Accept-Ranges", "bytes"); + c.header("Date", stats.birthtime.toUTCString()); + const parts = range.replace(/bytes=/, "").split("-", 2); + const start = parseInt(parts[0], 10) || 0; + let end = parseInt(parts[1], 10) || size - 1; + if (size < end - start + 1) { + end = size - 1; + } + const chunksize = end - start + 1; + const stream = (0, import_node_fs.createReadStream)(path, { start, end }); + c.header("Content-Length", chunksize.toString()); + c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`); + result = c.body(createStreamBody(stream), 206); + } + await options.onFound?.(path, c); + return result; + }; +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + serveStatic +}); diff --git a/node_modules/@hono/node-server/dist/serve-static.mjs b/node_modules/@hono/node-server/dist/serve-static.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5ac3b55ad89bc5c80fc05149d17083c45895c733 --- /dev/null +++ b/node_modules/@hono/node-server/dist/serve-static.mjs @@ -0,0 +1,152 @@ +// src/serve-static.ts +import { getMimeType } from "hono/utils/mime"; +import { createReadStream, statSync, existsSync } from "fs"; +import { join } from "path"; +import { versions } from "process"; +import { Readable } from "stream"; +var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i; +var ENCODINGS = { + br: ".br", + zstd: ".zst", + gzip: ".gz" +}; +var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS); +var pr54206Applied = () => { + const [major, minor] = versions.node.split(".").map((component) => parseInt(component)); + return major >= 23 || major === 22 && minor >= 7 || major === 20 && minor >= 18; +}; +var useReadableToWeb = pr54206Applied(); +var createStreamBody = (stream) => { + if (useReadableToWeb) { + return Readable.toWeb(stream); + } + const body = new ReadableStream({ + start(controller) { + stream.on("data", (chunk) => { + controller.enqueue(chunk); + }); + stream.on("error", (err) => { + controller.error(err); + }); + stream.on("end", () => { + controller.close(); + }); + }, + cancel() { + stream.destroy(); + } + }); + return body; +}; +var getStats = (path) => { + let stats; + try { + stats = statSync(path); + } catch { + } + return stats; +}; +var tryDecode = (str, decoder) => { + try { + return decoder(str); + } catch { + return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => { + try { + return decoder(match); + } catch { + return match; + } + }); + } +}; +var tryDecodeURI = (str) => tryDecode(str, decodeURI); +var serveStatic = (options = { root: "" }) => { + const root = options.root || ""; + const optionPath = options.path; + if (root !== "" && !existsSync(root)) { + console.error(`serveStatic: root path '${root}' is not found, are you sure it's correct?`); + } + return async (c, next) => { + if (c.finalized) { + return next(); + } + let filename; + if (optionPath) { + filename = optionPath; + } else { + try { + filename = tryDecodeURI(c.req.path); + if (/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}/.test(filename)) { + throw new Error(); + } + } catch { + await options.onNotFound?.(c.req.path, c); + return next(); + } + } + let path = join( + root, + !optionPath && options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename + ); + let stats = getStats(path); + if (stats && stats.isDirectory()) { + const indexFile = options.index ?? "index.html"; + path = join(path, indexFile); + stats = getStats(path); + } + if (!stats) { + await options.onNotFound?.(path, c); + return next(); + } + const mimeType = getMimeType(path); + c.header("Content-Type", mimeType || "application/octet-stream"); + if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) { + const acceptEncodingSet = new Set( + c.req.header("Accept-Encoding")?.split(",").map((encoding) => encoding.trim()) + ); + for (const encoding of ENCODINGS_ORDERED_KEYS) { + if (!acceptEncodingSet.has(encoding)) { + continue; + } + const precompressedStats = getStats(path + ENCODINGS[encoding]); + if (precompressedStats) { + c.header("Content-Encoding", encoding); + c.header("Vary", "Accept-Encoding", { append: true }); + stats = precompressedStats; + path = path + ENCODINGS[encoding]; + break; + } + } + } + let result; + const size = stats.size; + const range = c.req.header("range") || ""; + if (c.req.method == "HEAD" || c.req.method == "OPTIONS") { + c.header("Content-Length", size.toString()); + c.status(200); + result = c.body(null); + } else if (!range) { + c.header("Content-Length", size.toString()); + result = c.body(createStreamBody(createReadStream(path)), 200); + } else { + c.header("Accept-Ranges", "bytes"); + c.header("Date", stats.birthtime.toUTCString()); + const parts = range.replace(/bytes=/, "").split("-", 2); + const start = parseInt(parts[0], 10) || 0; + let end = parseInt(parts[1], 10) || size - 1; + if (size < end - start + 1) { + end = size - 1; + } + const chunksize = end - start + 1; + const stream = createReadStream(path, { start, end }); + c.header("Content-Length", chunksize.toString()); + c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`); + result = c.body(createStreamBody(stream), 206); + } + await options.onFound?.(path, c); + return result; + }; +}; +export { + serveStatic +}; diff --git a/node_modules/@hono/node-server/dist/server.d.mts b/node_modules/@hono/node-server/dist/server.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a8e95432ce56a800ae10a12ca5a96f7ef7bd1e81 --- /dev/null +++ b/node_modules/@hono/node-server/dist/server.d.mts @@ -0,0 +1,10 @@ +import { AddressInfo } from 'node:net'; +import { Options, ServerType } from './types.mjs'; +import 'node:http'; +import 'node:http2'; +import 'node:https'; + +declare const createAdaptorServer: (options: Options) => ServerType; +declare const serve: (options: Options, listeningListener?: (info: AddressInfo) => void) => ServerType; + +export { createAdaptorServer, serve }; diff --git a/node_modules/@hono/node-server/dist/server.d.ts b/node_modules/@hono/node-server/dist/server.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6392830326508495dc130bb863663f3526db085 --- /dev/null +++ b/node_modules/@hono/node-server/dist/server.d.ts @@ -0,0 +1,10 @@ +import { AddressInfo } from 'node:net'; +import { Options, ServerType } from './types.js'; +import 'node:http'; +import 'node:http2'; +import 'node:https'; + +declare const createAdaptorServer: (options: Options) => ServerType; +declare const serve: (options: Options, listeningListener?: (info: AddressInfo) => void) => ServerType; + +export { createAdaptorServer, serve }; diff --git a/node_modules/@hono/node-server/dist/server.js b/node_modules/@hono/node-server/dist/server.js new file mode 100644 index 0000000000000000000000000000000000000000..2cebe018608110d8c2714b80070e409362bb357c --- /dev/null +++ b/node_modules/@hono/node-server/dist/server.js @@ -0,0 +1,696 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/server.ts +var server_exports = {}; +__export(server_exports, { + createAdaptorServer: () => createAdaptorServer, + serve: () => serve +}); +module.exports = __toCommonJS(server_exports); +var import_node_http = require("http"); + +// src/listener.ts +var import_node_http22 = require("http2"); + +// src/request.ts +var import_node_http2 = require("http2"); +var import_node_stream = require("stream"); +var RequestError = class extends Error { + constructor(message, options) { + super(message, options); + this.name = "RequestError"; + } +}; +var toRequestError = (e) => { + if (e instanceof RequestError) { + return e; + } + return new RequestError(e.message, { cause: e }); +}; +var GlobalRequest = global.Request; +var Request = class extends GlobalRequest { + constructor(input, options) { + if (typeof input === "object" && getRequestCache in input) { + input = input[getRequestCache](); + } + if (typeof options?.body?.getReader !== "undefined") { + ; + options.duplex ??= "half"; + } + super(input, options); + } +}; +var newHeadersFromIncoming = (incoming) => { + const headerRecord = []; + const rawHeaders = incoming.rawHeaders; + for (let i = 0; i < rawHeaders.length; i += 2) { + const { [i]: key, [i + 1]: value } = rawHeaders; + if (key.charCodeAt(0) !== /*:*/ + 58) { + headerRecord.push([key, value]); + } + } + return new Headers(headerRecord); +}; +var wrapBodyStream = Symbol("wrapBodyStream"); +var newRequestFromIncoming = (method, url, headers, incoming, abortController) => { + const init = { + method, + headers, + signal: abortController.signal + }; + if (method === "TRACE") { + init.method = "GET"; + const req = new Request(url, init); + Object.defineProperty(req, "method", { + get() { + return "TRACE"; + } + }); + return req; + } + if (!(method === "GET" || method === "HEAD")) { + if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) { + init.body = new ReadableStream({ + start(controller) { + controller.enqueue(incoming.rawBody); + controller.close(); + } + }); + } else if (incoming[wrapBodyStream]) { + let reader; + init.body = new ReadableStream({ + async pull(controller) { + try { + reader ||= import_node_stream.Readable.toWeb(incoming).getReader(); + const { done, value } = await reader.read(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + } catch (error) { + controller.error(error); + } + } + }); + } else { + init.body = import_node_stream.Readable.toWeb(incoming); + } + } + return new Request(url, init); +}; +var getRequestCache = Symbol("getRequestCache"); +var requestCache = Symbol("requestCache"); +var incomingKey = Symbol("incomingKey"); +var urlKey = Symbol("urlKey"); +var headersKey = Symbol("headersKey"); +var abortControllerKey = Symbol("abortControllerKey"); +var getAbortController = Symbol("getAbortController"); +var requestPrototype = { + get method() { + return this[incomingKey].method || "GET"; + }, + get url() { + return this[urlKey]; + }, + get headers() { + return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]); + }, + [getAbortController]() { + this[getRequestCache](); + return this[abortControllerKey]; + }, + [getRequestCache]() { + this[abortControllerKey] ||= new AbortController(); + return this[requestCache] ||= newRequestFromIncoming( + this.method, + this[urlKey], + this.headers, + this[incomingKey], + this[abortControllerKey] + ); + } +}; +[ + "body", + "bodyUsed", + "cache", + "credentials", + "destination", + "integrity", + "mode", + "redirect", + "referrer", + "referrerPolicy", + "signal", + "keepalive" +].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + get() { + return this[getRequestCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + value: function() { + return this[getRequestCache]()[k](); + } + }); +}); +Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + method: this.method, + url: this.url, + headers: this.headers, + nativeRequest: this[requestCache] + }; + return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(requestPrototype, Request.prototype); +var newRequest = (incoming, defaultHostname) => { + const req = Object.create(requestPrototype); + req[incomingKey] = incoming; + const incomingUrl = incoming.url || ""; + if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL. + (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) { + if (incoming instanceof import_node_http2.Http2ServerRequest) { + throw new RequestError("Absolute URL for :path is not allowed in HTTP/2"); + } + try { + const url2 = new URL(incomingUrl); + req[urlKey] = url2.href; + } catch (e) { + throw new RequestError("Invalid absolute URL", { cause: e }); + } + return req; + } + const host = (incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname; + if (!host) { + throw new RequestError("Missing host header"); + } + let scheme; + if (incoming instanceof import_node_http2.Http2ServerRequest) { + scheme = incoming.scheme; + if (!(scheme === "http" || scheme === "https")) { + throw new RequestError("Unsupported scheme"); + } + } else { + scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http"; + } + const url = new URL(`${scheme}://${host}${incomingUrl}`); + if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) { + throw new RequestError("Invalid host header"); + } + req[urlKey] = url.href; + return req; +}; + +// src/response.ts +var responseCache = Symbol("responseCache"); +var getResponseCache = Symbol("getResponseCache"); +var cacheKey = Symbol("cache"); +var GlobalResponse = global.Response; +var Response2 = class _Response { + #body; + #init; + [getResponseCache]() { + delete this[cacheKey]; + return this[responseCache] ||= new GlobalResponse(this.#body, this.#init); + } + constructor(body, init) { + let headers; + this.#body = body; + if (init instanceof _Response) { + const cachedGlobalResponse = init[responseCache]; + if (cachedGlobalResponse) { + this.#init = cachedGlobalResponse; + this[getResponseCache](); + return; + } else { + this.#init = init.#init; + headers = new Headers(init.#init.headers); + } + } else { + this.#init = init; + } + if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) { + ; + this[cacheKey] = [init?.status || 200, body, headers || init?.headers]; + } + } + get headers() { + const cache = this[cacheKey]; + if (cache) { + if (!(cache[2] instanceof Headers)) { + cache[2] = new Headers( + cache[2] || { "content-type": "text/plain; charset=UTF-8" } + ); + } + return cache[2]; + } + return this[getResponseCache]().headers; + } + get status() { + return this[cacheKey]?.[0] ?? this[getResponseCache]().status; + } + get ok() { + const status = this.status; + return status >= 200 && status < 300; + } +}; +["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + get() { + return this[getResponseCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + value: function() { + return this[getResponseCache]()[k](); + } + }); +}); +Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + status: this.status, + headers: this.headers, + ok: this.ok, + nativeResponse: this[responseCache] + }; + return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(Response2, GlobalResponse); +Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype); + +// src/utils.ts +async function readWithoutBlocking(readPromise) { + return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]); +} +function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) { + const cancel = (error) => { + reader.cancel(error).catch(() => { + }); + }; + writable.on("close", cancel); + writable.on("error", cancel); + (currentReadPromise ?? reader.read()).then(flow, handleStreamError); + return reader.closed.finally(() => { + writable.off("close", cancel); + writable.off("error", cancel); + }); + function handleStreamError(error) { + if (error) { + writable.destroy(error); + } + } + function onDrain() { + reader.read().then(flow, handleStreamError); + } + function flow({ done, value }) { + try { + if (done) { + writable.end(); + } else if (!writable.write(value)) { + writable.once("drain", onDrain); + } else { + return reader.read().then(flow, handleStreamError); + } + } catch (e) { + handleStreamError(e); + } + } +} +function writeFromReadableStream(stream, writable) { + if (stream.locked) { + throw new TypeError("ReadableStream is locked."); + } else if (writable.destroyed) { + return; + } + return writeFromReadableStreamDefaultReader(stream.getReader(), writable); +} +var buildOutgoingHttpHeaders = (headers) => { + const res = {}; + if (!(headers instanceof Headers)) { + headers = new Headers(headers ?? void 0); + } + const cookies = []; + for (const [k, v] of headers) { + if (k === "set-cookie") { + cookies.push(v); + } else { + res[k] = v; + } + } + if (cookies.length > 0) { + res["set-cookie"] = cookies; + } + res["content-type"] ??= "text/plain; charset=UTF-8"; + return res; +}; + +// src/utils/response/constants.ts +var X_ALREADY_SENT = "x-hono-already-sent"; + +// src/globals.ts +var import_node_crypto = __toESM(require("crypto")); +if (typeof global.crypto === "undefined") { + global.crypto = import_node_crypto.default; +} + +// src/listener.ts +var outgoingEnded = Symbol("outgoingEnded"); +var incomingDraining = Symbol("incomingDraining"); +var DRAIN_TIMEOUT_MS = 500; +var MAX_DRAIN_BYTES = 64 * 1024 * 1024; +var drainIncoming = (incoming) => { + const incomingWithDrainState = incoming; + if (incoming.destroyed || incomingWithDrainState[incomingDraining]) { + return; + } + incomingWithDrainState[incomingDraining] = true; + if (incoming instanceof import_node_http22.Http2ServerRequest) { + try { + ; + incoming.stream?.close?.(import_node_http22.constants.NGHTTP2_NO_ERROR); + } catch { + } + return; + } + let bytesRead = 0; + const cleanup = () => { + clearTimeout(timer); + incoming.off("data", onData); + incoming.off("end", cleanup); + incoming.off("error", cleanup); + }; + const forceClose = () => { + cleanup(); + const socket = incoming.socket; + if (socket && !socket.destroyed) { + socket.destroySoon(); + } + }; + const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS); + timer.unref?.(); + const onData = (chunk) => { + bytesRead += chunk.length; + if (bytesRead > MAX_DRAIN_BYTES) { + forceClose(); + } + }; + incoming.on("data", onData); + incoming.on("end", cleanup); + incoming.on("error", cleanup); + incoming.resume(); +}; +var handleRequestError = () => new Response(null, { + status: 400 +}); +var handleFetchError = (e) => new Response(null, { + status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 +}); +var handleResponseError = (e, outgoing) => { + const err = e instanceof Error ? e : new Error("unknown error", { cause: e }); + if (err.code === "ERR_STREAM_PREMATURE_CLOSE") { + console.info("The user aborted a request."); + } else { + console.error(e); + if (!outgoing.headersSent) { + outgoing.writeHead(500, { "Content-Type": "text/plain" }); + } + outgoing.end(`Error: ${err.message}`); + outgoing.destroy(err); + } +}; +var flushHeaders = (outgoing) => { + if ("flushHeaders" in outgoing && outgoing.writable) { + outgoing.flushHeaders(); + } +}; +var responseViaCache = async (res, outgoing) => { + let [status, body, header] = res[cacheKey]; + let hasContentLength = false; + if (!header) { + header = { "content-type": "text/plain; charset=UTF-8" }; + } else if (header instanceof Headers) { + hasContentLength = header.has("content-length"); + header = buildOutgoingHttpHeaders(header); + } else if (Array.isArray(header)) { + const headerObj = new Headers(header); + hasContentLength = headerObj.has("content-length"); + header = buildOutgoingHttpHeaders(headerObj); + } else { + for (const key in header) { + if (key.length === 14 && key.toLowerCase() === "content-length") { + hasContentLength = true; + break; + } + } + } + if (!hasContentLength) { + if (typeof body === "string") { + header["Content-Length"] = Buffer.byteLength(body); + } else if (body instanceof Uint8Array) { + header["Content-Length"] = body.byteLength; + } else if (body instanceof Blob) { + header["Content-Length"] = body.size; + } + } + outgoing.writeHead(status, header); + if (typeof body === "string" || body instanceof Uint8Array) { + outgoing.end(body); + } else if (body instanceof Blob) { + outgoing.end(new Uint8Array(await body.arrayBuffer())); + } else { + flushHeaders(outgoing); + await writeFromReadableStream(body, outgoing)?.catch( + (e) => handleResponseError(e, outgoing) + ); + } + ; + outgoing[outgoingEnded]?.(); +}; +var isPromise = (res) => typeof res.then === "function"; +var responseViaResponseObject = async (res, outgoing, options = {}) => { + if (isPromise(res)) { + if (options.errorHandler) { + try { + res = await res; + } catch (err) { + const errRes = await options.errorHandler(err); + if (!errRes) { + return; + } + res = errRes; + } + } else { + res = await res.catch(handleFetchError); + } + } + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + const resHeaderRecord = buildOutgoingHttpHeaders(res.headers); + if (res.body) { + const reader = res.body.getReader(); + const values = []; + let done = false; + let currentReadPromise = void 0; + if (resHeaderRecord["transfer-encoding"] !== "chunked") { + let maxReadCount = 2; + for (let i = 0; i < maxReadCount; i++) { + currentReadPromise ||= reader.read(); + const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => { + console.error(e); + done = true; + }); + if (!chunk) { + if (i === 1) { + await new Promise((resolve) => setTimeout(resolve)); + maxReadCount = 3; + continue; + } + break; + } + currentReadPromise = void 0; + if (chunk.value) { + values.push(chunk.value); + } + if (chunk.done) { + done = true; + break; + } + } + if (done && !("content-length" in resHeaderRecord)) { + resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0); + } + } + outgoing.writeHead(res.status, resHeaderRecord); + values.forEach((value) => { + ; + outgoing.write(value); + }); + if (done) { + outgoing.end(); + } else { + if (values.length === 0) { + flushHeaders(outgoing); + } + await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise); + } + } else if (resHeaderRecord[X_ALREADY_SENT]) { + } else { + outgoing.writeHead(res.status, resHeaderRecord); + outgoing.end(); + } + ; + outgoing[outgoingEnded]?.(); +}; +var getRequestListener = (fetchCallback, options = {}) => { + const autoCleanupIncoming = options.autoCleanupIncoming ?? true; + if (options.overrideGlobalObjects !== false && global.Request !== Request) { + Object.defineProperty(global, "Request", { + value: Request + }); + Object.defineProperty(global, "Response", { + value: Response2 + }); + } + return async (incoming, outgoing) => { + let res, req; + try { + req = newRequest(incoming, options.hostname); + let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD"; + if (!incomingEnded) { + ; + incoming[wrapBodyStream] = true; + incoming.on("end", () => { + incomingEnded = true; + }); + if (incoming instanceof import_node_http22.Http2ServerRequest) { + ; + outgoing[outgoingEnded] = () => { + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }; + } + outgoing.on("finish", () => { + if (!incomingEnded) { + drainIncoming(incoming); + } + }); + } + outgoing.on("close", () => { + const abortController = req[abortControllerKey]; + if (abortController) { + if (incoming.errored) { + req[abortControllerKey].abort(incoming.errored.toString()); + } else if (!outgoing.writableFinished) { + req[abortControllerKey].abort("Client connection prematurely closed."); + } + } + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }); + res = fetchCallback(req, { incoming, outgoing }); + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + } catch (e) { + if (!res) { + if (options.errorHandler) { + res = await options.errorHandler(req ? e : toRequestError(e)); + if (!res) { + return; + } + } else if (!req) { + res = handleRequestError(); + } else { + res = handleFetchError(e); + } + } else { + return handleResponseError(e, outgoing); + } + } + try { + return await responseViaResponseObject(res, outgoing, options); + } catch (e) { + return handleResponseError(e, outgoing); + } + }; +}; + +// src/server.ts +var createAdaptorServer = (options) => { + const fetchCallback = options.fetch; + const requestListener = getRequestListener(fetchCallback, { + hostname: options.hostname, + overrideGlobalObjects: options.overrideGlobalObjects, + autoCleanupIncoming: options.autoCleanupIncoming + }); + const createServer = options.createServer || import_node_http.createServer; + const server = createServer(options.serverOptions || {}, requestListener); + return server; +}; +var serve = (options, listeningListener) => { + const server = createAdaptorServer(options); + server.listen(options?.port ?? 3e3, options.hostname, () => { + const serverInfo = server.address(); + listeningListener && listeningListener(serverInfo); + }); + return server; +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + createAdaptorServer, + serve +}); diff --git a/node_modules/@hono/node-server/dist/server.mjs b/node_modules/@hono/node-server/dist/server.mjs new file mode 100644 index 0000000000000000000000000000000000000000..252b2d9218ab6fa0280919b81b134367bf429f66 --- /dev/null +++ b/node_modules/@hono/node-server/dist/server.mjs @@ -0,0 +1,660 @@ +// src/server.ts +import { createServer as createServerHTTP } from "http"; + +// src/listener.ts +import { Http2ServerRequest as Http2ServerRequest2, constants as h2constants } from "http2"; + +// src/request.ts +import { Http2ServerRequest } from "http2"; +import { Readable } from "stream"; +var RequestError = class extends Error { + constructor(message, options) { + super(message, options); + this.name = "RequestError"; + } +}; +var toRequestError = (e) => { + if (e instanceof RequestError) { + return e; + } + return new RequestError(e.message, { cause: e }); +}; +var GlobalRequest = global.Request; +var Request = class extends GlobalRequest { + constructor(input, options) { + if (typeof input === "object" && getRequestCache in input) { + input = input[getRequestCache](); + } + if (typeof options?.body?.getReader !== "undefined") { + ; + options.duplex ??= "half"; + } + super(input, options); + } +}; +var newHeadersFromIncoming = (incoming) => { + const headerRecord = []; + const rawHeaders = incoming.rawHeaders; + for (let i = 0; i < rawHeaders.length; i += 2) { + const { [i]: key, [i + 1]: value } = rawHeaders; + if (key.charCodeAt(0) !== /*:*/ + 58) { + headerRecord.push([key, value]); + } + } + return new Headers(headerRecord); +}; +var wrapBodyStream = Symbol("wrapBodyStream"); +var newRequestFromIncoming = (method, url, headers, incoming, abortController) => { + const init = { + method, + headers, + signal: abortController.signal + }; + if (method === "TRACE") { + init.method = "GET"; + const req = new Request(url, init); + Object.defineProperty(req, "method", { + get() { + return "TRACE"; + } + }); + return req; + } + if (!(method === "GET" || method === "HEAD")) { + if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) { + init.body = new ReadableStream({ + start(controller) { + controller.enqueue(incoming.rawBody); + controller.close(); + } + }); + } else if (incoming[wrapBodyStream]) { + let reader; + init.body = new ReadableStream({ + async pull(controller) { + try { + reader ||= Readable.toWeb(incoming).getReader(); + const { done, value } = await reader.read(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + } catch (error) { + controller.error(error); + } + } + }); + } else { + init.body = Readable.toWeb(incoming); + } + } + return new Request(url, init); +}; +var getRequestCache = Symbol("getRequestCache"); +var requestCache = Symbol("requestCache"); +var incomingKey = Symbol("incomingKey"); +var urlKey = Symbol("urlKey"); +var headersKey = Symbol("headersKey"); +var abortControllerKey = Symbol("abortControllerKey"); +var getAbortController = Symbol("getAbortController"); +var requestPrototype = { + get method() { + return this[incomingKey].method || "GET"; + }, + get url() { + return this[urlKey]; + }, + get headers() { + return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]); + }, + [getAbortController]() { + this[getRequestCache](); + return this[abortControllerKey]; + }, + [getRequestCache]() { + this[abortControllerKey] ||= new AbortController(); + return this[requestCache] ||= newRequestFromIncoming( + this.method, + this[urlKey], + this.headers, + this[incomingKey], + this[abortControllerKey] + ); + } +}; +[ + "body", + "bodyUsed", + "cache", + "credentials", + "destination", + "integrity", + "mode", + "redirect", + "referrer", + "referrerPolicy", + "signal", + "keepalive" +].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + get() { + return this[getRequestCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + value: function() { + return this[getRequestCache]()[k](); + } + }); +}); +Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + method: this.method, + url: this.url, + headers: this.headers, + nativeRequest: this[requestCache] + }; + return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(requestPrototype, Request.prototype); +var newRequest = (incoming, defaultHostname) => { + const req = Object.create(requestPrototype); + req[incomingKey] = incoming; + const incomingUrl = incoming.url || ""; + if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL. + (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) { + if (incoming instanceof Http2ServerRequest) { + throw new RequestError("Absolute URL for :path is not allowed in HTTP/2"); + } + try { + const url2 = new URL(incomingUrl); + req[urlKey] = url2.href; + } catch (e) { + throw new RequestError("Invalid absolute URL", { cause: e }); + } + return req; + } + const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname; + if (!host) { + throw new RequestError("Missing host header"); + } + let scheme; + if (incoming instanceof Http2ServerRequest) { + scheme = incoming.scheme; + if (!(scheme === "http" || scheme === "https")) { + throw new RequestError("Unsupported scheme"); + } + } else { + scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http"; + } + const url = new URL(`${scheme}://${host}${incomingUrl}`); + if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) { + throw new RequestError("Invalid host header"); + } + req[urlKey] = url.href; + return req; +}; + +// src/response.ts +var responseCache = Symbol("responseCache"); +var getResponseCache = Symbol("getResponseCache"); +var cacheKey = Symbol("cache"); +var GlobalResponse = global.Response; +var Response2 = class _Response { + #body; + #init; + [getResponseCache]() { + delete this[cacheKey]; + return this[responseCache] ||= new GlobalResponse(this.#body, this.#init); + } + constructor(body, init) { + let headers; + this.#body = body; + if (init instanceof _Response) { + const cachedGlobalResponse = init[responseCache]; + if (cachedGlobalResponse) { + this.#init = cachedGlobalResponse; + this[getResponseCache](); + return; + } else { + this.#init = init.#init; + headers = new Headers(init.#init.headers); + } + } else { + this.#init = init; + } + if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) { + ; + this[cacheKey] = [init?.status || 200, body, headers || init?.headers]; + } + } + get headers() { + const cache = this[cacheKey]; + if (cache) { + if (!(cache[2] instanceof Headers)) { + cache[2] = new Headers( + cache[2] || { "content-type": "text/plain; charset=UTF-8" } + ); + } + return cache[2]; + } + return this[getResponseCache]().headers; + } + get status() { + return this[cacheKey]?.[0] ?? this[getResponseCache]().status; + } + get ok() { + const status = this.status; + return status >= 200 && status < 300; + } +}; +["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + get() { + return this[getResponseCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + value: function() { + return this[getResponseCache]()[k](); + } + }); +}); +Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + status: this.status, + headers: this.headers, + ok: this.ok, + nativeResponse: this[responseCache] + }; + return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(Response2, GlobalResponse); +Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype); + +// src/utils.ts +async function readWithoutBlocking(readPromise) { + return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]); +} +function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) { + const cancel = (error) => { + reader.cancel(error).catch(() => { + }); + }; + writable.on("close", cancel); + writable.on("error", cancel); + (currentReadPromise ?? reader.read()).then(flow, handleStreamError); + return reader.closed.finally(() => { + writable.off("close", cancel); + writable.off("error", cancel); + }); + function handleStreamError(error) { + if (error) { + writable.destroy(error); + } + } + function onDrain() { + reader.read().then(flow, handleStreamError); + } + function flow({ done, value }) { + try { + if (done) { + writable.end(); + } else if (!writable.write(value)) { + writable.once("drain", onDrain); + } else { + return reader.read().then(flow, handleStreamError); + } + } catch (e) { + handleStreamError(e); + } + } +} +function writeFromReadableStream(stream, writable) { + if (stream.locked) { + throw new TypeError("ReadableStream is locked."); + } else if (writable.destroyed) { + return; + } + return writeFromReadableStreamDefaultReader(stream.getReader(), writable); +} +var buildOutgoingHttpHeaders = (headers) => { + const res = {}; + if (!(headers instanceof Headers)) { + headers = new Headers(headers ?? void 0); + } + const cookies = []; + for (const [k, v] of headers) { + if (k === "set-cookie") { + cookies.push(v); + } else { + res[k] = v; + } + } + if (cookies.length > 0) { + res["set-cookie"] = cookies; + } + res["content-type"] ??= "text/plain; charset=UTF-8"; + return res; +}; + +// src/utils/response/constants.ts +var X_ALREADY_SENT = "x-hono-already-sent"; + +// src/globals.ts +import crypto from "crypto"; +if (typeof global.crypto === "undefined") { + global.crypto = crypto; +} + +// src/listener.ts +var outgoingEnded = Symbol("outgoingEnded"); +var incomingDraining = Symbol("incomingDraining"); +var DRAIN_TIMEOUT_MS = 500; +var MAX_DRAIN_BYTES = 64 * 1024 * 1024; +var drainIncoming = (incoming) => { + const incomingWithDrainState = incoming; + if (incoming.destroyed || incomingWithDrainState[incomingDraining]) { + return; + } + incomingWithDrainState[incomingDraining] = true; + if (incoming instanceof Http2ServerRequest2) { + try { + ; + incoming.stream?.close?.(h2constants.NGHTTP2_NO_ERROR); + } catch { + } + return; + } + let bytesRead = 0; + const cleanup = () => { + clearTimeout(timer); + incoming.off("data", onData); + incoming.off("end", cleanup); + incoming.off("error", cleanup); + }; + const forceClose = () => { + cleanup(); + const socket = incoming.socket; + if (socket && !socket.destroyed) { + socket.destroySoon(); + } + }; + const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS); + timer.unref?.(); + const onData = (chunk) => { + bytesRead += chunk.length; + if (bytesRead > MAX_DRAIN_BYTES) { + forceClose(); + } + }; + incoming.on("data", onData); + incoming.on("end", cleanup); + incoming.on("error", cleanup); + incoming.resume(); +}; +var handleRequestError = () => new Response(null, { + status: 400 +}); +var handleFetchError = (e) => new Response(null, { + status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 +}); +var handleResponseError = (e, outgoing) => { + const err = e instanceof Error ? e : new Error("unknown error", { cause: e }); + if (err.code === "ERR_STREAM_PREMATURE_CLOSE") { + console.info("The user aborted a request."); + } else { + console.error(e); + if (!outgoing.headersSent) { + outgoing.writeHead(500, { "Content-Type": "text/plain" }); + } + outgoing.end(`Error: ${err.message}`); + outgoing.destroy(err); + } +}; +var flushHeaders = (outgoing) => { + if ("flushHeaders" in outgoing && outgoing.writable) { + outgoing.flushHeaders(); + } +}; +var responseViaCache = async (res, outgoing) => { + let [status, body, header] = res[cacheKey]; + let hasContentLength = false; + if (!header) { + header = { "content-type": "text/plain; charset=UTF-8" }; + } else if (header instanceof Headers) { + hasContentLength = header.has("content-length"); + header = buildOutgoingHttpHeaders(header); + } else if (Array.isArray(header)) { + const headerObj = new Headers(header); + hasContentLength = headerObj.has("content-length"); + header = buildOutgoingHttpHeaders(headerObj); + } else { + for (const key in header) { + if (key.length === 14 && key.toLowerCase() === "content-length") { + hasContentLength = true; + break; + } + } + } + if (!hasContentLength) { + if (typeof body === "string") { + header["Content-Length"] = Buffer.byteLength(body); + } else if (body instanceof Uint8Array) { + header["Content-Length"] = body.byteLength; + } else if (body instanceof Blob) { + header["Content-Length"] = body.size; + } + } + outgoing.writeHead(status, header); + if (typeof body === "string" || body instanceof Uint8Array) { + outgoing.end(body); + } else if (body instanceof Blob) { + outgoing.end(new Uint8Array(await body.arrayBuffer())); + } else { + flushHeaders(outgoing); + await writeFromReadableStream(body, outgoing)?.catch( + (e) => handleResponseError(e, outgoing) + ); + } + ; + outgoing[outgoingEnded]?.(); +}; +var isPromise = (res) => typeof res.then === "function"; +var responseViaResponseObject = async (res, outgoing, options = {}) => { + if (isPromise(res)) { + if (options.errorHandler) { + try { + res = await res; + } catch (err) { + const errRes = await options.errorHandler(err); + if (!errRes) { + return; + } + res = errRes; + } + } else { + res = await res.catch(handleFetchError); + } + } + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + const resHeaderRecord = buildOutgoingHttpHeaders(res.headers); + if (res.body) { + const reader = res.body.getReader(); + const values = []; + let done = false; + let currentReadPromise = void 0; + if (resHeaderRecord["transfer-encoding"] !== "chunked") { + let maxReadCount = 2; + for (let i = 0; i < maxReadCount; i++) { + currentReadPromise ||= reader.read(); + const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => { + console.error(e); + done = true; + }); + if (!chunk) { + if (i === 1) { + await new Promise((resolve) => setTimeout(resolve)); + maxReadCount = 3; + continue; + } + break; + } + currentReadPromise = void 0; + if (chunk.value) { + values.push(chunk.value); + } + if (chunk.done) { + done = true; + break; + } + } + if (done && !("content-length" in resHeaderRecord)) { + resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0); + } + } + outgoing.writeHead(res.status, resHeaderRecord); + values.forEach((value) => { + ; + outgoing.write(value); + }); + if (done) { + outgoing.end(); + } else { + if (values.length === 0) { + flushHeaders(outgoing); + } + await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise); + } + } else if (resHeaderRecord[X_ALREADY_SENT]) { + } else { + outgoing.writeHead(res.status, resHeaderRecord); + outgoing.end(); + } + ; + outgoing[outgoingEnded]?.(); +}; +var getRequestListener = (fetchCallback, options = {}) => { + const autoCleanupIncoming = options.autoCleanupIncoming ?? true; + if (options.overrideGlobalObjects !== false && global.Request !== Request) { + Object.defineProperty(global, "Request", { + value: Request + }); + Object.defineProperty(global, "Response", { + value: Response2 + }); + } + return async (incoming, outgoing) => { + let res, req; + try { + req = newRequest(incoming, options.hostname); + let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD"; + if (!incomingEnded) { + ; + incoming[wrapBodyStream] = true; + incoming.on("end", () => { + incomingEnded = true; + }); + if (incoming instanceof Http2ServerRequest2) { + ; + outgoing[outgoingEnded] = () => { + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }; + } + outgoing.on("finish", () => { + if (!incomingEnded) { + drainIncoming(incoming); + } + }); + } + outgoing.on("close", () => { + const abortController = req[abortControllerKey]; + if (abortController) { + if (incoming.errored) { + req[abortControllerKey].abort(incoming.errored.toString()); + } else if (!outgoing.writableFinished) { + req[abortControllerKey].abort("Client connection prematurely closed."); + } + } + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }); + res = fetchCallback(req, { incoming, outgoing }); + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + } catch (e) { + if (!res) { + if (options.errorHandler) { + res = await options.errorHandler(req ? e : toRequestError(e)); + if (!res) { + return; + } + } else if (!req) { + res = handleRequestError(); + } else { + res = handleFetchError(e); + } + } else { + return handleResponseError(e, outgoing); + } + } + try { + return await responseViaResponseObject(res, outgoing, options); + } catch (e) { + return handleResponseError(e, outgoing); + } + }; +}; + +// src/server.ts +var createAdaptorServer = (options) => { + const fetchCallback = options.fetch; + const requestListener = getRequestListener(fetchCallback, { + hostname: options.hostname, + overrideGlobalObjects: options.overrideGlobalObjects, + autoCleanupIncoming: options.autoCleanupIncoming + }); + const createServer = options.createServer || createServerHTTP; + const server = createServer(options.serverOptions || {}, requestListener); + return server; +}; +var serve = (options, listeningListener) => { + const server = createAdaptorServer(options); + server.listen(options?.port ?? 3e3, options.hostname, () => { + const serverInfo = server.address(); + listeningListener && listeningListener(serverInfo); + }); + return server; +}; +export { + createAdaptorServer, + serve +}; diff --git a/node_modules/@hono/node-server/dist/types.d.mts b/node_modules/@hono/node-server/dist/types.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c258f6a85ea4eeb9f54cfd0763343b97028f90e4 --- /dev/null +++ b/node_modules/@hono/node-server/dist/types.d.mts @@ -0,0 +1,44 @@ +import { IncomingMessage, ServerResponse, ServerOptions as ServerOptions$1, createServer, Server } from 'node:http'; +import { Http2ServerRequest, Http2ServerResponse, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer, Http2Server, Http2SecureServer } from 'node:http2'; +import { ServerOptions as ServerOptions$2, createServer as createServer$1 } from 'node:https'; + +type HttpBindings = { + incoming: IncomingMessage; + outgoing: ServerResponse; +}; +type Http2Bindings = { + incoming: Http2ServerRequest; + outgoing: Http2ServerResponse; +}; +type FetchCallback = (request: Request, env: HttpBindings | Http2Bindings) => Promise | unknown; +type NextHandlerOption = { + fetch: FetchCallback; +}; +type ServerType = Server | Http2Server | Http2SecureServer; +type createHttpOptions = { + serverOptions?: ServerOptions$1; + createServer?: typeof createServer; +}; +type createHttpsOptions = { + serverOptions?: ServerOptions$2; + createServer?: typeof createServer$1; +}; +type createHttp2Options = { + serverOptions?: ServerOptions$3; + createServer?: typeof createServer$2; +}; +type createSecureHttp2Options = { + serverOptions?: SecureServerOptions; + createServer?: typeof createSecureServer; +}; +type ServerOptions = createHttpOptions | createHttpsOptions | createHttp2Options | createSecureHttp2Options; +type Options = { + fetch: FetchCallback; + overrideGlobalObjects?: boolean; + autoCleanupIncoming?: boolean; + port?: number; + hostname?: string; +} & ServerOptions; +type CustomErrorHandler = (err: unknown) => void | Response | Promise; + +export type { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType }; diff --git a/node_modules/@hono/node-server/dist/types.d.ts b/node_modules/@hono/node-server/dist/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c258f6a85ea4eeb9f54cfd0763343b97028f90e4 --- /dev/null +++ b/node_modules/@hono/node-server/dist/types.d.ts @@ -0,0 +1,44 @@ +import { IncomingMessage, ServerResponse, ServerOptions as ServerOptions$1, createServer, Server } from 'node:http'; +import { Http2ServerRequest, Http2ServerResponse, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer, Http2Server, Http2SecureServer } from 'node:http2'; +import { ServerOptions as ServerOptions$2, createServer as createServer$1 } from 'node:https'; + +type HttpBindings = { + incoming: IncomingMessage; + outgoing: ServerResponse; +}; +type Http2Bindings = { + incoming: Http2ServerRequest; + outgoing: Http2ServerResponse; +}; +type FetchCallback = (request: Request, env: HttpBindings | Http2Bindings) => Promise | unknown; +type NextHandlerOption = { + fetch: FetchCallback; +}; +type ServerType = Server | Http2Server | Http2SecureServer; +type createHttpOptions = { + serverOptions?: ServerOptions$1; + createServer?: typeof createServer; +}; +type createHttpsOptions = { + serverOptions?: ServerOptions$2; + createServer?: typeof createServer$1; +}; +type createHttp2Options = { + serverOptions?: ServerOptions$3; + createServer?: typeof createServer$2; +}; +type createSecureHttp2Options = { + serverOptions?: SecureServerOptions; + createServer?: typeof createSecureServer; +}; +type ServerOptions = createHttpOptions | createHttpsOptions | createHttp2Options | createSecureHttp2Options; +type Options = { + fetch: FetchCallback; + overrideGlobalObjects?: boolean; + autoCleanupIncoming?: boolean; + port?: number; + hostname?: string; +} & ServerOptions; +type CustomErrorHandler = (err: unknown) => void | Response | Promise; + +export type { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType }; diff --git a/node_modules/@hono/node-server/dist/types.js b/node_modules/@hono/node-server/dist/types.js new file mode 100644 index 0000000000000000000000000000000000000000..14bbc9e0e2e73aa7db177eef636075fb3be14343 --- /dev/null +++ b/node_modules/@hono/node-server/dist/types.js @@ -0,0 +1,18 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/types.ts +var types_exports = {}; +module.exports = __toCommonJS(types_exports); diff --git a/node_modules/@hono/node-server/dist/types.mjs b/node_modules/@hono/node-server/dist/types.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/node_modules/@hono/node-server/dist/utils.d.mts b/node_modules/@hono/node-server/dist/utils.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..966a2b46cb8a847216dde3bec2d0264553465f4a --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils.d.mts @@ -0,0 +1,9 @@ +import { OutgoingHttpHeaders } from 'node:http'; +import { Writable } from 'node:stream'; + +declare function readWithoutBlocking(readPromise: Promise>): Promise | undefined>; +declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader, writable: Writable, currentReadPromise?: Promise> | undefined): Promise; +declare function writeFromReadableStream(stream: ReadableStream, writable: Writable): Promise | undefined; +declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders; + +export { buildOutgoingHttpHeaders, readWithoutBlocking, writeFromReadableStream, writeFromReadableStreamDefaultReader }; diff --git a/node_modules/@hono/node-server/dist/utils.d.ts b/node_modules/@hono/node-server/dist/utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..966a2b46cb8a847216dde3bec2d0264553465f4a --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils.d.ts @@ -0,0 +1,9 @@ +import { OutgoingHttpHeaders } from 'node:http'; +import { Writable } from 'node:stream'; + +declare function readWithoutBlocking(readPromise: Promise>): Promise | undefined>; +declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader, writable: Writable, currentReadPromise?: Promise> | undefined): Promise; +declare function writeFromReadableStream(stream: ReadableStream, writable: Writable): Promise | undefined; +declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders; + +export { buildOutgoingHttpHeaders, readWithoutBlocking, writeFromReadableStream, writeFromReadableStreamDefaultReader }; diff --git a/node_modules/@hono/node-server/dist/utils.js b/node_modules/@hono/node-server/dist/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..7d416f142c04750ce6110ff1557c733e3a6284ed --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils.js @@ -0,0 +1,99 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/utils.ts +var utils_exports = {}; +__export(utils_exports, { + buildOutgoingHttpHeaders: () => buildOutgoingHttpHeaders, + readWithoutBlocking: () => readWithoutBlocking, + writeFromReadableStream: () => writeFromReadableStream, + writeFromReadableStreamDefaultReader: () => writeFromReadableStreamDefaultReader +}); +module.exports = __toCommonJS(utils_exports); +async function readWithoutBlocking(readPromise) { + return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]); +} +function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) { + const cancel = (error) => { + reader.cancel(error).catch(() => { + }); + }; + writable.on("close", cancel); + writable.on("error", cancel); + (currentReadPromise ?? reader.read()).then(flow, handleStreamError); + return reader.closed.finally(() => { + writable.off("close", cancel); + writable.off("error", cancel); + }); + function handleStreamError(error) { + if (error) { + writable.destroy(error); + } + } + function onDrain() { + reader.read().then(flow, handleStreamError); + } + function flow({ done, value }) { + try { + if (done) { + writable.end(); + } else if (!writable.write(value)) { + writable.once("drain", onDrain); + } else { + return reader.read().then(flow, handleStreamError); + } + } catch (e) { + handleStreamError(e); + } + } +} +function writeFromReadableStream(stream, writable) { + if (stream.locked) { + throw new TypeError("ReadableStream is locked."); + } else if (writable.destroyed) { + return; + } + return writeFromReadableStreamDefaultReader(stream.getReader(), writable); +} +var buildOutgoingHttpHeaders = (headers) => { + const res = {}; + if (!(headers instanceof Headers)) { + headers = new Headers(headers ?? void 0); + } + const cookies = []; + for (const [k, v] of headers) { + if (k === "set-cookie") { + cookies.push(v); + } else { + res[k] = v; + } + } + if (cookies.length > 0) { + res["set-cookie"] = cookies; + } + res["content-type"] ??= "text/plain; charset=UTF-8"; + return res; +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + buildOutgoingHttpHeaders, + readWithoutBlocking, + writeFromReadableStream, + writeFromReadableStreamDefaultReader +}); diff --git a/node_modules/@hono/node-server/dist/utils.mjs b/node_modules/@hono/node-server/dist/utils.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5184acbdf892f1d2671f79c1e616da7a83d7049d --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils.mjs @@ -0,0 +1,71 @@ +// src/utils.ts +async function readWithoutBlocking(readPromise) { + return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]); +} +function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) { + const cancel = (error) => { + reader.cancel(error).catch(() => { + }); + }; + writable.on("close", cancel); + writable.on("error", cancel); + (currentReadPromise ?? reader.read()).then(flow, handleStreamError); + return reader.closed.finally(() => { + writable.off("close", cancel); + writable.off("error", cancel); + }); + function handleStreamError(error) { + if (error) { + writable.destroy(error); + } + } + function onDrain() { + reader.read().then(flow, handleStreamError); + } + function flow({ done, value }) { + try { + if (done) { + writable.end(); + } else if (!writable.write(value)) { + writable.once("drain", onDrain); + } else { + return reader.read().then(flow, handleStreamError); + } + } catch (e) { + handleStreamError(e); + } + } +} +function writeFromReadableStream(stream, writable) { + if (stream.locked) { + throw new TypeError("ReadableStream is locked."); + } else if (writable.destroyed) { + return; + } + return writeFromReadableStreamDefaultReader(stream.getReader(), writable); +} +var buildOutgoingHttpHeaders = (headers) => { + const res = {}; + if (!(headers instanceof Headers)) { + headers = new Headers(headers ?? void 0); + } + const cookies = []; + for (const [k, v] of headers) { + if (k === "set-cookie") { + cookies.push(v); + } else { + res[k] = v; + } + } + if (cookies.length > 0) { + res["set-cookie"] = cookies; + } + res["content-type"] ??= "text/plain; charset=UTF-8"; + return res; +}; +export { + buildOutgoingHttpHeaders, + readWithoutBlocking, + writeFromReadableStream, + writeFromReadableStreamDefaultReader +}; diff --git a/node_modules/@hono/node-server/dist/utils/response.d.mts b/node_modules/@hono/node-server/dist/utils/response.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..523b753e01cd018ace68090f47e34343fd298228 --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils/response.d.mts @@ -0,0 +1,3 @@ +declare const RESPONSE_ALREADY_SENT: Response; + +export { RESPONSE_ALREADY_SENT }; diff --git a/node_modules/@hono/node-server/dist/utils/response.d.ts b/node_modules/@hono/node-server/dist/utils/response.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..523b753e01cd018ace68090f47e34343fd298228 --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils/response.d.ts @@ -0,0 +1,3 @@ +declare const RESPONSE_ALREADY_SENT: Response; + +export { RESPONSE_ALREADY_SENT }; diff --git a/node_modules/@hono/node-server/dist/utils/response.js b/node_modules/@hono/node-server/dist/utils/response.js new file mode 100644 index 0000000000000000000000000000000000000000..6fe007b6ac96feb207ef61a5ec251b6491ab1020 --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils/response.js @@ -0,0 +1,37 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/utils/response.ts +var response_exports = {}; +__export(response_exports, { + RESPONSE_ALREADY_SENT: () => RESPONSE_ALREADY_SENT +}); +module.exports = __toCommonJS(response_exports); + +// src/utils/response/constants.ts +var X_ALREADY_SENT = "x-hono-already-sent"; + +// src/utils/response.ts +var RESPONSE_ALREADY_SENT = new Response(null, { + headers: { [X_ALREADY_SENT]: "true" } +}); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + RESPONSE_ALREADY_SENT +}); diff --git a/node_modules/@hono/node-server/dist/utils/response.mjs b/node_modules/@hono/node-server/dist/utils/response.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5d42aaaec4621de5f6bbae20bd559ce63710d5a4 --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils/response.mjs @@ -0,0 +1,10 @@ +// src/utils/response/constants.ts +var X_ALREADY_SENT = "x-hono-already-sent"; + +// src/utils/response.ts +var RESPONSE_ALREADY_SENT = new Response(null, { + headers: { [X_ALREADY_SENT]: "true" } +}); +export { + RESPONSE_ALREADY_SENT +}; diff --git a/node_modules/@hono/node-server/dist/utils/response/constants.d.mts b/node_modules/@hono/node-server/dist/utils/response/constants.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f09b912b4b9c97ceb20cbfda981c6bd421ebe5b9 --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils/response/constants.d.mts @@ -0,0 +1,3 @@ +declare const X_ALREADY_SENT = "x-hono-already-sent"; + +export { X_ALREADY_SENT }; diff --git a/node_modules/@hono/node-server/dist/utils/response/constants.d.ts b/node_modules/@hono/node-server/dist/utils/response/constants.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f09b912b4b9c97ceb20cbfda981c6bd421ebe5b9 --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils/response/constants.d.ts @@ -0,0 +1,3 @@ +declare const X_ALREADY_SENT = "x-hono-already-sent"; + +export { X_ALREADY_SENT }; diff --git a/node_modules/@hono/node-server/dist/utils/response/constants.js b/node_modules/@hono/node-server/dist/utils/response/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..615e7c5218dbefa1ffdfd2d5437969e14fcee453 --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils/response/constants.js @@ -0,0 +1,30 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/utils/response/constants.ts +var constants_exports = {}; +__export(constants_exports, { + X_ALREADY_SENT: () => X_ALREADY_SENT +}); +module.exports = __toCommonJS(constants_exports); +var X_ALREADY_SENT = "x-hono-already-sent"; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + X_ALREADY_SENT +}); diff --git a/node_modules/@hono/node-server/dist/utils/response/constants.mjs b/node_modules/@hono/node-server/dist/utils/response/constants.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e6ed45f81834da53baf5814956c63e91e17dea19 --- /dev/null +++ b/node_modules/@hono/node-server/dist/utils/response/constants.mjs @@ -0,0 +1,5 @@ +// src/utils/response/constants.ts +var X_ALREADY_SENT = "x-hono-already-sent"; +export { + X_ALREADY_SENT +}; diff --git a/node_modules/@hono/node-server/dist/vercel.d.mts b/node_modules/@hono/node-server/dist/vercel.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d187c0582719fd7c6f1b2dee187ef863e8fd89f1 --- /dev/null +++ b/node_modules/@hono/node-server/dist/vercel.d.mts @@ -0,0 +1,7 @@ +import * as http2 from 'http2'; +import * as http from 'http'; +import { Hono } from 'hono'; + +declare const handle: (app: Hono) => (incoming: http.IncomingMessage | http2.Http2ServerRequest, outgoing: http.ServerResponse | http2.Http2ServerResponse) => Promise; + +export { handle }; diff --git a/node_modules/@hono/node-server/dist/vercel.d.ts b/node_modules/@hono/node-server/dist/vercel.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d187c0582719fd7c6f1b2dee187ef863e8fd89f1 --- /dev/null +++ b/node_modules/@hono/node-server/dist/vercel.d.ts @@ -0,0 +1,7 @@ +import * as http2 from 'http2'; +import * as http from 'http'; +import { Hono } from 'hono'; + +declare const handle: (app: Hono) => (incoming: http.IncomingMessage | http2.Http2ServerRequest, outgoing: http.ServerResponse | http2.Http2ServerResponse) => Promise; + +export { handle }; diff --git a/node_modules/@hono/node-server/dist/vercel.js b/node_modules/@hono/node-server/dist/vercel.js new file mode 100644 index 0000000000000000000000000000000000000000..cf8171b29548f7284587e9561e6a36290bcbb9cc --- /dev/null +++ b/node_modules/@hono/node-server/dist/vercel.js @@ -0,0 +1,677 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/vercel.ts +var vercel_exports = {}; +__export(vercel_exports, { + handle: () => handle +}); +module.exports = __toCommonJS(vercel_exports); + +// src/listener.ts +var import_node_http22 = require("http2"); + +// src/request.ts +var import_node_http2 = require("http2"); +var import_node_stream = require("stream"); +var RequestError = class extends Error { + constructor(message, options) { + super(message, options); + this.name = "RequestError"; + } +}; +var toRequestError = (e) => { + if (e instanceof RequestError) { + return e; + } + return new RequestError(e.message, { cause: e }); +}; +var GlobalRequest = global.Request; +var Request = class extends GlobalRequest { + constructor(input, options) { + if (typeof input === "object" && getRequestCache in input) { + input = input[getRequestCache](); + } + if (typeof options?.body?.getReader !== "undefined") { + ; + options.duplex ??= "half"; + } + super(input, options); + } +}; +var newHeadersFromIncoming = (incoming) => { + const headerRecord = []; + const rawHeaders = incoming.rawHeaders; + for (let i = 0; i < rawHeaders.length; i += 2) { + const { [i]: key, [i + 1]: value } = rawHeaders; + if (key.charCodeAt(0) !== /*:*/ + 58) { + headerRecord.push([key, value]); + } + } + return new Headers(headerRecord); +}; +var wrapBodyStream = Symbol("wrapBodyStream"); +var newRequestFromIncoming = (method, url, headers, incoming, abortController) => { + const init = { + method, + headers, + signal: abortController.signal + }; + if (method === "TRACE") { + init.method = "GET"; + const req = new Request(url, init); + Object.defineProperty(req, "method", { + get() { + return "TRACE"; + } + }); + return req; + } + if (!(method === "GET" || method === "HEAD")) { + if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) { + init.body = new ReadableStream({ + start(controller) { + controller.enqueue(incoming.rawBody); + controller.close(); + } + }); + } else if (incoming[wrapBodyStream]) { + let reader; + init.body = new ReadableStream({ + async pull(controller) { + try { + reader ||= import_node_stream.Readable.toWeb(incoming).getReader(); + const { done, value } = await reader.read(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + } catch (error) { + controller.error(error); + } + } + }); + } else { + init.body = import_node_stream.Readable.toWeb(incoming); + } + } + return new Request(url, init); +}; +var getRequestCache = Symbol("getRequestCache"); +var requestCache = Symbol("requestCache"); +var incomingKey = Symbol("incomingKey"); +var urlKey = Symbol("urlKey"); +var headersKey = Symbol("headersKey"); +var abortControllerKey = Symbol("abortControllerKey"); +var getAbortController = Symbol("getAbortController"); +var requestPrototype = { + get method() { + return this[incomingKey].method || "GET"; + }, + get url() { + return this[urlKey]; + }, + get headers() { + return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]); + }, + [getAbortController]() { + this[getRequestCache](); + return this[abortControllerKey]; + }, + [getRequestCache]() { + this[abortControllerKey] ||= new AbortController(); + return this[requestCache] ||= newRequestFromIncoming( + this.method, + this[urlKey], + this.headers, + this[incomingKey], + this[abortControllerKey] + ); + } +}; +[ + "body", + "bodyUsed", + "cache", + "credentials", + "destination", + "integrity", + "mode", + "redirect", + "referrer", + "referrerPolicy", + "signal", + "keepalive" +].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + get() { + return this[getRequestCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + value: function() { + return this[getRequestCache]()[k](); + } + }); +}); +Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + method: this.method, + url: this.url, + headers: this.headers, + nativeRequest: this[requestCache] + }; + return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(requestPrototype, Request.prototype); +var newRequest = (incoming, defaultHostname) => { + const req = Object.create(requestPrototype); + req[incomingKey] = incoming; + const incomingUrl = incoming.url || ""; + if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL. + (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) { + if (incoming instanceof import_node_http2.Http2ServerRequest) { + throw new RequestError("Absolute URL for :path is not allowed in HTTP/2"); + } + try { + const url2 = new URL(incomingUrl); + req[urlKey] = url2.href; + } catch (e) { + throw new RequestError("Invalid absolute URL", { cause: e }); + } + return req; + } + const host = (incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname; + if (!host) { + throw new RequestError("Missing host header"); + } + let scheme; + if (incoming instanceof import_node_http2.Http2ServerRequest) { + scheme = incoming.scheme; + if (!(scheme === "http" || scheme === "https")) { + throw new RequestError("Unsupported scheme"); + } + } else { + scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http"; + } + const url = new URL(`${scheme}://${host}${incomingUrl}`); + if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) { + throw new RequestError("Invalid host header"); + } + req[urlKey] = url.href; + return req; +}; + +// src/response.ts +var responseCache = Symbol("responseCache"); +var getResponseCache = Symbol("getResponseCache"); +var cacheKey = Symbol("cache"); +var GlobalResponse = global.Response; +var Response2 = class _Response { + #body; + #init; + [getResponseCache]() { + delete this[cacheKey]; + return this[responseCache] ||= new GlobalResponse(this.#body, this.#init); + } + constructor(body, init) { + let headers; + this.#body = body; + if (init instanceof _Response) { + const cachedGlobalResponse = init[responseCache]; + if (cachedGlobalResponse) { + this.#init = cachedGlobalResponse; + this[getResponseCache](); + return; + } else { + this.#init = init.#init; + headers = new Headers(init.#init.headers); + } + } else { + this.#init = init; + } + if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) { + ; + this[cacheKey] = [init?.status || 200, body, headers || init?.headers]; + } + } + get headers() { + const cache = this[cacheKey]; + if (cache) { + if (!(cache[2] instanceof Headers)) { + cache[2] = new Headers( + cache[2] || { "content-type": "text/plain; charset=UTF-8" } + ); + } + return cache[2]; + } + return this[getResponseCache]().headers; + } + get status() { + return this[cacheKey]?.[0] ?? this[getResponseCache]().status; + } + get ok() { + const status = this.status; + return status >= 200 && status < 300; + } +}; +["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + get() { + return this[getResponseCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + value: function() { + return this[getResponseCache]()[k](); + } + }); +}); +Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + status: this.status, + headers: this.headers, + ok: this.ok, + nativeResponse: this[responseCache] + }; + return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(Response2, GlobalResponse); +Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype); + +// src/utils.ts +async function readWithoutBlocking(readPromise) { + return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]); +} +function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) { + const cancel = (error) => { + reader.cancel(error).catch(() => { + }); + }; + writable.on("close", cancel); + writable.on("error", cancel); + (currentReadPromise ?? reader.read()).then(flow, handleStreamError); + return reader.closed.finally(() => { + writable.off("close", cancel); + writable.off("error", cancel); + }); + function handleStreamError(error) { + if (error) { + writable.destroy(error); + } + } + function onDrain() { + reader.read().then(flow, handleStreamError); + } + function flow({ done, value }) { + try { + if (done) { + writable.end(); + } else if (!writable.write(value)) { + writable.once("drain", onDrain); + } else { + return reader.read().then(flow, handleStreamError); + } + } catch (e) { + handleStreamError(e); + } + } +} +function writeFromReadableStream(stream, writable) { + if (stream.locked) { + throw new TypeError("ReadableStream is locked."); + } else if (writable.destroyed) { + return; + } + return writeFromReadableStreamDefaultReader(stream.getReader(), writable); +} +var buildOutgoingHttpHeaders = (headers) => { + const res = {}; + if (!(headers instanceof Headers)) { + headers = new Headers(headers ?? void 0); + } + const cookies = []; + for (const [k, v] of headers) { + if (k === "set-cookie") { + cookies.push(v); + } else { + res[k] = v; + } + } + if (cookies.length > 0) { + res["set-cookie"] = cookies; + } + res["content-type"] ??= "text/plain; charset=UTF-8"; + return res; +}; + +// src/utils/response/constants.ts +var X_ALREADY_SENT = "x-hono-already-sent"; + +// src/globals.ts +var import_node_crypto = __toESM(require("crypto")); +if (typeof global.crypto === "undefined") { + global.crypto = import_node_crypto.default; +} + +// src/listener.ts +var outgoingEnded = Symbol("outgoingEnded"); +var incomingDraining = Symbol("incomingDraining"); +var DRAIN_TIMEOUT_MS = 500; +var MAX_DRAIN_BYTES = 64 * 1024 * 1024; +var drainIncoming = (incoming) => { + const incomingWithDrainState = incoming; + if (incoming.destroyed || incomingWithDrainState[incomingDraining]) { + return; + } + incomingWithDrainState[incomingDraining] = true; + if (incoming instanceof import_node_http22.Http2ServerRequest) { + try { + ; + incoming.stream?.close?.(import_node_http22.constants.NGHTTP2_NO_ERROR); + } catch { + } + return; + } + let bytesRead = 0; + const cleanup = () => { + clearTimeout(timer); + incoming.off("data", onData); + incoming.off("end", cleanup); + incoming.off("error", cleanup); + }; + const forceClose = () => { + cleanup(); + const socket = incoming.socket; + if (socket && !socket.destroyed) { + socket.destroySoon(); + } + }; + const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS); + timer.unref?.(); + const onData = (chunk) => { + bytesRead += chunk.length; + if (bytesRead > MAX_DRAIN_BYTES) { + forceClose(); + } + }; + incoming.on("data", onData); + incoming.on("end", cleanup); + incoming.on("error", cleanup); + incoming.resume(); +}; +var handleRequestError = () => new Response(null, { + status: 400 +}); +var handleFetchError = (e) => new Response(null, { + status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 +}); +var handleResponseError = (e, outgoing) => { + const err = e instanceof Error ? e : new Error("unknown error", { cause: e }); + if (err.code === "ERR_STREAM_PREMATURE_CLOSE") { + console.info("The user aborted a request."); + } else { + console.error(e); + if (!outgoing.headersSent) { + outgoing.writeHead(500, { "Content-Type": "text/plain" }); + } + outgoing.end(`Error: ${err.message}`); + outgoing.destroy(err); + } +}; +var flushHeaders = (outgoing) => { + if ("flushHeaders" in outgoing && outgoing.writable) { + outgoing.flushHeaders(); + } +}; +var responseViaCache = async (res, outgoing) => { + let [status, body, header] = res[cacheKey]; + let hasContentLength = false; + if (!header) { + header = { "content-type": "text/plain; charset=UTF-8" }; + } else if (header instanceof Headers) { + hasContentLength = header.has("content-length"); + header = buildOutgoingHttpHeaders(header); + } else if (Array.isArray(header)) { + const headerObj = new Headers(header); + hasContentLength = headerObj.has("content-length"); + header = buildOutgoingHttpHeaders(headerObj); + } else { + for (const key in header) { + if (key.length === 14 && key.toLowerCase() === "content-length") { + hasContentLength = true; + break; + } + } + } + if (!hasContentLength) { + if (typeof body === "string") { + header["Content-Length"] = Buffer.byteLength(body); + } else if (body instanceof Uint8Array) { + header["Content-Length"] = body.byteLength; + } else if (body instanceof Blob) { + header["Content-Length"] = body.size; + } + } + outgoing.writeHead(status, header); + if (typeof body === "string" || body instanceof Uint8Array) { + outgoing.end(body); + } else if (body instanceof Blob) { + outgoing.end(new Uint8Array(await body.arrayBuffer())); + } else { + flushHeaders(outgoing); + await writeFromReadableStream(body, outgoing)?.catch( + (e) => handleResponseError(e, outgoing) + ); + } + ; + outgoing[outgoingEnded]?.(); +}; +var isPromise = (res) => typeof res.then === "function"; +var responseViaResponseObject = async (res, outgoing, options = {}) => { + if (isPromise(res)) { + if (options.errorHandler) { + try { + res = await res; + } catch (err) { + const errRes = await options.errorHandler(err); + if (!errRes) { + return; + } + res = errRes; + } + } else { + res = await res.catch(handleFetchError); + } + } + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + const resHeaderRecord = buildOutgoingHttpHeaders(res.headers); + if (res.body) { + const reader = res.body.getReader(); + const values = []; + let done = false; + let currentReadPromise = void 0; + if (resHeaderRecord["transfer-encoding"] !== "chunked") { + let maxReadCount = 2; + for (let i = 0; i < maxReadCount; i++) { + currentReadPromise ||= reader.read(); + const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => { + console.error(e); + done = true; + }); + if (!chunk) { + if (i === 1) { + await new Promise((resolve) => setTimeout(resolve)); + maxReadCount = 3; + continue; + } + break; + } + currentReadPromise = void 0; + if (chunk.value) { + values.push(chunk.value); + } + if (chunk.done) { + done = true; + break; + } + } + if (done && !("content-length" in resHeaderRecord)) { + resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0); + } + } + outgoing.writeHead(res.status, resHeaderRecord); + values.forEach((value) => { + ; + outgoing.write(value); + }); + if (done) { + outgoing.end(); + } else { + if (values.length === 0) { + flushHeaders(outgoing); + } + await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise); + } + } else if (resHeaderRecord[X_ALREADY_SENT]) { + } else { + outgoing.writeHead(res.status, resHeaderRecord); + outgoing.end(); + } + ; + outgoing[outgoingEnded]?.(); +}; +var getRequestListener = (fetchCallback, options = {}) => { + const autoCleanupIncoming = options.autoCleanupIncoming ?? true; + if (options.overrideGlobalObjects !== false && global.Request !== Request) { + Object.defineProperty(global, "Request", { + value: Request + }); + Object.defineProperty(global, "Response", { + value: Response2 + }); + } + return async (incoming, outgoing) => { + let res, req; + try { + req = newRequest(incoming, options.hostname); + let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD"; + if (!incomingEnded) { + ; + incoming[wrapBodyStream] = true; + incoming.on("end", () => { + incomingEnded = true; + }); + if (incoming instanceof import_node_http22.Http2ServerRequest) { + ; + outgoing[outgoingEnded] = () => { + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }; + } + outgoing.on("finish", () => { + if (!incomingEnded) { + drainIncoming(incoming); + } + }); + } + outgoing.on("close", () => { + const abortController = req[abortControllerKey]; + if (abortController) { + if (incoming.errored) { + req[abortControllerKey].abort(incoming.errored.toString()); + } else if (!outgoing.writableFinished) { + req[abortControllerKey].abort("Client connection prematurely closed."); + } + } + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }); + res = fetchCallback(req, { incoming, outgoing }); + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + } catch (e) { + if (!res) { + if (options.errorHandler) { + res = await options.errorHandler(req ? e : toRequestError(e)); + if (!res) { + return; + } + } else if (!req) { + res = handleRequestError(); + } else { + res = handleFetchError(e); + } + } else { + return handleResponseError(e, outgoing); + } + } + try { + return await responseViaResponseObject(res, outgoing, options); + } catch (e) { + return handleResponseError(e, outgoing); + } + }; +}; + +// src/vercel.ts +var handle = (app) => { + return getRequestListener(app.fetch); +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + handle +}); diff --git a/node_modules/@hono/node-server/dist/vercel.mjs b/node_modules/@hono/node-server/dist/vercel.mjs new file mode 100644 index 0000000000000000000000000000000000000000..aafdd30bb6d497c0277bd03864dc3d4de0c5e283 --- /dev/null +++ b/node_modules/@hono/node-server/dist/vercel.mjs @@ -0,0 +1,640 @@ +// src/listener.ts +import { Http2ServerRequest as Http2ServerRequest2, constants as h2constants } from "http2"; + +// src/request.ts +import { Http2ServerRequest } from "http2"; +import { Readable } from "stream"; +var RequestError = class extends Error { + constructor(message, options) { + super(message, options); + this.name = "RequestError"; + } +}; +var toRequestError = (e) => { + if (e instanceof RequestError) { + return e; + } + return new RequestError(e.message, { cause: e }); +}; +var GlobalRequest = global.Request; +var Request = class extends GlobalRequest { + constructor(input, options) { + if (typeof input === "object" && getRequestCache in input) { + input = input[getRequestCache](); + } + if (typeof options?.body?.getReader !== "undefined") { + ; + options.duplex ??= "half"; + } + super(input, options); + } +}; +var newHeadersFromIncoming = (incoming) => { + const headerRecord = []; + const rawHeaders = incoming.rawHeaders; + for (let i = 0; i < rawHeaders.length; i += 2) { + const { [i]: key, [i + 1]: value } = rawHeaders; + if (key.charCodeAt(0) !== /*:*/ + 58) { + headerRecord.push([key, value]); + } + } + return new Headers(headerRecord); +}; +var wrapBodyStream = Symbol("wrapBodyStream"); +var newRequestFromIncoming = (method, url, headers, incoming, abortController) => { + const init = { + method, + headers, + signal: abortController.signal + }; + if (method === "TRACE") { + init.method = "GET"; + const req = new Request(url, init); + Object.defineProperty(req, "method", { + get() { + return "TRACE"; + } + }); + return req; + } + if (!(method === "GET" || method === "HEAD")) { + if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) { + init.body = new ReadableStream({ + start(controller) { + controller.enqueue(incoming.rawBody); + controller.close(); + } + }); + } else if (incoming[wrapBodyStream]) { + let reader; + init.body = new ReadableStream({ + async pull(controller) { + try { + reader ||= Readable.toWeb(incoming).getReader(); + const { done, value } = await reader.read(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + } catch (error) { + controller.error(error); + } + } + }); + } else { + init.body = Readable.toWeb(incoming); + } + } + return new Request(url, init); +}; +var getRequestCache = Symbol("getRequestCache"); +var requestCache = Symbol("requestCache"); +var incomingKey = Symbol("incomingKey"); +var urlKey = Symbol("urlKey"); +var headersKey = Symbol("headersKey"); +var abortControllerKey = Symbol("abortControllerKey"); +var getAbortController = Symbol("getAbortController"); +var requestPrototype = { + get method() { + return this[incomingKey].method || "GET"; + }, + get url() { + return this[urlKey]; + }, + get headers() { + return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]); + }, + [getAbortController]() { + this[getRequestCache](); + return this[abortControllerKey]; + }, + [getRequestCache]() { + this[abortControllerKey] ||= new AbortController(); + return this[requestCache] ||= newRequestFromIncoming( + this.method, + this[urlKey], + this.headers, + this[incomingKey], + this[abortControllerKey] + ); + } +}; +[ + "body", + "bodyUsed", + "cache", + "credentials", + "destination", + "integrity", + "mode", + "redirect", + "referrer", + "referrerPolicy", + "signal", + "keepalive" +].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + get() { + return this[getRequestCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(requestPrototype, k, { + value: function() { + return this[getRequestCache]()[k](); + } + }); +}); +Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + method: this.method, + url: this.url, + headers: this.headers, + nativeRequest: this[requestCache] + }; + return `Request (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(requestPrototype, Request.prototype); +var newRequest = (incoming, defaultHostname) => { + const req = Object.create(requestPrototype); + req[incomingKey] = incoming; + const incomingUrl = incoming.url || ""; + if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL. + (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) { + if (incoming instanceof Http2ServerRequest) { + throw new RequestError("Absolute URL for :path is not allowed in HTTP/2"); + } + try { + const url2 = new URL(incomingUrl); + req[urlKey] = url2.href; + } catch (e) { + throw new RequestError("Invalid absolute URL", { cause: e }); + } + return req; + } + const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname; + if (!host) { + throw new RequestError("Missing host header"); + } + let scheme; + if (incoming instanceof Http2ServerRequest) { + scheme = incoming.scheme; + if (!(scheme === "http" || scheme === "https")) { + throw new RequestError("Unsupported scheme"); + } + } else { + scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http"; + } + const url = new URL(`${scheme}://${host}${incomingUrl}`); + if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) { + throw new RequestError("Invalid host header"); + } + req[urlKey] = url.href; + return req; +}; + +// src/response.ts +var responseCache = Symbol("responseCache"); +var getResponseCache = Symbol("getResponseCache"); +var cacheKey = Symbol("cache"); +var GlobalResponse = global.Response; +var Response2 = class _Response { + #body; + #init; + [getResponseCache]() { + delete this[cacheKey]; + return this[responseCache] ||= new GlobalResponse(this.#body, this.#init); + } + constructor(body, init) { + let headers; + this.#body = body; + if (init instanceof _Response) { + const cachedGlobalResponse = init[responseCache]; + if (cachedGlobalResponse) { + this.#init = cachedGlobalResponse; + this[getResponseCache](); + return; + } else { + this.#init = init.#init; + headers = new Headers(init.#init.headers); + } + } else { + this.#init = init; + } + if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) { + ; + this[cacheKey] = [init?.status || 200, body, headers || init?.headers]; + } + } + get headers() { + const cache = this[cacheKey]; + if (cache) { + if (!(cache[2] instanceof Headers)) { + cache[2] = new Headers( + cache[2] || { "content-type": "text/plain; charset=UTF-8" } + ); + } + return cache[2]; + } + return this[getResponseCache]().headers; + } + get status() { + return this[cacheKey]?.[0] ?? this[getResponseCache]().status; + } + get ok() { + const status = this.status; + return status >= 200 && status < 300; + } +}; +["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + get() { + return this[getResponseCache]()[k]; + } + }); +}); +["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => { + Object.defineProperty(Response2.prototype, k, { + value: function() { + return this[getResponseCache]()[k](); + } + }); +}); +Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custom"), { + value: function(depth, options, inspectFn) { + const props = { + status: this.status, + headers: this.headers, + ok: this.ok, + nativeResponse: this[responseCache] + }; + return `Response (lightweight) ${inspectFn(props, { ...options, depth: depth == null ? null : depth - 1 })}`; + } +}); +Object.setPrototypeOf(Response2, GlobalResponse); +Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype); + +// src/utils.ts +async function readWithoutBlocking(readPromise) { + return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]); +} +function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) { + const cancel = (error) => { + reader.cancel(error).catch(() => { + }); + }; + writable.on("close", cancel); + writable.on("error", cancel); + (currentReadPromise ?? reader.read()).then(flow, handleStreamError); + return reader.closed.finally(() => { + writable.off("close", cancel); + writable.off("error", cancel); + }); + function handleStreamError(error) { + if (error) { + writable.destroy(error); + } + } + function onDrain() { + reader.read().then(flow, handleStreamError); + } + function flow({ done, value }) { + try { + if (done) { + writable.end(); + } else if (!writable.write(value)) { + writable.once("drain", onDrain); + } else { + return reader.read().then(flow, handleStreamError); + } + } catch (e) { + handleStreamError(e); + } + } +} +function writeFromReadableStream(stream, writable) { + if (stream.locked) { + throw new TypeError("ReadableStream is locked."); + } else if (writable.destroyed) { + return; + } + return writeFromReadableStreamDefaultReader(stream.getReader(), writable); +} +var buildOutgoingHttpHeaders = (headers) => { + const res = {}; + if (!(headers instanceof Headers)) { + headers = new Headers(headers ?? void 0); + } + const cookies = []; + for (const [k, v] of headers) { + if (k === "set-cookie") { + cookies.push(v); + } else { + res[k] = v; + } + } + if (cookies.length > 0) { + res["set-cookie"] = cookies; + } + res["content-type"] ??= "text/plain; charset=UTF-8"; + return res; +}; + +// src/utils/response/constants.ts +var X_ALREADY_SENT = "x-hono-already-sent"; + +// src/globals.ts +import crypto from "crypto"; +if (typeof global.crypto === "undefined") { + global.crypto = crypto; +} + +// src/listener.ts +var outgoingEnded = Symbol("outgoingEnded"); +var incomingDraining = Symbol("incomingDraining"); +var DRAIN_TIMEOUT_MS = 500; +var MAX_DRAIN_BYTES = 64 * 1024 * 1024; +var drainIncoming = (incoming) => { + const incomingWithDrainState = incoming; + if (incoming.destroyed || incomingWithDrainState[incomingDraining]) { + return; + } + incomingWithDrainState[incomingDraining] = true; + if (incoming instanceof Http2ServerRequest2) { + try { + ; + incoming.stream?.close?.(h2constants.NGHTTP2_NO_ERROR); + } catch { + } + return; + } + let bytesRead = 0; + const cleanup = () => { + clearTimeout(timer); + incoming.off("data", onData); + incoming.off("end", cleanup); + incoming.off("error", cleanup); + }; + const forceClose = () => { + cleanup(); + const socket = incoming.socket; + if (socket && !socket.destroyed) { + socket.destroySoon(); + } + }; + const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS); + timer.unref?.(); + const onData = (chunk) => { + bytesRead += chunk.length; + if (bytesRead > MAX_DRAIN_BYTES) { + forceClose(); + } + }; + incoming.on("data", onData); + incoming.on("end", cleanup); + incoming.on("error", cleanup); + incoming.resume(); +}; +var handleRequestError = () => new Response(null, { + status: 400 +}); +var handleFetchError = (e) => new Response(null, { + status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 +}); +var handleResponseError = (e, outgoing) => { + const err = e instanceof Error ? e : new Error("unknown error", { cause: e }); + if (err.code === "ERR_STREAM_PREMATURE_CLOSE") { + console.info("The user aborted a request."); + } else { + console.error(e); + if (!outgoing.headersSent) { + outgoing.writeHead(500, { "Content-Type": "text/plain" }); + } + outgoing.end(`Error: ${err.message}`); + outgoing.destroy(err); + } +}; +var flushHeaders = (outgoing) => { + if ("flushHeaders" in outgoing && outgoing.writable) { + outgoing.flushHeaders(); + } +}; +var responseViaCache = async (res, outgoing) => { + let [status, body, header] = res[cacheKey]; + let hasContentLength = false; + if (!header) { + header = { "content-type": "text/plain; charset=UTF-8" }; + } else if (header instanceof Headers) { + hasContentLength = header.has("content-length"); + header = buildOutgoingHttpHeaders(header); + } else if (Array.isArray(header)) { + const headerObj = new Headers(header); + hasContentLength = headerObj.has("content-length"); + header = buildOutgoingHttpHeaders(headerObj); + } else { + for (const key in header) { + if (key.length === 14 && key.toLowerCase() === "content-length") { + hasContentLength = true; + break; + } + } + } + if (!hasContentLength) { + if (typeof body === "string") { + header["Content-Length"] = Buffer.byteLength(body); + } else if (body instanceof Uint8Array) { + header["Content-Length"] = body.byteLength; + } else if (body instanceof Blob) { + header["Content-Length"] = body.size; + } + } + outgoing.writeHead(status, header); + if (typeof body === "string" || body instanceof Uint8Array) { + outgoing.end(body); + } else if (body instanceof Blob) { + outgoing.end(new Uint8Array(await body.arrayBuffer())); + } else { + flushHeaders(outgoing); + await writeFromReadableStream(body, outgoing)?.catch( + (e) => handleResponseError(e, outgoing) + ); + } + ; + outgoing[outgoingEnded]?.(); +}; +var isPromise = (res) => typeof res.then === "function"; +var responseViaResponseObject = async (res, outgoing, options = {}) => { + if (isPromise(res)) { + if (options.errorHandler) { + try { + res = await res; + } catch (err) { + const errRes = await options.errorHandler(err); + if (!errRes) { + return; + } + res = errRes; + } + } else { + res = await res.catch(handleFetchError); + } + } + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + const resHeaderRecord = buildOutgoingHttpHeaders(res.headers); + if (res.body) { + const reader = res.body.getReader(); + const values = []; + let done = false; + let currentReadPromise = void 0; + if (resHeaderRecord["transfer-encoding"] !== "chunked") { + let maxReadCount = 2; + for (let i = 0; i < maxReadCount; i++) { + currentReadPromise ||= reader.read(); + const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => { + console.error(e); + done = true; + }); + if (!chunk) { + if (i === 1) { + await new Promise((resolve) => setTimeout(resolve)); + maxReadCount = 3; + continue; + } + break; + } + currentReadPromise = void 0; + if (chunk.value) { + values.push(chunk.value); + } + if (chunk.done) { + done = true; + break; + } + } + if (done && !("content-length" in resHeaderRecord)) { + resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0); + } + } + outgoing.writeHead(res.status, resHeaderRecord); + values.forEach((value) => { + ; + outgoing.write(value); + }); + if (done) { + outgoing.end(); + } else { + if (values.length === 0) { + flushHeaders(outgoing); + } + await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise); + } + } else if (resHeaderRecord[X_ALREADY_SENT]) { + } else { + outgoing.writeHead(res.status, resHeaderRecord); + outgoing.end(); + } + ; + outgoing[outgoingEnded]?.(); +}; +var getRequestListener = (fetchCallback, options = {}) => { + const autoCleanupIncoming = options.autoCleanupIncoming ?? true; + if (options.overrideGlobalObjects !== false && global.Request !== Request) { + Object.defineProperty(global, "Request", { + value: Request + }); + Object.defineProperty(global, "Response", { + value: Response2 + }); + } + return async (incoming, outgoing) => { + let res, req; + try { + req = newRequest(incoming, options.hostname); + let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD"; + if (!incomingEnded) { + ; + incoming[wrapBodyStream] = true; + incoming.on("end", () => { + incomingEnded = true; + }); + if (incoming instanceof Http2ServerRequest2) { + ; + outgoing[outgoingEnded] = () => { + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }; + } + outgoing.on("finish", () => { + if (!incomingEnded) { + drainIncoming(incoming); + } + }); + } + outgoing.on("close", () => { + const abortController = req[abortControllerKey]; + if (abortController) { + if (incoming.errored) { + req[abortControllerKey].abort(incoming.errored.toString()); + } else if (!outgoing.writableFinished) { + req[abortControllerKey].abort("Client connection prematurely closed."); + } + } + if (!incomingEnded) { + setTimeout(() => { + if (!incomingEnded) { + setTimeout(() => { + drainIncoming(incoming); + }); + } + }); + } + }); + res = fetchCallback(req, { incoming, outgoing }); + if (cacheKey in res) { + return responseViaCache(res, outgoing); + } + } catch (e) { + if (!res) { + if (options.errorHandler) { + res = await options.errorHandler(req ? e : toRequestError(e)); + if (!res) { + return; + } + } else if (!req) { + res = handleRequestError(); + } else { + res = handleFetchError(e); + } + } else { + return handleResponseError(e, outgoing); + } + } + try { + return await responseViaResponseObject(res, outgoing, options); + } catch (e) { + return handleResponseError(e, outgoing); + } + }; +}; + +// src/vercel.ts +var handle = (app) => { + return getRequestListener(app.fetch); +}; +export { + handle +}; diff --git a/node_modules/@hono/node-server/package.json b/node_modules/@hono/node-server/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d854461808c3e6bf649b14132db1558d0bae8ff1 --- /dev/null +++ b/node_modules/@hono/node-server/package.json @@ -0,0 +1,103 @@ +{ + "name": "@hono/node-server", + "version": "1.19.14", + "description": "Node.js Adapter for Hono", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "dist" + ], + "exports": { + ".": { + "types": "./dist/index.d.ts", + "require": "./dist/index.js", + "import": "./dist/index.mjs" + }, + "./serve-static": { + "types": "./dist/serve-static.d.ts", + "require": "./dist/serve-static.js", + "import": "./dist/serve-static.mjs" + }, + "./vercel": { + "types": "./dist/vercel.d.ts", + "require": "./dist/vercel.js", + "import": "./dist/vercel.mjs" + }, + "./utils/*": { + "types": "./dist/utils/*.d.ts", + "require": "./dist/utils/*.js", + "import": "./dist/utils/*.mjs" + }, + "./conninfo": { + "types": "./dist/conninfo.d.ts", + "require": "./dist/conninfo.js", + "import": "./dist/conninfo.mjs" + } + }, + "typesVersions": { + "*": { + ".": [ + "./dist/index.d.ts" + ], + "serve-static": [ + "./dist/serve-static.d.ts" + ], + "vercel": [ + "./dist/vercel.d.ts" + ], + "utils/*": [ + "./dist/utils/*.d.ts" + ], + "conninfo": [ + "./dist/conninfo.d.ts" + ] + } + }, + "scripts": { + "test": "node --expose-gc node_modules/jest/bin/jest.js", + "build": "tsup --external hono", + "watch": "tsup --watch", + "postbuild": "publint", + "prerelease": "bun run build && bun run test", + "release": "np", + "lint": "eslint src test", + "lint:fix": "eslint src test --fix", + "format": "prettier --check \"src/**/*.{js,ts}\" \"test/**/*.{js,ts}\"", + "format:fix": "prettier --write \"src/**/*.{js,ts}\" \"test/**/*.{js,ts}\"" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/honojs/node-server.git" + }, + "homepage": "https://github.com/honojs/node-server", + "author": "Yusuke Wada (https://github.com/yusukebe)", + "publishConfig": { + "registry": "https://registry.npmjs.org", + "access": "public" + }, + "engines": { + "node": ">=18.14.1" + }, + "devDependencies": { + "@hono/eslint-config": "^1.0.1", + "@types/jest": "^29.5.3", + "@types/node": "^20.10.0", + "@types/supertest": "^2.0.12", + "@whatwg-node/fetch": "^0.9.14", + "eslint": "^9.10.0", + "hono": "^4.4.10", + "jest": "^29.6.1", + "np": "^7.7.0", + "prettier": "^3.2.4", + "publint": "^0.1.16", + "supertest": "^6.3.3", + "ts-jest": "^29.1.1", + "tsup": "^7.2.0", + "typescript": "^5.3.2" + }, + "peerDependencies": { + "hono": "^4" + }, + "packageManager": "bun@1.2.20" +} diff --git a/node_modules/@humanfs/core/LICENSE b/node_modules/@humanfs/core/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/node_modules/@humanfs/core/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/@humanfs/core/README.md b/node_modules/@humanfs/core/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4f86d14d66fd15bff2daecf9be05713639800e1f --- /dev/null +++ b/node_modules/@humanfs/core/README.md @@ -0,0 +1,140 @@ +# `@humanfs/core` + +by [Nicholas C. Zakas](https://humanwhocodes.com) + +If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star. + +## Description + +The core functionality for humanfs that is shared across all implementations for all runtimes. The contents of this package are intentionally runtime agnostic and are not intended to be used alone. + +Currently, this package simply exports the `Hfs` class, which is an abstract base class intended to be inherited from in runtime-specific hfs packages (like `@humanfs/node`). + +> [!WARNING] +> This project is **experimental** and may change significantly before v1.0.0. Use at your own caution and definitely not in production! + +## Installation + +### Node.js + +Install using your favorite package manager for Node.js: + +```shell +npm install @humanfs/core + +# or + +pnpm install @humanfs/core + +# or + +yarn add @humanfs/core + +# or + +bun install @humanfs/core +``` + +Then you can import the `Hfs` and `Path` classes like this: + +```js +import { Hfs, Path } from "@humanfs/core"; +``` + +### Deno + +Install using [JSR](https://jsr.io): + +```shell +deno add @humanfs/core + +# or + +jsr add @humanfs/core +``` + +Then you can import the `Hfs` class like this: + +```js +import { Hfs, Path } from "@humanfs/core"; +``` + +### Browser + +It's recommended to import the minified version to save bandwidth: + +```js +import { Hfs, Path } from "https://cdn.skypack.dev/@humanfs/core?min"; +``` + +However, you can also import the unminified version for debugging purposes: + +```js +import { Hfs, Path } from "https://cdn.skypack.dev/@humanfs/core"; +``` + +## Usage + +### `Hfs` Class + +The `Hfs` class contains all of the basic functionality for an `Hfs` instance *without* a predefined impl. This class is mostly used for creating runtime-specific impls, such as `NodeHfs` and `DenoHfs`. + +You can create your own instance by providing an `impl` directly: + +```js +const hfs = new Hfs({ impl: { async text() {} }}); +``` + +The specified `impl` becomes the base impl for the instance, meaning you can always reset back to it using `resetImpl()`. + +You can also inherit from `Hfs` to create your own class with a preconfigured impl, such as: + +```js +class MyHfs extends Hfs { + constructor() { + super({ + impl: myImpl + }); + } +} +``` + +### `Path` Class + +The `Path` class represents the path to a directory or file within a file system. It's an abstract representation that can be used even outside of traditional file systems where string paths might not make sense. + +```js +const myPath = new Path(["dir", "subdir"]); +console.log(myPath.toString()); // "dir/subdir" + +// add another step +myPath.push("file.txt"); +console.log(myPath.toString()); // "dir/subdir/file.txt" + +// get just the last step +console.log(myPath.name); // "file.txt" + +// change just the last step +myPath.name = "file.json"; +console.log(myPath.name); // "file.json" +console.log(myPath.toString()); // "dir/subdir/file.json" + +// get the size of the path +console.log(myPath.size); // 3 + +// remove the last step +myPath.pop(); +console.log(myPath.toString()); // "dir/subdir" + +// iterate over the steps +for (const step of myPath) { + // do something +} + +// create a new path from a string +const newPath = Path.fromString("/foo/bar"); +``` + +## License + +Apache 2.0 diff --git a/node_modules/@humanfs/core/dist/errors.d.ts b/node_modules/@humanfs/core/dist/errors.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c885bbf4f3db7cbfa17b8c61fa7ff03cc24654b6 --- /dev/null +++ b/node_modules/@humanfs/core/dist/errors.d.ts @@ -0,0 +1,64 @@ +/** + * @fileoverview Common error classes + * @author Nicholas C. Zakas + */ +/** + * Error thrown when a file or directory is not found. + */ +export class NotFoundError extends Error { + /** + * Creates a new instance. + * @param {string} message The error message. + */ + constructor(message: string); + /** + * Error code. + * @type {string} + */ + code: string; +} +/** + * Error thrown when an operation is not permitted. + */ +export class PermissionError extends Error { + /** + * Creates a new instance. + * @param {string} message The error message. + */ + constructor(message: string); + /** + * Error code. + * @type {string} + */ + code: string; +} +/** + * Error thrown when an operation is not allowed on a directory. + */ +export class DirectoryError extends Error { + /** + * Creates a new instance. + * @param {string} message The error message. + */ + constructor(message: string); + /** + * Error code. + * @type {string} + */ + code: string; +} +/** + * Error thrown when a directory is not empty. + */ +export class NotEmptyError extends Error { + /** + * Creates a new instance. + * @param {string} message The error message. + */ + constructor(message: string); + /** + * Error code. + * @type {string} + */ + code: string; +} diff --git a/node_modules/@humanfs/core/dist/fsx.d.ts b/node_modules/@humanfs/core/dist/fsx.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ef85093a95e3f3e927bdf0f129664f944e93c377 --- /dev/null +++ b/node_modules/@humanfs/core/dist/fsx.d.ts @@ -0,0 +1,193 @@ +/** + * @fileoverview The main file for the hfs package. + * @author Nicholas C. Zakas + */ +/** @typedef{import("@humanfs/types").HfsImpl} HfsImpl */ +/** @typedef{import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */ +/** + * Error to represent when a method is missing on an impl. + */ +export class NoSuchMethodError extends Error { + /** + * Creates a new instance. + * @param {string} methodName The name of the method that was missing. + */ + constructor(methodName: string); +} +/** + * Error to represent when an impl is already set. + */ +export class ImplAlreadySetError extends Error { + /** + * Creates a new instance. + */ + constructor(); +} +/** + * A class representing a log entry. + */ +export class LogEntry { + /** + * Creates a new instance. + * @param {string} type The type of log entry. + * @param {any} [data] The data associated with the log entry. + */ + constructor(type: string, data?: any); + /** + * The time at which the log entry was created. + * @type {number} + */ + timestamp: number; + methodName: string; + data: any; + #private; +} +/** + * A class representing a file system utility library. + * @implements {HfsImpl} + */ +export class Hfs implements HfsImpl { + /** + * Creates a new instance. + * @param {object} options The options for the instance. + * @param {HfsImpl} options.impl The implementation to use. + */ + constructor({ impl }: { + impl: HfsImpl; + }); + /** + * Starts a new log with the given name. + * @param {string} name The name of the log to start; + * @returns {void} + * @throws {Error} When the log already exists. + * @throws {TypeError} When the name is not a non-empty string. + */ + logStart(name: string): void; + /** + * Ends a log with the given name and returns the entries. + * @param {string} name The name of the log to end. + * @returns {Array} The entries in the log. + * @throws {Error} When the log does not exist. + */ + logEnd(name: string): Array; + /** + * Determines if the current implementation is the base implementation. + * @returns {boolean} True if the current implementation is the base implementation. + */ + isBaseImpl(): boolean; + /** + * Sets the implementation for this instance. + * @param {object} impl The implementation to use. + * @returns {void} + */ + setImpl(impl: object): void; + /** + * Resets the implementation for this instance back to its original. + * @returns {void} + */ + resetImpl(): void; + /** + * Reads the given file and returns the contents as text. Assumes UTF-8 encoding. + * @param {string} filePath The file to read. + * @returns {Promise} The contents of the file. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + text(filePath: string): Promise; + /** + * Reads the given file and returns the contents as JSON. Assumes UTF-8 encoding. + * @param {string} filePath The file to read. + * @returns {Promise} The contents of the file as JSON. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {SyntaxError} When the file contents are not valid JSON. + * @throws {TypeError} When the file path is not a non-empty string. + */ + json(filePath: string): Promise; + /** + * Reads the given file and returns the contents as an ArrayBuffer. + * @param {string} filePath The file to read. + * @returns {Promise} The contents of the file as an ArrayBuffer. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + * @deprecated Use bytes() instead. + */ + arrayBuffer(filePath: string): Promise; + /** + * Reads the given file and returns the contents as an Uint8Array. + * @param {string} filePath The file to read. + * @returns {Promise} The contents of the file as an Uint8Array. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + bytes(filePath: string): Promise; + /** + * Writes the given data to the given file. Creates any necessary directories along the way. + * If the data is a string, UTF-8 encoding is used. + * @param {string} filePath The file to write. + * @param {any} contents The data to write. + * @returns {Promise} A promise that resolves when the file is written. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + write(filePath: string, contents: any): Promise; + /** + * Determines if the given file exists. + * @param {string} filePath The file to check. + * @returns {Promise} True if the file exists. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + isFile(filePath: string): Promise; + /** + * Determines if the given directory exists. + * @param {string} dirPath The directory to check. + * @returns {Promise} True if the directory exists. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the directory path is not a non-empty string. + */ + isDirectory(dirPath: string): Promise; + /** + * Creates the given directory. + * @param {string} dirPath The directory to create. + * @returns {Promise} A promise that resolves when the directory is created. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the directory path is not a non-empty string. + */ + createDirectory(dirPath: string): Promise; + /** + * Deletes the given file. + * @param {string} filePath The file to delete. + * @returns {Promise} A promise that resolves when the file is deleted. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + delete(filePath: string): Promise; + /** + * Deletes the given directory. + * @param {string} dirPath The directory to delete. + * @returns {Promise} A promise that resolves when the directory is deleted. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the directory path is not a non-empty string. + */ + deleteAll(dirPath: string): Promise; + /** + * Returns a list of directory entries for the given path. + * @param {string} dirPath The path to the directory to read. + * @returns {AsyncIterable} A promise that resolves with the + * directory entries. + * @throws {TypeError} If the directory path is not a string. + * @throws {Error} If the directory cannot be read. + */ + list(dirPath: string): AsyncIterable; + /** + * Returns the size of the given file. + * @param {string} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the size of the file. + * @throws {TypeError} If the file path is not a string. + * @throws {Error} If the file cannot be read. + */ + size(filePath: string): Promise; + #private; +} +export type HfsImpl = import("@humanfs/types").HfsImpl; +export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry; diff --git a/node_modules/@humanfs/core/dist/hfs.d.ts b/node_modules/@humanfs/core/dist/hfs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..69ec3681a6cc408bf861387b8b2190dd72ac7083 --- /dev/null +++ b/node_modules/@humanfs/core/dist/hfs.d.ts @@ -0,0 +1,288 @@ +/** + * Error to represent when a method is missing on an impl. + */ +export class NoSuchMethodError extends Error { + /** + * Creates a new instance. + * @param {string} methodName The name of the method that was missing. + */ + constructor(methodName: string); +} +/** + * Error to represent when a method is not supported on an impl. This happens + * when a method on `Hfs` is called with one name and the corresponding method + * on the impl has a different name. (Example: `text()` and `bytes()`.) + */ +export class MethodNotSupportedError extends Error { + /** + * Creates a new instance. + * @param {string} methodName The name of the method that was missing. + */ + constructor(methodName: string); +} +/** + * Error to represent when an impl is already set. + */ +export class ImplAlreadySetError extends Error { + /** + * Creates a new instance. + */ + constructor(); +} +/** + * A class representing a log entry. + */ +export class LogEntry { + /** + * Creates a new instance. + * @param {string} type The type of log entry. + * @param {any} [data] The data associated with the log entry. + */ + constructor(type: string, data?: any); + /** + * The type of log entry. + * @type {string} + */ + type: string; + /** + * The data associated with the log entry. + * @type {any} + */ + data: any; + /** + * The time at which the log entry was created. + * @type {number} + */ + timestamp: number; +} +/** + * A class representing a file system utility library. + * @implements {HfsImpl} + */ +export class Hfs implements HfsImpl { + /** + * Creates a new instance. + * @param {object} options The options for the instance. + * @param {HfsImpl} options.impl The implementation to use. + */ + constructor({ impl }: { + impl: HfsImpl; + }); + /** + * Starts a new log with the given name. + * @param {string} name The name of the log to start; + * @returns {void} + * @throws {Error} When the log already exists. + * @throws {TypeError} When the name is not a non-empty string. + */ + logStart(name: string): void; + /** + * Ends a log with the given name and returns the entries. + * @param {string} name The name of the log to end. + * @returns {Array} The entries in the log. + * @throws {Error} When the log does not exist. + */ + logEnd(name: string): Array; + /** + * Determines if the current implementation is the base implementation. + * @returns {boolean} True if the current implementation is the base implementation. + */ + isBaseImpl(): boolean; + /** + * Sets the implementation for this instance. + * @param {object} impl The implementation to use. + * @returns {void} + */ + setImpl(impl: object): void; + /** + * Resets the implementation for this instance back to its original. + * @returns {void} + */ + resetImpl(): void; + /** + * Reads the given file and returns the contents as text. Assumes UTF-8 encoding. + * @param {string|URL} filePath The file to read. + * @returns {Promise} The contents of the file. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + text(filePath: string | URL): Promise; + /** + * Reads the given file and returns the contents as JSON. Assumes UTF-8 encoding. + * @param {string|URL} filePath The file to read. + * @returns {Promise} The contents of the file as JSON. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {SyntaxError} When the file contents are not valid JSON. + * @throws {TypeError} When the file path is not a non-empty string. + */ + json(filePath: string | URL): Promise; + /** + * Reads the given file and returns the contents as an ArrayBuffer. + * @param {string|URL} filePath The file to read. + * @returns {Promise} The contents of the file as an ArrayBuffer. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + * @deprecated Use bytes() instead. + */ + arrayBuffer(filePath: string | URL): Promise; + /** + * Reads the given file and returns the contents as an Uint8Array. + * @param {string|URL} filePath The file to read. + * @returns {Promise} The contents of the file as an Uint8Array. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + bytes(filePath: string | URL): Promise; + /** + * Writes the given data to the given file. Creates any necessary directories along the way. + * If the data is a string, UTF-8 encoding is used. + * @param {string|URL} filePath The file to write. + * @param {string|ArrayBuffer|ArrayBufferView} contents The data to write. + * @returns {Promise} A promise that resolves when the file is written. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + write(filePath: string | URL, contents: string | ArrayBuffer | ArrayBufferView): Promise; + /** + * Appends the given data to the given file. Creates any necessary directories along the way. + * If the data is a string, UTF-8 encoding is used. + * @param {string|URL} filePath The file to append to. + * @param {string|ArrayBuffer|ArrayBufferView} contents The data to append. + * @returns {Promise} A promise that resolves when the file is appended to. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + * @throws {TypeError} When the file contents are not a string or ArrayBuffer. + * @throws {Error} When the file cannot be appended to. + */ + append(filePath: string | URL, contents: string | ArrayBuffer | ArrayBufferView): Promise; + /** + * Determines if the given file exists. + * @param {string|URL} filePath The file to check. + * @returns {Promise} True if the file exists. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + isFile(filePath: string | URL): Promise; + /** + * Determines if the given directory exists. + * @param {string|URL} dirPath The directory to check. + * @returns {Promise} True if the directory exists. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the directory path is not a non-empty string. + */ + isDirectory(dirPath: string | URL): Promise; + /** + * Creates the given directory. + * @param {string|URL} dirPath The directory to create. + * @returns {Promise} A promise that resolves when the directory is created. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the directory path is not a non-empty string. + */ + createDirectory(dirPath: string | URL): Promise; + /** + * Deletes the given file or empty directory. + * @param {string|URL} filePath The file to delete. + * @returns {Promise} A promise that resolves when the file or + * directory is deleted, true if the file or directory is deleted, false + * if the file or directory does not exist. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + delete(filePath: string | URL): Promise; + /** + * Deletes the given file or directory recursively. + * @param {string|URL} dirPath The directory to delete. + * @returns {Promise} A promise that resolves when the file or + * directory is deleted, true if the file or directory is deleted, false + * if the file or directory does not exist. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the directory path is not a non-empty string. + */ + deleteAll(dirPath: string | URL): Promise; + /** + * Returns a list of directory entries for the given path. + * @param {string|URL} dirPath The path to the directory to read. + * @returns {AsyncIterable} A promise that resolves with the + * directory entries. + * @throws {TypeError} If the directory path is not a string or URL. + * @throws {Error} If the directory cannot be read. + */ + list(dirPath: string | URL): AsyncIterable; + /** + * Walks a directory using a depth-first traversal and returns the entries + * from the traversal. + * @param {string|URL} dirPath The path to the directory to walk. + * @param {Object} [options] The options for the walk. + * @param {(entry:HfsWalkEntry) => Promise|boolean} [options.directoryFilter] A filter function to determine + * if a directory's entries should be included in the walk. + * @param {(entry:HfsWalkEntry) => Promise|boolean} [options.entryFilter] A filter function to determine if + * an entry should be included in the walk. + * @returns {AsyncIterable} A promise that resolves with the + * directory entries. + * @throws {TypeError} If the directory path is not a string or URL. + * @throws {Error} If the directory cannot be read. + */ + walk(dirPath: string | URL, { directoryFilter, entryFilter }?: { + directoryFilter?: (entry: HfsWalkEntry) => Promise | boolean; + entryFilter?: (entry: HfsWalkEntry) => Promise | boolean; + }): AsyncIterable; + /** + * Returns the size of the given file. + * @param {string|URL} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the size of the file. + * @throws {TypeError} If the file path is not a string or URL. + * @throws {Error} If the file cannot be read. + */ + size(filePath: string | URL): Promise; + /** + * Returns the last modified timestamp of the given file or directory. + * @param {string|URL} fileOrDirPath The path to the file or directory. + * @returns {Promise} A promise that resolves with the last modified date + * or undefined if the file or directory does not exist. + * @throws {TypeError} If the path is not a string or URL. + */ + lastModified(fileOrDirPath: string | URL): Promise; + /** + * Copys a file from one location to another. + * @param {string|URL} source The path to the file to copy. + * @param {string|URL} destination The path to the new file. + * @returns {Promise} A promise that resolves when the file is copied. + * @throws {TypeError} If the file path is not a string or URL. + * @throws {Error} If the file cannot be copied. + */ + copy(source: string | URL, destination: string | URL): Promise; + /** + * Copies a file or directory from one location to another. + * @param {string|URL} source The path to the file or directory to copy. + * @param {string|URL} destination The path to copy the file or directory to. + * @returns {Promise} A promise that resolves when the file or directory is + * copied. + * @throws {TypeError} If the directory path is not a string or URL. + * @throws {Error} If the directory cannot be copied. + */ + copyAll(source: string | URL, destination: string | URL): Promise; + /** + * Moves a file from the source path to the destination path. + * @param {string|URL} source The location of the file to move. + * @param {string|URL} destination The destination of the file to move. + * @returns {Promise} A promise that resolves when the move is complete. + * @throws {TypeError} If the file or directory paths are not strings. + * @throws {Error} If the file or directory cannot be moved. + */ + move(source: string | URL, destination: string | URL): Promise; + /** + * Moves a file or directory from one location to another. + * @param {string|URL} source The path to the file or directory to move. + * @param {string|URL} destination The path to move the file or directory to. + * @returns {Promise} A promise that resolves when the file or directory is + * moved. + * @throws {TypeError} If the source is not a string or URL. + * @throws {TypeError} If the destination is not a string or URL. + * @throws {Error} If the file or directory cannot be moved. + */ + moveAll(source: string | URL, destination: string | URL): Promise; + #private; +} +export type HfsImpl = import("@humanfs/types").HfsImpl; +export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry; +export type HfsWalkEntry = import("@humanfs/types").HfsWalkEntry; diff --git a/node_modules/@humanfs/core/dist/index.d.ts b/node_modules/@humanfs/core/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d2dd30f1693b92caa28514a819c9ddabeef8fb95 --- /dev/null +++ b/node_modules/@humanfs/core/dist/index.d.ts @@ -0,0 +1,3 @@ +export { Hfs } from "./hfs.js"; +export { Path } from "./path.js"; +export * from "./errors.js"; diff --git a/node_modules/@humanfs/core/dist/path.d.ts b/node_modules/@humanfs/core/dist/path.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6e29395baa312a05b2e83624d0a5d31d88aecda9 --- /dev/null +++ b/node_modules/@humanfs/core/dist/path.d.ts @@ -0,0 +1,82 @@ +export class Path { + /** + * Creates a new path based on the argument type. If the argument is a string, + * it is assumed to be a file or directory path and is converted to a Path + * instance. If the argument is a URL, it is assumed to be a file URL and is + * converted to a Path instance. If the argument is a Path instance, it is + * copied into a new Path instance. If the argument is an array, it is assumed + * to be the steps of a path and is used to create a new Path instance. + * @param {string|URL|Path|Array} pathish The value to convert to a Path instance. + * @returns {Path} A new Path instance. + * @throws {TypeError} When pathish is not a string, URL, Path, or Array. + * @throws {TypeError} When pathish is a string and is empty. + */ + static from(pathish: string | URL | Path | Array): Path; + /** + * Creates a new Path instance from a string. + * @param {string} fileOrDirPath The file or directory path to convert. + * @returns {Path} A new Path instance. + * @deprecated Use Path.from() instead. + */ + static fromString(fileOrDirPath: string): Path; + /** + * Creates a new Path instance from a URL. + * @param {URL} url The URL to convert. + * @returns {Path} A new Path instance. + * @throws {TypeError} When url is not a URL instance. + * @throws {TypeError} When url.pathname is empty. + * @throws {TypeError} When url.protocol is not "file:". + * @deprecated Use Path.from() instead. + */ + static fromURL(url: URL): Path; + /** + * Creates a new instance. + * @param {Iterable} [steps] The steps to use for the path. + * @throws {TypeError} When steps is not iterable. + */ + constructor(steps?: Iterable); + /** + * Adds steps to the end of the path. + * @param {...string} steps The steps to add to the path. + * @returns {void} + */ + push(...steps: string[]): void; + /** + * Removes the last step from the path. + * @returns {string} The last step in the path. + */ + pop(): string; + /** + * Returns an iterator for steps in the path. + * @returns {IterableIterator} An iterator for the steps in the path. + */ + steps(): IterableIterator; + /** + * Sets the name (the last step) of the path. + * @type {string} + */ + set name(value: string); + /** + * Retrieves the name (the last step) of the path. + * @type {string} + */ + get name(): string; + /** + * Retrieves the size of the path. + * @type {number} + */ + get size(): number; + /** + * Returns the path as a string. + * @returns {string} The path as a string. + */ + toString(): string; + /** + * Returns an iterator for the steps in the path. + * @returns {IterableIterator} An iterator for the steps in the path. + */ + [Symbol.iterator](): IterableIterator; + #private; +} +export type HfsImpl = import("@humanfs/types").HfsImpl; +export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry; diff --git a/node_modules/@humanfs/core/package.json b/node_modules/@humanfs/core/package.json new file mode 100644 index 0000000000000000000000000000000000000000..806a2a5d5d0aa5a7b073c0ff3b9eb74b49204626 --- /dev/null +++ b/node_modules/@humanfs/core/package.json @@ -0,0 +1,54 @@ +{ + "name": "@humanfs/core", + "version": "0.19.2", + "description": "The core of the humanfs library.", + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "exports": { + "import": { + "types": "./dist/index.d.ts", + "default": "./src/index.js" + } + }, + "files": [ + "dist", + "src" + ], + "scripts": { + "build": "tsc", + "prepare": "npm run build", + "pretest": "npm run build", + "test": "c8 mocha tests" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/humanwhocodes/humanfs.git" + }, + "publishConfig": { + "access": "public" + }, + "keywords": [ + "filesystem", + "fs", + "hfs", + "files" + ], + "author": "Nicholas C. Zakas", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/humanwhocodes/humanfs/issues" + }, + "homepage": "https://github.com/humanwhocodes/humanfs#readme", + "engines": { + "node": ">=18.18.0" + }, + "devDependencies": { + "c8": "^9.0.0", + "mocha": "^10.2.0", + "typescript": "^5.2.2" + }, + "dependencies": { + "@humanfs/types": "^0.15.0" + } +} diff --git a/node_modules/@humanfs/core/src/errors.js b/node_modules/@humanfs/core/src/errors.js new file mode 100644 index 0000000000000000000000000000000000000000..8fb35be7c98fb1de830024e5d2cf1c3c7b2f1298 --- /dev/null +++ b/node_modules/@humanfs/core/src/errors.js @@ -0,0 +1,105 @@ +/** + * @fileoverview Common error classes + * @author Nicholas C. Zakas + */ + +/** + * Error thrown when a file or directory is not found. + */ +export class NotFoundError extends Error { + /** + * Name of the error class. + * @type {string} + */ + name = "NotFoundError"; + + /** + * Error code. + * @type {string} + */ + code = "ENOENT"; + + /** + * Creates a new instance. + * @param {string} message The error message. + */ + constructor(message) { + super(`ENOENT: No such file or directory, ${message}`); + } +} + +/** + * Error thrown when an operation is not permitted. + */ +export class PermissionError extends Error { + /** + * Name of the error class. + * @type {string} + */ + name = "PermissionError"; + + /** + * Error code. + * @type {string} + */ + code = "EPERM"; + + /** + * Creates a new instance. + * @param {string} message The error message. + */ + constructor(message) { + super(`EPERM: Operation not permitted, ${message}`); + } +} + +/** + * Error thrown when an operation is not allowed on a directory. + */ + +export class DirectoryError extends Error { + /** + * Name of the error class. + * @type {string} + */ + name = "DirectoryError"; + + /** + * Error code. + * @type {string} + */ + code = "EISDIR"; + + /** + * Creates a new instance. + * @param {string} message The error message. + */ + constructor(message) { + super(`EISDIR: Illegal operation on a directory, ${message}`); + } +} + +/** + * Error thrown when a directory is not empty. + */ +export class NotEmptyError extends Error { + /** + * Name of the error class. + * @type {string} + */ + name = "NotEmptyError"; + + /** + * Error code. + * @type {string} + */ + code = "ENOTEMPTY"; + + /** + * Creates a new instance. + * @param {string} message The error message. + */ + constructor(message) { + super(`ENOTEMPTY: Directory not empty, ${message}`); + } +} diff --git a/node_modules/@humanfs/core/src/hfs.js b/node_modules/@humanfs/core/src/hfs.js new file mode 100644 index 0000000000000000000000000000000000000000..38ee31c5664def3876989783a8ee89acabfa87ff --- /dev/null +++ b/node_modules/@humanfs/core/src/hfs.js @@ -0,0 +1,699 @@ +/** + * @fileoverview The main file for the humanfs package. + * @author Nicholas C. Zakas + */ + +/* global URL, TextDecoder, TextEncoder */ + +//----------------------------------------------------------------------------- +// Types +//----------------------------------------------------------------------------- + +/** @typedef {import("@humanfs/types").HfsImpl} HfsImpl */ +/** @typedef {import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */ +/** @typedef {import("@humanfs/types").HfsWalkEntry} HfsWalkEntry */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +const decoder = new TextDecoder(); +const encoder = new TextEncoder(); + +/** + * Error to represent when a method is missing on an impl. + */ +export class NoSuchMethodError extends Error { + /** + * Creates a new instance. + * @param {string} methodName The name of the method that was missing. + */ + constructor(methodName) { + super(`Method "${methodName}" does not exist on impl.`); + } +} + +/** + * Error to represent when a method is not supported on an impl. This happens + * when a method on `Hfs` is called with one name and the corresponding method + * on the impl has a different name. (Example: `text()` and `bytes()`.) + */ +export class MethodNotSupportedError extends Error { + /** + * Creates a new instance. + * @param {string} methodName The name of the method that was missing. + */ + constructor(methodName) { + super(`Method "${methodName}" is not supported on this impl.`); + } +} + +/** + * Error to represent when an impl is already set. + */ +export class ImplAlreadySetError extends Error { + /** + * Creates a new instance. + */ + constructor() { + super(`Implementation already set.`); + } +} + +/** + * Asserts that the given path is a valid file path. + * @param {any} fileOrDirPath The path to check. + * @returns {void} + * @throws {TypeError} When the path is not a non-empty string. + */ +function assertValidFileOrDirPath(fileOrDirPath) { + if ( + !fileOrDirPath || + (!(fileOrDirPath instanceof URL) && typeof fileOrDirPath !== "string") + ) { + throw new TypeError("Path must be a non-empty string or URL."); + } +} + +/** + * Asserts that the given file contents are valid. + * @param {any} contents The contents to check. + * @returns {void} + * @throws {TypeError} When the contents are not a string or ArrayBuffer. + */ +function assertValidFileContents(contents) { + if ( + typeof contents !== "string" && + !(contents instanceof ArrayBuffer) && + !ArrayBuffer.isView(contents) + ) { + throw new TypeError( + "File contents must be a string, ArrayBuffer, or ArrayBuffer view.", + ); + } +} + +/** + * Converts the given contents to Uint8Array. + * @param {any} contents The data to convert. + * @returns {Uint8Array} The converted Uint8Array. + * @throws {TypeError} When the contents are not a string or ArrayBuffer. + */ +function toUint8Array(contents) { + if (contents instanceof Uint8Array) { + return contents; + } + + if (typeof contents === "string") { + return encoder.encode(contents); + } + + if (contents instanceof ArrayBuffer) { + return new Uint8Array(contents); + } + + if (ArrayBuffer.isView(contents)) { + const bytes = contents.buffer.slice( + contents.byteOffset, + contents.byteOffset + contents.byteLength, + ); + return new Uint8Array(bytes); + } + throw new TypeError( + "Invalid contents type. Expected string or ArrayBuffer.", + ); +} + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * A class representing a log entry. + */ +export class LogEntry { + /** + * The type of log entry. + * @type {string} + */ + type; + + /** + * The data associated with the log entry. + * @type {any} + */ + data; + + /** + * The time at which the log entry was created. + * @type {number} + */ + timestamp = Date.now(); + + /** + * Creates a new instance. + * @param {string} type The type of log entry. + * @param {any} [data] The data associated with the log entry. + */ + constructor(type, data) { + this.type = type; + this.data = data; + } +} + +/** + * A class representing a file system utility library. + * @implements {HfsImpl} + */ +export class Hfs { + /** + * The base implementation for this instance. + * @type {HfsImpl} + */ + #baseImpl; + + /** + * The current implementation for this instance. + * @type {HfsImpl} + */ + #impl; + + /** + * A map of log names to their corresponding entries. + * @type {Map>} + */ + #logs = new Map(); + + /** + * Creates a new instance. + * @param {object} options The options for the instance. + * @param {HfsImpl} options.impl The implementation to use. + */ + constructor({ impl }) { + this.#baseImpl = impl; + this.#impl = impl; + } + + /** + * Logs an entry onto all currently open logs. + * @param {string} methodName The name of the method being called. + * @param {...*} args The arguments to the method. + * @returns {void} + */ + #log(methodName, ...args) { + for (const logs of this.#logs.values()) { + logs.push(new LogEntry("call", { methodName, args })); + } + } + + /** + * Starts a new log with the given name. + * @param {string} name The name of the log to start; + * @returns {void} + * @throws {Error} When the log already exists. + * @throws {TypeError} When the name is not a non-empty string. + */ + logStart(name) { + if (!name || typeof name !== "string") { + throw new TypeError("Log name must be a non-empty string."); + } + + if (this.#logs.has(name)) { + throw new Error(`Log "${name}" already exists.`); + } + + this.#logs.set(name, []); + } + + /** + * Ends a log with the given name and returns the entries. + * @param {string} name The name of the log to end. + * @returns {Array} The entries in the log. + * @throws {Error} When the log does not exist. + */ + logEnd(name) { + if (this.#logs.has(name)) { + const logs = this.#logs.get(name); + this.#logs.delete(name); + return logs; + } + + throw new Error(`Log "${name}" does not exist.`); + } + + /** + * Determines if the current implementation is the base implementation. + * @returns {boolean} True if the current implementation is the base implementation. + */ + isBaseImpl() { + return this.#impl === this.#baseImpl; + } + + /** + * Sets the implementation for this instance. + * @param {object} impl The implementation to use. + * @returns {void} + */ + setImpl(impl) { + this.#log("implSet", impl); + + if (this.#impl !== this.#baseImpl) { + throw new ImplAlreadySetError(); + } + + this.#impl = impl; + } + + /** + * Resets the implementation for this instance back to its original. + * @returns {void} + */ + resetImpl() { + this.#log("implReset"); + this.#impl = this.#baseImpl; + } + + /** + * Asserts that the given method exists on the current implementation. + * @param {string} methodName The name of the method to check. + * @returns {void} + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + */ + #assertImplMethod(methodName) { + if (typeof this.#impl[methodName] !== "function") { + throw new NoSuchMethodError(methodName); + } + } + + /** + * Asserts that the given method exists on the current implementation, and if not, + * throws an error with a different method name. + * @param {string} methodName The name of the method to check. + * @param {string} targetMethodName The name of the method that should be reported + * as an error when methodName does not exist. + * @returns {void} + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + */ + #assertImplMethodAlt(methodName, targetMethodName) { + if (typeof this.#impl[methodName] !== "function") { + throw new MethodNotSupportedError(targetMethodName); + } + } + + /** + * Calls the given method on the current implementation. + * @param {string} methodName The name of the method to call. + * @param {...any} args The arguments to the method. + * @returns {any} The return value from the method. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + */ + #callImplMethod(methodName, ...args) { + this.#log(methodName, ...args); + this.#assertImplMethod(methodName); + return this.#impl[methodName](...args); + } + + /** + * Calls the given method on the current implementation and doesn't log the call. + * @param {string} methodName The name of the method to call. + * @param {...any} args The arguments to the method. + * @returns {any} The return value from the method. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + */ + #callImplMethodWithoutLog(methodName, ...args) { + this.#assertImplMethod(methodName); + return this.#impl[methodName](...args); + } + + /** + * Calls the given method on the current implementation but logs a different method name. + * @param {string} methodName The name of the method to call. + * @param {string} targetMethodName The name of the method to log. + * @param {...any} args The arguments to the method. + * @returns {any} The return value from the method. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + */ + #callImplMethodAlt(methodName, targetMethodName, ...args) { + this.#log(targetMethodName, ...args); + this.#assertImplMethodAlt(methodName, targetMethodName); + return this.#impl[methodName](...args); + } + + /** + * Reads the given file and returns the contents as text. Assumes UTF-8 encoding. + * @param {string|URL} filePath The file to read. + * @returns {Promise} The contents of the file. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + async text(filePath) { + assertValidFileOrDirPath(filePath); + + const result = await this.#callImplMethodAlt("bytes", "text", filePath); + return result ? decoder.decode(result) : undefined; + } + + /** + * Reads the given file and returns the contents as JSON. Assumes UTF-8 encoding. + * @param {string|URL} filePath The file to read. + * @returns {Promise} The contents of the file as JSON. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {SyntaxError} When the file contents are not valid JSON. + * @throws {TypeError} When the file path is not a non-empty string. + */ + async json(filePath) { + assertValidFileOrDirPath(filePath); + + const result = await this.#callImplMethodAlt("bytes", "json", filePath); + return result ? JSON.parse(decoder.decode(result)) : undefined; + } + + /** + * Reads the given file and returns the contents as an ArrayBuffer. + * @param {string|URL} filePath The file to read. + * @returns {Promise} The contents of the file as an ArrayBuffer. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + * @deprecated Use bytes() instead. + */ + async arrayBuffer(filePath) { + assertValidFileOrDirPath(filePath); + + const result = await this.#callImplMethodAlt( + "bytes", + "arrayBuffer", + filePath, + ); + return result?.buffer; + } + + /** + * Reads the given file and returns the contents as an Uint8Array. + * @param {string|URL} filePath The file to read. + * @returns {Promise} The contents of the file as an Uint8Array. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + async bytes(filePath) { + assertValidFileOrDirPath(filePath); + return this.#callImplMethod("bytes", filePath); + } + + /** + * Writes the given data to the given file. Creates any necessary directories along the way. + * If the data is a string, UTF-8 encoding is used. + * @param {string|URL} filePath The file to write. + * @param {string|ArrayBuffer|ArrayBufferView} contents The data to write. + * @returns {Promise} A promise that resolves when the file is written. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + async write(filePath, contents) { + assertValidFileOrDirPath(filePath); + assertValidFileContents(contents); + this.#log("write", filePath, contents); + + let value = toUint8Array(contents); + return this.#callImplMethodWithoutLog("write", filePath, value); + } + + /** + * Appends the given data to the given file. Creates any necessary directories along the way. + * If the data is a string, UTF-8 encoding is used. + * @param {string|URL} filePath The file to append to. + * @param {string|ArrayBuffer|ArrayBufferView} contents The data to append. + * @returns {Promise} A promise that resolves when the file is appended to. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + * @throws {TypeError} When the file contents are not a string or ArrayBuffer. + * @throws {Error} When the file cannot be appended to. + */ + async append(filePath, contents) { + assertValidFileOrDirPath(filePath); + assertValidFileContents(contents); + this.#log("append", filePath, contents); + + let value = toUint8Array(contents); + return this.#callImplMethodWithoutLog("append", filePath, value); + } + + /** + * Determines if the given file exists. + * @param {string|URL} filePath The file to check. + * @returns {Promise} True if the file exists. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + async isFile(filePath) { + assertValidFileOrDirPath(filePath); + return this.#callImplMethod("isFile", filePath); + } + + /** + * Determines if the given directory exists. + * @param {string|URL} dirPath The directory to check. + * @returns {Promise} True if the directory exists. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the directory path is not a non-empty string. + */ + async isDirectory(dirPath) { + assertValidFileOrDirPath(dirPath); + return this.#callImplMethod("isDirectory", dirPath); + } + + /** + * Creates the given directory. + * @param {string|URL} dirPath The directory to create. + * @returns {Promise} A promise that resolves when the directory is created. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the directory path is not a non-empty string. + */ + async createDirectory(dirPath) { + assertValidFileOrDirPath(dirPath); + return this.#callImplMethod("createDirectory", dirPath); + } + + /** + * Deletes the given file or empty directory. + * @param {string|URL} filePath The file to delete. + * @returns {Promise} A promise that resolves when the file or + * directory is deleted, true if the file or directory is deleted, false + * if the file or directory does not exist. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the file path is not a non-empty string. + */ + async delete(filePath) { + assertValidFileOrDirPath(filePath); + return this.#callImplMethod("delete", filePath); + } + + /** + * Deletes the given file or directory recursively. + * @param {string|URL} dirPath The directory to delete. + * @returns {Promise} A promise that resolves when the file or + * directory is deleted, true if the file or directory is deleted, false + * if the file or directory does not exist. + * @throws {NoSuchMethodError} When the method does not exist on the current implementation. + * @throws {TypeError} When the directory path is not a non-empty string. + */ + async deleteAll(dirPath) { + assertValidFileOrDirPath(dirPath); + return this.#callImplMethod("deleteAll", dirPath); + } + + /** + * Returns a list of directory entries for the given path. + * @param {string|URL} dirPath The path to the directory to read. + * @returns {AsyncIterable} A promise that resolves with the + * directory entries. + * @throws {TypeError} If the directory path is not a string or URL. + * @throws {Error} If the directory cannot be read. + */ + async *list(dirPath) { + assertValidFileOrDirPath(dirPath); + yield* await this.#callImplMethod("list", dirPath); + } + + /** + * Walks a directory using a depth-first traversal and returns the entries + * from the traversal. + * @param {string|URL} dirPath The path to the directory to walk. + * @param {Object} [options] The options for the walk. + * @param {(entry:HfsWalkEntry) => Promise|boolean} [options.directoryFilter] A filter function to determine + * if a directory's entries should be included in the walk. + * @param {(entry:HfsWalkEntry) => Promise|boolean} [options.entryFilter] A filter function to determine if + * an entry should be included in the walk. + * @returns {AsyncIterable} A promise that resolves with the + * directory entries. + * @throws {TypeError} If the directory path is not a string or URL. + * @throws {Error} If the directory cannot be read. + */ + async *walk( + dirPath, + { directoryFilter = () => true, entryFilter = () => true } = {}, + ) { + assertValidFileOrDirPath(dirPath); + this.#log("walk", dirPath, { directoryFilter, entryFilter }); + + // inner function for recursion without additional logging + const walk = async function* ( + dirPath, + { directoryFilter, entryFilter, parentPath = "", depth = 1 }, + ) { + let dirEntries; + + try { + dirEntries = await this.#callImplMethodWithoutLog( + "list", + dirPath, + ); + } catch (error) { + // if the directory does not exist then return an empty array + if (error.code === "ENOENT") { + return; + } + + // otherwise, rethrow the error + throw error; + } + + for await (const listEntry of dirEntries) { + const walkEntry = { + path: listEntry.name, + depth, + ...listEntry, + }; + + if (parentPath) { + walkEntry.path = `${parentPath}/${walkEntry.path}`; + } + + // first emit the entry but only if the entry filter returns true + let shouldEmitEntry = entryFilter(walkEntry); + if (shouldEmitEntry.then) { + shouldEmitEntry = await shouldEmitEntry; + } + + if (shouldEmitEntry) { + yield walkEntry; + } + + // if it's a directory then yield the entry and walk the directory + if (listEntry.isDirectory) { + // if the directory filter returns false, skip the directory + let shouldWalkDirectory = directoryFilter(walkEntry); + if (shouldWalkDirectory.then) { + shouldWalkDirectory = await shouldWalkDirectory; + } + + if (!shouldWalkDirectory) { + continue; + } + + // make sure there's a trailing slash on the directory path before appending + const directoryPath = + dirPath instanceof URL + ? new URL( + listEntry.name, + dirPath.href.endsWith("/") + ? dirPath.href + : `${dirPath.href}/`, + ) + : `${dirPath.endsWith("/") ? dirPath : `${dirPath}/`}${listEntry.name}`; + + yield* walk(directoryPath, { + directoryFilter, + entryFilter, + parentPath: walkEntry.path, + depth: depth + 1, + }); + } + } + }.bind(this); + + yield* walk(dirPath, { directoryFilter, entryFilter }); + } + + /** + * Returns the size of the given file. + * @param {string|URL} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the size of the file. + * @throws {TypeError} If the file path is not a string or URL. + * @throws {Error} If the file cannot be read. + */ + async size(filePath) { + assertValidFileOrDirPath(filePath); + return this.#callImplMethod("size", filePath); + } + + /** + * Returns the last modified timestamp of the given file or directory. + * @param {string|URL} fileOrDirPath The path to the file or directory. + * @returns {Promise} A promise that resolves with the last modified date + * or undefined if the file or directory does not exist. + * @throws {TypeError} If the path is not a string or URL. + */ + async lastModified(fileOrDirPath) { + assertValidFileOrDirPath(fileOrDirPath); + return this.#callImplMethod("lastModified", fileOrDirPath); + } + + /** + * Copys a file from one location to another. + * @param {string|URL} source The path to the file to copy. + * @param {string|URL} destination The path to the new file. + * @returns {Promise} A promise that resolves when the file is copied. + * @throws {TypeError} If the file path is not a string or URL. + * @throws {Error} If the file cannot be copied. + */ + async copy(source, destination) { + assertValidFileOrDirPath(source); + assertValidFileOrDirPath(destination); + return this.#callImplMethod("copy", source, destination); + } + + /** + * Copies a file or directory from one location to another. + * @param {string|URL} source The path to the file or directory to copy. + * @param {string|URL} destination The path to copy the file or directory to. + * @returns {Promise} A promise that resolves when the file or directory is + * copied. + * @throws {TypeError} If the directory path is not a string or URL. + * @throws {Error} If the directory cannot be copied. + */ + async copyAll(source, destination) { + assertValidFileOrDirPath(source); + assertValidFileOrDirPath(destination); + return this.#callImplMethod("copyAll", source, destination); + } + + /** + * Moves a file from the source path to the destination path. + * @param {string|URL} source The location of the file to move. + * @param {string|URL} destination The destination of the file to move. + * @returns {Promise} A promise that resolves when the move is complete. + * @throws {TypeError} If the file or directory paths are not strings. + * @throws {Error} If the file or directory cannot be moved. + */ + async move(source, destination) { + assertValidFileOrDirPath(source); + assertValidFileOrDirPath(destination); + return this.#callImplMethod("move", source, destination); + } + + /** + * Moves a file or directory from one location to another. + * @param {string|URL} source The path to the file or directory to move. + * @param {string|URL} destination The path to move the file or directory to. + * @returns {Promise} A promise that resolves when the file or directory is + * moved. + * @throws {TypeError} If the source is not a string or URL. + * @throws {TypeError} If the destination is not a string or URL. + * @throws {Error} If the file or directory cannot be moved. + */ + async moveAll(source, destination) { + assertValidFileOrDirPath(source); + assertValidFileOrDirPath(destination); + return this.#callImplMethod("moveAll", source, destination); + } +} diff --git a/node_modules/@humanfs/core/src/index.js b/node_modules/@humanfs/core/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1b662d480ac0e70771af295677426365e16d27af --- /dev/null +++ b/node_modules/@humanfs/core/src/index.js @@ -0,0 +1,8 @@ +/** + * @fileoverview API entrypoint for hfs/core + * @author Nicholas C. Zakas + */ + +export { Hfs } from "./hfs.js"; +export { Path } from "./path.js"; +export * from "./errors.js"; diff --git a/node_modules/@humanfs/core/src/path.js b/node_modules/@humanfs/core/src/path.js new file mode 100644 index 0000000000000000000000000000000000000000..4798091b9899c0696a0368435c84b2cfc01d5c7f --- /dev/null +++ b/node_modules/@humanfs/core/src/path.js @@ -0,0 +1,237 @@ +/** + * @fileoverview The Path class. + * @author Nicholas C. Zakas + */ + +/* globals URL */ + +//----------------------------------------------------------------------------- +// Types +//----------------------------------------------------------------------------- + +/** @typedef{import("@humanfs/types").HfsImpl} HfsImpl */ +/** @typedef{import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/** + * Normalizes a path to use forward slashes. + * @param {string} filePath The path to normalize. + * @returns {string} The normalized path. + */ +function normalizePath(filePath) { + let startIndex = 0; + let endIndex = filePath.length; + + if (/[a-z]:\//i.test(filePath)) { + startIndex = 3; + } + + if (filePath.startsWith("./")) { + startIndex = 2; + } + + if (filePath.startsWith("/")) { + startIndex = 1; + } + + if (filePath.endsWith("/")) { + endIndex = filePath.length - 1; + } + + return filePath.slice(startIndex, endIndex).replace(/\\/g, "/"); +} + +/** + * Asserts that the given name is a non-empty string, no equal to "." or "..", + * and does not contain a forward slash or backslash. + * @param {string} name The name to check. + * @returns {void} + * @throws {TypeError} When name is not valid. + */ +function assertValidName(name) { + if (typeof name !== "string") { + throw new TypeError("name must be a string"); + } + + if (!name) { + throw new TypeError("name cannot be empty"); + } + + if (name === ".") { + throw new TypeError(`name cannot be "."`); + } + + if (name === "..") { + throw new TypeError(`name cannot be ".."`); + } + + if (name.includes("/") || name.includes("\\")) { + throw new TypeError( + `name cannot contain a slash or backslash: "${name}"`, + ); + } +} + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +export class Path { + /** + * The steps in the path. + * @type {Array} + */ + #steps; + + /** + * Creates a new instance. + * @param {Iterable} [steps] The steps to use for the path. + * @throws {TypeError} When steps is not iterable. + */ + constructor(steps = []) { + if (typeof steps[Symbol.iterator] !== "function") { + throw new TypeError("steps must be iterable"); + } + + this.#steps = [...steps]; + this.#steps.forEach(assertValidName); + } + + /** + * Adds steps to the end of the path. + * @param {...string} steps The steps to add to the path. + * @returns {void} + */ + push(...steps) { + steps.forEach(assertValidName); + this.#steps.push(...steps); + } + + /** + * Removes the last step from the path. + * @returns {string} The last step in the path. + */ + pop() { + return this.#steps.pop(); + } + + /** + * Returns an iterator for steps in the path. + * @returns {IterableIterator} An iterator for the steps in the path. + */ + steps() { + return this.#steps.values(); + } + + /** + * Returns an iterator for the steps in the path. + * @returns {IterableIterator} An iterator for the steps in the path. + */ + [Symbol.iterator]() { + return this.steps(); + } + + /** + * Retrieves the name (the last step) of the path. + * @type {string} + */ + get name() { + return this.#steps[this.#steps.length - 1]; + } + + /** + * Sets the name (the last step) of the path. + * @type {string} + */ + set name(value) { + assertValidName(value); + this.#steps[this.#steps.length - 1] = value; + } + + /** + * Retrieves the size of the path. + * @type {number} + */ + get size() { + return this.#steps.length; + } + + /** + * Returns the path as a string. + * @returns {string} The path as a string. + */ + toString() { + return this.#steps.join("/"); + } + + /** + * Creates a new path based on the argument type. If the argument is a string, + * it is assumed to be a file or directory path and is converted to a Path + * instance. If the argument is a URL, it is assumed to be a file URL and is + * converted to a Path instance. If the argument is a Path instance, it is + * copied into a new Path instance. If the argument is an array, it is assumed + * to be the steps of a path and is used to create a new Path instance. + * @param {string|URL|Path|Array} pathish The value to convert to a Path instance. + * @returns {Path} A new Path instance. + * @throws {TypeError} When pathish is not a string, URL, Path, or Array. + * @throws {TypeError} When pathish is a string and is empty. + */ + static from(pathish) { + if (typeof pathish === "string") { + if (!pathish) { + throw new TypeError("argument cannot be empty"); + } + + return Path.fromString(pathish); + } + + if (pathish instanceof URL) { + return Path.fromURL(pathish); + } + + if (pathish instanceof Path || Array.isArray(pathish)) { + return new Path(pathish); + } + + throw new TypeError("argument must be a string, URL, Path, or Array"); + } + + /** + * Creates a new Path instance from a string. + * @param {string} fileOrDirPath The file or directory path to convert. + * @returns {Path} A new Path instance. + * @deprecated Use Path.from() instead. + */ + static fromString(fileOrDirPath) { + return new Path(normalizePath(fileOrDirPath).split("/")); + } + + /** + * Creates a new Path instance from a URL. + * @param {URL} url The URL to convert. + * @returns {Path} A new Path instance. + * @throws {TypeError} When url is not a URL instance. + * @throws {TypeError} When url.pathname is empty. + * @throws {TypeError} When url.protocol is not "file:". + * @deprecated Use Path.from() instead. + */ + static fromURL(url) { + if (!(url instanceof URL)) { + throw new TypeError("url must be a URL instance"); + } + + if (!url.pathname || url.pathname === "/") { + throw new TypeError("url.pathname cannot be empty"); + } + + if (url.protocol !== "file:") { + throw new TypeError(`url.protocol must be "file:"`); + } + + // Remove leading slash in pathname + return new Path(normalizePath(url.pathname.slice(1)).split("/")); + } +} diff --git a/node_modules/@humanfs/node/LICENSE b/node_modules/@humanfs/node/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/node_modules/@humanfs/node/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/@humanfs/node/README.md b/node_modules/@humanfs/node/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c3e4be478fa18cf8b05526f394d6c03524ac1949 --- /dev/null +++ b/node_modules/@humanfs/node/README.md @@ -0,0 +1,141 @@ +# `@humanfs/node` + +by [Nicholas C. Zakas](https://humanwhocodes.com) + +If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star. + +## Description + +The `hfs` bindings for use in Node.js and Node.js-compatible runtimes. + +> [!WARNING] +> This project is **experimental** and may change significantly before v1.0.0. Use at your own caution and definitely not in production! + +## Installation + +Install using your favorite package manager: + +```shell +npm install @humanfs/node + +# or + +pnpm install @humanfs/node + +# or + +yarn add @humanfs/node + +# or + +bun install @humanfs/node +``` + +## Usage + +The easiest way to use hfs in your project is to import the `hfs` object: + +```js +import { hfs } from "@humanfs/node"; +``` + +Then, you can use the API methods: + +```js +// 1. Files + +// read from a text file +const text = await hfs.text("file.txt"); + +// read from a JSON file +const json = await hfs.json("file.json"); + +// read raw bytes from a text file +const arrayBuffer = await hfs.arrayBuffer("file.txt"); + +// write text to a file +await hfs.write("file.txt", "Hello world!"); + +// write bytes to a file +await hfs.write("file.txt", new TextEncoder().encode("Hello world!")); + +// append text to a file +await hfs.append("file.txt", "Hello world!"); + +// append bytes to a file +await hfs.append("file.txt", new TextEncoder().encode("Hello world!")); + +// does the file exist? +const found = await hfs.isFile("file.txt"); + +// how big is the file? +const size = await hfs.size("file.txt"); + +// when was the file modified? +const mtime = await hfs.lastModified("file.txt"); + +// copy a file from one location to another +await hfs.copy("file.txt", "file-copy.txt"); + +// move a file from one location to another +await hfs.move("file.txt", "renamed.txt"); + +// delete a file +await hfs.delete("file.txt"); + +// 2. Directories + +// create a directory +await hfs.createDirectory("dir"); + +// create a directory recursively +await hfs.createDirectory("dir/subdir"); + +// does the directory exist? +const dirFound = await hfs.isDirectory("dir"); + +// copy the entire directory +hfs.copyAll("from-dir", "to-dir"); + +// move the entire directory +hfs.moveAll("from-dir", "to-dir"); + +// delete a directory +await hfs.delete("dir"); + +// delete a non-empty directory +await hfs.deleteAll("dir"); +``` + +If you'd like to create your own instance, import the `NodeHfs` constructor: + +```js +import { NodeHfs } from "@humanfs/node"; +import fsp from "fs/promises"; + +const hfs = new NodeHfs(); + +// optionally specify the fs/promises object to use +const hfs = new NodeHfs({ fsp }); +``` + +If you'd like to use just the impl, import the `NodeHfsImpl` constructor: + +```js +import { NodeHfsImpl } from "@humanfs/node"; +import fsp from "fs/promises"; + +const hfs = new NodeHfsImpl(); + +// optionally specify the fs/promises object to use +const hfs = new NodeHfsImpl({ fsp }); +``` + +## Errors Handled + +* `ENOENT` - in most cases, these errors are handled silently. +* `ENFILE` and `EMFILE` - calls that result in these errors are retried for up to 60 seconds before giving up for good. + +## License + +Apache 2.0 diff --git a/node_modules/@humanfs/node/dist/index.d.ts b/node_modules/@humanfs/node/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c2d1d306821ed407b2e2868bd57ca108d49680e9 --- /dev/null +++ b/node_modules/@humanfs/node/dist/index.d.ts @@ -0,0 +1,2 @@ +export * from "./node-hfs.js"; +export { Hfs } from "@humanfs/core"; diff --git a/node_modules/@humanfs/node/dist/node-fsx.d.ts b/node_modules/@humanfs/node/dist/node-fsx.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..78e8dbd9efe320df81d7ae175c662465b7c69269 --- /dev/null +++ b/node_modules/@humanfs/node/dist/node-fsx.d.ts @@ -0,0 +1,150 @@ +/// +/** + * A class representing the Node.js implementation of Hfs. + * @implements {HfsImpl} + */ +export class NodeHfsImpl implements HfsImpl { + /** + * Creates a new instance. + * @param {object} [options] The options for the instance. + * @param {Fsp} [options.fsp] The file system module to use. + */ + constructor({ fsp }?: { + fsp?: Fsp; + }); + /** + * Reads a file and returns the contents as a string. Assumes UTF-8 encoding. + * @param {string} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the contents of + * the file or undefined if the file doesn't exist. + * @throws {TypeError} If the file path is not a string. + * @throws {RangeError} If the file path is empty. + * @throws {RangeError} If the file path is not absolute. + * @throws {RangeError} If the file path is not a file. + * @throws {RangeError} If the file path is not readable. + */ + text(filePath: string): Promise; + /** + * Reads a file and returns the contents as a JSON object. Assumes UTF-8 encoding. + * @param {string} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the contents of + * the file or undefined if the file doesn't exist. + * @throws {SyntaxError} If the file contents are not valid JSON. + * @throws {Error} If the file cannot be read. + * @throws {TypeError} If the file path is not a string. + */ + json(filePath: string): Promise; + /** + * Reads a file and returns the contents as an ArrayBuffer. + * @param {string} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the contents + * of the file or undefined if the file doesn't exist. + * @throws {Error} If the file cannot be read. + * @throws {TypeError} If the file path is not a string. + * @deprecated Use bytes() instead. + */ + arrayBuffer(filePath: string): Promise; + /** + * Reads a file and returns the contents as an Uint8Array. + * @param {string} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the contents + * of the file or undefined if the file doesn't exist. + * @throws {Error} If the file cannot be read. + * @throws {TypeError} If the file path is not a string. + */ + bytes(filePath: string): Promise; + /** + * Writes a value to a file. If the value is a string, UTF-8 encoding is used. + * @param {string} filePath The path to the file to write. + * @param {string|ArrayBuffer|ArrayBufferView} contents The contents to write to the + * file. + * @returns {Promise} A promise that resolves when the file is + * written. + * @throws {TypeError} If the file path is not a string. + * @throws {Error} If the file cannot be written. + */ + write(filePath: string, contents: string | ArrayBuffer | ArrayBufferView): Promise; + /** + * Checks if a file exists. + * @param {string} filePath The path to the file to check. + * @returns {Promise} A promise that resolves with true if the + * file exists or false if it does not. + * @throws {Error} If the operation fails with a code other than ENOENT. + */ + isFile(filePath: string): Promise; + /** + * Checks if a directory exists. + * @param {string} dirPath The path to the directory to check. + * @returns {Promise} A promise that resolves with true if the + * directory exists or false if it does not. + * @throws {Error} If the operation fails with a code other than ENOENT. + */ + isDirectory(dirPath: string): Promise; + /** + * Creates a directory recursively. + * @param {string} dirPath The path to the directory to create. + * @returns {Promise} A promise that resolves when the directory is + * created. + */ + createDirectory(dirPath: string): Promise; + /** + * Deletes a file or empty directory. + * @param {string} fileOrDirPath The path to the file or directory to + * delete. + * @returns {Promise} A promise that resolves when the file or + * directory is deleted. + * @throws {TypeError} If the file or directory path is not a string. + * @throws {Error} If the file or directory cannot be deleted. + * @throws {Error} If the file or directory is not found. + */ + delete(fileOrDirPath: string): Promise; + /** + * Deletes a file or directory recursively. + * @param {string} fileOrDirPath The path to the file or directory to + * delete. + * @returns {Promise} A promise that resolves when the file or + * directory is deleted. + * @throws {TypeError} If the file or directory path is not a string. + * @throws {Error} If the file or directory cannot be deleted. + * @throws {Error} If the file or directory is not found. + */ + deleteAll(fileOrDirPath: string): Promise; + /** + * Returns a list of directory entries for the given path. + * @param {string} dirPath The path to the directory to read. + * @returns {AsyncIterable} A promise that resolves with the + * directory entries. + * @throws {TypeError} If the directory path is not a string. + * @throws {Error} If the directory cannot be read. + */ + list(dirPath: string): AsyncIterable; + /** + * Returns the size of a file. + * @param {string} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the size of the + * file in bytes or undefined if the file doesn't exist. + */ + size(filePath: string): Promise; + #private; +} +/** + * A class representing a file system utility library. + * @implements {HfsImpl} + */ +export class NodeHfs extends Hfs implements HfsImpl { + /** + * Creates a new instance. + * @param {object} [options] The options for the instance. + * @param {Fsp} [options.fsp] The file system module to use. + */ + constructor({ fsp }?: { + fsp?: Fsp; + }); +} +export const hfs: NodeHfs; +export type HfsImpl = import("@humanfs/types").HfsImpl; +export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry; +export type Fsp = typeof nativeFsp; +export type Dirent = import("fs").Dirent; +import { Hfs } from "@humanfs/core"; +import nativeFsp from "node:fs/promises"; diff --git a/node_modules/@humanfs/node/dist/node-hfs.d.ts b/node_modules/@humanfs/node/dist/node-hfs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1fd6322200935f662db3ffd06f214eb6f0bb46a6 --- /dev/null +++ b/node_modules/@humanfs/node/dist/node-hfs.d.ts @@ -0,0 +1,176 @@ +/// +/** + * A class representing the Node.js implementation of Hfs. + * @implements {HfsImpl} + */ +export class NodeHfsImpl implements HfsImpl { + /** + * Creates a new instance. + * @param {object} [options] The options for the instance. + * @param {Fsp} [options.fsp] The file system module to use. + */ + constructor({ fsp }?: { + fsp?: Fsp; + }); + /** + * Reads a file and returns the contents as an Uint8Array. + * @param {string|URL} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the contents + * of the file or undefined if the file doesn't exist. + * @throws {Error} If the file cannot be read. + * @throws {TypeError} If the file path is not a string. + */ + bytes(filePath: string | URL): Promise; + /** + * Writes a value to a file. If the value is a string, UTF-8 encoding is used. + * @param {string|URL} filePath The path to the file to write. + * @param {Uint8Array} contents The contents to write to the + * file. + * @returns {Promise} A promise that resolves when the file is + * written. + * @throws {TypeError} If the file path is not a string. + * @throws {Error} If the file cannot be written. + */ + write(filePath: string | URL, contents: Uint8Array): Promise; + /** + * Appends a value to a file. If the value is a string, UTF-8 encoding is used. + * @param {string|URL} filePath The path to the file to append to. + * @param {Uint8Array} contents The contents to append to the + * file. + * @returns {Promise} A promise that resolves when the file is + * written. + * @throws {TypeError} If the file path is not a string. + * @throws {Error} If the file cannot be appended to. + */ + append(filePath: string | URL, contents: Uint8Array): Promise; + /** + * Checks if a file exists. + * @param {string|URL} filePath The path to the file to check. + * @returns {Promise} A promise that resolves with true if the + * file exists or false if it does not. + * @throws {Error} If the operation fails with a code other than ENOENT. + */ + isFile(filePath: string | URL): Promise; + /** + * Checks if a directory exists. + * @param {string|URL} dirPath The path to the directory to check. + * @returns {Promise} A promise that resolves with true if the + * directory exists or false if it does not. + * @throws {Error} If the operation fails with a code other than ENOENT. + */ + isDirectory(dirPath: string | URL): Promise; + /** + * Creates a directory recursively. + * @param {string|URL} dirPath The path to the directory to create. + * @returns {Promise} A promise that resolves when the directory is + * created. + */ + createDirectory(dirPath: string | URL): Promise; + /** + * Deletes a file or empty directory. + * @param {string|URL} fileOrDirPath The path to the file or directory to + * delete. + * @returns {Promise} A promise that resolves when the file or + * directory is deleted, true if the file or directory is deleted, false + * if the file or directory does not exist. + * @throws {TypeError} If the file or directory path is not a string. + * @throws {Error} If the file or directory cannot be deleted. + */ + delete(fileOrDirPath: string | URL): Promise; + /** + * Deletes a file or directory recursively. + * @param {string|URL} fileOrDirPath The path to the file or directory to + * delete. + * @returns {Promise} A promise that resolves when the file or + * directory is deleted, true if the file or directory is deleted, false + * if the file or directory does not exist. + * @throws {TypeError} If the file or directory path is not a string. + * @throws {Error} If the file or directory cannot be deleted. + */ + deleteAll(fileOrDirPath: string | URL): Promise; + /** + * Returns a list of directory entries for the given path. + * @param {string|URL} dirPath The path to the directory to read. + * @returns {AsyncIterable} A promise that resolves with the + * directory entries. + * @throws {TypeError} If the directory path is not a string. + * @throws {Error} If the directory cannot be read. + */ + list(dirPath: string | URL): AsyncIterable; + /** + * Returns the size of a file. This method handles ENOENT errors + * and returns undefined in that case. + * @param {string|URL} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the size of the + * file in bytes or undefined if the file doesn't exist. + */ + size(filePath: string | URL): Promise; + /** + * Returns the last modified date of a file or directory. This method handles ENOENT errors + * and returns undefined in that case. + * @param {string|URL} fileOrDirPath The path to the file to read. + * @returns {Promise} A promise that resolves with the last modified + * date of the file or directory, or undefined if the file doesn't exist. + */ + lastModified(fileOrDirPath: string | URL): Promise; + /** + * Copies a file from one location to another. + * @param {string|URL} source The path to the file to copy. + * @param {string|URL} destination The path to copy the file to. + * @returns {Promise} A promise that resolves when the file is copied. + * @throws {Error} If the source file does not exist. + * @throws {Error} If the source file is a directory. + * @throws {Error} If the destination file is a directory. + */ + copy(source: string | URL, destination: string | URL): Promise; + /** + * Copies a file or directory from one location to another. + * @param {string|URL} source The path to the file or directory to copy. + * @param {string|URL} destination The path to copy the file or directory to. + * @returns {Promise} A promise that resolves when the file or directory is + * copied. + * @throws {Error} If the source file or directory does not exist. + * @throws {Error} If the destination file or directory is a directory. + */ + copyAll(source: string | URL, destination: string | URL): Promise; + /** + * Moves a file from the source path to the destination path. + * @param {string|URL} source The location of the file to move. + * @param {string|URL} destination The destination of the file to move. + * @returns {Promise} A promise that resolves when the move is complete. + * @throws {TypeError} If the file paths are not strings. + * @throws {Error} If the file cannot be moved. + */ + move(source: string | URL, destination: string | URL): Promise; + /** + * Moves a file or directory from the source path to the destination path. + * @param {string|URL} source The location of the file or directory to move. + * @param {string|URL} destination The destination of the file or directory to move. + * @returns {Promise} A promise that resolves when the move is complete. + * @throws {TypeError} If the file paths are not strings. + * @throws {Error} If the file or directory cannot be moved. + */ + moveAll(source: string | URL, destination: string | URL): Promise; + #private; +} +/** + * A class representing a file system utility library. + * @implements {HfsImpl} + */ +export class NodeHfs extends Hfs implements HfsImpl { + /** + * Creates a new instance. + * @param {object} [options] The options for the instance. + * @param {Fsp} [options.fsp] The file system module to use. + */ + constructor({ fsp }?: { + fsp?: Fsp; + }); +} +export const hfs: NodeHfs; +export type HfsImpl = import("@humanfs/types").HfsImpl; +export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry; +export type Fsp = typeof nativeFsp; +export type Dirent = import("fs").Dirent; +import { Hfs } from "@humanfs/core"; +import nativeFsp from "node:fs/promises"; diff --git a/node_modules/@humanfs/node/package.json b/node_modules/@humanfs/node/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0d6de7d04f4ea001ce51e20369415a9bda097609 --- /dev/null +++ b/node_modules/@humanfs/node/package.json @@ -0,0 +1,58 @@ +{ + "name": "@humanfs/node", + "version": "0.16.8", + "description": "The Node.js bindings of the humanfs library.", + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "exports": { + "import": { + "types": "./dist/index.d.ts", + "default": "./src/index.js" + } + }, + "files": [ + "dist", + "src" + ], + "scripts": { + "build": "tsc", + "prepare": "npm run build", + "pretest": "npm run build", + "test": "mocha ./tests/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/humanwhocodes/humanfs.git", + "directory": "packages/node" + }, + "publishConfig": { + "access": "public" + }, + "keywords": [ + "filesystem", + "fs", + "hfs", + "files" + ], + "author": "Nicholas C. Zakas", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/humanwhocodes/humanfs/issues" + }, + "homepage": "https://github.com/humanwhocodes/humanfs#readme", + "engines": { + "node": ">=18.18.0" + }, + "devDependencies": { + "@types/node": "^20.9.4", + "@humanfs/test": "^0.15.0", + "mocha": "^10.2.0", + "typescript": "^5.2.2" + }, + "dependencies": { + "@humanwhocodes/retry": "^0.4.0", + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0" + } +} diff --git a/node_modules/@humanfs/node/src/index.js b/node_modules/@humanfs/node/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6d551aa7f1b272e80242051ad294caef480f2fa7 --- /dev/null +++ b/node_modules/@humanfs/node/src/index.js @@ -0,0 +1,7 @@ +/** + * @fileoverview This file exports everything for this package. + * @author Nicholas C. Zakas + */ + +export * from "./node-hfs.js"; +export { Hfs } from "@humanfs/core"; diff --git a/node_modules/@humanfs/node/src/node-hfs.js b/node_modules/@humanfs/node/src/node-hfs.js new file mode 100644 index 0000000000000000000000000000000000000000..e098b28616dd20c92de410859ccb394c0df59f74 --- /dev/null +++ b/node_modules/@humanfs/node/src/node-hfs.js @@ -0,0 +1,460 @@ +/** + * @fileoverview The main file for the hfs package. + * @author Nicholas C. Zakas + */ +/* global Buffer:readonly, URL */ + +//----------------------------------------------------------------------------- +// Types +//----------------------------------------------------------------------------- + +/** @typedef {import("@humanfs/types").HfsImpl} HfsImpl */ +/** @typedef {import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */ +/** @typedef {import("node:fs/promises")} Fsp */ +/** @typedef {import("fs").Dirent} Dirent */ + +//----------------------------------------------------------------------------- +// Imports +//----------------------------------------------------------------------------- + +import { Hfs } from "@humanfs/core"; +import path from "node:path"; +import { Retrier } from "@humanwhocodes/retry"; +import nativeFsp from "node:fs/promises"; +import { fileURLToPath } from "node:url"; + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +const RETRY_ERROR_CODES = new Set(["ENFILE", "EMFILE"]); + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/** + * A class representing a directory entry. + * @implements {HfsDirectoryEntry} + */ +class NodeHfsDirectoryEntry { + /** + * The name of the directory entry. + * @type {string} + */ + name; + + /** + * True if the entry is a file. + * @type {boolean} + */ + isFile; + + /** + * True if the entry is a directory. + * @type {boolean} + */ + isDirectory; + + /** + * True if the entry is a symbolic link. + * @type {boolean} + */ + isSymlink; + + /** + * Creates a new instance. + * @param {Dirent} dirent The directory entry to wrap. + */ + constructor(dirent) { + this.name = dirent.name; + this.isFile = dirent.isFile(); + this.isDirectory = dirent.isDirectory(); + this.isSymlink = dirent.isSymbolicLink(); + } +} + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * A class representing the Node.js implementation of Hfs. + * @implements {HfsImpl} + */ +export class NodeHfsImpl { + /** + * The file system module to use. + * @type {Fsp} + */ + #fsp; + + /** + * The retryer object used for retrying operations. + * @type {Retrier} + */ + #retrier; + + /** + * Creates a new instance. + * @param {object} [options] The options for the instance. + * @param {Fsp} [options.fsp] The file system module to use. + */ + constructor({ fsp = nativeFsp } = {}) { + this.#fsp = fsp; + this.#retrier = new Retrier(error => RETRY_ERROR_CODES.has(error.code)); + } + + /** + * Reads a file and returns the contents as an Uint8Array. + * @param {string|URL} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the contents + * of the file or undefined if the file doesn't exist. + * @throws {Error} If the file cannot be read. + * @throws {TypeError} If the file path is not a string. + */ + bytes(filePath) { + return this.#retrier + .retry(() => this.#fsp.readFile(filePath)) + .then(buffer => new Uint8Array(buffer.buffer)) + .catch(error => { + if (error.code === "ENOENT") { + return undefined; + } + + throw error; + }); + } + + /** + * Writes a value to a file. If the value is a string, UTF-8 encoding is used. + * @param {string|URL} filePath The path to the file to write. + * @param {Uint8Array} contents The contents to write to the + * file. + * @returns {Promise} A promise that resolves when the file is + * written. + * @throws {TypeError} If the file path is not a string. + * @throws {Error} If the file cannot be written. + */ + async write(filePath, contents) { + const value = Buffer.from(contents); + + return this.#retrier + .retry(() => this.#fsp.writeFile(filePath, value)) + .catch(error => { + // the directory may not exist, so create it + if (error.code === "ENOENT") { + const dirPath = path.dirname( + filePath instanceof URL + ? fileURLToPath(filePath) + : filePath, + ); + + return this.#fsp + .mkdir(dirPath, { recursive: true }) + .then(() => this.#fsp.writeFile(filePath, value)); + } + + throw error; + }); + } + + /** + * Appends a value to a file. If the value is a string, UTF-8 encoding is used. + * @param {string|URL} filePath The path to the file to append to. + * @param {Uint8Array} contents The contents to append to the + * file. + * @returns {Promise} A promise that resolves when the file is + * written. + * @throws {TypeError} If the file path is not a string. + * @throws {Error} If the file cannot be appended to. + */ + async append(filePath, contents) { + const value = Buffer.from(contents); + + return this.#retrier + .retry(() => this.#fsp.appendFile(filePath, value)) + .catch(error => { + // the directory may not exist, so create it + if (error.code === "ENOENT") { + const dirPath = path.dirname( + filePath instanceof URL + ? fileURLToPath(filePath) + : filePath, + ); + + return this.#fsp + .mkdir(dirPath, { recursive: true }) + .then(() => this.#fsp.appendFile(filePath, value)); + } + + throw error; + }); + } + + /** + * Checks if a file exists. + * @param {string|URL} filePath The path to the file to check. + * @returns {Promise} A promise that resolves with true if the + * file exists or false if it does not. + * @throws {Error} If the operation fails with a code other than ENOENT. + */ + isFile(filePath) { + return this.#fsp + .stat(filePath) + .then(stat => stat.isFile()) + .catch(error => { + if (error.code === "ENOENT") { + return false; + } + + throw error; + }); + } + + /** + * Checks if a directory exists. + * @param {string|URL} dirPath The path to the directory to check. + * @returns {Promise} A promise that resolves with true if the + * directory exists or false if it does not. + * @throws {Error} If the operation fails with a code other than ENOENT. + */ + isDirectory(dirPath) { + return this.#fsp + .stat(dirPath) + .then(stat => stat.isDirectory()) + .catch(error => { + if (error.code === "ENOENT") { + return false; + } + + throw error; + }); + } + + /** + * Creates a directory recursively. + * @param {string|URL} dirPath The path to the directory to create. + * @returns {Promise} A promise that resolves when the directory is + * created. + */ + async createDirectory(dirPath) { + await this.#fsp.mkdir(dirPath, { recursive: true }); + } + + /** + * Deletes a file or empty directory. + * @param {string|URL} fileOrDirPath The path to the file or directory to + * delete. + * @returns {Promise} A promise that resolves when the file or + * directory is deleted, true if the file or directory is deleted, false + * if the file or directory does not exist. + * @throws {TypeError} If the file or directory path is not a string. + * @throws {Error} If the file or directory cannot be deleted. + */ + delete(fileOrDirPath) { + return this.#fsp + .rm(fileOrDirPath) + .then(() => true) + .catch(error => { + if (error.code === "ERR_FS_EISDIR") { + return this.#fsp.rmdir(fileOrDirPath).then(() => true); + } + + if (error.code === "ENOENT") { + return false; + } + + throw error; + }); + } + + /** + * Deletes a file or directory recursively. + * @param {string|URL} fileOrDirPath The path to the file or directory to + * delete. + * @returns {Promise} A promise that resolves when the file or + * directory is deleted, true if the file or directory is deleted, false + * if the file or directory does not exist. + * @throws {TypeError} If the file or directory path is not a string. + * @throws {Error} If the file or directory cannot be deleted. + */ + deleteAll(fileOrDirPath) { + return this.#fsp + .rm(fileOrDirPath, { recursive: true }) + .then(() => true) + .catch(error => { + if (error.code === "ENOENT") { + return false; + } + + throw error; + }); + } + + /** + * Returns a list of directory entries for the given path. + * @param {string|URL} dirPath The path to the directory to read. + * @returns {AsyncIterable} A promise that resolves with the + * directory entries. + * @throws {TypeError} If the directory path is not a string. + * @throws {Error} If the directory cannot be read. + */ + async *list(dirPath) { + const entries = await this.#fsp.readdir(dirPath, { + withFileTypes: true, + }); + + for (const entry of entries) { + yield new NodeHfsDirectoryEntry(entry); + } + } + + /** + * Returns the size of a file. This method handles ENOENT errors + * and returns undefined in that case. + * @param {string|URL} filePath The path to the file to read. + * @returns {Promise} A promise that resolves with the size of the + * file in bytes or undefined if the file doesn't exist. + */ + size(filePath) { + return this.#fsp + .stat(filePath) + .then(stat => stat.size) + .catch(error => { + if (error.code === "ENOENT") { + return undefined; + } + + throw error; + }); + } + + /** + * Returns the last modified date of a file or directory. This method handles ENOENT errors + * and returns undefined in that case. + * @param {string|URL} fileOrDirPath The path to the file to read. + * @returns {Promise} A promise that resolves with the last modified + * date of the file or directory, or undefined if the file doesn't exist. + */ + lastModified(fileOrDirPath) { + return this.#fsp + .stat(fileOrDirPath) + .then(stat => stat.mtime) + .catch(error => { + if (error.code === "ENOENT") { + return undefined; + } + + throw error; + }); + } + + /** + * Copies a file from one location to another. + * @param {string|URL} source The path to the file to copy. + * @param {string|URL} destination The path to copy the file to. + * @returns {Promise} A promise that resolves when the file is copied. + * @throws {Error} If the source file does not exist. + * @throws {Error} If the source file is a directory. + * @throws {Error} If the destination file is a directory. + */ + async copy(source, destination) { + const stat = await this.#fsp.lstat(source); + if (stat.isSymbolicLink()) { + const target = await this.#fsp.readlink(source); + return this.#fsp.symlink(target, destination); + } + return this.#fsp.copyFile(source, destination); + } + + /** + * Copies a file or directory from one location to another. + * @param {string|URL} source The path to the file or directory to copy. + * @param {string|URL} destination The path to copy the file or directory to. + * @returns {Promise} A promise that resolves when the file or directory is + * copied. + * @throws {Error} If the source file or directory does not exist. + * @throws {Error} If the destination file or directory is a directory. + */ + async copyAll(source, destination) { + // for files use copy() and exit + if (await this.isFile(source)) { + return this.copy(source, destination); + } + + const sourceStr = + source instanceof URL ? fileURLToPath(source) : source; + + const destinationStr = + destination instanceof URL + ? fileURLToPath(destination) + : destination; + + // for directories, create the destination directory and copy each entry + await this.createDirectory(destination); + + for await (const entry of this.list(source)) { + const fromEntryPath = path.join(sourceStr, entry.name); + const toEntryPath = path.join(destinationStr, entry.name); + + if (entry.isSymlink) { + const target = await this.#fsp.readlink(fromEntryPath); + await this.#fsp.symlink(target, toEntryPath); + } else if (entry.isDirectory) { + await this.copyAll(fromEntryPath, toEntryPath); + } else { + await this.copy(fromEntryPath, toEntryPath); + } + } + } + + /** + * Moves a file from the source path to the destination path. + * @param {string|URL} source The location of the file to move. + * @param {string|URL} destination The destination of the file to move. + * @returns {Promise} A promise that resolves when the move is complete. + * @throws {TypeError} If the file paths are not strings. + * @throws {Error} If the file cannot be moved. + */ + move(source, destination) { + return this.#fsp.stat(source).then(stat => { + if (stat.isDirectory()) { + throw new Error( + `EISDIR: illegal operation on a directory, move '${source}' -> '${destination}'`, + ); + } + + return this.#fsp.rename(source, destination); + }); + } + + /** + * Moves a file or directory from the source path to the destination path. + * @param {string|URL} source The location of the file or directory to move. + * @param {string|URL} destination The destination of the file or directory to move. + * @returns {Promise} A promise that resolves when the move is complete. + * @throws {TypeError} If the file paths are not strings. + * @throws {Error} If the file or directory cannot be moved. + */ + async moveAll(source, destination) { + return this.#fsp.rename(source, destination); + } +} + +/** + * A class representing a file system utility library. + * @implements {HfsImpl} + */ +export class NodeHfs extends Hfs { + /** + * Creates a new instance. + * @param {object} [options] The options for the instance. + * @param {Fsp} [options.fsp] The file system module to use. + */ + constructor({ fsp } = {}) { + super({ impl: new NodeHfsImpl({ fsp }) }); + } +} + +export const hfs = new NodeHfs(); diff --git a/node_modules/@humanfs/types/CHANGELOG.md b/node_modules/@humanfs/types/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..fd9725fa5e278c233b75a2fd90bc698ff11fb2fe --- /dev/null +++ b/node_modules/@humanfs/types/CHANGELOG.md @@ -0,0 +1,150 @@ +# Changelog + +## [0.15.0](https://github.com/humanwhocodes/humanfs/compare/types-v0.14.0...types-v0.15.0) (2024-09-09) + + +### Features + +* Add depth to HfsWalkEntry ([#130](https://github.com/humanwhocodes/humanfs/issues/130)) ([a633452](https://github.com/humanwhocodes/humanfs/commit/a63345260562b798e73c2ea63612e6fe95ac400d)) + +## [0.14.0](https://github.com/humanwhocodes/humanfs/compare/types-v0.13.0...types-v0.14.0) (2024-06-12) + + +### Features + +* Implement Hfs#walk() method ([#119](https://github.com/humanwhocodes/humanfs/issues/119)) ([2aeade0](https://github.com/humanwhocodes/humanfs/commit/2aeade0ffbef886103dc38d16694e9b63191a8df)) + +## [0.13.0](https://github.com/humanwhocodes/humanfs/compare/types-v0.12.0...types-v0.13.0) (2024-03-20) + + +### โš  BREAKING CHANGES + +* delete/deleteAll should not throw on ENOENT ([#105](https://github.com/humanwhocodes/humanfs/issues/105)) + +### Features + +* delete/deleteAll should not throw on ENOENT ([#105](https://github.com/humanwhocodes/humanfs/issues/105)) ([b508df1](https://github.com/humanwhocodes/humanfs/commit/b508df19845f7a914895c13cfe47707c0cd1a7c7)) + +## [0.12.0](https://github.com/humanwhocodes/humanfs/compare/types-v0.11.0...types-v0.12.0) (2024-02-27) + + +### Features + +* impl write() method only needs to handle Uint8Arrays ([#92](https://github.com/humanwhocodes/humanfs/issues/92)) ([68bcfb5](https://github.com/humanwhocodes/humanfs/commit/68bcfb59a6684b184c55f97536aad730636299b5)) + +## [0.11.0](https://github.com/humanwhocodes/humanfs/compare/types-v0.10.0...types-v0.11.0) (2024-02-23) + + +### Features + +* Impls only need bytes() method to read data ([#90](https://github.com/humanwhocodes/humanfs/issues/90)) ([c0c3b36](https://github.com/humanwhocodes/humanfs/commit/c0c3b36413c8d10e63a94ad1cc6a5cead7b52e88)) + +## [0.10.0](https://github.com/humanwhocodes/humanfs/compare/types-v0.9.0...types-v0.10.0) (2024-02-16) + + +### โš  BREAKING CHANGES + +* Rewrite MemoryHfsImpl to support lastModified() ([#87](https://github.com/humanwhocodes/humanfs/issues/87)) + +### Features + +* Add lastModified() method ([#84](https://github.com/humanwhocodes/humanfs/issues/84)) ([9cbcd03](https://github.com/humanwhocodes/humanfs/commit/9cbcd03c86e4c1bed5985e10da6ab452e8c2b44c)) +* Rewrite MemoryHfsImpl to support lastModified() ([#87](https://github.com/humanwhocodes/humanfs/issues/87)) ([84e9812](https://github.com/humanwhocodes/humanfs/commit/84e98129e48acb3f2ea067b0ea745d591e8d8b91)) + +## [0.9.0](https://github.com/humanwhocodes/humanfs/compare/types-v0.8.0...types-v0.9.0) (2024-02-14) + + +### Features + +* Add append() method ([#82](https://github.com/humanwhocodes/humanfs/issues/82)) ([ab7b978](https://github.com/humanwhocodes/humanfs/commit/ab7b978ff3be84dc3fd2fd4d6fa1131dfdec8134)) +* Add move() and moveAll() methods ([#80](https://github.com/humanwhocodes/humanfs/issues/80)) ([85f100b](https://github.com/humanwhocodes/humanfs/commit/85f100b721c99b920b307779548c2a043e7e18b5)) + +## [0.8.0](https://github.com/humanwhocodes/humanfs/compare/types-v0.7.0...types-v0.8.0) (2024-02-09) + + +### Features + +* Add copyAll() method ([#77](https://github.com/humanwhocodes/humanfs/issues/77)) ([3c0852a](https://github.com/humanwhocodes/humanfs/commit/3c0852af99cb835b3941f58fdc2206e7b1179e21)) + +## [0.7.0](https://github.com/humanwhocodes/humanfs/compare/types-v0.6.0...types-v0.7.0) (2024-02-08) + + +### Features + +* Add copy() method ([#69](https://github.com/humanwhocodes/humanfs/issues/69)) ([f252bac](https://github.com/humanwhocodes/humanfs/commit/f252bac6692a5b5c973ee3c696f5190caa5f12c7)) + +## [0.6.0](https://github.com/humanwhocodes/humanfs/compare/types-v0.5.1...types-v0.6.0) (2024-02-07) + + +### Features + +* Allow URL file and directory paths ([#62](https://github.com/humanwhocodes/humanfs/issues/62)) ([a767e37](https://github.com/humanwhocodes/humanfs/commit/a767e372287b1556c4c9e8bdb26c23ff81866f99)) + +## [0.5.1](https://github.com/humanwhocodes/humanfs/compare/types-v0.5.0...types-v0.5.1) (2024-01-31) + + +### Bug Fixes + +* Order of exports and engines in package.json ([66204c2](https://github.com/humanwhocodes/humanfs/commit/66204c24bc2dd02380aa2fb3c5769ca2cf5238a7)), closes [#61](https://github.com/humanwhocodes/humanfs/issues/61) + +## [0.5.0](https://github.com/humanwhocodes/humanfs/compare/types-v0.4.0...types-v0.5.0) (2024-01-30) + + +### โš  BREAKING CHANGES + +* Rename fsx -> humanfs ([#56](https://github.com/humanwhocodes/humanfs/issues/56)) + +### Features + +* Rename fsx -> humanfs ([#56](https://github.com/humanwhocodes/humanfs/issues/56)) ([f5dc533](https://github.com/humanwhocodes/humanfs/commit/f5dc533c8a46d45afd7aad602af39a6074f8a07b)) + +## [0.4.0](https://github.com/humanwhocodes/fsx/compare/fsx-types-v0.3.0...fsx-types-v0.4.0) (2024-01-27) + + +### Features + +* New size() method ([#51](https://github.com/humanwhocodes/fsx/issues/51)) ([ffd12e6](https://github.com/humanwhocodes/fsx/commit/ffd12e6b0db318320dd5a9dbb8eb248106d60afa)) + +## [0.3.0](https://github.com/humanwhocodes/fsx/compare/fsx-types-v0.2.0...fsx-types-v0.3.0) (2024-01-23) + + +### โš  BREAKING CHANGES + +* Safer delete(); new deleteAll() method ([#37](https://github.com/humanwhocodes/fsx/issues/37)) + +### Features + +* Safer delete(); new deleteAll() method ([#37](https://github.com/humanwhocodes/fsx/issues/37)) ([2e85142](https://github.com/humanwhocodes/fsx/commit/2e85142e34bdc3cc18e18aa0b051cc9007fca4b8)) +* write() to accept ArrayBuffer views as file contents ([1fd5517](https://github.com/humanwhocodes/fsx/commit/1fd55174a528ef3dcbabc154347006bec799f3f9)) + + +### Bug Fixes + +* **types:** Ensure FsxImpl methods also return undefined ([14eadc6](https://github.com/humanwhocodes/fsx/commit/14eadc66b19e40d7406a166e019004d9888075d3)), closes [#32](https://github.com/humanwhocodes/fsx/issues/32) + +## [0.2.0](https://github.com/humanwhocodes/fsx/compare/fsx-types-v0.1.0...fsx-types-v0.2.0) (2024-01-19) + + +### Features + +* Add list() method ([#25](https://github.com/humanwhocodes/fsx/issues/25)) ([dad841b](https://github.com/humanwhocodes/fsx/commit/dad841b7c9f5312996ff23db9be36774af985157)) + +## [0.1.0](https://github.com/humanwhocodes/fsx/compare/fsx-types-v0.0.3...fsx-types-v0.1.0) (2024-01-18) + + +### Features + +* Add bytes() method, deprecate arrayBuffer() ([718c9c8](https://github.com/humanwhocodes/fsx/commit/718c9c84a0a1dcaef3cc032c882b1308e9cb3273)) + +## [0.0.3](https://github.com/humanwhocodes/fsx/compare/fsx-types-v0.0.2...fsx-types-v0.0.3) (2024-01-16) + + +### Bug Fixes + +* Ensure isFile/isDirectory rethrow non-ENOENT errors. ([d31ee56](https://github.com/humanwhocodes/fsx/commit/d31ee56788e898cbc1fc0d6a54d1551f9b17cd45)), closes [#14](https://github.com/humanwhocodes/fsx/issues/14) + +## [0.0.2](https://github.com/humanwhocodes/fsx/compare/fsx-types-v0.0.1...fsx-types-v0.0.2) (2024-01-06) + +### Bug Fixes + +- **docs:** Correct package names in READMEs ([6c552ac](https://github.com/humanwhocodes/fsx/commit/6c552ac74542a245cdc2675101858da022336a1a)) diff --git a/node_modules/@humanfs/types/README.md b/node_modules/@humanfs/types/README.md new file mode 100644 index 0000000000000000000000000000000000000000..7a476fce766818297091124810ff69e8414032e0 --- /dev/null +++ b/node_modules/@humanfs/types/README.md @@ -0,0 +1,13 @@ +# `@humanfs/types` + +by [Nicholas C. Zakas](https://humanwhocodes.com) + +If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star. + +## Description + +Additional type definitions for humanfs. These are used primarily to share type definitions across packages because there is no easy way to export imported type definitions using JavaScript and JSDoc. + +## License + +Apache 2.0 diff --git a/node_modules/@humanfs/types/package.json b/node_modules/@humanfs/types/package.json new file mode 100644 index 0000000000000000000000000000000000000000..bdbeff88fcf6c95e546c3868975296b9f83005b2 --- /dev/null +++ b/node_modules/@humanfs/types/package.json @@ -0,0 +1,42 @@ +{ + "name": "@humanfs/types", + "version": "0.15.0", + "description": "The TypeScript types for the hfs project.", + "type": "module", + "types": "src/hfs-types.ts", + "exports": { + ".": { + "types": "./src/hfs-types.ts" + }, + "./package.json": "./package.json" + }, + "scripts": { + "build": "tsc", + "prepare": "npm run build" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/humanwhocodes/humanfs.git" + }, + "publishConfig": { + "access": "public" + }, + "keywords": [ + "filesystem", + "fs", + "hfs", + "files" + ], + "author": "Nicholas C. Zakas", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/humanwhocodes/humanfs/issues" + }, + "homepage": "https://github.com/humanwhocodes/humanfs#readme", + "engines": { + "node": ">=18.18.0" + }, + "devDependencies": { + "typescript": "^5.2.2" + } +} diff --git a/node_modules/@humanfs/types/src/hfs-types.ts b/node_modules/@humanfs/types/src/hfs-types.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6d109617c45bd6698e3a1fd7b00745537ea3111 --- /dev/null +++ b/node_modules/@humanfs/types/src/hfs-types.ts @@ -0,0 +1,192 @@ +/** + * @fileoverview The types file for the hfs package. + * @author Nicholas C. Zakas + */ + +//------------------------------------------------------------------------------ +// HfsImpl +//------------------------------------------------------------------------------ + +export interface HfsImpl { + + /** + * Reads the given file and returns the contents as an Uint8Array. + * @param filePath The file to read. + * @returns The contents of the file as a Uint8Array or undefined if the file is empty. + */ + bytes?(filePath: string|URL): Promise; + + /** + * Writes the given data to the given file. For text, assumes UTF-8 encoding. + * @param filePath The file to write to. + * @param data The data to write. + * @returns A promise that resolves when the file is written. + * @throws {Error} If the file cannot be written. + */ + write?(filePath: string|URL, data: Uint8Array): Promise; + + /** + * Appends the given data to the given file. For text, assumes UTF-8 encoding. + * @param filePath The file to append to. + * @param data The data to append. + * @returns A promise that resolves when the file is written. + * @throws {Error} If the file cannot be written. + */ + append?(filePath: string|URL, data: Uint8Array): Promise; + + /** + * Checks if the given file exists. + * @param filePath The file to check. + * @returns True if the file exists, false if not. + * @throws {Error} If the operation fails with a code other than ENOENT. + */ + isFile?(filePath: string|URL): Promise; + + /** + * Checks if the given directory exists. + * @param dirPath The directory to check. + * @returns True if the directory exists, false if not. + * @throws {Error} If the operation fails with a code other than ENOENT. + */ + isDirectory?(dirPath: string|URL): Promise; + + /** + * Creates the given directory, including any necessary parents. + * @param dirPath The directory to create. + * @returns A promise that resolves when the directory is created. + * @throws {Error} If the directory cannot be created. + */ + createDirectory?(dirPath: string|URL): Promise; + + /** + * Deletes the given file or empty directory. + * @param fileOrDirPath The file or directory to delete. + * @returns A promise that resolves when the file or directory is deleted, + * true if the file or directory was deleted, false if it did not exist. + * @throws {Error} If the file or directory cannot be deleted. + */ + delete?(fileOrDirPath: string|URL): Promise; + + /** + * Deletes the given file or directory recursively. + * @param fileOrDirPath The file or directory to delete. + * @returns A promise that resolves when the file or directory is deleted, + * true if the file or directory was deleted, false if it did not exist. + * @throws {Error} If the file or directory cannot be deleted. + */ + deleteAll?(fileOrDirPath: string|URL): Promise; + + /** + * Returns a list of directory entries for the given path. + * @param dirPath The path to the directory to read. + * @returns A promise that resolves with the + * directory entries. + * @throws {TypeError} If the directory path is not a string. + * @throws {Error} If the directory cannot be read. + */ + list?(dirPath: string|URL): AsyncIterable; + + /** + * Returns the size of the given file. + * @param filePath The path to the file to check. + * @returns A promise that resolves with the size of the file in bytes or + * undefined if the file does not exist. + * @throws {Error} If the file cannot be read. + */ + size?(filePath: string|URL): Promise; + + /** + * Returns the last modified date of the given file or directory. + * @param fileOrDirPath The path to the file or directory to check. + * @returns A promise that resolves with the last modified date of the file or + * directory, undefined if the file does not exist. + * @throws {Error} If the file or directory cannot be read. + */ + lastModified?(fileOrDirPath: string|URL): Promise; + + /** + * Copies the file from the source path to the destination path. + * @param source The source file to copy. + * @param destination The destination file to copy to. + * @returns A promise that resolves when the file is copied. + * @throws {Error} If the file cannot be copied. + */ + copy?(source: string|URL, destination: string|URL): Promise; + + /** + * Copies a file or directory from one location to another. + * @param source The path to the file or directory to copy. + * @param destination The path to copy the file or directory to. + * @returns A promise that resolves when the file or directory is + * copied. + * @throws {Error} If the source file or directory does not exist. + * @throws {Error} If the source cannot be read. + */ + copyAll?(source: string|URL, destination: string|URL): Promise; + + /** + * Moves a file from the source path to the destination path. + * @param source The location of the file to move. + * @param destination The destination of the file to move. + * @returns A promise that resolves when the file is moved. + * @throws {Error} If the source is a directory. + * @throws {Error} If the file cannot be moved. + */ + move?(source: string|URL, destination: string|URL): Promise; + + /** + * Moves a file or directory from one location to another. + * @param source The path to the file or directory to move. + * @param destination The path to move the file or directory to. + * @returns A promise that resolves when the file or directory is + * moved. + * @throws {Error} If the source file or directory does not exist. + * @throws {Error} If the source cannot be read. + */ + moveAll?(source: string|URL, destination: string|URL): Promise; +} + +//------------------------------------------------------------------------------ +// HfsDirectoryEntry +//------------------------------------------------------------------------------ + +export interface HfsDirectoryEntry { + + /** + * The name of the file or directory. + */ + name: string; + + /** + * True if the entry is a directory, false if not. + */ + isDirectory: boolean; + + /** + * True if the entry is a file, false if not. + */ + isFile: boolean; + + /** + * True if the entry is a symbolic link, false if not. + */ + isSymlink: boolean; + +} + +//------------------------------------------------------------------------------ +// HfsWalkEntry +//------------------------------------------------------------------------------ + +export interface HfsWalkEntry extends HfsDirectoryEntry { + + /** + * The path of the entry relative to the directory that was walked. + */ + path: string; + + /** + * The depth of the entry in the directory tree from the directory that was walked. + */ + depth: number; +} diff --git a/node_modules/@humanfs/types/tsconfig.json b/node_modules/@humanfs/types/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..22daf84e2acfc29d985c5e65fa8b788d24b17c23 --- /dev/null +++ b/node_modules/@humanfs/types/tsconfig.json @@ -0,0 +1,13 @@ +{ + "files": ["src/hfs-types.ts"], + "compilerOptions": { + "declaration": true, + "emitDeclarationOnly": true, + "allowJs": true, + "checkJs": true, + "outDir": "dist", + "target": "ES2022", + "moduleResolution": "NodeNext", + "module": "NodeNext" + } +} diff --git a/node_modules/@humanwhocodes/module-importer/CHANGELOG.md b/node_modules/@humanwhocodes/module-importer/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..1b442a195d9898cfba6c87d1d9212f494af468de --- /dev/null +++ b/node_modules/@humanwhocodes/module-importer/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +## [1.0.1](https://github.com/humanwhocodes/module-importer/compare/v1.0.0...v1.0.1) (2022-08-18) + + +### Bug Fixes + +* Ensure CommonJS mode works correctly. ([cf54a0b](https://github.com/humanwhocodes/module-importer/commit/cf54a0b998085066fbe1776dd0b4cacd808cc192)), closes [#6](https://github.com/humanwhocodes/module-importer/issues/6) + +## 1.0.0 (2022-08-17) + + +### Features + +* Implement ModuleImporter ([3ce4e82](https://www.github.com/humanwhocodes/module-importer/commit/3ce4e820c30c114e787bfed00a0966ac4772f563)) diff --git a/node_modules/@humanwhocodes/module-importer/LICENSE b/node_modules/@humanwhocodes/module-importer/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/node_modules/@humanwhocodes/module-importer/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/@humanwhocodes/module-importer/README.md b/node_modules/@humanwhocodes/module-importer/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3de07a7fb21a01258abb1a6d8703c0269d94ddc0 --- /dev/null +++ b/node_modules/@humanwhocodes/module-importer/README.md @@ -0,0 +1,80 @@ +# ModuleImporter + +by [Nicholas C. Zakas](https://humanwhocodes.com) + +If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate). + +## Description + +A utility for seamlessly importing modules in Node.js regardless if they are CommonJS or ESM format. Under the hood, this uses `import()` and relies on Node.js's CommonJS compatibility to work correctly. This ensures that the correct locations and formats are used for CommonJS so you can call one method and not worry about any compatibility issues. + +The problem with the default `import()` is that it always resolves relative to the file location in which it is called. If you want to resolve from a different location, you need to jump through a few hoops to achieve that. This package makes it easy to both resolve and import modules from any directory. + +## Usage + +### Node.js + +Install using [npm][npm] or [yarn][yarn]: + +``` +npm install @humanwhocodes/module-importer + +# or + +yarn add @humanwhocodes/module-importer +``` + +Import into your Node.js project: + +```js +// CommonJS +const { ModuleImporter } = require("@humanwhocodes/module-importer"); + +// ESM +import { ModuleImporter } from "@humanwhocodes/module-importer"; +``` + +### Bun + +Install using this command: + +``` +bun add @humanwhocodes/module-importer +``` + +Import into your Bun project: + +```js +import { ModuleImporter } from "@humanwhocodes/module-importer"; +``` + +## API + +After importing, create a new instance of `ModuleImporter` to start emitting events: + +```js +// cwd can be omitted to use process.cwd() +const importer = new ModuleImporter(cwd); + +// you can resolve the location of any package +const location = importer.resolve("./some-file.cjs"); + +// you can also import directly +const module = importer.import("./some-file.cjs"); +``` + +For both `resolve()` and `import()`, you can pass in package names and filenames. + +## Developer Setup + +1. Fork the repository +2. Clone your fork +3. Run `npm install` to setup dependencies +4. Run `npm test` to run tests + +## License + +Apache 2.0 + +[npm]: https://npmjs.com/ +[yarn]: https://yarnpkg.com/ diff --git a/node_modules/@humanwhocodes/module-importer/dist/module-importer.cjs b/node_modules/@humanwhocodes/module-importer/dist/module-importer.cjs new file mode 100644 index 0000000000000000000000000000000000000000..779e0cf6f5cf613e2613ff777da453d3f8b0f957 --- /dev/null +++ b/node_modules/@humanwhocodes/module-importer/dist/module-importer.cjs @@ -0,0 +1,22 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var module$1 = require('module'); +var url = require('url'); +var path = require('path'); + +/** + * @fileoverview Universal module importer + */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +const __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('module-importer.cjs', document.baseURI).href))); +const __dirname$1 = path.dirname(__filename$1); +const require$1 = module$1.createRequire(__dirname$1 + "/"); +const { ModuleImporter } = require$1("./module-importer.cjs"); + +exports.ModuleImporter = ModuleImporter; diff --git a/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.cts b/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..a1acbb6d38689deecfbe7efde971a9e4490b9c82 --- /dev/null +++ b/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.cts @@ -0,0 +1,27 @@ +export class ModuleImporter { + /** + * Creates a new instance. + * @param {string} [cwd] The current working directory to resolve from. + */ + constructor(cwd?: string); + /** + * The base directory from which paths should be resolved. + * @type {string} + */ + cwd: string; + /** + * Resolves a module based on its name or location. + * @param {string} specifier Either an npm package name or + * relative file path. + * @returns {string|undefined} The location of the import. + * @throws {Error} If specifier cannot be located. + */ + resolve(specifier: string): string | undefined; + /** + * Imports a module based on its name or location. + * @param {string} specifier Either an npm package name or + * relative file path. + * @returns {Promise} The module's object. + */ + import(specifier: string): Promise; +} diff --git a/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.ts b/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..498f0a246564ebd299956b89d37c7abd9cd86589 --- /dev/null +++ b/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.ts @@ -0,0 +1,2 @@ +export { ModuleImporter }; +import { ModuleImporter } from "./module-importer.cjs"; diff --git a/node_modules/@humanwhocodes/module-importer/dist/module-importer.js b/node_modules/@humanwhocodes/module-importer/dist/module-importer.js new file mode 100644 index 0000000000000000000000000000000000000000..26e052da1f2b813c09c13a1abc4ea5381df0ac00 --- /dev/null +++ b/node_modules/@humanwhocodes/module-importer/dist/module-importer.js @@ -0,0 +1,18 @@ +import { createRequire } from 'module'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; + +/** + * @fileoverview Universal module importer + */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const require = createRequire(__dirname + "/"); +const { ModuleImporter } = require("./module-importer.cjs"); + +export { ModuleImporter }; diff --git a/node_modules/@humanwhocodes/module-importer/package.json b/node_modules/@humanwhocodes/module-importer/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8ece071e94f384bb9750c8e2b0c3b683ad0053bb --- /dev/null +++ b/node_modules/@humanwhocodes/module-importer/package.json @@ -0,0 +1,65 @@ +{ + "name": "@humanwhocodes/module-importer", + "version": "1.0.1", + "description": "Universal module importer for Node.js", + "main": "src/module-importer.cjs", + "module": "src/module-importer.js", + "type": "module", + "types": "dist/module-importer.d.ts", + "exports": { + "require": "./src/module-importer.cjs", + "import": "./src/module-importer.js" + }, + "files": [ + "dist", + "src" + ], + "publishConfig": { + "access": "public" + }, + "gitHooks": { + "pre-commit": "lint-staged" + }, + "lint-staged": { + "*.js": [ + "eslint --fix" + ] + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + }, + "scripts": { + "build": "rollup -c && tsc", + "prepare": "npm run build", + "lint": "eslint src/ tests/", + "test:unit": "c8 mocha tests/module-importer.test.js", + "test:build": "node tests/pkg.test.cjs && node tests/pkg.test.mjs", + "test": "npm run test:unit && npm run test:build" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/humanwhocodes/module-importer.git" + }, + "keywords": [ + "modules", + "esm", + "commonjs" + ], + "engines": { + "node": ">=12.22" + }, + "author": "Nicholas C. Zaks", + "license": "Apache-2.0", + "devDependencies": { + "@types/node": "^18.7.6", + "c8": "7.12.0", + "chai": "4.3.6", + "eslint": "8.22.0", + "lint-staged": "13.0.3", + "mocha": "9.2.2", + "rollup": "2.78.0", + "typescript": "4.7.4", + "yorkie": "2.0.0" + } +} diff --git a/node_modules/@humanwhocodes/module-importer/src/module-importer.cjs b/node_modules/@humanwhocodes/module-importer/src/module-importer.cjs new file mode 100644 index 0000000000000000000000000000000000000000..3efb095e11af65a20a0a214c91ff574e1ff40ce8 --- /dev/null +++ b/node_modules/@humanwhocodes/module-importer/src/module-importer.cjs @@ -0,0 +1,81 @@ +/** + * @fileoverview Universal module importer + */ + +//----------------------------------------------------------------------------- +// Imports +//----------------------------------------------------------------------------- + +const { createRequire } = require("module"); +const { pathToFileURL } = require("url"); + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +const SLASHES = new Set(["/", "\\"]); + +/** + * Normalizes directories to have a trailing slash. + * Resolve is pretty finicky -- if the directory name doesn't have + * a trailing slash then it tries to look in the parent directory. + * i.e., if the directory is "/usr/nzakas/foo" it will start the + * search in /usr/nzakas. However, if the directory is "/user/nzakas/foo/", + * then it will start the search in /user/nzakas/foo. + * @param {string} directory The directory to check. + * @returns {string} The normalized directory. + */ +function normalizeDirectory(directory) { + if (!SLASHES.has(directory[directory.length-1])) { + return directory + "/"; + } + + return directory; +} + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * Class for importing both CommonJS and ESM modules in Node.js. + */ +exports.ModuleImporter = class ModuleImporter { + + /** + * Creates a new instance. + * @param {string} [cwd] The current working directory to resolve from. + */ + constructor(cwd = process.cwd()) { + + /** + * The base directory from which paths should be resolved. + * @type {string} + */ + this.cwd = normalizeDirectory(cwd); + } + + /** + * Resolves a module based on its name or location. + * @param {string} specifier Either an npm package name or + * relative file path. + * @returns {string|undefined} The location of the import. + * @throws {Error} If specifier cannot be located. + */ + resolve(specifier) { + const require = createRequire(this.cwd); + return require.resolve(specifier); + } + + /** + * Imports a module based on its name or location. + * @param {string} specifier Either an npm package name or + * relative file path. + * @returns {Promise} The module's object. + */ + import(specifier) { + const location = this.resolve(specifier); + return import(pathToFileURL(location).href); + } + +} diff --git a/node_modules/@humanwhocodes/module-importer/src/module-importer.js b/node_modules/@humanwhocodes/module-importer/src/module-importer.js new file mode 100644 index 0000000000000000000000000000000000000000..f5464e18deccb1c8fac5c13ef594e9f609129e50 --- /dev/null +++ b/node_modules/@humanwhocodes/module-importer/src/module-importer.js @@ -0,0 +1,22 @@ +/** + * @fileoverview Universal module importer + */ + +//----------------------------------------------------------------------------- +// Imports +//----------------------------------------------------------------------------- + +import { createRequire } from "module"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const require = createRequire(__dirname + "/"); +const { ModuleImporter } = require("./module-importer.cjs"); + +export { ModuleImporter }; diff --git a/node_modules/@humanwhocodes/retry/LICENSE b/node_modules/@humanwhocodes/retry/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64 --- /dev/null +++ b/node_modules/@humanwhocodes/retry/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/@humanwhocodes/retry/README.md b/node_modules/@humanwhocodes/retry/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0ec7a471d19c84cdc2dae982a992055f0f989ffb --- /dev/null +++ b/node_modules/@humanwhocodes/retry/README.md @@ -0,0 +1,177 @@ +# Retry utility + +by [Nicholas C. Zakas](https://humanwhocodes.com) + +If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star. + +## Description + +A utility for retrying failed async JavaScript calls based on the error returned. + +## Usage + +### Node.js + +Install using [npm][npm] or [yarn][yarn]: + +``` +npm install @humanwhocodes/retry + +# or + +yarn add @humanwhocodes/retry +``` + +Import into your Node.js project: + +```js +// CommonJS +const { Retrier } = require("@humanwhocodes/retry"); + +// ESM +import { Retrier } from "@humanwhocodes/retry"; +``` + +### Deno + +Install using [JSR](https://jsr.io): + +```shell +deno add @humanwhocodes/retry + +#or + +jsr add @humanwhocodes/retry +``` + +Then import into your Deno project: + +```js +import { Retrier } from "@humanwhocodes/retry"; +``` + +### Bun + +Install using this command: + +``` +bun add @humanwhocodes/retry +``` + +Import into your Bun project: + +```js +import { Retrier } from "@humanwhocodes/retry"; +``` + +### Browser + +It's recommended to import the minified version to save bandwidth: + +```js +import { Retrier } from "https://cdn.skypack.dev/@humanwhocodes/retry?min"; +``` + +However, you can also import the unminified version for debugging purposes: + +```js +import { Retrier } from "https://cdn.skypack.dev/@humanwhocodes/retry"; +``` + +## API + +After importing, create a new instance of `Retrier` and specify the function to run on the error. This function should return `true` if you want the call retried and `false` if not. + +```js +// this instance will retry if the specific error code is found +const retrier = new Retrier(error => { + return error.code === "ENFILE" || error.code === "EMFILE"; +}); +``` + +Then, call the `retry()` method around the function you'd like to retry, such as: + +```js +import fs from "fs/promises"; + +const retrier = new Retrier(error => { + return error.code === "ENFILE" || error.code === "EMFILE"; +}); + +const text = await retrier.retry(() => fs.readFile("README.md", "utf8")); +``` + +The `retry()` method will either pass through the result on success or wait and retry on failure. Any error that isn't caught by the retrier is automatically rejected so the end result is a transparent passing through of both success and failure. + +### Setting a Timeout + +You can control how long a task will attempt to retry before giving up by passing the `timeout` option to the `Retrier` constructor. By default, the timeout is one minute. + +```js +import fs from "fs/promises"; + +const retrier = new Retrier(error => { + return error.code === "ENFILE" || error.code === "EMFILE"; +}, { timeout: 100_000 }); + +const text = await retrier.retry(() => fs.readFile("README.md", "utf8")); +``` + +When a call times out, it rejects the first error that was received from calling the function. + +### Setting a Concurrency Limit + +When processing a large number of function calls, you can limit the number of concurrent function calls by passing the `concurrency` option to the `Retrier` constructor. By default, `concurrency` is 1000. + +```js +import fs from "fs/promises"; + +const retrier = new Retrier(error => { + return error.code === "ENFILE" || error.code === "EMFILE"; +}, { concurrency: 100 }); + +const filenames = getFilenames(); +const contents = await Promise.all( + filenames.map(filename => retrier.retry(() => fs.readFile(filename, "utf8")) +); +``` + +### Aborting with `AbortSignal` + +You can also pass an `AbortSignal` to cancel a retry: + +```js +import fs from "fs/promises"; + +const controller = new AbortController(); +const retrier = new Retrier(error => { + return error.code === "ENFILE" || error.code === "EMFILE"; +}); + +const text = await retrier.retry( + () => fs.readFile("README.md", "utf8"), + { signal: controller.signal } +); +``` + +## Developer Setup + +1. Fork the repository +2. Clone your fork +3. Run `npm install` to setup dependencies +4. Run `npm test` to run tests + +### Debug Output + +Enable debugging output by setting the `DEBUG` environment variable to `"@hwc/retry"` before running. + +## License + +Apache 2.0 + +## Prior Art + +This utility is inspired by, and contains code from [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). + +[npm]: https://npmjs.com/ +[yarn]: https://yarnpkg.com/ diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.cjs b/node_modules/@humanwhocodes/retry/dist/retrier.cjs new file mode 100644 index 0000000000000000000000000000000000000000..635e1e089dfc56b147e9ea978f3efd4b7f2b96e3 --- /dev/null +++ b/node_modules/@humanwhocodes/retry/dist/retrier.cjs @@ -0,0 +1,478 @@ +'use strict'; + +/** + * @fileoverview A utility for retrying failed async method calls. + */ + +/* global setTimeout, clearTimeout */ + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +const MAX_TASK_TIMEOUT = 60000; +const MAX_TASK_DELAY = 100; +const MAX_CONCURRENCY = 1000; + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/** + * Logs a message to the console if the DEBUG environment variable is set. + * @param {string} message The message to log. + * @returns {void} + */ +function debug(message) { + if (globalThis?.process?.env.DEBUG === "@hwc/retry") { + console.debug(message); + } +} + +/* + * The following logic has been extracted from graceful-fs. + * + * The ISC License + * + * Copyright (c) 2011-2023 Isaac Z. Schlueter, Ben Noordhuis, and Contributors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * Checks if it is time to retry a task based on the timestamp and last attempt time. + * @param {RetryTask} task The task to check. + * @param {number} maxDelay The maximum delay for the queue. + * @returns {boolean} true if it is time to retry, false otherwise. + */ +function isTimeToRetry(task, maxDelay) { + const timeSinceLastAttempt = Date.now() - task.lastAttempt; + const timeSinceStart = Math.max(task.lastAttempt - task.timestamp, 1); + const desiredDelay = Math.min(timeSinceStart * 1.2, maxDelay); + + return timeSinceLastAttempt >= desiredDelay; +} + +/** + * Checks if it is time to bail out based on the given timestamp. + * @param {RetryTask} task The task to check. + * @param {number} timeout The timeout for the queue. + * @returns {boolean} true if it is time to bail, false otherwise. + */ +function isTimeToBail(task, timeout) { + return task.age > timeout; +} + +/** + * Creates a new promise with resolve and reject functions. + * @returns {{promise:Promise, resolve:(value:any) => any, reject: (value:any) => any}} A new promise. + */ +function createPromise() { + if (Promise.withResolvers) { + return Promise.withResolvers(); + } + + let resolve, reject; + + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + + if (resolve === undefined || reject === undefined) { + throw new Error("Promise executor did not initialize resolve or reject."); + } + + return { promise, resolve, reject }; +} + + +/** + * A class to represent a task in the retry queue. + */ +class RetryTask { + + /** + * The unique ID for the task. + * @type {string} + */ + id = Math.random().toString(36).slice(2); + + /** + * The function to call. + * @type {Function} + */ + fn; + + /** + * The error that was thrown. + * @type {Error} + */ + error; + + /** + * The timestamp of the task. + * @type {number} + */ + timestamp = Date.now(); + + /** + * The timestamp of the last attempt. + * @type {number} + */ + lastAttempt = this.timestamp; + + /** + * The resolve function for the promise. + * @type {Function} + */ + resolve; + + /** + * The reject function for the promise. + * @type {Function} + */ + reject; + + /** + * The AbortSignal to monitor for cancellation. + * @type {AbortSignal|undefined} + */ + signal; + + /** + * Creates a new instance. + * @param {Function} fn The function to call. + * @param {Error} error The error that was thrown. + * @param {Function} resolve The resolve function for the promise. + * @param {Function} reject The reject function for the promise. + * @param {AbortSignal|undefined} signal The AbortSignal to monitor for cancellation. + */ + constructor(fn, error, resolve, reject, signal) { + this.fn = fn; + this.error = error; + this.timestamp = Date.now(); + this.lastAttempt = Date.now(); + this.resolve = resolve; + this.reject = reject; + this.signal = signal; + } + + /** + * Gets the age of the task. + * @returns {number} The age of the task in milliseconds. + * @readonly + */ + get age() { + return Date.now() - this.timestamp; + } +} + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * A class that manages a queue of retry jobs. + */ +class Retrier { + + /** + * Represents the queue for processing tasks. + * @type {Array} + */ + #retrying = []; + + /** + * Represents the queue for pending tasks. + * @type {Array} + */ + #pending = []; + + /** + * The number of tasks currently being processed. + * @type {number} + */ + #working = 0; + + /** + * The timeout for the queue. + * @type {number} + */ + #timeout; + + /** + * The maximum delay for the queue. + * @type {number} + */ + #maxDelay; + + /** + * The setTimeout() timer ID. + * @type {NodeJS.Timeout|undefined} + */ + #timerId; + + /** + * The function to call. + * @type {Function} + */ + #check; + + /** + * The maximum number of concurrent tasks. + * @type {number} + */ + #concurrency; + + /** + * Creates a new instance. + * @param {Function} check The function to call. + * @param {object} [options] The options for the instance. + * @param {number} [options.timeout] The timeout for the queue. + * @param {number} [options.maxDelay] The maximum delay for the queue. + * @param {number} [options.concurrency] The maximum number of concurrent tasks. + */ + constructor(check, { timeout = MAX_TASK_TIMEOUT, maxDelay = MAX_TASK_DELAY, concurrency = MAX_CONCURRENCY } = {}) { + + if (typeof check !== "function") { + throw new Error("Missing function to check errors"); + } + + this.#check = check; + this.#timeout = timeout; + this.#maxDelay = maxDelay; + this.#concurrency = concurrency; + } + + /** + * Gets the number of tasks waiting to be retried. + * @returns {number} The number of tasks in the retry queue. + */ + get retrying() { + return this.#retrying.length; + } + + /** + * Gets the number of tasks waiting to be processed in the pending queue. + * @returns {number} The number of tasks in the pending queue. + */ + get pending() { + return this.#pending.length; + } + + /** + * Gets the number of tasks currently being processed. + * @returns {number} The number of tasks currently being processed. + */ + get working() { + return this.#working; + } + + /** + * Calls the function and retries if it fails. + * @param {Function} fn The function to call. + * @param {Object} options The options for the job. + * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. + * @param {Promise} options.promise The promise to return when the function settles. + * @param {Function} options.resolve The resolve function for the promise. + * @param {Function} options.reject The reject function for the promise. + * @returns {Promise} A promise that resolves when the function is + * called successfully. + */ + #call(fn, { signal, promise, resolve, reject }) { + + let result; + + try { + result = fn(); + } catch (/** @type {any} */ error) { + reject(new Error(`Synchronous error: ${error.message}`, { cause: error })); + return promise; + } + + // if the result is not a promise then reject an error + if (!result || typeof result.then !== "function") { + reject(new Error("Result is not a promise.")); + return promise; + } + + this.#working++; + promise.finally(() => { + this.#working--; + this.#processPending(); + }) + // `promise.finally` creates a new promise that may be rejected, so it must be handled. + .catch(() => { }); + + // call the original function and catch any ENFILE or EMFILE errors + Promise.resolve(result) + .then(value => { + debug("Function called successfully without retry."); + resolve(value); + }) + .catch(error => { + if (!this.#check(error)) { + reject(error); + return; + } + + const task = new RetryTask(fn, error, resolve, reject, signal); + + debug(`Function failed, queuing for retry with task ${task.id}.`); + this.#retrying.push(task); + + signal?.addEventListener("abort", () => { + debug(`Task ${task.id} was aborted due to AbortSignal.`); + reject(signal.reason); + }); + + this.#processQueue(); + }); + + return promise; + } + + /** + * Adds a new retry job to the queue. + * @template {(...args: unknown[]) => Promise} Func + * @template {Awaited>} RetVal + * @param {Func} fn The function to call. + * @param {object} [options] The options for the job. + * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. + * @returns {Promise} A promise that resolves when the queue is processed. + */ + retry(fn, { signal } = {}) { + + signal?.throwIfAborted(); + + const { promise, resolve, reject } = createPromise(); + + this.#pending.push(() => this.#call(fn, { signal, promise, resolve, reject })); + this.#processPending(); + + return promise; + } + + + /** + * Processes the pending queue and the retry queue. + * @returns {void} + */ + #processAll() { + if (this.pending) { + this.#processPending(); + } + + if (this.retrying) { + this.#processQueue(); + } + } + + /** + * Processes the pending queue to see which tasks can be started. + * @returns {void} + */ + #processPending() { + + debug(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`); + + const available = this.#concurrency - this.working; + + if (available <= 0) { + return; + } + + const count = Math.min(this.pending, available); + + for (let i = 0; i < count; i++) { + const task = this.#pending.shift(); + task?.(); + } + + debug(`Processed pending tasks: ${this.pending} pending, ${this.working} working.`); + } + + /** + * Processes the queue. + * @returns {void} + */ + #processQueue() { + // clear any timer because we're going to check right now + clearTimeout(this.#timerId); + this.#timerId = undefined; + + debug(`Processing retry queue: ${this.retrying} retrying, ${this.working} working.`); + + const processAgain = () => { + this.#timerId = setTimeout(() => this.#processAll(), 0); + }; + + // if there's nothing in the queue, we're done + const task = this.#retrying.shift(); + if (!task) { + debug("Queue is empty, exiting."); + + if (this.pending) { + processAgain(); + } + return; + } + + // if it's time to bail, then bail + if (isTimeToBail(task, this.#timeout)) { + debug(`Task ${task.id} was abandoned due to timeout.`); + task.reject(task.error); + processAgain(); + return; + } + + // if it's not time to retry, then wait and try again + if (!isTimeToRetry(task, this.#maxDelay)) { + debug(`Task ${task.id} is not ready to retry, skipping.`); + this.#retrying.push(task); + processAgain(); + return; + } + + // otherwise, try again + task.lastAttempt = Date.now(); + + // Promise.resolve needed in case it's a thenable but not a Promise + Promise.resolve(task.fn()) + // @ts-ignore because we know it's any + .then(result => { + debug(`Task ${task.id} succeeded after ${task.age}ms.`); + task.resolve(result); + }) + + // @ts-ignore because we know it's any + .catch(error => { + if (!this.#check(error)) { + debug(`Task ${task.id} failed with non-retryable error: ${error.message}.`); + task.reject(error); + return; + } + + // update the task timestamp and push to back of queue to try again + task.lastAttempt = Date.now(); + this.#retrying.push(task); + debug(`Task ${task.id} failed, requeueing to try again.`); + }) + .finally(() => { + this.#processAll(); + }); + } +} + +exports.Retrier = Retrier; diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.d.cts b/node_modules/@humanwhocodes/retry/dist/retrier.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..2d3811efac30a6352f8e03d63089805136b9ef17 --- /dev/null +++ b/node_modules/@humanwhocodes/retry/dist/retrier.d.cts @@ -0,0 +1,46 @@ +/** + * A class that manages a queue of retry jobs. + */ +export class Retrier { + /** + * Creates a new instance. + * @param {Function} check The function to call. + * @param {object} [options] The options for the instance. + * @param {number} [options.timeout] The timeout for the queue. + * @param {number} [options.maxDelay] The maximum delay for the queue. + * @param {number} [options.concurrency] The maximum number of concurrent tasks. + */ + constructor(check: Function, { timeout, maxDelay, concurrency }?: { + timeout?: number | undefined; + maxDelay?: number | undefined; + concurrency?: number | undefined; + } | undefined); + /** + * Gets the number of tasks waiting to be retried. + * @returns {number} The number of tasks in the retry queue. + */ + get retrying(): number; + /** + * Gets the number of tasks waiting to be processed in the pending queue. + * @returns {number} The number of tasks in the pending queue. + */ + get pending(): number; + /** + * Gets the number of tasks currently being processed. + * @returns {number} The number of tasks currently being processed. + */ + get working(): number; + /** + * Adds a new retry job to the queue. + * @template {(...args: unknown[]) => Promise} Func + * @template {Awaited>} RetVal + * @param {Func} fn The function to call. + * @param {object} [options] The options for the job. + * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. + * @returns {Promise} A promise that resolves when the queue is processed. + */ + retry Promise, RetVal extends Awaited>>(fn: Func, { signal }?: { + signal?: AbortSignal | undefined; + } | undefined): Promise; + #private; +} diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.d.ts b/node_modules/@humanwhocodes/retry/dist/retrier.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2d3811efac30a6352f8e03d63089805136b9ef17 --- /dev/null +++ b/node_modules/@humanwhocodes/retry/dist/retrier.d.ts @@ -0,0 +1,46 @@ +/** + * A class that manages a queue of retry jobs. + */ +export class Retrier { + /** + * Creates a new instance. + * @param {Function} check The function to call. + * @param {object} [options] The options for the instance. + * @param {number} [options.timeout] The timeout for the queue. + * @param {number} [options.maxDelay] The maximum delay for the queue. + * @param {number} [options.concurrency] The maximum number of concurrent tasks. + */ + constructor(check: Function, { timeout, maxDelay, concurrency }?: { + timeout?: number | undefined; + maxDelay?: number | undefined; + concurrency?: number | undefined; + } | undefined); + /** + * Gets the number of tasks waiting to be retried. + * @returns {number} The number of tasks in the retry queue. + */ + get retrying(): number; + /** + * Gets the number of tasks waiting to be processed in the pending queue. + * @returns {number} The number of tasks in the pending queue. + */ + get pending(): number; + /** + * Gets the number of tasks currently being processed. + * @returns {number} The number of tasks currently being processed. + */ + get working(): number; + /** + * Adds a new retry job to the queue. + * @template {(...args: unknown[]) => Promise} Func + * @template {Awaited>} RetVal + * @param {Func} fn The function to call. + * @param {object} [options] The options for the job. + * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. + * @returns {Promise} A promise that resolves when the queue is processed. + */ + retry Promise, RetVal extends Awaited>>(fn: Func, { signal }?: { + signal?: AbortSignal | undefined; + } | undefined): Promise; + #private; +} diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.js b/node_modules/@humanwhocodes/retry/dist/retrier.js new file mode 100644 index 0000000000000000000000000000000000000000..29c9d3ea720d1cfd78a7f176d5ebec95017c966e --- /dev/null +++ b/node_modules/@humanwhocodes/retry/dist/retrier.js @@ -0,0 +1,477 @@ +// @ts-self-types="./retrier.d.ts" +/** + * @fileoverview A utility for retrying failed async method calls. + */ + +/* global setTimeout, clearTimeout */ + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +const MAX_TASK_TIMEOUT = 60000; +const MAX_TASK_DELAY = 100; +const MAX_CONCURRENCY = 1000; + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/** + * Logs a message to the console if the DEBUG environment variable is set. + * @param {string} message The message to log. + * @returns {void} + */ +function debug(message) { + if (globalThis?.process?.env.DEBUG === "@hwc/retry") { + console.debug(message); + } +} + +/* + * The following logic has been extracted from graceful-fs. + * + * The ISC License + * + * Copyright (c) 2011-2023 Isaac Z. Schlueter, Ben Noordhuis, and Contributors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * Checks if it is time to retry a task based on the timestamp and last attempt time. + * @param {RetryTask} task The task to check. + * @param {number} maxDelay The maximum delay for the queue. + * @returns {boolean} true if it is time to retry, false otherwise. + */ +function isTimeToRetry(task, maxDelay) { + const timeSinceLastAttempt = Date.now() - task.lastAttempt; + const timeSinceStart = Math.max(task.lastAttempt - task.timestamp, 1); + const desiredDelay = Math.min(timeSinceStart * 1.2, maxDelay); + + return timeSinceLastAttempt >= desiredDelay; +} + +/** + * Checks if it is time to bail out based on the given timestamp. + * @param {RetryTask} task The task to check. + * @param {number} timeout The timeout for the queue. + * @returns {boolean} true if it is time to bail, false otherwise. + */ +function isTimeToBail(task, timeout) { + return task.age > timeout; +} + +/** + * Creates a new promise with resolve and reject functions. + * @returns {{promise:Promise, resolve:(value:any) => any, reject: (value:any) => any}} A new promise. + */ +function createPromise() { + if (Promise.withResolvers) { + return Promise.withResolvers(); + } + + let resolve, reject; + + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + + if (resolve === undefined || reject === undefined) { + throw new Error("Promise executor did not initialize resolve or reject."); + } + + return { promise, resolve, reject }; +} + + +/** + * A class to represent a task in the retry queue. + */ +class RetryTask { + + /** + * The unique ID for the task. + * @type {string} + */ + id = Math.random().toString(36).slice(2); + + /** + * The function to call. + * @type {Function} + */ + fn; + + /** + * The error that was thrown. + * @type {Error} + */ + error; + + /** + * The timestamp of the task. + * @type {number} + */ + timestamp = Date.now(); + + /** + * The timestamp of the last attempt. + * @type {number} + */ + lastAttempt = this.timestamp; + + /** + * The resolve function for the promise. + * @type {Function} + */ + resolve; + + /** + * The reject function for the promise. + * @type {Function} + */ + reject; + + /** + * The AbortSignal to monitor for cancellation. + * @type {AbortSignal|undefined} + */ + signal; + + /** + * Creates a new instance. + * @param {Function} fn The function to call. + * @param {Error} error The error that was thrown. + * @param {Function} resolve The resolve function for the promise. + * @param {Function} reject The reject function for the promise. + * @param {AbortSignal|undefined} signal The AbortSignal to monitor for cancellation. + */ + constructor(fn, error, resolve, reject, signal) { + this.fn = fn; + this.error = error; + this.timestamp = Date.now(); + this.lastAttempt = Date.now(); + this.resolve = resolve; + this.reject = reject; + this.signal = signal; + } + + /** + * Gets the age of the task. + * @returns {number} The age of the task in milliseconds. + * @readonly + */ + get age() { + return Date.now() - this.timestamp; + } +} + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * A class that manages a queue of retry jobs. + */ +class Retrier { + + /** + * Represents the queue for processing tasks. + * @type {Array} + */ + #retrying = []; + + /** + * Represents the queue for pending tasks. + * @type {Array} + */ + #pending = []; + + /** + * The number of tasks currently being processed. + * @type {number} + */ + #working = 0; + + /** + * The timeout for the queue. + * @type {number} + */ + #timeout; + + /** + * The maximum delay for the queue. + * @type {number} + */ + #maxDelay; + + /** + * The setTimeout() timer ID. + * @type {NodeJS.Timeout|undefined} + */ + #timerId; + + /** + * The function to call. + * @type {Function} + */ + #check; + + /** + * The maximum number of concurrent tasks. + * @type {number} + */ + #concurrency; + + /** + * Creates a new instance. + * @param {Function} check The function to call. + * @param {object} [options] The options for the instance. + * @param {number} [options.timeout] The timeout for the queue. + * @param {number} [options.maxDelay] The maximum delay for the queue. + * @param {number} [options.concurrency] The maximum number of concurrent tasks. + */ + constructor(check, { timeout = MAX_TASK_TIMEOUT, maxDelay = MAX_TASK_DELAY, concurrency = MAX_CONCURRENCY } = {}) { + + if (typeof check !== "function") { + throw new Error("Missing function to check errors"); + } + + this.#check = check; + this.#timeout = timeout; + this.#maxDelay = maxDelay; + this.#concurrency = concurrency; + } + + /** + * Gets the number of tasks waiting to be retried. + * @returns {number} The number of tasks in the retry queue. + */ + get retrying() { + return this.#retrying.length; + } + + /** + * Gets the number of tasks waiting to be processed in the pending queue. + * @returns {number} The number of tasks in the pending queue. + */ + get pending() { + return this.#pending.length; + } + + /** + * Gets the number of tasks currently being processed. + * @returns {number} The number of tasks currently being processed. + */ + get working() { + return this.#working; + } + + /** + * Calls the function and retries if it fails. + * @param {Function} fn The function to call. + * @param {Object} options The options for the job. + * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. + * @param {Promise} options.promise The promise to return when the function settles. + * @param {Function} options.resolve The resolve function for the promise. + * @param {Function} options.reject The reject function for the promise. + * @returns {Promise} A promise that resolves when the function is + * called successfully. + */ + #call(fn, { signal, promise, resolve, reject }) { + + let result; + + try { + result = fn(); + } catch (/** @type {any} */ error) { + reject(new Error(`Synchronous error: ${error.message}`, { cause: error })); + return promise; + } + + // if the result is not a promise then reject an error + if (!result || typeof result.then !== "function") { + reject(new Error("Result is not a promise.")); + return promise; + } + + this.#working++; + promise.finally(() => { + this.#working--; + this.#processPending(); + }) + // `promise.finally` creates a new promise that may be rejected, so it must be handled. + .catch(() => { }); + + // call the original function and catch any ENFILE or EMFILE errors + Promise.resolve(result) + .then(value => { + debug("Function called successfully without retry."); + resolve(value); + }) + .catch(error => { + if (!this.#check(error)) { + reject(error); + return; + } + + const task = new RetryTask(fn, error, resolve, reject, signal); + + debug(`Function failed, queuing for retry with task ${task.id}.`); + this.#retrying.push(task); + + signal?.addEventListener("abort", () => { + debug(`Task ${task.id} was aborted due to AbortSignal.`); + reject(signal.reason); + }); + + this.#processQueue(); + }); + + return promise; + } + + /** + * Adds a new retry job to the queue. + * @template {(...args: unknown[]) => Promise} Func + * @template {Awaited>} RetVal + * @param {Func} fn The function to call. + * @param {object} [options] The options for the job. + * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. + * @returns {Promise} A promise that resolves when the queue is processed. + */ + retry(fn, { signal } = {}) { + + signal?.throwIfAborted(); + + const { promise, resolve, reject } = createPromise(); + + this.#pending.push(() => this.#call(fn, { signal, promise, resolve, reject })); + this.#processPending(); + + return promise; + } + + + /** + * Processes the pending queue and the retry queue. + * @returns {void} + */ + #processAll() { + if (this.pending) { + this.#processPending(); + } + + if (this.retrying) { + this.#processQueue(); + } + } + + /** + * Processes the pending queue to see which tasks can be started. + * @returns {void} + */ + #processPending() { + + debug(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`); + + const available = this.#concurrency - this.working; + + if (available <= 0) { + return; + } + + const count = Math.min(this.pending, available); + + for (let i = 0; i < count; i++) { + const task = this.#pending.shift(); + task?.(); + } + + debug(`Processed pending tasks: ${this.pending} pending, ${this.working} working.`); + } + + /** + * Processes the queue. + * @returns {void} + */ + #processQueue() { + // clear any timer because we're going to check right now + clearTimeout(this.#timerId); + this.#timerId = undefined; + + debug(`Processing retry queue: ${this.retrying} retrying, ${this.working} working.`); + + const processAgain = () => { + this.#timerId = setTimeout(() => this.#processAll(), 0); + }; + + // if there's nothing in the queue, we're done + const task = this.#retrying.shift(); + if (!task) { + debug("Queue is empty, exiting."); + + if (this.pending) { + processAgain(); + } + return; + } + + // if it's time to bail, then bail + if (isTimeToBail(task, this.#timeout)) { + debug(`Task ${task.id} was abandoned due to timeout.`); + task.reject(task.error); + processAgain(); + return; + } + + // if it's not time to retry, then wait and try again + if (!isTimeToRetry(task, this.#maxDelay)) { + debug(`Task ${task.id} is not ready to retry, skipping.`); + this.#retrying.push(task); + processAgain(); + return; + } + + // otherwise, try again + task.lastAttempt = Date.now(); + + // Promise.resolve needed in case it's a thenable but not a Promise + Promise.resolve(task.fn()) + // @ts-ignore because we know it's any + .then(result => { + debug(`Task ${task.id} succeeded after ${task.age}ms.`); + task.resolve(result); + }) + + // @ts-ignore because we know it's any + .catch(error => { + if (!this.#check(error)) { + debug(`Task ${task.id} failed with non-retryable error: ${error.message}.`); + task.reject(error); + return; + } + + // update the task timestamp and push to back of queue to try again + task.lastAttempt = Date.now(); + this.#retrying.push(task); + debug(`Task ${task.id} failed, requeueing to try again.`); + }) + .finally(() => { + this.#processAll(); + }); + } +} + +export { Retrier }; diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.min.js b/node_modules/@humanwhocodes/retry/dist/retrier.min.js new file mode 100644 index 0000000000000000000000000000000000000000..376092651fcfa71d059da4e43f63304ac4cd6df3 --- /dev/null +++ b/node_modules/@humanwhocodes/retry/dist/retrier.min.js @@ -0,0 +1 @@ +function e(e){"@hwc/retry"===globalThis?.process?.env.DEBUG&&console.debug(e)}class RetryTask{id=Math.random().toString(36).slice(2);fn;error;timestamp=Date.now();lastAttempt=this.timestamp;resolve;reject;signal;constructor(e,t,r,i,s){this.fn=e,this.error=t,this.timestamp=Date.now(),this.lastAttempt=Date.now(),this.resolve=r,this.reject=i,this.signal=s}get age(){return Date.now()-this.timestamp}}class Retrier{#e=[];#t=[];#r=0;#i;#s;#n;#o;#c;constructor(e,{timeout:t=6e4,maxDelay:r=100,concurrency:i=1e3}={}){if("function"!=typeof e)throw new Error("Missing function to check errors");this.#o=e,this.#i=t,this.#s=r,this.#c=i}get retrying(){return this.#e.length}get pending(){return this.#t.length}get working(){return this.#r}#a(t,{signal:r,promise:i,resolve:s,reject:n}){let o;try{o=t()}catch(e){return n(new Error(`Synchronous error: ${e.message}`,{cause:e})),i}return o&&"function"==typeof o.then?(this.#r++,i.finally((()=>{this.#r--,this.#h()})).catch((()=>{})),Promise.resolve(o).then((t=>{e("Function called successfully without retry."),s(t)})).catch((i=>{if(!this.#o(i))return void n(i);const o=new RetryTask(t,i,s,n,r);e(`Function failed, queuing for retry with task ${o.id}.`),this.#e.push(o),r?.addEventListener("abort",(()=>{e(`Task ${o.id} was aborted due to AbortSignal.`),n(r.reason)})),this.#g()})),i):(n(new Error("Result is not a promise.")),i)}retry(e,{signal:t}={}){t?.throwIfAborted();const{promise:r,resolve:i,reject:s}=function(){if(Promise.withResolvers)return Promise.withResolvers();let e,t;const r=new Promise(((r,i)=>{e=r,t=i}));if(void 0===e||void 0===t)throw new Error("Promise executor did not initialize resolve or reject.");return{promise:r,resolve:e,reject:t}}();return this.#t.push((()=>this.#a(e,{signal:t,promise:r,resolve:i,reject:s}))),this.#h(),r}#u(){this.pending&&this.#h(),this.retrying&&this.#g()}#h(){e(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`);const t=this.#c-this.working;if(t<=0)return;const r=Math.min(this.pending,t);for(let e=0;e{this.#n=setTimeout((()=>this.#u()),0)},r=this.#e.shift();return r?function(e,t){return e.age>t}(r,this.#i)?(e(`Task ${r.id} was abandoned due to timeout.`),r.reject(r.error),void t()):function(e,t){const r=Date.now()-e.lastAttempt,i=Math.max(e.lastAttempt-e.timestamp,1);return r>=Math.min(1.2*i,t)}(r,this.#s)?(r.lastAttempt=Date.now(),void Promise.resolve(r.fn()).then((t=>{e(`Task ${r.id} succeeded after ${r.age}ms.`),r.resolve(t)})).catch((t=>{if(!this.#o(t))return e(`Task ${r.id} failed with non-retryable error: ${t.message}.`),void r.reject(t);r.lastAttempt=Date.now(),this.#e.push(r),e(`Task ${r.id} failed, requeueing to try again.`)})).finally((()=>{this.#u()}))):(e(`Task ${r.id} is not ready to retry, skipping.`),this.#e.push(r),void t()):(e("Queue is empty, exiting."),void(this.pending&&t()))}}export{Retrier}; diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.mjs b/node_modules/@humanwhocodes/retry/dist/retrier.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a05cd0d17673a167404240f43da9223652d1851f --- /dev/null +++ b/node_modules/@humanwhocodes/retry/dist/retrier.mjs @@ -0,0 +1,476 @@ +/** + * @fileoverview A utility for retrying failed async method calls. + */ + +/* global setTimeout, clearTimeout */ + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +const MAX_TASK_TIMEOUT = 60000; +const MAX_TASK_DELAY = 100; +const MAX_CONCURRENCY = 1000; + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/** + * Logs a message to the console if the DEBUG environment variable is set. + * @param {string} message The message to log. + * @returns {void} + */ +function debug(message) { + if (globalThis?.process?.env.DEBUG === "@hwc/retry") { + console.debug(message); + } +} + +/* + * The following logic has been extracted from graceful-fs. + * + * The ISC License + * + * Copyright (c) 2011-2023 Isaac Z. Schlueter, Ben Noordhuis, and Contributors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * Checks if it is time to retry a task based on the timestamp and last attempt time. + * @param {RetryTask} task The task to check. + * @param {number} maxDelay The maximum delay for the queue. + * @returns {boolean} true if it is time to retry, false otherwise. + */ +function isTimeToRetry(task, maxDelay) { + const timeSinceLastAttempt = Date.now() - task.lastAttempt; + const timeSinceStart = Math.max(task.lastAttempt - task.timestamp, 1); + const desiredDelay = Math.min(timeSinceStart * 1.2, maxDelay); + + return timeSinceLastAttempt >= desiredDelay; +} + +/** + * Checks if it is time to bail out based on the given timestamp. + * @param {RetryTask} task The task to check. + * @param {number} timeout The timeout for the queue. + * @returns {boolean} true if it is time to bail, false otherwise. + */ +function isTimeToBail(task, timeout) { + return task.age > timeout; +} + +/** + * Creates a new promise with resolve and reject functions. + * @returns {{promise:Promise, resolve:(value:any) => any, reject: (value:any) => any}} A new promise. + */ +function createPromise() { + if (Promise.withResolvers) { + return Promise.withResolvers(); + } + + let resolve, reject; + + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + + if (resolve === undefined || reject === undefined) { + throw new Error("Promise executor did not initialize resolve or reject."); + } + + return { promise, resolve, reject }; +} + + +/** + * A class to represent a task in the retry queue. + */ +class RetryTask { + + /** + * The unique ID for the task. + * @type {string} + */ + id = Math.random().toString(36).slice(2); + + /** + * The function to call. + * @type {Function} + */ + fn; + + /** + * The error that was thrown. + * @type {Error} + */ + error; + + /** + * The timestamp of the task. + * @type {number} + */ + timestamp = Date.now(); + + /** + * The timestamp of the last attempt. + * @type {number} + */ + lastAttempt = this.timestamp; + + /** + * The resolve function for the promise. + * @type {Function} + */ + resolve; + + /** + * The reject function for the promise. + * @type {Function} + */ + reject; + + /** + * The AbortSignal to monitor for cancellation. + * @type {AbortSignal|undefined} + */ + signal; + + /** + * Creates a new instance. + * @param {Function} fn The function to call. + * @param {Error} error The error that was thrown. + * @param {Function} resolve The resolve function for the promise. + * @param {Function} reject The reject function for the promise. + * @param {AbortSignal|undefined} signal The AbortSignal to monitor for cancellation. + */ + constructor(fn, error, resolve, reject, signal) { + this.fn = fn; + this.error = error; + this.timestamp = Date.now(); + this.lastAttempt = Date.now(); + this.resolve = resolve; + this.reject = reject; + this.signal = signal; + } + + /** + * Gets the age of the task. + * @returns {number} The age of the task in milliseconds. + * @readonly + */ + get age() { + return Date.now() - this.timestamp; + } +} + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * A class that manages a queue of retry jobs. + */ +class Retrier { + + /** + * Represents the queue for processing tasks. + * @type {Array} + */ + #retrying = []; + + /** + * Represents the queue for pending tasks. + * @type {Array} + */ + #pending = []; + + /** + * The number of tasks currently being processed. + * @type {number} + */ + #working = 0; + + /** + * The timeout for the queue. + * @type {number} + */ + #timeout; + + /** + * The maximum delay for the queue. + * @type {number} + */ + #maxDelay; + + /** + * The setTimeout() timer ID. + * @type {NodeJS.Timeout|undefined} + */ + #timerId; + + /** + * The function to call. + * @type {Function} + */ + #check; + + /** + * The maximum number of concurrent tasks. + * @type {number} + */ + #concurrency; + + /** + * Creates a new instance. + * @param {Function} check The function to call. + * @param {object} [options] The options for the instance. + * @param {number} [options.timeout] The timeout for the queue. + * @param {number} [options.maxDelay] The maximum delay for the queue. + * @param {number} [options.concurrency] The maximum number of concurrent tasks. + */ + constructor(check, { timeout = MAX_TASK_TIMEOUT, maxDelay = MAX_TASK_DELAY, concurrency = MAX_CONCURRENCY } = {}) { + + if (typeof check !== "function") { + throw new Error("Missing function to check errors"); + } + + this.#check = check; + this.#timeout = timeout; + this.#maxDelay = maxDelay; + this.#concurrency = concurrency; + } + + /** + * Gets the number of tasks waiting to be retried. + * @returns {number} The number of tasks in the retry queue. + */ + get retrying() { + return this.#retrying.length; + } + + /** + * Gets the number of tasks waiting to be processed in the pending queue. + * @returns {number} The number of tasks in the pending queue. + */ + get pending() { + return this.#pending.length; + } + + /** + * Gets the number of tasks currently being processed. + * @returns {number} The number of tasks currently being processed. + */ + get working() { + return this.#working; + } + + /** + * Calls the function and retries if it fails. + * @param {Function} fn The function to call. + * @param {Object} options The options for the job. + * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. + * @param {Promise} options.promise The promise to return when the function settles. + * @param {Function} options.resolve The resolve function for the promise. + * @param {Function} options.reject The reject function for the promise. + * @returns {Promise} A promise that resolves when the function is + * called successfully. + */ + #call(fn, { signal, promise, resolve, reject }) { + + let result; + + try { + result = fn(); + } catch (/** @type {any} */ error) { + reject(new Error(`Synchronous error: ${error.message}`, { cause: error })); + return promise; + } + + // if the result is not a promise then reject an error + if (!result || typeof result.then !== "function") { + reject(new Error("Result is not a promise.")); + return promise; + } + + this.#working++; + promise.finally(() => { + this.#working--; + this.#processPending(); + }) + // `promise.finally` creates a new promise that may be rejected, so it must be handled. + .catch(() => { }); + + // call the original function and catch any ENFILE or EMFILE errors + Promise.resolve(result) + .then(value => { + debug("Function called successfully without retry."); + resolve(value); + }) + .catch(error => { + if (!this.#check(error)) { + reject(error); + return; + } + + const task = new RetryTask(fn, error, resolve, reject, signal); + + debug(`Function failed, queuing for retry with task ${task.id}.`); + this.#retrying.push(task); + + signal?.addEventListener("abort", () => { + debug(`Task ${task.id} was aborted due to AbortSignal.`); + reject(signal.reason); + }); + + this.#processQueue(); + }); + + return promise; + } + + /** + * Adds a new retry job to the queue. + * @template {(...args: unknown[]) => Promise} Func + * @template {Awaited>} RetVal + * @param {Func} fn The function to call. + * @param {object} [options] The options for the job. + * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. + * @returns {Promise} A promise that resolves when the queue is processed. + */ + retry(fn, { signal } = {}) { + + signal?.throwIfAborted(); + + const { promise, resolve, reject } = createPromise(); + + this.#pending.push(() => this.#call(fn, { signal, promise, resolve, reject })); + this.#processPending(); + + return promise; + } + + + /** + * Processes the pending queue and the retry queue. + * @returns {void} + */ + #processAll() { + if (this.pending) { + this.#processPending(); + } + + if (this.retrying) { + this.#processQueue(); + } + } + + /** + * Processes the pending queue to see which tasks can be started. + * @returns {void} + */ + #processPending() { + + debug(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`); + + const available = this.#concurrency - this.working; + + if (available <= 0) { + return; + } + + const count = Math.min(this.pending, available); + + for (let i = 0; i < count; i++) { + const task = this.#pending.shift(); + task?.(); + } + + debug(`Processed pending tasks: ${this.pending} pending, ${this.working} working.`); + } + + /** + * Processes the queue. + * @returns {void} + */ + #processQueue() { + // clear any timer because we're going to check right now + clearTimeout(this.#timerId); + this.#timerId = undefined; + + debug(`Processing retry queue: ${this.retrying} retrying, ${this.working} working.`); + + const processAgain = () => { + this.#timerId = setTimeout(() => this.#processAll(), 0); + }; + + // if there's nothing in the queue, we're done + const task = this.#retrying.shift(); + if (!task) { + debug("Queue is empty, exiting."); + + if (this.pending) { + processAgain(); + } + return; + } + + // if it's time to bail, then bail + if (isTimeToBail(task, this.#timeout)) { + debug(`Task ${task.id} was abandoned due to timeout.`); + task.reject(task.error); + processAgain(); + return; + } + + // if it's not time to retry, then wait and try again + if (!isTimeToRetry(task, this.#maxDelay)) { + debug(`Task ${task.id} is not ready to retry, skipping.`); + this.#retrying.push(task); + processAgain(); + return; + } + + // otherwise, try again + task.lastAttempt = Date.now(); + + // Promise.resolve needed in case it's a thenable but not a Promise + Promise.resolve(task.fn()) + // @ts-ignore because we know it's any + .then(result => { + debug(`Task ${task.id} succeeded after ${task.age}ms.`); + task.resolve(result); + }) + + // @ts-ignore because we know it's any + .catch(error => { + if (!this.#check(error)) { + debug(`Task ${task.id} failed with non-retryable error: ${error.message}.`); + task.reject(error); + return; + } + + // update the task timestamp and push to back of queue to try again + task.lastAttempt = Date.now(); + this.#retrying.push(task); + debug(`Task ${task.id} failed, requeueing to try again.`); + }) + .finally(() => { + this.#processAll(); + }); + } +} + +export { Retrier }; diff --git a/node_modules/@humanwhocodes/retry/package.json b/node_modules/@humanwhocodes/retry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..df8e94376ff3e5e7438e6413cf7866cc9e06fe96 --- /dev/null +++ b/node_modules/@humanwhocodes/retry/package.json @@ -0,0 +1,77 @@ +{ + "name": "@humanwhocodes/retry", + "version": "0.4.3", + "description": "A utility to retry failed async methods.", + "type": "module", + "main": "dist/retrier.cjs", + "module": "dist/retrier.js", + "types": "dist/retrier.d.ts", + "exports": { + "require": { + "types": "./dist/retrier.d.cts", + "default": "./dist/retrier.cjs" + }, + "import": { + "types": "./dist/retrier.d.ts", + "default": "./dist/retrier.js" + } + }, + "files": [ + "dist" + ], + "engines": { + "node": ">=18.18" + }, + "publishConfig": { + "access": "public" + }, + "gitHooks": { + "pre-commit": "lint-staged" + }, + "lint-staged": { + "*.js": [ + "eslint --fix" + ] + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + }, + "scripts": { + "build:cts-types": "node -e \"fs.copyFileSync('dist/retrier.d.ts', 'dist/retrier.d.cts')\"", + "build": "rollup -c && tsc && npm run build:cts-types", + "prepare": "npm run build", + "lint": "eslint src/ tests/", + "pretest": "npm run build", + "test:unit": "mocha tests/retrier.test.js", + "test:build": "node tests/pkg.test.cjs && node tests/pkg.test.mjs", + "test:jsr": "npx jsr@latest publish --dry-run", + "test:emfile": "node tools/check-emfile-handling.js", + "test": "npm run test:unit && npm run test:build" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/humanwhocodes/retry.git" + }, + "keywords": [ + "nodejs", + "retry", + "async", + "promises" + ], + "author": "Nicholas C. Zaks", + "license": "Apache-2.0", + "devDependencies": { + "@eslint/js": "^8.49.0", + "@rollup/plugin-terser": "0.4.4", + "@tsconfig/node16": "^16.1.1", + "@types/mocha": "^10.0.3", + "@types/node": "20.12.6", + "eslint": "^8.21.0", + "lint-staged": "15.2.1", + "mocha": "^10.3.0", + "rollup": "3.29.4", + "typescript": "5.4.4", + "yorkie": "2.0.0" + } +} diff --git a/node_modules/@inquirer/ansi/LICENSE b/node_modules/@inquirer/ansi/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..f7186988726152b8dfb1bbafe940a712da142e3e --- /dev/null +++ b/node_modules/@inquirer/ansi/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2025 Simon Boudrias + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@inquirer/ansi/README.md b/node_modules/@inquirer/ansi/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ba2e26686e3205b57a80a7027b271f6106b4aa13 --- /dev/null +++ b/node_modules/@inquirer/ansi/README.md @@ -0,0 +1,89 @@ +# @inquirer/ansi + +A lightweight package providing ANSI escape sequences for terminal cursor manipulation and screen clearing. + +# Installation + + + + + + + + + + +
npmyarn
+ +```sh +npm install @inquirer/ansi +``` + + + +```sh +yarn add @inquirer/ansi +``` + +
+ +## Usage + +```js +import { + cursorUp, + cursorDown, + cursorTo, + cursorLeft, + cursorHide, + cursorShow, + eraseLines, +} from '@inquirer/ansi'; + +// Move cursor up 3 lines +process.stdout.write(cursorUp(3)); + +// Move cursor to specific position (x: 10, y: 5) +process.stdout.write(cursorTo(10, 5)); + +// Hide/show cursor +process.stdout.write(cursorHide); +process.stdout.write(cursorShow); + +// Clear 5 lines +process.stdout.write(eraseLines(5)); +``` + +Or when used inside an inquirer prompt: + +```js +import { cursorHide } from '@inquirer/ansi'; +import { createPrompt } from '@inquirer/core'; + +export default createPrompt((config, done: (value: void) => void) => { + return `Choose an option${cursorHide}`; +}); +``` + +## API + +### Cursor Movement + +- **`cursorUp(count?: number)`** - Move cursor up by `count` lines (default: 1) +- **`cursorDown(count?: number)`** - Move cursor down by `count` lines (default: 1) +- **`cursorTo(x: number, y?: number)`** - Move cursor to position (x, y). If y is omitted, only moves horizontally +- **`cursorLeft`** - Move cursor to beginning of line + +### Cursor Visibility + +- **`cursorHide`** - Hide the cursor +- **`cursorShow`** - Show the cursor + +### Screen Manipulation + +- **`eraseLines(count: number)`** - Clear `count` lines and position cursor at the beginning of the first cleared line + +# License + +Copyright (c) 2025 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))
+Licensed under the MIT license. diff --git a/node_modules/@inquirer/ansi/dist/index.d.ts b/node_modules/@inquirer/ansi/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f607ad6b67289ed7bb92a882b36c9fecc808ab6c --- /dev/null +++ b/node_modules/@inquirer/ansi/dist/index.d.ts @@ -0,0 +1,14 @@ +/** Move cursor to first column */ +export declare const cursorLeft: string; +/** Hide the cursor */ +export declare const cursorHide: string; +/** Show the cursor */ +export declare const cursorShow: string; +/** Move cursor up by count rows */ +export declare const cursorUp: (rows?: number) => string; +/** Move cursor down by count rows */ +export declare const cursorDown: (rows?: number) => string; +/** Move cursor to position (x, y) */ +export declare const cursorTo: (x: number, y?: number) => string; +/** Erase the specified number of lines above the cursor */ +export declare const eraseLines: (lines: number) => string; diff --git a/node_modules/@inquirer/ansi/dist/index.js b/node_modules/@inquirer/ansi/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2e69a44e554d242669130157d71a1175b6ff38b9 --- /dev/null +++ b/node_modules/@inquirer/ansi/dist/index.js @@ -0,0 +1,21 @@ +const ESC = '\u001B['; +/** Move cursor to first column */ +export const cursorLeft = ESC + 'G'; +/** Hide the cursor */ +export const cursorHide = ESC + '?25l'; +/** Show the cursor */ +export const cursorShow = ESC + '?25h'; +/** Move cursor up by count rows */ +export const cursorUp = (rows = 1) => (rows > 0 ? `${ESC}${rows}A` : ''); +/** Move cursor down by count rows */ +export const cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : ''; +/** Move cursor to position (x, y) */ +export const cursorTo = (x, y) => { + if (typeof y === 'number' && !Number.isNaN(y)) { + return `${ESC}${y + 1};${x + 1}H`; + } + return `${ESC}${x + 1}G`; +}; +const eraseLine = ESC + '2K'; +/** Erase the specified number of lines above the cursor */ +export const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : ''; diff --git a/node_modules/@inquirer/ansi/package.json b/node_modules/@inquirer/ansi/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6f45f63d602eac720b6af5357392258ef7eca0a7 --- /dev/null +++ b/node_modules/@inquirer/ansi/package.json @@ -0,0 +1,78 @@ +{ + "name": "@inquirer/ansi", + "version": "2.0.7", + "keywords": [ + "ansi", + "answer", + "answers", + "ask", + "base", + "cli", + "command", + "command-line", + "confirm", + "enquirer", + "generate", + "generator", + "hyper", + "input", + "inquire", + "inquirer", + "interface", + "iterm", + "javascript", + "menu", + "node", + "nodejs", + "prompt", + "promptly", + "prompts", + "question", + "readline", + "scaffold", + "scaffolder", + "scaffolding", + "stdin", + "stdout", + "terminal", + "tty", + "ui", + "yeoman", + "yo", + "zsh" + ], + "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/ansi/README.md", + "license": "MIT", + "author": "Simon Boudrias ", + "repository": { + "type": "git", + "url": "https://github.com/SBoudrias/Inquirer.js.git" + }, + "files": [ + "dist" + ], + "type": "module", + "sideEffects": false, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "tsc": "tsc" + }, + "devDependencies": { + "typescript": "^6.0.2" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "gitHead": "b43359d803733b1a7c4638addcc270987fb894c3" +} diff --git a/node_modules/@inquirer/confirm/LICENSE b/node_modules/@inquirer/confirm/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..f7186988726152b8dfb1bbafe940a712da142e3e --- /dev/null +++ b/node_modules/@inquirer/confirm/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2025 Simon Boudrias + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@inquirer/confirm/README.md b/node_modules/@inquirer/confirm/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fe2e5f0234b72858028466604308d66d573187c0 --- /dev/null +++ b/node_modules/@inquirer/confirm/README.md @@ -0,0 +1,92 @@ +# `@inquirer/confirm` + +Simple interactive command line prompt to gather boolean input from users. + +![Confirm prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/confirm.svg) + +# Installation + + + + + + + + + + + + + + + + + +
npmyarn
+ +```sh +npm install @inquirer/prompts +``` + + + +```sh +yarn add @inquirer/prompts +``` + +
Or
+ +```sh +npm install @inquirer/confirm +``` + + + +```sh +yarn add @inquirer/confirm +``` + +
+ +# Usage + +```js +import { confirm } from '@inquirer/prompts'; +// Or +// import confirm from '@inquirer/confirm'; + +const answer = await confirm({ message: 'Continue?' }); +``` + +## Options + +| Property | Type | Required | Description | +| ----------- | ----------------------- | -------- | ------------------------------------------------------- | +| message | `string` | yes | The question to ask | +| default | `boolean` | no | Default answer (true or false) | +| transformer | `(boolean) => string` | no | Transform the prompt printed message to a custom string | +| theme | [See Theming](#Theming) | no | Customize look of the prompt. | + +## Theming + +You can theme a prompt by passing a `theme` object option. The theme object only need to includes the keys you wish to modify, we'll fallback on the defaults for the rest. + +```ts +type Theme = { + prefix: string | { idle: string; done: string }; + spinner: { + interval: number; + frames: string[]; + }; + style: { + answer: (text: string) => string; + message: (text: string, status: 'idle' | 'done' | 'loading') => string; + defaultAnswer: (text: string) => string; + }; +}; +``` + +# License + +Copyright (c) 2023 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))
+Licensed under the MIT license. diff --git a/node_modules/@inquirer/confirm/dist/index.d.ts b/node_modules/@inquirer/confirm/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d3d323add1e962e96e7547ceaae4d3208ef92360 --- /dev/null +++ b/node_modules/@inquirer/confirm/dist/index.d.ts @@ -0,0 +1,10 @@ +import { type Theme } from '@inquirer/core'; +import type { PartialDeep } from '@inquirer/type'; +type ConfirmConfig = { + message: string; + default?: boolean; + transformer?: (value: boolean) => string; + theme?: PartialDeep; +}; +declare const _default: import("@inquirer/type").Prompt; +export default _default; diff --git a/node_modules/@inquirer/confirm/dist/index.js b/node_modules/@inquirer/confirm/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..44f3a5ffc6c487a2675e3aec6f144b4ec66cb2cd --- /dev/null +++ b/node_modules/@inquirer/confirm/dist/index.js @@ -0,0 +1,48 @@ +import { createPrompt, useState, useKeypress, isEnterKey, isTabKey, usePrefix, makeTheme, } from '@inquirer/core'; +function getBooleanValue(value, defaultValue) { + let answer = defaultValue !== false; + if (/^(y|yes)/i.test(value)) + answer = true; + else if (/^(n|no)/i.test(value)) + answer = false; + return answer; +} +function boolToString(value) { + return value ? 'Yes' : 'No'; +} +export default createPrompt((config, done) => { + const { transformer = boolToString } = config; + const [status, setStatus] = useState('idle'); + const [value, setValue] = useState(''); + const theme = makeTheme(config.theme); + const prefix = usePrefix({ status, theme }); + useKeypress((key, rl) => { + if (status !== 'idle') + return; + if (isEnterKey(key)) { + const answer = getBooleanValue(value, config.default); + setValue(transformer(answer)); + setStatus('done'); + done(answer); + } + else if (isTabKey(key)) { + const answer = boolToString(!getBooleanValue(value, config.default)); + rl.clearLine(0); // Remove the tab character. + rl.write(answer); + setValue(answer); + } + else { + setValue(rl.line); + } + }); + let formattedValue = value; + let defaultValue = ''; + if (status === 'done') { + formattedValue = theme.style.answer(value); + } + else { + defaultValue = ` ${theme.style.defaultAnswer(config.default === false ? 'y/N' : 'Y/n')}`; + } + const message = theme.style.message(config.message, status); + return `${prefix} ${message}${defaultValue} ${formattedValue}`; +}); diff --git a/node_modules/@inquirer/confirm/package.json b/node_modules/@inquirer/confirm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..de9fa2a862fdfe36aecac6be6694a40a2724d0e1 --- /dev/null +++ b/node_modules/@inquirer/confirm/package.json @@ -0,0 +1,90 @@ +{ + "name": "@inquirer/confirm", + "version": "6.1.1", + "description": "Inquirer confirm prompt", + "keywords": [ + "answer", + "answers", + "ask", + "base", + "cli", + "command", + "command-line", + "confirm", + "enquirer", + "generate", + "generator", + "hyper", + "input", + "inquire", + "inquirer", + "interface", + "iterm", + "javascript", + "menu", + "node", + "nodejs", + "prompt", + "promptly", + "prompts", + "question", + "readline", + "scaffold", + "scaffolder", + "scaffolding", + "stdin", + "stdout", + "terminal", + "tty", + "ui", + "yeoman", + "yo", + "zsh" + ], + "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/confirm/README.md", + "license": "MIT", + "author": "Simon Boudrias ", + "repository": { + "type": "git", + "url": "https://github.com/SBoudrias/Inquirer.js.git" + }, + "files": [ + "dist" + ], + "type": "module", + "sideEffects": false, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "tsc": "tsc" + }, + "dependencies": { + "@inquirer/core": "^11.2.1", + "@inquirer/type": "^4.0.7" + }, + "devDependencies": { + "typescript": "^6.0.2" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "gitHead": "b43359d803733b1a7c4638addcc270987fb894c3" +} diff --git a/node_modules/@inquirer/core/LICENSE b/node_modules/@inquirer/core/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..f7186988726152b8dfb1bbafe940a712da142e3e --- /dev/null +++ b/node_modules/@inquirer/core/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2025 Simon Boudrias + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@inquirer/core/README.md b/node_modules/@inquirer/core/README.md new file mode 100644 index 0000000000000000000000000000000000000000..2b528bdbeedd299aeb7910cb63059560de07a239 --- /dev/null +++ b/node_modules/@inquirer/core/README.md @@ -0,0 +1,386 @@ +# `@inquirer/core` + +The `@inquirer/core` package is the library enabling the creation of Inquirer prompts. + +It aims to implements a lightweight API similar to React hooks - but without JSX. + +# Installation + + + + + + + + + + +
npmyarn
+ +```sh +npm install @inquirer/core +``` + + + +```sh +yarn add @inquirer/core +``` + +
+ +# Usage + +## Basic concept + +Visual terminal apps are at their core strings rendered onto the terminal. + +The most basic prompt is a function returning a string that'll be rendered in the terminal. This function will run every time the prompt state change, and the new returned string will replace the previously rendered one. The prompt cursor appears after the string. + +Wrapping the rendering function with `createPrompt()` will setup the rendering layer, inject the state management utilities, and wait until the `done` callback is called. + +```ts +import { createPrompt } from '@inquirer/core'; + +const input = createPrompt((config, done) => { + // Implement logic + + return '? My question'; +}); + +// And it is then called as +const answer = await input({ + /* config */ +}); +``` + +## Hooks + +State management and user interactions are handled through hooks. Hooks are common [within the React ecosystem](https://react.dev/reference/react/hooks), and Inquirer reimplement the common ones. + +### State hook + +State lets a component โ€œrememberโ€ information like user input. For example, an input prompt can use state to store the input value, while a list prompt can use state to track the cursor index. + +`useState` declares a state variable that you can update directly. + +```ts +import { createPrompt, useState } from '@inquirer/core'; + +const input = createPrompt((config, done) => { + const [index, setIndex] = useState(0); + + // ... +``` + +### Keypress hook + +Almost all prompts need to react to user actions. In a terminal, this is done through typing. + +`useKeypress` allows you to react to keypress events, and access the prompt line. + +```ts +const input = createPrompt((config, done) => { + useKeypress((key) => { + if (key.name === 'enter') { + done(answer); + } + }); + + // ... +``` + +Behind the scenes, Inquirer prompts are wrappers around [readlines](https://nodejs.org/api/readline.html). Aside the keypress event object, the hook also pass the active readline instance to the event handler. + +```ts +const input = createPrompt((config, done) => { + useKeypress((key, readline) => { + setValue(readline.line); + }); + + // ... +``` + +### Ref hook + +Refs let a prompt hold some information that isnโ€™t used for rendering, like a class instance or a timeout ID. Unlike with state, updating a ref does not re-render your prompt. Refs are an โ€œescape hatchโ€ from the rendering paradigm. + +`useRef` declares a ref. You can hold any value in it, but most often itโ€™s used to hold a timeout ID. + +```ts +const input = createPrompt((config, done) => { + const timeout = useRef(null); + + // ... +``` + +### Effect Hook + +Effects let a prompt connect to and synchronize with external systems. This includes dealing with network or animations. + +`useEffect` connects a component to an external system. + +```ts +const chat = createPrompt((config, done) => { + useEffect(() => { + const connection = createConnection(roomId); + connection.connect(); + return () => connection.disconnect(); + }, [roomId]); + + // ... +``` + +### Performance hook + +A common way to optimize re-rendering performance is to skip unnecessary work. For example, you can tell Inquirer to reuse a cached calculation or to skip a re-render if the data has not changed since the previous render. + +`useMemo` lets you cache the result of an expensive calculation. + +```ts +const todoSelect = createPrompt((config, done) => { + const visibleTodos = useMemo(() => filterTodos(todos, tab), [todos, tab]); + + // ... +``` + +### Rendering hooks + +#### Prefix / loading + +All default prompts, and most custom ones, uses a prefix at the beginning of the prompt line. This helps visually delineate different questions, and provides a convenient area to render a loading spinner. + +`usePrefix` is a built-in hook to do this. + +```ts +const input = createPrompt((config, done) => { + const prefix = usePrefix({ status }); + + return `${prefix} My question`; +}); +``` + +#### Pagination + +When looping through a long list of options (like in the `select` prompt), paginating the results appearing on the screen at once can be necessary. The `usePagination` hook is the utility used within the `select` and `checkbox` prompts to cycle through the list of options. + +Pagination works by taking in the list of options and returning a subset of the rendered items that fit within the page. The hook takes in a few options. It needs a list of options (`items`), and a `pageSize` which is the number of lines to be rendered. The `active` index is the index of the currently selected/selectable item. The `loop` option is a boolean that indicates if the list should loop around when reaching the end: this is the default behavior. The pagination hook renders items only as necessary, so it takes a function that can render an item at an index, including an `active` state, called `renderItem`. + +```js +export default createPrompt((config, done) => { + const [active, setActive] = useState(0); + + const allChoices = config.choices.map((choice) => choice.name); + + const page = usePagination({ + items: allChoices, + active: active, + renderItem: ({ item, index, isActive }) => `${isActive ? ">" : " "}${index}. ${item.toString()}` + pageSize: config.pageSize, + loop: config.loop, + }); + + return `... ${page}`; +}); +``` + +## `createPrompt()` API + +As we saw earlier, the rendering function should return a string, and eventually call `done` to close the prompt and return the answer. + +```ts +const input = createPrompt((config, done) => { + const [value, setValue] = useState(); + + useKeypress((key, readline) => { + if (key.name === 'enter') { + done(answer); + } else { + setValue(readline.line); + } + }); + + return `? ${config.message} ${value}`; +}); +``` + +The rendering function can also return a tuple of 2 string (`[string, string]`.) The first string represents the prompt. The second one is content to render under the prompt, like an error message. The text input cursor will appear after the first string. + +```ts +const number = createPrompt((config, done) => { + // Add some logic here + + return [`? My question ${input}`, `! The input must be a number`]; +}); +``` + +### Typescript + +If using typescript, `createPrompt` takes 2 generic arguments. + +```ts +// createPrompt +const input = createPrompt(// ... +``` + +The first one is the type of the resolved value + +```ts +const answer: string = await input(); +``` + +The second one is the type of the prompt config; in other words the interface the created prompt will provide to users. + +```ts +const answer = await input({ + message: 'My question', +}); +``` + +## Key utilities + +Listening for keypress events inside an inquirer prompt is a very common pattern. To ease this, we export a few utility functions taking in the keypress event object and return a boolean: + +- `isEnterKey()` +- `isBackspaceKey()` +- `isSpaceKey()` +- `isUpKey()` - Note: this utility will handle vim and emacs keybindings (up, `k`, and `ctrl+p`) +- `isDownKey()` - Note: this utility will handle vim and emacs keybindings (down, `j`, and `ctrl+n`) +- `isNumberKey()` one of 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 + +Set `INQUIRER_KEYBINDINGS=vim`, `INQUIRER_KEYBINDINGS=emacs`, or `INQUIRER_KEYBINDINGS=vim,emacs` to enable alternative navigation keybindings globally. Prompt-level `theme.keybindings` values override the environment variable. + +## Theming + +Theming utilities will allow you to expose customization of the prompt style. Inquirer also has a few standard theme values shared across all the official prompts. + +To allow standard customization: + +```ts +import { createPrompt, usePrefix, makeTheme, type Theme } from '@inquirer/core'; +import type { PartialDeep } from '@inquirer/type'; + +type PromptConfig = { + theme?: PartialDeep; +}; + +export default createPrompt((config, done) => { + const theme = makeTheme(config.theme); + + const prefix = usePrefix({ status, theme }); + + return `${prefix} ${theme.style.highlight('hello')}`; +}); +``` + +To setup a custom theme: + +```ts +import { createPrompt, makeTheme, type Theme } from '@inquirer/core'; +import type { PartialDeep } from '@inquirer/type'; + +type PromptTheme = {}; + +const promptTheme: PromptTheme = { + icon: '!', +}; + +type PromptConfig = { + theme?: PartialDeep>; +}; + +export default createPrompt((config, done) => { + const theme = makeTheme(promptTheme, config.theme); + + const prefix = usePrefix({ status, theme }); + + return `${prefix} ${theme.icon}`; +}); +``` + +The [default theme keys cover](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/core/src/lib/theme.ts): + +```ts +type DefaultTheme = { + prefix: string | { idle: string; done: string }; + spinner: { + interval: number; + frames: string[]; + }; + keybindings: readonly ('emacs' | 'vim')[]; + style: { + answer: (text: string) => string; + message: (text: string, status: 'idle' | 'done' | 'loading') => string; + error: (text: string) => string; + defaultAnswer: (text: string) => string; + help: (text: string) => string; + highlight: (text: string) => string; + key: (text: string) => string; + }; +}; +``` + +# Examples + +You can refer to any `@inquirer/prompts` prompts for real examples: + +- [Confirm Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/confirm/src/index.ts) +- [Input Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/input/src/index.ts) +- [Password Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/password/src/index.ts) +- [Editor Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/editor/src/index.ts) +- [Select Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/select/src/index.ts) +- [Checkbox Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/checkbox/src/index.ts) +- [Rawlist Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/rawlist/src/index.ts) +- [Expand Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/expand/src/index.ts) + +```ts +import { styleText } from 'node:util'; +import { + createPrompt, + useState, + useKeypress, + isEnterKey, + usePrefix, + type Status, +} from '@inquirer/core'; + +const confirm = createPrompt( + (config, done) => { + const [status, setStatus] = useState('idle'); + const [value, setValue] = useState(''); + const prefix = usePrefix({}); + + useKeypress((key, rl) => { + if (isEnterKey(key)) { + const answer = value ? /^y(es)?/i.test(value) : config.default !== false; + setValue(answer ? 'yes' : 'no'); + setStatus('done'); + done(answer); + } else { + setValue(rl.line); + } + }); + + let formattedValue = value; + let defaultValue = ''; + if (status === 'done') { + formattedValue = styleText('cyan', value); + } else { + defaultValue = styleText('dim', config.default === false ? ' (y/N)' : ' (Y/n)'); + } + + const message = styleText('bold', config.message); + return `${prefix} ${message}${defaultValue} ${formattedValue}`; + }, +); + +/** + * Which then can be used like this: + */ +const answer = await confirm({ message: 'Do you want to continue?' }); +``` + +# License + +Copyright (c) 2023 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))
+Licensed under the MIT license. diff --git a/node_modules/@inquirer/core/dist/index.d.ts b/node_modules/@inquirer/core/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..615b010d521dfe3e7e2c22a314e84c15b21fea25 --- /dev/null +++ b/node_modules/@inquirer/core/dist/index.d.ts @@ -0,0 +1,13 @@ +export { isUpKey, isDownKey, isSpaceKey, isBackspaceKey, isTabKey, isNumberKey, isEnterKey, isShiftKey, type KeypressEvent, type Keybinding, } from './lib/key.ts'; +export * from './lib/errors.ts'; +export { usePrefix } from './lib/use-prefix.ts'; +export { useState } from './lib/use-state.ts'; +export { useEffect } from './lib/use-effect.ts'; +export { useMemo } from './lib/use-memo.ts'; +export { useRef } from './lib/use-ref.ts'; +export { useKeypress } from './lib/use-keypress.ts'; +export { makeTheme } from './lib/make-theme.ts'; +export type { Theme, Status } from './lib/theme.ts'; +export { usePagination } from './lib/pagination/use-pagination.ts'; +export { createPrompt } from './lib/create-prompt.ts'; +export { Separator } from './lib/Separator.ts'; diff --git a/node_modules/@inquirer/core/dist/index.js b/node_modules/@inquirer/core/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..0dbfb03ff4e825912bd30a9bd44a8feb72fd37e6 --- /dev/null +++ b/node_modules/@inquirer/core/dist/index.js @@ -0,0 +1,12 @@ +export { isUpKey, isDownKey, isSpaceKey, isBackspaceKey, isTabKey, isNumberKey, isEnterKey, isShiftKey, } from "./lib/key.js"; +export * from "./lib/errors.js"; +export { usePrefix } from "./lib/use-prefix.js"; +export { useState } from "./lib/use-state.js"; +export { useEffect } from "./lib/use-effect.js"; +export { useMemo } from "./lib/use-memo.js"; +export { useRef } from "./lib/use-ref.js"; +export { useKeypress } from "./lib/use-keypress.js"; +export { makeTheme } from "./lib/make-theme.js"; +export { usePagination } from "./lib/pagination/use-pagination.js"; +export { createPrompt } from "./lib/create-prompt.js"; +export { Separator } from "./lib/Separator.js"; diff --git a/node_modules/@inquirer/core/dist/lib/Separator.d.ts b/node_modules/@inquirer/core/dist/lib/Separator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..028355567638da2eac0e8c759ce6a3ce07dd643b --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/Separator.d.ts @@ -0,0 +1,10 @@ +/** + * Separator object + * Used to space/separate choices group + */ +export declare class Separator { + readonly separator: string; + readonly type: string; + constructor(separator?: string); + static isSeparator(choice: unknown): choice is Separator; +} diff --git a/node_modules/@inquirer/core/dist/lib/Separator.js b/node_modules/@inquirer/core/dist/lib/Separator.js new file mode 100644 index 0000000000000000000000000000000000000000..562e9283ea6a56c8b3f71801a5e1cdd123b3baae --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/Separator.js @@ -0,0 +1,21 @@ +import { styleText } from 'node:util'; +import figures from '@inquirer/figures'; +/** + * Separator object + * Used to space/separate choices group + */ +export class Separator { + separator = styleText('dim', Array.from({ length: 15 }).join(figures.line)); + type = 'separator'; + constructor(separator) { + if (separator) { + this.separator = separator; + } + } + static isSeparator(choice) { + return Boolean(choice && + typeof choice === 'object' && + 'type' in choice && + choice.type === 'separator'); + } +} diff --git a/node_modules/@inquirer/core/dist/lib/create-prompt.d.ts b/node_modules/@inquirer/core/dist/lib/create-prompt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4414db45697e4e2d9dc2f0d3894b4891746cb4b3 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/create-prompt.d.ts @@ -0,0 +1,4 @@ +import { type Prompt, type Prettify } from '@inquirer/type'; +type ViewFunction = (config: Prettify, done: (value: Value) => void) => string | [string, string | undefined]; +export declare function createPrompt(view: ViewFunction): Prompt; +export {}; diff --git a/node_modules/@inquirer/core/dist/lib/create-prompt.js b/node_modules/@inquirer/core/dist/lib/create-prompt.js new file mode 100644 index 0000000000000000000000000000000000000000..cc60c3c0bdc2297e5542942dcaa51afe21c921b9 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/create-prompt.js @@ -0,0 +1,165 @@ +import * as readline from 'node:readline'; +import { AsyncResource } from 'node:async_hooks'; +import MuteStream from 'mute-stream'; +import { onExit as onSignalExit } from 'signal-exit'; +import ScreenManager from "./screen-manager.js"; +import { PromisePolyfill } from "./promise-polyfill.js"; +import { withHooks, effectScheduler } from "./hook-engine.js"; +import { AbortPromptError, CancelPromptError, ExitPromptError } from "./errors.js"; +import path from 'node:path'; +// Capture the real setImmediate at module load time so it works even when test +// frameworks mock timers with vi.useFakeTimers() or similar. +const nativeSetImmediate = globalThis.setImmediate; +function getCallSites() { + // oxlint-disable-next-line typescript/unbound-method + const savedPrepareStackTrace = Error.prepareStackTrace; + let result = []; + try { + Error.prepareStackTrace = (_, callSites) => { + const callSitesWithoutCurrent = callSites.slice(1); + result = callSitesWithoutCurrent; + return callSitesWithoutCurrent; + }; + // oxlint-disable-next-line no-unused-expressions + new Error().stack; + } + catch { + // An error will occur if the Node flag --frozen-intrinsics is used. + // https://nodejs.org/api/cli.html#--frozen-intrinsics + return result; + } + Error.prepareStackTrace = savedPrepareStackTrace; + return result; +} +export function createPrompt(view) { + const callSites = getCallSites(); + const prompt = (config, context = {}) => { + // Default `input` to stdin + const { input = process.stdin, signal } = context; + const cleanups = new Set(); + // Add mute capabilities to the output + const output = new MuteStream(); + output.pipe(context.output ?? process.stdout); + // oxlint-disable-next-line typescript/no-unsafe-type-assertion + const rl = readline.createInterface({ + terminal: true, + input, + output, + }); + // Mute the output after readline has initialized so readline can perform + // any terminal setup writes (e.g. Windows Console API initialization) + // before suppressing output. ScreenManager will unmute/mute around each + // render call as needed. + output.mute(); + const screen = new ScreenManager(rl); + const { promise, resolve, reject } = PromisePolyfill.withResolver(); + const cancel = () => reject(new CancelPromptError()); + if (signal) { + const abort = () => reject(new AbortPromptError({ cause: signal.reason })); + if (signal.aborted) { + abort(); + return Object.assign(promise, { cancel }); + } + signal.addEventListener('abort', abort); + cleanups.add(() => signal.removeEventListener('abort', abort)); + } + cleanups.add(onSignalExit((code, signal) => { + reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal}`)); + })); + // SIGINT must be explicitly handled by the prompt so the ExitPromptError can be handled. + // Otherwise, the prompt will stop and in some scenarios never resolve. + // Ref issue #1741 + const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`)); + rl.on('SIGINT', sigint); + cleanups.add(() => rl.removeListener('SIGINT', sigint)); + return withHooks(rl, (cycle) => { + // The close event triggers immediately when the user press ctrl+c. SignalExit on the other hand + // triggers after the process is done (which happens after timeouts are done triggering.) + // We triggers the hooks cleanup phase on rl `close` so active timeouts can be cleared. + const hooksCleanup = AsyncResource.bind(() => effectScheduler.clearAll()); + rl.on('close', hooksCleanup); + cleanups.add(() => rl.removeListener('close', hooksCleanup)); + const startCycle = () => { + // Re-renders only happen when the state change; but the readline cursor could + // change position and that also requires a re-render (and a manual one because + // we mute the streams). We set the listener after the initial workLoop to avoid + // a double render if render triggered by a state change sets the cursor to the + // right position. + const checkCursorPos = () => screen.checkCursorPos(); + rl.input.on('keypress', checkCursorPos); + cleanups.add(() => rl.input.removeListener('keypress', checkCursorPos)); + let pendingDone = null; + cycle(() => { + let effectsSettled = false; + try { + const nextView = view(config, (value) => { + if (effectsSettled) { + // After the cycle completes (async validation path), the "done" + // render already flushed via setStatus โ†’ handleChange, so resolve + // immediately. + resolve(value); + } + else { + pendingDone = { value }; + } + }); + // Typescript won't allow this, but not all users rely on typescript. + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (nextView === undefined) { + let callerFilename = callSites[1]?.getFileName(); + if (callerFilename && !callerFilename.startsWith('file://')) { + callerFilename = path.resolve(callerFilename); + } + throw new Error(`Prompt functions must return a string.\n at ${callerFilename}`); + } + const [content, bottomContent] = typeof nextView === 'string' ? [nextView] : nextView; + screen.render(content, bottomContent); + effectScheduler.run(); + } + catch (error) { + reject(error); + } + effectsSettled = true; + if (pendingDone !== null) { + const { value } = pendingDone; + pendingDone = null; + resolve(value); + } + }); + }; + // Proper Readable streams (like process.stdin) may have OS-level buffered + // data that arrives in the poll phase when readline resumes the stream. + // Deferring the first render by one setImmediate tick (check phase, after + // poll) lets that stale data flow through readline harmlesslyโ€”no keypress + // handlers are registered yet and the output is muted, so the stale + // keystrokes are silently discarded. + // Old-style streams (like MuteStream) have no such buffering, so the + // render cycle starts immediately. + // + // @see https://github.com/SBoudrias/Inquirer.js/issues/1303 + if ('readableFlowing' in input) { + nativeSetImmediate(startCycle); + } + else { + startCycle(); + } + return Object.assign(promise + .then((answer) => { + effectScheduler.clearAll(); + return answer; + }, (error) => { + effectScheduler.clearAll(); + throw error; + }) + // Wait for the promise to settle, then cleanup. + .finally(() => { + cleanups.forEach((cleanup) => cleanup()); + screen.done({ clearContent: Boolean(context.clearPromptOnDone) }); + output.end(); + }) + // Once cleanup is done, let the expose promise resolve/reject to the internal one. + .then(() => promise), { cancel }); + }); + }; + return prompt; +} diff --git a/node_modules/@inquirer/core/dist/lib/errors.d.ts b/node_modules/@inquirer/core/dist/lib/errors.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9df681e623b3a0798c95080f009ff994e4e7010 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/errors.d.ts @@ -0,0 +1,20 @@ +export declare class AbortPromptError extends Error { + name: string; + message: string; + constructor(options?: { + cause?: unknown; + }); +} +export declare class CancelPromptError extends Error { + name: string; + message: string; +} +export declare class ExitPromptError extends Error { + name: string; +} +export declare class HookError extends Error { + name: string; +} +export declare class ValidationError extends Error { + name: string; +} diff --git a/node_modules/@inquirer/core/dist/lib/errors.js b/node_modules/@inquirer/core/dist/lib/errors.js new file mode 100644 index 0000000000000000000000000000000000000000..153a9363ee96a4ef0d4d5ce024d755e71f13a5f3 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/errors.js @@ -0,0 +1,21 @@ +export class AbortPromptError extends Error { + name = 'AbortPromptError'; + message = 'Prompt was aborted'; + constructor(options) { + super(); + this.cause = options?.cause; + } +} +export class CancelPromptError extends Error { + name = 'CancelPromptError'; + message = 'Prompt was canceled'; +} +export class ExitPromptError extends Error { + name = 'ExitPromptError'; +} +export class HookError extends Error { + name = 'HookError'; +} +export class ValidationError extends Error { + name = 'ValidationError'; +} diff --git a/node_modules/@inquirer/core/dist/lib/hook-engine.d.ts b/node_modules/@inquirer/core/dist/lib/hook-engine.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..edfc61cb036121c4a42b0c8af323d10f9c9c438a --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/hook-engine.d.ts @@ -0,0 +1,23 @@ +import type { InquirerReadline } from '@inquirer/type'; +export declare function withHooks(rl: InquirerReadline, cb: (cycle: (render: () => void) => void) => T): T; +export declare function readline(): InquirerReadline; +export declare function withUpdates(fn: (...args: Args) => R): (...args: Args) => R; +type SetPointer = { + get(): Value; + set(value: Value): void; + initialized: true; +}; +type UnsetPointer = { + get(): void; + set(value: Value): void; + initialized: false; +}; +type Pointer = SetPointer | UnsetPointer; +export declare function withPointer(cb: (pointer: Pointer) => ReturnValue): ReturnValue; +export declare function handleChange(): void; +export declare const effectScheduler: { + queue(cb: (readline: InquirerReadline) => void | (() => void)): void; + run(): void; + clearAll(): void; +}; +export {}; diff --git a/node_modules/@inquirer/core/dist/lib/hook-engine.js b/node_modules/@inquirer/core/dist/lib/hook-engine.js new file mode 100644 index 0000000000000000000000000000000000000000..b3c66537934e38641b53086ab62868dae6488f08 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/hook-engine.js @@ -0,0 +1,111 @@ +/* eslint @typescript-eslint/no-explicit-any: ["off"] */ +import { AsyncLocalStorage, AsyncResource } from 'node:async_hooks'; +import { HookError, ValidationError } from "./errors.js"; +const hookStorage = new AsyncLocalStorage(); +function createStore(rl) { + const store = { + rl, + hooks: [], + hooksCleanup: [], + hooksEffect: [], + index: 0, + handleChange() { }, + }; + return store; +} +// Run callback in with the hook engine setup. +export function withHooks(rl, cb) { + const store = createStore(rl); + return hookStorage.run(store, () => { + function cycle(render) { + store.handleChange = () => { + store.index = 0; + render(); + }; + store.handleChange(); + } + return cb(cycle); + }); +} +// Safe getStore utility that'll return the store or throw if undefined. +function getStore() { + const store = hookStorage.getStore(); + if (!store) { + throw new HookError('[Inquirer] Hook functions can only be called from within a prompt'); + } + return store; +} +export function readline() { + return getStore().rl; +} +// Merge state updates happening within the callback function to avoid multiple renders. +export function withUpdates(fn) { + const wrapped = (...args) => { + const store = getStore(); + let shouldUpdate = false; + const oldHandleChange = store.handleChange; + store.handleChange = () => { + shouldUpdate = true; + }; + const returnValue = fn(...args); + if (shouldUpdate) { + oldHandleChange(); + } + store.handleChange = oldHandleChange; + return returnValue; + }; + return AsyncResource.bind(wrapped); +} +export function withPointer(cb) { + const store = getStore(); + const { index } = store; + const pointer = { + get() { + // oxlint-disable-next-line typescript/no-unsafe-type-assertion + return store.hooks[index]; + }, + set(value) { + store.hooks[index] = value; + }, + initialized: index in store.hooks, + }; + const returnValue = cb(pointer); + store.index++; + return returnValue; +} +export function handleChange() { + getStore().handleChange(); +} +export const effectScheduler = { + queue(cb) { + const store = getStore(); + const { index } = store; + store.hooksEffect.push(() => { + store.hooksCleanup[index]?.(); + const cleanFn = cb(readline()); + if (cleanFn != null && typeof cleanFn !== 'function') { + throw new ValidationError('useEffect return value must be a cleanup function or nothing.'); + } + store.hooksCleanup[index] = cleanFn; + }); + }, + run() { + const store = getStore(); + withUpdates(() => { + store.hooksEffect.forEach((effect) => { + effect(); + }); + // Warning: Clean the hooks before exiting the `withUpdates` block. + // Failure to do so means an updates would hit the same effects again. + store.hooksEffect.length = 0; + })(); + }, + clearAll() { + const store = getStore(); + store.hooksCleanup.forEach((cleanFn) => { + cleanFn?.(); + }); + store.hooksEffect.length = 0; + store.hooksCleanup.length = 0; + }, +}; diff --git a/node_modules/@inquirer/core/dist/lib/key.d.ts b/node_modules/@inquirer/core/dist/lib/key.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1cf7f471a150277de319480eb94cf07dd6679417 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/key.d.ts @@ -0,0 +1,15 @@ +export type KeypressEvent = { + name: string; + ctrl: boolean; + shift: boolean; +}; +export type Keybinding = 'emacs' | 'vim'; +export declare function getDefaultKeybindings(): ReadonlyArray; +export declare const isUpKey: (key: KeypressEvent, keybindings?: ReadonlyArray) => boolean; +export declare const isDownKey: (key: KeypressEvent, keybindings?: ReadonlyArray) => boolean; +export declare const isSpaceKey: (key: KeypressEvent) => boolean; +export declare const isBackspaceKey: (key: KeypressEvent) => boolean; +export declare const isTabKey: (key: KeypressEvent) => boolean; +export declare const isNumberKey: (key: KeypressEvent) => boolean; +export declare const isEnterKey: (key: KeypressEvent) => boolean; +export declare const isShiftKey: (key: KeypressEvent) => boolean; diff --git a/node_modules/@inquirer/core/dist/lib/key.js b/node_modules/@inquirer/core/dist/lib/key.js new file mode 100644 index 0000000000000000000000000000000000000000..aecc8b872cb2ca744e71cdfd6efecbd4e85c9996 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/key.js @@ -0,0 +1,34 @@ +const keybindings = ['emacs', 'vim']; +const keybindingLookup = new Set(keybindings); +function isKeybinding(value) { + return keybindingLookup.has(value); +} +export function getDefaultKeybindings() { + const env = process.env['INQUIRER_KEYBINDINGS']; + if (!env) + return []; + return Array.from(new Set(env + .toLowerCase() + .split(/[\s,]+/) + .filter(isKeybinding))); +} +export const isUpKey = (key, keybindings = []) => +// The up key +key.name === 'up' || + // Vim keybinding: hjkl keys map to left/down/up/right + (keybindings.includes('vim') && key.name === 'k') || + // Emacs keybinding: Ctrl+P means "previous" in Emacs navigation conventions + (keybindings.includes('emacs') && key.ctrl && key.name === 'p'); +export const isDownKey = (key, keybindings = []) => +// The down key +key.name === 'down' || + // Vim keybinding: hjkl keys map to left/down/up/right + (keybindings.includes('vim') && key.name === 'j') || + // Emacs keybinding: Ctrl+N means "next" in Emacs navigation conventions + (keybindings.includes('emacs') && key.ctrl && key.name === 'n'); +export const isSpaceKey = (key) => key.name === 'space'; +export const isBackspaceKey = (key) => key.name === 'backspace'; +export const isTabKey = (key) => key.name === 'tab'; +export const isNumberKey = (key) => '1234567890'.includes(key.name); +export const isEnterKey = (key) => key.name === 'enter' || key.name === 'return'; +export const isShiftKey = (key) => key.shift; diff --git a/node_modules/@inquirer/core/dist/lib/make-theme.d.ts b/node_modules/@inquirer/core/dist/lib/make-theme.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7aae8b225c01c27c531617a09cec62ba2c1e4f6 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/make-theme.d.ts @@ -0,0 +1,3 @@ +import type { Prettify, PartialDeep } from '@inquirer/type'; +import { type Theme } from './theme.ts'; +export declare function makeTheme(...themes: ReadonlyArray>>): Prettify>; diff --git a/node_modules/@inquirer/core/dist/lib/make-theme.js b/node_modules/@inquirer/core/dist/lib/make-theme.js new file mode 100644 index 0000000000000000000000000000000000000000..4943a7686eb5d467d99c2cf5a1f106f394bae89d --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/make-theme.js @@ -0,0 +1,32 @@ +import { getDefaultTheme } from "./theme.js"; +function isPlainObject(value) { + if (typeof value !== 'object' || value === null) + return false; + let proto = value; + while (Object.getPrototypeOf(proto) !== null) { + proto = Object.getPrototypeOf(proto); + } + return Object.getPrototypeOf(value) === proto; +} +function deepMerge(...objects) { + const output = {}; + for (const obj of objects) { + for (const [key, value] of Object.entries(obj)) { + const prevValue = output[key]; + output[key] = + isPlainObject(prevValue) && isPlainObject(value) + ? deepMerge(prevValue, value) + : value; + } + } + // oxlint-disable-next-line typescript/no-unsafe-type-assertion + return output; +} +export function makeTheme(...themes) { + // oxlint-disable-next-line typescript/no-unsafe-type-assertion + const themesToMerge = [ + getDefaultTheme(), + ...themes.filter((theme) => theme != null), + ]; + return deepMerge(...themesToMerge); +} diff --git a/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.d.ts b/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..47467c3d811b9ee88e1e3358214f9edc176f4018 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.d.ts @@ -0,0 +1,16 @@ +import type { Prettify } from '@inquirer/type'; +export declare function usePagination({ items, active, renderItem, pageSize, loop, }: { + items: ReadonlyArray; + /** The index of the active item. */ + active: number; + /** Renders an item as part of a page. */ + renderItem: (layout: Prettify<{ + item: T; + index: number; + isActive: boolean; + }>) => string; + /** The size of the page. */ + pageSize: number; + /** Allows creating an infinitely looping list. `true` if unspecified. */ + loop?: boolean; +}): string; diff --git a/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js b/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js new file mode 100644 index 0000000000000000000000000000000000000000..f3883d54f7a21f123c9786badcfbb726e40e9195 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js @@ -0,0 +1,121 @@ +import { useRef } from "../use-ref.js"; +import { readlineWidth, breakLines } from "../utils.js"; +function usePointerPosition({ active, renderedItems, pageSize, loop, }) { + const state = useRef({ + lastPointer: active, + lastActive: undefined, + }); + const { lastPointer, lastActive } = state.current; + const middle = Math.floor(pageSize / 2); + const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0); + const defaultPointerPosition = renderedItems + .slice(0, active) + .reduce((acc, item) => acc + item.length, 0); + let pointer = defaultPointerPosition; + if (renderedLength > pageSize) { + if (loop) { + /** + * Creates the next position for the pointer considering an infinitely + * looping list of items to be rendered on the page. + * + * The goal is to progressively move the cursor to the middle position as the user move down, and then keep + * the cursor there. When the user move up, maintain the cursor position. + */ + // By default, keep the cursor position as-is. + pointer = lastPointer; + if ( + // First render, skip this logic. + lastActive != null && + // Only move the pointer down when the user moves down. + lastActive < active && + // Check user didn't move up across page boundary. + active - lastActive < pageSize) { + pointer = Math.min( + // Furthest allowed position for the pointer is the middle of the list + middle, Math.abs(active - lastActive) === 1 + ? Math.min( + // Move the pointer at most the height of the last active item. + lastPointer + (renderedItems[lastActive]?.length ?? 0), + // If the user moved by one item, move the pointer to the natural position of the active item as + // long as it doesn't move the cursor up. + Math.max(defaultPointerPosition, lastPointer)) + : // Otherwise, move the pointer down by the difference between the active and last active item. + lastPointer + active - lastActive); + } + } + else { + /** + * Creates the next position for the pointer considering a finite list of + * items to be rendered on a page. + * + * The goal is to keep the pointer in the middle of the page whenever possible, until + * we reach the bounds of the list (top or bottom). In which case, the cursor moves progressively + * to the bottom or top of the list. + */ + const spaceUnderActive = renderedItems + .slice(active) + .reduce((acc, item) => acc + item.length, 0); + pointer = + spaceUnderActive < pageSize - middle + ? // If the active item is near the end of the list, progressively move the cursor towards the end. + pageSize - spaceUnderActive + : // Otherwise, progressively move the pointer to the middle of the list. + Math.min(defaultPointerPosition, middle); + } + } + // Save state for the next render + state.current.lastPointer = pointer; + state.current.lastActive = active; + return pointer; +} +export function usePagination({ items, active, renderItem, pageSize, loop = true, }) { + const width = readlineWidth(); + const bound = (num) => ((num % items.length) + items.length) % items.length; + const renderedItems = items.map((item, index) => { + if (item == null) + return []; + return breakLines(renderItem({ item, index, isActive: index === active }), width).split('\n'); + }); + const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0); + const renderItemAtIndex = (index) => renderedItems[index] ?? []; + const pointer = usePointerPosition({ active, renderedItems, pageSize, loop }); + // Render the active item to decide the position. + // If the active item fits under the pointer, we render it there. + // Otherwise, we need to render it to fit at the bottom of the page; moving the pointer up. + const activeItem = renderItemAtIndex(active).slice(0, pageSize); + const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length; + // Create an array of lines for the page, and add the lines of the active item into the page + const pageBuffer = Array.from({ length: pageSize }); + pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem); + // Store to prevent rendering the same item twice + const itemVisited = new Set([active]); + // Fill the page under the active item + let bufferPointer = activeItemPosition + activeItem.length; + let itemPointer = bound(active + 1); + while (bufferPointer < pageSize && + !itemVisited.has(itemPointer) && + (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) { + const lines = renderItemAtIndex(itemPointer); + const linesToAdd = lines.slice(0, pageSize - bufferPointer); + pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd); + // Move pointers for next iteration + itemVisited.add(itemPointer); + bufferPointer += linesToAdd.length; + itemPointer = bound(itemPointer + 1); + } + // Fill the page over the active item + bufferPointer = activeItemPosition - 1; + itemPointer = bound(active - 1); + while (bufferPointer >= 0 && + !itemVisited.has(itemPointer) && + (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) { + const lines = renderItemAtIndex(itemPointer); + const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1)); + pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd); + // Move pointers for next iteration + itemVisited.add(itemPointer); + bufferPointer -= linesToAdd.length; + itemPointer = bound(itemPointer - 1); + } + return pageBuffer.filter((line) => typeof line === 'string').join('\n'); +} diff --git a/node_modules/@inquirer/core/dist/lib/promise-polyfill.d.ts b/node_modules/@inquirer/core/dist/lib/promise-polyfill.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0e4f74ca61d0b9ad9e7f092c436b79d137c0bb22 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/promise-polyfill.d.ts @@ -0,0 +1,7 @@ +export declare class PromisePolyfill extends Promise { + static withResolver(): { + promise: Promise; + resolve: (value: T) => void; + reject: (error: unknown) => void; + }; +} diff --git a/node_modules/@inquirer/core/dist/lib/promise-polyfill.js b/node_modules/@inquirer/core/dist/lib/promise-polyfill.js new file mode 100644 index 0000000000000000000000000000000000000000..621708ee2a568a6afa8207f555d1a5f1ef1791f6 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/promise-polyfill.js @@ -0,0 +1,14 @@ +// TODO: Remove this class once Node 22 becomes the minimum supported version. +export class PromisePolyfill extends Promise { + // Available starting from Node 22 + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers + static withResolver() { + let resolve; + let reject; + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, resolve: resolve, reject: reject }; + } +} diff --git a/node_modules/@inquirer/core/dist/lib/screen-manager.d.ts b/node_modules/@inquirer/core/dist/lib/screen-manager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..de4c1e00fb09d30464dbebf43b87a04c8a9b8e8f --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/screen-manager.d.ts @@ -0,0 +1,14 @@ +import type { InquirerReadline } from '@inquirer/type'; +export default class ScreenManager { + private height; + private extraLinesUnderPrompt; + private cursorPos; + private readonly rl; + constructor(rl: InquirerReadline); + write(content: string): void; + render(content: string, bottomContent?: string): void; + checkCursorPos(): void; + done({ clearContent }: { + clearContent: boolean; + }): void; +} diff --git a/node_modules/@inquirer/core/dist/lib/screen-manager.js b/node_modules/@inquirer/core/dist/lib/screen-manager.js new file mode 100644 index 0000000000000000000000000000000000000000..ce264cb28b8d9a2dac4f5beedce7ed08e2a76330 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/screen-manager.js @@ -0,0 +1,84 @@ +import { stripVTControlCharacters } from 'node:util'; +import { breakLines, readlineWidth } from "./utils.js"; +import { cursorDown, cursorLeft, cursorUp, cursorTo, cursorShow, eraseLines, } from '@inquirer/ansi'; +const height = (content) => content.split('\n').length; +const lastLine = (content) => content.split('\n').pop() ?? ''; +export default class ScreenManager { + // These variables are keeping information to allow correct prompt re-rendering + height = 0; + extraLinesUnderPrompt = 0; + cursorPos; + rl; + constructor(rl) { + this.rl = rl; + this.cursorPos = rl.getCursorPos(); + } + write(content) { + this.rl.output.unmute(); + this.rl.output.write(content); + this.rl.output.mute(); + } + render(content, bottomContent = '') { + // Write message to screen and setPrompt to control backspace + const promptLine = lastLine(content); + const rawPromptLine = stripVTControlCharacters(promptLine); + // Remove the rl.line from our prompt. We can't rely on the content of + // rl.line (mainly because of the password prompt), so just rely on it's + // length. + let prompt = rawPromptLine; + if (this.rl.line.length > 0) { + prompt = prompt.slice(0, -this.rl.line.length); + } + this.rl.setPrompt(prompt); + // SetPrompt will change cursor position, now we can get correct value + this.cursorPos = this.rl.getCursorPos(); + const width = readlineWidth(); + content = breakLines(content, width); + bottomContent = breakLines(bottomContent, width); + // Manually insert an extra line if we're at the end of the line. + // This prevent the cursor from appearing at the beginning of the + // current line. + if (rawPromptLine.length % width === 0) { + content += '\n'; + } + let output = content + (bottomContent ? '\n' + bottomContent : ''); + /** + * Re-adjust the cursor at the correct position. + */ + // We need to consider parts of the prompt under the cursor as part of the bottom + // content in order to correctly cleanup and re-render. + const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows; + const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0); + // Return cursor to the input position (on top of the bottomContent) + if (bottomContentHeight > 0) + output += cursorUp(bottomContentHeight); + // Return cursor to the initial left offset. + output += cursorTo(this.cursorPos.cols); + /** + * Render and store state for future re-rendering + */ + this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output); + this.extraLinesUnderPrompt = bottomContentHeight; + this.height = height(output); + } + checkCursorPos() { + const cursorPos = this.rl.getCursorPos(); + if (cursorPos.cols !== this.cursorPos.cols) { + this.write(cursorTo(cursorPos.cols)); + this.cursorPos = cursorPos; + } + } + done({ clearContent }) { + this.rl.setPrompt(''); + let output = cursorDown(this.extraLinesUnderPrompt); + output += clearContent ? eraseLines(this.height) : '\n'; + // Reset cursor to column 0. On Windows terminals, \n moves the cursor + // down without resetting the column when the rendered prompt+answer + // wraps past the terminal width. Without this, all subsequent output + // starts at the wrong horizontal offset. + output += cursorLeft; + output += cursorShow; + this.write(output); + this.rl.close(); + } +} diff --git a/node_modules/@inquirer/core/dist/lib/theme.d.ts b/node_modules/@inquirer/core/dist/lib/theme.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2b81bf8a59fa97879313c83363d2e7cf86e32659 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/theme.d.ts @@ -0,0 +1,166 @@ +import type { Prettify } from '@inquirer/type'; +import { type Keybinding } from './key.ts'; +/** + * Union type representing the possible statuses of a prompt. + * + * - `'loading'`: The prompt is currently loading. + * - `'idle'`: The prompt is loaded and currently waiting for the user to + * submit an answer. + * - `'done'`: The user has submitted an answer and the prompt is finished. + * - `string`: Any other string: The prompt is in a custom state. + */ +export type Status = 'loading' | 'idle' | 'done' | (string & {}); +type DefaultTheme = { + /** + * Prefix to prepend to the message. If a function is provided, it will be + * called with the current status of the prompt, and the return value will be + * used as the prefix. + * + * @remarks + * If `status === 'loading'`, this property is ignored and the spinner (styled + * by the `spinner` property) will be displayed instead. + * + * @defaultValue + * ```ts + * // import { styleText } from 'node:util'; + * (status) => status === 'done' ? styleText('green', 'โœ”') : styleText('blue', '?') + * ``` + */ + prefix: string | Prettify, 'loading'>>; + /** + * Configuration for the spinner that is displayed when the prompt is in the + * `'loading'` state. + * + * We recommend the use of {@link https://github.com/sindresorhus/cli-spinners|cli-spinners} for a list of available spinners. + */ + spinner: { + /** + * The time interval between frames, in milliseconds. + * + * @defaultValue + * ```ts + * 80 + * ``` + */ + interval: number; + /** + * A list of frames to show for the spinner. + * + * @defaultValue + * ```ts + * ['โ ‹', 'โ ™', 'โ น', 'โ ธ', 'โ ผ', 'โ ด', 'โ ฆ', 'โ ง', 'โ ‡', 'โ '] + * ``` + */ + frames: string[]; + }; + /** + * Alternative keybindings enabled for prompt navigation. + * + * @defaultValue + * ```ts + * process.env['INQUIRER_KEYBINDINGS'] + * ``` + */ + keybindings: ReadonlyArray; + /** + * Object containing functions to style different parts of the prompt. + */ + style: { + /** + * Style to apply to the user's answer once it has been submitted. + * + * @param text - The user's answer. + * @returns The styled answer. + * + * @defaultValue + * ```ts + * // import { styleText } from 'node:util'; + * (text) => styleText('cyan', text) + * ``` + */ + answer: (text: string) => string; + /** + * Style to apply to the message displayed to the user. + * + * @param text - The message to style. + * @param status - The current status of the prompt. + * @returns The styled message. + * + * @defaultValue + * ```ts + * // import { styleText } from 'node:util'; + * (text, status) => styleText('bold', text) + * ``` + */ + message: (text: string, status: Status) => string; + /** + * Style to apply to error messages. + * + * @param text - The error message. + * @returns The styled error message. + * + * @defaultValue + * ```ts + * // import { styleText } from 'node:util'; + * (text) => styleText('red', `> ${text}`) + * ``` + */ + error: (text: string) => string; + /** + * Style to apply to the default answer when one is provided. + * + * @param text - The default answer. + * @returns The styled default answer. + * + * @defaultValue + * ```ts + * // import { styleText } from 'node:util'; + * (text) => styleText('dim', `(${text})`) + * ``` + */ + defaultAnswer: (text: string) => string; + /** + * Style to apply to help text. + * + * @param text - The help text. + * @returns The styled help text. + * + * @defaultValue + * ```ts + * // import { styleText } from 'node:util'; + * (text) => styleText('dim', text) + * ``` + */ + help: (text: string) => string; + /** + * Style to apply to highlighted text. + * + * @param text - The text to highlight. + * @returns The highlighted text. + * + * @defaultValue + * ```ts + * // import { styleText } from 'node:util'; + * (text) => styleText('cyan', text) + * ``` + */ + highlight: (text: string) => string; + /** + * Style to apply to keyboard keys referred to in help texts. + * + * @param text - The key to style. + * @returns The styled key. + * + * @defaultValue + * ```ts + * // import { styleText } from 'node:util'; + * (text) => styleText('cyan', styleText('bold', `<${text}>`)) + * ``` + */ + key: (text: string) => string; + }; +}; +export type Theme = Prettify; +export declare const defaultTheme: DefaultTheme; +export declare function getDefaultTheme(): DefaultTheme; +export {}; diff --git a/node_modules/@inquirer/core/dist/lib/theme.js b/node_modules/@inquirer/core/dist/lib/theme.js new file mode 100644 index 0000000000000000000000000000000000000000..9433dda238e0c7e542488ddca9331fbbcdedc9f9 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/theme.js @@ -0,0 +1,29 @@ +import { styleText } from 'node:util'; +import figures from '@inquirer/figures'; +import { getDefaultKeybindings } from "./key.js"; +export const defaultTheme = { + prefix: { + idle: styleText('blue', '?'), + done: styleText('green', figures.tick), + }, + spinner: { + interval: 80, + frames: ['โ ‹', 'โ ™', 'โ น', 'โ ธ', 'โ ผ', 'โ ด', 'โ ฆ', 'โ ง', 'โ ‡', 'โ '].map((frame) => styleText('yellow', frame)), + }, + keybindings: [], + style: { + answer: (text) => styleText('cyan', text), + message: (text) => styleText('bold', text), + error: (text) => styleText('red', `> ${text}`), + defaultAnswer: (text) => styleText('dim', `(${text})`), + help: (text) => styleText('dim', text), + highlight: (text) => styleText('cyan', text), + key: (text) => styleText('cyan', styleText('bold', `<${text}>`)), + }, +}; +export function getDefaultTheme() { + return { + ...defaultTheme, + keybindings: getDefaultKeybindings(), + }; +} diff --git a/node_modules/@inquirer/core/dist/lib/use-effect.d.ts b/node_modules/@inquirer/core/dist/lib/use-effect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..abee90639f181a2a64ec31dd47e3920586edc9ad --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-effect.d.ts @@ -0,0 +1,2 @@ +import type { InquirerReadline } from '@inquirer/type'; +export declare function useEffect(cb: (rl: InquirerReadline) => void | (() => void), depArray: ReadonlyArray): void; diff --git a/node_modules/@inquirer/core/dist/lib/use-effect.js b/node_modules/@inquirer/core/dist/lib/use-effect.js new file mode 100644 index 0000000000000000000000000000000000000000..1c1a9cabf040acee58e0f4fa2777408a5a2eae3f --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-effect.js @@ -0,0 +1,11 @@ +import { withPointer, effectScheduler } from "./hook-engine.js"; +export function useEffect(cb, depArray) { + withPointer((pointer) => { + const oldDeps = pointer.get(); + const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i])); + if (hasChanged) { + effectScheduler.queue(cb); + } + pointer.set(depArray); + }); +} diff --git a/node_modules/@inquirer/core/dist/lib/use-keypress.d.ts b/node_modules/@inquirer/core/dist/lib/use-keypress.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ccdeefaf26be3e47e9c2459f23707e7b50af0ddf --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-keypress.d.ts @@ -0,0 +1,3 @@ +import { type InquirerReadline } from '@inquirer/type'; +import { type KeypressEvent } from './key.ts'; +export declare function useKeypress(userHandler: (event: KeypressEvent, rl: InquirerReadline) => void | Promise): void; diff --git a/node_modules/@inquirer/core/dist/lib/use-keypress.js b/node_modules/@inquirer/core/dist/lib/use-keypress.js new file mode 100644 index 0000000000000000000000000000000000000000..4ff9b89be42e5bd69aa3062cee4e3a333625085a --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-keypress.js @@ -0,0 +1,20 @@ +import { useRef } from "./use-ref.js"; +import { useEffect } from "./use-effect.js"; +import { withUpdates } from "./hook-engine.js"; +export function useKeypress(userHandler) { + const signal = useRef(userHandler); + signal.current = userHandler; + useEffect((rl) => { + let ignore = false; + const handler = withUpdates((_input, event) => { + if (ignore) + return; + void signal.current(event, rl); + }); + rl.input.on('keypress', handler); + return () => { + ignore = true; + rl.input.removeListener('keypress', handler); + }; + }, []); +} diff --git a/node_modules/@inquirer/core/dist/lib/use-memo.d.ts b/node_modules/@inquirer/core/dist/lib/use-memo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..19d164433d1f17a0bb9e0557e8b9eedc307271f7 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-memo.d.ts @@ -0,0 +1 @@ +export declare function useMemo(fn: () => Value, dependencies: ReadonlyArray): Value; diff --git a/node_modules/@inquirer/core/dist/lib/use-memo.js b/node_modules/@inquirer/core/dist/lib/use-memo.js new file mode 100644 index 0000000000000000000000000000000000000000..0395f4ed1b4c55362d1b59b6579f5f0e65e164d4 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-memo.js @@ -0,0 +1,14 @@ +import { withPointer } from "./hook-engine.js"; +export function useMemo(fn, dependencies) { + return withPointer((pointer) => { + const prev = pointer.get(); + if (!prev || + prev.dependencies.length !== dependencies.length || + prev.dependencies.some((dep, i) => dep !== dependencies[i])) { + const value = fn(); + pointer.set({ value, dependencies }); + return value; + } + return prev.value; + }); +} diff --git a/node_modules/@inquirer/core/dist/lib/use-prefix.d.ts b/node_modules/@inquirer/core/dist/lib/use-prefix.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..db1dabb13a37372d17b7ec3f944586ffc3916c17 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-prefix.d.ts @@ -0,0 +1,5 @@ +import type { Theme, Status } from './theme.ts'; +export declare function usePrefix({ status, theme, }: { + status?: Status; + theme?: Theme; +}): string; diff --git a/node_modules/@inquirer/core/dist/lib/use-prefix.js b/node_modules/@inquirer/core/dist/lib/use-prefix.js new file mode 100644 index 0000000000000000000000000000000000000000..d334a502ac199ddb2d07bdf665272e99eb5d2587 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-prefix.js @@ -0,0 +1,35 @@ +import { useState } from "./use-state.js"; +import { useEffect } from "./use-effect.js"; +import { makeTheme } from "./make-theme.js"; +export function usePrefix({ status = 'idle', theme, }) { + const [showLoader, setShowLoader] = useState(false); + const [tick, setTick] = useState(0); + const { prefix, spinner } = makeTheme(theme); + useEffect(() => { + if (status === 'loading') { + let tickInterval; + let inc = -1; + // Delay displaying spinner by 300ms, to avoid flickering + const delayTimeout = setTimeout(() => { + setShowLoader(true); + tickInterval = setInterval(() => { + inc = inc + 1; + setTick(inc % spinner.frames.length); + }, spinner.interval); + }, 300); + return () => { + clearTimeout(delayTimeout); + clearInterval(tickInterval); + }; + } + else { + setShowLoader(false); + } + }, [status]); + if (showLoader) { + return spinner.frames[tick]; + } + // There's a delay before we show the loader. So we want to ignore `loading` here, and pass idle instead. + const iconName = status === 'loading' ? 'idle' : status; + return typeof prefix === 'string' ? prefix : (prefix[iconName] ?? prefix['idle']); +} diff --git a/node_modules/@inquirer/core/dist/lib/use-ref.d.ts b/node_modules/@inquirer/core/dist/lib/use-ref.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..be7126b9e8784bebfe6526bdca70895a388a0c16 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-ref.d.ts @@ -0,0 +1,6 @@ +export declare function useRef(val: Value): { + current: Value; +}; +export declare function useRef(val?: Value): { + current: Value | undefined; +}; diff --git a/node_modules/@inquirer/core/dist/lib/use-ref.js b/node_modules/@inquirer/core/dist/lib/use-ref.js new file mode 100644 index 0000000000000000000000000000000000000000..a0255614e16b311f40ce53174a4106f3f8e6612f --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-ref.js @@ -0,0 +1,4 @@ +import { useState } from "./use-state.js"; +export function useRef(val) { + return useState({ current: val })[0]; +} diff --git a/node_modules/@inquirer/core/dist/lib/use-state.d.ts b/node_modules/@inquirer/core/dist/lib/use-state.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba0b621f9dce863bbd33d7dac60cf19894d7a9f --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-state.d.ts @@ -0,0 +1,4 @@ +type NotFunction = T extends (...args: never) => unknown ? never : T; +export declare function useState(defaultValue: NotFunction | (() => Value)): [Value, (newValue: Value) => void]; +export declare function useState(defaultValue?: NotFunction | (() => Value)): [Value | undefined, (newValue?: Value) => void]; +export {}; diff --git a/node_modules/@inquirer/core/dist/lib/use-state.js b/node_modules/@inquirer/core/dist/lib/use-state.js new file mode 100644 index 0000000000000000000000000000000000000000..b2c9b3f9a89d53b4b2b02996b80572381a2495a0 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/use-state.js @@ -0,0 +1,23 @@ +import { AsyncResource } from 'node:async_hooks'; +import { withPointer, handleChange } from "./hook-engine.js"; +function isFactory(value) { + return typeof value === 'function'; +} +export function useState(defaultValue) { + return withPointer((pointer) => { + const setState = AsyncResource.bind(function setState(newValue) { + // Noop if the value is still the same. + if (pointer.get() !== newValue) { + pointer.set(newValue); + // Trigger re-render + handleChange(); + } + }); + if (pointer.initialized) { + return [pointer.get(), setState]; + } + const value = isFactory(defaultValue) ? defaultValue() : defaultValue; + pointer.set(value); + return [value, setState]; + }); +} diff --git a/node_modules/@inquirer/core/dist/lib/utils.d.ts b/node_modules/@inquirer/core/dist/lib/utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..14f8fc438e8a481cf90a4c071b18751e26f9f4d0 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/utils.d.ts @@ -0,0 +1,13 @@ +/** + * Force line returns at specific width. This function is ANSI code friendly and it'll + * ignore invisible codes during width calculation. + * @param {string} content + * @param {number} width + * @return {string} + */ +export declare function breakLines(content: string, width: number): string; +/** + * Returns the width of the active readline, or 80 as default value. + * @returns {number} + */ +export declare function readlineWidth(): number; diff --git a/node_modules/@inquirer/core/dist/lib/utils.js b/node_modules/@inquirer/core/dist/lib/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..58a81459752947da654d9b3e6a391b16ee810e50 --- /dev/null +++ b/node_modules/@inquirer/core/dist/lib/utils.js @@ -0,0 +1,25 @@ +import cliWidth from 'cli-width'; +import { wrapAnsi } from 'fast-wrap-ansi'; +import { readline } from "./hook-engine.js"; +/** + * Force line returns at specific width. This function is ANSI code friendly and it'll + * ignore invisible codes during width calculation. + * @param {string} content + * @param {number} width + * @return {string} + */ +export function breakLines(content, width) { + return content + .split('\n') + .flatMap((line) => wrapAnsi(line, width, { trim: false, wordWrap: false }) + .split('\n') + .map((str) => str.trimEnd())) + .join('\n'); +} +/** + * Returns the width of the active readline, or 80 as default value. + * @returns {number} + */ +export function readlineWidth() { + return cliWidth({ defaultWidth: 80, output: readline().output }); +} diff --git a/node_modules/@inquirer/core/package.json b/node_modules/@inquirer/core/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b439924858532f0335fb9b871afa2b3b9d606202 --- /dev/null +++ b/node_modules/@inquirer/core/package.json @@ -0,0 +1,97 @@ +{ + "name": "@inquirer/core", + "version": "11.2.1", + "description": "Core Inquirer prompt API", + "keywords": [ + "answer", + "answers", + "ask", + "base", + "cli", + "command", + "command-line", + "confirm", + "enquirer", + "generate", + "generator", + "hyper", + "input", + "inquire", + "inquirer", + "interface", + "iterm", + "javascript", + "menu", + "node", + "nodejs", + "prompt", + "promptly", + "prompts", + "question", + "readline", + "scaffold", + "scaffolder", + "scaffolding", + "stdin", + "stdout", + "terminal", + "tty", + "ui", + "yeoman", + "yo", + "zsh" + ], + "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/core/README.md", + "license": "MIT", + "author": "Simon Boudrias ", + "repository": { + "type": "git", + "url": "https://github.com/SBoudrias/Inquirer.js.git" + }, + "files": [ + "dist" + ], + "type": "module", + "sideEffects": false, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "tsc": "tsc" + }, + "dependencies": { + "@inquirer/ansi": "^2.0.7", + "@inquirer/figures": "^2.0.7", + "@inquirer/type": "^4.0.7", + "cli-width": "^4.1.0", + "fast-wrap-ansi": "^0.2.0", + "mute-stream": "^3.0.0", + "signal-exit": "^4.1.0" + }, + "devDependencies": { + "@types/mute-stream": "^0.0.4", + "@types/node": "^25.5.2", + "typescript": "^6.0.2" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "gitHead": "b43359d803733b1a7c4638addcc270987fb894c3" +} diff --git a/node_modules/@inquirer/figures/LICENSE b/node_modules/@inquirer/figures/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..f7186988726152b8dfb1bbafe940a712da142e3e --- /dev/null +++ b/node_modules/@inquirer/figures/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2025 Simon Boudrias + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@inquirer/figures/dist/index.d.ts b/node_modules/@inquirer/figures/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f9e48b5e59895121f195a587c13e5b5ac25ecf53 --- /dev/null +++ b/node_modules/@inquirer/figures/dist/index.d.ts @@ -0,0 +1,275 @@ +declare const common: { + circleQuestionMark: string; + questionMarkPrefix: string; + square: string; + squareDarkShade: string; + squareMediumShade: string; + squareLightShade: string; + squareTop: string; + squareBottom: string; + squareLeft: string; + squareRight: string; + squareCenter: string; + bullet: string; + dot: string; + ellipsis: string; + pointerSmall: string; + triangleUp: string; + triangleUpSmall: string; + triangleDown: string; + triangleDownSmall: string; + triangleLeftSmall: string; + triangleRightSmall: string; + home: string; + heart: string; + musicNote: string; + musicNoteBeamed: string; + arrowUp: string; + arrowDown: string; + arrowLeft: string; + arrowRight: string; + arrowLeftRight: string; + arrowUpDown: string; + almostEqual: string; + notEqual: string; + lessOrEqual: string; + greaterOrEqual: string; + identical: string; + infinity: string; + subscriptZero: string; + subscriptOne: string; + subscriptTwo: string; + subscriptThree: string; + subscriptFour: string; + subscriptFive: string; + subscriptSix: string; + subscriptSeven: string; + subscriptEight: string; + subscriptNine: string; + oneHalf: string; + oneThird: string; + oneQuarter: string; + oneFifth: string; + oneSixth: string; + oneEighth: string; + twoThirds: string; + twoFifths: string; + threeQuarters: string; + threeFifths: string; + threeEighths: string; + fourFifths: string; + fiveSixths: string; + fiveEighths: string; + sevenEighths: string; + line: string; + lineBold: string; + lineDouble: string; + lineDashed0: string; + lineDashed1: string; + lineDashed2: string; + lineDashed3: string; + lineDashed4: string; + lineDashed5: string; + lineDashed6: string; + lineDashed7: string; + lineDashed8: string; + lineDashed9: string; + lineDashed10: string; + lineDashed11: string; + lineDashed12: string; + lineDashed13: string; + lineDashed14: string; + lineDashed15: string; + lineVertical: string; + lineVerticalBold: string; + lineVerticalDouble: string; + lineVerticalDashed0: string; + lineVerticalDashed1: string; + lineVerticalDashed2: string; + lineVerticalDashed3: string; + lineVerticalDashed4: string; + lineVerticalDashed5: string; + lineVerticalDashed6: string; + lineVerticalDashed7: string; + lineVerticalDashed8: string; + lineVerticalDashed9: string; + lineVerticalDashed10: string; + lineVerticalDashed11: string; + lineDownLeft: string; + lineDownLeftArc: string; + lineDownBoldLeftBold: string; + lineDownBoldLeft: string; + lineDownLeftBold: string; + lineDownDoubleLeftDouble: string; + lineDownDoubleLeft: string; + lineDownLeftDouble: string; + lineDownRight: string; + lineDownRightArc: string; + lineDownBoldRightBold: string; + lineDownBoldRight: string; + lineDownRightBold: string; + lineDownDoubleRightDouble: string; + lineDownDoubleRight: string; + lineDownRightDouble: string; + lineUpLeft: string; + lineUpLeftArc: string; + lineUpBoldLeftBold: string; + lineUpBoldLeft: string; + lineUpLeftBold: string; + lineUpDoubleLeftDouble: string; + lineUpDoubleLeft: string; + lineUpLeftDouble: string; + lineUpRight: string; + lineUpRightArc: string; + lineUpBoldRightBold: string; + lineUpBoldRight: string; + lineUpRightBold: string; + lineUpDoubleRightDouble: string; + lineUpDoubleRight: string; + lineUpRightDouble: string; + lineUpDownLeft: string; + lineUpBoldDownBoldLeftBold: string; + lineUpBoldDownBoldLeft: string; + lineUpDownLeftBold: string; + lineUpBoldDownLeftBold: string; + lineUpDownBoldLeftBold: string; + lineUpDownBoldLeft: string; + lineUpBoldDownLeft: string; + lineUpDoubleDownDoubleLeftDouble: string; + lineUpDoubleDownDoubleLeft: string; + lineUpDownLeftDouble: string; + lineUpDownRight: string; + lineUpBoldDownBoldRightBold: string; + lineUpBoldDownBoldRight: string; + lineUpDownRightBold: string; + lineUpBoldDownRightBold: string; + lineUpDownBoldRightBold: string; + lineUpDownBoldRight: string; + lineUpBoldDownRight: string; + lineUpDoubleDownDoubleRightDouble: string; + lineUpDoubleDownDoubleRight: string; + lineUpDownRightDouble: string; + lineDownLeftRight: string; + lineDownBoldLeftBoldRightBold: string; + lineDownLeftBoldRightBold: string; + lineDownBoldLeftRight: string; + lineDownBoldLeftBoldRight: string; + lineDownBoldLeftRightBold: string; + lineDownLeftRightBold: string; + lineDownLeftBoldRight: string; + lineDownDoubleLeftDoubleRightDouble: string; + lineDownDoubleLeftRight: string; + lineDownLeftDoubleRightDouble: string; + lineUpLeftRight: string; + lineUpBoldLeftBoldRightBold: string; + lineUpLeftBoldRightBold: string; + lineUpBoldLeftRight: string; + lineUpBoldLeftBoldRight: string; + lineUpBoldLeftRightBold: string; + lineUpLeftRightBold: string; + lineUpLeftBoldRight: string; + lineUpDoubleLeftDoubleRightDouble: string; + lineUpDoubleLeftRight: string; + lineUpLeftDoubleRightDouble: string; + lineUpDownLeftRight: string; + lineUpBoldDownBoldLeftBoldRightBold: string; + lineUpDownBoldLeftBoldRightBold: string; + lineUpBoldDownLeftBoldRightBold: string; + lineUpBoldDownBoldLeftRightBold: string; + lineUpBoldDownBoldLeftBoldRight: string; + lineUpBoldDownLeftRight: string; + lineUpDownBoldLeftRight: string; + lineUpDownLeftBoldRight: string; + lineUpDownLeftRightBold: string; + lineUpBoldDownBoldLeftRight: string; + lineUpDownLeftBoldRightBold: string; + lineUpBoldDownLeftBoldRight: string; + lineUpBoldDownLeftRightBold: string; + lineUpDownBoldLeftBoldRight: string; + lineUpDownBoldLeftRightBold: string; + lineUpDoubleDownDoubleLeftDoubleRightDouble: string; + lineUpDoubleDownDoubleLeftRight: string; + lineUpDownLeftDoubleRightDouble: string; + lineCross: string; + lineBackslash: string; + lineSlash: string; +}; +declare const specialMainSymbols: { + tick: string; + info: string; + warning: string; + cross: string; + squareSmall: string; + squareSmallFilled: string; + circle: string; + circleFilled: string; + circleDotted: string; + circleDouble: string; + circleCircle: string; + circleCross: string; + circlePipe: string; + radioOn: string; + radioOff: string; + checkboxOn: string; + checkboxOff: string; + checkboxCircleOn: string; + checkboxCircleOff: string; + pointer: string; + triangleUpOutline: string; + triangleLeft: string; + triangleRight: string; + lozenge: string; + lozengeOutline: string; + hamburger: string; + smiley: string; + mustache: string; + star: string; + play: string; + nodejs: string; + oneSeventh: string; + oneNinth: string; + oneTenth: string; +}; +declare const specialFallbackSymbols: { + tick: string; + info: string; + warning: string; + cross: string; + squareSmall: string; + squareSmallFilled: string; + circle: string; + circleFilled: string; + circleDotted: string; + circleDouble: string; + circleCircle: string; + circleCross: string; + circlePipe: string; + radioOn: string; + radioOff: string; + checkboxOn: string; + checkboxOff: string; + checkboxCircleOn: string; + checkboxCircleOff: string; + pointer: string; + triangleUpOutline: string; + triangleLeft: string; + triangleRight: string; + lozenge: string; + lozengeOutline: string; + hamburger: string; + smiley: string; + mustache: string; + star: string; + play: string; + nodejs: string; + oneSeventh: string; + oneNinth: string; + oneTenth: string; +}; +export declare const mainSymbols: typeof common & typeof specialMainSymbols; +export declare const fallbackSymbols: (typeof common & typeof specialFallbackSymbols) & Record; +declare const figures: typeof mainSymbols | typeof fallbackSymbols; +export default figures; +export declare const replaceSymbols: (string: string, { useFallback }?: { + useFallback?: boolean; +}) => string; diff --git a/node_modules/@inquirer/figures/dist/index.js b/node_modules/@inquirer/figures/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ad5c60b7180e5a288840533323875b00229d9ae3 --- /dev/null +++ b/node_modules/@inquirer/figures/dist/index.js @@ -0,0 +1,315 @@ +// process.env dot-notation access prints: +// Property 'TERM' comes from an index signature, so it must be accessed with ['TERM'].ts(4111) +/* eslint dot-notation: ["off"] */ +import process from 'node:process'; +// Ported from is-unicode-supported +function isUnicodeSupported() { + if (!process.platform.startsWith('win')) { + return process.env['TERM'] !== 'linux'; // Linux console (kernel) + } + return (Boolean(process.env['CI']) || // CI environments generally support unicode + Boolean(process.env['WT_SESSION']) || // Windows Terminal + Boolean(process.env['TERMINUS_SUBLIME']) || // Terminus (<0.2.27) + process.env['ConEmuTask'] === '{cmd::Cmder}' || // ConEmu and cmder + process.env['TERM_PROGRAM'] === 'Terminus-Sublime' || + process.env['TERM_PROGRAM'] === 'vscode' || + process.env['TERM'] === 'xterm-256color' || + process.env['TERM'] === 'alacritty' || + process.env['TERMINAL_EMULATOR'] === 'JetBrains-JediTerm'); +} +// Ported from figures +const common = { + circleQuestionMark: '(?)', + questionMarkPrefix: '(?)', + square: 'โ–ˆ', + squareDarkShade: 'โ–“', + squareMediumShade: 'โ–’', + squareLightShade: 'โ–‘', + squareTop: 'โ–€', + squareBottom: 'โ–„', + squareLeft: 'โ–Œ', + squareRight: 'โ–', + squareCenter: 'โ– ', + bullet: 'โ—', + dot: 'โ€ค', + ellipsis: 'โ€ฆ', + pointerSmall: 'โ€บ', + triangleUp: 'โ–ฒ', + triangleUpSmall: 'โ–ด', + triangleDown: 'โ–ผ', + triangleDownSmall: 'โ–พ', + triangleLeftSmall: 'โ—‚', + triangleRightSmall: 'โ–ธ', + home: 'โŒ‚', + heart: 'โ™ฅ', + musicNote: 'โ™ช', + musicNoteBeamed: 'โ™ซ', + arrowUp: 'โ†‘', + arrowDown: 'โ†“', + arrowLeft: 'โ†', + arrowRight: 'โ†’', + arrowLeftRight: 'โ†”', + arrowUpDown: 'โ†•', + almostEqual: 'โ‰ˆ', + notEqual: 'โ‰ ', + lessOrEqual: 'โ‰ค', + greaterOrEqual: 'โ‰ฅ', + identical: 'โ‰ก', + infinity: 'โˆž', + subscriptZero: 'โ‚€', + subscriptOne: 'โ‚', + subscriptTwo: 'โ‚‚', + subscriptThree: 'โ‚ƒ', + subscriptFour: 'โ‚„', + subscriptFive: 'โ‚…', + subscriptSix: 'โ‚†', + subscriptSeven: 'โ‚‡', + subscriptEight: 'โ‚ˆ', + subscriptNine: 'โ‚‰', + oneHalf: 'ยฝ', + oneThird: 'โ…“', + oneQuarter: 'ยผ', + oneFifth: 'โ…•', + oneSixth: 'โ…™', + oneEighth: 'โ…›', + twoThirds: 'โ…”', + twoFifths: 'โ…–', + threeQuarters: 'ยพ', + threeFifths: 'โ…—', + threeEighths: 'โ…œ', + fourFifths: 'โ…˜', + fiveSixths: 'โ…š', + fiveEighths: 'โ…', + sevenEighths: 'โ…ž', + line: 'โ”€', + lineBold: 'โ”', + lineDouble: 'โ•', + lineDashed0: 'โ”„', + lineDashed1: 'โ”…', + lineDashed2: 'โ”ˆ', + lineDashed3: 'โ”‰', + lineDashed4: 'โ•Œ', + lineDashed5: 'โ•', + lineDashed6: 'โ•ด', + lineDashed7: 'โ•ถ', + lineDashed8: 'โ•ธ', + lineDashed9: 'โ•บ', + lineDashed10: 'โ•ผ', + lineDashed11: 'โ•พ', + lineDashed12: 'โˆ’', + lineDashed13: 'โ€“', + lineDashed14: 'โ€', + lineDashed15: 'โƒ', + lineVertical: 'โ”‚', + lineVerticalBold: 'โ”ƒ', + lineVerticalDouble: 'โ•‘', + lineVerticalDashed0: 'โ”†', + lineVerticalDashed1: 'โ”‡', + lineVerticalDashed2: 'โ”Š', + lineVerticalDashed3: 'โ”‹', + lineVerticalDashed4: 'โ•Ž', + lineVerticalDashed5: 'โ•', + lineVerticalDashed6: 'โ•ต', + lineVerticalDashed7: 'โ•ท', + lineVerticalDashed8: 'โ•น', + lineVerticalDashed9: 'โ•ป', + lineVerticalDashed10: 'โ•ฝ', + lineVerticalDashed11: 'โ•ฟ', + lineDownLeft: 'โ”', + lineDownLeftArc: 'โ•ฎ', + lineDownBoldLeftBold: 'โ”“', + lineDownBoldLeft: 'โ”’', + lineDownLeftBold: 'โ”‘', + lineDownDoubleLeftDouble: 'โ•—', + lineDownDoubleLeft: 'โ•–', + lineDownLeftDouble: 'โ••', + lineDownRight: 'โ”Œ', + lineDownRightArc: 'โ•ญ', + lineDownBoldRightBold: 'โ”', + lineDownBoldRight: 'โ”Ž', + lineDownRightBold: 'โ”', + lineDownDoubleRightDouble: 'โ•”', + lineDownDoubleRight: 'โ•“', + lineDownRightDouble: 'โ•’', + lineUpLeft: 'โ”˜', + lineUpLeftArc: 'โ•ฏ', + lineUpBoldLeftBold: 'โ”›', + lineUpBoldLeft: 'โ”š', + lineUpLeftBold: 'โ”™', + lineUpDoubleLeftDouble: 'โ•', + lineUpDoubleLeft: 'โ•œ', + lineUpLeftDouble: 'โ•›', + lineUpRight: 'โ””', + lineUpRightArc: 'โ•ฐ', + lineUpBoldRightBold: 'โ”—', + lineUpBoldRight: 'โ”–', + lineUpRightBold: 'โ”•', + lineUpDoubleRightDouble: 'โ•š', + lineUpDoubleRight: 'โ•™', + lineUpRightDouble: 'โ•˜', + lineUpDownLeft: 'โ”ค', + lineUpBoldDownBoldLeftBold: 'โ”ซ', + lineUpBoldDownBoldLeft: 'โ”จ', + lineUpDownLeftBold: 'โ”ฅ', + lineUpBoldDownLeftBold: 'โ”ฉ', + lineUpDownBoldLeftBold: 'โ”ช', + lineUpDownBoldLeft: 'โ”ง', + lineUpBoldDownLeft: 'โ”ฆ', + lineUpDoubleDownDoubleLeftDouble: 'โ•ฃ', + lineUpDoubleDownDoubleLeft: 'โ•ข', + lineUpDownLeftDouble: 'โ•ก', + lineUpDownRight: 'โ”œ', + lineUpBoldDownBoldRightBold: 'โ”ฃ', + lineUpBoldDownBoldRight: 'โ” ', + lineUpDownRightBold: 'โ”', + lineUpBoldDownRightBold: 'โ”ก', + lineUpDownBoldRightBold: 'โ”ข', + lineUpDownBoldRight: 'โ”Ÿ', + lineUpBoldDownRight: 'โ”ž', + lineUpDoubleDownDoubleRightDouble: 'โ• ', + lineUpDoubleDownDoubleRight: 'โ•Ÿ', + lineUpDownRightDouble: 'โ•ž', + lineDownLeftRight: 'โ”ฌ', + lineDownBoldLeftBoldRightBold: 'โ”ณ', + lineDownLeftBoldRightBold: 'โ”ฏ', + lineDownBoldLeftRight: 'โ”ฐ', + lineDownBoldLeftBoldRight: 'โ”ฑ', + lineDownBoldLeftRightBold: 'โ”ฒ', + lineDownLeftRightBold: 'โ”ฎ', + lineDownLeftBoldRight: 'โ”ญ', + lineDownDoubleLeftDoubleRightDouble: 'โ•ฆ', + lineDownDoubleLeftRight: 'โ•ฅ', + lineDownLeftDoubleRightDouble: 'โ•ค', + lineUpLeftRight: 'โ”ด', + lineUpBoldLeftBoldRightBold: 'โ”ป', + lineUpLeftBoldRightBold: 'โ”ท', + lineUpBoldLeftRight: 'โ”ธ', + lineUpBoldLeftBoldRight: 'โ”น', + lineUpBoldLeftRightBold: 'โ”บ', + lineUpLeftRightBold: 'โ”ถ', + lineUpLeftBoldRight: 'โ”ต', + lineUpDoubleLeftDoubleRightDouble: 'โ•ฉ', + lineUpDoubleLeftRight: 'โ•จ', + lineUpLeftDoubleRightDouble: 'โ•ง', + lineUpDownLeftRight: 'โ”ผ', + lineUpBoldDownBoldLeftBoldRightBold: 'โ•‹', + lineUpDownBoldLeftBoldRightBold: 'โ•ˆ', + lineUpBoldDownLeftBoldRightBold: 'โ•‡', + lineUpBoldDownBoldLeftRightBold: 'โ•Š', + lineUpBoldDownBoldLeftBoldRight: 'โ•‰', + lineUpBoldDownLeftRight: 'โ•€', + lineUpDownBoldLeftRight: 'โ•', + lineUpDownLeftBoldRight: 'โ”ฝ', + lineUpDownLeftRightBold: 'โ”พ', + lineUpBoldDownBoldLeftRight: 'โ•‚', + lineUpDownLeftBoldRightBold: 'โ”ฟ', + lineUpBoldDownLeftBoldRight: 'โ•ƒ', + lineUpBoldDownLeftRightBold: 'โ•„', + lineUpDownBoldLeftBoldRight: 'โ•…', + lineUpDownBoldLeftRightBold: 'โ•†', + lineUpDoubleDownDoubleLeftDoubleRightDouble: 'โ•ฌ', + lineUpDoubleDownDoubleLeftRight: 'โ•ซ', + lineUpDownLeftDoubleRightDouble: 'โ•ช', + lineCross: 'โ•ณ', + lineBackslash: 'โ•ฒ', + lineSlash: 'โ•ฑ', +}; +const specialMainSymbols = { + tick: 'โœ”', + info: 'โ„น', + warning: 'โš ', + cross: 'โœ˜', + squareSmall: 'โ—ป', + squareSmallFilled: 'โ—ผ', + circle: 'โ—ฏ', + circleFilled: 'โ—‰', + circleDotted: 'โ—Œ', + circleDouble: 'โ—Ž', + circleCircle: 'โ“ž', + circleCross: 'โ“ง', + circlePipe: 'โ’พ', + radioOn: 'โ—‰', + radioOff: 'โ—ฏ', + checkboxOn: 'โ˜’', + checkboxOff: 'โ˜', + checkboxCircleOn: 'โ“ง', + checkboxCircleOff: 'โ’พ', + pointer: 'โฏ', + triangleUpOutline: 'โ–ณ', + triangleLeft: 'โ—€', + triangleRight: 'โ–ถ', + lozenge: 'โ—†', + lozengeOutline: 'โ—‡', + hamburger: 'โ˜ฐ', + smiley: 'ใ‹ก', + mustache: 'เทด', + star: 'โ˜…', + play: 'โ–ถ', + nodejs: 'โฌข', + oneSeventh: 'โ…', + oneNinth: 'โ…‘', + oneTenth: 'โ…’', +}; +const specialFallbackSymbols = { + tick: 'โˆš', + info: 'i', + warning: 'โ€ผ', + cross: 'ร—', + squareSmall: 'โ–ก', + squareSmallFilled: 'โ– ', + circle: '( )', + circleFilled: '(*)', + circleDotted: '( )', + circleDouble: '( )', + circleCircle: '(โ—‹)', + circleCross: '(ร—)', + circlePipe: '(โ”‚)', + radioOn: '(*)', + radioOff: '( )', + checkboxOn: '[ร—]', + checkboxOff: '[ ]', + checkboxCircleOn: '(ร—)', + checkboxCircleOff: '( )', + pointer: '>', + triangleUpOutline: 'โˆ†', + triangleLeft: 'โ—„', + triangleRight: 'โ–บ', + lozenge: 'โ™ฆ', + lozengeOutline: 'โ—Š', + hamburger: 'โ‰ก', + smiley: 'โ˜บ', + mustache: 'โ”Œโ”€โ”', + star: 'โœถ', + play: 'โ–บ', + nodejs: 'โ™ฆ', + oneSeventh: '1/7', + oneNinth: '1/9', + oneTenth: '1/10', +}; +export const mainSymbols = { + ...common, + ...specialMainSymbols, +}; +export const fallbackSymbols = { + ...common, + ...specialFallbackSymbols, +}; +const shouldUseMain = isUnicodeSupported(); +const figures = shouldUseMain + ? mainSymbols + : fallbackSymbols; +export default figures; +const replacements = Object.entries(specialMainSymbols); +// On terminals which do not support Unicode symbols, substitute them to other symbols +export const replaceSymbols = (string, { useFallback = !shouldUseMain } = {}) => { + if (useFallback) { + for (const [key, mainSymbol] of replacements) { + const fallbackSymbol = fallbackSymbols[key]; + if (!fallbackSymbol) { + throw new Error(`Unable to find fallback for ${key}`); + } + string = string.replaceAll(mainSymbol, fallbackSymbol); + } + } + return string; +}; diff --git a/node_modules/@inquirer/figures/package.json b/node_modules/@inquirer/figures/package.json new file mode 100644 index 0000000000000000000000000000000000000000..262ca7808ad4b853f98fc2359be97889c5b1ad16 --- /dev/null +++ b/node_modules/@inquirer/figures/package.json @@ -0,0 +1,80 @@ +{ + "name": "@inquirer/figures", + "version": "2.0.7", + "description": "Vendored version of figures, for CJS compatibility", + "keywords": [ + "answer", + "answers", + "ask", + "base", + "cli", + "command", + "command-line", + "confirm", + "enquirer", + "generate", + "generator", + "hyper", + "input", + "inquire", + "inquirer", + "interface", + "iterm", + "javascript", + "menu", + "node", + "nodejs", + "prompt", + "promptly", + "prompts", + "question", + "readline", + "scaffold", + "scaffolder", + "scaffolding", + "stdin", + "stdout", + "terminal", + "tty", + "types", + "typescript", + "ui", + "yeoman", + "yo", + "zsh" + ], + "license": "MIT", + "author": "Simon Boudrias ", + "repository": { + "type": "git", + "url": "https://github.com/SBoudrias/Inquirer.js.git" + }, + "files": [ + "dist" + ], + "type": "module", + "sideEffects": false, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "tsc": "tsc" + }, + "devDependencies": { + "@types/node": "^25.5.2", + "typescript": "^6.0.2" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "gitHead": "b43359d803733b1a7c4638addcc270987fb894c3" +} diff --git a/node_modules/@inquirer/type/LICENSE b/node_modules/@inquirer/type/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..f7186988726152b8dfb1bbafe940a712da142e3e --- /dev/null +++ b/node_modules/@inquirer/type/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2025 Simon Boudrias + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@inquirer/type/dist/index.d.ts b/node_modules/@inquirer/type/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..611714bd893bb6ceb9591ae90b25b98e3fb6c8ba --- /dev/null +++ b/node_modules/@inquirer/type/dist/index.d.ts @@ -0,0 +1,2 @@ +export * from './inquirer.ts'; +export * from './utils.ts'; diff --git a/node_modules/@inquirer/type/dist/index.js b/node_modules/@inquirer/type/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e5adf2cebe00efd432da5dbc3597d467a5e21176 --- /dev/null +++ b/node_modules/@inquirer/type/dist/index.js @@ -0,0 +1,2 @@ +export * from "./inquirer.js"; +export * from "./utils.js"; diff --git a/node_modules/@inquirer/type/dist/inquirer.d.ts b/node_modules/@inquirer/type/dist/inquirer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..354329b6db725f2e531e852daf9fbe61344c7c51 --- /dev/null +++ b/node_modules/@inquirer/type/dist/inquirer.d.ts @@ -0,0 +1,35 @@ +import { Duplex } from 'node:stream'; +/** + * `InquirerReadline` is a re-implementation of `readline.Interface` from Node.js. + * We're reimplementing it because of 3 reasons: + * 1. The `readline.Interface` API is not complete; it's missing for example `clearLine`. + * 2. The input/output streams are not generics, meaning they're inexact. + * 3. Since ReadLine isn't built-in Typescript Global NodeJS type, it'd force us to ship `@types/node` as a dependency to all users. + */ +export type InquirerReadline = { + output: Duplex & { + mute: () => void; + unmute: () => void; + }; + input: NodeJS.ReadableStream; + clearLine: (dir: 0 | 1 | -1) => void; + getCursorPos: () => { + rows: number; + cols: number; + }; + setPrompt: (prompt: string) => void; + line: string; + write: (data: string) => void; + on: (event: string, listener: (...args: unknown[]) => void) => void; + removeListener: (event: string, listener: (...args: unknown[]) => void) => void; + pause: () => void; + resume: () => void; + close: () => void; +}; +export type Context = { + input?: NodeJS.ReadableStream; + output?: NodeJS.WritableStream; + clearPromptOnDone?: boolean; + signal?: AbortSignal; +}; +export type Prompt = (config: Config, context?: Context) => Promise; diff --git a/node_modules/@inquirer/type/dist/inquirer.js b/node_modules/@inquirer/type/dist/inquirer.js new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/node_modules/@inquirer/type/dist/inquirer.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@inquirer/type/dist/utils.d.ts b/node_modules/@inquirer/type/dist/utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c37eb73af13648aa19eb0d77df8e93bb4e9af944 --- /dev/null +++ b/node_modules/@inquirer/type/dist/utils.d.ts @@ -0,0 +1,29 @@ +type Key = string | number | symbol; +export type Prettify = { + [K in keyof T]: T[K]; +} & {}; +export type PartialDeep = T extends object ? { + [P in keyof T]?: PartialDeep; +} : T; +export type LiteralUnion = T | (F & {}); +export type KeyUnion = LiteralUnion>; +export type DistributiveMerge = A extends any ? Prettify & B> : never; +export type UnionToIntersection = (T extends any ? (input: T) => void : never) extends (input: infer Intersection) => void ? Intersection : never; +/** + * @hidden + */ +type __Pick = { + [P in K]: O[P]; +} & {}; +/** + * @hidden + */ +export type _Pick = __Pick; +/** + * Extract out of `O` the fields of key `K` + * @param O to extract from + * @param K to chose fields + * @returns [[Object]] + */ +export type Pick = O extends unknown ? _Pick : never; +export {}; diff --git a/node_modules/@inquirer/type/dist/utils.js b/node_modules/@inquirer/type/dist/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..79413320c6e7f7f1a92966521f381ae5aa345c38 --- /dev/null +++ b/node_modules/@inquirer/type/dist/utils.js @@ -0,0 +1,2 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +export {}; diff --git a/node_modules/@inquirer/type/package.json b/node_modules/@inquirer/type/package.json new file mode 100644 index 0000000000000000000000000000000000000000..72d0ec08dd83b64be396a9c6817522d3fb95738a --- /dev/null +++ b/node_modules/@inquirer/type/package.json @@ -0,0 +1,87 @@ +{ + "name": "@inquirer/type", + "version": "4.0.7", + "description": "Inquirer core TS types", + "keywords": [ + "answer", + "answers", + "ask", + "base", + "cli", + "command", + "command-line", + "confirm", + "enquirer", + "generate", + "generator", + "hyper", + "input", + "inquire", + "inquirer", + "interface", + "iterm", + "javascript", + "menu", + "node", + "nodejs", + "prompt", + "promptly", + "prompts", + "question", + "readline", + "scaffold", + "scaffolder", + "scaffolding", + "stdin", + "stdout", + "terminal", + "tty", + "types", + "typescript", + "ui", + "yeoman", + "yo", + "zsh" + ], + "license": "MIT", + "author": "Simon Boudrias ", + "repository": { + "type": "git", + "url": "https://github.com/SBoudrias/Inquirer.js.git" + }, + "files": [ + "dist" + ], + "type": "module", + "sideEffects": false, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "tsc": "tsc" + }, + "devDependencies": { + "typescript": "^6.0.2" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "gitHead": "b43359d803733b1a7c4638addcc270987fb894c3" +} diff --git a/node_modules/@istanbuljs/schema/CHANGELOG.md b/node_modules/@istanbuljs/schema/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..ca157d91034c2a7d02d075e79797fde974d4168c --- /dev/null +++ b/node_modules/@istanbuljs/schema/CHANGELOG.md @@ -0,0 +1,65 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [0.1.6](https://github.com/istanbuljs/schema/compare/v0.1.5...v0.1.6) (2026-04-13) + + +### Bug Fixes + +* Undo change to schema in 0.1.x series ([440f977](https://github.com/istanbuljs/schema/commit/440f977adc826fa51aa5eba06ee4d89065ca4261)) + +## [0.1.5](https://github.com/istanbuljs/schema/compare/v0.1.4...v0.1.5) (2026-04-13) + + +### Bug Fixes + +* Re-add release-please ([7c25461](https://github.com/istanbuljs/schema/commit/7c25461ac00d69b843d6a3e112a279164fc972b9)) + +## [0.1.4](https://github.com/istanbuljs/schema/compare/v0.1.3...v0.1.4) (2026-04-13) + + +### Bug Fixes + +* Remove development dependencies ([a24b4c1](https://github.com/istanbuljs/schema/commit/a24b4c1bccf65f63e7f1fe6bd82bed82e57abc80)) + +### [0.1.3](https://github.com/istanbuljs/schema/compare/v0.1.2...v0.1.3) (2021-02-13) + + +### Features + +* Add `classPrivateMethods` and `topLevelAwait` default support ([#17](https://github.com/istanbuljs/schema/issues/17)) ([e732889](https://github.com/istanbuljs/schema/commit/e7328894ddeb61da256c1f13c2c2cc2e04f181df)), closes [#16](https://github.com/istanbuljs/schema/issues/16) +* Add `numericSeparator` to default `parserPlugins` ([#12](https://github.com/istanbuljs/schema/issues/12)) ([fe32f00](https://github.com/istanbuljs/schema/commit/fe32f002f54c61467b1c1a487081f51c85ec8d10)), closes [#5](https://github.com/istanbuljs/schema/issues/5) +* Add babel.config.mjs to default exclude ([#10](https://github.com/istanbuljs/schema/issues/10)) ([a4dbeaa](https://github.com/istanbuljs/schema/commit/a4dbeaa7045490a4d46754801ac71f5d99c9bd79)) + + +### Bug Fixes + +* Exclude tests with `tsx` or `jsx` extensions ([#13](https://github.com/istanbuljs/schema/issues/13)) ([c7747f7](https://github.com/istanbuljs/schema/commit/c7747f7a7df8a2b770036834af77dfd0ee445733)), closes [#11](https://github.com/istanbuljs/schema/issues/11) + +### [0.1.2](https://github.com/istanbuljs/schema/compare/v0.1.1...v0.1.2) (2019-12-05) + + +### Features + +* Ignore *.d.ts ([#6](https://github.com/istanbuljs/schema/issues/6)) ([d867eaf](https://github.com/istanbuljs/schema/commit/d867eaff6ca4abcd4301990e2bdcdf53e438e9c4)) +* Update default exclude of dev tool configurations ([#7](https://github.com/istanbuljs/schema/issues/7)) ([c89f818](https://github.com/istanbuljs/schema/commit/c89f8185f30879bcdf8d2f1c3b7aba0ac7056fa9)) + +## [0.1.1](https://github.com/istanbuljs/schema/compare/v0.1.0...v0.1.1) (2019-10-07) + + +### Bug Fixes + +* Add missing `instrument` option ([#3](https://github.com/istanbuljs/schema/issues/3)) ([bf1217d](https://github.com/istanbuljs/schema/commit/bf1217d)) + + +### Features + +* Add `use-spawn-wrap` nyc option ([#4](https://github.com/istanbuljs/schema/issues/4)) ([b2ce2e8](https://github.com/istanbuljs/schema/commit/b2ce2e8)) + +## 0.1.0 (2019-10-05) + + +### Features + +* Initial implementation ([99bd3a5](https://github.com/istanbuljs/schema/commit/99bd3a5)) diff --git a/node_modules/@istanbuljs/schema/LICENSE b/node_modules/@istanbuljs/schema/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..807a18bdbcb7d9c43d4e6a77f9d502b6fb486205 --- /dev/null +++ b/node_modules/@istanbuljs/schema/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 CFWare, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@istanbuljs/schema/README.md b/node_modules/@istanbuljs/schema/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c21b4d3d2b18de8cbee2e9efc6e3c56b13deca71 --- /dev/null +++ b/node_modules/@istanbuljs/schema/README.md @@ -0,0 +1,42 @@ +# @istanbuljs/schema + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![MIT][license-image]](LICENSE) + +Schemas describing various structures used by nyc and istanbuljs + +## Usage + +```js +const {nyc} = require('@istanbuljs/schema').defaults; + +console.log(`Default exclude list:\n\t* ${nyc.exclude.join('\n\t* ')}`); +``` + +## Testing + +- **Runtime support**: See `engines.node` in `package.json` (currently `>=8`). +- **Running tests**: Requires **Node.js >=22.3.0** (uses `node:test` snapshot testing via `t.assert.snapshot`). + +```bash +npm test +``` + +To update snapshots: + +```bash +npm run test:update-snapshots +``` + +## `@istanbuljs/schema` for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of `@istanbuljs/schema` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-istanbuljs-schema?utm_source=npm-istanbuljs-schema&utm_medium=referral&utm_campaign=enterprise) + +[npm-image]: https://img.shields.io/npm/v/@istanbuljs/schema.svg +[npm-url]: https://npmjs.org/package/@istanbuljs/schema +[downloads-image]: https://img.shields.io/npm/dm/@istanbuljs/schema.svg +[downloads-url]: https://npmjs.org/package/@istanbuljs/schema +[license-image]: https://img.shields.io/npm/l/@istanbuljs/schema.svg diff --git a/node_modules/@istanbuljs/schema/default-exclude.js b/node_modules/@istanbuljs/schema/default-exclude.js new file mode 100644 index 0000000000000000000000000000000000000000..c6bb526444f7b700479bee3c6e4bab6f1ae2a8c4 --- /dev/null +++ b/node_modules/@istanbuljs/schema/default-exclude.js @@ -0,0 +1,22 @@ +'use strict'; + +const defaultExtension = require('./default-extension.js'); +const testFileExtensions = defaultExtension + .map(extension => extension.slice(1)) + .join(','); + +module.exports = [ + 'coverage/**', + 'packages/*/test{,s}/**', + '**/*.d.ts', + 'test{,s}/**', + `test{,-*}.{${testFileExtensions}}`, + `**/*{.,-}test.{${testFileExtensions}}`, + '**/__tests__/**', + + /* Exclude common development tool configuration files */ + '**/{ava,babel,nyc}.config.{js,cjs,mjs}', + '**/jest.config.{js,cjs,mjs,ts}', + '**/{karma,rollup,webpack}.config.js', + '**/.{eslint,mocha}rc.{js,cjs}' +]; diff --git a/node_modules/@istanbuljs/schema/default-extension.js b/node_modules/@istanbuljs/schema/default-extension.js new file mode 100644 index 0000000000000000000000000000000000000000..46ebadca52b3814419833081c50a81110520e8b6 --- /dev/null +++ b/node_modules/@istanbuljs/schema/default-extension.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = [ + '.js', + '.cjs', + '.mjs', + '.ts', + '.tsx', + '.jsx' +]; diff --git a/node_modules/@istanbuljs/schema/index.js b/node_modules/@istanbuljs/schema/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b35f6101a313ac8c11216d9b866d809b0f399b79 --- /dev/null +++ b/node_modules/@istanbuljs/schema/index.js @@ -0,0 +1,466 @@ +'use strict'; + +const defaultExclude = require('./default-exclude.js'); +const defaultExtension = require('./default-extension.js'); + +const nycCommands = { + all: [null, 'check-coverage', 'instrument', 'merge', 'report'], + testExclude: [null, 'instrument', 'report', 'check-coverage'], + instrument: [null, 'instrument'], + checkCoverage: [null, 'report', 'check-coverage'], + report: [null, 'report'], + main: [null], + instrumentOnly: ['instrument'] +}; + +const cwd = { + description: 'working directory used when resolving paths', + type: 'string', + get default() { + return process.cwd(); + }, + nycCommands: nycCommands.all +}; + +const nycrcPath = { + description: 'specify an explicit path to find nyc configuration', + nycCommands: nycCommands.all +}; + +const tempDir = { + description: 'directory to output raw coverage information to', + type: 'string', + default: './.nyc_output', + nycAlias: 't', + nycHiddenAlias: 'temp-directory', + nycCommands: [null, 'check-coverage', 'merge', 'report'] +}; + +const testExclude = { + exclude: { + description: 'a list of specific files and directories that should be excluded from coverage, glob patterns are supported', + type: 'array', + items: { + type: 'string' + }, + default: defaultExclude, + nycCommands: nycCommands.testExclude, + nycAlias: 'x' + }, + excludeNodeModules: { + description: 'whether or not to exclude all node_module folders (i.e. **/node_modules/**) by default', + type: 'boolean', + default: true, + nycCommands: nycCommands.testExclude + }, + include: { + description: 'a list of specific files that should be covered, glob patterns are supported', + type: 'array', + items: { + type: 'string' + }, + default: [], + nycCommands: nycCommands.testExclude, + nycAlias: 'n' + }, + extension: { + description: 'a list of extensions that nyc should handle in addition to .js', + type: 'array', + items: { + type: 'string' + }, + default: defaultExtension, + nycCommands: nycCommands.testExclude, + nycAlias: 'e' + } +}; + +const instrumentVisitor = { + coverageVariable: { + description: 'variable to store coverage', + type: 'string', + default: '__coverage__', + nycCommands: nycCommands.instrument + }, + coverageGlobalScope: { + description: 'scope to store the coverage variable', + type: 'string', + default: 'this', + nycCommands: nycCommands.instrument + }, + coverageGlobalScopeFunc: { + description: 'avoid potentially replaced `Function` when finding global scope', + type: 'boolean', + default: true, + nycCommands: nycCommands.instrument + }, + ignoreClassMethods: { + description: 'class method names to ignore for coverage', + type: 'array', + items: { + type: 'string' + }, + default: [], + nycCommands: nycCommands.instrument + } +}; + +const instrumentParseGen = { + autoWrap: { + description: 'allow `return` statements outside of functions', + type: 'boolean', + default: true, + nycCommands: nycCommands.instrument + }, + esModules: { + description: 'should files be treated as ES Modules', + type: 'boolean', + default: true, + nycCommands: nycCommands.instrument + }, + parserPlugins: { + description: 'babel parser plugins to use when parsing the source', + type: 'array', + items: { + type: 'string' + }, + /* Babel parser plugins are to be enabled when the feature is stage 3 and + * implemented in a released version of node.js. */ + default: [ + 'asyncGenerators', + 'bigInt', + 'classProperties', + 'classPrivateProperties', + 'classPrivateMethods', + 'dynamicImport', + 'importMeta', + 'numericSeparator', + 'objectRestSpread', + 'optionalCatchBinding', + 'topLevelAwait' + ], + nycCommands: nycCommands.instrument + }, + compact: { + description: 'should the output be compacted?', + type: 'boolean', + default: true, + nycCommands: nycCommands.instrument + }, + preserveComments: { + description: 'should comments be preserved in the output?', + type: 'boolean', + default: true, + nycCommands: nycCommands.instrument + }, + produceSourceMap: { + description: 'should source maps be produced?', + type: 'boolean', + default: true, + nycCommands: nycCommands.instrument + } +}; + +const checkCoverage = { + excludeAfterRemap: { + description: 'should exclude logic be performed after the source-map remaps filenames?', + type: 'boolean', + default: true, + nycCommands: nycCommands.checkCoverage + }, + branches: { + description: 'what % of branches must be covered?', + type: 'number', + default: 0, + minimum: 0, + maximum: 100, + nycCommands: nycCommands.checkCoverage + }, + functions: { + description: 'what % of functions must be covered?', + type: 'number', + default: 0, + minimum: 0, + maximum: 100, + nycCommands: nycCommands.checkCoverage + }, + lines: { + description: 'what % of lines must be covered?', + type: 'number', + default: 90, + minimum: 0, + maximum: 100, + nycCommands: nycCommands.checkCoverage + }, + statements: { + description: 'what % of statements must be covered?', + type: 'number', + default: 0, + minimum: 0, + maximum: 100, + nycCommands: nycCommands.checkCoverage + }, + perFile: { + description: 'check thresholds per file', + type: 'boolean', + default: false, + nycCommands: nycCommands.checkCoverage + } +}; + +const report = { + checkCoverage: { + description: 'check whether coverage is within thresholds provided', + type: 'boolean', + default: false, + nycCommands: nycCommands.report + }, + reporter: { + description: 'coverage reporter(s) to use', + type: 'array', + items: { + type: 'string' + }, + default: ['text'], + nycCommands: nycCommands.report, + nycAlias: 'r' + }, + reportDir: { + description: 'directory to output coverage reports in', + type: 'string', + default: 'coverage', + nycCommands: nycCommands.report + }, + showProcessTree: { + description: 'display the tree of spawned processes', + type: 'boolean', + default: false, + nycCommands: nycCommands.report + }, + skipEmpty: { + description: 'don\'t show empty files (no lines of code) in report', + type: 'boolean', + default: false, + nycCommands: nycCommands.report + }, + skipFull: { + description: 'don\'t show files with 100% statement, branch, and function coverage', + type: 'boolean', + default: false, + nycCommands: nycCommands.report + } +}; + +const nycMain = { + silent: { + description: 'don\'t output a report after tests finish running', + type: 'boolean', + default: false, + nycCommands: nycCommands.main, + nycAlias: 's' + }, + all: { + description: 'whether or not to instrument all files of the project (not just the ones touched by your test suite)', + type: 'boolean', + default: false, + nycCommands: nycCommands.main, + nycAlias: 'a' + }, + eager: { + description: 'instantiate the instrumenter at startup (see https://git.io/vMKZ9)', + type: 'boolean', + default: false, + nycCommands: nycCommands.main + }, + cache: { + description: 'cache instrumentation results for improved performance', + type: 'boolean', + default: true, + nycCommands: nycCommands.main, + nycAlias: 'c' + }, + cacheDir: { + description: 'explicitly set location for instrumentation cache', + type: 'string', + nycCommands: nycCommands.main + }, + babelCache: { + description: 'cache babel transpilation results for improved performance', + type: 'boolean', + default: false, + nycCommands: nycCommands.main + }, + useSpawnWrap: { + description: 'use spawn-wrap instead of setting process.env.NODE_OPTIONS', + type: 'boolean', + default: false, + nycCommands: nycCommands.main + }, + hookRequire: { + description: 'should nyc wrap require?', + type: 'boolean', + default: true, + nycCommands: nycCommands.main + }, + hookRunInContext: { + description: 'should nyc wrap vm.runInContext?', + type: 'boolean', + default: false, + nycCommands: nycCommands.main + }, + hookRunInThisContext: { + description: 'should nyc wrap vm.runInThisContext?', + type: 'boolean', + default: false, + nycCommands: nycCommands.main + }, + clean: { + description: 'should the .nyc_output folder be cleaned before executing tests', + type: 'boolean', + default: true, + nycCommands: nycCommands.main + } +}; + +const instrumentOnly = { + inPlace: { + description: 'should nyc run the instrumentation in place?', + type: 'boolean', + default: false, + nycCommands: nycCommands.instrumentOnly + }, + exitOnError: { + description: 'should nyc exit when an instrumentation failure occurs?', + type: 'boolean', + default: false, + nycCommands: nycCommands.instrumentOnly + }, + delete: { + description: 'should the output folder be deleted before instrumenting files?', + type: 'boolean', + default: false, + nycCommands: nycCommands.instrumentOnly + }, + completeCopy: { + description: 'should nyc copy all files from input to output as well as instrumented files?', + type: 'boolean', + default: false, + nycCommands: nycCommands.instrumentOnly + } +}; + +const nyc = { + description: 'nyc configuration options', + type: 'object', + properties: { + cwd, + nycrcPath, + tempDir, + + /* Test Exclude */ + ...testExclude, + + /* Instrumentation settings */ + ...instrumentVisitor, + + /* Instrumentation parser/generator settings */ + ...instrumentParseGen, + sourceMap: { + description: 'should nyc detect and handle source maps?', + type: 'boolean', + default: true, + nycCommands: nycCommands.instrument + }, + require: { + description: 'a list of additional modules that nyc should attempt to require in its subprocess, e.g., @babel/register, @babel/polyfill', + type: 'array', + items: { + type: 'string' + }, + default: [], + nycCommands: nycCommands.instrument, + nycAlias: 'i' + }, + instrument: { + description: 'should nyc handle instrumentation?', + type: 'boolean', + default: true, + nycCommands: nycCommands.instrument + }, + + /* Check coverage */ + ...checkCoverage, + + /* Report options */ + ...report, + + /* Main command options */ + ...nycMain, + + /* Instrument command options */ + ...instrumentOnly + } +}; + +const configs = { + nyc, + testExclude: { + description: 'test-exclude options', + type: 'object', + properties: { + cwd, + ...testExclude + } + }, + babelPluginIstanbul: { + description: 'babel-plugin-istanbul options', + type: 'object', + properties: { + cwd, + ...testExclude, + ...instrumentVisitor + } + }, + instrumentVisitor: { + description: 'instrument visitor options', + type: 'object', + properties: instrumentVisitor + }, + instrumenter: { + description: 'stand-alone instrumenter options', + type: 'object', + properties: { + ...instrumentVisitor, + ...instrumentParseGen + } + } +}; + +function defaultsReducer(defaults, [name, {default: value}]) { + /* Modifying arrays in defaults is safe, does not change schema. */ + if (Array.isArray(value)) { + value = [...value]; + } + + return Object.assign(defaults, {[name]: value}); +} + +module.exports = { + ...configs, + defaults: Object.keys(configs).reduce( + (defaults, id) => { + Object.defineProperty(defaults, id, { + enumerable: true, + get() { + /* This defers `process.cwd()` until defaults are requested. */ + return Object.entries(configs[id].properties) + .filter(([, info]) => 'default' in info) + .reduce(defaultsReducer, {}); + } + }); + + return defaults; + }, + {} + ) +}; diff --git a/node_modules/@istanbuljs/schema/package.json b/node_modules/@istanbuljs/schema/package.json new file mode 100644 index 0000000000000000000000000000000000000000..251ceac61ad711b1952375688e40564e9efe2fb9 --- /dev/null +++ b/node_modules/@istanbuljs/schema/package.json @@ -0,0 +1,26 @@ +{ + "name": "@istanbuljs/schema", + "version": "0.1.6", + "description": "Schemas describing various structures used by nyc and istanbuljs", + "main": "index.js", + "scripts": { + "test": "nyc node --test test/test.js", + "test:update-snapshots": "nyc node --test --test-update-snapshots test/test.js" + }, + "engines": { + "node": ">=8" + }, + "author": "Corey Farrell", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/istanbuljs/schema.git" + }, + "bugs": { + "url": "https://github.com/istanbuljs/schema/issues" + }, + "homepage": "https://github.com/istanbuljs/schema#readme", + "devDependencies": { + "nyc": "^18.0.0" + } +} diff --git a/node_modules/@jimp/core/.tshy/build.json b/node_modules/@jimp/core/.tshy/build.json new file mode 100644 index 0000000000000000000000000000000000000000..aea1a9e93b5db3468973ebeaad6dac0a77b10c02 --- /dev/null +++ b/node_modules/@jimp/core/.tshy/build.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../src", + "module": "nodenext", + "moduleResolution": "nodenext" + } +} diff --git a/node_modules/@jimp/core/.tshy/commonjs.json b/node_modules/@jimp/core/.tshy/commonjs.json new file mode 100644 index 0000000000000000000000000000000000000000..75bcfc1d756dcb1baafc973385c81c5aa93f3174 --- /dev/null +++ b/node_modules/@jimp/core/.tshy/commonjs.json @@ -0,0 +1,17 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.cts", + "../src/**/*.tsx", + "../src/**/*.json" + ], + "exclude": [ + "../**/*.test.ts", + "../src/**/*.mts", + "../src/package.json" + ], + "compilerOptions": { + "outDir": "../.tshy-build/commonjs" + } +} diff --git a/node_modules/@jimp/core/.tshy/esm.json b/node_modules/@jimp/core/.tshy/esm.json new file mode 100644 index 0000000000000000000000000000000000000000..fdc4fa775818876f2e8f6cd606e9bb337515ac56 --- /dev/null +++ b/node_modules/@jimp/core/.tshy/esm.json @@ -0,0 +1,16 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.mts", + "../src/**/*.tsx", + "../src/**/*.json" + ], + "exclude": [ + "../**/*.test.ts", + "../src/package.json" + ], + "compilerOptions": { + "outDir": "../.tshy-build/esm" + } +} diff --git a/node_modules/@jimp/core/CHANGELOG.md b/node_modules/@jimp/core/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..c81a00f097d656cb921764cdbc6b9913fd5499a6 --- /dev/null +++ b/node_modules/@jimp/core/CHANGELOG.md @@ -0,0 +1,164 @@ +# v1.6.1 (Tue Apr 07 2026) + +:tada: This release contains work from a new contributor! :tada: + +Thank you, Denys Kashkovskyi ([@Kashkovsky](https://github.com/Kashkovsky)), for all your work! + +#### ๐Ÿ› Bug Fix + +- Update file-type from ^16 to ^21.3.3 in @jimp/core [#1400](https://github.com/jimp-dev/jimp/pull/1400) ([@Kashkovsky](https://github.com/Kashkovsky) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### โš ๏ธ Pushed to `main` + +- Doc updates (closes #1342) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Denys Kashkovskyi ([@Kashkovsky](https://github.com/Kashkovsky)) + +--- + +# v1.5.0 (Sat Sep 07 2024) + +### Release Notes + +#### Add support for image decoder options ([#1336](https://github.com/jimp-dev/jimp/pull/1336)) + +Can now have options for the underlying image codecs + +![CleanShot 2024-09-07 at 15 26 41](https://github.com/user-attachments/assets/26fa1a48-f463-455c-89f9-9c99f9fcb3d1) + +--- + +#### ๐Ÿš€ Enhancement + +- Add support for image decoder options [#1336](https://github.com/jimp-dev/jimp/pull/1336) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.4.0 (Sat Sep 07 2024) + +#### ๐Ÿš€ Enhancement + +- Let Jimp.read accept a Buffer [#1332](https://github.com/jimp-dev/jimp/pull/1332) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### โš ๏ธ Pushed to `main` + +- fix docs build ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.3.0 (Wed Sep 04 2024) + +#### ๐Ÿš€ Enhancement + +- Add width/height/mime getters [#1327](https://github.com/jimp-dev/jimp/pull/1327) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.2.0 (Tue Sep 03 2024) + +#### ๐Ÿš€ Enhancement + +- Add webp, avid, png, jpeg WASM format plugin [#1324](https://github.com/jimp-dev/jimp/pull/1324) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.1.5 (Mon Sep 02 2024) + +#### โš ๏ธ Pushed to `main` + +- Fix height/width being undefined when creating a Jimp from a canvas ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.1.3 (Mon Sep 02 2024) + +#### ๐Ÿ› Bug Fix + +- Update deps [#1319](https://github.com/jimp-dev/jimp/pull/1319) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.1.1 (Sun Sep 01 2024) + +#### ๐Ÿ› Bug Fix + +- fix file-type import for esm projects [#1309](https://github.com/jimp-dev/jimp/pull/1309) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.1.0 (Sun Sep 01 2024) + +#### โš ๏ธ Pushed to `main` + +- upgrade tshy ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.0.3 (Sat Aug 31 2024) + +:tada: This release contains work from a new contributor! :tada: + +Thank you, Ben McCann ([@benmccann](https://github.com/benmccann)), for all your work! + +#### ๐Ÿ› Bug Fix + +- remove hundreds of unused dependencies [#1302](https://github.com/jimp-dev/jimp/pull/1302) ([@benmccann](https://github.com/benmccann) [@hipstersmoothie](https://github.com/hipstersmoothie)) +- Fix build [#1303](https://github.com/jimp-dev/jimp/pull/1303) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### โš ๏ธ Pushed to `main` + +- add clean script ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Ben McCann ([@benmccann](https://github.com/benmccann)) + +--- + +# v1.0.2 (Sat Aug 31 2024) + +#### โš ๏ธ Pushed to `main` + +- set side effects ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- fix versions ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- add publish config ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) diff --git a/node_modules/@jimp/core/LICENSE b/node_modules/@jimp/core/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..baa5d48509a18b9ab4f6c39289362690ea68e688 --- /dev/null +++ b/node_modules/@jimp/core/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Oliver Moran + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@jimp/core/dist/commonjs/index.d.ts b/node_modules/@jimp/core/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0edd2fc3cd9f9cb47efdba6b4ba3cfe72c30cb84 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/index.d.ts @@ -0,0 +1,1904 @@ +import { Bitmap, Format, JimpClass, Edge } from "@jimp/types"; +import { BlendMode } from "./index.js"; +export { getExifOrientation } from "./utils/image-bitmap.js"; +export { composite } from "./utils/composite.js"; +export * from "./utils/constants.js"; +export interface RawImageData { + width: number; + height: number; + data: Buffer | Uint8Array | Uint8ClampedArray | number[]; +} +/** + * Instead of loading an image into an instance you can initialize a new Jimp instance with a empty bitmap. + */ +export interface JimpSimpleConstructorOptions { + height: number; + width: number; + /** + * Initialize the image with a color for each pixel + */ + color?: number | string; +} +export type JimpConstructorOptions = Bitmap | JimpSimpleConstructorOptions; +/** Converts a jimp plugin function to a Jimp class method */ +type JimpInstanceMethod = Method extends JimpChainableMethod ? (...args: Args) => JimpInstanceMethods & ClassInstance : Method extends JimpMethod ? (...args: Args) => Return : never; +/** Converts a Record of jimp plugin functions to a Record of Jimp class methods */ +export type JimpInstanceMethods = { + [Key in keyof MethodMap]: JimpInstanceMethod; +}; +/** A Jimp instance method that can be chained. */ +type JimpChainableMethod = (img: J, ...args: Args) => J; +/** A Jimp instance method that returns anything. */ +type JimpMethod = (img: J, ...args: Args) => ReturnType; +export interface JimpPlugin { + [key: string]: JimpChainableMethod | JimpMethod; +} +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type Constructor = new (...args: any[]) => T; +type JimpFormat | undefined = undefined, DecodeOptions extends Record | undefined = undefined, T extends Format = Format> = () => T; +type CreateMimeTypeToExportOptions> = T extends Format ? Record : never; +type CreateMimeTypeToDecodeOptions> = T extends Format ? Record : never; +type GetOptionsForMimeType = MimeTypeMap extends Record ? O : never; +type MimeToExtension = `${string}/${M}`; +type CreateExtensionToMimeType = M extends MimeToExtension ? Record : never; +type GetMimeTypeForExtension = MimeTypeMap extends Record ? M : never; +/** + * Create a Jimp class that support the given image formats and methods + */ +export declare function createJimp({ plugins: pluginsArg, formats: formatsArg, }?: { + /** Plugins that add methods to the created Jimp class */ + plugins?: Methods; + /** Image formats the Jimp class should support */ + formats?: Formats; +}): { + new (options?: JimpConstructorOptions): { + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + }; + /** + * Create a Jimp instance from a URL, a file path, or a Buffer + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * // Read from a file path + * const image = await Jimp.read("test/image.png"); + * + * // Read from a URL + * const image = await Jimp.read("https://upload.wikimedia.org/wikipedia/commons/0/01/Bot-Test.jpg"); + * ``` + */ + read(url: string | Buffer | ArrayBuffer, options?: CreateMimeTypeToDecodeOptions>): Promise<{ + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + } & JimpInstanceMethods<{ + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + }, UnionToIntersection>>; + /** + * Create a Jimp instance from a bitmap. + * The difference between this and just using the constructor is that this will + * convert raw image data into the bitmap format that Jimp uses. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBitmap({ + * data: Buffer.from([ + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * ]), + * width: 3, + * height: 3, + * }); + * ``` + */ + fromBitmap(bitmap: RawImageData): InstanceType & JimpInstanceMethods<{ + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + }, UnionToIntersection>; + /** + * Parse a bitmap with the loaded image types. + * + * @param buffer Raw image data + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const buffer = await fs.readFile("test/image.png"); + * const image = await Jimp.fromBuffer(buffer); + * ``` + */ + fromBuffer(buffer: Buffer | ArrayBuffer, options?: CreateMimeTypeToDecodeOptions>): Promise<{ + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + } & JimpInstanceMethods<{ + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + }, UnionToIntersection>>; +} & Constructor[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone>): Promise>>; + /** + * Create a Jimp instance from a bitmap. + * The difference between this and just using the constructor is that this will + * convert raw image data into the bitmap format that Jimp uses. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBitmap({ + * data: Buffer.from([ + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * ]), + * width: 3, + * height: 3, + * }); + * ``` + */ + fromBitmap(bitmap: RawImageData): InstanceType & JimpInstanceMethods>; + /** + * Parse a bitmap with the loaded image types. + * + * @param buffer Raw image data + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const buffer = await fs.readFile("test/image.png"); + * const image = await Jimp.fromBuffer(buffer); + * ``` + */ + fromBuffer(buffer: Buffer | ArrayBuffer, options?: CreateMimeTypeToDecodeOptions>): Promise>>; + }>(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; +}, UnionToIntersection>>; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/index.d.ts.map b/node_modules/@jimp/core/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..73f2e40f5b07571840ff859796e5973a0ce7f1eb --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAO9D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAgCvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,cAAc,sBAAsB,CAAC;AAErC,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,iBAAiB,GAA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,MAAM;IAe/C;;;;;;;;;;;;;OAaG;;IAcH;;;;;;;;;;;;;;;OAeG;cACO,CAAC,wDAIA;QACP,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;IAKH;;;;;;;;;;;;;;;;;;OAkBG;YACK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,GAAG;IAnBlD;;;;;;;;;;;;;;;;;;OAkBG;YAGE,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACL,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,GAAG;IAYhD;;;;;;;;;;;;;;;;OAgBG;;;;;;;yCAc+D,CACrE"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/index.js b/node_modules/@jimp/core/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4202f9e4462673096952c4d244681108a7e37cb3 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/index.js @@ -0,0 +1,534 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.composite = exports.getExifOrientation = void 0; +exports.createJimp = createJimp; +const types_1 = require("@jimp/types"); +const utils_1 = require("@jimp/utils"); +const await_to_js_1 = require("await-to-js"); +const file_ops_1 = require("@jimp/file-ops"); +const lite_js_1 = __importDefault(require("mime/lite.js")); +const composite_js_1 = require("./utils/composite.js"); +const image_bitmap_js_1 = require("./utils/image-bitmap.js"); +const emptyBitmap = { + data: Buffer.alloc(0), + width: 0, + height: 0, +}; +/** + * Prepare a Buffer object from the arrayBuffer. + */ +function bufferFromArrayBuffer(arrayBuffer) { + const buffer = Buffer.alloc(arrayBuffer.byteLength); + const view = new Uint8Array(arrayBuffer); + for (let i = 0; i < buffer.length; ++i) { + buffer[i] = view[i]; + } + return buffer; +} +async function detectFileTypeFromBuffer(buffer) { + const { fileTypeFromBuffer } = await import("file-type"); + return fileTypeFromBuffer(buffer instanceof ArrayBuffer + ? buffer + : new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength)); +} +var image_bitmap_js_2 = require("./utils/image-bitmap.js"); +Object.defineProperty(exports, "getExifOrientation", { enumerable: true, get: function () { return image_bitmap_js_2.getExifOrientation; } }); +var composite_js_2 = require("./utils/composite.js"); +Object.defineProperty(exports, "composite", { enumerable: true, get: function () { return composite_js_2.composite; } }); +__exportStar(require("./utils/constants.js"), exports); +/** + * Create a Jimp class that support the given image formats and methods + */ +function createJimp({ plugins: pluginsArg, formats: formatsArg, } = {}) { + const plugins = pluginsArg || []; + const formats = (formatsArg || []).map((format) => format()); + const CustomJimp = class Jimp { + /** + * The bitmap data of the image + */ + bitmap = emptyBitmap; + /** Default color to use for new pixels */ + background = 0x00000000; + /** Formats that can be used with Jimp */ + formats = []; + /** The original MIME type of the image */ + mime; + constructor(options = emptyBitmap) { + // Add the formats + this.formats = formats; + if ("data" in options) { + this.bitmap = options; + } + else { + this.bitmap = { + data: Buffer.alloc(options.width * options.height * 4), + width: options.width, + height: options.height, + }; + if (options.color) { + this.background = + typeof options.color === "string" + ? (0, utils_1.cssColorToHex)(options.color) + : options.color; + for (let i = 0; i < this.bitmap.data.length; i += 4) { + this.bitmap.data.writeUInt32BE(this.background, i); + } + } + } + // Add the plugins + for (const methods of plugins) { + for (const key in methods) { + this[key] = (...args) => { + const result = methods[key]?.(this, ...args); + if (typeof result === "object" && "bitmap" in result) { + this.bitmap = result.bitmap; + return this; + } + return result; + }; + } + } + } + /** + * Create a Jimp instance from a URL, a file path, or a Buffer + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * // Read from a file path + * const image = await Jimp.read("test/image.png"); + * + * // Read from a URL + * const image = await Jimp.read("https://upload.wikimedia.org/wikipedia/commons/0/01/Bot-Test.jpg"); + * ``` + */ + static async read(url, options) { + if (Buffer.isBuffer(url) || url instanceof ArrayBuffer) { + return this.fromBuffer(url); + } + if ((0, file_ops_1.existsSync)(url)) { + return this.fromBuffer(await (0, file_ops_1.readFile)(url)); + } + const [fetchErr, response] = await (0, await_to_js_1.to)(fetch(url)); + if (fetchErr) { + throw new Error(`Could not load Buffer from URL: ${url}`); + } + if (!response.ok) { + throw new Error(`HTTP Status ${response.status} for url ${url}`); + } + const [arrayBufferErr, data] = await (0, await_to_js_1.to)(response.arrayBuffer()); + if (arrayBufferErr) { + throw new Error(`Could not load Buffer from ${url}`); + } + const buffer = bufferFromArrayBuffer(data); + return this.fromBuffer(buffer, options); + } + /** + * Create a Jimp instance from a bitmap. + * The difference between this and just using the constructor is that this will + * convert raw image data into the bitmap format that Jimp uses. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBitmap({ + * data: Buffer.from([ + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * ]), + * width: 3, + * height: 3, + * }); + * ``` + */ + static fromBitmap(bitmap) { + let data; + if (bitmap.data instanceof Buffer) { + data = Buffer.from(bitmap.data); + } + if (bitmap.data instanceof Uint8Array || + bitmap.data instanceof Uint8ClampedArray) { + data = Buffer.from(bitmap.data.buffer); + } + if (Array.isArray(bitmap.data)) { + data = Buffer.concat(bitmap.data.map((hex) => Buffer.from(hex.toString(16).padStart(8, "0"), "hex"))); + } + if (!data) { + throw new Error("data must be a Buffer"); + } + if (typeof bitmap.height !== "number" || + typeof bitmap.width !== "number") { + throw new Error("bitmap must have width and height"); + } + return new CustomJimp({ + height: bitmap.height, + width: bitmap.width, + data, + }); + } + /** + * Parse a bitmap with the loaded image types. + * + * @param buffer Raw image data + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const buffer = await fs.readFile("test/image.png"); + * const image = await Jimp.fromBuffer(buffer); + * ``` + */ + static async fromBuffer(buffer, options) { + const actualBuffer = buffer instanceof ArrayBuffer ? bufferFromArrayBuffer(buffer) : buffer; + const mime = await detectFileTypeFromBuffer(actualBuffer); + if (!mime || !mime.mime) { + throw new Error("Could not find MIME for Buffer"); + } + const format = formats.find((format) => format.mime === mime.mime); + if (!format || !format.decode) { + throw new Error(`Mime type ${mime.mime} does not support decoding`); + } + const image = new CustomJimp(await format.decode(actualBuffer, options?.[format.mime])); + image.mime = mime.mime; + (0, image_bitmap_js_1.attemptExifRotate)(image, actualBuffer); + return image; + } + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect() { + return (""); + } + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString() { + return "[object Jimp]"; + } + /** Get the width of the image */ + get width() { + return this.bitmap.width; + } + /** Get the height of the image */ + get height() { + return this.bitmap.height; + } + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + async getBuffer(mime, options) { + const format = this.formats.find((format) => format.mime === mime); + if (!format || !format.encode) { + throw new Error(`Unsupported MIME type: ${mime}`); + } + let outputImage; + if (format.hasAlpha) { + // eslint-disable-next-line @typescript-eslint/no-this-alias + outputImage = this; + } + else { + outputImage = new CustomJimp({ + width: this.bitmap.width, + height: this.bitmap.height, + color: this.background, + }); + (0, composite_js_1.composite)(outputImage, this); + } + return format.encode(outputImage.bitmap, options); + } + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + async getBase64(mime, options) { + const data = await this.getBuffer(mime, options); + return "data:" + mime + ";base64," + data.toString("base64"); + } + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + async write(path, options) { + const mimeType = lite_js_1.default.getType(path); + await (0, file_ops_1.writeFile)(path, await this.getBuffer(mimeType, options)); + } + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone() { + return new CustomJimp({ + ...this.bitmap, + data: Buffer.from(this.bitmap.data), + }); + } + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x, y, edgeHandling) { + let xi; + let yi; + if (!edgeHandling) { + edgeHandling = types_1.Edge.EXTEND; + } + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + // round input + x = Math.round(x); + y = Math.round(y); + xi = x; + yi = y; + if (edgeHandling === types_1.Edge.EXTEND) { + if (x < 0) + xi = 0; + if (x >= this.bitmap.width) + xi = this.bitmap.width - 1; + if (y < 0) + yi = 0; + if (y >= this.bitmap.height) + yi = this.bitmap.height - 1; + } + if (edgeHandling === types_1.Edge.WRAP) { + if (x < 0) { + xi = this.bitmap.width + x; + } + if (x >= this.bitmap.width) { + xi = x % this.bitmap.width; + } + if (y < 0) { + yi = this.bitmap.height + y; + } + if (y >= this.bitmap.height) { + yi = y % this.bitmap.height; + } + } + let i = (this.bitmap.width * yi + xi) << 2; + // if out of bounds index is -1 + if (xi < 0 || xi >= this.bitmap.width) { + i = -1; + } + if (yi < 0 || yi >= this.bitmap.height) { + i = -1; + } + return i; + } + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x, y) { + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + const idx = this.getPixelIndex(x, y); + return this.bitmap.data.readUInt32BE(idx); + } + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex, x, y) { + if (typeof hex !== "number" || + typeof x !== "number" || + typeof y !== "number") { + throw new Error("hex, x and y must be numbers"); + } + const idx = this.getPixelIndex(x, y); + this.bitmap.data.writeUInt32BE(hex, idx); + return this; + } + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha() { + const { width, height, data } = this.bitmap; + const byteLen = (width * height) << 2; + for (let idx = 3; idx < byteLen; idx += 4) { + if (data[idx] !== 0xff) { + return true; + } + } + return false; + } + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src, x = 0, y = 0, options = {}) { + return (0, composite_js_1.composite)(this, src, x, y, options); + } + scan(x, y, w, h, f) { + return (0, utils_1.scan)(this, x, y, w, h, f); + } + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x = 0, y = 0, w = this.bitmap.width, h = this.bitmap.height) { + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + if (typeof w !== "number" || typeof h !== "number") { + throw new Error("w and h must be numbers"); + } + return (0, utils_1.scanIterator)(this, x, y, w, h); + } + }; + return CustomJimp; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/index.js.map b/node_modules/@jimp/core/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1311c254b79eac3f56807a40315001a71b1dde5a --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAuIA,gCAyoBC;AAhxBD,uCAA8D;AAC9D,uCAAgE;AAChE,6CAAiC;AACjC,6CAAiE;AACjE,2DAAgC;AAEhC,uDAAiD;AAEjD,6DAA4D;AAE5D,MAAM,WAAW,GAAW;IAC1B,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACV,CAAC;AAEF;;GAEG;AACH,SAAS,qBAAqB,CAAC,WAAwB;IACrD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IAEzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACvC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;IACvB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,wBAAwB,CAAC,MAA4B;IAClE,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;IACzD,OAAO,kBAAkB,CACvB,MAAM,YAAY,WAAW;QAC3B,CAAC,CAA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CAA8C;YAE9C,OAAO,IAAA,YAAI,EAAC,IAAI,EAAE,CAAQ,EAAE,CAAQ,EAAE,CAAQ,EAAE,CAAQ,EAAE,CAAQ,CAAC,CAAC;QACtE,CAAC;QAED;;;;;;;;;;;;;;;;WAgBG;QACH,YAAY,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM;YACtE,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACnD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7C,CAAC;YAED,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACnD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7C,CAAC;YAED,OAAO,IAAA,oBAAY,EAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;IAEF,OAAO,UAA6D,CAAC;AACvE,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/package.json b/node_modules/@jimp/core/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.d.ts b/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b28491b194a5380ff5a883a18196d8f0f5fa1c1d --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.d.ts @@ -0,0 +1,70 @@ +import { RGBAColor } from "@jimp/types"; +export declare function srcOver(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function dstOver(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function multiply(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function add(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function screen(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function overlay(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function darken(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function lighten(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function hardLight(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function difference(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function exclusion(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare const names: readonly [typeof srcOver, typeof dstOver, typeof multiply, typeof add, typeof screen, typeof overlay, typeof darken, typeof lighten, typeof hardLight, typeof difference, typeof exclusion]; +export type CompositeMode = (typeof names)[number]; +//# sourceMappingURL=composite-modes.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.d.ts.map b/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..0d8ce73b73fadb2a29ab98ea2e00dd5e3a725611 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"composite-modes.d.ts","sourceRoot":"","sources":["../../../src/utils/composite-mod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K,CAAC,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.js b/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.js new file mode 100644 index 0000000000000000000000000000000000000000..0827d6a2acd2d7e7caa23dd4d805307883566445 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.js @@ -0,0 +1,236 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.names = void 0; +exports.srcOver = srcOver; +exports.dstOver = dstOver; +exports.multiply = multiply; +exports.add = add; +exports.screen = screen; +exports.overlay = overlay; +exports.darken = darken; +exports.lighten = lighten; +exports.hardLight = hardLight; +exports.difference = difference; +exports.exclusion = exclusion; +function srcOver(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a; + const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a; + const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a; + return { r, g, b, a }; +} +function dstOver(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a; + const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a; + const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a; + return { r, g, b, a }; +} +function multiply(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + return { r, g, b, a }; +} +function add(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra + dra) / a; + const g = (sga + dga) / a; + const b = (sba + dba) / a; + return { r, g, b, a }; +} +function screen(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dst.a + + dra * src.a - + sra * dra + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = (sga * dst.a + + dga * src.a - + sga * dga + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = (sba * dst.a + + dba * src.a - + sba * dba + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + return { r, g, b, a }; +} +function overlay(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (2 * dra <= dst.a + ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) + : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / + a; + const g = (2 * dga <= dst.a + ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) + : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / + a; + const b = (2 * dba <= dst.a + ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) + : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / + a; + return { r, g, b, a }; +} +function darken(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (Math.min(sra * dst.a, dra * src.a) + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = (Math.min(sga * dst.a, dga * src.a) + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = (Math.min(sba * dst.a, dba * src.a) + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + return { r, g, b, a }; +} +function lighten(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (Math.max(sra * dst.a, dra * src.a) + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = (Math.max(sga * dst.a, dga * src.a) + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = (Math.max(sba * dst.a, dba * src.a) + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + return { r, g, b, a }; +} +function hardLight(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (2 * sra <= src.a + ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) + : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / + a; + const g = (2 * sga <= src.a + ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) + : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / + a; + const b = (2 * sba <= src.a + ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) + : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / + a; + return { r, g, b, a }; +} +function difference(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a; + const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a; + const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a; + return { r, g, b, a }; +} +function exclusion(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dst.a + + dra * src.a - + 2 * sra * dra + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = (sga * dst.a + + dga * src.a - + 2 * sga * dga + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = (sba * dst.a + + dba * src.a - + 2 * sba * dba + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + return { r, g, b, a }; +} +exports.names = [ + srcOver, + dstOver, + multiply, + add, + screen, + overlay, + darken, + lighten, + hardLight, + difference, + exclusion, +]; +//# sourceMappingURL=composite-modes.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.js.map b/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.js.map new file mode 100644 index 0000000000000000000000000000000000000000..afe45c9df67ce75c8b9c084df5c6d13b42eb4834 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/composite-modes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"composite-modes.js","sourceRoot":"","sources":["../../../src/utils/composite-modes.ts"],"names":[],"mappings":";;;AAEA,0BAUC;AAED,0BAUC;AAED,4BAkBC;AAED,kBAkBC;AAED,wBAoCC;AAED,0BAgCC;AAED,wBA8BC;AAED,0BA8BC;AAED,8BAgCC;AAED,gCAkBC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CAAC,EAAE,CAAC,EAAE,CAAC;AACxB,CAAC;AAEY,QAAA,KAAK,GAAG;IACnB,OAAO;IACP,OAAO;IACP,QAAQ;IACR,GAAG;IACH,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,UAAU;IACV,SAAS;CACD,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/composite.d.ts b/node_modules/@jimp/core/dist/commonjs/utils/composite.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0b43b27502a9da533a8c45ccdac27b553e4fc941 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/composite.d.ts @@ -0,0 +1,8 @@ +import { JimpClass } from "@jimp/types"; +import { BlendMode } from "./constants.js"; +export declare function composite(baseImage: I, src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; +}): I; +//# sourceMappingURL=composite.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/composite.d.ts.map b/node_modules/@jimp/core/dist/commonjs/utils/composite.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7d0a0f0cfcdffcc7eae7e8219f79fe8d17749a44 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/composite.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"composite.d.ts","sourceRoot":"","sources":["../../../src/utils/composite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,SAAS,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI3C,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,EAC3C,SAAS,EAAE,CAAC,EACZ,GAAG,EAAE,CAAC,EACN,CAAC,SAAI,EACL,CAAC,SAAI,EACL,OAAO,GAAE;IACP,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACjB,KAqEP"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/composite.js b/node_modules/@jimp/core/dist/commonjs/utils/composite.js new file mode 100644 index 0000000000000000000000000000000000000000..af4b22d9267478e564a65e2e04182a9d03ba0182 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/composite.js @@ -0,0 +1,82 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.composite = composite; +const types_1 = require("@jimp/types"); +const constants_js_1 = require("./constants.js"); +const compositeModes = __importStar(require("./composite-modes.js")); +const utils_1 = require("@jimp/utils"); +function composite(baseImage, src, x = 0, y = 0, options = {}) { + if (!(src instanceof baseImage.constructor)) { + throw new Error("The source must be a Jimp image"); + } + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + const { mode = constants_js_1.BlendMode.SRC_OVER } = options; + let { opacitySource = 1.0, opacityDest = 1.0 } = options; + if (typeof opacitySource !== "number" || + opacitySource < 0 || + opacitySource > 1) { + opacitySource = 1.0; + } + if (typeof opacityDest !== "number" || opacityDest < 0 || opacityDest > 1) { + opacityDest = 1.0; + } + const blendmode = compositeModes[mode]; + // round input + x = Math.round(x); + y = Math.round(y); + if (opacityDest !== 1.0) { + baseImage.scan((_, __, idx) => { + const v = baseImage.bitmap.data[idx + 3] * opacityDest; + baseImage.bitmap.data[idx + 3] = v; + }); + } + src.scan((sx, sy, idx) => { + const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, types_1.Edge.CROP); + if (dstIdx === -1) { + // Skip target pixels outside of dst + return; + } + const blended = blendmode({ + r: src.bitmap.data[idx + 0] / 255, + g: src.bitmap.data[idx + 1] / 255, + b: src.bitmap.data[idx + 2] / 255, + a: src.bitmap.data[idx + 3] / 255, + }, { + r: baseImage.bitmap.data[dstIdx + 0] / 255, + g: baseImage.bitmap.data[dstIdx + 1] / 255, + b: baseImage.bitmap.data[dstIdx + 2] / 255, + a: baseImage.bitmap.data[dstIdx + 3] / 255, + }, opacitySource); + baseImage.bitmap.data[dstIdx + 0] = (0, utils_1.limit255)(blended.r * 255); + baseImage.bitmap.data[dstIdx + 1] = (0, utils_1.limit255)(blended.g * 255); + baseImage.bitmap.data[dstIdx + 2] = (0, utils_1.limit255)(blended.b * 255); + baseImage.bitmap.data[dstIdx + 3] = (0, utils_1.limit255)(blended.a * 255); + }); + return baseImage; +} +//# sourceMappingURL=composite.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/composite.js.map b/node_modules/@jimp/core/dist/commonjs/utils/composite.js.map new file mode 100644 index 0000000000000000000000000000000000000000..50092ac4ea6d9876a9da7e66714d830c00e4d2c5 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/composite.js.map @@ -0,0 +1 @@ +{"version":3,"file":"composite.js","sourceRoot":"","sources":["../../../src/utils/composite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,8BA8EC;AApFD,uCAA8C;AAE9C,iDAA2C;AAC3C,qEAAuD;AACvD,uCAAuC;AAEvC,SAAgB,SAAS,CACvB,SAAY,EACZ,GAAM,E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AAA,gBAAQ,EAAC,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;QAC9D,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAA,gBAAQ,EAAC,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;QAC9D,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAA,gBAAQ,EAAC,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;QAC9D,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAA,gBAAQ,EAAC,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/constants.d.ts b/node_modules/@jimp/core/dist/commonjs/utils/constants.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d569e5c8fca764aa00039d5499346a318191a7c3 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/constants.d.ts @@ -0,0 +1,85 @@ +export declare enum HorizontalAlign { + LEFT = 1, + CENTER = 2, + RIGHT = 4 +} +export declare enum VerticalAlign { + TOP = 8, + MIDDLE = 16, + BOTTOM = 32 +} +/** + * How to blend two images together + */ +export declare enum BlendMode { + /** + * Composite the source image over the destination image. + * This is the default value. It represents the most intuitive case, where shapes are painted on top of what is below, with transparent areas showing the destination layer. + */ + SRC_OVER = "srcOver", + /** Composite the source image under the destination image. */ + DST_OVER = "dstOver", + /** + * Multiply the color components of the source and destination images. + * This can only result in the same or darker colors (multiplying by white, 1.0, results in no change; multiplying by black, 0.0, results in black). + * When compositing two opaque images, this has similar effect to overlapping two transparencies on a projector. + * + * This mode is useful for coloring shadows. + */ + MULTIPLY = "multiply", + /** + * The Add mode adds the color information of the base layers and the blending layer. + * In digital terms, adding color increases the brightness. + */ + ADD = "add", + /** + * Multiply the inverse of the components of the source and destination images, and inverse the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * This is essentially the same as modulate blend mode, but with the values of the colors inverted before the multiplication and the result being inverted back before rendering. + * This can only result in the same or lighter colors (multiplying by black, 1.0, results in no change; multiplying by white, 0.0, results in white). Similarly, in the alpha channel, it can only result in more opaque colors. + * This has similar effect to two projectors displaying their images on the same screen simultaneously. + */ + SCREEN = "screen", + /** + * Multiply the components of the source and destination images after adjusting them to favor the destination. + * Specifically, if the destination value is smaller, this multiplies it with the source value, whereas is the source value is smaller, it multiplies the inverse of the source value with the inverse of the destination value, then inverts the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * + * The Overlay mode behaves like Screen mode in bright areas, and like Multiply mode in darker areas. + * With this mode, the bright areas will look brighter and the dark areas will look darker. + */ + OVERLAY = "overlay", + /** + * Composite the source and destination image by choosing the lowest value from each color channel. + * The opacity of the output image is computed in the same way as for srcOver. + */ + DARKEN = "darken", + /** + * Composite the source and destination image by choosing the highest value from each color channel. + * The opacity of the output image is computed in the same way as for srcOver. + */ + LIGHTEN = "lighten", + /** + * Multiply the components of the source and destination images after adjusting them to favor the source. + * Specifically, if the source value is smaller, this multiplies it with the destination value, whereas is the destination value is smaller, it multiplies the inverse of the destination value with the inverse of the source value, then inverts the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * + * The effect of the Hard light mode depends on the density of the superimposed color. Using bright colors on the blending layer will create a brighter effect like the Screen modes, while dark colors will create darker colors like the Multiply mode. + */ + HARD_LIGHT = "hardLight", + /** + * Subtract the smaller value from the bigger value for each channel. + * Compositing black has no effect; compositing white inverts the colors of the other image. + * The opacity of the output image is computed in the same way as for srcOver. + * The effect is similar to exclusion but harsher. + */ + DIFFERENCE = "difference", + /** + * Subtract double the product of the two images from the sum of the two images. + * Compositing black has no effect; compositing white inverts the colors of the other image. + * The opacity of the output image is computed in the same way as for srcOver. + * The effect is similar to difference but softer. + */ + EXCLUSION = "exclusion" +} +//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/constants.d.ts.map b/node_modules/@jimp/core/dist/commonjs/utils/constants.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..baf76c785a81fa96f83e724f263d14b2fb767478 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/constants.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AACA,oBAAY,eAAe;IACzB,IAAI,IAAI;IACR,MAAM,IAAI;IACV,KAAK,IAAI;CACV;AAGD,oBAAY,aAAa;IACvB,GAAG,IAAI;IACP,MAAM,KAAK;IACX,MAAM,KAAK;CACZ;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB;;;OAGG;IACH,QAAQ,YAAY;IACpB,8DAA8D;IAC9D,QAAQ,YAAY;IACpB;;;;;;OAMG;IACH,QAAQ,aAAa;IACrB;;;OAGG;IACH,GAAG,QAAQ;IACX;;;;;;OAMG;IACH,MAAM,WAAW;IACjB;;;;;;;OAOG;IACH,OAAO,YAAY;IACnB;;;OAGG;IACH,MAAM,WAAW;IACjB;;;OAGG;IACH,OAAO,YAAY;IACnB;;;;;;OAMG;IACH,UAAU,cAAc;IACxB;;;;;OAKG;IACH,UAAU,eAAe;IACzB;;;;;OAKG;IACH,SAAS,cAAc;CACxB"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/constants.js b/node_modules/@jimp/core/dist/commonjs/utils/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..a17d9e0082dd8fb3a0fb52fb36ea7480ecd7678e --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/constants.js @@ -0,0 +1,93 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BlendMode = exports.VerticalAlign = exports.HorizontalAlign = void 0; +/* Horizontal align modes for cover, contain, bit masks */ +var HorizontalAlign; +(function (HorizontalAlign) { + HorizontalAlign[HorizontalAlign["LEFT"] = 1] = "LEFT"; + HorizontalAlign[HorizontalAlign["CENTER"] = 2] = "CENTER"; + HorizontalAlign[HorizontalAlign["RIGHT"] = 4] = "RIGHT"; +})(HorizontalAlign || (exports.HorizontalAlign = HorizontalAlign = {})); +/* Vertical align modes for cover, contain, bit masks */ +var VerticalAlign; +(function (VerticalAlign) { + VerticalAlign[VerticalAlign["TOP"] = 8] = "TOP"; + VerticalAlign[VerticalAlign["MIDDLE"] = 16] = "MIDDLE"; + VerticalAlign[VerticalAlign["BOTTOM"] = 32] = "BOTTOM"; +})(VerticalAlign || (exports.VerticalAlign = VerticalAlign = {})); +/** + * How to blend two images together + */ +var BlendMode; +(function (BlendMode) { + /** + * Composite the source image over the destination image. + * This is the default value. It represents the most intuitive case, where shapes are painted on top of what is below, with transparent areas showing the destination layer. + */ + BlendMode["SRC_OVER"] = "srcOver"; + /** Composite the source image under the destination image. */ + BlendMode["DST_OVER"] = "dstOver"; + /** + * Multiply the color components of the source and destination images. + * This can only result in the same or darker colors (multiplying by white, 1.0, results in no change; multiplying by black, 0.0, results in black). + * When compositing two opaque images, this has similar effect to overlapping two transparencies on a projector. + * + * This mode is useful for coloring shadows. + */ + BlendMode["MULTIPLY"] = "multiply"; + /** + * The Add mode adds the color information of the base layers and the blending layer. + * In digital terms, adding color increases the brightness. + */ + BlendMode["ADD"] = "add"; + /** + * Multiply the inverse of the components of the source and destination images, and inverse the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * This is essentially the same as modulate blend mode, but with the values of the colors inverted before the multiplication and the result being inverted back before rendering. + * This can only result in the same or lighter colors (multiplying by black, 1.0, results in no change; multiplying by white, 0.0, results in white). Similarly, in the alpha channel, it can only result in more opaque colors. + * This has similar effect to two projectors displaying their images on the same screen simultaneously. + */ + BlendMode["SCREEN"] = "screen"; + /** + * Multiply the components of the source and destination images after adjusting them to favor the destination. + * Specifically, if the destination value is smaller, this multiplies it with the source value, whereas is the source value is smaller, it multiplies the inverse of the source value with the inverse of the destination value, then inverts the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * + * The Overlay mode behaves like Screen mode in bright areas, and like Multiply mode in darker areas. + * With this mode, the bright areas will look brighter and the dark areas will look darker. + */ + BlendMode["OVERLAY"] = "overlay"; + /** + * Composite the source and destination image by choosing the lowest value from each color channel. + * The opacity of the output image is computed in the same way as for srcOver. + */ + BlendMode["DARKEN"] = "darken"; + /** + * Composite the source and destination image by choosing the highest value from each color channel. + * The opacity of the output image is computed in the same way as for srcOver. + */ + BlendMode["LIGHTEN"] = "lighten"; + /** + * Multiply the components of the source and destination images after adjusting them to favor the source. + * Specifically, if the source value is smaller, this multiplies it with the destination value, whereas is the destination value is smaller, it multiplies the inverse of the destination value with the inverse of the source value, then inverts the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * + * The effect of the Hard light mode depends on the density of the superimposed color. Using bright colors on the blending layer will create a brighter effect like the Screen modes, while dark colors will create darker colors like the Multiply mode. + */ + BlendMode["HARD_LIGHT"] = "hardLight"; + /** + * Subtract the smaller value from the bigger value for each channel. + * Compositing black has no effect; compositing white inverts the colors of the other image. + * The opacity of the output image is computed in the same way as for srcOver. + * The effect is similar to exclusion but harsher. + */ + BlendMode["DIFFERENCE"] = "difference"; + /** + * Subtract double the product of the two images from the sum of the two images. + * Compositing black has no effect; compositing white inverts the colors of the other image. + * The opacity of the output image is computed in the same way as for srcOver. + * The effect is similar to difference but softer. + */ + BlendMode["EXCLUSION"] = "exclusion"; +})(BlendMode || (exports.BlendMode = BlendMode = {})); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/constants.js.map b/node_modules/@jimp/core/dist/commonjs/utils/constants.js.map new file mode 100644 index 0000000000000000000000000000000000000000..935c2f932399cbad5907247ecf0c512e3a8dafca --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAA,0DAA0D;AAC1D,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,qDAAQ,CAAA;IACR,yDAAU,CAAA;IACV,uDAAS,CAAA;AACX,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B;AAED,wDAAwD;AACxD,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,+CAAO,CAAA;IACP,sDAAW,CAAA;IACX,sDAAW,CAAA;AACb,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAED;;GAEG;AACH,IAAY,SAsEX;AAtED,WAAY,SAAS;IACnB;;;OAGG;IACH,iCAAoB,CAAA;IACpB,8DAA8D;IAC9D,iCAAoB,CAAA;IACpB;;;;;;OAMG;IACH,kCAAqB,CAAA;IACrB;;;OAGG;IACH,wBAAW,CAAA;IACX;;;;;;OAMG;IACH,8BAAiB,CAAA;IACjB;;;;;;;OAOG;IACH,gCAAmB,CAAA;IACnB;;;OAGG;IACH,8BAAiB,CAAA;IACjB;;;OAGG;IACH,gCAAmB,CAAA;IACnB;;;;;;OAMG;IACH,qCAAwB,CAAA;IACxB;;;;;OAKG;IACH,sCAAyB,CAAA;IACzB;;;;;OAKG;IACH,oCAAuB,CAAA;AACzB,CAAC,EAtEW,SAAS,yBAAT,SAAS,QAsEpB"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.d.ts b/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..014a08bc32548161c179f02eab498411f8a80472 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.d.ts @@ -0,0 +1,11 @@ +import { JimpClass } from "@jimp/types"; +/** + * Obtains image orientation from EXIF metadata. + * + * @param img a Jimp image object + * @returns a number 1-8 representing EXIF orientation, + * in particular 1 if orientation tag is missing + */ +export declare function getExifOrientation(img: I): number; +export declare function attemptExifRotate(image: I, buffer: Buffer): Promise; +//# sourceMappingURL=image-bitmap.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.d.ts.map b/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..9e976b5c3b453402f935efa7a5c20fa57cd30bb1 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"image-bitmap.d.ts","sourceRoot":"","sources":["../../../src/utils/image-bitmap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,CAAC,UAG7D;AA+HD,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,SAAS,EACzD,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,MAAM,iBAUf"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.js b/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.js new file mode 100644 index 0000000000000000000000000000000000000000..ce4daafc3cb28eb82a78af3762e8764b8cb7e06d --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.js @@ -0,0 +1,129 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getExifOrientation = getExifOrientation; +exports.attemptExifRotate = attemptExifRotate; +const exif_parser_1 = __importDefault(require("exif-parser")); +/** + * Obtains image orientation from EXIF metadata. + * + * @param img a Jimp image object + * @returns a number 1-8 representing EXIF orientation, + * in particular 1 if orientation tag is missing + */ +function getExifOrientation(img) { + const _exif = img._exif; + return (_exif && _exif.tags && _exif.tags.Orientation) || 1; +} +/** + * Returns a function which translates EXIF-rotated coordinates into + * non-rotated ones. + * + * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html. + * + * @param img a Jimp image object + * @returns transformation function for transformBitmap(). + */ +function getExifOrientationTransformation(img) { + const w = img.bitmap.width; + const h = img.bitmap.height; + switch (getExifOrientation(img)) { + case 1: // Horizontal (normal) + // does not need to be supported here + return null; + case 2: // Mirror horizontal + return function (x, y) { + return [w - x - 1, y]; + }; + case 3: // Rotate 180 + return function (x, y) { + return [w - x - 1, h - y - 1]; + }; + case 4: // Mirror vertical + return function (x, y) { + return [x, h - y - 1]; + }; + case 5: // Mirror horizontal and rotate 270 CW + return function (x, y) { + return [y, x]; + }; + case 6: // Rotate 90 CW + return function (x, y) { + return [y, h - x - 1]; + }; + case 7: // Mirror horizontal and rotate 90 CW + return function (x, y) { + return [w - y - 1, h - x - 1]; + }; + case 8: // Rotate 270 CW + return function (x, y) { + return [w - y - 1, x]; + }; + default: + return null; + } +} +/** + * Transforms bitmap in place (moves pixels around) according to given + * transformation function. + * + * @param img a Jimp image object, which bitmap is supposed to + * be transformed + * @param width bitmap width after the transformation + * @param height bitmap height after the transformation + * @param transformation transformation function which defines pixel + * mapping between new and source bitmap. It takes a pair of coordinates + * in the target, and returns a respective pair of coordinates in + * the source bitmap, i.e. has following form: + * `function(new_x, new_y) { return [src_x, src_y] }`. + */ +function transformBitmap(img, width, height, transformation) { + // Underscore-prefixed values are related to the source bitmap + // Their counterparts with no prefix are related to the target bitmap + const _data = img.bitmap.data; + const _width = img.bitmap.width; + const data = Buffer.alloc(_data.length); + for (let x = 0; x < width; x++) { + for (let y = 0; y < height; y++) { + const [_x, _y] = transformation(x, y); + const idx = (width * y + x) << 2; + const _idx = (_width * _y + _x) << 2; + const pixel = _data.readUInt32BE(_idx); + data.writeUInt32BE(pixel, idx); + } + } + img.bitmap.data = data; + img.bitmap.width = width; + img.bitmap.height = height; + // @ts-expect-error Accessing private property + img._exif.tags.Orientation = 1; +} +/** + * Automagically rotates an image based on its EXIF data (if present). + * @param img a Jimp image object + */ +function exifRotate(img) { + if (getExifOrientation(img) < 2) { + return; + } + const transformation = getExifOrientationTransformation(img); + const swapDimensions = getExifOrientation(img) > 4; + const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; + const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; + if (transformation) { + transformBitmap(img, newWidth, newHeight, transformation); + } +} +async function attemptExifRotate(image, buffer) { + try { + image._exif = + exif_parser_1.default.create(buffer).parse(); + exifRotate(image); // EXIF data + } + catch { + // do nothing + } +} +//# sourceMappingURL=image-bitmap.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.js.map b/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1f61b47f0144c28b36b17c747307a9dbbc7cd7e3 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/image-bitmap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"image-bitmap.js","sourceRoot":"","sources":["../../../src/utils/image-bitmap.ts"],"names":[],"mappings":";;;;;AAUA,gDAGC;AA+HD,8CAYC;AAxJD,8DAAmD;AAGnD;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAAsB,GAAM;IAC5D,MAAM,KAAK,GAAI,GAAsC,CAAC,KAAK,CAAC;IAC5D,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;;;GAQG;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MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IACzB,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IAE3B,8CAA8C;IAC9C,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAsB,GAAM;IAC7C,IAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,OAAO;IACT,CAAC;IAED,MAAM,cAAc,GAAG,gCAAgC,CAAC,GAAG,CAAC,CAAC;IAC7D,MAAM,cAAc,GAAG,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEnD,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;IACvE,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;IAExE,IAAI,cAAc,EAAE,CAAC;QACnB,eAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,iBAAiB,CACrC,KAAQ,EACR,MAAc;IAEd,IAAI,CAAC;QACF,KAAwC,CAAC,KAAK;YAC7C,qBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC;QAEpC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,aAAa;IACf,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/mime.d.ts b/node_modules/@jimp/core/dist/commonjs/utils/mime.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b5e4d945b71567c26ded65cf8a884736885dcd6 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/mime.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=mime.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/mime.d.ts.map b/node_modules/@jimp/core/dist/commonjs/utils/mime.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..4b7d532657302946db85726d2a1d295920fa425f --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/mime.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mime.d.ts","sourceRoot":"","sources":["../../../src/utils/mime.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/mime.js b/node_modules/@jimp/core/dist/commonjs/utils/mime.js new file mode 100644 index 0000000000000000000000000000000000000000..61e3f9c122286b9662090815a210342690c271a8 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/mime.js @@ -0,0 +1,30 @@ +"use strict"; +// const mimeTypes = {}; +Object.defineProperty(exports, "__esModule", { value: true }); +// const findType = (extension: string) => +// Object.entries(mimeTypes).find((type) => type[1].includes(extension)) || []; +// export const addType = (mime: string, extensions: string[]) => { +// mimeTypes[mime] = extensions; +// }; +// /** +// * Lookup a mime type based on extension +// * @param {string} path path to find extension for +// * @returns {string} mime found mime type +// */ +// export const getType = (path: string) => { +// const pathParts = path.split("/").slice(-1); +// const extension = pathParts[pathParts.length - 1]?.split(".").pop(); +// if (!extension) { +// return null; +// } +// const type = findType(extension); +// return type[0]; +// }; +// /** +// * Return file extension associated with a mime type +// * @param {string} type mime type to look up +// * @returns {string} extension file extension +// */ +// export const getExtension = (type: string) => +// (mimeTypes[type.toLowerCase()] || [])[0]; +//# sourceMappingURL=mime.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/commonjs/utils/mime.js.map b/node_modules/@jimp/core/dist/commonjs/utils/mime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..372bd44e3cd22e42155ec623888603ef7b0adab3 --- /dev/null +++ b/node_modules/@jimp/core/dist/commonjs/utils/mime.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mime.js","sourceRoot":"","sources":["../../../src/utils/mime.ts"],"names":[],"mappings":";AAAA,wBAAwB;;AAExB,0CAA0C;AAC1C,iFAAiF;AAEjF,mEAAmE;AACnE,kCAAkC;AAClC,KAAK;AAEL,MAAM;AACN,2CAA2C;AAC3C,qDAAqD;AACrD,4CAA4C;AAC5C,MAAM;AACN,6CAA6C;AAC7C,iDAAiD;AACjD,yEAAyE;AAEzE,sBAAsB;AACtB,mBAAmB;AACnB,MAAM;AAEN,sCAAsC;AAEtC,oBAAoB;AACpB,KAAK;AAEL,MAAM;AACN,uDAAuD;AACvD,+CAA+C;AAC/C,gDAAgD;AAChD,MAAM;AACN,gDAAgD;AAChD,8CAA8C"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/index.d.ts b/node_modules/@jimp/core/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0edd2fc3cd9f9cb47efdba6b4ba3cfe72c30cb84 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/index.d.ts @@ -0,0 +1,1904 @@ +import { Bitmap, Format, JimpClass, Edge } from "@jimp/types"; +import { BlendMode } from "./index.js"; +export { getExifOrientation } from "./utils/image-bitmap.js"; +export { composite } from "./utils/composite.js"; +export * from "./utils/constants.js"; +export interface RawImageData { + width: number; + height: number; + data: Buffer | Uint8Array | Uint8ClampedArray | number[]; +} +/** + * Instead of loading an image into an instance you can initialize a new Jimp instance with a empty bitmap. + */ +export interface JimpSimpleConstructorOptions { + height: number; + width: number; + /** + * Initialize the image with a color for each pixel + */ + color?: number | string; +} +export type JimpConstructorOptions = Bitmap | JimpSimpleConstructorOptions; +/** Converts a jimp plugin function to a Jimp class method */ +type JimpInstanceMethod = Method extends JimpChainableMethod ? (...args: Args) => JimpInstanceMethods & ClassInstance : Method extends JimpMethod ? (...args: Args) => Return : never; +/** Converts a Record of jimp plugin functions to a Record of Jimp class methods */ +export type JimpInstanceMethods = { + [Key in keyof MethodMap]: JimpInstanceMethod; +}; +/** A Jimp instance method that can be chained. */ +type JimpChainableMethod = (img: J, ...args: Args) => J; +/** A Jimp instance method that returns anything. */ +type JimpMethod = (img: J, ...args: Args) => ReturnType; +export interface JimpPlugin { + [key: string]: JimpChainableMethod | JimpMethod; +} +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type Constructor = new (...args: any[]) => T; +type JimpFormat | undefined = undefined, DecodeOptions extends Record | undefined = undefined, T extends Format = Format> = () => T; +type CreateMimeTypeToExportOptions> = T extends Format ? Record : never; +type CreateMimeTypeToDecodeOptions> = T extends Format ? Record : never; +type GetOptionsForMimeType = MimeTypeMap extends Record ? O : never; +type MimeToExtension = `${string}/${M}`; +type CreateExtensionToMimeType = M extends MimeToExtension ? Record : never; +type GetMimeTypeForExtension = MimeTypeMap extends Record ? M : never; +/** + * Create a Jimp class that support the given image formats and methods + */ +export declare function createJimp({ plugins: pluginsArg, formats: formatsArg, }?: { + /** Plugins that add methods to the created Jimp class */ + plugins?: Methods; + /** Image formats the Jimp class should support */ + formats?: Formats; +}): { + new (options?: JimpConstructorOptions): { + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + }; + /** + * Create a Jimp instance from a URL, a file path, or a Buffer + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * // Read from a file path + * const image = await Jimp.read("test/image.png"); + * + * // Read from a URL + * const image = await Jimp.read("https://upload.wikimedia.org/wikipedia/commons/0/01/Bot-Test.jpg"); + * ``` + */ + read(url: string | Buffer | ArrayBuffer, options?: CreateMimeTypeToDecodeOptions>): Promise<{ + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + } & JimpInstanceMethods<{ + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + }, UnionToIntersection>>; + /** + * Create a Jimp instance from a bitmap. + * The difference between this and just using the constructor is that this will + * convert raw image data into the bitmap format that Jimp uses. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBitmap({ + * data: Buffer.from([ + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * ]), + * width: 3, + * height: 3, + * }); + * ``` + */ + fromBitmap(bitmap: RawImageData): InstanceType & JimpInstanceMethods<{ + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + }, UnionToIntersection>; + /** + * Parse a bitmap with the loaded image types. + * + * @param buffer Raw image data + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const buffer = await fs.readFile("test/image.png"); + * const image = await Jimp.fromBuffer(buffer); + * ``` + */ + fromBuffer(buffer: Buffer | ArrayBuffer, options?: CreateMimeTypeToDecodeOptions>): Promise<{ + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + } & JimpInstanceMethods<{ + /** + * The bitmap data of the image + */ + bitmap: Bitmap; + /** Default color to use for new pixels */ + background: number; + /** Formats that can be used with Jimp */ + formats: Format[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; + }, UnionToIntersection>>; +} & Constructor[]; + /** The original MIME type of the image */ + mime?: string; + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect(): string; + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString(): string; + /** Get the width of the image */ + readonly width: number; + /** Get the height of the image */ + readonly height: number; + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBuffer["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + getBase64["mime"], Options extends GetOptionsForMimeType>>>(mime: ProvidedMimeType, options?: Options | undefined): Promise; + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + write["mime"]>>, Options extends GetOptionsForMimeType>>>(path: `${string}.${Extension}`, options?: Options | undefined): Promise; + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone>): Promise>>; + /** + * Create a Jimp instance from a bitmap. + * The difference between this and just using the constructor is that this will + * convert raw image data into the bitmap format that Jimp uses. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBitmap({ + * data: Buffer.from([ + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * ]), + * width: 3, + * height: 3, + * }); + * ``` + */ + fromBitmap(bitmap: RawImageData): InstanceType & JimpInstanceMethods>; + /** + * Parse a bitmap with the loaded image types. + * + * @param buffer Raw image data + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const buffer = await fs.readFile("test/image.png"); + * const image = await Jimp.fromBuffer(buffer); + * ``` + */ + fromBuffer(buffer: Buffer | ArrayBuffer, options?: CreateMimeTypeToDecodeOptions>): Promise>>; + }>(this: S): S; + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge): number; + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number): number; + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number): any; + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha(): boolean; + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + }): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): any; + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any; + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{ + x: number; + y: number; + idx: number; + image: any; + }, void, unknown>; +}, UnionToIntersection>>; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/index.d.ts.map b/node_modules/@jimp/core/dist/esm/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..73f2e40f5b07571840ff859796e5973a0ce7f1eb --- /dev/null +++ b/node_modules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;IAST;;;;;;;;;;;;;;;;OAgBG;UAED,SAAS,SAAS,MAAM,EACxB,IAAI,6GACJ,OAAO;IAST;;;;;;;;;;;;OAYG;UACG,CAAC;uBA7Vc,sBAAsB;QA0C3C;;;;;;;;;;;;WAYG;kBAEI,MAAM,GAAG,MAAM,GAAG,WAAW;QA+BpC;;;;;;;;;;;;;;;;;;;WAmBG;2BACuB,YAAY,GAqC9B,YAAY,KAAmB,iEAAiB;QAGxD;;;;;;;;;;;WAWG;2BAEO,MAAM,GAAG,WAAW;;IAoM9B;;;;;;;;;;;;;;OAcG;qBACc,MAAM,KAAK,MAAM,iBAAiB,IAAI;IAyDvD;;;;;;;;;;;;;OAaG;qBACc,MAAM,KAAK,MAAM;IASlC;;;;;;;;;;;;;;;OAeG;uBACgB,MAAM,KAAK,MAAM,KAAK,MAAM;IAe/C;;;;;;;;;;;;;OAaG;;IAcH;;;;;;;;;;;;;;;OAeG;cACO,CAAC,wDAIA;QACP,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;IAKH;;;;;;;;;;;;;;;;;;OAkBG;YACK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,GAAG;IAnBlD;;;;;;;;;;;;;;;;;;OAkBG;YAGE,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACL,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,GAAG;IAYhD;;;;;;;;;;;;;;;;OAgBG;;;;;;;yCAc+D,CACrE"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/index.js b/node_modules/@jimp/core/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3ede0348e5c4d9f642f4c077257c02a0963b2d53 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/index.js @@ -0,0 +1,511 @@ +import { Edge } from "@jimp/types"; +import { cssColorToHex, scan, scanIterator } from "@jimp/utils"; +import { to } from "await-to-js"; +import { existsSync, readFile, writeFile } from "@jimp/file-ops"; +import mime from "mime/lite.js"; +import { composite } from "./utils/composite.js"; +import { attemptExifRotate } from "./utils/image-bitmap.js"; +const emptyBitmap = { + data: Buffer.alloc(0), + width: 0, + height: 0, +}; +/** + * Prepare a Buffer object from the arrayBuffer. + */ +function bufferFromArrayBuffer(arrayBuffer) { + const buffer = Buffer.alloc(arrayBuffer.byteLength); + const view = new Uint8Array(arrayBuffer); + for (let i = 0; i < buffer.length; ++i) { + buffer[i] = view[i]; + } + return buffer; +} +async function detectFileTypeFromBuffer(buffer) { + const { fileTypeFromBuffer } = await import("file-type"); + return fileTypeFromBuffer(buffer instanceof ArrayBuffer + ? buffer + : new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength)); +} +export { getExifOrientation } from "./utils/image-bitmap.js"; +export { composite } from "./utils/composite.js"; +export * from "./utils/constants.js"; +/** + * Create a Jimp class that support the given image formats and methods + */ +export function createJimp({ plugins: pluginsArg, formats: formatsArg, } = {}) { + const plugins = pluginsArg || []; + const formats = (formatsArg || []).map((format) => format()); + const CustomJimp = class Jimp { + /** + * The bitmap data of the image + */ + bitmap = emptyBitmap; + /** Default color to use for new pixels */ + background = 0x00000000; + /** Formats that can be used with Jimp */ + formats = []; + /** The original MIME type of the image */ + mime; + constructor(options = emptyBitmap) { + // Add the formats + this.formats = formats; + if ("data" in options) { + this.bitmap = options; + } + else { + this.bitmap = { + data: Buffer.alloc(options.width * options.height * 4), + width: options.width, + height: options.height, + }; + if (options.color) { + this.background = + typeof options.color === "string" + ? cssColorToHex(options.color) + : options.color; + for (let i = 0; i < this.bitmap.data.length; i += 4) { + this.bitmap.data.writeUInt32BE(this.background, i); + } + } + } + // Add the plugins + for (const methods of plugins) { + for (const key in methods) { + this[key] = (...args) => { + const result = methods[key]?.(this, ...args); + if (typeof result === "object" && "bitmap" in result) { + this.bitmap = result.bitmap; + return this; + } + return result; + }; + } + } + } + /** + * Create a Jimp instance from a URL, a file path, or a Buffer + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * // Read from a file path + * const image = await Jimp.read("test/image.png"); + * + * // Read from a URL + * const image = await Jimp.read("https://upload.wikimedia.org/wikipedia/commons/0/01/Bot-Test.jpg"); + * ``` + */ + static async read(url, options) { + if (Buffer.isBuffer(url) || url instanceof ArrayBuffer) { + return this.fromBuffer(url); + } + if (existsSync(url)) { + return this.fromBuffer(await readFile(url)); + } + const [fetchErr, response] = await to(fetch(url)); + if (fetchErr) { + throw new Error(`Could not load Buffer from URL: ${url}`); + } + if (!response.ok) { + throw new Error(`HTTP Status ${response.status} for url ${url}`); + } + const [arrayBufferErr, data] = await to(response.arrayBuffer()); + if (arrayBufferErr) { + throw new Error(`Could not load Buffer from ${url}`); + } + const buffer = bufferFromArrayBuffer(data); + return this.fromBuffer(buffer, options); + } + /** + * Create a Jimp instance from a bitmap. + * The difference between this and just using the constructor is that this will + * convert raw image data into the bitmap format that Jimp uses. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBitmap({ + * data: Buffer.from([ + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * ]), + * width: 3, + * height: 3, + * }); + * ``` + */ + static fromBitmap(bitmap) { + let data; + if (bitmap.data instanceof Buffer) { + data = Buffer.from(bitmap.data); + } + if (bitmap.data instanceof Uint8Array || + bitmap.data instanceof Uint8ClampedArray) { + data = Buffer.from(bitmap.data.buffer); + } + if (Array.isArray(bitmap.data)) { + data = Buffer.concat(bitmap.data.map((hex) => Buffer.from(hex.toString(16).padStart(8, "0"), "hex"))); + } + if (!data) { + throw new Error("data must be a Buffer"); + } + if (typeof bitmap.height !== "number" || + typeof bitmap.width !== "number") { + throw new Error("bitmap must have width and height"); + } + return new CustomJimp({ + height: bitmap.height, + width: bitmap.width, + data, + }); + } + /** + * Parse a bitmap with the loaded image types. + * + * @param buffer Raw image data + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const buffer = await fs.readFile("test/image.png"); + * const image = await Jimp.fromBuffer(buffer); + * ``` + */ + static async fromBuffer(buffer, options) { + const actualBuffer = buffer instanceof ArrayBuffer ? bufferFromArrayBuffer(buffer) : buffer; + const mime = await detectFileTypeFromBuffer(actualBuffer); + if (!mime || !mime.mime) { + throw new Error("Could not find MIME for Buffer"); + } + const format = formats.find((format) => format.mime === mime.mime); + if (!format || !format.decode) { + throw new Error(`Mime type ${mime.mime} does not support decoding`); + } + const image = new CustomJimp(await format.decode(actualBuffer, options?.[format.mime])); + image.mime = mime.mime; + attemptExifRotate(image, actualBuffer); + return image; + } + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect() { + return (""); + } + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString() { + return "[object Jimp]"; + } + /** Get the width of the image */ + get width() { + return this.bitmap.width; + } + /** Get the height of the image */ + get height() { + return this.bitmap.height; + } + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + async getBuffer(mime, options) { + const format = this.formats.find((format) => format.mime === mime); + if (!format || !format.encode) { + throw new Error(`Unsupported MIME type: ${mime}`); + } + let outputImage; + if (format.hasAlpha) { + // eslint-disable-next-line @typescript-eslint/no-this-alias + outputImage = this; + } + else { + outputImage = new CustomJimp({ + width: this.bitmap.width, + height: this.bitmap.height, + color: this.background, + }); + composite(outputImage, this); + } + return format.encode(outputImage.bitmap, options); + } + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + async getBase64(mime, options) { + const data = await this.getBuffer(mime, options); + return "data:" + mime + ";base64," + data.toString("base64"); + } + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + async write(path, options) { + const mimeType = mime.getType(path); + await writeFile(path, await this.getBuffer(mimeType, options)); + } + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone() { + return new CustomJimp({ + ...this.bitmap, + data: Buffer.from(this.bitmap.data), + }); + } + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x, y, edgeHandling) { + let xi; + let yi; + if (!edgeHandling) { + edgeHandling = Edge.EXTEND; + } + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + // round input + x = Math.round(x); + y = Math.round(y); + xi = x; + yi = y; + if (edgeHandling === Edge.EXTEND) { + if (x < 0) + xi = 0; + if (x >= this.bitmap.width) + xi = this.bitmap.width - 1; + if (y < 0) + yi = 0; + if (y >= this.bitmap.height) + yi = this.bitmap.height - 1; + } + if (edgeHandling === Edge.WRAP) { + if (x < 0) { + xi = this.bitmap.width + x; + } + if (x >= this.bitmap.width) { + xi = x % this.bitmap.width; + } + if (y < 0) { + yi = this.bitmap.height + y; + } + if (y >= this.bitmap.height) { + yi = y % this.bitmap.height; + } + } + let i = (this.bitmap.width * yi + xi) << 2; + // if out of bounds index is -1 + if (xi < 0 || xi >= this.bitmap.width) { + i = -1; + } + if (yi < 0 || yi >= this.bitmap.height) { + i = -1; + } + return i; + } + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x, y) { + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + const idx = this.getPixelIndex(x, y); + return this.bitmap.data.readUInt32BE(idx); + } + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex, x, y) { + if (typeof hex !== "number" || + typeof x !== "number" || + typeof y !== "number") { + throw new Error("hex, x and y must be numbers"); + } + const idx = this.getPixelIndex(x, y); + this.bitmap.data.writeUInt32BE(hex, idx); + return this; + } + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha() { + const { width, height, data } = this.bitmap; + const byteLen = (width * height) << 2; + for (let idx = 3; idx < byteLen; idx += 4) { + if (data[idx] !== 0xff) { + return true; + } + } + return false; + } + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite(src, x = 0, y = 0, options = {}) { + return composite(this, src, x, y, options); + } + scan(x, y, w, h, f) { + return scan(this, x, y, w, h, f); + } + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x = 0, y = 0, w = this.bitmap.width, h = this.bitmap.height) { + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + if (typeof w !== "number" || typeof h !== "number") { + throw new Error("w and h must be numbers"); + } + return scanIterator(this, x, y, w, h); + } + }; + return CustomJimp; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/index.js.map b/node_modules/@jimp/core/dist/esm/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..02244811e5818942a3e6152c17f313ff92012a5f --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"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AAC;QACtE,CAAC;QAED;;;;;;;;;;;;;;;;WAgBG;QACH,YAAY,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM;YACtE,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACnD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7C,CAAC;YAED,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACnD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7C,CAAC;YAED,OAAO,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;IAEF,OAAO,UAA6D,CAAC;AACvE,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/package.json b/node_modules/@jimp/core/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@jimp/core/dist/esm/utils/composite-modes.d.ts b/node_modules/@jimp/core/dist/esm/utils/composite-modes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b28491b194a5380ff5a883a18196d8f0f5fa1c1d --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/composite-modes.d.ts @@ -0,0 +1,70 @@ +import { RGBAColor } from "@jimp/types"; +export declare function srcOver(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function dstOver(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function multiply(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function add(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function screen(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function overlay(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function darken(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function lighten(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function hardLight(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function difference(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare function exclusion(src: RGBAColor, dst: RGBAColor, ops?: number): { + r: number; + g: number; + b: number; + a: number; +}; +export declare const names: readonly [typeof srcOver, typeof dstOver, typeof multiply, typeof add, typeof screen, typeof overlay, typeof darken, typeof lighten, typeof hardLight, typeof difference, typeof exclusion]; +export type CompositeMode = (typeof names)[number]; +//# sourceMappingURL=composite-modes.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/composite-modes.d.ts.map b/node_modules/@jimp/core/dist/esm/utils/composite-modes.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..0d8ce73b73fadb2a29ab98ea2e00dd5e3a725611 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/composite-modes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"composite-modes.d.ts","sourceRoot":"","sources":["../../../src/utils/composite-modes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAI;;;;;EAU9D;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAI;;;;;EAU9D;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAI;;;;;EAkB/D;AAED,wBAAgB,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAI;;;;;EAkB1D;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAI;;;;;EAoC7D;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAI;;;;;EAgC9D;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAI;;;;;EA8B7D;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAI;;;;;EA8B9D;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAI;;;;;EAgChE;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAI;;;;;EAkBjE;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAI;;;;;EAoChE;AAED,eAAO,MAAM,KAAK,6LAYR,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/composite-modes.js b/node_modules/@jimp/core/dist/esm/utils/composite-modes.js new file mode 100644 index 0000000000000000000000000000000000000000..c992a6114d241485be8b67af5d0efd92ad215ed0 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/composite-modes.js @@ -0,0 +1,222 @@ +export function srcOver(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a; + const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a; + const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a; + return { r, g, b, a }; +} +export function dstOver(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a; + const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a; + const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a; + return { r, g, b, a }; +} +export function multiply(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + return { r, g, b, a }; +} +export function add(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra + dra) / a; + const g = (sga + dga) / a; + const b = (sba + dba) / a; + return { r, g, b, a }; +} +export function screen(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dst.a + + dra * src.a - + sra * dra + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = (sga * dst.a + + dga * src.a - + sga * dga + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = (sba * dst.a + + dba * src.a - + sba * dba + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + return { r, g, b, a }; +} +export function overlay(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (2 * dra <= dst.a + ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) + : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / + a; + const g = (2 * dga <= dst.a + ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) + : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / + a; + const b = (2 * dba <= dst.a + ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) + : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / + a; + return { r, g, b, a }; +} +export function darken(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (Math.min(sra * dst.a, dra * src.a) + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = (Math.min(sga * dst.a, dga * src.a) + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = (Math.min(sba * dst.a, dba * src.a) + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + return { r, g, b, a }; +} +export function lighten(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (Math.max(sra * dst.a, dra * src.a) + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = (Math.max(sga * dst.a, dga * src.a) + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = (Math.max(sba * dst.a, dba * src.a) + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + return { r, g, b, a }; +} +export function hardLight(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (2 * sra <= src.a + ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) + : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / + a; + const g = (2 * sga <= src.a + ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) + : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / + a; + const b = (2 * sba <= src.a + ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) + : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / + a; + return { r, g, b, a }; +} +export function difference(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a; + const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a; + const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a; + return { r, g, b, a }; +} +export function exclusion(src, dst, ops = 1) { + src.a *= ops; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dst.a + + dra * src.a - + 2 * sra * dra + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = (sga * dst.a + + dga * src.a - + 2 * sga * dga + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = (sba * dst.a + + dba * src.a - + 2 * sba * dba + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + return { r, g, b, a }; +} +export const names = [ + srcOver, + dstOver, + multiply, + add, + screen, + overlay, + darken, + lighten, + hardLight, + difference, + exclusion, +]; +//# sourceMappingURL=composite-modes.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/composite-modes.js.map b/node_modules/@jimp/core/dist/esm/utils/composite-modes.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9b7713ee7571e60596d36a207b464e5981f57935 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/composite-modes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"composite-modes.js","sourceRoot":"","sources":["../../../src/utils/composite-modes.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,OAAO,CAAC,GAAc,EAAE,GAAc,EAAE,GAAG,GAAG,CAAC;IAC7D,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC;IAEb,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAExC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5D,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,C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,CAAC;QACX,CAAC,GAAG,GAAG,GAAG,GAAG;QACb,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACjB,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC,CAAC;IACJ,MAAM,CAAC,GACL,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;QACV,GAAG,GAAG,GAAG,CAAC,CAAC;QACX,CAAC,GAAG,GAAG,GAAG,GAAG;QACb,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACjB,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC,CAAC;IACJ,MAAM,CAAC,GACL,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;QACV,GAAG,GAAG,GAAG,CAAC,CAAC;QACX,CAAC,GAAG,GAAG,GAAG,GAAG;QACb,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACjB,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC,CAAC;IAEJ,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACxB,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,OAAO;IACP,OAAO;IACP,QAAQ;IACR,GAAG;IACH,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,UAAU;IACV,SAAS;CACD,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/composite.d.ts b/node_modules/@jimp/core/dist/esm/utils/composite.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0b43b27502a9da533a8c45ccdac27b553e4fc941 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/composite.d.ts @@ -0,0 +1,8 @@ +import { JimpClass } from "@jimp/types"; +import { BlendMode } from "./constants.js"; +export declare function composite(baseImage: I, src: I, x?: number, y?: number, options?: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; +}): I; +//# sourceMappingURL=composite.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/composite.d.ts.map b/node_modules/@jimp/core/dist/esm/utils/composite.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7d0a0f0cfcdffcc7eae7e8219f79fe8d17749a44 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/composite.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"composite.d.ts","sourceRoot":"","sources":["../../../src/utils/composite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,SAAS,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI3C,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,EAC3C,SAAS,EAAE,CAAC,EACZ,GAAG,EAAE,CAAC,EACN,CAAC,SAAI,EACL,CAAC,SAAI,EACL,OAAO,GAAE;IACP,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACjB,KAqEP"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/composite.js b/node_modules/@jimp/core/dist/esm/utils/composite.js new file mode 100644 index 0000000000000000000000000000000000000000..d73fdf034410fc3a346d4063f7c9d616f206eede --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/composite.js @@ -0,0 +1,56 @@ +import { Edge } from "@jimp/types"; +import { BlendMode } from "./constants.js"; +import * as compositeModes from "./composite-modes.js"; +import { limit255 } from "@jimp/utils"; +export function composite(baseImage, src, x = 0, y = 0, options = {}) { + if (!(src instanceof baseImage.constructor)) { + throw new Error("The source must be a Jimp image"); + } + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + const { mode = BlendMode.SRC_OVER } = options; + let { opacitySource = 1.0, opacityDest = 1.0 } = options; + if (typeof opacitySource !== "number" || + opacitySource < 0 || + opacitySource > 1) { + opacitySource = 1.0; + } + if (typeof opacityDest !== "number" || opacityDest < 0 || opacityDest > 1) { + opacityDest = 1.0; + } + const blendmode = compositeModes[mode]; + // round input + x = Math.round(x); + y = Math.round(y); + if (opacityDest !== 1.0) { + baseImage.scan((_, __, idx) => { + const v = baseImage.bitmap.data[idx + 3] * opacityDest; + baseImage.bitmap.data[idx + 3] = v; + }); + } + src.scan((sx, sy, idx) => { + const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, Edge.CROP); + if (dstIdx === -1) { + // Skip target pixels outside of dst + return; + } + const blended = blendmode({ + r: src.bitmap.data[idx + 0] / 255, + g: src.bitmap.data[idx + 1] / 255, + b: src.bitmap.data[idx + 2] / 255, + a: src.bitmap.data[idx + 3] / 255, + }, { + r: baseImage.bitmap.data[dstIdx + 0] / 255, + g: baseImage.bitmap.data[dstIdx + 1] / 255, + b: baseImage.bitmap.data[dstIdx + 2] / 255, + a: baseImage.bitmap.data[dstIdx + 3] / 255, + }, opacitySource); + baseImage.bitmap.data[dstIdx + 0] = limit255(blended.r * 255); + baseImage.bitmap.data[dstIdx + 1] = limit255(blended.g * 255); + baseImage.bitmap.data[dstIdx + 2] = limit255(blended.b * 255); + baseImage.bitmap.data[dstIdx + 3] = limit255(blended.a * 255); + }); + return baseImage; +} +//# sourceMappingURL=composite.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/composite.js.map b/node_modules/@jimp/core/dist/esm/utils/composite.js.map new file mode 100644 index 0000000000000000000000000000000000000000..320ac510c6fc4c878b4d38ac08b977eca71235bd --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/composite.js.map @@ -0,0 +1 @@ +{"version":3,"file":"composite.js","sourceRoot":"","sources":["../../../src/utils/composite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAa,MAAM,aAAa,C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,GAAG;YAC3C,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,GAAG;SAC5C,EACD,aAAa,CACd,CAAC;QAEF,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;QAC9D,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;QAC9D,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;QAC9D,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/constants.d.ts b/node_modules/@jimp/core/dist/esm/utils/constants.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d569e5c8fca764aa00039d5499346a318191a7c3 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/constants.d.ts @@ -0,0 +1,85 @@ +export declare enum HorizontalAlign { + LEFT = 1, + CENTER = 2, + RIGHT = 4 +} +export declare enum VerticalAlign { + TOP = 8, + MIDDLE = 16, + BOTTOM = 32 +} +/** + * How to blend two images together + */ +export declare enum BlendMode { + /** + * Composite the source image over the destination image. + * This is the default value. It represents the most intuitive case, where shapes are painted on top of what is below, with transparent areas showing the destination layer. + */ + SRC_OVER = "srcOver", + /** Composite the source image under the destination image. */ + DST_OVER = "dstOver", + /** + * Multiply the color components of the source and destination images. + * This can only result in the same or darker colors (multiplying by white, 1.0, results in no change; multiplying by black, 0.0, results in black). + * When compositing two opaque images, this has similar effect to overlapping two transparencies on a projector. + * + * This mode is useful for coloring shadows. + */ + MULTIPLY = "multiply", + /** + * The Add mode adds the color information of the base layers and the blending layer. + * In digital terms, adding color increases the brightness. + */ + ADD = "add", + /** + * Multiply the inverse of the components of the source and destination images, and inverse the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * This is essentially the same as modulate blend mode, but with the values of the colors inverted before the multiplication and the result being inverted back before rendering. + * This can only result in the same or lighter colors (multiplying by black, 1.0, results in no change; multiplying by white, 0.0, results in white). Similarly, in the alpha channel, it can only result in more opaque colors. + * This has similar effect to two projectors displaying their images on the same screen simultaneously. + */ + SCREEN = "screen", + /** + * Multiply the components of the source and destination images after adjusting them to favor the destination. + * Specifically, if the destination value is smaller, this multiplies it with the source value, whereas is the source value is smaller, it multiplies the inverse of the source value with the inverse of the destination value, then inverts the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * + * The Overlay mode behaves like Screen mode in bright areas, and like Multiply mode in darker areas. + * With this mode, the bright areas will look brighter and the dark areas will look darker. + */ + OVERLAY = "overlay", + /** + * Composite the source and destination image by choosing the lowest value from each color channel. + * The opacity of the output image is computed in the same way as for srcOver. + */ + DARKEN = "darken", + /** + * Composite the source and destination image by choosing the highest value from each color channel. + * The opacity of the output image is computed in the same way as for srcOver. + */ + LIGHTEN = "lighten", + /** + * Multiply the components of the source and destination images after adjusting them to favor the source. + * Specifically, if the source value is smaller, this multiplies it with the destination value, whereas is the destination value is smaller, it multiplies the inverse of the destination value with the inverse of the source value, then inverts the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * + * The effect of the Hard light mode depends on the density of the superimposed color. Using bright colors on the blending layer will create a brighter effect like the Screen modes, while dark colors will create darker colors like the Multiply mode. + */ + HARD_LIGHT = "hardLight", + /** + * Subtract the smaller value from the bigger value for each channel. + * Compositing black has no effect; compositing white inverts the colors of the other image. + * The opacity of the output image is computed in the same way as for srcOver. + * The effect is similar to exclusion but harsher. + */ + DIFFERENCE = "difference", + /** + * Subtract double the product of the two images from the sum of the two images. + * Compositing black has no effect; compositing white inverts the colors of the other image. + * The opacity of the output image is computed in the same way as for srcOver. + * The effect is similar to difference but softer. + */ + EXCLUSION = "exclusion" +} +//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/constants.d.ts.map b/node_modules/@jimp/core/dist/esm/utils/constants.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..baf76c785a81fa96f83e724f263d14b2fb767478 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/constants.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AACA,oBAAY,eAAe;IACzB,IAAI,IAAI;IACR,MAAM,IAAI;IACV,KAAK,IAAI;CACV;AAGD,oBAAY,aAAa;IACvB,GAAG,IAAI;IACP,MAAM,KAAK;IACX,MAAM,KAAK;CACZ;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB;;;OAGG;IACH,QAAQ,YAAY;IACpB,8DAA8D;IAC9D,QAAQ,YAAY;IACpB;;;;;;OAMG;IACH,QAAQ,aAAa;IACrB;;;OAGG;IACH,GAAG,QAAQ;IACX;;;;;;OAMG;IACH,MAAM,WAAW;IACjB;;;;;;;OAOG;IACH,OAAO,YAAY;IACnB;;;OAGG;IACH,MAAM,WAAW;IACjB;;;OAGG;IACH,OAAO,YAAY;IACnB;;;;;;OAMG;IACH,UAAU,cAAc;IACxB;;;;;OAKG;IACH,UAAU,eAAe;IACzB;;;;;OAKG;IACH,SAAS,cAAc;CACxB"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/constants.js b/node_modules/@jimp/core/dist/esm/utils/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..345e1a55a7d045b90e919d51e7855447b90a0105 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/constants.js @@ -0,0 +1,90 @@ +/* Horizontal align modes for cover, contain, bit masks */ +export var HorizontalAlign; +(function (HorizontalAlign) { + HorizontalAlign[HorizontalAlign["LEFT"] = 1] = "LEFT"; + HorizontalAlign[HorizontalAlign["CENTER"] = 2] = "CENTER"; + HorizontalAlign[HorizontalAlign["RIGHT"] = 4] = "RIGHT"; +})(HorizontalAlign || (HorizontalAlign = {})); +/* Vertical align modes for cover, contain, bit masks */ +export var VerticalAlign; +(function (VerticalAlign) { + VerticalAlign[VerticalAlign["TOP"] = 8] = "TOP"; + VerticalAlign[VerticalAlign["MIDDLE"] = 16] = "MIDDLE"; + VerticalAlign[VerticalAlign["BOTTOM"] = 32] = "BOTTOM"; +})(VerticalAlign || (VerticalAlign = {})); +/** + * How to blend two images together + */ +export var BlendMode; +(function (BlendMode) { + /** + * Composite the source image over the destination image. + * This is the default value. It represents the most intuitive case, where shapes are painted on top of what is below, with transparent areas showing the destination layer. + */ + BlendMode["SRC_OVER"] = "srcOver"; + /** Composite the source image under the destination image. */ + BlendMode["DST_OVER"] = "dstOver"; + /** + * Multiply the color components of the source and destination images. + * This can only result in the same or darker colors (multiplying by white, 1.0, results in no change; multiplying by black, 0.0, results in black). + * When compositing two opaque images, this has similar effect to overlapping two transparencies on a projector. + * + * This mode is useful for coloring shadows. + */ + BlendMode["MULTIPLY"] = "multiply"; + /** + * The Add mode adds the color information of the base layers and the blending layer. + * In digital terms, adding color increases the brightness. + */ + BlendMode["ADD"] = "add"; + /** + * Multiply the inverse of the components of the source and destination images, and inverse the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * This is essentially the same as modulate blend mode, but with the values of the colors inverted before the multiplication and the result being inverted back before rendering. + * This can only result in the same or lighter colors (multiplying by black, 1.0, results in no change; multiplying by white, 0.0, results in white). Similarly, in the alpha channel, it can only result in more opaque colors. + * This has similar effect to two projectors displaying their images on the same screen simultaneously. + */ + BlendMode["SCREEN"] = "screen"; + /** + * Multiply the components of the source and destination images after adjusting them to favor the destination. + * Specifically, if the destination value is smaller, this multiplies it with the source value, whereas is the source value is smaller, it multiplies the inverse of the source value with the inverse of the destination value, then inverts the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * + * The Overlay mode behaves like Screen mode in bright areas, and like Multiply mode in darker areas. + * With this mode, the bright areas will look brighter and the dark areas will look darker. + */ + BlendMode["OVERLAY"] = "overlay"; + /** + * Composite the source and destination image by choosing the lowest value from each color channel. + * The opacity of the output image is computed in the same way as for srcOver. + */ + BlendMode["DARKEN"] = "darken"; + /** + * Composite the source and destination image by choosing the highest value from each color channel. + * The opacity of the output image is computed in the same way as for srcOver. + */ + BlendMode["LIGHTEN"] = "lighten"; + /** + * Multiply the components of the source and destination images after adjusting them to favor the source. + * Specifically, if the source value is smaller, this multiplies it with the destination value, whereas is the destination value is smaller, it multiplies the inverse of the destination value with the inverse of the source value, then inverts the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * + * The effect of the Hard light mode depends on the density of the superimposed color. Using bright colors on the blending layer will create a brighter effect like the Screen modes, while dark colors will create darker colors like the Multiply mode. + */ + BlendMode["HARD_LIGHT"] = "hardLight"; + /** + * Subtract the smaller value from the bigger value for each channel. + * Compositing black has no effect; compositing white inverts the colors of the other image. + * The opacity of the output image is computed in the same way as for srcOver. + * The effect is similar to exclusion but harsher. + */ + BlendMode["DIFFERENCE"] = "difference"; + /** + * Subtract double the product of the two images from the sum of the two images. + * Compositing black has no effect; compositing white inverts the colors of the other image. + * The opacity of the output image is computed in the same way as for srcOver. + * The effect is similar to difference but softer. + */ + BlendMode["EXCLUSION"] = "exclusion"; +})(BlendMode || (BlendMode = {})); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/constants.js.map b/node_modules/@jimp/core/dist/esm/utils/constants.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a42ffb79f14e06b677930d58a7a96f32ca530186 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,qDAAQ,CAAA;IACR,yDAAU,CAAA;IACV,uDAAS,CAAA;AACX,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAED,wDAAwD;AACxD,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,+CAAO,CAAA;IACP,sDAAW,CAAA;IACX,sDAAW,CAAA;AACb,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SAsEX;AAtED,WAAY,SAAS;IACnB;;;OAGG;IACH,iCAAoB,CAAA;IACpB,8DAA8D;IAC9D,iCAAoB,CAAA;IACpB;;;;;;OAMG;IACH,kCAAqB,CAAA;IACrB;;;OAGG;IACH,wBAAW,CAAA;IACX;;;;;;OAMG;IACH,8BAAiB,CAAA;IACjB;;;;;;;OAOG;IACH,gCAAmB,CAAA;IACnB;;;OAGG;IACH,8BAAiB,CAAA;IACjB;;;OAGG;IACH,gCAAmB,CAAA;IACnB;;;;;;OAMG;IACH,qCAAwB,CAAA;IACxB;;;;;OAKG;IACH,sCAAyB,CAAA;IACzB;;;;;OAKG;IACH,oCAAuB,CAAA;AACzB,CAAC,EAtEW,SAAS,KAAT,SAAS,QAsEpB"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/image-bitmap.d.ts b/node_modules/@jimp/core/dist/esm/utils/image-bitmap.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..014a08bc32548161c179f02eab498411f8a80472 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/image-bitmap.d.ts @@ -0,0 +1,11 @@ +import { JimpClass } from "@jimp/types"; +/** + * Obtains image orientation from EXIF metadata. + * + * @param img a Jimp image object + * @returns a number 1-8 representing EXIF orientation, + * in particular 1 if orientation tag is missing + */ +export declare function getExifOrientation(img: I): number; +export declare function attemptExifRotate(image: I, buffer: Buffer): Promise; +//# sourceMappingURL=image-bitmap.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/image-bitmap.d.ts.map b/node_modules/@jimp/core/dist/esm/utils/image-bitmap.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..9e976b5c3b453402f935efa7a5c20fa57cd30bb1 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/image-bitmap.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"image-bitmap.d.ts","sourceRoot":"","sources":["../../../src/utils/image-bitmap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,CAAC,UAG7D;AA+HD,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,SAAS,EACzD,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,MAAM,iBAUf"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/image-bitmap.js b/node_modules/@jimp/core/dist/esm/utils/image-bitmap.js new file mode 100644 index 0000000000000000000000000000000000000000..c0905f5014c4aa7a50a0bf15f3722283f05d93d3 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/image-bitmap.js @@ -0,0 +1,122 @@ +import EXIFParser from "exif-parser"; +/** + * Obtains image orientation from EXIF metadata. + * + * @param img a Jimp image object + * @returns a number 1-8 representing EXIF orientation, + * in particular 1 if orientation tag is missing + */ +export function getExifOrientation(img) { + const _exif = img._exif; + return (_exif && _exif.tags && _exif.tags.Orientation) || 1; +} +/** + * Returns a function which translates EXIF-rotated coordinates into + * non-rotated ones. + * + * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html. + * + * @param img a Jimp image object + * @returns transformation function for transformBitmap(). + */ +function getExifOrientationTransformation(img) { + const w = img.bitmap.width; + const h = img.bitmap.height; + switch (getExifOrientation(img)) { + case 1: // Horizontal (normal) + // does not need to be supported here + return null; + case 2: // Mirror horizontal + return function (x, y) { + return [w - x - 1, y]; + }; + case 3: // Rotate 180 + return function (x, y) { + return [w - x - 1, h - y - 1]; + }; + case 4: // Mirror vertical + return function (x, y) { + return [x, h - y - 1]; + }; + case 5: // Mirror horizontal and rotate 270 CW + return function (x, y) { + return [y, x]; + }; + case 6: // Rotate 90 CW + return function (x, y) { + return [y, h - x - 1]; + }; + case 7: // Mirror horizontal and rotate 90 CW + return function (x, y) { + return [w - y - 1, h - x - 1]; + }; + case 8: // Rotate 270 CW + return function (x, y) { + return [w - y - 1, x]; + }; + default: + return null; + } +} +/** + * Transforms bitmap in place (moves pixels around) according to given + * transformation function. + * + * @param img a Jimp image object, which bitmap is supposed to + * be transformed + * @param width bitmap width after the transformation + * @param height bitmap height after the transformation + * @param transformation transformation function which defines pixel + * mapping between new and source bitmap. It takes a pair of coordinates + * in the target, and returns a respective pair of coordinates in + * the source bitmap, i.e. has following form: + * `function(new_x, new_y) { return [src_x, src_y] }`. + */ +function transformBitmap(img, width, height, transformation) { + // Underscore-prefixed values are related to the source bitmap + // Their counterparts with no prefix are related to the target bitmap + const _data = img.bitmap.data; + const _width = img.bitmap.width; + const data = Buffer.alloc(_data.length); + for (let x = 0; x < width; x++) { + for (let y = 0; y < height; y++) { + const [_x, _y] = transformation(x, y); + const idx = (width * y + x) << 2; + const _idx = (_width * _y + _x) << 2; + const pixel = _data.readUInt32BE(_idx); + data.writeUInt32BE(pixel, idx); + } + } + img.bitmap.data = data; + img.bitmap.width = width; + img.bitmap.height = height; + // @ts-expect-error Accessing private property + img._exif.tags.Orientation = 1; +} +/** + * Automagically rotates an image based on its EXIF data (if present). + * @param img a Jimp image object + */ +function exifRotate(img) { + if (getExifOrientation(img) < 2) { + return; + } + const transformation = getExifOrientationTransformation(img); + const swapDimensions = getExifOrientation(img) > 4; + const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; + const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; + if (transformation) { + transformBitmap(img, newWidth, newHeight, transformation); + } +} +export async function attemptExifRotate(image, buffer) { + try { + image._exif = + EXIFParser.create(buffer).parse(); + exifRotate(image); // EXIF data + } + catch { + // do nothing + } +} +//# sourceMappingURL=image-bitmap.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/image-bitmap.js.map b/node_modules/@jimp/core/dist/esm/utils/image-bitmap.js.map new file mode 100644 index 0000000000000000000000000000000000000000..56198c29d310311045701117679d8397a51d965e --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/image-bitmap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"image-bitmap.js","sourceRoot":"","sources":["../../../src/utils/image-bitmap.ts"],"names":[],"mappings":"AAAA,OAAO,UAAwB,MAAM,aAAa,CAAC;AAGnD;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAsB,GAAM;IAC5D,MAAM,KAAK,GAAI,GAAsC,CAAC,KAAK,CAAC;IAC5D,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,gCAAgC,CAAsB,GAAM;IACnE,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;IAC3B,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;IAE5B,QAAQ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CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAsB,GAAM;IAC7C,IAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,OAAO;IACT,CAAC;IAED,MAAM,cAAc,GAAG,gCAAgC,CAAC,GAAG,CAAC,CAAC;IAC7D,MAAM,cAAc,GAAG,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEnD,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;IACvE,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;IAExE,IAAI,cAAc,EAAE,CAAC;QACnB,eAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAQ,EACR,MAAc;IAEd,IAAI,CAAC;QACF,KAAwC,CAAC,KAAK;YAC7C,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC;QAEpC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,aAAa;IACf,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/mime.d.ts b/node_modules/@jimp/core/dist/esm/utils/mime.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b5e4d945b71567c26ded65cf8a884736885dcd6 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/mime.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=mime.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/mime.d.ts.map b/node_modules/@jimp/core/dist/esm/utils/mime.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..4b7d532657302946db85726d2a1d295920fa425f --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/mime.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mime.d.ts","sourceRoot":"","sources":["../../../src/utils/mime.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/mime.js b/node_modules/@jimp/core/dist/esm/utils/mime.js new file mode 100644 index 0000000000000000000000000000000000000000..dffd748bdbd11d7bbfe605e2dc08113170db1c08 --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/mime.js @@ -0,0 +1,29 @@ +// const mimeTypes = {}; +export {}; +// const findType = (extension: string) => +// Object.entries(mimeTypes).find((type) => type[1].includes(extension)) || []; +// export const addType = (mime: string, extensions: string[]) => { +// mimeTypes[mime] = extensions; +// }; +// /** +// * Lookup a mime type based on extension +// * @param {string} path path to find extension for +// * @returns {string} mime found mime type +// */ +// export const getType = (path: string) => { +// const pathParts = path.split("/").slice(-1); +// const extension = pathParts[pathParts.length - 1]?.split(".").pop(); +// if (!extension) { +// return null; +// } +// const type = findType(extension); +// return type[0]; +// }; +// /** +// * Return file extension associated with a mime type +// * @param {string} type mime type to look up +// * @returns {string} extension file extension +// */ +// export const getExtension = (type: string) => +// (mimeTypes[type.toLowerCase()] || [])[0]; +//# sourceMappingURL=mime.js.map \ No newline at end of file diff --git a/node_modules/@jimp/core/dist/esm/utils/mime.js.map b/node_modules/@jimp/core/dist/esm/utils/mime.js.map new file mode 100644 index 0000000000000000000000000000000000000000..48475cb688c04f7e19d711385f0b34eceded8c6a --- /dev/null +++ b/node_modules/@jimp/core/dist/esm/utils/mime.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mime.js","sourceRoot":"","sources":["../../../src/utils/mime.ts"],"names":[],"mappings":"AAAA,wBAAwB;;AAExB,0CAA0C;AAC1C,iFAAiF;AAEjF,mEAAmE;AACnE,kCAAkC;AAClC,KAAK;AAEL,MAAM;AACN,2CAA2C;AAC3C,qDAAqD;AACrD,4CAA4C;AAC5C,MAAM;AACN,6CAA6C;AAC7C,iDAAiD;AACjD,yEAAyE;AAEzE,sBAAsB;AACtB,mBAAmB;AACnB,MAAM;AAEN,sCAAsC;AAEtC,oBAAoB;AACpB,KAAK;AAEL,MAAM;AACN,uDAAuD;AACvD,+CAA+C;AAC/C,gDAAgD;AAChD,MAAM;AACN,gDAAgD;AAChD,8CAA8C"} \ No newline at end of file diff --git a/node_modules/@jimp/core/eslint.config.mjs b/node_modules/@jimp/core/eslint.config.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2b137b2a6354081a9578faf6d9a58b1896181c3e --- /dev/null +++ b/node_modules/@jimp/core/eslint.config.mjs @@ -0,0 +1,9 @@ +import shared from "@jimp/config-eslint/base.js"; +export default [ + ...shared, + { + rules: { + "@typescript-eslint/no-explicit-any": "off", + }, + }, +]; diff --git a/node_modules/@jimp/core/package.json b/node_modules/@jimp/core/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f1138f4941a5486c9ef407bda88766bf80b97e12 --- /dev/null +++ b/node_modules/@jimp/core/package.json @@ -0,0 +1,69 @@ +{ + "name": "@jimp/core", + "version": "1.6.1", + "repository": "jimp-dev/jimp", + "engines": { + "node": ">=18" + }, + "scripts": { + "lint": "eslint .", + "test-off": "vitest", + "build": "tshy", + "dev": "tshy --watch", + "clean": "rm -rf node_modules .tshy .tshy-build dist .turbo" + }, + "author": "Andrew Lisowski ", + "license": "MIT", + "dependencies": { + "@jimp/file-ops": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", + "await-to-js": "^3.0.0", + "exif-parser": "^0.1.12", + "file-type": "^21.3.3", + "mime": "3" + }, + "devDependencies": { + "@jimp/config-eslint": "1.6.1", + "@jimp/config-typescript": "1.6.1", + "@jimp/test-utils": "1.6.1", + "@types/mime": "^3.0.4", + "@types/node": "^18.19.48", + "eslint": "^9.9.1", + "tshy": "^3.0.2", + "typescript": "^5.5.4", + "vite-plugin-node-polyfills": "^0.22.0", + "vitest": "^2.0.5" + }, + "tshy": { + "exclude": [ + "**/*.test.ts" + ], + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "publishConfig": { + "access": "public" + }, + "sideEffects": false, + "module": "./dist/esm/index.js", + "gitHead": "7e6a95694e00a8b6f1bdd9aad709f5413eb9b08c" +} diff --git a/node_modules/@jimp/core/src/index.ts b/node_modules/@jimp/core/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a9c63d0a819bfb1cdbbb7244375c4d314067a3d --- /dev/null +++ b/node_modules/@jimp/core/src/index.ts @@ -0,0 +1,785 @@ +import { Bitmap, Format, JimpClass, Edge } from "@jimp/types"; +import { cssColorToHex, scan, scanIterator } from "@jimp/utils"; +import { to } from "await-to-js"; +import { existsSync, readFile, writeFile } from "@jimp/file-ops"; +import mime from "mime/lite.js"; + +import { composite } from "./utils/composite.js"; +import { BlendMode } from "./index.js"; +import { attemptExifRotate } from "./utils/image-bitmap.js"; + +const emptyBitmap: Bitmap = { + data: Buffer.alloc(0), + width: 0, + height: 0, +}; + +/** + * Prepare a Buffer object from the arrayBuffer. + */ +function bufferFromArrayBuffer(arrayBuffer: ArrayBuffer) { + const buffer = Buffer.alloc(arrayBuffer.byteLength); + const view = new Uint8Array(arrayBuffer); + + for (let i = 0; i < buffer.length; ++i) { + buffer[i] = view[i]!; + } + + return buffer; +} + +async function detectFileTypeFromBuffer(buffer: Buffer | ArrayBuffer) { + const { fileTypeFromBuffer } = await import("file-type"); + return fileTypeFromBuffer( + buffer instanceof ArrayBuffer + ? buffer + : new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength) + ); +} + +export { getExifOrientation } from "./utils/image-bitmap.js"; +export { composite } from "./utils/composite.js"; +export * from "./utils/constants.js"; + +export interface RawImageData { + width: number; + height: number; + data: Buffer | Uint8Array | Uint8ClampedArray | number[]; +} + +/** + * Instead of loading an image into an instance you can initialize a new Jimp instance with a empty bitmap. + */ +export interface JimpSimpleConstructorOptions { + height: number; + width: number; + /** + * Initialize the image with a color for each pixel + */ + color?: number | string; +} + +export type JimpConstructorOptions = Bitmap | JimpSimpleConstructorOptions; + +/** Converts a jimp plugin function to a Jimp class method */ +type JimpInstanceMethod = + Method extends JimpChainableMethod + ? ( + ...args: Args + ) => JimpInstanceMethods & ClassInstance + : Method extends JimpMethod + ? (...args: Args) => Return + : never; + +/** Converts a Record of jimp plugin functions to a Record of Jimp class methods */ +export type JimpInstanceMethods = { + [Key in keyof MethodMap]: JimpInstanceMethod< + ClassInstance, + MethodMap, + MethodMap[Key] + >; +}; + +/** A Jimp instance method that can be chained. */ +type JimpChainableMethod< + Args extends any[] = any[], + J extends JimpClass = JimpClass, +> = (img: J, ...args: Args) => J; + +/** A Jimp instance method that returns anything. */ +type JimpMethod< + Args extends any[] = any[], + ReturnType = any, + J extends JimpClass = JimpClass, +> = (img: J, ...args: Args) => ReturnType; + +export interface JimpPlugin { + [key: string]: JimpChainableMethod | JimpMethod; +} + +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( + k: infer I +) => void + ? I + : never; + +type Constructor = new (...args: any[]) => T; + +type JimpFormat< + MimeType extends string = string, + EncodeOptions extends Record | undefined = undefined, + DecodeOptions extends Record | undefined = undefined, + T extends Format = Format< + MimeType, + EncodeOptions, + DecodeOptions + >, +> = () => T; + +type CreateMimeTypeToExportOptions> = + T extends Format ? Record : never; +type CreateMimeTypeToDecodeOptions> = + T extends Format ? Record : never; +type GetOptionsForMimeType = + MimeTypeMap extends Record ? O : never; + +type PathWithExtension = `${string}.${E}`; +type MimeToExtension = `${string}/${M}`; +type CreateExtensionToMimeType = + M extends MimeToExtension ? Record : never; +type GetMimeTypeForExtension = + MimeTypeMap extends Record ? M : never; + +/** + * Create a Jimp class that support the given image formats and methods + */ +export function createJimp< + Methods extends JimpPlugin[], + Formats extends JimpFormat[], +>({ + plugins: pluginsArg, + formats: formatsArg, +}: { + /** Plugins that add methods to the created Jimp class */ + plugins?: Methods; + /** Image formats the Jimp class should support */ + formats?: Formats; +} = {}) { + type ExtraMethodMap = JimpInstanceMethods< + InstanceType, + UnionToIntersection + >; + type SupportedMimeTypes = ReturnType["mime"]; + type MimeTypeToExportOptions = CreateMimeTypeToExportOptions< + ReturnType + >; + type MimeTypeToDecodeOptions = CreateMimeTypeToDecodeOptions< + ReturnType + >; + type ExtensionToMimeType = CreateExtensionToMimeType; + + const plugins = pluginsArg || []; + const formats = (formatsArg || []).map((format) => format()); + + const CustomJimp = class Jimp implements JimpClass { + /** + * The bitmap data of the image + */ + bitmap: Bitmap = emptyBitmap; + + /** Default color to use for new pixels */ + background = 0x00000000; + + /** Formats that can be used with Jimp */ + formats: Format[] = []; + + /** The original MIME type of the image */ + mime?: string; + + constructor(options: JimpConstructorOptions = emptyBitmap) { + // Add the formats + this.formats = formats; + + if ("data" in options) { + this.bitmap = options; + } else { + this.bitmap = { + data: Buffer.alloc(options.width * options.height * 4), + width: options.width, + height: options.height, + }; + + if (options.color) { + this.background = + typeof options.color === "string" + ? cssColorToHex(options.color) + : options.color; + + for (let i = 0; i < this.bitmap.data.length; i += 4) { + this.bitmap.data.writeUInt32BE(this.background, i); + } + } + } + + // Add the plugins + for (const methods of plugins) { + for (const key in methods) { + (this as any)[key] = (...args: any[]) => { + const result = methods[key]?.(this, ...args); + + if (typeof result === "object" && "bitmap" in result) { + this.bitmap = result.bitmap; + return this; + } + + return result; + }; + } + } + } + + /** + * Create a Jimp instance from a URL, a file path, or a Buffer + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * // Read from a file path + * const image = await Jimp.read("test/image.png"); + * + * // Read from a URL + * const image = await Jimp.read("https://upload.wikimedia.org/wikipedia/commons/0/01/Bot-Test.jpg"); + * ``` + */ + static async read( + url: string | Buffer | ArrayBuffer, + options?: MimeTypeToDecodeOptions + ) { + if (Buffer.isBuffer(url) || url instanceof ArrayBuffer) { + return this.fromBuffer(url); + } + + if (existsSync(url)) { + return this.fromBuffer(await readFile(url)); + } + + const [fetchErr, response] = await to(fetch(url)); + + if (fetchErr) { + throw new Error(`Could not load Buffer from URL: ${url}`); + } + + if (!response.ok) { + throw new Error(`HTTP Status ${response.status} for url ${url}`); + } + + const [arrayBufferErr, data] = await to(response.arrayBuffer()); + + if (arrayBufferErr) { + throw new Error(`Could not load Buffer from ${url}`); + } + + const buffer = bufferFromArrayBuffer(data); + return this.fromBuffer(buffer, options); + } + + /** + * Create a Jimp instance from a bitmap. + * The difference between this and just using the constructor is that this will + * convert raw image data into the bitmap format that Jimp uses. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBitmap({ + * data: Buffer.from([ + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * 0xffffffff, 0xffffffff, 0xffffffff, + * ]), + * width: 3, + * height: 3, + * }); + * ``` + */ + static fromBitmap(bitmap: RawImageData) { + let data: Buffer | undefined; + + if (bitmap.data instanceof Buffer) { + data = Buffer.from(bitmap.data); + } + + if ( + bitmap.data instanceof Uint8Array || + bitmap.data instanceof Uint8ClampedArray + ) { + data = Buffer.from(bitmap.data.buffer); + } + + if (Array.isArray(bitmap.data)) { + data = Buffer.concat( + bitmap.data.map((hex) => + Buffer.from(hex.toString(16).padStart(8, "0"), "hex") + ) + ); + } + + if (!data) { + throw new Error("data must be a Buffer"); + } + + if ( + typeof bitmap.height !== "number" || + typeof bitmap.width !== "number" + ) { + throw new Error("bitmap must have width and height"); + } + + return new CustomJimp({ + height: bitmap.height, + width: bitmap.width, + data, + }) as InstanceType & ExtraMethodMap; + } + + /** + * Parse a bitmap with the loaded image types. + * + * @param buffer Raw image data + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const buffer = await fs.readFile("test/image.png"); + * const image = await Jimp.fromBuffer(buffer); + * ``` + */ + static async fromBuffer( + buffer: Buffer | ArrayBuffer, + options?: MimeTypeToDecodeOptions + ) { + const actualBuffer = + buffer instanceof ArrayBuffer ? bufferFromArrayBuffer(buffer) : buffer; + + const mime = await detectFileTypeFromBuffer(actualBuffer); + + if (!mime || !mime.mime) { + throw new Error("Could not find MIME for Buffer"); + } + + const format = formats.find((format) => format.mime === mime.mime); + + if (!format || !format.decode) { + throw new Error(`Mime type ${mime.mime} does not support decoding`); + } + + const image = new CustomJimp( + await format.decode(actualBuffer, options?.[format.mime]) + ) as InstanceType & ExtraMethodMap; + + image.mime = mime.mime; + + attemptExifRotate(image, actualBuffer); + + return image; + } + + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns Pretty printed jimp object + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * + * console.log(image); + * ``` + */ + inspect() { + return ( + "" + ); + } + + /** + * Nicely format Jimp object when converted to a string + * @returns pretty printed + */ + toString() { + return "[object Jimp]"; + } + + /** Get the width of the image */ + get width() { + return this.bitmap.width; + } + + /** Get the height of the image */ + get height() { + return this.bitmap.height; + } + + /** + * Converts the Jimp instance to an image buffer + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * import { promises as fs } from "fs"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * await image.getBuffer("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + async getBuffer< + ProvidedMimeType extends SupportedMimeTypes, + Options extends GetOptionsForMimeType< + ProvidedMimeType, + MimeTypeToExportOptions + >, + >(mime: ProvidedMimeType, options?: Options) { + const format = this.formats.find((format) => format.mime === mime); + + if (!format || !format.encode) { + throw new Error(`Unsupported MIME type: ${mime}`); + } + + let outputImage: Jimp; + + if (format.hasAlpha) { + // eslint-disable-next-line @typescript-eslint/no-this-alias + outputImage = this; + } else { + outputImage = new CustomJimp({ + width: this.bitmap.width, + height: this.bitmap.height, + color: this.background, + }); + + composite(outputImage, this); + } + + return format.encode(outputImage.bitmap, options); + } + + /** + * Converts the image to a base 64 string + * + * @param mime The mime type to export to + * @param options The options to use when exporting + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * const base64 = image.getBase64("image/jpeg", { + * quality: 50, + * }); + * ``` + */ + async getBase64< + ProvidedMimeType extends SupportedMimeTypes, + Options extends GetOptionsForMimeType< + ProvidedMimeType, + MimeTypeToExportOptions + >, + >(mime: ProvidedMimeType, options?: Options) { + const data = await this.getBuffer(mime, options); + return "data:" + mime + ";base64," + data.toString("base64"); + } + + /** + * Write the image to a file + * @param path the path to write the image to + * @param options the options to use when writing the image + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = Jimp.fromBuffer(Buffer.from([ + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + * ])); + * + * await image.write("test/output.png"); + * ``` + */ + async write< + Extension extends string, + Mime extends GetMimeTypeForExtension, + Options extends GetOptionsForMimeType, + >(path: PathWithExtension, options?: Options) { + const mimeType = mime.getType(path); + await writeFile( + path, + await this.getBuffer(mimeType as SupportedMimeTypes, options) + ); + } + + /** + * Clone the image into a new Jimp instance. + * @param this + * @returns A new Jimp instance + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * const clone = image.clone(); + * ``` + */ + clone(this: S) { + return new CustomJimp({ + ...(this as any).bitmap, + data: Buffer.from((this as any).bitmap.data), + }) as unknown as S; + } + + /** + * Returns the offset of a pixel in the bitmap buffer + * @param x the x coordinate + * @param y the y coordinate + * @param edgeHandling (optional) define how to sum pixels from outside the border + * @returns the index of the pixel or -1 if not found + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelIndex(1, 1); // 2 + * ``` + */ + getPixelIndex(x: number, y: number, edgeHandling?: Edge) { + let xi; + let yi; + + if (!edgeHandling) { + edgeHandling = Edge.EXTEND; + } + + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + + // round input + x = Math.round(x); + y = Math.round(y); + xi = x; + yi = y; + + if (edgeHandling === Edge.EXTEND) { + if (x < 0) xi = 0; + if (x >= this.bitmap.width) xi = this.bitmap.width - 1; + if (y < 0) yi = 0; + if (y >= this.bitmap.height) yi = this.bitmap.height - 1; + } + + if (edgeHandling === Edge.WRAP) { + if (x < 0) { + xi = this.bitmap.width + x; + } + + if (x >= this.bitmap.width) { + xi = x % this.bitmap.width; + } + + if (y < 0) { + yi = this.bitmap.height + y; + } + + if (y >= this.bitmap.height) { + yi = y % this.bitmap.height; + } + } + + let i = (this.bitmap.width * yi + xi) << 2; + + // if out of bounds index is -1 + if (xi < 0 || xi >= this.bitmap.width) { + i = -1; + } + + if (yi < 0 || yi >= this.bitmap.height) { + i = -1; + } + + return i; + } + + /** + * Returns the hex color value of a pixel + * @param x the x coordinate + * @param y the y coordinate + * @returns the color of the pixel + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.getPixelColor(1, 1); // 0xffffffff + * ``` + */ + getPixelColor(x: number, y: number) { + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + + const idx = this.getPixelIndex(x, y); + return this.bitmap.data.readUInt32BE(idx); + } + + /** + * Sets the hex colour value of a pixel + * + * @param hex color to set + * @param x the x coordinate + * @param y the y coordinate + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.setPixelColor(0xff0000ff, 0, 0); + * ``` + */ + setPixelColor(hex: number, x: number, y: number) { + if ( + typeof hex !== "number" || + typeof x !== "number" || + typeof y !== "number" + ) { + throw new Error("hex, x and y must be numbers"); + } + + const idx = this.getPixelIndex(x, y); + this.bitmap.data.writeUInt32BE(hex, idx); + + return this; + } + + /** + * Determine if the image contains opaque pixels. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffaa }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.hasAlpha(); // false + * image2.hasAlpha(); // true + * ``` + */ + hasAlpha() { + const { width, height, data } = this.bitmap; + const byteLen = (width * height) << 2; + + for (let idx = 3; idx < byteLen; idx += 4) { + if (data[idx] !== 0xff) { + return true; + } + } + + return false; + } + + /** + * Composites a source image over to this image respecting alpha channels + * @param src the source Jimp instance + * @param x the x position to blit the image + * @param y the y position to blit the image + * @param options determine what mode to use + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 10, height: 10, color: 0xffffffff }); + * const image2 = new Jimp({ width: 3, height: 3, color: 0xff0000ff }); + * + * image.composite(image2, 3, 3); + * ``` + */ + composite( + src: I, + x = 0, + y = 0, + options: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + } = {} + ) { + return composite(this, src, x, y, options); + } + + /** + * Scan through the image and call the callback for each pixel + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * image.scan((x, y, idx) => { + * // do something with the pixel + * }); + * + * // Or scan through just a region + * image.scan(0, 0, 2, 2, (x, y, idx) => { + * // do something with the pixel + * }); + * ``` + */ + scan(f: (x: number, y: number, idx: number) => any): this; + scan( + x: number, + y: number, + w: number, + h: number, + cb: (x: number, y: number, idx: number) => any + ): this; + scan( + x: number | ((x: number, y: number, idx: number) => any), + y?: number, + w?: number, + h?: number, + f?: (x: number, y: number, idx: number) => any + ): this { + return scan(this, x as any, y as any, w as any, h as any, f as any); + } + + /** + * Iterate scan through a region of the bitmap + * @param x the x coordinate to begin the scan at + * @param y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); + * + * for (const { x, y, idx, image } of j.scanIterator()) { + * // do something with the pixel + * } + * ``` + */ + scanIterator(x = 0, y = 0, w = this.bitmap.width, h = this.bitmap.height) { + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + + if (typeof w !== "number" || typeof h !== "number") { + throw new Error("w and h must be numbers"); + } + + return scanIterator(this, x, y, w, h); + } + }; + + return CustomJimp as typeof CustomJimp & Constructor; +} diff --git a/node_modules/@jimp/core/src/utils/composite-modes.ts b/node_modules/@jimp/core/src/utils/composite-modes.ts new file mode 100644 index 0000000000000000000000000000000000000000..055075c81925628eac11d46a10fcda74e420b964 --- /dev/null +++ b/node_modules/@jimp/core/src/utils/composite-modes.ts @@ -0,0 +1,308 @@ +import { RGBAColor } from "@jimp/types"; + +export function srcOver(src: RGBAColor, dst: RGBAColor, ops = 1) { + src.a *= ops; + + const a = dst.a + src.a - dst.a * src.a; + + const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a; + const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a; + const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a; + + return { r, g, b, a }; +} + +export function dstOver(src: RGBAColor, dst: RGBAColor, ops = 1) { + src.a *= ops; + + const a = dst.a + src.a - dst.a * src.a; + + const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a; + const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a; + const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a; + + return { r, g, b, a }; +} + +export function multiply(src: RGBAColor, dst: RGBAColor, ops = 1) { + src.a *= ops; + + const a = dst.a + src.a - dst.a * src.a; + + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + + const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + + return { r, g, b, a }; +} + +export function add(src: RGBAColor, dst: RGBAColor, ops = 1) { + src.a *= ops; + + const a = dst.a + src.a - dst.a * src.a; + + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + + const r = (sra + dra) / a; + const g = (sga + dga) / a; + const b = (sba + dba) / a; + + return { r, g, b, a }; +} + +export function screen(src: RGBAColor, dst: RGBAColor, ops = 1) { + src.a *= ops; + + const a = dst.a + src.a - dst.a * src.a; + + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + + const r = + (sra * dst.a + + dra * src.a - + sra * dra + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = + (sga * dst.a + + dga * src.a - + sga * dga + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = + (sba * dst.a + + dba * src.a - + sba * dba + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + + return { r, g, b, a }; +} + +export function overlay(src: RGBAColor, dst: RGBAColor, ops = 1) { + src.a *= ops; + + const a = dst.a + src.a - dst.a * src.a; + + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + + const r = + (2 * dra <= dst.a + ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) + : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / + a; + + const g = + (2 * dga <= dst.a + ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) + : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / + a; + + const b = + (2 * dba <= dst.a + ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) + : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / + a; + + return { r, g, b, a }; +} + +export function darken(src: RGBAColor, dst: RGBAColor, ops = 1) { + src.a *= ops; + + const a = dst.a + src.a - dst.a * src.a; + + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + + const r = + (Math.min(sra * dst.a, dra * src.a) + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = + (Math.min(sga * dst.a, dga * src.a) + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = + (Math.min(sba * dst.a, dba * src.a) + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + + return { r, g, b, a }; +} + +export function lighten(src: RGBAColor, dst: RGBAColor, ops = 1) { + src.a *= ops; + + const a = dst.a + src.a - dst.a * src.a; + + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + + const r = + (Math.max(sra * dst.a, dra * src.a) + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = + (Math.max(sga * dst.a, dga * src.a) + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = + (Math.max(sba * dst.a, dba * src.a) + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + + return { r, g, b, a }; +} + +export function hardLight(src: RGBAColor, dst: RGBAColor, ops = 1) { + src.a *= ops; + + const a = dst.a + src.a - dst.a * src.a; + + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + + const r = + (2 * sra <= src.a + ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) + : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / + a; + + const g = + (2 * sga <= src.a + ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) + : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / + a; + + const b = + (2 * sba <= src.a + ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) + : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / + a; + + return { r, g, b, a }; +} + +export function difference(src: RGBAColor, dst: RGBAColor, ops = 1) { + src.a *= ops; + + const a = dst.a + src.a - dst.a * src.a; + + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + + const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a; + const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a; + const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a; + + return { r, g, b, a }; +} + +export function exclusion(src: RGBAColor, dst: RGBAColor, ops = 1) { + src.a *= ops; + + const a = dst.a + src.a - dst.a * src.a; + + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + + const r = + (sra * dst.a + + dra * src.a - + 2 * sra * dra + + sra * (1 - dst.a) + + dra * (1 - src.a)) / + a; + const g = + (sga * dst.a + + dga * src.a - + 2 * sga * dga + + sga * (1 - dst.a) + + dga * (1 - src.a)) / + a; + const b = + (sba * dst.a + + dba * src.a - + 2 * sba * dba + + sba * (1 - dst.a) + + dba * (1 - src.a)) / + a; + + return { r, g, b, a }; +} + +export const names = [ + srcOver, + dstOver, + multiply, + add, + screen, + overlay, + darken, + lighten, + hardLight, + difference, + exclusion, +] as const; +export type CompositeMode = (typeof names)[number]; diff --git a/node_modules/@jimp/core/src/utils/composite.ts b/node_modules/@jimp/core/src/utils/composite.ts new file mode 100644 index 0000000000000000000000000000000000000000..3dd7fd96917fb3480d2c412a2ea97251a8fd236d --- /dev/null +++ b/node_modules/@jimp/core/src/utils/composite.ts @@ -0,0 +1,85 @@ +import { Edge, JimpClass } from "@jimp/types"; + +import { BlendMode } from "./constants.js"; +import * as compositeModes from "./composite-modes.js"; +import { limit255 } from "@jimp/utils"; + +export function composite( + baseImage: I, + src: I, + x = 0, + y = 0, + options: { + mode?: BlendMode; + opacitySource?: number; + opacityDest?: number; + } = {} +) { + if (!(src instanceof baseImage.constructor)) { + throw new Error("The source must be a Jimp image"); + } + + if (typeof x !== "number" || typeof y !== "number") { + throw new Error("x and y must be numbers"); + } + + const { mode = BlendMode.SRC_OVER } = options; + let { opacitySource = 1.0, opacityDest = 1.0 } = options; + + if ( + typeof opacitySource !== "number" || + opacitySource < 0 || + opacitySource > 1 + ) { + opacitySource = 1.0; + } + + if (typeof opacityDest !== "number" || opacityDest < 0 || opacityDest > 1) { + opacityDest = 1.0; + } + + const blendmode = compositeModes[mode]; + + // round input + x = Math.round(x); + y = Math.round(y); + + if (opacityDest !== 1.0) { + baseImage.scan((_, __, idx) => { + const v = baseImage.bitmap.data[idx + 3]! * opacityDest; + baseImage.bitmap.data[idx + 3] = v; + }); + } + + src.scan((sx, sy, idx) => { + const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, Edge.CROP); + + if (dstIdx === -1) { + // Skip target pixels outside of dst + return; + } + + const blended = blendmode( + { + r: src.bitmap.data[idx + 0]! / 255, + g: src.bitmap.data[idx + 1]! / 255, + b: src.bitmap.data[idx + 2]! / 255, + a: src.bitmap.data[idx + 3]! / 255, + }, + { + r: baseImage.bitmap.data[dstIdx + 0]! / 255, + g: baseImage.bitmap.data[dstIdx + 1]! / 255, + b: baseImage.bitmap.data[dstIdx + 2]! / 255, + a: baseImage.bitmap.data[dstIdx + 3]! / 255, + }, + opacitySource + ); + + baseImage.bitmap.data[dstIdx + 0] = limit255(blended.r * 255); + baseImage.bitmap.data[dstIdx + 1] = limit255(blended.g * 255); + baseImage.bitmap.data[dstIdx + 2] = limit255(blended.b * 255); + baseImage.bitmap.data[dstIdx + 3] = limit255(blended.a * 255); + }); + + return baseImage; +} diff --git a/node_modules/@jimp/core/src/utils/constants.ts b/node_modules/@jimp/core/src/utils/constants.ts new file mode 100644 index 0000000000000000000000000000000000000000..840d9d21f510bcae13a7c39ab99c9b390887f8fd --- /dev/null +++ b/node_modules/@jimp/core/src/utils/constants.ts @@ -0,0 +1,88 @@ +/* Horizontal align modes for cover, contain, bit masks */ +export enum HorizontalAlign { + LEFT = 1, + CENTER = 2, + RIGHT = 4, +} + +/* Vertical align modes for cover, contain, bit masks */ +export enum VerticalAlign { + TOP = 8, + MIDDLE = 16, + BOTTOM = 32, +} + +/** + * How to blend two images together + */ +export enum BlendMode { + /** + * Composite the source image over the destination image. + * This is the default value. It represents the most intuitive case, where shapes are painted on top of what is below, with transparent areas showing the destination layer. + */ + SRC_OVER = "srcOver", + /** Composite the source image under the destination image. */ + DST_OVER = "dstOver", + /** + * Multiply the color components of the source and destination images. + * This can only result in the same or darker colors (multiplying by white, 1.0, results in no change; multiplying by black, 0.0, results in black). + * When compositing two opaque images, this has similar effect to overlapping two transparencies on a projector. + * + * This mode is useful for coloring shadows. + */ + MULTIPLY = "multiply", + /** + * The Add mode adds the color information of the base layers and the blending layer. + * In digital terms, adding color increases the brightness. + */ + ADD = "add", + /** + * Multiply the inverse of the components of the source and destination images, and inverse the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * This is essentially the same as modulate blend mode, but with the values of the colors inverted before the multiplication and the result being inverted back before rendering. + * This can only result in the same or lighter colors (multiplying by black, 1.0, results in no change; multiplying by white, 0.0, results in white). Similarly, in the alpha channel, it can only result in more opaque colors. + * This has similar effect to two projectors displaying their images on the same screen simultaneously. + */ + SCREEN = "screen", + /** + * Multiply the components of the source and destination images after adjusting them to favor the destination. + * Specifically, if the destination value is smaller, this multiplies it with the source value, whereas is the source value is smaller, it multiplies the inverse of the source value with the inverse of the destination value, then inverts the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * + * The Overlay mode behaves like Screen mode in bright areas, and like Multiply mode in darker areas. + * With this mode, the bright areas will look brighter and the dark areas will look darker. + */ + OVERLAY = "overlay", + /** + * Composite the source and destination image by choosing the lowest value from each color channel. + * The opacity of the output image is computed in the same way as for srcOver. + */ + DARKEN = "darken", + /** + * Composite the source and destination image by choosing the highest value from each color channel. + * The opacity of the output image is computed in the same way as for srcOver. + */ + LIGHTEN = "lighten", + /** + * Multiply the components of the source and destination images after adjusting them to favor the source. + * Specifically, if the source value is smaller, this multiplies it with the destination value, whereas is the destination value is smaller, it multiplies the inverse of the destination value with the inverse of the source value, then inverts the result. + * Inverting the components means that a fully saturated channel (opaque white) is treated as the value 0.0, and values normally treated as 0.0 (black, transparent) are treated as 1.0. + * + * The effect of the Hard light mode depends on the density of the superimposed color. Using bright colors on the blending layer will create a brighter effect like the Screen modes, while dark colors will create darker colors like the Multiply mode. + */ + HARD_LIGHT = "hardLight", + /** + * Subtract the smaller value from the bigger value for each channel. + * Compositing black has no effect; compositing white inverts the colors of the other image. + * The opacity of the output image is computed in the same way as for srcOver. + * The effect is similar to exclusion but harsher. + */ + DIFFERENCE = "difference", + /** + * Subtract double the product of the two images from the sum of the two images. + * Compositing black has no effect; compositing white inverts the colors of the other image. + * The opacity of the output image is computed in the same way as for srcOver. + * The effect is similar to difference but softer. + */ + EXCLUSION = "exclusion", +} diff --git a/node_modules/@jimp/core/src/utils/exif-parser.d.ts b/node_modules/@jimp/core/src/utils/exif-parser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e42fc9013150bd7483e951eac1c825ad7aeb0f65 --- /dev/null +++ b/node_modules/@jimp/core/src/utils/exif-parser.d.ts @@ -0,0 +1,13 @@ +declare module "exif-parser" { + export interface ExifData { + tags?: { + Orientation?: number; + }; + } + + function create(data: Buffer): { + parse: () => ExifData; + }; + + export { create }; +} diff --git a/node_modules/@jimp/core/src/utils/image-bitmap.ts b/node_modules/@jimp/core/src/utils/image-bitmap.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7055e7863b86832cf3806ef140d4ac515d0da2c --- /dev/null +++ b/node_modules/@jimp/core/src/utils/image-bitmap.ts @@ -0,0 +1,153 @@ +import EXIFParser, { ExifData } from "exif-parser"; +import { JimpClass } from "@jimp/types"; + +/** + * Obtains image orientation from EXIF metadata. + * + * @param img a Jimp image object + * @returns a number 1-8 representing EXIF orientation, + * in particular 1 if orientation tag is missing + */ +export function getExifOrientation(img: I) { + const _exif = (img as unknown as { _exif: ExifData })._exif; + return (_exif && _exif.tags && _exif.tags.Orientation) || 1; +} + +/** + * Returns a function which translates EXIF-rotated coordinates into + * non-rotated ones. + * + * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html. + * + * @param img a Jimp image object + * @returns transformation function for transformBitmap(). + */ +function getExifOrientationTransformation(img: I) { + const w = img.bitmap.width; + const h = img.bitmap.height; + + switch (getExifOrientation(img)) { + case 1: // Horizontal (normal) + // does not need to be supported here + return null; + + case 2: // Mirror horizontal + return function (x: number, y: number) { + return [w - x - 1, y] as const; + }; + + case 3: // Rotate 180 + return function (x: number, y: number) { + return [w - x - 1, h - y - 1] as const; + }; + + case 4: // Mirror vertical + return function (x: number, y: number) { + return [x, h - y - 1] as const; + }; + + case 5: // Mirror horizontal and rotate 270 CW + return function (x: number, y: number) { + return [y, x] as const; + }; + + case 6: // Rotate 90 CW + return function (x: number, y: number) { + return [y, h - x - 1] as const; + }; + + case 7: // Mirror horizontal and rotate 90 CW + return function (x: number, y: number) { + return [w - y - 1, h - x - 1] as const; + }; + + case 8: // Rotate 270 CW + return function (x: number, y: number) { + return [w - y - 1, x] as const; + }; + + default: + return null; + } +} + +/** + * Transforms bitmap in place (moves pixels around) according to given + * transformation function. + * + * @param img a Jimp image object, which bitmap is supposed to + * be transformed + * @param width bitmap width after the transformation + * @param height bitmap height after the transformation + * @param transformation transformation function which defines pixel + * mapping between new and source bitmap. It takes a pair of coordinates + * in the target, and returns a respective pair of coordinates in + * the source bitmap, i.e. has following form: + * `function(new_x, new_y) { return [src_x, src_y] }`. + */ +function transformBitmap( + img: I, + width: number, + height: number, + transformation: (x: number, y: number) => readonly [number, number] +) { + // Underscore-prefixed values are related to the source bitmap + // Their counterparts with no prefix are related to the target bitmap + const _data = img.bitmap.data; + const _width = img.bitmap.width; + + const data = Buffer.alloc(_data.length); + + for (let x = 0; x < width; x++) { + for (let y = 0; y < height; y++) { + const [_x, _y] = transformation(x, y); + + const idx = (width * y + x) << 2; + const _idx = (_width * _y + _x) << 2; + + const pixel = _data.readUInt32BE(_idx); + data.writeUInt32BE(pixel, idx); + } + } + + img.bitmap.data = data; + img.bitmap.width = width; + img.bitmap.height = height; + + // @ts-expect-error Accessing private property + img._exif.tags.Orientation = 1; +} + +/** + * Automagically rotates an image based on its EXIF data (if present). + * @param img a Jimp image object + */ +function exifRotate(img: I) { + if (getExifOrientation(img) < 2) { + return; + } + + const transformation = getExifOrientationTransformation(img); + const swapDimensions = getExifOrientation(img) > 4; + + const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; + const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; + + if (transformation) { + transformBitmap(img, newWidth, newHeight, transformation); + } +} + +export async function attemptExifRotate( + image: I, + buffer: Buffer +) { + try { + (image as unknown as { _exif: ExifData })._exif = + EXIFParser.create(buffer).parse(); + + exifRotate(image); // EXIF data + } catch { + // do nothing + } +} diff --git a/node_modules/@jimp/core/src/utils/mime.ts b/node_modules/@jimp/core/src/utils/mime.ts new file mode 100644 index 0000000000000000000000000000000000000000..97c9548e6db29edc992c400700ec5b6b0902e913 --- /dev/null +++ b/node_modules/@jimp/core/src/utils/mime.ts @@ -0,0 +1,34 @@ +// const mimeTypes = {}; + +// const findType = (extension: string) => +// Object.entries(mimeTypes).find((type) => type[1].includes(extension)) || []; + +// export const addType = (mime: string, extensions: string[]) => { +// mimeTypes[mime] = extensions; +// }; + +// /** +// * Lookup a mime type based on extension +// * @param {string} path path to find extension for +// * @returns {string} mime found mime type +// */ +// export const getType = (path: string) => { +// const pathParts = path.split("/").slice(-1); +// const extension = pathParts[pathParts.length - 1]?.split(".").pop(); + +// if (!extension) { +// return null; +// } + +// const type = findType(extension); + +// return type[0]; +// }; + +// /** +// * Return file extension associated with a mime type +// * @param {string} type mime type to look up +// * @returns {string} extension file extension +// */ +// export const getExtension = (type: string) => +// (mimeTypes[type.toLowerCase()] || [])[0]; diff --git a/node_modules/@jimp/core/tsconfig.json b/node_modules/@jimp/core/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..ad7f216ca2b10874329665feda994727844e4305 --- /dev/null +++ b/node_modules/@jimp/core/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@jimp/config-typescript/base.json", + "compilerOptions": { + "outDir": "dist" + } +} diff --git a/node_modules/@jimp/diff/.tshy/build.json b/node_modules/@jimp/diff/.tshy/build.json new file mode 100644 index 0000000000000000000000000000000000000000..aea1a9e93b5db3468973ebeaad6dac0a77b10c02 --- /dev/null +++ b/node_modules/@jimp/diff/.tshy/build.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../src", + "module": "nodenext", + "moduleResolution": "nodenext" + } +} diff --git a/node_modules/@jimp/diff/.tshy/commonjs.json b/node_modules/@jimp/diff/.tshy/commonjs.json new file mode 100644 index 0000000000000000000000000000000000000000..75bcfc1d756dcb1baafc973385c81c5aa93f3174 --- /dev/null +++ b/node_modules/@jimp/diff/.tshy/commonjs.json @@ -0,0 +1,17 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.cts", + "../src/**/*.tsx", + "../src/**/*.json" + ], + "exclude": [ + "../**/*.test.ts", + "../src/**/*.mts", + "../src/package.json" + ], + "compilerOptions": { + "outDir": "../.tshy-build/commonjs" + } +} diff --git a/node_modules/@jimp/diff/.tshy/esm.json b/node_modules/@jimp/diff/.tshy/esm.json new file mode 100644 index 0000000000000000000000000000000000000000..fdc4fa775818876f2e8f6cd606e9bb337515ac56 --- /dev/null +++ b/node_modules/@jimp/diff/.tshy/esm.json @@ -0,0 +1,16 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.mts", + "../src/**/*.tsx", + "../src/**/*.json" + ], + "exclude": [ + "../**/*.test.ts", + "../src/package.json" + ], + "compilerOptions": { + "outDir": "../.tshy-build/esm" + } +} diff --git a/node_modules/@jimp/diff/CHANGELOG.md b/node_modules/@jimp/diff/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..0d0e934ad77696735ccc26587ccfff4955f44d52 --- /dev/null +++ b/node_modules/@jimp/diff/CHANGELOG.md @@ -0,0 +1,63 @@ +# v1.1.3 (Mon Sep 02 2024) + +#### ๐Ÿ› Bug Fix + +- Update deps [#1319](https://github.com/jimp-dev/jimp/pull/1319) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.1.2 (Mon Sep 02 2024) + +#### ๐Ÿ› Bug Fix + +- Jimp.diff() to make real resize before image compare [#1311](https://github.com/jimp-dev/jimp/pull/1311) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.1.0 (Sun Sep 01 2024) + +#### โš ๏ธ Pushed to `main` + +- upgrade tshy ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.0.3 (Sat Aug 31 2024) + +#### ๐Ÿ› Bug Fix + +- Fix build [#1303](https://github.com/jimp-dev/jimp/pull/1303) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### โš ๏ธ Pushed to `main` + +- add clean script ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v1.0.2 (Sat Aug 31 2024) + +#### โš ๏ธ Pushed to `main` + +- set side effects ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- fix versions ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- add publish config ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) diff --git a/node_modules/@jimp/diff/LICENSE b/node_modules/@jimp/diff/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..baa5d48509a18b9ab4f6c39289362690ea68e688 --- /dev/null +++ b/node_modules/@jimp/diff/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Oliver Moran + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@jimp/diff/dist/commonjs/index.d.ts b/node_modules/@jimp/diff/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba17a429e354018b6e20e002e8fcc110c4f488c --- /dev/null +++ b/node_modules/@jimp/diff/dist/commonjs/index.d.ts @@ -0,0 +1,27 @@ +import { JimpClass } from "@jimp/types"; +/** + * Diffs two images and returns + * @param img1 A Jimp image to compare + * @param img2 A Jimp image to compare + * @param threshold A number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) + * @returns An object with the following properties: + * - percent: The proportion of different pixels (0-1), where 0 means the two images are pixel identical + * - image: A Jimp image showing differences + * @example + * ```ts + * import { Jimp, diff } from "jimp"; + * + * const image1 = await Jimp.read("test/image.png"); + * const image2 = await Jimp.read("test/image.png"); + * + * const diff = diff(image1, image2); + * + * diff.percent; // 0.5 + * diff.image; // a Jimp image showing differences + * ``` + */ +export declare function diff(img1: I, img2: I, threshold?: number): { + percent: number; + image: any; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/diff/dist/commonjs/index.d.ts.map b/node_modules/@jimp/diff/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..3344b9a38b551b9b0c493e09c0cfb1143b04e7e1 --- /dev/null +++ b/node_modules/@jimp/diff/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,SAAM;;;EA4C1E"} \ No newline at end of file diff --git a/node_modules/@jimp/diff/dist/commonjs/index.js b/node_modules/@jimp/diff/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3d90503f609a59509d9c047fa8f2ff26bc2653b5 --- /dev/null +++ b/node_modules/@jimp/diff/dist/commonjs/index.js @@ -0,0 +1,65 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.diff = diff; +const plugin_resize_1 = require("@jimp/plugin-resize"); +const utils_1 = require("@jimp/utils"); +const pixelmatch_1 = __importDefault(require("pixelmatch")); +/** + * Diffs two images and returns + * @param img1 A Jimp image to compare + * @param img2 A Jimp image to compare + * @param threshold A number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) + * @returns An object with the following properties: + * - percent: The proportion of different pixels (0-1), where 0 means the two images are pixel identical + * - image: A Jimp image showing differences + * @example + * ```ts + * import { Jimp, diff } from "jimp"; + * + * const image1 = await Jimp.read("test/image.png"); + * const image2 = await Jimp.read("test/image.png"); + * + * const diff = diff(image1, image2); + * + * diff.percent; // 0.5 + * diff.image; // a Jimp image showing differences + * ``` + */ +function diff(img1, img2, threshold = 0.1) { + let bmp1 = img1.bitmap; + let bmp2 = img2.bitmap; + if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) { + if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) { + // img1 is bigger + bmp1 = plugin_resize_1.methods.resize((0, utils_1.clone)(img1), { + w: bmp2.width, + h: bmp2.height, + }).bitmap; + } + else { + // img2 is bigger (or they are the same in area) + bmp2 = plugin_resize_1.methods.resize((0, utils_1.clone)(img2), { + w: bmp1.width, + h: bmp1.height, + }).bitmap; + } + } + if (typeof threshold !== "number" || threshold < 0 || threshold > 1) { + throw new Error("threshold must be a number between 0 and 1"); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const diff = new img1.constructor({ + width: bmp1.width, + height: bmp1.height, + color: 0xffffffff, + }); + const numDiffPixels = (0, pixelmatch_1.default)(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, { threshold }); + return { + percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height), + image: diff, + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/diff/dist/commonjs/index.js.map b/node_modules/@jimp/diff/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f5202a7e9c36bfcf51961a5c45b5fed214fabf18 --- /dev/null +++ b/node_modules/@jimp/diff/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AA0BA,oBA4CC;AAtED,uDAA8C;AAE9C,uCAAoC;AACpC,4DAAoC;AAEpC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,IAAI,CAAsB,IAAO,EAAE,IAAO,EAAE,SAAS,GAAG,GAAG;IACzE,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;IACvB,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;IAEvB,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;QAC7D,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YACxD,iBAAiB;YACjB,IAAI,GAAG,uBAAO,CAAC,MAAM,CAAC,IAAA,aAAK,EAAC,IAAI,CAAC,EAAE;gBACjC,CAAC,EAAE,IAAI,CAAC,KAAK;gBACb,CAAC,EAAE,IAAI,CAAC,MAAM;aACf,CAAC,CAAC,MAAM,CAAC;QACZ,CAAC;aAAM,CAAC;YACN,gDAAgD;YAChD,IAAI,GAAG,uBAAO,CAAC,MAAM,CAAC,IAAA,aAAK,EAAC,IAAI,CAAC,EAAE;gBACjC,CAAC,EAAE,IAAI,CAAC,KAAK;gBACb,CAAC,EAAE,IAAI,CAAC,MAAM;aACf,CAAC,CAAC,MAAM,CAAC;QACZ,CAAC;IACH,CAAC;IAED,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,GAAG,CAAC,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,8DAA8D;IAC9D,MAAM,IAAI,GAAG,IAAK,IAAY,CAAC,WAAW,CAAC;QACzC,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,UAAU;KAClB,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,IAAA,oBAAU,EAC9B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,MAAM,CAAC,IAAI,EAChB,IAAI,CAAC,MAAM,CAAC,KAAK,EACjB,IAAI,CAAC,MAAM,CAAC,MAAM,EAClB,EAAE,SAAS,EAAE,CACd,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,aAAa,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACjE,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/diff/dist/commonjs/package.json b/node_modules/@jimp/diff/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/node_modules/@jimp/diff/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@jimp/diff/dist/esm/index.d.ts b/node_modules/@jimp/diff/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba17a429e354018b6e20e002e8fcc110c4f488c --- /dev/null +++ b/node_modules/@jimp/diff/dist/esm/index.d.ts @@ -0,0 +1,27 @@ +import { JimpClass } from "@jimp/types"; +/** + * Diffs two images and returns + * @param img1 A Jimp image to compare + * @param img2 A Jimp image to compare + * @param threshold A number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) + * @returns An object with the following properties: + * - percent: The proportion of different pixels (0-1), where 0 means the two images are pixel identical + * - image: A Jimp image showing differences + * @example + * ```ts + * import { Jimp, diff } from "jimp"; + * + * const image1 = await Jimp.read("test/image.png"); + * const image2 = await Jimp.read("test/image.png"); + * + * const diff = diff(image1, image2); + * + * diff.percent; // 0.5 + * diff.image; // a Jimp image showing differences + * ``` + */ +export declare function diff(img1: I, img2: I, threshold?: number): { + percent: number; + image: any; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/diff/dist/esm/index.d.ts.map b/node_modules/@jimp/diff/dist/esm/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..3344b9a38b551b9b0c493e09c0cfb1143b04e7e1 --- /dev/null +++ b/node_modules/@jimp/diff/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,SAAM;;;EA4C1E"} \ No newline at end of file diff --git a/node_modules/@jimp/diff/dist/esm/index.js b/node_modules/@jimp/diff/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..fea740558d2041d7eca1e6b21040d74173ec0180 --- /dev/null +++ b/node_modules/@jimp/diff/dist/esm/index.js @@ -0,0 +1,59 @@ +import { methods } from "@jimp/plugin-resize"; +import { clone } from "@jimp/utils"; +import pixelMatch from "pixelmatch"; +/** + * Diffs two images and returns + * @param img1 A Jimp image to compare + * @param img2 A Jimp image to compare + * @param threshold A number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) + * @returns An object with the following properties: + * - percent: The proportion of different pixels (0-1), where 0 means the two images are pixel identical + * - image: A Jimp image showing differences + * @example + * ```ts + * import { Jimp, diff } from "jimp"; + * + * const image1 = await Jimp.read("test/image.png"); + * const image2 = await Jimp.read("test/image.png"); + * + * const diff = diff(image1, image2); + * + * diff.percent; // 0.5 + * diff.image; // a Jimp image showing differences + * ``` + */ +export function diff(img1, img2, threshold = 0.1) { + let bmp1 = img1.bitmap; + let bmp2 = img2.bitmap; + if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) { + if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) { + // img1 is bigger + bmp1 = methods.resize(clone(img1), { + w: bmp2.width, + h: bmp2.height, + }).bitmap; + } + else { + // img2 is bigger (or they are the same in area) + bmp2 = methods.resize(clone(img2), { + w: bmp1.width, + h: bmp1.height, + }).bitmap; + } + } + if (typeof threshold !== "number" || threshold < 0 || threshold > 1) { + throw new Error("threshold must be a number between 0 and 1"); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const diff = new img1.constructor({ + width: bmp1.width, + height: bmp1.height, + color: 0xffffffff, + }); + const numDiffPixels = pixelMatch(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, { threshold }); + return { + percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height), + image: diff, + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/diff/dist/esm/index.js.map b/node_modules/@jimp/diff/dist/esm/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..86fbc8a7c2791420bd217c1edc39cf4868a19442 --- /dev/null +++ b/node_modules/@jimp/diff/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,IAAI,CAAsB,IAAO,EAAE,IAAO,EAAE,SAAS,GAAG,GAAG;IACzE,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;IACvB,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;IAEvB,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;QAC7D,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YACxD,iBAAiB;YACjB,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;gBACjC,CAAC,EAAE,IAAI,CAAC,KAAK;gBACb,CAAC,EAAE,IAAI,CAAC,MAAM;aACf,CAAC,CAAC,MAAM,CAAC;QACZ,CAAC;aAAM,CAAC;YACN,gDAAgD;YAChD,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;gBACjC,CAAC,EAAE,IAAI,CAAC,KAAK;gBACb,CAAC,EAAE,IAAI,CAAC,MAAM;aACf,CAAC,CAAC,MAAM,CAAC;QACZ,CAAC;IACH,CAAC;IAED,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,GAAG,CAAC,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,8DAA8D;IAC9D,MAAM,IAAI,GAAG,IAAK,IAAY,CAAC,WAAW,CAAC;QACzC,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,UAAU;KAClB,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,UAAU,CAC9B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,MAAM,CAAC,IAAI,EAChB,IAAI,CAAC,MAAM,CAAC,KAAK,EACjB,IAAI,CAAC,MAAM,CAAC,MAAM,EAClB,EAAE,SAAS,EAAE,CACd,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,aAAa,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACjE,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/diff/dist/esm/package.json b/node_modules/@jimp/diff/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/node_modules/@jimp/diff/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@jimp/diff/eslint.config.mjs b/node_modules/@jimp/diff/eslint.config.mjs new file mode 100644 index 0000000000000000000000000000000000000000..939816d0a4be5f347676861f9592614a0ca07046 --- /dev/null +++ b/node_modules/@jimp/diff/eslint.config.mjs @@ -0,0 +1,2 @@ +import shared from "@jimp/config-eslint/base.js"; +export default [...shared]; \ No newline at end of file diff --git a/node_modules/@jimp/diff/package.json b/node_modules/@jimp/diff/package.json new file mode 100644 index 0000000000000000000000000000000000000000..00ddfee2f008c6f06bb8b09567c81a6654c66508 --- /dev/null +++ b/node_modules/@jimp/diff/package.json @@ -0,0 +1,65 @@ +{ + "name": "@jimp/diff", + "version": "1.6.1", + "repository": "jimp-dev/jimp", + "engines": { + "node": ">=18" + }, + "scripts": { + "lint": "eslint .", + "test": "vitest", + "build": "tshy", + "dev": "tshy --watch", + "clean": "rm -rf node_modules .tshy .tshy-build dist .turbo" + }, + "author": "Andrew Lisowski ", + "license": "MIT", + "dependencies": { + "@jimp/plugin-resize": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", + "pixelmatch": "^5.3.0" + }, + "devDependencies": { + "@jimp/config-eslint": "1.6.1", + "@jimp/config-typescript": "1.6.1", + "@jimp/core": "1.6.1", + "@jimp/test-utils": "1.6.1", + "@types/pixelmatch": "^5.2.6", + "eslint": "^9.9.1", + "tshy": "^3.0.2", + "typescript": "^5.5.4", + "vitest": "^2.0.5" + }, + "tshy": { + "exclude": [ + "**/*.test.ts" + ], + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "publishConfig": { + "access": "public" + }, + "sideEffects": false, + "module": "./dist/esm/index.js", + "gitHead": "7e6a95694e00a8b6f1bdd9aad709f5413eb9b08c" +} diff --git a/node_modules/@jimp/diff/src/__snapshots__/index.test.ts.snap b/node_modules/@jimp/diff/src/__snapshots__/index.test.ts.snap new file mode 100644 index 0000000000000000000000000000000000000000..7bd9f86c9c5f16ebda0e7e3c5630f8ec39a553dc --- /dev/null +++ b/node_modules/@jimp/diff/src/__snapshots__/index.test.ts.snap @@ -0,0 +1,49 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Compare image difference > images 0 and 1 1`] = ` +Visualization: + +Dโ–ดโ–ดโ–ด +โ–ด3โ–ดโ–ด +โ–ดโ–ดโ—‡โ–ด +โ–ดโ–ดโ–ดโ–ฉ + +Data: + +E8-E8-E8แถ แถ  FF-00-00แถ แถ  FF-00-00แถ แถ  FF-00-00แถ แถ  +FF-00-00แถ แถ  EC-EC-ECแถ แถ  FF-00-00แถ แถ  FF-00-00แถ แถ  +FF-00-00แถ แถ  FF-00-00แถ แถ  EF-EF-EFแถ แถ  FF-00-00แถ แถ  +FF-00-00แถ แถ  FF-00-00แถ แถ  FF-00-00แถ แถ  F3-F3-F3แถ แถ  +`; + +exports[`Compare image difference > images 0 and 2 1`] = ` +Visualization: + +DDDD +3333 +โ—‡โ—‡โ—‡โ—‡ +โ–ฉโ–ฉโ–ฉโ–ฉ + +Data: + +E8-E8-E8แถ แถ  E8-E8-E8แถ แถ  E8-E8-E8แถ แถ  E8-E8-E8แถ แถ  +EC-EC-ECแถ แถ  EC-EC-ECแถ แถ  EC-EC-ECแถ แถ  EC-EC-ECแถ แถ  +EF-EF-EFแถ แถ  EF-EF-EFแถ แถ  EF-EF-EFแถ แถ  EF-EF-EFแถ แถ  +F3-F3-F3แถ แถ  F3-F3-F3แถ แถ  F3-F3-F3แถ แถ  F3-F3-F3แถ แถ  +`; + +exports[`Compare image difference > images 0 and 3 1`] = ` +Visualization: + +DDDD +3333 +โ—‡โ—‡โ—‡โ—‡ +โ–ฉโ–ฉโ–ฉโ–ฉ + +Data: + +E8-E8-E8แถ แถ  E8-E8-E8แถ แถ  E8-E8-E8แถ แถ  E8-E8-E8แถ แถ  +EC-EC-ECแถ แถ  EC-EC-ECแถ แถ  EC-EC-ECแถ แถ  EC-EC-ECแถ แถ  +EF-EF-EFแถ แถ  EF-EF-EFแถ แถ  EF-EF-EFแถ แถ  EF-EF-EFแถ แถ  +F3-F3-F3แถ แถ  F3-F3-F3แถ แถ  F3-F3-F3แถ แถ  F3-F3-F3แถ แถ  +`; diff --git a/node_modules/@jimp/diff/src/index.test.ts b/node_modules/@jimp/diff/src/index.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..36773b2e1b478ca758315c05016e1ea17d39334e --- /dev/null +++ b/node_modules/@jimp/diff/src/index.test.ts @@ -0,0 +1,56 @@ +import { expect, test, describe } from "vitest"; + +import { makeTestImage } from "@jimp/test-utils"; +import { createJimp } from "@jimp/core"; + +import { diff } from "./index.js"; + +const Jimp = createJimp(); + +describe("Compare image difference", () => { + const imgs = [ + Jimp.fromBitmap(makeTestImage("2222", "4444", "6666", "8888")), + Jimp.fromBitmap(makeTestImage("2468", "2468", "2468", "2468")), + Jimp.fromBitmap(makeTestImage("2212", "4434", "6656", "8878")), + Jimp.fromBitmap(makeTestImage("2232", "4454", "6676", "8898")), + Jimp.fromBitmap(makeTestImage("22322", "44544", "66766", "88988")), + ] as const; + + test("images 0 and 1", () => { + const result = diff(imgs[0], imgs[1]); + + expect(result.percent).toBe(0.75); + expect(result.image).toMatchSnapshot(); + }); + + test("images 0 and 2", () => { + const result = diff(imgs[0], imgs[2]); + + expect(result.percent).toBe(0); + expect(result.image).toMatchSnapshot(); + }); + + test("images 0 and 3", () => { + const result = diff(imgs[0], imgs[3]); + + expect(result.percent).toBe(0); + expect(result.image).toMatchSnapshot(); + }); + + test("allows to set a different threshold", () => { + expect(diff(imgs[0], imgs[3], 0.1).percent).toBe(0); + expect(diff(imgs[0], imgs[3], 0).percent).toBe(0.25); + }); + + test("throws an error if threshold is invalid", () => { + expect(() => diff(imgs[0], imgs[3], -1)).toThrow( + "threshold must be a number between 0 and 1", + ); + }); + + test("should resize image before diffing", () => { + expect(diff(imgs[3], imgs[4]).percent).toStrictEqual( + diff(imgs[4], imgs[3]).percent, + ); + }); +}); diff --git a/node_modules/@jimp/diff/src/index.ts b/node_modules/@jimp/diff/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..3bde24df64edfbb6e8a4d5f54863514f1a087794 --- /dev/null +++ b/node_modules/@jimp/diff/src/index.ts @@ -0,0 +1,71 @@ +import { methods } from "@jimp/plugin-resize"; +import { JimpClass } from "@jimp/types"; +import { clone } from "@jimp/utils"; +import pixelMatch from "pixelmatch"; + +/** + * Diffs two images and returns + * @param img1 A Jimp image to compare + * @param img2 A Jimp image to compare + * @param threshold A number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) + * @returns An object with the following properties: + * - percent: The proportion of different pixels (0-1), where 0 means the two images are pixel identical + * - image: A Jimp image showing differences + * @example + * ```ts + * import { Jimp, diff } from "jimp"; + * + * const image1 = await Jimp.read("test/image.png"); + * const image2 = await Jimp.read("test/image.png"); + * + * const diff = diff(image1, image2); + * + * diff.percent; // 0.5 + * diff.image; // a Jimp image showing differences + * ``` + */ +export function diff(img1: I, img2: I, threshold = 0.1) { + let bmp1 = img1.bitmap; + let bmp2 = img2.bitmap; + + if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) { + if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) { + // img1 is bigger + bmp1 = methods.resize(clone(img1), { + w: bmp2.width, + h: bmp2.height, + }).bitmap; + } else { + // img2 is bigger (or they are the same in area) + bmp2 = methods.resize(clone(img2), { + w: bmp1.width, + h: bmp1.height, + }).bitmap; + } + } + + if (typeof threshold !== "number" || threshold < 0 || threshold > 1) { + throw new Error("threshold must be a number between 0 and 1"); + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const diff = new (img1 as any).constructor({ + width: bmp1.width, + height: bmp1.height, + color: 0xffffffff, + }); + + const numDiffPixels = pixelMatch( + bmp1.data, + bmp2.data, + diff.bitmap.data, + diff.bitmap.width, + diff.bitmap.height, + { threshold } + ); + + return { + percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height), + image: diff, + }; +} diff --git a/node_modules/@jimp/diff/tsconfig.json b/node_modules/@jimp/diff/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..ad7f216ca2b10874329665feda994727844e4305 --- /dev/null +++ b/node_modules/@jimp/diff/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@jimp/config-typescript/base.json", + "compilerOptions": { + "outDir": "dist" + } +}