diff --git a/.gitattributes b/.gitattributes index deea3b31efc725f501994000bbb402ffee67834a..a04caf22b4f10c34130c4a8064272e8f027d11f6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -42,3 +42,5 @@ docs/screenshots/journey.png filter=lfs diff=lfs merge=lfs -text docs/screenshots/trip-iceland.png filter=lfs diff=lfs merge=lfs -text docs/screenshots/trip-planner.png filter=lfs diff=lfs merge=lfs -text docs/screenshots/vacay.png filter=lfs diff=lfs merge=lfs -text +node_modules/@jimp/js-bmp/src/images/windows95.bmp filter=lfs diff=lfs merge=lfs -text +node_modules/@jimp/js-bmp/src/images/windows95.png filter=lfs diff=lfs merge=lfs -text 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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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 2 6 3 1 3 2 a 0 b 1 3 9 f 0 3 2 1l 0 2 4 5 1 3 2 4 0 l b 4 0 c 2 1l 0 2 7 2 2 2 2 l 1 3 9 b 5 2 2 1l 0 2 6 3 1 3 2 8 2 b 1 3 9 j 0 1o 4 4 2 2 3 a 0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 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); +} + +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,E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AK,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/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 2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 0 4e b 6 9 7 3 1k 1 2 6 3 1 3 2 a 0 b 1 3 6 4 4 1w 8 2 0 3 0 2 3 2 4 2 0 f 1 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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AAC,SAAS,CAAC,wBAAwB,EAAE;AACzC,YAAA,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,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/@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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,2,2,1,8,1,-4, + 1,8,1,13,1,-11,1,-36,1,54,1,17,1,11,1,13,1,-4,1,-3,-2,1,-6,1,22,1,-9,1,13,1,-5,1,7,-2,-2,1,-2,1,4,-1,1,-2,1,66,-2,1,11,-3,1,14,-1,2,1,2,9,2,2,-2,1,8,1,-5,-2,1,5,1,-4,1,5,-3,1,10,1,17,-1,1,4,2,2, + -1,4,1,2,3, + "MhH-C_0AAgYbHu8NBAAHAAcLCwnuDAgBABD-Ae8MWLf-_iT-9An4-QEJ9_kp7An-_A4W6hP3GwUGDgFuBAMY_uIXAiP7iHP7JND8Lv3-BwEUAAXs_ggYFv0jwwofCQQIEfz5_AELCPIW-STtBgENHAACVgMDAwYCAAUC-wsHAw7xArNqmwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf8AAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAP8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAPkH", + 3,1,-3,1,7,-1,1,-2,-2,1,4,-2,1,6,1,4,2,1,-1,3,1,2,9,"t10LChELBwEOdikAAAAAAAAA",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,"5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,1,7,1,2,2,6,2,27,1,2,2,3,1,-1,5,1,-2,-1,3,3,6,3,8,1,-1,-1,6,1,19,1,4,2,0,6,2,0,3,1,3,1,7,1,-2,-1,6,1,2,2,-1,0,6, + 15,0,6,1,2,2,3,1,5,3,-2,3,-39183,"t20AgVqpZw8W_9sAAgD2AAAgAOAw0CAC3SP-AAAAEAA",10,-14,"sSUfaAMAuBV7gQDPJ7QAA1z934Rs7wRZ8FSTAAAAIgAAAADeIAABAN4AACcA_AAB_wAAAN4g","$6", + "kv0AAQB-VgCuIt8X9QDbAnoA-gCm_v0AuS0hAAAAAA_yAAAAAAAAAAAAAAAAAAAAAADdyg",6,1,19,1,0,6,7,1,19,1,0,6,8,0,2,2,3,1,7,1,-2,8,1,3,1, + "0gErArCpaBAE_P7eIsUdEF3i_ZRkJpD-9v6t-wADAfs1LtosAMARAAL-_gK-pv4NAZdpAHMBAfwB1PsAARKc-bBanxVIigEhAAEA3v8DAAAAAP4C_gACIAAA3iH_BQAAAAEAAAAAAPwDAAAAAAAAAAAAAAEAAAAA2iAAAQAAAAAFAAAADADvEu4SAO7_4A", + 0,23,3,51394,7,1,11,1,2,2,3,1,0,6,7,1,-2,-1,17,1,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,0,3,1,"$C",0,15,"$c",0,13,3,1,7,1,-2,-1,6,1,8,1,0,6,7,0,11,1,2,2,3,1,3,1,0,6,4,0,-2,-1,6,1,19,1,-1,0,94,6,0,3,1,17,1,0,6,6,0,3,1,3,1,7,1,-2,-1,5,1, + 0,6,1,0,3,1,3,1,7,1,4,1,6,1,2,2,3,1,3,1,0,94,4,0,-2,-1,20,1,0,6,14,0,2,2,2,1,6,3,-2,-1,0,6,6,1,2,2,3,1,7,1,-2,-1,6,1,2,2,3,1,-1,0,94,6,0,-2,6,3,13,2,0,6,6,0,20,1,0,6,14,0,2,2,2,1,7,2,-2,6,3, + 2,-8960,-2,4,2,8,5,5,1,-2,-3,2,7,3,1,2,6,-2,-3,1,10,-1,1,6,-3,-3,2,19,-2,2,2,-1,2,5,4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g4rTnRgACutw0tFNFdFatLHOSLtp1eDQwCV8NAgIAAAECAQ8EAQgAAwa4DgEBBR8JAwa3AAYEAAEDAwMABAAFAgABAAEAAAECAgAAAgMDAgICAgACAAEEAQcFAMgCL8kMBwEGJ8QBG9kLDQABAw0JBBO2AQcPBgU", + 0,96,"jTDyPYHPZsuW6DaOAK_MYbVV1Cc3hQPtxUtKV3vkuxWVbAKIJVtbpKg5G_YAYBudaZjpT-o5ZSoE-Ts1a64cjtcxYm6cmFG_wfn_U3Wf0xu-7iPUmOmX1uo8Q9XtOHkACQEHAQELY2oBEwAC1AcEAgMCAwj7AgYDAwkTCgLRAQUZCbwNAQEAAQAFAAMDAgABAgMCBQEHBAkGCLUDCAEBAAEFAQMDAgEDCwMCAwQCxiHoDyrAAgUKAAECBQA", + 0,96,"O3jA12FpgHMtTDt5TLAodifVF3BpNYprtGJ0H_7cxeYXTyeXYzCavakroFIokJoA_OmpTq4RLcHYQw10PC11jQ4JHAjxN8yXMs0Hvc5hHhwCjP6YLIeyHwDs_1ixvXIOEQm1AQMBAAEACQEICgIdwgAGABkAABQF3B_QEQsTzwIW9AAEAwsZBQ-xFQwFEdorErQAAhoTHsgFBQXfCCEN4QAA6QwNEgPOAQQBAAMCAwMAAQQACwAAAQcBBQs" + ], + "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,1,15,1,5,149,243,129,135,149606,26], + "gb18030": [ + 1,19970,3,1,1,8,-2,1,4,3,7,-1,-2,-2,2,4,-1,-1,-1,-1,1,4,3,3,-1,-1,-3,1,6,-3,-1,2,2,4,6,2,1,6,1,-2,10,1,7,1,-1,-2,1,5,2,5,-1,3,2,1,4,1,6,3,4,-2,4,1,3,2,1,9,-3,2,2,-1,3,7,-3,-1,2,3,-1,3,3,-1,-2,3,3, + -1,-1,-1,7,1,2,2,5,5,2,5,-3,-1,2,4,3,2,-2,-1,-1,-1,-1,-1,5,2,2,1,6,1,1,5,-1,-1,2,10,-3,-1,2,1,2,1,2,2,-2,4,1,-2,3,2,3,2,-2,-1,-1,-1,2,1,2,1,3,1,-1,2,1,2,1,-1,1,6,-1,5,2,9,1,3,1,4,3,3,1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,2,-1,3,1,-1,-1,7,1,3,1,2,2,13,3,4,1,5,1,11,1,2,1,2,1,6,1,-1,6,1,7,1, + 11,2,-1,12,2,33,2,8,1,7,2,17,1,3,1,18,1,2,1,14,1,12,1,-3,4,2,-2,3,1,-1,4,3,3,1,3,2,3,1,-1,2,3,2,1,13,2,1,5,-1,3,1,-3,2,3,4,4,-1,13,1,-2,3,1,4,1,-1,1,4,-3,7,1,-1,3,1,11,1,5,2,2,1,-1,-2,11,3,8,1, + 4,3,14,1,4,1,-1,-1,13,1,-1,5,1,-1,5,3,3,1,4,2,-1,2,1,6,1,5,1,4,1,4,1,3,1,5,2,7,2,3,1,6,1,-1,3,1,9,1,10,1,5,1,10,2,4,1,-1,6,1,10,1,12,1,22,1,10,1,-1,-1,3,1,3,2,1,5,-1,-1,7,1,3,2,4,2,3,1,2,1,-1,-1, + -1,-1,3,2,-2,4,1,2,2,2,1,3,1,3,2,2,4,5,1,-2,-1,2,1,12,1,12,1,-2,3,2,-1,7,4,3,4,4,1,-2,-1,4,1,-1,2,1,96,29162,3,-46374,"txH94FoBDkm3D_EAAgD2AAACAP4wAPDfIQAAAAAAEAA",8,-14,2,6,2,-8, + "sSUfPvAA6P0a_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,-1,8,1,16,3,23,1,9,1,-1,-1,-1,-3,7,1,3,2,94,27687,1,-27781,-1,7,2,4,1,8,1,-1,-1,-1,4,1,-3,2,1,5,1,2,1,-2,-3, + 1,5,-1,-2,2,2,-1,4,1,2,1,2,1,-2,4,2,4,1,8,4,3,2,7,1,-1,3,1,5,2,3,1,2,1,-1,94,27632,3,-27726,3,1,-1,-2,-1,-2,2,2,-1,-3,5,3,-2,2,8,2,2,3,3,1,4,2,4,4,1,-1,-3,2,1,2,1,3,1,-3,-3,4,2,2,2,4,1,2,1,2,1,-3, + -1,4,1,-1,3,1,4,1,-1,-3,3,1,-2,-1,2,3,-3,2,1,2,1,2,3,3,1,-1,2,3,-1,94,27537,7,-27631,6,2,-1,5,1,-1,4,1,7,1,3,1,8,1,2,1,-1,3,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4,6,2,5,1,-1,2,1,8,1,4,2,4,6,2,2, + 64,-144,2,1,-1,2,2,2,4,-1,-2,-3,4,2,-3,1,12,-1,-2,1,9,5,4,2,5,2,7,2,7,2,4,5,-22,3,2,3,1,2,2, + "3wKZCAsAARr79w4B_P4GoF0DAQT-BPwIAARz_QMB_gQDliQgJv6KAQQI-w_xCw4GAwsDmQB8RgQAAgZDxgGcAPsAAAAAAAAAAAADAAAE_AAAAAAAAAAAAAEAAAAAAAD9AQAAAAEAAAAAAAAAAQAAAAADAOAgAAAAAPULAA",3,59,-2,1,-2,-2,1,6,1,-3, + 1,-3,1,4,1,4,1,50,1,9,-2,1,9,1,-3,2,5,1,5,96,-610,94,17649,96,-17743,94,17647,96,-17741,94,17645,28,-17739,1,5,-2,1,6,-1,-3,2,6,-3,1,12,-2,3,1,-1,-2,-3,4,1,-2,2,8,-2,10,1,2,2,4,1,2,2,6,1,9,2,-1, + 6,1,4,1,94,17571,9,-17665,3,1,2,1,-1,5,2,4,1,3,1,-3,2,1,3,1,2,1,-3,-2,2,1,-1,-1,4,2,9,1,-1,-2,12,1,-1,-2,2,1,3,1,-1,6,1,-1,9,1,2,1,2,1,94,17530,5,-17624,-1,-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_iTBHCMBF8MAAUAjAb6Bvo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X4kxpkRfJ9a98unB-ykSaAqwcvVjrvU7vlmaHOK5RaNARDw1HYHrwDsXgac_vQe7GIGwc0b7mMGmmAEseUBGOgBGEwGqNkpvA",0,1,1,119683,1,21961,0,1,"fsrRik4F",0,1,"_WlvbCkgZWAWJAP2COw", + 0,1,"D-c09I4l21RJ-A0A_6qR5ogE5yQEmj3aMB0_BYTrUsM",0,1,"Xw82kpSNhcehqG6dz4QKXxeI1VcKAQAA2CfyhQeEBc0oewewSQY",0,1,"2W3-vysFCvcpUIgFnNpDQgdh",0,1,1,14232,0,1, + "wpTCv1I4_Om37KGF8VX6KNSUEiBkz3KGB3XXJPnDvGOV58zhWnzzfFwHnf4GAP34_xX55RlYBKT0DfYSTweWYwapAPoGAwL_7P0QsjMk",0,1,"qb5QB47A1fOaLfc0kBSJ6_kaUQSYyTTvAds17w",0,1, + "cfDKIpiUofc2d49_hfj-2xT9_7lnnFeAf1ATllS0rD0pyK1r6wy6U7w48wNVsRKUC_QACxjz_gThLvX-f1kHk-7rB-qcBPwG-gb6BfsF-wb6BfsF-wSAfAX7BvoG-gT8BPwHZhZ9B8D_OgZSzzEAzyHfAAAA_yIA",3,56874,1,-64924,4,64924, + "XLYd4h5Avxq4ACsAJAHZANsAIwDVACkAzQAxAMkANQDLADMAywAzAP8h3iLeJ9kAAQD_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_gMBgwHkMwAAAADNUQAAA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QD_Af8BAAEAAAACAAEAAQEAAAEAAAACAAEAAAAAAgAAAAAAAAIAAAAAAAABAAABAAEAAQMAAAAAAAAAAAIAAAACAAACAAAAAQEBAAAAAAAAAQABAAABAAACAAAAAAAAAAAAAAIAAAABAAAAAAEAAAAAAQAAAAAAAQAAAAABAAEAAAAAAAAAAAACAAABAQCyBQIAAANEvwMAAAAEAAEABAAAAAYAAAAAAAACAAAAAQABAAABAAEAAQIAAQACAAAAAAACAAAAAAH_AQAAAgQAAAAAAAACAQD_AAIAAAACAAAAAAAAAAACAAEAAAAAAAABAAABAAEAAgAAAAAAAAAAAAAAAAACAQABAAAAAAEAAAABAAEAAQAAAAACAAAAAAEAAAC0BAAAAAACAwAAAAIEAAQAAAEBAwYAAAIBAQIAAwAAAAEAAgAAAAAT7wAAAQEBAQMAAf8BAAAAAgABAAACAAAAAAACAAEAAAADAAMA_wICAQEAAAEAAAACAAIAAAEAAACyAAUAAAMDAQQABAAAAQQB_wEFAgACAAIBBQIAAQcAAAIAAAABAAACAAACAQAAAQACAwAAAAAAAAECAAAAAQABAQAAAAABAAEAAQAAAAEAAQAAALIABQAABQIAAgIEBgAFAAMBAQEAAwMABAABCAAAAgIAAQABAgMAAAMAAAABAQEAAAEBAAAAAQACAAAAtwcFAwAAAQUJBgIAAAIAAAMFAAIDBQAEAAADAQEBAAAAAAACAAABAQC4Ag0LBgABCAAJAAADAAD3CwQDAwAAAAECAQABAQABAAEAAL8NBQwADAEFAwMABAEBAQPSBxQJAwMA5A0DAwMAAAgAAu4ICtQoAQMA3g", + 10,-22547,10,10,10,-782,"NghFGuETFE0-MExTdVpXS3RbENKrseM-APEdTgAAAAMAAAEBAAAGAgLSLwABAAYAEAEZB2oC","$7","OwH__wAo",83,2307,86,13,"$C","$c","59AAFXCLjeVJd44e1yirqSEAABCnBHKKBHbyW7JOOQY",0,40, + "4gEi-i7kCnkA4wP_AAAAM-8ADwD-AA",3,1,-1,2,1,1,7,2,6,1,7,-1,-2,-1,-1,1,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AAAAAANH8NABnBpMA6RcA63wHkiJFBpNnBPwG-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,OAAO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ACD,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,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,MAAMC,OAAS,GAUfA,OAAOC,cAAgB,CAACC,KAAMC,WAC7B,MACCb,IAAMY,KAAKX,OACZC,IAAIY,aAAeF,KAAKX,OAAS,IAChCE,EACAY,EAAI,EACJC,SACAC,SACAC,SACAC,SAED,GAAIP,KAAKA,KAAKX,OAAS,KAAO,IAAK,CAClCa,YAAY,GACZ,GAAIF,KAAKA,KAAKX,OAAS,KAAO,IAAK,CAClCa,YAAY,EACb,CACD,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U,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,GAAG,MAAM,EAAE,CAAC;CAC1D;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,4BAA4B,CAAC;AAE3E,6DAA6D;AAC7D,KAAK,kBAAkB,CAAC,aAAa,EAAE,SAAS,EAAE,MAAM,IACtD,MAAM,SAAS,mBAAmB,CAAC,MAAM,IAAI,CAAC,GAC1C,CACE,GAAG,IAAI,EAAE,IAAI,KACV,mBAAmB,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG,aAAa,GAClE,MAAM,SAAS,UAAU,CAAC,MAAM,IAAI,EAAE,MAAM,MAAM,CAAC,GACjD,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,GACzB,KAAK,CAAC;AAEd,mFAAmF;AACnF,MAAM,MAAM,mBAAmB,CAAC,aAAa,EAAE,S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AAO;IA6BT;;;;;;;;;;;;;;;;;;;OAmBG;cAED,gBAAgB,8CAChB,OAAO;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/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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C,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-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/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;AAED,8BAoCC;AAlSD,SAAgB,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,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5D,MAAM,CAAC,GAA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,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;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,EACN,CAAC,GAAG,CAAC,EACL,CAAC,GAAG,CAAC,EACL,UAII,EAAE;IAEN,IAAI,CAAC,CAAC,GAAG,YAAY,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,EAAE,IAAI,GAAG,wBAAS,CAAC,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC9C,IAAI,EAAE,aAAa,GAAG,GAAG,EAAE,WAAW,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;IAEzD,IACE,OAAO,aAAa,KAAK,QAAQ;QACjC,aAAa,GAAG,CAAC;QACjB,aAAa,GAAG,CAAC,EACjB,CAAC;QACD,aAAa,GAAG,GAAG,CAAC;IACtB,CAAC;IAED,IAAI,OAAO,WA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AG,GAAG;YAClC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAE,GAAG,GAAG;SACnC,EACD;YACE,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,GAAG;YAC3C,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,GAAG;YAC3C,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,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,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;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;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,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,KAAK,CAAC,EAAE,sBAAsB;YAC5B,qCAAqC;YACrC,OAAO,IAAI,CAAC;QAEd,KAAK,CAAC,EAAE,oBAAoB;YAC1B,OAAO,UAAU,CAAS,EAAE,CAAS;gBACnC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAU,CAAC;YACjC,CAAC,CAAC;QAEJ,KAAK,CAAC,EAAE,aAAa;YACnB,OAAO,UAAU,CAAS,EAAE,CAAS;gBACnC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAU,CAAC;YACzC,CAAC,CAAC;QAEJ,KAAK,CAAC,EAAE,kBAAkB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AC,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/@jimp/core/dist/esm/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,GAAG,MAAM,EAAE,CAAC;CAC1D;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAA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M,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":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;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,K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--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 +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,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,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,UAAU,SAAS,CACvB,SAAY,EACZ,GAAM,EACN,CAAC,GAAG,CAAC,EACL,CAAC,GAAG,CAAC,EACL,UAII,EAAE;IAEN,IAAI,CAAC,CAAC,GAAG,YAAY,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,EAAE,IAAI,GAAG,SAAS,CAAC,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC9C,IAAI,EAAE,aAAa,GAAG,GAAG,EAAE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AC,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/@j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;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;A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C,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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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" + } +} diff --git a/node_modules/@jimp/file-ops/.tshy/browser.json b/node_modules/@jimp/file-ops/.tshy/browser.json new file mode 100644 index 0000000000000000000000000000000000000000..4c8229313655dafe92a80d606c265c9388b4a8e4 --- /dev/null +++ b/node_modules/@jimp/file-ops/.tshy/browser.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/browser" + } +} diff --git a/node_modules/@jimp/file-ops/.tshy/build.json b/node_modules/@jimp/file-ops/.tshy/build.json new file mode 100644 index 0000000000000000000000000000000000000000..aea1a9e93b5db3468973ebeaad6dac0a77b10c02 --- /dev/null +++ b/node_modules/@jimp/file-ops/.tshy/build.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../src", + "module": "nodenext", + "moduleResolution": "nodenext" + } +} diff --git a/node_modules/@jimp/file-ops/.tshy/commonjs.json b/node_modules/@jimp/file-ops/.tshy/commonjs.json new file mode 100644 index 0000000000000000000000000000000000000000..28f4a0bf2a5ac52c38b8c92344c3ff5c6fa26c0d --- /dev/null +++ b/node_modules/@jimp/file-ops/.tshy/commonjs.json @@ -0,0 +1,18 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.cts", + "../src/**/*.tsx", + "../src/**/*.json" + ], + "exclude": [ + "../**/*.test.ts", + "../src/**/*.mts", + "../src/package.json", + "../src/index-browser.mts" + ], + "compilerOptions": { + "outDir": "../.tshy-build/commonjs" + } +} diff --git a/node_modules/@jimp/file-ops/.tshy/esm.json b/node_modules/@jimp/file-ops/.tshy/esm.json new file mode 100644 index 0000000000000000000000000000000000000000..f4eac5d36cc5d25ff8d425f1ab75e94f7665360b --- /dev/null +++ b/node_modules/@jimp/file-ops/.tshy/esm.json @@ -0,0 +1,17 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.mts", + "../src/**/*.tsx", + "../src/**/*.json" + ], + "exclude": [ + "../**/*.test.ts", + "../src/package.json", + "../src/index-browser.mts" + ], + "compilerOptions": { + "outDir": "../.tshy-build/esm" + } +} diff --git a/node_modules/@jimp/file-ops/CHANGELOG.md b/node_modules/@jimp/file-ops/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..2b6908c4c86d1f7a6e51649d324e2272f1ffc3d9 --- /dev/null +++ b/node_modules/@jimp/file-ops/CHANGELOG.md @@ -0,0 +1,51 @@ +# 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.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/file-ops/LICENSE b/node_modules/@jimp/file-ops/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..baa5d48509a18b9ab4f6c39289362690ea68e688 --- /dev/null +++ b/node_modules/@jimp/file-ops/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/file-ops/dist/browser/index-browser.d.mts.map b/node_modules/@jimp/file-ops/dist/browser/index-browser.d.mts.map new file mode 100644 index 0000000000000000000000000000000000000000..68913946a488267a4de004597367843d3c9ac76d --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/browser/index-browser.d.mts.map @@ -0,0 +1 @@ +{"version":3,"file":"index-browser.d.mts","sourceRoot":"","sources":["../../src/index-browser.mts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,eAAc,CAAC;AAEtC,eAAO,MAAM,QAAQ,sBAEpB,CAAC;AAEF,eAAO,MAAM,SAAS,sBAErB,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/browser/index-browser.mjs.map b/node_modules/@jimp/file-ops/dist/browser/index-browser.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..87e5607729ec7ce38755e70f0a4b9d6839908439 --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/browser/index-browser.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index-browser.mjs","sourceRoot":"","sources":["../../src/index-browser.mts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC;AAEtC,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;IACjC,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;IAClC,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;AACnC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/browser/index.d.ts b/node_modules/@jimp/file-ops/dist/browser/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5206ab3e7c6deda649d3130576f5a156bf15aee9 --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/browser/index.d.ts @@ -0,0 +1,4 @@ +export declare const existsSync: () => boolean; +export declare const readFile: () => Promise; +export declare const writeFile: () => Promise; +//# sourceMappingURL=index-browser.d.mts.map \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/browser/index.js b/node_modules/@jimp/file-ops/dist/browser/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a6b8a7ce99e5f9be9dc83af488caaafc5ab3f391 --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/browser/index.js @@ -0,0 +1,8 @@ +export const existsSync = () => false; +export const readFile = async () => { + throw new Error("Not supported"); +}; +export const writeFile = async () => { + throw new Error("Not supported"); +}; +//# sourceMappingURL=index-browser.mjs.map \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/browser/package.json b/node_modules/@jimp/file-ops/dist/browser/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/browser/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@jimp/file-ops/dist/commonjs/index.d.ts b/node_modules/@jimp/file-ops/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..198403790a2a9630c896c6702e1568dae4535488 --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/commonjs/index.d.ts @@ -0,0 +1,5 @@ +import { promises as fs } from "fs"; +export { existsSync } from "fs"; +export declare const readFile: typeof fs.readFile; +export declare const writeFile: typeof fs.writeFile; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/commonjs/index.d.ts.map b/node_modules/@jimp/file-ops/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..bb98818a2fa28661dbd7807d8e17faedd59f07d8 --- /dev/null +++ b/node_modules/@jimp/file-ops/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,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,eAAO,MAAM,QAAQ,oBAAc,CAAC;AACpC,eAAO,MAAM,SAAS,qBAAe,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/commonjs/index.js b/node_modules/@jimp/file-ops/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2741fa12c21412eb467a47a929f24159409aa2cc --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/commonjs/index.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.writeFile = exports.readFile = exports.existsSync = void 0; +const fs_1 = require("fs"); +var fs_2 = require("fs"); +Object.defineProperty(exports, "existsSync", { enumerable: true, get: function () { return fs_2.existsSync; } }); +exports.readFile = fs_1.promises.readFile; +exports.writeFile = fs_1.promises.writeFile; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/commonjs/index.js.map b/node_modules/@jimp/file-ops/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b9692d7a43ea7118a43311186aec8ba92c4929de --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,2BAAoC;AAEpC,yBAAgC;AAAvB,gGAAA,UAAU,OAAA;AACN,QAAA,QAAQ,GAAG,aAAE,CAAC,QAAQ,CAAC;AACvB,QAAA,SAAS,GAAG,aAAE,CAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/commonjs/package.json b/node_modules/@jimp/file-ops/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@jimp/file-ops/dist/esm/index.d.ts b/node_modules/@jimp/file-ops/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..198403790a2a9630c896c6702e1568dae4535488 --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/esm/index.d.ts @@ -0,0 +1,5 @@ +import { promises as fs } from "fs"; +export { existsSync } from "fs"; +export declare const readFile: typeof fs.readFile; +export declare const writeFile: typeof fs.writeFile; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/esm/index.d.ts.map b/node_modules/@jimp/file-ops/dist/esm/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..bb98818a2fa28661dbd7807d8e17faedd59f07d8 --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,eAAO,MAAM,QAAQ,oBAAc,CAAC;AACpC,eAAO,MAAM,SAAS,qBAAe,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/esm/index.js b/node_modules/@jimp/file-ops/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..036260534266c72bccbf0e6432bfac9a0050f330 --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/esm/index.js @@ -0,0 +1,5 @@ +import { promises as fs } from "fs"; +export { existsSync } from "fs"; +export const readFile = fs.readFile; +export const writeFile = fs.writeFile; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/esm/index.js.map b/node_modules/@jimp/file-ops/dist/esm/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a282c9ffe5ccc93e34639a7e44e3be65784b221c --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;AACpC,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/file-ops/dist/esm/package.json b/node_modules/@jimp/file-ops/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/node_modules/@jimp/file-ops/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@jimp/file-ops/eslint.config.mjs b/node_modules/@jimp/file-ops/eslint.config.mjs new file mode 100644 index 0000000000000000000000000000000000000000..939816d0a4be5f347676861f9592614a0ca07046 --- /dev/null +++ b/node_modules/@jimp/file-ops/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/file-ops/package.json b/node_modules/@jimp/file-ops/package.json new file mode 100644 index 0000000000000000000000000000000000000000..de869afda5060518b9647b0f9d90248f943610da --- /dev/null +++ b/node_modules/@jimp/file-ops/package.json @@ -0,0 +1,63 @@ +{ + "name": "@jimp/file-ops", + "version": "1.6.1", + "repository": "jimp-dev/jimp", + "engines": { + "node": ">=18" + }, + "scripts": { + "lint": "eslint .", + "build": "tshy", + "dev": "tshy --watch", + "clean": "rm -rf node_modules .tshy .tshy-build dist .turbo" + }, + "author": "Andrew Lisowski ", + "license": "MIT", + "devDependencies": { + "@jimp/config-eslint": "1.6.1", + "@jimp/config-typescript": "1.6.1", + "@types/node": "^18.19.48", + "eslint": "^9.9.1", + "tshy": "^3.0.2", + "typescript": "^5.5.4", + "vitest": "^2.0.5" + }, + "tshy": { + "exclude": [ + "**/*.test.ts" + ], + "esmDialects": [ + "browser" + ], + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "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/file-ops/src/index-browser.mts b/node_modules/@jimp/file-ops/src/index-browser.mts new file mode 100644 index 0000000000000000000000000000000000000000..1719e1c414e073dc9a92f4088254d1b4918384af --- /dev/null +++ b/node_modules/@jimp/file-ops/src/index-browser.mts @@ -0,0 +1,9 @@ +export const existsSync = () => false; + +export const readFile = async () => { + throw new Error("Not supported"); +}; + +export const writeFile = async () => { + throw new Error("Not supported"); +}; diff --git a/node_modules/@jimp/file-ops/src/index.ts b/node_modules/@jimp/file-ops/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..ce9fc1b7b5024458d86ffa0e8765bb7c4c5116fb --- /dev/null +++ b/node_modules/@jimp/file-ops/src/index.ts @@ -0,0 +1,5 @@ +import { promises as fs } from "fs"; + +export { existsSync } from "fs"; +export const readFile = fs.readFile; +export const writeFile = fs.writeFile; diff --git a/node_modules/@jimp/file-ops/tsconfig.json b/node_modules/@jimp/file-ops/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..ad7f216ca2b10874329665feda994727844e4305 --- /dev/null +++ b/node_modules/@jimp/file-ops/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@jimp/config-typescript/base.json", + "compilerOptions": { + "outDir": "dist" + } +} diff --git a/node_modules/@jimp/js-bmp/.tshy/build.json b/node_modules/@jimp/js-bmp/.tshy/build.json new file mode 100644 index 0000000000000000000000000000000000000000..aea1a9e93b5db3468973ebeaad6dac0a77b10c02 --- /dev/null +++ b/node_modules/@jimp/js-bmp/.tshy/build.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../src", + "module": "nodenext", + "moduleResolution": "nodenext" + } +} diff --git a/node_modules/@jimp/js-bmp/.tshy/commonjs.json b/node_modules/@jimp/js-bmp/.tshy/commonjs.json new file mode 100644 index 0000000000000000000000000000000000000000..75bcfc1d756dcb1baafc973385c81c5aa93f3174 --- /dev/null +++ b/node_modules/@jimp/js-bmp/.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/js-bmp/.tshy/esm.json b/node_modules/@jimp/js-bmp/.tshy/esm.json new file mode 100644 index 0000000000000000000000000000000000000000..fdc4fa775818876f2e8f6cd606e9bb337515ac56 --- /dev/null +++ b/node_modules/@jimp/js-bmp/.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/js-bmp/CHANGELOG.md b/node_modules/@jimp/js-bmp/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..1eb5e248fea3643b21f1a7e4efabb731b7910f2b --- /dev/null +++ b/node_modules/@jimp/js-bmp/CHANGELOG.md @@ -0,0 +1,73 @@ +# 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.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.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/js-bmp/LICENSE b/node_modules/@jimp/js-bmp/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..baa5d48509a18b9ab4f6c39289362690ea68e688 --- /dev/null +++ b/node_modules/@jimp/js-bmp/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/js-bmp/README.md b/node_modules/@jimp/js-bmp/README.md new file mode 100644 index 0000000000000000000000000000000000000000..dd90e545c4993d9f826553f1c6c85fc2a746f5c5 --- /dev/null +++ b/node_modules/@jimp/js-bmp/README.md @@ -0,0 +1,6 @@ +
+ +

@jimp/bmp

+

Default Jimp bmp encoder/decoder.

+
diff --git a/node_modules/@jimp/js-bmp/dist/commonjs/index.d.ts b/node_modules/@jimp/js-bmp/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d7e69c86eed24918f8eb69399880839a7f346cf0 --- /dev/null +++ b/node_modules/@jimp/js-bmp/dist/commonjs/index.d.ts @@ -0,0 +1,24 @@ +import * as BMP from "bmp-ts"; +import { Bitmap } from "@jimp/types"; +export type { BmpColor } from "bmp-ts"; +export { BmpCompression } from "bmp-ts"; +type Pretty = { + [K in keyof T]: T[K] extends (...args: any[]) => any ? T[K] : T[K] extends object ? Pretty : T[K]; +}; +export type EncodeOptions = Pretty>>; +export interface DecodeBmpOptions { + toRGBA?: boolean; +} +declare function encode(image: Bitmap, options?: EncodeOptions): Buffer; +declare function decode(data: Buffer, options?: DecodeBmpOptions): Bitmap; +export declare function msBmp(): { + mime: "image/x-ms-bmp"; + encode: typeof encode; + decode: typeof decode; +}; +export default function bmp(): { + mime: "image/bmp"; + encode: typeof encode; + decode: typeof decode; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-bmp/dist/commonjs/index.d.ts.map b/node_modules/@jimp/js-bmp/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..13fb84c7c2dc3c0b8f067634fcfa9a962f0a75f2 --- /dev/null +++ b/node_modules/@jimp/js-bmp/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAG9B,OAAO,EAAE,MAAM,EAAU,MAAM,aAAa,CAAC;AAE7C,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,KAAK,MAAM,CAAC,CAAC,IAAI;KAEd,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAChD,CAAC,CAAC,CAAC,CAAC,GACJ,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACjB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACZ,CAAC,CAAC,CAAC,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,MAAM,CAChC,OAAO,CACL,IAAI,CACF,GAAG,CAAC,QAAQ,EACV,SAAS,GACT,QAAQ,GACR,iBAAiB,GACjB,IAAI,GACJ,IAAI,GACJ,WAAW,GACX,WAAW,CACd,CACF,CACF,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,iBAAS,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,UAqBzD;AAED,iBAAS,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAsBrC,MAAM,CACxB;AAED,wBAAgB,KAAK;;;;EAMpB;AAED,MAAM,CAAC,OAAO,UAAU,GAAG;;;;EAM1B"} \ No newline at end of file diff --git a/node_modules/@jimp/js-bmp/dist/commonjs/index.js b/node_modules/@jimp/js-bmp/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..84634224bd3160777e5d8d745fc1e429f4b30d8b --- /dev/null +++ b/node_modules/@jimp/js-bmp/dist/commonjs/index.js @@ -0,0 +1,74 @@ +"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.BmpCompression = void 0; +exports.msBmp = msBmp; +exports.default = bmp; +const BMP = __importStar(require("bmp-ts")); +const utils_1 = require("@jimp/utils"); +var bmp_ts_1 = require("bmp-ts"); +Object.defineProperty(exports, "BmpCompression", { enumerable: true, get: function () { return bmp_ts_1.BmpCompression; } }); +function encode(image, options = {}) { + (0, utils_1.scan)({ bitmap: image }, 0, 0, image.width, image.height, function (_, __, index) { + const red = image.data[index + 0]; + const green = image.data[index + 1]; + const blue = image.data[index + 2]; + const alpha = image.data[index + 3]; + image.data[index + 0] = alpha; + image.data[index + 1] = blue; + image.data[index + 2] = green; + image.data[index + 3] = red; + }); + return BMP.encode({ ...image, ...options }).data; +} +function decode(data, options) { + const result = BMP.decode(data, options); + (0, utils_1.scan)({ bitmap: result }, 0, 0, result.width, result.height, function (_, __, index) { + // const alpha = result.data[index + 0]!; + const blue = result.data[index + 1]; + const green = result.data[index + 2]; + const red = result.data[index + 3]; + result.data[index + 0] = red; + result.data[index + 1] = green; + result.data[index + 2] = blue; + result.data[index + 3] = 0xff; + }); + return result; +} +function msBmp() { + return { + mime: "image/x-ms-bmp", + encode, + decode, + }; +} +function bmp() { + return { + mime: "image/bmp", + encode, + decode, + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-bmp/dist/commonjs/index.js.map b/node_modules/@jimp/js-bmp/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b3ff2688fad1ac16cb1e9f2743e0dd8b1ff5820e --- /dev/null +++ b/node_modules/@jimp/js-bmp/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;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,MAAM,EAAE,MAAM,EAAE,EAClB,CAAC,EACD,CAAC,EACD,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,MAAM,EACb,UAAU,CAAC,EAAE,EAAE,EAAE,KAAK;QACpB,yCAAyC;QACzC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC;QACrC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC;QACtC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC;QAEpC,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;IAChC,CAAC,CACF,CAAC;IAEF,OAAO,MAAgB,CAAC;AAC1B,CAAC;AAED,SAAgB,KAAK;IACnB,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,MAAM;QACN,MAAM;KAC4B,CAAC;AACvC,CAAC;AAED,SAAwB,GAAG;IACzB,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM;QACN,MAAM;KACuB,CAAC;AAClC,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/js-bmp/dist/commonjs/package.json b/node_modules/@jimp/js-bmp/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/node_modules/@jimp/js-bmp/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@jimp/js-bmp/dist/esm/index.d.ts b/node_modules/@jimp/js-bmp/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d7e69c86eed24918f8eb69399880839a7f346cf0 --- /dev/null +++ b/node_modules/@jimp/js-bmp/dist/esm/index.d.ts @@ -0,0 +1,24 @@ +import * as BMP from "bmp-ts"; +import { Bitmap } from "@jimp/types"; +export type { BmpColor } from "bmp-ts"; +export { BmpCompression } from "bmp-ts"; +type Pretty = { + [K in keyof T]: T[K] extends (...args: any[]) => any ? T[K] : T[K] extends object ? Pretty : T[K]; +}; +export type EncodeOptions = Pretty>>; +export interface DecodeBmpOptions { + toRGBA?: boolean; +} +declare function encode(image: Bitmap, options?: EncodeOptions): Buffer; +declare function decode(data: Buffer, options?: DecodeBmpOptions): Bitmap; +export declare function msBmp(): { + mime: "image/x-ms-bmp"; + encode: typeof encode; + decode: typeof decode; +}; +export default function bmp(): { + mime: "image/bmp"; + encode: typeof encode; + decode: typeof decode; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-bmp/dist/esm/index.d.ts.map b/node_modules/@jimp/js-bmp/dist/esm/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..13fb84c7c2dc3c0b8f067634fcfa9a962f0a75f2 --- /dev/null +++ b/node_modules/@jimp/js-bmp/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAG9B,OAAO,EAAE,MAAM,EAAU,MAAM,aAAa,CAAC;AAE7C,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,KAAK,MAAM,CAAC,CAAC,IAAI;KAEd,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAChD,CAAC,CAAC,CAAC,CAAC,GACJ,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACjB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACZ,CAAC,CAAC,CAAC,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,MAAM,CAChC,OAAO,CACL,IAAI,CACF,GAAG,CAAC,QAAQ,EACV,SAAS,GACT,QAAQ,GACR,iBAAiB,GACjB,IAAI,GACJ,IAAI,GACJ,WAAW,GACX,WAAW,CACd,CACF,CACF,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,iBAAS,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,UAqBzD;AAED,iBAAS,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAsBrC,MAAM,CACxB;AAED,wBAAgB,KAAK;;;;EAMpB;AAED,MAAM,CAAC,OAAO,UAAU,GAAG;;;;EAM1B"} \ No newline at end of file diff --git a/node_modules/@jimp/js-bmp/dist/esm/index.js b/node_modules/@jimp/js-bmp/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d210f35c381e7c88fcddce1655ec9713c06ae6da --- /dev/null +++ b/node_modules/@jimp/js-bmp/dist/esm/index.js @@ -0,0 +1,45 @@ +import * as BMP from "bmp-ts"; +import { scan } from "@jimp/utils"; +export { BmpCompression } from "bmp-ts"; +function encode(image, options = {}) { + scan({ bitmap: image }, 0, 0, image.width, image.height, function (_, __, index) { + const red = image.data[index + 0]; + const green = image.data[index + 1]; + const blue = image.data[index + 2]; + const alpha = image.data[index + 3]; + image.data[index + 0] = alpha; + image.data[index + 1] = blue; + image.data[index + 2] = green; + image.data[index + 3] = red; + }); + return BMP.encode({ ...image, ...options }).data; +} +function decode(data, options) { + const result = BMP.decode(data, options); + scan({ bitmap: result }, 0, 0, result.width, result.height, function (_, __, index) { + // const alpha = result.data[index + 0]!; + const blue = result.data[index + 1]; + const green = result.data[index + 2]; + const red = result.data[index + 3]; + result.data[index + 0] = red; + result.data[index + 1] = green; + result.data[index + 2] = blue; + result.data[index + 3] = 0xff; + }); + return result; +} +export function msBmp() { + return { + mime: "image/x-ms-bmp", + encode, + decode, + }; +} +export default function bmp() { + return { + mime: "image/bmp", + encode, + decode, + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-bmp/dist/esm/index.js.map b/node_modules/@jimp/js-bmp/dist/esm/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..858360346010339bb0563f81cd41c0462acb67cc --- /dev/null +++ b/node_modules/@jimp/js-bmp/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAInC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AA8BxC,SAAS,MAAM,CAAC,KAAa,EAAE,UAAyB,EAAE;IACxD,IAAI,CACF,EAAE,MAAM,EAAE,KAAK,EAAE,EACjB,CAAC,EACD,CAAC,EACD,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,MAAM,EACZ,UAAU,CAAC,EAAE,EAAE,EAAE,KAAK;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC;QACnC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC;QACpC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC;QAErC,KAAK,CAAC,IAAI,CAAC,KAAK,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,CAAC;IAEF,OAAO,MAAgB,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,MAAM;QACN,MAAM;KAC4B,CAAC;AACvC,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,GAAG;IACzB,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM;QACN,MAAM;KACuB,CAAC;AAClC,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/js-bmp/dist/esm/package.json b/node_modules/@jimp/js-bmp/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/node_modules/@jimp/js-bmp/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@jimp/js-bmp/eslint.config.mjs b/node_modules/@jimp/js-bmp/eslint.config.mjs new file mode 100644 index 0000000000000000000000000000000000000000..939816d0a4be5f347676861f9592614a0ca07046 --- /dev/null +++ b/node_modules/@jimp/js-bmp/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/js-bmp/package.json b/node_modules/@jimp/js-bmp/package.json new file mode 100644 index 0000000000000000000000000000000000000000..9c57777b576e638bfe2e9d07fbc2d51dbd6c83cf --- /dev/null +++ b/node_modules/@jimp/js-bmp/package.json @@ -0,0 +1,69 @@ +{ + "name": "@jimp/js-bmp", + "version": "1.6.1", + "repository": "jimp-dev/jimp", + "engines": { + "node": ">=18" + }, + "scripts": { + "lint": "eslint .", + "test": "vitest", + "test:browser": "vitest --config vitest.config.browser.mjs", + "build": "tshy", + "dev": "tshy --watch", + "clean": "rm -rf node_modules .tshy .tshy-build dist .turbo" + }, + "author": "Andrew Lisowski ", + "license": "MIT", + "devDependencies": { + "@jimp/config-eslint": "1.6.1", + "@jimp/config-typescript": "1.6.1", + "@jimp/config-vitest": "1.6.1", + "@jimp/js-png": "1.6.1", + "@jimp/test-utils": "1.6.1", + "@types/node": "^18.19.48", + "@vitest/browser": "^2.0.5", + "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", + "dependencies": { + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", + "@jimp/utils": "1.6.1", + "bmp-ts": "^1.0.9" + }, + "publishConfig": { + "access": "public" + }, + "sideEffects": false, + "module": "./dist/esm/index.js", + "gitHead": "7e6a95694e00a8b6f1bdd9aad709f5413eb9b08c" +} diff --git a/node_modules/@jimp/js-bmp/src/images/windows95.bmp b/node_modules/@jimp/js-bmp/src/images/windows95.bmp new file mode 100644 index 0000000000000000000000000000000000000000..484be51b27f58fbccb166a9b90fd30906289ad9a --- /dev/null +++ b/node_modules/@jimp/js-bmp/src/images/windows95.bmp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c82e66ebf4477e93d91fb0953478a4f31d42a6e915dcc777b1a8d22db82c0af6 +size 129078 diff --git a/node_modules/@jimp/js-bmp/src/images/windows95.png b/node_modules/@jimp/js-bmp/src/images/windows95.png new file mode 100644 index 0000000000000000000000000000000000000000..57b7cf735d99ee83f79a2d1b72d79225a96ec84b Binary files /dev/null and b/node_modules/@jimp/js-bmp/src/images/windows95.png differ diff --git a/node_modules/@jimp/js-bmp/src/index.node.test.ts b/node_modules/@jimp/js-bmp/src/index.node.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..c4b7aaf2d78a6ed48339e719d374178995154ac6 --- /dev/null +++ b/node_modules/@jimp/js-bmp/src/index.node.test.ts @@ -0,0 +1,17 @@ +import { describe, expect, test } from "vitest"; +import { createJimp } from "@jimp/core"; +import { getTestImagePath } from "@jimp/test-utils"; + +import png from "@jimp/js-png"; +import bmp from "./index.js"; + +const jimp = createJimp({ formats: [bmp, png] }); + +describe("BMP", () => { + test("uses correct colors for BMP", async function () { + const expectedImg = await jimp.read(getTestImagePath("windows95.png")); + const image = await jimp.read(getTestImagePath("windows95.bmp")); + + expect(image.bitmap.data).toEqual(expectedImg.bitmap.data); + }); +}); diff --git a/node_modules/@jimp/js-bmp/src/index.test.ts b/node_modules/@jimp/js-bmp/src/index.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..021cb766d3fde021b4b5633a3eccf45a9f91acde --- /dev/null +++ b/node_modules/@jimp/js-bmp/src/index.test.ts @@ -0,0 +1,32 @@ +import { describe, expect, test } from "vitest"; +import { createJimp } from "@jimp/core"; +import { getTestImagePath } from "@jimp/test-utils"; + +import png from "@jimp/js-png"; +import bmp from "./index.js"; + +const jimp = createJimp({ formats: [bmp, png] }); + +describe("BMP", () => { + test("load BMP", async () => { + const image = await jimp.read(getTestImagePath("windows95.bmp")); + + expect(image.getPixelColor(10, 10)).toBe(0xeff7f7ff); + expect(image.getPixelColor(150, 80)).toBe(0x73add6ff); + expect(image.getPixelColor(190, 200)).toBe(0xf7c300ff); + }); + + test("export BMP", async () => { + const image = jimp.fromBitmap({ + width: 3, + height: 3, + data: [ + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], + }); + const buffer = await image.getBuffer("image/bmp"); + + expect(buffer.toString()).toMatch(/^BM/); + }); +}); diff --git a/node_modules/@jimp/js-bmp/src/index.ts b/node_modules/@jimp/js-bmp/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..8dc8d366a00cfe74bc159d236f8ce7d2b1bf4251 --- /dev/null +++ b/node_modules/@jimp/js-bmp/src/index.ts @@ -0,0 +1,99 @@ +import * as BMP from "bmp-ts"; + +import { scan } from "@jimp/utils"; +import { Bitmap, Format } from "@jimp/types"; + +export type { BmpColor } from "bmp-ts"; +export { BmpCompression } from "bmp-ts"; + +type Pretty = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [K in keyof T]: T[K] extends (...args: any[]) => any + ? T[K] + : T[K] extends object + ? Pretty + : T[K]; +}; + +export type EncodeOptions = Pretty< + Partial< + Pick< + BMP.BmpImage, + | "palette" + | "colors" + | "importantColors" + | "hr" + | "vr" + | "reserved1" + | "reserved2" + > + > +>; + +export interface DecodeBmpOptions { + toRGBA?: boolean; +} + +function encode(image: Bitmap, options: EncodeOptions = {}) { + scan( + { bitmap: image }, + 0, + 0, + image.width, + image.height, + function (_, __, index) { + const red = image.data[index + 0]!; + const green = image.data[index + 1]!; + const blue = image.data[index + 2]!; + const alpha = image.data[index + 3]!; + + image.data[index + 0] = alpha; + image.data[index + 1] = blue; + image.data[index + 2] = green; + image.data[index + 3] = red; + } + ); + + return BMP.encode({ ...image, ...options }).data; +} + +function decode(data: Buffer, options?: DecodeBmpOptions) { + const result = BMP.decode(data, options); + + scan( + { bitmap: result }, + 0, + 0, + result.width, + result.height, + function (_, __, index) { + // const alpha = result.data[index + 0]!; + const blue = result.data[index + 1]!; + const green = result.data[index + 2]!; + const red = result.data[index + 3]!; + + result.data[index + 0] = red; + result.data[index + 1] = green; + result.data[index + 2] = blue; + result.data[index + 3] = 0xff; + } + ); + + return result as Bitmap; +} + +export function msBmp() { + return { + mime: "image/x-ms-bmp", + encode, + decode, + } satisfies Format<"image/x-ms-bmp">; +} + +export default function bmp() { + return { + mime: "image/bmp", + encode, + decode, + } satisfies Format<"image/bmp">; +} diff --git a/node_modules/@jimp/js-bmp/tsconfig.json b/node_modules/@jimp/js-bmp/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..ad7f216ca2b10874329665feda994727844e4305 --- /dev/null +++ b/node_modules/@jimp/js-bmp/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@jimp/config-typescript/base.json", + "compilerOptions": { + "outDir": "dist" + } +} diff --git a/node_modules/@jimp/js-bmp/vitest.config.browser.mjs b/node_modules/@jimp/js-bmp/vitest.config.browser.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dfe6aff6b16f48bc45697e4c14219f2034754cf5 --- /dev/null +++ b/node_modules/@jimp/js-bmp/vitest.config.browser.mjs @@ -0,0 +1,3 @@ +import config from "@jimp/config-vitest/browser"; + +export default config; diff --git a/node_modules/@jimp/js-gif/.tshy/build.json b/node_modules/@jimp/js-gif/.tshy/build.json new file mode 100644 index 0000000000000000000000000000000000000000..aea1a9e93b5db3468973ebeaad6dac0a77b10c02 --- /dev/null +++ b/node_modules/@jimp/js-gif/.tshy/build.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../src", + "module": "nodenext", + "moduleResolution": "nodenext" + } +} diff --git a/node_modules/@jimp/js-gif/.tshy/commonjs.json b/node_modules/@jimp/js-gif/.tshy/commonjs.json new file mode 100644 index 0000000000000000000000000000000000000000..75bcfc1d756dcb1baafc973385c81c5aa93f3174 --- /dev/null +++ b/node_modules/@jimp/js-gif/.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/js-gif/.tshy/esm.json b/node_modules/@jimp/js-gif/.tshy/esm.json new file mode 100644 index 0000000000000000000000000000000000000000..fdc4fa775818876f2e8f6cd606e9bb337515ac56 --- /dev/null +++ b/node_modules/@jimp/js-gif/.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/js-gif/CHANGELOG.md b/node_modules/@jimp/js-gif/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..8a5e43d877c675803da2600252741c13cc2df3c4 --- /dev/null +++ b/node_modules/@jimp/js-gif/CHANGELOG.md @@ -0,0 +1,39 @@ +# 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.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/js-gif/LICENSE b/node_modules/@jimp/js-gif/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..baa5d48509a18b9ab4f6c39289362690ea68e688 --- /dev/null +++ b/node_modules/@jimp/js-gif/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/js-gif/README.md b/node_modules/@jimp/js-gif/README.md new file mode 100644 index 0000000000000000000000000000000000000000..215eb3993215d6d5580acecabbd2d20964200f21 --- /dev/null +++ b/node_modules/@jimp/js-gif/README.md @@ -0,0 +1,8 @@ +
+ +

@jimp/gif

+

Default Jimp gif decoder.

+
+ +NOTE: Only supports single frame diff --git a/node_modules/@jimp/js-gif/dist/commonjs/index.d.ts b/node_modules/@jimp/js-gif/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..34ce8eedc33bbda9114452699ee618cb936a2ed7 --- /dev/null +++ b/node_modules/@jimp/js-gif/dist/commonjs/index.d.ts @@ -0,0 +1,13 @@ +export interface JPEGOptions { + quality?: number; +} +export default function gif(): { + mime: "image/gif"; + encode: (bitmap: import("@jimp/types").Bitmap) => Promise; + decode: (data: Buffer) => { + data: Buffer; + width: number; + height: number; + }; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-gif/dist/commonjs/index.d.ts.map b/node_modules/@jimp/js-gif/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f4e64f69a874349e063e5b7483fcdda829c11989 --- /dev/null +++ b/node_modules/@jimp/js-gif/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,UAAU,GAAG;;;;;;;;EAwB1B"} \ No newline at end of file diff --git a/node_modules/@jimp/js-gif/dist/commonjs/index.js b/node_modules/@jimp/js-gif/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..95004aa785322c0b92b38acf99da02a896d9190a --- /dev/null +++ b/node_modules/@jimp/js-gif/dist/commonjs/index.js @@ -0,0 +1,32 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = gif; +const omggif_1 = __importDefault(require("omggif")); +const gifwrap_1 = require("gifwrap"); +function gif() { + return { + mime: "image/gif", + encode: async (bitmap) => { + const gif = new gifwrap_1.BitmapImage(bitmap); + gifwrap_1.GifUtil.quantizeDekker(gif, 256); + const newFrame = new gifwrap_1.GifFrame(bitmap); + const gifCodec = new gifwrap_1.GifCodec(); + const newGif = await gifCodec.encodeGif([newFrame], {}); + return newGif.buffer; + }, + decode: (data) => { + const gifObj = new omggif_1.default.GifReader(data); + const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); + gifObj.decodeAndBlitFrameRGBA(0, gifData); + return { + data: gifData, + width: gifObj.width, + height: gifObj.height, + }; + }, + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-gif/dist/commonjs/index.js.map b/node_modules/@jimp/js-gif/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..689585b92aa8f5420bcc8640608ddbbe5821bed9 --- /dev/null +++ b/node_modules/@jimp/js-gif/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAQA,sBAwBC;AAhCD,oDAAyB;AACzB,qCAAmE;AAOnE,SAAwB,GAAG;IACzB,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACvB,MAAM,GAAG,GAAG,IAAI,qBAAW,CAAC,MAAM,CAAC,CAAC;YACpC,iBAAO,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACjC,MAAM,QAAQ,GAAG,IAAI,kBAAQ,CAAC,MAAM,CAAC,CAAC;YACtC,MAAM,QAAQ,GAAG,IAAI,kBAAQ,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;YACxD,OAAO,MAAM,CAAC,MAAM,CAAC;QACvB,CAAC;QACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACf,MAAM,MAAM,GAAG,IAAI,gBAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACvC,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAE/D,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YAE1C,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB,CAAC;QACJ,CAAC;KAC4B,CAAC;AAClC,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/js-gif/dist/commonjs/package.json b/node_modules/@jimp/js-gif/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/node_modules/@jimp/js-gif/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@jimp/js-gif/dist/esm/index.d.ts b/node_modules/@jimp/js-gif/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..34ce8eedc33bbda9114452699ee618cb936a2ed7 --- /dev/null +++ b/node_modules/@jimp/js-gif/dist/esm/index.d.ts @@ -0,0 +1,13 @@ +export interface JPEGOptions { + quality?: number; +} +export default function gif(): { + mime: "image/gif"; + encode: (bitmap: import("@jimp/types").Bitmap) => Promise; + decode: (data: Buffer) => { + data: Buffer; + width: number; + height: number; + }; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-gif/dist/esm/index.d.ts.map b/node_modules/@jimp/js-gif/dist/esm/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f4e64f69a874349e063e5b7483fcdda829c11989 --- /dev/null +++ b/node_modules/@jimp/js-gif/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,UAAU,GAAG;;;;;;;;EAwB1B"} \ No newline at end of file diff --git a/node_modules/@jimp/js-gif/dist/esm/index.js b/node_modules/@jimp/js-gif/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c366d4b4e18002e49e72ed03de383bb8d0d6a9c7 --- /dev/null +++ b/node_modules/@jimp/js-gif/dist/esm/index.js @@ -0,0 +1,26 @@ +import GIF from "omggif"; +import { GifUtil, GifFrame, BitmapImage, GifCodec } from "gifwrap"; +export default function gif() { + return { + mime: "image/gif", + encode: async (bitmap) => { + const gif = new BitmapImage(bitmap); + GifUtil.quantizeDekker(gif, 256); + const newFrame = new GifFrame(bitmap); + const gifCodec = new GifCodec(); + const newGif = await gifCodec.encodeGif([newFrame], {}); + return newGif.buffer; + }, + decode: (data) => { + const gifObj = new GIF.GifReader(data); + const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); + gifObj.decodeAndBlitFrameRGBA(0, gifData); + return { + data: gifData, + width: gifObj.width, + height: gifObj.height, + }; + }, + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-gif/dist/esm/index.js.map b/node_modules/@jimp/js-gif/dist/esm/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d8e7d7f1c09475097298f90ab1431713fd8f0ec8 --- /dev/null +++ b/node_modules/@jimp/js-gif/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAOnE,MAAM,CAAC,OAAO,UAAU,GAAG;IACzB,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACvB,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;YACpC,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACjC,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;YACtC,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;YACxD,OAAO,MAAM,CAAC,MAAM,CAAC;QACvB,CAAC;QACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACf,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACvC,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAE/D,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YAE1C,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB,CAAC;QACJ,CAAC;KAC4B,CAAC;AAClC,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/js-gif/dist/esm/package.json b/node_modules/@jimp/js-gif/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/node_modules/@jimp/js-gif/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@jimp/js-gif/eslint.config.mjs b/node_modules/@jimp/js-gif/eslint.config.mjs new file mode 100644 index 0000000000000000000000000000000000000000..939816d0a4be5f347676861f9592614a0ca07046 --- /dev/null +++ b/node_modules/@jimp/js-gif/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/js-gif/package.json b/node_modules/@jimp/js-gif/package.json new file mode 100644 index 0000000000000000000000000000000000000000..e29dc3640f6c55bd2db0f83763b2556ed9bd3223 --- /dev/null +++ b/node_modules/@jimp/js-gif/package.json @@ -0,0 +1,69 @@ +{ + "name": "@jimp/js-gif", + "version": "1.6.1", + "repository": "jimp-dev/jimp", + "engines": { + "node": ">=18" + }, + "scripts": { + "lint": "eslint .", + "test": "vitest", + "test:browser": "vitest --config vitest.config.browser.mjs", + "build": "tshy", + "dev": "tshy --watch", + "clean": "rm -rf node_modules .tshy .tshy-build dist .turbo" + }, + "author": "Andrew Lisowski ", + "license": "MIT", + "devDependencies": { + "@jimp/config-eslint": "1.6.1", + "@jimp/config-typescript": "1.6.1", + "@jimp/config-vitest": "1.6.1", + "@jimp/test-utils": "1.6.1", + "@types/node": "^18.19.48", + "@types/omggif": "^1.0.5", + "@vitest/browser": "^2.0.5", + "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", + "dependencies": { + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", + "gifwrap": "^0.10.1", + "omggif": "^1.0.10" + }, + "publishConfig": { + "access": "public" + }, + "sideEffects": false, + "module": "./dist/esm/index.js", + "gitHead": "7e6a95694e00a8b6f1bdd9aad709f5413eb9b08c" +} diff --git a/node_modules/@jimp/js-gif/src/index.test.ts b/node_modules/@jimp/js-gif/src/index.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..391710dec776d18557746bfb09393a2902cf7db5 --- /dev/null +++ b/node_modules/@jimp/js-gif/src/index.test.ts @@ -0,0 +1,25 @@ +import { expect, test, describe } from "vitest"; +import { createJimp } from "@jimp/core"; +import { getTestImagePath } from "@jimp/test-utils"; + +import gif from "./index.js"; + +const jimp = createJimp({ formats: [gif] }); + +describe("GIF", () => { + test("load GIF", async () => { + const image = await jimp.read(getTestImagePath("flower.gif")); + expect(image.getPixelColor(10, 10)).toBe(0xfefefeff); + }); + + test("load animated GIF", async () => { + const image = await jimp.read(getTestImagePath("animated.gif")); + expect(image.getPixelColor(10, 10)).toBe(0xa1d2f1ff); + }); + + test("export GIF", async () => { + const jgd = await jimp.read(getTestImagePath("flower.gif")); + const buffer = await jgd.getBuffer("image/gif"); + expect(buffer.toString()).toMatch(/^GIF/); + }); +}); diff --git a/node_modules/@jimp/js-gif/src/index.ts b/node_modules/@jimp/js-gif/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..bc78a120677231601af18935add0775d19d7e5b8 --- /dev/null +++ b/node_modules/@jimp/js-gif/src/index.ts @@ -0,0 +1,33 @@ +import GIF from "omggif"; +import { GifUtil, GifFrame, BitmapImage, GifCodec } from "gifwrap"; +import { Format } from "@jimp/types"; + +export interface JPEGOptions { + quality?: number; +} + +export default function gif() { + return { + mime: "image/gif", + encode: async (bitmap) => { + const gif = new BitmapImage(bitmap); + GifUtil.quantizeDekker(gif, 256); + const newFrame = new GifFrame(bitmap); + const gifCodec = new GifCodec(); + const newGif = await gifCodec.encodeGif([newFrame], {}); + return newGif.buffer; + }, + decode: (data) => { + const gifObj = new GIF.GifReader(data); + const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); + + gifObj.decodeAndBlitFrameRGBA(0, gifData); + + return { + data: gifData, + width: gifObj.width, + height: gifObj.height, + }; + }, + } satisfies Format<"image/gif">; +} diff --git a/node_modules/@jimp/js-gif/tsconfig.json b/node_modules/@jimp/js-gif/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..ad7f216ca2b10874329665feda994727844e4305 --- /dev/null +++ b/node_modules/@jimp/js-gif/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@jimp/config-typescript/base.json", + "compilerOptions": { + "outDir": "dist" + } +} diff --git a/node_modules/@jimp/js-gif/vitest.config.browser.mjs b/node_modules/@jimp/js-gif/vitest.config.browser.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dfe6aff6b16f48bc45697e4c14219f2034754cf5 --- /dev/null +++ b/node_modules/@jimp/js-gif/vitest.config.browser.mjs @@ -0,0 +1,3 @@ +import config from "@jimp/config-vitest/browser"; + +export default config; diff --git a/node_modules/@jimp/js-jpeg/.tshy/build.json b/node_modules/@jimp/js-jpeg/.tshy/build.json new file mode 100644 index 0000000000000000000000000000000000000000..aea1a9e93b5db3468973ebeaad6dac0a77b10c02 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/.tshy/build.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../src", + "module": "nodenext", + "moduleResolution": "nodenext" + } +} diff --git a/node_modules/@jimp/js-jpeg/.tshy/commonjs.json b/node_modules/@jimp/js-jpeg/.tshy/commonjs.json new file mode 100644 index 0000000000000000000000000000000000000000..75bcfc1d756dcb1baafc973385c81c5aa93f3174 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/.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/js-jpeg/.tshy/esm.json b/node_modules/@jimp/js-jpeg/.tshy/esm.json new file mode 100644 index 0000000000000000000000000000000000000000..fdc4fa775818876f2e8f6cd606e9bb337515ac56 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/.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/js-jpeg/CHANGELOG.md b/node_modules/@jimp/js-jpeg/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..3983b07dfc0b2985f8afc7781b3984c3fe6423c7 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/CHANGELOG.md @@ -0,0 +1,74 @@ +# 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.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.0 (Sun Sep 01 2024) + +#### ⚠️ Pushed to `main` + +- upgrade tshy ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- update more docs ([@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/js-jpeg/LICENSE b/node_modules/@jimp/js-jpeg/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..baa5d48509a18b9ab4f6c39289362690ea68e688 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/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/js-jpeg/README.md b/node_modules/@jimp/js-jpeg/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0dddc13c339c392969d18210863657c4e19ba506 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/README.md @@ -0,0 +1,6 @@ +
+ +

@jimp/jpeg

+

Default Jimp jpeg encoder/decoder.

+
diff --git a/node_modules/@jimp/js-jpeg/dist/commonjs/index.d.ts b/node_modules/@jimp/js-jpeg/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9947356eb653175bfd36682f187124ee83d918a --- /dev/null +++ b/node_modules/@jimp/js-jpeg/dist/commonjs/index.d.ts @@ -0,0 +1,20 @@ +import JPEG from "jpeg-js"; +export interface JPEGOptions { + quality?: number; +} +export interface DecodeJpegOptions { + useTArray?: false; + colorTransform?: boolean; + formatAsRGBA?: boolean; + tolerantDecoding?: boolean; + maxResolutionInMP?: number; + maxMemoryUsageInMB?: number; +} +export default function jpeg(): { + mime: "image/jpeg"; + encode: (bitmap: import("@jimp/types").Bitmap, { quality }?: JPEGOptions) => Buffer; + decode: (data: Buffer, options?: DecodeJpegOptions) => JPEG.BufferRet & { + comments?: string[]; + }; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-jpeg/dist/commonjs/index.d.ts.map b/node_modules/@jimp/js-jpeg/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..aabd09c343dee1e257c3eaa7488c2232c87fe12a --- /dev/null +++ b/node_modules/@jimp/js-jpeg/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAG3B,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,UAAU,IAAI;;iEAGY,WAAW;qCAEtB,iBAAiB;;;EAE7C"} \ No newline at end of file diff --git a/node_modules/@jimp/js-jpeg/dist/commonjs/index.js b/node_modules/@jimp/js-jpeg/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7db814665fa1031bbc5e3185e8661eea4eac726a --- /dev/null +++ b/node_modules/@jimp/js-jpeg/dist/commonjs/index.js @@ -0,0 +1,15 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = jpeg; +const jpeg_js_1 = __importDefault(require("jpeg-js")); +function jpeg() { + return { + mime: "image/jpeg", + encode: (bitmap, { quality = 100 } = {}) => jpeg_js_1.default.encode(bitmap, quality).data, + decode: (data, options) => jpeg_js_1.default.decode(data, options), + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-jpeg/dist/commonjs/index.js.map b/node_modules/@jimp/js-jpeg/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c5269ec836de985deb309de57bdf521b95e895be --- /dev/null +++ b/node_modules/@jimp/js-jpeg/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAgBA,uBAOC;AAvBD,sDAA2B;AAgB3B,SAAwB,IAAI;IAC1B,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,OAAO,GAAG,GAAG,KAAkB,EAAE,EAAE,EAAE,CACtD,iBAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;QACnC,MAAM,EAAE,CAAC,IAAI,EAAE,OAA2B,EAAE,EAAE,CAAC,iBAAI,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;KAC3C,CAAC;AACnC,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/js-jpeg/dist/commonjs/package.json b/node_modules/@jimp/js-jpeg/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@jimp/js-jpeg/dist/esm/index.d.ts b/node_modules/@jimp/js-jpeg/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9947356eb653175bfd36682f187124ee83d918a --- /dev/null +++ b/node_modules/@jimp/js-jpeg/dist/esm/index.d.ts @@ -0,0 +1,20 @@ +import JPEG from "jpeg-js"; +export interface JPEGOptions { + quality?: number; +} +export interface DecodeJpegOptions { + useTArray?: false; + colorTransform?: boolean; + formatAsRGBA?: boolean; + tolerantDecoding?: boolean; + maxResolutionInMP?: number; + maxMemoryUsageInMB?: number; +} +export default function jpeg(): { + mime: "image/jpeg"; + encode: (bitmap: import("@jimp/types").Bitmap, { quality }?: JPEGOptions) => Buffer; + decode: (data: Buffer, options?: DecodeJpegOptions) => JPEG.BufferRet & { + comments?: string[]; + }; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-jpeg/dist/esm/index.d.ts.map b/node_modules/@jimp/js-jpeg/dist/esm/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..aabd09c343dee1e257c3eaa7488c2232c87fe12a --- /dev/null +++ b/node_modules/@jimp/js-jpeg/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAG3B,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,UAAU,IAAI;;iEAGY,WAAW;qCAEtB,iBAAiB;;;EAE7C"} \ No newline at end of file diff --git a/node_modules/@jimp/js-jpeg/dist/esm/index.js b/node_modules/@jimp/js-jpeg/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..dfd69e4cdbe38dbaf83a9831842e38ad6d21c8d7 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/dist/esm/index.js @@ -0,0 +1,9 @@ +import JPEG from "jpeg-js"; +export default function jpeg() { + return { + mime: "image/jpeg", + encode: (bitmap, { quality = 100 } = {}) => JPEG.encode(bitmap, quality).data, + decode: (data, options) => JPEG.decode(data, options), + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-jpeg/dist/esm/index.js.map b/node_modules/@jimp/js-jpeg/dist/esm/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..31026097f0bd076cfa3f9db627643bd9d7dff481 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAgB3B,MAAM,CAAC,OAAO,UAAU,IAAI;IAC1B,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,OAAO,GAAG,GAAG,KAAkB,EAAE,EAAE,EAAE,CACtD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;QACnC,MAAM,EAAE,CAAC,IAAI,EAAE,OAA2B,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;KAC3C,CAAC;AACnC,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/js-jpeg/dist/esm/package.json b/node_modules/@jimp/js-jpeg/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@jimp/js-jpeg/eslint.config.mjs b/node_modules/@jimp/js-jpeg/eslint.config.mjs new file mode 100644 index 0000000000000000000000000000000000000000..939816d0a4be5f347676861f9592614a0ca07046 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/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/js-jpeg/package.json b/node_modules/@jimp/js-jpeg/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f31bded4a7600edab259d5bc27c7db866cc7da79 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/package.json @@ -0,0 +1,66 @@ +{ + "name": "@jimp/js-jpeg", + "version": "1.6.1", + "repository": "jimp-dev/jimp", + "engines": { + "node": ">=18" + }, + "scripts": { + "lint": "eslint .", + "test": "vitest", + "test:browser": "vitest --config vitest.config.browser.mjs", + "build": "tshy", + "dev": "tshy --watch", + "clean": "rm -rf node_modules .tshy .tshy-build dist .turbo" + }, + "author": "Andrew Lisowski ", + "license": "MIT", + "devDependencies": { + "@jimp/config-eslint": "1.6.1", + "@jimp/config-typescript": "1.6.1", + "@jimp/config-vitest": "1.6.1", + "@jimp/test-utils": "1.6.1", + "@vitest/browser": "^2.0.5", + "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", + "dependencies": { + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", + "jpeg-js": "^0.4.4" + }, + "publishConfig": { + "access": "public" + }, + "sideEffects": false, + "module": "./dist/esm/index.js", + "gitHead": "7e6a95694e00a8b6f1bdd9aad709f5413eb9b08c" +} diff --git a/node_modules/@jimp/js-jpeg/src/index.test.ts b/node_modules/@jimp/js-jpeg/src/index.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..031fa29647c7852982596cb1f90d938d1c4ef9cd --- /dev/null +++ b/node_modules/@jimp/js-jpeg/src/index.test.ts @@ -0,0 +1,43 @@ +import { expect, test, describe } from "vitest"; +import { createJimp } from "@jimp/core"; +import { getTestImagePath } from "@jimp/test-utils"; + +import jpeg from "./index.js"; + +const jimp = createJimp({ formats: [jpeg] }); + +describe("JPEG", () => { + test("load JPG", async () => { + const image = await jimp.read(getTestImagePath("cops.jpg")); + + expect(image.getPixelColor(10, 10)).toBe(0x3f4a02ff); + expect(image.getPixelColor(220, 190)).toBe(0x5d94b6ff); + expect(image.getPixelColor(350, 130)).toBe(0xdf7944ff); + }); + + test("load JPG with fill bytes", async () => { + const image = await jimp.read(getTestImagePath("fillbytes.jpg")); + + expect(image.getPixelColor(10, 10)).toBe(0xaeb8c3ff); + expect(image.getPixelColor(220, 190)).toBe(0x262b21ff); + expect(image.getPixelColor(350, 130)).toBe(0x4e5d30ff); + }); + + test("export JPG", async () => { + const image = jimp.fromBitmap({ + width: 3, + height: 3, + data: [ + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], + }); + + const buffer = await image.getBuffer("image/jpeg", { + quality: 50, + }); + + // eslint-disable-next-line no-control-regex + expect(buffer.toString()).toMatch(/^.{3,9}JFIF\u0000/); + }); +}); diff --git a/node_modules/@jimp/js-jpeg/src/index.ts b/node_modules/@jimp/js-jpeg/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..bc24291a6e47b49e880f7c41340ce62707e0e224 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/src/index.ts @@ -0,0 +1,24 @@ +import JPEG from "jpeg-js"; +import { Format } from "@jimp/types"; + +export interface JPEGOptions { + quality?: number; +} + +export interface DecodeJpegOptions { + useTArray?: false; + colorTransform?: boolean; + formatAsRGBA?: boolean; + tolerantDecoding?: boolean; + maxResolutionInMP?: number; + maxMemoryUsageInMB?: number; +} + +export default function jpeg() { + return { + mime: "image/jpeg", + encode: (bitmap, { quality = 100 }: JPEGOptions = {}) => + JPEG.encode(bitmap, quality).data, + decode: (data, options?: DecodeJpegOptions) => JPEG.decode(data, options), + } satisfies Format<"image/jpeg">; +} diff --git a/node_modules/@jimp/js-jpeg/tsconfig.json b/node_modules/@jimp/js-jpeg/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..ad7f216ca2b10874329665feda994727844e4305 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@jimp/config-typescript/base.json", + "compilerOptions": { + "outDir": "dist" + } +} diff --git a/node_modules/@jimp/js-jpeg/vitest.config.browser.mjs b/node_modules/@jimp/js-jpeg/vitest.config.browser.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dfe6aff6b16f48bc45697e4c14219f2034754cf5 --- /dev/null +++ b/node_modules/@jimp/js-jpeg/vitest.config.browser.mjs @@ -0,0 +1,3 @@ +import config from "@jimp/config-vitest/browser"; + +export default config; diff --git a/node_modules/@jimp/js-png/.tshy/build.json b/node_modules/@jimp/js-png/.tshy/build.json new file mode 100644 index 0000000000000000000000000000000000000000..aea1a9e93b5db3468973ebeaad6dac0a77b10c02 --- /dev/null +++ b/node_modules/@jimp/js-png/.tshy/build.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../src", + "module": "nodenext", + "moduleResolution": "nodenext" + } +} diff --git a/node_modules/@jimp/js-png/.tshy/commonjs.json b/node_modules/@jimp/js-png/.tshy/commonjs.json new file mode 100644 index 0000000000000000000000000000000000000000..75bcfc1d756dcb1baafc973385c81c5aa93f3174 --- /dev/null +++ b/node_modules/@jimp/js-png/.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/js-png/.tshy/esm.json b/node_modules/@jimp/js-png/.tshy/esm.json new file mode 100644 index 0000000000000000000000000000000000000000..fdc4fa775818876f2e8f6cd606e9bb337515ac56 --- /dev/null +++ b/node_modules/@jimp/js-png/.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/js-png/CHANGELOG.md b/node_modules/@jimp/js-png/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..1eb5e248fea3643b21f1a7e4efabb731b7910f2b --- /dev/null +++ b/node_modules/@jimp/js-png/CHANGELOG.md @@ -0,0 +1,73 @@ +# 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.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.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/js-png/LICENSE b/node_modules/@jimp/js-png/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..baa5d48509a18b9ab4f6c39289362690ea68e688 --- /dev/null +++ b/node_modules/@jimp/js-png/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/js-png/README.md b/node_modules/@jimp/js-png/README.md new file mode 100644 index 0000000000000000000000000000000000000000..da13e48289df028ac1955ab494d3c1cec860a6e0 --- /dev/null +++ b/node_modules/@jimp/js-png/README.md @@ -0,0 +1,35 @@ +
+ +

@jimp/png

+

Default Jimp png encoder/decoder.

+
+ +## Available Methods + +### Jimp.deflateLevel + +Sets the deflate level used when saving as PNG format (default is 9) + +### Jimp.deflateStrategy + +Sets the deflate strategy used when saving as PNG format (default is 3) + +### Jimp.filterType + +Sets the filter type used when saving as PNG format (default is automatic filters) + +### Jimp.colorType + +Sets the color type used when saving as PNG format (one of 0, 2, 4, 6) + +### Filter Types + +```js +Jimp.PNG_FILTER_AUTO; +Jimp.PNG_FILTER_NONE; +Jimp.PNG_FILTER_SUB; +Jimp.PNG_FILTER_UP; +Jimp.PNG_FILTER_AVERAGE; +Jimp.PNG_FILTER_PATH; +``` diff --git a/node_modules/@jimp/js-png/dist/commonjs/constants.d.ts b/node_modules/@jimp/js-png/dist/commonjs/constants.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e5cf96bb77fa9a822c0247788d02b51156fd6658 --- /dev/null +++ b/node_modules/@jimp/js-png/dist/commonjs/constants.d.ts @@ -0,0 +1,29 @@ +/** + * Filter method is a single-byte integer that indicates the preprocessing method applied to the image data before compression. + */ +export declare enum PNGFilterType { + AUTO = -1, + /** scanline is transmitted unmodified */ + NONE = 0, + /** filter transmits the difference between each byte and the value of the corresponding byte of the prior pixel */ + SUB = 1, + /** The Up() filter is just like the Sub() filter except that the pixel immediately above the current pixel, rather than just to its left, is used as the predictor. */ + UP = 2, + /** uses the average of the two neighboring pixels (left and above) to predict the value of a pixel */ + AVERAGE = 3, + /** computes a simple linear function of the three neighboring pixels (left, above, upper left), then chooses as predictor the neighboring pixel closest to the computed value. */ + PATH = 4 +} +/** + * Color type is a single-byte integer that describes the interpretation of the image data. + * Color type codes represent sums of the following values: + * + * 1 (palette used), 2 (color used), and 4 (alpha channel used). + */ +export declare enum PNGColorType { + GRAYSCALE = 0, + COLOR = 2, + GRAYSCALE_ALPHA = 4, + COLOR_ALPHA = 6 +} +//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/commonjs/constants.d.ts.map b/node_modules/@jimp/js-png/dist/commonjs/constants.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..98839cf4eaa481da75b7cdf2f122332ac84a342f --- /dev/null +++ b/node_modules/@jimp/js-png/dist/commonjs/constants.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,aAAa;IACvB,IAAI,KAAK;IACT,yCAAyC;IACzC,IAAI,IAAI;IACR,mHAAmH;IACnH,GAAG,IAAI;IACP,uKAAuK;IACvK,EAAE,IAAI;IACN,sGAAsG;IACtG,OAAO,IAAI;IACX,kLAAkL;IAClL,IAAI,IAAI;CACT;AAED;;;;;GAKG;AACH,oBAAY,YAAY;IACtB,SAAS,IAAI;IACb,KAAK,IAAI;IACT,eAAe,IAAI;IACnB,WAAW,IAAI;CAChB"} \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/commonjs/constants.js b/node_modules/@jimp/js-png/dist/commonjs/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..572fa97fb7e73e221279ac5b4cef0e376227fe6c --- /dev/null +++ b/node_modules/@jimp/js-png/dist/commonjs/constants.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PNGColorType = exports.PNGFilterType = void 0; +/** + * Filter method is a single-byte integer that indicates the preprocessing method applied to the image data before compression. + */ +var PNGFilterType; +(function (PNGFilterType) { + PNGFilterType[PNGFilterType["AUTO"] = -1] = "AUTO"; + /** scanline is transmitted unmodified */ + PNGFilterType[PNGFilterType["NONE"] = 0] = "NONE"; + /** filter transmits the difference between each byte and the value of the corresponding byte of the prior pixel */ + PNGFilterType[PNGFilterType["SUB"] = 1] = "SUB"; + /** The Up() filter is just like the Sub() filter except that the pixel immediately above the current pixel, rather than just to its left, is used as the predictor. */ + PNGFilterType[PNGFilterType["UP"] = 2] = "UP"; + /** uses the average of the two neighboring pixels (left and above) to predict the value of a pixel */ + PNGFilterType[PNGFilterType["AVERAGE"] = 3] = "AVERAGE"; + /** computes a simple linear function of the three neighboring pixels (left, above, upper left), then chooses as predictor the neighboring pixel closest to the computed value. */ + PNGFilterType[PNGFilterType["PATH"] = 4] = "PATH"; +})(PNGFilterType || (exports.PNGFilterType = PNGFilterType = {})); +/** + * Color type is a single-byte integer that describes the interpretation of the image data. + * Color type codes represent sums of the following values: + * + * 1 (palette used), 2 (color used), and 4 (alpha channel used). + */ +var PNGColorType; +(function (PNGColorType) { + PNGColorType[PNGColorType["GRAYSCALE"] = 0] = "GRAYSCALE"; + PNGColorType[PNGColorType["COLOR"] = 2] = "COLOR"; + PNGColorType[PNGColorType["GRAYSCALE_ALPHA"] = 4] = "GRAYSCALE_ALPHA"; + PNGColorType[PNGColorType["COLOR_ALPHA"] = 6] = "COLOR_ALPHA"; +})(PNGColorType || (exports.PNGColorType = PNGColorType = {})); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/commonjs/constants.js.map b/node_modules/@jimp/js-png/dist/commonjs/constants.js.map new file mode 100644 index 0000000000000000000000000000000000000000..890abf3c45762d78a0fac10fea714232343e032c --- /dev/null +++ b/node_modules/@jimp/js-png/dist/commonjs/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,aAYX;AAZD,WAAY,aAAa;IACvB,kDAAS,CAAA;IACT,yCAAyC;IACzC,iDAAQ,CAAA;IACR,mHAAmH;IACnH,+CAAO,CAAA;IACP,uKAAuK;IACvK,6CAAM,CAAA;IACN,sGAAsG;IACtG,uDAAW,CAAA;IACX,kLAAkL;IAClL,iDAAQ,CAAA;AACV,CAAC,EAZW,aAAa,6BAAb,aAAa,QAYxB;AAED;;;;;GAKG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,yDAAa,CAAA;IACb,iDAAS,CAAA;IACT,qEAAmB,CAAA;IACnB,6DAAe,CAAA;AACjB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB"} \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/commonjs/index.d.ts b/node_modules/@jimp/js-png/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..692fb37a595044b8da1e22af9ed8547a81c9a6da --- /dev/null +++ b/node_modules/@jimp/js-png/dist/commonjs/index.d.ts @@ -0,0 +1,24 @@ +import { PNGOptions as PNGJSOptions } from "pngjs"; +import { PNGFilterType, PNGColorType } from "./constants.js"; +export type { PNGOptions as PNGJSOptions } from "pngjs"; +export type PNGOptions = Omit & { + filterType?: PNGFilterType; + colorType?: PNGColorType; + inputColorType?: PNGColorType; +}; +export interface DecodePngOptions { + checkCRC?: boolean | undefined; + skipRescale?: boolean | undefined; +} +export * from "./constants.js"; +export default function png(): { + mime: "image/png"; + hasAlpha: true; + encode: (bitmap: import("@jimp/types").Bitmap, { deflateLevel, deflateStrategy, filterType, colorType, inputHasAlpha, ...options }?: PNGOptions) => Buffer; + decode: (data: Buffer, options?: DecodePngOptions) => { + data: Buffer; + width: number; + height: number; + }; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/commonjs/index.d.ts.map b/node_modules/@jimp/js-png/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..4fcd0bef53fb70b51875d519613739c5e6f6589c --- /dev/null +++ b/node_modules/@jimp/js-png/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,UAAU,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE7D,YAAY,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,IAAI,CAC3B,YAAY,EACZ,YAAY,GAAG,WAAW,GAAG,gBAAgB,CAC9C,GAAG;IACF,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,cAAc,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACnC;AAED,cAAc,gBAAgB,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,GAAG;;;yIAalB,UAAU;qCAuBU,gBAAgB;;;;;EAU5C"} \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/commonjs/index.js b/node_modules/@jimp/js-png/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..276ffcb40e9bfa027231b020c69b5a006eb1b347 --- /dev/null +++ b/node_modules/@jimp/js-png/dist/commonjs/index.js @@ -0,0 +1,54 @@ +"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); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = png; +const pngjs_1 = require("pngjs"); +const constants_js_1 = require("./constants.js"); +__exportStar(require("./constants.js"), exports); +function png() { + return { + mime: "image/png", + hasAlpha: true, + encode: (bitmap, { deflateLevel = 9, deflateStrategy = 3, filterType = constants_js_1.PNGFilterType.AUTO, colorType, inputHasAlpha = true, ...options } = {}) => { + const png = new pngjs_1.PNG({ + width: bitmap.width, + height: bitmap.height, + }); + png.data = bitmap.data; + return pngjs_1.PNG.sync.write(png, { + ...options, + deflateLevel, + deflateStrategy, + filterType, + colorType: typeof colorType !== "undefined" + ? colorType + : inputHasAlpha + ? constants_js_1.PNGColorType.COLOR_ALPHA + : constants_js_1.PNGColorType.COLOR, + inputHasAlpha, + }); + }, + decode: (data, options) => { + const result = pngjs_1.PNG.sync.read(data, options); + return { + data: result.data, + width: result.width, + height: result.height, + }; + }, + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/commonjs/index.js.map b/node_modules/@jimp/js-png/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b0664f8db0705832e64acc5915a41a5061e9891a --- /dev/null +++ b/node_modules/@jimp/js-png/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../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node_modules/@jimp/js-png/dist/commonjs/package.json b/node_modules/@jimp/js-png/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/node_modules/@jimp/js-png/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@jimp/js-png/dist/esm/constants.d.ts b/node_modules/@jimp/js-png/dist/esm/constants.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e5cf96bb77fa9a822c0247788d02b51156fd6658 --- /dev/null +++ b/node_modules/@jimp/js-png/dist/esm/constants.d.ts @@ -0,0 +1,29 @@ +/** + * Filter method is a single-byte integer that indicates the preprocessing method applied to the image data before compression. + */ +export declare enum PNGFilterType { + AUTO = -1, + /** scanline is transmitted unmodified */ + NONE = 0, + /** filter transmits the difference between each byte and the value of the corresponding byte of the prior pixel */ + SUB = 1, + /** The Up() filter is just like the Sub() filter except that the pixel immediately above the current pixel, rather than just to its left, is used as the predictor. */ + UP = 2, + /** uses the average of the two neighboring pixels (left and above) to predict the value of a pixel */ + AVERAGE = 3, + /** computes a simple linear function of the three neighboring pixels (left, above, upper left), then chooses as predictor the neighboring pixel closest to the computed value. */ + PATH = 4 +} +/** + * Color type is a single-byte integer that describes the interpretation of the image data. + * Color type codes represent sums of the following values: + * + * 1 (palette used), 2 (color used), and 4 (alpha channel used). + */ +export declare enum PNGColorType { + GRAYSCALE = 0, + COLOR = 2, + GRAYSCALE_ALPHA = 4, + COLOR_ALPHA = 6 +} +//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/esm/constants.d.ts.map b/node_modules/@jimp/js-png/dist/esm/constants.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..98839cf4eaa481da75b7cdf2f122332ac84a342f --- /dev/null +++ b/node_modules/@jimp/js-png/dist/esm/constants.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,aAAa;IACvB,IAAI,KAAK;IACT,yCAAyC;IACzC,IAAI,IAAI;IACR,mHAAmH;IACnH,GAAG,IAAI;IACP,uKAAuK;IACvK,EAAE,IAAI;IACN,sGAAsG;IACtG,OAAO,IAAI;IACX,kLAAkL;IAClL,IAAI,IAAI;CACT;AAED;;;;;GAKG;AACH,oBAAY,YAAY;IACtB,SAAS,IAAI;IACb,KAAK,IAAI;IACT,eAAe,IAAI;IACnB,WAAW,IAAI;CAChB"} \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/esm/constants.js b/node_modules/@jimp/js-png/dist/esm/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..5aa1b5db0f89deadb7c503a9dcce0869f74080ba --- /dev/null +++ b/node_modules/@jimp/js-png/dist/esm/constants.js @@ -0,0 +1,31 @@ +/** + * Filter method is a single-byte integer that indicates the preprocessing method applied to the image data before compression. + */ +export var PNGFilterType; +(function (PNGFilterType) { + PNGFilterType[PNGFilterType["AUTO"] = -1] = "AUTO"; + /** scanline is transmitted unmodified */ + PNGFilterType[PNGFilterType["NONE"] = 0] = "NONE"; + /** filter transmits the difference between each byte and the value of the corresponding byte of the prior pixel */ + PNGFilterType[PNGFilterType["SUB"] = 1] = "SUB"; + /** The Up() filter is just like the Sub() filter except that the pixel immediately above the current pixel, rather than just to its left, is used as the predictor. */ + PNGFilterType[PNGFilterType["UP"] = 2] = "UP"; + /** uses the average of the two neighboring pixels (left and above) to predict the value of a pixel */ + PNGFilterType[PNGFilterType["AVERAGE"] = 3] = "AVERAGE"; + /** computes a simple linear function of the three neighboring pixels (left, above, upper left), then chooses as predictor the neighboring pixel closest to the computed value. */ + PNGFilterType[PNGFilterType["PATH"] = 4] = "PATH"; +})(PNGFilterType || (PNGFilterType = {})); +/** + * Color type is a single-byte integer that describes the interpretation of the image data. + * Color type codes represent sums of the following values: + * + * 1 (palette used), 2 (color used), and 4 (alpha channel used). + */ +export var PNGColorType; +(function (PNGColorType) { + PNGColorType[PNGColorType["GRAYSCALE"] = 0] = "GRAYSCALE"; + PNGColorType[PNGColorType["COLOR"] = 2] = "COLOR"; + PNGColorType[PNGColorType["GRAYSCALE_ALPHA"] = 4] = "GRAYSCALE_ALPHA"; + PNGColorType[PNGColorType["COLOR_ALPHA"] = 6] = "COLOR_ALPHA"; +})(PNGColorType || (PNGColorType = {})); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/esm/constants.js.map b/node_modules/@jimp/js-png/dist/esm/constants.js.map new file mode 100644 index 0000000000000000000000000000000000000000..878eac95ac229db355c1c89256c1e5fa3f468d6a --- /dev/null +++ b/node_modules/@jimp/js-png/dist/esm/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,aAYX;AAZD,WAAY,aAAa;IACvB,kDAAS,CAAA;IACT,yCAAyC;IACzC,iDAAQ,CAAA;IACR,mHAAmH;IACnH,+CAAO,CAAA;IACP,uKAAuK;IACvK,6CAAM,CAAA;IACN,sGAAsG;IACtG,uDAAW,CAAA;IACX,kLAAkL;IAClL,iDAAQ,CAAA;AACV,CAAC,EAZW,aAAa,KAAb,aAAa,QAYxB;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,yDAAa,CAAA;IACb,iDAAS,CAAA;IACT,qEAAmB,CAAA;IACnB,6DAAe,CAAA;AACjB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB"} \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/esm/index.d.ts b/node_modules/@jimp/js-png/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..692fb37a595044b8da1e22af9ed8547a81c9a6da --- /dev/null +++ b/node_modules/@jimp/js-png/dist/esm/index.d.ts @@ -0,0 +1,24 @@ +import { PNGOptions as PNGJSOptions } from "pngjs"; +import { PNGFilterType, PNGColorType } from "./constants.js"; +export type { PNGOptions as PNGJSOptions } from "pngjs"; +export type PNGOptions = Omit & { + filterType?: PNGFilterType; + colorType?: PNGColorType; + inputColorType?: PNGColorType; +}; +export interface DecodePngOptions { + checkCRC?: boolean | undefined; + skipRescale?: boolean | undefined; +} +export * from "./constants.js"; +export default function png(): { + mime: "image/png"; + hasAlpha: true; + encode: (bitmap: import("@jimp/types").Bitmap, { deflateLevel, deflateStrategy, filterType, colorType, inputHasAlpha, ...options }?: PNGOptions) => Buffer; + decode: (data: Buffer, options?: DecodePngOptions) => { + data: Buffer; + width: number; + height: number; + }; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/esm/index.d.ts.map b/node_modules/@jimp/js-png/dist/esm/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..4fcd0bef53fb70b51875d519613739c5e6f6589c --- /dev/null +++ b/node_modules/@jimp/js-png/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,UAAU,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE7D,YAAY,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,IAAI,CAC3B,YAAY,EACZ,YAAY,GAAG,WAAW,GAAG,gBAAgB,CAC9C,GAAG;IACF,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,cAAc,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACnC;AAED,cAAc,gBAAgB,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,GAAG;;;yIAalB,UAAU;qCAuBU,gBAAgB;;;;;EAU5C"} \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/esm/index.js b/node_modules/@jimp/js-png/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..097d1eae32f32ca128d55d9238a162fe4eae97cb --- /dev/null +++ b/node_modules/@jimp/js-png/dist/esm/index.js @@ -0,0 +1,37 @@ +import { PNG } from "pngjs"; +import { PNGFilterType, PNGColorType } from "./constants.js"; +export * from "./constants.js"; +export default function png() { + return { + mime: "image/png", + hasAlpha: true, + encode: (bitmap, { deflateLevel = 9, deflateStrategy = 3, filterType = PNGFilterType.AUTO, colorType, inputHasAlpha = true, ...options } = {}) => { + const png = new PNG({ + width: bitmap.width, + height: bitmap.height, + }); + png.data = bitmap.data; + return PNG.sync.write(png, { + ...options, + deflateLevel, + deflateStrategy, + filterType, + colorType: typeof colorType !== "undefined" + ? colorType + : inputHasAlpha + ? PNGColorType.COLOR_ALPHA + : PNGColorType.COLOR, + inputHasAlpha, + }); + }, + decode: (data, options) => { + const result = PNG.sync.read(data, options); + return { + data: result.data, + width: result.width, + height: result.height, + }; + }, + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/esm/index.js.map b/node_modules/@jimp/js-png/dist/esm/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..727a2bff61ee8d40f25e503501234d8b4de2861b --- /dev/null +++ b/node_modules/@jimp/js-png/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAA8B,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAiB7D,cAAc,gBAAgB,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,GAAG;IACzB,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,CACN,MAAM,EACN,EACE,YAAY,GAAG,CAAC,EAChB,eAAe,GAAG,CAAC,EACnB,UAAU,GAAG,aAAa,CAAC,IAAI,EAC/B,SAAS,EACT,aAAa,GAAG,IAAI,EACpB,GAAG,OAAO,KACI,EAAE,EAClB,EAAE;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;gBAClB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB,CAAC,CAAC;YAEH,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;YAEvB,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;gBACzB,GAAG,OAAO;gBACV,YAAY;gBACZ,eAAe;gBACf,UAAU;gBACV,SAAS,EACP,OAAO,SAAS,KAAK,WAAW;oBAC9B,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,aAAa;wBACb,CAAC,CAAC,YAAY,CAAC,WAAW;wBAC1B,CAAC,CAAC,YAAY,CAAC,KAAK;gBAC1B,aAAa;aACd,CAAC,CAAC;QACL,CAAC;QACD,MAAM,EAAE,CAAC,IAAI,EAAE,OAA0B,EAAE,EAAE;YAC3C,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAE5C,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB,CAAC;QACJ,CAAC;KAC4B,CAAC;AAClC,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/js-png/dist/esm/package.json b/node_modules/@jimp/js-png/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/node_modules/@jimp/js-png/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@jimp/js-png/eslint.config.mjs b/node_modules/@jimp/js-png/eslint.config.mjs new file mode 100644 index 0000000000000000000000000000000000000000..939816d0a4be5f347676861f9592614a0ca07046 --- /dev/null +++ b/node_modules/@jimp/js-png/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/js-png/package.json b/node_modules/@jimp/js-png/package.json new file mode 100644 index 0000000000000000000000000000000000000000..2fca4c9c2f341650e46b33ea6a3e787879b62304 --- /dev/null +++ b/node_modules/@jimp/js-png/package.json @@ -0,0 +1,67 @@ +{ + "name": "@jimp/js-png", + "version": "1.6.1", + "repository": "jimp-dev/jimp", + "engines": { + "node": ">=18" + }, + "scripts": { + "lint": "eslint .", + "test": "vitest", + "test:browser": "vitest --config vitest.config.browser.mjs", + "build": "tshy", + "dev": "tshy --watch", + "clean": "rm -rf node_modules .tshy .tshy-build dist .turbo" + }, + "author": "Andrew Lisowski ", + "license": "MIT", + "dependencies": { + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", + "pngjs": "^7.0.0" + }, + "devDependencies": { + "@jimp/config-eslint": "1.6.1", + "@jimp/config-typescript": "1.6.1", + "@jimp/config-vitest": "1.6.1", + "@jimp/test-utils": "1.6.1", + "@types/pngjs": "^6.0.5", + "@vitest/browser": "^2.0.5", + "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/js-png/src/__image_snapshots__/index-node-test-ts-png-should-use-png-options-1-snap.png b/node_modules/@jimp/js-png/src/__image_snapshots__/index-node-test-ts-png-should-use-png-options-1-snap.png new file mode 100644 index 0000000000000000000000000000000000000000..b96c9832445fb9a5471202d12f839a6fe58fff2b Binary files /dev/null and b/node_modules/@jimp/js-png/src/__image_snapshots__/index-node-test-ts-png-should-use-png-options-1-snap.png differ diff --git a/node_modules/@jimp/js-png/src/constants.ts b/node_modules/@jimp/js-png/src/constants.ts new file mode 100644 index 0000000000000000000000000000000000000000..ede3cd5501a32fd4cee1ee8482998a9ebafa15fd --- /dev/null +++ b/node_modules/@jimp/js-png/src/constants.ts @@ -0,0 +1,29 @@ +/** + * Filter method is a single-byte integer that indicates the preprocessing method applied to the image data before compression. + */ +export enum PNGFilterType { + AUTO = -1, + /** scanline is transmitted unmodified */ + NONE = 0, + /** filter transmits the difference between each byte and the value of the corresponding byte of the prior pixel */ + SUB = 1, + /** The Up() filter is just like the Sub() filter except that the pixel immediately above the current pixel, rather than just to its left, is used as the predictor. */ + UP = 2, + /** uses the average of the two neighboring pixels (left and above) to predict the value of a pixel */ + AVERAGE = 3, + /** computes a simple linear function of the three neighboring pixels (left, above, upper left), then chooses as predictor the neighboring pixel closest to the computed value. */ + PATH = 4, +} + +/** + * Color type is a single-byte integer that describes the interpretation of the image data. + * Color type codes represent sums of the following values: + * + * 1 (palette used), 2 (color used), and 4 (alpha channel used). + */ +export enum PNGColorType { + GRAYSCALE = 0, + COLOR = 2, + GRAYSCALE_ALPHA = 4, + COLOR_ALPHA = 6, +} diff --git a/node_modules/@jimp/js-png/src/index.node.test.ts b/node_modules/@jimp/js-png/src/index.node.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..7e0acdbdaeb6eea8bba6307e31075b416c5045d5 --- /dev/null +++ b/node_modules/@jimp/js-png/src/index.node.test.ts @@ -0,0 +1,29 @@ +import { expect, test, describe } from "vitest"; +import "@jimp/test-utils/image-snapshot"; +import { createJimp } from "@jimp/core"; + +import png from "./index.js"; + +const jimp = createJimp({ formats: [png] }); + +describe("PNG", () => { + test("should use png options", async () => { + const testImage = jimp.fromBitmap({ + width: 20, + height: 20, + data: [ + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, 0xff0000ff, 0xff0080ff, 0xff00ffff, + 0xff0080ff, 0xff00ffff, 0x8000ffff, 0xff00ffff, 0x8000ffff, 0x0000ffff, + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, 0xff0000ff, 0xff0080ff, 0xff00ffff, + 0xff0080ff, 0xff00ffff, 0x8000ffff, 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], + }); + const image = await testImage.getBuffer("image/png", { + deflateStrategy: 0, + colorType: 0, + }); + expect(image).toMatchImageSnapshot(); + }); +}); diff --git a/node_modules/@jimp/js-png/src/index.test.ts b/node_modules/@jimp/js-png/src/index.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b00d9c2dc9dead3d29fa2c8da3603ce2de27360 --- /dev/null +++ b/node_modules/@jimp/js-png/src/index.test.ts @@ -0,0 +1,29 @@ +import { expect, test, describe } from "vitest"; +import { createJimp } from "@jimp/core"; + +import png from "./index.js"; +import { getTestImagePath } from "@jimp/test-utils"; + +const jimp = createJimp({ formats: [png] }); + +describe("PNG", () => { + test("load PNG", async () => { + const image = await jimp.read(getTestImagePath("dice.png")); + expect(image.getPixelColor(10, 10)).toBe(0x00000000); + expect(image.getPixelColor(160, 80)).toBe(0x1c1cd4ff); + expect(image.getPixelColor(400, 250)).toBe(0x7e0c0cda); + }); + + test("export PNG", async () => { + const testImage = jimp.fromBitmap({ + width: 3, + height: 3, + data: [ + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], + }); + const buffer = await testImage.getBuffer("image/png"); + expect(buffer.toString()).toMatch(/^.PNG\r\n/); + }); +}); diff --git a/node_modules/@jimp/js-png/src/index.ts b/node_modules/@jimp/js-png/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..84596d63b4467cfa58f8725a577426876e701b10 --- /dev/null +++ b/node_modules/@jimp/js-png/src/index.ts @@ -0,0 +1,68 @@ +import { PNG, PNGOptions as PNGJSOptions } from "pngjs"; +import { Format } from "@jimp/types"; +import { PNGFilterType, PNGColorType } from "./constants.js"; + +export type { PNGOptions as PNGJSOptions } from "pngjs"; +export type PNGOptions = Omit< + PNGJSOptions, + "filterType" | "colorType" | "inputColorType" +> & { + filterType?: PNGFilterType; + colorType?: PNGColorType; + inputColorType?: PNGColorType; +}; + +export interface DecodePngOptions { + checkCRC?: boolean | undefined; + skipRescale?: boolean | undefined; +} + +export * from "./constants.js"; + +export default function png() { + return { + mime: "image/png", + hasAlpha: true, + encode: ( + bitmap, + { + deflateLevel = 9, + deflateStrategy = 3, + filterType = PNGFilterType.AUTO, + colorType, + inputHasAlpha = true, + ...options + }: PNGOptions = {} + ) => { + const png = new PNG({ + width: bitmap.width, + height: bitmap.height, + }); + + png.data = bitmap.data; + + return PNG.sync.write(png, { + ...options, + deflateLevel, + deflateStrategy, + filterType, + colorType: + typeof colorType !== "undefined" + ? colorType + : inputHasAlpha + ? PNGColorType.COLOR_ALPHA + : PNGColorType.COLOR, + inputHasAlpha, + }); + }, + decode: (data, options?: DecodePngOptions) => { + const result = PNG.sync.read(data, options); + + return { + data: result.data, + width: result.width, + height: result.height, + }; + }, + } satisfies Format<"image/png">; +} diff --git a/node_modules/@jimp/js-png/src/output.png b/node_modules/@jimp/js-png/src/output.png new file mode 100644 index 0000000000000000000000000000000000000000..d85e4f462490c6afa7e2a9f9c498cd23f23ac4f5 Binary files /dev/null and b/node_modules/@jimp/js-png/src/output.png differ diff --git a/node_modules/@jimp/js-png/tsconfig.json b/node_modules/@jimp/js-png/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..ad7f216ca2b10874329665feda994727844e4305 --- /dev/null +++ b/node_modules/@jimp/js-png/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@jimp/config-typescript/base.json", + "compilerOptions": { + "outDir": "dist" + } +} diff --git a/node_modules/@jimp/js-png/vitest.config.browser.mjs b/node_modules/@jimp/js-png/vitest.config.browser.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dfe6aff6b16f48bc45697e4c14219f2034754cf5 --- /dev/null +++ b/node_modules/@jimp/js-png/vitest.config.browser.mjs @@ -0,0 +1,3 @@ +import config from "@jimp/config-vitest/browser"; + +export default config; diff --git a/node_modules/@jimp/js-tiff/.tshy/build.json b/node_modules/@jimp/js-tiff/.tshy/build.json new file mode 100644 index 0000000000000000000000000000000000000000..aea1a9e93b5db3468973ebeaad6dac0a77b10c02 --- /dev/null +++ b/node_modules/@jimp/js-tiff/.tshy/build.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../src", + "module": "nodenext", + "moduleResolution": "nodenext" + } +} diff --git a/node_modules/@jimp/js-tiff/.tshy/commonjs.json b/node_modules/@jimp/js-tiff/.tshy/commonjs.json new file mode 100644 index 0000000000000000000000000000000000000000..75bcfc1d756dcb1baafc973385c81c5aa93f3174 --- /dev/null +++ b/node_modules/@jimp/js-tiff/.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/js-tiff/.tshy/esm.json b/node_modules/@jimp/js-tiff/.tshy/esm.json new file mode 100644 index 0000000000000000000000000000000000000000..fdc4fa775818876f2e8f6cd606e9bb337515ac56 --- /dev/null +++ b/node_modules/@jimp/js-tiff/.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/js-tiff/CHANGELOG.md b/node_modules/@jimp/js-tiff/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..2b6908c4c86d1f7a6e51649d324e2272f1ffc3d9 --- /dev/null +++ b/node_modules/@jimp/js-tiff/CHANGELOG.md @@ -0,0 +1,51 @@ +# 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.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/js-tiff/LICENSE b/node_modules/@jimp/js-tiff/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..baa5d48509a18b9ab4f6c39289362690ea68e688 --- /dev/null +++ b/node_modules/@jimp/js-tiff/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/js-tiff/README.md b/node_modules/@jimp/js-tiff/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3f3a92d78b710704ab78374ad8a8262568aaae1f --- /dev/null +++ b/node_modules/@jimp/js-tiff/README.md @@ -0,0 +1,6 @@ +
+ +

@jimp/tiff

+

Default Jimp tiff encoder/decoder.

+
diff --git a/node_modules/@jimp/js-tiff/dist/commonjs/index.d.ts b/node_modules/@jimp/js-tiff/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4350a10d6cc69e023549b9dc8a20491c3c0c9ff5 --- /dev/null +++ b/node_modules/@jimp/js-tiff/dist/commonjs/index.d.ts @@ -0,0 +1,7 @@ +import { Bitmap } from "@jimp/types"; +export default function tiff(): { + mime: "image/tiff"; + encode: (bitmap: Bitmap) => Buffer; + decode: (data: Buffer) => Bitmap; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-tiff/dist/commonjs/index.d.ts.map b/node_modules/@jimp/js-tiff/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..1cd6c9f80ed191ddac7c68e857e7149f142ae2c4 --- /dev/null +++ b/node_modules/@jimp/js-tiff/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,MAAM,EAAU,MAAM,aAAa,CAAC;AAkB7C,MAAM,CAAC,OAAO,UAAU,IAAI;;;8BAiCjB,MAAM;EAGhB"} \ No newline at end of file diff --git a/node_modules/@jimp/js-tiff/dist/commonjs/index.js b/node_modules/@jimp/js-tiff/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4c4f166914570b0e2679d6b42b078a6065c393f2 --- /dev/null +++ b/node_modules/@jimp/js-tiff/dist/commonjs/index.js @@ -0,0 +1,51 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = tiff; +const utif2_1 = __importDefault(require("utif2")); +function getDimensionValue(dimension) { + if (typeof dimension === "number") { + return dimension; + } + if (dimension instanceof Uint8Array) { + return dimension[0]; + } + if (typeof dimension[0] === "string") { + return parseInt(dimension[0]); + } + return dimension[0]; +} +function tiff() { + return { + mime: "image/tiff", + encode: (bitmap) => { + const tiff = utif2_1.default.encodeImage(bitmap.data, bitmap.width, bitmap.height); + return Buffer.from(tiff); + }, + decode: (data) => { + const ifds = utif2_1.default.decode(data); + const page = ifds[0]; + if (!page) { + throw new Error("No page found in TIFF"); + } + if (!page.t256) { + throw new Error("No image width found in TIFF"); + } + if (!page.t257) { + throw new Error("No image height found in TIFF"); + } + ifds.forEach((ifd) => { + utif2_1.default.decodeImage(data, ifd); + }); + const rgba = utif2_1.default.toRGBA8(page); + return { + data: Buffer.from(rgba), + width: getDimensionValue(page.t256), + height: getDimensionValue(page.t257), + }; + }, + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-tiff/dist/commonjs/index.js.map b/node_modules/@jimp/js-tiff/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c2f7f64f4edf7645c0f419a8be258b667298eab8 --- /dev/null +++ b/node_modules/@jimp/js-tiff/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAmBA,uBAoCC;AAvDD,kDAAsC;AAGtC,SAAS,iBAAiB,CAAC,SAAwC;IACjE,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,SAAS,YAAY,UAAU,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,OAAO,SAAS,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC;AAED,SAAwB,IAAI;IAC1B,OAAO;QACL,IAAI,EA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tiff/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/node_modules/@jimp/js-tiff/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@jimp/js-tiff/dist/esm/index.d.ts b/node_modules/@jimp/js-tiff/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4350a10d6cc69e023549b9dc8a20491c3c0c9ff5 --- /dev/null +++ b/node_modules/@jimp/js-tiff/dist/esm/index.d.ts @@ -0,0 +1,7 @@ +import { Bitmap } from "@jimp/types"; +export default function tiff(): { + mime: "image/tiff"; + encode: (bitmap: Bitmap) => Buffer; + decode: (data: Buffer) => Bitmap; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/js-tiff/dist/esm/index.d.ts.map b/node_modules/@jimp/js-tiff/dist/esm/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..1cd6c9f80ed191ddac7c68e857e7149f142ae2c4 --- /dev/null +++ b/node_modules/@jimp/js-tiff/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,MAAM,EAAU,MAAM,aAAa,CAAC;AAkB7C,MAAM,CAAC,OAAO,UAAU,IAAI;;;8BAiCjB,MAAM;EAGhB"} \ No newline at end of file diff --git a/node_modules/@jimp/js-tiff/dist/esm/index.js b/node_modules/@jimp/js-tiff/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..65dc631c8fdc6b092e5f3abc98009f5746ef17ee --- /dev/null +++ b/node_modules/@jimp/js-tiff/dist/esm/index.js @@ -0,0 +1,45 @@ +import utif from "utif2"; +function getDimensionValue(dimension) { + if (typeof dimension === "number") { + return dimension; + } + if (dimension instanceof Uint8Array) { + return dimension[0]; + } + if (typeof dimension[0] === "string") { + return parseInt(dimension[0]); + } + return dimension[0]; +} +export default function tiff() { + return { + mime: "image/tiff", + encode: (bitmap) => { + const tiff = utif.encodeImage(bitmap.data, bitmap.width, bitmap.height); + return Buffer.from(tiff); + }, + decode: (data) => { + const ifds = utif.decode(data); + const page = ifds[0]; + if (!page) { + throw new Error("No page found in TIFF"); + } + if (!page.t256) { + throw new Error("No image width found in TIFF"); + } + if (!page.t257) { + throw new Error("No image height found in TIFF"); + } + ifds.forEach((ifd) => { + utif.decodeImage(data, ifd); + }); + const rgba = utif.toRGBA8(page); + return { + data: Buffer.from(rgba), + width: getDimensionValue(page.t256), + height: getDimensionValue(page.t257), + }; + }, + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/js-tiff/dist/esm/index.js.map b/node_modules/@jimp/js-tiff/dist/esm/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2382cf53adf9e3fc13b7ae02e6feffaa845b760c --- /dev/null +++ b/node_modules/@jimp/js-tiff/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAiB,MAAM,OAAO,CAAC;AAGtC,SAAS,iBAAiB,CAAC,SAAwC;IACjE,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,SAAS,YAAY,UAAU,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,OAAO,SAAS,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,IAAI;IAC1B,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;YACjB,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YACxE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;QACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACf,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAErB,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;YAClD,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,CAAC;YAED,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAEhC,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;gBACvB,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;gBACnC,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;aAC3B,CAAC;QACd,CAAC;KAC6B,CAAC;AACnC,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/js-tiff/dist/esm/package.json b/node_modules/@jimp/js-tiff/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/node_modules/@jimp/js-tiff/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@jimp/js-tiff/eslint.config.mjs b/node_modules/@jimp/js-tiff/eslint.config.mjs new file mode 100644 index 0000000000000000000000000000000000000000..939816d0a4be5f347676861f9592614a0ca07046 --- /dev/null +++ b/node_modules/@jimp/js-tiff/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/js-tiff/package.json b/node_modules/@jimp/js-tiff/package.json new file mode 100644 index 0000000000000000000000000000000000000000..41851fbca45a9a512361285cab85f255933038c5 --- /dev/null +++ b/node_modules/@jimp/js-tiff/package.json @@ -0,0 +1,67 @@ +{ + "name": "@jimp/js-tiff", + "version": "1.6.1", + "repository": "jimp-dev/jimp", + "engines": { + "node": ">=18" + }, + "scripts": { + "lint": "eslint .", + "test": "vitest", + "test:browser": "vitest --config vitest.config.browser.mjs", + "build": "tshy", + "dev": "tshy --watch", + "clean": "rm -rf node_modules .tshy .tshy-build dist .turbo" + }, + "author": "Andrew Lisowski ", + "license": "MIT", + "devDependencies": { + "@jimp/config-eslint": "1.6.1", + "@jimp/config-typescript": "1.6.1", + "@jimp/config-vitest": "1.6.1", + "@jimp/test-utils": "1.6.1", + "@types/node": "^18.19.48", + "@vitest/browser": "^2.0.5", + "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", + "dependencies": { + "@jimp/core": "1.6.1", + "@jimp/types": "1.6.1", + "utif2": "^4.1.0" + }, + "publishConfig": { + "access": "public" + }, + "sideEffects": false, + "module": "./dist/esm/index.js", + "gitHead": "7e6a95694e00a8b6f1bdd9aad709f5413eb9b08c" +} diff --git a/node_modules/@jimp/js-tiff/src/index.test.ts b/node_modules/@jimp/js-tiff/src/index.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..76d7ed6ed3b9834b86311f8f10fe496815714aa7 --- /dev/null +++ b/node_modules/@jimp/js-tiff/src/index.test.ts @@ -0,0 +1,32 @@ +import { expect, test, describe } from "vitest"; +import { createJimp } from "@jimp/core"; +import { getTestImagePath } from "@jimp/test-utils"; + +import tiff from "./index.js"; + +const jimp = createJimp({ formats: [tiff] }); + +describe("TIFF", () => { + test("load TIFF", async () => { + const image = await jimp.read(getTestImagePath("rgb.tiff")); + + expect(image.getPixelColor(10, 10)).toBe(0xa4988bff); + expect(image.getPixelColor(220, 190)).toBe(0xe0d7ddff); + expect(image.getPixelColor(350, 130)).toBe(0x565433ff); + }); + + test("export TIFF", async () => { + const image = jimp.fromBitmap({ + width: 3, + height: 3, + data: [ + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], + }); + const buffer = await image.getBuffer("image/tiff"); + + // eslint-disable-next-line no-control-regex + expect(buffer.toString()).toMatch(/^MM\u0000*\u0000/); + }); +}); diff --git a/node_modules/@jimp/js-tiff/src/index.ts b/node_modules/@jimp/js-tiff/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..f93602a8476b5138586c6b88b555496bef000e4c --- /dev/null +++ b/node_modules/@jimp/js-tiff/src/index.ts @@ -0,0 +1,56 @@ +import utif, { TiffTag } from "utif2"; +import { Bitmap, Format } from "@jimp/types"; + +function getDimensionValue(dimension: number | Uint8Array | TiffTag) { + if (typeof dimension === "number") { + return dimension; + } + + if (dimension instanceof Uint8Array) { + return dimension[0]; + } + + if (typeof dimension[0] === "string") { + return parseInt(dimension[0]); + } + + return dimension[0]; +} + +export default function tiff() { + return { + mime: "image/tiff", + encode: (bitmap) => { + const tiff = utif.encodeImage(bitmap.data, bitmap.width, bitmap.height); + return Buffer.from(tiff); + }, + decode: (data) => { + const ifds = utif.decode(data); + const page = ifds[0]; + + if (!page) { + throw new Error("No page found in TIFF"); + } + + if (!page.t256) { + throw new Error("No image width found in TIFF"); + } + + if (!page.t257) { + throw new Error("No image height found in TIFF"); + } + + ifds.forEach((ifd) => { + utif.decodeImage(data, ifd); + }); + + const rgba = utif.toRGBA8(page); + + return { + data: Buffer.from(rgba), + width: getDimensionValue(page.t256), + height: getDimensionValue(page.t257), + } as Bitmap; + }, + } satisfies Format<"image/tiff">; +} diff --git a/node_modules/@jimp/js-tiff/tsconfig.json b/node_modules/@jimp/js-tiff/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..ad7f216ca2b10874329665feda994727844e4305 --- /dev/null +++ b/node_modules/@jimp/js-tiff/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@jimp/config-typescript/base.json", + "compilerOptions": { + "outDir": "dist" + } +} diff --git a/node_modules/@jimp/js-tiff/vitest.config.browser.mjs b/node_modules/@jimp/js-tiff/vitest.config.browser.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dfe6aff6b16f48bc45697e4c14219f2034754cf5 --- /dev/null +++ b/node_modules/@jimp/js-tiff/vitest.config.browser.mjs @@ -0,0 +1,3 @@ +import config from "@jimp/config-vitest/browser"; + +export default config; diff --git a/node_modules/@jimp/plugin-blit/.tshy/build.json b/node_modules/@jimp/plugin-blit/.tshy/build.json new file mode 100644 index 0000000000000000000000000000000000000000..aea1a9e93b5db3468973ebeaad6dac0a77b10c02 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/.tshy/build.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../src", + "module": "nodenext", + "moduleResolution": "nodenext" + } +} diff --git a/node_modules/@jimp/plugin-blit/.tshy/commonjs.json b/node_modules/@jimp/plugin-blit/.tshy/commonjs.json new file mode 100644 index 0000000000000000000000000000000000000000..75bcfc1d756dcb1baafc973385c81c5aa93f3174 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/.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/plugin-blit/.tshy/esm.json b/node_modules/@jimp/plugin-blit/.tshy/esm.json new file mode 100644 index 0000000000000000000000000000000000000000..fdc4fa775818876f2e8f6cd606e9bb337515ac56 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/.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/plugin-blit/CHANGELOG.md b/node_modules/@jimp/plugin-blit/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..b74ff6d59c2b16c506f4a03cb5f071ccc1e763ab --- /dev/null +++ b/node_modules/@jimp/plugin-blit/CHANGELOG.md @@ -0,0 +1,64 @@ +# v1.4.0 (Sat Sep 07 2024) + +#### 📝 Documentation + +- Misc doc updates [#1334](https://github.com/jimp-dev/jimp/pull/1334) ([@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.0 (Sun Sep 01 2024) + +#### ⚠️ Pushed to `main` + +- upgrade tshy ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- update more docs ([@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/plugin-blit/LICENSE b/node_modules/@jimp/plugin-blit/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..baa5d48509a18b9ab4f6c39289362690ea68e688 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/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/plugin-blit/README.md b/node_modules/@jimp/plugin-blit/README.md new file mode 100644 index 0000000000000000000000000000000000000000..78ac4757ebe53df7e9301ceba27c30ef53114449 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/README.md @@ -0,0 +1,10 @@ +
+ +

@jimp/plugin-blit

+

Blit an image.

+
+ +> Blit - a data operation commonly used in computer graphics in which several bitmaps are combined into one using a boolean function. + +[Read the docs](http://jimp-dev.github.io/jimp/api/jimp/classes/jimp#blit) diff --git a/node_modules/@jimp/plugin-blit/dist/commonjs/index.d.ts b/node_modules/@jimp/plugin-blit/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3916d36d82c0727c28fc276d1d47fca3565b56ff --- /dev/null +++ b/node_modules/@jimp/plugin-blit/dist/commonjs/index.d.ts @@ -0,0 +1,118 @@ +import { JimpClass } from "@jimp/types"; +import { z } from "zod"; +declare const BlitOptionsSchema: z.ZodUnion<[z.ZodObject<{ + bitmap: z.ZodObject<{ + data: z.ZodUnion<[z.ZodType, z.ZodType]>; + width: z.ZodNumber; + height: z.ZodNumber; + }, "strip", z.ZodTypeAny, { + data: Buffer | Uint8Array; + width: number; + height: number; + }, { + data: Buffer | Uint8Array; + width: number; + height: number; + }>; +}, "strip", z.ZodTypeAny, { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; +}, { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; +}>, z.ZodObject<{ + src: z.ZodObject<{ + bitmap: z.ZodObject<{ + data: z.ZodUnion<[z.ZodType, z.ZodType]>; + width: z.ZodNumber; + height: z.ZodNumber; + }, "strip", z.ZodTypeAny, { + data: Buffer | Uint8Array; + width: number; + height: number; + }, { + data: Buffer | Uint8Array; + width: number; + height: number; + }>; + }, "strip", z.ZodTypeAny, { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; + }, { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; + }>; + /** the x position to blit the image */ + x: z.ZodOptional; + /** the y position to blit the image */ + y: z.ZodOptional; + /** the x position from which to crop the source image */ + srcX: z.ZodOptional; + /** the y position from which to crop the source image */ + srcY: z.ZodOptional; + /** the width to which to crop the source image */ + srcW: z.ZodOptional; + /** the height to which to crop the source image */ + srcH: z.ZodOptional; +}, "strip", z.ZodTypeAny, { + src: { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; + }; + x?: number | undefined; + y?: number | undefined; + srcX?: number | undefined; + srcY?: number | undefined; + srcW?: number | undefined; + srcH?: number | undefined; +}, { + src: { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; + }; + x?: number | undefined; + y?: number | undefined; + srcX?: number | undefined; + srcY?: number | undefined; + srcW?: number | undefined; + srcH?: number | undefined; +}>]>; +export type BlitOptions = z.infer; +export declare const methods: { + /** + * Short for "bit-block transfer". + * It involves the transfer of a block of pixel data from one area of a computer's memory to another area, typically for the purpose of rendering images on the screen or manipulating them in various ways. + * It's a fundamental operation in computer graphics utilized in various applications, from operating systems to video games. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * const parrot = await Jimp.read("test/party-parrot.png"); + * + * image.blit({ src: parrot, x: 10, y: 10 }); + * ``` + */ + blit(image: I, options: BlitOptions): I; +}; +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blit/dist/commonjs/index.d.ts.map b/node_modules/@jimp/plugin-blit/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..18355b4355d71488ec01c7f0235d475738ed9d27 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/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,SAAS,EAAmB,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB,QAAA,MAAM,iBAAiB;;oCAEV,MAAM,gBAAe,MAAO;;;;cAK0B,MAAO;;;;cAAoF,MAAO;;;;;;cAClF,MAAO;;;;;;cAKvF,MACF;;;;;;;wCAZY,MAAM,gBAAe,MAAO;;;;kBAK0B,MAAO;;;;kBAAoF,MAAO;;;;;;kBAClF,MAAO;;;;;;kBAKvF,MACF;;;;;IA9BC,uCAAuC;;IAEvC,uCAAuC;;IAEvC,yDAAyD;;IAEzD,yDAAyD;;IAEzD,kDAAkD;;IAElD,mDAAmD;;;;;kBAc8B,MAAO;;;;;;;;;;;;;;kBAKvF,MACF;;;;;;;;;;;IAd6E,CAAC;AAE/E,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,OAAO;IAClB;;;;;;;;;;;;;;OAcG;SACE,CAAC,SAAS,SAAS,SAAS,CAAC,WAAW,WAAW;CAuEzD,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blit/dist/commonjs/index.js b/node_modules/@jimp/plugin-blit/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..51241d705e0f547f5442c9af91c0d9663a21caf2 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/dist/commonjs/index.js @@ -0,0 +1,92 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.methods = void 0; +const types_1 = require("@jimp/types"); +const utils_1 = require("@jimp/utils"); +const zod_1 = require("zod"); +const BlitOptionsSchemaComplex = zod_1.z.object({ + src: types_1.JimpClassSchema, + /** the x position to blit the image */ + x: zod_1.z.number().optional(), + /** the y position to blit the image */ + y: zod_1.z.number().optional(), + /** the x position from which to crop the source image */ + srcX: zod_1.z.number().optional(), + /** the y position from which to crop the source image */ + srcY: zod_1.z.number().optional(), + /** the width to which to crop the source image */ + srcW: zod_1.z.number().optional(), + /** the height to which to crop the source image */ + srcH: zod_1.z.number().optional(), +}); +const BlitOptionsSchema = zod_1.z.union([types_1.JimpClassSchema, BlitOptionsSchemaComplex]); +exports.methods = { + /** + * Short for "bit-block transfer". + * It involves the transfer of a block of pixel data from one area of a computer's memory to another area, typically for the purpose of rendering images on the screen or manipulating them in various ways. + * It's a fundamental operation in computer graphics utilized in various applications, from operating systems to video games. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * const parrot = await Jimp.read("test/party-parrot.png"); + * + * image.blit({ src: parrot, x: 10, y: 10 }); + * ``` + */ + blit(image, options) { + const parsed = BlitOptionsSchema.parse(options); + let { + // eslint-disable-next-line prefer-const + src, x = 0, y = 0, srcX = 0, srcY = 0, srcW = src.bitmap.width, srcH = src.bitmap.height, } = "bitmap" in parsed ? { src: parsed } : parsed; + if (!("bitmap" in src)) { + 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"); + } + // round input + x = Math.round(x); + y = Math.round(y); + // round input + srcX = Math.round(srcX); + srcY = Math.round(srcY); + srcW = Math.round(srcW); + srcH = Math.round(srcH); + const maxWidth = image.bitmap.width; + const maxHeight = image.bitmap.height; + (0, utils_1.scan)(src, srcX, srcY, srcW, srcH, function (sx, sy, idx) { + const xOffset = x + sx - srcX; + const yOffset = y + sy - srcY; + if (xOffset >= 0 && + yOffset >= 0 && + maxWidth - xOffset > 0 && + maxHeight - yOffset > 0) { + const dstIdx = image.getPixelIndex(xOffset, yOffset); + const srcColor = { + r: src.bitmap.data[idx] || 0, + g: src.bitmap.data[idx + 1] || 0, + b: src.bitmap.data[idx + 2] || 0, + a: src.bitmap.data[idx + 3] || 0, + }; + const dst = { + r: image.bitmap.data[dstIdx] || 0, + g: image.bitmap.data[dstIdx + 1] || 0, + b: image.bitmap.data[dstIdx + 2] || 0, + a: image.bitmap.data[dstIdx + 3] || 0, + }; + image.bitmap.data[dstIdx] = + ((srcColor.a * (srcColor.r - dst.r) - dst.r + 255) >> 8) + dst.r; + image.bitmap.data[dstIdx + 1] = + ((srcColor.a * (srcColor.g - dst.g) - dst.g + 255) >> 8) + dst.g; + image.bitmap.data[dstIdx + 2] = + ((srcColor.a * (srcColor.b - dst.b) - dst.b + 255) >> 8) + dst.b; + image.bitmap.data[dstIdx + 3] = (0, utils_1.limit255)(dst.a + srcColor.a); + } + }); + return image; + }, +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blit/dist/commonjs/index.js.map b/node_modules/@jimp/plugin-blit/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f959ead842764f41a06cf05f4c893aa36ec2c64a --- /dev/null +++ b/node_modules/@jimp/plugin-blit/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAAyD;AACzD,uCAA6C;AAC7C,6BAAwB;AAExB,MAAM,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,GAAG,EAAE,uBAAe;IACpB,uCAAuC;IACvC,CAAC,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxB,uCAAuC;IACvC,CAAC,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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CAAC,CAAC;gBACnE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blit/dist/commonjs/package.json b/node_modules/@jimp/plugin-blit/dist/commonjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5bbefffbabee392d1855491b84dc0a716b6a3bf2 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@jimp/plugin-blit/dist/esm/index.d.ts b/node_modules/@jimp/plugin-blit/dist/esm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3916d36d82c0727c28fc276d1d47fca3565b56ff --- /dev/null +++ b/node_modules/@jimp/plugin-blit/dist/esm/index.d.ts @@ -0,0 +1,118 @@ +import { JimpClass } from "@jimp/types"; +import { z } from "zod"; +declare const BlitOptionsSchema: z.ZodUnion<[z.ZodObject<{ + bitmap: z.ZodObject<{ + data: z.ZodUnion<[z.ZodType, z.ZodType]>; + width: z.ZodNumber; + height: z.ZodNumber; + }, "strip", z.ZodTypeAny, { + data: Buffer | Uint8Array; + width: number; + height: number; + }, { + data: Buffer | Uint8Array; + width: number; + height: number; + }>; +}, "strip", z.ZodTypeAny, { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; +}, { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; +}>, z.ZodObject<{ + src: z.ZodObject<{ + bitmap: z.ZodObject<{ + data: z.ZodUnion<[z.ZodType, z.ZodType]>; + width: z.ZodNumber; + height: z.ZodNumber; + }, "strip", z.ZodTypeAny, { + data: Buffer | Uint8Array; + width: number; + height: number; + }, { + data: Buffer | Uint8Array; + width: number; + height: number; + }>; + }, "strip", z.ZodTypeAny, { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; + }, { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; + }>; + /** the x position to blit the image */ + x: z.ZodOptional; + /** the y position to blit the image */ + y: z.ZodOptional; + /** the x position from which to crop the source image */ + srcX: z.ZodOptional; + /** the y position from which to crop the source image */ + srcY: z.ZodOptional; + /** the width to which to crop the source image */ + srcW: z.ZodOptional; + /** the height to which to crop the source image */ + srcH: z.ZodOptional; +}, "strip", z.ZodTypeAny, { + src: { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; + }; + x?: number | undefined; + y?: number | undefined; + srcX?: number | undefined; + srcY?: number | undefined; + srcW?: number | undefined; + srcH?: number | undefined; +}, { + src: { + bitmap: { + data: Buffer | Uint8Array; + width: number; + height: number; + }; + }; + x?: number | undefined; + y?: number | undefined; + srcX?: number | undefined; + srcY?: number | undefined; + srcW?: number | undefined; + srcH?: number | undefined; +}>]>; +export type BlitOptions = z.infer; +export declare const methods: { + /** + * Short for "bit-block transfer". + * It involves the transfer of a block of pixel data from one area of a computer's memory to another area, typically for the purpose of rendering images on the screen or manipulating them in various ways. + * It's a fundamental operation in computer graphics utilized in various applications, from operating systems to video games. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * const parrot = await Jimp.read("test/party-parrot.png"); + * + * image.blit({ src: parrot, x: 10, y: 10 }); + * ``` + */ + blit(image: I, options: BlitOptions): I; +}; +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blit/dist/esm/index.d.ts.map b/node_modules/@jimp/plugin-blit/dist/esm/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..18355b4355d71488ec01c7f0235d475738ed9d27 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB,QAAA,MAAM,iBAAiB;;oCAEV,MAAM,gBAAe,MAAO;;;;cAK0B,MAAO;;;;cAAoF,MAAO;;;;;;cAClF,MAAO;;;;;;cAKvF,MACF;;;;;;;wCAZY,MAAM,gBAAe,MAAO;;;;kBAK0B,MAAO;;;;kBAAoF,MAAO;;;;;;kBAClF,MAAO;;;;;;kBAKvF,MACF;;;;;IA9BC,uCAAuC;;IAEvC,uCAAuC;;IAEvC,yDAAyD;;IAEzD,yDAAyD;;IAEzD,kDAAkD;;IAElD,mDAAmD;;;;;kBAc8B,MAAO;;;;;;;;;;;;;;kBAKvF,MACF;;;;;;;;;;;IAd6E,CAAC;AAE/E,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,OAAO;IAClB;;;;;;;;;;;;;;OAcG;SACE,CAAC,SAAS,SAAS,SAAS,CAAC,WAAW,WAAW;CAuEzD,CAAC"} \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blit/dist/esm/index.js b/node_modules/@jimp/plugin-blit/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..61b83f37d79b42317bad91923ca545d755b43476 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/dist/esm/index.js @@ -0,0 +1,89 @@ +import { JimpClassSchema } from "@jimp/types"; +import { limit255, scan } from "@jimp/utils"; +import { z } from "zod"; +const BlitOptionsSchemaComplex = z.object({ + src: JimpClassSchema, + /** the x position to blit the image */ + x: z.number().optional(), + /** the y position to blit the image */ + y: z.number().optional(), + /** the x position from which to crop the source image */ + srcX: z.number().optional(), + /** the y position from which to crop the source image */ + srcY: z.number().optional(), + /** the width to which to crop the source image */ + srcW: z.number().optional(), + /** the height to which to crop the source image */ + srcH: z.number().optional(), +}); +const BlitOptionsSchema = z.union([JimpClassSchema, BlitOptionsSchemaComplex]); +export const methods = { + /** + * Short for "bit-block transfer". + * It involves the transfer of a block of pixel data from one area of a computer's memory to another area, typically for the purpose of rendering images on the screen or manipulating them in various ways. + * It's a fundamental operation in computer graphics utilized in various applications, from operating systems to video games. + * + * @example + * ```ts + * import { Jimp } from "jimp"; + * + * const image = await Jimp.read("test/image.png"); + * const parrot = await Jimp.read("test/party-parrot.png"); + * + * image.blit({ src: parrot, x: 10, y: 10 }); + * ``` + */ + blit(image, options) { + const parsed = BlitOptionsSchema.parse(options); + let { + // eslint-disable-next-line prefer-const + src, x = 0, y = 0, srcX = 0, srcY = 0, srcW = src.bitmap.width, srcH = src.bitmap.height, } = "bitmap" in parsed ? { src: parsed } : parsed; + if (!("bitmap" in src)) { + 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"); + } + // round input + x = Math.round(x); + y = Math.round(y); + // round input + srcX = Math.round(srcX); + srcY = Math.round(srcY); + srcW = Math.round(srcW); + srcH = Math.round(srcH); + const maxWidth = image.bitmap.width; + const maxHeight = image.bitmap.height; + scan(src, srcX, srcY, srcW, srcH, function (sx, sy, idx) { + const xOffset = x + sx - srcX; + const yOffset = y + sy - srcY; + if (xOffset >= 0 && + yOffset >= 0 && + maxWidth - xOffset > 0 && + maxHeight - yOffset > 0) { + const dstIdx = image.getPixelIndex(xOffset, yOffset); + const srcColor = { + r: src.bitmap.data[idx] || 0, + g: src.bitmap.data[idx + 1] || 0, + b: src.bitmap.data[idx + 2] || 0, + a: src.bitmap.data[idx + 3] || 0, + }; + const dst = { + r: image.bitmap.data[dstIdx] || 0, + g: image.bitmap.data[dstIdx + 1] || 0, + b: image.bitmap.data[dstIdx + 2] || 0, + a: image.bitmap.data[dstIdx + 3] || 0, + }; + image.bitmap.data[dstIdx] = + ((srcColor.a * (srcColor.r - dst.r) - dst.r + 255) >> 8) + dst.r; + image.bitmap.data[dstIdx + 1] = + ((srcColor.a * (srcColor.g - dst.g) - dst.g + 255) >> 8) + dst.g; + image.bitmap.data[dstIdx + 2] = + ((srcColor.a * (srcColor.b - dst.b) - dst.b + 255) >> 8) + dst.b; + image.bitmap.data[dstIdx + 3] = limit255(dst.a + srcColor.a); + } + }); + return image; + }, +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@jimp/plugin-blit/dist/esm/index.js.map b/node_modules/@jimp/plugin-blit/dist/esm/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0e17716d507b5c4a6c77f1cc9273f48951c95ef0 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,GAAG,EAAE,eAAe;IACpB,uCAAuC;IACvC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxB,uCAAuC;IACvC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxB,yDAAyD;IACzD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,yDAAyD;IACzD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,kDAAkD;IAClD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,mDAAmD;IACnD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,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.json new file mode 100644 index 0000000000000000000000000000000000000000..3dbc1ca591c0557e35b6004aeba250e6a70b56e3 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@jimp/plugin-blit/eslint.config.mjs b/node_modules/@jimp/plugin-blit/eslint.config.mjs new file mode 100644 index 0000000000000000000000000000000000000000..939816d0a4be5f347676861f9592614a0ca07046 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/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/plugin-blit/node_modules/zod/LICENSE b/node_modules/@jimp/plugin-blit/node_modules/zod/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..c06579627b432d09779094cd0166b7f37fe51db8 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Colin McDonnell + +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/plugin-blit/node_modules/zod/README.md b/node_modules/@jimp/plugin-blit/node_modules/zod/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5ffbaa84a76c8873d22bfb83681558ea14f0a421 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/README.md @@ -0,0 +1,208 @@ +

+ Zod logo +

Zod

+

+ TypeScript-first schema validation with static type inference +
+ by @colinhacks +

+

+
+ +

+Zod CI status +License +npm +discord server +stars +

+ +
+ Docs +   •   + Discord +   •   + 𝕏 +   •   + Bluesky +
+
+ +
+
+ +

Featured sponsor: Jazz

+ +
+ + + + jazz logo + + +
+

Learn more about featured sponsorships

+
+ +
+
+
+ +### [Read the docs →](https://zod.dev/api) + +
+
+ +## What is Zod? + +Zod is a TypeScript-first validation library. Define a schema and parse some data with it. You'll get back a strongly typed, validated result. + +```ts +import * as z from "zod/v4"; + +const User = z.object({ + name: z.string(), +}); + +// some untrusted data... +const input = { + /* stuff */ +}; + +// the parsed result is validated and type safe! +const data = User.parse(input); + +// so you can use it with confidence :) +console.log(data.name); +``` + +
+ +## Features + +- Zero external dependencies +- Works in Node.js and all modern browsers +- Tiny: `2kb` core bundle (gzipped) +- Immutable API: methods return a new instance +- Concise interface +- Works with TypeScript and plain JS +- Built-in JSON Schema conversion +- Extensive ecosystem + +
+ +## Installation + +```sh +npm install zod +``` + +
+ +## Basic usage + +Before you can do anything else, you need to define a schema. For the purposes of this guide, we'll use a simple object schema. + +```ts +import * as z from "zod/v4"; + +const Player = z.object({ + username: z.string(), + xp: z.number(), +}); +``` + +### Parsing data + +Given any Zod schema, use `.parse` to validate an input. If it's valid, Zod returns a strongly-typed _deep clone_ of the input. + +```ts +Player.parse({ username: "billie", xp: 100 }); +// => returns { username: "billie", xp: 100 } +``` + +**Note** — If your schema uses certain asynchronous APIs like `async` [refinements](#refine) or [transforms](#transform), you'll need to use the `.parseAsync()` method instead. + +```ts +const schema = z.string().refine(async (val) => val.length <= 8); + +await schema.parseAsync("hello"); +// => "hello" +``` + +### Handling errors + +When validation fails, the `.parse()` method will throw a `ZodError` instance with granular information about the validation issues. + +```ts +try { + Player.parse({ username: 42, xp: "100" }); +} catch (err) { + if (err instanceof z.ZodError) { + err.issues; + /* [ + { + expected: 'string', + code: 'invalid_type', + path: [ 'username' ], + message: 'Invalid input: expected string' + }, + { + expected: 'number', + code: 'invalid_type', + path: [ 'xp' ], + message: 'Invalid input: expected number' + } + ] */ + } +} +``` + +To avoid a `try/catch` block, you can use the `.safeParse()` method to get back a plain result object containing either the successfully parsed data or a `ZodError`. The result type is a [discriminated union](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions), so you can handle both cases conveniently. + +```ts +const result = Player.safeParse({ username: 42, xp: "100" }); +if (!result.success) { + result.error; // ZodError instance +} else { + result.data; // { username: string; xp: number } +} +``` + +**Note** — If your schema uses certain asynchronous APIs like `async` [refinements](#refine) or [transforms](#transform), you'll need to use the `.safeParseAsync()` method instead. + +```ts +const schema = z.string().refine(async (val) => val.length <= 8); + +await schema.safeParseAsync("hello"); +// => { success: true; data: "hello" } +``` + +### Inferring types + +Zod infers a static type from your schema definitions. You can extract this type with the `z.infer<>` utility and use it however you like. + +```ts +const Player = z.object({ + username: z.string(), + xp: z.number(), +}); + +// extract the inferred type +type Player = z.infer; + +// use it in your code +const player: Player = { username: "billie", xp: 100 }; +``` + +In some cases, the input & output types of a schema can diverge. For instance, the `.transform()` API can convert the input from one type to another. In these cases, you can extract the input and output types independently: + +```ts +const mySchema = z.string().transform((val) => val.length); + +type MySchemaIn = z.input; +// => string + +type MySchemaOut = z.output; // equivalent to z.infer +// number +``` diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/index.cjs b/node_modules/@jimp/plugin-blit/node_modules/zod/index.cjs new file mode 100644 index 0000000000000000000000000000000000000000..62f74c802b220c1e095199b3e4431461032ae461 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/index.cjs @@ -0,0 +1,33 @@ +"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; +}; +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); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.z = void 0; +const z = __importStar(require("./v3/external.cjs")); +exports.z = z; +__exportStar(require("./v3/external.cjs"), exports); +exports.default = z; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/index.d.cts b/node_modules/@jimp/plugin-blit/node_modules/zod/index.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..665bd24d9fbbc120372baccfc26db2a028e0001d --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/index.d.cts @@ -0,0 +1,4 @@ +import * as z from "./v3/external.cjs"; +export * from "./v3/external.cjs"; +export { z }; +export default z; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/index.d.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf6f1643ab4526b97b1eb1a6dcdea48262f70194 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/index.d.ts @@ -0,0 +1,4 @@ +import * as z from "./v3/external.js"; +export * from "./v3/external.js"; +export { z }; +export default z; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/index.js b/node_modules/@jimp/plugin-blit/node_modules/zod/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bf6f1643ab4526b97b1eb1a6dcdea48262f70194 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/index.js @@ -0,0 +1,4 @@ +import * as z from "./v3/external.js"; +export * from "./v3/external.js"; +export { z }; +export default z; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/package.json b/node_modules/@jimp/plugin-blit/node_modules/zod/package.json new file mode 100644 index 0000000000000000000000000000000000000000..eedcfb0f8e3343c8ac5ba32e5117a032352a986c --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/package.json @@ -0,0 +1,118 @@ +{ + "name": "zod", + "version": "3.25.76", + "type": "module", + "author": "Colin McDonnell ", + "description": "TypeScript-first schema declaration and validation library with static type inference", + "files": [ + "src", + "**/*.js", + "**/*.mjs", + "**/*.cjs", + "**/*.d.ts", + "**/*.d.mts", + "**/*.d.cts" + ], + "funding": "https://github.com/sponsors/colinhacks", + "homepage": "https://zod.dev", + "keywords": [ + "typescript", + "schema", + "validation", + "type", + "inference" + ], + "license": "MIT", + "sideEffects": false, + "main": "./index.cjs", + "types": "./index.d.cts", + "module": "./index.js", + "zshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./v3": "./src/v3/index.ts", + "./v4": "./src/v4/index.ts", + "./v4-mini": "./src/v4-mini/index.ts", + "./v4/mini": "./src/v4/mini/index.ts", + "./v4/core": "./src/v4/core/index.ts", + "./v4/locales": "./src/v4/locales/index.ts", + "./v4/locales/*": "./src/v4/locales/*" + }, + "sourceDialects": [ + "@zod/source" + ] + }, + "exports": { + "./package.json": "./package.json", + ".": { + "@zod/source": "./src/index.ts", + "types": "./index.d.cts", + "import": "./index.js", + "require": "./index.cjs" + }, + "./v3": { + "@zod/source": "./src/v3/index.ts", + "types": "./v3/index.d.cts", + "import": "./v3/index.js", + "require": "./v3/index.cjs" + }, + "./v4": { + "@zod/source": "./src/v4/index.ts", + "types": "./v4/index.d.cts", + "import": "./v4/index.js", + "require": "./v4/index.cjs" + }, + "./v4-mini": { + "@zod/source": "./src/v4-mini/index.ts", + "types": "./v4-mini/index.d.cts", + "import": "./v4-mini/index.js", + "require": "./v4-mini/index.cjs" + }, + "./v4/mini": { + "@zod/source": "./src/v4/mini/index.ts", + "types": "./v4/mini/index.d.cts", + "import": "./v4/mini/index.js", + "require": "./v4/mini/index.cjs" + }, + "./v4/core": { + "@zod/source": "./src/v4/core/index.ts", + "types": "./v4/core/index.d.cts", + "import": "./v4/core/index.js", + "require": "./v4/core/index.cjs" + }, + "./v4/locales": { + "@zod/source": "./src/v4/locales/index.ts", + "types": "./v4/locales/index.d.cts", + "import": "./v4/locales/index.js", + "require": "./v4/locales/index.cjs" + }, + "./v4/locales/*": { + "@zod/source": "./src/v4/locales/*", + "types": "./v4/locales/*", + "import": "./v4/locales/*", + "require": "./v4/locales/*" + } + }, + "repository": { + "type": "git", + "url": "git+https://github.com/colinhacks/zod.git" + }, + "bugs": { + "url": "https://github.com/colinhacks/zod/issues" + }, + "support": { + "backing": { + "npm-funding": true + } + }, + "scripts": { + "clean": "git clean -xdf . -e node_modules", + "build": "zshy --project tsconfig.build.json", + "postbuild": "pnpm biome check --write .", + "test:watch": "pnpm vitest", + "test": "pnpm vitest run", + "bump:beta": "pnpm version \"v$(pnpm pkg get version | jq -r)-beta.$(date +%Y%m%dT%H%M%S)\"", + "pub:beta": "pnpm bump:beta && pnpm publish --tag next --publish-branch v4 --no-git-checks --dry-run" + } +} diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/index.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf6f1643ab4526b97b1eb1a6dcdea48262f70194 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/index.ts @@ -0,0 +1,4 @@ +import * as z from "./v3/external.js"; +export * from "./v3/external.js"; +export { z }; +export default z; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/ZodError.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/ZodError.ts new file mode 100644 index 0000000000000000000000000000000000000000..6ee33c14a93b8bb8c5fd62fcc19803f843c619e7 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/ZodError.ts @@ -0,0 +1,330 @@ +import type { Primitive } from "./helpers/typeAliases.js"; +import { util, type ZodParsedType } from "./helpers/util.js"; +import type { TypeOf, ZodType } from "./index.js"; + +type allKeys = T extends any ? keyof T : never; + +export type inferFlattenedErrors, U = string> = typeToFlattenedError, U>; +export type typeToFlattenedError = { + formErrors: U[]; + fieldErrors: { + [P in allKeys]?: U[]; + }; +}; + +export const ZodIssueCode = util.arrayToEnum([ + "invalid_type", + "invalid_literal", + "custom", + "invalid_union", + "invalid_union_discriminator", + "invalid_enum_value", + "unrecognized_keys", + "invalid_arguments", + "invalid_return_type", + "invalid_date", + "invalid_string", + "too_small", + "too_big", + "invalid_intersection_types", + "not_multiple_of", + "not_finite", +]); + +export type ZodIssueCode = keyof typeof ZodIssueCode; + +export type ZodIssueBase = { + path: (string | number)[]; + message?: string | undefined; +}; + +export interface ZodInvalidTypeIssue extends ZodIssueBase { + code: typeof ZodIssueCode.invalid_type; + expected: ZodParsedType; + received: ZodParsedType; +} + +export interface ZodInvalidLiteralIssue extends ZodIssueBase { + code: typeof ZodIssueCode.invalid_literal; + expected: unknown; + received: unknown; +} + +export interface ZodUnrecognizedKeysIssue extends ZodIssueBase { + code: typeof ZodIssueCode.unrecognized_keys; + keys: string[]; +} + +export interface ZodInvalidUnionIssue extends ZodIssueBase { + code: typeof ZodIssueCode.invalid_union; + unionErrors: ZodError[]; +} + +export interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase { + code: typeof ZodIssueCode.invalid_union_discriminator; + options: Primitive[]; +} + +export interface ZodInvalidEnumValueIssue extends ZodIssueBase { + received: string | number; + code: typeof ZodIssueCode.invalid_enum_value; + options: (string | number)[]; +} + +export interface ZodInvalidArgumentsIssue extends ZodIssueBase { + code: typeof ZodIssueCode.invalid_arguments; + argumentsError: ZodError; +} + +export interface ZodInvalidReturnTypeIssue extends ZodIssueBase { + code: typeof ZodIssueCode.invalid_return_type; + returnTypeError: ZodError; +} + +export interface ZodInvalidDateIssue extends ZodIssueBase { + code: typeof ZodIssueCode.invalid_date; +} + +export type StringValidation = + | "email" + | "url" + | "emoji" + | "uuid" + | "nanoid" + | "regex" + | "cuid" + | "cuid2" + | "ulid" + | "datetime" + | "date" + | "time" + | "duration" + | "ip" + | "cidr" + | "base64" + | "jwt" + | "base64url" + | { includes: string; position?: number | undefined } + | { startsWith: string } + | { endsWith: string }; + +export interface ZodInvalidStringIssue extends ZodIssueBase { + code: typeof ZodIssueCode.invalid_string; + validation: StringValidation; +} + +export interface ZodTooSmallIssue extends ZodIssueBase { + code: typeof ZodIssueCode.too_small; + minimum: number | bigint; + inclusive: boolean; + exact?: boolean; + type: "array" | "string" | "number" | "set" | "date" | "bigint"; +} + +export interface ZodTooBigIssue extends ZodIssueBase { + code: typeof ZodIssueCode.too_big; + maximum: number | bigint; + inclusive: boolean; + exact?: boolean; + type: "array" | "string" | "number" | "set" | "date" | "bigint"; +} + +export interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase { + code: typeof ZodIssueCode.invalid_intersection_types; +} + +export interface ZodNotMultipleOfIssue extends ZodIssueBase { + code: typeof ZodIssueCode.not_multiple_of; + multipleOf: number | bigint; +} + +export interface ZodNotFiniteIssue extends ZodIssueBase { + code: typeof ZodIssueCode.not_finite; +} + +export interface ZodCustomIssue extends ZodIssueBase { + code: typeof ZodIssueCode.custom; + params?: { [k: string]: any }; +} + +export type DenormalizedError = { [k: string]: DenormalizedError | string[] }; + +export type ZodIssueOptionalMessage = + | ZodInvalidTypeIssue + | ZodInvalidLiteralIssue + | ZodUnrecognizedKeysIssue + | ZodInvalidUnionIssue + | ZodInvalidUnionDiscriminatorIssue + | ZodInvalidEnumValueIssue + | ZodInvalidArgumentsIssue + | ZodInvalidReturnTypeIssue + | ZodInvalidDateIssue + | ZodInvalidStringIssue + | ZodTooSmallIssue + | ZodTooBigIssue + | ZodInvalidIntersectionTypesIssue + | ZodNotMultipleOfIssue + | ZodNotFiniteIssue + | ZodCustomIssue; + +export type ZodIssue = ZodIssueOptionalMessage & { + fatal?: boolean | undefined; + message: string; +}; + +export const quotelessJson = (obj: any) => { + const json = JSON.stringify(obj, null, 2); + return json.replace(/"([^"]+)":/g, "$1:"); +}; + +type recursiveZodFormattedError = T extends [any, ...any[]] + ? { [K in keyof T]?: ZodFormattedError } + : T extends any[] + ? { [k: number]: ZodFormattedError } + : T extends object + ? { [K in keyof T]?: ZodFormattedError } + : unknown; + +export type ZodFormattedError = { + _errors: U[]; +} & recursiveZodFormattedError>; + +export type inferFormattedError, U = string> = ZodFormattedError, U>; + +export class ZodError extends Error { + issues: ZodIssue[] = []; + + get errors() { + return this.issues; + } + + constructor(issues: ZodIssue[]) { + super(); + + const actualProto = new.target.prototype; + if (Object.setPrototypeOf) { + // eslint-disable-next-line ban/ban + Object.setPrototypeOf(this, actualProto); + } else { + (this as any).__proto__ = actualProto; + } + this.name = "ZodError"; + this.issues = issues; + } + + format(): ZodFormattedError; + format(mapper: (issue: ZodIssue) => U): ZodFormattedError; + format(_mapper?: any) { + const mapper: (issue: ZodIssue) => any = + _mapper || + function (issue: ZodIssue) { + return issue.message; + }; + const fieldErrors: ZodFormattedError = { _errors: [] } as any; + const processError = (error: ZodError) => { + for (const issue of error.issues) { + if (issue.code === "invalid_union") { + issue.unionErrors.map(processError); + } else if (issue.code === "invalid_return_type") { + processError(issue.returnTypeError); + } else if (issue.code === "invalid_arguments") { + processError(issue.argumentsError); + } else if (issue.path.length === 0) { + (fieldErrors as any)._errors.push(mapper(issue)); + } else { + let curr: any = fieldErrors; + let i = 0; + while (i < issue.path.length) { + const el = issue.path[i]!; + const terminal = i === issue.path.length - 1; + + if (!terminal) { + curr[el] = curr[el] || { _errors: [] }; + // if (typeof el === "string") { + // curr[el] = curr[el] || { _errors: [] }; + // } else if (typeof el === "number") { + // const errorArray: any = []; + // errorArray._errors = []; + // curr[el] = curr[el] || errorArray; + // } + } else { + curr[el] = curr[el] || { _errors: [] }; + curr[el]._errors.push(mapper(issue)); + } + + curr = curr[el]; + i++; + } + } + } + }; + + processError(this); + return fieldErrors; + } + + static create = (issues: ZodIssue[]) => { + const error = new ZodError(issues); + return error; + }; + + static assert(value: unknown): asserts value is ZodError { + if (!(value instanceof ZodError)) { + throw new Error(`Not a ZodError: ${value}`); + } + } + + override toString() { + return this.message; + } + override get message() { + return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2); + } + + get isEmpty(): boolean { + return this.issues.length === 0; + } + + addIssue = (sub: ZodIssue) => { + this.issues = [...this.issues, sub]; + }; + + addIssues = (subs: ZodIssue[] = []) => { + this.issues = [...this.issues, ...subs]; + }; + + flatten(): typeToFlattenedError; + flatten(mapper?: (issue: ZodIssue) => U): typeToFlattenedError; + flatten(mapper: (issue: ZodIssue) => U = (issue: ZodIssue) => issue.message as any): any { + const fieldErrors: any = {}; + const formErrors: U[] = []; + for (const sub of this.issues) { + if (sub.path.length > 0) { + const firstEl = sub.path[0]!; + fieldErrors[firstEl] = fieldErrors[firstEl] || []; + fieldErrors[firstEl].push(mapper(sub)); + } else { + formErrors.push(mapper(sub)); + } + } + return { formErrors, fieldErrors }; + } + + get formErrors() { + return this.flatten(); + } +} + +type stripPath = T extends any ? util.OmitKeys : never; + +export type IssueData = stripPath & { + path?: (string | number)[]; + fatal?: boolean | undefined; +}; + +export type ErrorMapCtx = { + defaultError: string; + data: any; +}; + +export type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => { message: string }; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/datetime.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/datetime.ts new file mode 100644 index 0000000000000000000000000000000000000000..85552c254597cca742ff15351a99b5b862abd63e --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/datetime.ts @@ -0,0 +1,58 @@ +import Benchmark from "benchmark"; + +const datetimeValidationSuite = new Benchmark.Suite("datetime"); + +const DATA = "2021-01-01"; +const MONTHS_31 = new Set([1, 3, 5, 7, 8, 10, 12]); +const MONTHS_30 = new Set([4, 6, 9, 11]); + +const simpleDatetimeRegex = /^(\d{4})-(\d{2})-(\d{2})$/; +const datetimeRegexNoLeapYearValidation = + /^\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\d|2\d))$/; +const datetimeRegexWithLeapYearValidation = + /^((\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\d|3[01])|(0[469]|11)-(0[1-9]|[12]\d|30)|(02)-(0[1-9]|1\d|2[0-8])))$/; + +datetimeValidationSuite + .add("new Date()", () => { + return !Number.isNaN(new Date(DATA).getTime()); + }) + .add("regex (no validation)", () => { + return simpleDatetimeRegex.test(DATA); + }) + .add("regex (no leap year)", () => { + return datetimeRegexNoLeapYearValidation.test(DATA); + }) + .add("regex (w/ leap year)", () => { + return datetimeRegexWithLeapYearValidation.test(DATA); + }) + .add("capture groups + code", () => { + const match = DATA.match(simpleDatetimeRegex); + if (!match) return false; + + // Extract year, month, and day from the capture groups + const year = Number.parseInt(match[1], 10); + const month = Number.parseInt(match[2], 10); // month is 0-indexed in JavaScript Date, so subtract 1 + const day = Number.parseInt(match[3], 10); + + if (month === 2) { + if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) { + return day <= 29; + } + return day <= 28; + } + if (MONTHS_30.has(month)) { + return day <= 30; + } + if (MONTHS_31.has(month)) { + return day <= 31; + } + return false; + }) + + .on("cycle", (e: Benchmark.Event) => { + console.log(`${datetimeValidationSuite.name!}: ${e.target}`); + }); + +export default { + suites: [datetimeValidationSuite], +}; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts new file mode 100644 index 0000000000000000000000000000000000000000..47737e6c382b0bf6b239bc7c147dbb336a20c778 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts @@ -0,0 +1,80 @@ +import Benchmark from "benchmark"; + +import { z } from "zod/v3"; + +const doubleSuite = new Benchmark.Suite("z.discriminatedUnion: double"); +const manySuite = new Benchmark.Suite("z.discriminatedUnion: many"); + +const aSchema = z.object({ + type: z.literal("a"), +}); +const objA = { + type: "a", +}; + +const bSchema = z.object({ + type: z.literal("b"), +}); +const objB = { + type: "b", +}; + +const cSchema = z.object({ + type: z.literal("c"), +}); +const objC = { + type: "c", +}; + +const dSchema = z.object({ + type: z.literal("d"), +}); + +const double = z.discriminatedUnion("type", [aSchema, bSchema]); +const many = z.discriminatedUnion("type", [aSchema, bSchema, cSchema, dSchema]); + +doubleSuite + .add("valid: a", () => { + double.parse(objA); + }) + .add("valid: b", () => { + double.parse(objB); + }) + .add("invalid: null", () => { + try { + double.parse(null); + } catch (_err) {} + }) + .add("invalid: wrong shape", () => { + try { + double.parse(objC); + } catch (_err) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`${(doubleSuite as any).name}: ${e.target}`); + }); + +manySuite + .add("valid: a", () => { + many.parse(objA); + }) + .add("valid: c", () => { + many.parse(objC); + }) + .add("invalid: null", () => { + try { + many.parse(null); + } catch (_err) {} + }) + .add("invalid: wrong shape", () => { + try { + many.parse({ type: "unknown" }); + } catch (_err) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`${(manySuite as any).name}: ${e.target}`); + }); + +export default { + suites: [doubleSuite, manySuite], +}; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/index.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..ca81c5bb9e300b4917d46e31fdb87dc4f6146bcc --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/index.ts @@ -0,0 +1,59 @@ +import type Benchmark from "benchmark"; + +import datetimeBenchmarks from "./datetime.js"; +import discriminatedUnionBenchmarks from "./discriminatedUnion.js"; +import ipv4Benchmarks from "./ipv4.js"; +import objectBenchmarks from "./object.js"; +import primitiveBenchmarks from "./primitives.js"; +import realworld from "./realworld.js"; +import stringBenchmarks from "./string.js"; +import unionBenchmarks from "./union.js"; + +const argv = process.argv.slice(2); +let suites: Benchmark.Suite[] = []; + +if (!argv.length) { + suites = [ + ...realworld.suites, + ...primitiveBenchmarks.suites, + ...stringBenchmarks.suites, + ...objectBenchmarks.suites, + ...unionBenchmarks.suites, + ...discriminatedUnionBenchmarks.suites, + ]; +} else { + if (argv.includes("--realworld")) { + suites.push(...realworld.suites); + } + if (argv.includes("--primitives")) { + suites.push(...primitiveBenchmarks.suites); + } + if (argv.includes("--string")) { + suites.push(...stringBenchmarks.suites); + } + if (argv.includes("--object")) { + suites.push(...objectBenchmarks.suites); + } + if (argv.includes("--union")) { + suites.push(...unionBenchmarks.suites); + } + if (argv.includes("--discriminatedUnion")) { + suites.push(...datetimeBenchmarks.suites); + } + if (argv.includes("--datetime")) { + suites.push(...datetimeBenchmarks.suites); + } + if (argv.includes("--ipv4")) { + suites.push(...ipv4Benchmarks.suites); + } +} + +for (const suite of suites) { + suite.run({}); +} + +// exit on Ctrl-C +process.on("SIGINT", function () { + console.log("Exiting..."); + process.exit(); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/ipv4.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/ipv4.ts new file mode 100644 index 0000000000000000000000000000000000000000..913ffd4166b7061b1505eb635687ea7eabf403d2 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/ipv4.ts @@ -0,0 +1,57 @@ +import Benchmark from "benchmark"; + +const suite = new Benchmark.Suite("ipv4"); + +const DATA = "127.0.0.1"; +const ipv4RegexA = + /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/; +const ipv4RegexB = + /^(?:(?:(?=(25[0-5]))\1|(?=(2[0-4][0-9]))\2|(?=(1[0-9]{2}))\3|(?=([0-9]{1,2}))\4)\.){3}(?:(?=(25[0-5]))\5|(?=(2[0-4][0-9]))\6|(?=(1[0-9]{2}))\7|(?=([0-9]{1,2}))\8)$/; +const ipv4RegexC = /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/; +const ipv4RegexD = /^(\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/; +const ipv4RegexE = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.){3}(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)$/; +const ipv4RegexF = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/; +const ipv4RegexG = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/; +const ipv4RegexH = /^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])(\.(?!$)|$)){4}$/; +const ipv4RegexI = + /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/; + +suite + .add("A", () => { + return ipv4RegexA.test(DATA); + }) + .add("B", () => { + return ipv4RegexB.test(DATA); + }) + .add("C", () => { + return ipv4RegexC.test(DATA); + }) + .add("D", () => { + return ipv4RegexD.test(DATA); + }) + .add("E", () => { + return ipv4RegexE.test(DATA); + }) + .add("F", () => { + return ipv4RegexF.test(DATA); + }) + .add("G", () => { + return ipv4RegexG.test(DATA); + }) + .add("H", () => { + return ipv4RegexH.test(DATA); + }) + .add("I", () => { + return ipv4RegexI.test(DATA); + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`${suite.name!}: ${e.target}`); + }); + +export default { + suites: [suite], +}; + +if (require.main === module) { + suite.run(); +} diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/object.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/object.ts new file mode 100644 index 0000000000000000000000000000000000000000..3c1da1022a6e049fe7a6fb6d4fd5cfa5da10d538 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/object.ts @@ -0,0 +1,69 @@ +import Benchmark from "benchmark"; + +import { z } from "zod/v3"; + +const emptySuite = new Benchmark.Suite("z.object: empty"); +const shortSuite = new Benchmark.Suite("z.object: short"); +const longSuite = new Benchmark.Suite("z.object: long"); + +const empty = z.object({}); +const short = z.object({ + string: z.string(), +}); +const long = z.object({ + string: z.string(), + number: z.number(), + boolean: z.boolean(), +}); + +emptySuite + .add("valid", () => { + empty.parse({}); + }) + .add("valid: extra keys", () => { + empty.parse({ string: "string" }); + }) + .add("invalid: null", () => { + try { + empty.parse(null); + } catch (_err) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`${(emptySuite as any).name}: ${e.target}`); + }); + +shortSuite + .add("valid", () => { + short.parse({ string: "string" }); + }) + .add("valid: extra keys", () => { + short.parse({ string: "string", number: 42 }); + }) + .add("invalid: null", () => { + try { + short.parse(null); + } catch (_err) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`${(shortSuite as any).name}: ${e.target}`); + }); + +longSuite + .add("valid", () => { + long.parse({ string: "string", number: 42, boolean: true }); + }) + .add("valid: extra keys", () => { + long.parse({ string: "string", number: 42, boolean: true, list: [] }); + }) + .add("invalid: null", () => { + try { + long.parse(null); + } catch (_err) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`${(longSuite as any).name}: ${e.target}`); + }); + +export default { + suites: [emptySuite, shortSuite, longSuite], +}; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/primitives.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/primitives.ts new file mode 100644 index 0000000000000000000000000000000000000000..fd61b38fefe0b9c31aa69f5ed247ef2d6dd88cb5 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/primitives.ts @@ -0,0 +1,162 @@ +import Benchmark from "benchmark"; + +import { z } from "zod/v3"; +import { Mocker } from "../tests/Mocker.js"; + +const val = new Mocker(); + +const enumSuite = new Benchmark.Suite("z.enum"); +const enumSchema = z.enum(["a", "b", "c"]); + +enumSuite + .add("valid", () => { + enumSchema.parse("a"); + }) + .add("invalid", () => { + try { + enumSchema.parse("x"); + } catch (_e: any) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`z.enum: ${e.target}`); + }); + +const longEnumSuite = new Benchmark.Suite("long z.enum"); +const longEnumSchema = z.enum([ + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "ten", + "eleven", + "twelve", + "thirteen", + "fourteen", + "fifteen", + "sixteen", + "seventeen", +]); + +longEnumSuite + .add("valid", () => { + longEnumSchema.parse("five"); + }) + .add("invalid", () => { + try { + longEnumSchema.parse("invalid"); + } catch (_e: any) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`long z.enum: ${e.target}`); + }); + +const undefinedSuite = new Benchmark.Suite("z.undefined"); +const undefinedSchema = z.undefined(); + +undefinedSuite + .add("valid", () => { + undefinedSchema.parse(undefined); + }) + .add("invalid", () => { + try { + undefinedSchema.parse(1); + } catch (_e: any) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`z.undefined: ${e.target}`); + }); + +const literalSuite = new Benchmark.Suite("z.literal"); +const short = "short"; +const bad = "bad"; +const literalSchema = z.literal("short"); + +literalSuite + .add("valid", () => { + literalSchema.parse(short); + }) + .add("invalid", () => { + try { + literalSchema.parse(bad); + } catch (_e: any) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`z.literal: ${e.target}`); + }); + +const numberSuite = new Benchmark.Suite("z.number"); +const numberSchema = z.number().int(); + +numberSuite + .add("valid", () => { + numberSchema.parse(1); + }) + .add("invalid type", () => { + try { + numberSchema.parse("bad"); + } catch (_e: any) {} + }) + .add("invalid number", () => { + try { + numberSchema.parse(0.5); + } catch (_e: any) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`z.number: ${e.target}`); + }); + +const dateSuite = new Benchmark.Suite("z.date"); + +const plainDate = z.date(); +const minMaxDate = z.date().min(new Date("2021-01-01")).max(new Date("2030-01-01")); + +dateSuite + .add("valid", () => { + plainDate.parse(new Date()); + }) + .add("invalid", () => { + try { + plainDate.parse(1); + } catch (_e: any) {} + }) + .add("valid min and max", () => { + minMaxDate.parse(new Date("2023-01-01")); + }) + .add("invalid min", () => { + try { + minMaxDate.parse(new Date("2019-01-01")); + } catch (_e: any) {} + }) + .add("invalid max", () => { + try { + minMaxDate.parse(new Date("2031-01-01")); + } catch (_e: any) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`z.date: ${e.target}`); + }); + +const symbolSuite = new Benchmark.Suite("z.symbol"); +const symbolSchema = z.symbol(); + +symbolSuite + .add("valid", () => { + symbolSchema.parse(val.symbol); + }) + .add("invalid", () => { + try { + symbolSchema.parse(1); + } catch (_e: any) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`z.symbol: ${e.target}`); + }); + +export default { + suites: [enumSuite, longEnumSuite, undefinedSuite, literalSuite, numberSuite, dateSuite, symbolSuite], +}; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/realworld.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/realworld.ts new file mode 100644 index 0000000000000000000000000000000000000000..d64c4f0d0986a4d0ce7b2c6cd394b65fab1ee7d5 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/realworld.ts @@ -0,0 +1,63 @@ +import Benchmark from "benchmark"; + +import { z } from "zod/v3"; + +const shortSuite = new Benchmark.Suite("realworld"); + +const People = z.array( + z.object({ + type: z.literal("person"), + hair: z.enum(["blue", "brown"]), + active: z.boolean(), + name: z.string(), + age: z.number().int(), + hobbies: z.array(z.string()), + address: z.object({ + street: z.string(), + zip: z.string(), + country: z.string(), + }), + }) +); + +let i = 0; + +function num() { + return ++i; +} + +function str() { + return (++i % 100).toString(16); +} + +function array(fn: () => T): T[] { + return Array.from({ length: ++i % 10 }, () => fn()); +} + +const people = Array.from({ length: 100 }, () => { + return { + type: "person", + hair: i % 2 ? "blue" : "brown", + active: !!(i % 2), + name: str(), + age: num(), + hobbies: array(str), + address: { + street: str(), + zip: str(), + country: str(), + }, + }; +}); + +shortSuite + .add("valid", () => { + People.parse(people); + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`${(shortSuite as any).name}: ${e.target}`); + }); + +export default { + suites: [shortSuite], +}; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/string.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/string.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b3d29f94083571f7693a615849758cac5ef8b7f --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/string.ts @@ -0,0 +1,55 @@ +import Benchmark from "benchmark"; + +import { z } from "zod/v3"; + +const SUITE_NAME = "z.string"; +const suite = new Benchmark.Suite(SUITE_NAME); + +const empty = ""; +const short = "short"; +const long = "long".repeat(256); +const manual = (str: unknown) => { + if (typeof str !== "string") { + throw new Error("Not a string"); + } + + return str; +}; +const stringSchema = z.string(); +const optionalStringSchema = z.string().optional(); +const optionalNullableStringSchema = z.string().optional().nullable(); + +suite + .add("empty string", () => { + stringSchema.parse(empty); + }) + .add("short string", () => { + stringSchema.parse(short); + }) + .add("long string", () => { + stringSchema.parse(long); + }) + .add("optional string", () => { + optionalStringSchema.parse(long); + }) + .add("nullable string", () => { + optionalNullableStringSchema.parse(long); + }) + .add("nullable (null) string", () => { + optionalNullableStringSchema.parse(null); + }) + .add("invalid: null", () => { + try { + stringSchema.parse(null); + } catch (_err) {} + }) + .add("manual parser: long", () => { + manual(long); + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`${SUITE_NAME}: ${e.target}`); + }); + +export default { + suites: [suite], +}; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/union.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/union.ts new file mode 100644 index 0000000000000000000000000000000000000000..d716dcef0eb61e1b94ea9b71ee20c093913c2327 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/benchmarks/union.ts @@ -0,0 +1,80 @@ +import Benchmark from "benchmark"; + +import { z } from "zod/v3"; + +const doubleSuite = new Benchmark.Suite("z.union: double"); +const manySuite = new Benchmark.Suite("z.union: many"); + +const aSchema = z.object({ + type: z.literal("a"), +}); +const objA = { + type: "a", +}; + +const bSchema = z.object({ + type: z.literal("b"), +}); +const objB = { + type: "b", +}; + +const cSchema = z.object({ + type: z.literal("c"), +}); +const objC = { + type: "c", +}; + +const dSchema = z.object({ + type: z.literal("d"), +}); + +const double = z.union([aSchema, bSchema]); +const many = z.union([aSchema, bSchema, cSchema, dSchema]); + +doubleSuite + .add("valid: a", () => { + double.parse(objA); + }) + .add("valid: b", () => { + double.parse(objB); + }) + .add("invalid: null", () => { + try { + double.parse(null); + } catch (_err) {} + }) + .add("invalid: wrong shape", () => { + try { + double.parse(objC); + } catch (_err) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`${(doubleSuite as any).name}: ${e.target}`); + }); + +manySuite + .add("valid: a", () => { + many.parse(objA); + }) + .add("valid: c", () => { + many.parse(objC); + }) + .add("invalid: null", () => { + try { + many.parse(null); + } catch (_err) {} + }) + .add("invalid: wrong shape", () => { + try { + many.parse({ type: "unknown" }); + } catch (_err) {} + }) + .on("cycle", (e: Benchmark.Event) => { + console.log(`${(manySuite as any).name}: ${e.target}`); + }); + +export default { + suites: [doubleSuite, manySuite], +}; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/errors.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/errors.ts new file mode 100644 index 0000000000000000000000000000000000000000..3c0dae65964dc95c61870d9b28de67b97d6a94fa --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/errors.ts @@ -0,0 +1,13 @@ +import type { ZodErrorMap } from "./ZodError.js"; +import defaultErrorMap from "./locales/en.js"; + +let overrideErrorMap = defaultErrorMap; +export { defaultErrorMap }; + +export function setErrorMap(map: ZodErrorMap) { + overrideErrorMap = map; +} + +export function getErrorMap() { + return overrideErrorMap; +} diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/external.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/external.ts new file mode 100644 index 0000000000000000000000000000000000000000..f0a4be4c7aa63b363b654384b103396050a06e29 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/external.ts @@ -0,0 +1,6 @@ +export * from "./errors.js"; +export * from "./helpers/parseUtil.js"; +export * from "./helpers/typeAliases.js"; +export * from "./helpers/util.js"; +export * from "./types.js"; +export * from "./ZodError.js"; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/enumUtil.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/enumUtil.ts new file mode 100644 index 0000000000000000000000000000000000000000..526b22736af39391898dd888762d2eabe6ed5e04 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/enumUtil.ts @@ -0,0 +1,17 @@ +export namespace enumUtil { + type UnionToIntersectionFn = (T extends unknown ? (k: () => T) => void : never) extends ( + k: infer Intersection + ) => void + ? Intersection + : never; + + type GetUnionLast = UnionToIntersectionFn extends () => infer Last ? Last : never; + + type UnionToTuple = [T] extends [never] + ? Tuple + : UnionToTuple>, [GetUnionLast, ...Tuple]>; + + type CastToStringTuple = T extends [string, ...string[]] ? T : never; + + export type UnionToTupleString = CastToStringTuple>; +} diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/errorUtil.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/errorUtil.ts new file mode 100644 index 0000000000000000000000000000000000000000..319ef6b74c8fd0ffee2fe8ea60edc3d8bada9d0a --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/errorUtil.ts @@ -0,0 +1,8 @@ +export namespace errorUtil { + export type ErrMessage = string | { message?: string | undefined }; + export const errToObj = (message?: ErrMessage): { message?: string | undefined } => + typeof message === "string" ? { message } : message || {}; + // biome-ignore lint: + export const toString = (message?: ErrMessage): string | undefined => + typeof message === "string" ? message : message?.message; +} diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/parseUtil.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/parseUtil.ts new file mode 100644 index 0000000000000000000000000000000000000000..1076ad9de1418b0fee118cd210f041060a1e132a --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/parseUtil.ts @@ -0,0 +1,176 @@ +import type { IssueData, ZodErrorMap, ZodIssue } from "../ZodError.js"; +import { getErrorMap } from "../errors.js"; +import defaultErrorMap from "../locales/en.js"; +import type { ZodParsedType } from "./util.js"; + +export const makeIssue = (params: { + data: any; + path: (string | number)[]; + errorMaps: ZodErrorMap[]; + issueData: IssueData; +}): ZodIssue => { + const { data, path, errorMaps, issueData } = params; + const fullPath = [...path, ...(issueData.path || [])]; + const fullIssue = { + ...issueData, + path: fullPath, + }; + + if (issueData.message !== undefined) { + return { + ...issueData, + path: fullPath, + message: issueData.message, + }; + } + + let errorMessage = ""; + const maps = errorMaps + .filter((m) => !!m) + .slice() + .reverse(); + for (const map of maps) { + errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message; + } + + return { + ...issueData, + path: fullPath, + message: errorMessage, + }; +}; + +export type ParseParams = { + path: (string | number)[]; + errorMap: ZodErrorMap; + async: boolean; +}; + +export type ParsePathComponent = string | number; +export type ParsePath = ParsePathComponent[]; +export const EMPTY_PATH: ParsePath = []; + +export interface ParseContext { + readonly common: { + readonly issues: ZodIssue[]; + readonly contextualErrorMap?: ZodErrorMap | undefined; + readonly async: boolean; + }; + readonly path: ParsePath; + readonly schemaErrorMap?: ZodErrorMap | undefined; + readonly parent: ParseContext | null; + readonly data: any; + readonly parsedType: ZodParsedType; +} + +export type ParseInput = { + data: any; + path: (string | number)[]; + parent: ParseContext; +}; + +export function addIssueToContext(ctx: ParseContext, issueData: IssueData): void { + const overrideMap = getErrorMap(); + const issue = makeIssue({ + issueData: issueData, + data: ctx.data, + path: ctx.path, + errorMaps: [ + ctx.common.contextualErrorMap, // contextual error map is first priority + ctx.schemaErrorMap, // then schema-bound map if available + overrideMap, // then global override map + overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map + ].filter((x) => !!x), + }); + ctx.common.issues.push(issue); +} + +export type ObjectPair = { + key: SyncParseReturnType; + value: SyncParseReturnType; +}; +export class ParseStatus { + value: "aborted" | "dirty" | "valid" = "valid"; + dirty(): void { + if (this.value === "valid") this.value = "dirty"; + } + abort(): void { + if (this.value !== "aborted") this.value = "aborted"; + } + + static mergeArray(status: ParseStatus, results: SyncParseReturnType[]): SyncParseReturnType { + const arrayValue: any[] = []; + for (const s of results) { + if (s.status === "aborted") return INVALID; + if (s.status === "dirty") status.dirty(); + arrayValue.push(s.value); + } + + return { status: status.value, value: arrayValue }; + } + + static async mergeObjectAsync( + status: ParseStatus, + pairs: { key: ParseReturnType; value: ParseReturnType }[] + ): Promise> { + const syncPairs: ObjectPair[] = []; + for (const pair of pairs) { + const key = await pair.key; + const value = await pair.value; + syncPairs.push({ + key, + value, + }); + } + return ParseStatus.mergeObjectSync(status, syncPairs); + } + + static mergeObjectSync( + status: ParseStatus, + pairs: { + key: SyncParseReturnType; + value: SyncParseReturnType; + alwaysSet?: boolean; + }[] + ): SyncParseReturnType { + const finalObject: any = {}; + for (const pair of pairs) { + const { key, value } = pair; + if (key.status === "aborted") return INVALID; + if (value.status === "aborted") return INVALID; + if (key.status === "dirty") status.dirty(); + if (value.status === "dirty") status.dirty(); + + if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) { + finalObject[key.value] = value.value; + } + } + + return { status: status.value, value: finalObject }; + } +} +export interface ParseResult { + status: "aborted" | "dirty" | "valid"; + data: any; +} + +export type INVALID = { status: "aborted" }; +export const INVALID: INVALID = Object.freeze({ + status: "aborted", +}); + +export type DIRTY = { status: "dirty"; value: T }; +export const DIRTY = (value: T): DIRTY => ({ status: "dirty", value }); + +export type OK = { status: "valid"; value: T }; +export const OK = (value: T): OK => ({ status: "valid", value }); + +export type SyncParseReturnType = OK | DIRTY | INVALID; +export type AsyncParseReturnType = Promise>; +export type ParseReturnType = SyncParseReturnType | AsyncParseReturnType; + +export const isAborted = (x: ParseReturnType): x is INVALID => (x as any).status === "aborted"; +export const isDirty = (x: ParseReturnType): x is OK | DIRTY => (x as any).status === "dirty"; +export const isValid = (x: ParseReturnType): x is OK => (x as any).status === "valid"; +export const isAsync = (x: ParseReturnType): x is AsyncParseReturnType => + typeof Promise !== "undefined" && x instanceof Promise; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/partialUtil.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/partialUtil.ts new file mode 100644 index 0000000000000000000000000000000000000000..0eff8ff34ca6b96f41383ef554752e9f9fda6db9 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/partialUtil.ts @@ -0,0 +1,34 @@ +import type { + ZodArray, + ZodNullable, + ZodObject, + ZodOptional, + ZodRawShape, + ZodTuple, + ZodTupleItems, + ZodTypeAny, +} from "../types.js"; + +export namespace partialUtil { + export type DeepPartial = T extends ZodObject + ? ZodObject< + { [k in keyof T["shape"]]: ZodOptional> }, + T["_def"]["unknownKeys"], + T["_def"]["catchall"] + > + : T extends ZodArray + ? ZodArray, Card> + : T extends ZodOptional + ? ZodOptional> + : T extends ZodNullable + ? ZodNullable> + : T extends ZodTuple + ? { + [k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial : never; + } extends infer PI + ? PI extends ZodTupleItems + ? ZodTuple + : never + : never + : T; +} diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/typeAliases.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/typeAliases.ts new file mode 100644 index 0000000000000000000000000000000000000000..32df022ca3b929528dace9023f77212204324422 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/typeAliases.ts @@ -0,0 +1,2 @@ +export type Primitive = string | number | symbol | bigint | boolean | null | undefined; +export type Scalars = Primitive | Primitive[]; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/util.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/util.ts new file mode 100644 index 0000000000000000000000000000000000000000..030ea821b694ed03e210b418c8742c7a535ac816 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/helpers/util.ts @@ -0,0 +1,224 @@ +export namespace util { + type AssertEqual = (() => V extends T ? 1 : 2) extends () => V extends U ? 1 : 2 ? true : false; + + export type isAny = 0 extends 1 & T ? true : false; + export const assertEqual = (_: AssertEqual): void => {}; + export function assertIs(_arg: T): void {} + export function assertNever(_x: never): never { + throw new Error(); + } + + export type Omit = Pick>; + export type OmitKeys = Pick>; + export type MakePartial = Omit & Partial>; + export type Exactly = T & Record, never>; + export type InexactPartial = { [k in keyof T]?: T[k] | undefined }; + export const arrayToEnum = (items: U): { [k in U[number]]: k } => { + const obj: any = {}; + for (const item of items) { + obj[item] = item; + } + return obj; + }; + + export const getValidEnumValues = (obj: any): any[] => { + const validKeys = objectKeys(obj).filter((k: any) => typeof obj[obj[k]] !== "number"); + const filtered: any = {}; + for (const k of validKeys) { + filtered[k] = obj[k]; + } + return objectValues(filtered); + }; + + export const objectValues = (obj: any): any[] => { + return objectKeys(obj).map(function (e) { + return obj[e]; + }); + }; + + export const objectKeys: ObjectConstructor["keys"] = + typeof Object.keys === "function" // eslint-disable-line ban/ban + ? (obj: any) => Object.keys(obj) // eslint-disable-line ban/ban + : (object: any) => { + const keys = []; + for (const key in object) { + if (Object.prototype.hasOwnProperty.call(object, key)) { + keys.push(key); + } + } + return keys; + }; + + export const find = (arr: T[], checker: (arg: T) => any): T | undefined => { + for (const item of arr) { + if (checker(item)) return item; + } + return undefined; + }; + + export type identity = objectUtil.identity; + export type flatten = objectUtil.flatten; + + export type noUndefined = T extends undefined ? never : T; + + export const isInteger: NumberConstructor["isInteger"] = + typeof Number.isInteger === "function" + ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban + : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val; + + export function joinValues(array: T, separator = " | "): string { + return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator); + } + + export const jsonStringifyReplacer = (_: string, value: any): any => { + if (typeof value === "bigint") { + return value.toString(); + } + return value; + }; +} + +export namespace objectUtil { + export type MergeShapes = + // fast path when there is no keys overlap + keyof U & keyof V extends never + ? U & V + : { + [k in Exclude]: U[k]; + } & V; + + type optionalKeys = { + [k in keyof T]: undefined extends T[k] ? k : never; + }[keyof T]; + type requiredKeys = { + [k in keyof T]: undefined extends T[k] ? never : k; + }[keyof T]; + export type addQuestionMarks = { + [K in requiredKeys]: T[K]; + } & { + [K in optionalKeys]?: T[K]; + } & { [k in keyof T]?: unknown }; + + export type identity = T; + export type flatten = identity<{ [k in keyof T]: T[k] }>; + + export type noNeverKeys = { + [k in keyof T]: [T[k]] extends [never] ? never : k; + }[keyof T]; + + export type noNever = identity<{ + [k in noNeverKeys]: k extends keyof T ? T[k] : never; + }>; + + export const mergeShapes = (first: U, second: T): T & U => { + return { + ...first, + ...second, // second overwrites first + }; + }; + + export type extendShape = keyof A & keyof B extends never // fast path when there is no keys overlap + ? A & B + : { + [K in keyof A as K extends keyof B ? never : K]: A[K]; + } & { + [K in keyof B]: B[K]; + }; +} + +export const ZodParsedType: { + string: "string"; + nan: "nan"; + number: "number"; + integer: "integer"; + float: "float"; + boolean: "boolean"; + date: "date"; + bigint: "bigint"; + symbol: "symbol"; + function: "function"; + undefined: "undefined"; + null: "null"; + array: "array"; + object: "object"; + unknown: "unknown"; + promise: "promise"; + void: "void"; + never: "never"; + map: "map"; + set: "set"; +} = util.arrayToEnum([ + "string", + "nan", + "number", + "integer", + "float", + "boolean", + "date", + "bigint", + "symbol", + "function", + "undefined", + "null", + "array", + "object", + "unknown", + "promise", + "void", + "never", + "map", + "set", +]); + +export type ZodParsedType = keyof typeof ZodParsedType; + +export const getParsedType = (data: any): ZodParsedType => { + const t = typeof data; + + switch (t) { + case "undefined": + return ZodParsedType.undefined; + + case "string": + return ZodParsedType.string; + + case "number": + return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number; + + case "boolean": + return ZodParsedType.boolean; + + case "function": + return ZodParsedType.function; + + case "bigint": + return ZodParsedType.bigint; + + case "symbol": + return ZodParsedType.symbol; + + case "object": + if (Array.isArray(data)) { + return ZodParsedType.array; + } + if (data === null) { + return ZodParsedType.null; + } + if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") { + return ZodParsedType.promise; + } + if (typeof Map !== "undefined" && data instanceof Map) { + return ZodParsedType.map; + } + if (typeof Set !== "undefined" && data instanceof Set) { + return ZodParsedType.set; + } + if (typeof Date !== "undefined" && data instanceof Date) { + return ZodParsedType.date; + } + return ZodParsedType.object; + + default: + return ZodParsedType.unknown; + } +}; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/index.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9dab57383baf1f27b9531f2dafc7a48c3dc4f81 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/index.ts @@ -0,0 +1,4 @@ +import * as z from "./external.js"; +export * from "./external.js"; +export { z }; +export default z; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/locales/en.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/locales/en.ts new file mode 100644 index 0000000000000000000000000000000000000000..0264f82ef2e381ed4e855932c1992a10da28b015 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/locales/en.ts @@ -0,0 +1,124 @@ +import { type ZodErrorMap, ZodIssueCode } from "../ZodError.js"; +import { util, ZodParsedType } from "../helpers/util.js"; + +const errorMap: ZodErrorMap = (issue, _ctx) => { + let message: string; + switch (issue.code) { + case ZodIssueCode.invalid_type: + if (issue.received === ZodParsedType.undefined) { + message = "Required"; + } else { + message = `Expected ${issue.expected}, received ${issue.received}`; + } + break; + case ZodIssueCode.invalid_literal: + message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`; + break; + case ZodIssueCode.unrecognized_keys: + message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`; + break; + case ZodIssueCode.invalid_union: + message = `Invalid input`; + break; + case ZodIssueCode.invalid_union_discriminator: + message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`; + break; + case ZodIssueCode.invalid_enum_value: + message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`; + break; + case ZodIssueCode.invalid_arguments: + message = `Invalid function arguments`; + break; + case ZodIssueCode.invalid_return_type: + message = `Invalid function return type`; + break; + case ZodIssueCode.invalid_date: + message = `Invalid date`; + break; + case ZodIssueCode.invalid_string: + if (typeof issue.validation === "object") { + if ("includes" in issue.validation) { + message = `Invalid input: must include "${issue.validation.includes}"`; + + if (typeof issue.validation.position === "number") { + message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`; + } + } else if ("startsWith" in issue.validation) { + message = `Invalid input: must start with "${issue.validation.startsWith}"`; + } else if ("endsWith" in issue.validation) { + message = `Invalid input: must end with "${issue.validation.endsWith}"`; + } else { + util.assertNever(issue.validation); + } + } else if (issue.validation !== "regex") { + message = `Invalid ${issue.validation}`; + } else { + message = "Invalid"; + } + break; + case ZodIssueCode.too_small: + if (issue.type === "array") + message = `Array must contain ${ + issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than` + } ${issue.minimum} element(s)`; + else if (issue.type === "string") + message = `String must contain ${ + issue.exact ? "exactly" : issue.inclusive ? `at least` : `over` + } ${issue.minimum} character(s)`; + else if (issue.type === "number") + message = `Number must be ${ + issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than ` + }${issue.minimum}`; + else if (issue.type === "bigint") + message = `Number must be ${ + issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than ` + }${issue.minimum}`; + else if (issue.type === "date") + message = `Date must be ${ + issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than ` + }${new Date(Number(issue.minimum))}`; + else message = "Invalid input"; + break; + case ZodIssueCode.too_big: + if (issue.type === "array") + message = `Array must contain ${ + issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than` + } ${issue.maximum} element(s)`; + else if (issue.type === "string") + message = `String must contain ${ + issue.exact ? `exactly` : issue.inclusive ? `at most` : `under` + } ${issue.maximum} character(s)`; + else if (issue.type === "number") + message = `Number must be ${ + issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than` + } ${issue.maximum}`; + else if (issue.type === "bigint") + message = `BigInt must be ${ + issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than` + } ${issue.maximum}`; + else if (issue.type === "date") + message = `Date must be ${ + issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than` + } ${new Date(Number(issue.maximum))}`; + else message = "Invalid input"; + break; + case ZodIssueCode.custom: + message = `Invalid input`; + break; + case ZodIssueCode.invalid_intersection_types: + message = `Intersection results could not be merged`; + break; + case ZodIssueCode.not_multiple_of: + message = `Number must be a multiple of ${issue.multipleOf}`; + break; + case ZodIssueCode.not_finite: + message = "Number must be finite"; + break; + default: + message = _ctx.defaultError; + util.assertNever(issue); + } + return { message }; +}; + +export default errorMap; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/standard-schema.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/standard-schema.ts new file mode 100644 index 0000000000000000000000000000000000000000..07193fd135b70d85ed46a806faf921fea9370ad3 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/standard-schema.ts @@ -0,0 +1,113 @@ +/** + * The Standard Schema interface. + */ +export type StandardSchemaV1 = { + /** + * The Standard Schema properties. + */ + readonly "~standard": StandardSchemaV1.Props; +}; + +export declare namespace StandardSchemaV1 { + /** + * The Standard Schema properties interface. + */ + export interface Props { + /** + * The version number of the standard. + */ + readonly version: 1; + /** + * The vendor name of the schema library. + */ + readonly vendor: string; + /** + * Validates unknown input values. + */ + readonly validate: (value: unknown) => Result | Promise>; + /** + * Inferred types associated with the schema. + */ + readonly types?: Types | undefined; + } + + /** + * The result interface of the validate function. + */ + export type Result = SuccessResult | FailureResult; + + /** + * The result interface if validation succeeds. + */ + export interface SuccessResult { + /** + * The typed output value. + */ + readonly value: Output; + /** + * The non-existent issues. + */ + readonly issues?: undefined; + } + + /** + * The result interface if validation fails. + */ + export interface FailureResult { + /** + * The issues of failed validation. + */ + readonly issues: ReadonlyArray; + } + + /** + * The issue interface of the failure output. + */ + export interface Issue { + /** + * The error message of the issue. + */ + readonly message: string; + /** + * The path of the issue, if any. + */ + readonly path?: ReadonlyArray | undefined; + } + + /** + * The path segment interface of the issue. + */ + export interface PathSegment { + /** + * The key representing a path segment. + */ + readonly key: PropertyKey; + } + + /** + * The Standard Schema types interface. + */ + export interface Types { + /** + * The input type of the schema. + */ + readonly input: Input; + /** + * The output type of the schema. + */ + readonly output: Output; + } + + /** + * Infers the input type of a Standard Schema. + */ + export type InferInput = NonNullable["input"]; + + /** + * Infers the output type of a Standard Schema. + */ + export type InferOutput = NonNullable["output"]; + + // biome-ignore lint/complexity/noUselessEmptyExport: needed for granular visibility control of TS namespace + export {}; +} diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/Mocker.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/Mocker.ts new file mode 100644 index 0000000000000000000000000000000000000000..c9fbdd51a5aecd3fc18b2c8e3b7fbf362e30ee60 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/Mocker.ts @@ -0,0 +1,54 @@ +function getRandomInt(max: number) { + return Math.floor(Math.random() * Math.floor(max)); +} + +const testSymbol = Symbol("test"); + +export class Mocker { + pick = (...args: any[]): any => { + return args[getRandomInt(args.length)]; + }; + + get string(): string { + return Math.random().toString(36).substring(7); + } + get number(): number { + return Math.random() * 100; + } + get bigint(): bigint { + return BigInt(Math.floor(Math.random() * 10000)); + } + get boolean(): boolean { + return Math.random() < 0.5; + } + get date(): Date { + return new Date(Math.floor(Date.now() * Math.random())); + } + get symbol(): symbol { + return testSymbol; + } + get null(): null { + return null; + } + get undefined(): undefined { + return undefined; + } + get stringOptional(): string | undefined { + return this.pick(this.string, this.undefined); + } + get stringNullable(): string | null { + return this.pick(this.string, this.null); + } + get numberOptional(): number | undefined { + return this.pick(this.number, this.undefined); + } + get numberNullable(): number | null { + return this.pick(this.number, this.null); + } + get booleanOptional(): boolean | undefined { + return this.pick(this.boolean, this.undefined); + } + get booleanNullable(): boolean | null { + return this.pick(this.boolean, this.null); + } +} diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/all-errors.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/all-errors.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..8fdf8f42688de42dd29e13f66ff8f5a529dbe2ed --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/all-errors.test.ts @@ -0,0 +1,157 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +const Test = z.object({ + f1: z.number(), + f2: z.string().optional(), + f3: z.string().nullable(), + f4: z.array(z.object({ t: z.union([z.string(), z.boolean()]) })), +}); +type TestFlattenedErrors = z.inferFlattenedErrors; +type TestFormErrors = z.inferFlattenedErrors; + +test("default flattened errors type inference", () => { + type TestTypeErrors = { + formErrors: string[]; + fieldErrors: { [P in keyof z.TypeOf]?: string[] | undefined }; + }; + + util.assertEqual, TestTypeErrors>(true); + util.assertEqual, TestTypeErrors>(false); +}); + +test("custom flattened errors type inference", () => { + type ErrorType = { message: string; code: number }; + type TestTypeErrors = { + formErrors: ErrorType[]; + fieldErrors: { + [P in keyof z.TypeOf]?: ErrorType[] | undefined; + }; + }; + + util.assertEqual, TestTypeErrors>(false); + util.assertEqual, TestTypeErrors>(true); + util.assertEqual, TestTypeErrors>(false); +}); + +test("form errors type inference", () => { + type TestTypeErrors = { + formErrors: string[]; + fieldErrors: { [P in keyof z.TypeOf]?: string[] | undefined }; + }; + + util.assertEqual, TestTypeErrors>(true); +}); + +test(".flatten() type assertion", () => { + const parsed = Test.safeParse({}) as z.SafeParseError; + const validFlattenedErrors: TestFlattenedErrors = parsed.error.flatten(() => ({ message: "", code: 0 })); + // @ts-expect-error should fail assertion between `TestFlattenedErrors` and unmapped `flatten()`. + const invalidFlattenedErrors: TestFlattenedErrors = parsed.error.flatten(); + const validFormErrors: TestFormErrors = parsed.error.flatten(); + // @ts-expect-error should fail assertion between `TestFormErrors` and mapped `flatten()`. + const invalidFormErrors: TestFormErrors = parsed.error.flatten(() => ({ + message: "string", + code: 0, + })); + + [validFlattenedErrors, invalidFlattenedErrors, validFormErrors, invalidFormErrors]; +}); + +test(".formErrors type assertion", () => { + const parsed = Test.safeParse({}) as z.SafeParseError; + const validFormErrors: TestFormErrors = parsed.error.formErrors; + // @ts-expect-error should fail assertion between `TestFlattenedErrors` and `.formErrors`. + const invalidFlattenedErrors: TestFlattenedErrors = parsed.error.formErrors; + + [validFormErrors, invalidFlattenedErrors]; +}); + +test("all errors", () => { + const propertySchema = z.string(); + const schema = z + .object({ + a: propertySchema, + b: propertySchema, + }) + .refine( + (val) => { + return val.a === val.b; + }, + { message: "Must be equal" } + ); + + try { + schema.parse({ + a: "asdf", + b: "qwer", + }); + } catch (error) { + if (error instanceof z.ZodError) { + expect(error.flatten()).toEqual({ + formErrors: ["Must be equal"], + fieldErrors: {}, + }); + } + } + + try { + schema.parse({ + a: null, + b: null, + }); + } catch (_error) { + const error = _error as z.ZodError; + expect(error.flatten()).toEqual({ + formErrors: [], + fieldErrors: { + a: ["Expected string, received null"], + b: ["Expected string, received null"], + }, + }); + + expect(error.flatten((iss) => iss.message.toUpperCase())).toEqual({ + formErrors: [], + fieldErrors: { + a: ["EXPECTED STRING, RECEIVED NULL"], + b: ["EXPECTED STRING, RECEIVED NULL"], + }, + }); + // Test identity + + expect(error.flatten((i: z.ZodIssue) => i)).toEqual({ + formErrors: [], + fieldErrors: { + a: [ + { + code: "invalid_type", + expected: "string", + message: "Expected string, received null", + path: ["a"], + received: "null", + }, + ], + b: [ + { + code: "invalid_type", + expected: "string", + message: "Expected string, received null", + path: ["b"], + received: "null", + }, + ], + }, + }); + // Test mapping + expect(error.flatten((i: z.ZodIssue) => i.message.length)).toEqual({ + formErrors: [], + fieldErrors: { + a: ["Expected string, received null".length], + b: ["Expected string, received null".length], + }, + }); + } +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/anyunknown.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/anyunknown.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..49d07db2c8b3a4600a6f7eeb0f51e1ec27228d98 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/anyunknown.test.ts @@ -0,0 +1,28 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("check any inference", () => { + const t1 = z.any(); + t1.optional(); + t1.nullable(); + type t1 = z.infer; + util.assertEqual(true); +}); + +test("check unknown inference", () => { + const t1 = z.unknown(); + t1.optional(); + t1.nullable(); + type t1 = z.infer; + util.assertEqual(true); +}); + +test("check never inference", () => { + const t1 = z.never(); + expect(() => t1.parse(undefined)).toThrow(); + expect(() => t1.parse("asdf")).toThrow(); + expect(() => t1.parse(null)).toThrow(); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/array.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/array.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..df5b9d373ce740719c95908d00c11038a939e06c --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/array.test.ts @@ -0,0 +1,71 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +const minTwo = z.string().array().min(2); +const maxTwo = z.string().array().max(2); +const justTwo = z.string().array().length(2); +const intNum = z.string().array().nonempty(); +const nonEmptyMax = z.string().array().nonempty().max(2); + +type t1 = z.infer; +util.assertEqual<[string, ...string[]], t1>(true); + +type t2 = z.infer; +util.assertEqual(true); + +test("passing validations", () => { + minTwo.parse(["a", "a"]); + minTwo.parse(["a", "a", "a"]); + maxTwo.parse(["a", "a"]); + maxTwo.parse(["a"]); + justTwo.parse(["a", "a"]); + intNum.parse(["a"]); + nonEmptyMax.parse(["a"]); +}); + +test("failing validations", () => { + expect(() => minTwo.parse(["a"])).toThrow(); + expect(() => maxTwo.parse(["a", "a", "a"])).toThrow(); + expect(() => justTwo.parse(["a"])).toThrow(); + expect(() => justTwo.parse(["a", "a", "a"])).toThrow(); + expect(() => intNum.parse([])).toThrow(); + expect(() => nonEmptyMax.parse([])).toThrow(); + expect(() => nonEmptyMax.parse(["a", "a", "a"])).toThrow(); +}); + +test("parse empty array in nonempty", () => { + expect(() => + z + .array(z.string()) + .nonempty() + .parse([] as any) + ).toThrow(); +}); + +test("get element", () => { + justTwo.element.parse("asdf"); + expect(() => justTwo.element.parse(12)).toThrow(); +}); + +test("continue parsing despite array size error", () => { + const schema = z.object({ + people: z.string().array().min(2), + }); + + const result = schema.safeParse({ + people: [123], + }); + expect(result.success).toEqual(false); + if (!result.success) { + expect(result.error.issues.length).toEqual(2); + } +}); + +test("parse should fail given sparse array", () => { + const schema = z.array(z.string()).nonempty().min(1).max(3); + + expect(() => schema.parse(new Array(3))).toThrow(); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/async-parsing.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/async-parsing.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..01dbc4f1e1acee18b28771fedfef1eb0fc8e4928 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/async-parsing.test.ts @@ -0,0 +1,388 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +/// string +const stringSchema = z.string(); + +test("string async parse", async () => { + const goodData = "XXX"; + const badData = 12; + + const goodResult = await stringSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await stringSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// number +const numberSchema = z.number(); +test("number async parse", async () => { + const goodData = 1234.2353; + const badData = "1234"; + + const goodResult = await numberSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await numberSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// bigInt +const bigIntSchema = z.bigint(); +test("bigInt async parse", async () => { + const goodData = BigInt(145); + const badData = 134; + + const goodResult = await bigIntSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await bigIntSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// boolean +const booleanSchema = z.boolean(); +test("boolean async parse", async () => { + const goodData = true; + const badData = 1; + + const goodResult = await booleanSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await booleanSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// date +const dateSchema = z.date(); +test("date async parse", async () => { + const goodData = new Date(); + const badData = new Date().toISOString(); + + const goodResult = await dateSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await dateSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// undefined +const undefinedSchema = z.undefined(); +test("undefined async parse", async () => { + const goodData = undefined; + const badData = "XXX"; + + const goodResult = await undefinedSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(undefined); + + const badResult = await undefinedSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// null +const nullSchema = z.null(); +test("null async parse", async () => { + const goodData = null; + const badData = undefined; + + const goodResult = await nullSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await nullSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// any +const anySchema = z.any(); +test("any async parse", async () => { + const goodData = [{}]; + // const badData = 'XXX'; + + const goodResult = await anySchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + // const badResult = await anySchema.safeParseAsync(badData); + // expect(badResult.success).toBe(false); + // if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// unknown +const unknownSchema = z.unknown(); +test("unknown async parse", async () => { + const goodData = ["asdf", 124, () => {}]; + // const badData = 'XXX'; + + const goodResult = await unknownSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + // const badResult = await unknownSchema.safeParseAsync(badData); + // expect(badResult.success).toBe(false); + // if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// void +const voidSchema = z.void(); +test("void async parse", async () => { + const goodData = undefined; + const badData = 0; + + const goodResult = await voidSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await voidSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// array +const arraySchema = z.array(z.string()); +test("array async parse", async () => { + const goodData = ["XXX"]; + const badData = "XXX"; + + const goodResult = await arraySchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await arraySchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// object +const objectSchema = z.object({ string: z.string() }); +test("object async parse", async () => { + const goodData = { string: "XXX" }; + const badData = { string: 12 }; + + const goodResult = await objectSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await objectSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// union +const unionSchema = z.union([z.string(), z.undefined()]); +test("union async parse", async () => { + const goodData = undefined; + const badData = null; + + const goodResult = await unionSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await unionSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// record +const recordSchema = z.record(z.object({})); +test("record async parse", async () => { + const goodData = { adsf: {}, asdf: {} }; + const badData = [{}]; + + const goodResult = await recordSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await recordSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// function +const functionSchema = z.function(); +test("function async parse", async () => { + const goodData = () => {}; + const badData = "XXX"; + + const goodResult = await functionSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(typeof goodResult.data).toEqual("function"); + + const badResult = await functionSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// literal +const literalSchema = z.literal("asdf"); +test("literal async parse", async () => { + const goodData = "asdf"; + const badData = "asdff"; + + const goodResult = await literalSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await literalSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// enum +const enumSchema = z.enum(["fish", "whale"]); +test("enum async parse", async () => { + const goodData = "whale"; + const badData = "leopard"; + + const goodResult = await enumSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await enumSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// nativeEnum +enum nativeEnumTest { + asdf = "qwer", +} +// @ts-ignore +const nativeEnumSchema = z.nativeEnum(nativeEnumTest); +test("nativeEnum async parse", async () => { + const goodData = nativeEnumTest.asdf; + const badData = "asdf"; + + const goodResult = await nativeEnumSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) expect(goodResult.data).toEqual(goodData); + + const badResult = await nativeEnumSchema.safeParseAsync(badData); + expect(badResult.success).toBe(false); + if (!badResult.success) expect(badResult.error).toBeInstanceOf(z.ZodError); +}); + +/// promise +const promiseSchema = z.promise(z.number()); +test("promise async parse good", async () => { + const goodData = Promise.resolve(123); + + const goodResult = await promiseSchema.safeParseAsync(goodData); + expect(goodResult.success).toBe(true); + if (goodResult.success) { + expect(goodResult.data).toBeInstanceOf(Promise); + const data = await goodResult.data; + expect(data).toEqual(123); + // expect(goodResult.data).resolves.toEqual(124); + // return goodResult.data; + } else { + throw new Error("success should be true"); + } +}); + +test("promise async parse bad", async () => { + const badData = Promise.resolve("XXX"); + const badResult = await promiseSchema.safeParseAsync(badData); + expect(badResult.success).toBe(true); + if (badResult.success) { + await expect(badResult.data).rejects.toBeInstanceOf(z.ZodError); + } else { + throw new Error("success should be true"); + } +}); + +test("async validation non-empty strings", async () => { + const base = z.object({ + hello: z.string().refine((x) => x && x.length > 0), + foo: z.string().refine((x) => x && x.length > 0), + }); + + const testval = { hello: "", foo: "" }; + const result1 = base.safeParse(testval); + const result2 = base.safeParseAsync(testval); + + const r1 = result1; + await result2.then((r2) => { + if (r1.success === false && r2.success === false) expect(r1.error.issues.length).toBe(r2.error.issues.length); // <--- r1 has length 2, r2 has length 1 + }); +}); + +test("async validation multiple errors 1", async () => { + const base = z.object({ + hello: z.string(), + foo: z.number(), + }); + + const testval = { hello: 3, foo: "hello" }; + const result1 = base.safeParse(testval); + const result2 = base.safeParseAsync(testval); + + const r1 = result1; + await result2.then((r2) => { + if (r1.success === false && r2.success === false) expect(r2.error.issues.length).toBe(r1.error.issues.length); + }); +}); + +test("async validation multiple errors 2", async () => { + const base = (is_async?: boolean) => + z.object({ + hello: z.string(), + foo: z.object({ + bar: z.number().refine(is_async ? async () => false : () => false), + }), + }); + + const testval = { hello: 3, foo: { bar: 4 } }; + const result1 = base().safeParse(testval); + const result2 = base(true).safeParseAsync(testval); + + const r1 = result1; + await result2.then((r2) => { + if (r1.success === false && r2.success === false) expect(r2.error.issues.length).toBe(r1.error.issues.length); + }); +}); + +test("ensure early async failure prevents follow-up refinement checks", async () => { + let count = 0; + const base = z.object({ + hello: z.string(), + foo: z + .number() + .refine(async () => { + count++; + return true; + }) + .refine(async () => { + count++; + return true; + }, "Good"), + }); + + const testval = { hello: "bye", foo: 3 }; + const result = await base.safeParseAsync(testval); + if (result.success === false) { + expect(result.error.issues.length).toBe(1); + expect(count).toBe(1); + } + + // await result.then((r) => { + // if (r.success === false) expect(r.error.issues.length).toBe(1); + // expect(count).toBe(2); + // }); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/async-refinements.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/async-refinements.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..509475db62905630d39959ef3af2c0033b55b18a --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/async-refinements.test.ts @@ -0,0 +1,46 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +test("parse async test", async () => { + const schema1 = z.string().refine(async (_val) => false); + expect(() => schema1.parse("asdf")).toThrow(); + + const schema2 = z.string().refine((_val) => Promise.resolve(true)); + return await expect(() => schema2.parse("asdf")).toThrow(); +}); + +test("parseAsync async test", async () => { + const schema1 = z.string().refine(async (_val) => true); + await schema1.parseAsync("asdf"); + + const schema2 = z.string().refine(async (_val) => false); + return await expect(schema2.parseAsync("asdf")).rejects.toBeDefined(); + // expect(async () => await schema2.parseAsync('asdf')).toThrow(); +}); + +test("parseAsync async test", async () => { + // expect.assertions(2); + + const schema1 = z.string().refine((_val) => Promise.resolve(true)); + const v1 = await schema1.parseAsync("asdf"); + expect(v1).toEqual("asdf"); + + const schema2 = z.string().refine((_val) => Promise.resolve(false)); + await expect(schema2.parseAsync("asdf")).rejects.toBeDefined(); + + const schema3 = z.string().refine((_val) => Promise.resolve(true)); + await expect(schema3.parseAsync("asdf")).resolves.toEqual("asdf"); + return await expect(schema3.parseAsync("qwer")).resolves.toEqual("qwer"); +}); + +test("parseAsync async with value", async () => { + const schema1 = z.string().refine(async (val) => { + return val.length > 5; + }); + await expect(schema1.parseAsync("asdf")).rejects.toBeDefined(); + + const v = await schema1.parseAsync("asdf123"); + return await expect(v).toEqual("asdf123"); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/base.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/base.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..ab743d565d365ec62c13dde7506419c0468b4f92 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/base.test.ts @@ -0,0 +1,29 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("type guard", () => { + const stringToNumber = z.string().transform((arg) => arg.length); + + const s1 = z.object({ + stringToNumber, + }); + type t1 = z.input; + + const data = { stringToNumber: "asdf" }; + const parsed = s1.safeParse(data); + if (parsed.success) { + util.assertEqual(true); + } +}); + +test("test this binding", () => { + const callback = (predicate: (val: string) => boolean) => { + return predicate("hello"); + }; + + expect(callback((value) => z.string().safeParse(value).success)).toBe(true); // true + expect(callback((value) => z.string().safeParse(value).success)).toBe(true); // true +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/bigint.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/bigint.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..9692f570018d981d89165772d23a68c6573f2f17 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/bigint.test.ts @@ -0,0 +1,55 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +const gtFive = z.bigint().gt(BigInt(5)); +const gteFive = z.bigint().gte(BigInt(5)); +const ltFive = z.bigint().lt(BigInt(5)); +const lteFive = z.bigint().lte(BigInt(5)); +const positive = z.bigint().positive(); +const negative = z.bigint().negative(); +const nonnegative = z.bigint().nonnegative(); +const nonpositive = z.bigint().nonpositive(); +const multipleOfFive = z.bigint().multipleOf(BigInt(5)); + +test("passing validations", () => { + z.bigint().parse(BigInt(1)); + z.bigint().parse(BigInt(0)); + z.bigint().parse(BigInt(-1)); + gtFive.parse(BigInt(6)); + gteFive.parse(BigInt(5)); + gteFive.parse(BigInt(6)); + ltFive.parse(BigInt(4)); + lteFive.parse(BigInt(5)); + lteFive.parse(BigInt(4)); + positive.parse(BigInt(3)); + negative.parse(BigInt(-2)); + nonnegative.parse(BigInt(0)); + nonnegative.parse(BigInt(7)); + nonpositive.parse(BigInt(0)); + nonpositive.parse(BigInt(-12)); + multipleOfFive.parse(BigInt(15)); +}); + +test("failing validations", () => { + expect(() => gtFive.parse(BigInt(5))).toThrow(); + expect(() => gteFive.parse(BigInt(4))).toThrow(); + expect(() => ltFive.parse(BigInt(5))).toThrow(); + expect(() => lteFive.parse(BigInt(6))).toThrow(); + expect(() => positive.parse(BigInt(0))).toThrow(); + expect(() => positive.parse(BigInt(-2))).toThrow(); + expect(() => negative.parse(BigInt(0))).toThrow(); + expect(() => negative.parse(BigInt(3))).toThrow(); + expect(() => nonnegative.parse(BigInt(-1))).toThrow(); + expect(() => nonpositive.parse(BigInt(1))).toThrow(); + expect(() => multipleOfFive.parse(BigInt(13))).toThrow(); +}); + +test("min max getters", () => { + expect(z.bigint().min(BigInt(5)).minValue).toEqual(BigInt(5)); + expect(z.bigint().min(BigInt(5)).min(BigInt(10)).minValue).toEqual(BigInt(10)); + + expect(z.bigint().max(BigInt(5)).maxValue).toEqual(BigInt(5)); + expect(z.bigint().max(BigInt(5)).max(BigInt(1)).maxValue).toEqual(BigInt(1)); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/branded.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/branded.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..b19786cf6bf501e1b23396df08fdfec268cc173f --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/branded.test.ts @@ -0,0 +1,53 @@ +// @ts-ignore TS6133 +import { test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("branded types", () => { + const mySchema = z + .object({ + name: z.string(), + }) + .brand<"superschema">(); + + // simple branding + type MySchema = z.infer; + util.assertEqual(true); + + const doStuff = (arg: MySchema) => arg; + doStuff(mySchema.parse({ name: "hello there" })); + + // inheritance + const extendedSchema = mySchema.brand<"subschema">(); + type ExtendedSchema = z.infer; + util.assertEqual & z.BRAND<"subschema">>(true); + + doStuff(extendedSchema.parse({ name: "hello again" })); + + // number branding + const numberSchema = z.number().brand<42>(); + type NumberSchema = z.infer; + util.assertEqual(true); + + // symbol branding + const MyBrand: unique symbol = Symbol("hello"); + type MyBrand = typeof MyBrand; + const symbolBrand = z.number().brand<"sup">().brand(); + type SymbolBrand = z.infer; + // number & { [z.BRAND]: { sup: true, [MyBrand]: true } } + util.assertEqual & z.BRAND>(true); + + // keeping brands out of input types + const age = z.number().brand<"age">(); + + type Age = z.infer; + type AgeInput = z.input; + + util.assertEqual(false); + util.assertEqual(true); + util.assertEqual, Age>(true); + + // @ts-expect-error + doStuff({ name: "hello there!" }); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/catch.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/catch.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..94d12aa2b8314479e71472f451cba35c7b1c7fcd --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/catch.test.ts @@ -0,0 +1,220 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import { z } from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("basic catch", () => { + expect(z.string().catch("default").parse(undefined)).toBe("default"); +}); + +test("catch fn does not run when parsing succeeds", () => { + let isCalled = false; + const cb = () => { + isCalled = true; + return "asdf"; + }; + expect(z.string().catch(cb).parse("test")).toBe("test"); + expect(isCalled).toEqual(false); +}); + +test("basic catch async", async () => { + const result = await z.string().catch("default").parseAsync(1243); + expect(result).toBe("default"); +}); + +test("catch replace wrong types", () => { + expect(z.string().catch("default").parse(true)).toBe("default"); + expect(z.string().catch("default").parse(true)).toBe("default"); + expect(z.string().catch("default").parse(15)).toBe("default"); + expect(z.string().catch("default").parse([])).toBe("default"); + expect(z.string().catch("default").parse(new Map())).toBe("default"); + expect(z.string().catch("default").parse(new Set())).toBe("default"); + expect(z.string().catch("default").parse({})).toBe("default"); +}); + +test("catch with transform", () => { + const stringWithDefault = z + .string() + .transform((val) => val.toUpperCase()) + .catch("default"); + expect(stringWithDefault.parse(undefined)).toBe("default"); + expect(stringWithDefault.parse(15)).toBe("default"); + expect(stringWithDefault).toBeInstanceOf(z.ZodCatch); + expect(stringWithDefault._def.innerType).toBeInstanceOf(z.ZodEffects); + expect(stringWithDefault._def.innerType._def.schema).toBeInstanceOf(z.ZodSchema); + + type inp = z.input; + util.assertEqual(true); + type out = z.output; + util.assertEqual(true); +}); + +test("catch on existing optional", () => { + const stringWithDefault = z.string().optional().catch("asdf"); + expect(stringWithDefault.parse(undefined)).toBe(undefined); + expect(stringWithDefault.parse(15)).toBe("asdf"); + expect(stringWithDefault).toBeInstanceOf(z.ZodCatch); + expect(stringWithDefault._def.innerType).toBeInstanceOf(z.ZodOptional); + expect(stringWithDefault._def.innerType._def.innerType).toBeInstanceOf(z.ZodString); + + type inp = z.input; + util.assertEqual(true); + type out = z.output; + util.assertEqual(true); +}); + +test("optional on catch", () => { + const stringWithDefault = z.string().catch("asdf").optional(); + + type inp = z.input; + util.assertEqual(true); + type out = z.output; + util.assertEqual(true); +}); + +test("complex chain example", () => { + const complex = z + .string() + .catch("asdf") + .transform((val) => val + "!") + .transform((val) => val.toUpperCase()) + .catch("qwer") + .removeCatch() + .optional() + .catch("asdfasdf"); + + expect(complex.parse("qwer")).toBe("QWER!"); + expect(complex.parse(15)).toBe("ASDF!"); + expect(complex.parse(true)).toBe("ASDF!"); +}); + +test("removeCatch", () => { + const stringWithRemovedDefault = z.string().catch("asdf").removeCatch(); + + type out = z.output; + util.assertEqual(true); +}); + +test("nested", () => { + const inner = z.string().catch("asdf"); + const outer = z.object({ inner }).catch({ + inner: "asdf", + }); + type input = z.input; + util.assertEqual(true); + type out = z.output; + util.assertEqual(true); + expect(outer.parse(undefined)).toEqual({ inner: "asdf" }); + expect(outer.parse({})).toEqual({ inner: "asdf" }); + expect(outer.parse({ inner: undefined })).toEqual({ inner: "asdf" }); +}); + +test("chained catch", () => { + const stringWithDefault = z.string().catch("inner").catch("outer"); + const result = stringWithDefault.parse(undefined); + expect(result).toEqual("inner"); + const resultDiff = stringWithDefault.parse(5); + expect(resultDiff).toEqual("inner"); +}); + +test("factory", () => { + z.ZodCatch.create(z.string(), { + catch: "asdf", + }).parse(undefined); +}); + +test("native enum", () => { + enum Fruits { + apple = "apple", + orange = "orange", + } + + const schema = z.object({ + fruit: z.nativeEnum(Fruits).catch(Fruits.apple), + }); + + expect(schema.parse({})).toEqual({ fruit: Fruits.apple }); + expect(schema.parse({ fruit: 15 })).toEqual({ fruit: Fruits.apple }); +}); + +test("enum", () => { + const schema = z.object({ + fruit: z.enum(["apple", "orange"]).catch("apple"), + }); + + expect(schema.parse({})).toEqual({ fruit: "apple" }); + expect(schema.parse({ fruit: true })).toEqual({ fruit: "apple" }); + expect(schema.parse({ fruit: 15 })).toEqual({ fruit: "apple" }); +}); + +test("reported issues with nested usage", () => { + const schema = z.object({ + string: z.string(), + obj: z.object({ + sub: z.object({ + lit: z.literal("a"), + subCatch: z.number().catch(23), + }), + midCatch: z.number().catch(42), + }), + number: z.number().catch(0), + bool: z.boolean(), + }); + + try { + schema.parse({ + string: {}, + obj: { + sub: { + lit: "b", + subCatch: "24", + }, + midCatch: 444, + }, + number: "", + bool: "yes", + }); + } catch (error) { + const issues = (error as z.ZodError).issues; + + expect(issues.length).toEqual(3); + expect(issues[0].message).toMatch("string"); + expect(issues[1].message).toMatch("literal"); + expect(issues[2].message).toMatch("boolean"); + } +}); + +test("catch error", () => { + let catchError: z.ZodError | undefined = undefined; + + const schema = z.object({ + age: z.number(), + name: z.string().catch((ctx) => { + catchError = ctx.error; + + return "John Doe"; + }), + }); + + const result = schema.safeParse({ + age: null, + name: null, + }); + + expect(result.success).toEqual(false); + expect(!result.success && result.error.issues.length).toEqual(1); + expect(!result.success && result.error.issues[0].message).toMatch("number"); + + expect(catchError).toBeInstanceOf(z.ZodError); + expect(catchError !== undefined && (catchError as z.ZodError).issues.length).toEqual(1); + expect(catchError !== undefined && (catchError as z.ZodError).issues[0].message).toMatch("string"); +}); + +test("ctx.input", () => { + const schema = z.string().catch((ctx) => { + return String(ctx.input); + }); + + expect(schema.parse(123)).toEqual("123"); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/coerce.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/coerce.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..1f5300416a727575e72a68cdcfcee6baad446ef3 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/coerce.test.ts @@ -0,0 +1,133 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +test("string coercion", () => { + const schema = z.coerce.string(); + expect(schema.parse("sup")).toEqual("sup"); + expect(schema.parse("")).toEqual(""); + expect(schema.parse(12)).toEqual("12"); + expect(schema.parse(0)).toEqual("0"); + expect(schema.parse(-12)).toEqual("-12"); + expect(schema.parse(3.14)).toEqual("3.14"); + expect(schema.parse(BigInt(15))).toEqual("15"); + expect(schema.parse(Number.NaN)).toEqual("NaN"); + expect(schema.parse(Number.POSITIVE_INFINITY)).toEqual("Infinity"); + expect(schema.parse(Number.NEGATIVE_INFINITY)).toEqual("-Infinity"); + expect(schema.parse(true)).toEqual("true"); + expect(schema.parse(false)).toEqual("false"); + expect(schema.parse(null)).toEqual("null"); + expect(schema.parse(undefined)).toEqual("undefined"); + expect(schema.parse({ hello: "world!" })).toEqual("[object Object]"); + expect(schema.parse(["item", "another_item"])).toEqual("item,another_item"); + expect(schema.parse([])).toEqual(""); + expect(schema.parse(new Date("2022-01-01T00:00:00.000Z"))).toEqual(new Date("2022-01-01T00:00:00.000Z").toString()); +}); + +test("number coercion", () => { + const schema = z.coerce.number(); + expect(schema.parse("12")).toEqual(12); + expect(schema.parse("0")).toEqual(0); + expect(schema.parse("-12")).toEqual(-12); + expect(schema.parse("3.14")).toEqual(3.14); + expect(schema.parse("")).toEqual(0); + expect(() => schema.parse("NOT_A_NUMBER")).toThrow(); // z.ZodError + expect(schema.parse(12)).toEqual(12); + expect(schema.parse(0)).toEqual(0); + expect(schema.parse(-12)).toEqual(-12); + expect(schema.parse(3.14)).toEqual(3.14); + expect(schema.parse(BigInt(15))).toEqual(15); + expect(() => schema.parse(Number.NaN)).toThrow(); // z.ZodError + expect(schema.parse(Number.POSITIVE_INFINITY)).toEqual(Number.POSITIVE_INFINITY); + expect(schema.parse(Number.NEGATIVE_INFINITY)).toEqual(Number.NEGATIVE_INFINITY); + expect(schema.parse(true)).toEqual(1); + expect(schema.parse(false)).toEqual(0); + expect(schema.parse(null)).toEqual(0); + expect(() => schema.parse(undefined)).toThrow(); // z.ZodError + expect(() => schema.parse({ hello: "world!" })).toThrow(); // z.ZodError + expect(() => schema.parse(["item", "another_item"])).toThrow(); // z.ZodError + expect(schema.parse([])).toEqual(0); + expect(schema.parse(new Date(1670139203496))).toEqual(1670139203496); +}); + +test("boolean coercion", () => { + const schema = z.coerce.boolean(); + expect(schema.parse("true")).toEqual(true); + expect(schema.parse("false")).toEqual(true); + expect(schema.parse("0")).toEqual(true); + expect(schema.parse("1")).toEqual(true); + expect(schema.parse("")).toEqual(false); + expect(schema.parse(1)).toEqual(true); + expect(schema.parse(0)).toEqual(false); + expect(schema.parse(-1)).toEqual(true); + expect(schema.parse(3.14)).toEqual(true); + expect(schema.parse(BigInt(15))).toEqual(true); + expect(schema.parse(Number.NaN)).toEqual(false); + expect(schema.parse(Number.POSITIVE_INFINITY)).toEqual(true); + expect(schema.parse(Number.NEGATIVE_INFINITY)).toEqual(true); + expect(schema.parse(true)).toEqual(true); + expect(schema.parse(false)).toEqual(false); + expect(schema.parse(null)).toEqual(false); + expect(schema.parse(undefined)).toEqual(false); + expect(schema.parse({ hello: "world!" })).toEqual(true); + expect(schema.parse(["item", "another_item"])).toEqual(true); + expect(schema.parse([])).toEqual(true); + expect(schema.parse(new Date(1670139203496))).toEqual(true); +}); + +test("bigint coercion", () => { + const schema = z.coerce.bigint(); + expect(schema.parse("5")).toEqual(BigInt(5)); + expect(schema.parse("0")).toEqual(BigInt(0)); + expect(schema.parse("-5")).toEqual(BigInt(-5)); + expect(() => schema.parse("3.14")).toThrow(); // not a z.ZodError! + expect(schema.parse("")).toEqual(BigInt(0)); + expect(() => schema.parse("NOT_A_NUMBER")).toThrow(); // not a z.ZodError! + expect(schema.parse(5)).toEqual(BigInt(5)); + expect(schema.parse(0)).toEqual(BigInt(0)); + expect(schema.parse(-5)).toEqual(BigInt(-5)); + expect(() => schema.parse(3.14)).toThrow(); // not a z.ZodError! + expect(schema.parse(BigInt(5))).toEqual(BigInt(5)); + expect(() => schema.parse(Number.NaN)).toThrow(); // not a z.ZodError! + expect(() => schema.parse(Number.POSITIVE_INFINITY)).toThrow(); // not a z.ZodError! + expect(() => schema.parse(Number.NEGATIVE_INFINITY)).toThrow(); // not a z.ZodError! + expect(schema.parse(true)).toEqual(BigInt(1)); + expect(schema.parse(false)).toEqual(BigInt(0)); + expect(() => schema.parse(null)).toThrow(); // not a z.ZodError! + expect(() => schema.parse(undefined)).toThrow(); // not a z.ZodError! + expect(() => schema.parse({ hello: "world!" })).toThrow(); // not a z.ZodError! + expect(() => schema.parse(["item", "another_item"])).toThrow(); // not a z.ZodError! + expect(schema.parse([])).toEqual(BigInt(0)); + expect(schema.parse(new Date(1670139203496))).toEqual(BigInt(1670139203496)); +}); + +test("date coercion", () => { + const schema = z.coerce.date(); + expect(schema.parse(new Date().toDateString())).toBeInstanceOf(Date); + expect(schema.parse(new Date().toISOString())).toBeInstanceOf(Date); + expect(schema.parse(new Date().toUTCString())).toBeInstanceOf(Date); + expect(schema.parse("5")).toBeInstanceOf(Date); + expect(schema.parse("2000-01-01")).toBeInstanceOf(Date); + // expect(schema.parse("0")).toBeInstanceOf(Date); + // expect(schema.parse("-5")).toBeInstanceOf(Date); + // expect(schema.parse("3.14")).toBeInstanceOf(Date); + expect(() => schema.parse("")).toThrow(); // z.ZodError + expect(() => schema.parse("NOT_A_DATE")).toThrow(); // z.ZodError + expect(schema.parse(5)).toBeInstanceOf(Date); + expect(schema.parse(0)).toBeInstanceOf(Date); + expect(schema.parse(-5)).toBeInstanceOf(Date); + expect(schema.parse(3.14)).toBeInstanceOf(Date); + expect(() => schema.parse(BigInt(5))).toThrow(); // not a z.ZodError! + expect(() => schema.parse(Number.NaN)).toThrow(); // z.ZodError + expect(() => schema.parse(Number.POSITIVE_INFINITY)).toThrow(); // z.ZodError + expect(() => schema.parse(Number.NEGATIVE_INFINITY)).toThrow(); // z.ZodError + expect(schema.parse(true)).toBeInstanceOf(Date); + expect(schema.parse(false)).toBeInstanceOf(Date); + expect(schema.parse(null)).toBeInstanceOf(Date); + expect(() => schema.parse(undefined)).toThrow(); // z.ZodError + expect(() => schema.parse({ hello: "world!" })).toThrow(); // z.ZodError + expect(() => schema.parse(["item", "another_item"])).toThrow(); // z.ZodError + expect(() => schema.parse([])).toThrow(); // z.ZodError + expect(schema.parse(new Date())).toBeInstanceOf(Date); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/complex.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/complex.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..7807b2b11f550f5323d0e9dffcd23603ee86d28d --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/complex.test.ts @@ -0,0 +1,56 @@ +import { test } from "vitest"; +import * as z from "zod/v3"; + +const crazySchema = z.object({ + tuple: z.tuple([ + z.string().nullable().optional(), + z.number().nullable().optional(), + z.boolean().nullable().optional(), + z.null().nullable().optional(), + z.undefined().nullable().optional(), + z.literal("1234").nullable().optional(), + ]), + merged: z + .object({ + k1: z.string().optional(), + }) + .merge(z.object({ k1: z.string().nullable(), k2: z.number() })), + union: z.array(z.union([z.literal("asdf"), z.literal(12)])).nonempty(), + array: z.array(z.number()), + // sumTransformer: z.transformer(z.array(z.number()), z.number(), (arg) => { + // return arg.reduce((a, b) => a + b, 0); + // }), + sumMinLength: z.array(z.number()).refine((arg) => arg.length > 5), + intersection: z.intersection(z.object({ p1: z.string().optional() }), z.object({ p1: z.number().optional() })), + enum: z.intersection(z.enum(["zero", "one"]), z.enum(["one", "two"])), + nonstrict: z.object({ points: z.number() }).nonstrict(), + numProm: z.promise(z.number()), + lenfun: z.function(z.tuple([z.string()]), z.boolean()), +}); + +// const asyncCrazySchema = crazySchema.extend({ +// // async_transform: z.transformer( +// // z.array(z.number()), +// // z.number(), +// // async (arg) => { +// // return arg.reduce((a, b) => a + b, 0); +// // } +// // ), +// async_refine: z.array(z.number()).refine(async (arg) => arg.length > 5), +// }); + +test("parse", () => { + crazySchema.parse({ + tuple: ["asdf", 1234, true, null, undefined, "1234"], + merged: { k1: "asdf", k2: 12 }, + union: ["asdf", 12, "asdf", 12, "asdf", 12], + array: [12, 15, 16], + // sumTransformer: [12, 15, 16], + sumMinLength: [12, 15, 16, 98, 24, 63], + intersection: {}, + enum: "one", + nonstrict: { points: 1234 }, + numProm: Promise.resolve(12), + lenfun: (x: string) => x.length, + }); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/custom.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/custom.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..b24b6762dcf11e40a69fc96486333e219f96e910 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/custom.test.ts @@ -0,0 +1,31 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +test("passing validations", () => { + const example1 = z.custom((x) => typeof x === "number"); + example1.parse(1234); + expect(() => example1.parse({})).toThrow(); +}); + +test("string params", () => { + const example1 = z.custom((x) => typeof x !== "number", "customerr"); + const result = example1.safeParse(1234); + expect(result.success).toEqual(false); + // @ts-ignore + expect(JSON.stringify(result.error).includes("customerr")).toEqual(true); +}); + +test("async validations", async () => { + const example1 = z.custom(async (x) => { + return typeof x === "number"; + }); + const r1 = await example1.safeParseAsync(1234); + expect(r1.success).toEqual(true); + expect(r1.data).toEqual(1234); + + const r2 = await example1.safeParseAsync("asdf"); + expect(r2.success).toEqual(false); + expect(r2.error!.issues.length).toEqual(1); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/date.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/date.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..c86dc84fc56062af09081fe7e444a9651e8b64b1 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/date.test.ts @@ -0,0 +1,32 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +const beforeBenchmarkDate = new Date(2022, 10, 4); +const benchmarkDate = new Date(2022, 10, 5); +const afterBenchmarkDate = new Date(2022, 10, 6); + +const minCheck = z.date().min(benchmarkDate); +const maxCheck = z.date().max(benchmarkDate); + +test("passing validations", () => { + minCheck.parse(benchmarkDate); + minCheck.parse(afterBenchmarkDate); + + maxCheck.parse(benchmarkDate); + maxCheck.parse(beforeBenchmarkDate); +}); + +test("failing validations", () => { + expect(() => minCheck.parse(beforeBenchmarkDate)).toThrow(); + expect(() => maxCheck.parse(afterBenchmarkDate)).toThrow(); +}); + +test("min max getters", () => { + expect(minCheck.minDate).toEqual(benchmarkDate); + expect(minCheck.min(afterBenchmarkDate).minDate).toEqual(afterBenchmarkDate); + + expect(maxCheck.maxDate).toEqual(benchmarkDate); + expect(maxCheck.max(beforeBenchmarkDate).maxDate).toEqual(beforeBenchmarkDate); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/deepmasking.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/deepmasking.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..d707e79a07f16373480571dd3466d2bce7f14200 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/deepmasking.test.ts @@ -0,0 +1,186 @@ +// @ts-ignore TS6133 +import { test } from "vitest"; + +import * as z from "zod/v3"; + +test("test", () => { + z; +}); + +// const fish = z.object({ +// name: z.string(), +// props: z.object({ +// color: z.string(), +// numScales: z.number(), +// }), +// }); + +// const nonStrict = z +// .object({ +// name: z.string(), +// color: z.string(), +// }) +// .nonstrict(); + +// test('object pick type', () => { +// const modNonStrictFish = nonStrict.omit({ name: true }); +// modNonStrictFish.parse({ color: 'asdf' }); + +// const bad1 = () => fish.pick({ props: { unknown: true } } as any); +// const bad2 = () => fish.omit({ name: true, props: { unknown: true } } as any); + +// expect(bad1).toThrow(); +// expect(bad2).toThrow(); +// }); + +// test('f1', () => { +// const f1 = fish.pick(true); +// f1.parse({ name: 'a', props: { color: 'b', numScales: 3 } }); +// }); +// test('f2', () => { +// const f2 = fish.pick({ props: true }); +// f2.parse({ props: { color: 'asdf', numScales: 1 } }); +// const badcheck2 = () => f2.parse({ name: 'a', props: { color: 'b', numScales: 3 } } as any); +// expect(badcheck2).toThrow(); +// }); +// test('f3', () => { +// const f3 = fish.pick({ props: { color: true } }); +// f3.parse({ props: { color: 'b' } }); +// const badcheck3 = () => f3.parse({ name: 'a', props: { color: 'b', numScales: 3 } } as any); +// expect(badcheck3).toThrow(); +// }); +// test('f4', () => { +// const badcheck4 = () => fish.pick({ props: { color: true, unknown: true } }); +// expect(badcheck4).toThrow(); +// }); +// test('f6', () => { +// const f6 = fish.omit({ props: true }); +// const badcheck6 = () => f6.parse({ name: 'a', props: { color: 'b', numScales: 3 } } as any); +// f6.parse({ name: 'adsf' }); +// expect(badcheck6).toThrow(); +// }); +// test('f7', () => { +// const f7 = fish.omit({ props: { color: true } }); +// f7.parse({ name: 'a', props: { numScales: 3 } }); +// const badcheck7 = () => f7.parse({ name: 'a', props: { color: 'b', numScales: 3 } } as any); +// expect(badcheck7).toThrow(); +// }); +// test('f8', () => { +// const badcheck8 = () => fish.omit({ props: { color: true, unknown: true } }); +// expect(badcheck8).toThrow(); +// }); +// test('f9', () => { +// const f9 = nonStrict.pick(true); +// f9.parse({ name: 'a', color: 'asdf' }); +// }); +// test('f10', () => { +// const f10 = nonStrict.pick({ name: true }); +// f10.parse({ name: 'a' }); +// const val = f10.parse({ name: 'a', color: 'b' }); +// expect(val).toEqual({ name: 'a' }); +// }); +// test('f12', () => { +// const badfcheck12 = () => nonStrict.omit({ color: true, asdf: true }); +// expect(badfcheck12).toThrow(); +// }); + +// test('array masking', () => { +// const fishArray = z.array(fish); +// const modFishArray = fishArray.pick({ +// name: true, +// props: { +// numScales: true, +// }, +// }); + +// modFishArray.parse([{ name: 'fish', props: { numScales: 12 } }]); +// const bad1 = () => modFishArray.parse([{ name: 'fish', props: { numScales: 12, color: 'asdf' } }] as any); +// expect(bad1).toThrow(); +// }); + +// test('array masking', () => { +// const fishArray = z.array(fish); +// const fail = () => +// fishArray.pick({ +// name: true, +// props: { +// whatever: true, +// }, +// } as any); +// expect(fail).toThrow(); +// }); + +// test('array masking', () => { +// const fishArray = z.array(fish); +// const fail = () => +// fishArray.omit({ +// whateve: true, +// } as any); +// expect(fail).toThrow(); +// }); + +// test('array masking', () => { +// const fishArray = z.array(fish); +// const modFishList = fishArray.omit({ +// name: true, +// props: { +// color: true, +// }, +// }); + +// modFishList.parse([{ props: { numScales: 12 } }]); +// const fail = () => modFishList.parse([{ name: 'hello', props: { numScales: 12 } }] as any); +// expect(fail).toThrow(); +// }); + +// test('primitive array masking', () => { +// const fishArray = z.array(z.number()); +// const fail = () => fishArray.pick({} as any); +// expect(fail).toThrow(); +// }); + +// test('other array masking', () => { +// const fishArray = z.array(z.array(z.number())); +// const fail = () => fishArray.pick({} as any); +// expect(fail).toThrow(); +// }); + +// test('invalid mask #1', () => { +// const fail = () => fish.pick(1 as any); +// expect(fail).toThrow(); +// }); + +// test('invalid mask #2', () => { +// const fail = () => fish.pick([] as any); +// expect(fail).toThrow(); +// }); + +// test('invalid mask #3', () => { +// const fail = () => fish.pick(false as any); +// expect(fail).toThrow(); +// }); + +// test('invalid mask #4', () => { +// const fail = () => fish.pick('asdf' as any); +// expect(fail).toThrow(); +// }); + +// test('invalid mask #5', () => { +// const fail = () => fish.omit(1 as any); +// expect(fail).toThrow(); +// }); + +// test('invalid mask #6', () => { +// const fail = () => fish.omit([] as any); +// expect(fail).toThrow(); +// }); + +// test('invalid mask #7', () => { +// const fail = () => fish.omit(false as any); +// expect(fail).toThrow(); +// }); + +// test('invalid mask #8', () => { +// const fail = () => fish.omit('asdf' as any); +// expect(fail).toThrow(); +// }); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/default.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/default.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..29e007c93d030d20b00e7c19da6463e35f20ff37 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/default.test.ts @@ -0,0 +1,112 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import { z } from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("basic defaults", () => { + expect(z.string().default("default").parse(undefined)).toBe("default"); +}); + +test("default with transform", () => { + const stringWithDefault = z + .string() + .transform((val) => val.toUpperCase()) + .default("default"); + expect(stringWithDefault.parse(undefined)).toBe("DEFAULT"); + expect(stringWithDefault).toBeInstanceOf(z.ZodDefault); + expect(stringWithDefault._def.innerType).toBeInstanceOf(z.ZodEffects); + expect(stringWithDefault._def.innerType._def.schema).toBeInstanceOf(z.ZodSchema); + + type inp = z.input; + util.assertEqual(true); + type out = z.output; + util.assertEqual(true); +}); + +test("default on existing optional", () => { + const stringWithDefault = z.string().optional().default("asdf"); + expect(stringWithDefault.parse(undefined)).toBe("asdf"); + expect(stringWithDefault).toBeInstanceOf(z.ZodDefault); + expect(stringWithDefault._def.innerType).toBeInstanceOf(z.ZodOptional); + expect(stringWithDefault._def.innerType._def.innerType).toBeInstanceOf(z.ZodString); + + type inp = z.input; + util.assertEqual(true); + type out = z.output; + util.assertEqual(true); +}); + +test("optional on default", () => { + const stringWithDefault = z.string().default("asdf").optional(); + + type inp = z.input; + util.assertEqual(true); + type out = z.output; + util.assertEqual(true); +}); + +test("complex chain example", () => { + const complex = z + .string() + .default("asdf") + .transform((val) => val.toUpperCase()) + .default("qwer") + .removeDefault() + .optional() + .default("asdfasdf"); + + expect(complex.parse(undefined)).toBe("ASDFASDF"); +}); + +test("removeDefault", () => { + const stringWithRemovedDefault = z.string().default("asdf").removeDefault(); + + type out = z.output; + util.assertEqual(true); +}); + +test("nested", () => { + const inner = z.string().default("asdf"); + const outer = z.object({ inner }).default({ + inner: undefined, + }); + type input = z.input; + util.assertEqual(true); + type out = z.output; + util.assertEqual(true); + expect(outer.parse(undefined)).toEqual({ inner: "asdf" }); + expect(outer.parse({})).toEqual({ inner: "asdf" }); + expect(outer.parse({ inner: undefined })).toEqual({ inner: "asdf" }); +}); + +test("chained defaults", () => { + const stringWithDefault = z.string().default("inner").default("outer"); + const result = stringWithDefault.parse(undefined); + expect(result).toEqual("outer"); +}); + +test("factory", () => { + expect(z.ZodDefault.create(z.string(), { default: "asdf" }).parse(undefined)).toEqual("asdf"); +}); + +test("native enum", () => { + enum Fruits { + apple = "apple", + orange = "orange", + } + + const schema = z.object({ + fruit: z.nativeEnum(Fruits).default(Fruits.apple), + }); + + expect(schema.parse({})).toEqual({ fruit: Fruits.apple }); +}); + +test("enum", () => { + const schema = z.object({ + fruit: z.enum(["apple", "orange"]).default("apple"), + }); + + expect(schema.parse({})).toEqual({ fruit: "apple" }); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/description.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/description.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..1edaa1cc2ee1a575db568d914992944bd9bfd210 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/description.test.ts @@ -0,0 +1,33 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +const description = "a description"; + +test("passing `description` to schema should add a description", () => { + expect(z.string({ description }).description).toEqual(description); + expect(z.number({ description }).description).toEqual(description); + expect(z.boolean({ description }).description).toEqual(description); +}); + +test("`.describe` should add a description", () => { + expect(z.string().describe(description).description).toEqual(description); + expect(z.number().describe(description).description).toEqual(description); + expect(z.boolean().describe(description).description).toEqual(description); +}); + +test("description should carry over to chained schemas", () => { + const schema = z.string({ description }); + expect(schema.description).toEqual(description); + expect(schema.optional().description).toEqual(description); + expect(schema.optional().nullable().default("default").description).toEqual(description); +}); + +test("description should not carry over to chained array schema", () => { + const schema = z.string().describe(description); + + expect(schema.description).toEqual(description); + expect(schema.array().description).toEqual(undefined); + expect(z.array(schema).description).toEqual(undefined); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/discriminated-unions.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/discriminated-unions.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..7fb5cfefe80b18f2c26bee891a47bc8c50153170 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/discriminated-unions.test.ts @@ -0,0 +1,315 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +test("valid", () => { + expect( + z + .discriminatedUnion("type", [ + z.object({ type: z.literal("a"), a: z.string() }), + z.object({ type: z.literal("b"), b: z.string() }), + ]) + .parse({ type: "a", a: "abc" }) + ).toEqual({ type: "a", a: "abc" }); +}); + +test("valid - discriminator value of various primitive types", () => { + const schema = z.discriminatedUnion("type", [ + z.object({ type: z.literal("1"), val: z.literal(1) }), + z.object({ type: z.literal(1), val: z.literal(2) }), + z.object({ type: z.literal(BigInt(1)), val: z.literal(3) }), + z.object({ type: z.literal("true"), val: z.literal(4) }), + z.object({ type: z.literal(true), val: z.literal(5) }), + z.object({ type: z.literal("null"), val: z.literal(6) }), + z.object({ type: z.literal(null), val: z.literal(7) }), + z.object({ type: z.literal("undefined"), val: z.literal(8) }), + z.object({ type: z.literal(undefined), val: z.literal(9) }), + z.object({ type: z.literal("transform"), val: z.literal(10) }), + z.object({ type: z.literal("refine"), val: z.literal(11) }), + z.object({ type: z.literal("superRefine"), val: z.literal(12) }), + ]); + + expect(schema.parse({ type: "1", val: 1 })).toEqual({ type: "1", val: 1 }); + expect(schema.parse({ type: 1, val: 2 })).toEqual({ type: 1, val: 2 }); + expect(schema.parse({ type: BigInt(1), val: 3 })).toEqual({ + type: BigInt(1), + val: 3, + }); + expect(schema.parse({ type: "true", val: 4 })).toEqual({ + type: "true", + val: 4, + }); + expect(schema.parse({ type: true, val: 5 })).toEqual({ + type: true, + val: 5, + }); + expect(schema.parse({ type: "null", val: 6 })).toEqual({ + type: "null", + val: 6, + }); + expect(schema.parse({ type: null, val: 7 })).toEqual({ + type: null, + val: 7, + }); + expect(schema.parse({ type: "undefined", val: 8 })).toEqual({ + type: "undefined", + val: 8, + }); + expect(schema.parse({ type: undefined, val: 9 })).toEqual({ + type: undefined, + val: 9, + }); +}); + +test("invalid - null", () => { + try { + z.discriminatedUnion("type", [ + z.object({ type: z.literal("a"), a: z.string() }), + z.object({ type: z.literal("b"), b: z.string() }), + ]).parse(null); + throw new Error(); + } catch (e: any) { + expect(JSON.parse(e.message)).toEqual([ + { + code: z.ZodIssueCode.invalid_type, + expected: z.ZodParsedType.object, + message: "Expected object, received null", + received: z.ZodParsedType.null, + path: [], + }, + ]); + } +}); + +test("invalid discriminator value", () => { + try { + z.discriminatedUnion("type", [ + z.object({ type: z.literal("a"), a: z.string() }), + z.object({ type: z.literal("b"), b: z.string() }), + ]).parse({ type: "x", a: "abc" }); + throw new Error(); + } catch (e: any) { + expect(JSON.parse(e.message)).toEqual([ + { + code: z.ZodIssueCode.invalid_union_discriminator, + options: ["a", "b"], + message: "Invalid discriminator value. Expected 'a' | 'b'", + path: ["type"], + }, + ]); + } +}); + +test("valid discriminator value, invalid data", () => { + try { + z.discriminatedUnion("type", [ + z.object({ type: z.literal("a"), a: z.string() }), + z.object({ type: z.literal("b"), b: z.string() }), + ]).parse({ type: "a", b: "abc" }); + throw new Error(); + } catch (e: any) { + expect(JSON.parse(e.message)).toEqual([ + { + code: z.ZodIssueCode.invalid_type, + expected: z.ZodParsedType.string, + message: "Required", + path: ["a"], + received: z.ZodParsedType.undefined, + }, + ]); + } +}); + +test("wrong schema - missing discriminator", () => { + try { + z.discriminatedUnion("type", [ + z.object({ type: z.literal("a"), a: z.string() }), + z.object({ b: z.string() }) as any, + ]); + throw new Error(); + } catch (e: any) { + expect(e.message.includes("could not be extracted")).toBe(true); + } +}); + +test("wrong schema - duplicate discriminator values", () => { + try { + z.discriminatedUnion("type", [ + z.object({ type: z.literal("a"), a: z.string() }), + z.object({ type: z.literal("a"), b: z.string() }), + ]); + throw new Error(); + } catch (e: any) { + expect(e.message.includes("has duplicate value")).toEqual(true); + } +}); + +test("async - valid", async () => { + expect( + await z + .discriminatedUnion("type", [ + z.object({ + type: z.literal("a"), + a: z + .string() + .refine(async () => true) + .transform(async (val) => Number(val)), + }), + z.object({ + type: z.literal("b"), + b: z.string(), + }), + ]) + .parseAsync({ type: "a", a: "1" }) + ).toEqual({ type: "a", a: 1 }); +}); + +test("async - invalid", async () => { + try { + await z + .discriminatedUnion("type", [ + z.object({ + type: z.literal("a"), + a: z + .string() + .refine(async () => true) + .transform(async (val) => val), + }), + z.object({ + type: z.literal("b"), + b: z.string(), + }), + ]) + .parseAsync({ type: "a", a: 1 }); + throw new Error(); + } catch (e: any) { + expect(JSON.parse(e.message)).toEqual([ + { + code: "invalid_type", + expected: "string", + received: "number", + path: ["a"], + message: "Expected string, received number", + }, + ]); + } +}); + +test("valid - literals with .default or .preprocess", () => { + const schema = z.discriminatedUnion("type", [ + z.object({ + type: z.literal("foo").default("foo"), + a: z.string(), + }), + z.object({ + type: z.literal("custom"), + method: z.string(), + }), + z.object({ + type: z.preprocess((val) => String(val), z.literal("bar")), + c: z.string(), + }), + ]); + expect(schema.parse({ type: "foo", a: "foo" })).toEqual({ + type: "foo", + a: "foo", + }); +}); + +test("enum and nativeEnum", () => { + enum MyEnum { + d = 0, + e = "e", + } + + const schema = z.discriminatedUnion("key", [ + z.object({ + key: z.literal("a"), + // Add other properties specific to this option + }), + z.object({ + key: z.enum(["b", "c"]), + // Add other properties specific to this option + }), + z.object({ + key: z.nativeEnum(MyEnum), + // Add other properties specific to this option + }), + ]); + + // type schema = z.infer; + + schema.parse({ key: "a" }); + schema.parse({ key: "b" }); + schema.parse({ key: "c" }); + schema.parse({ key: MyEnum.d }); + schema.parse({ key: MyEnum.e }); + schema.parse({ key: "e" }); +}); + +test("branded", () => { + const schema = z.discriminatedUnion("key", [ + z.object({ + key: z.literal("a"), + // Add other properties specific to this option + }), + z.object({ + key: z.literal("b").brand("asdfaf"), + // Add other properties specific to this option + }), + ]); + + // type schema = z.infer; + + schema.parse({ key: "a" }); + schema.parse({ key: "b" }); + expect(() => { + schema.parse({ key: "c" }); + }).toThrow(); +}); + +test("optional and nullable", () => { + const schema = z.discriminatedUnion("key", [ + z.object({ + key: z.literal("a").optional(), + a: z.literal(true), + }), + z.object({ + key: z.literal("b").nullable(), + b: z.literal(true), + // Add other properties specific to this option + }), + ]); + + type schema = z.infer; + z.util.assertEqual(true); + + schema.parse({ key: "a", a: true }); + schema.parse({ key: undefined, a: true }); + schema.parse({ key: "b", b: true }); + schema.parse({ key: null, b: true }); + expect(() => { + schema.parse({ key: null, a: true }); + }).toThrow(); + expect(() => { + schema.parse({ key: "b", a: true }); + }).toThrow(); + + const value = schema.parse({ key: null, b: true }); + + if (!("key" in value)) value.a; + if (value.key === undefined) value.a; + if (value.key === "a") value.a; + if (value.key === "b") value.b; + if (value.key === null) value.b; +}); + +test("readonly array of options", () => { + const options = [ + z.object({ type: z.literal("x"), val: z.literal(1) }), + z.object({ type: z.literal("y"), val: z.literal(2) }), + ] as const; + + expect(z.discriminatedUnion("type", options).parse({ type: "x", val: 1 })).toEqual({ type: "x", val: 1 }); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/enum.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/enum.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..53f4a3e8444766a94563777dc5e9e30d8b2b9fb5 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/enum.test.ts @@ -0,0 +1,80 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("create enum", () => { + const MyEnum = z.enum(["Red", "Green", "Blue"]); + expect(MyEnum.Values.Red).toEqual("Red"); + expect(MyEnum.Enum.Red).toEqual("Red"); + expect(MyEnum.enum.Red).toEqual("Red"); +}); + +test("infer enum", () => { + const MyEnum = z.enum(["Red", "Green", "Blue"]); + type MyEnum = z.infer; + util.assertEqual(true); +}); + +test("get options", () => { + expect(z.enum(["tuna", "trout"]).options).toEqual(["tuna", "trout"]); +}); + +test("readonly enum", () => { + const HTTP_SUCCESS = ["200", "201"] as const; + const arg = z.enum(HTTP_SUCCESS); + type arg = z.infer; + util.assertEqual(true); + + arg.parse("201"); + expect(() => arg.parse("202")).toThrow(); +}); + +test("error params", () => { + const result = z.enum(["test"], { required_error: "REQUIRED" }).safeParse(undefined); + expect(result.success).toEqual(false); + if (!result.success) { + expect(result.error.issues[0].message).toEqual("REQUIRED"); + } +}); + +test("extract/exclude", () => { + const foods = ["Pasta", "Pizza", "Tacos", "Burgers", "Salad"] as const; + const FoodEnum = z.enum(foods); + const ItalianEnum = FoodEnum.extract(["Pasta", "Pizza"]); + const UnhealthyEnum = FoodEnum.exclude(["Salad"]); + const EmptyFoodEnum = FoodEnum.exclude(foods); + + util.assertEqual, "Pasta" | "Pizza">(true); + util.assertEqual, "Pasta" | "Pizza" | "Tacos" | "Burgers">(true); + // @ts-expect-error TS2344 + util.assertEqual>(true); + util.assertEqual, never>(true); +}); + +test("error map in extract/exclude", () => { + const foods = ["Pasta", "Pizza", "Tacos", "Burgers", "Salad"] as const; + const FoodEnum = z.enum(foods, { + errorMap: () => ({ message: "This is not food!" }), + }); + const ItalianEnum = FoodEnum.extract(["Pasta", "Pizza"]); + const foodsError = FoodEnum.safeParse("Cucumbers"); + const italianError = ItalianEnum.safeParse("Tacos"); + if (!foodsError.success && !italianError.success) { + expect(foodsError.error.issues[0].message).toEqual(italianError.error.issues[0].message); + } + + const UnhealthyEnum = FoodEnum.exclude(["Salad"], { + errorMap: () => ({ message: "This is not healthy food!" }), + }); + const unhealthyError = UnhealthyEnum.safeParse("Salad"); + if (!unhealthyError.success) { + expect(unhealthyError.error.issues[0].message).toEqual("This is not healthy food!"); + } +}); + +test("readonly in ZodEnumDef", () => { + let _t!: z.ZodEnumDef; + _t; +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/error.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/error.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..5caaa6d81b34049f0c3467872905b60b1b60438d --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/error.test.ts @@ -0,0 +1,551 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { ZodError, ZodIssueCode } from "../ZodError.js"; +import { ZodParsedType } from "../helpers/util.js"; + +test("error creation", () => { + const err1 = ZodError.create([]); + err1.addIssue({ + code: ZodIssueCode.invalid_type, + expected: ZodParsedType.object, + received: ZodParsedType.string, + path: [], + message: "", + fatal: true, + }); + err1.isEmpty; + + const err2 = ZodError.create(err1.issues); + const err3 = new ZodError([]); + err3.addIssues(err1.issues); + err3.addIssue(err1.issues[0]); + err1.message; + err2.message; + err3.message; +}); + +const errorMap: z.ZodErrorMap = (error, ctx) => { + if (error.code === ZodIssueCode.invalid_type) { + if (error.expected === "string") { + return { message: "bad type!" }; + } + } + if (error.code === ZodIssueCode.custom) { + return { message: `less-than-${error.params?.minimum}` }; + } + return { message: ctx.defaultError }; +}; + +test("type error with custom error map", () => { + try { + z.string().parse(234, { errorMap }); + } catch (err) { + const zerr: z.ZodError = err as any; + + expect(zerr.issues[0].code).toEqual(z.ZodIssueCode.invalid_type); + expect(zerr.issues[0].message).toEqual(`bad type!`); + } +}); + +test("refinement fail with params", () => { + try { + z.number() + .refine((val) => val >= 3, { + params: { minimum: 3 }, + }) + .parse(2, { errorMap }); + } catch (err) { + const zerr: z.ZodError = err as any; + expect(zerr.issues[0].code).toEqual(z.ZodIssueCode.custom); + expect(zerr.issues[0].message).toEqual(`less-than-3`); + } +}); + +test("custom error with custom errormap", () => { + try { + z.string() + .refine((val) => val.length > 12, { + params: { minimum: 13 }, + message: "override", + }) + .parse("asdf", { errorMap }); + } catch (err) { + const zerr: z.ZodError = err as any; + expect(zerr.issues[0].message).toEqual("override"); + } +}); + +test("default error message", () => { + try { + z.number() + .refine((x) => x > 3) + .parse(2); + } catch (err) { + const zerr: z.ZodError = err as any; + expect(zerr.issues.length).toEqual(1); + expect(zerr.issues[0].message).toEqual("Invalid input"); + } +}); + +test("override error in refine", () => { + try { + z.number() + .refine((x) => x > 3, "override") + .parse(2); + } catch (err) { + const zerr: z.ZodError = err as any; + expect(zerr.issues.length).toEqual(1); + expect(zerr.issues[0].message).toEqual("override"); + } +}); + +test("override error in refinement", () => { + try { + z.number() + .refine((x) => x > 3, { + message: "override", + }) + .parse(2); + } catch (err) { + const zerr: z.ZodError = err as any; + expect(zerr.issues.length).toEqual(1); + expect(zerr.issues[0].message).toEqual("override"); + } +}); + +test("array minimum", () => { + try { + z.array(z.string()).min(3, "tooshort").parse(["asdf", "qwer"]); + } catch (err) { + const zerr: ZodError = err as any; + expect(zerr.issues[0].code).toEqual(ZodIssueCode.too_small); + expect(zerr.issues[0].message).toEqual("tooshort"); + } + try { + z.array(z.string()).min(3).parse(["asdf", "qwer"]); + } catch (err) { + const zerr: ZodError = err as any; + expect(zerr.issues[0].code).toEqual(ZodIssueCode.too_small); + expect(zerr.issues[0].message).toEqual(`Array must contain at least 3 element(s)`); + } +}); + +// implement test for semi-smart union logic that checks for type error on either left or right +// test("union smart errors", () => { +// // expect.assertions(2); + +// const p1 = z +// .union([z.string(), z.number().refine((x) => x > 0)]) +// .safeParse(-3.2); + +// if (p1.success === true) throw new Error(); +// expect(p1.success).toBe(false); +// expect(p1.error.issues[0].code).toEqual(ZodIssueCode.custom); + +// const p2 = z.union([z.string(), z.number()]).safeParse(false); +// // .catch(err => expect(err.issues[0].code).toEqual(ZodIssueCode.invalid_union)); +// if (p2.success === true) throw new Error(); +// expect(p2.success).toBe(false); +// expect(p2.error.issues[0].code).toEqual(ZodIssueCode.invalid_union); +// }); + +test("custom path in custom error map", () => { + const schema = z.object({ + items: z.array(z.string()).refine((data) => data.length > 3, { + path: ["items-too-few"], + }), + }); + + const errorMap: z.ZodErrorMap = (error) => { + expect(error.path.length).toBe(2); + return { message: "doesnt matter" }; + }; + const result = schema.safeParse({ items: ["first"] }, { errorMap }); + expect(result.success).toEqual(false); + if (!result.success) { + expect(result.error.issues[0].path).toEqual(["items", "items-too-few"]); + } +}); + +test("error metadata from value", () => { + const dynamicRefine = z.string().refine( + (val) => val === val.toUpperCase(), + (val) => ({ params: { val } }) + ); + + const result = dynamicRefine.safeParse("asdf"); + expect(result.success).toEqual(false); + if (!result.success) { + const sub = result.error.issues[0]; + expect(result.error.issues[0].code).toEqual("custom"); + if (sub.code === "custom") { + expect(sub.params!.val).toEqual("asdf"); + } + } +}); + +// test("don't call refine after validation failed", () => { +// const asdf = z +// .union([ +// z.number(), +// z.string().transform(z.number(), (val) => { +// return parseFloat(val); +// }), +// ]) +// .refine((v) => v >= 1); + +// expect(() => asdf.safeParse("foo")).not.toThrow(); +// }); + +test("root level formatting", () => { + const schema = z.string().email(); + const result = schema.safeParse("asdfsdf"); + expect(result.success).toEqual(false); + if (!result.success) { + expect(result.error.format()._errors).toEqual(["Invalid email"]); + } +}); + +test("custom path", () => { + const schema = z + .object({ + password: z.string(), + confirm: z.string(), + }) + .refine((val) => val.confirm === val.password, { path: ["confirm"] }); + + const result = schema.safeParse({ + password: "peanuts", + confirm: "qeanuts", + }); + + expect(result.success).toEqual(false); + if (!result.success) { + // nested errors + const error = result.error.format(); + expect(error._errors).toEqual([]); + expect(error.password?._errors).toEqual(undefined); + expect(error.confirm?._errors).toEqual(["Invalid input"]); + } +}); + +test("custom path", () => { + const schema = z + .object({ + password: z.string().min(6), + confirm: z.string().min(6), + }) + .refine((val) => val.confirm === val.password); + + const result = schema.safeParse({ + password: "qwer", + confirm: "asdf", + }); + + expect(result.success).toEqual(false); + if (!result.success) { + expect(result.error.issues.length).toEqual(3); + } +}); + +const schema = z.object({ + inner: z.object({ + name: z + .string() + .refine((val) => val.length > 5) + .array() + .refine((val) => val.length <= 1), + }), +}); + +test("no abort early on refinements", () => { + const invalidItem = { + inner: { name: ["aasd", "asdfasdfasfd"] }, + }; + + const result1 = schema.safeParse(invalidItem); + expect(result1.success).toEqual(false); + if (!result1.success) { + expect(result1.error.issues.length).toEqual(2); + } +}); +test("formatting", () => { + const invalidItem = { + inner: { name: ["aasd", "asdfasdfasfd"] }, + }; + const invalidArray = { + inner: { name: ["asdfasdf", "asdfasdfasfd"] }, + }; + const result1 = schema.safeParse(invalidItem); + const result2 = schema.safeParse(invalidArray); + + expect(result1.success).toEqual(false); + expect(result2.success).toEqual(false); + if (!result1.success) { + const error = result1.error.format(); + + expect(error._errors).toEqual([]); + expect(error.inner?._errors).toEqual([]); + // expect(error.inner?.name?._errors).toEqual(["Invalid input"]); + // expect(error.inner?.name?.[0]._errors).toEqual(["Invalid input"]); + expect(error.inner?.name?.[1]).toEqual(undefined); + } + if (!result2.success) { + type FormattedError = z.inferFormattedError; + const error: FormattedError = result2.error.format(); + expect(error._errors).toEqual([]); + expect(error.inner?._errors).toEqual([]); + expect(error.inner?.name?._errors).toEqual(["Invalid input"]); + expect(error.inner?.name?.[0]).toEqual(undefined); + expect(error.inner?.name?.[1]).toEqual(undefined); + expect(error.inner?.name?.[2]).toEqual(undefined); + } + + // test custom mapper + if (!result2.success) { + type FormattedError = z.inferFormattedError; + const error: FormattedError = result2.error.format(() => 5); + expect(error._errors).toEqual([]); + expect(error.inner?._errors).toEqual([]); + expect(error.inner?.name?._errors).toEqual([5]); + } +}); + +test("formatting with nullable and optional fields", () => { + const nameSchema = z.string().refine((val) => val.length > 5); + const schema = z.object({ + nullableObject: z.object({ name: nameSchema }).nullable(), + nullableArray: z.array(nameSchema).nullable(), + nullableTuple: z.tuple([nameSchema, nameSchema, z.number()]).nullable(), + optionalObject: z.object({ name: nameSchema }).optional(), + optionalArray: z.array(nameSchema).optional(), + optionalTuple: z.tuple([nameSchema, nameSchema, z.number()]).optional(), + }); + const invalidItem = { + nullableObject: { name: "abcd" }, + nullableArray: ["abcd"], + nullableTuple: ["abcd", "abcd", 1], + optionalObject: { name: "abcd" }, + optionalArray: ["abcd"], + optionalTuple: ["abcd", "abcd", 1], + }; + const result = schema.safeParse(invalidItem); + expect(result.success).toEqual(false); + if (!result.success) { + type FormattedError = z.inferFormattedError; + const error: FormattedError = result.error.format(); + expect(error._errors).toEqual([]); + expect(error.nullableObject?._errors).toEqual([]); + expect(error.nullableObject?.name?._errors).toEqual(["Invalid input"]); + expect(error.nullableArray?._errors).toEqual([]); + expect(error.nullableArray?.[0]?._errors).toEqual(["Invalid input"]); + expect(error.nullableTuple?._errors).toEqual([]); + expect(error.nullableTuple?.[0]?._errors).toEqual(["Invalid input"]); + expect(error.nullableTuple?.[1]?._errors).toEqual(["Invalid input"]); + expect(error.optionalObject?._errors).toEqual([]); + expect(error.optionalObject?.name?._errors).toEqual(["Invalid input"]); + expect(error.optionalArray?._errors).toEqual([]); + expect(error.optionalArray?.[0]?._errors).toEqual(["Invalid input"]); + expect(error.optionalTuple?._errors).toEqual([]); + expect(error.optionalTuple?.[0]?._errors).toEqual(["Invalid input"]); + expect(error.optionalTuple?.[1]?._errors).toEqual(["Invalid input"]); + } +}); + +const stringWithCustomError = z.string({ + errorMap: (issue, ctx) => ({ + message: issue.code === "invalid_type" ? (ctx.data ? "Invalid name" : "Name is required") : ctx.defaultError, + }), +}); + +test("schema-bound error map", () => { + const result = stringWithCustomError.safeParse(1234); + expect(result.success).toEqual(false); + if (!result.success) { + expect(result.error.issues[0].message).toEqual("Invalid name"); + } + + const result2 = stringWithCustomError.safeParse(undefined); + expect(result2.success).toEqual(false); + if (!result2.success) { + expect(result2.error.issues[0].message).toEqual("Name is required"); + } + + // support contextual override + const result3 = stringWithCustomError.safeParse(undefined, { + errorMap: () => ({ message: "OVERRIDE" }), + }); + expect(result3.success).toEqual(false); + if (!result3.success) { + expect(result3.error.issues[0].message).toEqual("OVERRIDE"); + } +}); + +test("overrideErrorMap", () => { + // support overrideErrorMap + z.setErrorMap(() => ({ message: "OVERRIDE" })); + const result4 = stringWithCustomError.min(10).safeParse("tooshort"); + expect(result4.success).toEqual(false); + if (!result4.success) { + expect(result4.error.issues[0].message).toEqual("OVERRIDE"); + } + z.setErrorMap(z.defaultErrorMap); +}); + +test("invalid and required", () => { + const str = z.string({ + invalid_type_error: "Invalid name", + required_error: "Name is required", + }); + const result1 = str.safeParse(1234); + expect(result1.success).toEqual(false); + if (!result1.success) { + expect(result1.error.issues[0].message).toEqual("Invalid name"); + } + const result2 = str.safeParse(undefined); + expect(result2.success).toEqual(false); + if (!result2.success) { + expect(result2.error.issues[0].message).toEqual("Name is required"); + } +}); + +test("Fallback to default required error", () => { + const str = z.string({ + invalid_type_error: "Invalid name", + // required_error: "Name is required", + }); + + const result2 = str.safeParse(undefined); + expect(result2.success).toEqual(false); + if (!result2.success) { + expect(result2.error.issues[0].message).toEqual("Required"); + } +}); + +test("invalid and required and errorMap", () => { + expect(() => { + return z.string({ + invalid_type_error: "Invalid name", + required_error: "Name is required", + errorMap: () => ({ message: "OVERRIDE" }), + }); + }).toThrow(); +}); + +test("strict error message", () => { + const errorMsg = "Invalid object"; + const obj = z.object({ x: z.string() }).strict(errorMsg); + const result = obj.safeParse({ x: "a", y: "b" }); + expect(result.success).toEqual(false); + if (!result.success) { + expect(result.error.issues[0].message).toEqual(errorMsg); + } +}); + +test("enum error message, invalid enum elementstring", () => { + try { + z.enum(["Tuna", "Trout"]).parse("Salmon"); + } catch (err) { + const zerr: z.ZodError = err as any; + expect(zerr.issues.length).toEqual(1); + expect(zerr.issues[0].message).toEqual("Invalid enum value. Expected 'Tuna' | 'Trout', received 'Salmon'"); + } +}); + +test("enum error message, invalid type", () => { + try { + z.enum(["Tuna", "Trout"]).parse(12); + } catch (err) { + const zerr: z.ZodError = err as any; + expect(zerr.issues.length).toEqual(1); + expect(zerr.issues[0].message).toEqual("Expected 'Tuna' | 'Trout', received number"); + } +}); + +test("nativeEnum default error message", () => { + enum Fish { + Tuna = "Tuna", + Trout = "Trout", + } + try { + z.nativeEnum(Fish).parse("Salmon"); + } catch (err) { + const zerr: z.ZodError = err as any; + expect(zerr.issues.length).toEqual(1); + expect(zerr.issues[0].message).toEqual("Invalid enum value. Expected 'Tuna' | 'Trout', received 'Salmon'"); + } +}); + +test("literal default error message", () => { + try { + z.literal("Tuna").parse("Trout"); + } catch (err) { + const zerr: z.ZodError = err as any; + expect(zerr.issues.length).toEqual(1); + expect(zerr.issues[0].message).toEqual(`Invalid literal value, expected "Tuna"`); + } +}); + +test("literal bigint default error message", () => { + try { + z.literal(BigInt(12)).parse(BigInt(13)); + } catch (err) { + const zerr: z.ZodError = err as any; + expect(zerr.issues.length).toEqual(1); + expect(zerr.issues[0].message).toEqual(`Invalid literal value, expected "12"`); + } +}); + +test("enum with message returns the custom error message", () => { + const schema = z.enum(["apple", "banana"], { + message: "the value provided is invalid", + }); + + const result1 = schema.safeParse("berries"); + expect(result1.success).toEqual(false); + if (!result1.success) { + expect(result1.error.issues[0].message).toEqual("the value provided is invalid"); + } + + const result2 = schema.safeParse(undefined); + expect(result2.success).toEqual(false); + if (!result2.success) { + expect(result2.error.issues[0].message).toEqual("the value provided is invalid"); + } + + const result3 = schema.safeParse("banana"); + expect(result3.success).toEqual(true); + + const result4 = schema.safeParse(null); + expect(result4.success).toEqual(false); + if (!result4.success) { + expect(result4.error.issues[0].message).toEqual("the value provided is invalid"); + } +}); + +test("when the message is falsy, it is used as is provided", () => { + const schema = z.string().max(1, { message: "" }); + const result = schema.safeParse("asdf"); + expect(result.success).toEqual(false); + if (!result.success) { + expect(result.error.issues[0].message).toEqual(""); + } +}); + +// test("dont short circuit on continuable errors", () => { +// const user = z +// .object({ +// password: z.string().min(6), +// confirm: z.string(), +// }) +// .refine((data) => data.password === data.confirm, { +// message: "Passwords don't match", +// path: ["confirm"], +// }); +// const result = user.safeParse({ password: "asdf", confirm: "qwer" }); +// if (!result.success) { +// expect(result.error.issues.length).toEqual(2); +// } +// }); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/firstparty.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/firstparty.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..017a1c13e48a2570642ce99d66b345020e3ca0aa --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/firstparty.test.ts @@ -0,0 +1,87 @@ +// @ts-ignore TS6133 +import { test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("first party switch", () => { + const myType = z.string() as z.ZodFirstPartySchemaTypes; + const def = myType._def; + + switch (def.typeName) { + case z.ZodFirstPartyTypeKind.ZodString: + break; + case z.ZodFirstPartyTypeKind.ZodNumber: + break; + case z.ZodFirstPartyTypeKind.ZodNaN: + break; + case z.ZodFirstPartyTypeKind.ZodBigInt: + break; + case z.ZodFirstPartyTypeKind.ZodBoolean: + break; + case z.ZodFirstPartyTypeKind.ZodDate: + break; + case z.ZodFirstPartyTypeKind.ZodUndefined: + break; + case z.ZodFirstPartyTypeKind.ZodNull: + break; + case z.ZodFirstPartyTypeKind.ZodAny: + break; + case z.ZodFirstPartyTypeKind.ZodUnknown: + break; + case z.ZodFirstPartyTypeKind.ZodNever: + break; + case z.ZodFirstPartyTypeKind.ZodVoid: + break; + case z.ZodFirstPartyTypeKind.ZodArray: + break; + case z.ZodFirstPartyTypeKind.ZodObject: + break; + case z.ZodFirstPartyTypeKind.ZodUnion: + break; + case z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: + break; + case z.ZodFirstPartyTypeKind.ZodIntersection: + break; + case z.ZodFirstPartyTypeKind.ZodTuple: + break; + case z.ZodFirstPartyTypeKind.ZodRecord: + break; + case z.ZodFirstPartyTypeKind.ZodMap: + break; + case z.ZodFirstPartyTypeKind.ZodSet: + break; + case z.ZodFirstPartyTypeKind.ZodFunction: + break; + case z.ZodFirstPartyTypeKind.ZodLazy: + break; + case z.ZodFirstPartyTypeKind.ZodLiteral: + break; + case z.ZodFirstPartyTypeKind.ZodEnum: + break; + case z.ZodFirstPartyTypeKind.ZodEffects: + break; + case z.ZodFirstPartyTypeKind.ZodNativeEnum: + break; + case z.ZodFirstPartyTypeKind.ZodOptional: + break; + case z.ZodFirstPartyTypeKind.ZodNullable: + break; + case z.ZodFirstPartyTypeKind.ZodDefault: + break; + case z.ZodFirstPartyTypeKind.ZodCatch: + break; + case z.ZodFirstPartyTypeKind.ZodPromise: + break; + case z.ZodFirstPartyTypeKind.ZodBranded: + break; + case z.ZodFirstPartyTypeKind.ZodPipeline: + break; + case z.ZodFirstPartyTypeKind.ZodSymbol: + break; + case z.ZodFirstPartyTypeKind.ZodReadonly: + break; + default: + util.assertNever(def); + } +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..ad397d8b8eb5ea9df3bf7af27662cf073fd5f2d9 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts @@ -0,0 +1,21 @@ +// @ts-ignore TS6133 +import { test } from "vitest"; + +import type { ZodFirstPartySchemaTypes, ZodFirstPartyTypeKind } from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("Identify missing [ZodFirstPartySchemaTypes]", () => { + type ZodFirstPartySchemaForType = ZodFirstPartySchemaTypes extends infer Schema + ? Schema extends { _def: { typeName: T } } + ? Schema + : never + : never; + type ZodMappedTypes = { + [key in ZodFirstPartyTypeKind]: ZodFirstPartySchemaForType; + }; + type ZodFirstPartySchemaTypesMissingFromUnion = keyof { + [key in keyof ZodMappedTypes as ZodMappedTypes[key] extends { _def: never } ? key : never]: unknown; + }; + + util.assertEqual(true); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/function.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/function.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..a0f03bb5c15574b403ac0cc30d7f305121476c84 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/function.test.ts @@ -0,0 +1,257 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +const args1 = z.tuple([z.string()]); +const returns1 = z.number(); +const func1 = z.function(args1, returns1); + +test("function parsing", () => { + const parsed = func1.parse((arg: any) => arg.length); + parsed("asdf"); +}); + +test("parsed function fail 1", () => { + const parsed = func1.parse((x: string) => x); + expect(() => parsed("asdf")).toThrow(); +}); + +test("parsed function fail 2", () => { + const parsed = func1.parse((x: string) => x); + expect(() => parsed(13 as any)).toThrow(); +}); + +test("function inference 1", () => { + type func1 = z.TypeOf; + util.assertEqual number>(true); +}); + +test("method parsing", () => { + const methodObject = z.object({ + property: z.number(), + method: z.function().args(z.string()).returns(z.number()), + }); + const methodInstance = { + property: 3, + method: function (s: string) { + return s.length + this.property; + }, + }; + const parsed = methodObject.parse(methodInstance); + expect(parsed.method("length=8")).toBe(11); // 8 length + 3 property +}); + +test("async method parsing", async () => { + const methodObject = z.object({ + property: z.number(), + method: z.function().args(z.string()).returns(z.promise(z.number())), + }); + const methodInstance = { + property: 3, + method: async function (s: string) { + return s.length + this.property; + }, + }; + const parsed = methodObject.parse(methodInstance); + expect(await parsed.method("length=8")).toBe(11); // 8 length + 3 property +}); + +test("args method", () => { + const t1 = z.function(); + type t1 = z.infer; + util.assertEqual unknown>(true); + + const t2 = t1.args(z.string()); + type t2 = z.infer; + util.assertEqual unknown>(true); + + const t3 = t2.returns(z.boolean()); + type t3 = z.infer; + util.assertEqual boolean>(true); +}); + +const args2 = z.tuple([ + z.object({ + f1: z.number(), + f2: z.string().nullable(), + f3: z.array(z.boolean().optional()).optional(), + }), +]); +const returns2 = z.union([z.string(), z.number()]); + +const func2 = z.function(args2, returns2); + +test("function inference 2", () => { + type func2 = z.TypeOf; + util.assertEqual< + func2, + (arg: { + f1: number; + f2: string | null; + f3?: (boolean | undefined)[] | undefined; + }) => string | number + >(true); +}); + +test("valid function run", () => { + const validFunc2Instance = func2.validate((_x) => { + return "adf" as any; + }); + + const checker = () => { + validFunc2Instance({ + f1: 21, + f2: "asdf", + f3: [true, false], + }); + }; + + checker(); +}); + +test("input validation error", () => { + const invalidFuncInstance = func2.validate((_x) => { + return "adf" as any; + }); + + const checker = () => { + invalidFuncInstance("Invalid_input" as any); + }; + + expect(checker).toThrow(); +}); + +test("output validation error", () => { + const invalidFuncInstance = func2.validate((_x) => { + return ["this", "is", "not", "valid", "output"] as any; + }); + + const checker = () => { + invalidFuncInstance({ + f1: 21, + f2: "asdf", + f3: [true, false], + }); + }; + + expect(checker).toThrow(); +}); + +z.function(z.tuple([z.string()])).args()._def.args; + +test("special function error codes", () => { + const checker = z.function(z.tuple([z.string()]), z.boolean()).implement((arg) => { + return arg.length as any; + }); + try { + checker("12" as any); + } catch (err) { + const zerr = err as z.ZodError; + const first = zerr.issues[0]; + if (first.code !== z.ZodIssueCode.invalid_return_type) throw new Error(); + + expect(first.returnTypeError).toBeInstanceOf(z.ZodError); + } + + try { + checker(12 as any); + } catch (err) { + const zerr = err as z.ZodError; + const first = zerr.issues[0]; + if (first.code !== z.ZodIssueCode.invalid_arguments) throw new Error(); + expect(first.argumentsError).toBeInstanceOf(z.ZodError); + } +}); + +test("function with async refinements", async () => { + const func = z + .function() + .args(z.string().refine(async (val) => val.length > 10)) + .returns(z.promise(z.number().refine(async (val) => val > 10))) + .implement(async (val) => { + return val.length; + }); + const results = []; + try { + await func("asdfasdf"); + results.push("success"); + } catch (_err) { + results.push("fail"); + } + try { + await func("asdflkjasdflkjsf"); + results.push("success"); + } catch (_err) { + results.push("fail"); + } + + expect(results).toEqual(["fail", "success"]); +}); + +test("non async function with async refinements should fail", async () => { + const func = z + .function() + .args(z.string().refine(async (val) => val.length > 10)) + .returns(z.number().refine(async (val) => val > 10)) + .implement((val) => { + return val.length; + }); + + const results = []; + try { + await func("asdasdfasdffasdf"); + results.push("success"); + } catch (_err) { + results.push("fail"); + } + + expect(results).toEqual(["fail"]); +}); + +test("allow extra parameters", () => { + const maxLength5 = z + .function() + .args(z.string()) + .returns(z.boolean()) + .implement((str, _arg, _qewr) => { + return str.length <= 5; + }); + + const filteredList = ["apple", "orange", "pear", "banana", "strawberry"].filter(maxLength5); + expect(filteredList.length).toEqual(2); +}); + +test("params and returnType getters", () => { + const func = z.function().args(z.string()).returns(z.string()); + + func.parameters().items[0].parse("asdf"); + func.returnType().parse("asdf"); +}); + +test("inference with transforms", () => { + const funcSchema = z + .function() + .args(z.string().transform((val) => val.length)) + .returns(z.object({ val: z.number() })); + const myFunc = funcSchema.implement((val) => { + return { val, extra: "stuff" }; + }); + myFunc("asdf"); + + util.assertEqual { val: number; extra: string }>(true); +}); + +test("fallback to OuterTypeOfFunction", () => { + const funcSchema = z + .function() + .args(z.string().transform((val) => val.length)) + .returns(z.object({ arg: z.number() }).transform((val) => val.arg)); + + const myFunc = funcSchema.implement((val) => { + return { arg: val, arg2: false }; + }); + + util.assertEqual number>(true); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/generics.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/generics.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0af470f07639a56497f748d520db2d13b82c56c --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/generics.test.ts @@ -0,0 +1,48 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("generics", () => { + async function stripOuter(schema: TData, data: unknown) { + return z + .object({ + nested: schema, // as z.ZodTypeAny, + }) + .transform((data) => { + return data.nested!; + }) + .parse({ nested: data }); + } + + const result = stripOuter(z.object({ a: z.string() }), { a: "asdf" }); + util.assertEqual>(true); +}); + +// test("assignability", () => { +// const createSchemaAndParse = ( +// key: K, +// valueSchema: VS, +// data: unknown +// ) => { +// const schema = z.object({ +// [key]: valueSchema, +// } as { [k in K]: VS }); +// return { [key]: valueSchema }; +// const parsed = schema.parse(data); +// return parsed; +// // const inferred: z.infer> = parsed; +// // return inferred; +// }; +// const parsed = createSchemaAndParse("foo", z.string(), { foo: "" }); +// util.assertEqual(true); +// }); + +test("nested no undefined", () => { + const inner = z.string().or(z.array(z.string())); + const outer = z.object({ inner }); + type outerSchema = z.infer; + z.util.assertEqual(true); + expect(outer.safeParse({ inner: undefined }).success).toEqual(false); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/instanceof.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/instanceof.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..de66f3f09f9127d970f431d7d54e12d9a38e0f43 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/instanceof.test.ts @@ -0,0 +1,37 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("instanceof", async () => { + class Test {} + class Subtest extends Test {} + abstract class AbstractBar { + constructor(public val: string) {} + } + class Bar extends AbstractBar {} + + const TestSchema = z.instanceof(Test); + const SubtestSchema = z.instanceof(Subtest); + const AbstractSchema = z.instanceof(AbstractBar); + const BarSchema = z.instanceof(Bar); + + TestSchema.parse(new Test()); + TestSchema.parse(new Subtest()); + SubtestSchema.parse(new Subtest()); + AbstractSchema.parse(new Bar("asdf")); + const bar = BarSchema.parse(new Bar("asdf")); + expect(bar.val).toEqual("asdf"); + + await expect(() => SubtestSchema.parse(new Test())).toThrow(/Input not instance of Subtest/); + await expect(() => TestSchema.parse(12)).toThrow(/Input not instance of Test/); + + util.assertEqual>(true); +}); + +test("instanceof fatal", () => { + const schema = z.instanceof(Date).refine((d) => d.toString()); + const res = schema.safeParse(null); + expect(res.success).toBe(false); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/intersection.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/intersection.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..6d7936c199ca6202d32b84d47fe17719c68511b3 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/intersection.test.ts @@ -0,0 +1,110 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +test("object intersection", () => { + const BaseTeacher = z.object({ + subjects: z.array(z.string()), + }); + const HasID = z.object({ id: z.string() }); + + const Teacher = z.intersection(BaseTeacher.passthrough(), HasID); // BaseTeacher.merge(HasID); + const data = { + subjects: ["math"], + id: "asdfasdf", + }; + expect(Teacher.parse(data)).toEqual(data); + expect(() => Teacher.parse({ subject: data.subjects })).toThrow(); + expect(Teacher.parse({ ...data, extra: 12 })).toEqual({ ...data, extra: 12 }); + + expect(() => z.intersection(BaseTeacher.strict(), HasID).parse({ ...data, extra: 12 })).toThrow(); +}); + +test("deep intersection", () => { + const Animal = z.object({ + properties: z.object({ + is_animal: z.boolean(), + }), + }); + const Cat = z + .object({ + properties: z.object({ + jumped: z.boolean(), + }), + }) + .and(Animal); + + type _Cat = z.infer; + // const cat:Cat = 'asdf' as any; + const cat = Cat.parse({ properties: { is_animal: true, jumped: true } }); + expect(cat.properties).toEqual({ is_animal: true, jumped: true }); +}); + +test("deep intersection of arrays", async () => { + const Author = z.object({ + posts: z.array( + z.object({ + post_id: z.number(), + }) + ), + }); + const Registry = z + .object({ + posts: z.array( + z.object({ + title: z.string(), + }) + ), + }) + .and(Author); + + const posts = [ + { post_id: 1, title: "Novels" }, + { post_id: 2, title: "Fairy tales" }, + ]; + const cat = Registry.parse({ posts }); + expect(cat.posts).toEqual(posts); + const asyncCat = await Registry.parseAsync({ posts }); + expect(asyncCat.posts).toEqual(posts); +}); + +test("invalid intersection types", async () => { + const numberIntersection = z.intersection( + z.number(), + z.number().transform((x) => x + 1) + ); + + const syncResult = numberIntersection.safeParse(1234); + expect(syncResult.success).toEqual(false); + if (!syncResult.success) { + expect(syncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types); + } + + const asyncResult = await numberIntersection.spa(1234); + expect(asyncResult.success).toEqual(false); + if (!asyncResult.success) { + expect(asyncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types); + } +}); + +test("invalid array merge", async () => { + const stringArrInt = z.intersection( + z.string().array(), + z + .string() + .array() + .transform((val) => [...val, "asdf"]) + ); + const syncResult = stringArrInt.safeParse(["asdf", "qwer"]); + expect(syncResult.success).toEqual(false); + if (!syncResult.success) { + expect(syncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types); + } + + const asyncResult = await stringArrInt.spa(["asdf", "qwer"]); + expect(asyncResult.success).toEqual(false); + if (!asyncResult.success) { + expect(asyncResult.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_intersection_types); + } +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/language-server.source.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/language-server.source.ts new file mode 100644 index 0000000000000000000000000000000000000000..cbe818bb3783a8d625a9c6fa8eb08c0db6829b77 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/language-server.source.ts @@ -0,0 +1,76 @@ +import * as z from "zod/v3"; + +export const filePath = __filename; + +// z.object() + +export const Test = z.object({ + f1: z.number(), +}); + +export type Test = z.infer; + +export const instanceOfTest: Test = { + f1: 1, +}; + +// z.object().merge() + +export const TestMerge = z + .object({ + f2: z.string().optional(), + }) + .merge(Test); + +export type TestMerge = z.infer; + +export const instanceOfTestMerge: TestMerge = { + f1: 1, + f2: "string", +}; + +// z.union() + +export const TestUnion = z.union([ + z.object({ + f2: z.string().optional(), + }), + Test, +]); + +export type TestUnion = z.infer; + +export const instanceOfTestUnion: TestUnion = { + f1: 1, + f2: "string", +}; + +// z.object().partial() + +export const TestPartial = Test.partial(); + +export type TestPartial = z.infer; + +export const instanceOfTestPartial: TestPartial = { + f1: 1, +}; + +// z.object().pick() + +export const TestPick = TestMerge.pick({ f1: true }); + +export type TestPick = z.infer; + +export const instanceOfTestPick: TestPick = { + f1: 1, +}; + +// z.object().omit() + +export const TestOmit = TestMerge.omit({ f2: true }); + +export type TestOmit = z.infer; + +export const instanceOfTestOmit: TestOmit = { + f1: 1, +}; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/language-server.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/language-server.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..851fdc483925537d0479ad506e9db521e5217810 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/language-server.test.ts @@ -0,0 +1,207 @@ +import { test } from "vitest"; +// import path from "path"; +// import { Node, Project, SyntaxKind } from "ts-morph"; + +// import { filePath } from "./language-server.source"; + +// The following tool is helpful for understanding the TypeScript AST associated with these tests: +// https://ts-ast-viewer.com/ (just copy the contents of language-server.source into the viewer) + +test("", () => {}); +// describe("Executing Go To Definition (and therefore Find Usages and Rename Refactoring) using an IDE works on inferred object properties", () => { +// // Compile file developmentEnvironment.source +// const project = new Project({ +// tsConfigFilePath: path.join(__dirname, "..", "..", "tsconfig.json"), +// skipAddingFilesFromTsConfig: true, +// }); +// const sourceFile = project.addSourceFileAtPath(filePath); + +// test("works for object properties inferred from z.object()", () => { +// // Find usage of Test.f1 property +// const instanceVariable = +// sourceFile.getVariableDeclarationOrThrow("instanceOfTest"); +// const propertyBeingAssigned = getPropertyBeingAssigned( +// instanceVariable, +// "f1" +// ); + +// // Find definition of Test.f1 property +// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; +// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( +// SyntaxKind.VariableDeclaration +// ); + +// // Assert that find definition returned the Zod definition of Test +// expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); +// expect(parentOfProperty?.getName()).toEqual("Test"); +// }); + +// // test("works for first object properties inferred from z.object().merge()", () => { +// // // Find usage of TestMerge.f1 property +// // const instanceVariable = sourceFile.getVariableDeclarationOrThrow( +// // "instanceOfTestMerge" +// // ); +// // const propertyBeingAssigned = getPropertyBeingAssigned( +// // instanceVariable, +// // "f1" +// // ); + +// // // Find definition of TestMerge.f1 property +// // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; +// // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( +// // SyntaxKind.VariableDeclaration +// // ); + +// // // Assert that find definition returned the Zod definition of Test +// // expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); +// // expect(parentOfProperty?.getName()).toEqual("Test"); +// // }); + +// // test("works for second object properties inferred from z.object().merge()", () => { +// // // Find usage of TestMerge.f2 property +// // const instanceVariable = sourceFile.getVariableDeclarationOrThrow( +// // "instanceOfTestMerge" +// // ); +// // const propertyBeingAssigned = getPropertyBeingAssigned( +// // instanceVariable, +// // "f2" +// // ); + +// // // Find definition of TestMerge.f2 property +// // const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; +// // const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( +// // SyntaxKind.VariableDeclaration +// // ); + +// // // Assert that find definition returned the Zod definition of TestMerge +// // expect(definitionOfProperty?.getText()).toEqual( +// // "f2: z.string().optional()" +// // ); +// // expect(parentOfProperty?.getName()).toEqual("TestMerge"); +// // }); + +// test("works for first object properties inferred from z.union()", () => { +// // Find usage of TestUnion.f1 property +// const instanceVariable = sourceFile.getVariableDeclarationOrThrow( +// "instanceOfTestUnion" +// ); +// const propertyBeingAssigned = getPropertyBeingAssigned( +// instanceVariable, +// "f1" +// ); + +// // Find definition of TestUnion.f1 property +// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; +// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( +// SyntaxKind.VariableDeclaration +// ); + +// // Assert that find definition returned the Zod definition of Test +// expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); +// expect(parentOfProperty?.getName()).toEqual("Test"); +// }); + +// test("works for second object properties inferred from z.union()", () => { +// // Find usage of TestUnion.f2 property +// const instanceVariable = sourceFile.getVariableDeclarationOrThrow( +// "instanceOfTestUnion" +// ); +// const propertyBeingAssigned = getPropertyBeingAssigned( +// instanceVariable, +// "f2" +// ); + +// // Find definition of TestUnion.f2 property +// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; +// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( +// SyntaxKind.VariableDeclaration +// ); + +// // Assert that find definition returned the Zod definition of TestUnion +// expect(definitionOfProperty?.getText()).toEqual( +// "f2: z.string().optional()" +// ); +// expect(parentOfProperty?.getName()).toEqual("TestUnion"); +// }); + +// test("works for object properties inferred from z.object().partial()", () => { +// // Find usage of TestPartial.f1 property +// const instanceVariable = sourceFile.getVariableDeclarationOrThrow( +// "instanceOfTestPartial" +// ); +// const propertyBeingAssigned = getPropertyBeingAssigned( +// instanceVariable, +// "f1" +// ); + +// // Find definition of TestPartial.f1 property +// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; +// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( +// SyntaxKind.VariableDeclaration +// ); + +// // Assert that find definition returned the Zod definition of Test +// expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); +// expect(parentOfProperty?.getName()).toEqual("Test"); +// }); + +// test("works for object properties inferred from z.object().pick()", () => { +// // Find usage of TestPick.f1 property +// const instanceVariable = +// sourceFile.getVariableDeclarationOrThrow("instanceOfTestPick"); +// const propertyBeingAssigned = getPropertyBeingAssigned( +// instanceVariable, +// "f1" +// ); + +// // Find definition of TestPick.f1 property +// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; +// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( +// SyntaxKind.VariableDeclaration +// ); + +// // Assert that find definition returned the Zod definition of Test +// expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); +// expect(parentOfProperty?.getName()).toEqual("Test"); +// }); + +// test("works for object properties inferred from z.object().omit()", () => { +// // Find usage of TestOmit.f1 property +// const instanceVariable = +// sourceFile.getVariableDeclarationOrThrow("instanceOfTestOmit"); +// const propertyBeingAssigned = getPropertyBeingAssigned( +// instanceVariable, +// "f1" +// ); + +// // Find definition of TestOmit.f1 property +// const definitionOfProperty = propertyBeingAssigned?.getDefinitionNodes()[0]; +// const parentOfProperty = definitionOfProperty?.getFirstAncestorByKind( +// SyntaxKind.VariableDeclaration +// ); + +// // Assert that find definition returned the Zod definition of Test +// expect(definitionOfProperty?.getText()).toEqual("f1: z.number()"); +// expect(parentOfProperty?.getName()).toEqual("Test"); +// }); +// }); + +// const getPropertyBeingAssigned = (node: Node, name: string) => { +// const propertyAssignment = node.forEachDescendant((descendent) => +// Node.isPropertyAssignment(descendent) && descendent.getName() == name +// ? descendent +// : undefined +// ); + +// if (propertyAssignment == null) +// fail(`Could not find property assignment with name ${name}`); + +// const propertyLiteral = propertyAssignment.getFirstDescendantByKind( +// SyntaxKind.Identifier +// ); + +// if (propertyLiteral == null) +// fail(`Could not find property literal with name ${name}`); + +// return propertyLiteral; +// }; diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/literal.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/literal.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..d166a24f2daccb9b46d90a058398be7ba9c1b2a0 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/literal.test.ts @@ -0,0 +1,36 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +const literalTuna = z.literal("tuna"); +const literalFortyTwo = z.literal(42); +const literalTrue = z.literal(true); + +const terrificSymbol = Symbol("terrific"); +const literalTerrificSymbol = z.literal(terrificSymbol); + +test("passing validations", () => { + literalTuna.parse("tuna"); + literalFortyTwo.parse(42); + literalTrue.parse(true); + literalTerrificSymbol.parse(terrificSymbol); +}); + +test("failing validations", () => { + expect(() => literalTuna.parse("shark")).toThrow(); + expect(() => literalFortyTwo.parse(43)).toThrow(); + expect(() => literalTrue.parse(false)).toThrow(); + expect(() => literalTerrificSymbol.parse(Symbol("terrific"))).toThrow(); +}); + +test("invalid_literal should have `received` field with data", () => { + const data = "shark"; + const result = literalTuna.safeParse(data); + if (!result.success) { + const issue = result.error.issues[0]; + if (issue.code === "invalid_literal") { + expect(issue.received).toBe(data); + } + } +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/map.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/map.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..94718190376b4779f786f1f307a67c5a00460581 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/map.test.ts @@ -0,0 +1,110 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { ZodIssueCode } from "zod/v3"; +import { util } from "../helpers/util.js"; + +const stringMap = z.map(z.string(), z.string()); +type stringMap = z.infer; + +test("type inference", () => { + util.assertEqual>(true); +}); + +test("valid parse", () => { + const result = stringMap.safeParse( + new Map([ + ["first", "foo"], + ["second", "bar"], + ]) + ); + expect(result.success).toEqual(true); + if (result.success) { + expect(result.data.has("first")).toEqual(true); + expect(result.data.has("second")).toEqual(true); + expect(result.data.get("first")).toEqual("foo"); + expect(result.data.get("second")).toEqual("bar"); + } +}); + +test("valid parse async", async () => { + const result = await stringMap.spa( + new Map([ + ["first", "foo"], + ["second", "bar"], + ]) + ); + expect(result.success).toEqual(true); + if (result.success) { + expect(result.data.has("first")).toEqual(true); + expect(result.data.has("second")).toEqual(true); + expect(result.data.get("first")).toEqual("foo"); + expect(result.data.get("second")).toEqual("bar"); + } +}); + +test("throws when a Set is given", () => { + const result = stringMap.safeParse(new Set([])); + expect(result.success).toEqual(false); + if (result.success === false) { + expect(result.error.issues.length).toEqual(1); + expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type); + } +}); + +test("throws when the given map has invalid key and invalid input", () => { + const result = stringMap.safeParse(new Map([[42, Symbol()]])); + expect(result.success).toEqual(false); + if (result.success === false) { + expect(result.error.issues.length).toEqual(2); + expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type); + expect(result.error.issues[0].path).toEqual([0, "key"]); + expect(result.error.issues[1].code).toEqual(ZodIssueCode.invalid_type); + expect(result.error.issues[1].path).toEqual([0, "value"]); + } +}); + +test("throws when the given map has multiple invalid entries", () => { + // const result = stringMap.safeParse(new Map([[42, Symbol()]])); + + const result = stringMap.safeParse( + new Map([ + [1, "foo"], + ["bar", 2], + ] as [any, any][]) as Map + ); + + // const result = stringMap.safeParse(new Map([[42, Symbol()]])); + expect(result.success).toEqual(false); + if (result.success === false) { + expect(result.error.issues.length).toEqual(2); + expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type); + expect(result.error.issues[0].path).toEqual([0, "key"]); + expect(result.error.issues[1].code).toEqual(ZodIssueCode.invalid_type); + expect(result.error.issues[1].path).toEqual([1, "value"]); + } +}); + +test("dirty", async () => { + const map = z.map( + z.string().refine((val) => val === val.toUpperCase(), { + message: "Keys must be uppercase", + }), + z.string() + ); + const result = await map.spa( + new Map([ + ["first", "foo"], + ["second", "bar"], + ]) + ); + expect(result.success).toEqual(false); + if (!result.success) { + expect(result.error.issues.length).toEqual(2); + expect(result.error.issues[0].code).toEqual(z.ZodIssueCode.custom); + expect(result.error.issues[0].message).toEqual("Keys must be uppercase"); + expect(result.error.issues[1].code).toEqual(z.ZodIssueCode.custom); + expect(result.error.issues[1].message).toEqual("Keys must be uppercase"); + } +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/masking.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/masking.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..63817e2c1afe2302e00a6d2d39f7902a30d84769 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/masking.test.ts @@ -0,0 +1,4 @@ +// @ts-ignore TS6133 +import { test } from "vitest"; + +test("masking test", () => {}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/mocker.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/mocker.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..3a2506b90c150550707e55aa4a5c98b368b9482a --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/mocker.test.ts @@ -0,0 +1,19 @@ +// @ts-ignore TS6133 +import { test } from "vitest"; + +import { Mocker } from "./Mocker.js"; + +test("mocker", () => { + const mocker = new Mocker(); + mocker.string; + mocker.number; + mocker.boolean; + mocker.null; + mocker.undefined; + mocker.stringOptional; + mocker.stringNullable; + mocker.numberOptional; + mocker.numberNullable; + mocker.booleanOptional; + mocker.booleanNullable; +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/nan.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/nan.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..e24567abca5787e01cfc1437137d537ef00ba98a --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/nan.test.ts @@ -0,0 +1,21 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +const schema = z.nan(); + +test("passing validations", () => { + schema.parse(Number.NaN); + schema.parse(Number("Not a number")); +}); + +test("failing validations", () => { + expect(() => schema.parse(5)).toThrow(); + expect(() => schema.parse("John")).toThrow(); + expect(() => schema.parse(true)).toThrow(); + expect(() => schema.parse(null)).toThrow(); + expect(() => schema.parse(undefined)).toThrow(); + expect(() => schema.parse({})).toThrow(); + expect(() => schema.parse([])).toThrow(); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/nativeEnum.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/nativeEnum.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..61eb37a13284eb83b09b742f29236c9c2f358895 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/nativeEnum.test.ts @@ -0,0 +1,87 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("nativeEnum test with consts", () => { + const Fruits: { Apple: "apple"; Banana: "banana" } = { + Apple: "apple", + Banana: "banana", + }; + const fruitEnum = z.nativeEnum(Fruits); + type fruitEnum = z.infer; + fruitEnum.parse("apple"); + fruitEnum.parse("banana"); + fruitEnum.parse(Fruits.Apple); + fruitEnum.parse(Fruits.Banana); + util.assertEqual(true); +}); + +test("nativeEnum test with real enum", () => { + enum Fruits { + Apple = "apple", + Banana = "banana", + } + // @ts-ignore + const fruitEnum = z.nativeEnum(Fruits); + type fruitEnum = z.infer; + fruitEnum.parse("apple"); + fruitEnum.parse("banana"); + fruitEnum.parse(Fruits.Apple); + fruitEnum.parse(Fruits.Banana); + util.assertIs(true); +}); + +test("nativeEnum test with const with numeric keys", () => { + const FruitValues = { + Apple: 10, + Banana: 20, + // @ts-ignore + } as const; + const fruitEnum = z.nativeEnum(FruitValues); + type fruitEnum = z.infer; + fruitEnum.parse(10); + fruitEnum.parse(20); + fruitEnum.parse(FruitValues.Apple); + fruitEnum.parse(FruitValues.Banana); + util.assertEqual(true); +}); + +test("from enum", () => { + enum Fruits { + Cantaloupe = 0, + Apple = "apple", + Banana = "banana", + } + + const FruitEnum = z.nativeEnum(Fruits as any); + type _FruitEnum = z.infer; + FruitEnum.parse(Fruits.Cantaloupe); + FruitEnum.parse(Fruits.Apple); + FruitEnum.parse("apple"); + FruitEnum.parse(0); + expect(() => FruitEnum.parse(1)).toThrow(); + expect(() => FruitEnum.parse("Apple")).toThrow(); + expect(() => FruitEnum.parse("Cantaloupe")).toThrow(); +}); + +test("from const", () => { + const Greek = { + Alpha: "a", + Beta: "b", + Gamma: 3, + // @ts-ignore + } as const; + + const GreekEnum = z.nativeEnum(Greek); + type _GreekEnum = z.infer; + GreekEnum.parse("a"); + GreekEnum.parse("b"); + GreekEnum.parse(3); + expect(() => GreekEnum.parse("v")).toThrow(); + expect(() => GreekEnum.parse("Alpha")).toThrow(); + expect(() => GreekEnum.parse(2)).toThrow(); + + expect(GreekEnum.enum.Alpha).toEqual("a"); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/nullable.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/nullable.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..90c1eed4df2dea25db691c505ea9fa6a781e7886 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/nullable.test.ts @@ -0,0 +1,42 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +function checkErrors(a: z.ZodTypeAny, bad: any) { + let expected: any; + try { + a.parse(bad); + } catch (error) { + expected = (error as z.ZodError).formErrors; + } + try { + a.nullable().parse(bad); + } catch (error) { + expect((error as z.ZodError).formErrors).toEqual(expected); + } +} + +test("Should have error messages appropriate for the underlying type", () => { + checkErrors(z.string().min(2), 1); + z.string().min(2).nullable().parse(null); + checkErrors(z.number().gte(2), 1); + z.number().gte(2).nullable().parse(null); + checkErrors(z.boolean(), ""); + z.boolean().nullable().parse(null); + checkErrors(z.null(), null); + z.null().nullable().parse(null); + checkErrors(z.null(), {}); + z.null().nullable().parse(null); + checkErrors(z.object({}), 1); + z.object({}).nullable().parse(null); + checkErrors(z.tuple([]), 1); + z.tuple([]).nullable().parse(null); + checkErrors(z.unknown(), 1); + z.unknown().nullable().parse(null); +}); + +test("unwrap", () => { + const unwrapped = z.string().nullable().unwrap(); + expect(unwrapped).toBeInstanceOf(z.ZodString); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/number.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/number.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..db3f73b2df8fd71f2bee3ac6570eab8019214280 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/number.test.ts @@ -0,0 +1,176 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +const gtFive = z.number().gt(5); +const gteFive = z.number().gte(-5).gte(5); +const minFive = z.number().min(0).min(5); +const ltFive = z.number().lte(10).lt(5); +const lteFive = z.number().lte(5); +const maxFive = z.number().max(10).max(5); +const intNum = z.number().int(); +const positive = z.number().positive(); +const negative = z.number().negative(); +const nonpositive = z.number().nonpositive(); +const nonnegative = z.number().nonnegative(); +const multipleOfFive = z.number().multipleOf(5); +const multipleOfNegativeFive = z.number().multipleOf(-5); +const finite = z.number().finite(); +const safe = z.number().safe(); +const stepPointOne = z.number().step(0.1); +const stepPointZeroZeroZeroOne = z.number().step(0.0001); +const stepSixPointFour = z.number().step(6.4); + +test("passing validations", () => { + z.number().parse(1); + z.number().parse(1.5); + z.number().parse(0); + z.number().parse(-1.5); + z.number().parse(-1); + z.number().parse(Number.POSITIVE_INFINITY); + z.number().parse(Number.NEGATIVE_INFINITY); + gtFive.parse(6); + gtFive.parse(Number.POSITIVE_INFINITY); + gteFive.parse(5); + gteFive.parse(Number.POSITIVE_INFINITY); + minFive.parse(5); + minFive.parse(Number.POSITIVE_INFINITY); + ltFive.parse(4); + ltFive.parse(Number.NEGATIVE_INFINITY); + lteFive.parse(5); + lteFive.parse(Number.NEGATIVE_INFINITY); + maxFive.parse(5); + maxFive.parse(Number.NEGATIVE_INFINITY); + intNum.parse(4); + positive.parse(1); + positive.parse(Number.POSITIVE_INFINITY); + negative.parse(-1); + negative.parse(Number.NEGATIVE_INFINITY); + nonpositive.parse(0); + nonpositive.parse(-1); + nonpositive.parse(Number.NEGATIVE_INFINITY); + nonnegative.parse(0); + nonnegative.parse(1); + nonnegative.parse(Number.POSITIVE_INFINITY); + multipleOfFive.parse(15); + multipleOfFive.parse(-15); + multipleOfNegativeFive.parse(-15); + multipleOfNegativeFive.parse(15); + finite.parse(123); + safe.parse(Number.MIN_SAFE_INTEGER); + safe.parse(Number.MAX_SAFE_INTEGER); + stepPointOne.parse(6); + stepPointOne.parse(6.1); + stepPointOne.parse(6.1); + stepSixPointFour.parse(12.8); + stepPointZeroZeroZeroOne.parse(3.01); +}); + +test("failing validations", () => { + expect(() => ltFive.parse(5)).toThrow(); + expect(() => lteFive.parse(6)).toThrow(); + expect(() => maxFive.parse(6)).toThrow(); + expect(() => gtFive.parse(5)).toThrow(); + expect(() => gteFive.parse(4)).toThrow(); + expect(() => minFive.parse(4)).toThrow(); + expect(() => intNum.parse(3.14)).toThrow(); + expect(() => positive.parse(0)).toThrow(); + expect(() => positive.parse(-1)).toThrow(); + expect(() => negative.parse(0)).toThrow(); + expect(() => negative.parse(1)).toThrow(); + expect(() => nonpositive.parse(1)).toThrow(); + expect(() => nonnegative.parse(-1)).toThrow(); + expect(() => multipleOfFive.parse(7.5)).toThrow(); + expect(() => multipleOfFive.parse(-7.5)).toThrow(); + expect(() => multipleOfNegativeFive.parse(-7.5)).toThrow(); + expect(() => multipleOfNegativeFive.parse(7.5)).toThrow(); + expect(() => finite.parse(Number.POSITIVE_INFINITY)).toThrow(); + expect(() => finite.parse(Number.NEGATIVE_INFINITY)).toThrow(); + expect(() => safe.parse(Number.MIN_SAFE_INTEGER - 1)).toThrow(); + expect(() => safe.parse(Number.MAX_SAFE_INTEGER + 1)).toThrow(); + + expect(() => stepPointOne.parse(6.11)).toThrow(); + expect(() => stepPointOne.parse(6.1000000001)).toThrow(); + expect(() => stepSixPointFour.parse(6.41)).toThrow(); +}); + +test("parse NaN", () => { + expect(() => z.number().parse(Number.NaN)).toThrow(); +}); + +test("min max getters", () => { + expect(z.number().minValue).toBeNull; + expect(ltFive.minValue).toBeNull; + expect(lteFive.minValue).toBeNull; + expect(maxFive.minValue).toBeNull; + expect(negative.minValue).toBeNull; + expect(nonpositive.minValue).toBeNull; + expect(intNum.minValue).toBeNull; + expect(multipleOfFive.minValue).toBeNull; + expect(finite.minValue).toBeNull; + expect(gtFive.minValue).toEqual(5); + expect(gteFive.minValue).toEqual(5); + expect(minFive.minValue).toEqual(5); + expect(minFive.min(10).minValue).toEqual(10); + expect(positive.minValue).toEqual(0); + expect(nonnegative.minValue).toEqual(0); + expect(safe.minValue).toEqual(Number.MIN_SAFE_INTEGER); + + expect(z.number().maxValue).toBeNull; + expect(gtFive.maxValue).toBeNull; + expect(gteFive.maxValue).toBeNull; + expect(minFive.maxValue).toBeNull; + expect(positive.maxValue).toBeNull; + expect(nonnegative.maxValue).toBeNull; + expect(intNum.minValue).toBeNull; + expect(multipleOfFive.minValue).toBeNull; + expect(finite.minValue).toBeNull; + expect(ltFive.maxValue).toEqual(5); + expect(lteFive.maxValue).toEqual(5); + expect(maxFive.maxValue).toEqual(5); + expect(maxFive.max(1).maxValue).toEqual(1); + expect(negative.maxValue).toEqual(0); + expect(nonpositive.maxValue).toEqual(0); + expect(safe.maxValue).toEqual(Number.MAX_SAFE_INTEGER); +}); + +test("int getter", () => { + expect(z.number().isInt).toEqual(false); + expect(z.number().multipleOf(1.5).isInt).toEqual(false); + expect(gtFive.isInt).toEqual(false); + expect(gteFive.isInt).toEqual(false); + expect(minFive.isInt).toEqual(false); + expect(positive.isInt).toEqual(false); + expect(nonnegative.isInt).toEqual(false); + expect(finite.isInt).toEqual(false); + expect(ltFive.isInt).toEqual(false); + expect(lteFive.isInt).toEqual(false); + expect(maxFive.isInt).toEqual(false); + expect(negative.isInt).toEqual(false); + expect(nonpositive.isInt).toEqual(false); + expect(safe.isInt).toEqual(false); + + expect(intNum.isInt).toEqual(true); + expect(multipleOfFive.isInt).toEqual(true); +}); + +test("finite getter", () => { + expect(z.number().isFinite).toEqual(false); + expect(gtFive.isFinite).toEqual(false); + expect(gteFive.isFinite).toEqual(false); + expect(minFive.isFinite).toEqual(false); + expect(positive.isFinite).toEqual(false); + expect(nonnegative.isFinite).toEqual(false); + expect(ltFive.isFinite).toEqual(false); + expect(lteFive.isFinite).toEqual(false); + expect(maxFive.isFinite).toEqual(false); + expect(negative.isFinite).toEqual(false); + expect(nonpositive.isFinite).toEqual(false); + + expect(finite.isFinite).toEqual(true); + expect(intNum.isFinite).toEqual(true); + expect(multipleOfFive.isFinite).toEqual(true); + expect(z.number().min(5).max(10).isFinite).toEqual(true); + expect(safe.isFinite).toEqual(true); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/object-augmentation.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/object-augmentation.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..964ea3dae0c3fb7f3977f9af973876c9f54c9403 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/object-augmentation.test.ts @@ -0,0 +1,29 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +test("object augmentation", () => { + const Animal = z + .object({ + species: z.string(), + }) + .augment({ + population: z.number(), + }); + // overwrites `species` + const ModifiedAnimal = Animal.augment({ + species: z.array(z.string()), + }); + ModifiedAnimal.parse({ + species: ["asd"], + population: 1324, + }); + + const bad = () => + ModifiedAnimal.parse({ + species: "asdf", + population: 1324, + } as any); + expect(bad).toThrow(); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..293ebf0c7271051986306daf531a04afe85c85e0 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts @@ -0,0 +1,29 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +const RealSet = Set; +const RealMap = Map; +const RealDate = Date; + +test("doesn’t throw when Date is undefined", () => { + delete (globalThis as any).Date; + const result = z.object({}).safeParse({}); + expect(result.success).toEqual(true); + globalThis.Date = RealDate; +}); + +test("doesn’t throw when Set is undefined", () => { + delete (globalThis as any).Set; + const result = z.object({}).safeParse({}); + expect(result.success).toEqual(true); + globalThis.Set = RealSet; +}); + +test("doesn’t throw when Map is undefined", () => { + delete (globalThis as any).Map; + const result = z.object({}).safeParse({}); + expect(result.success).toEqual(true); + globalThis.Map = RealMap; +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/object.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/object.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..d8772d4f9843870dd5e7aa6ed62ab2971a995d7f --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/object.test.ts @@ -0,0 +1,434 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +const Test = z.object({ + f1: z.number(), + f2: z.string().optional(), + f3: z.string().nullable(), + f4: z.array(z.object({ t: z.union([z.string(), z.boolean()]) })), +}); + +test("object type inference", () => { + type TestType = { + f1: number; + f2?: string | undefined; + f3: string | null; + f4: { t: string | boolean }[]; + }; + + util.assertEqual, TestType>(true); +}); + +test("unknown throw", () => { + const asdf: unknown = 35; + expect(() => Test.parse(asdf)).toThrow(); +}); + +test("shape() should return schema of particular key", () => { + const f1Schema = Test.shape.f1; + const f2Schema = Test.shape.f2; + const f3Schema = Test.shape.f3; + const f4Schema = Test.shape.f4; + + expect(f1Schema).toBeInstanceOf(z.ZodNumber); + expect(f2Schema).toBeInstanceOf(z.ZodOptional); + expect(f3Schema).toBeInstanceOf(z.ZodNullable); + expect(f4Schema).toBeInstanceOf(z.ZodArray); +}); + +test("correct parsing", () => { + Test.parse({ + f1: 12, + f2: "string", + f3: "string", + f4: [ + { + t: "string", + }, + ], + }); + + Test.parse({ + f1: 12, + f3: null, + f4: [ + { + t: false, + }, + ], + }); +}); + +test("incorrect #1", () => { + expect(() => Test.parse({} as any)).toThrow(); +}); + +test("nonstrict by default", () => { + z.object({ points: z.number() }).parse({ + points: 2314, + unknown: "asdf", + }); +}); + +const data = { + points: 2314, + unknown: "asdf", +}; + +test("strip by default", () => { + const val = z.object({ points: z.number() }).parse(data); + expect(val).toEqual({ points: 2314 }); +}); + +test("unknownkeys override", () => { + const val = z.object({ points: z.number() }).strict().passthrough().strip().nonstrict().parse(data); + + expect(val).toEqual(data); +}); + +test("passthrough unknown", () => { + const val = z.object({ points: z.number() }).passthrough().parse(data); + + expect(val).toEqual(data); +}); + +test("strip unknown", () => { + const val = z.object({ points: z.number() }).strip().parse(data); + + expect(val).toEqual({ points: 2314 }); +}); + +test("strict", () => { + const val = z.object({ points: z.number() }).strict().safeParse(data); + + expect(val.success).toEqual(false); +}); + +test("catchall inference", () => { + const o1 = z + .object({ + first: z.string(), + }) + .catchall(z.number()); + + const d1 = o1.parse({ first: "asdf", num: 1243 }); + util.assertEqual(true); + util.assertEqual(true); +}); + +test("catchall overrides strict", () => { + const o1 = z.object({ first: z.string().optional() }).strict().catchall(z.number()); + + // should run fine + // setting a catchall overrides the unknownKeys behavior + o1.parse({ + asdf: 1234, + }); + + // should only run catchall validation + // against unknown keys + o1.parse({ + first: "asdf", + asdf: 1234, + }); +}); + +test("catchall overrides strict", () => { + const o1 = z + .object({ + first: z.string(), + }) + .strict() + .catchall(z.number()); + + // should run fine + // setting a catchall overrides the unknownKeys behavior + o1.parse({ + first: "asdf", + asdf: 1234, + }); +}); + +test("test that optional keys are unset", async () => { + const SNamedEntity = z.object({ + id: z.string(), + set: z.string().optional(), + unset: z.string().optional(), + }); + const result = await SNamedEntity.parse({ + id: "asdf", + set: undefined, + }); + // eslint-disable-next-line ban/ban + expect(Object.keys(result)).toEqual(["id", "set"]); +}); + +test("test catchall parsing", async () => { + const result = z.object({ name: z.string() }).catchall(z.number()).parse({ name: "Foo", validExtraKey: 61 }); + + expect(result).toEqual({ name: "Foo", validExtraKey: 61 }); + + const result2 = z + .object({ name: z.string() }) + .catchall(z.number()) + .safeParse({ name: "Foo", validExtraKey: 61, invalid: "asdf" }); + + expect(result2.success).toEqual(false); +}); + +test("test nonexistent keys", async () => { + const Schema = z.union([z.object({ a: z.string() }), z.object({ b: z.number() })]); + const obj = { a: "A" }; + const result = await Schema.spa(obj); // Works with 1.11.10, breaks with 2.0.0-beta.21 + expect(result.success).toBe(true); +}); + +test("test async union", async () => { + const Schema2 = z.union([ + z.object({ + ty: z.string(), + }), + z.object({ + ty: z.number(), + }), + ]); + + const obj = { ty: "A" }; + const result = await Schema2.spa(obj); // Works with 1.11.10, breaks with 2.0.0-beta.21 + expect(result.success).toEqual(true); +}); + +test("test inferred merged type", async () => { + const asdf = z.object({ a: z.string() }).merge(z.object({ a: z.number() })); + type asdf = z.infer; + util.assertEqual(true); +}); + +test("inferred merged object type with optional properties", async () => { + const Merged = z + .object({ a: z.string(), b: z.string().optional() }) + .merge(z.object({ a: z.string().optional(), b: z.string() })); + type Merged = z.infer; + util.assertEqual(true); + // todo + // util.assertEqual(true); +}); + +test("inferred unioned object type with optional properties", async () => { + const Unioned = z.union([ + z.object({ a: z.string(), b: z.string().optional() }), + z.object({ a: z.string().optional(), b: z.string() }), + ]); + type Unioned = z.infer; + util.assertEqual(true); +}); + +test("inferred enum type", async () => { + const Enum = z.object({ a: z.string(), b: z.string().optional() }).keyof(); + + expect(Enum.Values).toEqual({ + a: "a", + b: "b", + }); + expect(Enum.enum).toEqual({ + a: "a", + b: "b", + }); + expect(Enum._def.values).toEqual(["a", "b"]); + type Enum = z.infer; + util.assertEqual(true); +}); + +test("inferred partial object type with optional properties", async () => { + const Partial = z.object({ a: z.string(), b: z.string().optional() }).partial(); + type Partial = z.infer; + util.assertEqual(true); +}); + +test("inferred picked object type with optional properties", async () => { + const Picked = z.object({ a: z.string(), b: z.string().optional() }).pick({ b: true }); + type Picked = z.infer; + util.assertEqual(true); +}); + +test("inferred type for unknown/any keys", () => { + const myType = z.object({ + anyOptional: z.any().optional(), + anyRequired: z.any(), + unknownOptional: z.unknown().optional(), + unknownRequired: z.unknown(), + }); + type myType = z.infer; + util.assertEqual< + myType, + { + anyOptional?: any; + anyRequired?: any; + unknownOptional?: unknown; + unknownRequired?: unknown; + } + >(true); +}); + +test("setKey", () => { + const base = z.object({ name: z.string() }); + const withNewKey = base.setKey("age", z.number()); + + type withNewKey = z.infer; + util.assertEqual(true); + withNewKey.parse({ name: "asdf", age: 1234 }); +}); + +test("strictcreate", async () => { + const strictObj = z.strictObject({ + name: z.string(), + }); + + const syncResult = strictObj.safeParse({ name: "asdf", unexpected: 13 }); + expect(syncResult.success).toEqual(false); + + const asyncResult = await strictObj.spa({ name: "asdf", unexpected: 13 }); + expect(asyncResult.success).toEqual(false); +}); + +test("object with refine", async () => { + const schema = z + .object({ + a: z.string().default("foo"), + b: z.number(), + }) + .refine(() => true); + expect(schema.parse({ b: 5 })).toEqual({ b: 5, a: "foo" }); + const result = await schema.parseAsync({ b: 5 }); + expect(result).toEqual({ b: 5, a: "foo" }); +}); + +test("intersection of object with date", async () => { + const schema = z.object({ + a: z.date(), + }); + expect(schema.and(schema).parse({ a: new Date(1637353595983) })).toEqual({ + a: new Date(1637353595983), + }); + const result = await schema.parseAsync({ a: new Date(1637353595983) }); + expect(result).toEqual({ a: new Date(1637353595983) }); +}); + +test("intersection of object with refine with date", async () => { + const schema = z + .object({ + a: z.date(), + }) + .refine(() => true); + expect(schema.and(schema).parse({ a: new Date(1637353595983) })).toEqual({ + a: new Date(1637353595983), + }); + const result = await schema.parseAsync({ a: new Date(1637353595983) }); + expect(result).toEqual({ a: new Date(1637353595983) }); +}); + +test("constructor key", () => { + const person = z + .object({ + name: z.string(), + }) + .strict(); + + expect(() => + person.parse({ + name: "bob dylan", + constructor: 61, + }) + ).toThrow(); +}); + +test("constructor key", () => { + const Example = z.object({ + prop: z.string(), + opt: z.number().optional(), + arr: z.string().array(), + }); + + type Example = z.infer; + util.assertEqual(true); +}); + +test("unknownkeys merging", () => { + // This one is "strict" + const schemaA = z + .object({ + a: z.string(), + }) + .strict(); + + // This one is "strip" + const schemaB = z + .object({ + b: z.string(), + }) + .catchall(z.string()); + + const mergedSchema = schemaA.merge(schemaB); + type mergedSchema = typeof mergedSchema; + util.assertEqual(true); + expect(mergedSchema._def.unknownKeys).toEqual("strip"); + + util.assertEqual(true); + expect(mergedSchema._def.catchall instanceof z.ZodString).toEqual(true); +}); + +const personToExtend = z.object({ + firstName: z.string(), + lastName: z.string(), +}); + +test("extend() should return schema with new key", () => { + const PersonWithNickname = personToExtend.extend({ nickName: z.string() }); + type PersonWithNickname = z.infer; + + const expected = { firstName: "f", nickName: "n", lastName: "l" }; + const actual = PersonWithNickname.parse(expected); + + expect(actual).toEqual(expected); + util.assertEqual(true); + util.assertEqual(true); +}); + +test("extend() should have power to override existing key", () => { + const PersonWithNumberAsLastName = personToExtend.extend({ + lastName: z.number(), + }); + type PersonWithNumberAsLastName = z.infer; + + const expected = { firstName: "f", lastName: 42 }; + const actual = PersonWithNumberAsLastName.parse(expected); + + expect(actual).toEqual(expected); + util.assertEqual(true); +}); + +test("passthrough index signature", () => { + const a = z.object({ a: z.string() }); + type a = z.infer; + util.assertEqual<{ a: string }, a>(true); + const b = a.passthrough(); + type b = z.infer; + util.assertEqual<{ a: string } & { [k: string]: unknown }, b>(true); +}); + +test("xor", () => { + type Without = { [P in Exclude]?: never }; + type XOR = T extends object ? (U extends object ? (Without & U) | (Without & T) : U) : T; + + type A = { name: string; a: number }; + type B = { name: string; b: number }; + type C = XOR; + type Outer = { data: C }; + + const _Outer: z.ZodType = z.object({ + data: z.union([z.object({ name: z.string(), a: z.number() }), z.object({ name: z.string(), b: z.number() })]), + }); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/optional.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/optional.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..016c954fce821de87946e5c12a1bc32a19c2953f --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/optional.test.ts @@ -0,0 +1,42 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +function checkErrors(a: z.ZodTypeAny, bad: any) { + let expected: any; + try { + a.parse(bad); + } catch (error) { + expected = (error as z.ZodError).formErrors; + } + try { + a.optional().parse(bad); + } catch (error) { + expect((error as z.ZodError).formErrors).toEqual(expected); + } +} + +test("Should have error messages appropriate for the underlying type", () => { + checkErrors(z.string().min(2), 1); + z.string().min(2).optional().parse(undefined); + checkErrors(z.number().gte(2), 1); + z.number().gte(2).optional().parse(undefined); + checkErrors(z.boolean(), ""); + z.boolean().optional().parse(undefined); + checkErrors(z.undefined(), null); + z.undefined().optional().parse(undefined); + checkErrors(z.null(), {}); + z.null().optional().parse(undefined); + checkErrors(z.object({}), 1); + z.object({}).optional().parse(undefined); + checkErrors(z.tuple([]), 1); + z.tuple([]).optional().parse(undefined); + checkErrors(z.unknown(), 1); + z.unknown().optional().parse(undefined); +}); + +test("unwrap", () => { + const unwrapped = z.string().optional().unwrap(); + expect(unwrapped).toBeInstanceOf(z.ZodString); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/parseUtil.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/parseUtil.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..8882d4c34f9351ef3d55bc231a40ba1d4019a6fd --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/parseUtil.test.ts @@ -0,0 +1,23 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import { type SyncParseReturnType, isAborted, isDirty, isValid } from "../helpers/parseUtil.js"; + +test("parseUtil isInvalid should use structural typing", () => { + // Test for issue #556: https://github.com/colinhacks/zod/issues/556 + const aborted: SyncParseReturnType = { status: "aborted" }; + const dirty: SyncParseReturnType = { status: "dirty", value: "whatever" }; + const valid: SyncParseReturnType = { status: "valid", value: "whatever" }; + + expect(isAborted(aborted)).toBe(true); + expect(isAborted(dirty)).toBe(false); + expect(isAborted(valid)).toBe(false); + + expect(isDirty(aborted)).toBe(false); + expect(isDirty(dirty)).toBe(true); + expect(isDirty(valid)).toBe(false); + + expect(isValid(aborted)).toBe(false); + expect(isValid(dirty)).toBe(false); + expect(isValid(valid)).toBe(true); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/parser.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/parser.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..6e685f9f5968160c177784ced5fd15682f87c5d5 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/parser.test.ts @@ -0,0 +1,41 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +test("parse strict object with unknown keys", () => { + expect(() => + z + .object({ name: z.string() }) + .strict() + .parse({ name: "bill", unknownKey: 12 } as any) + ).toThrow(); +}); + +test("parse nonstrict object with unknown keys", () => { + z.object({ name: z.string() }).nonstrict().parse({ name: "bill", unknownKey: 12 }); +}); + +test("invalid left side of intersection", () => { + expect(() => z.intersection(z.string(), z.number()).parse(12 as any)).toThrow(); +}); + +test("invalid right side of intersection", () => { + expect(() => z.intersection(z.string(), z.number()).parse("12" as any)).toThrow(); +}); + +test("parsing non-array in tuple schema", () => { + expect(() => z.tuple([]).parse("12" as any)).toThrow(); +}); + +test("incorrect num elements in tuple", () => { + expect(() => z.tuple([]).parse(["asdf"] as any)).toThrow(); +}); + +test("invalid enum value", () => { + expect(() => z.enum(["Blue"]).parse("Red" as any)).toThrow(); +}); + +test("parsing unknown", () => { + z.string().parse("Red" as unknown); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/partials.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/partials.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..a2fb6ed9c252517b522bb6d842f0c3efd0d4d62a --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/partials.test.ts @@ -0,0 +1,243 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { ZodNullable, ZodOptional } from "zod/v3"; +import { util } from "../helpers/util.js"; + +const nested = z.object({ + name: z.string(), + age: z.number(), + outer: z.object({ + inner: z.string(), + }), + array: z.array(z.object({ asdf: z.string() })), +}); + +test("shallow inference", () => { + const shallow = nested.partial(); + type shallow = z.infer; + type correct = { + name?: string | undefined; + age?: number | undefined; + outer?: { inner: string } | undefined; + array?: { asdf: string }[]; + }; + util.assertEqual(true); +}); + +test("shallow partial parse", () => { + const shallow = nested.partial(); + shallow.parse({}); + shallow.parse({ + name: "asdf", + age: 23143, + }); +}); + +test("deep partial inference", () => { + const deep = nested.deepPartial(); + const asdf = deep.shape.array.unwrap().element.shape.asdf.unwrap(); + asdf.parse("asdf"); + type deep = z.infer; + type correct = { + array?: { asdf?: string }[]; + name?: string | undefined; + age?: number | undefined; + outer?: { inner?: string | undefined } | undefined; + }; + + util.assertEqual(true); +}); + +test("deep partial parse", () => { + const deep = nested.deepPartial(); + + expect(deep.shape.name instanceof z.ZodOptional).toBe(true); + expect(deep.shape.outer instanceof z.ZodOptional).toBe(true); + expect(deep.shape.outer._def.innerType instanceof z.ZodObject).toBe(true); + expect(deep.shape.outer._def.innerType.shape.inner instanceof z.ZodOptional).toBe(true); + expect(deep.shape.outer._def.innerType.shape.inner._def.innerType instanceof z.ZodString).toBe(true); +}); + +test("deep partial runtime tests", () => { + const deep = nested.deepPartial(); + deep.parse({}); + deep.parse({ + outer: {}, + }); + deep.parse({ + name: "asdf", + age: 23143, + outer: { + inner: "adsf", + }, + }); +}); + +test("deep partial optional/nullable", () => { + const schema = z + .object({ + name: z.string().optional(), + age: z.number().nullable(), + }) + .deepPartial(); + + expect(schema.shape.name.unwrap()).toBeInstanceOf(ZodOptional); + expect(schema.shape.age.unwrap()).toBeInstanceOf(ZodNullable); +}); + +test("deep partial tuple", () => { + const schema = z + .object({ + tuple: z.tuple([ + z.object({ + name: z.string().optional(), + age: z.number().nullable(), + }), + ]), + }) + .deepPartial(); + + expect(schema.shape.tuple.unwrap().items[0].shape.name).toBeInstanceOf(ZodOptional); +}); + +test("deep partial inference", () => { + const mySchema = z.object({ + name: z.string(), + array: z.array(z.object({ asdf: z.string() })), + tuple: z.tuple([z.object({ value: z.string() })]), + }); + + const partialed = mySchema.deepPartial(); + type partialed = z.infer; + type expected = { + name?: string | undefined; + array?: + | { + asdf?: string | undefined; + }[] + | undefined; + tuple?: [{ value?: string }] | undefined; + }; + util.assertEqual(true); +}); + +test("required", () => { + const object = z.object({ + name: z.string(), + age: z.number().optional(), + field: z.string().optional().default("asdf"), + nullableField: z.number().nullable(), + nullishField: z.string().nullish(), + }); + + const requiredObject = object.required(); + expect(requiredObject.shape.name).toBeInstanceOf(z.ZodString); + expect(requiredObject.shape.age).toBeInstanceOf(z.ZodNumber); + expect(requiredObject.shape.field).toBeInstanceOf(z.ZodDefault); + expect(requiredObject.shape.nullableField).toBeInstanceOf(z.ZodNullable); + expect(requiredObject.shape.nullishField).toBeInstanceOf(z.ZodNullable); +}); + +test("required inference", () => { + const object = z.object({ + name: z.string(), + age: z.number().optional(), + field: z.string().optional().default("asdf"), + nullableField: z.number().nullable(), + nullishField: z.string().nullish(), + }); + + const requiredObject = object.required(); + + type required = z.infer; + type expected = { + name: string; + age: number; + field: string; + nullableField: number | null; + nullishField: string | null; + }; + util.assertEqual(true); +}); + +test("required with mask", () => { + const object = z.object({ + name: z.string(), + age: z.number().optional(), + field: z.string().optional().default("asdf"), + country: z.string().optional(), + }); + + const requiredObject = object.required({ age: true }); + expect(requiredObject.shape.name).toBeInstanceOf(z.ZodString); + expect(requiredObject.shape.age).toBeInstanceOf(z.ZodNumber); + expect(requiredObject.shape.field).toBeInstanceOf(z.ZodDefault); + expect(requiredObject.shape.country).toBeInstanceOf(z.ZodOptional); +}); + +test("required with mask -- ignore falsy values", () => { + const object = z.object({ + name: z.string(), + age: z.number().optional(), + field: z.string().optional().default("asdf"), + country: z.string().optional(), + }); + + // @ts-expect-error + const requiredObject = object.required({ age: true, country: false }); + expect(requiredObject.shape.name).toBeInstanceOf(z.ZodString); + expect(requiredObject.shape.age).toBeInstanceOf(z.ZodNumber); + expect(requiredObject.shape.field).toBeInstanceOf(z.ZodDefault); + expect(requiredObject.shape.country).toBeInstanceOf(z.ZodOptional); +}); + +test("partial with mask", async () => { + const object = z.object({ + name: z.string(), + age: z.number().optional(), + field: z.string().optional().default("asdf"), + country: z.string(), + }); + + const masked = object.partial({ age: true, field: true, name: true }).strict(); + + expect(masked.shape.name).toBeInstanceOf(z.ZodOptional); + expect(masked.shape.age).toBeInstanceOf(z.ZodOptional); + expect(masked.shape.field).toBeInstanceOf(z.ZodOptional); + expect(masked.shape.country).toBeInstanceOf(z.ZodString); + + masked.parse({ country: "US" }); + await masked.parseAsync({ country: "US" }); +}); + +test("partial with mask -- ignore falsy values", async () => { + const object = z.object({ + name: z.string(), + age: z.number().optional(), + field: z.string().optional().default("asdf"), + country: z.string(), + }); + + // @ts-expect-error + const masked = object.partial({ name: true, country: false }).strict(); + + expect(masked.shape.name).toBeInstanceOf(z.ZodOptional); + expect(masked.shape.age).toBeInstanceOf(z.ZodOptional); + expect(masked.shape.field).toBeInstanceOf(z.ZodDefault); + expect(masked.shape.country).toBeInstanceOf(z.ZodString); + + masked.parse({ country: "US" }); + await masked.parseAsync({ country: "US" }); +}); + +test("deeppartial array", () => { + const schema = z.object({ array: z.string().array().min(42) }).deepPartial(); + + // works as expected + schema.parse({}); + + // should be false, but is true + expect(schema.safeParse({ array: [] }).success).toBe(false); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/pickomit.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/pickomit.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..b1056e5af9e6446036a3cb2c0089cfb0f94bbfeb --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/pickomit.test.ts @@ -0,0 +1,111 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +const fish = z.object({ + name: z.string(), + age: z.number(), + nested: z.object({}), +}); + +test("pick type inference", () => { + const nameonlyFish = fish.pick({ name: true }); + type nameonlyFish = z.infer; + util.assertEqual(true); +}); + +test("pick parse - success", () => { + const nameonlyFish = fish.pick({ name: true }); + nameonlyFish.parse({ name: "bob" }); + + // @ts-expect-error checking runtime picks `name` only. + const anotherNameonlyFish = fish.pick({ name: true, age: false }); + anotherNameonlyFish.parse({ name: "bob" }); +}); + +test("pick parse - fail", () => { + fish.pick({ name: true }).parse({ name: "12" } as any); + fish.pick({ name: true }).parse({ name: "bob", age: 12 } as any); + fish.pick({ age: true }).parse({ age: 12 } as any); + + const nameonlyFish = fish.pick({ name: true }).strict(); + const bad1 = () => nameonlyFish.parse({ name: 12 } as any); + const bad2 = () => nameonlyFish.parse({ name: "bob", age: 12 } as any); + const bad3 = () => nameonlyFish.parse({ age: 12 } as any); + + // @ts-expect-error checking runtime picks `name` only. + const anotherNameonlyFish = fish.pick({ name: true, age: false }).strict(); + const bad4 = () => anotherNameonlyFish.parse({ name: "bob", age: 12 } as any); + + expect(bad1).toThrow(); + expect(bad2).toThrow(); + expect(bad3).toThrow(); + expect(bad4).toThrow(); +}); + +test("omit type inference", () => { + const nonameFish = fish.omit({ name: true }); + type nonameFish = z.infer; + util.assertEqual(true); +}); + +test("omit parse - success", () => { + const nonameFish = fish.omit({ name: true }); + nonameFish.parse({ age: 12, nested: {} }); + + // @ts-expect-error checking runtime omits `name` only. + const anotherNonameFish = fish.omit({ name: true, age: false }); + anotherNonameFish.parse({ age: 12, nested: {} }); +}); + +test("omit parse - fail", () => { + const nonameFish = fish.omit({ name: true }); + const bad1 = () => nonameFish.parse({ name: 12 } as any); + const bad2 = () => nonameFish.parse({ age: 12 } as any); + const bad3 = () => nonameFish.parse({} as any); + + // @ts-expect-error checking runtime omits `name` only. + const anotherNonameFish = fish.omit({ name: true, age: false }); + const bad4 = () => anotherNonameFish.parse({ nested: {} } as any); + + expect(bad1).toThrow(); + expect(bad2).toThrow(); + expect(bad3).toThrow(); + expect(bad4).toThrow(); +}); + +test("nonstrict inference", () => { + const laxfish = fish.pick({ name: true }).catchall(z.any()); + type laxfish = z.infer; + util.assertEqual(true); +}); + +test("nonstrict parsing - pass", () => { + const laxfish = fish.passthrough().pick({ name: true }); + laxfish.parse({ name: "asdf", whatever: "asdf" }); + laxfish.parse({ name: "asdf", age: 12, nested: {} }); +}); + +test("nonstrict parsing - fail", () => { + const laxfish = fish.passthrough().pick({ name: true }); + const bad = () => laxfish.parse({ whatever: "asdf" } as any); + expect(bad).toThrow(); +}); + +test("pick/omit/required/partial - do not allow unknown keys", () => { + const schema = z.object({ + name: z.string(), + age: z.number(), + }); + + // @ts-expect-error + schema.pick({ $unknown: true }); + // @ts-expect-error + schema.omit({ $unknown: true }); + // @ts-expect-error + schema.required({ $unknown: true }); + // @ts-expect-error + schema.partial({ $unknown: true }); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/pipeline.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/pipeline.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..cc94fc55480ad28c7ea211bbfc957b94b59bb082 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/pipeline.test.ts @@ -0,0 +1,29 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; + +test("string to number pipeline", () => { + const schema = z.string().transform(Number).pipe(z.number()); + expect(schema.parse("1234")).toEqual(1234); +}); + +test("string to number pipeline async", async () => { + const schema = z + .string() + .transform(async (val) => Number(val)) + .pipe(z.number()); + expect(await schema.parseAsync("1234")).toEqual(1234); +}); + +test("break if dirty", () => { + const schema = z + .string() + .refine((c) => c === "1234") + .transform(async (val) => Number(val)) + .pipe(z.number().refine((v) => v < 100)); + const r1: any = schema.safeParse("12345"); + expect(r1.error.issues.length).toBe(1); + const r2: any = schema.safeParse("3"); + expect(r2.error.issues.length).toBe(1); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/preprocess.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/preprocess.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..7e1b5a1d7b497d62c19a9215c3220595283759d3 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/preprocess.test.ts @@ -0,0 +1,186 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +test("preprocess", () => { + const schema = z.preprocess((data) => [data], z.string().array()); + + const value = schema.parse("asdf"); + expect(value).toEqual(["asdf"]); + util.assertEqual<(typeof schema)["_input"], unknown>(true); +}); + +test("async preprocess", async () => { + const schema = z.preprocess(async (data) => [data], z.string().array()); + + const value = await schema.parseAsync("asdf"); + expect(value).toEqual(["asdf"]); +}); + +test("preprocess ctx.addIssue with parse", () => { + expect(() => { + z.preprocess((data, ctx) => { + ctx.addIssue({ + code: "custom", + message: `${data} is not one of our allowed strings`, + }); + return data; + }, z.string()).parse("asdf"); + }).toThrow( + JSON.stringify( + [ + { + code: "custom", + message: "asdf is not one of our allowed strings", + path: [], + }, + ], + null, + 2 + ) + ); +}); + +test("preprocess ctx.addIssue non-fatal by default", () => { + try { + z.preprocess((data, ctx) => { + ctx.addIssue({ + code: "custom", + message: `custom error`, + }); + return data; + }, z.string()).parse(1234); + } catch (err) { + z.ZodError.assert(err); + expect(err.issues.length).toEqual(2); + } +}); + +test("preprocess ctx.addIssue fatal true", () => { + try { + z.preprocess((data, ctx) => { + ctx.addIssue({ + code: "custom", + message: `custom error`, + fatal: true, + }); + return data; + }, z.string()).parse(1234); + } catch (err) { + z.ZodError.assert(err); + expect(err.issues.length).toEqual(1); + } +}); + +test("async preprocess ctx.addIssue with parse", async () => { + const schema = z.preprocess(async (data, ctx) => { + ctx.addIssue({ + code: "custom", + message: `custom error`, + }); + return data; + }, z.string()); + + expect(await schema.safeParseAsync("asdf")).toMatchInlineSnapshot(` + { + "error": [ZodError: [ + { + "code": "custom", + "message": "custom error", + "path": [] + } + ]], + "success": false, + } + `); +}); + +test("preprocess ctx.addIssue with parseAsync", async () => { + const result = await z + .preprocess(async (data, ctx) => { + ctx.addIssue({ + code: "custom", + message: `${data} is not one of our allowed strings`, + }); + return data; + }, z.string()) + .safeParseAsync("asdf"); + + expect(JSON.parse(JSON.stringify(result))).toEqual({ + success: false, + error: { + issues: [ + { + code: "custom", + message: "asdf is not one of our allowed strings", + path: [], + }, + ], + name: "ZodError", + }, + }); +}); + +test("z.NEVER in preprocess", () => { + const foo = z.preprocess((val, ctx) => { + if (!val) { + ctx.addIssue({ code: z.ZodIssueCode.custom, message: "bad" }); + return z.NEVER; + } + return val; + }, z.number()); + + type foo = z.infer; + util.assertEqual(true); + const arg = foo.safeParse(undefined); + expect(arg.error!.issues).toHaveLength(2); + expect(arg.error!.issues[0].message).toEqual("bad"); +}); +test("preprocess as the second property of object", () => { + const schema = z.object({ + nonEmptyStr: z.string().min(1), + positiveNum: z.preprocess((v) => Number(v), z.number().positive()), + }); + const result = schema.safeParse({ + nonEmptyStr: "", + positiveNum: "", + }); + expect(result.success).toEqual(false); + if (!result.success) { + expect(result.error.issues.length).toEqual(2); + expect(result.error.issues[0].code).toEqual(z.ZodIssueCode.too_small); + expect(result.error.issues[1].code).toEqual(z.ZodIssueCode.too_small); + } +}); + +test("preprocess validates with sibling errors", () => { + expect(() => { + z.object({ + // Must be first + missing: z.string().refine(() => false), + preprocess: z.preprocess((data: any) => data?.trim(), z.string().regex(/ asdf/)), + }).parse({ preprocess: " asdf" }); + }).toThrow( + JSON.stringify( + [ + { + code: "invalid_type", + expected: "string", + received: "undefined", + path: ["missing"], + message: "Required", + }, + { + validation: "regex", + code: "invalid_string", + message: "Invalid", + path: ["preprocess"], + }, + ], + null, + 2 + ) + ); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/primitive.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/primitive.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..48e36a21c3c01db2139c25e2457b5b0807036416 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/primitive.test.ts @@ -0,0 +1,440 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; +import { Mocker } from "./Mocker.js"; + +const literalStringSchema = z.literal("asdf"); +const literalNumberSchema = z.literal(12); +const literalBooleanSchema = z.literal(true); +const literalBigIntSchema = z.literal(BigInt(42)); +const MySymbol = Symbol("stuff"); +const literalSymbolSchema = z.literal(MySymbol); +const stringSchema = z.string(); +const numberSchema = z.number(); +const bigintSchema = z.bigint(); +const booleanSchema = z.boolean(); +const dateSchema = z.date(); +const symbolSchema = z.symbol(); + +const nullSchema = z.null(); +const undefinedSchema = z.undefined(); +const stringSchemaOptional = z.string().optional(); +const stringSchemaNullable = z.string().nullable(); +const numberSchemaOptional = z.number().optional(); +const numberSchemaNullable = z.number().nullable(); +const bigintSchemaOptional = z.bigint().optional(); +const bigintSchemaNullable = z.bigint().nullable(); +const booleanSchemaOptional = z.boolean().optional(); +const booleanSchemaNullable = z.boolean().nullable(); +const dateSchemaOptional = z.date().optional(); +const dateSchemaNullable = z.date().nullable(); +const symbolSchemaOptional = z.symbol().optional(); +const symbolSchemaNullable = z.symbol().nullable(); + +const val = new Mocker(); + +test("literal string correct", () => { + expect(literalStringSchema.parse("asdf")).toBe("asdf"); +}); + +test("literal string incorrect", () => { + const f = () => literalStringSchema.parse("not_asdf"); + expect(f).toThrow(); +}); + +test("literal string number", () => { + const f = () => literalStringSchema.parse(123); + expect(f).toThrow(); +}); + +test("literal string boolean", () => { + const f = () => literalStringSchema.parse(true); + expect(f).toThrow(); +}); + +test("literal string boolean", () => { + const f = () => literalStringSchema.parse(true); + expect(f).toThrow(); +}); + +test("literal string object", () => { + const f = () => literalStringSchema.parse({}); + expect(f).toThrow(); +}); + +test("literal number correct", () => { + expect(literalNumberSchema.parse(12)).toBe(12); +}); + +test("literal number incorrect", () => { + const f = () => literalNumberSchema.parse(13); + expect(f).toThrow(); +}); + +test("literal number number", () => { + const f = () => literalNumberSchema.parse(val.string); + expect(f).toThrow(); +}); + +test("literal number boolean", () => { + const f = () => literalNumberSchema.parse(val.boolean); + expect(f).toThrow(); +}); + +test("literal number object", () => { + const f = () => literalStringSchema.parse({}); + expect(f).toThrow(); +}); + +test("literal boolean correct", () => { + expect(literalBooleanSchema.parse(true)).toBe(true); +}); + +test("literal boolean incorrect", () => { + const f = () => literalBooleanSchema.parse(false); + expect(f).toThrow(); +}); + +test("literal boolean number", () => { + const f = () => literalBooleanSchema.parse("asdf"); + expect(f).toThrow(); +}); + +test("literal boolean boolean", () => { + const f = () => literalBooleanSchema.parse(123); + expect(f).toThrow(); +}); + +test("literal boolean object", () => { + const f = () => literalBooleanSchema.parse({}); + expect(f).toThrow(); +}); + +test("literal bigint correct", () => { + expect(literalBigIntSchema.parse(BigInt(42))).toBe(BigInt(42)); +}); + +test("literal bigint incorrect", () => { + const f = () => literalBigIntSchema.parse(BigInt(43)); + expect(f).toThrow(); +}); + +test("literal bigint number", () => { + const f = () => literalBigIntSchema.parse("asdf"); + expect(f).toThrow(); +}); + +test("literal bigint boolean", () => { + const f = () => literalBigIntSchema.parse(123); + expect(f).toThrow(); +}); + +test("literal bigint object", () => { + const f = () => literalBigIntSchema.parse({}); + expect(f).toThrow(); +}); + +test("literal symbol", () => { + util.assertEqual, typeof MySymbol>(true); + literalSymbolSchema.parse(MySymbol); + expect(() => literalSymbolSchema.parse(Symbol("asdf"))).toThrow(); +}); + +test("parse stringSchema string", () => { + stringSchema.parse(val.string); +}); + +test("parse stringSchema number", () => { + const f = () => stringSchema.parse(val.number); + expect(f).toThrow(); +}); + +test("parse stringSchema boolean", () => { + const f = () => stringSchema.parse(val.boolean); + expect(f).toThrow(); +}); + +test("parse stringSchema undefined", () => { + const f = () => stringSchema.parse(val.undefined); + expect(f).toThrow(); +}); + +test("parse stringSchema null", () => { + const f = () => stringSchema.parse(val.null); + expect(f).toThrow(); +}); + +test("parse numberSchema string", () => { + const f = () => numberSchema.parse(val.string); + expect(f).toThrow(); +}); + +test("parse numberSchema number", () => { + numberSchema.parse(val.number); +}); + +test("parse numberSchema bigint", () => { + const f = () => numberSchema.parse(val.bigint); + expect(f).toThrow(); +}); + +test("parse numberSchema boolean", () => { + const f = () => numberSchema.parse(val.boolean); + expect(f).toThrow(); +}); + +test("parse numberSchema undefined", () => { + const f = () => numberSchema.parse(val.undefined); + expect(f).toThrow(); +}); + +test("parse numberSchema null", () => { + const f = () => numberSchema.parse(val.null); + expect(f).toThrow(); +}); + +test("parse bigintSchema string", () => { + const f = () => bigintSchema.parse(val.string); + expect(f).toThrow(); +}); + +test("parse bigintSchema number", () => { + const f = () => bigintSchema.parse(val.number); + expect(f).toThrow(); +}); + +test("parse bigintSchema bigint", () => { + bigintSchema.parse(val.bigint); +}); + +test("parse bigintSchema boolean", () => { + const f = () => bigintSchema.parse(val.boolean); + expect(f).toThrow(); +}); + +test("parse bigintSchema undefined", () => { + const f = () => bigintSchema.parse(val.undefined); + expect(f).toThrow(); +}); + +test("parse bigintSchema null", () => { + const f = () => bigintSchema.parse(val.null); + expect(f).toThrow(); +}); + +test("parse booleanSchema string", () => { + const f = () => booleanSchema.parse(val.string); + expect(f).toThrow(); +}); + +test("parse booleanSchema number", () => { + const f = () => booleanSchema.parse(val.number); + expect(f).toThrow(); +}); + +test("parse booleanSchema boolean", () => { + booleanSchema.parse(val.boolean); +}); + +test("parse booleanSchema undefined", () => { + const f = () => booleanSchema.parse(val.undefined); + expect(f).toThrow(); +}); + +test("parse booleanSchema null", () => { + const f = () => booleanSchema.parse(val.null); + expect(f).toThrow(); +}); + +// ============== + +test("parse dateSchema string", () => { + const f = () => dateSchema.parse(val.string); + expect(f).toThrow(); +}); + +test("parse dateSchema number", () => { + const f = () => dateSchema.parse(val.number); + expect(f).toThrow(); +}); + +test("parse dateSchema boolean", () => { + const f = () => dateSchema.parse(val.boolean); + expect(f).toThrow(); +}); + +test("parse dateSchema date", () => { + dateSchema.parse(val.date); +}); + +test("parse dateSchema undefined", () => { + const f = () => dateSchema.parse(val.undefined); + expect(f).toThrow(); +}); + +test("parse dateSchema null", () => { + const f = () => dateSchema.parse(val.null); + expect(f).toThrow(); +}); + +test("parse dateSchema invalid date", async () => { + try { + await dateSchema.parseAsync(new Date("invalid")); + } catch (err) { + expect((err as z.ZodError).issues[0].code).toEqual(z.ZodIssueCode.invalid_date); + } +}); +// ============== + +test("parse symbolSchema string", () => { + const f = () => symbolSchema.parse(val.string); + expect(f).toThrow(); +}); + +test("parse symbolSchema number", () => { + const f = () => symbolSchema.parse(val.number); + expect(f).toThrow(); +}); + +test("parse symbolSchema boolean", () => { + const f = () => symbolSchema.parse(val.boolean); + expect(f).toThrow(); +}); + +test("parse symbolSchema date", () => { + const f = () => symbolSchema.parse(val.date); + expect(f).toThrow(); +}); + +test("parse symbolSchema symbol", () => { + symbolSchema.parse(val.symbol); +}); + +test("parse symbolSchema undefined", () => { + const f = () => symbolSchema.parse(val.undefined); + expect(f).toThrow(); +}); + +test("parse symbolSchema null", () => { + const f = () => symbolSchema.parse(val.null); + expect(f).toThrow(); +}); + +// ============== + +test("parse undefinedSchema string", () => { + const f = () => undefinedSchema.parse(val.string); + expect(f).toThrow(); +}); + +test("parse undefinedSchema number", () => { + const f = () => undefinedSchema.parse(val.number); + expect(f).toThrow(); +}); + +test("parse undefinedSchema boolean", () => { + const f = () => undefinedSchema.parse(val.boolean); + expect(f).toThrow(); +}); + +test("parse undefinedSchema undefined", () => { + undefinedSchema.parse(val.undefined); +}); + +test("parse undefinedSchema null", () => { + const f = () => undefinedSchema.parse(val.null); + expect(f).toThrow(); +}); + +test("parse nullSchema string", () => { + const f = () => nullSchema.parse(val.string); + expect(f).toThrow(); +}); + +test("parse nullSchema number", () => { + const f = () => nullSchema.parse(val.number); + expect(f).toThrow(); +}); + +test("parse nullSchema boolean", () => { + const f = () => nullSchema.parse(val.boolean); + expect(f).toThrow(); +}); + +test("parse nullSchema undefined", () => { + const f = () => nullSchema.parse(val.undefined); + expect(f).toThrow(); +}); + +test("parse nullSchema null", () => { + nullSchema.parse(val.null); +}); + +test("primitive inference", () => { + util.assertEqual, "asdf">(true); + util.assertEqual, 12>(true); + util.assertEqual, true>(true); + util.assertEqual, bigint>(true); + util.assertEqual, string>(true); + util.assertEqual, number>(true); + util.assertEqual, bigint>(true); + util.assertEqual, boolean>(true); + util.assertEqual, Date>(true); + util.assertEqual, symbol>(true); + + util.assertEqual, null>(true); + util.assertEqual, undefined>(true); + util.assertEqual, string | undefined>(true); + util.assertEqual, string | null>(true); + util.assertEqual, number | undefined>(true); + util.assertEqual, number | null>(true); + util.assertEqual, bigint | undefined>(true); + util.assertEqual, bigint | null>(true); + util.assertEqual, boolean | undefined>(true); + util.assertEqual, boolean | null>(true); + util.assertEqual, Date | undefined>(true); + util.assertEqual, Date | null>(true); + util.assertEqual, symbol | undefined>(true); + util.assertEqual, symbol | null>(true); + + // [ + // literalStringSchemaTest, + // literalNumberSchemaTest, + // literalBooleanSchemaTest, + // literalBigIntSchemaTest, + // stringSchemaTest, + // numberSchemaTest, + // bigintSchemaTest, + // booleanSchemaTest, + // dateSchemaTest, + // symbolSchemaTest, + + // nullSchemaTest, + // undefinedSchemaTest, + // stringSchemaOptionalTest, + // stringSchemaNullableTest, + // numberSchemaOptionalTest, + // numberSchemaNullableTest, + // bigintSchemaOptionalTest, + // bigintSchemaNullableTest, + // booleanSchemaOptionalTest, + // booleanSchemaNullableTest, + // dateSchemaOptionalTest, + // dateSchemaNullableTest, + // symbolSchemaOptionalTest, + // symbolSchemaNullableTest, + + // ]; +}); + +test("get literal value", () => { + expect(literalStringSchema.value).toEqual("asdf"); +}); + +test("optional convenience method", () => { + z.ostring().parse(undefined); + z.onumber().parse(undefined); + z.oboolean().parse(undefined); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/promise.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/promise.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..23b6de17862bb00cde067af322f5c6df0713c69d --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/promise.test.ts @@ -0,0 +1,90 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +const promSchema = z.promise( + z.object({ + name: z.string(), + age: z.number(), + }) +); + +test("promise inference", () => { + type promSchemaType = z.infer; + util.assertEqual>(true); +}); + +test("promise parsing success", async () => { + const pr = promSchema.parse(Promise.resolve({ name: "Bobby", age: 10 })); + expect(pr).toBeInstanceOf(Promise); + const result = await pr; + expect(typeof result).toBe("object"); + expect(typeof result.age).toBe("number"); + expect(typeof result.name).toBe("string"); +}); + +test("promise parsing success 2", () => { + const fakePromise = { + then() { + return this; + }, + catch() { + return this; + }, + }; + promSchema.parse(fakePromise); +}); + +test("promise parsing fail", async () => { + const bad = promSchema.parse(Promise.resolve({ name: "Bobby", age: "10" })); + // return await expect(bad).resolves.toBe({ name: 'Bobby', age: '10' }); + return await expect(bad).rejects.toBeInstanceOf(z.ZodError); + // done(); +}); + +test("promise parsing fail 2", async () => { + const failPromise = promSchema.parse(Promise.resolve({ name: "Bobby", age: "10" })); + await expect(failPromise).rejects.toBeInstanceOf(z.ZodError); + // done();/z +}); + +test("promise parsing fail", () => { + const bad = () => promSchema.parse({ then: () => {}, catch: {} }); + expect(bad).toThrow(); +}); + +// test('sync promise parsing', () => { +// expect(() => z.promise(z.string()).parse(Promise.resolve('asfd'))).toThrow(); +// }); + +const asyncFunction = z.function(z.tuple([]), promSchema); + +test("async function pass", async () => { + const validatedFunction = asyncFunction.implement(async () => { + return { name: "jimmy", age: 14 }; + }); + await expect(validatedFunction()).resolves.toEqual({ + name: "jimmy", + age: 14, + }); +}); + +test("async function fail", async () => { + const validatedFunction = asyncFunction.implement(() => { + return Promise.resolve("asdf" as any); + }); + await expect(validatedFunction()).rejects.toBeInstanceOf(z.ZodError); +}); + +test("async promise parsing", () => { + const res = z.promise(z.number()).parseAsync(Promise.resolve(12)); + expect(res).toBeInstanceOf(Promise); +}); + +test("resolves", () => { + const foo = z.literal("foo"); + const res = z.promise(foo); + expect(res.unwrap()).toEqual(foo); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/readonly.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/readonly.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..5078955f4aa026631928f9d586d533f0e0295dcd --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/readonly.test.ts @@ -0,0 +1,194 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +enum testEnum { + A = 0, + B = 1, +} + +const schemas = [ + z.string().readonly(), + z.number().readonly(), + z.nan().readonly(), + z.bigint().readonly(), + z.boolean().readonly(), + z.date().readonly(), + z.undefined().readonly(), + z.null().readonly(), + z.any().readonly(), + z.unknown().readonly(), + z.void().readonly(), + z.function().args(z.string(), z.number()).readonly(), + + z.array(z.string()).readonly(), + z.tuple([z.string(), z.number()]).readonly(), + z.map(z.string(), z.date()).readonly(), + z.set(z.promise(z.string())).readonly(), + z.record(z.string()).readonly(), + z.record(z.string(), z.number()).readonly(), + z.object({ a: z.string(), 1: z.number() }).readonly(), + z.nativeEnum(testEnum).readonly(), + z.promise(z.string()).readonly(), +] as const; + +test("flat inference", () => { + util.assertEqual, string>(true); + util.assertEqual, number>(true); + util.assertEqual, number>(true); + util.assertEqual, bigint>(true); + util.assertEqual, boolean>(true); + util.assertEqual, Date>(true); + util.assertEqual, undefined>(true); + util.assertEqual, null>(true); + util.assertEqual, any>(true); + util.assertEqual, Readonly>(true); + util.assertEqual, void>(true); + util.assertEqual, (args_0: string, args_1: number, ...args_2: unknown[]) => unknown>( + true + ); + util.assertEqual, readonly string[]>(true); + + util.assertEqual, readonly [string, number]>(true); + util.assertEqual, ReadonlyMap>(true); + util.assertEqual, ReadonlySet>>(true); + util.assertEqual, Readonly>>(true); + util.assertEqual, Readonly>>(true); + util.assertEqual, { readonly a: string; readonly 1: number }>(true); + util.assertEqual, Readonly>(true); + util.assertEqual, Promise>(true); +}); + +// test("deep inference", () => { +// util.assertEqual, string>(true); +// util.assertEqual, number>(true); +// util.assertEqual, number>(true); +// util.assertEqual, bigint>(true); +// util.assertEqual, boolean>(true); +// util.assertEqual, Date>(true); +// util.assertEqual, undefined>(true); +// util.assertEqual, null>(true); +// util.assertEqual, any>(true); +// util.assertEqual< +// z.infer<(typeof deepReadonlySchemas_0)[9]>, +// Readonly +// >(true); +// util.assertEqual, void>(true); +// util.assertEqual< +// z.infer<(typeof deepReadonlySchemas_0)[11]>, +// (args_0: string, args_1: number, ...args_2: unknown[]) => unknown +// >(true); +// util.assertEqual< +// z.infer<(typeof deepReadonlySchemas_0)[12]>, +// readonly string[] +// >(true); +// util.assertEqual< +// z.infer<(typeof deepReadonlySchemas_0)[13]>, +// readonly [string, number] +// >(true); +// util.assertEqual< +// z.infer<(typeof deepReadonlySchemas_0)[14]>, +// ReadonlyMap +// >(true); +// util.assertEqual< +// z.infer<(typeof deepReadonlySchemas_0)[15]>, +// ReadonlySet> +// >(true); +// util.assertEqual< +// z.infer<(typeof deepReadonlySchemas_0)[16]>, +// Readonly> +// >(true); +// util.assertEqual< +// z.infer<(typeof deepReadonlySchemas_0)[17]>, +// Readonly> +// >(true); +// util.assertEqual< +// z.infer<(typeof deepReadonlySchemas_0)[18]>, +// { readonly a: string; readonly 1: number } +// >(true); +// util.assertEqual< +// z.infer<(typeof deepReadonlySchemas_0)[19]>, +// Readonly +// >(true); +// util.assertEqual< +// z.infer<(typeof deepReadonlySchemas_0)[20]>, +// Promise +// >(true); + +// util.assertEqual< +// z.infer, +// ReadonlyMap< +// ReadonlySet, +// { +// readonly a: { +// readonly [x: string]: readonly any[]; +// }; +// readonly b: { +// readonly c: { +// readonly d: { +// readonly e: { +// readonly f: { +// readonly g?: {}; +// }; +// }; +// }; +// }; +// }; +// } +// > +// >(true); +// }); + +test("object freezing", () => { + expect(Object.isFrozen(z.array(z.string()).readonly().parse(["a"]))).toBe(true); + expect(Object.isFrozen(z.tuple([z.string(), z.number()]).readonly().parse(["a", 1]))).toBe(true); + expect( + Object.isFrozen( + z + .map(z.string(), z.date()) + .readonly() + .parse(new Map([["a", new Date()]])) + ) + ).toBe(true); + expect( + Object.isFrozen( + z + .set(z.promise(z.string())) + .readonly() + .parse(new Set([Promise.resolve("a")])) + ) + ).toBe(true); + expect(Object.isFrozen(z.record(z.string()).readonly().parse({ a: "b" }))).toBe(true); + expect(Object.isFrozen(z.record(z.string(), z.number()).readonly().parse({ a: 1 }))).toBe(true); + expect(Object.isFrozen(z.object({ a: z.string(), 1: z.number() }).readonly().parse({ a: "b", 1: 2 }))).toBe(true); + expect(Object.isFrozen(z.promise(z.string()).readonly().parse(Promise.resolve("a")))).toBe(true); +}); + +test("async object freezing", async () => { + expect(Object.isFrozen(await z.array(z.string()).readonly().parseAsync(["a"]))).toBe(true); + expect(Object.isFrozen(await z.tuple([z.string(), z.number()]).readonly().parseAsync(["a", 1]))).toBe(true); + expect( + Object.isFrozen( + await z + .map(z.string(), z.date()) + .readonly() + .parseAsync(new Map([["a", new Date()]])) + ) + ).toBe(true); + expect( + Object.isFrozen( + await z + .set(z.promise(z.string())) + .readonly() + .parseAsync(new Set([Promise.resolve("a")])) + ) + ).toBe(true); + expect(Object.isFrozen(await z.record(z.string()).readonly().parseAsync({ a: "b" }))).toBe(true); + expect(Object.isFrozen(await z.record(z.string(), z.number()).readonly().parseAsync({ a: 1 }))).toBe(true); + expect( + Object.isFrozen(await z.object({ a: z.string(), 1: z.number() }).readonly().parseAsync({ a: "b", 1: 2 })) + ).toBe(true); + expect(Object.isFrozen(await z.promise(z.string()).readonly().parseAsync(Promise.resolve("a")))).toBe(true); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/record.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/record.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..83c363f33fed48112c695eea66bc05f6aed311b8 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/record.test.ts @@ -0,0 +1,171 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { util } from "../helpers/util.js"; + +const booleanRecord = z.record(z.boolean()); +type booleanRecord = z.infer; + +const recordWithEnumKeys = z.record(z.enum(["Tuna", "Salmon"]), z.string()); +type recordWithEnumKeys = z.infer; + +const recordWithLiteralKeys = z.record(z.union([z.literal("Tuna"), z.literal("Salmon")]), z.string()); +type recordWithLiteralKeys = z.infer; + +test("type inference", () => { + util.assertEqual>(true); + + util.assertEqual>>(true); + + util.assertEqual>>(true); +}); + +test("methods", () => { + booleanRecord.optional(); + booleanRecord.nullable(); +}); + +test("string record parse - pass", () => { + booleanRecord.parse({ + k1: true, + k2: false, + 1234: false, + }); +}); + +test("string record parse - fail", () => { + const badCheck = () => + booleanRecord.parse({ + asdf: 1234, + } as any); + expect(badCheck).toThrow(); + + expect(() => booleanRecord.parse("asdf")).toThrow(); +}); + +test("string record parse - fail", () => { + const badCheck = () => + booleanRecord.parse({ + asdf: {}, + } as any); + expect(badCheck).toThrow(); +}); + +test("string record parse - fail", () => { + const badCheck = () => + booleanRecord.parse({ + asdf: [], + } as any); + expect(badCheck).toThrow(); +}); + +test("key schema", () => { + const result1 = recordWithEnumKeys.parse({ + Tuna: "asdf", + Salmon: "asdf", + }); + expect(result1).toEqual({ + Tuna: "asdf", + Salmon: "asdf", + }); + + const result2 = recordWithLiteralKeys.parse({ + Tuna: "asdf", + Salmon: "asdf", + }); + expect(result2).toEqual({ + Tuna: "asdf", + Salmon: "asdf", + }); + + // shouldn't require us to specify all props in record + const result3 = recordWithEnumKeys.parse({ + Tuna: "abcd", + }); + expect(result3).toEqual({ + Tuna: "abcd", + }); + + // shouldn't require us to specify all props in record + const result4 = recordWithLiteralKeys.parse({ + Salmon: "abcd", + }); + expect(result4).toEqual({ + Salmon: "abcd", + }); + + expect(() => + recordWithEnumKeys.parse({ + Tuna: "asdf", + Salmon: "asdf", + Trout: "asdf", + }) + ).toThrow(); + + expect(() => + recordWithLiteralKeys.parse({ + Tuna: "asdf", + Salmon: "asdf", + + Trout: "asdf", + }) + ).toThrow(); +}); + +// test("record element", () => { +// expect(booleanRecord.element).toBeInstanceOf(z.ZodBoolean); +// }); + +test("key and value getters", () => { + const rec = z.record(z.string(), z.number()); + + rec.keySchema.parse("asdf"); + rec.valueSchema.parse(1234); + rec.element.parse(1234); +}); + +test("is not vulnerable to prototype pollution", async () => { + const rec = z.record( + z.object({ + a: z.string(), + }) + ); + + const data = JSON.parse(` + { + "__proto__": { + "a": "evil" + }, + "b": { + "a": "good" + } + } + `); + + const obj1 = rec.parse(data); + expect(obj1.a).toBeUndefined(); + + const obj2 = rec.safeParse(data); + expect(obj2.success).toBe(true); + if (obj2.success) { + expect(obj2.data.a).toBeUndefined(); + } + + const obj3 = await rec.parseAsync(data); + expect(obj3.a).toBeUndefined(); + + const obj4 = await rec.safeParseAsync(data); + expect(obj4.success).toBe(true); + if (obj4.success) { + expect(obj4.data.a).toBeUndefined(); + } +}); + +test("dont parse undefined values", () => { + const result1 = z.record(z.any()).parse({ foo: undefined }); + + expect(result1).toEqual({ + foo: undefined, + }); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/recursive.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/recursive.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..f5bb1088adae61ab26664e235ba8beff98e1e103 --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/recursive.test.ts @@ -0,0 +1,197 @@ +// @ts-ignore TS6133 +import { test } from "vitest"; + +import { z } from "zod/v3"; + +interface Category { + name: string; + subcategories: Category[]; +} + +const testCategory: Category = { + name: "I", + subcategories: [ + { + name: "A", + subcategories: [ + { + name: "1", + subcategories: [ + { + name: "a", + subcategories: [], + }, + ], + }, + ], + }, + ], +}; + +test("recursion with z.late.object", () => { + const Category: z.ZodType = z.late.object(() => ({ + name: z.string(), + subcategories: z.array(Category), + })); + Category.parse(testCategory); +}); + +test("recursion with z.lazy", () => { + const Category: z.ZodType = z.lazy(() => + z.object({ + name: z.string(), + subcategories: z.array(Category), + }) + ); + Category.parse(testCategory); +}); + +test("schema getter", () => { + z.lazy(() => z.string()).schema.parse("asdf"); +}); + +type LinkedList = null | { value: number; next: LinkedList }; + +const linkedListExample = { + value: 1, + next: { + value: 2, + next: { + value: 3, + next: { + value: 4, + next: null, + }, + }, + }, +}; + +test("recursion involving union type", () => { + const LinkedListSchema: z.ZodType = z.lazy(() => + z.union([ + z.null(), + z.object({ + value: z.number(), + next: LinkedListSchema, + }), + ]) + ); + LinkedListSchema.parse(linkedListExample); +}); + +// interface A { +// val: number; +// b: B; +// } + +// interface B { +// val: number; +// a: A; +// } + +// const A: z.ZodType = z.late.object(() => ({ +// val: z.number(), +// b: B, +// })); + +// const B: z.ZodType = z.late.object(() => ({ +// val: z.number(), +// a: A, +// })); + +// const Alazy: z.ZodType = z.lazy(() => z.object({ +// val: z.number(), +// b: B, +// })); + +// const Blazy: z.ZodType = z.lazy(() => z.object({ +// val: z.number(), +// a: A, +// })); + +// const a: any = { val: 1 }; +// const b: any = { val: 2 }; +// a.b = b; +// b.a = a; + +// test('valid check', () => { +// A.parse(a); +// B.parse(b); +// }); + +// test("valid check lazy", () => { +// A.parse({val:1, b:}); +// B.parse(b); +// }); + +// test('masking check', () => { +// const FragmentOnA = z +// .object({ +// val: z.number(), +// b: z +// .object({ +// val: z.number(), +// a: z +// .object({ +// val: z.number(), +// }) +// .nonstrict(), +// }) +// .nonstrict(), +// }) +// .nonstrict(); + +// const fragment = FragmentOnA.parse(a); +// fragment; +// }); + +// test('invalid check', () => { +// expect(() => A.parse({} as any)).toThrow(); +// }); + +// test('schema getter', () => { +// (A as z.ZodLazy).schema; +// }); + +// test("self recursion with cyclical data", () => { +// interface Category { +// name: string; +// subcategories: Category[]; +// } + +// const Category: z.ZodType = z.late.object(() => ({ +// name: z.string(), +// subcategories: z.array(Category), +// })); + +// const untypedCategory: any = { +// name: "Category A", +// }; +// // creating a cycle +// untypedCategory.subcategories = [untypedCategory]; +// Category.parse(untypedCategory); +// }); + +// test("self recursion with base type", () => { +// const BaseCategory = z.object({ +// name: z.string(), +// }); +// type BaseCategory = z.infer; + +// type Category = BaseCategory & { subcategories: Category[] }; + +// const Category: z.ZodType = z.late +// .object(() => ({ +// subcategories: z.array(Category), +// })) +// .extend({ +// name: z.string(), +// }); + +// const untypedCategory: any = { +// name: "Category A", +// }; +// // creating a cycle +// untypedCategory.subcategories = [untypedCategory]; +// Category.parse(untypedCategory); // parses successfully +// }); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/refine.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/refine.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..55c27fea501d4b6763c0f700cf7c36eaee953b1d --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/refine.test.ts @@ -0,0 +1,313 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +import { ZodIssueCode } from "../ZodError.js"; +import { util } from "../helpers/util.js"; + +test("refinement", () => { + const obj1 = z.object({ + first: z.string(), + second: z.string(), + }); + const obj2 = obj1.partial().strict(); + + const obj3 = obj2.refine((data) => data.first || data.second, "Either first or second should be filled in."); + + expect(obj1 === (obj2 as any)).toEqual(false); + expect(obj2 === (obj3 as any)).toEqual(false); + + expect(() => obj1.parse({})).toThrow(); + expect(() => obj2.parse({ third: "adsf" })).toThrow(); + expect(() => obj3.parse({})).toThrow(); + obj3.parse({ first: "a" }); + obj3.parse({ second: "a" }); + obj3.parse({ first: "a", second: "a" }); +}); + +test("refinement 2", () => { + const validationSchema = z + .object({ + email: z.string().email(), + password: z.string(), + confirmPassword: z.string(), + }) + .refine((data) => data.password === data.confirmPassword, "Both password and confirmation must match"); + + expect(() => + validationSchema.parse({ + email: "aaaa@gmail.com", + password: "aaaaaaaa", + confirmPassword: "bbbbbbbb", + }) + ).toThrow(); +}); + +test("refinement type guard", () => { + const validationSchema = z.object({ + a: z.string().refine((s): s is "a" => s === "a"), + }); + type Input = z.input; + type Schema = z.infer; + + util.assertEqual<"a", Input["a"]>(false); + util.assertEqual(true); + + util.assertEqual<"a", Schema["a"]>(true); + util.assertEqual(false); +}); + +test("refinement Promise", async () => { + const validationSchema = z + .object({ + email: z.string().email(), + password: z.string(), + confirmPassword: z.string(), + }) + .refine( + (data) => Promise.resolve().then(() => data.password === data.confirmPassword), + "Both password and confirmation must match" + ); + + await validationSchema.parseAsync({ + email: "aaaa@gmail.com", + password: "password", + confirmPassword: "password", + }); +}); + +test("custom path", async () => { + const result = await z + .object({ + password: z.string(), + confirm: z.string(), + }) + .refine((data) => data.confirm === data.password, { path: ["confirm"] }) + .spa({ password: "asdf", confirm: "qewr" }); + expect(result.success).toEqual(false); + if (!result.success) { + expect(result.error.issues[0].path).toEqual(["confirm"]); + } +}); + +test("use path in refinement context", async () => { + const noNested = z.string()._refinement((_val, ctx) => { + if (ctx.path.length > 0) { + ctx.addIssue({ + code: ZodIssueCode.custom, + message: `schema cannot be nested. path: ${ctx.path.join(".")}`, + }); + return false; + } else { + return true; + } + }); + + const data = z.object({ + foo: noNested, + }); + + const t1 = await noNested.spa("asdf"); + const t2 = await data.spa({ foo: "asdf" }); + + expect(t1.success).toBe(true); + expect(t2.success).toBe(false); + if (t2.success === false) { + expect(t2.error.issues[0].message).toEqual("schema cannot be nested. path: foo"); + } +}); + +test("superRefine", () => { + const Strings = z.array(z.string()).superRefine((val, ctx) => { + if (val.length > 3) { + ctx.addIssue({ + code: z.ZodIssueCode.too_big, + maximum: 3, + type: "array", + inclusive: true, + exact: true, + message: "Too many items 😡", + }); + } + + if (val.length !== new Set(val).size) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: `No duplicates allowed.`, + }); + } + }); + + const result = Strings.safeParse(["asfd", "asfd", "asfd", "asfd"]); + + expect(result.success).toEqual(false); + if (!result.success) expect(result.error.issues.length).toEqual(2); + + Strings.parse(["asfd", "qwer"]); +}); + +test("superRefine async", async () => { + const Strings = z.array(z.string()).superRefine(async (val, ctx) => { + if (val.length > 3) { + ctx.addIssue({ + code: z.ZodIssueCode.too_big, + maximum: 3, + type: "array", + inclusive: true, + exact: true, + message: "Too many items 😡", + }); + } + + if (val.length !== new Set(val).size) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: `No duplicates allowed.`, + }); + } + }); + + const result = await Strings.safeParseAsync(["asfd", "asfd", "asfd", "asfd"]); + + expect(result.success).toEqual(false); + if (!result.success) expect(result.error.issues.length).toEqual(2); + + Strings.parseAsync(["asfd", "qwer"]); +}); + +test("superRefine - type narrowing", () => { + type NarrowType = { type: string; age: number }; + const schema = z + .object({ + type: z.string(), + age: z.number(), + }) + .nullable() + .superRefine((arg, ctx): arg is NarrowType => { + if (!arg) { + // still need to make a call to ctx.addIssue + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: "cannot be null", + fatal: true, + }); + return false; + } + return true; + }); + + util.assertEqual, NarrowType>(true); + + expect(schema.safeParse({ type: "test", age: 0 }).success).toEqual(true); + expect(schema.safeParse(null).success).toEqual(false); +}); + +test("chained mixed refining types", () => { + type firstRefinement = { first: string; second: number; third: true }; + type secondRefinement = { first: "bob"; second: number; third: true }; + type thirdRefinement = { first: "bob"; second: 33; third: true }; + const schema = z + .object({ + first: z.string(), + second: z.number(), + third: z.boolean(), + }) + .nullable() + .refine((arg): arg is firstRefinement => !!arg?.third) + .superRefine((arg, ctx): arg is secondRefinement => { + util.assertEqual(true); + if (arg.first !== "bob") { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: "`first` property must be `bob`", + }); + return false; + } + return true; + }) + .refine((arg): arg is thirdRefinement => { + util.assertEqual(true); + return arg.second === 33; + }); + + util.assertEqual, thirdRefinement>(true); +}); + +test("get inner type", () => { + z.string() + .refine(() => true) + .innerType() + .parse("asdf"); +}); + +test("chained refinements", () => { + const objectSchema = z + .object({ + length: z.number(), + size: z.number(), + }) + .refine(({ length }) => length > 5, { + path: ["length"], + message: "length greater than 5", + }) + .refine(({ size }) => size > 7, { + path: ["size"], + message: "size greater than 7", + }); + const r1 = objectSchema.safeParse({ + length: 4, + size: 9, + }); + expect(r1.success).toEqual(false); + if (!r1.success) expect(r1.error.issues.length).toEqual(1); + + const r2 = objectSchema.safeParse({ + length: 4, + size: 3, + }); + expect(r2.success).toEqual(false); + if (!r2.success) expect(r2.error.issues.length).toEqual(2); +}); + +test("fatal superRefine", () => { + const Strings = z + .string() + .superRefine((val, ctx) => { + if (val === "") { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: "foo", + fatal: true, + }); + } + }) + .superRefine((val, ctx) => { + if (val !== " ") { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: "bar", + }); + } + }); + + const result = Strings.safeParse(""); + + expect(result.success).toEqual(false); + if (!result.success) expect(result.error.issues.length).toEqual(1); +}); + +test("superRefine after skipped transform", () => { + const schema = z + .string() + .regex(/^\d+$/) + .transform((val) => Number(val)) + .superRefine((val) => { + if (typeof val !== "number") { + throw new Error("Called without transform"); + } + }); + + const result = schema.safeParse(""); + + expect(result.success).toEqual(false); +}); diff --git a/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/safeparse.test.ts b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/safeparse.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..950a2df5eba33f66d5141444a92558ac9caa9c0a --- /dev/null +++ b/node_modules/@jimp/plugin-blit/node_modules/zod/src/v3/tests/safeparse.test.ts @@ -0,0 +1,27 @@ +// @ts-ignore TS6133 +import { expect, test } from "vitest"; + +import * as z from "zod/v3"; +const stringSchema = z.string(); + +test("safeparse fail", () => { + const safe = stringSchema.safeParse(12); + expect(safe.success).toEqual(false); + expect(safe.error).toBeInstanceOf(z.ZodError); +}); + +test("safeparse pass", () => { + const safe = stringSchema.safeParse("12"); + expect(safe.success).toEqual(true); + expect(safe.data).toEqual("12"); +}); + +test("safeparse unexpected error", () => { + expect(() => + stringSchema + .refine((data) => { + throw new Error(data); + }) + .safeParse("12") + ).toThrow(); +});