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,80 @@
# EE First
[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![Gittip][gittip-image]][gittip-url]
Get the first event in a set of event emitters and event pairs,
then clean up after itself.
## Install
```sh
$ npm install ee-first
```
## API
```js
var first = require('ee-first')
```
### first(arr, listener)
Invoke `listener` on the first event from the list specified in `arr`. `arr` is
an array of arrays, with each array in the format `[ee, ...event]`. `listener`
will be called only once, the first time any of the given events are emitted. If
`error` is one of the listened events, then if that fires first, the `listener`
will be given the `err` argument.
The `listener` is invoked as `listener(err, ee, event, args)`, where `err` is the
first argument emitted from an `error` event, if applicable; `ee` is the event
emitter that fired; `event` is the string event name that fired; and `args` is an
array of the arguments that were emitted on the event.
```js
var ee1 = new EventEmitter()
var ee2 = new EventEmitter()
first([
[ee1, 'close', 'end', 'error'],
[ee2, 'error']
], function (err, ee, event, args) {
// listener invoked
})
```
#### .cancel()
The group of listeners can be cancelled before being invoked and have all the event
listeners removed from the underlying event emitters.
```js
var thunk = first([
[ee1, 'close', 'end', 'error'],
[ee2, 'error']
], function (err, ee, event, args) {
// listener invoked
})
// cancel and clean up
thunk.cancel()
```
[npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square
[npm-url]: https://npmjs.org/package/ee-first
[github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square
[github-url]: https://github.com/jonathanong/ee-first/tags
[travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square
[travis-url]: https://travis-ci.org/jonathanong/ee-first
[coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master
[license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square
[license-url]: LICENSE.md
[downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/ee-first
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
[gittip-url]: https://www.gittip.com/jonathanong/
@@ -0,0 +1,2 @@
'use strict';
require('../register')('lie', {Promise: require('lie')})
@@ -0,0 +1,3 @@
# `react-dismissable-layer`
This is an internal utility, not intended for public usage.
@@ -0,0 +1,16 @@
/**
* @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 CircleChevronUp = createLucideIcon("CircleChevronUp", [
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
["path", { d: "m8 14 4-4 4 4", key: "fy2ptz" }]
]);
export { CircleChevronUp as default };
//# sourceMappingURL=circle-chevron-up.js.map
@@ -0,0 +1,53 @@
// src/primitive.tsx
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
return function handleEvent(event) {
originalEventHandler?.(event);
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
return ourEventHandler?.(event);
}
};
}
function getOwnerWindow(element) {
if (!canUseDOM) {
throw new Error("Cannot access window outside of the DOM");
}
return element?.ownerDocument?.defaultView ?? window;
}
function getOwnerDocument(element) {
if (!canUseDOM) {
throw new Error("Cannot access document outside of the DOM");
}
return element?.ownerDocument ?? document;
}
function getActiveElement(node, activeDescendant = false) {
const { activeElement } = getOwnerDocument(node);
if (!activeElement?.nodeName) {
return null;
}
if (isFrame(activeElement) && activeElement.contentDocument) {
return getActiveElement(activeElement.contentDocument.body, activeDescendant);
}
if (activeDescendant) {
const id = activeElement.getAttribute("aria-activedescendant");
if (id) {
const element = getOwnerDocument(activeElement).getElementById(id);
if (element) {
return element;
}
}
}
return activeElement;
}
function isFrame(element) {
return element.tagName === "IFRAME";
}
export {
canUseDOM,
composeEventHandlers,
getActiveElement,
getOwnerDocument,
getOwnerWindow,
isFrame
};
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_LR","8":"_HB"},B:{"2":"_I","8":"_FB _5G","584":"h _BG _EH s","1025":"_H t _lH _i"},C:{"1":"_w","129":"_f"},D:{"1":"LB","8":"_uF _NB _uG _5G","584":"h _BG _EH s","1025":"_H t _lH _l"},E:{"1":"_QB","260":"_TB"},F:{"2":"F","8":"_MC","584":"_aF","1025":"_mQ _h","2052":"_6 _O"},G:{"1":"_t","8":"_d"},H:{"8":"1D"},I:{"8":"_G","1025":"I"},J:{"1":"A","8":"D"},K:{"8":"_D","1025":"H"},L:{"1025":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"8":"bC"},P:{"1":"_6B","8":"_IL"},Q:{"8":"JE"},R:{"8":"KE"},S:{"1":"_C"}},B:2,C:"MathML",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"brain-cog.js","sources":["../../../src/icons/brain-cog.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BrainCog\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA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iAgPHBhdGggZD0ibTEzLjEgOS4yLjQtLjkiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/brain-cog\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 BrainCog = createLucideIcon('BrainCog', [\n [\n 'path',\n {\n d: 'M12 5a3 3 0 1 0-5.997.142 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588 4 4 0 0 0 7.636 2.106 3.2 3.2 0 0 0 .164-.546c.028-.13.306-.13.335 0a3.2 3.2 0 0 0 .163.546 4 4 0 0 0 7.636-2.106 4 4 0 0 0 .556-6.588 4 4 0 0 0-2.526-5.77A3 3 0 1 0 12 5',\n key: '1kgmhc',\n },\n ],\n ['path', { d: 'M17.599 6.5a3 3 0 0 0 .399-1.375', key: 'tmeiqw' }],\n ['path', { d: 'M6.003 5.125A3 3 0 0 0 6.401 6.5', key: '105sqy' }],\n ['path', { d: 'M3.477 10.896a4 4 0 0 1 .585-.396', key: 'ql3yin' }],\n ['path', { d: 'M19.938 10.5a4 4 0 0 1 .585.396', key: '1qfode' }],\n ['path', { d: 'M6 18a4 4 0 0 1-1.967-.516', key: '2e4loj' }],\n ['path', { d: 'M19.967 17.484A4 4 0 0 1 18 18', key: '159ez6' }],\n ['circle', { cx: '12', cy: '12', r: '3', key: '1v7zrd' }],\n ['path', { d: 'm15.7 10.4-.9.4', key: 'ayzo6p' }],\n ['path', { d: 'm9.2 13.2-.9.4', key: '1uzb3g' }],\n ['path', { d: 'm13.6 15.7-.4-.9', key: '11ifqf' }],\n ['path', { d: 'm10.8 9.2-.4-.9', key: '1pmk2v' }],\n ['path', { d: 'm15.7 13.5-.9-.4', key: '7ng02m' }],\n ['path', { d: 'm9.2 10.9-.9-.4', key: '1x66zd' }],\n ['path', { d: 'm10.5 15.7.4-.9', key: '3js94g' }],\n ['path', { d: 'm13.1 9.2.4-.9', key: '18n7mc' }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A,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,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAALine truncated
@@ -0,0 +1,617 @@
export default `flf2a% 6 6 21 0 3
cosmic.flf by Mike Rosulek <mjr@netins.net>, 7/11/95. Check out my
homepage at: http://www.netins.net/showcase/mikewrld/
---- Modified and corrected by Michel Eftimakis (Michel.Eftimakis@vlsi.com) ----
%%%%#
%%%%#
%%%%#
%%%%#
%%%%#
%%%%##
.:#
;;;#
'[[#
$$#
""#
MM##
%:: ::%#
%"; ;"%#
#
#
#
##
:: :: #
__,;'_,;'_#
''[[''[[''#
,$" ,$" #
o88oo88oo #
,M" ,M" ##
.: #
,;;;. #
[[,,_\` #
\`"""Yo#
Yo_,d"#
'M' ##
.. .:\`#
; ; ,;\` #
^^ ,[\` #
cP ,, #
,8" 8 8#
,dP "" ##
:\\ #
.;;' #
([__ #
c$"" #
"Yo,oP#
"M,##
::#
,'#
#
#
#
##
.:#
,;' #
n[ #
Y$ #
8o,#
"M##
:. #
';,#
[n#
$Y#
,o8 #
M" ##
#
\\|/ #
/|\\ #
#
#
##
#
#
[ #
%$$$$$%#
8 #
##
#
#
#
#
d8b#
,M"##
#
#
#
%cccc%#
#
##
#
#
#
#
d8b#
YMP##
/:\`#
/;\` #
n[' #
c$" #
o8" #
mM" ##
#
,;;, #
,[' [n #
$$ $$#
Y8, ,8"#
"YmmP ##
:.#
;;#
[[#
$$#
88#
MM##
.:::. #
,;'\`\`;. #
'' ,[['#
.c$$P' #
d88 _,oo,#
MMMUP*"^^##
.::. #
;'\`';;, #
.n[[ #
\`\`"$$$.#
,,o888"#
YMMP" ##
.:: #
,;';; #
,[' [[ #
$P__$$c#
\`"""88"#
MM ##
::::::::#
\`;;\`\`'';#
[[,_ #
\`""*Ycc#
__,od8"#
MMP" ##
.:. #
,;' #
,[[.od8b #
$$$" "$$#
Y8b,,d8P#
"YMP" ##
...:::::#
'''\`\`;;'#
.[' #
,$$' #
888 #
MMM ##
.::::. #
\`;. ,;'#
[nn[, #
$" $c#
Yb,_,8P#
"YMP" ##
.,,. #
,;;'\`';,#
[[, _,[[#
Y$$P"$$#
,,_,d8"#
"MP" ##
#
,;,#
'['#
#
d8b#
YMP##
#
,;,#
'['#
#
d8b#
,M"##
#
,,#
,[['#
c$ #
"8bo,#
"MP##
#
#
%,,,,,%#
% """"%#
%oooo%#
%""""%##
#
,, #
'[[, #
$c#
,od8"#
YM" ##
.-::::-.#
;;'\`\`\`;;;#
,n[[' #
d$P" #
"" #
MM ##
.:::''''''':::. #
;;' ,;;;;;;,.; \`;.#
:[[ [. .['[[ [[#
$$, 'Y$$$P'Y$$P' #
'Y8o,_ __,oo #
\`"YUMMMMMMUY" ##
:::. #
;;\`;; #
,[[ '[[, #
c$$$cc$$$c #
888 888,#
YMM ""\` ##
:::::::. #
;;;'';;' #
[[[__[[\\.#
$$""""Y$$#
_88o,,od8P#
""YUMMMP" ##
.,-::::: #
,;;;'\`\`\`\`' #
[[[ #
$$$ #
\`88bo,__,o, #
"YUMMMMMP"##
:::::::-. #
;;, \`';,#
\`[[ [[#
$$, $$#
888_,o8P'#
MMMMP"\` ##
.,:::::: #
;;;;'''' #
[[cccc #
$$"""" #
888oo,__ #
""""YUMMM##
.-:::::'#
;;;'''' #
[[[,,== #
\`$$$"\`\` #
888 #
"MM, ##
.,-:::::/ #
,;;-'\`\`\`\`' #
[[[ [[[[[[/#
"$$c. "$$ #
\`Y8bo,,,o88o#
\`'YMUP"YMM##
:: .: #
,;; ;;, #
,[[[,,,[[[ #
"$$$"""$$$ #
888 "88o#
MMM YMM##
:::#
;;;#
[[[#
$$$#
888#
MMM##
....::::::#
;;;;;;;;;\`\`\`\`#
''\` \`[[. #
,,, \`$$ #
888boood88 #
"MMMMMMMM" ##
::: . #
;;; .;;,.#
[[[[[/' #
_$$$$, #
"888"88o, #
MMM "MMP"##
::: #
;;; #
[[[ #
$$' #
o88oo,.__#
""""YUMMM##
. : #
;;,. ;;; #
[[[[, ,[[[[, #
$$$$$$$$"$$$ #
888 Y88" 888o#
MMM M' "MMM##
:::. :::.#
\`;;;;, \`;;;#
[[[[[. '[[#
$$$ "Y$c$$#
888 Y88#
MMM YM##
... #
.;;;;;;;. #
,[[ \\[[,#
$$$, $$$#
"888,_ _,88P#
"YMMMMMP" ##
::::::::::. #
\`;;;\`\`\`.;;;#
\`]]nnn]]' #
$$$"" #
888o #
YMMMb ##
.::::::. #
,;;'\`\`\`';;, #
[[[ [[[\\#
"$$c cc$$$"#
"*8bo,Y88b,#
"*YP" "M"##
:::::::.. #
;;;;\`\`;;;; #
[[[,/[[[' #
$$$$$$c #
888b "88bo,#
MMMM "W" ##
.::::::. #
;;;\` \` #
'[==/[[[[,#
''' $#
88b dP#
"YMmMY" ##
::::::::::::#
;;;;;;;;''''#
[[ #
$$ #
88, #
MMM ##
... :::#
;; ;;;#
[[' [[[#
$$ $$$#
88 .d888#
"YmmMMMM""##
::: .::.#
';;, ,;;;' #
\\[[ .[[/ #
Y$c.$$" #
Y88P #
MP ##
.:: . .:::#
';;, ;; ;;;' #
'[[, [[, [[' #
Y$c$$$c$P #
"88"888 #
"M "M" ##
.,:: .:#
\`;;;, .,;; #
'[[,,[[' #
Y$$$P #
oP"\`\`"Yo, #
,m" "Mm,##
.-:. ::-.#
';;. ;;;;'#
'[[,[[[' #
c$$" #
,8P"\` #
mM" ##
:::::::::#
'\`\`\`\`\`;;;#
.n[['#
,$$P" #
,888bo,_ #
\`""*UMM ##
::::#
;;' #
[[ #
$$ #
88, #
"YMM##
\`:\\ #
\`;\\ #
'[n #
"$c #
"8o #
"Mm##
::::#
';;#
[[#
$$#
,88#
MMP"##
.:. #
;' \`;#
#
#
#
##
#
#
#
#
#
mmmmmmm##
\`:. #
\`;,#
#
#
#
##
:::. #
;;\`;; #
,[[ '[[, #
c$$$cc$$$c #
888 888,#
YMM ""\` ##
:::::::. #
;;;'';;' #
[[[__[[\\.#
$$""""Y$$#
_88o,,od8P#
""YUMMMP" ##
.,-::::: #
,;;;'\`\`\`\`' #
[[[ #
$$$ #
\`88bo,__,o, #
"YUMMMMMP"##
:::::::-. #
;;, \`';,#
\`[[ [[#
$$, $$#
888_,o8P'#
MMMMP"\` ##
.,:::::: #
;;;;'''' #
[[cccc #
$$"""" #
888oo,__ #
""""YUMMM##
.-:::::'#
;;;'''' #
[[[,,== #
\`$$$"\`\` #
888 #
"MM, ##
.,-:::::/ #
,;;-'\`\`\`\`' #
[[[ [[[[[[/#
"$$c. "$$ #
\`Y8bo,,,o88o#
\`'YMUP"YMM##
:: .: #
,;; ;;, #
,[[[,,,[[[ #
"$$$"""$$$ #
888 "88o#
MMM YMM##
:::#
;;;#
[[[#
$$$#
888#
MMM##
....::::::#
;;;;;;;;;\`\`\`\`#
''\` \`[[. #
,,, \`$$ #
888boood88 #
"MMMMMMMM" ##
::: . #
;;; .;;,.#
[[[[[/' #
_$$$$, #
"888"88o, #
MMM "MMP"##
::: #
;;; #
[[[ #
$$' #
o88oo,.__#
""""YUMMM##
. : #
;;,. ;;; #
[[[[, ,[[[[, #
$$$$$$$$"$$$ #
888 Y88" 888o#
MMM M' "MMM##
:::. :::.#
\`;;;;, \`;;;#
[[[[[. '[[#
$$$ "Y$c$$#
888 Y88#
MMM YM##
... #
.;;;;;;;. #
,[[ \\[[,#
$$$, $$$#
"888,_ _,88P#
"YMMMMMP" ##
::::::::::. #
\`;;;\`\`\`.;;;#
\`]]nnn]]' #
$$$"" #
888o #
YMMMb ##
.::::::. #
,;;'\`\`\`';;, #
[[[ [[[\\#
"$$c cc$$$"#
"*8bo,Y88b,#
"*YP" "M"##
:::::::.. #
;;;;\`\`;;;; #
[[[,/[[[' #
$$$$$$c #
888b "88bo,#
MMMM "W" ##
.::::::. #
;;;\` \` #
'[==/[[[[,#
''' $#
88b dP#
"YMmMY" ##
::::::::::::#
;;;;;;;;''''#
[[ #
$$ #
88, #
MMM ##
... :::#
;; ;;;#
[[' [[[#
$$ $$$#
88 .d888#
"YmmMMMM""##
::: .::.#
';;, ,;;;' #
\\[[ .[[/ #
Y$c.$$" #
Y88P #
MP ##
.:: . .:::#
';;, ;; ;;;' #
'[[, [[, [[' #
Y$c$$$c$P #
"88"888 #
"M "M" ##
.,:: .:#
\`;;;, .,;; #
'[[,,[[' #
Y$$$P #
oP"\`\`"Yo, #
,m" "Mm,##
.-:. ::-.#
';;. ;;;;'#
'[[,[[[' #
c$$" #
,8P"\` #
mM" ##
:::::::::#
'\`\`\`\`\`;;;#
.n[['#
,$$P" #
,888bo,_ #
\`""*UMM ##
.:#
;'#
[#
$"#
8 #
"M##
\`:#
,;#
[[#
$$#
88#
MM##
:.#
';#
[ #
"$#
8#
M"##
':.:':.#
\`;' \`;#
#
#
#
##
:: ::. :: #
;;\`;; #
,[[ '[[, #
c$$$cc$$$c #
888 888,#
YMM ""\` ##
:: ... :: #
.;;;;;;;. #
,[[ \\[[,#
$$$, $$$#
"888,_ _,88P#
"YMMMMMP" ##
..:: :: ::#
;; ;;;#
[[' [[[#
$$ $$$#
88 .d888#
"YmmMMMM""##
:: ::. :: #
;;\`;; #
,[[ '[[, #
c$$$cc$$$c #
888 888,#
YMM ""\` ##
:: ... :: #
.;;;;;;;. #
,[[ \\[[,#
$$$, $$$#
"888,_ _,88P#
"YMMMMMP" ##
..:: :: ::#
;; ;;;#
[[' [[[#
$$ $$$#
88 .d888#
"YmmMMMM""##
:::::::. #
;;;'';;' #
[[[__[[\\.#
$$""""Y$$#
88o,,od8P#
MM\`YMMP" ##
`
@@ -0,0 +1,49 @@
{
"name": "statuses",
"description": "HTTP status utility",
"version": "2.0.2",
"contributors": [
"Douglas Christopher Wilson <doug@somethingdoug.com>",
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
],
"repository": "jshttp/statuses",
"license": "MIT",
"keywords": [
"http",
"status",
"code"
],
"files": [
"HISTORY.md",
"index.js",
"codes.json",
"LICENSE"
],
"devDependencies": {
"csv-parse": "4.16.3",
"eslint": "7.19.0",
"eslint-config-standard": "14.1.1",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-markdown": "1.0.2",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "4.3.1",
"eslint-plugin-standard": "4.1.0",
"mocha": "8.4.0",
"nyc": "15.1.0",
"raw-body": "2.5.2",
"stream-to-array": "2.3.0"
},
"engines": {
"node": ">= 0.8"
},
"scripts": {
"build": "node scripts/build.js",
"fetch": "node scripts/fetch-apache.js && node scripts/fetch-iana.js && node scripts/fetch-nginx.js && node scripts/fetch-node.js",
"lint": "eslint --plugin markdown --ext js,md .",
"test": "mocha --reporter spec --check-leaks --bail test/",
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test",
"update": "npm run fetch && npm run build",
"version": "node scripts/version-history.js && git add HISTORY.md"
}
}
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _nonIterableRest;
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
//# sourceMappingURL=nonIterableRest.js.map
@@ -0,0 +1 @@
{"version":3,"file":"switch-camera.js","sources":["../../../src/icons/switch-camera.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name SwitchCamera\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTEgMTlINGEyIDIgMCAwIDEtMi0yVjdhMiAyIDAgMCAxIDItMmg1IiAvPgogIDxwYXRoIGQ9Ik0xMyA1aDdhMiAyIDAgMCAxIDIgMnYxMGEyIDIgMCAwIDEtMiAyaC01IiAvPgogIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjMiIC8+CiAgPHBhdGggZD0ibTE4IDIyLTMtMyAzLTMiIC8+CiAgPHBhdGggZD0ibTYgMiAzIDMtMyAzIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/switch-camera\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 SwitchCamera = createLucideIcon('SwitchCamera', [\n ['path', { d: 'M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5', key: 'mtk2lu' }],\n ['path', { d: 'M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5', key: '120jsl' }],\n ['circle', { cx: '12', cy: '12', r: '3', key: '1v7zrd' }],\n ['path', { d: 'm18 22-3-3 3-3', key: 'kgdoj7' }],\n ['path', { d: 'm6 2 3 3-3 3', key: '1fnbkv' }],\n]);\n\nexport default SwitchCamera;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,iBAAiB,cAAgB,CAAA,CAAA,CAAA;AAAA,CAAA,CACpD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4C,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,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA6C,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,CAAK,UAAU,CAAA,CAAA;AAAA,CAC1E,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,CAAkB,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,CAC/C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC/C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"phone-forwarded.js","sources":["../../../src/icons/phone-forwarded.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name PhoneForwarded\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cG9seWxpbmUgcG9pbnRzPSIxOCAyIDIyIDYgMTggMTAiIC8+CiAgPGxpbmUgeDE9IjE0IiB4Mj0iMjIiIHkxPSI2IiB5Mj0iNiIgLz4KICA8cGF0aCBkPSJNMjIgMTYuOTJ2M2EyIDIgMCAwIDEtMi4xOCAyIDE5Ljc5IDE5Ljc5IDAgMCAxLTguNjMtMy4wNyAxOS41IDE5LjUgMCAwIDEtNi02IDE5Ljc5IDE5Ljc5IDAgMCAxLTMuMDctOC42N0EyIDIgMCAwIDEgNC4xMSAyaDNhMiAyIDAgMCAxIDIgMS43MiAxMi44NCAxMi44NCAwIDAgMCAuNyAyLjgxIDIgMiAwIDAgMS0uNDUgMi4xMUw4LjA5IDkuOTFhMTYgMTYgMCAwIDAgNiA2bDEuMjctMS4yN2EyIDIgMCAwIDEgMi4xMS0uNDUgMTIuODQgMTIuODQgMCAwIDAgMi44MS43QTIgMiAwIDAgMSAyMiAxNi45MnoiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/phone-forwarded\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 PhoneForwarded = createLucideIcon('PhoneForwarded', [\n ['polyline', { points: '18 2 22 6 18 10', key: '6vjanh' }],\n ['line', { x1: '14', x2: '22', y1: '6', y2: '6', key: '1jsywh' }],\n [\n 'path',\n {\n d: 'M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4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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;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":"ajvProvider-1b6pVpkg.cjs","names":["_a","_addFormats","Ajv2020","declaredDialect","Ajv2019","Draft7Ajv"],"sources":["../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/defaults.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/code.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/keyword.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.js","../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js","../../../node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/data.json","../../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js","../../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js","../../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/uri.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/id.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/ref.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/ucs2length.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/pattern.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/required.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/equal.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/const.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/enum.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/contains.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/properties.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.jLine truncated
@@ -0,0 +1,121 @@
/**
* Experimental client task features for MCP SDK.
* WARNING: These APIs are experimental and may change without notice.
*
* @experimental
*/
import type { Client } from '../../client/index.js';
import type { RequestOptions } from '../../shared/protocol.js';
import type { ResponseMessage } from '../../shared/responseMessage.js';
import type { AnyObjectSchema, SchemaOutput } from '../../server/zod-compat.js';
import type { CallToolRequest, ClientRequest, Notification, Request, Result } from '../../types.js';
import { CallToolResultSchema, type CompatibilityCallToolResultSchema } from '../../types.js';
import type { GetTaskResult, ListTasksResult, CancelTaskResult } from './types.js';
/**
* Experimental task features for MCP clients.
*
* Access via `client.experimental.tasks`:
* ```typescript
* const stream = client.experimental.tasks.callToolStream({ name: 'tool', arguments: {} });
* const task = await client.experimental.tasks.getTask(taskId);
* ```
*
* @experimental
*/
export declare class ExperimentalClientTasks<RequestT extends Request = Request, NotificationT extends Notification = Notification, ResultT extends Result = Result> {
private readonly _client;
constructor(_client: Client<RequestT, NotificationT, ResultT>);
/**
* Calls a tool and returns an AsyncGenerator that yields response messages.
* The generator is guaranteed to end with either a 'result' or 'error' message.
*
* This method provides streaming access to tool execution, allowing you to
* observe intermediate task status updates for long-running tool calls.
* Automatically validates structured output if the tool has an outputSchema.
*
* @example
* ```typescript
* const stream = client.experimental.tasks.callToolStream({ name: 'myTool', arguments: {} });
* for await (const message of stream) {
* switch (message.type) {
* case 'taskCreated':
* console.log('Tool execution started:', message.task.taskId);
* break;
* case 'taskStatus':
* console.log('Tool status:', message.task.status);
* break;
* case 'result':
* console.log('Tool result:', message.result);
* break;
* case 'error':
* console.error('Tool error:', message.error);
* break;
* }
* }
* ```
*
* @param params - Tool call parameters (name and arguments)
* @param resultSchema - Zod schema for validating the result (defaults to CallToolResultSchema)
* @param options - Optional request options (timeout, signal, task creation params, etc.)
* @returns AsyncGenerator that yields ResponseMessage objects
*
* @experimental
*/
callToolStream<T extends typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema>(params: CallToolRequest['params'], resultSchema?: T, options?: RequestOptions): AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>;
/**
* Gets the current status of a task.
*
* @param taskId - The task identifier
* @param options - Optional request options
* @returns The task status
*
* @experimental
*/
getTask(taskId: string, options?: RequestOptions): Promise<GetTaskResult>;
/**
* Retrieves the result of a completed task.
*
* @param taskId - The task identifier
* @param resultSchema - Zod schema for validating the result
* @param options - Optional request options
* @returns The task result
*
* @experimental
*/
getTaskResult<T extends AnyObjectSchema>(taskId: string, resultSchema?: T, options?: RequestOptions): Promise<SchemaOutput<T>>;
/**
* Lists tasks with optional pagination.
*
* @param cursor - Optional pagination cursor
* @param options - Optional request options
* @returns List of tasks with optional next cursor
*
* @experimental
*/
listTasks(cursor?: string, options?: RequestOptions): Promise<ListTasksResult>;
/**
* Cancels a running task.
*
* @param taskId - The task identifier
* @param options - Optional request options
*
* @experimental
*/
cancelTask(taskId: string, options?: RequestOptions): Promise<CancelTaskResult>;
/**
* Sends a request and returns an AsyncGenerator that yields response messages.
* The generator is guaranteed to end with either a 'result' or 'error' message.
*
* This method provides streaming access to request processing, allowing you to
* observe intermediate task status updates for task-augmented requests.
*
* @param request - The request to send
* @param resultSchema - Zod schema for validating the result
* @param options - Optional request options (timeout, signal, task creation params, etc.)
* @returns AsyncGenerator that yields ResponseMessage objects
*
* @experimental
*/
requestStream<T extends AnyObjectSchema>(request: ClientRequest | RequestT, resultSchema: T, options?: RequestOptions): AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>;
}
//# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,136 @@
// re-exports for index file
// functions for working with versions
import semverParse = require("./functions/parse");
import semverValid = require("./functions/valid");
import semverClean = require("./functions/clean");
import semverInc = require("./functions/inc");
import semverDiff = require("./functions/diff");
import semverMajor = require("./functions/major");
import semverMinor = require("./functions/minor");
import semverPatch = require("./functions/patch");
import semverPrerelease = require("./functions/prerelease");
import semverCompare = require("./functions/compare");
import semverRcompare = require("./functions/rcompare");
import semverCompareLoose = require("./functions/compare-loose");
import semverCompareBuild = require("./functions/compare-build");
import semverSort = require("./functions/sort");
import semverRsort = require("./functions/rsort");
export {
semverClean as clean,
semverCompare as compare,
semverCompareBuild as compareBuild,
semverCompareLoose as compareLoose,
semverDiff as diff,
semverInc as inc,
semverMajor as major,
semverMinor as minor,
semverParse as parse,
semverPatch as patch,
semverPrerelease as prerelease,
semverRcompare as rcompare,
semverRsort as rsort,
semverSort as sort,
semverValid as valid,
};
// low-level comparators between versions
import semverGt = require("./functions/gt");
import semverLt = require("./functions/lt");
import semverEq = require("./functions/eq");
import semverNeq = require("./functions/neq");
import semverGte = require("./functions/gte");
import semverLte = require("./functions/lte");
import semverCmp = require("./functions/cmp");
import semverCoerce = require("./functions/coerce");
export {
semverCmp as cmp,
semverCoerce as coerce,
semverEq as eq,
semverGt as gt,
semverGte as gte,
semverLt as lt,
semverLte as lte,
semverNeq as neq,
};
// working with ranges
import semverSatisfies = require("./functions/satisfies");
import semverMaxSatisfying = require("./ranges/max-satisfying");
import semverMinSatisfying = require("./ranges/min-satisfying");
import semverToComparators = require("./ranges/to-comparators");
import semverMinVersion = require("./ranges/min-version");
import semverValidRange = require("./ranges/valid");
import semverOutside = require("./ranges/outside");
import semverGtr = require("./ranges/gtr");
import semverLtr = require("./ranges/ltr");
import semverIntersects = require("./ranges/intersects");
import simplify = require("./ranges/simplify");
import rangeSubset = require("./ranges/subset");
export {
rangeSubset as subset,
semverGtr as gtr,
semverIntersects as intersects,
semverLtr as ltr,
semverMaxSatisfying as maxSatisfying,
semverMinSatisfying as minSatisfying,
semverMinVersion as minVersion,
semverOutside as outside,
semverSatisfies as satisfies,
semverToComparators as toComparators,
semverValidRange as validRange,
simplify as simplifyRange,
};
// classes
import SemVer = require("./classes/semver");
import Range = require("./classes/range");
import Comparator = require("./classes/comparator");
export { Comparator, Range, SemVer };
// internals
import identifiers = require("./internals/identifiers");
export import compareIdentifiers = identifiers.compareIdentifiers;
export import rcompareIdentifiers = identifiers.rcompareIdentifiers;
export const SEMVER_SPEC_VERSION: "2.0.0";
export const RELEASE_TYPES: ReleaseType[];
export type ReleaseType = "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease" | "release";
export interface Options {
loose?: boolean | undefined;
}
export interface RangeOptions extends Options {
includePrerelease?: boolean | undefined;
}
export interface CoerceOptions extends Options {
/**
* If the `options.includePrerelease` flag is set, then the `coerce` result will contain
* prerelease and build parts of a version. For example, `1.2.3.4-rc.1+rev.2`
* will preserve prerelease `rc.1` and build `rev.2` in the result.
*
* @default false
* @since 7.6.0
*/
includePrerelease?: boolean | undefined;
/**
* If the `options.rtl` flag is set, then `coerce` will return the right-most
* coercible tuple that does not share an ending index with a longer coercible
* tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
* `4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
* any other overlapping SemVer tuple.
*
* @default false
* @since 6.2.0
*/
rtl?: boolean | undefined;
}
export type Operator = "===" | "!==" | "" | "=" | "==" | "!=" | ">" | ">=" | "<" | "<=";
@@ -0,0 +1,894 @@
//! otpauth 9.5.1 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
/// <reference types="./otpauth.d.ts" />
// @ts-nocheck
import * as crypto from 'node:crypto';
/**
* Converts an integer to an Uint8Array.
* @param {number} num Integer.
* @returns {Uint8Array} Uint8Array.
*/ const uintDecode = (num)=>{
const buf = new ArrayBuffer(8);
const arr = new Uint8Array(buf);
let acc = num;
for(let i = 7; i >= 0; i--){
if (acc === 0) break;
arr[i] = acc & 255;
acc -= arr[i];
acc /= 256;
}
return arr;
};
/**
* "globalThis" ponyfill.
* @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)
* @type {Object.<string, *>}
*/ const globalScope = (()=>{
if (typeof globalThis === "object") return globalThis;
else {
Object.defineProperty(Object.prototype, "__GLOBALTHIS__", {
get () {
return this;
},
configurable: true
});
try {
// @ts-expect-error
// eslint-disable-next-line no-undef
if (typeof __GLOBALTHIS__ !== "undefined") return __GLOBALTHIS__;
} finally{
// @ts-expect-error
delete Object.prototype.__GLOBALTHIS__;
}
}
// Still unable to determine "globalThis", fall back to a naive method.
if (typeof self !== "undefined") return self;
else if (typeof window !== "undefined") return window;
else if (typeof global !== "undefined") return global;
return undefined;
})();
/**
* Canonicalizes a hash algorithm name.
* @param {string} algorithm Hash algorithm name.
* @returns {"SHA1"|"SHA224"|"SHA256"|"SHA384"|"SHA512"|"SHA3-224"|"SHA3-256"|"SHA3-384"|"SHA3-512"} Canonicalized hash algorithm name.
*/ const canonicalizeAlgorithm = (algorithm)=>{
switch(true){
case /^(?:SHA-?1|SSL3-SHA1)$/i.test(algorithm):
return "SHA1";
case /^SHA(?:2?-)?224$/i.test(algorithm):
return "SHA224";
case /^SHA(?:2?-)?256$/i.test(algorithm):
return "SHA256";
case /^SHA(?:2?-)?384$/i.test(algorithm):
return "SHA384";
case /^SHA(?:2?-)?512$/i.test(algorithm):
return "SHA512";
case /^SHA3-224$/i.test(algorithm):
return "SHA3-224";
case /^SHA3-256$/i.test(algorithm):
return "SHA3-256";
case /^SHA3-384$/i.test(algorithm):
return "SHA3-384";
case /^SHA3-512$/i.test(algorithm):
return "SHA3-512";
default:
throw new TypeError(`Unknown hash algorithm: ${algorithm}`);
}
};
/**
* Calculates an HMAC digest.
* @param {string} algorithm Algorithm.
* @param {Uint8Array} key Key.
* @param {Uint8Array} message Message.
* @returns {Uint8Array} Digest.
*/ const hmacDigest = (algorithm, key, message)=>{
if (crypto?.createHmac) {
const hmac = crypto.createHmac(algorithm, globalScope.Buffer.from(key));
hmac.update(globalScope.Buffer.from(message));
return hmac.digest();
} else {
throw new Error("Missing HMAC function");
}
};
/**
* RFC 4648 base32 alphabet without pad.
* @type {string}
*/ const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
/**
* Converts a base32 string to an Uint8Array (RFC 4648).
* @see [LinusU/base32-decode](https://github.com/LinusU/base32-decode)
* @param {string} str Base32 string.
* @returns {Uint8Array} Uint8Array.
*/ const base32Decode = (str)=>{
// Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
str = str.replace(/ /g, "");
// Canonicalize to all upper case and remove padding if it exists.
let end = str.length;
while(str[end - 1] === "=")--end;
str = (end < str.length ? str.substring(0, end) : str).toUpperCase();
const buf = new ArrayBuffer(str.length * 5 / 8 | 0);
const arr = new Uint8Array(buf);
let bits = 0;
let value = 0;
let index = 0;
for(let i = 0; i < str.length; i++){
const idx = ALPHABET.indexOf(str[i]);
if (idx === -1) throw new TypeError(`Invalid character found: ${str[i]}`);
value = value << 5 | idx;
bits += 5;
if (bits >= 8) {
bits -= 8;
arr[index++] = value >>> bits;
}
}
return arr;
};
/**
* Converts an Uint8Array to a base32 string (RFC 4648).
* @see [LinusU/base32-encode](https://github.com/LinusU/base32-encode)
* @param {Uint8Array} arr Uint8Array.
* @returns {string} Base32 string.
*/ const base32Encode = (arr)=>{
let bits = 0;
let value = 0;
let str = "";
for(let i = 0; i < arr.length; i++){
value = value << 8 | arr[i];
bits += 8;
while(bits >= 5){
str += ALPHABET[value >>> bits - 5 & 31];
bits -= 5;
}
}
if (bits > 0) {
str += ALPHABET[value << 5 - bits & 31];
}
return str;
};
/**
* Converts a hexadecimal string to an Uint8Array.
* @param {string} str Hexadecimal string.
* @returns {Uint8Array} Uint8Array.
*/ const hexDecode = (str)=>{
// Remove spaces (although they are not allowed by the spec, some issuers add them for readability).
str = str.replace(/ /g, "");
const buf = new ArrayBuffer(str.length / 2);
const arr = new Uint8Array(buf);
for(let i = 0; i < str.length; i += 2){
arr[i / 2] = parseInt(str.substring(i, i + 2), 16);
}
return arr;
};
/**
* Converts an Uint8Array to a hexadecimal string.
* @param {Uint8Array} arr Uint8Array.
* @returns {string} Hexadecimal string.
*/ const hexEncode = (arr)=>{
let str = "";
for(let i = 0; i < arr.length; i++){
const hex = arr[i].toString(16);
if (hex.length === 1) str += "0";
str += hex;
}
return str.toUpperCase();
};
/**
* Converts a Latin-1 string to an Uint8Array.
* @param {string} str Latin-1 string.
* @returns {Uint8Array} Uint8Array.
*/ const latin1Decode = (str)=>{
const buf = new ArrayBuffer(str.length);
const arr = new Uint8Array(buf);
for(let i = 0; i < str.length; i++){
arr[i] = str.charCodeAt(i) & 0xff;
}
return arr;
};
/**
* Converts an Uint8Array to a Latin-1 string.
* @param {Uint8Array} arr Uint8Array.
* @returns {string} Latin-1 string.
*/ const latin1Encode = (arr)=>{
let str = "";
for(let i = 0; i < arr.length; i++){
str += String.fromCharCode(arr[i]);
}
return str;
};
/**
* TextEncoder instance.
* @type {TextEncoder|null}
*/ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;
/**
* TextDecoder instance.
* @type {TextDecoder|null}
*/ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;
/**
* Converts an UTF-8 string to an Uint8Array.
* @param {string} str String.
* @returns {Uint8Array} Uint8Array.
*/ const utf8Decode = (str)=>{
if (!ENCODER) {
throw new Error("Encoding API not available");
}
return ENCODER.encode(str);
};
/**
* Converts an Uint8Array to an UTF-8 string.
* @param {Uint8Array} arr Uint8Array.
* @returns {string} String.
*/ const utf8Encode = (arr)=>{
if (!DECODER) {
throw new Error("Encoding API not available");
}
return DECODER.decode(arr);
};
/**
* Returns random bytes.
* @param {number} size Size.
* @returns {Uint8Array} Random bytes.
*/ const randomBytes = (size)=>{
if (crypto?.randomBytes) {
return crypto.randomBytes(size);
} else if (globalScope.crypto?.getRandomValues) {
return globalScope.crypto.getRandomValues(new Uint8Array(size));
} else {
throw new Error("Cryptography API not available");
}
};
/**
* OTP secret key.
*/ class Secret {
/**
* Converts a Latin-1 string to a Secret object.
* @param {string} str Latin-1 string.
* @returns {Secret} Secret object.
*/ static fromLatin1(str) {
return new Secret({
buffer: latin1Decode(str).buffer
});
}
/**
* Converts an UTF-8 string to a Secret object.
* @param {string} str UTF-8 string.
* @returns {Secret} Secret object.
*/ static fromUTF8(str) {
return new Secret({
buffer: utf8Decode(str).buffer
});
}
/**
* Converts a base32 string to a Secret object.
* @param {string} str Base32 string.
* @returns {Secret} Secret object.
*/ static fromBase32(str) {
return new Secret({
buffer: base32Decode(str).buffer
});
}
/**
* Converts a hexadecimal string to a Secret object.
* @param {string} str Hexadecimal string.
* @returns {Secret} Secret object.
*/ static fromHex(str) {
return new Secret({
buffer: hexDecode(str).buffer
});
}
/**
* Secret key buffer.
* @deprecated For backward compatibility, the "bytes" property should be used instead.
* @type {ArrayBufferLike}
*/ get buffer() {
return this.bytes.buffer;
}
/**
* Latin-1 string representation of secret key.
* @type {string}
*/ get latin1() {
Object.defineProperty(this, "latin1", {
enumerable: true,
writable: false,
configurable: false,
value: latin1Encode(this.bytes)
});
return this.latin1;
}
/**
* UTF-8 string representation of secret key.
* @type {string}
*/ get utf8() {
Object.defineProperty(this, "utf8", {
enumerable: true,
writable: false,
configurable: false,
value: utf8Encode(this.bytes)
});
return this.utf8;
}
/**
* Base32 string representation of secret key.
* @type {string}
*/ get base32() {
Object.defineProperty(this, "base32", {
enumerable: true,
writable: false,
configurable: false,
value: base32Encode(this.bytes)
});
return this.base32;
}
/**
* Hexadecimal string representation of secret key.
* @type {string}
*/ get hex() {
Object.defineProperty(this, "hex", {
enumerable: true,
writable: false,
configurable: false,
value: hexEncode(this.bytes)
});
return this.hex;
}
/**
* Creates a secret key object.
* @param {Object} [config] Configuration options.
* @param {ArrayBufferLike} [config.buffer] Secret key buffer.
* @param {number} [config.size=20] Number of random bytes to generate, ignored if 'buffer' is provided.
*/ constructor({ buffer, size = 20 } = {}){
/**
* Secret key.
* @type {Uint8Array}
* @readonly
*/ this.bytes = typeof buffer === "undefined" ? randomBytes(size) : new Uint8Array(buffer);
// Prevent the "bytes" property from being modified.
Object.defineProperty(this, "bytes", {
enumerable: true,
writable: false,
configurable: false,
value: this.bytes
});
}
}
/**
* Returns true if a is equal to b, without leaking timing information that would allow an attacker to guess one of the values.
* @param {string} a String a.
* @param {string} b String b.
* @returns {boolean} Equality result.
*/ const timingSafeEqual = (a, b)=>{
if (crypto?.timingSafeEqual) {
return crypto.timingSafeEqual(globalScope.Buffer.from(a), globalScope.Buffer.from(b));
} else {
if (a.length !== b.length) {
throw new TypeError("Input strings must have the same length");
}
let i = -1;
let out = 0;
while(++i < a.length){
out |= a.charCodeAt(i) ^ b.charCodeAt(i);
}
return out === 0;
}
};
/**
* HOTP: An HMAC-based One-time Password Algorithm.
* @see [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226)
*/ class HOTP {
/**
* Default configuration.
* @type {{
* issuer: string,
* label: string,
* issuerInLabel: boolean,
* algorithm: string,
* digits: number,
* counter: number
* window: number
* }}
*/ static get defaults() {
return {
issuer: "",
label: "OTPAuth",
issuerInLabel: true,
algorithm: "SHA1",
digits: 6,
counter: 0,
window: 1
};
}
/**
* Generates an HOTP token.
* @param {Object} config Configuration options.
* @param {Secret} config.secret Secret key.
* @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
* @param {number} [config.digits=6] Token length.
* @param {number} [config.counter=0] Counter value.
* @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
* @returns {string} Token.
*/ static generate({ secret, algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac = hmacDigest }) {
const message = uintDecode(counter);
const digest = hmac(algorithm, secret.bytes, message);
if (!digest?.byteLength || digest.byteLength < 19) {
throw new TypeError("Return value must be at least 19 bytes");
}
const offset = digest[digest.byteLength - 1] & 15;
const otp = ((digest[offset] & 127) << 24 | (digest[offset + 1] & 255) << 16 | (digest[offset + 2] & 255) << 8 | digest[offset + 3] & 255) % 10 ** digits;
return otp.toString().padStart(digits, "0");
}
/**
* Generates an HOTP token.
* @param {Object} [config] Configuration options.
* @param {number} [config.counter=this.counter++] Counter value.
* @returns {string} Token.
*/ generate({ counter = this.counter++ } = {}) {
return HOTP.generate({
secret: this.secret,
algorithm: this.algorithm,
digits: this.digits,
counter,
hmac: this.hmac
});
}
/**
* Validates an HOTP token.
* @param {Object} config Configuration options.
* @param {string} config.token Token value.
* @param {Secret} config.secret Secret key.
* @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
* @param {number} [config.digits=6] Token length.
* @param {number} [config.counter=0] Counter value.
* @param {number} [config.window=1] Window of counter values to test.
* @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
* @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
*/ static validate({ token, secret, algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, window = HOTP.defaults.window, hmac = hmacDigest }) {
// Return early if the token length does not match the digit number.
if (token.length !== digits) return null;
let delta = null;
const check = (/** @type {number} */ i)=>{
const generatedToken = HOTP.generate({
secret,
algorithm,
digits,
counter: i,
hmac
});
if (timingSafeEqual(token, generatedToken)) {
delta = i - counter;
}
};
check(counter);
for(let i = 1; i <= window && delta === null; ++i){
check(counter - i);
if (delta !== null) break;
check(counter + i);
if (delta !== null) break;
}
return delta;
}
/**
* Validates an HOTP token.
* @param {Object} config Configuration options.
* @param {string} config.token Token value.
* @param {number} [config.counter=this.counter] Counter value.
* @param {number} [config.window=1] Window of counter values to test.
* @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
*/ validate({ token, counter = this.counter, window }) {
return HOTP.validate({
token,
secret: this.secret,
algorithm: this.algorithm,
digits: this.digits,
counter,
window,
hmac: this.hmac
});
}
/**
* Returns a Google Authenticator key URI.
* @returns {string} URI.
*/ toString() {
const e = encodeURIComponent;
return "otpauth://hotp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `counter=${e(this.counter)}`;
}
/**
* Creates an HOTP object.
* @param {Object} [config] Configuration options.
* @param {string} [config.issuer=''] Account provider.
* @param {string} [config.label='OTPAuth'] Account label.
* @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
* @param {Secret|string} [config.secret=Secret] Secret key.
* @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
* @param {number} [config.digits=6] Token length.
* @param {number} [config.counter=0] Initial counter value.
* @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
*/ constructor({ issuer = HOTP.defaults.issuer, label = HOTP.defaults.label, issuerInLabel = HOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = HOTP.defaults.algorithm, digits = HOTP.defaults.digits, counter = HOTP.defaults.counter, hmac } = {}){
/**
* Account provider.
* @type {string}
*/ this.issuer = issuer;
/**
* Account label.
* @type {string}
*/ this.label = label;
/**
* Include issuer prefix in label.
* @type {boolean}
*/ this.issuerInLabel = issuerInLabel;
/**
* Secret key.
* @type {Secret}
*/ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
/**
* HMAC hashing algorithm.
* @type {string}
*/ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
/**
* Token length.
* @type {number}
*/ this.digits = digits;
/**
* Initial counter value.
* @type {number}
*/ this.counter = counter;
/**
* Custom HMAC function.
* @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
*/ this.hmac = hmac;
}
}
/**
* TOTP: Time-Based One-Time Password Algorithm.
* @see [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)
*/ class TOTP {
/**
* Default configuration.
* @type {{
* issuer: string,
* label: string,
* issuerInLabel: boolean,
* algorithm: string,
* digits: number,
* period: number
* window: number
* }}
*/ static get defaults() {
return {
issuer: "",
label: "OTPAuth",
issuerInLabel: true,
algorithm: "SHA1",
digits: 6,
period: 30,
window: 1
};
}
/**
* Calculates the counter. i.e. the number of periods since timestamp 0.
* @param {Object} [config] Configuration options.
* @param {number} [config.period=30] Token time-step duration.
* @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
* @returns {number} Counter.
*/ static counter({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
return Math.floor(timestamp / 1000 / period);
}
/**
* Calculates the counter. i.e. the number of periods since timestamp 0.
* @param {Object} [config] Configuration options.
* @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
* @returns {number} Counter.
*/ counter({ timestamp = Date.now() } = {}) {
return TOTP.counter({
period: this.period,
timestamp
});
}
/**
* Calculates the remaining time in milliseconds until the next token is generated.
* @param {Object} [config] Configuration options.
* @param {number} [config.period=30] Token time-step duration.
* @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
* @returns {number} counter.
*/ static remaining({ period = TOTP.defaults.period, timestamp = Date.now() } = {}) {
return period * 1000 - timestamp % (period * 1000);
}
/**
* Calculates the remaining time in milliseconds until the next token is generated.
* @param {Object} [config] Configuration options.
* @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
* @returns {number} counter.
*/ remaining({ timestamp = Date.now() } = {}) {
return TOTP.remaining({
period: this.period,
timestamp
});
}
/**
* Generates a TOTP token.
* @param {Object} config Configuration options.
* @param {Secret} config.secret Secret key.
* @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
* @param {number} [config.digits=6] Token length.
* @param {number} [config.period=30] Token time-step duration.
* @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
* @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
* @returns {string} Token.
*/ static generate({ secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), hmac }) {
return HOTP.generate({
secret,
algorithm,
digits,
counter: TOTP.counter({
period,
timestamp
}),
hmac
});
}
/**
* Generates a TOTP token.
* @param {Object} [config] Configuration options.
* @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
* @returns {string} Token.
*/ generate({ timestamp = Date.now() } = {}) {
return TOTP.generate({
secret: this.secret,
algorithm: this.algorithm,
digits: this.digits,
period: this.period,
timestamp,
hmac: this.hmac
});
}
/**
* Validates a TOTP token.
* @param {Object} config Configuration options.
* @param {string} config.token Token value.
* @param {Secret} config.secret Secret key.
* @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
* @param {number} [config.digits=6] Token length.
* @param {number} [config.period=30] Token time-step duration.
* @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
* @param {number} [config.window=1] Window of counter values to test.
* @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
* @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
*/ static validate({ token, secret, algorithm, digits, period = TOTP.defaults.period, timestamp = Date.now(), window, hmac }) {
return HOTP.validate({
token,
secret,
algorithm,
digits,
counter: TOTP.counter({
period,
timestamp
}),
window,
hmac
});
}
/**
* Validates a TOTP token.
* @param {Object} config Configuration options.
* @param {string} config.token Token value.
* @param {number} [config.timestamp=Date.now] Timestamp value in milliseconds.
* @param {number} [config.window=1] Window of counter values to test.
* @returns {number|null} Token delta or null if it is not found in the search window, in which case it should be considered invalid.
*/ validate({ token, timestamp, window }) {
return TOTP.validate({
token,
secret: this.secret,
algorithm: this.algorithm,
digits: this.digits,
period: this.period,
timestamp,
window,
hmac: this.hmac
});
}
/**
* Returns a Google Authenticator key URI.
* @returns {string} URI.
*/ toString() {
const e = encodeURIComponent;
return "otpauth://totp/" + `${this.issuer.length > 0 ? this.issuerInLabel ? `${e(this.issuer)}:${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?issuer=${e(this.issuer)}&` : `${e(this.label)}?`}` + `secret=${e(this.secret.base32)}&` + `algorithm=${e(this.algorithm)}&` + `digits=${e(this.digits)}&` + `period=${e(this.period)}`;
}
/**
* Creates a TOTP object.
* @param {Object} [config] Configuration options.
* @param {string} [config.issuer=''] Account provider.
* @param {string} [config.label='OTPAuth'] Account label.
* @param {boolean} [config.issuerInLabel=true] Include issuer prefix in label.
* @param {Secret|string} [config.secret=Secret] Secret key.
* @param {string} [config.algorithm='SHA1'] HMAC hashing algorithm.
* @param {number} [config.digits=6] Token length.
* @param {number} [config.period=30] Token time-step duration.
* @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
*/ constructor({ issuer = TOTP.defaults.issuer, label = TOTP.defaults.label, issuerInLabel = TOTP.defaults.issuerInLabel, secret = new Secret(), algorithm = TOTP.defaults.algorithm, digits = TOTP.defaults.digits, period = TOTP.defaults.period, hmac } = {}){
/**
* Account provider.
* @type {string}
*/ this.issuer = issuer;
/**
* Account label.
* @type {string}
*/ this.label = label;
/**
* Include issuer prefix in label.
* @type {boolean}
*/ this.issuerInLabel = issuerInLabel;
/**
* Secret key.
* @type {Secret}
*/ this.secret = typeof secret === "string" ? Secret.fromBase32(secret) : secret;
/**
* HMAC hashing algorithm.
* @type {string}
*/ this.algorithm = hmac ? algorithm : canonicalizeAlgorithm(algorithm);
/**
* Token length.
* @type {number}
*/ this.digits = digits;
/**
* Token time-step duration.
* @type {number}
*/ this.period = period;
/**
* Custom HMAC function.
* @type {((algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array)|undefined}
*/ this.hmac = hmac;
}
}
/**
* Key URI regex (otpauth://TYPE/[ISSUER:]LABEL?PARAMETERS).
* @type {RegExp}
*/ const OTPURI_REGEX = /^otpauth:\/\/([ht]otp)\/(.+)\?([A-Z0-9.~_-]+=[^?&]*(?:&[A-Z0-9.~_-]+=[^?&]*)*)$/i;
/**
* RFC 4648 base32 alphabet with pad.
* @type {RegExp}
*/ const SECRET_REGEX = /^[2-7A-Z]+=*$/i;
/**
* Regex for supported algorithms in built-in HMAC function.
* @type {RegExp}
*/ const ALGORITHM_REGEX = /^SHA(?:1|224|256|384|512|3-224|3-256|3-384|3-512)$/i;
/**
* Regex for custom algorithms in user-defined HMAC function.
* @type {RegExp}
*/ const ALGORITHM_CUSTOM_REGEX = /^[A-Z0-9]+(?:[_-][A-Z0-9]+)*$/i;
/**
* Integer regex.
* @type {RegExp}
*/ const INTEGER_REGEX = /^[+-]?\d+$/;
/**
* Positive integer regex.
* @type {RegExp}
*/ const POSITIVE_INTEGER_REGEX = /^\+?[1-9]\d*$/;
/**
* HOTP/TOTP object/string conversion.
* @see [Key URI Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
*/ class URI {
/**
* Parses a Google Authenticator key URI and returns an HOTP/TOTP object.
* @param {string} uri Google Authenticator Key URI.
* @param {Object} [config] Configuration options.
* @param {(algorithm: string, key: Uint8Array, message: Uint8Array) => Uint8Array} [config.hmac] Custom HMAC function.
* @returns {HOTP|TOTP} HOTP/TOTP object.
*/ static parse(uri, { hmac } = {}) {
let uriGroups;
try {
uriGroups = uri.match(OTPURI_REGEX);
// eslint-disable-next-line no-unused-vars
} catch (_) {
/* Handled below */ }
if (!Array.isArray(uriGroups)) {
throw new URIError("Invalid URI format");
}
// Extract URI groups.
const uriType = uriGroups[1].toLowerCase();
const uriLabel = uriGroups[2].split(/(?::|%3A) *(.+)/i, 2).map(decodeURIComponent);
/** @type {Object.<string, string>} */ const uriParams = uriGroups[3].split("&").reduce((acc, cur)=>{
const pairArr = cur.split(/=(.*)/, 2).map(decodeURIComponent);
const pairKey = pairArr[0].toLowerCase();
const pairVal = pairArr[1];
/** @type {Object.<string, string>} */ const pairAcc = acc;
pairAcc[pairKey] = pairVal;
return pairAcc;
}, {});
// 'OTP' will be instantiated with 'config' argument.
let OTP;
const config = {};
if (uriType === "hotp") {
OTP = HOTP;
// Counter: required
if (typeof uriParams.counter !== "undefined" && INTEGER_REGEX.test(uriParams.counter)) {
config.counter = parseInt(uriParams.counter, 10);
} else {
throw new TypeError("Missing or invalid 'counter' parameter");
}
} else if (uriType === "totp") {
OTP = TOTP;
// Period: optional
if (typeof uriParams.period !== "undefined") {
if (POSITIVE_INTEGER_REGEX.test(uriParams.period)) {
config.period = parseInt(uriParams.period, 10);
} else {
throw new TypeError("Invalid 'period' parameter");
}
}
} else {
throw new TypeError("Unknown OTP type");
}
// Label: required
// Issuer: optional
if (typeof uriParams.issuer !== "undefined") {
config.issuer = uriParams.issuer;
}
if (uriLabel.length === 2) {
config.label = uriLabel[1];
if (typeof config.issuer === "undefined" || config.issuer === "") {
config.issuer = uriLabel[0];
} else if (uriLabel[0] === "") {
config.issuerInLabel = false;
}
} else {
config.label = uriLabel[0];
if (typeof config.issuer !== "undefined" && config.issuer !== "") {
config.issuerInLabel = false;
}
}
// Secret: required
if (typeof uriParams.secret !== "undefined" && SECRET_REGEX.test(uriParams.secret)) {
config.secret = uriParams.secret;
} else {
throw new TypeError("Missing or invalid 'secret' parameter");
}
// Algorithm: optional
if (typeof uriParams.algorithm !== "undefined") {
if ((hmac ? ALGORITHM_CUSTOM_REGEX : ALGORITHM_REGEX).test(uriParams.algorithm)) {
config.algorithm = uriParams.algorithm;
} else {
throw new TypeError("Invalid 'algorithm' parameter");
}
}
// Digits: optional
if (typeof uriParams.digits !== "undefined") {
if (POSITIVE_INTEGER_REGEX.test(uriParams.digits)) {
config.digits = parseInt(uriParams.digits, 10);
} else {
throw new TypeError("Invalid 'digits' parameter");
}
}
// HMAC: optional
if (typeof hmac !== "undefined") {
config.hmac = hmac;
}
return new OTP(config);
}
/**
* Converts an HOTP/TOTP object to a Google Authenticator key URI.
* @param {HOTP|TOTP} otp HOTP/TOTP object.
* @returns {string} Google Authenticator Key URI.
*/ static stringify(otp) {
if (otp instanceof HOTP || otp instanceof TOTP) {
return otp.toString();
}
throw new TypeError("Invalid 'HOTP/TOTP' object");
}
}
/**
* Library version.
* @type {string}
*/ const version = "9.5.1";
export { HOTP, Secret, TOTP, URI, version };
@@ -0,0 +1,18 @@
export * from './ensureType';
export * from './getType';
export * from './isAbsoluteURL';
export * from './isArrayLike';
export * from './isAsyncFunction';
export * from './isESModule';
export * from './isError';
export * from './isFunction';
export * from './isIterable';
export * from './isLeapYear';
export * from './isLength';
export * from './isNil';
export * from './isNumber';
export * from './isObject';
export * from './isPlainObject';
export * from './isPromiseLike';
export * from './isValidDate';
export * from './isWhat';
@@ -0,0 +1,30 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_utils = require("../utils.cjs");
const require_scroll_restoration = require("../scroll-restoration.cjs");
const require_scroll_restoration_inline = require("../scroll-restoration-inline.cjs");
//#region src/scroll-restoration-script/server.ts
const defaultInlineScrollRestorationScript = `(${require_scroll_restoration_inline.default})(${require_utils.escapeHtml(JSON.stringify({
storageKey: require_scroll_restoration.storageKey,
shouldScrollRestoration: true
}))})`;
function getScrollRestorationScript(options) {
if (options.storageKey === "tsr-scroll-restoration-v1_3" && options.shouldScrollRestoration === true && options.key === void 0 && options.behavior === void 0) return defaultInlineScrollRestorationScript;
return `(${require_scroll_restoration_inline.default})(${require_utils.escapeHtml(JSON.stringify(options))})`;
}
function getScrollRestorationScriptForRouter(router) {
if (typeof router.options.scrollRestoration === "function" && !router.options.scrollRestoration({ location: router.latestLocation })) return null;
const getKey = router.options.getScrollRestorationKey;
if (!getKey) return defaultInlineScrollRestorationScript;
const location = router.latestLocation;
const userKey = getKey(location);
if (userKey === require_scroll_restoration.defaultGetScrollRestorationKey(location)) return defaultInlineScrollRestorationScript;
return getScrollRestorationScript({
storageKey: require_scroll_restoration.storageKey,
shouldScrollRestoration: true,
key: userKey
});
}
//#endregion
exports.getScrollRestorationScriptForRouter = getScrollRestorationScriptForRouter;
//# sourceMappingURL=server.cjs.map
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.statements = exports.statement = exports.smart = exports.program = exports.expression = exports.default = void 0;
var formatters = require("./formatters.js");
var _builder = require("./builder.js");
const smart = exports.smart = (0, _builder.default)(formatters.smart);
const statement = exports.statement = (0, _builder.default)(formatters.statement);
const statements = exports.statements = (0, _builder.default)(formatters.statements);
const expression = exports.expression = (0, _builder.default)(formatters.expression);
const program = exports.program = (0, _builder.default)(formatters.program);
var _default = exports.default = Object.assign(smart.bind(undefined), {
smart,
statement,
statements,
expression,
program,
ast: smart.ast
});
//# sourceMappingURL=index.js.map
@@ -0,0 +1,502 @@
// A readable tar stream creator
// Technically, this is a transform stream that you write paths into,
// and tar format comes out of.
// The `add()` method is like `write()` but returns this,
// and end() return `this` as well, so you can
// do `new Pack(opt).add('files').add('dir').end().pipe(output)
// You could also do something like:
// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar'))
import fs from 'fs';
import { WriteEntry, WriteEntrySync, WriteEntryTar, } from './write-entry.js';
export class PackJob {
path;
absolute;
entry;
stat;
readdir;
pending = false;
pendingLink = false;
ignore = false;
piped = false;
constructor(path, absolute) {
this.path = path || './';
this.absolute = absolute;
}
}
import { Minipass } from 'minipass';
import * as zlib from 'minizlib';
import { Yallist } from 'yallist';
import { warnMethod } from './warn-method.js';
const EOF = Buffer.alloc(1024);
const ONSTAT = Symbol('onStat');
const ENDED = Symbol('ended');
const QUEUE = Symbol('queue');
const PENDINGLINKS = Symbol('pendingLinks');
const CURRENT = Symbol('current');
const PROCESS = Symbol('process');
const PROCESSING = Symbol('processing');
const PROCESSJOB = Symbol('processJob');
const JOBS = Symbol('jobs');
const JOBDONE = Symbol('jobDone');
const ADDFSENTRY = Symbol('addFSEntry');
const ADDTARENTRY = Symbol('addTarEntry');
const STAT = Symbol('stat');
const READDIR = Symbol('readdir');
const ONREADDIR = Symbol('onreaddir');
const PIPE = Symbol('pipe');
const ENTRY = Symbol('entry');
const ENTRYOPT = Symbol('entryOpt');
const WRITEENTRYCLASS = Symbol('writeEntryClass');
const WRITE = Symbol('write');
const ONDRAIN = Symbol('ondrain');
import path from 'path';
import { normalizeWindowsPath } from './normalize-windows-path.js';
export class Pack extends Minipass {
sync = false;
opt;
cwd;
maxReadSize;
preservePaths;
strict;
noPax;
prefix;
linkCache;
statCache;
file;
portable;
zip;
readdirCache;
noDirRecurse;
follow;
noMtime;
mtime;
filter;
jobs;
[WRITEENTRYCLASS];
onWriteEntry;
// Note: we actually DO need a linked list here, because we
// shift() to update the head of the list where we start, but still
// while that happens, need to know what the next item in the queue
// will be. Since we do multiple jobs in parallel, it's not as simple
// as just an Array.shift(), since that would lose the information about
// the next job in the list. We could add a .next field on the PackJob
// class, but then we'd have to be tracking the tail of the queue the
// whole time, and Yallist just does that for us anyway.
[QUEUE];
[PENDINGLINKS] = new Map();
[JOBS] = 0;
[PROCESSING] = false;
[ENDED] = false;
constructor(opt = {}) {
super();
this.opt = opt;
this.file = opt.file || '';
this.cwd = opt.cwd || process.cwd();
this.maxReadSize = opt.maxReadSize;
this.preservePaths = !!opt.preservePaths;
this.strict = !!opt.strict;
this.noPax = !!opt.noPax;
this.prefix = normalizeWindowsPath(opt.prefix || '');
this.linkCache = opt.linkCache || new Map();
this.statCache = opt.statCache || new Map();
this.readdirCache = opt.readdirCache || new Map();
this.onWriteEntry = opt.onWriteEntry;
this[WRITEENTRYCLASS] = WriteEntry;
if (typeof opt.onwarn === 'function') {
this.on('warn', opt.onwarn);
}
this.portable = !!opt.portable;
if (opt.gzip || opt.brotli || opt.zstd) {
if ((opt.gzip ? 1 : 0) + (opt.brotli ? 1 : 0) + (opt.zstd ? 1 : 0) >
1) {
throw new TypeError('gzip, brotli, zstd are mutually exclusive');
}
if (opt.gzip) {
if (typeof opt.gzip !== 'object') {
opt.gzip = {};
}
if (this.portable) {
opt.gzip.portable = true;
}
this.zip = new zlib.Gzip(opt.gzip);
}
if (opt.brotli) {
if (typeof opt.brotli !== 'object') {
opt.brotli = {};
}
this.zip = new zlib.BrotliCompress(opt.brotli);
}
if (opt.zstd) {
if (typeof opt.zstd !== 'object') {
opt.zstd = {};
}
this.zip = new zlib.ZstdCompress(opt.zstd);
}
/* c8 ignore next */
if (!this.zip)
throw new Error('impossible');
const zip = this.zip;
zip.on('data', chunk => super.write(chunk));
zip.on('end', () => super.end());
zip.on('drain', () => this[ONDRAIN]());
this.on('resume', () => zip.resume());
}
else {
this.on('drain', this[ONDRAIN]);
}
this.noDirRecurse = !!opt.noDirRecurse;
this.follow = !!opt.follow;
this.noMtime = !!opt.noMtime;
if (opt.mtime)
this.mtime = opt.mtime;
this.filter =
typeof opt.filter === 'function' ? opt.filter : () => true;
this[QUEUE] = new Yallist();
this[JOBS] = 0;
this.jobs = Number(opt.jobs) || 4;
this[PROCESSING] = false;
this[ENDED] = false;
}
[WRITE](chunk) {
return super.write(chunk);
}
add(path) {
this.write(path);
return this;
}
end(path, encoding, cb) {
/* c8 ignore start */
if (typeof path === 'function') {
cb = path;
path = undefined;
}
if (typeof encoding === 'function') {
cb = encoding;
encoding = undefined;
}
/* c8 ignore stop */
if (path) {
this.add(path);
}
this[ENDED] = true;
this[PROCESS]();
/* c8 ignore next */
if (cb)
cb();
return this;
}
write(path) {
if (this[ENDED]) {
throw new Error('write after end');
}
if (typeof path === 'string') {
this[ADDFSENTRY](path);
}
else {
this[ADDTARENTRY](path);
}
return this.flowing;
}
[ADDTARENTRY](p) {
const absolute = normalizeWindowsPath(path.resolve(this.cwd, p.path));
// in this case, we don't have to wait for the stat
if (!this.filter(p.path, p)) {
p.resume();
}
else {
const job = new PackJob(p.path, absolute);
job.entry = new WriteEntryTar(p, this[ENTRYOPT](job));
job.entry.on('end', () => this[JOBDONE](job));
this[JOBS] += 1;
this[QUEUE].push(job);
}
this[PROCESS]();
}
[ADDFSENTRY](p) {
const absolute = normalizeWindowsPath(path.resolve(this.cwd, p));
this[QUEUE].push(new PackJob(p, absolute));
this[PROCESS]();
}
[STAT](job) {
job.pending = true;
this[JOBS] += 1;
const stat = this.follow ? 'stat' : 'lstat';
fs[stat](job.absolute, (er, stat) => {
job.pending = false;
this[JOBS] -= 1;
if (er) {
this.emit('error', er);
}
else {
this[ONSTAT](job, stat);
}
});
}
[ONSTAT](job, stat) {
this.statCache.set(job.absolute, stat);
job.stat = stat;
// now we have the stat, we can filter it.
if (!this.filter(job.path, stat)) {
job.ignore = true;
}
else if (stat.isFile() &&
stat.nlink > 1 &&
!this.linkCache.get(`${stat.dev}:${stat.ino}`) &&
!this.sync) {
// if it's not filtered, and it's a new File entry, and next anyway
// process right away in case any pending Link entries are about
// to try to link to it.
if (job === this[CURRENT]) {
this[PROCESSJOB](job);
}
else {
// if it's NOT the current entry, it needs to be deferred,
// so that the link target can be built first.
const key = `${stat.dev}:${stat.ino}`;
const pending = this[PENDINGLINKS].get(key);
if (pending)
pending.push(job);
else
this[PENDINGLINKS].set(key, [job]);
job.pendingLink = true;
job.pending = true;
}
}
this[PROCESS]();
}
[READDIR](job) {
job.pending = true;
this[JOBS] += 1;
fs.readdir(job.absolute, (er, entries) => {
job.pending = false;
this[JOBS] -= 1;
if (er) {
return this.emit('error', er);
}
this[ONREADDIR](job, entries);
});
}
[ONREADDIR](job, entries) {
this.readdirCache.set(job.absolute, entries);
job.readdir = entries;
this[PROCESS]();
}
[PROCESS]() {
if (this[PROCESSING]) {
return;
}
this[PROCESSING] = true;
for (let w = this[QUEUE].head; !!w && this[JOBS] < this.jobs; w = w.next) {
this[PROCESSJOB](w.value);
if (w.value.ignore) {
const p = w.next;
this[QUEUE].removeNode(w);
w.next = p;
}
}
this[PROCESSING] = false;
if (this[ENDED] && this[QUEUE].length === 0 && this[JOBS] === 0) {
if (this.zip) {
this.zip.end(EOF);
}
else {
super.write(EOF);
super.end();
}
}
}
get [CURRENT]() {
return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value;
}
[JOBDONE](job) {
this[QUEUE].shift();
this[JOBS] -= 1;
const { stat } = job;
if (stat && stat.isFile() && stat.nlink > 1) {
// might be a file with pending links
const key = `${stat.dev}:${stat.ino}`;
const pending = this[PENDINGLINKS].get(key);
if (pending) {
this[PENDINGLINKS].delete(key);
for (const job of pending) {
job.pending = false;
this[PROCESSJOB](job);
}
}
}
this[PROCESS]();
}
[PROCESSJOB](job) {
if (job.pending && job.pendingLink && job === this[CURRENT]) {
// At least one of the links to this file are not being included
// in the tarball, so we need to just proceed.
job.pending = false;
job.pendingLink = false;
}
if (job.pending) {
return;
}
if (job.entry) {
if (job === this[CURRENT] && !job.piped) {
this[PIPE](job);
}
return;
}
if (!job.stat) {
const sc = this.statCache.get(job.absolute);
if (sc) {
this[ONSTAT](job, sc);
}
else {
this[STAT](job);
}
}
if (!job.stat) {
return;
}
// filtered out!
if (job.ignore) {
return;
}
if (!this.noDirRecurse && job.stat.isDirectory() && !job.readdir) {
const rc = this.readdirCache.get(job.absolute);
if (rc) {
this[ONREADDIR](job, rc);
}
else {
this[READDIR](job);
}
if (!job.readdir) {
return;
}
}
// we know it doesn't have an entry, because that got checked above
job.entry = this[ENTRY](job);
if (!job.entry) {
job.ignore = true;
return;
}
if (job === this[CURRENT] && !job.piped) {
this[PIPE](job);
}
}
[ENTRYOPT](job) {
return {
onwarn: (code, msg, data) => this.warn(code, msg, data),
noPax: this.noPax,
cwd: this.cwd,
absolute: job.absolute,
preservePaths: this.preservePaths,
maxReadSize: this.maxReadSize,
strict: this.strict,
portable: this.portable,
linkCache: this.linkCache,
statCache: this.statCache,
noMtime: this.noMtime,
mtime: this.mtime,
prefix: this.prefix,
onWriteEntry: this.onWriteEntry,
};
}
[ENTRY](job) {
this[JOBS] += 1;
try {
const e = new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job));
return e
.on('end', () => this[JOBDONE](job))
.on('error', er => this.emit('error', er));
}
catch (er) {
this.emit('error', er);
}
}
[ONDRAIN]() {
if (this[CURRENT] && this[CURRENT].entry) {
this[CURRENT].entry.resume();
}
}
// like .pipe() but using super, because our write() is special
[PIPE](job) {
job.piped = true;
if (job.readdir) {
job.readdir.forEach(entry => {
const p = job.path;
const base = p === './' ? '' : p.replace(/\/*$/, '/');
this[ADDFSENTRY](base + entry);
});
}
const source = job.entry;
const zip = this.zip;
/* c8 ignore start */
if (!source)
throw new Error('cannot pipe without source');
/* c8 ignore stop */
if (zip) {
source.on('data', chunk => {
if (!zip.write(chunk)) {
source.pause();
}
});
}
else {
source.on('data', chunk => {
if (!super.write(chunk)) {
source.pause();
}
});
}
}
pause() {
if (this.zip) {
this.zip.pause();
}
return super.pause();
}
warn(code, message, data = {}) {
warnMethod(this, code, message, data);
}
}
export class PackSync extends Pack {
sync = true;
constructor(opt) {
super(opt);
this[WRITEENTRYCLASS] = WriteEntrySync;
}
// pause/resume are no-ops in sync streams.
pause() { }
resume() { }
[STAT](job) {
const stat = this.follow ? 'statSync' : 'lstatSync';
this[ONSTAT](job, fs[stat](job.absolute));
}
[READDIR](job) {
this[ONREADDIR](job, fs.readdirSync(job.absolute));
}
// gotta get it all in this tick
[PIPE](job) {
const source = job.entry;
const zip = this.zip;
if (job.readdir) {
job.readdir.forEach(entry => {
const p = job.path;
const base = p === './' ? '' : p.replace(/\/*$/, '/');
this[ADDFSENTRY](base + entry);
});
}
/* c8 ignore start */
if (!source)
throw new Error('Cannot pipe without source');
/* c8 ignore stop */
if (zip) {
source.on('data', chunk => {
zip.write(chunk);
});
}
else {
source.on('data', chunk => {
super[WRITE](chunk);
});
}
}
}
//# sourceMappingURL=pack.js.map
@@ -0,0 +1 @@
{"version":3,"file":"spell-check.js","sources":["../../../src/icons/spell-check.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name SpellCheck\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtNiAxNiA2LTEyIDYgMTIiIC8+CiAgPHBhdGggZD0iTTggMTJoOCIgLz4KICA8cGF0aCBkPSJtMTYgMjAgMiAyIDQtNCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/spell-check\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 SpellCheck = createLucideIcon('SpellCheck', [\n ['path', { d: 'm6 16 6-12 6 12', key: '1b4byz' }],\n ['path', { d: 'M8 12h8', key: '1wcyev' }],\n ['path', { d: 'm16 20 2 2 4-4', key: '13tcca' }],\n]);\n\nexport default SpellCheck;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,iBAAiB,YAAc,CAAA,CAAA,CAAA;AAAA,CAAA,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,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,CAChD,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,GAAG,CAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACjD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../src/posix.ts", "../../src/win32.ts", "../../src/index.ts"],
"sourcesContent": ["/**\n * This is the Posix implementation of isexe, which uses the file\n * mode and uid/gid values.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'node:fs'\nimport { stat } from 'node:fs/promises'\nimport { IsexeOptions } from './options.js'\n\n/**\n * Determine whether a path is executable according to the mode and\n * current (or specified) user and group IDs.\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {},\n): Promise<boolean> => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable according to\n * the mode and current (or specified) user and group IDs.\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {},\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkStat = (stat: Stats, options: IsexeOptions) =>\n stat.isFile() && checkMode(stat, options)\n\nconst checkMode = (stat: Stats, options: IsexeOptions) => {\n const myUid = options.uid ?? process.getuid?.()\n const myGroups = options.groups ?? process.getgroups?.() ?? []\n const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]\n if (myUid === undefined || myGid === undefined) {\n throw new Error('cannot get uid or gid')\n }\n\n const groups = new Set([myGid, ...myGroups])\n\n const mod = stat.mode\n const uid = stat.uid\n const gid = stat.gid\n\n const u = parseInt('100', 8)\n const g = parseInt('010', 8)\n const o = parseInt('001', 8)\n const ug = u | g\n\n return !!(\n mod & o ||\n (mod & g && groups.has(gid)) ||\n (mod & u && uid === myUid) ||\n (mod & ug && myUid === 0)\n )\n}\n", "/**\n * This is the Windows implementation of isexe, which uses the file\n * extension and PATHEXT setting.\n *\n * @module\n */\n\nimport { Stats, statSync } from 'node:fs'\nimport { stat } from 'node:fs/promises'\nimport { IsexeOptions } from './options.js'\nimport { delimiter } from 'node:path'\n\n/**\n * Determine whether a path is executable based on the file extension\n * and PATHEXT environment variable (or specified pathExt option)\n */\nexport const isexe = async (\n path: string,\n options: IsexeOptions = {},\n): Promise<boolean> => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(await stat(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\n/**\n * Synchronously determine whether a path is executable based on the file\n * extension and PATHEXT environment variable (or specified pathExt option)\n */\nexport const sync = (\n path: string,\n options: IsexeOptions = {},\n): boolean => {\n const { ignoreErrors = false } = options\n try {\n return checkStat(statSync(path), path, options)\n } catch (e) {\n const er = e as NodeJS.ErrnoException\n if (ignoreErrors || er.code === 'EACCES') return false\n throw er\n }\n}\n\nconst checkPathExt = (path: string, options: IsexeOptions) => {\n const { pathExt = process.env.PATHEXT || '' } = options\n const peSplit = pathExt.split(delimiter)\n if (peSplit.indexOf('') !== -1) {\n return true\n }\n\n for (const pes of peSplit) {\n const p = pes.toLowerCase()\n const ext = path.substring(path.length - p.length).toLowerCase()\n\n if (p && ext === p) {\n return true\n }\n }\n return false\n}\n\nconst checkStat = (stat: Stats, path: string, options: IsexeOptions) =>\n stat.isFile() && checkPathExt(path, options)\n", "import * as posix from './posix.js'\nimport * as win32 from './win32.js'\nexport * from './options.js'\nexport { win32, posix }\n\nconst platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform\nconst impl = platform === 'win32' ? win32 : posix\n\n/**\n * Determine whether a path is executable on the current platform.\n */\nexport const isexe = impl.isexe\n/**\n * Synchronously determine whether a path is executable on the\n * current platform.\n */\nexport const sync = impl.sync\n"],
"mappings": "0FAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,SAAAC,IAOA,OAAgB,YAAAC,MAAgB,UAChC,OAAS,QAAAC,MAAY,mBAOd,IAAMH,EAAQ,MACnBI,EACAC,EAAwB,CAAA,IACJ,CACpB,GAAM,CAAE,aAAAC,EAAe,EAAK,EAAKD,EACjC,GAAI,CACF,OAAOE,EAAU,MAAMJ,EAAKC,CAAI,EAAGC,CAAO,CAC5C,OAASG,EAAG,CACV,IAAMC,EAAKD,EACX,GAAIF,GAAgBG,EAAG,OAAS,SAAU,MAAO,GACjD,MAAMA,CACR,CACF,EAMaR,EAAO,CAClBG,EACAC,EAAwB,CAAA,IACb,CACX,GAAM,CAAE,aAAAC,EAAe,EAAK,EAAKD,EACjC,GAAI,CACF,OAAOE,EAAUL,EAASE,CAAI,EAAGC,CAAO,CAC1C,OAASG,EAAG,CACV,IAAMC,EAAKD,EACX,GAAIF,GAAgBG,EAAG,OAAS,SAAU,MAAO,GACjD,MAAMA,CACR,CACF,EAEMF,EAAY,CAACJ,EAAaE,IAC9BF,EAAK,OAAM,GAAMO,EAAUP,EAAME,CAAO,EAEpCK,EAAY,CAACP,EAAaE,IAAyB,CACvD,IAAMM,EAAQN,EAAQ,KAAO,QAAQ,SAAQ,EACvCO,EAAWP,EAAQ,QAAU,QAAQ,YAAW,GAAM,CAAA,EACtDQ,EAAQR,EAAQ,KAAO,QAAQ,SAAQ,GAAMO,EAAS,CAAC,EAC7D,GAAID,IAAU,QAAaE,IAAU,OACnC,MAAM,IAAI,MAAM,uBAAuB,EAGzC,IAAMC,EAAS,IAAI,IAAI,CAACD,EAAO,GAAGD,CAAQ,CAAC,EAErCG,EAAMZ,EAAK,KACXa,EAAMb,EAAK,IACXc,EAAMd,EAAK,IAEXe,EAAI,SAAS,MAAO,CAAC,EACrBC,EAAI,SAAS,MAAO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,EACT,EAEMP,EAAY,CAACL,EAAaE,EAAcC,IAC5CH,EAAK,OAAM,GAAMQ,EAAaN,EAAMC,CAAO,EC9D7C,IAAMW,EAAW,QAAQ,IAAI,uBAAyB,QAAQ,SACxDC,EAAOD,IAAa,QAAUE,EAAQC,EAK/BC,EAAQH,EAAK,MAKbI,EAAOJ,EAAK",
"names": ["posix_exports", "__export", "isexe", "sync", "statSync", "stat", "path", "options", "ignoreErrors", "checkStat", "e", "er", "checkMode", "myUid", "myGroups", "myGid", "groups", "mod", "uid", "gid", "u", "g", "o", "ug", "win32_exports", "__export", "isexe", "sync", "statSync", "stat", "delimiter", "path", "options", "ignoreErrors", "checkStat", "e", "er", "checkPathExt", "pathExt", "peSplit", "pes", "p", "ext", "platform", "impl", "win32_exports", "posix_exports", "isexe", "sync"]
}
@@ -0,0 +1,40 @@
"use client";
import { motionValue } from 'motion-dom';
import { useContext, useState, useEffect } from 'react';
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
import { useConstant } from '../utils/use-constant.mjs';
/**
* Creates a `MotionValue` to track the state and velocity of a value.
*
* Usually, these are created automatically. For advanced use-cases, like use with `useTransform`, you can create `MotionValue`s externally and pass them into the animated component via the `style` prop.
*
* ```jsx
* export const MyComponent = () => {
* const scale = useMotionValue(1)
*
* return <motion.div style={{ scale }} />
* }
* ```
*
* @param initial - The initial state.
*
* @public
*/
function useMotionValue(initial) {
const value = useConstant(() => motionValue(initial));
/**
* If this motion value is being used in static mode, like on
* the Framer canvas, force components to rerender when the motion
* value is updated.
*/
const { isStatic } = useContext(MotionConfigContext);
if (isStatic) {
const [, setLatest] = useState(initial);
useEffect(() => value.on("change", setLatest), []);
}
return value;
}
export { useMotionValue };
//# sourceMappingURL=use-motion-value.mjs.map
@@ -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 Share2 = createLucideIcon("Share2", [
["circle", { cx: "18", cy: "5", r: "3", key: "gq8acd" }],
["circle", { cx: "6", cy: "12", r: "3", key: "w7nqdw" }],
["circle", { cx: "18", cy: "19", r: "3", key: "1xt0gg" }],
["line", { x1: "8.59", x2: "15.42", y1: "13.51", y2: "17.49", key: "47mynk" }],
["line", { x1: "15.41", x2: "8.59", y1: "6.51", y2: "10.49", key: "1n3mei" }]
]);
export { Share2 as default };
//# sourceMappingURL=share-2.js.map
@@ -0,0 +1 @@
{"version":3,"file":"path.js","names":[],"sources":["../../src/path.ts"],"sourcesContent":["import { isServer } from '@tanstack/router-core/isServer'\nimport { last } from './utils'\nimport {\n SEGMENT_TYPE_OPTIONAL_PARAM,\n SEGMENT_TYPE_PARAM,\n SEGMENT_TYPE_PATHNAME,\n SEGMENT_TYPE_WILDCARD,\n parseSegment,\n} from './new-process-route-tree'\nimport type { LRUCache } from './lru-cache'\n\n/** Join path segments, cleaning duplicate slashes between parts. */\nexport function joinPaths(paths: Array<string | undefined>) {\n return cleanPath(\n paths\n .filter((val) => {\n return val !== undefined\n })\n .join('/'),\n )\n}\n\n/** Remove repeated slashes from a path string. */\nexport function cleanPath(path: string) {\n // remove double slashes\n return path.replace(/\\/{2,}/g, '/')\n}\n\n/** Trim leading slashes (except preserving root '/'). */\nexport function trimPathLeft(path: string) {\n return path === '/' ? path : path.replace(/^\\/{1,}/, '')\n}\n\n/** Trim trailing slashes (except preserving root '/'). */\nexport function trimPathRight(path: string) {\n const len = path.length\n return len > 1 && path[len - 1] === '/' ? path.replace(/\\/{1,}$/, '') : path\n}\n\n/** Trim both leading and trailing slashes. */\nexport function trimPath(path: string) {\n return trimPathRight(trimPathLeft(path))\n}\n\n/** Remove a trailing slash from value when appropriate for comparisons. */\nexport function removeTrailingSlash(value: string, basepath: string): string {\n if (value?.endsWith('/') && value !== '/' && value !== `${basepath}/`) {\n return value.slice(0, -1)\n }\n return value\n}\n\n// intended to only compare path name\n// see the usage in the isActive under useLinkProps\n// /sample/path1 = /sample/path1/\n// /sample/path1/some <> /sample/path1\n/**\n * Compare two pathnames for exact equality after normalizing trailing slashes\n * relative to the provided `basepath`.\n */\nexport function exactPathTest(\n pathName1: string,\n pathName2: string,\n basepath: string,\n): boolean {\n return (\n removeTrailingSlash(pathName1, basepath) ===\n removeTrailingSlash(pathName2, basepath)\n )\n}\n\n// When resolving relative paths, we treat all paths as if they are trailing slash\n// documents. All trailing slashes are removed after the path is resolved.\n// Here are a few examples:\n//\n// /a/b/c + ./d = /a/b/c/d\n// /a/b/c + ../d = /a/b/d\n// /a/b/c + ./d/ = /a/b/c/d\n// /a/b/c + ../d/ = /a/b/d\n// /a/b/c + ./ = /a/b/c\n//\n// Absolute paths that start with `/` short circuit the resolution process to the root\n// path.\n//\n// Here are some examples:\n//\n// /a/b/c + /d = /d\n// /a/b/c + /d/ = /d\n// /a/b/c + / = /\n//\n// Non-.-prefixed paths are still treated as relative paths, resolved like `./`\n//\n// Here are some examples:\n//\n// /a/b/c + d = /a/b/c/d\n// /a/b/c + d/ = /a/b/c/d\n// /a/b/c + d/e = /a/b/c/d/e\ninterface ResolvePathOptions {\n base: string\n to: string\n trailingSlash?: 'always' | 'never' | 'preserve'\n cache?: LRUCache<string, string>\n}\n\n/**\n * Resolve a destination path against a base, honoring trailing-slash policy\n * and supporting relative segments (`.`/`..`) and absolute `to` values.\n */\nexport function resolvePath({\n base,\n to,\n trailingSlash = 'never',\n cache,\n}: ResolvePathOptions) {\n const isAbsolute = to.startsWith('/')\n const isBase = !isAbsolute && to === '.'\n\n let key\n if (cache) {\n // `trailingSlash` is static per router, so it doesn't need to be part of the cache key\n key = isAbsolute ? to : isBase ? base : base + '\\0' + to\n const cached = cache.get(key)\n if (cached) return cached\n }\n\n let baseSegments: Array<string>\n if (isBase) {\n baseSegments = base.split('/')\n } else if (isAbsolute) {\n baseSegments = to.split('/')\n } else {\n baseSegments = base.split('/')\n while (baseSegments.length > 1 && last(baseSegments) === '') {\n baseSegments.pop()\n }\n\n const toSegments = to.split('/')\n for (let index = 0, length = toSegments.length; index < length; index++) {\n const value = toSegments[index]!\n if (value === '') {\n if (!index) {\n // Leading slash\n baseSegments = [value]\n } else if (index === length - 1) {\n // Trailing Slash\n baseSegments.push(value)\n } else {\n // ignore inter-slashes\n }\n } else if (value === '..') {\n baseSegments.pop()\n } else if (value === '.') {\n // ignore\n } else {\n baseSegments.push(value)\n }\n }\n }\n\n if (baseSegments.length > 1) {\n if (last(baseSegments) === '') {\n if (trailingSlash === 'never') {\n baseSegments.pop()\n }\n } else if (trailingSlash === 'always') {\n baseSegments.push('')\n }\n }\n\n const result = cleanPath(baseSegments.join('/')) || '/'\n if (key && cache) cache.set(key, result)\n return result\n}\n\n/**\n * Create a prLine truncated
@@ -0,0 +1,33 @@
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
export type MessageIds = 'incorrectGroupOrder' | 'incorrectOrder' | 'incorrectRequiredMembersOrder';
type ReadonlyType = 'readonly-field' | 'readonly-signature';
type MemberKind = 'accessor' | 'call-signature' | 'constructor' | 'field' | 'get' | 'method' | 'set' | 'signature' | 'static-initialization' | ReadonlyType;
type DecoratedMemberKind = 'accessor' | 'field' | 'get' | 'method' | 'set' | Exclude<ReadonlyType, 'readonly-signature'>;
type NonCallableMemberKind = Exclude<MemberKind, 'constructor' | 'readonly-signature' | 'signature'>;
type MemberScope = 'abstract' | 'instance' | 'static';
type Accessibility = '#private' | TSESTree.Accessibility;
type BaseMemberType = `${Accessibility}-${Exclude<MemberKind, 'readonly-signature' | 'signature' | 'static-initialization'>}` | `${Accessibility}-${MemberScope}-${NonCallableMemberKind}` | `${Accessibility}-decorated-${DecoratedMemberKind}` | `${MemberScope}-${NonCallableMemberKind}` | `decorated-${DecoratedMemberKind}` | MemberKind;
type MemberType = BaseMemberType | BaseMemberType[];
type AlphabeticalOrder = 'alphabetically' | 'alphabetically-case-insensitive' | 'natural' | 'natural-case-insensitive';
type Order = 'as-written' | AlphabeticalOrder;
interface SortedOrderConfig {
memberTypes?: 'never' | MemberType[];
optionalityOrder?: OptionalityOrder;
order?: Order;
}
type OrderConfig = 'never' | MemberType[] | SortedOrderConfig;
type OptionalityOrder = 'optional-first' | 'required-first';
export type Options = [
{
classes?: OrderConfig;
classExpressions?: OrderConfig;
default?: OrderConfig;
interfaces?: OrderConfig;
typeLiterals?: OrderConfig;
}
];
export declare const defaultOrder: MemberType[];
declare const _default: TSESLint.RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1,59 @@
/**
* A list of all valid MotionProps.
*
* @privateRemarks
* This doesn't throw if a `MotionProp` name is missing - it should.
*/
const validMotionProps = new Set([
"animate",
"exit",
"variants",
"initial",
"style",
"values",
"variants",
"transition",
"transformTemplate",
"custom",
"inherit",
"onBeforeLayoutMeasure",
"onAnimationStart",
"onAnimationComplete",
"onUpdate",
"onDragStart",
"onDrag",
"onDragEnd",
"onMeasureDragConstraints",
"onDirectionLock",
"onDragTransitionEnd",
"_dragX",
"_dragY",
"onHoverStart",
"onHoverEnd",
"onViewportEnter",
"onViewportLeave",
"globalTapTarget",
"propagate",
"ignoreStrict",
"viewport",
]);
/**
* Check whether a prop name is a valid `MotionProp` key.
*
* @param key - Name of the property to check
* @returns `true` is key is a valid `MotionProp`.
*
* @public
*/
function isValidMotionProp(key) {
return (key.startsWith("while") ||
(key.startsWith("drag") && key !== "draggable") ||
key.startsWith("layout") ||
key.startsWith("onTap") ||
key.startsWith("onPan") ||
key.startsWith("onLayout") ||
validMotionProps.has(key));
}
export { isValidMotionProp };
//# sourceMappingURL=valid-prop.mjs.map
@@ -0,0 +1,284 @@
<!-- LOGO -->
<div align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="media/mcp-white.svg">
<source media="(prefers-color-scheme: light)" srcset="media/mcp.svg">
<img src="media/mcp.svg" alt="MCP Apps" width="128">
</picture>
<h1>MCP Apps</h1>
<p>
Build interactive UIs for MCP tools — charts, forms, dashboards — that render inline in Claude, ChatGPT and any other compliant chat client.
<br /><br />
<a href="#why-mcp-apps">Why</a>
·
<a href="https://apps.extensions.modelcontextprotocol.io/api/documents/quickstart.html">Quickstart</a>
·
<a href="https://apps.extensions.modelcontextprotocol.io/api/">API Docs</a>
·
<a href="https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx">Spec</a>
·
<a href="CONTRIBUTING.md">Contributing</a>
</p>
</div>
<p align="center">
<a href="https://github.com/modelcontextprotocol/ext-apps/actions/workflows/ci.yml"><img src="https://github.com/modelcontextprotocol/ext-apps/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="License: Apache 2.0"></a>
<a href="https://www.npmjs.com/package/@modelcontextprotocol/ext-apps"><img src="https://img.shields.io/npm/v/@modelcontextprotocol/ext-apps.svg" alt="npm version"></a>
<a href="https://www.npmjs.com/package/@modelcontextprotocol/ext-apps"><img src="https://img.shields.io/npm/dm/@modelcontextprotocol/ext-apps.svg" alt="npm downloads"></a>
<a href="https://github.com/modelcontextprotocol/ext-apps"><img src="https://img.shields.io/github/stars/modelcontextprotocol/ext-apps" alt="GitHub stars"></a>
<a href="https://apps.extensions.modelcontextprotocol.io/api/"><img src="https://img.shields.io/badge/docs-API%20Reference-blue" alt="API Documentation"></a>
</p>
<p align="center">
<img src="media/excalidraw.gif" alt="MCP Apps demo" width="600">
<br><em>Excalidraw built with MCP Apps, running in Claude</em>
</p>
## Table of Contents
- [Build with Agent Skills](#build-with-agent-skills)
- [Supported Clients](#supported-clients)
- [Why MCP Apps?](#why-mcp-apps)
- [How It Works](#how-it-works)
- [Getting Started](#getting-started)
- [Using the SDK](#using-the-sdk)
- [Examples](#examples)
- [Specification](#specification)
- [Resources](#resources)
- [Contributing](#contributing)
## Build with Agent Skills
The fastest way to build an MCP App is to let your AI coding agent do it. This
repo ships four [Agent Skills](https://agentskills.io/) — install them once,
then just ask:
| Skill | What it does | Try it |
| --------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------- |
| [`create-mcp-app`](./plugins/mcp-apps/skills/create-mcp-app/SKILL.md) | Scaffolds a new MCP App with an interactive UI from scratch | _"Create an MCP App"_ |
| [`migrate-oai-app`](./plugins/mcp-apps/skills/migrate-oai-app/SKILL.md) | Converts an existing OpenAI App to use MCP Apps | _"Migrate from OpenAI Apps SDK"_ |
| [`add-app-to-server`](./plugins/mcp-apps/skills/add-app-to-server/SKILL.md) | Adds interactive UI to an existing MCP server's tools | _"Add UI to my MCP server"_ |
| [`convert-web-app`](./plugins/mcp-apps/skills/convert-web-app/SKILL.md) | Turns an existing web app into a hybrid web + MCP App | _"Add MCP App support to my web app"_ |
### Install the Skills
**Claude Code** — install via the plugin marketplace:
```
/plugin marketplace add modelcontextprotocol/ext-apps
/plugin install mcp-apps@modelcontextprotocol-ext-apps
```
**Other agents** — any AI coding agent that supports
[Agent Skills](https://agentskills.io/) can use these skills. See the
[agent skills guide](./docs/agent-skills.md) for manual installation
instructions.
Once installed, verify by asking your agent _"What skills do you have?"_ — you
should see `create-mcp-app`, `migrate-oai-app`, `add-app-to-server`, and
`convert-web-app` in the list. Then just ask it to create or migrate an app and
it will guide you through the rest.
## Supported Clients
<p align="center">
<a href="https://developers.openai.com/apps-sdk/mcp-apps-in-chatgpt/"><img src="https://img.shields.io/badge/ChatGPT-docs-74aa9c?logo=openai&logoColor=white" alt="ChatGPT"></a>
<a href="https://claude.com/docs/connectors/building/mcp-apps/getting-started"><img src="https://img.shields.io/badge/Claude-docs-d97706?logo=claude&logoColor=white" alt="Claude"></a>
<a href="https://code.visualstudio.com/blogs/2026/01/26/mcp-apps-support"><img src="https://img.shields.io/badge/VS_Code-docs-007ACC?logo=visualstudiocode&logoColor=white" alt="VS Code"></a>
<a href="https://block.github.io/goose/docs/tutorials/building-mcp-apps/"><img src="https://img.shields.io/badge/Goose-docs-000000?logo=goose&logoColor=white" alt="Goose"></a>
<a href="https://learning.postman.com/docs/postman-ai/mcp-requests/interact"><img src="https://img.shields.io/badge/Postman-docs-FF6C37?logo=postman&logoColor=white" alt="Postman"></a>
<a href="https://www.mcpjam.com/blog/mcp-apps-example"><img src="https://img.shields.io/badge/MCPJam-docs-8B5CF6" alt="MCPJam"></a>
<a href="https://manufact.com/inspector"><img src="https://img.shields.io/badge/mcp--use-inspector-E5F3FD" alt="mcp-use"></a>
<a href="https://docs.alpic.ai/distribution/playground"><img src="https://img.shields.io/badge/Alpic-playground-E90060?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAKlBMVEUKDhz%2F%2F%2F%2BjpaogJDFBRE%2Fw8PHHyMvh4eNmaHF1d4CUlpuFho2ztLhWWWP5YkbJAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB1klEQVR42u2Y0ZKDIAxFBQQF8f9%2FdyW7dhAu7U7Iy87mzvShGfXU3CTGLotKpVKpVCqV6h%2FI2VuxfF3tUwcdVEccA2LNS%2BWCq2mUykG%2BCtg5iNmv76mllOApCPHrFQgNxJf8HHIQs10XdFtDKcEKPQ0x4brg6htKWGr0PIR8jq0tj4oQgJiIzD8rtATErMAWMj%2FxIYcBPjuPgoENcW3Jks%2BdLeXS32jLmise%2BZxQ8GRD%2BkkCbSlByi0Pgm3p0P6nJ1meXJ%2F8K1tKo7qUOFM4wdxEMMS4iSp9sqFJQrZ4hOZBTEa5gbaQ%2BTwI%2FcCu8TOq482xIWZkSx8MfAi0xcOEJTZkULKohXjm29epGU2SIGK%2BfT9J%2Bjre%2BRBYsiUYBSHkaEI2B0EInRx%2BkbApiB89EaMgBNdx7u5vDoJH79ne3yQElqxvEzYLKY%2Bl81PCZiFUsvlDwqYhw80uSkJg4z8Ttsss3OltwgQgMGGPlpSAwITVM0wCgius6iARCGzJcn%2BHJCSMXraCIATPsPW2SggCh364a1sIgveUew%2BTgtBGsuE9zDspyLBZ3M5aVCOCUDFlqXUbrm8j7%2FnvJ2B9G3kf%2BZBlt0iu%2Fr%2BNxHqRU6lUKpVKpVL9UX0BOrAPfcbTY8UAAAAASUVORK5CYII%3D" alt="Alpic Playground"></a>
</p>
> [!NOTE]
> MCP Apps is an extension to the
> [core MCP specification](https://modelcontextprotocol.io/specification). Host
> support varies — see the
> [clients page](https://modelcontextprotocol.io/clients) for the full list.
## Why MCP Apps?
MCP tools return text and structured data. That works for many cases, but not
when you need an interactive UI, like a chart, form, design canvas or video player.
MCP Apps provide a standardized way to deliver interactive UIs from MCP servers.
Your UI renders inline in the conversation, in context, in any compliant host.
## How It Works
MCP Apps extend the Model Context Protocol by letting tools declare UI
resources:
1. **Tool definition** — Your tool declares a `ui://` resource containing its
HTML interface
2. **Tool call** — The LLM calls the tool on your server
3. **Host renders** — The host fetches the resource and displays it in a
sandboxed iframe
4. **Bidirectional communication** — The host passes tool data to the UI via
notifications, and the UI can call other tools through the host
## Getting Started
Requires Node.js 20+. The base MCP SDK packages are `^2.0.0` peers of
`ext-apps` (`@modelcontextprotocol/core` is a required peer that `client` already depends on, so npm installs it for you).
For a View or host:
```bash
npm install -S @modelcontextprotocol/ext-apps \
@modelcontextprotocol/client@^2.0.0 \
zod@^4.2.0
```
For an MCP server, add the server package (and, for HTTP transports, the Node
and Express adapters):
```bash
npm install -S @modelcontextprotocol/ext-apps \
@modelcontextprotocol/client@^2.0.0 \
@modelcontextprotocol/server@^2.0.0 \
@modelcontextprotocol/node@^2.0.0 \
@modelcontextprotocol/express@^2.0.0 \
zod@^4.2.0
```
The wire protocol is unchanged between `ext-apps` 1.x and 2.x: a 2.x View works
in a 1.x host and a 2.x host renders 1.x Views. See the
[migration guide](https://apps.extensions.modelcontextprotocol.io/api/documents/migrate-to-v2.html)
when upgrading from 1.x.
**New here?** Start with the
[Quickstart Guide](https://apps.extensions.modelcontextprotocol.io/api/documents/quickstart.html)
to build your first MCP App.
## Using the SDK
The SDK serves three roles: app developers building interactive Views, host
developers embedding those Views, and MCP server authors registering tools with
UI metadata.
| Package | Purpose | Docs |
| ------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `@modelcontextprotocol/ext-apps` | Build interactive Views (App class, PostMessageTransport) | [API Docs →](https://apps.extensions.modelcontextprotocol.io/api/modules/app.html) |
| `@modelcontextprotocol/ext-apps/react` | React hooks for Views (useApp, useHostStyles, etc.) | [API Docs →](https://apps.extensions.modelcontextprotocol.io/api/modules/_modelcontextprotocol_ext-apps_react.html) |
| `@modelcontextprotocol/ext-apps/app-bridge` | Embed and communicate with Views in your chat client | [API Docs →](https://apps.extensions.modelcontextprotocol.io/api/modules/app-bridge.html) |
| `@modelcontextprotocol/ext-apps/server` | Register tools and resources on your MCP server | [API Docs →](https://apps.extensions.modelcontextprotocol.io/api/modules/server-helpers.html) |
There's no _supported_ host implementation in this repo (beyond the
[examples/basic-host](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host)
example).
The [MCP-UI](https://github.com/idosal/mcp-ui) client SDK offers a
fully-featured MCP Apps framework used by a few hosts. Clients may choose to use
it or roll their own implementation.
## Examples
The
[`examples/`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples)
directory contains demo apps showcasing real-world use cases.
<!-- prettier-ignore-start -->
| | | |
|:---:|:---:|:---:|
| [![Map](examples/map-server/grid-cell.png "Interactive 3D globe viewer using CesiumJS")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/map-server) | [![Three.js](examples/threejs-server/grid-cell.png "Interactive 3D scene renderer")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/threejs-server) | [![ShaderToy](examples/shadertoy-server/grid-cell.png "Real-time GLSL shader renderer")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/shadertoy-server) |
| [**Map**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/map-server) | [**Three.js**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/threejs-server) | [**ShaderToy**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/shadertoy-server) |
| [![Sheet Music](examples/sheet-music-server/grid-cell.png "ABC notation to sheet music")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/sheet-music-server) | [![Wiki Explorer](examples/wiki-explorer-server/grid-cell.png "Wikipedia link graph visualization")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/wiki-explorer-server) | [![Cohort Heatmap](examples/cohort-heatmap-server/grid-cell.png "Customer retention heatmap")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/cohort-heatmap-server) |
| [**Sheet Music**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/sheet-music-server) | [**Wiki Explorer**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/wiki-explorer-server) | [**Cohort Heatmap**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/cohort-heatmap-server) |
| [![Scenario Modeler](examples/scenario-modeler-server/grid-cell.png "SaaS business projections")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/scenario-modeler-server) | [![Budget Allocator](examples/budget-allocator-server/grid-cell.png "Interactive budget allocation")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/budget-allocator-server) | [![Customer Segmentation](examples/customer-segmentation-server/grid-cell.png "Scatter chart with clustering")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/customer-segmentation-server) |
| [**Scenario Modeler**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/scenario-modeler-server) | [**Budget Allocator**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/budget-allocator-server) | [**Customer Segmentation**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/customer-segmentation-server) |
| [![System Monitor](examples/system-monitor-server/grid-cell.png "Real-time OS metrics")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/system-monitor-server) | [![Transcript](examples/transcript-server/grid-cell.png "Live speech transcription")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/transcript-server) | [![Video Resource](examples/video-resource-server/grid-cell.png "Binary video via MCP resources")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/video-resource-server) |
| [**System Monitor**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/system-monitor-server) | [**Transcript**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/transcript-server) | [**Video Resource**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/video-resource-server) |
| [![PDF Server](examples/pdf-server/grid-cell.png "Interactive PDF viewer with chunked loading")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/pdf-server) | [![QR Code](examples/qr-server/grid-cell.png "QR code generator")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/qr-server) | [![Say Demo](examples/say-server/grid-cell.png "Text-to-speech demo")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/say-server) |
| [**PDF Server**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/pdf-server) | [**QR Code (Python)**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/qr-server) | [**Say Demo**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/say-server) |
### Starter Templates
| | |
|:---:|:---|
| [![Basic](examples/basic-server-react/grid-cell.png "Starter template")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-react) | The same app built with different frameworks — pick your favorite!<br><br>[React](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-react) · [Vue](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-vue) · [Svelte](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-svelte) · [Preact](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-preact) · [Solid](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-solid) · [Vanilla JS](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-vanillajs) |
<!-- prettier-ignore-end -->
### Running the Examples
#### With basic-host
To run all examples locally using
[basic-host](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host)
(the reference host implementation included in this repo):
```bash
git clone https://github.com/modelcontextprotocol/ext-apps.git
cd ext-apps
npm install
npm start
```
Then open http://localhost:8080/.
#### With MCP Clients
Every Node.js example is published as `@modelcontextprotocol/server-<name>`. To
add one to an MCP client that supports stdio (Claude Desktop, VS Code, etc.),
use this pattern:
```json
{
"mcpServers": {
"<name>": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-<name>", "--stdio"]
}
}
}
```
For example, to add the map server: `@modelcontextprotocol/server-map`. The
Python examples (`qr-server`, `say-server`) use `uv run` instead — see their
READMEs for details.
#### Local Development
To test local modifications with an MCP client, clone the repo, install, then
point your client at a local build:
```json
{
"mcpServers": {
"<name>": {
"command": "bash",
"args": [
"-c",
"cd ~/code/ext-apps/examples/<name>-server && npm run build >&2 && node dist/index.js --stdio"
]
}
}
}
```
## Specification
<div align="center">
| Version | Status | Link |
| -------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **2026-01-26** | Stable | [specification/2026-01-26/apps.mdx](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx) |
| **draft** | Development | [specification/draft/apps.mdx](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx) |
</div>
## Resources
- [Quickstart Guide](https://apps.extensions.modelcontextprotocol.io/api/documents/quickstart.html)
- [API Documentation](https://apps.extensions.modelcontextprotocol.io/api/)
- [Specification (2026-01-26)](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx)
([Draft](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx))
- [SEP-1865 Discussion](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1865)
## Contributing
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for
guidelines on how to get started, submit pull requests, and report issues.
@@ -0,0 +1 @@
{"version":3,"file":"list-filter-plus.js","sources":["../../../src/icons/list-filter-plus.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ListFilterPlus\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTAgMThoNCIgLz4KICA8cGF0aCBkPSJNMTEgNkgzIiAvPgogIDxwYXRoIGQ9Ik0xNSA2aDYiIC8+CiAgPHBhdGggZD0iTTE4IDlWMyIgLz4KICA8cGF0aCBkPSJNNyAxMmg4IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/list-filter-plus\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 ListFilterPlus = createLucideIcon('ListFilterPlus', [\n ['path', { d: 'M10 18h4', key: '1ulq68' }],\n ['path', { d: 'M11 6H3', key: '1u26ik' }],\n ['path', { d: 'M15 6h6', key: '1jlkvy' }],\n ['path', { d: 'M18 9V3', key: 'xwwp7m' }],\n ['path', { d: 'M7 12h8', key: '7a1bxv' }],\n]);\n\nexport default ListFilterPlus;\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,CAAA,CAAiB,iBAAiB,gBAAkB,CAAA,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,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,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,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,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,44 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore `sass` may not be installed
import type DartSass from 'sass'
// @ts-ignore `sass-embedded` may not be installed
import type SassEmbedded from 'sass-embedded'
// @ts-ignore `less` may not be installed
import type Less from 'less'
// @ts-ignore `stylus` may not be installed
import type Stylus from 'stylus'
/* eslint-enable @typescript-eslint/ban-ts-comment */
// https://github.com/type-challenges/type-challenges/issues/29285
type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false
type DartSassStringOptionsAsync = DartSass.StringOptions<'async'>
type SassEmbeddedStringOptionsAsync = SassEmbedded.StringOptions<'async'>
type SassStringOptionsAsync =
IsAny<SassEmbeddedStringOptionsAsync> extends false
? SassEmbeddedStringOptionsAsync
: DartSassStringOptionsAsync
export type SassModernPreprocessBaseOptions = Omit<
SassStringOptionsAsync,
'url' | 'sourceMap'
>
export type LessPreprocessorBaseOptions = Omit<
Less.Options,
'sourceMap' | 'filename'
>
export type StylusPreprocessorBaseOptions = Omit<
Stylus.RenderOptions,
'filename'
> & { define?: Record<string, any> }
declare global {
// LESS' types somewhat references this which doesn't make sense in Node,
// so we have to shim it
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface HTMLLinkElement {}
}
@@ -0,0 +1 @@
{"version":3,"file":"authorize.js","sourceRoot":"","sources":["../../../../../src/server/auth/handlers/authorize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,gDAmBC;AAqBD,oDAiHC;AArLD,0CAA4B;AAC5B,sDAA8B;AAE9B,2DAA4E;AAC5E,uEAAiE;AACjE,4CAAsH;AAWtH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAEpE;;;;;;;;;GASG;AACH,SAAgB,kBAAkB,CAAC,SAAiB,EAAE,UAAkB;IACpE,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,GAAQ,EAAE,GAAQ,CAAC;IACvB,IAAI,CAAC;QACD,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;QACzB,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;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AAwD;YACxD,IAAI,KAAK,YAAY,sBAAU,EAAE,CAAC;gBAC9B,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,mBAAmB,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;YACvE,CAAC;iBAAM,CAAC;gBACJ,MAAM,WAAW,GAAG,IAAI,Line truncated
@@ -0,0 +1,706 @@
// The node:sqlite compatibility shim (Phase 5):
// `import { DatabaseSync } from '@appthreat/sqlite3/compat'`.
//
// A zero-dependency drop-in for code written against Node's built-in
// node:sqlite that outgrew it — when the connection is idle the mapped
// calls run on this package's synchronous fast path (parity with
// node:sqlite's speed), and the moment the application needs pools,
// sessions, streaming or cancellation it can reach through `db.native`
// for the full async surface without changing databases.
//
// What maps 1:1: open/close/isOpen/isTransaction, exec (synchronous
// multi-statement scripts), prepare + StatementSync get/all/run/iterate/
// columns/sourceSQL/expandedSQL, function/aggregate (the Phase 2
// re-entrant UDFs make these genuinely synchronous), loadExtension/
// enableLoadExtension, enableDefensive, location, prepare options
// (readBigInts, returnArrays, allowBareNamedParameters,
// allowUnknownNamedParameters, persistent — accepted, some as no-ops).
//
// Documented divergences (loud, not silent):
// - setAuthorizer() throws: this package's authorizer is a declarative
// C++ rule list by design (no JavaScript on the prepare path); reach
// through `db.native.authorizer(policy)` for the supported form.
// - createSession()/applyChangeset() keep this package's async
// signatures (they return promises) — node:sqlite's sync ones have no
// equivalent on the sync fast path.
// - serialize() returns the bytes asynchronously.
// - StatementSync.close() finalizes asynchronously under the hood; the
// statement is unusable immediately after. DatabaseSync.close() is the
// same shape: it finalizes the statements prepared through it (as
// node:sqlite does) and starts the close — the connection is unusable
// at once, the handle is released on the queue. Use `await db[Symbol.
// asyncDispose]()`, or `await db.native.close()`, when the close must
// have completed (deleting the file, reopening it on Windows). A close
// that fails anyway — a statement prepared directly on `db.native`
// holds the connection — is reported on the connection's 'error'
// event, never discarded.
// - StatementSync.iterate() materialises the rows before yielding: the
// sync fast path has no mid-cursor suspension. Use
// `db.native.iterate()` for a true streaming cursor.
// - setReadBigInts() after prepare() applies to lastInsertRowid;
// integer *columns* are read in the mode fixed at prepare time, so
// pass `{ readBigInts: true }` to prepare() (or re-prepare) to change
// how rows are read.
import sqlite3 from './sqlite3.js';
/**
* Splits one SQL script into complete statements, using sqlite3_complete
* (via the binding's `complete()`) to find statement boundaries — quotes,
// comments and trigger bodies included. The trailing remainder (an
* incomplete final statement) is kept and will fail loudly on run.
*
* @param {string} sql the script.
* @returns {string[]} the complete statements.
* @private
*/
function splitScript(sql) {
/** @type {string[]} */
const statements = [];
let current = '';
let i = 0;
while (i < sql.length) {
const ch = sql[i];
current += ch;
i++;
if (ch === ';') {
const candidate = current.trim();
if (candidate.length > 0 && sqlite3.complete(candidate)) {
statements.push(candidate);
current = '';
}
}
}
const rest = current.trim();
if (rest.length > 0) {
// An unterminated tail: run it through complete() to fail with
// sqlite's own message rather than dropping it silently.
statements.push(rest);
}
return statements;
}
/**
* A prepared statement in the node:sqlite shape, wrapping this package's
* synchronous fast path.
*
* @since 9.1.0
*/
class StatementSync {
/** @type {import('./sqlite3-binding.js').Statement} */
#stmt;
#readBigInts;
#returnArrays;
/** @type {(mode: 'number' | 'bigint') => import('./sqlite3-binding.js').Statement} */
#reprepare;
/** @type {(stmt: StatementSync) => void} */
#onClose;
/**
* @param {import('./sqlite3-binding.js').Statement} stmt the wrapped statement.
* @param {{ readBigInts?: boolean, returnArrays?: boolean }} options
* @param {(mode: 'number' | 'bigint') => import('./sqlite3-binding.js').Statement} [reprepare]
* re-prepares the same SQL under another integer mode, for
* setReadBigInts (the mode belongs to the prepared statement).
* @param {(stmt: StatementSync) => void} [onClose] tells the owning
* connection this statement no longer needs finalizing at close.
*/
constructor(stmt, options, reprepare, onClose) {
this.#stmt = stmt;
this.#readBigInts = options?.readBigInts === true;
this.#returnArrays = options?.returnArrays === true;
this.#reprepare =
reprepare ??
(() => {
throw new Error(
'setReadBigInts() cannot re-prepare this statement',
);
});
this.#onClose =
onClose ??
(() => {
// Unowned statement: nobody is tracking it for close.
});
}
/**
* True once finalized (explicitly or through dispose).
*
* @returns {boolean} finalized.
*/
get finalized() {
return this.#stmt.finalized;
}
/**
* The statement's SQL text.
*
* @returns {string} the SQL.
*/
get sourceSQL() {
return /** @type {string} */ (this.#stmt.sql);
}
/**
* The SQL with the most recent bound values substituted.
*
* @returns {string} the expanded SQL.
*/
get expandedSQL() {
return /** @type {string} */ (this.#stmt.expandedSQL);
}
/**
* The statement's result columns.
*
* @returns {{ name: string, database?: string, table?: string, column?: string, type?: string }[]}
* the column descriptors.
*/
columns() {
// node:sqlite names the origin column `column`; this package's
// native accessor calls it `origin`.
const native = /** @type {any[]} */ (this.#stmt.columns) ?? [];
return native.map(({ origin, ...rest }) =>
origin === undefined ? rest : { ...rest, column: origin },
);
}
/**
* The bind arguments for one call: node:sqlite re-executes a
* statement called again with no parameters (this package's statement
* cursor semantics otherwise continue), so an explicit empty bind
* forces the reset.
*
* @param {unknown[]} params
* @returns {unknown[]}
*/
#bindArgs(params) {
// Only a zero-parameter statement can be safely re-executed with
// an explicit empty bind (which forces the reset); a parameterful
// statement called without arguments keeps this package's
// re-bind-with-last-values semantics.
if (params.length === 0 && this.#stmt.parameterCount === 0) {
return [[]];
}
return params;
}
/**
* @param {unknown[]} params
* @returns {unknown[]}
*/
#rowModeOption(params) {
return this.#returnArrays ? [...params, { rowMode: 'array' }] : params;
}
/**
* Steps once and returns the first row (or undefined).
*
* @param {...unknown} params bind parameters.
* @returns {any} the row.
*/
get(...params) {
return this.#stmt.getSync(
...this.#rowModeOption(this.#bindArgs(params)),
);
}
/**
* Steps to completion and returns every row.
*
* @param {...unknown} params bind parameters.
* @returns {any[]} the rows.
*/
all(...params) {
return this.#stmt.allSync(
...this.#rowModeOption(this.#bindArgs(params)),
);
}
/**
* Runs the statement, returning `{ changes, lastInsertRowid }`.
*
* @param {...unknown} params bind parameters.
* @returns {{ changes: number | bigint, lastInsertRowid: number | bigint }} the run result.
*/
run(...params) {
this.#stmt.runSync(...this.#bindArgs(params));
return {
changes: this.#stmt.changes,
lastInsertRowid: this.#readBigInts
? this.#stmt.lastIDBigInt
: this.#stmt.lastID,
};
}
/**
* A synchronous iterator over the rows. Divergence: the rows are
* materialised first (the sync fast path has no mid-cursor
* suspension), so this costs the memory of the whole result — reach
* for `db.native.iterate()` when that matters.
*
* @param {...unknown} params bind parameters.
* @returns {IterableIterator<any>} the rows.
*/
*iterate(...params) {
yield* this.all(...params);
}
/**
* Sets whether integers read as BigInt (node:sqlite's toggle). The
* integer mode belongs to the prepared statement here, so this
* re-prepares the same SQL under the new mode — column values follow
* the setting, as they do in node:sqlite, rather than only
* `lastInsertRowid`.
*
* @param {boolean} value the new setting.
* @returns {void}
*/
setReadBigInts(value) {
const next = value === true;
if (next === this.#readBigInts) return;
const replacement = this.#reprepare(next ? 'bigint' : 'number');
const previous = this.#stmt;
this.#stmt = replacement;
this.#readBigInts = next;
if (!previous.finalized) {
previous.finalize(function () {
/* best effort: the replacement is live */
});
}
}
/**
* Sets whether rows are arrays (node:sqlite's toggle).
*
* @param {boolean} value the new setting.
* @returns {void}
*/
setReturnArrays(value) {
this.#returnArrays = value === true;
}
/**
* Finalizes the statement. Accepted for shape parity; the underlying
* finalize is asynchronous (queued), and the statement is unusable
* immediately.
*
* @returns {void}
*/
close() {
if (!this.#stmt.finalized) {
this.#stmt.finalize(function () {
/* best effort */
});
}
this.#onClose(this);
}
/**
* `using` support.
*
* @returns {void}
*/
[Symbol.dispose]() {
this.close();
}
}
/**
* A connection in the node:sqlite `DatabaseSync` shape, mapping onto this
* package's synchronous fast path.
*
* @since 9.1.0
* @example
* import { DatabaseSync } from '@appthreat/sqlite3/compat';
* const db = new DatabaseSync(':memory:');
* db.exec('CREATE TABLE t (a)');
* const stmt = db.prepare('SELECT * FROM t WHERE a = ?');
* const row = stmt.get(1);
* db.close();
*/
class DatabaseSync {
/** @type {import('./sqlite3-binding.js').Database} */
#db;
#allowExtension = false;
// Statements prepared through this connection and not yet closed.
// node:sqlite finalizes outstanding statements when the database
// closes, and code written against it relies on that: this package's
// close() instead fails with SQLITE_BUSY ("unable to close due to
// unfinalized statements") while one is live, so without this the
// connection would simply never close. Weakly held, because a
// statement nobody kept a reference to is finalized by GC on its own
// and pinning it here would be the leak the tracking is meant to
// avoid.
/** @type {Set<WeakRef<StatementSync>>} */
#statements = new Set();
/** @type {FinalizationRegistry<WeakRef<StatementSync>>} */
#collected = new FinalizationRegistry((ref) => {
this.#statements.delete(ref);
});
/**
* Opens a connection. Options map onto this package's opens and
* configure() calls: `readOnly`, `open` (default true),
* `enableForeignKeyConstraints` (default true, node:sqlite's own
* default), `enableDoubleQuotedStringLiterals` (refused: this
* package keeps strict SQL), `allowExtension`, `timeout`.
*
* @param {string} location the database filename or `:memory:`.
* @param {{ readOnly?: boolean, open?: boolean, enableForeignKeyConstraints?: boolean, allowExtension?: boolean, timeout?: number }} [options]
*/
constructor(location, options = {}) {
const known = new Set([
'readOnly',
'open',
'enableForeignKeyConstraints',
'enableDoubleQuotedStringLiterals',
'allowExtension',
'timeout',
]);
for (const key of Object.keys(options)) {
if (!known.has(key)) {
throw new TypeError(
`DatabaseSync received unknown option '${key}'`,
);
}
}
if (options.open === false) {
throw new TypeError(
"DatabaseSync option 'open: false' has no equivalent; " +
'open the connection when ready instead',
);
}
if (options.enableDoubleQuotedStringLiterals === true) {
throw new TypeError(
'DatabaseSync cannot enable double-quoted string ' +
'literals: this package deliberately keeps strict SQL',
);
}
const mode =
options.readOnly === true
? sqlite3.OPEN_READONLY
: sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE;
// syncOpen: the native synchronous open (node:sqlite's semantics —
// the connection is usable the moment the constructor returns).
this.#db = new sqlite3.Database(location, { mode, syncOpen: true });
if (options.timeout !== undefined) {
this.#db.configure('busyTimeout', options.timeout);
}
this.#allowExtension = options.allowExtension === true;
if (options.enableForeignKeyConstraints !== false) {
this.#db.runSync('PRAGMA foreign_keys = ON');
}
}
/**
* The underlying connection, for reaching the full async surface
* (pools, sessions, streaming, cancellation) without a second open.
*
* @returns {import('./sqlite3-binding.js').Database} the connection.
*/
get native() {
return this.#db;
}
/**
* True while open.
*
* @returns {boolean} open.
*/
get open() {
return this.#db.open;
}
/**
* Alias of {@link DatabaseSync.open} (node:sqlite's name).
*
* @returns {boolean} open.
*/
get isOpen() {
return this.#db.open;
}
/**
* True inside an explicit transaction.
*
* @returns {boolean} in transaction.
*/
get isTransaction() {
return this.#db.inTransaction;
}
/**
* Runs a SQL script (possibly several statements) synchronously.
* Returns undefined, like node:sqlite's exec.
*
* @param {string} sql the script.
* @returns {undefined}
*/
exec(sql) {
if (typeof sql !== 'string') {
throw new TypeError('exec() requires a SQL string');
}
for (const statement of splitScript(sql)) {
this.#db.runSync(statement);
}
return undefined;
}
/**
* Prepares a statement synchronously.
*
* @param {string} sql the SQL.
* @param {{ readBigInts?: boolean, returnArrays?: boolean, allowBareNamedParameters?: boolean, allowUnknownNamedParameters?: boolean, persistent?: boolean }} [options]
* `readBigInts`/`returnArrays` map onto this package's per-call
* row shapes; the remaining options are accepted for shape parity
* (bare named parameters are always allowed here, unknown named
* parameters always refused — this package's strictness).
* @returns {StatementSync} the statement.
*/
prepare(sql, options = {}) {
const known = new Set([
'readBigInts',
'returnArrays',
'allowBareNamedParameters',
'allowUnknownNamedParameters',
'persistent',
]);
for (const key of Object.keys(options)) {
if (!known.has(key)) {
throw new TypeError(
`prepare() received unknown option '${key}'`,
);
}
}
/** @param {'number' | 'bigint'} [mode] */
const prepare = (mode) =>
this.#db.prepareSync(sql, { integerMode: mode });
const stmt = prepare(
options.readBigInts === true ? 'bigint' : undefined,
);
/** @type {StatementSync} */
const wrapper = new StatementSync(stmt, options, prepare, (closed) =>
this.#forget(closed),
);
const ref = new WeakRef(wrapper);
this.#statements.add(ref);
this.#collected.register(wrapper, ref, wrapper);
return wrapper;
}
/**
* Drops a statement from the close-time finalize list.
*
* @param {StatementSync} stmt the statement that closed itself.
* @returns {void}
*/
#forget(stmt) {
this.#collected.unregister(stmt);
for (const ref of this.#statements) {
const live = ref.deref();
if (live === undefined || live === stmt)
this.#statements.delete(ref);
}
}
/**
* Finalizes every statement still open on this connection, so that
* the close below is not refused with SQLITE_BUSY.
*
* @returns {void}
*/
#finalizeStatements() {
for (const ref of this.#statements) {
const stmt = ref.deref();
if (stmt !== undefined && !stmt.finalized) {
// One statement refusing to finalize must not strand the
// rest — or the close.
try {
stmt.close();
} catch {
/* keep going; close() reports what it cannot do */
}
}
}
this.#statements.clear();
}
/**
* Registers a scalar SQL function (synchronous, via the re-entrant
* direct-call path).
*
* @param {string} name the SQL name.
* @param {((...args: unknown[]) => unknown) | { deterministic?: boolean, directOnly?: boolean, varargs?: boolean }} [options]
* the options object, or the implementation directly.
* @param {(...args: unknown[]) => unknown} [fn] the implementation.
* @returns {void}
*/
function(name, options, fn) {
/** @type {any} */ (this.#db).function(name, options, fn);
}
/**
* Registers an aggregate (or window, with `inverse`) SQL function.
*
* @param {string} name the SQL name.
* @param {{ start: () => unknown, step: (acc: unknown, ...args: unknown[]) => unknown, result: (acc: unknown) => unknown, inverse?: (acc: unknown, ...args: unknown[]) => unknown, deterministic?: boolean, varargs?: boolean }} spec
* the implementation.
* @returns {void}
*/
aggregate(name, spec) {
/** @type {any} */ (this.#db).aggregate(name, spec);
}
/**
* Loads a SQLite extension.
*
* @param {string} path the extension file.
* @param {string} [entryPoint] the optional entry point.
* @returns {void}
*/
loadExtension(path, entryPoint) {
if (!this.#allowExtension) {
throw new Error(
'DatabaseSync.loadExtension() requires allowExtension: ' +
'true at construction (node:sqlite has the same gate)',
);
}
if (entryPoint !== undefined) {
throw new TypeError(
'loadExtension entryPoint is not supported; the extension ' +
'must use its default entry point',
);
}
this.#db.loadExtension(path, function () {
/* sync-shaped: completes on the queue */
});
}
/**
* No-op gate (the allowExtension constructor option is the real
* gate), kept for node:sqlite's shape.
*
* @param {boolean} allow the new setting.
* @returns {void}
*/
enableLoadExtension(allow) {
this.#allowExtension = allow === true;
}
/**
* Toggles SQLite defensive mode.
*
* @param {boolean} active the new state.
* @returns {void}
*/
enableDefensive(active) {
this.#db.dbConfig(sqlite3.DBCONFIG_DEFENSIVE, active === true);
}
/**
* The filesystem path of an attached database, or null for an
* in-memory or temporary one (node:sqlite's shape; this package's own
* `location()` returns the empty string there).
*
* @param {string} [dbName] the attached name.
* @returns {string | null} the path.
*/
location(dbName) {
const path = this.#db.location(dbName);
return path === '' ? null : path;
}
/**
* Not available: this package's authorizer is declarative (a C++ rule
* list — no JavaScript runs on the prepare path, by design). Use
* `db.native.authorizer(policy)`.
*
* @returns {never}
*/
setAuthorizer() {
throw new Error(
'DatabaseSync.setAuthorizer() is not available: this ' +
"package's authorizer is declarative (a C++ rule list, no " +
'JavaScript on the prepare path). Reach through ' +
'db.native.authorizer(policy) for the supported form',
);
}
/**
* Creates a changeset-recording session. Divergence: this package's
* sessions are asynchronous, so the returned session's methods return
* promises (node:sqlite's are synchronous).
*
* @param {{ table?: string }} [options]
* @returns {import('./sqlite3-binding.js').Session} the session.
*/
createSession(options = {}) {
return this.#db.session(options);
}
/**
* Applies a changeset (asynchronous here; see createSession).
*
* @param {Uint8Array} changeset the bytes.
* @param {import('./native.js').ApplyChangesetOptions} [options]
* @returns {Promise<void>} resolves once applied.
*/
applyChangeset(changeset, options) {
return this.#db.applyChangeset(changeset, options);
}
/**
* Serializes the database (asynchronous here).
*
* @returns {Promise<Uint8Array>} the bytes.
*/
async serialize() {
return this.#db.serializeToBytes();
}
/**
* Closes the connection, finalizing any statement prepared through it
* that is still open — node:sqlite's semantics, and required here:
* this package refuses to close a connection holding an unfinalized
* statement (`SQLITE_BUSY: unable to close due to unfinalized
* statements`).
*
* Divergence: the close is queued (this package's close is
* asynchronous), so the connection refuses further work at once but
* the file handle is released a turn later — use `await using` /
* `Symbol.asyncDispose`, or `await db.native.close()`, when a caller
* must know the file is free, e.g. before deleting or reopening it on
* Windows. A close that still fails (a statement prepared directly on
* `db.native`, say) is reported on the connection's `'error'` event
* rather than discarded; with no listener attached that surfaces as an
* uncaught error, which is the point — the connection stayed open.
*
* @returns {void}
*/
close() {
if (this.#db.open) {
this.#finalizeStatements();
const db = this.#db;
db.close((err) => {
if (err) db.emit('error', err);
});
}
}
/**
* `await using` support: finalizes outstanding statements, then waits
* for the close to complete (unlike {@link DatabaseSync.close}, which
* only starts it).
*
* @returns {Promise<void>} resolves once closed.
*/
async [Symbol.asyncDispose]() {
if (this.#db.open) {
this.#finalizeStatements();
await this.#db.close();
}
}
}
export { DatabaseSync, StatementSync };
@@ -0,0 +1,7 @@
import { __assign } from "tslib";
import * as React from 'react';
import { RemoveScroll } from './UI';
import SideCar from './sidecar';
var ReactRemoveScroll = React.forwardRef(function (props, ref) { return (React.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: SideCar }))); });
ReactRemoveScroll.classNames = RemoveScroll.classNames;
export default ReactRemoveScroll;
@@ -0,0 +1,18 @@
//#region src/client/env.ts
const context = (() => {
if (typeof globalThis !== "undefined") return globalThis;
else if (typeof self !== "undefined") return self;
else if (typeof window !== "undefined") return window;
else return Function("return this")();
})();
const defines = __DEFINES__;
Object.keys(defines).forEach((key) => {
const segments = key.split(".");
let target = context;
for (let i = 0; i < segments.length; i++) {
const segment = segments[i];
if (i === segments.length - 1) target[segment] = defines[key];
else target = target[segment] || (target[segment] = {});
}
});
//#endregion
@@ -0,0 +1,516 @@
// import { $ZodType } from "./schemas.js";
import * as core from "./core.js";
import * as regexes from "./regexes.js";
import * as util from "./util.js";
export const $ZodCheck = /*@__PURE__*/ core.$constructor("$ZodCheck", (inst, def) => {
var _a;
inst._zod ?? (inst._zod = {});
inst._zod.def = def;
(_a = inst._zod).onattach ?? (_a.onattach = []);
});
/** Default `when` for size-based checks: run only on non-nullish values with a `size`. */
const _whenHasSize = (payload) => {
const val = payload.value;
return !util.nullish(val) && val.size !== undefined;
};
/** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
const _whenHasLength = (payload) => {
const val = payload.value;
return !util.nullish(val) && val.length !== undefined;
};
const numericOriginMap = {
number: "number",
bigint: "bigint",
object: "date",
};
export const $ZodCheckLessThan = /*@__PURE__*/ core.$constructor("$ZodCheckLessThan", (inst, def) => {
$ZodCheck.init(inst, def);
const origin = numericOriginMap[typeof def.value];
inst._zod.check = (payload) => {
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
return;
}
payload.issues.push({
origin: numericOriginMap[typeof payload.value] ?? origin,
code: "too_big",
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
input: payload.value,
inclusive: def.inclusive,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckGreaterThan = /*@__PURE__*/ core.$constructor("$ZodCheckGreaterThan", (inst, def) => {
$ZodCheck.init(inst, def);
const origin = numericOriginMap[typeof def.value];
inst._zod.check = (payload) => {
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
return;
}
payload.issues.push({
origin: numericOriginMap[typeof payload.value] ?? origin,
code: "too_small",
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
input: payload.value,
inclusive: def.inclusive,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckMultipleOf =
/*@__PURE__*/ core.$constructor("$ZodCheckMultipleOf", (inst, def) => {
$ZodCheck.init(inst, def);
inst._zod.check = (payload) => {
if (typeof payload.value !== typeof def.value)
throw new Error("Cannot mix number and bigint in multiple_of check.");
const isMultiple = typeof payload.value === "bigint"
? // `value % 0n` throws, and nothing is a multiple of zero — the number branch already fails this way via NaN
def.value !== BigInt(0) && payload.value % def.value === BigInt(0)
: util.floatSafeRemainder(payload.value, def.value) === 0;
if (isMultiple)
return;
payload.issues.push({
origin: typeof payload.value,
code: "not_multiple_of",
divisor: def.value,
input: payload.value,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckNumberFormat = /*@__PURE__*/ core.$constructor("$ZodCheckNumberFormat", (inst, def) => {
$ZodCheck.init(inst, def); // no format checks
def.format = def.format || "float64";
const isInt = def.format?.includes("int");
const origin = isInt ? "int" : "number";
const [minimum, maximum] = util.NUMBER_FORMAT_RANGES[def.format];
inst._zod.check = (payload) => {
const input = payload.value;
if (isInt) {
if (!Number.isInteger(input)) {
// invalid_format issue
// payload.issues.push({
// expected: def.format,
// format: def.format,
// code: "invalid_format",
// input,
// inst,
// });
// invalid_type issue
payload.issues.push({
expected: origin,
format: def.format,
code: "invalid_type",
continue: false,
input,
inst,
});
return;
// not_multiple_of issue
// payload.issues.push({
// code: "not_multiple_of",
// origin: "number",
// input,
// inst,
// divisor: 1,
// });
}
if (!Number.isSafeInteger(input)) {
if (input > 0) {
// too_big
payload.issues.push({
input,
code: "too_big",
maximum: Number.MAX_SAFE_INTEGER,
note: "Integers must be within the safe integer range.",
inst,
origin,
inclusive: true,
continue: !def.abort,
});
}
else {
// too_small
payload.issues.push({
input,
code: "too_small",
minimum: Number.MIN_SAFE_INTEGER,
note: "Integers must be within the safe integer range.",
inst,
origin,
inclusive: true,
continue: !def.abort,
});
}
return;
}
}
if (input < minimum) {
payload.issues.push({
origin: "number",
input,
code: "too_small",
minimum,
inclusive: true,
inst,
continue: !def.abort,
});
}
if (input > maximum) {
payload.issues.push({
origin: "number",
input,
code: "too_big",
maximum,
inclusive: true,
inst,
continue: !def.abort,
});
}
};
});
export const $ZodCheckBigIntFormat = /*@__PURE__*/ core.$constructor("$ZodCheckBigIntFormat", (inst, def) => {
$ZodCheck.init(inst, def); // no format checks
const [minimum, maximum] = util.BIGINT_FORMAT_RANGES[def.format];
inst._zod.check = (payload) => {
const input = payload.value;
if (input < minimum) {
payload.issues.push({
origin: "bigint",
input,
code: "too_small",
minimum: minimum,
inclusive: true,
inst,
continue: !def.abort,
});
}
if (input > maximum) {
payload.issues.push({
origin: "bigint",
input,
code: "too_big",
maximum,
inclusive: true,
inst,
continue: !def.abort,
});
}
};
});
export const $ZodCheckMaxSize = /*@__PURE__*/ core.$constructor("$ZodCheckMaxSize", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = _whenHasSize);
inst._zod.check = (payload) => {
const input = payload.value;
const size = input.size;
if (size <= def.maximum)
return;
payload.issues.push({
origin: util.getSizableOrigin(input),
code: "too_big",
maximum: def.maximum,
inclusive: true,
input,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckMinSize = /*@__PURE__*/ core.$constructor("$ZodCheckMinSize", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = _whenHasSize);
inst._zod.check = (payload) => {
const input = payload.value;
const size = input.size;
if (size >= def.minimum)
return;
payload.issues.push({
origin: util.getSizableOrigin(input),
code: "too_small",
minimum: def.minimum,
inclusive: true,
input,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckSizeEquals = /*@__PURE__*/ core.$constructor("$ZodCheckSizeEquals", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = _whenHasSize);
inst._zod.check = (payload) => {
const input = payload.value;
const size = input.size;
if (size === def.size)
return;
const tooBig = size > def.size;
payload.issues.push({
origin: util.getSizableOrigin(input),
...(tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size }),
inclusive: true,
exact: true,
input: payload.value,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckMaxLength = /*@__PURE__*/ core.$constructor("$ZodCheckMaxLength", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
inst._zod.check = (payload) => {
const input = payload.value;
const units = input.length;
// Strings are measured in Unicode code points, not UTF-16 units. A code point is at most two units, so a string that already fits in units fits in code points; only an overflow has to be counted.
const length = typeof input === "string" && units > def.maximum ? util.codePointLength(input) : units;
if (length <= def.maximum)
return;
const origin = util.getLengthableOrigin(input);
payload.issues.push({
origin,
code: "too_big",
maximum: def.maximum,
inclusive: true,
input,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckMinLength = /*@__PURE__*/ core.$constructor("$ZodCheckMinLength", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
inst._zod.check = (payload) => {
const input = payload.value;
const units = input.length;
// A code point is one or two UTF-16 units, so fewer units than the floor can never reach it and twice the floor always clears it. Only in between is the exact count in doubt.
const length = typeof input === "string" && units >= def.minimum && units < def.minimum * 2
? util.codePointLength(input)
: units;
if (length >= def.minimum)
return;
const origin = util.getLengthableOrigin(input);
payload.issues.push({
origin,
code: "too_small",
minimum: def.minimum,
inclusive: true,
input,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckLengthEquals = /*@__PURE__*/ core.$constructor("$ZodCheckLengthEquals", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
inst._zod.check = (payload) => {
const input = payload.value;
const units = input.length;
// A code point is one or two UTF-16 units, so outside `[length, length * 2]` units the target is missed either way — and missed in the same direction in both measures.
const length = typeof input === "string" && units >= def.length && units <= def.length * 2
? util.codePointLength(input)
: units;
if (length === def.length)
return;
const origin = util.getLengthableOrigin(input);
const tooBig = length > def.length;
payload.issues.push({
origin,
...(tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length }),
inclusive: true,
exact: true,
input: payload.value,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckStringFormat = /*@__PURE__*/ core.$constructor("$ZodCheckStringFormat", (inst, def) => {
var _a, _b;
$ZodCheck.init(inst, def);
if (def.pattern)
(_a = inst._zod).check ?? (_a.check = (payload) => {
def.pattern.lastIndex = 0;
if (def.pattern.test(payload.value))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: def.format,
input: payload.value,
...(def.pattern ? { pattern: def.pattern.toString() } : {}),
inst,
continue: !def.abort,
});
});
else
(_b = inst._zod).check ?? (_b.check = () => { });
});
export const $ZodCheckRegex = /*@__PURE__*/ core.$constructor("$ZodCheckRegex", (inst, def) => {
$ZodCheckStringFormat.init(inst, def);
inst._zod.check = (payload) => {
def.pattern.lastIndex = 0;
if (def.pattern.test(payload.value))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "regex",
input: payload.value,
pattern: def.pattern.toString(),
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckLowerCase = /*@__PURE__*/ core.$constructor("$ZodCheckLowerCase", (inst, def) => {
def.pattern ?? (def.pattern = regexes.lowercase);
$ZodCheckStringFormat.init(inst, def);
});
export const $ZodCheckUpperCase = /*@__PURE__*/ core.$constructor("$ZodCheckUpperCase", (inst, def) => {
def.pattern ?? (def.pattern = regexes.uppercase);
$ZodCheckStringFormat.init(inst, def);
});
export const $ZodCheckIncludes = /*@__PURE__*/ core.$constructor("$ZodCheckIncludes", (inst, def) => {
$ZodCheck.init(inst, def);
const escapedRegex = util.escapeRegex(def.includes);
// `String.prototype.includes(sub, position)` matches `sub` at `position`
// OR LATER, so the pattern must allow at least `position` leading chars
// (`{N,}`), not exactly `position` chars (`{N}`).
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
def.pattern = pattern;
inst._zod.check = (payload) => {
if (payload.value.includes(def.includes, def.position))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "includes",
includes: def.includes,
input: payload.value,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckStartsWith = /*@__PURE__*/ core.$constructor("$ZodCheckStartsWith", (inst, def) => {
$ZodCheck.init(inst, def);
const pattern = new RegExp(`^${util.escapeRegex(def.prefix)}.*`);
def.pattern ?? (def.pattern = pattern);
inst._zod.check = (payload) => {
if (payload.value.startsWith(def.prefix))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "starts_with",
prefix: def.prefix,
input: payload.value,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckEndsWith = /*@__PURE__*/ core.$constructor("$ZodCheckEndsWith", (inst, def) => {
$ZodCheck.init(inst, def);
const pattern = new RegExp(`.*${util.escapeRegex(def.suffix)}$`);
def.pattern ?? (def.pattern = pattern);
inst._zod.check = (payload) => {
if (payload.value.endsWith(def.suffix))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "ends_with",
suffix: def.suffix,
input: payload.value,
inst,
continue: !def.abort,
});
};
});
///////////////////////////////////
///// $ZodCheckProperty /////
///////////////////////////////////
function handleCheckPropertyResult(result, payload, property) {
if (result.issues.length) {
payload.issues.push(...util.prefixIssues(property, result.issues));
}
}
export const $ZodCheckProperty = /*@__PURE__*/ core.$constructor("$ZodCheckProperty", (inst, def) => {
$ZodCheck.init(inst, def);
inst._zod.check = (payload) => {
const result = def.schema._zod.run({
value: payload.value[def.property],
issues: [],
}, {});
if (result instanceof Promise) {
return result.then((result) => handleCheckPropertyResult(result, payload, def.property));
}
handleCheckPropertyResult(result, payload, def.property);
return;
};
});
export const $ZodCheckProperties = /*@__PURE__*/ core.$constructor("$ZodCheckProperties", (inst, def) => {
$ZodCheck.init(inst, def);
util.hide(inst, Symbol.iterator, function* () {
yield inst;
});
// key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
let entries;
inst._zod.check = (payload) => {
// the base schema already typed the value, so only a nullish one is rejected here: the properties read on a primitive too, matching z.property() on a string's length
if (payload.value == null) {
payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
return undefined;
}
entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
const input = payload.value;
let proms;
for (const [key, schema] of entries) {
const result = schema._zod.run({ value: input[key], issues: [] }, {});
if (result instanceof Promise) {
proms ?? (proms = []);
proms.push(result.then((result) => handleCheckPropertyResult(result, payload, key)));
}
else {
handleCheckPropertyResult(result, payload, key);
}
}
if (proms)
return Promise.all(proms).then(() => undefined);
return undefined;
};
});
export const $ZodCheckMimeType = /*@__PURE__*/ core.$constructor("$ZodCheckMimeType", (inst, def) => {
$ZodCheck.init(inst, def);
const mimeSet = new Set(def.mime);
inst._zod.check = (payload) => {
if (mimeSet.has(payload.value.type))
return;
payload.issues.push({
code: "invalid_value",
values: def.mime,
input: payload.value.type,
inst,
continue: !def.abort,
});
};
});
export const $ZodCheckOverwrite = /*@__PURE__*/ core.$constructor("$ZodCheckOverwrite", (inst, def) => {
$ZodCheck.init(inst, def);
inst._zod.check = (payload) => {
payload.value = def.tx(payload.value);
};
});
@@ -0,0 +1,41 @@
import {SourceSpan} from './logger';
/**
* An exception thrown because a Sass compilation failed.
*
* @category Other
*/
export class Exception extends Error {
private constructor();
/**
* A human-friendly representation of the exception.
*
* Because many tools simply print `Error.message` directly, this includes not
* only the textual description of what went wrong (the {@link sassMessage})
* but also an indication of where in the Sass stylesheet the error occurred
* (the {@link span}) and the Sass stack trace at the point of error (the
* {@link sassStack}).
*/
message: string;
/**
* A textual description of what went wrong.
*
* Unlike {@link message}, this does *not* include representations of {@link
* span} or {@link sassStack}.
*/
readonly sassMessage: string;
/**
* A human-friendly representation of the Sass stack trace at the point of
* error.
*/
readonly sassStack: string;
/** The location the error occurred in the Sass file that triggered it. */
readonly span: SourceSpan;
/** Returns the same string as {@link message}. */
toString(): string;
}
@@ -0,0 +1,15 @@
/**
* @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 Dot = createLucideIcon("Dot", [
["circle", { cx: "12.1", cy: "12.1", r: "1", key: "18d7e5" }]
]);
export { Dot as default };
//# sourceMappingURL=dot.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_RE","2":"_x"},C:{"1":"_yL","2":"_UK"},D:{"1":"_TI","2":"_9J"},E:{"2":"_KC _GQ _zM ZC _DE _xK","129":"mC","194":"_6H QD","257":"_uC"},F:{"1":"_6G","2":"_QK"},G:{"2":"_EB _iL _XG","129":"lD","194":"_lC _FF","257":"_7B"},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:1,C:"navigator.hardwareConcurrency",D:true};
@@ -0,0 +1,11 @@
"use strict";
module.exports = function (it) {
const { pluginName } = it;
return `
ESLint couldn't find the plugin "${pluginName}". because there is whitespace in the name. Please check your configuration and remove all whitespace from the plugin name.
If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.
`.trimStart();
};
@@ -0,0 +1,22 @@
/**
* @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 GlassWater = createLucideIcon("GlassWater", [
[
"path",
{
d: "M5.116 4.104A1 1 0 0 1 6.11 3h11.78a1 1 0 0 1 .994 1.105L17.19 20.21A2 2 0 0 1 15.2 22H8.8a2 2 0 0 1-2-1.79z",
key: "p55z4y"
}
],
["path", { d: "M6 12a5 5 0 0 1 6 0 5 5 0 0 0 6 0", key: "mjntcy" }]
]);
export { GlassWater as default };
//# sourceMappingURL=glass-water.js.map
@@ -0,0 +1 @@
{"version":3,"file":"internal.d.mts","names":[],"sources":["../src/constants.ts"],"sourcesContent":[],"mappings":";;;cAAa,uBAAA;cACA,mCAAA;cACA;AAFb;AACA;AACA;AAOA;AASA;AASa,cAlBA,qBAAA,GAkBoB,sCAAA;AASjC;AAQA;AAaA;AAWA;AAkBA;AAUa,cA9EA,yBAAA,GA8EmB,yCAAA;AAUhC;AAGA;AAGA;AACA;AACA;AACA;AACA;cAzFa,oBAAA;;;;;;;;cASA,oBAAA;;;;;;;cAQA,4BAAA;;;;;;;;;;;;cAaA,wBAAA;;;;;;;;;;cAWA,kBAAA;;;;;;;;;cAkBA,oBAAA;;;;;;;;;cAUA,mBAAA;;;;;;;;;cAUA,gBAAA;cAGA,eAAA;cAGA,WAAA;cACA,eAAA;cACA,gBAAA;cACA,cAAA;cACA,cAAA"}
@@ -0,0 +1,9 @@
import { TraceMap } from './trace-mapping.mts';
import type { SectionedSourceMapInput, Ro } from './types.mts';
type FlattenMap = {
new (map: Ro<SectionedSourceMapInput>, mapUrl?: string | null): TraceMap;
(map: Ro<SectionedSourceMapInput>, mapUrl?: string | null): TraceMap;
};
export declare const FlattenMap: FlattenMap;
export {};
//# sourceMappingURL=flatten-map.d.ts.map
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.visitorKeys = exports.getKeys = void 0;
var get_keys_1 = require("./get-keys");
Object.defineProperty(exports, "getKeys", { enumerable: true, get: function () { return get_keys_1.getKeys; } });
var visitor_keys_1 = require("./visitor-keys");
Object.defineProperty(exports, "visitorKeys", { enumerable: true, get: function () { return visitor_keys_1.visitorKeys; } });
@@ -0,0 +1,6 @@
function isNullish(v) {
return v == null;
}
export { isNullish };
//# sourceMappingURL=is-nullish.mjs.map
@@ -0,0 +1,43 @@
{
"name": "json-schema-traverse",
"version": "1.0.0",
"description": "Traverse JSON Schema passing each schema object to callback",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"eslint": "eslint index.js spec",
"test-spec": "mocha spec -R spec",
"test": "npm run eslint && nyc npm run test-spec"
},
"repository": {
"type": "git",
"url": "git+https://github.com/epoberezkin/json-schema-traverse.git"
},
"keywords": [
"JSON-Schema",
"traverse",
"iterate"
],
"author": "Evgeny Poberezkin",
"license": "MIT",
"bugs": {
"url": "https://github.com/epoberezkin/json-schema-traverse/issues"
},
"homepage": "https://github.com/epoberezkin/json-schema-traverse#readme",
"devDependencies": {
"eslint": "^7.3.1",
"mocha": "^8.0.1",
"nyc": "^15.0.0",
"pre-commit": "^1.2.2"
},
"nyc": {
"exclude": [
"**/spec/**",
"node_modules"
],
"reporter": [
"lcov",
"text-summary"
]
}
}
@@ -0,0 +1,437 @@
/**
* EventSource/Server-Sent Events parser
* @see https://html.spec.whatwg.org/multipage/server-sent-events.html
*/
import {ParseError} from './errors.ts'
import type {EventSourceParser, ParserConfig} from './types.ts'
// ASCII codes used in the hot parsing paths.
const LF = 10
const CR = 13
const SPACE = 32
// oxlint-disable-next-line no-unused-vars
function noop(_arg: unknown) {
// intentional noop
}
/**
* Creates a new EventSource parser.
*
* @param config - Parser configuration. Accepts callbacks (see {@link ParserCallbacks})
* and options like `maxBufferSize` (see {@link ParserConfig}).
*
* @returns A new EventSource parser, with `feed` and `reset` methods.
* @public
*/
export function createParser(config: ParserConfig): EventSourceParser {
if (typeof config === 'function') {
throw new TypeError(
'`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?',
)
}
const {onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize} = config
// Trailing bytes from prior `feed()` calls that did not yet form a complete line.
// Stored as an array of fragments and only joined when a line terminator arrives.
// Concatenating per-feed (`prefix + chunk`) is O(N²) when a single SSE line spans
// many chunks (e.g. a large `data:` payload streamed in tiny slices, or an MCP-style
// server that emits one giant content block). Buffering as fragments + joining once
// makes the same workload linear.
const pendingFragments: string[] = []
// Running total of `pendingFragments` lengths, kept in sync with the array so the
// `maxBufferSize` check doesn't have to walk the fragment list on every feed.
let pendingFragmentsLength = 0
let isFirstChunk = true
let id: string | undefined
let data = ''
let dataLines = 0
let eventType: string | undefined
// Set after a `maxBufferSize` overflow. Once tripped, `feed()` throws until
// `reset()` is called — see the comment on `maxBufferSize` in `ParserConfig`.
let terminated = false
/**
* Feeds a chunk of the SSE stream to the parser. Any trailing bytes that do
* not yet form a complete line are held back and prepended to the next chunk,
* so callers can pass arbitrary slices of the stream without worrying about
* line boundaries.
*
* Per the SSE spec, a UTF-8 BOM (0xEF 0xBB 0xBF) at the start of the very
* first chunk is stripped before parsing.
*
* @see https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream
*/
function feed(chunk: string) {
if (terminated) {
throw new Error(
'Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.',
)
}
if (isFirstChunk) {
isFirstChunk = false
// Match and strip UTF-8 BOM from the start of the stream, if present.
// (Per the spec, this is only valid at the very start of the stream)
if (
chunk.charCodeAt(0) === 0xef &&
chunk.charCodeAt(1) === 0xbb &&
chunk.charCodeAt(2) === 0xbf
) {
chunk = chunk.slice(3)
}
}
// Hot path: no buffered prefix from a prior partial line. Hand the chunk
// straight to `processLines`, exactly like the original implementation.
// Zero new work in the common case (every chunk ends with `\n\n`).
if (pendingFragments.length === 0) {
const trailing = processLines(chunk)
if (trailing !== '') {
pendingFragments.push(trailing)
pendingFragmentsLength = trailing.length
}
checkBufferSize()
return
}
// We have a buffered prefix. If this chunk also has no terminator, append
// to the buffer without concatenating — that's the O(N²) trap we're
// avoiding (large single `data:` payload split across many tiny chunks).
if (chunk.indexOf('\n') === -1 && chunk.indexOf('\r') === -1) {
pendingFragments.push(chunk)
pendingFragmentsLength += chunk.length
checkBufferSize()
return
}
// Terminator arrived. Join the accumulated fragments + this chunk once,
// process, and buffer any new trailing partial line.
pendingFragments.push(chunk)
const input = pendingFragments.join('')
pendingFragments.length = 0
pendingFragmentsLength = 0
const trailing = processLines(input)
if (trailing !== '') {
pendingFragments.push(trailing)
pendingFragmentsLength = trailing.length
}
checkBufferSize()
}
function checkBufferSize() {
if (maxBufferSize === undefined) return
if (pendingFragmentsLength + data.length <= maxBufferSize) return
terminated = true
pendingFragments.length = 0
pendingFragmentsLength = 0
id = undefined
data = ''
dataLines = 0
eventType = undefined
onError(
new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
type: 'max-buffer-size-exceeded',
}),
)
}
/**
* Splits `chunk` into SSE lines and dispatches each to the appropriate handler.
* Returns any trailing bytes that did not terminate with a line break, so the
* caller can prepend them to the next chunk.
*
* The SSE spec permits three line terminators: `\n`, `\r`, and `\r\n`. Real-world
* streams almost always use plain `\n`, so we take a fast path when no `\r` is
* present in the chunk. The slow path is spec-correct but does more work per line.
*/
function processLines(chunk: string): string {
let searchIndex = 0
// Fast path: LF-only chunk (the common case for typical SSE servers).
// We can scan forward with a single `indexOf('\n')` per line and inline
// the hot-path branches for `data:` and `event:` without the CR bookkeeping
// the slow path needs.
if (chunk.indexOf('\r') === -1) {
let lfIndex = chunk.indexOf('\n', searchIndex)
while (lfIndex !== -1) {
// Blank line: end-of-event marker. Dispatch the accumulated event (if any)
// and reset the buffered fields. This is hoisted out of `parseLine` because
// it's the single most common line shape after `data:` lines.
if (searchIndex === lfIndex) {
if (dataLines > 0) {
onEvent({id, event: eventType, data})
}
id = undefined
data = ''
dataLines = 0
eventType = undefined
searchIndex = lfIndex + 1
lfIndex = chunk.indexOf('\n', searchIndex)
continue
}
const firstCharCode = chunk.charCodeAt(searchIndex)
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
// `data:` line — append the value to the event's data buffer.
// 'data:'.length === 5, 'data: '.length === 6
const valueStart =
chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5
const value = chunk.slice(valueStart, lfIndex)
// Fast path within a fast path: if this is the first data line AND the
// next char is another LF (i.e. `data:foo\n\n`), dispatch immediately
// without ever writing to the `data` buffer. This is the shape of a
// typical single-line SSE event (ChatGPT-style streams, etc.) and is
// hot enough to be worth the duplication.
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
onEvent({id, event: eventType, data: value})
id = undefined
data = ''
eventType = undefined
searchIndex = lfIndex + 2
lfIndex = chunk.indexOf('\n', searchIndex)
continue
}
// Multi-line data: concatenate with newline separator per spec.
data = dataLines === 0 ? value : `${data}\n${value}`
dataLines++
} else if (isEventPrefix(chunk, searchIndex, firstCharCode)) {
// `event:` line — set the event type for the next dispatch. Per spec,
// an empty value resets `event type` to its default (undefined here).
// 'event:'.length === 6, 'event: '.length === 7
eventType =
chunk.slice(
chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
lfIndex,
) || undefined
} else {
// Everything else: `id:`, `retry:`, comment lines (`:` prefix), unknown
// fields, or malformed lines. These are rarer and go through the full
// per-line parser, which handles the SSE field grammar in detail.
parseLine(chunk, searchIndex, lfIndex)
}
searchIndex = lfIndex + 1
lfIndex = chunk.indexOf('\n', searchIndex)
}
return chunk.slice(searchIndex)
}
// Slow path: the chunk contains at least one `\r`, so lines may be terminated
// by `\r`, `\n`, or `\r\n`. We locate the next terminator by looking at both
// the nearest `\r` and `\n` and picking whichever comes first.
while (searchIndex < chunk.length) {
const crIndex = chunk.indexOf('\r', searchIndex)
const lfIndex = chunk.indexOf('\n', searchIndex)
let lineEnd = -1
if (crIndex !== -1 && lfIndex !== -1) {
lineEnd = crIndex < lfIndex ? crIndex : lfIndex
} else if (crIndex !== -1) {
// A trailing `\r` at the very end of the chunk is ambiguous: it could be
// a bare-CR terminator, or the first half of a `\r\n` whose `\n` arrives
// in the next chunk. Defer until we see more input.
if (crIndex === chunk.length - 1) {
lineEnd = -1
} else {
lineEnd = crIndex
}
} else if (lfIndex !== -1) {
lineEnd = lfIndex
}
if (lineEnd === -1) {
break
}
parseLine(chunk, searchIndex, lineEnd)
searchIndex = lineEnd + 1
// If we just consumed a `\r` and the next char is `\n`, skip it so the
// pair is treated as a single terminator rather than an empty line.
if (chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF) {
searchIndex++
}
}
return chunk.slice(searchIndex)
}
function parseLine(chunk: string, start: number, end: number) {
if (start === end) {
dispatchEvent()
return
}
const firstCharCode = chunk.charCodeAt(start)
if (isDataPrefix(chunk, start, firstCharCode)) {
// 'data:'.length === 5, 'data: '.length === 6
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5
const value = chunk.slice(valueStart, end)
data = dataLines === 0 ? value : `${data}\n${value}`
dataLines++
return
}
if (isEventPrefix(chunk, start, firstCharCode)) {
// 'event:'.length === 6, 'event: '.length === 7
eventType =
chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || undefined
return
}
// Fast path for "id:" — 'i' = 105, 'd' = 100, ':' = 58
if (
firstCharCode === 105 &&
chunk.charCodeAt(start + 1) === 100 &&
chunk.charCodeAt(start + 2) === 58
) {
// 'id:'.length === 3, 'id: '.length === 4
const value = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end)
id = value.includes('\0') ? undefined : value
return
}
// Comment line — ':' = 58
if (firstCharCode === 58) {
if (onComment) {
const line = chunk.slice(start, end)
// skip ':' (+1), or ': ' (+2) when a space follows
onComment(line.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1))
}
return
}
const line = chunk.slice(start, end)
const fieldSeparatorIndex = line.indexOf(':')
if (fieldSeparatorIndex === -1) {
processField(line, '', line)
return
}
const field = line.slice(0, fieldSeparatorIndex)
// skip ':' (+1), or ': ' (+2) when a space follows
const offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1
const value = line.slice(fieldSeparatorIndex + offset)
processField(field, value, line)
}
function processField(field: string, value: string, line: string) {
// Field names must be compared literally, with no case folding performed.
switch (field) {
case 'event':
// Set the `event type` buffer to field value
eventType = value || undefined
break
case 'data':
data = dataLines === 0 ? value : `${data}\n${value}`
dataLines++
break
case 'id':
// If the field value does not contain U+0000 NULL, then set the `ID` buffer to
// the field value. Otherwise, ignore the field.
id = value.includes('\0') ? undefined : value
break
case 'retry':
// If the field value consists of only ASCII digits, then interpret the field value as an
// integer in base ten, and set the event stream's reconnection time to that integer.
// Otherwise, ignore the field.
if (/^\d+$/.test(value)) {
onRetry(parseInt(value, 10))
} else {
onError(
new ParseError(`Invalid \`retry\` value: "${value}"`, {
type: 'invalid-retry',
value,
line,
}),
)
}
break
default:
// Otherwise, the field is ignored.
onError(
new ParseError(
`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}…` : field}"`,
{type: 'unknown-field', field, value, line},
),
)
break
}
}
function dispatchEvent() {
if (dataLines > 0) {
onEvent({
id,
event: eventType,
data,
})
}
id = undefined
data = ''
dataLines = 0
eventType = undefined
}
function reset(options: {consume?: boolean} = {}) {
if (options.consume && pendingFragments.length > 0) {
const incompleteLine = pendingFragments.join('')
parseLine(incompleteLine, 0, incompleteLine.length)
}
isFirstChunk = true
id = undefined
data = ''
dataLines = 0
eventType = undefined
pendingFragments.length = 0
pendingFragmentsLength = 0
terminated = false
}
return {feed, reset}
}
/**
* Checks if `chunk` starts with the literal `data:` at index `i`.
*
* Equivalent to `chunk.startsWith('data:', i)`, but benchmarks show this
* hand-unrolled char-code comparison is ~20% faster on common event types.
* The caller passes `firstCharCode` (the code at `i`) so it can be reused
* across prefix checks.
*
* ASCII: 'd' = 100, 'a' = 97, 't' = 116, 'a' = 97, ':' = 58
*/
function isDataPrefix(chunk: string, i: number, firstCharCode: number): boolean {
return (
firstCharCode === 100 &&
chunk.charCodeAt(i + 1) === 97 &&
chunk.charCodeAt(i + 2) === 116 &&
chunk.charCodeAt(i + 3) === 97 &&
chunk.charCodeAt(i + 4) === 58
)
}
/**
* Checks if `chunk` starts with the literal `event:` at index `i`.
*
* See {@link isDataPrefix} for why this is hand-unrolled rather than using
* `String.prototype.startsWith`.
*
* ASCII: 'e' = 101, 'v' = 118, 'e' = 101, 'n' = 110, 't' = 116, ':' = 58
*/
function isEventPrefix(chunk: string, i: number, firstCharCode: number): boolean {
return (
firstCharCode === 101 &&
chunk.charCodeAt(i + 1) === 118 &&
chunk.charCodeAt(i + 2) === 101 &&
chunk.charCodeAt(i + 3) === 110 &&
chunk.charCodeAt(i + 4) === 116 &&
chunk.charCodeAt(i + 5) === 58
)
}
@@ -0,0 +1,46 @@
import { setResponseValueAndErrors } from "../errorMessages.js";
export function parseDateDef(def, refs, overrideDateStrategy) {
const strategy = overrideDateStrategy ?? refs.dateStrategy;
if (Array.isArray(strategy)) {
return {
anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)),
};
}
switch (strategy) {
case "string":
case "format:date-time":
return {
type: "string",
format: "date-time",
};
case "format:date":
return {
type: "string",
format: "date",
};
case "integer":
return integerDateParser(def, refs);
}
}
const integerDateParser = (def, refs) => {
const res = {
type: "integer",
format: "unix-time",
};
if (refs.target === "openApi3") {
return res;
}
for (const check of def.checks) {
switch (check.kind) {
case "min":
setResponseValueAndErrors(res, "minimum", check.value, // This is in milliseconds
check.message, refs);
break;
case "max":
setResponseValueAndErrors(res, "maximum", check.value, // This is in milliseconds
check.message, refs);
break;
}
}
return res;
};
@@ -0,0 +1,4 @@
"use strict";var d=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var We=d(F=>{"use strict";var Do=F&&F.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(F,"__esModule",{value:!0});F.Minipass=F.isWritable=F.isReadable=F.isStream=void 0;var kr=typeof process=="object"&&process?process:{stdout:null,stderr:null},ss=require("node:events"),qr=Do(require("node:stream")),Po=require("node:string_decoder"),No=s=>!!s&&typeof s=="object"&&(s instanceof Zt||s instanceof qr.default||(0,F.isReadable)(s)||(0,F.isWritable)(s));F.isStream=No;var Mo=s=>!!s&&typeof s=="object"&&s instanceof ss.EventEmitter&&typeof s.pipe=="function"&&s.pipe!==qr.default.Writable.prototype.pipe;F.isReadable=Mo;var Lo=s=>!!s&&typeof s=="object"&&s instanceof ss.EventEmitter&&typeof s.write=="function"&&typeof s.end=="function";F.isWritable=Lo;var ce=Symbol("EOF"),ue=Symbol("maybeEmitEnd"),we=Symbol("emittedEnd"),jt=Symbol("emittingEnd"),dt=Symbol("emittedError"),Ut=Symbol("closed"),xr=Symbol("read"),qt=Symbol("flush"),jr=Symbol("flushChunk"),K=Symbol("encoding"),Ue=Symbol("decoder"),R=Symbol("flowing"),mt=Symbol("paused"),qe=Symbol("resume"),O=Symbol("buffer"),I=Symbol("pipes"),v=Symbol("bufferLength"),Xi=Symbol("bufferPush"),Wt=Symbol("bufferShift"),N=Symbol("objectMode"),E=Symbol("destroyed"),Qi=Symbol("error"),Ji=Symbol("emitData"),Ur=Symbol("emitEnd"),es=Symbol("emitEnd2"),J=Symbol("async"),ts=Symbol("abort"),Ht=Symbol("aborted"),pt=Symbol("signal"),Ne=Symbol("dataListeners"),x=Symbol("discarded"),_t=s=>Promise.resolve().then(s),Ao=s=>s(),Io=s=>s==="end"||s==="finish"||s==="prefinish",Fo=s=>s instanceof ArrayBuffer||!!s&&typeof s=="object"&&s.constructor&&s.constructor.name==="ArrayBuffer"&&s.byteLength>=0,Co=s=>!Buffer.isBuffer(s)&&ArrayBuffer.isView(s),Gt=class{src;dest;opts;ondrain;constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[qe](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},is=class extends Gt{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=r=>this.dest.emit("error",r),e.on("error",this.proxyErrors)}},Bo=s=>!!s.objectMode,zo=s=>!s.objectMode&&!!s.encoding&&s.encoding!=="buffer",Zt=class extends ss.EventEmitter{[R]=!1;[mt]=!1;[I]=[];[O]=[];[N];[K];[J];[Ue];[ce]=!1;[we]=!1;[jt]=!1;[Ut]=!1;[dt]=null;[v]=0;[E]=!1;[pt];[Ht]=!1;[Ne]=0;[x]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Bo(t)?(this[N]=!0,this[K]=null):zo(t)?(this[K]=t.encoding,this[N]=!1):(this[N]=!1,this[K]=null),this[J]=!!t.async,this[Ue]=this[K]?new Po.StringDecoder(this[K]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[O]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[I]});let{signal:i}=t;i&&(this[pt]=i,i.aborted?this[ts]():i.addEventListener("abort",()=>this[ts]()))}get bufferLength(){return this[v]}get encoding(){return this[K]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[N]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[J]}set async(e){this[J]=this[J]||!!e}[ts](){this[Ht]=!0,this.emit("abort",this[pt]?.reason),this.destroy(this[pt]?.reason)}get aborted(){return this[Ht]}set aborted(e){}write(e,t,i){if(this[Ht])return!1;if(this[ce])throw new Error("write after end");if(this[E])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||(t="utf8");let r=this[J]?_t:Ao;if(!this[N]&&!Buffer.isBuffer(e)){if(Co(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Fo(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[N]?(this[R]&&this[v]!==0&&this[qt](!0),this[R]?this.emit("data",e):this[Xi](e),this[v]!==0&&this.emit("readable"),i&&r(i),this[R]):e.length?(typeof e=="string"&&!(t===this[K]&&!this[Ue]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[K]&&(e=this[Ue].write(e)),this[R]&&this[v]!==0&&this[qt](!0),this[R]?this.emit("data",e):this[Xi](e),this[v]!==0&&this.emit("readable"),i&&r(i),this[R]):(this[v]!==0&&this.emit("readable"),i&&r(i),this[R])}read(e){if(this[E])return null;if(this[x]=!1,this[v]===0||e===0||e&&e>this[v])return this[ue](),null;this[N]&&(e=null),this[O].length>1&&!this[N]&&(this[O]=[this[K]?this[O].join(""):Buffer.concat(this[O],this[v])]);let t=this[xr](e||null,this[O][0]);return this[ue](),t}[xr](e,t){if(this[N])this[Wt]();else{let i=t;e===i.length||e===null?this[Wt]():typeof i=="string"?Line truncated
`,n=Buffer.byteLength(r),o=Math.floor(Math.log(n)/Math.log(10))+1;return n+o>=Math.pow(10,o)&&(o+=1),o+n+r}static parse(e,t,i=!1){return new s(Aa(Ia(e),t),i)}};ii.Pax=Is;var Aa=(s,e)=>e?Object.assign({},e,s):s,Ia=s=>s.replace(/\n$/,"").split(`
`).reduce(Fa,Object.create(null)),Fa=(s,e)=>{let t=parseInt(e,10);if(t!==Buffer.byteLength(e)+1)return s;e=e.slice((t+" ").length);let i=e.split("="),r=i.shift();if(!r)return s;let n=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),o=i.join("=").replace(/\0.*/,"");switch(n){case"path":case"linkpath":case"type":case"charset":case"comment":case"gname":case"uname":s[n]=o;break;case"ctime":case"atime":case"mtime":s[n]=new Date(Number(o)*1e3);break;case"size":let a=+o;a>=0&&(s[n]=a);break;case"gid":case"uid":case"dev":case"ino":case"nlink":case"mode":s[n]=+o;break}return s}});var tt=d(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.normalizeWindowsPath=void 0;var Ca=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;ri.normalizeWindowsPath=Ca!=="win32"?s=>String(s):s=>String(s).replaceAll(/\\/g,"/")});var Cs=d(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.ReadEntry=void 0;var Ba=We(),ni=tt(),Fs=class extends Ba.Minipass{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,t,i){switch(super({}),this.pause(),this.extended=t,this.globalExtended=i,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=(0,ni.normalizeWindowsPath)(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?(0,ni.normalizeWindowsPath)(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),i&&this.#e(i,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw new Error("writing more to entry than is appropriate");let i=this.remain,r=this.blockRemain;return this.remain=Math.max(0,i-t),this.blockRemain=Math.max(0,r-t),this.ignore?!0:i>=t?super.write(e):super.write(e.subarray(0,i))}#e(e,t=!1){e.path&&(e.path=(0,ni.normalizeWindowsPath)(e.path)),e.linkpath&&(e.linkpath=(0,ni.normalizeWindowsPath)(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,r])=>!(r==null||i==="path"&&t))))}};oi.ReadEntry=Fs});var hi=d(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.warnMethod=void 0;var za=(s,e,t,i={})=>{s.file&&(i.file=s.file),s.cwd&&(i.cwd=s.cwd),i.code=t instanceof Error&&t.code||e,i.tarCode=e,!s.strict&&i.recoverable!==!1?(t instanceof Error&&(i=Object.assign(t,i),t=t.message),s.emit("warn",e,t,i)):t instanceof Error?s.emit("error",Object.assign(t,i)):s.emit("error",Object.assign(new Error(`${e}: ${t}`),i))};ai.warnMethod=za});var _i=d(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.Parser=void 0;var ka=require("events"),Bs=Ps(),Xr=et(),Qr=si(),xa=Cs(),ja=hi(),Ua=1024*1024,qs=Buffer.from([31,139]),Ws=Buffer.from([40,181,47,253]),qa=Math.max(qs.length,Ws.length),H=Symbol("state"),ze=Symbol("writeEntry"),me=Symbol("readEntry"),zs=Symbol("nextEntry"),Jr=Symbol("processEntry"),re=Symbol("extendedHeader"),gt=Symbol("globalExtendedHeader"),Re=Symbol("meta"),en=Symbol("emitMeta"),_=Symbol("buffer"),pe=Symbol("queue"),Oe=Symbol("ended"),ks=Symbol("emittedEnd"),ke=Symbol("emit"),y=Symbol("unzip"),li=Symbol("consumeChunk"),ci=Symbol("consumeChunkSub"),xs=Symbol("consumeBody"),tn=Symbol("consumeMeta"),sn=Symbol("consumeHeader"),Rt=Symbol("consuming"),js=Symbol("bufferConcat"),ui=Symbol("maybeEnd"),it=Symbol("writing"),ne=Symbol("aborted"),fi=Symbol("onDone"),xe=Symbol("sawValidEntry"),di=Symbol("sawNullBlock"),mi=Symbol("sawEOF"),rn=Symbol("closeStream"),Wa=1e3,Ot=Symbol("compressedBytesRead"),Us=Symbol("decompressedBytesRead"),nn=Symbol("checkDecompressionRatio"),Ha=()=>!0,Hs=class extends ka.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;maxDecompressionRatio;writable=!0;readable=!1;[pe]=[];[_];[me];[ze];[H]="begin";[Re]="";[re];[gt];[Oe]=!1;[y];[ne]=!1;[xe];[di]=!1;[mi]=!1;[it]=!1;[Rt]=!1;[ks]=!1;[Ot]=0;[Us]=0;constructor(e={}){super(),this.file=e.file||"",this.on(fi,()=>{(this[H]==="begin"||this[xe]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(fi,e.ondone):this.on(fi,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxDecompressionRatio=typeof e.maxDecompressionRatio=="number"?e.maxDecompressionRatio:Wa,this.maxMetaEntrySize=e.maxMetaEntrySize||Ua,this.filter=typeof e.filLine truncated
//# sourceMappingURL=index.min.js.map
@@ -0,0 +1,370 @@
/**
* @license React
* react-jsx-dev-runtime.react-server.development.js
*
* 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.
*/
"use strict";
"production" !== process.env.NODE_ENV &&
(function () {
function getComponentNameFromType(type) {
if (null == type) return null;
if ("function" === typeof type)
return type.$$typeof === REACT_CLIENT_REFERENCE
? null
: type.displayName || type.name || null;
if ("string" === typeof type) return type;
switch (type) {
case REACT_FRAGMENT_TYPE:
return "Fragment";
case REACT_PROFILER_TYPE:
return "Profiler";
case REACT_STRICT_MODE_TYPE:
return "StrictMode";
case REACT_SUSPENSE_TYPE:
return "Suspense";
case REACT_SUSPENSE_LIST_TYPE:
return "SuspenseList";
case REACT_ACTIVITY_TYPE:
return "Activity";
}
if ("object" === typeof type)
switch (
("number" === typeof type.tag &&
console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
),
type.$$typeof)
) {
case REACT_PORTAL_TYPE:
return "Portal";
case REACT_CONTEXT_TYPE:
return type.displayName || "Context";
case REACT_CONSUMER_TYPE:
return (type._context.displayName || "Context") + ".Consumer";
case REACT_FORWARD_REF_TYPE:
var innerType = type.render;
type = type.displayName;
type ||
((type = innerType.displayName || innerType.name || ""),
(type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
return type;
case REACT_MEMO_TYPE:
return (
(innerType = type.displayName || null),
null !== innerType
? innerType
: getComponentNameFromType(type.type) || "Memo"
);
case REACT_LAZY_TYPE:
innerType = type._payload;
type = type._init;
try {
return getComponentNameFromType(type(innerType));
} catch (x) {}
}
return null;
}
function testStringCoercion(value) {
return "" + value;
}
function checkKeyStringCoercion(value) {
try {
testStringCoercion(value);
var JSCompiler_inline_result = !1;
} catch (e) {
JSCompiler_inline_result = !0;
}
if (JSCompiler_inline_result) {
JSCompiler_inline_result = console;
var JSCompiler_temp_const = JSCompiler_inline_result.error;
var JSCompiler_inline_result$jscomp$0 =
("function" === typeof Symbol &&
Symbol.toStringTag &&
value[Symbol.toStringTag]) ||
value.constructor.name ||
"Object";
JSCompiler_temp_const.call(
JSCompiler_inline_result,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
JSCompiler_inline_result$jscomp$0
);
return testStringCoercion(value);
}
}
function getTaskName(type) {
if (type === REACT_FRAGMENT_TYPE) return "<>";
if (
"object" === typeof type &&
null !== type &&
type.$$typeof === REACT_LAZY_TYPE
)
return "<...>";
try {
var name = getComponentNameFromType(type);
return name ? "<" + name + ">" : "<...>";
} catch (x) {
return "<...>";
}
}
function getOwner() {
var dispatcher = ReactSharedInternalsServer.A;
return null === dispatcher ? null : dispatcher.getOwner();
}
function UnknownOwner() {
return Error("react-stack-top-frame");
}
function hasValidKey(config) {
if (hasOwnProperty.call(config, "key")) {
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
if (getter && getter.isReactWarning) return !1;
}
return void 0 !== config.key;
}
function defineKeyPropWarningGetter(props, displayName) {
function warnAboutAccessingKey() {
specialPropKeyWarningShown ||
((specialPropKeyWarningShown = !0),
console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
displayName
));
}
warnAboutAccessingKey.isReactWarning = !0;
Object.defineProperty(props, "key", {
get: warnAboutAccessingKey,
configurable: !0
});
}
function elementRefGetterWithDeprecationWarning() {
var componentName = getComponentNameFromType(this.type);
didWarnAboutElementRef[componentName] ||
((didWarnAboutElementRef[componentName] = !0),
console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
));
componentName = this.props.ref;
return void 0 !== componentName ? componentName : null;
}
function ReactElement(type, key, props, owner, debugStack, debugTask) {
var refProp = props.ref;
type = {
$$typeof: REACT_ELEMENT_TYPE,
type: type,
key: key,
props: props,
_owner: owner
};
null !== (void 0 !== refProp ? refProp : null)
? Object.defineProperty(type, "ref", {
enumerable: !1,
get: elementRefGetterWithDeprecationWarning
})
: Object.defineProperty(type, "ref", { enumerable: !1, value: null });
type._store = {};
Object.defineProperty(type._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
});
Object.defineProperty(type, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
});
Object.defineProperty(type, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: debugStack
});
Object.defineProperty(type, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: debugTask
});
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
return type;
}
function jsxDEVImpl(
type,
config,
maybeKey,
isStaticChildren,
debugStack,
debugTask
) {
var children = config.children;
if (void 0 !== children)
if (isStaticChildren)
if (isArrayImpl(children)) {
for (
isStaticChildren = 0;
isStaticChildren < children.length;
isStaticChildren++
)
validateChildKeys(children[isStaticChildren]);
Object.freeze && Object.freeze(children);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else validateChildKeys(children);
if (hasOwnProperty.call(config, "key")) {
children = getComponentNameFromType(type);
var keys = Object.keys(config).filter(function (k) {
return "key" !== k;
});
isStaticChildren =
0 < keys.length
? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
: "{key: someKey}";
didWarnAboutKeySpread[children + isStaticChildren] ||
((keys =
0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
console.error(
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
isStaticChildren,
children,
keys,
children
),
(didWarnAboutKeySpread[children + isStaticChildren] = !0));
}
children = null;
void 0 !== maybeKey &&
(checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
hasValidKey(config) &&
(checkKeyStringCoercion(config.key), (children = "" + config.key));
if ("key" in config) {
maybeKey = {};
for (var propName in config)
"key" !== propName && (maybeKey[propName] = config[propName]);
} else maybeKey = config;
children &&
defineKeyPropWarningGetter(
maybeKey,
"function" === typeof type
? type.displayName || type.name || "Unknown"
: type
);
return ReactElement(
type,
children,
maybeKey,
getOwner(),
debugStack,
debugTask
);
}
function validateChildKeys(node) {
isValidElement(node)
? node._store && (node._store.validated = 1)
: "object" === typeof node &&
null !== node &&
node.$$typeof === REACT_LAZY_TYPE &&
("fulfilled" === node._payload.status
? isValidElement(node._payload.value) &&
node._payload.value._store &&
(node._payload.value._store.validated = 1)
: node._store && (node._store.validated = 1));
}
function isValidElement(object) {
return (
"object" === typeof object &&
null !== object &&
object.$$typeof === REACT_ELEMENT_TYPE
);
}
var React = require("react"),
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
REACT_MEMO_TYPE = Symbol.for("react.memo"),
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
ReactSharedInternalsServer =
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
if (!ReactSharedInternalsServer)
throw Error(
'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
);
var hasOwnProperty = Object.prototype.hasOwnProperty,
isArrayImpl = Array.isArray,
createTask = console.createTask
? console.createTask
: function () {
return null;
};
React = {
react_stack_bottom_frame: function (callStackForError) {
return callStackForError();
}
};
var specialPropKeyWarningShown;
var didWarnAboutElementRef = {};
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
React,
UnknownOwner
)();
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
var didWarnAboutKeySpread = {};
exports.Fragment = REACT_FRAGMENT_TYPE;
exports.jsx = function (type, config, maybeKey) {
var trackActualOwner =
1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
return jsxDEVImpl(
type,
config,
maybeKey,
!1,
trackActualOwner
? Error("react-stack-top-frame")
: unknownOwnerDebugStack,
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
);
};
exports.jsxDEV = function (type, config, maybeKey, isStaticChildren) {
var trackActualOwner =
1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
return jsxDEVImpl(
type,
config,
maybeKey,
isStaticChildren,
trackActualOwner
? Error("react-stack-top-frame")
: unknownOwnerDebugStack,
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
);
};
exports.jsxs = function (type, config, maybeKey) {
var trackActualOwner =
1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
return jsxDEVImpl(
type,
config,
maybeKey,
!0,
trackActualOwner
? Error("react-stack-top-frame")
: unknownOwnerDebugStack,
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
);
};
})();
@@ -0,0 +1 @@
{"version":3,"file":"elicitationUrlExample.js","sourceRoot":"","sources":["../../../../src/examples/server/elicitationUrlExample.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,EAAE;AACF,2EAA2E;AAC3E,oDAAoD;AACpD,uFAAuF;AACvF,oCAAoC;AACpC,8FAA8F;AAC9F,kEAAkE;;;;;AAElE,sDAAqD;AACrD,6CAAyC;AACzC,6BAAwB;AACxB,gDAAgD;AAChD,wDAA8D;AAC9D,sEAA+E;AAC/E,2DAA0G;AAC1G,8EAA+E;AAC/E,6CAAwI;AACxI,2EAAqE;AACrE,iFAAiE;AAGjE,gDAAwB;AAExB,mDAAmD;AACnD,MAAM,SAAS,GAAG,GAAG,EAAE;IACnB,MAAM,SAAS,GAAG,IAAI,kBAAS,CAC3B;QACI,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE,OAAO;KACnB,EACD;QACI,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;KAChC,CACJ,CAA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MAAM,QAAQ,GAAG,aAAa,CAAC,sBAAsB,CAAC;QAEtD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC5E,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE;YACnC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACL,Line truncated
@@ -0,0 +1,35 @@
import type * as core from "./core.js";
import type { $ZodType } from "./schemas.js";
export declare const $output: unique symbol;
export type $output = typeof $output;
export declare const $input: unique symbol;
export type $input = typeof $input;
export type $replace<Meta, S extends $ZodType> = Meta extends $output ? core.output<S> : Meta extends $input ? core.input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends (...args: infer P) => infer R ? (...args: {
[K in keyof P]: $replace<P[K], S>;
}) => $replace<R, S> : Meta extends object ? {
[K in keyof Meta]: $replace<Meta[K], S>;
} : Meta;
type MetadataType = object | undefined;
export declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
_meta: Meta;
_schema: Schema;
_map: WeakMap<Schema, $replace<Meta, Schema>>;
_idmap: Map<string, Schema>;
add<S extends Schema>(schema: S, ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]): this;
clear(): this;
remove(schema: Schema): this;
get<S extends Schema>(schema: S): $replace<Meta, S> | undefined;
has(schema: Schema): boolean;
}
export interface JSONSchemaMeta {
id?: string | undefined;
title?: string | undefined;
description?: string | undefined;
deprecated?: boolean | undefined;
[k: string]: unknown;
}
export interface GlobalMeta extends JSONSchemaMeta {
}
export declare function registry<T extends MetadataType = MetadataType, S extends $ZodType = $ZodType>(): $ZodRegistry<T, S>;
export declare const globalRegistry: $ZodRegistry<GlobalMeta>;
export {};
@@ -0,0 +1,9 @@
import { createHtmlRenderState } from '../../html/utils/create-render-state.mjs';
const createSvgRenderState = () => ({
...createHtmlRenderState(),
attrs: {},
});
export { createSvgRenderState };
//# sourceMappingURL=create-render-state.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"arrow-down-0-1.js","sources":["../../../src/icons/arrow-down-0-1.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ArrowDown01\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMyAxNiA0IDQgNC00IiAvPgogIDxwYXRoIGQ9Ik03IDIwVjQiIC8+CiAgPHJlY3QgeD0iMTUiIHk9IjQiIHdpZHRoPSI0IiBoZWlnaHQ9IjYiIHJ5PSIyIiAvPgogIDxwYXRoIGQ9Ik0xNyAyMHYtNmgtMiIgLz4KICA8cGF0aCBkPSJNMTUgMjBoNCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/arrow-down-0-1\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 ArrowDown01 = createLucideIcon('ArrowDown01', [\n ['path', { d: 'm3 16 4 4 4-4', key: '1co6wj' }],\n ['path', { d: 'M7 20V4', key: '1yoxec' }],\n ['rect', { x: '15', y: '4', width: '4', height: '6', ry: '2', key: '1bwicg' }],\n ['path', { d: 'M17 20v-6h-2', key: '1qp1so' }],\n ['path', { d: 'M15 20h4', key: '1j968p' }],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AAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC7C,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;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,379 @@
import { beforeEach, describe, expect, test } from "vitest";
import { z } from "../../../../index.js";
import he from "../../../locales/he.js";
describe("Hebrew localization", () => {
beforeEach(() => {
z.config(he());
});
describe("too_small errors with definite article and gendered verbs", () => {
test("string type (feminine - צריכה)", () => {
const schema = z.string().min(3);
const result = schema.safeParse("ab");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קצר מדי: המחרוזת צריכה להכיל 3 תווים או יותר");
}
});
test("number type (masculine - צריך)", () => {
const schema = z.number().min(10);
const result = schema.safeParse(5);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קטן מדי: המספר צריך להיות גדול או שווה ל-10");
}
});
test("array type (masculine - צריך)", () => {
const schema = z.array(z.string()).min(1);
const result = schema.safeParse([]);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קטן מדי: המערך צריך להכיל לפחות פריט אחד");
}
});
test("set type (feminine - צריכה)", () => {
const schema = z.set(z.string()).min(2);
const result = schema.safeParse(new Set(["a"]));
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קטן מדי: הקבוצה (Set) צריכה להכיל 2 פריטים או יותר");
}
});
});
describe("too_big errors with definite article and gendered verbs", () => {
test("string type (feminine - צריכה)", () => {
const schema = z.string().max(3);
const result = schema.safeParse("abcde");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("ארוך מדי: המחרוזת צריכה להכיל 3 תווים או פחות");
}
});
test("number type (masculine - צריך)", () => {
const schema = z.number().max(365);
const result = schema.safeParse(400);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("גדול מדי: המספר צריך להיות קטן או שווה ל-365");
}
});
test("array max", () => {
const schema = z.array(z.string()).max(2);
const result = schema.safeParse(["a", "b", "c"]);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("גדול מדי: המערך צריך להכיל 2 פריטים או פחות");
}
});
});
describe("invalid_type errors with definite article and gendered verbs", () => {
test("string expected (feminine), number received", () => {
const schema = z.string();
const result = schema.safeParse(123);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות מחרוזת, התקבל מספר");
}
});
test("number expected (masculine), string received", () => {
const schema = z.number();
const result = schema.safeParse("abc");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות מספר, התקבל מחרוזת");
}
});
test("boolean expected (masculine), null received", () => {
const schema = z.boolean();
const result = schema.safeParse(null);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות ערך בוליאני, התקבל ערך ריק (null)");
}
});
test("array expected (masculine), object received", () => {
const schema = z.array(z.string());
const result = schema.safeParse({});
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות מערך, התקבל אובייקט");
}
});
test("object expected (masculine), array received", () => {
const schema = z.object({ a: z.string() });
const result = schema.safeParse([]);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות אובייקט, התקבל מערך");
}
});
test("function expected (feminine), string received", () => {
const schema = z.function();
const result = schema.safeParse("not a function");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות פונקציה, התקבל מחרוזת");
}
});
});
describe("gendered verbs consistency", () => {
test("feminine types use צריכה", () => {
const feminineTypes = [
{ schema: z.string().min(5), input: "abc" },
{ schema: z.set(z.string()).min(2), input: new Set(["a"]) },
];
for (const { schema, input } of feminineTypes) {
const result = schema.safeParse(input);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toContain("צריכה");
}
}
});
test("masculine types use צריך", () => {
const masculineTypes = [
{ schema: z.number().min(10), input: 5 },
{ schema: z.array(z.string()).min(2), input: ["a"] },
];
for (const { schema, input } of masculineTypes) {
const result = schema.safeParse(input);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toContain("צריך");
}
}
});
});
describe("invalid_value with enum", () => {
test("single value", () => {
const schema = z.enum(["a"]);
const result = schema.safeParse("b");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe('ערך לא תקין: הערך חייב להיות "a"');
}
});
test("two values", () => {
const schema = z.enum(["a", "b"]);
const result = schema.safeParse("c");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe('ערך לא תקין: האפשרויות המתאימות הן "a" או "b"');
}
});
test("multiple values", () => {
const schema = z.enum(["a", "b", "c"]);
const result = schema.safeParse("d");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe('ערך לא תקין: האפשרויות המתאימות הן "a", "b" או "c"');
}
});
});
describe("other error types", () => {
test("not_multiple_of", () => {
const schema = z.number().multipleOf(3);
const result = schema.safeParse(10);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("מספר לא תקין: חייב להיות מכפלה של 3");
}
});
test("unrecognized_keys - single key", () => {
const schema = z.object({ a: z.string() }).strict();
const result = schema.safeParse({ a: "test", b: "extra" });
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe('מפתח לא מזוהה: "b"');
}
});
test("unrecognized_keys - multiple keys", () => {
const schema = z.object({ a: z.string() }).strict();
const result = schema.safeParse({ a: "test", b: "extra", c: "more" });
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe('מפתחות לא מזוהים: "b", "c"');
}
});
test("invalid_union", () => {
const schema = z.union([z.string(), z.number()]);
const result = schema.safeParse(true);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קלט לא תקין");
}
});
test("invalid_key in object", () => {
const schema = z.record(z.number(), z.string());
const result = schema.safeParse({ notANumber: "value" });
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("שדה לא תקין באובייקט");
}
});
});
describe("invalid_format with string checks", () => {
test("startsWith", () => {
const schema = z.string().startsWith("hello");
const result = schema.safeParse("world");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe('המחרוזת חייבת להתחיל ב "hello"');
}
});
test("endsWith", () => {
const schema = z.string().endsWith("world");
const result = schema.safeParse("hello");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe('המחרוזת חייבת להסתיים ב "world"');
}
});
test("includes", () => {
const schema = z.string().includes("test");
const result = schema.safeParse("hello world");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe('המחרוזת חייבת לכלול "test"');
}
});
test("regex", () => {
const schema = z.string().regex(/^[a-z]+$/);
const result = schema.safeParse("ABC123");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("המחרוזת חייבת להתאים לתבנית /^[a-z]+$/");
}
});
});
describe("invalid_format with common formats", () => {
test("email", () => {
const schema = z.string().email();
const result = schema.safeParse("not-an-email");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("כתובת אימייל לא תקינה");
}
});
test("url", () => {
const schema = z.string().url();
const result = schema.safeParse("not-a-url");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("כתובת רשת לא תקינה");
}
});
test("uuid", () => {
const schema = z.string().uuid();
const result = schema.safeParse("not-a-uuid");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("UUID לא תקין");
}
});
});
describe("tuple validation", () => {
test("invalid element type in tuple shows full error message", () => {
const schema = z.tuple([z.string(), z.number()]);
const result = schema.safeParse(["abc", "not a number"]);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות מספר, התקבל מחרוזת");
}
});
});
describe("inclusive vs exclusive bounds", () => {
test("inclusive minimum (>=)", () => {
const schema = z.number().min(10);
const result = schema.safeParse(5);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קטן מדי: המספר צריך להיות גדול או שווה ל-10");
}
});
test("exclusive minimum (>)", () => {
const schema = z.number().gt(10);
const result = schema.safeParse(10);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("קטן מדי: המספר צריך להיות גדול מ-10");
}
});
test("inclusive maximum (<=)", () => {
const schema = z.number().max(10);
const result = schema.safeParse(15);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("גדול מדי: המספר צריך להיות קטן או שווה ל-10");
}
});
test("exclusive maximum (<)", () => {
const schema = z.number().lt(10);
const result = schema.safeParse(10);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("גדול מדי: המספר צריך להיות קטן מ-10");
}
});
});
describe("all type names with definite article", () => {
test("verifies all type translations are correct", () => {
const types = [
{ schema: z.string(), expected: "מחרוזת", input: 123 },
{ schema: z.number(), expected: "מספר", input: "abc" },
{ schema: z.boolean(), expected: "ערך בוליאני", input: "abc" },
{ schema: z.bigint(), expected: "BigInt", input: "abc" },
{ schema: z.date(), expected: "תאריך", input: "abc" },
{ schema: z.array(z.any()), expected: "מערך", input: "abc" },
{ schema: z.object({}), expected: "אובייקט", input: "abc" },
{ schema: z.function(), expected: "פונקציה", input: "abc" },
];
for (const { schema, expected, input } of types) {
const result = schema.safeParse(input);
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toContain(expected);
}
}
});
});
});
@@ -0,0 +1,3 @@
import { getConnInfo } from "./conninfo.js";
import { handle } from "./handler.js";
export { getConnInfo, handle };
@@ -0,0 +1 @@
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/server/completable.ts","../src/server/middleware/bearerAuth.ts","../src/server/middleware/hostHeaderValidation.ts","../src/server/middleware/oauthMetadata.ts","../src/server/middleware/originValidation.ts","../src/server/requestStateCodec.ts","../src/server/streamableHttp.ts","../src/server/requestBody.ts","../src/fromJsonSchema.ts"],"sourcesContent":[],"mappings":";;;;cAEa;KAED,2BAA2B,mBAAmB,4BAC/C,gBAAA,CAAiB,WAAW,WAHvC;cAKoB;AALpB,CAAA,EAAA,GAOK,gBAAA,CAAiB,UAPwD,CAO7C,CAP6C,CAAA,EAAA,GAOtC,OAPsC,CAO9B,gBAAA,CAAiB,UAPa,CAOF,CAPE,CAAA,EAAA,CAAA;AAElE,KAOA,eAPgB,CAAA,UAOU,gBAPV,GAO6B,gBAP7B,CAAA,GAAA;EAAW,QAAA,EAQzB,gBARyB,CAQR,CARQ,CAAA;CAAmB;AACnB,KAU3B,iBAV2B,CAAA,UAUC,gBAVD,CAAA,GAUqB,CAVrB,GAAA;EAA5B,CAWN,kBAAA,CAXuB,EAWF,eAXE,CAWc,CAXd,CAAA;CAER;;;;;;;AAIpB;;;;;;AAIA;;;;;;;AAmCA;;;;;;;;AAaA;;;;ACnDiB,iBDsCD,WCtCmB,CAAA,UDsCG,gBCxBO,CAAA,CAAA,MAAA,EDwBmB,CCxBnB,EAAA,QAAA,EDwBgC,gBCxBhC,CDwBiD,CCxBjD,CAAA,CAAA,EDwBsD,iBCxBtD,CDwBwE,CCxBxE,CAAA;AAO7C;AAiCA;AA8EA;AAEa,iBDnFG,aAAA,CCmFH,MAAA,EAAA,OAAA,CAAA,EAAA,MAAA,IDnF6C,iBCmF7C,CDnF+D,gBCmF/D,CAAA;;;;;;ADhJb;AAEA;;;;;AAGoB,UCKH,kBAAA,CDLG;EAEa;;;;;;AAEjC;;;;;;AAIA;EAAwC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B,UAAA,CAAA,QAAA,EM2BL,QN3BK,EAAA,OAAA,EM2Bc,cN3Bd,CAAA,EM2B+B,ON3B/B,CM2BuC,ON3BvC,CAAA;EAGlB;;;;;;;AAmCZ;EAAsC,qBAAA,EAAA,OAAA,EMDF,ONCE,CAAA,EMDQ,ONCR,CMDgB,QNChB,GAAA,SAAA,CAAA;EAA0B,iBAAA,CAAA,WAAA,EME3C,ONF2C,EAAA;IAAA;EAAa,CAAb,EAAA;IAA8B,IAAA,EAAA,CAAA,OAAA,EMMlE,ONNkE,EAAA,OAAA,EMMhD,cNNgD,EAAA,GMM7B,ONN6B,CAAA,IAAA,CAAA;EAAjB,CAAA,CAAA,EMQtE,ONRsE,CMQ9D,QNR8D,CAAA;;;;AAa7E;UMqBiB,+CAAA;;;ALxEjB;AAqBA;AAiCA;AA8EA;EAEa,kBAAA,CAAA,EAAA,CAAA,GAAA,GAAA,MAAA,CAAA,GAAA,SAAA;EACF;;;AAuDX;;;;EAGW,oBAAA,CAAA,EAAA,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,GAAA,IAAA,GKzG+C,OLyG/C,CAAA,IAAA,CAAA,CAAA,GAAA,SAAA;EA8CK;;;;;;;;;;EC3PJ,eAAA,CAAA,EAAA,CAAA,CAAA,SAA0B,EAAA,MAAA,EAAA,GAAA,IAAA,GIgHe,OJhHf,CAAA,IAAA,CAAA,CAAA,GAALine truncated
@@ -0,0 +1,8 @@
import type { CodeKeywordDefinition, ErrorObject } from "../../types";
export type MultipleOfError = ErrorObject<"multipleOf", {
multipleOf: number;
}, number | {
$data: string;
}>;
declare const def: CodeKeywordDefinition;
export default def;
@@ -0,0 +1,516 @@
import { DOM_ERROR_HANDLER, DOM_INTERNAL_TAG, DOM_MEMO, DOM_RENDERER, DOM_STASH } from "../constants.js";
import { createContext } from "./context.js";
import { globalContexts, useContext } from "../context.js";
import { toArray } from "../children.js";
import { normalizeIntrinsicElementKey, styleObjectForEach } from "../utils.js";
import "../hooks/index.js";
//#region src/jsx/dom/render.ts
const HONO_PORTAL_ELEMENT = "_hp";
const eventAliasMap = {
Change: "Input",
DoubleClick: "DblClick"
};
const nameSpaceMap = {
svg: "2000/svg",
math: "1998/Math/MathML"
};
const buildDataStack = [];
const refCleanupMap = /* @__PURE__ */ new WeakMap();
let nameSpaceContext = void 0;
const getNameSpaceContext = () => nameSpaceContext;
const isNodeString = (node) => "t" in node;
const eventCache = { onClick: ["click", false] };
const getEventSpec = (key) => {
if (!key.startsWith("on")) return;
if (eventCache[key]) return eventCache[key];
const match = key.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);
if (match) {
const [, eventName, capture] = match;
return eventCache[key] = [(eventAliasMap[eventName] || eventName).toLowerCase(), !!capture];
}
};
const toAttributeName = (element, key) => nameSpaceContext && element instanceof SVGElement && /[A-Z]/.test(key) && (key in element.style || key.match(/^(?:o|pai|str|u|ve)/)) ? key.replace(/([A-Z])/g, "-$1").toLowerCase() : key;
const normalizeFormValue = (value) => value === null || value === void 0 || value === false ? null : value;
const applySelectValue = (select, props) => {
if (!("value" in props)) return;
select.value = normalizeFormValue(props["value"]);
if (!select.multiple && select.selectedIndex === -1) select.selectedIndex = 0;
};
const isIgnorableAttributeError = (error) => error instanceof DOMException && error.name === "InvalidCharacterError";
const applyProps = (container, attributes, oldAttributes) => {
attributes ||= {};
for (let key in attributes) {
const value = attributes[key];
if (key !== "children" && (!oldAttributes || oldAttributes[key] !== value)) {
key = normalizeIntrinsicElementKey(key);
const eventSpec = getEventSpec(key);
if (eventSpec) {
if (oldAttributes?.[key] !== value) {
if (oldAttributes) container.removeEventListener(eventSpec[0], oldAttributes[key], eventSpec[1]);
if (value != null) {
if (typeof value !== "function") throw new Error(`Event handler for "${key}" is not a function`);
container.addEventListener(eventSpec[0], value, eventSpec[1]);
}
}
} else if (key === "dangerouslySetInnerHTML" && value) container.innerHTML = value.__html;
else if (key === "ref") {
refCleanupMap.get(container)?.();
let cleanup;
if (typeof value === "function") cleanup = value(container) || (() => value(null));
else if (value && "current" in value) {
value.current = container;
cleanup = () => value.current = null;
}
refCleanupMap.set(container, cleanup);
} else if (key === "style") {
const style = container.style;
if (typeof value === "string") style.cssText = value;
else {
style.cssText = "";
if (value != null) styleObjectForEach(value, style.setProperty.bind(style));
}
} else {
if (key === "value") {
const nodeName = container.nodeName;
if (nodeName === "SELECT") continue;
else if (nodeName === "INPUT" || nodeName === "TEXTAREA") {
container.value = normalizeFormValue(value);
if (nodeName === "TEXTAREA") {
container.textContent = value;
continue;
}
}
} else if (key === "checked" && container.nodeName === "INPUT" || key === "selected" && container.nodeName === "OPTION") container[key] = value;
const k = toAttributeName(container, key);
try {
if (value === null || value === void 0 || value === false) container.removeAttribute(k);
else if (value === true) container.setAttribute(k, "");
else if (typeof value === "string" || typeof value === "number") container.setAttribute(k, value);
else container.setAttribute(k, value.toString());
} catch (e) {
if (!isIgnorableAttributeError(e)) throw e;
}
}
}
}
if (oldAttributes) for (let key in oldAttributes) {
const value = oldAttributes[key];
if (key !== "children" && !(key in attributes)) {
key = normalizeIntrinsicElementKey(key);
const eventSpec = getEventSpec(key);
if (eventSpec) container.removeEventListener(eventSpec[0], value, eventSpec[1]);
else if (key === "ref") {
refCleanupMap.get(container)?.();
refCleanupMap.delete(container);
} else try {
container.removeAttribute(toAttributeName(container, key));
} catch (e) {
if (!isIgnorableAttributeError(e)) throw e;
}
}
}
};
const invokeTag = (context, node) => {
node[DOM_STASH][0] = 0;
buildDataStack.push([context, node]);
const func = node.tag[DOM_RENDERER] || node.tag;
const props = func.defaultProps ? {
...func.defaultProps,
...node.props
} : node.props;
try {
return [func.call(null, props)];
} finally {
buildDataStack.pop();
}
};
const getNextChildren = (node, container, nextChildren, childrenToRemove, callbacks) => {
if (node.vR?.length) {
childrenToRemove.push(...node.vR);
delete node.vR;
}
if (typeof node.tag === "function") node[DOM_STASH][1][1]?.forEach((data) => callbacks.push(data));
node.vC.forEach((child) => {
if (isNodeString(child)) nextChildren.push(child);
else if (typeof child.tag === "function" || child.tag === "") {
child.c = container;
const currentNextChildrenIndex = nextChildren.length;
getNextChildren(child, container, nextChildren, childrenToRemove, callbacks);
if (child.s) {
for (let i = currentNextChildrenIndex; i < nextChildren.length; i++) nextChildren[i].s = true;
child.s = false;
}
} else {
nextChildren.push(child);
if (child.vR?.length) {
childrenToRemove.push(...child.vR);
delete child.vR;
}
}
});
};
const findInsertBefore = (node) => {
while (node && (node.tag === HONO_PORTAL_ELEMENT || !node.e)) node = node.tag === HONO_PORTAL_ELEMENT || !node.vC?.[0] ? node.nN : node.vC[0];
return node?.e;
};
const removeNode = (node) => {
if (!isNodeString(node)) {
node[DOM_STASH]?.[1][1]?.forEach((data) => data[2]?.());
refCleanupMap.get(node.e)?.();
if (node.p === 2) node.vC?.forEach((n) => n.p = 2);
node.vC?.forEach(removeNode);
}
if (!node.p) {
node.e?.remove();
delete node.e;
}
if (typeof node.tag === "function") {
updateMap.delete(node);
fallbackUpdateFnArrayMap.delete(node);
delete node[DOM_STASH][3];
node.a = true;
}
};
const apply = (node, container, isNew) => {
node.c = container;
applyNodeObject(node, container, isNew);
};
const findChildNodeIndex = (childNodes, child) => {
if (!child) return;
for (let i = 0, len = childNodes.length; i < len; i++) if (childNodes[i] === child) return i;
};
const cancelBuild = Symbol();
const applyNodeObject = (node, container, isNew) => {
const next = [];
const remove = [];
const callbacks = [];
getNextChildren(node, container, next, remove, callbacks);
remove.forEach(removeNode);
const childNodes = isNew ? void 0 : container.childNodes;
let offset;
let insertBeforeNode = null;
if (isNew) offset = -1;
else if (!childNodes.length) offset = 0;
else {
const offsetByNextNode = findChildNodeIndex(childNodes, findInsertBefore(node.nN));
if (offsetByNextNode !== void 0) {
insertBeforeNode = childNodes[offsetByNextNode];
offset = offsetByNextNode;
} else offset = findChildNodeIndex(childNodes, next.find((n) => n.tag !== HONO_PORTAL_ELEMENT && n.e)?.e) ?? -1;
if (offset === -1) isNew = true;
}
for (let i = 0, len = next.length; i < len; i++, offset++) {
const child = next[i];
let el;
if (child.s && child.e) {
el = child.e;
child.s = false;
} else {
const isNewLocal = isNew || !child.e;
if (isNodeString(child)) {
if (child.e && child.d) child.e.textContent = child.t;
child.d = false;
el = child.e ||= document.createTextNode(child.t);
} else {
el = child.e ||= child.n ? document.createElementNS(child.n, child.tag) : document.createElement(child.tag);
applyProps(el, child.props, child.pP);
applyNodeObject(child, el, isNewLocal);
if (child.tag === "select") applySelectValue(el, child.props);
}
}
if (child.tag === HONO_PORTAL_ELEMENT) offset--;
else if (isNew) {
if (!el.parentNode) container.appendChild(el);
} else if (childNodes[offset] !== el && childNodes[offset - 1] !== el) {
if (childNodes[offset + 1] === el) container.appendChild(childNodes[offset]);
else container.insertBefore(el, insertBeforeNode || childNodes[offset] || null);
}
}
if (node.pP) node.pP = void 0;
if (callbacks.length) {
const useLayoutEffectCbs = [];
const useEffectCbs = [];
callbacks.forEach(([, useLayoutEffectCb, , useEffectCb, useInsertionEffectCb]) => {
if (useLayoutEffectCb) useLayoutEffectCbs.push(useLayoutEffectCb);
if (useEffectCb) useEffectCbs.push(useEffectCb);
useInsertionEffectCb?.();
});
useLayoutEffectCbs.forEach((cb) => cb());
if (useEffectCbs.length) requestAnimationFrame(() => {
useEffectCbs.forEach((cb) => cb());
});
}
};
const isSameContext = (oldContexts, newContexts) => !!(oldContexts && oldContexts.length === newContexts.length && oldContexts.every((ctx, i) => ctx[1] === newContexts[i][1]));
const indexChildrenByKey = (children) => {
const index = /* @__PURE__ */ new Map();
for (const child of children) {
const key = child.key;
if (index.has(key)) return;
index.set(key, child);
}
return index;
};
const fallbackUpdateFnArrayMap = /* @__PURE__ */ new WeakMap();
const build = (context, node, children) => {
const buildWithPreviousChildren = !children && node.pC;
if (children) node.pC ||= node.vC;
let foundErrorHandler;
try {
children ||= typeof node.tag == "function" ? invokeTag(context, node) : toArray(node.props.children);
if (children[0]?.tag === "" && children[0][DOM_ERROR_HANDLER]) {
foundErrorHandler = children[0][DOM_ERROR_HANDLER];
context[5].push([
context,
foundErrorHandler,
node
]);
}
let oldVChildren = buildWithPreviousChildren ? [...node.pC] : node.vC ? [...node.vC] : void 0;
const vChildren = [];
let prevNode;
let scanBudget = (oldVChildren?.length || 0) * 2;
let oldChildrenByKey;
for (let i = 0; i < children.length; i++) {
if (Array.isArray(children[i])) {
children.splice(i, 1, ...children[i].flat(Infinity));
i--;
continue;
}
let child = buildNode(children[i]);
if (child) {
if (typeof child.tag === "function" && !child.tag[DOM_INTERNAL_TAG]) {
if (globalContexts.length > 0) child[DOM_STASH][2] = globalContexts.map((c) => [c, c.values.at(-1)]);
if (context[5]?.length) child[DOM_STASH][3] = context[5].at(-1);
}
let oldChild;
if (oldChildrenByKey && child.key === void 0 && !isNodeString(child)) {
oldVChildren = [...oldChildrenByKey.values()];
oldChildrenByKey = void 0;
}
if (oldChildrenByKey) {
const key = child.key;
const candidate = oldChildrenByKey.get(key);
if (candidate && (isNodeString(child) ? isNodeString(candidate) : candidate.tag === child.tag && candidate.key === key)) {
oldChild = candidate;
oldChildrenByKey.delete(key);
}
} else if (oldVChildren && oldVChildren.length) {
const first = oldVChildren[0];
if (isNodeString(child) ? isNodeString(first) : !isNodeString(first) && (child.key !== void 0 ? first.key === child.key && first.tag === child.tag : first.tag === child.tag)) oldChild = oldVChildren.shift();
else {
const i = oldVChildren.findIndex(isNodeString(child) ? (c) => isNodeString(c) : child.key !== void 0 ? (c) => c.key === child.key && c.tag === child.tag : (c) => c.tag === child.tag);
scanBudget -= i === -1 ? oldVChildren.length : i;
if (i !== -1) {
oldChild = oldVChildren[i];
oldVChildren.splice(i, 1);
}
if (scanBudget < 0) {
scanBudget = Infinity;
oldChildrenByKey = indexChildrenByKey(oldVChildren);
}
}
}
if (oldChild) {
if (isNodeString(child)) {
if (oldChild.t !== child.t) {
oldChild.t = child.t;
oldChild.d = true;
}
child = oldChild;
} else {
const pP = oldChild.pP = oldChild.props;
oldChild.props = child.props;
oldChild.f ||= child.f || node.f;
if (typeof child.tag === "function") {
const oldContexts = oldChild[DOM_STASH][2];
oldChild[DOM_STASH][2] = child[DOM_STASH][2] || [];
oldChild[DOM_STASH][3] = child[DOM_STASH][3];
if (!oldChild.f && ((oldChild.o || oldChild) === child.o || oldChild.tag[DOM_MEMO]?.(pP, oldChild.props)) && isSameContext(oldContexts, oldChild[DOM_STASH][2])) oldChild.s = true;
}
child = oldChild;
}
} else if (!isNodeString(child) && nameSpaceContext) {
const ns = useContext(nameSpaceContext);
if (ns) child.n = ns;
}
if (!isNodeString(child) && !child.s) {
build(context, child);
delete child.f;
}
vChildren.push(child);
if (prevNode && !prevNode.s && !child.s) for (let p = prevNode; p && !isNodeString(p); p = p.vC?.at(-1)) p.nN = child;
prevNode = child;
}
}
oldVChildren = oldChildrenByKey ? [...oldChildrenByKey.values()] : oldVChildren;
node.vR = buildWithPreviousChildren ? [...node.vC, ...oldVChildren || []] : oldVChildren || [];
node.vC = vChildren;
if (buildWithPreviousChildren) delete node.pC;
} catch (e) {
node.f = true;
if (e === cancelBuild) {
if (foundErrorHandler) return;
else throw e;
}
const [errorHandlerContext, errorHandler, errorHandlerNode] = node[DOM_STASH]?.[3] || [];
if (errorHandler) {
const fallbackUpdateFn = () => update([
0,
false,
context[2]
], errorHandlerNode);
const fallbackUpdateFnArray = fallbackUpdateFnArrayMap.get(errorHandlerNode) || [];
fallbackUpdateFnArray.push(fallbackUpdateFn);
fallbackUpdateFnArrayMap.set(errorHandlerNode, fallbackUpdateFnArray);
const fallback = errorHandler(e, () => {
const fnArray = fallbackUpdateFnArrayMap.get(errorHandlerNode);
if (fnArray) {
const i = fnArray.indexOf(fallbackUpdateFn);
if (i !== -1) {
fnArray.splice(i, 1);
return fallbackUpdateFn();
}
}
});
if (fallback) {
if (context[0] === 1) context[1] = true;
else {
build(context, errorHandlerNode, [fallback]);
if ((errorHandler.length === 1 || context !== errorHandlerContext) && errorHandlerNode.c) {
apply(errorHandlerNode, errorHandlerNode.c, false);
return;
}
}
throw cancelBuild;
}
}
throw e;
} finally {
if (foundErrorHandler) context[5].pop();
}
};
const buildNode = (node) => {
if (node === void 0 || node === null || typeof node === "boolean") return;
else if (typeof node === "string" || typeof node === "number") return {
t: node.toString(),
d: true
};
else {
if ("vR" in node) node = {
tag: node.tag,
props: node.props,
key: node.key,
f: node.f,
type: node.tag,
ref: node.props.ref,
o: node.o || node
};
if (typeof node.tag === "function") node[DOM_STASH] = [0, []];
else {
const ns = nameSpaceMap[node.tag];
if (ns) {
nameSpaceContext ||= createContext("");
node.props.children = [{
tag: nameSpaceContext,
props: {
value: node.n = `http://www.w3.org/${ns}`,
children: node.props.children
}
}];
}
}
return node;
}
};
const replaceContainer = (node, from, to) => {
if (node.c === from) {
node.c = to;
node.vC.forEach((child) => replaceContainer(child, from, to));
}
};
const updateSync = (context, node) => {
node[DOM_STASH][2]?.forEach(([c, v]) => {
c.values.push(v);
});
try {
build(context, node, void 0);
} catch {
return;
}
if (node.a) {
delete node.a;
return;
}
node[DOM_STASH][2]?.forEach(([c]) => {
c.values.pop();
});
if (context[0] !== 1 || !context[1]) apply(node, node.c, false);
};
const updateMap = /* @__PURE__ */ new WeakMap();
const currentUpdateSets = [];
const update = async (context, node) => {
context[5] ||= [];
const existing = updateMap.get(node);
if (existing) existing[0](void 0);
let resolve;
const promise = new Promise((r) => resolve = r);
updateMap.set(node, [resolve, () => {
if (context[2]) context[2](context, node, (context) => {
updateSync(context, node);
}).then(() => resolve(node));
else {
updateSync(context, node);
resolve(node);
}
}]);
if (currentUpdateSets.length) currentUpdateSets.at(-1).add(node);
else {
await Promise.resolve();
const latest = updateMap.get(node);
if (latest) {
updateMap.delete(node);
latest[1]();
}
}
return promise;
};
const renderNode = (node, container) => {
const context = [];
context[5] = [];
context[4] = true;
build(context, node, void 0);
context[4] = false;
const fragment = document.createDocumentFragment();
apply(node, fragment, true);
replaceContainer(node, fragment, container);
container.replaceChildren(fragment);
};
const render = (jsxNode, container) => {
renderNode(buildNode({
tag: "",
props: { children: jsxNode }
}), container);
};
const flushSync = (callback) => {
const set = /* @__PURE__ */ new Set();
currentUpdateSets.push(set);
callback();
set.forEach((node) => {
const latest = updateMap.get(node);
if (latest) {
updateMap.delete(node);
latest[1]();
}
});
currentUpdateSets.pop();
};
const createPortal = (children, container, key) => ({
tag: HONO_PORTAL_ELEMENT,
props: { children },
key,
e: container,
p: 1
});
//#endregion
export { build, buildDataStack, buildNode, createPortal, flushSync, getNameSpaceContext, render, renderNode, update };
@@ -0,0 +1,3 @@
import { MatchEstimated, MatchExtended } from '../../types';
declare const _default: ({ baseGuesses, repeatCount }: MatchExtended | MatchEstimated) => number;
export default _default;
@@ -0,0 +1,311 @@
// Type definitions for commander
// Original definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
///<reference types="node" />
declare namespace commander {
interface CommanderError extends Error {
code: string;
exitCode: number;
message: string;
nestedError?: string;
}
type CommanderErrorConstructor = { new (exitCode: number, code: string, message: string): CommanderError };
interface Option {
flags: string;
required: boolean; // A value must be supplied when the option is specified.
optional: boolean; // A value is optional when the option is specified.
mandatory: boolean; // The option must have a value after parsing, which usually means it must be specified on command line.
bool: boolean;
short?: string;
long: string;
description: string;
}
type OptionConstructor = { new (flags: string, description?: string): Option };
interface Command extends NodeJS.EventEmitter {
[key: string]: any; // options as properties
args: string[];
/**
* Set the program version to `str`.
*
* This method auto-registers the "-V, --version" flag
* which will print the version number when passed.
*
* You can optionally supply the flags and description to override the defaults.
*/
version(str: string, flags?: string, description?: string): Command;
/**
* Define a command, implemented using an action handler.
*
* @remarks
* The command description is supplied using `.description`, not as a parameter to `.command`.
*
* @example
* ```ts
* program
* .command('clone <source> [destination]')
* .description('clone a repository into a newly created directory')
* .action((source, destination) => {
* console.log('clone command called');
* });
* ```
*
* @param nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
* @param opts - configuration options
* @returns new command
*/
command(nameAndArgs: string, opts?: CommandOptions): Command;
/**
* Define a command, implemented in a separate executable file.
*
* @remarks
* The command description is supplied as the second parameter to `.command`.
*
* @example
* ```ts
* program
* .command('start <service>', 'start named service')
* .command('stop [service]', 'stop named serice, or all if no name supplied');
* ```
*
* @param nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
* @param description - description of executable command
* @param opts - configuration options
* @returns top level command for chaining more command definitions
*/
command(nameAndArgs: string, description: string, opts?: commander.CommandOptions): Command;
/**
* Define argument syntax for the top-level command.
*
* @returns Command for chaining
*/
arguments(desc: string): Command;
/**
* Parse expected `args`.
*
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
*
* @returns Command for chaining
*/
parseExpectedArgs(args: string[]): Command;
/**
* Register callback to use as replacement for calling process.exit.
*/
exitOverride(callback?: (err: CommanderError) => never|void): Command;
/**
* Register callback `fn` for the command.
*
* @example
* program
* .command('help')
* .description('display verbose help')
* .action(function() {
* // output help here
* });
*
* @returns Command for chaining
*/
action(fn: (...args: any[]) => void | Promise<void>): Command;
/**
* Define option with `flags`, `description` and optional
* coercion `fn`.
*
* The `flags` string should contain both the short and long flags,
* separated by comma, a pipe or space. The following are all valid
* all will output this way when `--help` is used.
*
* "-p, --pepper"
* "-p|--pepper"
* "-p --pepper"
*
* @example
* // simple boolean defaulting to false
* program.option('-p, --pepper', 'add pepper');
*
* --pepper
* program.pepper
* // => Boolean
*
* // simple boolean defaulting to true
* program.option('-C, --no-cheese', 'remove cheese');
*
* program.cheese
* // => true
*
* --no-cheese
* program.cheese
* // => false
*
* // required argument
* program.option('-C, --chdir <path>', 'change the working directory');
*
* --chdir /tmp
* program.chdir
* // => "/tmp"
*
* // optional argument
* program.option('-c, --cheese [type]', 'add cheese [marble]');
*
* @returns Command for chaining
*/
option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command;
option(flags: string, description?: string, defaultValue?: any): Command;
/**
* Define a required option, which must have a value after parsing. This usually means
* the option must be specified on the command line. (Otherwise the same as .option().)
*
* The `flags` string should contain both the short and long flags, separated by comma, a pipe or space.
*/
requiredOption(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command;
requiredOption(flags: string, description?: string, defaultValue?: any): Command;
/**
* Whether to store option values as properties on command object,
* or store separately (specify false). In both cases the option values can be accessed using .opts().
*
* @return Command for chaining
*/
storeOptionsAsProperties(value?: boolean): Command;
/**
* Whether to pass command to action handler,
* or just the options (specify false).
*
* @return Command for chaining
*/
passCommandToAction(value?: boolean): Command;
/**
* Allow unknown options on the command line.
*
* @param [arg] if `true` or omitted, no error will be thrown for unknown options.
* @returns Command for chaining
*/
allowUnknownOption(arg?: boolean): Command;
/**
* Parse `argv`, setting options and invoking commands when defined.
*
* @returns Command for chaining
*/
parse(argv: string[]): Command;
/**
* Parse `argv`, setting options and invoking commands when defined.
*
* Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise.
*
* @returns Promise
*/
parseAsync(argv: string[]): Promise<any>;
/**
* Parse options from `argv` returning `argv` void of these options.
*/
parseOptions(argv: string[]): commander.ParseOptionsResult;
/**
* Return an object containing options as key-value pairs
*/
opts(): { [key: string]: any };
/**
* Set the description.
*
* @returns Command for chaining
*/
description(str: string, argsDescription?: {[argName: string]: string}): Command;
/**
* Get the description.
*/
description(): string;
/**
* Set an alias for the command.
*
* @returns Command for chaining
*/
alias(alias: string): Command;
/**
* Get alias for the command.
*/
alias(): string;
/**
* Set the command usage.
*
* @returns Command for chaining
*/
usage(str: string): Command;
/**
* Get the command usage.
*/
usage(): string;
/**
* Set the name of the command.
*
* @returns Command for chaining
*/
name(str: string): Command;
/**
* Get the name of the command.
*/
name(): string;
/**
* Output help information for this command.
*
* When listener(s) are available for the helpLongFlag
* those callbacks are invoked.
*/
outputHelp(cb?: (str: string) => string): void;
/**
* You can pass in flags and a description to override the help
* flags and help description for your command.
*/
helpOption(flags?: string, description?: string): Command;
/**
* Output help information and exit.
*/
help(cb?: (str: string) => string): never;
}
type CommandConstructor = { new (name?: string): Command };
interface CommandOptions {
noHelp?: boolean;
isDefault?: boolean;
executableFile?: string;
}
interface ParseOptionsResult {
args: string[];
unknown: string[];
}
interface CommanderStatic extends Command {
Command: CommandConstructor;
Option: OptionConstructor;
CommanderError:CommanderErrorConstructor;
}
}
declare const commander: commander.CommanderStatic;
export = commander;
@@ -0,0 +1,63 @@
{
"name": "class-variance-authority",
"version": "0.7.1",
"description": "Class Variance Authority 🧬",
"keywords": [
"Class Variance Authority",
"class-variance-authority",
"classes",
"classname",
"classnames",
"css",
"cva",
"stitches",
"vanilla-extract",
"variants"
],
"homepage": "https://github.com/joe-bell/cva#readme",
"bugs": "https://github.com/joe-bell/cva/issues",
"repository": "https://github.com/joe-bell/cva.git",
"funding": "https://polar.sh/cva",
"license": "Apache-2.0",
"author": "Joe Bell (https://joebell.co.uk)",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./types": {
"types": "./dist/types.d.ts"
}
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/"
],
"dependencies": {
"clsx": "^2.1.1"
},
"devDependencies": {
"@swc/cli": "0.3.12",
"@swc/core": "1.4.16",
"@types/node": "20.12.7",
"@types/react": "18.2.79",
"@types/react-dom": "18.2.25",
"bundlesize": "0.18.2",
"npm-run-all": "4.1.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"ts-node": "10.9.2",
"typescript": "5.4.5"
},
"scripts": {
"build": "run-p build:**",
"build:cjs": "swc ./src/index.ts --config-file ./.config/.swcrc -o dist/index.js -C module.type=commonjs",
"build:esm": "swc ./src/index.ts --config-file ./.config/.swcrc -o dist/index.mjs -C module.type=es6 ",
"build:tsc": "tsc --project .config/tsconfig.build.json",
"check": "tsc --project tsconfig.json --noEmit",
"bundlesize": "pnpm build && bundlesize -f 'dist/*.js' -s 1.2KB"
}
}
@@ -0,0 +1,4 @@
import { RequestHandler } from 'express';
import { OAuthMetadata, OAuthProtectedResourceMetadata } from '../../../shared/auth.js';
export declare function metadataHandler(metadata: OAuthMetadata | OAuthProtectedResourceMetadata): RequestHandler;
//# sourceMappingURL=metadata.d.ts.map
@@ -0,0 +1,46 @@
/**
* @fileoverview Rule to flag nested ternary expressions
* @author Ian Christian Myers
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow nested ternary expressions",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/no-nested-ternary",
},
schema: [],
messages: {
noNestedTernary: "Do not nest ternary expressions.",
},
},
create(context) {
return {
ConditionalExpression(node) {
if (
node.alternate.type === "ConditionalExpression" ||
node.consequent.type === "ConditionalExpression"
) {
context.report({
node,
messageId: "noNestedTernary",
});
}
},
};
},
};
@@ -0,0 +1 @@
{"version":3,"file":"unevaluatedItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/unevaluatedItems.ts"],"names":[],"mappings":";;AAOA,mDAAuD;AACvD,6CAA0D;AAI1D,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,MAAM,KAAK,GAAG,E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