docs: 仓库链接指向本镜像仓库
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run

This commit is contained in:
TanTan committed 2026-11-13 09:27:07 +08:00
1 parent fa9c73363d
commit 2a69b23b47
18210 files changed
+5101211 -16

No files matched your search

@@ -0,0 +1 @@
{"version":3,"file":"hammer.js","sources":["../../../src/icons/hammer.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Hammer\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTUgMTItOC4zNzMgOC4zNzNhMSAxIDAgMSAxLTMtM0wxMiA5IiAvPgogIDxwYXRoIGQ9Im0xOCAxNSA0LTQiIC8+CiAgPHBhdGggZD0ibTIxLjUgMTEuNS0xLjkxNC0xLjkxNEEyIDIgMCAwIDEgMTkgOC4xNzJWN2wtMi4yNi0yLjI2YTYgNiAwIDAgMC00LjIwMi0xLjc1Nkw5IDIuOTZsLjkyLjgyQTYuMTggNi4xOCAwIDAgMSAxMiA4LjRWMTBsMiAyaDEuMTcyYTIgMiAwIDAgMSAxLjQxNC41ODZMMTguNSAxNC41IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/hammer\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Hammer = createLucideIcon('Hammer', [\n ['path', { d: 'm15 12-8.373 8.373a1 1 0 1 1-3-3L12 9', key: 'eefl8a' }],\n ['path', { d: 'm18 15 4-4', key: '16gjal' }],\n [\n 'path',\n {\n d: 'm21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5',\n key: 'b7pghm',\n },\n ],\n]);\n\nexport default Hammer;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,iBAAiB,QAAU,CAAA,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAyC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACtE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAC3C,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CA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 -0,0 +1,22 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
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
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABILITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference lib="es2020" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
/// <reference lib="dom.asynciterable" />
@@ -0,0 +1 @@
{"version":3,"file":"user-check-2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../src/scoring/index.ts"],"sourcesContent":[null],"names":["Scoring","constructor","options","password","optimal","excludeAdditive","fillArray","size","valueType","result","i","value","push","makeBruteforceMatch","j","pattern","token","slice","update","match","sequenceLength","k","estimatedMatch","estimateGuesses","pi","guesses","guessesProduct","g","utils","factorial","MIN_GUESSES_BEFORE_GROWING_SEQUENCE","shouldSkip","competingG","totalGuesses","Object","keys","forEach","competingPatternLengthStr","competingPatternLength","parseInt","competingMetricMatch","bestMatches","bruteforceUpdate","passwordCharIndex","tmp","sequenceLengthStr","lastMatch","unwind","passwordLength","optimalMatchSequence","temp","candidateSequenceLengthStr","candidateSequenceLength","candidateMetricMatch","unshift","mostGuessableMatchSequence","matches","length","matchesByCoordinateJ","map","sort","m1","m2","prevM","optimalSequenceLength","getGuesses","guessesLog10","log10","sequence"],"mappings":";;;;AAWc,MAAOA,OAAO,CAAA;EAO1BC,WAAAA,CAAoBC,OAAgB,EA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uB,GAAGb,QAAQ,CAACY,0BAA0B,EAAE,EAAE,CAAC;AACxE,QAAA,MAAME,oBAAoB,GAAGH,IAAI,CAACE,uBAAuB,CAAC;QAC1D,IAAIC,oBAAoB,GAAG1B,CAAC,EAAE;AAC5BP,UAAAA,cAAc,GAAGgC,uBAAuB;AACxCzB,UAAAA,CAAC,GAAG0B,oBAAoB;AAC1B,QAAA;AACF,MAAA,CAAC,CAAC;AACJ,IAAA;IACA,OAAOhC,CAAC,IAAI,CAAC,EAAE;AACb,MAAA,MAAMF,KAAK,GAAmB,IAAI,CAACf,OAAO,CAACqC,WAAW,CAACpB,CAAC,CAAC,CAACD,cAAc,CAAC;AACzE6B,MAAAA,oBAAoB,CAACK,OAAO,CAACnC,KAAK,CAAC;AACnCE,MAAAA,CAAC,GAAGF,KAAK,CAACT,CAAC,GAAG,CAAC;AACfU,MAAAA,cAAc,IAAI,CAAC;AACrB,IAAA;AACA,IAAA,OAAO6B,oBAAoB;AAC7B,EAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACAM,0BAA0BA,CACxBpD,QAAgB,EAChBLine truncated
@@ -0,0 +1,14 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -0,0 +1,50 @@
import { Feature, frame } from 'motion-dom';
import { noop } from 'motion-utils';
import { addPointerEvent } from '../../events/add-pointer-event.mjs';
import { getContextWindow } from '../../utils/get-context-window.mjs';
import { PanSession } from './PanSession.mjs';
const asyncHandler = (handler) => (event, info) => {
if (handler) {
frame.update(() => handler(event, info), false, true);
}
};
class PanGesture extends Feature {
constructor() {
super(...arguments);
this.removePointerDownListener = noop;
}
onPointerDown(pointerDownEvent) {
this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), {
transformPagePoint: this.node.getTransformPagePoint(),
contextWindow: getContextWindow(this.node),
});
}
createPanHandlers() {
const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps();
return {
onSessionStart: asyncHandler(onPanSessionStart),
onStart: asyncHandler(onPanStart),
onMove: asyncHandler(onPan),
onEnd: (event, info) => {
delete this.session;
if (onPanEnd) {
frame.postRender(() => onPanEnd(event, info));
}
},
};
}
mount() {
this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (event) => this.onPointerDown(event));
}
update() {
this.session && this.session.updateHandlers(this.createPanHandlers());
}
unmount() {
this.removePointerDownListener();
this.session && this.session.end();
}
}
export { PanGesture };
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,40 @@
declare function traverse(
schema: traverse.SchemaObject,
opts: traverse.Options,
cb?: traverse.Callback
): void;
declare function traverse(
schema: traverse.SchemaObject,
cb: traverse.Callback
): void;
declare namespace traverse {
interface SchemaObject {
$id?: string;
$schema?: string;
[x: string]: any;
}
type Callback = (
schema: SchemaObject,
jsonPtr: string,
rootSchema: SchemaObject,
parentJsonPtr?: string,
parentKeyword?: string,
parentSchema?: SchemaObject,
keyIndex?: string | number
) => void;
interface Options {
allKeys?: boolean;
cb?:
| Callback
| {
pre?: Callback;
post?: Callback;
};
}
}
export = traverse;
@@ -0,0 +1,226 @@
export default `flf2a$ 2 2 8 -1 20
Cyberfont - small
Figlet conversion by Kent Nassen, kentn@cyberspace.org, 8-11-94
From: stock@fwi.uva.nl (Lennert Stock)
Date: 15 Jul 1994 00:04:25 GMT
Here are some fonts. Non-figlet I'm afraid, if you wanna convert them, be
my guest. I posted the isometric fonts before.
------------------------------------------------------------------------------
.x%%%%%%x. .x%%%%%%x.
,%%%%%%%%%%. .%%%%%%%%%%.
,%%%' )' \\) :( \`( \`%%%.
,%x%)________) --------- L e n n e r t S t o c k ( _ __ (%x%.
(%%%~^88P~88P| |~=> .=-~ %%%)
(%%::. .:,\\ .' \`. /,:. .::%%)
\`;%:\`\\. \`-' | | \`-' ./':%:'
\`\`x\`. -===.' stock@fwi.uva.nl -------- \`.===- .'x''
/ \`:\`.__.; :.__.':' \\
.d8b. ..\`. .'.. .d8b.
$@
$@@
/@
. @@
''@
@@
@
@@
@
@@
@
@@
@
@@
'@
@@
@
@@
@
@@
@
@@
@
@@
$ @
,@@
@
--@@
$@
.@@
/@
/ @@
@
@@
@
@@
@
@@
@
@@
@
@@
@
@@
@
@@
@
@@
@
@@
@
@@
.@
.@@
.@
,@@
@
@@
@
@@
@
@@
-,@
. @@
@
@@
____@
|--|@@
___ @
|==]@@
____@
|___@@
___ @
|__>@@
____@
|===@@
____@
|---@@
____@
|__,@@
_ _@
|--|@@
_@
|@@
_@
___|@@
_ _@
|-:_@@
_ @
|___@@
_ _@
|\\/|@@
__ _@
| \\|@@
____@
[__]@@
___ @
|--'@@
__ @
[_,]@@
____@
|--<@@
____@
====@@
___@
| @@
_ _@
|__|@@
_ _@
\\/ @@
_ _@
|/\\|@@
_ _@
_X_@@
_ _@
Y @@
___ @
/__@@
@
@@
\\ @
\\@@
@
@@
@
@@
@
___@@
\`@
@@
____@
|--|@@
___ @
|==]@@
____@
|___@@
___ @
|__>@@
____@
|===@@
____@
|---@@
____@
|__,@@
_ _@
|--|@@
_@
|@@
_@
___|@@
_ _@
|-:_@@
_ @
|___@@
_ _@
|\\/|@@
__ _@
| \\|@@
____@
[__]@@
___ @
|--'@@
__ @
[_,]@@
____@
|--<@@
____@
====@@
___@
| @@
_ _@
|__|@@
_ _@
\\/ @@
_ _@
|/\\|@@
_ _@
_X_@@
_ _@
Y @@
___ @
/__@@
@
@@
|@
|@@
@
@@
@
@@
@
@@
@
@@
@
@@
@
@@
@
@@
@
@@
@
@@
`
@@ -0,0 +1,69 @@
# content-type
[![NPM version][npm-image]][npm-url]
[![NPM downloads][downloads-image]][downloads-url]
[![Build status][build-image]][build-url]
[![Build coverage][coverage-image]][coverage-url]
[![License][license-image]][license-url]
Create and parse HTTP `Content-Type` header.
## Installation
```sh
npm install content-type
```
## API
```js
const contentType = require("content-type");
```
### contentType.parse(string, options?)
```js
const obj = contentType.parse("image/svg+xml; charset=utf-8");
```
Parse a `Content-Type` header. This will return an object with the following properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`):
- `type`: The media type. Example: `'image/svg+xml'`.
- `parameters`: An object of the parameters in the media type (parameter name is always lower case). Example: `{charset: 'utf-8'}`.
The parser is lenient and does not error. You should validate `type` and `parameters` before trusting them.
#### Options
- `parameters` (default: `true`): Set to `false` to skip parameters.
### contentType.format(obj)
```js
const str = contentType.format({
type: "image/svg+xml",
parameters: { charset: "utf-8" },
});
```
Format an object into a `Content-Type` header. This will return a string of the content type for the given object with the following properties (examples are shown that produce the string `'image/svg+xml; charset=utf-8'`):
- `type`: The media type. Example: `'image/svg+xml'`.
- `parameters`: An optional object of the parameters in the media type. Example: `{charset: 'utf-8'}`.
Throws a `TypeError` if the object contains an invalid type or parameter names.
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/content-type
[npm-url]: https://npmjs.org/package/content-type
[downloads-image]: https://img.shields.io/npm/dm/content-type
[downloads-url]: https://npmjs.org/package/content-type
[build-image]: https://img.shields.io/github/actions/workflow/status/jshttp/content-type/ci.yml?branch=master
[build-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml?query=branch%3Amaster
[coverage-image]: https://img.shields.io/codecov/c/gh/jshttp/content-type
[coverage-url]: https://codecov.io/gh/jshttp/content-type
[license-image]: http://img.shields.io/npm/l/content-type.svg?style=flat
[license-url]: LICENSE
@@ -0,0 +1,69 @@
{
"name": "chokidar",
"description": "Minimal and efficient cross-platform file watching library",
"version": "4.0.3",
"homepage": "https://github.com/paulmillr/chokidar",
"author": "Paul Miller (https://paulmillr.com)",
"files": [
"index.js",
"index.d.ts",
"handler.js",
"handler.d.ts",
"esm"
],
"main": "./index.js",
"module": "./esm/index.js",
"types": "./index.d.ts",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./index.js"
},
"./handler.js": {
"import": "./esm/handler.js",
"require": "./handler.js"
}
},
"dependencies": {
"readdirp": "^4.0.1"
},
"devDependencies": {
"@paulmillr/jsbt": "0.2.1",
"@types/node": "20.14.8",
"chai": "4.3.4",
"prettier": "3.1.1",
"rimraf": "5.0.5",
"sinon": "12.0.1",
"sinon-chai": "3.7.0",
"typescript": "5.5.2",
"upath": "2.0.1"
},
"sideEffects": false,
"engines": {
"node": ">= 14.16.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/paulmillr/chokidar.git"
},
"bugs": {
"url": "https://github.com/paulmillr/chokidar/issues"
},
"license": "MIT",
"scripts": {
"build": "tsc && tsc -p tsconfig.esm.json",
"lint": "prettier --check src",
"format": "prettier --write src",
"test": "node --test"
},
"keywords": [
"fs",
"watch",
"watchFile",
"watcher",
"watching",
"file",
"fsevents"
],
"funding": "https://paulmillr.com/funding/"
}
@@ -0,0 +1 @@
{"version":3,"file":"file-audio.js","sources":["../../../src/icons/file-audio.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name FileAudio\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTcuNSAyMmguNWEyIDIgMCAwIDAgMi0yVjdsLTUtNUg2YTIgMiAwIDAgMC0yIDJ2MyIgLz4KICA8cGF0aCBkPSJNMTQgMnY0YTIgMiAwIDAgMCAyIDJoNCIgLz4KICA8cGF0aCBkPSJNMiAxOWEyIDIgMCAxIDEgNCAwdjFhMiAyIDAgMSAxLTQgMHYtNGE2IDYgMCAwIDEgMTIgMHY0YTIgMiAwIDEgMS00IDB2LTFhMiAyIDAgMSAxIDQgMCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/file-audio\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst FileAudio = createLucideIcon('FileAudio', [\n ['path', { d: 'M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3', key: 'rslqgf' }],\n ['path', { d: 'M14 2v4a2 2 0 0 0 2 2h4', key: 'tnqrlb' }],\n [\n 'path',\n {\n d: 'M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0',\n key: '9f7x3i',\n },\n ],\n]);\n\nexport default FileAudio;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,iBAAiB,WAAa,CAAA,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAsD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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AAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"banana.js","sources":["../../../src/icons/banana.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Banana\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNCAxM2MzLjUtMiA4LTIgMTAgMmE1LjUgNS41IDAgMCAxIDggNSIgLz4KICA8cGF0aCBkPSJNNS4xNSAxNy44OWM1LjUyLTEuNTIgOC42NS02Ljg5IDctMTJDMTEuNTUgNCAxMS41IDIgMTMgMmMzLjIyIDAgNSA1LjUgNSA4IDAgNi41LTQuMiAxMi0xMC40OSAxMkM1LjExIDIyIDIgMjIgMiAyMGMwLTEuNSAxLjE0LTEuNTUgMy4xNS0yLjExWiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/banana\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Banana = createLucideIcon('Banana', [\n ['path', { d: 'M4 13c3.5-2 8-2 10 2a5.5 5.5 0 0 1 8 5', key: '1cscit' }],\n [\n 'path',\n {\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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"webcam.js","sources":["../../../src/icons/webcam.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Webcam\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEwIiByPSI4IiAvPgogIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTAiIHI9IjMiIC8+CiAgPHBhdGggZD0iTTcgMjJoMTAiIC8+CiAgPHBhdGggZD0iTTEyIDIydi00IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/webcam\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Webcam = createLucideIcon('Webcam', [\n ['circle', { cx: '12', cy: '10', r: '8', key: '1gshiw' }],\n ['circle', { cx: '12', cy: '10', r: '3', key: 'ilqhr7' }],\n ['path', { d: 'M7 22h10', key: '10w4w3' }],\n ['path', { d: 'M12 22v-4', key: '1utk9m' }],\n]);\n\nexport default Webcam;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,iBAAiB,QAAU,CAAA,CAAA,CAAA;AAAA,CACxC,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CACxD,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC5C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const AlignJustify = createLucideIcon("AlignJustify", [
["path", { d: "M3 12h18", key: "1i2n21" }],
["path", { d: "M3 18h18", key: "1h113x" }],
["path", { d: "M3 6h18", key: "d0wm0j" }]
]);
export { AlignJustify as default };
//# sourceMappingURL=align-justify.js.map
@@ -0,0 +1 @@
{"version":3,"file":"scoring.mjs","sources":["../../../src/matcher/sequence/scoring.ts"],"sourcesContent":[null],"names":["token","ascending","firstChr","charAt","baseGuesses","startingPoints","includes","exec","length"],"mappings":"AAEA,sBAAe,CAAC;EAAEA,KAAK;AAAEC,EAAAA;AAAS,CAAkC,KAAI;AACtE,EAAA,MAAMC,QAAQ,GAAGF,KAAK,CAACG,MAAM,CAAC,CAAC,CAAC;AAChC,EAAA,IAAIC,WAAW;AACf,EAAA,MAAMC,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAC1D;AACA,EAAA,IAAIA,cAAc,CAACC,QAAQ,CAACJ,QAAQ,CAAC,EAAE;AACrCE,IAAAA,WAAW,GAAG,CAAC;EACjB,CAAC,MAAM,IAAI,IAAI,CAACG,IAAI,CAACL,QAAQ,CAAC,EAAE;IAC9BE,WAAW,GAAG,EAAE,CAAA;AAClB,EAAA,CAAC,MAAM;AACL;AACA;AACAA,IAAAA,WAAW,GAAG,EAAE;AAClB,EAAA;AACA;AACA;EACA,IAAI,CAACH,SAAS,EAAE;AACdG,IAAAA,WAAW,IAAI,CAAC;AAClB,EAAA;AACA,EAAA,OAAOA,WAAW,GAAGJ,KAAK,CAACQ,MAAM;AACnC,CAAC;;;;"}
@@ -0,0 +1,317 @@
/* eslint-disable no-console */
import commander from "commander";
import {glob} from "tinyglobby";
import {exists, mkdir, readdir, readFile, stat, writeFile} from "mz/fs";
import {dirname, join, relative} from "path";
import { transform} from "./index";
export default function run() {
commander
.description(`Sucrase: super-fast Babel alternative.`)
.usage("[options] <srcDir>")
.option(
"-d, --out-dir <out>",
"Compile an input directory of modules into an output directory.",
)
.option(
"-p, --project <dir>",
"Compile a TypeScript project, will read from tsconfig.json in <dir>",
)
.option("--out-extension <extension>", "File extension to use for all output files.", "js")
.option("--exclude-dirs <paths>", "Names of directories that should not be traversed.")
.option("-q, --quiet", "Don't print the names of converted files.")
.option("-t, --transforms <transforms>", "Comma-separated list of transforms to run.")
.option("--disable-es-transforms", "Opt out of all ES syntax transforms.")
.option("--jsx-runtime <string>", "Transformation mode for the JSX transform.")
.option("--production", "Disable debugging information from JSX in output.")
.option(
"--jsx-import-source <string>",
"Automatic JSX transform import path prefix, defaults to `React.Fragment`.",
)
.option(
"--jsx-pragma <string>",
"Classic JSX transform element creation function, defaults to `React.createElement`.",
)
.option(
"--jsx-fragment-pragma <string>",
"Classic JSX transform fragment component, defaults to `React.Fragment`.",
)
.option("--keep-unused-imports", "Disable automatic removal of type-only imports/exports.")
.option("--preserve-dynamic-import", "Don't transpile dynamic import() to require.")
.option(
"--inject-create-require-for-import-require",
"Use `createRequire` when transpiling TS `import = require` to ESM.",
)
.option(
"--enable-legacy-typescript-module-interop",
"Use default TypeScript ESM/CJS interop strategy.",
)
.option("--enable-legacy-babel5-module-interop", "Use Babel 5 ESM/CJS interop strategy.")
.parse(process.argv);
if (commander.project) {
if (
commander.outDir ||
commander.transforms ||
commander.args[0] ||
commander.enableLegacyTypescriptModuleInterop
) {
console.error(
"If TypeScript project is specified, out directory, transforms, source " +
"directory, and --enable-legacy-typescript-module-interop may not be specified.",
);
process.exit(1);
}
} else {
if (!commander.outDir) {
console.error("Out directory is required");
process.exit(1);
}
if (!commander.transforms) {
console.error("Transforms option is required.");
process.exit(1);
}
if (!commander.args[0]) {
console.error("Source directory is required.");
process.exit(1);
}
}
const options = {
outDirPath: commander.outDir,
srcDirPath: commander.args[0],
project: commander.project,
outExtension: commander.outExtension,
excludeDirs: commander.excludeDirs ? commander.excludeDirs.split(",") : [],
quiet: commander.quiet,
sucraseOptions: {
transforms: commander.transforms ? commander.transforms.split(",") : [],
disableESTransforms: commander.disableEsTransforms,
jsxRuntime: commander.jsxRuntime,
production: commander.production,
jsxImportSource: commander.jsxImportSource,
jsxPragma: commander.jsxPragma || "React.createElement",
jsxFragmentPragma: commander.jsxFragmentPragma || "React.Fragment",
keepUnusedImports: commander.keepUnusedImports,
preserveDynamicImport: commander.preserveDynamicImport,
injectCreateRequireForImportRequire: commander.injectCreateRequireForImportRequire,
enableLegacyTypeScriptModuleInterop: commander.enableLegacyTypescriptModuleInterop,
enableLegacyBabel5ModuleInterop: commander.enableLegacyBabel5ModuleInterop,
},
};
buildDirectory(options).catch((e) => {
process.exitCode = 1;
console.error(e);
});
}
async function findFiles(options) {
const outDirPath = options.outDirPath;
const srcDirPath = options.srcDirPath;
const extensions = options.sucraseOptions.transforms.includes("typescript")
? [".ts", ".tsx"]
: [".js", ".jsx"];
if (!(await exists(outDirPath))) {
await mkdir(outDirPath);
}
const outArr = [];
for (const child of await readdir(srcDirPath)) {
if (["node_modules", ".git"].includes(child) || options.excludeDirs.includes(child)) {
continue;
}
const srcChildPath = join(srcDirPath, child);
const outChildPath = join(outDirPath, child);
if ((await stat(srcChildPath)).isDirectory()) {
const innerOptions = {...options};
innerOptions.srcDirPath = srcChildPath;
innerOptions.outDirPath = outChildPath;
const innerFiles = await findFiles(innerOptions);
outArr.push(...innerFiles);
} else if (extensions.some((ext) => srcChildPath.endsWith(ext))) {
const outPath = outChildPath.replace(/\.\w+$/, `.${options.outExtension}`);
outArr.push({
srcPath: srcChildPath,
outPath,
});
}
}
return outArr;
}
async function runGlob(options) {
const tsConfigPath = join(options.project, "tsconfig.json");
let str;
try {
str = await readFile(tsConfigPath, "utf8");
} catch (err) {
console.error("Could not find project tsconfig.json");
console.error(` --project=${options.project}`);
console.error(err);
process.exit(1);
}
const json = JSON.parse(str);
const foundFiles = [];
const files = json.files;
const include = json.include;
const absProject = join(process.cwd(), options.project);
const outDirs = [];
if (!(await exists(options.outDirPath))) {
await mkdir(options.outDirPath);
}
if (files) {
for (const file of files) {
if (file.endsWith(".d.ts")) {
continue;
}
if (!file.endsWith(".ts") && !file.endsWith(".js")) {
continue;
}
const srcFile = join(absProject, file);
const outFile = join(options.outDirPath, file);
const outPath = outFile.replace(/\.\w+$/, `.${options.outExtension}`);
const outDir = dirname(outPath);
if (!outDirs.includes(outDir)) {
outDirs.push(outDir);
}
foundFiles.push({
srcPath: srcFile,
outPath,
});
}
}
if (include) {
for (const pattern of include) {
const globFiles = await glob(join(absProject, pattern), {expandDirectories: false});
for (const file of globFiles) {
if (!file.endsWith(".ts") && !file.endsWith(".js")) {
continue;
}
if (file.endsWith(".d.ts")) {
continue;
}
const relativeFile = relative(absProject, file);
const outFile = join(options.outDirPath, relativeFile);
const outPath = outFile.replace(/\.\w+$/, `.${options.outExtension}`);
const outDir = dirname(outPath);
if (!outDirs.includes(outDir)) {
outDirs.push(outDir);
}
foundFiles.push({
srcPath: file,
outPath,
});
}
}
}
for (const outDirPath of outDirs) {
if (!(await exists(outDirPath))) {
await mkdir(outDirPath);
}
}
// TODO: read exclude
return foundFiles;
}
async function updateOptionsFromProject(options) {
/**
* Read the project information and assign the following.
* - outDirPath
* - transform: imports
* - transform: typescript
* - enableLegacyTypescriptModuleInterop: true/false.
*/
const tsConfigPath = join(options.project, "tsconfig.json");
let str;
try {
str = await readFile(tsConfigPath, "utf8");
} catch (err) {
console.error("Could not find project tsconfig.json");
console.error(` --project=${options.project}`);
console.error(err);
process.exit(1);
}
const json = JSON.parse(str);
const sucraseOpts = options.sucraseOptions;
if (!sucraseOpts.transforms.includes("typescript")) {
sucraseOpts.transforms.push("typescript");
}
const compilerOpts = json.compilerOptions;
if (compilerOpts.outDir) {
options.outDirPath = join(process.cwd(), options.project, compilerOpts.outDir);
}
if (compilerOpts.esModuleInterop !== true) {
sucraseOpts.enableLegacyTypeScriptModuleInterop = true;
}
if (compilerOpts.module === "commonjs") {
if (!sucraseOpts.transforms.includes("imports")) {
sucraseOpts.transforms.push("imports");
}
}
}
async function buildDirectory(options) {
let files;
if (options.outDirPath && options.srcDirPath) {
files = await findFiles(options);
} else if (options.project) {
await updateOptionsFromProject(options);
files = await runGlob(options);
} else {
console.error("Project or Source directory required.");
process.exit(1);
}
for (const file of files) {
await buildFile(file.srcPath, file.outPath, options);
}
}
async function buildFile(srcPath, outPath, options) {
if (!options.quiet) {
console.log(`${srcPath} -> ${outPath}`);
}
const code = (await readFile(srcPath)).toString();
const transformedCode = transform(code, {...options.sucraseOptions, filePath: srcPath}).code;
await writeFile(outPath, transformedCode);
}
@@ -0,0 +1 @@
{"version":3,"file":"observers.mjs","sources":["../../../../../src/motion/features/viewport/observers.ts"],"sourcesContent":["type IntersectionHandler = (entry: IntersectionObserverEntry) => void\n\ninterface ElementIntersectionObservers {\n [key: string]: IntersectionObserver\n}\n\n/**\n * Map an IntersectionHandler callback to an element. We only ever make one handler for one\n * element, so even though these handlers might all be triggered by different\n * observers, we can keep them in the same map.\n */\nconst observerCallbacks = new WeakMap<Element, IntersectionHandler>()\n\n/**\n * Multiple observers can be created for multiple element/document roots. Each with\n * different settings. So here we store dictionaries of observers to each root,\n * using serialised settings (threshold/margin) as lookup keys.\n */\nconst observers = new WeakMap<\n Element | Document,\n ElementIntersectionObservers\n>()\n\nconst fireObserverCallback = (entry: IntersectionObserverEntry) => {\n const callback = observerCallbacks.get(entry.target)\n callback && callback(entry)\n}\n\nconst fireAllObserverCallbacks: IntersectionObserverCallback = (entries) => {\n entries.forEach(fireObserverCallback)\n}\n\nfunction initIntersectionObserver({\n root,\n ...options\n}: IntersectionObserverInit): IntersectionObserver {\n const lookupRoot = root || document\n\n /**\n * If we don't have an observer lookup map for this root, create one.\n */\n if (!observers.has(lookupRoot)) {\n observers.set(lookupRoot, {})\n }\n const rootObservers = observers.get(lookupRoot)!\n\n const key = JSON.stringify(options)\n\n /**\n * If we don't have an observer for this combination of root and settings,\n * create one.\n */\n if (!rootObservers[key]) {\n rootObservers[key] = new IntersectionObserver(\n fireAllObserverCallbacks,\n { root, ...options }\n )\n }\n\n return rootObservers[key]\n}\n\nexport function observeIntersection(\n element: Element,\n options: IntersectionObserverInit,\n callback: IntersectionHandler\n) {\n const rootInteresectionObserver = initIntersectionObserver(options)\n\n observerCallbacks.set(element, callback)\n rootInteresectionObserver.observe(element)\n\n return () => {\n observerCallbacks.delete(element)\n rootInteresectionObserver.unobserve(element)\n }\n}\n"],"names":[],"mappings":"AAMA;;;;AAIG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAgC;AAErE;;;;AAIG;AACH,MAAM,SAAS,GAAG,IAAI,OAAO,EAG1B;AAEH,MAAM,oBAAoB,GAAG,CAAC,KAAgC,KAAI;IAC9D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;AACpD,IAAA,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC;AAC/B,CAAC;AAED,MAAM,wBAAwB,GAAiC,CAAC,OAAO,KAAI;AACvE,IAAA,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC;AACzC,CAAC;AAED,SAAS,wBAAwB,CAAC,EAC9B,IAAI,EACJ,GAAG,OAAO,EACa,EAAA;AACvB,IAAA,MAAM,UAAU,GAAG,IAAI,IAAI,QAAQ;AAEnC;;AAEG;IACH,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;AAC5B,QAAA,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC;IACjC;IACA,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAE;IAEhD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;AAEnC;;;AAGG;AACH,IAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE;AACrB,QAAA,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI,oBAAoB,CACzC,wBAAwB,EACxB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CACvB;IACL;AAEA,IAAA,OAAO,aAAa,CAAC,GAAG,CAAC;AAC7B;SAEgB,mBAAmB,CAC/B,OAAgB,EAChB,OAAiC,EACjC,QAA6B,EAAA;AAE7B,IAAA,MAAM,yBAAyB,GAAG,wBAAwB,CAAC,OAAO,CAAC;AAEnE,IAAA,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC;AACxC,IAAA,yBAAyB,CAAC,OAAO,CAAC,OAAO,CAAC;AAE1C,IAAA,OAAO,MAAK;AACR,QAAA,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC;AACjC,QAAA,yBAAyB,CAAC,SAAS,CAAC,OAAO,CAAC;AAChD,IAAA,CAAC;AACL;;;;"}
@@ -0,0 +1,31 @@
import type { TSESTree } from '@typescript-eslint/types';
import type { Referencer } from './Referencer';
import { Visitor } from './Visitor';
export declare class TypeVisitor extends Visitor {
#private;
constructor(referencer: Referencer);
static visit(referencer: Referencer, node: TSESTree.Node): void;
protected visitFunctionType(node: TSESTree.TSCallSignatureDeclaration | TSESTree.TSConstructorType | TSESTree.TSConstructSignatureDeclaration | TSESTree.TSFunctionType | TSESTree.TSMethodSignature): void;
protected visitPropertyKey(node: TSESTree.TSMethodSignature | TSESTree.TSPropertySignature): void;
protected Identifier(node: TSESTree.Identifier): void;
protected MemberExpression(node: TSESTree.MemberExpression): void;
protected TSCallSignatureDeclaration(node: TSESTree.TSCallSignatureDeclaration): void;
protected TSConditionalType(node: TSESTree.TSConditionalType): void;
protected TSConstructorType(node: TSESTree.TSConstructorType): void;
protected TSConstructSignatureDeclaration(node: TSESTree.TSConstructSignatureDeclaration): void;
protected TSFunctionType(node: TSESTree.TSFunctionType): void;
protected TSImportType(node: TSESTree.TSImportType): void;
protected TSIndexSignature(node: TSESTree.TSIndexSignature): void;
protected TSInferType(node: TSESTree.TSInferType): void;
protected TSInterfaceDeclaration(node: TSESTree.TSInterfaceDeclaration): void;
protected TSMappedType(node: TSESTree.TSMappedType): void;
protected TSMethodSignature(node: TSESTree.TSMethodSignature): void;
protected TSNamedTupleMember(node: TSESTree.TSNamedTupleMember): void;
protected TSPropertySignature(node: TSESTree.TSPropertySignature): void;
protected TSQualifiedName(node: TSESTree.TSQualifiedName): void;
protected TSTypeAliasDeclaration(node: TSESTree.TSTypeAliasDeclaration): void;
protected TSTypeParameter(node: TSESTree.TSTypeParameter): void;
protected TSTypePredicate(node: TSESTree.TSTypePredicate): void;
protected TSTypeAnnotation(node: TSESTree.TSTypeAnnotation): void;
protected TSTypeQuery(node: TSESTree.TSTypeQuery): void;
}
@@ -0,0 +1 @@
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/server/auth/errors.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAGjC,YACI,OAAe,EACC,QAAiB;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,aAAQ,GAAR,QAAQ,CAAS;QAGjC,IAAI,C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AC5D,CAAC,yBAAyB,CAAC,SAAS,CAAC,EAAE,yBAAyB;IAChE,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,iBAAiB;IAChD,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,iBAAiB;IAChD,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,WAAW;IACpC,CAAC,2BAA2B,CAAC,SAAS,CAAC,EAAE,2BAA2B;IACpE,CAAC,4BAA4B,CAAC,SAAS,CAAC,EAAE,4BAA4B;IACtE,CAAC,yBAAyB,CAAC,SAAS,CAAC,EAAE,yBAAyB;IAChE,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,iBAAiB;IAChD,CAAC,qBAAqB,CAAC,SAAS,CAAC,EAAE,qBAAqB;IACxD,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,oBAAoB;IACtD,CAAC,0BAA0B,CAAC,SAAS,CAAC,EAAE,0BAA0B;IAClE,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,sBAAsB;IAC1D,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,kBAAkB;CAC5C,CAAC"}
@@ -0,0 +1,29 @@
declare const _default: {
extends: string[];
rules: {
'@typescript-eslint/ban-ts-comment': "error";
'no-array-constructor': "off";
'@typescript-eslint/no-array-constructor': "error";
'@typescript-eslint/no-duplicate-enum-values': "error";
'@typescript-eslint/no-empty-object-type': "error";
'@typescript-eslint/no-explicit-any': "error";
'@typescript-eslint/no-extra-non-null-assertion': "error";
'@typescript-eslint/no-misused-new': "error";
'@typescript-eslint/no-namespace': "error";
'@typescript-eslint/no-non-null-asserted-optional-chain': "error";
'@typescript-eslint/no-require-imports': "error";
'@typescript-eslint/no-this-alias': "error";
'@typescript-eslint/no-unnecessary-type-constraint': "error";
'@typescript-eslint/no-unsafe-declaration-merging': "error";
'@typescript-eslint/no-unsafe-function-type': "error";
'no-unused-expressions': "off";
'@typescript-eslint/no-unused-expressions': "error";
'no-unused-vars': "off";
'@typescript-eslint/no-unused-vars': "error";
'@typescript-eslint/no-wrapper-object-types': "error";
'@typescript-eslint/prefer-as-const': "error";
'@typescript-eslint/prefer-namespace-keyword': "error";
'@typescript-eslint/triple-slash-reference': "error";
};
};
export = _default;
@@ -0,0 +1 @@
{"version":3,"file":"renderRouterToStream.cjs","names":[],"sources":["../../../src/ssr/renderRouterToStream.tsx"],"sourcesContent":["import { PassThrough } from 'node:stream'\nimport ReactDOMServer from 'react-dom/server'\nimport { isbot } from 'isbot'\nimport {\n transformPipeableStreamWithRouter,\n transformReadableStreamWithRouter,\n} from '@tanstack/router-core/ssr/server'\nimport type { AnyRouter } from '@tanstack/router-core'\nimport type { ReadableStream } from 'node:stream/web'\nimport type { ReactNode } from 'react'\n\nexport const renderRouterToStream = async ({\n request,\n router,\n responseHeaders,\n children,\n}: {\n request: Request\n router: AnyRouter\n responseHeaders: Headers\n children: ReactNode\n}) => {\n if (typeof ReactDOMServer.renderToReadableStream === 'function') {\n const stream = await ReactDOMServer.renderToReadableStream(children, {\n signal: request.signal,\n nonce: router.options.ssr?.nonce,\n progressiveChunkSize: Number.POSITIVE_INFINITY,\n })\n\n if (isbot(request.headers.get('User-Agent'))) {\n await stream.allReady\n }\n\n const responseStream = transformReadableStreamWithRouter(\n router,\n stream as unknown as ReadableStream,\n )\n return new Response(responseStream as any, {\n status: router.stores.statusCode.get(),\n headers: responseHeaders,\n })\n }\n\n if (typeof ReactDOMServer.renderToPipeableStream === 'function') {\n const reactAppPassthrough = new PassThrough()\n\n try {\n const pipeable = ReactDOMServer.renderToPipeableStream(children, {\n nonce: router.options.ssr?.nonce,\n progressiveChunkSize: Number.POSITIVE_INFINITY,\n ...(isbot(request.headers.get('User-Agent'))\n ? {\n onAllReady() {\n pipeable.pipe(reactAppPassthrough)\n },\n }\n : {\n onShellReady() {\n pipeable.pipe(reactAppPassthrough)\n },\n }),\n onError: (error, info) => {\n console.error('Error in renderToPipeableStream:', error, info)\n // Destroy the passthrough stream on error\n if (!reactAppPassthrough.destroyed) {\n reactAppPassthrough.destroy(\n error instanceof Error ? error : new Error(String(error)),\n )\n }\n },\n })\n } catch (e) {\n console.error('Error in renderToPipeableStream:', e)\n reactAppPassthrough.destroy(e instanceof Error ? e : new Error(String(e)))\n }\n\n const responseStream = transformPipeableStreamWithRouter(\n router,\n reactAppPassthrough,\n )\n return new Response(responseStream as any, {\n status: router.stores.statusCode.get(),\n headers: responseHeaders,\n })\n }\n\n throw new Error(\n 'No renderToReadableStream or renderToPipeableStream found in react-dom/server. Ensure you are using a version of react-dom that supports streaming.',\n )\n}\n"],"mappings":";;;;;;;AAWA,IAAa,uBAAuB,OAAO,EACzC,SACA,QACA,iBACA,eAMI;AACJ,KAAI,OAAO,iBAAA,QAAe,2BAA2B,YAAY;EAC/D,MAAM,SAAS,MAAM,iBAAA,QAAe,uBAAuB,UAAU;GACnE,QAAQ,QAAQ;GAChB,OAAO,OAAO,QAAQ,KAAK;GAC3B,sBAAsB,OAAO;GAC9B,CAAC;AAEF,OAAA,GAAA,MAAA,OAAU,QAAQ,QAAQ,IAAI,aAAa,CAAC,CAC1C,OAAM,OAAO;EAGf,MAAM,kBAAA,GAAA,iCAAA,mCACJ,QACA,OACD;AACD,SAAO,IAAI,SAAS,gBAAuB;GACzC,QAAQ,OAAO,OAAO,WAAW,KAAK;GACtC,SAAS;GACV,CAAC;;AAGJ,KAAI,OAAO,iBAAA,QAAe,2BAA2B,YAAY;EAC/D,MAAM,sBAAsB,IAAI,YAAA,aAAa;AAE7C,MAAI;GACF,MAAM,WAAW,iBAAA,QAAe,uBAAuB,UAAU;IAC/D,OAAO,OAAO,QAAQ,KAAK;IAC3B,sBAAsB,OAAO;IAC7B,IAAA,GAAA,MAAA,OAAU,QAAQ,QAAQ,IAAI,aAAa,CAAC,GACxC,EACE,aAAa;AACX,cAAS,KAAK,oBAAoB;OAErC,GACD,EACE,eAAe;AACb,cAAS,KAAK,oBAAoB;OAErC;IACL,UAAU,OAAO,SAAS;AACxB,aAAQ,MAAM,oCAAoC,OAAO,KAAK;AAE9D,SAAI,CAAC,oBAAoB,UACvB,qBAAoB,QAClB,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC,CAC1D;;IAGN,CAAC;WACK,GAAG;AACV,WAAQ,MAAM,oCAAoC,EAAE;AACpD,uBAAoB,QAAQ,aAAa,QAAQ,IAAI,IAAI,MAAM,OAAO,EAAE,CAAC,CAAC;;EAG5E,MAAM,kBAAA,GAAA,iCAAA,mCACJ,QACA,oBACD;AACD,SAAO,IAAI,SAAS,gBAAuB;GACzC,QAAQ,OAAO,OAAO,WAAW,KAAK;GACtC,SAAS;GACV,CAAC;;AAGJ,OAAM,IAAI,MACR,sJACD"}
@@ -0,0 +1,11 @@
import type { CodeKeywordDefinition, ErrorObject } from "../../types";
type Kwd = "maximum" | "minimum" | "exclusiveMaximum" | "exclusiveMinimum";
type Comparison = "<=" | ">=" | "<" | ">";
export type LimitNumberError = ErrorObject<Kwd, {
limit: number;
comparison: Comparison;
}, number | {
$data: string;
}>;
declare const def: CodeKeywordDefinition;
export default def;
@@ -0,0 +1 @@
{"version":3,"file":"guitar.js","sources":["../../../src/icons/guitar.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Guitar\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTEuOSAxMi4xIDQuNTE0LTQuNTE0IiAvPgogIDxwYXRoIGQ9Ik0yMC4xIDIuM2ExIDEgMCAwIDAtMS40IDBsLTEuMTE0IDEuMTE0QTIgMiAwIDAgMCAxNyA0LjgyOHYxLjM0NGEyIDIgMCAwIDEtLjU4NiAxLjQxNEEyIDIgMCAwIDEgMTcuODI4IDdoMS4zNDRhMiAyIDAgMCAwIDEuNDE0LS41ODZMMjEuNyA1LjNhMSAxIDAgMCAwIDAtMS40eiIgLz4KICA8cGF0aCBkPSJtNiAxNiAyIDIiIC8+CiAgPHBhdGggZD0iTTguMiA5LjlDOC43IDguOCA5LjggOCAxMSA4YzIuOCAwIDUgMi4yIDUgNSAwIDEuMi0uOCAyLjMtMS45IDIuOGwtLjkuNEEyIDIgMCAwIDAgMTIgMThhNCA0IDAgMCAxLTQgNGMtMy4zIDAtNi0yLjctNi02YTQgNCAwIDAgMSA0LTQgMiAyIDAgMCAwIDEuOC0xLjJ6IiAvPgogIDxjaXJjbGUgY3g9IjExLjUiIGN5PSIxMi41IiByPSIuNSIgZmlsbD0iY3VycmVudENvbG9yIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/guitar\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Guitar = createLucideIcon('Guitar', [\n ['path', { d: 'm11.9 12.1 4.514-4.514', key: '109xqo' }],\n [\n 'path',\n {\n d: 'M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z',\n key: 'txyc8t',\n },\n ],\n ['path', { d: 'm6 16 2 2', key: '16qmzd' }],\n [\n 'path',\n {\n d: 'M8.2 9.9C8.7 8.8 9.8 8 11 8c2.8 0 5 2.2 5 5 0 1.2-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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAC,CAAA,CAAA,CAAALine truncated
@@ -0,0 +1 @@
{"version":3,"names":["_setPrototypeOf","require","_inherits","subClass","superClass","TypeError","prototype","Object","create","constructor","value","writable","configurable","defineProperty","setPrototypeOf"],"sources":["../../src/helpers/inherits.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nimport setPrototypeOf from \"./setPrototypeOf.ts\";\n\nexport default function _inherits(\n subClass: Function,\n superClass: Function | null,\n) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n // We can't use defineProperty to set the prototype in a single step because it\n // doesn't work in Chrome <= 36. https://github.com/babel/babel/issues/14056\n // V8 bug: https://bugs.chromium.org/p/v8/issues/detail?id=3334\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true,\n },\n });\n Object.defineProperty(subClass, \"prototype\", { writable: false });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n"],"mappings":";;;;;;AAEA,IAAAA,eAAA,GAAAC,OAAA;AAEe,SAASC,SAASA,CAC/BC,QAAkB,EAClBC,UAA2B,EAC3B;EACA,IAAI,OAAOA,UAAU,KAAK,UAAU,IAAIA,UAAU,KAAK,IAAI,EAAE;IAC3D,MAAM,IAAIC,SAAS,CAAC,oDAAoD,CAAC;EAC3E;EAIAF,QAAQ,CAACG,SAAS,GAAGC,MAAM,CAACC,MAAM,CAACJ,UAAU,IAAIA,UAAU,CAACE,SAAS,EAAE;IACrEG,WAAW,EAAE;MACXC,KAAK,EAAEP,QAAQ;MACfQ,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAE;IAChB;EACF,CAAC,CAAC;EACFL,MAAM,CAACM,cAAc,CAACV,QAAQ,EAAE,WAAW,EAAE;IAAEQ,QAAQ,EAAE;EAAM,CAAC,CAAC;EACjE,IAAIP,UAAU,EAAE,IAAAU,uBAAc,EAACX,QAAQ,EAAEC,UAAU,CAAC;AACtD","ignoreList":[]}
@@ -0,0 +1 @@
{"version":3,"file":"square-percent.js","sources":["../../../src/icons/square-percent.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name SquarePercent\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHg9IjMiIHk9IjMiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Im0xNSA5LTYgNiIgLz4KICA8cGF0aCBkPSJNOSA5aC4wMSIgLz4KICA8cGF0aCBkPSJNMTUgMTVoLjAxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/square-percent\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst SquarePercent = createLucideIcon('SquarePercent', [\n ['rect', { width: '18', height: '18', x: '3', y: '3', rx: '2', key: 'afitv7' }],\n ['path', { d: 'm15 9-6 6', key: '1uzhvr' }],\n ['path', { d: 'M9 9h.01', key: '1q5me6' }],\n ['path', { d: 'M15 15h.01', key: 'lqbp3k' }],\n]);\n\nexport default SquarePercent;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,iBAAiB,eAAiB,CAAA,CAAA,CAAA;AAAA,CAAA,CACtD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,MAAM,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,47 @@
{
"name": "finalhandler",
"description": "Node.js final http responder",
"version": "2.1.1",
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
"license": "MIT",
"repository": "pillarjs/finalhandler",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
},
"dependencies": {
"debug": "^4.4.0",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"on-finished": "^2.4.1",
"parseurl": "^1.3.3",
"statuses": "^2.0.1"
},
"devDependencies": {
"eslint": "^7.32.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-markdown": "^2.2.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-standard": "^4.1.0",
"mocha": "^11.0.1",
"nyc": "^17.1.0",
"supertest": "^7.0.0"
},
"files": [
"LICENSE",
"HISTORY.md",
"index.js"
],
"engines": {
"node": ">= 18.0.0"
},
"scripts": {
"lint": "eslint .",
"test": "mocha --reporter spec --check-leaks test/",
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test",
"test-inspect": "mocha --reporter spec --inspect --inspect-brk test/"
}
}
@@ -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;
});
@@ -0,0 +1 @@
{"version":3,"file":"use-presence.mjs","sources":["../../../../src/components/AnimatePresence/use-presence.ts"],"sourcesContent":["\"use client\"\n\nimport { useCallback, useContext, useEffect, useId } from \"react\"\nimport {\n PresenceContext,\n PresenceContextProps,\n} from \"../../context/PresenceContext\"\n\nexport type SafeToRemove = () => void\n\ntype AlwaysPresent = [true, null]\n\ntype Present = [true]\n\ntype NotPresent = [false, SafeToRemove]\n\n/**\n * When a component is the child of `AnimatePresence`, it can use `usePresence`\n * to access information about whether it's still present in the React tree.\n *\n * ```jsx\n * import { usePresence } from \"framer-motion\"\n *\n * export const Component = () => {\n * const [isPresent, safeToRemove] = usePresence()\n *\n * useEffect(() => {\n * !isPresent && setTimeout(safeToRemove, 1000)\n * }, [isPresent])\n *\n * return <div />\n * }\n * ```\n *\n * If `isPresent` is `false`, it means that a component has been removed from the tree,\n * but `AnimatePresence` won't really remove it until `safeToRemove` has been called.\n *\n * @public\n */\nexport function usePresence(\n subscribe: boolean = true\n): AlwaysPresent | Present | NotPresent {\n const context = useContext(PresenceContext)\n\n if (context === null) return [true, null]\n\n const { isPresent, onExitComplete, register } = context\n\n // It's safe to call the following hooks conditionally (after an early return) because the context will always\n // either be null or non-null for the lifespan of the component.\n\n const id = useId()\n useEffect(() => {\n if (subscribe) {\n return register(id)\n }\n }, [subscribe])\n\n const safeToRemove = useCallback(\n () => subscribe && onExitComplete && onExitComplete(id),\n [id, onExitComplete, subscribe]\n )\n\n return !isPresent && onExitComplete ? [false, safeToRemove] : [true]\n}\n\n/**\n * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.\n * There is no `safeToRemove` function.\n *\n * ```jsx\n * import { useIsPresent } from \"framer-motion\"\n *\n * export const Component = () => {\n * const isPresent = useIsPresent()\n *\n * useEffect(() => {\n * !isPresent && console.log(\"I've been removed!\")\n * }, [isPresent])\n *\n * return <div />\n * }\n * ```\n *\n * @public\n */\nexport function useIsPresent() {\n return isPresent(useContext(PresenceContext))\n}\n\nexport function isPresent(context: PresenceContextProps | null) {\n return context === null ? true : context.isPresent\n}\n"],"names":[],"mappings":";;;;AAgBA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACG;AAGF;;AAEsB;;;;AAOtB;;;AAGQ;;AAER;;AAOA;AACJ;AAEA;;;;;;;;;;;;;;;;;;;AAmBG;;AAEC;AACJ;AAEM;AACF;AACJ;;"}
@@ -0,0 +1,441 @@
export default `flf2a$ 4 4 7 -1 32 0 0 0
Author : Lukasz Tyrala (lt.)
Date : 2004/4/12 12:28:23
Version: 1.2 (full)
URL : http://home.autocom.pl/bjt/lt
e-mail : luty@autocom.pl
--------------------------------------------
..xx.. (C) COPYRIGHTS MMIV by
.xXXXXXXx Lukasz Tyrala (lt.)
/ xXXXXx
.\` xDXXx Permission is hereby given to
C Xx modify this font, as long as
\\ x the modifier's name is placed
\`---/| on a comment line.
lt. | | For comercial use of this font
please contact with me (lt.).
--------------------------------------------
This font has been created using JavE's
FIGlet font export assistant.
---- Have a look at: http://www.jave.de ----
Visit polish a-a usenet at------------------
-----------------------news:pl.rec.ascii-art
$ #
$ #
$ #
$ ##
___ #
| \\ #
|___\\#
|__/ ##
_ _ #
\\|\\| #
#
##
_||| #
|_'_]#
|_'_]#
||| ##
|| #
,||= #
'||=,#
=||' ##
__ #
\\ \\[\\#
\\ \\ #
|]\\/ ##
___ #
| .\\ #
/ .(/#
\\__/\\##
_ #
|/ #
#
##
___ #
| / #
|/ #
|\\ ##
__ #
\\ | #
\\| #
/| ##
#
\\||/#
|_ ]#
/||\\##
__ #
_| | #
|_ _]#
|_| ##
#
#
,-. #
'-/ ##
#
___ #
|___\\#
##
#
#
,-. #
'-' ##
__#
/ /#
/ / #
/_/ ##
____ #
| |#
| \\ |#
|___|##
__#
/ |#
/_ |#
\\|##
____ #
| \\#
'-'_/#
|___]##
____ #
|__ \\#
_[ |#
|___/##
_ #
/ / #
/_ ]#
|/ ##
____ #
| __|#
_\\_ \\#
|___/##
____ #
| __\\#
| .\\#
|___/##
____ #
|__ |#
/ /#
/_/ ##
____ #
| . /#
>.< #
|___/##
____ #
| . \\#
|__ |#
\\__/##
__ #
|_] #
,-. #
'-' ##
__ #
|_] #
,-. #
'-/ ##
__ #
/ / #
\\ \\ #
\\_\\ ##
___ #
|___]#
|__/ #
##
__ #
\\ \\#
/ /#
/_/ ##
____ #
| \\#
|/\\_/#
|] ##
_ #
,'_\`.#
;(_\\/#
\`._, ##
___ #
| \\ #
| . \\#
|/\\_/##
___ #
| .\\ #
| .<_#
|___/##
____ #
| __\\#
| \\__#
|___/##
___ #
| \\ #
| . \\#
|___/##
____ #
| __\\#
| ]_#
|___/##
____ #
| _\\#
| _\\ #
|/ ##
____ #
| _\\#
| [ \\#
|___/##
_ _ #
||_|\\#
| _ |#
|/ |/##
____ #
|___\\#
| / #
|/ ##
____ #
|_ \\#
,_/ /#
\\__/ ##
__ _ #
| V \\#
| <_#
|/\\_/##
__ #
| | #
| |__#
|___/##
_ #
|\\/\\ #
| \\#
|/v\\/##
__ #
| \\|\\#
| \\|#
|/\\_/##
____ #
| |#
| . |#
|___/##
____ #
| . \\#
| __/#
|/ ##
____ #
| |#
| . |#
|___\\##
____ #
| . \\#
| <_#
|/\\_/##
___ #
| _\\ #
[__ \\#
|___/##
____ #
|_ _\\#
|| #
|/ ##
_ #
|| \\ #
||_|\\#
|___/##
_ _ #
|| |\\#
||/ /#
|__/ ##
_ _ #
||| \\#
||\\ /#
|/\\/ ##
_ _ #
|\\/_\\#
_><__#
|/\\_/##
_ #
||_/\\#
| __/#
|/ ##
___ #
|_ \\ #
| __]#
|___/##
___ #
| _] #
||_ #
|__] ##
__ #
\\ \\ #
\\ \\ #
\\_\\##
___ #
|_ | #
_|| #
|__| ##
#
/\\ #
//\\\\ #
##
#
#
____ #
|___]##
_ #
\\| #
#
##
___ #
| \\ #
| . \\#
|/\\_/##
___ #
| .\\ #
| .<_#
|___/##
____ #
| __\\#
| \\__#
|___/##
___ #
| \\ #
| . \\#
|___/##
____ #
| __\\#
| ]_#
|___/##
____ #
| _\\#
| _\\ #
|/ ##
____ #
| _\\#
| [ \\#
|___/##
_ _ #
||_|\\#
| _ |#
|/ |/##
____ #
|___\\#
| / #
|/ ##
____ #
|_ \\#
,_/ /#
\\__/ ##
__ _ #
| V \\#
| <_#
|/\\_/##
__ #
| | #
| |__#
|___/##
_ #
|\\/\\ #
| \\#
|/v\\/##
__ #
| \\|\\#
| \\|#
|/\\_/##
____ #
| |#
| . |#
|___/##
____ #
| . \\#
| __/#
|/ ##
____ #
| |#
| . |#
|___\\##
____ #
| . \\#
| <_#
|/\\_/##
___ #
| _\\ #
[__ \\#
|___/##
____ #
|_ _\\#
|| #
|/ ##
_ #
|| \\ #
||_|\\#
|___/##
_ _ #
|| |\\#
||/ /#
|__/ ##
_ _ #
||| \\#
||\\ /#
|/\\/ ##
_ _ #
|\\/_\\#
_><__#
|/\\_/##
_ #
||_/\\#
| __/#
|/ ##
___ #
|_ \\ #
| __]#
|___/##
{#
#
#
##
__ #
| | #
| | #
|_| ##
}#
#
#
##
#
_,-.,#
|,-.'#
##
___ #
| \\ #
| . \\#
|/\\_/##
____ #
| |#
| . |#
|___/##
_ #
|| \\ #
||_|\\#
|___/##
___ #
| \\ #
| . \\#
|/\\_/##
____ #
| |#
| . |#
|___/##
_ #
|| \\ #
||_|\\#
|___/##
�#
#
#
##`
@@ -0,0 +1 @@
{"version":3,"file":"bus-front.js","sources":["../../../src/icons/bus-front.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BusFront\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNCA2IDIgNyIgLz4KICA8cGF0aCBkPSJNMTAgNmg0IiAvPgogIDxwYXRoIGQ9Im0yMiA3LTItMSIgLz4KICA8cmVjdCB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHg9IjQiIHk9IjMiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Ik00IDExaDE2IiAvPgogIDxwYXRoIGQ9Ik04IDE1aC4wMSIgLz4KICA8cGF0aCBkPSJNMTYgMTVoLjAxIiAvPgogIDxwYXRoIGQ9Ik02IDE5djIiIC8+CiAgPHBhdGggZD0iTTE4IDIxdi0yIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/bus-front\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst BusFront = createLucideIcon('BusFront', [\n ['path', { d: 'M4 6 2 7', key: '1mqr15' }],\n ['path', { d: 'M10 6h4', key: '1itunk' }],\n ['path', { d: 'm22 7-2-1', key: '1umjhc' }],\n ['rect', { width: '16', height: '16', x: '4', y: '3', rx: '2', key: '1wxw4b' }],\n ['path', { d: 'M4 11h16', key: 'mpoxn0' }],\n ['path', { d: 'M8 15h.01', key: 'a7atzg' }],\n ['path', { d: 'M16 15h.01', key: 'rnfrdf' }],\n ['path', { d: 'M6 19v2', key: '1loha6' }],\n ['path', { d: 'M18 21v-2', key: 'sqyl04' }],\n]);\n\nexport default BusFront;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAA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A,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC5C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"index.d.mts","names":["JWKParameters","JWK_OKP_Public","JWK_OKP_Private","JWK_AKP_Public","JWK_AKP_Private","JWK_EC_Public","JWK_EC_Private","JWK_RSA_Public","JWK_RSA_Private","JWK_oct","JWK","GenericGetKeyFunction","IProtectedHeader","IToken","ReturnKeyTypes","Promise","GetKeyFunction","CryptoKey","KeyObject","Uint8Array","FlattenedJWSInput","JWSHeaderParameters","GeneralJWSInput","Omit","FlattenedJWS","Partial","GeneralJWS","JoseHeaderParameters","Pick","JWEKeyManagementHeaderParameters","FlattenedJWE","JWEHeaderParameters","GeneralJWE","CritOption","DecryptOptions","EncryptOptions","JWTClaimVerificationOptions","Date","VerifyOptions","SignOptions","JWTPayload","FlattenedDecryptResult","GeneralDecryptResult","CompactDecryptResult","CompactJWEHeaderParameters","FlattenedVerifyResult","GeneralVerifyResult","CompactVerifyResult","CompactJWSHeaderParameters","JWTVerifyResult","PayloadType","JWTHeaderParameters","JWTDecryptResult","ResolvedKey","JSONWebKeySet","crypto","subtle","generateKey","ReturnType","Awaited","Extract","ProduceJWT"],"sources":["../../../node_modules/.pnpm/jose@6.2.2/node_modules/jose/dist/types/types.d.ts","../src/client/dpop.ts","../src/client/authErrors.ts","../src/client/auth.ts","../src/client/authExtensions.ts","../src/client/probeClassifier.ts","../src/client/responseCache.ts","../src/client/versionNegotiation.ts","../src/client/client.ts","../src/client/crossAppAccess.ts","../src/client/middleware.ts","../src/client/sse.ts","../src/client/streamableHttp.ts","../src/fromJsonSchema.ts"],"sourcesContent":["/** Generic JSON Web Key Parameters. */\nexport interface JWKParameters {\n /** JWK \"kty\" (Key Type) Parameter */\n kty?: string\n /**\n * JWK \"alg\" (Algorithm) Parameter\n *\n * @see {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}\n */\n alg?: string\n /** JWK \"key_ops\" (Key Operations) Parameter */\n key_ops?: string[]\n /** JWK \"ext\" (Extractable) Parameter */\n ext?: boolean\n /** JWK \"use\" (Public Key Use) Parameter */\n use?: string\n /** JWK \"x5c\" (X.509 Certificate Chain) Parameter */\n x5c?: string[]\n /** JWK \"x5t\" (X.509 Certificate SHA-1 Thumbprint) Parameter */\n x5t?: string\n /** JWK \"x5t#S256\" (X.509 Certificate SHA-256 Thumbprint) Parameter */\n 'x5t#S256'?: string\n /** JWK \"x5u\" (X.509 URL) Parameter */\n x5u?: string\n /** JWK \"kid\" (Key ID) Parameter */\n kid?: string\n}\n\n/** Convenience interface for Public OKP JSON Web Keys */\nexport interface JWK_OKP_Public extends JWKParameters {\n /** OKP JWK \"crv\" (The Subtype of Key Pair) Parameter */\n crv: string\n /** OKP JWK \"x\" (The public key) Parameter */\n x: string\n}\n\n/** Convenience interface for Private OKP JSON Web Keys */\nexport interface JWK_OKP_Private extends JWK_OKP_Public {\n /** OKP JWK \"d\" (The Private Key) Parameter */\n d: string\n}\n\n/** Convenience interface for Public AKP JSON Web Keys */\nexport interface JWK_AKP_Public extends JWKParameters {\n /** JWK \"alg\" (Algorithm) Parameter */\n alg: string\n /** AKP JWK \"pub\" (The Public key) Parameter */\n pub: string\n}\n\n/** Convenience interface for Private AKP JSON Web Keys */\nexport interface JWK_AKP_Private extends JWK_AKP_Public {\n /** AKP JWK \"priv\" (The Private Key) Parameter */\n priv: string\n}\n\n/** Convenience interface for Public EC JSON Web Keys */\nexport interface JWK_EC_Public extends JWKParameters {\n /** EC JWK \"crv\" (Curve) Parameter */\n crv: string\n /** EC JWK \"x\" (X Coordinate) Parameter */\n x: string\n /** EC JWK \"y\" (Y Coordinate) Parameter */\n y: string\n}\n\n/** Convenience interface for Private EC JSON Web Keys */\nexport interface JWK_EC_Private extends JWK_EC_Public {\n /** EC JWK \"d\" (ECC Private Key) Parameter */\n d: string\n}\n\n/** Convenience interface for Public RSA JSON Web Keys */\nexport interface JWK_RSA_Public extends JWKParameters {\n /** RSA JWK \"e\" (Exponent) Parameter */\n e: string\n /** RSA JWK \"n\" (Modulus) Parameter */\n n: string\n}\n\n/** Convenience interface for Private RSA JSON Web Keys */\nexport interface JWK_RSA_Private extends JWK_RSA_Public {\n /** RSA JWK \"d\" (Private Exponent) Parameter */\n d: string\n /** RSA JWK \"dp\" (First Factor CRT Exponent) Parameter */\n dp: string\n /** RSA JWK \"dq\" (Second Factor CRT Exponent) Parameter */\n dq: string\n /** RSA JWK \"p\" (First Prime Factor) Parameter */\n p: string\n /** RSA JWK \"q\" (Second Prime Factor) Parameter */\n q: string\n /** RSA JWK \"qi\" (First CRT Coefficient) Parameter */\n qi: string\n}\n\n/** Convenience interface for oct JSON Web Keys */\nexport interface JWK_oct extends JWKParameters {\n /** Oct JWK \"k\" (Key Value) Parameter */\n k: string\n}\n\n/**\n * JSON Web Key ({@link https://www.rfc-editor.org/rfc/rfc7517 JWK}). \"RSA\", \"EC\", \"OKP\", \"AKP\", and\n * \"oct\" key types are supported.\n *\n * @see {@link JWK_AKP_Public}\n * @see {@link JWKLine truncated
@@ -0,0 +1,129 @@
import type { $ZodStringFormats } from "../core/checks.js";
import type * as errors from "../core/errors.js";
import * as util from "../core/util.js";
const error: () => errors.$ZodErrorMap = () => {
const Sizable: Record<string, { unit: string; verb: string }> = {
string: { unit: "àmi", verb: "ní" },
file: { unit: "bytes", verb: "ní" },
array: { unit: "nkan", verb: "ní" },
set: { unit: "nkan", verb: "ní" },
map: { unit: "nkan", verb: "ní" },
};
function getSizing(origin: string): { unit: string; verb: string } | null {
return Sizable[origin] ?? null;
}
const FormatDictionary: {
[k in $ZodStringFormats | (string & {})]?: string;
} = {
regex: "ẹ̀rọ ìbáwọlé",
email: "àdírẹ́sì ìmẹ́lì",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "àkókò ISO",
date: "ọjọ́ ISO",
time: "àkókò ISO",
duration: "àkókò tó pé ISO",
ipv4: "àdírẹ́sì IPv4",
ipv6: "àdírẹ́sì IPv6",
mac: "àdírẹ́sì MAC",
cidrv4: "àgbègbè IPv4",
cidrv6: "àgbègbè IPv6",
base64: "ọ̀rọ̀ tí a kọ́ ní base64",
base64url: "ọ̀rọ̀ base64url",
json_string: "ọ̀rọ̀ JSON",
e164: "nọ́mbà E.164",
credit_card: "nọmba kaadi gbese",
currency_code: "koodu owó",
iban: "IBAN",
jwt: "JWT",
template_literal: "ẹ̀rọ ìbáwọlé",
};
const TypeDictionary: {
[k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;
} = {
nan: "NaN",
number: "nọ́mbà",
array: "akopọ",
};
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = TypeDictionary[issue.expected] ?? issue.expected;
const receivedType = util.parsedType(issue.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue.expected)) {
return `Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${issue.expected}, àmọ̀ a rí ${received}`;
}
return `Ìbáwọlé aṣìṣe: a ní láti fi ${expected}, àmọ̀ a rí ${received}`;
}
case "invalid_value":
if (issue.values.length === 1) return `Ìbáwọlé aṣìṣe: a ní láti fi ${util.stringifyPrimitive(issue.values[0])}`;
return `Àṣàyàn aṣìṣe: yan ọ̀kan lára ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Tó pọ̀ jù: a ní láti jẹ́ pé ${issue.origin ?? "iye"} ${sizing.verb} ${adj}${issue.maximum} ${sizing.unit}`;
return `Tó pọ̀ jù: a ní láti jẹ́ ${adj}${issue.maximum}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing)
return `Kéré ju: a ní láti jẹ́ pé ${issue.origin} ${sizing.verb} ${adj}${issue.minimum} ${sizing.unit}`;
return `Kéré ju: a ní láti jẹ́ ${adj}${issue.minimum}`;
}
case "invalid_format": {
const _issue = issue as errors.$ZodStringFormatIssues;
if (_issue.format === "starts_with") return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${_issue.prefix}"`;
if (_issue.format === "ends_with") return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${_issue.suffix}"`;
if (_issue.format === "includes") return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${_issue.includes}"`;
if (_issue.format === "regex") return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${_issue.pattern}`;
return `Aṣìṣe: ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${issue.divisor}`;
case "unrecognized_keys":
return `Bọtìnì àìmọ̀: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Bọtìnì aṣìṣe nínú ${issue.origin}`;
case "invalid_union":
return "Ìbáwọlé aṣìṣe";
case "invalid_element":
return `Iye aṣìṣe nínú ${issue.origin}`;
default:
return "Ìbáwọlé aṣìṣe";
}
};
};
export default function (): { localeError: errors.$ZodErrorMap } {
return {
localeError: error(),
};
}
@@ -0,0 +1,19 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Sheet = createLucideIcon("Sheet", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
["line", { x1: "3", x2: "21", y1: "9", y2: "9", key: "1vqk6q" }],
["line", { x1: "3", x2: "21", y1: "15", y2: "15", key: "o2sbyz" }],
["line", { x1: "9", x2: "9", y1: "9", y2: "21", key: "1ib60c" }],
["line", { x1: "15", x2: "15", y1: "9", y2: "21", key: "1n26ft" }]
]);
export { Sheet as default };
//# sourceMappingURL=sheet.js.map
@@ -0,0 +1,194 @@
{{# def.definitions }}
{{## def._error:_rule:
{{ 'istanbul ignore else'; }}
{{? it.createErrors !== false }}
{
keyword: '{{= $errorKeyword || _rule }}'
, dataPath: (dataPath || '') + {{= it.errorPath }}
, schemaPath: {{=it.util.toQuotedString($errSchemaPath)}}
, params: {{# def._errorParams[_rule] }}
{{? it.opts.messages !== false }}
, message: {{# def._errorMessages[_rule] }}
{{?}}
{{? it.opts.verbose }}
, schema: {{# def._errorSchemas[_rule] }}
, parentSchema: validate.schema{{=it.schemaPath}}
, data: {{=$data}}
{{?}}
}
{{??}}
{}
{{?}}
#}}
{{## def._addError:_rule:
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
#}}
{{## def.addError:_rule:
var err = {{# def._error:_rule }};
{{# def._addError:_rule }}
#}}
{{## def.error:_rule:
{{# def.beginDefOut}}
{{# def._error:_rule }}
{{# def.storeDefOut:__err }}
{{? !it.compositeRule && $breakOnError }}
{{ 'istanbul ignore if'; }}
{{? it.async }}
throw new ValidationError([{{=__err}}]);
{{??}}
validate.errors = [{{=__err}}];
return false;
{{?}}
{{??}}
var err = {{=__err}};
{{# def._addError:_rule }}
{{?}}
#}}
{{## def.extraError:_rule:
{{# def.addError:_rule}}
{{? !it.compositeRule && $breakOnError }}
{{ 'istanbul ignore if'; }}
{{? it.async }}
throw new ValidationError(vErrors);
{{??}}
validate.errors = vErrors;
return false;
{{?}}
{{?}}
#}}
{{## def.checkError:_rule:
if (!{{=$valid}}) {
{{# def.error:_rule }}
}
#}}
{{## def.resetErrors:
errors = {{=$errs}};
if (vErrors !== null) {
if ({{=$errs}}) vErrors.length = {{=$errs}};
else vErrors = null;
}
#}}
{{## def.concatSchema:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=$schema}}{{?}}#}}
{{## def.appendSchema:{{?$isData}}' + {{=$schemaValue}}{{??}}{{=$schemaValue}}'{{?}}#}}
{{## def.concatSchemaEQ:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=it.util.escapeQuotes($schema)}}{{?}}#}}
{{## def._errorMessages = {
'false schema': "'boolean schema is false'",
$ref: "'can\\\'t resolve reference {{=it.util.escapeQuotes($schema)}}'",
additionalItems: "'should NOT have more than {{=$schema.length}} items'",
additionalProperties: "'{{? it.opts._errorDataPathProperty }}is an invalid additional property{{??}}should NOT have additional properties{{?}}'",
anyOf: "'should match some schema in anyOf'",
const: "'should be equal to constant'",
contains: "'should contain a valid item'",
dependencies: "'should have {{? $deps.length == 1 }}property {{= it.util.escapeQuotes($deps[0]) }}{{??}}properties {{= it.util.escapeQuotes($deps.join(\", \")) }}{{?}} when property {{= it.util.escapeQuotes($property) }} is present'",
'enum': "'should be equal to one of the allowed values'",
format: "'should match format \"{{#def.concatSchemaEQ}}\"'",
'if': "'should match \"' + {{=$ifClause}} + '\" schema'",
_limit: "'should be {{=$opStr}} {{#def.appendSchema}}",
_exclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'",
_limitItems: "'should NOT have {{?$keyword=='maxItems'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} items'",
_limitLength: "'should NOT be {{?$keyword=='maxLength'}}longer{{??}}shorter{{?}} than {{#def.concatSchema}} characters'",
_limitProperties:"'should NOT have {{?$keyword=='maxProperties'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} properties'",
multipleOf: "'should be multiple of {{#def.appendSchema}}",
not: "'should NOT be valid'",
oneOf: "'should match exactly one schema in oneOf'",
pattern: "'should match pattern \"{{#def.concatSchemaEQ}}\"'",
propertyNames: "'property name \\'{{=$invalidName}}\\' is invalid'",
required: "'{{? it.opts._errorDataPathProperty }}is a required property{{??}}should have required property \\'{{=$missingProperty}}\\'{{?}}'",
type: "'should be {{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}'",
uniqueItems: "'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'",
custom: "'should pass \"{{=$rule.keyword}}\" keyword validation'",
patternRequired: "'should have property matching pattern \\'{{=$missingPattern}}\\''",
switch: "'should pass \"switch\" keyword validation'",
_formatLimit: "'should be {{=$opStr}} \"{{#def.concatSchemaEQ}}\"'",
_formatExclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'"
} #}}
{{## def.schemaRefOrVal: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=$schema}}{{?}} #}}
{{## def.schemaRefOrQS: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
{{## def._errorSchemas = {
'false schema': "false",
$ref: "{{=it.util.toQuotedString($schema)}}",
additionalItems: "false",
additionalProperties: "false",
anyOf: "validate.schema{{=$schemaPath}}",
const: "validate.schema{{=$schemaPath}}",
contains: "validate.schema{{=$schemaPath}}",
dependencies: "validate.schema{{=$schemaPath}}",
'enum': "validate.schema{{=$schemaPath}}",
format: "{{#def.schemaRefOrQS}}",
'if': "validate.schema{{=$schemaPath}}",
_limit: "{{#def.schemaRefOrVal}}",
_exclusiveLimit: "validate.schema{{=$schemaPath}}",
_limitItems: "{{#def.schemaRefOrVal}}",
_limitLength: "{{#def.schemaRefOrVal}}",
_limitProperties:"{{#def.schemaRefOrVal}}",
multipleOf: "{{#def.schemaRefOrVal}}",
not: "validate.schema{{=$schemaPath}}",
oneOf: "validate.schema{{=$schemaPath}}",
pattern: "{{#def.schemaRefOrQS}}",
propertyNames: "validate.schema{{=$schemaPath}}",
required: "validate.schema{{=$schemaPath}}",
type: "validate.schema{{=$schemaPath}}",
uniqueItems: "{{#def.schemaRefOrVal}}",
custom: "validate.schema{{=$schemaPath}}",
patternRequired: "validate.schema{{=$schemaPath}}",
switch: "validate.schema{{=$schemaPath}}",
_formatLimit: "{{#def.schemaRefOrQS}}",
_formatExclusiveLimit: "validate.schema{{=$schemaPath}}"
} #}}
{{## def.schemaValueQS: {{?$isData}}{{=$schemaValue}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
{{## def._errorParams = {
'false schema': "{}",
$ref: "{ ref: '{{=it.util.escapeQuotes($schema)}}' }",
additionalItems: "{ limit: {{=$schema.length}} }",
additionalProperties: "{ additionalProperty: '{{=$additionalProperty}}' }",
anyOf: "{}",
const: "{ allowedValue: schema{{=$lvl}} }",
contains: "{}",
dependencies: "{ property: '{{= it.util.escapeQuotes($property) }}', missingProperty: '{{=$missingProperty}}', depsCount: {{=$deps.length}}, deps: '{{= it.util.escapeQuotes($deps.length==1 ? $deps[0] : $deps.join(\", \")) }}' }",
'enum': "{ allowedValues: schema{{=$lvl}} }",
format: "{ format: {{#def.schemaValueQS}} }",
'if': "{ failingKeyword: {{=$ifClause}} }",
_limit: "{ comparison: {{=$opExpr}}, limit: {{=$schemaValue}}, exclusive: {{=$exclusive}} }",
_exclusiveLimit: "{}",
_limitItems: "{ limit: {{=$schemaValue}} }",
_limitLength: "{ limit: {{=$schemaValue}} }",
_limitProperties:"{ limit: {{=$schemaValue}} }",
multipleOf: "{ multipleOf: {{=$schemaValue}} }",
not: "{}",
oneOf: "{ passingSchemas: {{=$passingSchemas}} }",
pattern: "{ pattern: {{#def.schemaValueQS}} }",
propertyNames: "{ propertyName: '{{=$invalidName}}' }",
required: "{ missingProperty: '{{=$missingProperty}}' }",
type: "{ type: '{{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}' }",
uniqueItems: "{ i: i, j: j }",
custom: "{ keyword: '{{=$rule.keyword}}' }",
patternRequired: "{ missingPattern: '{{=$missingPattern}}' }",
switch: "{ caseIndex: {{=$caseIndex}} }",
_formatLimit: "{ comparison: {{=$opExpr}}, limit: {{#def.schemaValueQS}}, exclusive: {{=$exclusive}} }",
_formatExclusiveLimit: "{}"
} #}}
@@ -0,0 +1,317 @@
# cookie
[![NPM Version][npm-version-image]][npm-url]
[![NPM Downloads][npm-downloads-image]][npm-url]
[![Node.js Version][node-image]][node-url]
[![Build Status][ci-image]][ci-url]
[![Coverage Status][coveralls-image]][coveralls-url]
Basic HTTP cookie parser and serializer for HTTP servers.
## Installation
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```sh
$ npm install cookie
```
## API
```js
var cookie = require('cookie');
```
### cookie.parse(str, options)
Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs.
The `str` argument is the string representing a `Cookie` header value and `options` is an
optional object containing additional parsing options.
```js
var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2');
// { foo: 'bar', equation: 'E=mc^2' }
```
#### Options
`cookie.parse` accepts these properties in the options object.
##### decode
Specifies a function that will be used to decode a cookie's value. Since the value of a cookie
has a limited character set (and must be a simple string), this function can be used to decode
a previously-encoded cookie value into a JavaScript string or other object.
The default function is the global `decodeURIComponent`, which will decode any URL-encoded
sequences into their byte representations.
**note** if an error is thrown from this function, the original, non-decoded cookie value will
be returned as the cookie's value.
### cookie.serialize(name, value, options)
Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the
name for the cookie, the `value` argument is the value to set the cookie to, and the `options`
argument is an optional object containing additional serialization options.
```js
var setCookie = cookie.serialize('foo', 'bar');
// foo=bar
```
#### Options
`cookie.serialize` accepts these properties in the options object.
##### domain
Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6265-5.2.3]. By default, no
domain is set, and most clients will consider the cookie to apply to only the current domain.
##### encode
Specifies a function that will be used to encode a cookie's value. Since value of a cookie
has a limited character set (and must be a simple string), this function can be used to encode
a value into a string suited for a cookie's value.
The default function is the global `encodeURIComponent`, which will encode a JavaScript string
into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range.
##### expires
Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6265-5.2.1].
By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and
will delete it on a condition like exiting a web browser application.
**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and
`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
so if both are set, they should point to the same date and time.
##### httpOnly
Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6265-5.2.6]. When truthy,
the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set.
**note** be careful when setting this to `true`, as compliant clients will not allow client-side
JavaScript to see the cookie in `document.cookie`.
##### maxAge
Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6265-5.2.2].
The given number will be converted to an integer by rounding down. By default, no maximum age is set.
**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and
`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
so if both are set, they should point to the same date and time.
##### partitioned
Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies)
attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the
`Partitioned` attribute is not set.
**note** This is an attribute that has not yet been fully standardized, and may change in the future.
This also means many clients may ignore this attribute until they understand it.
More information about can be found in [the proposal](https://github.com/privacycg/CHIPS).
##### path
Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6265-5.2.4]. By default, the path
is considered the ["default path"][rfc-6265-5.1.4].
##### priority
Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1].
- `'low'` will set the `Priority` attribute to `Low`.
- `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
- `'high'` will set the `Priority` attribute to `High`.
More information about the different priority levels can be found in
[the specification][rfc-west-cookie-priority-00-4.1].
**note** This is an attribute that has not yet been fully standardized, and may change in the future.
This also means many clients may ignore this attribute until they understand it.
##### sameSite
Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][rfc-6265bis-09-5.4.7].
- `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
- `false` will not set the `SameSite` attribute.
- `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
- `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.
- `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
More information about the different enforcement levels can be found in
[the specification][rfc-6265bis-09-5.4.7].
**note** This is an attribute that has not yet been fully standardized, and may change in the future.
This also means many clients may ignore this attribute until they understand it.
##### secure
Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6265-5.2.5]. When truthy,
the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to
the server in the future if the browser does not have an HTTPS connection.
## Example
The following example uses this module in conjunction with the Node.js core HTTP server
to prompt a user for their name and display it back on future visits.
```js
var cookie = require('cookie');
var escapeHtml = require('escape-html');
var http = require('http');
var url = require('url');
function onRequest(req, res) {
// Parse the query string
var query = url.parse(req.url, true, true).query;
if (query && query.name) {
// Set a new cookie with the name
res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), {
httpOnly: true,
maxAge: 60 * 60 * 24 * 7 // 1 week
}));
// Redirect back after setting cookie
res.statusCode = 302;
res.setHeader('Location', req.headers.referer || '/');
res.end();
return;
}
// Parse the cookies on the request
var cookies = cookie.parse(req.headers.cookie || '');
// Get the visitor name set in the cookie
var name = cookies.name;
res.setHeader('Content-Type', 'text/html; charset=UTF-8');
if (name) {
res.write('<p>Welcome back, <b>' + escapeHtml(name) + '</b>!</p>');
} else {
res.write('<p>Hello, new visitor!</p>');
}
res.write('<form method="GET">');
res.write('<input placeholder="enter your name" name="name"> <input type="submit" value="Set Name">');
res.end('</form>');
}
http.createServer(onRequest).listen(3000);
```
## Testing
```sh
$ npm test
```
## Benchmark
```
$ npm run bench
> cookie@0.5.0 bench
> node benchmark/index.js
node@18.18.2
acorn@8.10.0
ada@2.6.0
ares@1.19.1
brotli@1.0.9
cldr@43.1
icu@73.2
llhttp@6.0.11
modules@108
napi@9
nghttp2@1.57.0
nghttp3@0.7.0
ngtcp2@0.8.1
openssl@3.0.10+quic
simdutf@3.2.14
tz@2023c
undici@5.26.3
unicode@15.0
uv@1.44.2
uvwasi@0.0.18
v8@10.2.154.26-node.26
zlib@1.2.13.1-motley
> node benchmark/parse-top.js
cookie.parse - top sites
14 tests completed.
parse accounts.google.com x 2,588,913 ops/sec ±0.74% (186 runs sampled)
parse apple.com x 2,370,002 ops/sec ±0.69% (186 runs sampled)
parse cloudflare.com x 2,213,102 ops/sec ±0.88% (188 runs sampled)
parse docs.google.com x 2,194,157 ops/sec ±1.03% (184 runs sampled)
parse drive.google.com x 2,265,084 ops/sec ±0.79% (187 runs sampled)
parse en.wikipedia.org x 457,099 ops/sec ±0.81% (186 runs sampled)
parse linkedin.com x 504,407 ops/sec ±0.89% (186 runs sampled)
parse maps.google.com x 1,230,959 ops/sec ±0.98% (186 runs sampled)
parse microsoft.com x 926,294 ops/sec ±0.88% (184 runs sampled)
parse play.google.com x 2,311,338 ops/sec ±0.83% (185 runs sampled)
parse support.google.com x 1,508,850 ops/sec ±0.86% (186 runs sampled)
parse www.google.com x 1,022,582 ops/sec ±1.32% (182 runs sampled)
parse youtu.be x 332,136 ops/sec ±1.02% (185 runs sampled)
parse youtube.com x 323,833 ops/sec ±0.77% (183 runs sampled)
> node benchmark/parse.js
cookie.parse - generic
6 tests completed.
simple x 3,214,032 ops/sec ±1.61% (183 runs sampled)
decode x 587,237 ops/sec ±1.16% (187 runs sampled)
unquote x 2,954,618 ops/sec ±1.35% (183 runs sampled)
duplicates x 857,008 ops/sec ±0.89% (187 runs sampled)
10 cookies x 292,133 ops/sec ±0.89% (187 runs sampled)
100 cookies x 22,610 ops/sec ±0.68% (187 runs sampled)
```
## References
- [RFC 6265: HTTP State Management Mechanism][rfc-6265]
- [Same-site Cookies][rfc-6265bis-09-5.4.7]
[rfc-cutler-httpbis-partitioned-cookies]: https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/
[rfc-west-cookie-priority-00-4.1]: https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1
[rfc-6265bis-09-5.4.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7
[rfc-6265]: https://tools.ietf.org/html/rfc6265
[rfc-6265-5.1.4]: https://tools.ietf.org/html/rfc6265#section-5.1.4
[rfc-6265-5.2.1]: https://tools.ietf.org/html/rfc6265#section-5.2.1
[rfc-6265-5.2.2]: https://tools.ietf.org/html/rfc6265#section-5.2.2
[rfc-6265-5.2.3]: https://tools.ietf.org/html/rfc6265#section-5.2.3
[rfc-6265-5.2.4]: https://tools.ietf.org/html/rfc6265#section-5.2.4
[rfc-6265-5.2.5]: https://tools.ietf.org/html/rfc6265#section-5.2.5
[rfc-6265-5.2.6]: https://tools.ietf.org/html/rfc6265#section-5.2.6
[rfc-6265-5.3]: https://tools.ietf.org/html/rfc6265#section-5.3
## License
[MIT](LICENSE)
[ci-image]: https://badgen.net/github/checks/jshttp/cookie/master?label=ci
[ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/cookie/master
[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master
[node-image]: https://badgen.net/npm/node/cookie
[node-url]: https://nodejs.org/en/download
[npm-downloads-image]: https://badgen.net/npm/dm/cookie
[npm-url]: https://npmjs.org/package/cookie
[npm-version-image]: https://badgen.net/npm/v/cookie
@@ -0,0 +1,422 @@
'use strict'
const { EventEmitter } = require('node:events')
const { Buffer } = require('node:buffer')
const { InvalidArgumentError, Socks5ProxyError } = require('./errors')
const { debuglog } = require('node:util')
const { parseAddress } = require('./socks5-utils')
const debug = debuglog('undici:socks5')
const EMPTY_BUFFER = Buffer.alloc(0)
// SOCKS5 constants
const SOCKS_VERSION = 0x05
// Authentication methods
const AUTH_METHODS = {
NO_AUTH: 0x00,
GSSAPI: 0x01,
USERNAME_PASSWORD: 0x02,
NO_ACCEPTABLE: 0xFF
}
// SOCKS5 commands
const COMMANDS = {
CONNECT: 0x01,
BIND: 0x02,
UDP_ASSOCIATE: 0x03
}
// Address types
const ADDRESS_TYPES = {
IPV4: 0x01,
DOMAIN: 0x03,
IPV6: 0x04
}
// Reply codes
const REPLY_CODES = {
SUCCEEDED: 0x00,
GENERAL_FAILURE: 0x01,
CONNECTION_NOT_ALLOWED: 0x02,
NETWORK_UNREACHABLE: 0x03,
HOST_UNREACHABLE: 0x04,
CONNECTION_REFUSED: 0x05,
TTL_EXPIRED: 0x06,
COMMAND_NOT_SUPPORTED: 0x07,
ADDRESS_TYPE_NOT_SUPPORTED: 0x08
}
// State machine states
const STATES = {
INITIAL: 'initial',
HANDSHAKING: 'handshaking',
AUTHENTICATING: 'authenticating',
AUTHENTICATED: 'authenticated',
CONNECTING: 'connecting',
CONNECTED: 'connected',
ERROR: 'error',
CLOSED: 'closed'
}
/**
* SOCKS5 client implementation
* Handles SOCKS5 protocol negotiation and connection establishment
*/
class Socks5Client extends EventEmitter {
constructor (socket, options = {}) {
super()
if (!socket) {
throw new InvalidArgumentError('socket is required')
}
this.socket = socket
this.options = options
this.state = STATES.INITIAL
this.buffer = EMPTY_BUFFER
this.onSocketData = this.onData.bind(this)
this.onSocketError = this.onError.bind(this)
this.onSocketClose = this.onClose.bind(this)
// Authentication settings
this.authMethods = []
if (options.username && options.password) {
this.authMethods.push(AUTH_METHODS.USERNAME_PASSWORD)
}
this.authMethods.push(AUTH_METHODS.NO_AUTH)
// Socket event handlers
this.socket.on('data', this.onSocketData)
this.socket.on('error', this.onSocketError)
this.socket.on('close', this.onSocketClose)
}
/**
* Handle incoming data from the socket
*/
onData (data) {
debug('received data', data.length, 'bytes in state', this.state)
this.buffer = Buffer.concat([this.buffer, data])
try {
switch (this.state) {
case STATES.HANDSHAKING:
this.handleHandshakeResponse()
break
case STATES.AUTHENTICATING:
this.handleAuthResponse()
break
case STATES.CONNECTING:
this.handleConnectResponse()
break
}
} catch (err) {
this.onError(err)
}
}
/**
* Handle socket errors
*/
onError (err) {
debug('socket error', err)
this.state = STATES.ERROR
this.emit('error', err)
this.destroy()
}
/**
* Handle socket close
*/
onClose () {
debug('socket closed')
this.state = STATES.CLOSED
this.emit('close')
}
/**
* Destroy the client and underlying socket
*/
destroy () {
if (this.socket && !this.socket.destroyed) {
this.socket.destroy()
}
}
markAuthenticated () {
this.state = STATES.AUTHENTICATED
this.emit('authenticated')
}
/**
* Start the SOCKS5 handshake
*/
handshake () {
if (this.state !== STATES.INITIAL) {
throw new InvalidArgumentError('Handshake already started')
}
debug('starting handshake with', this.authMethods.length, 'auth methods')
this.state = STATES.HANDSHAKING
// Build handshake request
// +----+----------+----------+
// |VER | NMETHODS | METHODS |
// +----+----------+----------+
// | 1 | 1 | 1 to 255 |
// +----+----------+----------+
const request = Buffer.alloc(2 + this.authMethods.length)
request[0] = SOCKS_VERSION
request[1] = this.authMethods.length
this.authMethods.forEach((method, i) => {
request[2 + i] = method
})
this.socket.write(request)
}
/**
* Handle handshake response from server
*/
handleHandshakeResponse () {
if (this.buffer.length < 2) {
return // Not enough data yet
}
const version = this.buffer[0]
const method = this.buffer[1]
if (version !== SOCKS_VERSION) {
throw new Socks5ProxyError(`Invalid SOCKS version: ${version}`, 'UND_ERR_SOCKS5_VERSION')
}
if (method === AUTH_METHODS.NO_ACCEPTABLE) {
throw new Socks5ProxyError('No acceptable authentication method', 'UND_ERR_SOCKS5_AUTH_REJECTED')
}
this.buffer = this.buffer.subarray(2)
debug('server selected auth method', method)
if (method === AUTH_METHODS.NO_AUTH) {
this.markAuthenticated()
} else if (method === AUTH_METHODS.USERNAME_PASSWORD) {
this.state = STATES.AUTHENTICATING
this.sendAuthRequest()
} else {
throw new Socks5ProxyError(`Unsupported authentication method: ${method}`, 'UND_ERR_SOCKS5_AUTH_METHOD')
}
}
/**
* Send username/password authentication request
*/
sendAuthRequest () {
const { username, password } = this.options
if (!username || !password) {
throw new InvalidArgumentError('Username and password required for authentication')
}
debug('sending username/password auth')
// Username/Password authentication request (RFC 1929)
// +----+------+----------+------+----------+
// |VER | ULEN | UNAME | PLEN | PASSWD |
// +----+------+----------+------+----------+
// | 1 | 1 | 1 to 255 | 1 | 1 to 255 |
// +----+------+----------+------+----------+
const usernameBuffer = Buffer.from(username)
const passwordBuffer = Buffer.from(password)
if (usernameBuffer.length > 255 || passwordBuffer.length > 255) {
throw new InvalidArgumentError('Username or password too long')
}
const request = Buffer.alloc(3 + usernameBuffer.length + passwordBuffer.length)
request[0] = 0x01 // Sub-negotiation version
request[1] = usernameBuffer.length
usernameBuffer.copy(request, 2)
request[2 + usernameBuffer.length] = passwordBuffer.length
passwordBuffer.copy(request, 3 + usernameBuffer.length)
this.socket.write(request)
}
/**
* Handle authentication response
*/
handleAuthResponse () {
if (this.buffer.length < 2) {
return // Not enough data yet
}
const version = this.buffer[0]
const status = this.buffer[1]
if (version !== 0x01) {
throw new Socks5ProxyError(`Invalid auth sub-negotiation version: ${version}`, 'UND_ERR_SOCKS5_AUTH_VERSION')
}
if (status !== 0x00) {
throw new Socks5ProxyError('Authentication failed', 'UND_ERR_SOCKS5_AUTH_FAILED')
}
this.buffer = this.buffer.subarray(2)
debug('authentication successful')
this.markAuthenticated()
}
/**
* Send CONNECT command
* @param {string} address - Target address (IP or domain)
* @param {number} port - Target port
*/
connect (address, port) {
if (this.state === STATES.CONNECTING || this.state === STATES.CONNECTED) {
throw new InvalidArgumentError('Connection already in progress')
}
if (this.state !== STATES.AUTHENTICATED) {
throw new InvalidArgumentError('Client must be authenticated before CONNECT')
}
debug('connecting to', address, port)
this.state = STATES.CONNECTING
const request = this.buildConnectRequest(COMMANDS.CONNECT, address, port)
this.socket.write(request)
}
/**
* Build a SOCKS5 request
*/
buildConnectRequest (command, address, port) {
// Parse address to determine type and buffer
const { type: addressType, buffer: addressBuffer } = parseAddress(address)
// Build request
// +----+-----+-------+------+----------+----------+
// |VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT |
// +----+-----+-------+------+----------+----------+
// | 1 | 1 | X'00' | 1 | Variable | 2 |
// +----+-----+-------+------+----------+----------+
const request = Buffer.alloc(4 + addressBuffer.length + 2)
request[0] = SOCKS_VERSION
request[1] = command
request[2] = 0x00 // Reserved
request[3] = addressType
addressBuffer.copy(request, 4)
request.writeUInt16BE(port, 4 + addressBuffer.length)
return request
}
/**
* Handle CONNECT response
*/
handleConnectResponse () {
if (this.buffer.length < 4) {
return // Not enough data for header
}
const version = this.buffer[0]
const reply = this.buffer[1]
const addressType = this.buffer[3]
if (version !== SOCKS_VERSION) {
throw new Socks5ProxyError(`Invalid SOCKS version in reply: ${version}`, 'UND_ERR_SOCKS5_REPLY_VERSION')
}
// Calculate the expected response length
let responseLength = 4 // VER + REP + RSV + ATYP
if (addressType === ADDRESS_TYPES.IPV4) {
responseLength += 4 + 2 // IPv4 + port
} else if (addressType === ADDRESS_TYPES.DOMAIN) {
if (this.buffer.length < 5) {
return // Need domain length byte
}
responseLength += 1 + this.buffer[4] + 2 // length byte + domain + port
} else if (addressType === ADDRESS_TYPES.IPV6) {
responseLength += 16 + 2 // IPv6 + port
} else {
throw new Socks5ProxyError(`Invalid address type in reply: ${addressType}`, 'UND_ERR_SOCKS5_ADDR_TYPE')
}
if (this.buffer.length < responseLength) {
return // Not enough data for full response
}
if (reply !== REPLY_CODES.SUCCEEDED) {
const errorMessage = this.getReplyErrorMessage(reply)
throw new Socks5ProxyError(`SOCKS5 connection failed: ${errorMessage}`, `UND_ERR_SOCKS5_REPLY_${reply}`)
}
// Parse bound address and port
let boundAddress
let offset = 4
if (addressType === ADDRESS_TYPES.IPV4) {
boundAddress = Array.from(this.buffer.subarray(offset, offset + 4)).join('.')
offset += 4
} else if (addressType === ADDRESS_TYPES.DOMAIN) {
const domainLength = this.buffer[offset]
offset += 1
boundAddress = this.buffer.subarray(offset, offset + domainLength).toString()
offset += domainLength
} else if (addressType === ADDRESS_TYPES.IPV6) {
// Parse IPv6 address from 16-byte buffer
const parts = []
for (let i = 0; i < 8; i++) {
const value = this.buffer.readUInt16BE(offset + i * 2)
parts.push(value.toString(16))
}
boundAddress = parts.join(':')
offset += 16
}
const boundPort = this.buffer.readUInt16BE(offset)
this.buffer = EMPTY_BUFFER
this.state = STATES.CONNECTED
this.socket.removeListener('data', this.onSocketData)
debug('connected, bound address:', boundAddress, 'port:', boundPort)
this.emit('connected', { address: boundAddress, port: boundPort })
}
/**
* Get human-readable error message for reply code
*/
getReplyErrorMessage (reply) {
switch (reply) {
case REPLY_CODES.GENERAL_FAILURE:
return 'General SOCKS server failure'
case REPLY_CODES.CONNECTION_NOT_ALLOWED:
return 'Connection not allowed by ruleset'
case REPLY_CODES.NETWORK_UNREACHABLE:
return 'Network unreachable'
case REPLY_CODES.HOST_UNREACHABLE:
return 'Host unreachable'
case REPLY_CODES.CONNECTION_REFUSED:
return 'Connection refused'
case REPLY_CODES.TTL_EXPIRED:
return 'TTL expired'
case REPLY_CODES.COMMAND_NOT_SUPPORTED:
return 'Command not supported'
case REPLY_CODES.ADDRESS_TYPE_NOT_SUPPORTED:
return 'Address type not supported'
default:
return `Unknown error code: ${reply}`
}
}
}
module.exports = {
Socks5Client,
AUTH_METHODS,
COMMANDS,
ADDRESS_TYPES,
REPLY_CODES,
STATES
}
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const ArrowDownToDot = createLucideIcon("ArrowDownToDot", [
["path", { d: "M12 2v14", key: "jyx4ut" }],
["path", { d: "m19 9-7 7-7-7", key: "1oe3oy" }],
["circle", { cx: "12", cy: "21", r: "1", key: "o0uj5v" }]
]);
export { ArrowDownToDot as default };
//# sourceMappingURL=arrow-down-to-dot.js.map
@@ -0,0 +1,15 @@
#!/usr/bin/env node
/* eslint-disable no-var, unicorn/prefer-node-protocol */
var parser = require("..");
var fs = require("fs");
var filename = process.argv[2];
if (!filename) {
console.error("no filename specified");
} else {
var file = fs.readFileSync(filename, "utf8");
var ast = parser.parse(file);
console.log(JSON.stringify(ast, null, " "));
}
@@ -0,0 +1,304 @@
/**
* @fileoverview Manages the suppressed violations.
* @author Iacovos Constantinou
*/
"use strict";
//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------
const fs = require("node:fs");
const path = require("node:path");
const { calculateStatsPerFile } = require("../shared/message-counts");
const stringify = require("json-stable-stringify-without-jsonify");
//------------------------------------------------------------------------------
// Typedefs
//------------------------------------------------------------------------------
// For VSCode IntelliSense
/** @typedef {import("../types").Linter.LintMessage} LintMessage */
/** @typedef {import("../types").ESLint.LintResult} LintResult */
/** @typedef {Record<string, Record<string, { count: number; }>>} SuppressedViolations */
//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------
/**
* Manages the suppressed violations.
*/
class SuppressionsService {
static DEFAULT_SUPPRESSIONS_FILENAME = "eslint-suppressions.json";
filePath = "";
cwd = "";
/**
* Creates a new instance of SuppressionsService.
* @param {Object} options The options.
* @param {string} [options.filePath] The location of the suppressions file.
* @param {string} [options.cwd] The current working directory.
*/
constructor({ filePath, cwd }) {
this.filePath = filePath;
this.cwd = cwd;
}
/**
* Updates the suppressions file based on the current violations and the provided rules.
* If no rules are provided, all violations are suppressed.
* @param {LintResult[]|undefined} results The lint results.
* @param {string[]|undefined} rules The rules to suppress.
* @returns {Promise<void>}
*/
async suppress(results, rules) {
const suppressions = await this.load();
for (const result of results) {
const relativeFilePath = this.getRelativeFilePath(result.filePath);
const violationsByRule = SuppressionsService.countViolationsByRule(
result.messages,
);
for (const ruleId in violationsByRule) {
if (rules && !rules.includes(ruleId)) {
continue;
}
suppressions[relativeFilePath] ??= {};
suppressions[relativeFilePath][ruleId] =
violationsByRule[ruleId];
}
}
return this.save(suppressions);
}
/**
* Removes old, unused suppressions for violations that do not occur anymore.
* @param {LintResult[]} results The lint results.
* @returns {Promise<void>} No return value.
*/
async prune(results) {
const suppressions = await this.load();
const { unused } = this.applySuppressions(results, suppressions);
for (const file in unused) {
if (!suppressions[file]) {
continue;
}
for (const rule in unused[file]) {
if (!suppressions[file][rule]) {
continue;
}
const suppressionsCount = suppressions[file][rule].count;
const violationsCount = unused[file][rule].count;
if (suppressionsCount === violationsCount) {
// Remove unused rules
delete suppressions[file][rule];
} else {
// Update the count to match the new number of violations
suppressions[file][rule].count -= violationsCount;
}
}
// Cleanup files with no rules
if (Object.keys(suppressions[file]).length === 0) {
delete suppressions[file];
}
}
for (const file of Object.keys(suppressions)) {
const absolutePath = path.resolve(this.cwd, file);
if (!fs.existsSync(absolutePath)) {
delete suppressions[file];
}
}
return this.save(suppressions);
}
/**
* Checks the provided suppressions against the lint results.
*
* For each file, counts the number of violations per rule.
* For each rule in each file, compares the number of violations against the counter from the suppressions file.
* If the number of violations is less or equal to the counter, messages are moved to `LintResult#suppressedMessages` and ignored.
* Otherwise, all violations are reported as usual.
* @param {LintResult[]} results The lint results.
* @param {SuppressedViolations} suppressions The suppressions.
* @returns {{
* results: LintResult[],
* unused: SuppressedViolations
* }} The updated results and the unused suppressions.
*/
applySuppressions(results, suppressions) {
/**
* We copy the results to avoid modifying the original objects
* We remove only result messages that are matched and hence suppressed
* We leave the rest untouched to minimize the risk of losing parts of the original data
*/
const filtered = structuredClone(results);
const unused = {};
for (const result of filtered) {
const relativeFilePath = this.getRelativeFilePath(result.filePath);
if (!suppressions[relativeFilePath]) {
continue;
}
const violationsByRule = SuppressionsService.countViolationsByRule(
result.messages,
);
let wasSuppressed = false;
for (const ruleId in violationsByRule) {
if (!suppressions[relativeFilePath][ruleId]) {
continue;
}
const suppressionsCount =
suppressions[relativeFilePath][ruleId].count;
const violationsCount = violationsByRule[ruleId].count;
// Suppress messages if the number of violations is less or equal to the suppressions count
if (violationsCount <= suppressionsCount) {
SuppressionsService.suppressMessagesByRule(result, ruleId);
wasSuppressed = true;
}
// Update the count to match the new number of violations, otherwise remove the rule entirely
if (violationsCount < suppressionsCount) {
unused[relativeFilePath] ??= {};
unused[relativeFilePath][ruleId] ??= {};
unused[relativeFilePath][ruleId].count =
suppressionsCount - violationsCount;
}
}
// Mark as unused all the suppressions that were not matched against a rule
for (const ruleId in suppressions[relativeFilePath]) {
if (violationsByRule[ruleId]) {
continue;
}
unused[relativeFilePath] ??= {};
unused[relativeFilePath][ruleId] =
suppressions[relativeFilePath][ruleId];
}
// Recalculate stats if messages were suppressed
if (wasSuppressed) {
Object.assign(result, calculateStatsPerFile(result.messages));
}
}
return {
results: filtered,
unused,
};
}
/**
* Loads the suppressions file.
* @throws {Error} If the suppressions file cannot be parsed.
* @returns {Promise<SuppressedViolations>} The suppressions.
*/
async load() {
try {
const data = await fs.promises.readFile(this.filePath, "utf8");
return JSON.parse(data);
} catch (err) {
if (err.code === "ENOENT") {
return {};
}
throw new Error(
`Failed to parse suppressions file at ${this.filePath}`,
{
cause: err,
},
);
}
}
/**
* Updates the suppressions file.
* @param {SuppressedViolations} suppressions The suppressions to save.
* @returns {Promise<void>}
* @private
*/
save(suppressions) {
return fs.promises.writeFile(
this.filePath,
stringify(suppressions, { space: 2 }),
);
}
/**
* Counts the violations by rule, ignoring warnings.
* @param {LintMessage[]} messages The messages to count.
* @returns {Record<string, number>} The number of violations by rule.
*/
static countViolationsByRule(messages) {
return messages.reduce((totals, message) => {
if (message.severity === 2 && message.ruleId) {
totals[message.ruleId] ??= { count: 0 };
totals[message.ruleId].count++;
}
return totals;
}, {});
}
/**
* Returns the relative path of a file to the current working directory.
* Always in POSIX format for consistency and interoperability.
* @param {string} filePath The file path.
* @returns {string} The relative file path.
*/
getRelativeFilePath(filePath) {
return path
.relative(this.cwd, filePath)
.split(path.sep)
.join(path.posix.sep);
}
/**
* Moves the messages matching the rule to `LintResult#suppressedMessages` and updates the stats.
* @param {LintResult} result The result to update.
* @param {string} ruleId The rule to suppress.
* @returns {void}
*/
static suppressMessagesByRule(result, ruleId) {
const suppressedMessages = result.messages.filter(
message => message.ruleId === ruleId,
);
result.suppressedMessages = result.suppressedMessages.concat(
suppressedMessages.map(message => {
message.suppressions = [
{
kind: "file",
justification: "",
},
];
return message;
}),
);
result.messages = result.messages.filter(
message => message.ruleId !== ruleId,
);
}
}
module.exports = { SuppressionsService };
@@ -0,0 +1,41 @@
import { UnsupportedPathError } from "../../router.js";
//#region src/router/pattern-router/router.ts
const emptyParams = Object.create(null);
var PatternRouter = class {
name = "PatternRouter";
#routes = [];
add(method, path, handler) {
const suffix = path.endsWith("/*") ? "(?:$|/)" : path.endsWith("*") ? "" : "/?$";
path = path.replace(/\*$/, "");
if (path.at(-1) === "?") {
path = path.slice(0, -1);
this.add(method, path.replace(/\/[^/]+$/, ""), handler);
}
const parts = (path.match(/\/?(:\w+(?:{(?:(?:{[\d,]+})|[^}])+})?)|\/?[^\/\?]+/g) || []).map((part) => {
const match = part.match(/^\/:([^{]+)(?:{(.*)})?/);
return match ? `/(?<${match[1]}>${match[2] || "[^/]+"})` : part === "/*" ? "/[^/]+" : part.replace(/[.\\+*[^\]$()]/g, "\\$&");
});
try {
this.#routes.push([
new RegExp(`^${parts.join("")}${suffix}`),
method,
handler
]);
} catch {
throw new UnsupportedPathError();
}
}
match(method, path) {
const handlers = [];
for (let i = 0, len = this.#routes.length; i < len; i++) {
const [pattern, routeMethod, handler] = this.#routes[i];
if (routeMethod === method || routeMethod === "ALL") {
const match = pattern.exec(path);
if (match) handlers.push([handler, match.groups || emptyParams]);
}
}
return [handlers];
}
};
//#endregion
export { PatternRouter };
@@ -0,0 +1,232 @@
/**
* @fileoverview Rule to flag no-unneeded-ternary
* @author Gyandeep Singh
*/
"use strict";
const astUtils = require("./utils/ast-utils");
// Operators that always result in a boolean value
const BOOLEAN_OPERATORS = new Set([
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<=",
"in",
"instanceof",
]);
const OPERATOR_INVERSES = {
"==": "!=",
"!=": "==",
"===": "!==",
"!==": "===",
// Operators like < and >= are not true inverses, since both will return false with NaN.
};
const OR_PRECEDENCE = astUtils.getPrecedence({
type: "LogicalExpression",
operator: "||",
});
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: [{ defaultAssignment: true }],
docs: {
description:
"Disallow ternary operators when simpler alternatives exist",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/no-unneeded-ternary",
},
schema: [
{
type: "object",
properties: {
defaultAssignment: {
type: "boolean",
},
},
additionalProperties: false,
},
],
fixable: "code",
messages: {
unnecessaryConditionalExpression:
"Unnecessary use of boolean literals in conditional expression.",
unnecessaryConditionalAssignment:
"Unnecessary use of conditional expression for default assignment.",
},
},
create(context) {
const [{ defaultAssignment }] = context.options;
const sourceCode = context.sourceCode;
/**
* Test if the node is a boolean literal
* @param {ASTNode} node The node to report.
* @returns {boolean} True if the its a boolean literal
* @private
*/
function isBooleanLiteral(node) {
return node.type === "Literal" && typeof node.value === "boolean";
}
/**
* Creates an expression that represents the boolean inverse of the expression represented by the original node
* @param {ASTNode} node A node representing an expression
* @returns {string} A string representing an inverted expression
*/
function invertExpression(node) {
if (
node.type === "BinaryExpression" &&
Object.hasOwn(OPERATOR_INVERSES, node.operator)
) {
const operatorToken = sourceCode.getFirstTokenBetween(
node.left,
node.right,
token => token.value === node.operator,
);
const text = sourceCode.getText();
return (
text.slice(node.range[0], operatorToken.range[0]) +
OPERATOR_INVERSES[node.operator] +
text.slice(operatorToken.range[1], node.range[1])
);
}
if (
astUtils.getPrecedence(node) <
astUtils.getPrecedence({ type: "UnaryExpression" })
) {
return `!(${astUtils.getParenthesisedText(sourceCode, node)})`;
}
return `!${astUtils.getParenthesisedText(sourceCode, node)}`;
}
/**
* Tests if a given node always evaluates to a boolean value
* @param {ASTNode} node An expression node
* @returns {boolean} True if it is determined that the node will always evaluate to a boolean value
*/
function isBooleanExpression(node) {
return (
(node.type === "BinaryExpression" &&
BOOLEAN_OPERATORS.has(node.operator)) ||
(node.type === "UnaryExpression" && node.operator === "!")
);
}
/**
* Test if the node matches the pattern id ? id : expression
* @param {ASTNode} node The ConditionalExpression to check.
* @returns {boolean} True if the pattern is matched, and false otherwise
* @private
*/
function matchesDefaultAssignment(node) {
return (
node.test.type === "Identifier" &&
node.consequent.type === "Identifier" &&
node.test.name === node.consequent.name
);
}
return {
ConditionalExpression(node) {
if (
isBooleanLiteral(node.alternate) &&
isBooleanLiteral(node.consequent)
) {
context.report({
node,
messageId: "unnecessaryConditionalExpression",
fix(fixer) {
if (
node.consequent.value === node.alternate.value
) {
// Replace `foo ? true : true` with just `true`, but don't replace `foo() ? true : true`
return node.test.type === "Identifier"
? fixer.replaceText(
node,
node.consequent.value.toString(),
)
: null;
}
if (node.alternate.value) {
// Replace `foo() ? false : true` with `!(foo())`
return fixer.replaceText(
node,
invertExpression(node.test),
);
}
// Replace `foo ? true : false` with `foo` if `foo` is guaranteed to be a boolean, or `!!foo` otherwise.
return fixer.replaceText(
node,
isBooleanExpression(node.test)
? astUtils.getParenthesisedText(
sourceCode,
node.test,
)
: `!${invertExpression(node.test)}`,
);
},
});
} else if (
!defaultAssignment &&
matchesDefaultAssignment(node)
) {
context.report({
node,
messageId: "unnecessaryConditionalAssignment",
fix(fixer) {
const shouldParenthesizeAlternate =
(astUtils.getPrecedence(node.alternate) <
OR_PRECEDENCE ||
astUtils.isCoalesceExpression(
node.alternate,
)) &&
!astUtils.isParenthesised(
sourceCode,
node.alternate,
);
const alternateText = shouldParenthesizeAlternate
? `(${sourceCode.getText(node.alternate)})`
: astUtils.getParenthesisedText(
sourceCode,
node.alternate,
);
const testText = astUtils.getParenthesisedText(
sourceCode,
node.test,
);
return fixer.replaceText(
node,
`${testText} || ${alternateText}`,
);
},
});
}
},
};
},
};
@@ -0,0 +1,2 @@
export declare const DEFAULT_PROJECT_FILES_ERROR_EXPLANATION = "\n\nHaving many files run with the default project is known to cause performance issues and slow down linting.\n\nSee https://tseslint.com/allowdefaultproject-glob-too-wide\n";
export declare function validateDefaultProjectForFilesGlob(allowDefaultProject: string[] | undefined): void;
@@ -0,0 +1,335 @@
// src/only-export-components.ts
var reactComponentNameRE = /^[A-Z][a-zA-Z0-9_]*$/u;
var onlyExportComponents = {
meta: {
messages: {
exportAll: "This rule can't verify that `export *` only exports components.",
namedExport: "Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components.",
anonymousExport: "Fast refresh can't handle anonymous components. Add a name to your export.",
localComponents: "Fast refresh only works when a file only exports components. Move your component(s) to a separate file. If all exports are HOCs, add them to the `extraHOCs` option.",
noExport: "Fast refresh only works when a file has exports. Move your component(s) to a separate file.",
reactContext: "Fast refresh only works when a file only exports components. Move your React context(s) to a separate file."
},
type: "problem",
schema: [
{
type: "object",
properties: {
extraHOCs: { type: "array", items: { type: "string" } },
allowExportNames: { type: "array", items: { type: "string" } },
allowConstantExport: { type: "boolean" },
checkJS: { type: "boolean" }
},
additionalProperties: false
}
]
},
defaultOptions: [],
create: (context) => {
const {
extraHOCs = [],
allowExportNames,
allowConstantExport = false,
checkJS = false
} = context.options[0] ?? {};
const filename = context.filename;
if (filename.includes(".test.") || filename.includes(".spec.") || filename.includes(".cy.") || filename.includes(".stories.")) {
return {};
}
const shouldScan = filename.endsWith(".jsx") || filename.endsWith(".tsx") || checkJS && filename.endsWith(".js");
if (!shouldScan) return {};
const allowExportNamesSet = allowExportNames ? new Set(allowExportNames) : void 0;
const validHOCs = ["memo", "forwardRef", "lazy", ...extraHOCs];
const getHocName = (node) => {
const callee = node.type === "CallExpression" ? node.callee : node.tag;
if (callee.type === "CallExpression") {
return getHocName(callee);
}
if (callee.type === "MemberExpression") {
if (callee.property.type === "Identifier" && validHOCs.includes(callee.property.name)) {
return callee.property.name;
}
if (callee.object.type === "Identifier" && validHOCs.includes(callee.object.name)) {
return callee.object.name;
}
if (callee.object.type === "CallExpression") {
return getHocName(callee.object);
}
}
if (callee.type === "Identifier") {
return callee.name;
}
return void 0;
};
const isCallExpressionReactComponent = (node) => {
const hocName = getHocName(node);
if (!hocName || !validHOCs.includes(hocName)) return false;
const validateArgument = hocName === "memo" || hocName === "forwardRef";
if (!validateArgument) return true;
if (node.arguments.length === 0) return false;
const arg = skipTSWrapper(node.arguments[0]);
switch (arg.type) {
case "Identifier":
return reactComponentNameRE.test(arg.name);
case "FunctionExpression":
case "ArrowFunctionExpression":
if (!arg.id) return "needName";
return reactComponentNameRE.test(arg.id.name);
case "CallExpression":
return isCallExpressionReactComponent(arg);
default:
return false;
}
};
const isExpressionReactComponent = (expressionParam) => {
const exp = skipTSWrapper(expressionParam);
if (exp.type === "Identifier") {
return reactComponentNameRE.test(exp.name);
}
if (exp.type === "ArrowFunctionExpression" || exp.type === "FunctionExpression") {
if (exp.params.length > 2) return false;
if (!exp.id?.name) return "needName";
return reactComponentNameRE.test(exp.id.name);
}
if (exp.type === "ConditionalExpression") {
const consequent = isExpressionReactComponent(exp.consequent);
const alternate = isExpressionReactComponent(exp.alternate);
if (consequent === false || alternate === false) return false;
if (consequent === "needName" || alternate === "needName") {
return "needName";
}
return true;
}
if (exp.type === "CallExpression") {
return isCallExpressionReactComponent(exp);
}
if (exp.type === "TaggedTemplateExpression") {
const hocName = getHocName(exp);
if (!hocName || !validHOCs.includes(hocName)) return false;
return "needName";
}
return false;
};
return {
Program(program) {
let hasExports = false;
let hasReactExport = false;
let reactIsInScope = false;
const localComponents = [];
const nonComponentExports = [];
const reactContextExports = [];
const handleExportIdentifier = (identifierNode, initParam) => {
if (identifierNode.type !== "Identifier") {
nonComponentExports.push(identifierNode);
return;
}
if (allowExportNamesSet?.has(identifierNode.name)) return;
if (!initParam) {
if (reactComponentNameRE.test(identifierNode.name)) {
hasReactExport = true;
} else {
nonComponentExports.push(identifierNode);
}
return;
}
const init = skipTSWrapper(initParam);
if (allowConstantExport && constantExportExpressions.has(init.type)) {
return;
}
if (init.type === "CallExpression" && (init.callee.type === "Identifier" && init.callee.name === "createContext" || init.callee.type === "MemberExpression" && init.callee.property.type === "Identifier" && init.callee.property.name === "createContext")) {
reactContextExports.push(identifierNode);
return;
}
const isReactComponent = reactComponentNameRE.test(identifierNode.name) && isExpressionReactComponent(init);
if (isReactComponent === false) {
nonComponentExports.push(identifierNode);
} else {
hasReactExport = true;
}
};
const handleExportDeclaration = (node) => {
if (node.type === "VariableDeclaration") {
for (const variable of node.declarations) {
if (variable.init === null) {
nonComponentExports.push(variable.id);
continue;
}
handleExportIdentifier(variable.id, variable.init);
}
} else if (node.type === "FunctionDeclaration") {
if (node.id === null) {
context.report({ messageId: "anonymousExport", node });
} else {
handleExportIdentifier(node.id);
}
} else if (node.type === "ClassDeclaration") {
if (node.id === null) {
context.report({ messageId: "anonymousExport", node });
} else if (reactComponentNameRE.test(node.id.name) && node.superClass !== null && node.body.body.some(
(item) => item.type === "MethodDefinition" && item.key.type === "Identifier" && item.key.name === "render"
)) {
hasReactExport = true;
} else {
nonComponentExports.push(node.id);
}
} else if (node.type === "CallExpression") {
const result = isCallExpressionReactComponent(node);
if (result === false) {
nonComponentExports.push(node);
} else if (result === "needName") {
context.report({ messageId: "anonymousExport", node });
} else {
hasReactExport = true;
}
} else {
nonComponentExports.push(node);
}
};
for (const node of program.body) {
if (node.type === "ExportAllDeclaration") {
if (node.exportKind === "type") continue;
hasExports = true;
context.report({ messageId: "exportAll", node });
} else if (node.type === "ExportDefaultDeclaration") {
hasExports = true;
const declaration = skipTSWrapper(node.declaration);
if (declaration.type === "VariableDeclaration" || declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration" || declaration.type === "CallExpression") {
handleExportDeclaration(declaration);
}
if (declaration.type === "Identifier") {
handleExportIdentifier(declaration);
}
if (declaration.type === "ArrowFunctionExpression") {
context.report({ messageId: "anonymousExport", node });
}
} else if (node.type === "ExportNamedDeclaration") {
if (node.exportKind === "type") continue;
const declaration = node.declaration ? skipTSWrapper(node.declaration) : null;
if (declaration?.type === "TSDeclareFunction") continue;
hasExports = true;
if (declaration) handleExportDeclaration(declaration);
for (const specifier of node.specifiers) {
handleExportIdentifier(
specifier.exported.type === "Identifier" && specifier.exported.name === "default" ? specifier.local : specifier.exported
);
}
} else if (node.type === "VariableDeclaration") {
for (const variable of node.declarations) {
if (variable.id.type === "Identifier" && reactComponentNameRE.test(variable.id.name) && variable.init !== null && isExpressionReactComponent(variable.init) !== false) {
localComponents.push(variable.id);
}
}
} else if (node.type === "FunctionDeclaration") {
if (reactComponentNameRE.test(node.id.name)) {
localComponents.push(node.id);
}
} else if (node.type === "ImportDeclaration" && node.source.value === "react") {
reactIsInScope = true;
}
}
if (checkJS && !reactIsInScope) return;
if (hasExports) {
if (hasReactExport) {
for (const node of nonComponentExports) {
context.report({ messageId: "namedExport", node });
}
for (const node of reactContextExports) {
context.report({ messageId: "reactContext", node });
}
} else if (localComponents.length) {
for (const node of localComponents) {
context.report({ messageId: "localComponents", node });
}
}
} else if (localComponents.length) {
for (const node of localComponents) {
context.report({ messageId: "noExport", node });
}
}
}
};
}
};
var skipTSWrapper = (node) => {
if (node.type === "TSAsExpression" || node.type === "TSSatisfiesExpression" || node.type === "TSNonNullExpression" || node.type === "TSTypeAssertion" || node.type === "TSInstantiationExpression") {
return node.expression;
}
return node;
};
var constantExportExpressions = /* @__PURE__ */ new Set([
"Literal",
// 1, "foo"
"UnaryExpression",
// -1
"TemplateLiteral",
// `Some ${template}`
"BinaryExpression"
// 24 * 60
]);
// src/index.ts
var rules = {
"only-export-components": onlyExportComponents
};
var plugin = { rules };
var buildConfig = ({
name,
baseOptions
}) => (options) => ({
name: `react-refresh/${name}`,
plugins: { "react-refresh": plugin },
rules: {
"react-refresh/only-export-components": [
"error",
{ ...baseOptions, ...options }
]
}
});
var configs = {
recommended: buildConfig({ name: "recommended", baseOptions: {} }),
vite: buildConfig({
name: "vite",
baseOptions: { allowConstantExport: true }
}),
next: buildConfig({
name: "next",
baseOptions: {
allowExportNames: [
// https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
"experimental_ppr",
"dynamic",
"dynamicParams",
"revalidate",
"fetchCache",
"runtime",
"preferredRegion",
"maxDuration",
// https://nextjs.org/docs/app/api-reference/functions/generate-metadata
"metadata",
"generateMetadata",
// https://nextjs.org/docs/app/api-reference/functions/generate-viewport
"viewport",
"generateViewport",
// https://nextjs.org/docs/app/api-reference/functions/generate-image-metadata
"generateImageMetadata",
// https://nextjs.org/docs/app/api-reference/functions/generate-sitemaps
"generateSitemaps",
// https://nextjs.org/docs/app/api-reference/functions/generate-static-params
"generateStaticParams"
]
}
})
};
var reactRefresh = { plugin, configs };
var index_default = {
rules,
configs: {
recommended: configs.recommended(),
vite: configs.vite(),
next: configs.next()
}
};
export {
index_default as default,
reactRefresh
};
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../src/use-size.tsx"],
"sourcesContent": ["export { useSize } from './use-size';\n", "/// <reference types=\"resize-observer-browser\" />\n\nimport * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\nfunction useSize(element: HTMLElement | null) {\n const [size, setSize] = React.useState<{ width: number; height: number } | undefined>(undefined);\n\n useLayoutEffect(() => {\n if (element) {\n // provide size as early as possible\n setSize({ width: element.offsetWidth, height: element.offsetHeight });\n\n const resizeObserver = new ResizeObserver((entries) => {\n if (!Array.isArray(entries)) {\n return;\n }\n\n // Since we only observe the one element, we don't need to loop over the\n // array\n if (!entries.length) {\n return;\n }\n\n const entry = entries[0];\n let width: number;\n let height: number;\n\n if ('borderBoxSize' in entry) {\n const borderSizeEntry = entry['borderBoxSize'];\n // iron out differences between browsers\n const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;\n width = borderSize['inlineSize'];\n height = borderSize['blockSize'];\n } else {\n // for browsers that don't support `borderBoxSize`\n // we calculate it ourselves to get the correct border box.\n width = element.offsetWidth;\n height = element.offsetHeight;\n }\n\n setSize({ width, height });\n });\n\n resizeObserver.observe(element, { box: 'border-box' });\n\n return () => resizeObserver.unobserve(element);\n } else {\n // We only want to reset to `undefined` when the element becomes `null`,\n // not if it changes to another element.\n setSize(undefined);\n }\n }, [element]);\n\n return size;\n}\n\nexport { useSize };\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,YAAuB;AACvB,qCAAgC;AAEhC,SAAS,QAAQ,SAA6B;AAC5C,QAAM,CAAC,MAAM,OAAO,IAAU,eAAwD,MAAS;AAE/F,sDAAgB,MAAM;AACpB,QAAI,SAAS;AAEX,cAAQ,EAAE,OAAO,QAAQ,aAAa,QAAQ,QAAQ,aAAa,CAAC;AAEpE,YAAM,iBAAiB,IAAI,eAAe,CAAC,YAAY;AACrD,YAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;AAC3B;AAAA,QACF;AAIA,YAAI,CAAC,QAAQ,QAAQ;AACnB;AAAA,QACF;AAEA,cAAM,QAAQ,QAAQ,CAAC;AACvB,YAAI;AACJ,YAAI;AAEJ,YAAI,mBAAmB,OAAO;AAC5B,gBAAM,kBAAkB,MAAM,eAAe;AAE7C,gBAAM,aAAa,MAAM,QAAQ,eAAe,IAAI,gBAAgB,CAAC,IAAI;AACzE,kBAAQ,WAAW,YAAY;AAC/B,mBAAS,WAAW,WAAW;AAAA,QACjC,OAAO;AAGL,kBAAQ,QAAQ;AAChB,mBAAS,QAAQ;AAAA,QACnB;AAEA,gBAAQ,EAAE,OAAO,OAAO,CAAC;AAAA,MAC3B,CAAC;AAED,qBAAe,QAAQ,SAAS,EAAE,KAAK,aAAa,CAAC;AAErD,aAAO,MAAM,eAAe,UAAU,OAAO;AAAA,IAC/C,OAAO;AAGL,cAAQ,MAAS;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO;AACT;",
"names": []
}
@@ -0,0 +1,6 @@
import type { ParseSettings } from '../parseSettings';
import type { ASTAndDefiniteProgram } from './shared';
/**
* @returns Returns a new source file and program corresponding to the linted code
*/
export declare function createIsolatedProgram(parseSettings: ParseSettings): ASTAndDefiniteProgram;
@@ -0,0 +1,6 @@
import type { TSESTree } from '../ts-estree';
export declare const LINEBREAK_MATCHER: RegExp;
/**
* Determines whether two adjacent tokens are on the same line
*/
export declare function isTokenOnSameLine(left: TSESTree.Node | TSESTree.Token, right: TSESTree.Node | TSESTree.Token): boolean;
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2019_array: LibDefinition;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_K","2":"_I"},C:{"1":"_3L","2":"_US","194":"sB _3N"},D:{"1":"_FN _SG","2":"_4Q"},E:{"1":"_QB","2":"_TB"},F:{"1":"_bG _vB","2":"_SS"},G:{"1":"_BB","2":"_OB"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:5,C:"CSS Font Loading",D:true};
@@ -0,0 +1,25 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
//#region src/adapter/netlify/conninfo.ts
/**
* Get connection information from Netlify
* @param c - Context
* @returns Connection information including remote address
* @example
* ```ts
* import { Hono } from 'hono'
* import { handle, getConnInfo } from 'hono/netlify'
*
* const app = new Hono()
*
* app.get('/', (c) => {
* const info = getConnInfo(c)
* return c.text(`Your IP: ${info.remote.address}`)
* })
*
* export default handle(app)
* ```
* @deprecated `hono/netlify` will be removed in v5. Install `@hono/netlify` and import from there instead.
*/
const getConnInfo = (c) => ({ remote: { address: c.env.context?.ip } });
//#endregion
exports.getConnInfo = getConnInfo;
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Evgeny Poberezkin
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.
@@ -0,0 +1,12 @@
/*#__NO_SIDE_EFFECTS__*/
function memo(callback) {
let result;
return () => {
if (result === undefined)
result = callback();
return result;
};
}
export { memo };
//# sourceMappingURL=memo.mjs.map
@@ -0,0 +1,21 @@
"use client";
// src/direction.tsx
import * as React from "react";
import { jsx } from "react/jsx-runtime";
var DirectionContext = React.createContext(void 0);
var DirectionProvider = (props) => {
const { dir, children } = props;
return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children });
};
function useDirection(localDir) {
const globalDir = React.useContext(DirectionContext);
return localDir || globalDir || "ltr";
}
var Provider = DirectionProvider;
export {
DirectionProvider,
Provider,
useDirection
};
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,138 @@
import { compose } from "../../compose.js";
import "../../router.js";
import { TrieRouter } from "../../router/trie-router/router.js";
import "../../router/trie-router/index.js";
//#region src/middleware/combine/index.ts
/**
* @module
* Combine Middleware for Hono.
*/
/**
* Create a composed middleware that runs the first middleware that returns true.
*
* @param middleware - An array of MiddlewareHandler or Condition functions.
* Middleware is applied in the order it is passed, and if any middleware exits without returning
* an exception first, subsequent middleware will not be executed.
* You can also pass a condition function that returns a boolean value. If returns true
* the evaluation will be halted, and rest of the middleware will not be executed.
* @returns A composed middleware.
*
* @example
* ```ts
* import { some } from 'hono/combine'
* import { bearerAuth } from 'hono/bearer-auth'
* import { myRateLimit } from '@/rate-limit'
*
* // If client has a valid token, then skip rate limiting.
* // Otherwise, apply rate limiting.
* app.use('/api/*', some(
* bearerAuth({ token }),
* myRateLimit({ limit: 100 }),
* ));
* ```
*/
const some = (...middleware) => {
return async function some(c, next) {
let isNextCalled = false;
const wrappedNext = () => {
isNextCalled = true;
return next();
};
let lastError;
let response;
for (const handler of middleware) try {
const result = await handler(c, wrappedNext);
if (result === true && !c.finalized) await wrappedNext();
else if (result === false) {
lastError = /* @__PURE__ */ new Error("No successful middleware found");
continue;
} else if (result && result !== true) response = result;
lastError = void 0;
break;
} catch (error) {
lastError = error;
if (isNextCalled) break;
}
if (lastError) throw lastError;
return response;
};
};
/**
* Create a composed middleware that runs all middleware and throws an error if any of them fail.
*
* @param middleware - An array of MiddlewareHandler or Condition functions.
* Middleware is applied in the order it is passed, and if any middleware throws an error,
* subsequent middleware will not be executed.
* You can also pass a condition function that returns a boolean value. If returns false
* the evaluation will be halted, and rest of the middleware will not be executed.
* @returns A composed middleware.
*
* @example
* ```ts
* import { some, every } from 'hono/combine'
* import { bearerAuth } from 'hono/bearer-auth'
* import { myCheckLocalNetwork } from '@/check-local-network'
* import { myRateLimit } from '@/rate-limit'
*
* // If client is in local network, then skip authentication and rate limiting.
* // Otherwise, apply authentication and rate limiting.
* app.use('/api/*', some(
* myCheckLocalNetwork(),
* every(
* bearerAuth({ token }),
* myRateLimit({ limit: 100 }),
* ),
* ));
* ```
*/
const every = (...middleware) => {
return async function every(c, next) {
const currentRouteIndex = c.req.routeIndex;
await compose(middleware.map((m) => [[async (c, next) => {
c.req.routeIndex = currentRouteIndex;
const res = await m(c, next);
if (res === false) throw new Error("Unmet condition");
return res;
}]]))(c, next);
};
};
/**
* Create a composed middleware that runs all middleware except when the condition is met.
*
* @param condition - A string or Condition function.
* If there are multiple targets to match any of them, they can be passed as an array.
* If a string is passed, it will be treated as a path pattern to match.
* If a Condition function is passed, it will be evaluated against the request context.
* @param middleware - Middleware to run when the condition is not met.
* Multiple middleware can be passed, and they are applied in the order they are passed.
* @returns A composed middleware.
*
* @example
* ```ts
* import { except } from 'hono/combine'
* import { bearerAuth } from 'hono/bearer-auth'
*
* // If client is accessing public API, then skip authentication.
* // Otherwise, require a valid token.
* app.use('/api/*', except(
* '/api/public/*',
* bearerAuth({ token }),
* ));
* ```
*/
const except = (condition, ...middleware) => {
let router = void 0;
const conditions = (Array.isArray(condition) ? condition : [condition]).map((condition) => {
if (typeof condition === "string") {
router ||= new TrieRouter();
router.add("ALL", condition, true);
} else return condition;
}).filter(Boolean);
if (router) conditions.unshift((c) => !!router?.match("ALL", c.req.path)?.[0]?.[0]?.[0]);
const handler = some((c) => conditions.some((cond) => cond(c)), every(...middleware));
return async function except(c, next) {
await handler(c, next);
};
};
//#endregion
export { every, except, some };
@@ -0,0 +1,61 @@
import { r as runBaseTests, s as setupBaseEnvironment } from '../chunks/base.B6Opl8PE.js';
import { w as workerInit } from '../chunks/init-forks.H5ZuobOQ.js';
import 'node:vm';
import '@vitest/spy';
import '../chunks/index.DXx9Dtk7.js';
import '@vitest/expect';
import 'node:async_hooks';
import '../chunks/setup-common.DYx3LtFI.js';
import '../chunks/coverage.CTzCuANN.js';
import '@vitest/snapshot';
import '@vitest/utils/timers';
import '../chunks/utils.BX5Fg8C4.js';
import '../chunks/rpc.MzXet3jl.js';
import '../chunks/index.Chj8NDwU.js';
import '../chunks/test.DNmyFkvJ.js';
import '@vitest/runner';
import '@vitest/utils/helpers';
import '../chunks/benchmark.CX_oY03V.js';
import '@vitest/runner/utils';
import '@vitest/utils/error';
import 'pathe';
import '@vitest/utils/offset';
import '@vitest/utils/source-map';
import '../chunks/_commonjsHelpers.D26ty3Ew.js';
import '../chunks/init.k9zZ9sLh.js';
import 'node:fs';
import 'node:module';
import 'node:url';
import 'vite/module-runner';
import '../chunks/startVitestModuleRunner.DB-7oCpn.js';
import '../chunks/modules.BJuCwlRJ.js';
import '../path.js';
import 'node:path';
import '../module-evaluator.js';
import '../chunks/traces.DT5aQ62U.js';
import '@vitest/mocker';
import '@vitest/mocker/redirect';
import '../chunks/index.DC7d2Pf8.js';
import 'node:console';
import '@vitest/utils/serialize';
import 'tinyrainbow';
import '../chunks/inspector.CvyFGlXm.js';
import '../chunks/evaluatedModules.Dg1zASAC.js';
import '../chunks/nativeModuleRunner.BIakptoF.js';
import '../chunks/index.BCY_7LL2.js';
import 'node:process';
import 'node:fs/promises';
import 'node:assert';
import 'node:v8';
import 'node:util';
import 'node:perf_hooks';
import 'node:timers';
import 'node:timers/promises';
import '@vitest/utils/constants';
import '../chunks/index.DdgEv5B1.js';
import 'expect-type';
workerInit({
runTests: runBaseTests,
setup: setupBaseEnvironment
});
@@ -0,0 +1,113 @@
/**
* The Standard Schema interface.
*/
export type StandardSchemaV1<Input = unknown, Output = Input> = {
/**
* The Standard Schema properties.
*/
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
};
export declare namespace StandardSchemaV1 {
/**
* The Standard Schema properties interface.
*/
export interface Props<Input = unknown, Output = Input> {
/**
* 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<Output> | Promise<Result<Output>>;
/**
* Inferred types associated with the schema.
*/
readonly types?: Types<Input, Output> | undefined;
}
/**
* The result interface of the validate function.
*/
export type Result<Output> = SuccessResult<Output> | FailureResult;
/**
* The result interface if validation succeeds.
*/
export interface SuccessResult<Output> {
/**
* 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<Issue>;
}
/**
* 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<PropertyKey | PathSegment> | 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<Input = unknown, Output = Input> {
/**
* 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<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
/**
* Infers the output type of a Standard Schema.
*/
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
// biome-ignore lint/complexity/noUselessEmptyExport: needed for granular visibility control of TS namespace
export {};
}
@@ -0,0 +1,10 @@
# `@typescript-eslint/scope-manager`
[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/scope-manager.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/scope-manager)
[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/scope-manager.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/scope-manager)
👉 See **https://typescript-eslint.io/packages/scope-manager** for documentation on this package.
> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code.
<!-- Local path for docs: docs/packages/Scope_Manager.mdx -->
@@ -0,0 +1,51 @@
{{## def.coerceType:
{{
var $dataType = 'dataType' + $lvl
, $coerced = 'coerced' + $lvl;
}}
var {{=$dataType}} = typeof {{=$data}};
var {{=$coerced}} = undefined;
{{? it.opts.coerceTypes == 'array' }}
if ({{=$dataType}} == 'object' && Array.isArray({{=$data}}) && {{=$data}}.length == 1) {
{{=$data}} = {{=$data}}[0];
{{=$dataType}} = typeof {{=$data}};
if ({{=it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)}}) {{=$coerced}} = {{=$data}};
}
{{?}}
if ({{=$coerced}} !== undefined) ;
{{~ $coerceToTypes:$type:$i }}
{{? $type == 'string' }}
else if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean')
{{=$coerced}} = '' + {{=$data}};
else if ({{=$data}} === null) {{=$coerced}} = '';
{{?? $type == 'number' || $type == 'integer' }}
else if ({{=$dataType}} == 'boolean' || {{=$data}} === null
|| ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}}
{{? $type == 'integer' }} && !({{=$data}} % 1){{?}}))
{{=$coerced}} = +{{=$data}};
{{?? $type == 'boolean' }}
else if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null)
{{=$coerced}} = false;
else if ({{=$data}} === 'true' || {{=$data}} === 1)
{{=$coerced}} = true;
{{?? $type == 'null' }}
else if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false)
{{=$coerced}} = null;
{{?? it.opts.coerceTypes == 'array' && $type == 'array' }}
else if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null)
{{=$coerced}} = [{{=$data}}];
{{?}}
{{~}}
else {
{{# def.error:'type' }}
}
if ({{=$coerced}} !== undefined) {
{{# def.setParentData }}
{{=$data}} = {{=$coerced}};
{{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}}
{{=$parentData}}[{{=$parentDataProperty}}] = {{=$coerced}};
}
#}}
@@ -0,0 +1,469 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.buildPresetChain = buildPresetChain;
exports.buildPresetChainWalker = void 0;
exports.buildRootChain = buildRootChain;
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _debug() {
const data = require("debug");
_debug = function () {
return data;
};
return data;
}
var _options = require("./validation/options.js");
var _patternToRegex = require("./pattern-to-regex.js");
var _printer = require("./printer.js");
var _rewriteStackTrace = require("../errors/rewrite-stack-trace.js");
var _configError = require("../errors/config-error.js");
var _index = require("./files/index.js");
var _caching = require("./caching.js");
var _configDescriptors = require("./config-descriptors.js");
const debug = _debug()("babel:config:config-chain");
function* buildPresetChain(arg, context) {
const chain = yield* buildPresetChainWalker(arg, context);
if (!chain) return null;
return {
plugins: dedupDescriptors(chain.plugins),
presets: dedupDescriptors(chain.presets),
options: chain.options.map(o => createConfigChainOptions(o)),
files: new Set()
};
}
const buildPresetChainWalker = exports.buildPresetChainWalker = makeChainWalker({
root: preset => loadPresetDescriptors(preset),
env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),
overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),
overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName),
createLogger: () => () => {}
});
const loadPresetDescriptors = (0, _caching.makeWeakCacheSync)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors));
const loadPresetEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName)));
const loadPresetOverridesDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index)));
const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName))));
function* buildRootChain(opts, context) {
let configReport, babelRcReport;
const programmaticLogger = new _printer.ConfigPrinter();
const programmaticChain = yield* loadProgrammaticChain({
options: opts,
dirname: context.cwd
}, context, undefined, programmaticLogger);
if (!programmaticChain) return null;
const programmaticReport = yield* programmaticLogger.output();
let configFile;
if (typeof opts.configFile === "string") {
configFile = yield* (0, _index.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller);
} else if (opts.configFile !== false) {
configFile = yield* (0, _index.findRootConfig)(context.root, context.envName, context.caller);
}
let {
babelrc,
babelrcRoots
} = opts;
let babelrcRootsDirectory = context.cwd;
const configFileChain = emptyChain();
const configFileLogger = new _printer.ConfigPrinter();
if (configFile) {
const validatedFile = validateConfigFile(configFile);
const result = yield* loadFileChain(validatedFile, context, undefined, configFileLogger);
if (!result) return null;
configReport = yield* configFileLogger.output();
if (babelrc === undefined) {
babelrc = validatedFile.options.babelrc;
}
if (babelrcRoots === undefined) {
babelrcRootsDirectory = validatedFile.dirname;
babelrcRoots = validatedFile.options.babelrcRoots;
}
mergeChain(configFileChain, result);
}
let ignoreFile, babelrcFile;
let isIgnored = false;
const fileChain = emptyChain();
if ((babelrc === true || babelrc === undefined) && typeof context.filename === "string") {
const pkgData = yield* (0, _index.findPackageData)(context.filename);
if (pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) {
({
ignore: ignoreFile,
config: babelrcFile
} = yield* (0, _index.findRelativeConfig)(pkgData, context.envName, context.caller));
if (ignoreFile) {
fileChain.files.add(ignoreFile.filepath);
}
if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {
isIgnored = true;
}
if (babelrcFile && !isIgnored) {
const validatedFile = validateBabelrcFile(babelrcFile);
const babelrcLogger = new _printer.ConfigPrinter();
const result = yield* loadFileChain(validatedFile, context, undefined, babelrcLogger);
if (!result) {
isIgnored = true;
} else {
babelRcReport = yield* babelrcLogger.output();
mergeChain(fileChain, result);
}
}
if (babelrcFile && isIgnored) {
fileChain.files.add(babelrcFile.filepath);
}
}
}
if (context.showConfig) {
console.log(`Babel configs on "${context.filename}" (ascending priority):\n` + [configReport, babelRcReport, programmaticReport].filter(x => !!x).join("\n\n") + "\n-----End Babel configs-----");
}
const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain);
return {
plugins: isIgnored ? [] : dedupDescriptors(chain.plugins),
presets: isIgnored ? [] : dedupDescriptors(chain.presets),
options: isIgnored ? [] : chain.options.map(o => createConfigChainOptions(o)),
fileHandling: isIgnored ? "ignored" : "transpile",
ignore: ignoreFile || undefined,
babelrc: babelrcFile || undefined,
config: configFile || undefined,
files: chain.files
};
}
function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory) {
if (typeof babelrcRoots === "boolean") return babelrcRoots;
const absoluteRoot = context.root;
if (babelrcRoots === undefined) {
return pkgData.directories.includes(absoluteRoot);
}
let babelrcPatterns = babelrcRoots;
if (!Array.isArray(babelrcPatterns)) {
babelrcPatterns = [babelrcPatterns];
}
babelrcPatterns = babelrcPatterns.map(pat => {
return typeof pat === "string" ? _path().resolve(babelrcRootsDirectory, pat) : pat;
});
if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) {
return pkgData.directories.includes(absoluteRoot);
}
return babelrcPatterns.some(pat => {
if (typeof pat === "string") {
pat = (0, _patternToRegex.default)(pat, babelrcRootsDirectory);
}
return pkgData.directories.some(directory => {
return matchPattern(pat, babelrcRootsDirectory, directory, context);
});
});
}
const validateConfigFile = (0, _caching.makeWeakCacheSync)(file => ({
filepath: file.filepath,
dirname: file.dirname,
options: (0, _options.validate)("configfile", file.options, file.filepath)
}));
const validateBabelrcFile = (0, _caching.makeWeakCacheSync)(file => ({
filepath: file.filepath,
dirname: file.dirname,
options: (0, _options.validate)("babelrcfile", file.options, file.filepath)
}));
const validateExtendFile = (0, _caching.makeWeakCacheSync)(file => ({
filepath: file.filepath,
dirname: file.dirname,
options: (0, _options.validate)("extendsfile", file.options, file.filepath)
}));
const loadProgrammaticChain = makeChainWalker({
root: input => buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors),
env: (input, envName) => buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName),
overrides: (input, index) => buildOverrideDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index),
overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName),
createLogger: (input, context, baseLogger) => buildProgrammaticLogger(input, context, baseLogger)
});
const loadFileChainWalker = makeChainWalker({
root: file => loadFileDescriptors(file),
env: (file, envName) => loadFileEnvDescriptors(file)(envName),
overrides: (file, index) => loadFileOverridesDescriptors(file)(index),
overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName),
createLogger: (file, context, baseLogger) => buildFileLogger(file.filepath, context, baseLogger)
});
function* loadFileChain(input, context, files, baseLogger) {
const chain = yield* loadFileChainWalker(input, context, files, baseLogger);
chain == null || chain.files.add(input.filepath);
return chain;
}
const loadFileDescriptors = (0, _caching.makeWeakCacheSync)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors));
const loadFileEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName)));
const loadFileOverridesDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index)));
const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName))));
function buildFileLogger(filepath, context, baseLogger) {
if (!baseLogger) {
return () => {};
}
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Config, {
filepath
});
}
function buildRootDescriptors({
dirname,
options
}, alias, descriptors) {
return descriptors(dirname, options, alias);
}
function buildProgrammaticLogger(_, context, baseLogger) {
var _context$caller;
if (!baseLogger) {
return () => {};
}
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Programmatic, {
callerName: (_context$caller = context.caller) == null ? void 0 : _context$caller.name
});
}
function buildEnvDescriptors({
dirname,
options
}, alias, descriptors, envName) {
var _options$env;
const opts = (_options$env = options.env) == null ? void 0 : _options$env[envName];
return opts ? descriptors(dirname, opts, `${alias}.env["${envName}"]`) : null;
}
function buildOverrideDescriptors({
dirname,
options
}, alias, descriptors, index) {
var _options$overrides;
const opts = (_options$overrides = options.overrides) == null ? void 0 : _options$overrides[index];
if (!opts) throw new Error("Assertion failure - missing override");
return descriptors(dirname, opts, `${alias}.overrides[${index}]`);
}
function buildOverrideEnvDescriptors({
dirname,
options
}, alias, descriptors, index, envName) {
var _options$overrides2, _override$env;
const override = (_options$overrides2 = options.overrides) == null ? void 0 : _options$overrides2[index];
if (!override) throw new Error("Assertion failure - missing override");
const opts = (_override$env = override.env) == null ? void 0 : _override$env[envName];
return opts ? descriptors(dirname, opts, `${alias}.overrides[${index}].env["${envName}"]`) : null;
}
function makeChainWalker({
root,
env,
overrides,
overridesEnv,
createLogger
}) {
return function* chainWalker(input, context, files = new Set(), baseLogger) {
const {
dirname
} = input;
const flattenedConfigs = [];
const rootOpts = root(input);
if (configIsApplicable(rootOpts, dirname, context, input.filepath)) {
flattenedConfigs.push({
config: rootOpts,
envName: undefined,
index: undefined
});
const envOpts = env(input, context.envName);
if (envOpts && configIsApplicable(envOpts, dirname, context, input.filepath)) {
flattenedConfigs.push({
config: envOpts,
envName: context.envName,
index: undefined
});
}
(rootOpts.options.overrides || []).forEach((_, index) => {
const overrideOps = overrides(input, index);
if (configIsApplicable(overrideOps, dirname, context, input.filepath)) {
flattenedConfigs.push({
config: overrideOps,
index,
envName: undefined
});
const overrideEnvOpts = overridesEnv(input, index, context.envName);
if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context, input.filepath)) {
flattenedConfigs.push({
config: overrideEnvOpts,
index,
envName: context.envName
});
}
}
});
}
if (flattenedConfigs.some(({
config: {
options: {
ignore,
only
}
}
}) => shouldIgnore(context, ignore, only, dirname))) {
return null;
}
const chain = emptyChain();
const logger = createLogger(input, context, baseLogger);
for (const {
config,
index,
envName
} of flattenedConfigs) {
if (!(yield* mergeExtendsChain(chain, config.options, dirname, context, files, baseLogger))) {
return null;
}
logger(config, index, envName);
yield* mergeChainOpts(chain, config);
}
return chain;
};
}
function* mergeExtendsChain(chain, opts, dirname, context, files, baseLogger) {
if (opts.extends === undefined) return true;
const file = yield* (0, _index.loadConfig)(opts.extends, dirname, context.envName, context.caller);
if (files.has(file)) {
throw new Error(`Configuration cycle detected loading ${file.filepath}.\n` + `File already loaded following the config chain:\n` + Array.from(files, file => ` - ${file.filepath}`).join("\n"));
}
files.add(file);
const fileChain = yield* loadFileChain(validateExtendFile(file), context, files, baseLogger);
files.delete(file);
if (!fileChain) return false;
mergeChain(chain, fileChain);
return true;
}
function mergeChain(target, source) {
target.options.push(...source.options);
target.plugins.push(...source.plugins);
target.presets.push(...source.presets);
for (const file of source.files) {
target.files.add(file);
}
return target;
}
function* mergeChainOpts(target, {
options,
plugins,
presets
}) {
target.options.push(options);
target.plugins.push(...(yield* plugins()));
target.presets.push(...(yield* presets()));
return target;
}
function emptyChain() {
return {
options: [],
presets: [],
plugins: [],
files: new Set()
};
}
function createConfigChainOptions(opts) {
const options = Object.assign({}, opts);
delete options.extends;
delete options.env;
delete options.overrides;
delete options.plugins;
delete options.presets;
delete options.passPerPreset;
delete options.ignore;
delete options.only;
delete options.test;
delete options.include;
delete options.exclude;
if (hasOwnProperty.call(options, "sourceMap")) {
options.sourceMaps = options.sourceMap;
delete options.sourceMap;
}
return options;
}
function dedupDescriptors(items) {
const map = new Map();
const descriptors = [];
for (const item of items) {
if (typeof item.value === "function") {
const fnKey = item.value;
let nameMap = map.get(fnKey);
if (!nameMap) {
nameMap = new Map();
map.set(fnKey, nameMap);
}
let desc = nameMap.get(item.name);
if (!desc) {
desc = {
value: item
};
descriptors.push(desc);
if (!item.ownPass) nameMap.set(item.name, desc);
} else {
desc.value = item;
}
} else {
descriptors.push({
value: item
});
}
}
return descriptors.reduce((acc, desc) => {
acc.push(desc.value);
return acc;
}, []);
}
function configIsApplicable({
options
}, dirname, context, configName) {
return (options.test === undefined || configFieldIsApplicable(context, options.test, dirname, configName)) && (options.include === undefined || configFieldIsApplicable(context, options.include, dirname, configName)) && (options.exclude === undefined || !configFieldIsApplicable(context, options.exclude, dirname, configName));
}
function configFieldIsApplicable(context, test, dirname, configName) {
const patterns = Array.isArray(test) ? test : [test];
return matchesPatterns(context, patterns, dirname, configName);
}
function ignoreListReplacer(_key, value) {
if (value instanceof RegExp) {
return String(value);
}
return value;
}
function shouldIgnore(context, ignore, only, dirname) {
if (ignore && matchesPatterns(context, ignore, dirname)) {
var _context$filename;
const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore, ignoreListReplacer)}\` from "${dirname}"`;
debug(message);
if (context.showConfig) {
console.log(message);
}
return true;
}
if (only && !matchesPatterns(context, only, dirname)) {
var _context$filename2;
const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only, ignoreListReplacer)}\` from "${dirname}"`;
debug(message);
if (context.showConfig) {
console.log(message);
}
return true;
}
return false;
}
function matchesPatterns(context, patterns, dirname, configName) {
return patterns.some(pattern => matchPattern(pattern, dirname, context.filename, context, configName));
}
function matchPattern(pattern, dirname, pathToTest, context, configName) {
if (typeof pattern === "function") {
return !!(0, _rewriteStackTrace.endHiddenCallStack)(pattern)(pathToTest, {
dirname,
envName: context.envName,
caller: context.caller
});
}
if (typeof pathToTest !== "string") {
throw new _configError.default(`Configuration contains string/RegExp pattern, but no filename was passed to Babel`, configName);
}
if (typeof pattern === "string") {
pattern = (0, _patternToRegex.default)(pattern, dirname);
}
return pattern.test(pathToTest);
}
0 && 0;
//# sourceMappingURL=config-chain.js.map
@@ -0,0 +1,14 @@
export function addErrorMessage(res, key, errorMessage, refs) {
if (!refs?.errorMessages)
return;
if (errorMessage) {
res.errorMessage = {
...res.errorMessage,
[key]: errorMessage,
};
}
}
export function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
res[key] = value;
addErrorMessage(res, key, errorMessage, refs);
}
@@ -0,0 +1,25 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const SquareBottomDashedScissors = createLucideIcon("SquareBottomDashedScissors", [
[
"path",
{ d: "M4 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2", key: "1vzg26" }
],
["path", { d: "M10 22H8", key: "euku7a" }],
["path", { d: "M16 22h-2", key: "18d249" }],
["circle", { cx: "8", cy: "8", r: "2", key: "14cg06" }],
["path", { d: "M9.414 9.414 12 12", key: "qz4lzr" }],
["path", { d: "M14.8 14.8 18 18", key: "11flf1" }],
["circle", { cx: "8", cy: "16", r: "2", key: "1acxsx" }],
["path", { d: "m18 6-8.586 8.586", key: "11kzk1" }]
]);
export { SquareBottomDashedScissors as default };
//# sourceMappingURL=square-bottom-dashed-scissors.js.map
@@ -0,0 +1,51 @@
"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.default = void 0;
const z4 = __importStar(require("./classic/external.cjs"));
exports.default = z4;
__exportStar(require("./classic/index.cjs"), exports);
// seal-cjs-exports
(function () {
var keys = Object.getOwnPropertyNames(exports);
for (var i = 0; i < keys.length; i++) {
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
if (!desc || !desc.get || !desc.configurable) continue;
var value;
try {
value = desc.get();
} catch (e) {
continue;
}
// a circular require may not have settled this one yet, so leave it live
if (value === undefined) continue;
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
}
Object.freeze(exports);
})();
@@ -0,0 +1,89 @@
import type { SourceMapInput } from '@jridgewell/trace-mapping';
import type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types.cts';
export type { DecodedSourceMap, EncodedSourceMap, Mapping };
export type Options = {
file?: string | null;
sourceRoot?: string | null;
};
/**
* Provides the state to generate a sourcemap.
*/
export declare class GenMapping {
private _names;
private _sources;
private _sourcesContent;
private _mappings;
private _ignoreList;
file: string | null | undefined;
sourceRoot: string | null | undefined;
constructor({ file, sourceRoot }?: Options);
}
/**
* A low-level API to associate a generated position with an original source position. Line and
* column here are 0-based, unlike `addMapping`.
*/
export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source?: null, sourceLine?: null, sourceColumn?: null, name?: null, content?: null): void;
export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name?: null, content?: string | null): void;
export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name: string, content?: string | null): void;
/**
* A high-level API to associate a generated position with an original source position. Line is
* 1-based, but column is 0-based, due to legacy behavior in `source-map` library.
*/
export declare function addMapping(map: GenMapping, mapping: {
generated: Pos;
source?: null;
original?: null;
name?: null;
content?: null;
}): void;
export declare function addMapping(map: GenMapping, mapping: {
generated: Pos;
source: string;
original: Pos;
name?: null;
content?: string | null;
}): void;
export declare function addMapping(map: GenMapping, mapping: {
generated: Pos;
source: string;
original: Pos;
name: string;
content?: string | null;
}): void;
/**
* Same as `addSegment`, but will only add the segment if it generates useful information in the
* resulting map. This only works correctly if segments are added **in order**, meaning you should
* not add a segment with a lower generated line/column than one that came before.
*/
export declare const maybeAddSegment: typeof addSegment;
/**
* Same as `addMapping`, but will only add the mapping if it generates useful information in the
* resulting map. This only works correctly if mappings are added **in order**, meaning you should
* not add a mapping with a lower generated line/column than one that came before.
*/
export declare const maybeAddMapping: typeof addMapping;
/**
* Adds/removes the content of the source file to the source map.
*/
export declare function setSourceContent(map: GenMapping, source: string, content: string | null): void;
export declare function setIgnore(map: GenMapping, source: string, ignore?: boolean): void;
/**
* Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
* a sourcemap, or to JSON.stringify.
*/
export declare function toDecodedMap(map: GenMapping): DecodedSourceMap;
/**
* Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
* a sourcemap, or to JSON.stringify.
*/
export declare function toEncodedMap(map: GenMapping): EncodedSourceMap;
/**
* Constructs a new GenMapping, using the already present mappings of the input.
*/
export declare function fromMap(input: SourceMapInput): GenMapping;
/**
* Returns an array of high-level mapping objects for every recorded segment, which could then be
* passed to the `source-map` library.
*/
export declare function allMappings(map: GenMapping): Mapping[];
//# sourceMappingURL=gen-mapping.d.ts.map