docs: 仓库链接指向本镜像仓库
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Skipped

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,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 ArrowUpLeft = createLucideIcon("ArrowUpLeft", [
["path", { d: "M7 17V7h10", key: "11bw93" }],
["path", { d: "M17 17 7 7", key: "2786uv" }]
]);
export { ArrowUpLeft as default };
//# sourceMappingURL=arrow-up-left.js.map
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const LogOut = createLucideIcon("LogOut", [
["path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4", key: "1uf3rs" }],
["polyline", { points: "16 17 21 12 16 7", key: "1gabdz" }],
["line", { x1: "21", x2: "9", y1: "12", y2: "12", key: "1uyos4" }]
]);
export { LogOut as default };
//# sourceMappingURL=log-out.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"2":"_J"},C:{"2":"_S"},D:{"2":"_Q"},E:{"1":"_PD","2":"_UB","33":"F"},F:{"2":"_c"},G:{"1":"_BB","2":"_3","33":"_gC"},H:{"2":"1D"},I:{"2":"_P"},J:{"2":"_B"},K:{"2":"_N"},L:{"2":"I"},M:{"2":"YC"},N:{"2":"_A"},O:{"2":"bC"},P:{"2":"_F"},Q:{"2":"JE"},R:{"2":"KE"},S:{"2":"_C"}},B:5,C:"CSS filter() function",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"tent-tree.js","sources":["../../../src/icons/tent-tree.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name TentTree\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSI0IiBjeT0iNCIgcj0iMiIgLz4KICA8cGF0aCBkPSJtMTQgNSAzLTMgMyAzIiAvPgogIDxwYXRoIGQ9Im0xNCAxMCAzLTMgMyAzIiAvPgogIDxwYXRoIGQ9Ik0xNyAxNFYyIiAvPgogIDxwYXRoIGQ9Ik0xNyAxNEg3bC01IDhoMjBaIiAvPgogIDxwYXRoIGQ9Ik04IDE0djgiIC8+CiAgPHBhdGggZD0ibTkgMTQgNSA4IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/tent-tree\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 TentTree = createLucideIcon('TentTree', [\n ['circle', { cx: '4', cy: '4', r: '2', key: 'bt5ra8' }],\n ['path', { d: 'm14 5 3-3 3 3', key: '1sorif' }],\n ['path', { d: 'm14 10 3-3 3 3', key: '1jyi9h' }],\n ['path', { d: 'M17 14V2', key: '8ymqnk' }],\n ['path', { d: 'M17 14H7l-5 8h20Z', key: '13ar7p' }],\n ['path', { d: 'M8 14v8', key: '1ghmqk' }],\n ['path', { d: 'm9 14 5 8', key: '13pgi6' }],\n]);\n\nexport default TentTree;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAC5C,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,EAAK,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACtD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,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,CAC9C,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,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,CAAqB,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,CAClD,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,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC5C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,61 @@
# toidentifier
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
[![Test Coverage][codecov-image]][codecov-url]
> Convert a string of words to a JavaScript identifier
## Install
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```bash
$ npm install toidentifier
```
## Example
```js
var toIdentifier = require('toidentifier')
console.log(toIdentifier('Bad Request'))
// => "BadRequest"
```
## API
This CommonJS module exports a single default function: `toIdentifier`.
### toIdentifier(string)
Given a string as the argument, it will be transformed according to
the following rules and the new string will be returned:
1. Split into words separated by space characters (`0x20`).
2. Upper case the first character of each word.
3. Join the words together with no separator.
4. Remove all non-word (`[0-9a-z_]`) characters.
## License
[MIT](LICENSE)
[codecov-image]: https://img.shields.io/codecov/c/github/component/toidentifier.svg
[codecov-url]: https://codecov.io/gh/component/toidentifier
[downloads-image]: https://img.shields.io/npm/dm/toidentifier.svg
[downloads-url]: https://npmjs.org/package/toidentifier
[github-actions-ci-image]: https://img.shields.io/github/workflow/status/component/toidentifier/ci/master?label=ci
[github-actions-ci-url]: https://github.com/component/toidentifier?query=workflow%3Aci
[npm-image]: https://img.shields.io/npm/v/toidentifier.svg
[npm-url]: https://npmjs.org/package/toidentifier
##
[npm]: https://www.npmjs.com/
[yarn]: https://yarnpkg.com/
@@ -0,0 +1,18 @@
/**
* @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 Webcam = createLucideIcon("Webcam", [
["circle", { cx: "12", cy: "10", r: "8", key: "1gshiw" }],
["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }],
["path", { d: "M7 22h10", key: "10w4w3" }],
["path", { d: "M12 22v-4", key: "1utk9m" }]
]);
export { Webcam as default };
//# sourceMappingURL=webcam.js.map
@@ -0,0 +1,58 @@
/**
* @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 Wheat = createLucideIcon("Wheat", [
["path", { d: "M2 22 16 8", key: "60hf96" }],
[
"path",
{
d: "M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",
key: "1rdhi6"
}
],
[
"path",
{
d: "M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",
key: "1sdzmb"
}
],
[
"path",
{
d: "M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",
key: "eoatbi"
}
],
["path", { d: "M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z", key: "19rau1" }],
[
"path",
{
d: "M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",
key: "tc8ph9"
}
],
[
"path",
{
d: "M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",
key: "2m8kc5"
}
],
[
"path",
{
d: "M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",
key: "vex3ng"
}
]
]);
export { Wheat as default };
//# sourceMappingURL=wheat.js.map
@@ -0,0 +1,510 @@
@theme default {
--font-sans:
ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
--font-serif: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
--font-mono:
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
monospace;
--color-red-50: oklch(97.1% 0.013 17.38);
--color-red-100: oklch(93.6% 0.032 17.717);
--color-red-200: oklch(88.5% 0.062 18.334);
--color-red-300: oklch(80.8% 0.114 19.571);
--color-red-400: oklch(70.4% 0.191 22.216);
--color-red-500: oklch(63.7% 0.237 25.331);
--color-red-600: oklch(57.7% 0.245 27.325);
--color-red-700: oklch(50.5% 0.213 27.518);
--color-red-800: oklch(44.4% 0.177 26.899);
--color-red-900: oklch(39.6% 0.141 25.723);
--color-red-950: oklch(25.8% 0.092 26.042);
--color-orange-50: oklch(98% 0.016 73.684);
--color-orange-100: oklch(95.4% 0.038 75.164);
--color-orange-200: oklch(90.1% 0.076 70.697);
--color-orange-300: oklch(83.7% 0.128 66.29);
--color-orange-400: oklch(75% 0.183 55.934);
--color-orange-500: oklch(70.5% 0.213 47.604);
--color-orange-600: oklch(64.6% 0.222 41.116);
--color-orange-700: oklch(55.3% 0.195 38.402);
--color-orange-800: oklch(47% 0.157 37.304);
--color-orange-900: oklch(40.8% 0.123 38.172);
--color-orange-950: oklch(26.6% 0.079 36.259);
--color-amber-50: oklch(98.7% 0.022 95.277);
--color-amber-100: oklch(96.2% 0.059 95.617);
--color-amber-200: oklch(92.4% 0.12 95.746);
--color-amber-300: oklch(87.9% 0.169 91.605);
--color-amber-400: oklch(82.8% 0.189 84.429);
--color-amber-500: oklch(76.9% 0.188 70.08);
--color-amber-600: oklch(66.6% 0.179 58.318);
--color-amber-700: oklch(55.5% 0.163 48.998);
--color-amber-800: oklch(47.3% 0.137 46.201);
--color-amber-900: oklch(41.4% 0.112 45.904);
--color-amber-950: oklch(27.9% 0.077 45.635);
--color-yellow-50: oklch(98.7% 0.026 102.212);
--color-yellow-100: oklch(97.3% 0.071 103.193);
--color-yellow-200: oklch(94.5% 0.129 101.54);
--color-yellow-300: oklch(90.5% 0.182 98.111);
--color-yellow-400: oklch(85.2% 0.199 91.936);
--color-yellow-500: oklch(79.5% 0.184 86.047);
--color-yellow-600: oklch(68.1% 0.162 75.834);
--color-yellow-700: oklch(55.4% 0.135 66.442);
--color-yellow-800: oklch(47.6% 0.114 61.907);
--color-yellow-900: oklch(42.1% 0.095 57.708);
--color-yellow-950: oklch(28.6% 0.066 53.813);
--color-lime-50: oklch(98.6% 0.031 120.757);
--color-lime-100: oklch(96.7% 0.067 122.328);
--color-lime-200: oklch(93.8% 0.127 124.321);
--color-lime-300: oklch(89.7% 0.196 126.665);
--color-lime-400: oklch(84.1% 0.238 128.85);
--color-lime-500: oklch(76.8% 0.233 130.85);
--color-lime-600: oklch(64.8% 0.2 131.684);
--color-lime-700: oklch(53.2% 0.157 131.589);
--color-lime-800: oklch(45.3% 0.124 130.933);
--color-lime-900: oklch(40.5% 0.101 131.063);
--color-lime-950: oklch(27.4% 0.072 132.109);
--color-green-50: oklch(98.2% 0.018 155.826);
--color-green-100: oklch(96.2% 0.044 156.743);
--color-green-200: oklch(92.5% 0.084 155.995);
--color-green-300: oklch(87.1% 0.15 154.449);
--color-green-400: oklch(79.2% 0.209 151.711);
--color-green-500: oklch(72.3% 0.219 149.579);
--color-green-600: oklch(62.7% 0.194 149.214);
--color-green-700: oklch(52.7% 0.154 150.069);
--color-green-800: oklch(44.8% 0.119 151.328);
--color-green-900: oklch(39.3% 0.095 152.535);
--color-green-950: oklch(26.6% 0.065 152.934);
--color-emerald-50: oklch(97.9% 0.021 166.113);
--color-emerald-100: oklch(95% 0.052 163.051);
--color-emerald-200: oklch(90.5% 0.093 164.15);
--color-emerald-300: oklch(84.5% 0.143 164.978);
--color-emerald-400: oklch(76.5% 0.177 163.223);
--color-emerald-500: oklch(69.6% 0.17 162.48);
--color-emerald-600: oklch(59.6% 0.145 163.225);
--color-emerald-700: oklch(50.8% 0.118 165.612);
--color-emerald-800: oklch(43.2% 0.095 166.913);
--color-emerald-900: oklch(37.8% 0.077 168.94);
--color-emerald-950: oklch(26.2% 0.051 172.552);
--color-teal-50: oklch(98.4% 0.014 180.72);
--color-teal-100: oklch(95.3% 0.051 180.801);
--color-teal-200: oklch(91% 0.096 180.426);
--color-teal-300: oklch(85.5% 0.138 181.071);
--color-teal-400: oklch(77.7% 0.152 181.912);
--color-teal-500: oklch(70.4% 0.14 182.503);
--color-teal-600: oklch(60% 0.118 184.704);
--color-teal-700: oklch(51.1% 0.096 186.391);
--color-teal-800: oklch(43.7% 0.078 188.216);
--color-teal-900: oklch(38.6% 0.063 188.416);
--color-teal-950: oklch(27.7% 0.046 192.524);
--color-cyan-50: oklch(98.4% 0.019 200.873);
--color-cyan-100: oklch(95.6% 0.045 203.388);
--color-cyan-200: oklch(91.7% 0.08 205.041);
--color-cyan-300: oklch(86.5% 0.127 207.078);
--color-cyan-400: oklch(78.9% 0.154 211.53);
--color-cyan-500: oklch(71.5% 0.143 215.221);
--color-cyan-600: oklch(60.9% 0.126 221.723);
--color-cyan-700: oklch(52% 0.105 223.128);
--color-cyan-800: oklch(45% 0.085 224.283);
--color-cyan-900: oklch(39.8% 0.07 227.392);
--color-cyan-950: oklch(30.2% 0.056 229.695);
--color-sky-50: oklch(97.7% 0.013 236.62);
--color-sky-100: oklch(95.1% 0.026 236.824);
--color-sky-200: oklch(90.1% 0.058 230.902);
--color-sky-300: oklch(82.8% 0.111 230.318);
--color-sky-400: oklch(74.6% 0.16 232.661);
--color-sky-500: oklch(68.5% 0.169 237.323);
--color-sky-600: oklch(58.8% 0.158 241.966);
--color-sky-700: oklch(50% 0.134 242.749);
--color-sky-800: oklch(44.3% 0.11 240.79);
--color-sky-900: oklch(39.1% 0.09 240.876);
--color-sky-950: oklch(29.3% 0.066 243.157);
--color-blue-50: oklch(97% 0.014 254.604);
--color-blue-100: oklch(93.2% 0.032 255.585);
--color-blue-200: oklch(88.2% 0.059 254.128);
--color-blue-300: oklch(80.9% 0.105 251.813);
--color-blue-400: oklch(70.7% 0.165 254.624);
--color-blue-500: oklch(62.3% 0.214 259.815);
--color-blue-600: oklch(54.6% 0.245 262.881);
--color-blue-700: oklch(48.8% 0.243 264.376);
--color-blue-800: oklch(42.4% 0.199 265.638);
--color-blue-900: oklch(37.9% 0.146 265.522);
--color-blue-950: oklch(28.2% 0.091 267.935);
--color-indigo-50: oklch(96.2% 0.018 272.314);
--color-indigo-100: oklch(93% 0.034 272.788);
--color-indigo-200: oklch(87% 0.065 274.039);
--color-indigo-300: oklch(78.5% 0.115 274.713);
--color-indigo-400: oklch(67.3% 0.182 276.935);
--color-indigo-500: oklch(58.5% 0.233 277.117);
--color-indigo-600: oklch(51.1% 0.262 276.966);
--color-indigo-700: oklch(45.7% 0.24 277.023);
--color-indigo-800: oklch(39.8% 0.195 277.366);
--color-indigo-900: oklch(35.9% 0.144 278.697);
--color-indigo-950: oklch(25.7% 0.09 281.288);
--color-violet-50: oklch(96.9% 0.016 293.756);
--color-violet-100: oklch(94.3% 0.029 294.588);
--color-violet-200: oklch(89.4% 0.057 293.283);
--color-violet-300: oklch(81.1% 0.111 293.571);
--color-violet-400: oklch(70.2% 0.183 293.541);
--color-violet-500: oklch(60.6% 0.25 292.717);
--color-violet-600: oklch(54.1% 0.281 293.009);
--color-violet-700: oklch(49.1% 0.27 292.581);
--color-violet-800: oklch(43.2% 0.232 292.759);
--color-violet-900: oklch(38% 0.189 293.745);
--color-violet-950: oklch(28.3% 0.141 291.089);
--color-purple-50: oklch(97.7% 0.014 308.299);
--color-purple-100: oklch(94.6% 0.033 307.174);
--color-purple-200: oklch(90.2% 0.063 306.703);
--color-purple-300: oklch(82.7% 0.119 306.383);
--color-purple-400: oklch(71.4% 0.203 305.504);
--color-purple-500: oklch(62.7% 0.265 303.9);
--color-purple-600: oklch(55.8% 0.288 302.321);
--color-purple-700: oklch(49.6% 0.265 301.924);
--color-purple-800: oklch(43.8% 0.218 303.724);
--color-purple-900: oklch(38.1% 0.176 304.987);
--color-purple-950: oklch(29.1% 0.149 302.717);
--color-fuchsia-50: oklch(97.7% 0.017 320.058);
--color-fuchsia-100: oklch(95.2% 0.037 318.852);
--color-fuchsia-200: oklch(90.3% 0.076 319.62);
--color-fuchsia-300: oklch(83.3% 0.145 321.434);
--color-fuchsia-400: oklch(74% 0.238 322.16);
--color-fuchsia-500: oklch(66.7% 0.295 322.15);
--color-fuchsia-600: oklch(59.1% 0.293 322.896);
--color-fuchsia-700: oklch(51.8% 0.253 323.949);
--color-fuchsia-800: oklch(45.2% 0.211 324.591);
--color-fuchsia-900: oklch(40.1% 0.17 325.612);
--color-fuchsia-950: oklch(29.3% 0.136 325.661);
--color-pink-50: oklch(97.1% 0.014 343.198);
--color-pink-100: oklch(94.8% 0.028 342.258);
--color-pink-200: oklch(89.9% 0.061 343.231);
--color-pink-300: oklch(82.3% 0.12 346.018);
--color-pink-400: oklch(71.8% 0.202 349.761);
--color-pink-500: oklch(65.6% 0.241 354.308);
--color-pink-600: oklch(59.2% 0.249 0.584);
--color-pink-700: oklch(52.5% 0.223 3.958);
--color-pink-800: oklch(45.9% 0.187 3.815);
--color-pink-900: oklch(40.8% 0.153 2.432);
--color-pink-950: oklch(28.4% 0.109 3.907);
--color-rose-50: oklch(96.9% 0.015 12.422);
--color-rose-100: oklch(94.1% 0.03 12.58);
--color-rose-200: oklch(89.2% 0.058 10.001);
--color-rose-300: oklch(81% 0.117 11.638);
--color-rose-400: oklch(71.2% 0.194 13.428);
--color-rose-500: oklch(64.5% 0.246 16.439);
--color-rose-600: oklch(58.6% 0.253 17.585);
--color-rose-700: oklch(51.4% 0.222 16.935);
--color-rose-800: oklch(45.5% 0.188 13.697);
--color-rose-900: oklch(41% 0.159 10.272);
--color-rose-950: oklch(27.1% 0.105 12.094);
--color-slate-50: oklch(98.4% 0.003 247.858);
--color-slate-100: oklch(96.8% 0.007 247.896);
--color-slate-200: oklch(92.9% 0.013 255.508);
--color-slate-300: oklch(86.9% 0.022 252.894);
--color-slate-400: oklch(70.4% 0.04 256.788);
--color-slate-500: oklch(55.4% 0.046 257.417);
--color-slate-600: oklch(44.6% 0.043 257.281);
--color-slate-700: oklch(37.2% 0.044 257.287);
--color-slate-800: oklch(27.9% 0.041 260.031);
--color-slate-900: oklch(20.8% 0.042 265.755);
--color-slate-950: oklch(12.9% 0.042 264.695);
--color-gray-50: oklch(98.5% 0.002 247.839);
--color-gray-100: oklch(96.7% 0.003 264.542);
--color-gray-200: oklch(92.8% 0.006 264.531);
--color-gray-300: oklch(87.2% 0.01 258.338);
--color-gray-400: oklch(70.7% 0.022 261.325);
--color-gray-500: oklch(55.1% 0.027 264.364);
--color-gray-600: oklch(44.6% 0.03 256.802);
--color-gray-700: oklch(37.3% 0.034 259.733);
--color-gray-800: oklch(27.8% 0.033 256.848);
--color-gray-900: oklch(21% 0.034 264.665);
--color-gray-950: oklch(13% 0.028 261.692);
--color-zinc-50: oklch(98.5% 0 0);
--color-zinc-100: oklch(96.7% 0.001 286.375);
--color-zinc-200: oklch(92% 0.004 286.32);
--color-zinc-300: oklch(87.1% 0.006 286.286);
--color-zinc-400: oklch(70.5% 0.015 286.067);
--color-zinc-500: oklch(55.2% 0.016 285.938);
--color-zinc-600: oklch(44.2% 0.017 285.786);
--color-zinc-700: oklch(37% 0.013 285.805);
--color-zinc-800: oklch(27.4% 0.006 286.033);
--color-zinc-900: oklch(21% 0.006 285.885);
--color-zinc-950: oklch(14.1% 0.005 285.823);
--color-neutral-50: oklch(98.5% 0 0);
--color-neutral-100: oklch(97% 0 0);
--color-neutral-200: oklch(92.2% 0 0);
--color-neutral-300: oklch(87% 0 0);
--color-neutral-400: oklch(70.8% 0 0);
--color-neutral-500: oklch(55.6% 0 0);
--color-neutral-600: oklch(43.9% 0 0);
--color-neutral-700: oklch(37.1% 0 0);
--color-neutral-800: oklch(26.9% 0 0);
--color-neutral-900: oklch(20.5% 0 0);
--color-neutral-950: oklch(14.5% 0 0);
--color-stone-50: oklch(98.5% 0.001 106.423);
--color-stone-100: oklch(97% 0.001 106.424);
--color-stone-200: oklch(92.3% 0.003 48.717);
--color-stone-300: oklch(86.9% 0.005 56.366);
--color-stone-400: oklch(70.9% 0.01 56.259);
--color-stone-500: oklch(55.3% 0.013 58.071);
--color-stone-600: oklch(44.4% 0.011 73.639);
--color-stone-700: oklch(37.4% 0.01 67.558);
--color-stone-800: oklch(26.8% 0.007 34.298);
--color-stone-900: oklch(21.6% 0.006 56.043);
--color-stone-950: oklch(14.7% 0.004 49.25);
--color-mauve-50: oklch(98.5% 0 0);
--color-mauve-100: oklch(96% 0.003 325.6);
--color-mauve-200: oklch(92.2% 0.005 325.62);
--color-mauve-300: oklch(86.5% 0.012 325.68);
--color-mauve-400: oklch(71.1% 0.019 323.02);
--color-mauve-500: oklch(54.2% 0.034 322.5);
--color-mauve-600: oklch(43.5% 0.029 321.78);
--color-mauve-700: oklch(36.4% 0.029 323.89);
--color-mauve-800: oklch(26.3% 0.024 320.12);
--color-mauve-900: oklch(21.2% 0.019 322.12);
--color-mauve-950: oklch(14.5% 0.008 326);
--color-olive-50: oklch(98.8% 0.003 106.5);
--color-olive-100: oklch(96.6% 0.005 106.5);
--color-olive-200: oklch(93% 0.007 106.5);
--color-olive-300: oklch(88% 0.011 106.6);
--color-olive-400: oklch(73.7% 0.021 106.9);
--color-olive-500: oklch(58% 0.031 107.3);
--color-olive-600: oklch(46.6% 0.025 107.3);
--color-olive-700: oklch(39.4% 0.023 107.4);
--color-olive-800: oklch(28.6% 0.016 107.4);
--color-olive-900: oklch(22.8% 0.013 107.4);
--color-olive-950: oklch(15.3% 0.006 107.1);
--color-mist-50: oklch(98.7% 0.002 197.1);
--color-mist-100: oklch(96.3% 0.002 197.1);
--color-mist-200: oklch(92.5% 0.005 214.3);
--color-mist-300: oklch(87.2% 0.007 219.6);
--color-mist-400: oklch(72.3% 0.014 214.4);
--color-mist-500: oklch(56% 0.021 213.5);
--color-mist-600: oklch(45% 0.017 213.2);
--color-mist-700: oklch(37.8% 0.015 216);
--color-mist-800: oklch(27.5% 0.011 216.9);
--color-mist-900: oklch(21.8% 0.008 223.9);
--color-mist-950: oklch(14.8% 0.004 228.8);
--color-taupe-50: oklch(98.6% 0.002 67.8);
--color-taupe-100: oklch(96% 0.002 17.2);
--color-taupe-200: oklch(92.2% 0.005 34.3);
--color-taupe-300: oklch(86.8% 0.007 39.5);
--color-taupe-400: oklch(71.4% 0.014 41.2);
--color-taupe-500: oklch(54.7% 0.021 43.1);
--color-taupe-600: oklch(43.8% 0.017 39.3);
--color-taupe-700: oklch(36.7% 0.016 35.7);
--color-taupe-800: oklch(26.8% 0.011 36.5);
--color-taupe-900: oklch(21.4% 0.009 43.1);
--color-taupe-950: oklch(14.7% 0.004 49.3);
--color-black: #000;
--color-white: #fff;
--spacing: 0.25rem;
--breakpoint-sm: 40rem;
--breakpoint-md: 48rem;
--breakpoint-lg: 64rem;
--breakpoint-xl: 80rem;
--breakpoint-2xl: 96rem;
--container-3xs: 16rem;
--container-2xs: 18rem;
--container-xs: 20rem;
--container-sm: 24rem;
--container-md: 28rem;
--container-lg: 32rem;
--container-xl: 36rem;
--container-2xl: 42rem;
--container-3xl: 48rem;
--container-4xl: 56rem;
--container-5xl: 64rem;
--container-6xl: 72rem;
--container-7xl: 80rem;
--text-xs: 0.75rem;
--text-xs--line-height: calc(1 / 0.75);
--text-sm: 0.875rem;
--text-sm--line-height: calc(1.25 / 0.875);
--text-base: 1rem;
--text-base--line-height: calc(1.5 / 1);
--text-lg: 1.125rem;
--text-lg--line-height: calc(1.75 / 1.125);
--text-xl: 1.25rem;
--text-xl--line-height: calc(1.75 / 1.25);
--text-2xl: 1.5rem;
--text-2xl--line-height: calc(2 / 1.5);
--text-3xl: 1.875rem;
--text-3xl--line-height: calc(2.25 / 1.875);
--text-4xl: 2.25rem;
--text-4xl--line-height: calc(2.5 / 2.25);
--text-5xl: 3rem;
--text-5xl--line-height: 1;
--text-6xl: 3.75rem;
--text-6xl--line-height: 1;
--text-7xl: 4.5rem;
--text-7xl--line-height: 1;
--text-8xl: 6rem;
--text-8xl--line-height: 1;
--text-9xl: 8rem;
--text-9xl--line-height: 1;
--font-weight-thin: 100;
--font-weight-extralight: 200;
--font-weight-light: 300;
--font-weight-normal: 400;
--font-weight-medium: 500;
--font-weight-semibold: 600;
--font-weight-bold: 700;
--font-weight-extrabold: 800;
--font-weight-black: 900;
--tracking-tighter: -0.05em;
--tracking-tight: -0.025em;
--tracking-normal: 0em;
--tracking-wide: 0.025em;
--tracking-wider: 0.05em;
--tracking-widest: 0.1em;
--leading-tight: 1.25;
--leading-snug: 1.375;
--leading-normal: 1.5;
--leading-relaxed: 1.625;
--leading-loose: 2;
--radius-xs: 0.125rem;
--radius-sm: 0.25rem;
--radius-md: 0.375rem;
--radius-lg: 0.5rem;
--radius-xl: 0.75rem;
--radius-2xl: 1rem;
--radius-3xl: 1.5rem;
--radius-4xl: 2rem;
--shadow-2xs: 0 1px rgb(0 0 0 / 0.05);
--shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
--shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
--inset-shadow-2xs: inset 0 1px rgb(0 0 0 / 0.05);
--inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / 0.05);
--inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / 0.05);
--drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);
--drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);
--drop-shadow-md: 0 3px 3px rgb(0 0 0 / 0.12);
--drop-shadow-lg: 0 4px 4px rgb(0 0 0 / 0.15);
--drop-shadow-xl: 0 9px 7px rgb(0 0 0 / 0.1);
--drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / 0.15);
--text-shadow-2xs: 0px 1px 0px rgb(0 0 0 / 0.15);
--text-shadow-xs: 0px 1px 1px rgb(0 0 0 / 0.2);
--text-shadow-sm:
0px 1px 0px rgb(0 0 0 / 0.075), 0px 1px 1px rgb(0 0 0 / 0.075), 0px 2px 2px rgb(0 0 0 / 0.075);
--text-shadow-md:
0px 1px 1px rgb(0 0 0 / 0.1), 0px 1px 2px rgb(0 0 0 / 0.1), 0px 2px 4px rgb(0 0 0 / 0.1);
--text-shadow-lg:
0px 1px 2px rgb(0 0 0 / 0.1), 0px 3px 2px rgb(0 0 0 / 0.1), 0px 4px 8px rgb(0 0 0 / 0.1);
--ease-in: cubic-bezier(0.4, 0, 1, 1);
--ease-out: cubic-bezier(0, 0, 0.2, 1);
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
--animate-spin: spin 1s linear infinite;
--animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
--animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
--animate-bounce: bounce 1s infinite;
@keyframes spin {
to {
transform: rotate(360deg);
}
}
@keyframes ping {
75%,
100% {
transform: scale(2);
opacity: 0;
}
}
@keyframes pulse {
50% {
opacity: 0.5;
}
}
@keyframes bounce {
0%,
100% {
transform: translateY(-25%);
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
}
50% {
transform: none;
animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
}
}
--blur-xs: 4px;
--blur-sm: 8px;
--blur-md: 12px;
--blur-lg: 16px;
--blur-xl: 24px;
--blur-2xl: 40px;
--blur-3xl: 64px;
--perspective-dramatic: 100px;
--perspective-near: 300px;
--perspective-normal: 500px;
--perspective-midrange: 800px;
--perspective-distant: 1200px;
--aspect-video: 16 / 9;
--default-transition-duration: 150ms;
--default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
--default-font-family: --theme(--font-sans, initial);
--default-font-feature-settings: --theme(--font-sans--font-feature-settings, initial);
--default-font-variation-settings: --theme(--font-sans--font-variation-settings, initial);
--default-mono-font-family: --theme(--font-mono, initial);
--default-mono-font-feature-settings: --theme(--font-mono--font-feature-settings, initial);
--default-mono-font-variation-settings: --theme(--font-mono--font-variation-settings, initial);
}
/* Deprecated */
@theme default inline reference {
--blur: 8px;
--shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
--shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
--drop-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06);
--radius: 0.25rem;
--max-width-prose: 65ch;
}
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const MoveVertical = createLucideIcon("MoveVertical", [
["path", { d: "M12 2v20", key: "t6zp3m" }],
["path", { d: "m8 18 4 4 4-4", key: "bh5tu3" }],
["path", { d: "m8 6 4-4 4 4", key: "ybng9g" }]
]);
export { MoveVertical as default };
//# sourceMappingURL=move-vertical.js.map
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2024_arraybuffer: LibDefinition;
@@ -0,0 +1,992 @@
'use strict'
const assert = require('node:assert')
const { types, inspect } = require('node:util')
const { markAsUncloneable } = require('node:worker_threads')
const UNDEFINED = 1
const BOOLEAN = 2
const STRING = 3
const SYMBOL = 4
const NUMBER = 5
const BIGINT = 6
const NULL = 7
const OBJECT = 8 // function and object
const FunctionPrototypeSymbolHasInstance = Function.call.bind(Function.prototype[Symbol.hasInstance])
/** @type {import('../../../types/webidl').Webidl} */
const webidl = {
converters: {},
util: {},
errors: {},
is: {}
}
/**
* @description Instantiate an error.
*
* @param {Object} message
* @param {string} message.header
* @param {string} message.message
* @returns {TypeError}
*/
webidl.errors.exception = function (message) {
return new TypeError(`${message.header}: ${message.message}`)
}
/**
* @description Instantiate an error when conversion from one type to another has failed.
*
* @param {Object} opts
* @param {string} opts.prefix
* @param {string} opts.argument
* @param {string[]} opts.types
* @returns {TypeError}
*/
webidl.errors.conversionFailed = function (opts) {
const plural = opts.types.length === 1 ? '' : ' one of'
const message =
`${opts.argument} could not be converted to` +
`${plural}: ${opts.types.join(', ')}.`
return webidl.errors.exception({
header: opts.prefix,
message
})
}
/**
* @description Instantiate an error when an invalid argument is provided
*
* @param {Object} context
* @param {string} context.prefix
* @param {string} context.value
* @param {string} context.type
* @returns {TypeError}
*/
webidl.errors.invalidArgument = function (context) {
return webidl.errors.exception({
header: context.prefix,
message: `"${context.value}" is an invalid ${context.type}.`
})
}
// https://webidl.spec.whatwg.org/#implements
webidl.brandCheck = function (V, is) {
if (!is(V)) {
const err = new TypeError('Illegal invocation')
err.code = 'ERR_INVALID_THIS' // node compat.
throw err
}
}
webidl.argumentLengthCheck = function ({ length }, min, ctx) {
if (length < min) {
throw webidl.errors.exception({
message: `${min} argument${min !== 1 ? 's' : ''} required, ` +
`but${length ? ' only' : ''} ${length} found.`,
header: ctx
})
}
}
webidl.illegalConstructor = function () {
throw webidl.errors.exception({
header: 'TypeError',
message: 'Illegal constructor'
})
}
webidl.util.MakeTypeAssertion = function (I) {
return (O) => FunctionPrototypeSymbolHasInstance(I, O)
}
// https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values
webidl.util.Type = function (V) {
switch (typeof V) {
case 'undefined': return UNDEFINED
case 'boolean': return BOOLEAN
case 'string': return STRING
case 'symbol': return SYMBOL
case 'number': return NUMBER
case 'bigint': return BIGINT
case 'function':
case 'object': {
if (V === null) {
return NULL
}
return OBJECT
}
}
}
webidl.util.Types = {
UNDEFINED,
BOOLEAN,
STRING,
SYMBOL,
NUMBER,
BIGINT,
NULL,
OBJECT
}
webidl.util.TypeValueToString = function (o) {
switch (webidl.util.Type(o)) {
case UNDEFINED: return 'Undefined'
case BOOLEAN: return 'Boolean'
case STRING: return 'String'
case SYMBOL: return 'Symbol'
case NUMBER: return 'Number'
case BIGINT: return 'BigInt'
case NULL: return 'Null'
case OBJECT: return 'Object'
}
}
webidl.util.markAsUncloneable = markAsUncloneable
// https://webidl.spec.whatwg.org/#abstract-opdef-converttoint
webidl.util.ConvertToInt = function (V, bitLength, signedness, flags) {
let upperBound
let lowerBound
// 1. If bitLength is 64, then:
if (bitLength === 64) {
// 1. Let upperBound be 2^53 − 1.
upperBound = Math.pow(2, 53) - 1
// 2. If signedness is "unsigned", then let lowerBound be 0.
if (signedness === 'unsigned') {
lowerBound = 0
} else {
// 3. Otherwise let lowerBound be −2^53 + 1.
lowerBound = Math.pow(-2, 53) + 1
}
} else if (signedness === 'unsigned') {
// 2. Otherwise, if signedness is "unsigned", then:
// 1. Let lowerBound be 0.
lowerBound = 0
// 2. Let upperBound be 2^bitLength − 1.
upperBound = Math.pow(2, bitLength) - 1
} else {
// 3. Otherwise:
// 1. Let lowerBound be -2^(bitLength − 1).
lowerBound = -Math.pow(2, bitLength - 1)
// 2. Let upperBound be 2^(bitLength − 1) − 1.
upperBound = Math.pow(2, bitLength - 1) - 1
}
// 4. Let x be ? ToNumber(V).
let x = Number(V)
// 5. If x is −0, then set x to +0.
if (x === 0) {
x = 0
}
// 6. If the conversion is to an IDL type associated
// with the [EnforceRange] extended attribute, then:
if (webidl.util.HasFlag(flags, webidl.attributes.EnforceRange)) {
// 1. If x is NaN, +∞, or −∞, then throw a TypeError.
if (
Number.isNaN(x) ||
x === Number.POSITIVE_INFINITY ||
x === Number.NEGATIVE_INFINITY
) {
throw webidl.errors.exception({
header: 'Integer conversion',
message: `Could not convert ${webidl.util.Stringify(V)} to an integer.`
})
}
// 2. Set x to IntegerPart(x).
x = webidl.util.IntegerPart(x)
// 3. If x < lowerBound or x > upperBound, then
// throw a TypeError.
if (x < lowerBound || x > upperBound) {
throw webidl.errors.exception({
header: 'Integer conversion',
message: `Value must be between ${lowerBound}-${upperBound}, got ${x}.`
})
}
// 4. Return x.
return x
}
// 7. If x is not NaN and the conversion is to an IDL
// type associated with the [Clamp] extended
// attribute, then:
if (!Number.isNaN(x) && webidl.util.HasFlag(flags, webidl.attributes.Clamp)) {
// 1. Set x to min(max(x, lowerBound), upperBound).
x = Math.min(Math.max(x, lowerBound), upperBound)
// 2. Round x to the nearest integer, choosing the
// even integer if it lies halfway between two,
// and choosing +0 rather than −0.
if (Math.floor(x) % 2 === 0) {
x = Math.floor(x)
} else {
x = Math.ceil(x)
}
// 3. Return x.
return x
}
// 8. If x is NaN, +0, +∞, or −∞, then return +0.
if (
Number.isNaN(x) ||
(x === 0 && Object.is(0, x)) ||
x === Number.POSITIVE_INFINITY ||
x === Number.NEGATIVE_INFINITY
) {
return 0
}
// 9. Set x to IntegerPart(x).
x = webidl.util.IntegerPart(x)
// 10. Set x to x modulo 2^bitLength.
x = x % Math.pow(2, bitLength)
// 11. If signedness is "signed" and x ≥ 2^(bitLength − 1),
// then return x − 2^bitLength.
if (signedness === 'signed' && x >= Math.pow(2, bitLength - 1)) {
return x - Math.pow(2, bitLength)
}
// 12. Otherwise, return x.
return x
}
// https://webidl.spec.whatwg.org/#abstract-opdef-integerpart
webidl.util.IntegerPart = function (n) {
// 1. Let r be floor(abs(n)).
const r = Math.floor(Math.abs(n))
// 2. If n < 0, then return -1 × r.
if (n < 0) {
return -1 * r
}
// 3. Otherwise, return r.
return r
}
webidl.util.Stringify = function (V) {
const type = webidl.util.Type(V)
switch (type) {
case SYMBOL:
return `Symbol(${V.description})`
case OBJECT:
return inspect(V)
case STRING:
return `"${V}"`
case BIGINT:
return `${V}n`
default:
return `${V}`
}
}
webidl.util.IsResizableArrayBuffer = function (V) {
if (types.isArrayBuffer(V)) {
return V.resizable
}
if (types.isSharedArrayBuffer(V)) {
return V.growable
}
throw webidl.errors.exception({
header: 'IsResizableArrayBuffer',
message: `"${webidl.util.Stringify(V)}" is not an array buffer.`
})
}
webidl.util.HasFlag = function (flags, attributes) {
return typeof flags === 'number' && (flags & attributes) === attributes
}
// https://webidl.spec.whatwg.org/#es-sequence
webidl.sequenceConverter = function (converter) {
return (V, prefix, argument, Iterable) => {
// 1. If Type(V) is not Object, throw a TypeError.
if (webidl.util.Type(V) !== OBJECT) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} (${webidl.util.Stringify(V)}) is not iterable.`
})
}
// 2. Let method be ? GetMethod(V, @@iterator).
/** @type {Generator} */
const method = typeof Iterable === 'function' ? Iterable() : V?.[Symbol.iterator]?.()
const seq = []
let index = 0
// 3. If method is undefined, throw a TypeError.
if (
method === undefined ||
typeof method.next !== 'function'
) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} is not iterable.`
})
}
// https://webidl.spec.whatwg.org/#create-sequence-from-iterable
while (true) {
const { done, value } = method.next()
if (done) {
break
}
seq.push(converter(value, prefix, `${argument}[${index++}]`))
}
return seq
}
}
// https://webidl.spec.whatwg.org/#es-to-record
webidl.recordConverter = function (keyConverter, valueConverter) {
return (O, prefix, argument) => {
// 1. If Type(O) is not Object, throw a TypeError.
if (webidl.util.Type(O) !== OBJECT) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} ("${webidl.util.TypeValueToString(O)}") is not an Object.`
})
}
// 2. Let result be a new empty instance of record<K, V>.
const result = {}
if (!types.isProxy(O)) {
// 1. Let desc be ? O.[[GetOwnProperty]](key).
const keys = [...Object.getOwnPropertyNames(O), ...Object.getOwnPropertySymbols(O)]
for (const key of keys) {
const keyName = webidl.util.Stringify(key)
// 1. Let typedKey be key converted to an IDL value of type K.
const typedKey = keyConverter(key, prefix, `Key ${keyName} in ${argument}`)
// 2. Let value be ? Get(O, key).
// 3. Let typedValue be value converted to an IDL value of type V.
const typedValue = valueConverter(O[key], prefix, `${argument}[${keyName}]`)
// 4. Set result[typedKey] to typedValue.
result[typedKey] = typedValue
}
// 5. Return result.
return result
}
// 3. Let keys be ? O.[[OwnPropertyKeys]]().
const keys = Reflect.ownKeys(O)
// 4. For each key of keys.
for (const key of keys) {
// 1. Let desc be ? O.[[GetOwnProperty]](key).
const desc = Reflect.getOwnPropertyDescriptor(O, key)
// 2. If desc is not undefined and desc.[[Enumerable]] is true:
if (desc?.enumerable) {
// 1. Let typedKey be key converted to an IDL value of type K.
const typedKey = keyConverter(key, prefix, argument)
// 2. Let value be ? Get(O, key).
// 3. Let typedValue be value converted to an IDL value of type V.
const typedValue = valueConverter(O[key], prefix, argument)
// 4. Set result[typedKey] to typedValue.
result[typedKey] = typedValue
}
}
// 5. Return result.
return result
}
}
webidl.interfaceConverter = function (TypeCheck, name) {
return (V, prefix, argument) => {
if (!TypeCheck(V)) {
throw webidl.errors.exception({
header: prefix,
message: `Expected ${argument} ("${webidl.util.Stringify(V)}") to be an instance of ${name}.`
})
}
return V
}
}
webidl.dictionaryConverter = function (converters) {
// "For each dictionary member member declared on dictionary, in lexicographical order:"
converters.sort((a, b) => (a.key > b.key) - (a.key < b.key))
return (dictionary, prefix, argument) => {
const dict = {}
if (dictionary != null && webidl.util.Type(dictionary) !== OBJECT) {
throw webidl.errors.exception({
header: prefix,
message: `Expected ${dictionary} to be one of: Null, Undefined, Object.`
})
}
for (const options of converters) {
const { key, defaultValue, required, converter } = options
if (required === true) {
if (dictionary == null || !Object.hasOwn(dictionary, key)) {
throw webidl.errors.exception({
header: prefix,
message: `Missing required key "${key}".`
})
}
}
let value = dictionary?.[key]
const hasDefault = defaultValue !== undefined
// Only use defaultValue if value is undefined and
// a defaultValue options was provided.
if (hasDefault && value === undefined) {
value = defaultValue()
}
// A key can be optional and have no default value.
// When this happens, do not perform a conversion,
// and do not assign the key a value.
if (required || hasDefault || value !== undefined) {
value = converter(value, prefix, `${argument}.${key}`)
if (
options.allowedValues &&
!options.allowedValues.includes(value)
) {
throw webidl.errors.exception({
header: prefix,
message: `${value} is not an accepted type. Expected one of ${options.allowedValues.join(', ')}.`
})
}
dict[key] = value
}
}
return dict
}
}
webidl.nullableConverter = function (converter) {
return (V, prefix, argument) => {
if (V === null) {
return V
}
return converter(V, prefix, argument)
}
}
/**
* @param {*} value
* @returns {boolean}
*/
webidl.is.USVString = function (value) {
return (
typeof value === 'string' &&
value.isWellFormed()
)
}
webidl.is.ReadableStream = webidl.util.MakeTypeAssertion(ReadableStream)
webidl.is.Blob = webidl.util.MakeTypeAssertion(Blob)
webidl.is.URLSearchParams = webidl.util.MakeTypeAssertion(URLSearchParams)
webidl.is.File = webidl.util.MakeTypeAssertion(File)
webidl.is.URL = webidl.util.MakeTypeAssertion(URL)
webidl.is.AbortSignal = webidl.util.MakeTypeAssertion(AbortSignal)
webidl.is.MessagePort = webidl.util.MakeTypeAssertion(MessagePort)
webidl.is.BufferSource = function (V) {
return types.isArrayBuffer(V) || (
ArrayBuffer.isView(V) &&
types.isArrayBuffer(V.buffer)
)
}
// https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy
webidl.util.getCopyOfBytesHeldByBufferSource = function (bufferSource) {
// 1. Let jsBufferSource be the result of converting bufferSource to a JavaScript value.
const jsBufferSource = bufferSource
// 2. Let jsArrayBuffer be jsBufferSource.
let jsArrayBuffer = jsBufferSource
// 3. Let offset be 0.
let offset = 0
// 4. Let length be 0.
let length = 0
// 5. If jsBufferSource has a [[ViewedArrayBuffer]] internal slot, then:
if (types.isTypedArray(jsBufferSource) || types.isDataView(jsBufferSource)) {
// 5.1. Set jsArrayBuffer to jsBufferSource.[[ViewedArrayBuffer]].
jsArrayBuffer = jsBufferSource.buffer
// 5.2. Set offset to jsBufferSource.[[ByteOffset]].
offset = jsBufferSource.byteOffset
// 5.3. Set length to jsBufferSource.[[ByteLength]].
length = jsBufferSource.byteLength
} else {
// 6. Otherwise:
// 6.1. Assert: jsBufferSource is an ArrayBuffer or SharedArrayBuffer object.
assert(types.isAnyArrayBuffer(jsBufferSource))
// 6.2. Set length to jsBufferSource.[[ArrayBufferByteLength]].
length = jsBufferSource.byteLength
}
// 7. If IsDetachedBuffer(jsArrayBuffer) is true, then return the empty byte sequence.
if (jsArrayBuffer.detached) {
return new Uint8Array(0)
}
// 8. Let bytes be a new byte sequence of length equal to length.
const bytes = new Uint8Array(length)
// 9. For i in the range offset to offset + length − 1, inclusive,
// set bytes[i − offset] to GetValueFromBuffer(jsArrayBuffer, i, Uint8, true, Unordered).
const view = new Uint8Array(jsArrayBuffer, offset, length)
bytes.set(view)
// 10. Return bytes.
return bytes
}
// https://webidl.spec.whatwg.org/#es-DOMString
webidl.converters.DOMString = function (V, prefix, argument, flags) {
// 1. If V is null and the conversion is to an IDL type
// associated with the [LegacyNullToEmptyString]
// extended attribute, then return the DOMString value
// that represents the empty string.
if (V === null && webidl.util.HasFlag(flags, webidl.attributes.LegacyNullToEmptyString)) {
return ''
}
// 2. Let x be ? ToString(V).
if (typeof V === 'symbol') {
throw webidl.errors.exception({
header: prefix,
message: `${argument} is a symbol, which cannot be converted to a DOMString.`
})
}
// 3. Return the IDL DOMString value that represents the
// same sequence of code units as the one the
// ECMAScript String value x represents.
return String(V)
}
// https://webidl.spec.whatwg.org/#es-ByteString
webidl.converters.ByteString = function (V, prefix, argument) {
// 1. Let x be ? ToString(V).
if (typeof V === 'symbol') {
throw webidl.errors.exception({
header: prefix,
message: `${argument} is a symbol, which cannot be converted to a ByteString.`
})
}
const x = String(V)
// 2. If the value of any element of x is greater than
// 255, then throw a TypeError.
for (let index = 0; index < x.length; index++) {
if (x.charCodeAt(index) > 255) {
throw new TypeError(
'Cannot convert argument to a ByteString because the character at ' +
`index ${index} has a value of ${x.charCodeAt(index)} which is greater than 255.`
)
}
}
// 3. Return an IDL ByteString value whose length is the
// length of x, and where the value of each element is
// the value of the corresponding element of x.
return x
}
/**
* @param {unknown} value
* @returns {string}
* @see https://webidl.spec.whatwg.org/#es-USVString
*/
webidl.converters.USVString = function (value) {
// TODO: rewrite this so we can control the errors thrown
if (typeof value === 'string') {
return value.toWellFormed()
}
return `${value}`.toWellFormed()
}
// https://webidl.spec.whatwg.org/#es-boolean
webidl.converters.boolean = function (V) {
// 1. Let x be the result of computing ToBoolean(V).
// https://262.ecma-international.org/10.0/index.html#table-10
const x = Boolean(V)
// 2. Return the IDL boolean value that is the one that represents
// the same truth value as the ECMAScript Boolean value x.
return x
}
// https://webidl.spec.whatwg.org/#es-any
webidl.converters.any = function (V) {
return V
}
// https://webidl.spec.whatwg.org/#es-long-long
webidl.converters['long long'] = function (V, prefix, argument) {
// 1. Let x be ? ConvertToInt(V, 64, "signed").
const x = webidl.util.ConvertToInt(V, 64, 'signed', 0, prefix, argument)
// 2. Return the IDL long long value that represents
// the same numeric value as x.
return x
}
// https://webidl.spec.whatwg.org/#es-unsigned-long-long
webidl.converters['unsigned long long'] = function (V, prefix, argument) {
// 1. Let x be ? ConvertToInt(V, 64, "unsigned").
const x = webidl.util.ConvertToInt(V, 64, 'unsigned', 0, prefix, argument)
// 2. Return the IDL unsigned long long value that
// represents the same numeric value as x.
return x
}
// https://webidl.spec.whatwg.org/#es-unsigned-long
webidl.converters['unsigned long'] = function (V, prefix, argument) {
// 1. Let x be ? ConvertToInt(V, 32, "unsigned").
const x = webidl.util.ConvertToInt(V, 32, 'unsigned', 0, prefix, argument)
// 2. Return the IDL unsigned long value that
// represents the same numeric value as x.
return x
}
// https://webidl.spec.whatwg.org/#es-unsigned-short
webidl.converters['unsigned short'] = function (V, prefix, argument, flags) {
// 1. Let x be ? ConvertToInt(V, 16, "unsigned").
const x = webidl.util.ConvertToInt(V, 16, 'unsigned', flags, prefix, argument)
// 2. Return the IDL unsigned short value that represents
// the same numeric value as x.
return x
}
// https://webidl.spec.whatwg.org/#idl-ArrayBuffer
webidl.converters.ArrayBuffer = function (V, prefix, argument, flags) {
// 1. If V is not an Object, or V does not have an
// [[ArrayBufferData]] internal slot, then throw a
// TypeError.
// 2. If IsSharedArrayBuffer(V) is true, then throw a
// TypeError.
// see: https://tc39.es/ecma262/#sec-properties-of-the-arraybuffer-instances
if (
webidl.util.Type(V) !== OBJECT ||
!types.isArrayBuffer(V)
) {
throw webidl.errors.conversionFailed({
prefix,
argument: `${argument} ("${webidl.util.Stringify(V)}")`,
types: ['ArrayBuffer']
})
}
// 3. If the conversion is not to an IDL type associated
// with the [AllowResizable] extended attribute, and
// IsResizableArrayBuffer(V) is true, then throw a
// TypeError.
if (!webidl.util.HasFlag(flags, webidl.attributes.AllowResizable) && webidl.util.IsResizableArrayBuffer(V)) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} cannot be a resizable ArrayBuffer.`
})
}
// 4. Return the IDL ArrayBuffer value that is a
// reference to the same object as V.
return V
}
// https://webidl.spec.whatwg.org/#idl-SharedArrayBuffer
webidl.converters.SharedArrayBuffer = function (V, prefix, argument, flags) {
// 1. If V is not an Object, or V does not have an
// [[ArrayBufferData]] internal slot, then throw a
// TypeError.
// 2. If IsSharedArrayBuffer(V) is false, then throw a
// TypeError.
// see: https://tc39.es/ecma262/#sec-properties-of-the-sharedarraybuffer-instances
if (
webidl.util.Type(V) !== OBJECT ||
!types.isSharedArrayBuffer(V)
) {
throw webidl.errors.conversionFailed({
prefix,
argument: `${argument} ("${webidl.util.Stringify(V)}")`,
types: ['SharedArrayBuffer']
})
}
// 3. If the conversion is not to an IDL type associated
// with the [AllowResizable] extended attribute, and
// IsResizableArrayBuffer(V) is true, then throw a
// TypeError.
if (!webidl.util.HasFlag(flags, webidl.attributes.AllowResizable) && webidl.util.IsResizableArrayBuffer(V)) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} cannot be a resizable SharedArrayBuffer.`
})
}
// 4. Return the IDL SharedArrayBuffer value that is a
// reference to the same object as V.
return V
}
// https://webidl.spec.whatwg.org/#dfn-typed-array-type
webidl.converters.TypedArray = function (V, T, prefix, argument, flags) {
// 1. Let T be the IDL type V is being converted to.
// 2. If Type(V) is not Object, or V does not have a
// [[TypedArrayName]] internal slot with a value
// equal to T’s name, then throw a TypeError.
if (
webidl.util.Type(V) !== OBJECT ||
!types.isTypedArray(V) ||
V.constructor.name !== T.name
) {
throw webidl.errors.conversionFailed({
prefix,
argument: `${argument} ("${webidl.util.Stringify(V)}")`,
types: [T.name]
})
}
// 3. If the conversion is not to an IDL type associated
// with the [AllowShared] extended attribute, and
// IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is
// true, then throw a TypeError.
if (!webidl.util.HasFlag(flags, webidl.attributes.AllowShared) && types.isSharedArrayBuffer(V.buffer)) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} cannot be a view on a shared array buffer.`
})
}
// 4. If the conversion is not to an IDL type associated
// with the [AllowResizable] extended attribute, and
// IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is
// true, then throw a TypeError.
if (!webidl.util.HasFlag(flags, webidl.attributes.AllowResizable) && webidl.util.IsResizableArrayBuffer(V.buffer)) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} cannot be a view on a resizable array buffer.`
})
}
// 5. Return the IDL value of type T that is a reference
// to the same object as V.
return V
}
// https://webidl.spec.whatwg.org/#idl-DataView
webidl.converters.DataView = function (V, prefix, argument, flags) {
// 1. If Type(V) is not Object, or V does not have a
// [[DataView]] internal slot, then throw a TypeError.
if (webidl.util.Type(V) !== OBJECT || !types.isDataView(V)) {
throw webidl.errors.conversionFailed({
prefix,
argument: `${argument} ("${webidl.util.Stringify(V)}")`,
types: ['DataView']
})
}
// 2. If the conversion is not to an IDL type associated
// with the [AllowShared] extended attribute, and
// IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is true,
// then throw a TypeError.
if (!webidl.util.HasFlag(flags, webidl.attributes.AllowShared) && types.isSharedArrayBuffer(V.buffer)) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} cannot be a view on a shared array buffer.`
})
}
// 3. If the conversion is not to an IDL type associated
// with the [AllowResizable] extended attribute, and
// IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is
// true, then throw a TypeError.
if (!webidl.util.HasFlag(flags, webidl.attributes.AllowResizable) && webidl.util.IsResizableArrayBuffer(V.buffer)) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} cannot be a view on a resizable array buffer.`
})
}
// 4. Return the IDL DataView value that is a reference
// to the same object as V.
return V
}
// https://webidl.spec.whatwg.org/#ArrayBufferView
webidl.converters.ArrayBufferView = function (V, prefix, argument, flags) {
if (
webidl.util.Type(V) !== OBJECT ||
!types.isArrayBufferView(V)
) {
throw webidl.errors.conversionFailed({
prefix,
argument: `${argument} ("${webidl.util.Stringify(V)}")`,
types: ['ArrayBufferView']
})
}
if (!webidl.util.HasFlag(flags, webidl.attributes.AllowShared) && types.isSharedArrayBuffer(V.buffer)) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} cannot be a view on a shared array buffer.`
})
}
if (!webidl.util.HasFlag(flags, webidl.attributes.AllowResizable) && webidl.util.IsResizableArrayBuffer(V.buffer)) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} cannot be a view on a resizable array buffer.`
})
}
return V
}
// https://webidl.spec.whatwg.org/#BufferSource
webidl.converters.BufferSource = function (V, prefix, argument, flags) {
if (types.isArrayBuffer(V)) {
return webidl.converters.ArrayBuffer(V, prefix, argument, flags)
}
if (types.isArrayBufferView(V)) {
flags &= ~webidl.attributes.AllowShared
return webidl.converters.ArrayBufferView(V, prefix, argument, flags)
}
// Make this explicit for easier debugging
if (types.isSharedArrayBuffer(V)) {
throw webidl.errors.exception({
header: prefix,
message: `${argument} cannot be a SharedArrayBuffer.`
})
}
throw webidl.errors.conversionFailed({
prefix,
argument: `${argument} ("${webidl.util.Stringify(V)}")`,
types: ['ArrayBuffer', 'ArrayBufferView']
})
}
// https://webidl.spec.whatwg.org/#AllowSharedBufferSource
webidl.converters.AllowSharedBufferSource = function (V, prefix, argument, flags) {
if (types.isArrayBuffer(V)) {
return webidl.converters.ArrayBuffer(V, prefix, argument, flags)
}
if (types.isSharedArrayBuffer(V)) {
return webidl.converters.SharedArrayBuffer(V, prefix, argument, flags)
}
if (types.isArrayBufferView(V)) {
flags |= webidl.attributes.AllowShared
return webidl.converters.ArrayBufferView(V, prefix, argument, flags)
}
throw webidl.errors.conversionFailed({
prefix,
argument: `${argument} ("${webidl.util.Stringify(V)}")`,
types: ['ArrayBuffer', 'SharedArrayBuffer', 'ArrayBufferView']
})
}
webidl.converters['sequence<ByteString>'] = webidl.sequenceConverter(
webidl.converters.ByteString
)
webidl.converters['sequence<sequence<ByteString>>'] = webidl.sequenceConverter(
webidl.converters['sequence<ByteString>']
)
webidl.converters['record<ByteString, ByteString>'] = webidl.recordConverter(
webidl.converters.ByteString,
webidl.converters.ByteString
)
webidl.converters.Blob = webidl.interfaceConverter(webidl.is.Blob, 'Blob')
webidl.converters.AbortSignal = webidl.interfaceConverter(
webidl.is.AbortSignal,
'AbortSignal'
)
/**
* [LegacyTreatNonObjectAsNull]
* callback EventHandlerNonNull = any (Event event);
* typedef EventHandlerNonNull? EventHandler;
* @param {*} V
*/
webidl.converters.EventHandlerNonNull = function (V) {
if (webidl.util.Type(V) !== OBJECT) {
return null
}
// [I]f the value is not an object, it will be converted to null, and if the value is not callable,
// it will be converted to a callback function value that does nothing when called.
if (typeof V === 'function') {
return V
}
return () => {}
}
webidl.attributes = {
Clamp: 1 << 0,
EnforceRange: 1 << 1,
AllowShared: 1 << 2,
AllowResizable: 1 << 3,
LegacyNullToEmptyString: 1 << 4
}
module.exports = {
webidl
}
@@ -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 Film = createLucideIcon("Film", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "M7 3v18", key: "bbkbws" }],
["path", { d: "M3 7.5h4", key: "zfgn84" }],
["path", { d: "M3 12h18", key: "1i2n21" }],
["path", { d: "M3 16.5h4", key: "1230mu" }],
["path", { d: "M17 3v18", key: "in4fa5" }],
["path", { d: "M17 7.5h4", key: "myr1c1" }],
["path", { d: "M17 16.5h4", key: "go4c1d" }]
]);
export { Film as default };
//# sourceMappingURL=film.js.map
@@ -0,0 +1,44 @@
import { expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
test("ZodPreprocess<B> assignable to ZodPipe<$ZodTransform, B>", () => {
const pre = z.preprocess((v) => v, z.string().optional());
const _asPipe: z.ZodPipe<z.core.$ZodTransform, z.ZodOptional<z.ZodString>> = pre;
const _asCorePipe: z.core.$ZodPipe<z.core.$ZodTransform, z.ZodOptional<z.ZodString>> = pre;
expectTypeOf(_asPipe).toMatchTypeOf<z.ZodPipe>();
expectTypeOf(_asCorePipe).toMatchTypeOf<z.core.$ZodPipe>();
});
test("ZodPreprocess optin/optout defer to B", () => {
const optionalInside = z.preprocess((v) => v, z.string().optional());
expectTypeOf<(typeof optionalInside)["_zod"]["optin"]>().toEqualTypeOf<"optional" | "defaulted">();
expectTypeOf<(typeof optionalInside)["_zod"]["optout"]>().toEqualTypeOf<"optional">();
const required = z.preprocess((v) => v, z.string());
expectTypeOf<(typeof required)["_zod"]["optin"]>().toEqualTypeOf<"optional" | "defaulted" | undefined>();
expectTypeOf<(typeof required)["_zod"]["optout"]>().toEqualTypeOf<"optional" | undefined>();
});
test("ZodPreprocess input/output inference", () => {
const pre = z.preprocess((v) => v, z.number().optional());
expectTypeOf<z.output<typeof pre>>().toEqualTypeOf<number | undefined>();
expectTypeOf<z.input<typeof pre>>().toEqualTypeOf<unknown>();
});
test("ZodPreprocess narrows input from an annotated preprocessor arg", () => {
const trimmed = z.preprocess((val: string | null | undefined) => val?.trim() ?? "", z.string());
expectTypeOf<z.input<typeof trimmed>>().toEqualTypeOf<string | null | undefined>();
expectTypeOf<z.output<typeof trimmed>>().toEqualTypeOf<string>();
const obj = z.object({ a: z.preprocess((v: string | number) => String(v), z.string()) });
expectTypeOf<z.input<typeof obj>>().toEqualTypeOf<{ a: string | number }>();
expectTypeOf<z.output<typeof obj>>().toEqualTypeOf<{ a: string }>();
});
// The narrowing must ride on the transform's input only. Binding its output too makes $ZodPipeDef's codec-only `transform?` field contravariant in the preprocessor's return type, which drops the bare-type assignability below.
test("narrowed ZodPreprocess still assignable to the bare type", () => {
const pre = z.preprocess((v: string) => v.length, z.number());
const _bare: z.ZodPreprocess<z.ZodNumber> = pre;
const _bareCore: z.core.$ZodPreprocess = pre;
expectTypeOf<(typeof pre)["_zod"]["optin"]>().toEqualTypeOf<"optional" | "defaulted" | undefined>();
});
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2013-2014 Jonathan Ong <me@jongleberry.com>
Copyright (c) 2014-2022 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,12 @@
import { defineHandlerCallback } from '@tanstack/router-core/ssr/server'
import { renderRouterToString } from './renderRouterToString'
import { RouterServer } from './RouterServer'
export const defaultRenderHandler = defineHandlerCallback(
({ router, responseHeaders }) =>
renderRouterToString({
router,
responseHeaders,
children: <RouterServer router={router} />,
}),
)
@@ -0,0 +1,474 @@
import AtRule from './at-rule.js'
import Comment from './comment.js'
import Declaration from './declaration.js'
import Node, { ChildNode, ChildProps, NodeProps } from './node.js'
import { Root } from './postcss.js'
import Rule from './rule.js'
declare namespace Container {
export type ContainerWithChildren<Child extends Node = ChildNode> = {
nodes: Child[]
} & (AtRule | Root | Rule)
export interface ValueOptions {
/**
* String that’s used to narrow down values and speed up the regexp search.
*/
fast?: string
/**
* An array of property names.
*/
props?: readonly string[]
}
export interface ContainerProps extends NodeProps {
nodes?: readonly (ChildProps | Node)[]
}
/**
* All types that can be passed into container methods to create or add a new
* child node.
*/
export type NewChild =
| ChildProps
| Node
| readonly ChildProps[]
| readonly Node[]
| readonly string[]
| string
| undefined
export { Container_ as default }
}
/**
* The `Root`, `AtRule`, and `Rule` container nodes
* inherit some common methods to help work with their children.
*
* Note that all containers can store any content. If you write a rule inside
* a rule, PostCSS will parse it.
*/
declare abstract class Container_<Child extends Node = ChildNode> extends Node {
/**
* An array containing the container’s children.
*
* ```js
* const root = postcss.parse('a { color: black }')
* root.nodes.length //=> 1
* root.nodes[0].selector //=> 'a'
* root.nodes[0].nodes[0].prop //=> 'color'
* ```
*/
nodes: Child[] | undefined
/**
* The container’s first child.
*
* ```js
* rule.first === rules.nodes[0]
* ```
*/
get first(): Child | undefined
/**
* The container’s last child.
*
* ```js
* rule.last === rule.nodes[rule.nodes.length - 1]
* ```
*/
get last(): Child | undefined
/**
* Inserts new nodes to the end of the container.
*
* ```js
* const decl1 = new Declaration({ prop: 'color', value: 'black' })
* const decl2 = new Declaration({ prop: 'background-color', value: 'white' })
* rule.append(decl1, decl2)
*
* root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule
* root.append({ selector: 'a' }) // rule
* rule.append({ prop: 'color', value: 'black' }) // declaration
* rule.append({ text: 'Comment' }) // comment
*
* root.append('a {}')
* root.first.append('color: black; z-index: 1')
* ```
*
* @param nodes New nodes.
* @return This node for methods chain.
*/
append(...nodes: Container.NewChild[]): this
assign(overrides: Container.ContainerProps | object): this
clone(overrides?: Partial<Container.ContainerProps>): this
cloneAfter(overrides?: Partial<Container.ContainerProps>): this
cloneBefore(overrides?: Partial<Container.ContainerProps>): this
/**
* Iterates through the container’s immediate children,
* calling `callback` for each child.
*
* Returning `false` in the callback will break iteration.
*
* This method only iterates through the container’s immediate children.
* If you need to recursively iterate through all the container’s descendant
* nodes, use `Container#walk`.
*
* Unlike the for `{}`-cycle or `Array#forEach` this iterator is safe
* if you are mutating the array of child nodes during iteration.
* PostCSS will adjust the current index to match the mutations.
*
* ```js
* const root = postcss.parse('a { color: black; z-index: 1 }')
* const rule = root.first
*
* for (const decl of rule.nodes) {
* decl.cloneBefore({ prop: '-webkit-' + decl.prop })
* // Cycle will be infinite, because cloneBefore moves the current node
* // to the next index
* }
*
* rule.each(decl => {
* decl.cloneBefore({ prop: '-webkit-' + decl.prop })
* // Will be executed only for color and z-index
* })
* ```
*
* @param callback Iterator receives each node and index.
* @return Returns `false` if iteration was broke.
*/
each(
callback: (node: Child, index: number) => false | void
): false | undefined
/**
* Returns `true` if callback returns `true`
* for all of the container’s children.
*
* ```js
* const noPrefixes = rule.every(i => i.prop[0] !== '-')
* ```
*
* @param condition Iterator returns true or false.
* @return Is every child pass condition.
*/
every(
condition: (node: Child, index: number, nodes: Child[]) => boolean
): boolean
/**
* Returns a `child`’s index within the `Container#nodes` array.
*
* ```js
* rule.index( rule.nodes[2] ) //=> 2
* ```
*
* @param child Child of the current container.
* @return Child index.
*/
index(child: Child | number): number
/**
* Insert new node after old node within the container.
*
* @param oldNode Child or child’s index.
* @param newNode New node.
* @return This node for methods chain.
*/
insertAfter(oldNode: Child | number, newNode: Container.NewChild): this
/**
* Insert new node before old node within the container.
*
* ```js
* rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop }))
* ```
*
* @param oldNode Child or child’s index.
* @param newNode New node.
* @return This node for methods chain.
*/
insertBefore(oldNode: Child | number, newNode: Container.NewChild): this
/**
* Inserts new nodes to the start of the container.
*
* ```js
* const decl1 = new Declaration({ prop: 'color', value: 'black' })
* const decl2 = new Declaration({ prop: 'background-color', value: 'white' })
* rule.prepend(decl1, decl2)
*
* root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule
* root.append({ selector: 'a' }) // rule
* rule.append({ prop: 'color', value: 'black' }) // declaration
* rule.append({ text: 'Comment' }) // comment
*
* root.append('a {}')
* root.first.append('color: black; z-index: 1')
* ```
*
* @param nodes New nodes.
* @return This node for methods chain.
*/
prepend(...nodes: Container.NewChild[]): this
/**
* Add child to the end of the node.
*
* ```js
* rule.push(new Declaration({ prop: 'color', value: 'black' }))
* ```
*
* @param child New node.
* @return This node for methods chain.
*/
push(child: Child): this
/**
* Removes all children from the container
* and cleans their parent properties.
*
* ```js
* rule.removeAll()
* rule.nodes.length //=> 0
* ```
*
* @return This node for methods chain.
*/
removeAll(): this
/**
* Removes node from the container and cleans the parent properties
* from the node and its children.
*
* ```js
* rule.nodes.length //=> 5
* rule.removeChild(decl)
* rule.nodes.length //=> 4
* decl.parent //=> undefined
* ```
*
* @param child Child or child’s index.
* @return This node for methods chain.
*/
removeChild(child: Child | number): this
replaceValues(
pattern: RegExp | string,
replaced: { (substring: string, ...args: any[]): string } | string
): this
/**
* Passes all declaration values within the container that match pattern
* through callback, replacing those values with the returned result
* of callback.
*
* This method is useful if you are using a custom unit or function
* and need to iterate through all values.
*
* ```js
* root.replaceValues(/\d+rem/, { fast: 'rem' }, string => {
* return 15 * parseInt(string) + 'px'
* })
* ```
*
* @param pattern Replace pattern.
* @param {object} options Options to speed up the search.
* @param replaced String to replace pattern or callback
* that returns a new value. The callback
* will receive the same arguments
* as those passed to a function parameter
* of `String#replace`.
* @return This node for methods chain.
*/
replaceValues(
pattern: RegExp | string,
options: Container.ValueOptions,
replaced: { (substring: string, ...args: any[]): string } | string
): this
/**
* Returns `true` if callback returns `true` for (at least) one
* of the container’s children.
*
* ```js
* const hasPrefix = rule.some(i => i.prop[0] === '-')
* ```
*
* @param condition Iterator returns true or false.
* @return Is some child pass condition.
*/
some(
condition: (node: Child, index: number, nodes: Child[]) => boolean
): boolean
/**
* Traverses the container’s descendant nodes, calling callback
* for each node.
*
* Like container.each(), this method is safe to use
* if you are mutating arrays during iteration.
*
* If you only need to iterate through the container’s immediate children,
* use `Container#each`.
*
* ```js
* root.walk(node => {
* // Traverses all descendant nodes.
* })
* ```
*
* @param callback Iterator receives each node and index.
* @return Returns `false` if iteration was broke.
*/
walk(
callback: (node: ChildNode, index: number) => false | void
): false | undefined
/**
* Traverses the container’s descendant nodes, calling callback
* for each at-rule node.
*
* If you pass a filter, iteration will only happen over at-rules
* that have matching names.
*
* Like `Container#each`, this method is safe
* to use if you are mutating arrays during iteration.
*
* ```js
* root.walkAtRules(rule => {
* if (isOld(rule.name)) rule.remove()
* })
*
* let first = false
* root.walkAtRules('charset', rule => {
* if (!first) {
* first = true
* } else {
* rule.remove()
* }
* })
* ```
*
* @param name String or regular expression to filter at-rules by name.
* @param callback Iterator receives each node and index.
* @return Returns `false` if iteration was broke.
*/
walkAtRules(
nameFilter: RegExp | string,
callback: (atRule: AtRule, index: number) => false | void
): false | undefined
walkAtRules(
callback: (atRule: AtRule, index: number) => false | void
): false | undefined
/**
* Traverses the container’s descendant nodes, calling callback
* for each comment node.
*
* Like `Container#each`, this method is safe
* to use if you are mutating arrays during iteration.
*
* ```js
* root.walkComments(comment => {
* comment.remove()
* })
* ```
*
* @param callback Iterator receives each node and index.
* @return Returns `false` if iteration was broke.
*/
walkComments(
callback: (comment: Comment, indexed: number) => false | void
): false | undefined
/**
* Traverses the container’s descendant nodes, calling callback
* for each declaration node.
*
* If you pass a filter, iteration will only happen over declarations
* with matching properties.
*
* ```js
* root.walkDecls(decl => {
* checkPropertySupport(decl.prop)
* })
*
* root.walkDecls('border-radius', decl => {
* decl.remove()
* })
*
* root.walkDecls(/^background/, decl => {
* decl.value = takeFirstColorFromGradient(decl.value)
* })
* ```
*
* Like `Container#each`, this method is safe
* to use if you are mutating arrays during iteration.
*
* @param prop String or regular expression to filter declarations
* by property name.
* @param callback Iterator receives each node and index.
* @return Returns `false` if iteration was broke.
*/
walkDecls(
propFilter: RegExp | string,
callback: (decl: Declaration, index: number) => false | void
): false | undefined
walkDecls(
callback: (decl: Declaration, index: number) => false | void
): false | undefined
/**
* Traverses the container’s descendant nodes, calling callback
* for each rule node.
*
* If you pass a filter, iteration will only happen over rules
* with matching selectors.
*
* Like `Container#each`, this method is safe
* to use if you are mutating arrays during iteration.
*
* ```js
* const selectors = []
* root.walkRules(rule => {
* selectors.push(rule.selector)
* })
* console.log(`Your CSS uses ${ selectors.length } selectors`)
* ```
*
* @param selector String or regular expression to filter rules by selector.
* @param callback Iterator receives each node and index.
* @return Returns `false` if iteration was broke.
*/
walkRules(
selectorFilter: RegExp | string,
callback: (rule: Rule, index: number) => false | void
): false | undefined
walkRules(
callback: (rule: Rule, index: number) => false | void
): false | undefined
/**
* An internal method that converts a {@link NewChild} into a list of actual
* child nodes that can then be added to this container.
*
* This ensures that the nodes' parent is set to this container, that they use
* the correct prototype chain, and that they're marked as dirty.
*
* @param mnodes The new node or nodes to add.
* @param sample A node from whose raws the new node's `before` raw should be
* taken.
* @param type This should be set to `'prepend'` if the new nodes will be
* inserted at the beginning of the container.
* @hidden
*/
protected normalize(
nodes: Container.NewChild,
sample: Node | undefined,
type?: 'prepend' | false
): Child[]
}
declare class Container<
Child extends Node = ChildNode
> extends Container_<Child> {}
export = Container
@@ -0,0 +1,2 @@
declare const _default: () => number;
export default _default;
@@ -0,0 +1,626 @@
export default `flf2a$ 6 5 8 -1 12
Based on a lowercase font posted by robert@cs.caltech.edu
Figletized by Wendell Hicken 11/93 (whicken@parasoft.com)
Explanation of first line:
flf2 - "magic number" for file identification
a - should always be \`a', for now
$ - the "hardblank" -- prints as a blank, but can't be smushed
6 - height of a character
5 - height of a character, not including descenders
8 - max line length (excluding comment lines) + a fudge factor
-1 - default smushmode for this font (like "-m 15" on command line)
12 - number of comment lines
@
@
@
@
@
@@
@
|@
|@
@
o@
@@
@
| |@
\` \`@
@
@
@@
@
. . @
-+-+-@
-+-+-@
\` \` @
@@
, @
,-|-.@
\`-|-.@
| |@
\`-|-'@
\` @@
@
o /@
/ @
/ @
/ o@
@@
@
@
,-. @
|_|_@
| @
@@
@
|@
' @
@
@
@@
@
/@
| @
| @
| @
\\@@
@
\\ @
|@
|@
|@
/ @@
@
@
.|.@
-*-@
'|\`@
@@
@
@
| @
-+- @
| @
@@
@
@
@
@
| @
' @@
@
@
@
---@
@
@@
@
@
@
@
o@
@@
@
/@
/ @
/ @
/ @
@@
@
,--.@
| |@
| |@
\`--'@
@@
@
'|@
|@
|@
\`@
@@
@
,--.@
,--'@
| @
\`--'@
@@
@
,--.@
-|@
|@
\`--'@
@@
@
| |@
\`--|@
|@
\`@
@@
@
---.@
\`--.@
|@
\`--'@
@@
@
,--.@
|--.@
| |@
\`--'@
@@
@
---.@
/@
| @
| @
@@
@
,--.@
,--.@
| |@
\`--'@
@@
@
,--.@
\`__|@
|@
'@
@@
@
@
o@
@
o@
@@
@
@
o@
@
|@
' @@
@
/@
/ @
\\ @
\\@
@@
@
@
---@
---@
@
@@
@
\\ @
\\@
/@
/ @
@@
@
,---.@
,-'@
| @
o @
@@
@
,---.@
| o_/@
| @
\`---'@
@@
@
,---.@
|---|@
| |@
\` '@
@@
@
,---.@
|---.@
| |@
\`---'@
@@
@
,---.@
| @
| @
\`---'@
@@
@
,--. @
| |@
| |@
\`--' @
@@
@
,---.@
|--- @
| @
\`---'@
@@
@
,---.@
|__. @
| @
\` @
@@
@
,---.@
| _.@
| |@
\`---'@
@@
@
| |@
|---|@
| |@
\` '@
@@
@
|@
|@
|@
\`@
@@
@
|@
|@
|@
\`---'@
@@
@
| /@
|__/ @
| \\ @
\` \`@
@@
@
| @
| @
| @
\`---'@
@@
@
,-.-.@
| | |@
| | |@
\` ' '@
@@
@
, .@
|\\ |@
| \\ |@
\` \`'@
@@
@
,---.@
| |@
| |@
\`---'@
@@
@
,---.@
|---'@
| @
\` @
@@
@
,---.@
| |@
| |@
\`---\\@
@@
@
,---.@
|---'@
| \\ @
\` \`@
@@
@
,---.@
\`---.@
|@
\`---'@
@@
@
--.--@
| @
| @
\` @
@@
@
. .@
| |@
| |@
\`---'@
@@
@
. ,@
| |@
\\ / @
\`' @
@@
@
. . .@
| | |@
| | |@
\`-'-'@
@@
@
. ,@
>< @
| |@
' \`@
@@
@
, .@
| |@
\`---'@
| @
\` @@
@
,---,@
.-' @
| @
\`---'@
@@
@
,-@
| @
: @
| @
\`-@@
@
\\ @
\\ @
\\ @
\\@
@@
@
-.@
|@
:@
|@
-'@@
@
. @
/ \\@
@
@
@@
@
@
@
@
@
---@@
@
| @
\`@
@
@
@@
@
@
,---.@
,---|@
\`---^@
@@
@
| @
|---.@
| |@
\`---'@
@@
@
@
,---.@
| @
\`---'@
@@
@
|@
,---|@
| |@
\`---'@
@@
@
@
,---.@
|---'@
\`---'@
@@
@
,---.@
|__. @
| @
\` @
@@
@
@
,---.@
| |@
\`---|@
\`---'@@
@
| @
|---.@
| |@
\` '@
@@
@
o@
.@
|@
\`@
@@
@
o@
.@
|@
|@
\`---'@@
@
| @
|__/ @
| \\ @
\` \`@
@@
@
| @
| @
| @
\`---'@
@@
@
@
,-.-.@
| | |@
\` ' '@
@@
@
@
,---.@
| |@
\` '@
@@
@
@
,---.@
| |@
\`---'@
@@
@
@
,---.@
| |@
|---'@
| @@
@
@
,---.@
| |@
\`---|@
|@@
@
@
,---.@
| @
\` @
@@
@
@
,---.@
\`---.@
\`---'@
@@
@
| @
|--- @
| @
\`---'@
@@
@
@
. .@
| |@
\`---'@
@@
@
@
. ,@
\\ / @
\`' @
@@
@
@
. . .@
| | |@
\`-'-'@
@@
@
@
. ,@
>< @
' \`@
@@
@
@
, .@
| |@
\`---|@
\`---'@@
@
@
,---,@
.-' @
'---'@
@@
@
,-@
| @
-: @
| @
\`-@@
@
|@
|@
|@
|@
@@
@
-. @
| @
:-@
| @
-' @@
@
_ @
/ \\_/@
@
@
@@
o o @
,---.@
|---|@
| |@
\` '@
@@
o o @
,---.@
| |@
| |@
\`---'@
@@
o o @
. .@
| |@
| |@
\`---'@
@@
@
o o @
,---.@
,---|@
\`---^@
@@
@
o o @
,---.@
| |@
\`---'@
@@
@
o o @
. .@
| |@
\`---'@
@@
@
,---.@
|---.@
| |@
|---'@
| @@
`
@@ -0,0 +1,6 @@
function isNil(value) {
return value == null;
}
export {
isNil
};
@@ -0,0 +1,179 @@
# Cookies
<!--introduced_in=v5.15.0-->
<!--type=module-->
<!-- source_link=lib/web/cookies/index.js -->
> Stability: 2 - Stable
A set of helpers for reading and writing HTTP cookies on a [`Headers`][]
instance, following the [RFC 6265bis][] cookie parsing and serialization
algorithm. They operate on the `Cookie` request header and the `Set-Cookie`
response header.
```mjs
import { getCookies, setCookie, deleteCookie, getSetCookies, parseCookie } from 'undici'
```
These functions do not manage a cookie jar or perform any network activity; they
only read from and mutate the supplied `Headers` object.
## `Cookie`
The `Cookie` object describes a single cookie and its attributes. It is the
return shape of [`parseCookie()`][] and [`getSetCookies()`][], and the input
shape accepted by [`setCookie()`][].
* `name` {string} The cookie name.
* `value` {string} The cookie value.
* `expires` {Date|number} The cookie expiry time, as a `Date` or a Unix
timestamp in seconds. (optional)
* `maxAge` {number} The number of seconds until the cookie expires. (optional)
* `domain` {string} The hosts the cookie is sent to. (optional)
* `path` {string} The URL path that must exist for the cookie to be sent.
(optional)
* `secure` {boolean} Whether the cookie is only sent over HTTPS. (optional)
* `httpOnly` {boolean} Whether the cookie is inaccessible to client-side
JavaScript. (optional)
* `sameSite` {string} Controls whether the cookie is sent with cross-site
requests. One of `'Strict'`, `'Lax'`, or `'None'`. (optional)
* `unparsed` {string[]} Any attributes that were present in the `Set-Cookie`
header but not recognized, each formatted as `` `name=value` ``. (optional)
## `getCookies(headers)`
<!-- YAML
added: v5.15.0
-->
* `headers` {Headers} The `Headers` to read the `Cookie` header from.
* Returns: {Record<string, string>} A map of cookie names to values.
Parses the `Cookie` header of `headers` and returns its name/value pairs as a
plain object. An empty object is returned when no `Cookie` header is present.
```mjs
import { getCookies, Headers } from 'undici'
const headers = new Headers({
cookie: 'get=cookies; and=attributes'
})
console.log(getCookies(headers)) // { get: 'cookies', and: 'attributes' }
```
## `deleteCookie(headers, name[, attributes])`
<!-- YAML
added: v5.15.0
-->
* `headers` {Headers} The `Headers` to append the expiring cookie to.
* `name` {string} The name of the cookie to delete.
* `attributes` {Object} (optional)
* `path` {string} The path the cookie was scoped to. **Default:** `null`.
* `domain` {string} The domain the cookie was scoped to. **Default:** `null`.
* Returns: {undefined}
Appends a `Set-Cookie` header to `headers` that expires the named cookie by
setting its expiry time to the Unix epoch, causing a client to delete it on
receipt. The optional `path` and `domain` must match those of the cookie being
removed.
```mjs
import { deleteCookie, Headers } from 'undici'
const headers = new Headers()
deleteCookie(headers, 'name')
console.log(headers.get('set-cookie')) // name=; Expires=Thu, 01 Jan 1970 00:00:00 GMT
```
## `getSetCookies(headers)`
<!-- YAML
added: v5.15.0
-->
* `headers` {Headers} The `Headers` to read the `Set-Cookie` headers from.
* Returns: {Cookie[]} The parsed cookies, or an empty array when none are
present.
Parses every `Set-Cookie` header of `headers` and returns the resulting
[`Cookie`][] objects. A header that fails to parse yields a `null` entry at its
position in the returned array.
```mjs
import { getSetCookies, Headers } from 'undici'
const headers = new Headers({ 'set-cookie': 'undici=getSetCookies; Secure' })
console.log(getSetCookies(headers))
// [
// {
// name: 'undici',
// value: 'getSetCookies',
// secure: true
// }
// ]
```
## `setCookie(headers, cookie)`
<!-- YAML
added: v5.15.0
-->
* `headers` {Headers} The `Headers` to append the `Set-Cookie` header to.
* `cookie` {Cookie} The cookie to serialize. See [`Cookie`][].
* Returns: {undefined}
Serializes `cookie` and appends it to the `Set-Cookie` header of `headers`. When
the cookie name is empty, serialization yields no value and no header is
appended.
```mjs
import { setCookie, Headers } from 'undici'
const headers = new Headers()
setCookie(headers, { name: 'undici', value: 'setCookie' })
console.log(headers.get('Set-Cookie')) // undici=setCookie
```
## `parseCookie(cookie)`
<!-- YAML
added: v7.0.0
-->
* `cookie` {string} A `Set-Cookie` header value.
* Returns: {Cookie|null} The parsed cookie, or `null` if `cookie` is invalid.
Parses a single `Set-Cookie` header value into a [`Cookie`][] object. `null` is
returned when the value contains control characters or otherwise cannot be
parsed.
```mjs
import { parseCookie } from 'undici'
console.log(parseCookie('undici=getSetCookies; Secure; SameSite=Lax'))
// {
// name: 'undici',
// value: 'getSetCookies',
// secure: true,
// sameSite: 'Lax'
// }
```
The cookie value is returned exactly as it appears in the header; percent-encoded
sequences such as `%20` or `%0D%0A` are not decoded. The `sameSite` attribute is
only set when the value is a case-insensitive match for `Strict`, `Lax`, or
`None`.
[RFC 6265bis]: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis
[`Cookie`]: #cookie
[`Headers`]: https://developer.mozilla.org/en-US/docs/Web/API/Headers
[`getSetCookies()`]: #getsetcookiesheaders
[`parseCookie()`]: #parsecookiecookie
[`setCookie()`]: #setcookieheaders-cookie
@@ -0,0 +1,233 @@
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
import { util } from "../helpers/util.js";
const stringToNumber = z.string().transform((arg) => Number.parseFloat(arg));
// const numberToString = z
// .transformer(z.number())
// .transform((n) => String(n));
const asyncNumberToString = z.number().transform(async (n) => String(n));
test("transform ctx.addIssue with parse", () => {
const strs = ["foo", "bar"];
expect(() => {
z.string()
.transform((data, ctx) => {
const i = strs.indexOf(data);
if (i === -1) {
ctx.addIssue({
code: "custom",
message: `${data} is not one of our allowed strings`,
});
}
return data.length;
})
.parse("asdf");
}).toThrow(
JSON.stringify(
[
{
code: "custom",
message: "asdf is not one of our allowed strings",
path: [],
},
],
null,
2
)
);
});
test("transform ctx.addIssue with parseAsync", async () => {
const strs = ["foo", "bar"];
const result = await z
.string()
.transform(async (data, ctx) => {
const i = strs.indexOf(data);
if (i === -1) {
ctx.addIssue({
code: "custom",
message: `${data} is not one of our allowed strings`,
});
}
return data.length;
})
.safeParseAsync("asdf");
expect(JSON.parse(JSON.stringify(result))).toEqual({
success: false,
error: {
issues: [
{
code: "custom",
message: "asdf is not one of our allowed strings",
path: [],
},
],
name: "ZodError",
},
});
});
test("z.NEVER in transform", () => {
const foo = z
.number()
.optional()
.transform((val, ctx) => {
if (!val) {
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "bad" });
return z.NEVER;
}
return val;
});
type foo = z.infer<typeof foo>;
util.assertEqual<foo, number>(true);
const arg = foo.safeParse(undefined);
if (!arg.success) {
expect(arg.error.issues[0].message).toEqual("bad");
}
});
test("basic transformations", () => {
const r1 = z
.string()
.transform((data) => data.length)
.parse("asdf");
expect(r1).toEqual(4);
});
test("coercion", () => {
const numToString = z.number().transform((n) => String(n));
const data = z
.object({
id: numToString,
})
.parse({ id: 5 });
expect(data).toEqual({ id: "5" });
});
test("async coercion", async () => {
const numToString = z.number().transform(async (n) => String(n));
const data = await z
.object({
id: numToString,
})
.parseAsync({ id: 5 });
expect(data).toEqual({ id: "5" });
});
test("sync coercion async error", async () => {
expect(() =>
z
.object({
id: asyncNumberToString,
})
.parse({ id: 5 })
).toThrow();
// expect(data).toEqual({ id: '5' });
});
test("default", () => {
const data = z.string().default("asdf").parse(undefined); // => "asdf"
expect(data).toEqual("asdf");
});
test("dynamic default", () => {
const data = z
.string()
.default(() => "string")
.parse(undefined); // => "asdf"
expect(data).toEqual("string");
});
test("default when property is null or undefined", () => {
const data = z
.object({
foo: z.boolean().nullable().default(true),
bar: z.boolean().default(true),
})
.parse({ foo: null });
expect(data).toEqual({ foo: null, bar: true });
});
test("default with falsy values", () => {
const schema = z.object({
emptyStr: z.string().default("def"),
zero: z.number().default(5),
falseBoolean: z.boolean().default(true),
});
const input = { emptyStr: "", zero: 0, falseBoolean: true };
const output = schema.parse(input);
// defaults are not supposed to be used
expect(output).toEqual(input);
});
test("object typing", () => {
const t1 = z.object({
stringToNumber,
});
type t1 = z.input<typeof t1>;
type t2 = z.output<typeof t1>;
util.assertEqual<t1, { stringToNumber: string }>(true);
util.assertEqual<t2, { stringToNumber: number }>(true);
});
test("transform method overloads", () => {
const t1 = z.string().transform((val) => val.toUpperCase());
expect(t1.parse("asdf")).toEqual("ASDF");
const t2 = z.string().transform((val) => val.length);
expect(t2.parse("asdf")).toEqual(4);
});
test("multiple transformers", () => {
const doubler = stringToNumber.transform((val) => {
return val * 2;
});
expect(doubler.parse("5")).toEqual(10);
});
test("short circuit on dirty", () => {
const schema = z
.string()
.refine(() => false)
.transform((val) => val.toUpperCase());
const result = schema.safeParse("asdf");
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues[0].code).toEqual(z.ZodIssueCode.custom);
}
const result2 = schema.safeParse(1234);
expect(result2.success).toEqual(false);
if (!result2.success) {
expect(result2.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_type);
}
});
test("async short circuit on dirty", async () => {
const schema = z
.string()
.refine(() => false)
.transform((val) => val.toUpperCase());
const result = await schema.spa("asdf");
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues[0].code).toEqual(z.ZodIssueCode.custom);
}
const result2 = await schema.spa(1234);
expect(result2.success).toEqual(false);
if (!result2.success) {
expect(result2.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_type);
}
});
@@ -0,0 +1 @@
{"version":3,"file":"createRequestHandler.js","names":[],"sources":["../../../src/ssr/createRequestHandler.ts"],"sourcesContent":["import { createMemoryHistory } from '@tanstack/history'\nimport { mergeHeaders } from './headers'\nimport {\n attachRouterServerSsrUtils,\n getNormalizedURL,\n getOrigin,\n} from './ssr-server'\nimport type { HandlerCallback } from './handlerCallback'\nimport type { AnyHeaders } from './headers'\nimport type { AnyRouter } from '../router'\nimport type { Manifest } from '../manifest'\n\nexport type RequestHandler<TRouter extends AnyRouter> = (\n cb: HandlerCallback<TRouter>,\n) => Promise<Response>\n\nexport function createRequestHandler<TRouter extends AnyRouter>({\n createRouter,\n request,\n getRouterManifest,\n}: {\n createRouter: () => TRouter\n request: Request\n getRouterManifest?: () => Manifest | Promise<Manifest>\n}): RequestHandler<TRouter> {\n return async (cb) => {\n const router = createRouter()\n // Track whether the callback will handle cleanup\n let cbWillCleanup = false\n\n try {\n attachRouterServerSsrUtils({\n router,\n manifest: await getRouterManifest?.(),\n })\n\n // normalizing and sanitizing the pathname here for server, so we always deal with the same format during SSR.\n const { url } = getNormalizedURL(request.url, 'http://localhost')\n const origin = getOrigin(request)\n const href = url.href.replace(url.origin, '')\n\n // Create a history for the router\n const history = createMemoryHistory({\n initialEntries: [href],\n })\n\n // Update the router with the history and context\n router.update({\n history,\n origin: router.options.origin ?? origin,\n })\n\n await router.load()\n\n await router.serverSsr?.dehydrate()\n\n const responseHeaders = getRequestHeaders({\n router,\n })\n\n // Mark that the callback will handle cleanup\n cbWillCleanup = true\n return cb({\n request,\n router,\n responseHeaders,\n })\n } finally {\n if (!cbWillCleanup) {\n // Clean up router SSR state if the callback won't handle it\n // (e.g., if an error occurred before the callback was invoked).\n // When the callback runs, it handles cleanup (either via transformStreamWithRouter\n // for streaming, or directly in renderRouterToString for non-streaming).\n router.serverSsr?.cleanup()\n }\n }\n }\n}\n\nfunction getRequestHeaders(opts: { router: AnyRouter }): Headers {\n const matchHeaders = opts.router.stores.matches\n .get()\n .map<AnyHeaders>((match) => match.headers)\n\n // Handle Redirects\n const redirect = opts.router.stores.redirect.get()\n if (redirect) {\n matchHeaders.push(redirect.headers)\n }\n\n return mergeHeaders(\n {\n 'Content-Type': 'text/html; charset=UTF-8',\n },\n ...matchHeaders,\n )\n}\n"],"mappings":";;;;AAgBA,SAAgB,qBAAgD,EAC9D,cACA,SACA,qBAK0B;AAC1B,QAAO,OAAO,OAAO;EACnB,MAAM,SAAS,cAAc;EAE7B,IAAI,gBAAgB;AAEpB,MAAI;AACF,8BAA2B;IACzB;IACA,UAAU,MAAM,qBAAqB;IACtC,CAAC;GAGF,MAAM,EAAE,QAAQ,iBAAiB,QAAQ,KAAK,mBAAmB;GACjE,MAAM,SAAS,UAAU,QAAQ;GAIjC,MAAM,UAAU,oBAAoB,EAClC,gBAAgB,CAJL,IAAI,KAAK,QAAQ,IAAI,QAAQ,GAAG,CAIrB,EACvB,CAAC;AAGF,UAAO,OAAO;IACZ;IACA,QAAQ,OAAO,QAAQ,UAAU;IAClC,CAAC;AAEF,SAAM,OAAO,MAAM;AAEnB,SAAM,OAAO,WAAW,WAAW;GAEnC,MAAM,kBAAkB,kBAAkB,EACxC,QACD,CAAC;AAGF,mBAAgB;AAChB,UAAO,GAAG;IACR;IACA;IACA;IACD,CAAC;YACM;AACR,OAAI,CAAC,cAKH,QAAO,WAAW,SAAS;;;;AAMnC,SAAS,kBAAkB,MAAsC;CAC/D,MAAM,eAAe,KAAK,OAAO,OAAO,QACrC,KAAK,CACL,KAAiB,UAAU,MAAM,QAAQ;CAG5C,MAAM,WAAW,KAAK,OAAO,OAAO,SAAS,KAAK;AAClD,KAAI,SACF,cAAa,KAAK,SAAS,QAAQ;AAGrC,QAAO,aACL,EACE,gBAAgB,4BACjB,EACD,GAAG,aACJ"}
@@ -0,0 +1 @@
{"version":3,"file":"download.js","sources":["../../../src/icons/download.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Download\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjEgMTV2NGEyIDIgMCAwIDEtMiAySDVhMiAyIDAgMCAxLTItMnYtNCIgLz4KICA8cG9seWxpbmUgcG9pbnRzPSI3IDEwIDEyIDE1IDE3IDEwIiAvPgogIDxsaW5lIHgxPSIxMiIgeDI9IjEyIiB5MT0iMTUiIHkyPSIzIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/download\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 Download = createLucideIcon('Download', [\n ['path', { d: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4', key: 'ih7n3h' }],\n ['polyline', { points: '7 10 12 15 17 10', key: '2ggqvy' }],\n ['line', { x1: '12', x2: '12', y1: '15', y2: '3', key: '1vk2je' }],\n]);\n\nexport default Download;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,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,CAAA,CAC1E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAE,QAAQ,CAAoB,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,CAC1D,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACnE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"align-end-horizontal.js","sources":["../../../src/icons/align-end-horizontal.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name AlignEndHorizontal\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iNiIgaGVpZ2h0PSIxNiIgeD0iNCIgeT0iMiIgcng9IjIiIC8+CiAgPHJlY3Qgd2lkdGg9IjYiIGhlaWdodD0iOSIgeD0iMTQiIHk9IjkiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Ik0yMiAyMkgyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/align-end-horizontal\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 AlignEndHorizontal = createLucideIcon('AlignEndHorizontal', [\n ['rect', { width: '6', height: '16', x: '4', y: '2', rx: '2', key: 'z5wdxg' }],\n ['rect', { width: '6', height: '9', x: '14', y: '9', rx: '2', key: 'um7a8w' }],\n ['path', { d: 'M22 22H2', key: '19qnx5' }],\n]);\n\nexport default AlignEndHorizontal;\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,CAAA,CAAA,CAAA,CAAA,CAAqB,iBAAiB,oBAAsB,CAAA,CAAA,CAAA;AAAA,CAAA,CAChE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,KAAK,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC7E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,KAAK,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC7E,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,45 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.2.0](https://github.com/ljharb/gopd/compare/v1.1.0...v1.2.0) - 2024-12-03
### Commits
- [New] add `gOPD` entry point; remove `get-intrinsic` [`5b61232`](https://github.com/ljharb/gopd/commit/5b61232dedea4591a314bcf16101b1961cee024e)
## [v1.1.0](https://github.com/ljharb/gopd/compare/v1.0.1...v1.1.0) - 2024-11-29
### Commits
- [New] add types [`f585e39`](https://github.com/ljharb/gopd/commit/f585e397886d270e4ba84e53d226e4f9ca2eb0e6)
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `tape` [`0b8e4fd`](https://github.com/ljharb/gopd/commit/0b8e4fded64397a7726a9daa144a6cc9a5e2edfa)
- [Dev Deps] update `aud`, `npmignore`, `tape` [`48378b2`](https://github.com/ljharb/gopd/commit/48378b2443f09a4f7efbd0fb6c3ee845a6cabcf3)
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`78099ee`](https://github.com/ljharb/gopd/commit/78099eeed41bfdc134c912280483689cc8861c31)
- [Tests] replace `aud` with `npm audit` [`4e0d0ac`](https://github.com/ljharb/gopd/commit/4e0d0ac47619d24a75318a8e1f543ee04b2a2632)
- [meta] add missing `engines.node` [`1443316`](https://github.com/ljharb/gopd/commit/14433165d07835c680155b3dfd62d9217d735eca)
- [Deps] update `get-intrinsic` [`eee5f51`](https://github.com/ljharb/gopd/commit/eee5f51769f3dbaf578b70e2a3199116b01aa670)
- [Deps] update `get-intrinsic` [`550c378`](https://github.com/ljharb/gopd/commit/550c3780e3a9c77b62565712a001b4ed64ea61f5)
- [Dev Deps] add missing peer dep [`8c2ecf8`](https://github.com/ljharb/gopd/commit/8c2ecf848122e4e30abfc5b5086fb48b390dce75)
## [v1.0.1](https://github.com/ljharb/gopd/compare/v1.0.0...v1.0.1) - 2022-11-01
### Commits
- [Fix] actually export gOPD instead of dP [`4b624bf`](https://github.com/ljharb/gopd/commit/4b624bfbeff788c5e3ff16d9443a83627847234f)
## v1.0.0 - 2022-11-01
### Commits
- Initial implementation, tests, readme [`0911e01`](https://github.com/ljharb/gopd/commit/0911e012cd642092bd88b732c161c58bf4f20bea)
- Initial commit [`b84e33f`](https://github.com/ljharb/gopd/commit/b84e33f5808a805ac57ff88d4247ad935569acbe)
- [actions] add reusable workflows [`12ae28a`](https://github.com/ljharb/gopd/commit/12ae28ae5f50f86e750215b6e2188901646d0119)
- npm init [`280118b`](https://github.com/ljharb/gopd/commit/280118badb45c80b4483836b5cb5315bddf6e582)
- [meta] add `auto-changelog` [`bb78de5`](https://github.com/ljharb/gopd/commit/bb78de5639a180747fb290c28912beaaf1615709)
- [meta] create FUNDING.yml; add `funding` in package.json [`11c22e6`](https://github.com/ljharb/gopd/commit/11c22e6355bb01f24e7fac4c9bb3055eb5b25002)
- [meta] use `npmignore` to autogenerate an npmignore file [`4f4537a`](https://github.com/ljharb/gopd/commit/4f4537a843b39f698c52f072845092e6fca345bb)
- Only apps should have lockfiles [`c567022`](https://github.com/ljharb/gopd/commit/c567022a18573aa7951cf5399445d9840e23e98b)
@@ -0,0 +1 @@
{"version":3,"file":"path-reservations.d.ts","sourceRoot":"","sources":["../../src/path-reservations.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;AAmBjD,qBAAa,gBAAgB;;IAY3B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO;IA8DpC,KAAK,CAAC,EAAE,EAAE,OAAO;CA8ElB"}
@@ -0,0 +1 @@
{"version":3,"file":"mkdir.d.ts","sourceRoot":"","sources":["../../src/mkdir.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,cAAc,GAAG,QAAQ,GAAG,YAAY,CAAA;AAiBxE;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,GAChB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,yBAkDpD,CAAA;AA8ED,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,EAAE,KAAK,YAAY,wBAmEvD,CAAA"}
@@ -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 BookMinus = createLucideIcon("BookMinus", [
[
"path",
{
d: "M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",
key: "k3hazp"
}
],
["path", { d: "M9 10h6", key: "9gxzsh" }]
]);
export { BookMinus as default };
//# sourceMappingURL=book-minus.js.map
@@ -0,0 +1 @@
{"version":3,"file":"use-svg-visual-state.mjs","sources":["../../../../src/render/svg/use-svg-visual-state.ts"],"sourcesContent":["\"use client\"\n\nimport { scrapeSVGMotionValuesFromProps } from \"motion-dom\"\nimport { makeUseVisualState } from \"../../motion/utils/use-visual-state\"\nimport { createSvgRenderState } from \"./utils/create-render-state\"\n\nexport const useSVGVisualState = /*@__PURE__*/ makeUseVisualState({\n scrapeMotionValuesFromProps: scrapeSVGMotionValuesFromProps,\n createRenderState: createSvgRenderState,\n})\n"],"names":[],"mappings":";;;;;AAMO;AACH;AACA;AACH;;"}
@@ -0,0 +1,20 @@
import type { AllParams, RouteById } from './routeInfo'
import type { AnyRouter } from './router'
import type { Expand } from './utils'
export type ResolveUseParams<
TRouter extends AnyRouter,
TFrom,
TStrict extends boolean,
> = TStrict extends false
? AllParams<TRouter['routeTree']>
: Expand<RouteById<TRouter['routeTree'], TFrom>['types']['allParams']>
export type UseParamsResult<
TRouter extends AnyRouter,
TFrom,
TStrict extends boolean,
TSelected,
> = unknown extends TSelected
? ResolveUseParams<TRouter, TFrom, TStrict>
: TSelected
@@ -0,0 +1,721 @@
flf2a$ 7 7 20 -1 6
banner.flf by Ryan Youck (youck@cs.uregina.ca)
(From a unix program called banner)
I am not responsible for use of this font
Thanks to Glenn Chappell for his help
March 7, 1994
$$$@
$$$@
$$$@
$$$@
$$$@
$$$@
$$$@@
###$@
###$@
###$@
# $@
$@
###$@
###$@@
### ###$@
### ###$@
# # $@
$ $@
$ $@
$@
$@@
# # $@
# # $@
#######$@
# # $@
#######$@
# # $@
# # $@@
##### $@
# # #$@
# # $@
##### $@
# #$@
# # #$@
##### $@@
### #$@
# # # $@
### # $@
# $@
# ###$@
# # #$@
# ###$@@
## $@
# # $@
## $@
### $@
# # #$@
# # $@
### #$@@
###$@
###$@
# $@
# $@
$@
$@
$@@
##$@
# $@
# $@
# $@
# $@
# $@
##$@@
## $@
# $@
#$@
#$@
#$@
# $@
## $@@
$@
# # $@
# # $@
#######$@
# # $@
# # $@
$@@
$@
# $@
# $@
#####$@
# $@
# $@
$@@
$@
$@
$@
###$@
###$@
# $@
# $@@
$@
$@
$@
#####$@
$@
$@
$@@
$@
$@
$@
$@
###$@
###$@
###$@@
#$@
# $@
# $@
# $@
# $@
# $@
# $@@
### $@
# # $@
# #$@
# #$@
# #$@
# # $@
### $@@
# $@
## $@
# # $@
# $@
# $@
# $@
#####$@@
##### $@
# #$@
#$@
##### $@
# $@
# $@
#######$@@
##### $@
# #$@
#$@
##### $@
#$@
# #$@
##### $@@
# $@
# # $@
# # $@
# # $@
#######$@
# $@
# $@@
#######$@
# $@
# $@
###### $@
#$@
# #$@
##### $@@
##### $@
# #$@
# $@
###### $@
# #$@
# #$@
##### $@@
#######$@
# # $@
# $@
# $@
# $@
# $@
# $@@
##### $@
# #$@
# #$@
##### $@
# #$@
# #$@
##### $@@
##### $@
# #$@
# #$@
######$@
#$@
# #$@
##### $@@
# $@
###$@
# $@
$@
# $@
###$@
# $@@
###$@
###$@
$@
###$@
###$@
# $@
# $@@
#$@
# $@
# $@
# $@
# $@
# $@
#$@@
$@
$@
#####$@
$@
#####$@
$@
$@@
# $@
# $@
# $@
#$@
# $@
# $@
# $@@
##### $@
# #$@
#$@
### $@
# $@
$@
# $@@
##### $@
# #$@
# ### #$@
# ### #$@
# #### $@
# $@
##### $@@
# $@
# # $@
# # $@
# #$@
#######$@
# #$@
# #$@@
###### $@
# #$@
# #$@
###### $@
# #$@
# #$@
###### $@@
##### $@
# #$@
# $@
# $@
# $@
# #$@
##### $@@
###### $@
# #$@
# #$@
# #$@
# #$@
# #$@
###### $@@
#######$@
# $@
# $@
##### $@
# $@
# $@
#######$@@
#######$@
# $@
# $@
##### $@
# $@
# $@
# $@@
##### $@
# #$@
# $@
# ####$@
# #$@
# #$@
##### $@@
# #$@
# #$@
# #$@
#######$@
# #$@
# #$@
# #$@@
###$@
# $@
# $@
# $@
# $@
# $@
###$@@
#$@
#$@
#$@
#$@
# #$@
# #$@
##### $@@
# #$@
# # $@
# # $@
### $@
# # $@
# # $@
# #$@@
# $@
# $@
# $@
# $@
# $@
# $@
#######$@@
# #$@
## ##$@
# # # #$@
# # #$@
# #$@
# #$@
# #$@@
# #$@
## #$@
# # #$@
# # #$@
# # #$@
# ##$@
# #$@@
#######$@
# #$@
# #$@
# #$@
# #$@
# #$@
#######$@@
###### $@
# #$@
# #$@
###### $@
# $@
# $@
# $@@
##### $@
# #$@
# #$@
# #$@
# # #$@
# # $@
#### #$@@
###### $@
# #$@
# #$@
###### $@
# # $@
# # $@
# #$@@
##### $@
# #$@
# $@
##### $@
#$@
# #$@
##### $@@
#######$@
# $@
# $@
# $@
# $@
# $@
# $@@
# #$@
# #$@
# #$@
# #$@
# #$@
# #$@
##### $@@
# #$@
# #$@
# #$@
# #$@
# # $@
# # $@
# $@@
# #$@
# # #$@
# # #$@
# # #$@
# # #$@
# # #$@
## ## $@@
# #$@
# # $@
# # $@
# $@
# # $@
# # $@
# #$@@
# #$@
# # $@
# # $@
# $@
# $@
# $@
# $@@
#######$@
# $@
# $@
# $@
# $@
# $@
#######$@@
#####$@
# $@
# $@
# $@
# $@
# $@
#####$@@
# $@
# $@
# $@
# $@
# $@
# $@
#$@@
#####$@
#$@
#$@
#$@
#$@
#$@
#####$@@
# $@
# # $@
# #$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@
$@
#######$@@
###$@
###$@
# $@
#$@
$@
$@
$@@
$@
## $@
# # $@
# #$@
######$@
# #$@
# #$@@
$@
##### $@
# #$@
##### $@
# #$@
# #$@
##### $@@
$@
#### $@
# #$@
# $@
# $@
# #$@
#### $@@
$@
##### $@
# #$@
# #$@
# #$@
# #$@
##### $@@
$@
######$@
# $@
##### $@
# $@
# $@
######$@@
$@
######$@
# $@
##### $@
# $@
# $@
# $@@
$@
#### $@
# #$@
# $@
# ###$@
# #$@
#### $@@
$@
# #$@
# #$@
######$@
# #$@
# #$@
# #$@@
$@
#$@
#$@
#$@
#$@
#$@
#$@@
$@
#$@
#$@
#$@
#$@
# #$@
#### $@@
$@
# #$@
# # $@
#### $@
# # $@
# # $@
# #$@@
$@
# $@
# $@
# $@
# $@
# $@
######$@@
$@
# #$@
## ##$@
# ## #$@
# #$@
# #$@
# #$@@
$@
# #$@
## #$@
# # #$@
# # #$@
# ##$@
# #$@@
$@
#### $@
# #$@
# #$@
# #$@
# #$@
#### $@@
$@
##### $@
# #$@
# #$@
##### $@
# $@
# $@@
$@
#### $@
# #$@
# #$@
# # #$@
# # $@
### #$@@
$@
##### $@
# #$@
# #$@
##### $@
# # $@
# #$@@
$@
#### $@
# $@
#### $@
#$@
# #$@
#### $@@
$@
#####$@
# $@
# $@
# $@
# $@
# $@@
$@
# #$@
# #$@
# #$@
# #$@
# #$@
#### $@@
$@
# #$@
# #$@
# #$@
# #$@
# # $@
## $@@
$@
# #$@
# #$@
# #$@
# ## #$@
## ##$@
# #$@@
$@
# #$@
# # $@
## $@
## $@
# # $@
# #$@@
$@
# #$@
# # $@
# $@
# $@
# $@
# $@@
$@
######$@
# $@
# $@
# $@
# $@
######$@@
###$@
# $@
# $@
## $@
# $@
# $@
###$@@
#$@
#$@
#$@
$@
#$@
#$@
#$@@
### $@
# $@
# $@
##$@
# $@
# $@
### $@@
## $@
# # #$@
## $@
$@
$@
$@
$@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@@ -0,0 +1,7 @@
"use strict";
const { ESLint } = require("./eslint");
module.exports = {
ESLint,
};
@@ -0,0 +1 @@
{"version":3,"names":["_core","require","_traverse","rewriteThisVisitor","rewriteThis","programPath","visitors","environmentVisitor","ThisExpression","path","replaceWith","t","unaryExpression","numericLiteral","noScope","traverse","node"],"sources":["../src/rewrite-this.ts"],"sourcesContent":["import { types as t } from \"@babel/core\";\nimport traverse, { visitors, type NodePath } from \"@babel/traverse\";\n\n/**\n * A lazily constructed visitor to walk the tree, rewriting all `this` references in the\n * top-level scope to be `void 0` (undefined).\n *\n */\nlet rewriteThisVisitor: Parameters<typeof traverse>[1];\n\nexport default function rewriteThis(programPath: NodePath) {\n if (!rewriteThisVisitor) {\n rewriteThisVisitor = visitors.environmentVisitor({\n ThisExpression(path) {\n path.replaceWith(t.unaryExpression(\"void\", t.numericLiteral(0), true));\n },\n });\n rewriteThisVisitor.noScope = true;\n }\n // Rewrite \"this\" to be \"undefined\".\n traverse(programPath.node, rewriteThisVisitor);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAOA,IAAIE,kBAAkD;AAEvC,SAASC,WAAWA,CAACC,WAAqB,EAAE;EACzD,IAAI,CAACF,kBAAkB,EAAE;IACvBA,kBAAkB,GAAGG,kBAAQ,CAACC,kBAAkB,CAAC;MAC/CC,cAAcA,CAACC,IAAI,EAAE;QACnBA,IAAI,CAACC,WAAW,CAACC,WAAC,CAACC,eAAe,CAAC,MAAM,EAAED,WAAC,CAACE,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;MACxE;IACF,CAAC,CAAC;IACFV,kBAAkB,CAACW,OAAO,GAAG,IAAI;EACnC;EAEA,IAAAC,iBAAQ,EAACV,WAAW,CAACW,IAAI,EAAEb,kBAAkB,CAAC;AAChD","ignoreList":[]}
@@ -0,0 +1 @@
{"version":3,"file":"bluetooth-off.js","sources":["../../../src/icons/bluetooth-off.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BluetoothOff\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTcgMTctNSA1VjEybC01IDUiIC8+CiAgPHBhdGggZD0ibTIgMiAyMCAyMCIgLz4KICA8cGF0aCBkPSJNMTQuNSA5LjUgMTcgN2wtNS01djQuNSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/bluetooth-off\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 BluetoothOff = createLucideIcon('BluetoothOff', [\n ['path', { d: 'm17 17-5 5V12l-5 5', key: 'v5aci6' }],\n ['path', { d: 'm2 2 20 20', key: '1ooewy' }],\n ['path', { d: 'M14.5 9.5 17 7l-5-5v4.5', key: '1kddfz' }],\n]);\n\nexport default BluetoothOff;\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,CAAsB,CAAA,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,CACnD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC3C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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;AAC1D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
module.exports={C:{"88":0.00508,"105":0.00508,"115":0.03049,"120":0.06098,"121":0.04574,"132":0.03049,"134":0.01525,"139":0.43705,"140":0.04574,"149":0.01525,"150":0.00508,"151":0.08131,"152":0.00508,"153":0.03049,"154":0.18803,"155":1.05197,"156":0.80296,"157":0.01016,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 106 107 108 109 110 111 112 113 114 116 117 118 119 122 123 124 125 126 127 128 129 130 131 133 135 136 137 138 141 142 143 144 145 146 147 148 158 159 160 3.5 3.6"},D:{"76":0.01525,"79":0.00508,"94":0.00508,"97":0.00508,"103":0.06098,"104":0.03557,"105":0.0559,"106":0.0559,"107":0.05082,"108":0.04574,"109":0.20328,"110":0.04574,"111":0.07623,"112":0.0559,"114":0.01016,"116":0.12705,"117":0.05082,"118":0.10164,"119":0.03557,"120":0.17787,"122":0.08131,"124":0.0559,"125":0.03557,"127":0.00508,"128":0.02033,"131":0.09148,"132":0.00508,"133":0.12705,"134":0.07115,"135":0.03049,"136":0.04574,"137":0.03557,"138":0.31,"139":0.03049,"140":0.0559,"141":0.04574,"142":0.12197,"143":0.01525,"144":0.06098,"145":0.10672,"146":0.13213,"147":0.04066,"148":0.10672,"149":0.11689,"150":0.39131,"151":1.35181,"152":8.8376,"153":9.74219,"154":2.15985,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 77 78 80 81 83 84 85 86 87 88 89 90 91 92 93 95 96 98 99 100 101 102 113 115 121 123 126 129 130 155 156 157"},F:{"101":0.07623,"102":0.01525,"110":0.00508,"111":0.00508,"134":0.22361,"135":1.00115,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 103 104 105 106 107 108 109 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 131 132 133 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"109":0.01525,"119":0.03557,"120":0.07623,"126":0.06607,"133":0.00508,"136":0.01525,"142":0.00508,"145":0.03557,"146":0.00508,"147":0.00508,"148":0.00508,"149":0.01525,"150":0.05082,"151":0.10672,"152":1.71772,"153":4.45183,"154":0.66066,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 121 122 123 124 125 127 128 129 130 131 132 134 135 137 138 139 140 141 143 144"},E:{"14":0.00508,"27":0.62509,_:"4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 11.1 12.1 15.2-15.3 15.5 16.0 17.0 27.1 TP","10.1":0.00508,"13.1":0.01016,"14.1":0.00508,"15.1":0.02541,"15.4":0.01525,"15.6":0.5641,"16.1":0.02033,"16.2":0.01016,"16.3":0.04574,"16.4":0.00508,"16.5":0.01016,"16.6":0.3659,"17.1":0.47771,"17.2":0.01525,"17.3":0.01525,"17.4":0.03049,"17.5":0.10164,"17.6":0.56918,"18.0":0.00508,"18.1":0.02541,"18.2":0.02033,"18.3":0.04574,"18.4":0.03049,"18.5-18.7":0.07115,"26.0":0.01525,"26.1":0.07623,"26.2":0.11689,"26.3":0.32525,"26.4":0.35574,"26.5":0.91984,"26.6":3.9538,"27.2":0.04574},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00282,"5.0-5.1":0.00282,"6.0-6.1":0,"7.0-7.1":0.00564,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.02819,"11.0-11.2":0.00282,"11.3-11.4":0.00564,"12.0-12.1":0,"12.2-12.5":0.07331,"13.0-13.1":0,"13.2":0.0141,"13.3":0,"13.4-13.7":0.00282,"14.0-14.4":0.01128,"14.5-14.8":0.01692,"15.0-15.1":0.01692,"15.2-15.3":0.01128,"15.4":0.0141,"15.5":0.01692,"15.6-15.8":0.36653,"16.0":0.02819,"16.1":0.05075,"16.2":0.02819,"16.3":0.06203,"16.4":0.0141,"16.5":0.02256,"16.6-16.7":0.51033,"17.0":0.01974,"17.1":0.02819,"17.2":0.02819,"17.3":0.04229,"17.4":0.05921,"17.5":0.1156,"17.6-17.7":0.29887,"18.0":0.06203,"18.1":0.12406,"18.2":0.16917,"18.3":0.29323,"18.4":0.18327,"18.5-18.7":3.78657,"26.0":0.18327,"26.1":0.18609,"26.2":0.48495,"26.3":0.52443,"26.4":0.38345,"26.5":2.56855,"26.6":15.84835,"27.0":1.2152,"27.1":0,"27.2":0.03101},P:{"28":0.01203,"29":0.11425,"30":1.35896,_:"4 20 21 22 23 24 25 26 27 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0"},I:{"0":0.01474,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.16229,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0":19.37677},R:{_:"0"},M:{"0":1.05737},Q:{_:"14.9"},O:{_:"0"},H:{all:0}};
@@ -0,0 +1,49 @@
import { default as React } from 'react';
export interface ClientOnlyProps {
/**
* The children to render when the JS is loaded.
*/
children: React.ReactNode;
/**
* The fallback component to render if the JS is not yet loaded.
*/
fallback?: React.ReactNode;
}
/**
* Render the children only after the JS has loaded client-side. Use an optional
* fallback component if the JS is not yet loaded.
*
* @example
* Render a Chart component if JS loads, renders a simple FakeChart
* component server-side or if there is no JS. The FakeChart can have only the
* UI without the behavior or be a loading spinner or skeleton.
*
* ```tsx
* return (
* <ClientOnly fallback={<FakeChart />}>
* <Chart />
* </ClientOnly>
* )
* ```
*/
export declare function ClientOnly({ children, fallback }: ClientOnlyProps): import("react/jsx-runtime").JSX.Element;
/**
* Return a boolean indicating if the JS has been hydrated already.
* When doing Server-Side Rendering, the result will always be false.
* When doing Client-Side Rendering, the result will always be false on the
* first render and true from then on. Even if a new component renders it will
* always start with true.
*
* @example
* ```tsx
* // Disable a button that needs JS to work.
* let hydrated = useHydrated()
* return (
* <button type="button" disabled={!hydrated} onClick={doSomethingCustom}>
* Click me
* </button>
* )
* ```
* @returns True if the JS has been hydrated already, false otherwise.
*/
export declare function useHydrated(): boolean;
@@ -0,0 +1 @@
{"version":3,"names":["asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined"],"sources":["../../src/helpers/asyncToGenerator.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nfunction asyncGeneratorStep<TYield, TReturn>(\n gen: Generator<TYield, TReturn, Awaited<TYield>>,\n resolve: (value: TReturn) => void,\n reject: (error: unknown) => void,\n _next: (value: Awaited<TYield> | undefined) => void,\n _throw: (err: unknown) => void,\n key: \"next\",\n arg: Awaited<TYield> | undefined,\n): void;\nfunction asyncGeneratorStep<TYield, TReturn>(\n gen: Generator<TYield, TReturn, Awaited<TYield>>,\n resolve: (value: TReturn) => void,\n reject: (error: unknown) => void,\n _next: (value: Awaited<TYield> | undefined) => void,\n _throw: (err: unknown) => void,\n key: \"throw\",\n arg: unknown,\n): void;\nfunction asyncGeneratorStep<TYield, TReturn>(\n gen: Generator<TYield, TReturn, Awaited<TYield>>,\n resolve: (value: TReturn) => void,\n reject: (error: unknown) => void,\n _next: (value: Awaited<TYield> | undefined) => void,\n _throw: (err: unknown) => void,\n key: \"next\" | \"throw\",\n arg: any,\n): void {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n // The \"value\" variable is defined above before the \"info.done\" guard\n // So TypeScript can't narrowing \"value\" to TReturn here\n // If we use \"info.value\" here the type is narrowed correctly.\n // Still requires manual casting for the smaller bundle size.\n resolve(value as TReturn);\n } else {\n // Same as above, TypeScript can't narrow \"value\" to TYield here\n Promise.resolve(value as TYield).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator<\n This,\n Args extends unknown[],\n TYield,\n TReturn,\n>(\n fn: (\n this: This,\n ...args: Args\n ) => Generator<TYield, TReturn, Awaited<TYield>>,\n): (this: This, ...args: Args) => Promise<TReturn> {\n return function (this: any) {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n // Casting \"args\" to \"Args\" is intentional since we are trying to avoid the spread operator (not ES5)\n var gen = fn.apply(self, args as any as Args);\n function _next(value: Awaited<TYield> | undefined) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err: unknown) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n"],"mappings":";;;;;;AAoBA,SAASA,kBAAkBA,CACzBC,GAAgD,EAChDC,OAAiC,EACjCC,MAAgC,EAChCC,KAAmD,EACnDC,MAA8B,EAC9BC,GAAqB,EACrBC,GAAQ,EACF;EACN,IAAI;IACF,IAAIC,IAAI,GAAGP,GAAG,CAACK,GAAG,CAAC,CAACC,GAAG,CAAC;IACxB,IAAIE,KAAK,GAAGD,IAAI,CAACC,KAAK;EACxB,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdP,MAAM,CAACO,KAAK,CAAC;IACb;EACF;EAEA,IAAIF,IAAI,CAACG,IAAI,EAAE;IAKbT,OAAO,CAACO,KAAgB,CAAC;EAC3B,CAAC,MAAM;IAELG,OAAO,CAACV,OAAO,CAACO,KAAe,CAAC,CAACI,IAAI,CAACT,KAAK,EAAEC,MAAM,CAAC;EACtD;AACF;AAEe,SAASS,iBAAiBA,CAMvCC,EAGgD,EACC;EACjD,OAAO,YAAqB;IAC1B,IAAIC,IAAI,GAAG,IAAI;MACbC,IAAI,GAAGC,SAAS;IAClB,OAAO,IAAIN,OAAO,CAAC,UAAUV,OAAO,EAAEC,MAAM,EAAE;MAE5C,IAAIF,GAAG,GAAGc,EAAE,CAACI,KAAK,CAACH,IAAI,EAAEC,IAAmB,CAAC;MAC7C,SAASb,KAAKA,CAACK,KAAkC,EAAE;QACjDT,kBAAkB,CAACC,GAAG,EAAEC,OAAO,EAAEC,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAE,MAAM,EAAEI,KAAK,CAAC;MACxE;MACA,SAASJ,MAAMA,CAACe,GAAY,EAAE;QAC5BpB,kBAAkB,CAACC,GAAG,EAAEC,OAAO,EAAEC,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAE,OAAO,EAAEe,GAAG,CAAC;MACvE;MAEAhB,KAAK,CAACiB,SAAS,CAAC;IAClB,CAAC,CAAC;EACJ,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,824 @@
flf2a$ 8 7 20 -1 7
MARQUEE by Ron Fritz 8/94
Figlet Release 2.0
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
.::@
.::@
.::@
.: @
.: @
@
.::@
@@
.: .:@
.: .:@
@
@
@
@
@
@@
@
.:: .:: @
.:::::::.::::@
.:: .:: @
.:: .:: @
.:::::::.::::@
.:: .:: @
@@
.:: @
.: .:: @
.:: @
.:: @
.:: @
.:: .:: @
.:: @
@@
@
.:: .::@
.:: @
.:: @
.:: @
.:: @
.:: .:: @
@@
.: @
.:: .::@
.:: @
.::: @
.:: @
.:: .::@
.: @
@@
.::@
.:@
@
@
@
@
@
@@
.::@
.:: @
.:: @
.:: @
.:: @
.:: @
.::@
@@
.:: @
.:: @
.::@
.::@
.::@
.:: @
.:: @
@@
.:: @
.:: .:: .::@
.: .: .:: @
.:::: .:::::::@
.: .: .:: @
.:: .:: .::@
.:: @
@@
@
.:: @
.:: @
.:::.:::::@
.:: @
.:: @
@
@@
@
@
@
@
@
@
.::@
.:@@
@
@
@
.:::::@
@
@
@
@@
@
@
@
@
@
@
.::@
@@
.::@
.:: @
.:: @
.:: @
.:: @
.:: @
.:: @
@@
@
.:: @
.:: .:: @
.:: .:: @
.:: .::@
.:: .:: @
.::: @
@@
@
.:: @
.:: @
.:: @
.:: @
.:: @
.::::@
@@
@
.:::.: @
.: .:@
.:: @
.:: @
.:: @
.:::::::@
@@
@
.:: .:: @
.:: @
.:: @
::. @
:::.@
.:::::: @
@@
@
.:: @
. .:: @
.: .:: @
.:: .:: @
.:::: .: .::@
.:: @
@@
@
.:: .::: @
.:: @
.::: @
.:: @
.::@
.::: .:: @
@@
@
.:: @
.:: @
.:: @
.: .:: @
.:: .:: @
.:: .:: @
@@
@
.::::: .::@
.:: @
.:: @
.:: @
.:: @
.:: @
@@
@
.: @
.:: .:: @
.:: .: @
.:: .: @
.:: .::@
.:::: @
@@
@
.: .:: @
.:: .::@
.: .::@
.: .:: @
.:: @
.:: @
@@
@
@
@
@
.::@
@
.::@
@@
@
@
@
@
.::@
@
.::@
.:@@
.::@
.:: @
.:: @
.:: @
.:: @
.:: @
.::@
@@
@
@
.::::::@
@
.::::::@
@
@
@@
.:: @
.:: @
.:: @
.::@
.:: @
.:: @
.:: @
@@
.::: @
.:: @
.::@
.:: @
.:: @
@
.:: @
@@
@
.::: @
.: .:: @
.: .:: .::@
.:: .::. .::@
.:: ``` @
.:: @
@@
.: @
.: :: @
.: .:: @
.:: .:: @
.:::::: .:: @
.:: .:: @
.:: .::@
@@
.:: .:: @
.: .:: @
.: .::@
.::: .: @
.: .::@
.: .:@
.:::: .:: @
@@
.:: @
.:: .::@
.:: @
.:: @
.:: @
.:: .::@
.:::: @
@@
.::::: @
.:: .:: @
.:: .::@
.:: .::@
.:: .::@
.:: .:: @
.::::: @
@@
.::::::::@
.:: @
.:: @
.:::::: @
.:: @
.:: @
.::::::::@
@@
.::::::::@
.:: @
.:: @
.:::::: @
.:: @
.:: @
.:: @
@@
.:::: @
.: .:: @
.:: @
.:: @
.:: .::::@
.:: .: @
.::::: @
@@
.:: .::@
.:: .::@
.:: .::@
.:::::: .::@
.:: .::@
.:: .::@
.:: .::@
@@
.::@
.::@
.::@
.::@
.::@
.::@
.::@
@@
.::@
.::@
.::@
.::@
.::@
.: .::@
.:::: @
@@
.:: .:: @
.:: .:: @
.:: .:: @
.: .: @
.:: .:: @
.:: .:: @
.:: .::@
@@
.:: @
.:: @
.:: @
.:: @
.:: @
.:: @
.::::::::@
@@
.:: .::@
.: .:: .:::@
.:: .:: . .::@
.:: .:: .::@
.:: .: .::@
.:: .::@
.:: .::@
@@
.::: .::@
.: .:: .::@
.:: .:: .::@
.:: .:: .::@
.:: .: .::@
.:: .: ::@
.:: .::@
@@
.:::: @
.:: .:: @
.:: .::@
.:: .::@
.:: .::@
.:: .:: @
.:::: @
@@
.::::::: @
.:: .::@
.:: .::@
.::::::: @
.:: @
.:: @
.:: @
@@
.:::: @
.:: .:: @
.:: .::@
.:: .::@
.:: .::@
.:: .: .:: @
.:: :: @
.: @@
.::::::: @
.:: .:: @
.:: .:: @
.: .:: @
.:: .:: @
.:: .:: @
.:: .::@
@@
.:: :: @
.:: .::@
.:: @
.:: @
.:: @
.:: .::@
.:: :: @
@@
.::: .::::::@
.:: @
.:: @
.:: @
.:: @
.:: @
.:: @
@@
.:: .::@
.:: .::@
.:: .::@
.:: .::@
.:: .::@
.:: .::@
.::::: @
@@
.:: .::@
.:: .:: @
.:: .:: @
.:: .:: @
.:: .:: @
.:::: @
.:: @
@@
.:: .::@
.:: .::@
.:: .: .::@
.:: .:: .::@
.:: .: .:: .::@
.: .: .::::@
.:: .::@
@@
.:: .::@
.:: .:: @
.:: .:: @
.:: @
.:: .:: @
.:: .:: @
.:: .::@
@@
.:: .::@
.:: .:: @
.:: .:: @
.:: @
.:: @
.:: @
.:: @
@@
.::::::: .::@
.:: @
.:: @
.:: @
.:: @
.:: @
.:::::::::::@
@@
.::::@
.:: @
.:: @
.:: @
.:: @
.:: @
.::::@
@@
.:: @
.:: @
.:: @
.:: @
.:: @
.:: @
.::@
@@
.::::@
.::@
.::@
.::@
.::@
.::@
.::::@
@@
.:: @
.:: .:: @
.:: .::@
@
@
@
@
@@
@
@
@
@
@
@
@
.:::::@@
.::@
.: @
@
@
@
@
@
@@
@
@
.:: @
.:: .:: @
.:: .:: @
.:: .:: @
.:: .:::@
@@
.:: @
.:: @
.:: @
.:: .:: @
.:: .::@
.:: .::@
.:: .:: @
@@
@
@
.:::@
.:: @
.:: @
.:: @
.:::@
@@
.::@
.::@
.::@
.:: .::@
.: .::@
.: .::@
.:: .::@
@@
@
@
.:: @
.: .:: @
.::::: .::@
.: @
.:::: @
@@
.::@
.: @
.:.: .:@
.:: @
.:: @
.:: @
.:: @
@@
@
@
.:: @
.:: .::@
.:: .::@
.:: .::@
.:: @
.:: @@
@
.:: @
.:: @
.: .: @
.:: .::@
.: .::@
.:: .::@
@@
@
.:@
@
.::@
.::@
.::@
.::@
@@
@
.::@
@
.::@
.::@
.::@
.::@
.::: @@
.:: @
.:: @
.:: .::@
.:: .:: @
.:.:: @
.:: .:: @
.:: .::@
@@
.::@
.::@
.::@
.::@
.::@
.::@
.:::@
@@
@
@
.::: .:: .:: @
.:: .: .::@
.:: .: .::@
.:: .: .::@
.::: .: .::@
@@
@
@
.:: .:: @
.:: .::@
.:: .::@
.:: .::@
.::: .::@
@@
@
@
.:: @
.:: .:: @
.:: .::@
.:: .:: @
.:: @
@@
@
@
.: .:: @
.: .:: @
.: .::@
.:: .:: @
.:: @
.:: @@
@
@
.:: @
.: .:: @
.: .:: @
.::.:: @
.:: @
.:::@@
@
@
.: .:::@
.:: @
.:: @
.:: @
.::: @
@@
@
@
.:::: @
.:: @
.::: @
.::@
.:: .::@
@@
.:: @
.:: @
.:.: .:@
.:: @
.:: @
.:: @
.:: @
@@
@
@
.:: .::@
.:: .::@
.:: .::@
.:: .::@
.::.::@
@@
@
@
.:: .::@
.:: .:: @
.:: .:: @
.:.:: @
.:: @
@@
@
@
.:: .:::@
.:: : .::@
.:: .: .::@
.: .: .:.::@
.::: .:::@
@@
@
@
.:: .::@
.: .:: @
.: @
.: .:: @
.:: .::@
@@
@
@
.:: .::@
.:: .:: @
.::: @
.:: @
.:: @
.:: @@
@
@
.:::: .::@
.:: @
.:: @
.:: @
.::::::::@
@@
.::@
.:: @
.:: @
.:: @
.:: @
.:: @
.::@
@@
.:@
.:@
.:@
@
.:@
.:@
.:@
@@
.:: @
.:: @
.:: @
.::@
.:: @
.:: @
.:: @
@@
.:: .: @
.: .::@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Info = createLucideIcon("Info", [
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
["path", { d: "M12 16v-4", key: "1dtifu" }],
["path", { d: "M12 8h.01", key: "e9boi3" }]
]);
export { Info as default };
//# sourceMappingURL=info.js.map
@@ -0,0 +1,105 @@
import { ZodFirstPartyTypeKind } from "zod/v3";
import { parseAnyDef } from "./parsers/any.js";
import { parseArrayDef } from "./parsers/array.js";
import { parseBigintDef } from "./parsers/bigint.js";
import { parseBooleanDef } from "./parsers/boolean.js";
import { parseBrandedDef } from "./parsers/branded.js";
import { parseCatchDef } from "./parsers/catch.js";
import { parseDateDef } from "./parsers/date.js";
import { parseDefaultDef } from "./parsers/default.js";
import { parseEffectsDef } from "./parsers/effects.js";
import { parseEnumDef } from "./parsers/enum.js";
import { parseIntersectionDef } from "./parsers/intersection.js";
import { parseLiteralDef } from "./parsers/literal.js";
import { parseMapDef } from "./parsers/map.js";
import { parseNativeEnumDef } from "./parsers/nativeEnum.js";
import { parseNeverDef } from "./parsers/never.js";
import { parseNullDef } from "./parsers/null.js";
import { parseNullableDef } from "./parsers/nullable.js";
import { parseNumberDef } from "./parsers/number.js";
import { parseObjectDef } from "./parsers/object.js";
import { parseOptionalDef } from "./parsers/optional.js";
import { parsePipelineDef } from "./parsers/pipeline.js";
import { parsePromiseDef } from "./parsers/promise.js";
import { parseRecordDef } from "./parsers/record.js";
import { parseSetDef } from "./parsers/set.js";
import { parseStringDef } from "./parsers/string.js";
import { parseTupleDef } from "./parsers/tuple.js";
import { parseUndefinedDef } from "./parsers/undefined.js";
import { parseUnionDef } from "./parsers/union.js";
import { parseUnknownDef } from "./parsers/unknown.js";
import { parseReadonlyDef } from "./parsers/readonly.js";
export const selectParser = (def, typeName, refs) => {
switch (typeName) {
case ZodFirstPartyTypeKind.ZodString:
return parseStringDef(def, refs);
case ZodFirstPartyTypeKind.ZodNumber:
return parseNumberDef(def, refs);
case ZodFirstPartyTypeKind.ZodObject:
return parseObjectDef(def, refs);
case ZodFirstPartyTypeKind.ZodBigInt:
return parseBigintDef(def, refs);
case ZodFirstPartyTypeKind.ZodBoolean:
return parseBooleanDef();
case ZodFirstPartyTypeKind.ZodDate:
return parseDateDef(def, refs);
case ZodFirstPartyTypeKind.ZodUndefined:
return parseUndefinedDef(refs);
case ZodFirstPartyTypeKind.ZodNull:
return parseNullDef(refs);
case ZodFirstPartyTypeKind.ZodArray:
return parseArrayDef(def, refs);
case ZodFirstPartyTypeKind.ZodUnion:
case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
return parseUnionDef(def, refs);
case ZodFirstPartyTypeKind.ZodIntersection:
return parseIntersectionDef(def, refs);
case ZodFirstPartyTypeKind.ZodTuple:
return parseTupleDef(def, refs);
case ZodFirstPartyTypeKind.ZodRecord:
return parseRecordDef(def, refs);
case ZodFirstPartyTypeKind.ZodLiteral:
return parseLiteralDef(def, refs);
case ZodFirstPartyTypeKind.ZodEnum:
return parseEnumDef(def);
case ZodFirstPartyTypeKind.ZodNativeEnum:
return parseNativeEnumDef(def);
case ZodFirstPartyTypeKind.ZodNullable:
return parseNullableDef(def, refs);
case ZodFirstPartyTypeKind.ZodOptional:
return parseOptionalDef(def, refs);
case ZodFirstPartyTypeKind.ZodMap:
return parseMapDef(def, refs);
case ZodFirstPartyTypeKind.ZodSet:
return parseSetDef(def, refs);
case ZodFirstPartyTypeKind.ZodLazy:
return () => def.getter()._def;
case ZodFirstPartyTypeKind.ZodPromise:
return parsePromiseDef(def, refs);
case ZodFirstPartyTypeKind.ZodNaN:
case ZodFirstPartyTypeKind.ZodNever:
return parseNeverDef(refs);
case ZodFirstPartyTypeKind.ZodEffects:
return parseEffectsDef(def, refs);
case ZodFirstPartyTypeKind.ZodAny:
return parseAnyDef(refs);
case ZodFirstPartyTypeKind.ZodUnknown:
return parseUnknownDef(refs);
case ZodFirstPartyTypeKind.ZodDefault:
return parseDefaultDef(def, refs);
case ZodFirstPartyTypeKind.ZodBranded:
return parseBrandedDef(def, refs);
case ZodFirstPartyTypeKind.ZodReadonly:
return parseReadonlyDef(def, refs);
case ZodFirstPartyTypeKind.ZodCatch:
return parseCatchDef(def, refs);
case ZodFirstPartyTypeKind.ZodPipeline:
return parsePipelineDef(def, refs);
case ZodFirstPartyTypeKind.ZodFunction:
case ZodFirstPartyTypeKind.ZodVoid:
case ZodFirstPartyTypeKind.ZodSymbol:
return undefined;
default:
return ((_) => undefined)(typeName);
}
};
@@ -0,0 +1,229 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "TargetNames", {
enumerable: true,
get: function () {
return _options.TargetNames;
}
});
exports.default = getTargets;
Object.defineProperty(exports, "filterItems", {
enumerable: true,
get: function () {
return _filterItems.default;
}
});
Object.defineProperty(exports, "getInclusionReasons", {
enumerable: true,
get: function () {
return _debug.getInclusionReasons;
}
});
exports.isBrowsersQueryValid = isBrowsersQueryValid;
Object.defineProperty(exports, "isRequired", {
enumerable: true,
get: function () {
return _filterItems.isRequired;
}
});
Object.defineProperty(exports, "prettifyTargets", {
enumerable: true,
get: function () {
return _pretty.prettifyTargets;
}
});
Object.defineProperty(exports, "unreleasedLabels", {
enumerable: true,
get: function () {
return _targets.unreleasedLabels;
}
});
var _browserslist = require("browserslist");
var _helperValidatorOption = require("@babel/helper-validator-option");
var _lruCache = require("lru-cache");
var _utils = require("./utils.js");
var _targets = require("./targets.js");
var _options = require("./options.js");
var _pretty = require("./pretty.js");
var _debug = require("./debug.js");
var _filterItems = require("./filter-items.js");
const browserModulesData = require("@babel/compat-data/native-modules");
const ESM_SUPPORT = browserModulesData["es6.module"];
const v = new _helperValidatorOption.OptionValidator("@babel/helper-compilation-targets");
function validateTargetNames(targets) {
const validTargets = Object.keys(_options.TargetNames);
for (const target of Object.keys(targets)) {
if (!(target in _options.TargetNames)) {
throw new Error(v.formatMessage(`'${target}' is not a valid target
- Did you mean '${(0, _helperValidatorOption.findSuggestion)(target, validTargets)}'?`));
}
}
return targets;
}
function isBrowsersQueryValid(browsers) {
return typeof browsers === "string" || Array.isArray(browsers) && browsers.every(b => typeof b === "string");
}
function validateBrowsers(browsers) {
v.invariant(browsers === undefined || isBrowsersQueryValid(browsers), `'${String(browsers)}' is not a valid browserslist query`);
return browsers;
}
function getLowestVersions(browsers) {
return browsers.reduce((all, browser) => {
const [browserName, browserVersion] = browser.split(" ");
const target = _targets.browserNameMap[browserName];
if (!target) {
return all;
}
try {
const splitVersion = browserVersion.split("-")[0].toLowerCase();
const isSplitUnreleased = (0, _utils.isUnreleasedVersion)(splitVersion, target);
if (!all[target]) {
all[target] = isSplitUnreleased ? splitVersion : (0, _utils.semverify)(splitVersion);
return all;
}
const version = all[target];
const isUnreleased = (0, _utils.isUnreleasedVersion)(version, target);
if (isUnreleased && isSplitUnreleased) {
all[target] = (0, _utils.getLowestUnreleased)(version, splitVersion, target);
} else if (isUnreleased) {
all[target] = (0, _utils.semverify)(splitVersion);
} else if (!isUnreleased && !isSplitUnreleased) {
const parsedBrowserVersion = (0, _utils.semverify)(splitVersion);
all[target] = (0, _utils.semverMin)(version, parsedBrowserVersion);
}
} catch (_) {}
return all;
}, {});
}
function outputDecimalWarning(decimalTargets) {
if (!decimalTargets.length) {
return;
}
console.warn("Warning, the following targets are using a decimal version:\n");
decimalTargets.forEach(({
target,
value
}) => console.warn(` ${target}: ${value}`));
console.warn(`
We recommend using a string for minor/patch versions to avoid numbers like 6.10
getting parsed as 6.1, which can lead to unexpected behavior.
`);
}
function semverifyTarget(target, value) {
try {
return (0, _utils.semverify)(value);
} catch (_) {
throw new Error(v.formatMessage(`'${value}' is not a valid value for 'targets.${target}'.`));
}
}
function nodeTargetParser(value) {
const parsed = value === true || value === "current" ? process.versions.node.split("-")[0] : semverifyTarget("node", value);
return ["node", parsed];
}
function defaultTargetParser(target, value) {
const version = (0, _utils.isUnreleasedVersion)(value, target) ? value.toLowerCase() : semverifyTarget(target, value);
return [target, version];
}
function generateTargets(inputTargets) {
const input = Object.assign({}, inputTargets);
delete input.esmodules;
delete input.browsers;
return input;
}
function resolveTargets(queries, env) {
const resolved = _browserslist(queries, {
mobileToDesktop: true,
env
});
return getLowestVersions(resolved);
}
const targetsCache = new _lruCache({
max: 64
});
function resolveTargetsCached(queries, env) {
const cacheKey = typeof queries === "string" ? queries : queries.join() + env;
let cached = targetsCache.get(cacheKey);
if (!cached) {
cached = resolveTargets(queries, env);
targetsCache.set(cacheKey, cached);
}
return Object.assign({}, cached);
}
function getTargets(inputTargets = {}, options = {}) {
var _browsers, _browsers2;
let {
browsers,
esmodules
} = inputTargets;
const {
configPath = ".",
onBrowserslistConfigFound
} = options;
validateBrowsers(browsers);
const input = generateTargets(inputTargets);
let targets = validateTargetNames(input);
const shouldParseBrowsers = !!browsers;
const hasTargets = shouldParseBrowsers || Object.keys(targets).length > 0;
const shouldSearchForConfig = !options.ignoreBrowserslistConfig && !hasTargets;
if (!browsers && shouldSearchForConfig) {
browsers = process.env.BROWSERSLIST;
if (!browsers) {
const configFile = options.configFile || process.env.BROWSERSLIST_CONFIG || _browserslist.findConfigFile(configPath);
if (configFile != null) {
onBrowserslistConfigFound == null || onBrowserslistConfigFound(configFile);
browsers = _browserslist.loadConfig({
config: configFile,
env: options.browserslistEnv
});
}
}
if (browsers == null) {
browsers = [];
}
}
if (esmodules && (esmodules !== "intersect" || !((_browsers = browsers) != null && _browsers.length))) {
browsers = Object.keys(ESM_SUPPORT).map(browser => `${browser} >= ${ESM_SUPPORT[browser]}`).join(", ");
esmodules = false;
}
if ((_browsers2 = browsers) != null && _browsers2.length) {
const queryBrowsers = resolveTargetsCached(browsers, options.browserslistEnv);
if (esmodules === "intersect") {
for (const browser of Object.keys(queryBrowsers)) {
if (browser !== "deno" && browser !== "ie") {
const esmSupportVersion = ESM_SUPPORT[browser === "opera_mobile" ? "op_mob" : browser];
if (esmSupportVersion) {
const version = queryBrowsers[browser];
queryBrowsers[browser] = (0, _utils.getHighestUnreleased)(version, (0, _utils.semverify)(esmSupportVersion), browser);
} else {
delete queryBrowsers[browser];
}
} else {
delete queryBrowsers[browser];
}
}
}
targets = Object.assign(queryBrowsers, targets);
}
const result = {};
const decimalWarnings = [];
for (const target of Object.keys(targets).sort()) {
const value = targets[target];
if (typeof value === "number" && value % 1 !== 0) {
decimalWarnings.push({
target,
value
});
}
const [parsedTarget, parsedValue] = target === "node" ? nodeTargetParser(value) : defaultTargetParser(target, value);
if (parsedValue) {
result[parsedTarget] = parsedValue;
}
}
outputDecimalWarning(decimalWarnings);
return result;
}
//# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../src/dismissable-layer.tsx"],
"sourcesContent": ["'use client';\nexport {\n DismissableLayer,\n DismissableLayerBranch,\n //\n Root,\n Branch,\n} from './dismissable-layer';\nexport type { DismissableLayerProps } from './dismissable-layer';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useEscapeKeydown } from '@radix-ui/react-use-escape-keydown';\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableLayer\n * -----------------------------------------------------------------------------------------------*/\n\nconst DISMISSABLE_LAYER_NAME = 'DismissableLayer';\nconst CONTEXT_UPDATE = 'dismissableLayer.update';\nconst POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';\nconst FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';\n\nlet originalBodyPointerEvents: string;\n\nconst DismissableLayerContext = React.createContext({\n layers: new Set<DismissableLayerElement>(),\n layersWithOutsidePointerEventsDisabled: new Set<DismissableLayerElement>(),\n branches: new Set<DismissableLayerBranchElement>(),\n});\n\ntype DismissableLayerElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface DismissableLayerProps extends PrimitiveDivProps {\n /**\n * When `true`, hover/focus/click interactions will be disabled on elements outside\n * the `DismissableLayer`. Users will need to click twice on outside elements to\n * interact with them: once to close the `DismissableLayer`, and again to trigger the element.\n */\n disableOutsidePointerEvents?: boolean;\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onPointerDownOutside?: (event: PointerDownOutsideEvent) => void;\n /**\n * Event handler called when the focus moves outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onFocusOutside?: (event: FocusOutsideEvent) => void;\n /**\n * Event handler called when an interaction happens outside the `DismissableLayer`.\n * Specifically, when a `pointerdown` event happens outside or focus moves outside of it.\n * Can be prevented.\n */\n onInteractOutside?: (event: PointerDownOutsideEvent | FocusOutsideEvent) => void;\n /**\n * Handler called when the `DismissableLayer` should be dismissed\n */\n onDismiss?: () => void;\n}\n\nconst DismissableLayer = React.forwardRef<DismissableLayerElement, DismissableLayerProps>(\n (props, forwardedRef) => {\n const {\n disableOutsidePointerEvents = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props;\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState<DismissableLayerElement | null>(null);\n const ownerDocument = node?.ownerDocument ?? globalThis?.document;\n const [, force] = React.useState({});\n const composedRefs = useComposedRefs(forwardedRef, (node) => setNode(node));\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1); // prettier-ignore\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled!); // prettier-ignore\n const index = node ? layers.indexOf(node) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n\n const pointerDownOutside = usePointerDownOutside((event) => {\n const target = event.target as HTMLElement;\n const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return;\n onPointerDownOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n\n const focusOutside = useFocusOutside((event) => {\n const target = event.target as HTMLElement;\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));\n if (isFocusInBranch) return;\n onFocusOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n\n useEscapeKeydown((event) => {\n const isHighestLayer = index === Line truncated
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,uBAAqC;AACrC,6BAAuD;AACvD,gCAAgC;AAChC,oCAA+B;AAC/B,sCAAiC;AAqJ3B;AA/IN,IAAM,yBAAyB;AAC/B,IAAM,iBAAiB;AACvB,IAAM,uBAAuB;AAC7B,IAAM,gBAAgB;AAEtB,IAAI;AAEJ,IAAM,0BAAgC,oBAAc;AAAA,EAClD,QAAQ,oBAAI,IAA6B;AAAA,EACzC,wCAAwC,oBAAI,IAA6B;AAAA,EACzE,UAAU,oBAAI,IAAmC;AACnD,CAAC;AAsCD,IAAM,mBAAyB;AAAA,EAC7B,CAAC,OAAO,iBAAiB;AACvB,UAAM;AAAA,MACJ,8BAA8B;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,IAAI;AACJ,UAAM,UAAgB,iBAAW,uBAAuB;AACxD,UAAM,CAAC,MAAM,OAAO,IAAU,eAAyC,IAAI;AAC3E,UAAM,gBAAgB,MAAM,iBAAiB,YAAY;AACzD,UAAM,CAAC,EAAE,KAAK,IAAU,eAAS,CAAC,CAAC;AACnC,UAAM,mBAAe,2CAAgB,cAAc,CAACA,UAAS,QAAQA,KAAI,CAAC;AAC1E,UAAM,SAAS,MAAM,KAAK,QAAQ,MAAM;AACxC,UAAM,CAAC,4CAA4C,IAAI,CAAC,GAAG,QAAQ,sCAAsC,EAAE,MAAM,EAAE;AACnH,UAAM,oDAAoD,OAAO,QAAQ,4CAA6C;AACtH,UAAM,QAAQ,OAAO,OAAO,QAAQ,IAAI,IAAI;AAC5C,UAAM,8BAA8B,QAAQ,uCAAuC,OAAO;AAC1F,UAAM,yBAAyB,SAAS;AAExC,UAAM,qBAAqB,sBAAsB,CAAC,UAAU;AAC1D,YAAM,SAAS,MAAM;AACrB,YAAM,wBAAwB,CAAC,GAAG,QAAQ,QAAQ,EAAE,KAAK,CAAC,WAAW,OAAO,SAAS,MAAM,CAAC;AAC5F,UAAI,CAAC,0BAA0B,sBAAuB;AACtD,6BAAuB,KAAK;AAC5B,0BAAoB,KAAK;AACzB,UAAI,CAAC,MAAM,iBAAkB,aAAY;AAAA,IAC3C,GAAG,aAAa;AAEhB,UAAM,eAAe,gBAAgB,CAAC,UAAU;AAC9C,YAAM,SAAS,MAAM;AACrB,YAAM,kBAAkB,CAAC,GAAG,QAAQ,QAAQ,EAAE,KAAK,CAAC,WAAW,OAAO,SAAS,MAAM,CAAC;AACtF,UAAI,gBAAiB;AACrB,uBAAiB,KAAK;AACtB,0BAAoB,KAAK;AACzB,UAAI,CAAC,MAAM,iBAAkB,aAAY;AAAA,IAC3C,GAAG,aAAa;AAEhB,0DAAiB,CAAC,UAAU;AAC1B,YAAM,iBAAiB,UAAU,QAAQ,OAAO,OAAO;AACvD,UAAI,CAAC,eAAgB;AACrB,wBAAkB,KAAK;AACvB,UAAI,CAAC,MAAM,oBAAoB,WAAW;AACxC,cAAM,eAAe;AACrB,kBAAU;AAAA,MACZ;AAAA,IACF,GAAG,aAAa;AAEhB,IAAM,gBAAU,MAAM;AACpB,UAAI,CAAC,KAAM;AACX,UAAI,6BAA6B;AAC/B,YAAI,QAAQ,uCAAuC,SAAS,GAAG;AAC7D,sCAA4B,cAAc,KAAK,MAAM;AACrD,wBAAc,KAAK,MAAM,gBAAgB;AAAA,QAC3C;AACA,gBAAQ,uCAAuC,IAAI,IAAI;AAAA,MACzD;AACA,cAAQ,OAAO,IAAI,IAAI;AACvB,qBAAe;AACf,aAAO,MAAM;AACX,YACE,+BACA,QAAQ,uCAAuC,SAAS,GACxD;AACA,wBAAc,KAAK,MAAM,gBAAgB;AAAA,QAC3C;AAAA,MACF;AAAA,IACF,GAAG,CAAC,MAAM,eAAe,6BAA6B,OAAO,CAAC;AAQ9D,IAAM,gBAAU,MAAM;AACpB,aAAO,MAAM;AACX,YAAI,CAAC,KAAM;AACX,gBAAQ,OAAO,OAAO,IAAI;AAC1B,gBAAQ,uCAAuC,OAAO,IAAI;AAC1D,uBAAe;AAAA,MACjB;AAAA,IACF,GAAG,CAAC,MAAM,OAAO,CAAC;AAElB,IAAM,gBAAU,MAAM;AACpB,YAAM,eAAe,MAAM,MAAM,CAAC,CAAC;AACnC,eAAS,iBAAiB,gBAAgB,YAAY;AACtD,aAAO,MAAM,SAAS,oBAAoB,gBAAgB,YAAY;AAAA,IACxE,GAAG,CAAC,CAAC;AAEL,WACE;AAAA,MAAC,iCAAU;AAAA,MAAV;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,OAAO;AAAA,UACL,eAAe,8BACX,yBACE,SACA,SACF;AAAA,UACJ,GAAG,MAAM;AAAA,QACX;AAAA,QACA,oBAAgB,uCAAqB,MAAM,gBAAgB,aAAa,cAAc;AAAA,QACtF,mBAAe,uCAAqB,MAAM,eAAe,aAAa,aAAa;AAAA,QACnF,0BAAsB;AAAA,UACpB,MAAM;AAAA,UACN,mBAAmB;AAAA,QACrB;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,iBAAiB,cAAc;AAM/B,IAAM,cAAc;AAKpB,IAAM,yBAA+B,iBAGnC,CAAC,OAAO,iBAAiB;AACzB,QAAM,UAAgB,iBAAW,uBAAuB;AACxD,QAAM,MAAY,aAAsC,IAAI;AAC5D,QAAM,mBAAe,2CAAgB,cAAc,GAAG;AAEtD,EAAM,gBAAU,MAAM;AACpB,UAAM,OAAO,IAAI;AACjB,QAAI,MAAM;AACR,cAAQ,SAAS,IAAI,IAAI;AACzB,aAAO,MAAM;AACX,gBAAQ,SAAS,OAAO,IAAI;AAAA,MAC9B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,QAAQ,CAAC;AAErB,SAAO,4CAAC,iCAAU,KAAV,EAAe,GAAG,OAAO,KAAK,cAAc;AACtD,CAAC;AAED,uBAAuB,cAAc;AAYrC,SAAS,sBACP,sBACA,gBAA0B,YAAY,UACtC;AACA,QAAM,+BAA2B,8CAAe,oBAAoB;AACpE,QAAM,8BAAoC,aAAO,KAAK;AACtD,QAAM,iBAAuB,aAAO,MAAM;AAAA,EAAC,CAAC;AAE5C,EAAM,gBAAU,MAAM;AACpB,UAAM,oBAAoB,CAAC,UAAwB;AACjD,UAAI,MAAM,UAAU,CAAC,4BAA4B,SAAS;AAGxD,YAASC,4CAAT,WAAoD;AAClD;AAAA,YACE;AAAA,YACA;AAAA,YACA;AAAA,YACA,EAAE,UAAU,KAAK;AAAA,UACnB;AAAA,QACF;AAPS,uDAAAA;AAFT,cAAM,cAAc,EAAE,eAAe,MAAM;AAuB3C,YAAI,MAAM,gBAAgB,SAAS;AACjC,wBAAc,oBAAoB,SAAS,eAAe,OAAO;AACjE,yBAAe,UAAUA;AACzB,wBAAc,iBAAiB,SAAS,eAAe,SAAS,EAAE,MAAM,KAAK,CAAC;AAAA,QAChF,OAAO;AACL,UAAAA,0CAAyC;AAAA,QAC3C;AAAA,MACF,OAAO;AAGL,sBAAc,oBAAoB,SAAS,eAAe,OAAO;AAAA,MACnE;AACA,kCAA4B,UAAU;AAAA,IACxC;AAcA,UAAM,UAAU,OAAO,WAAW,MAAM;AACtC,oBAAc,iBAAiB,eAAe,iBAAiB;AAAA,IACjE,GAAG,CAAC;AACJ,WAAO,MAAM;AACX,aAAO,aAAa,OAAO;AAC3B,oBAAc,oBAAoB,eAAe,iBAAiB;AAClE,oBAAc,oBAAoB,SAAS,eAAe,OAAO;AAAA,IACnE;AAAA,EACF,GAAG,CAAC,eAAe,wBAAwB,CAAC;AAE5C,SAAO;AAAA;AAAA,IAEL,sBAAsB,MAAO,4BAA4B,UAAU;AAAA,EACrE;AACF;AAMA,SAAS,gBACP,gBACA,gBAA0B,YAAY,UACtC;AACA,QAAM,yBAAqB,8CAAe,cAAc;AACxD,QAAM,4BAAkC,aAAO,KAAK;AAEpD,EAAM,gBAAU,MAAM;AACpB,UAAM,cAAc,CAAC,UAAsB;AACzC,UAAI,MAAM,UAAU,CAAC,0BAA0B,SAAS;AACtD,cAAM,cAAc,EAAE,eAAe,MAAM;AAC3C,qCAA6B,eAAe,oBAAoB,aAAa;AAAA,UAC3E,UAAU;AAAA,QACZ,CAAC;AAAA,MACH;AAAA,IACF;AACA,kBAAc,iBAAiB,WAAW,WAAW;AACrD,WAAO,MAAM,cAAc,oBAAoB,WAAW,WAAW;AAAA,EACvE,GAAG,CAAC,eAAe,kBAAkB,CAAC;AAEtC,SAAO;AAAA,IACL,gBAAgB,MAAO,0BAA0B,UAAU;AAAA,IAC3D,eAAe,MAAO,0BAA0B,UAAU;AAAA,EAC5D;AACF;AAEA,SAAS,iBAAiB;AACxB,QAAM,QAAQ,IAAI,YAAY,cAAc;AAC5C,WAAS,cAAc,KAAK;AAC9B;AAEA,SAAS,6BACP,MACA,SACA,QACA,EAAE,SAAS,GACX;AACA,QAAM,SAAS,OAAO,cAAc;AACpC,QAAM,QAAQ,IAAI,YAAY,MAAM,EAAE,SAAS,OAAO,YAAY,MAAM,OAAO,CAAC;AAChF,MAAI,QAAS,QAAO,iBAAiB,MAAM,SAA0B,EAAE,MAAM,KAAK,CAAC;AAEnF,MAAI,UAAU;AACZ,4DAA4B,QAAQ,KAAK;AAAA,EAC3C,OAAO;AACL,WAAO,cAAc,KAAK;AAAA,EAC5B;AACF;AAEA,IAAM,OAAO;AACb,IAAM,SAAS;",
"names": ["node", "handleAndDispatchPointerDownOutsideEvent"]
}
@@ -0,0 +1,416 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZstdDecompress = exports.ZstdCompress = exports.BrotliDecompress = exports.BrotliCompress = exports.Unzip = exports.InflateRaw = exports.DeflateRaw = exports.Gunzip = exports.Gzip = exports.Inflate = exports.Deflate = exports.Zlib = exports.ZlibError = exports.constants = void 0;
const assert_1 = __importDefault(require("assert"));
const buffer_1 = require("buffer");
const minipass_1 = require("minipass");
const realZlib = __importStar(require("zlib"));
const constants_js_1 = require("./constants.js");
var constants_js_2 = require("./constants.js");
Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return constants_js_2.constants; } });
const OriginalBufferConcat = buffer_1.Buffer.concat;
const desc = Object.getOwnPropertyDescriptor(buffer_1.Buffer, 'concat');
const noop = (args) => args;
const passthroughBufferConcat = desc?.writable === true || desc?.set !== undefined
? (makeNoOp) => {
buffer_1.Buffer.concat = makeNoOp ? noop : OriginalBufferConcat;
}
: (_) => { };
const _superWrite = Symbol('_superWrite');
class ZlibError extends Error {
code;
errno;
constructor(err, origin) {
super('zlib: ' + err.message, { cause: err });
this.code = err.code;
this.errno = err.errno;
/* c8 ignore next */
if (!this.code)
this.code = 'ZLIB_ERROR';
this.message = 'zlib: ' + err.message;
Error.captureStackTrace(this, origin ?? this.constructor);
}
get name() {
return 'ZlibError';
}
}
exports.ZlibError = ZlibError;
// the Zlib class they all inherit from
// This thing manages the queue of requests, and returns
// true or false if there is anything in the queue when
// you call the .write() method.
const _flushFlag = Symbol('flushFlag');
class ZlibBase extends minipass_1.Minipass {
#sawError = false;
#ended = false;
#flushFlag;
#finishFlushFlag;
#fullFlushFlag;
#handle;
#onError;
get sawError() {
return this.#sawError;
}
get handle() {
return this.#handle;
}
/* c8 ignore start */
get flushFlag() {
return this.#flushFlag;
}
/* c8 ignore stop */
constructor(opts, mode) {
if (!opts || typeof opts !== 'object')
throw new TypeError('invalid options for ZlibBase constructor');
//@ts-ignore
super(opts);
/* c8 ignore start */
this.#flushFlag = opts.flush ?? 0;
this.#finishFlushFlag = opts.finishFlush ?? 0;
this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
/* c8 ignore stop */
//@ts-ignore
if (typeof realZlib[mode] !== 'function') {
throw new TypeError('Compression method not supported: ' + mode);
}
// this will throw if any options are invalid for the class selected
try {
// @types/node doesn't know that it exports the classes, but they're there
//@ts-ignore
this.#handle = new realZlib[mode](opts);
}
catch (er) {
// make sure that all errors get decorated properly
throw new ZlibError(er, this.constructor);
}
this.#onError = err => {
// no sense raising multiple errors, since we abort on the first one.
if (this.#sawError)
return;
this.#sawError = true;
// there is no way to cleanly recover.
// continuing only obscures problems.
this.close();
this.emit('error', err);
};
this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
this.once('end', () => this.close);
}
close() {
if (this.#handle) {
this.#handle.close();
this.#handle = undefined;
this.emit('close');
}
}
reset() {
if (!this.#sawError) {
(0, assert_1.default)(this.#handle, 'zlib binding closed');
//@ts-ignore
return this.#handle.reset?.();
}
}
flush(flushFlag) {
if (this.ended)
return;
if (typeof flushFlag !== 'number')
flushFlag = this.#fullFlushFlag;
this.write(Object.assign(buffer_1.Buffer.alloc(0), { [_flushFlag]: flushFlag }));
}
end(chunk, encoding, cb) {
/* c8 ignore start */
if (typeof chunk === 'function') {
cb = chunk;
encoding = undefined;
chunk = undefined;
}
if (typeof encoding === 'function') {
cb = encoding;
encoding = undefined;
}
/* c8 ignore stop */
if (chunk) {
if (encoding)
this.write(chunk, encoding);
else
this.write(chunk);
}
this.flush(this.#finishFlushFlag);
this.#ended = true;
return super.end(cb);
}
get ended() {
return this.#ended;
}
// overridden in the gzip classes to do portable writes
[_superWrite](data) {
return super.write(data);
}
write(chunk, encoding, cb) {
// process the chunk using the sync process
// then super.write() all the outputted chunks
if (typeof encoding === 'function')
(cb = encoding), (encoding = 'utf8');
if (typeof chunk === 'string')
chunk = buffer_1.Buffer.from(chunk, encoding);
if (this.#sawError)
return;
(0, assert_1.default)(this.#handle, 'zlib binding closed');
// _processChunk tries to .close() the native handle after it's done, so we
// intercept that by temporarily making it a no-op.
// diving into the node:zlib internals a bit here
const nativeHandle = this.#handle
._handle;
const originalNativeClose = nativeHandle.close;
nativeHandle.close = () => { };
const originalClose = this.#handle.close;
this.#handle.close = () => { };
// It also calls `Buffer.concat()` at the end, which may be convenient
// for some, but which we are not interested in as it slows us down.
passthroughBufferConcat(true);
let result = undefined;
try {
const flushFlag = typeof chunk[_flushFlag] === 'number'
? chunk[_flushFlag]
: this.#flushFlag;
result = this.#handle._processChunk(chunk, flushFlag);
// if we don't throw, reset it back how it was
passthroughBufferConcat(false);
}
catch (err) {
// or if we do, put Buffer.concat() back before we emit error
// Error events call into user code, which may call Buffer.concat()
passthroughBufferConcat(false);
this.#onError(new ZlibError(err, this.write));
}
finally {
if (this.#handle) {
// Core zlib resets `_handle` to null after attempting to close the
// native handle. Our no-op handler prevented actual closure, but we
// need to restore the `._handle` property.
;
this.#handle._handle =
nativeHandle;
nativeHandle.close = originalNativeClose;
this.#handle.close = originalClose;
// `_processChunk()` adds an 'error' listener. If we don't remove it
// after each call, these handlers start piling up.
this.#handle.removeAllListeners('error');
// make sure OUR error listener is still attached tho
}
}
if (this.#handle)
this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write)));
let writeReturn;
if (result) {
if (Array.isArray(result) && result.length > 0) {
const r = result[0];
// The first buffer is always `handle._outBuffer`, which would be
// re-used for later invocations; so, we always have to copy that one.
writeReturn = this[_superWrite](buffer_1.Buffer.from(r));
for (let i = 1; i < result.length; i++) {
writeReturn = this[_superWrite](result[i]);
}
}
else {
// either a single Buffer or an empty array
writeReturn = this[_superWrite](buffer_1.Buffer.from(result));
}
}
if (cb)
cb();
return writeReturn;
}
}
class Zlib extends ZlibBase {
#level;
#strategy;
constructor(opts, mode) {
opts = opts || {};
opts.flush = opts.flush || constants_js_1.constants.Z_NO_FLUSH;
opts.finishFlush = opts.finishFlush || constants_js_1.constants.Z_FINISH;
opts.fullFlushFlag = constants_js_1.constants.Z_FULL_FLUSH;
super(opts, mode);
this.#level = opts.level;
this.#strategy = opts.strategy;
}
params(level, strategy) {
if (this.sawError)
return;
if (!this.handle)
throw new Error('cannot switch params when binding is closed');
// no way to test this without also not supporting params at all
/* c8 ignore start */
if (!this.handle.params)
throw new Error('not supported in this implementation');
/* c8 ignore stop */
if (this.#level !== level || this.#strategy !== strategy) {
this.flush(constants_js_1.constants.Z_SYNC_FLUSH);
(0, assert_1.default)(this.handle, 'zlib binding closed');
// .params() calls .flush(), but the latter is always async in the
// core zlib. We override .flush() temporarily to intercept that and
// flush synchronously.
const origFlush = this.handle.flush;
this.handle.flush = (flushFlag, cb) => {
/* c8 ignore start */
if (typeof flushFlag === 'function') {
cb = flushFlag;
flushFlag = this.flushFlag;
}
/* c8 ignore stop */
this.flush(flushFlag);
cb?.();
};
try {
;
this.handle.params(level, strategy);
}
finally {
this.handle.flush = origFlush;
}
/* c8 ignore start */
if (this.handle) {
this.#level = level;
this.#strategy = strategy;
}
/* c8 ignore stop */
}
}
}
exports.Zlib = Zlib;
// minimal 2-byte header
class Deflate extends Zlib {
constructor(opts) {
super(opts, 'Deflate');
}
}
exports.Deflate = Deflate;
class Inflate extends Zlib {
constructor(opts) {
super(opts, 'Inflate');
}
}
exports.Inflate = Inflate;
class Gzip extends Zlib {
#portable;
constructor(opts) {
super(opts, 'Gzip');
this.#portable = opts && !!opts.portable;
}
[_superWrite](data) {
if (!this.#portable)
return super[_superWrite](data);
// we'll always get the header emitted in one first chunk
// overwrite the OS indicator byte with 0xFF
this.#portable = false;
data[9] = 255;
return super[_superWrite](data);
}
}
exports.Gzip = Gzip;
class Gunzip extends Zlib {
constructor(opts) {
super(opts, 'Gunzip');
}
}
exports.Gunzip = Gunzip;
// raw - no header
class DeflateRaw extends Zlib {
constructor(opts) {
super(opts, 'DeflateRaw');
}
}
exports.DeflateRaw = DeflateRaw;
class InflateRaw extends Zlib {
constructor(opts) {
super(opts, 'InflateRaw');
}
}
exports.InflateRaw = InflateRaw;
// auto-detect header.
class Unzip extends Zlib {
constructor(opts) {
super(opts, 'Unzip');
}
}
exports.Unzip = Unzip;
class Brotli extends ZlibBase {
constructor(opts, mode) {
opts = opts || {};
opts.flush = opts.flush || constants_js_1.constants.BROTLI_OPERATION_PROCESS;
opts.finishFlush =
opts.finishFlush || constants_js_1.constants.BROTLI_OPERATION_FINISH;
opts.fullFlushFlag = constants_js_1.constants.BROTLI_OPERATION_FLUSH;
super(opts, mode);
}
}
class BrotliCompress extends Brotli {
constructor(opts) {
super(opts, 'BrotliCompress');
}
}
exports.BrotliCompress = BrotliCompress;
class BrotliDecompress extends Brotli {
constructor(opts) {
super(opts, 'BrotliDecompress');
}
}
exports.BrotliDecompress = BrotliDecompress;
class Zstd extends ZlibBase {
constructor(opts, mode) {
opts = opts || {};
opts.flush = opts.flush || constants_js_1.constants.ZSTD_e_continue;
opts.finishFlush = opts.finishFlush || constants_js_1.constants.ZSTD_e_end;
opts.fullFlushFlag = constants_js_1.constants.ZSTD_e_flush;
super(opts, mode);
}
}
class ZstdCompress extends Zstd {
constructor(opts) {
super(opts, 'ZstdCompress');
}
}
exports.ZstdCompress = ZstdCompress;
class ZstdDecompress extends Zstd {
constructor(opts) {
super(opts, 'ZstdDecompress');
}
}
exports.ZstdDecompress = ZstdDecompress;
//# sourceMappingURL=index.js.map
@@ -0,0 +1,327 @@
/* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
*/
/**
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
*/
/* eslint-enable jsdoc/valid-types -- doesn't allow `readonly string[]`. TODO: check why */
/**
* @type {VisitorKeys}
*/
const KEYS = {
ArrayExpression: [
"elements"
],
ArrayPattern: [
"elements"
],
ArrowFunctionExpression: [
"params",
"body"
],
AssignmentExpression: [
"left",
"right"
],
AssignmentPattern: [
"left",
"right"
],
AwaitExpression: [
"argument"
],
BinaryExpression: [
"left",
"right"
],
BlockStatement: [
"body"
],
BreakStatement: [
"label"
],
CallExpression: [
"callee",
"arguments"
],
CatchClause: [
"param",
"body"
],
ChainExpression: [
"expression"
],
ClassBody: [
"body"
],
ClassDeclaration: [
"id",
"superClass",
"body"
],
ClassExpression: [
"id",
"superClass",
"body"
],
ConditionalExpression: [
"test",
"consequent",
"alternate"
],
ContinueStatement: [
"label"
],
DebuggerStatement: [],
DoWhileStatement: [
"body",
"test"
],
EmptyStatement: [],
ExperimentalRestProperty: [
"argument"
],
ExperimentalSpreadProperty: [
"argument"
],
ExportAllDeclaration: [
"exported",
"source",
"attributes"
],
ExportDefaultDeclaration: [
"declaration"
],
ExportNamedDeclaration: [
"declaration",
"specifiers",
"source",
"attributes"
],
ExportSpecifier: [
"local",
"exported"
],
ExpressionStatement: [
"expression"
],
ForInStatement: [
"left",
"right",
"body"
],
ForOfStatement: [
"left",
"right",
"body"
],
ForStatement: [
"init",
"test",
"update",
"body"
],
FunctionDeclaration: [
"id",
"params",
"body"
],
FunctionExpression: [
"id",
"params",
"body"
],
Identifier: [],
IfStatement: [
"test",
"consequent",
"alternate"
],
ImportAttribute: [
"key",
"value"
],
ImportDeclaration: [
"specifiers",
"source",
"attributes"
],
ImportDefaultSpecifier: [
"local"
],
ImportExpression: [
"source",
"options"
],
ImportNamespaceSpecifier: [
"local"
],
ImportSpecifier: [
"imported",
"local"
],
JSXAttribute: [
"name",
"value"
],
JSXClosingElement: [
"name"
],
JSXClosingFragment: [],
JSXElement: [
"openingElement",
"children",
"closingElement"
],
JSXEmptyExpression: [],
JSXExpressionContainer: [
"expression"
],
JSXFragment: [
"openingFragment",
"children",
"closingFragment"
],
JSXIdentifier: [],
JSXMemberExpression: [
"object",
"property"
],
JSXNamespacedName: [
"namespace",
"name"
],
JSXOpeningElement: [
"name",
"attributes"
],
JSXOpeningFragment: [],
JSXSpreadAttribute: [
"argument"
],
JSXSpreadChild: [
"expression"
],
JSXText: [],
LabeledStatement: [
"label",
"body"
],
Literal: [],
LogicalExpression: [
"left",
"right"
],
MemberExpression: [
"object",
"property"
],
MetaProperty: [
"meta",
"property"
],
MethodDefinition: [
"key",
"value"
],
NewExpression: [
"callee",
"arguments"
],
ObjectExpression: [
"properties"
],
ObjectPattern: [
"properties"
],
PrivateIdentifier: [],
Program: [
"body"
],
Property: [
"key",
"value"
],
PropertyDefinition: [
"key",
"value"
],
RestElement: [
"argument"
],
ReturnStatement: [
"argument"
],
SequenceExpression: [
"expressions"
],
SpreadElement: [
"argument"
],
StaticBlock: [
"body"
],
Super: [],
SwitchCase: [
"test",
"consequent"
],
SwitchStatement: [
"discriminant",
"cases"
],
TaggedTemplateExpression: [
"tag",
"quasi"
],
TemplateElement: [],
TemplateLiteral: [
"quasis",
"expressions"
],
ThisExpression: [],
ThrowStatement: [
"argument"
],
TryStatement: [
"block",
"handler",
"finalizer"
],
UnaryExpression: [
"argument"
],
UpdateExpression: [
"argument"
],
VariableDeclaration: [
"declarations"
],
VariableDeclarator: [
"id",
"init"
],
WhileStatement: [
"test",
"body"
],
WithStatement: [
"object",
"body"
],
YieldExpression: [
"argument"
]
};
// Types.
const NODE_TYPES = Object.keys(KEYS);
// Freeze the keys.
for (const type of NODE_TYPES) {
Object.freeze(KEYS[type]);
}
Object.freeze(KEYS);
export default KEYS;
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkNullableObject = exports.checkNullable = void 0;
const codegen_1 = require("../../compile/codegen");
function checkNullable({ gen, data, parentSchema }, cond = codegen_1.nil) {
const valid = gen.name("valid");
if (parentSchema.nullable) {
gen.let(valid, (0, codegen_1._) `${data} === null`);
cond = (0, codegen_1.not)(valid);
}
else {
gen.let(valid, false);
}
return [valid, cond];
}
exports.checkNullable = checkNullable;
function checkNullableObject(cxt, cond) {
const [valid, cond_] = checkNullable(cxt, cond);
return [valid, (0, codegen_1._) `${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`];
}
exports.checkNullableObject = checkNullableObject;
//# sourceMappingURL=nullable.js.map
@@ -0,0 +1,133 @@
'use strict'
let pico = require('picocolors')
let terminalHighlight = require('./terminal-highlight')
class CssSyntaxError extends Error {
constructor(message, line, column, source, file, plugin) {
super(message)
this.name = 'CssSyntaxError'
this.reason = message
if (file) {
this.file = file
}
if (source) {
this.source = source
}
if (plugin) {
this.plugin = plugin
}
if (typeof line !== 'undefined' && typeof column !== 'undefined') {
if (typeof line === 'number') {
this.line = line
this.column = column
} else {
this.line = line.line
this.column = line.column
this.endLine = column.line
this.endColumn = column.column
}
}
this.setMessage()
if (Error.captureStackTrace) {
Error.captureStackTrace(this, CssSyntaxError)
}
}
setMessage() {
this.message = this.plugin ? this.plugin + ': ' : ''
this.message += this.file ? this.file : '<css input>'
if (typeof this.line !== 'undefined') {
this.message += ':' + this.line + ':' + this.column
}
this.message += ': ' + this.reason
}
showSourceCode(color) {
if (!this.source) return ''
let css = this.source
if (color == null) color = pico.isColorSupported
let aside = text => text
let mark = text => text
let highlight = text => text
if (color) {
let { bold, gray, red } = pico.createColors(true)
mark = text => bold(red(text))
aside = text => gray(text)
if (terminalHighlight) {
highlight = text => terminalHighlight(text)
}
}
let lines = css.split(/\r?\n/)
let start = Math.max(this.line - 3, 0)
let end = Math.min(this.line + 2, lines.length)
let maxWidth = String(end).length
return lines
.slice(start, end)
.map((line, index) => {
let number = start + 1 + index
let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | '
if (number === this.line) {
if (line.length > 160) {
let padding = 20
let subLineStart = Math.max(0, this.column - padding)
let subLineEnd = Math.max(
this.column + padding,
this.endColumn + padding
)
let subLine = line.slice(subLineStart, subLineEnd)
let spacing =
aside(gutter.replace(/\d/g, ' ')) +
line
.slice(0, Math.min(this.column - 1, padding - 1))
.replace(/[^\t]/g, ' ')
return (
mark('>') +
aside(gutter) +
highlight(subLine) +
'\n ' +
spacing +
mark('^')
)
}
let spacing =
aside(gutter.replace(/\d/g, ' ')) +
line.slice(0, this.column - 1).replace(/[^\t]/g, ' ')
return (
mark('>') +
aside(gutter) +
highlight(line) +
'\n ' +
spacing +
mark('^')
)
}
return ' ' + aside(gutter) + highlight(line)
})
.join('\n')
}
toString() {
let code = this.showSourceCode()
if (code) {
code = '\n\n' + code + '\n'
}
return this.name + ': ' + this.message + code
}
}
module.exports = CssSyntaxError
CssSyntaxError.default = CssSyntaxError
@@ -0,0 +1,29 @@
import { SSGPlugin } from "./ssg.js";
//#region src/helper/ssg/plugins.d.ts
/**
* The default plugin that defines the recommended behavior.
*
* @experimental
* `defaultPlugin` is an experimental feature.
* The API might be changed.
*/
export declare const defaultPlugin: () => SSGPlugin;
/**
* The redirect plugin that generates HTML redirect pages for HTTP redirect responses for status codes 301, 302, 303, 307 and 308.
*
* When used with `defaultPlugin`, place `redirectPlugin` before it, because `defaultPlugin` skips non-200 responses.
*
* ```ts
* // ✅ Will work as expected
* toSSG(app, fs, { plugins: [redirectPlugin(), defaultPlugin()] })
*
* // ❌ Will not work as expected
* toSSG(app, fs, { plugins: [defaultPlugin(), redirectPlugin()] })
* ```
*
* @experimental
* `redirectPlugin` is an experimental feature.
* The API might be changed.
*/
export declare const redirectPlugin: () => SSGPlugin;
//#endregion
@@ -0,0 +1,155 @@
'use strict';
/* (c) 2015 Ari Porad (@ariporad) <http://ariporad.com>. License: ariporad.mit-license.org */
const BuiltinModule = require('module');
const path = require('path');
const nodeModulesRegex = /^(?:.*[\\/])?node_modules(?:[\\/].*)?$/;
// Guard against poorly-mocked module constructors.
const Module =
module.constructor.length > 1 ? module.constructor : BuiltinModule;
const HOOK_RETURNED_NOTHING_ERROR_MESSAGE =
'[Pirates] A hook returned a non-string, or nothing at all! This is a' +
' violation of intergalactic law!\n' +
'--------------------\n' +
'If you have no idea what this means or what Pirates is, let me explain: ' +
'Pirates is a module that makes it easy to implement require hooks. One of' +
" the require hooks you're using uses it. One of these require hooks" +
" didn't return anything from it's handler, so we don't know what to" +
' do. You might want to debug this.';
/**
* @param {string} filename The filename to check.
* @param {string[]} exts The extensions to hook. Should start with '.' (ex. ['.js']).
* @param {Matcher|null} matcher A matcher function, will be called with path to a file. Should return truthy if the file should be hooked, falsy otherwise.
* @param {boolean} ignoreNodeModules Auto-ignore node_modules. Independent of any matcher.
*/
function shouldCompile(filename, exts, matcher, ignoreNodeModules) {
if (typeof filename !== 'string') {
return false;
}
if (exts.indexOf(path.extname(filename)) === -1) {
return false;
}
const resolvedFilename = path.resolve(filename);
if (ignoreNodeModules && nodeModulesRegex.test(resolvedFilename)) {
return false;
}
if (matcher && typeof matcher === 'function') {
return !!matcher(resolvedFilename);
}
return true;
}
/**
* @callback Hook The hook. Accepts the code of the module and the filename.
* @param {string} code
* @param {string} filename
* @returns {string}
*/
/**
* @callback Matcher A matcher function, will be called with path to a file.
*
* Should return truthy if the file should be hooked, falsy otherwise.
* @param {string} path
* @returns {boolean}
*/
/**
* @callback RevertFunction Reverts the hook when called.
* @returns {void}
*/
/**
* @typedef {object} Options
* @property {Matcher|null} [matcher=null] A matcher function, will be called with path to a file.
*
* Should return truthy if the file should be hooked, falsy otherwise.
*
* @property {string[]} [extensions=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']).
* @property {string[]} [exts=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']).
*
* @property {string[]} [extension=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']).
* @property {string[]} [ext=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']).
*
* @property {boolean} [ignoreNodeModules=true] Auto-ignore node_modules. Independent of any matcher.
*/
/**
* Add a require hook.
*
* @param {Hook} hook The hook. Accepts the code of the module and the filename. Required.
* @param {Options} [opts] Options
* @returns {RevertFunction} The `revert` function. Reverts the hook when called.
*/
function addHook(hook, opts = {}) {
let reverted = false;
const loaders = [];
const oldLoaders = [];
let exts;
// We need to do this to fix #15. Basically, if you use a non-standard extension (ie. .jsx), then
// We modify the .js loader, then use the modified .js loader for as the base for .jsx.
// This prevents that.
const originalJSLoader = Module._extensions['.js'];
const matcher = opts.matcher || null;
const ignoreNodeModules = opts.ignoreNodeModules !== false;
exts = opts.extensions || opts.exts || opts.extension || opts.ext || ['.js'];
if (!Array.isArray(exts)) {
exts = [exts];
}
exts.forEach((ext) => {
if (typeof ext !== 'string') {
throw new TypeError(`Invalid Extension: ${ext}`);
}
const oldLoader = Module._extensions[ext] || originalJSLoader;
oldLoaders[ext] = Module._extensions[ext];
loaders[ext] = Module._extensions[ext] = function newLoader(mod, filename) {
let compile;
if (!reverted) {
if (shouldCompile(filename, exts, matcher, ignoreNodeModules)) {
compile = mod._compile;
mod._compile = function _compile(code) {
// reset the compile immediately as otherwise we end up having the
// compile function being changed even though this loader might be reverted
// Not reverting it here leads to long useless compile chains when doing
// addHook -> revert -> addHook -> revert -> ...
// The compile function is also anyway created new when the loader is called a second time.
mod._compile = compile;
const newCode = hook(code, filename);
if (typeof newCode !== 'string') {
throw new Error(HOOK_RETURNED_NOTHING_ERROR_MESSAGE);
}
return mod._compile(newCode, filename);
};
}
}
oldLoader(mod, filename);
};
});
return function revert() {
if (reverted) return;
reverted = true;
exts.forEach((ext) => {
// if the current loader for the extension is our loader then unregister it and set the oldLoader again
// if not we cannot do anything as we cannot remove a loader from within the loader-chain
if (Module._extensions[ext] === loaders[ext]) {
if (!oldLoaders[ext]) {
delete Module._extensions[ext];
} else {
Module._extensions[ext] = oldLoaders[ext];
}
}
});
};
}
exports.addHook = addHook;
@@ -0,0 +1,62 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
function createEventOptions(current: Event): EventInit {
return {
bubbles: current.bubbles,
cancelable: current.cancelable,
composed: current.composed,
};
}
type EventNode = {
type: SerovalNode;
options: SerovalNode;
};
const EventPlugin = /* @__PURE__ */ createPlugin<Event, EventNode>({
tag: 'seroval-plugins/web/Event',
test(value) {
if (typeof Event === 'undefined') {
return false;
}
return value instanceof Event;
},
parse: {
sync(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createEventOptions(value)),
};
},
async async(value, ctx) {
return {
type: await ctx.parse(value.type),
options: await ctx.parse(createEventOptions(value)),
};
},
stream(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createEventOptions(value)),
};
},
},
serialize(node, ctx) {
return (
'new Event(' +
ctx.serialize(node.type) +
',' +
ctx.serialize(node.options) +
')'
);
},
deserialize(node, ctx) {
return new Event(
ctx.deserialize(node.type) as string,
ctx.deserialize(node.options) as EventInit,
);
},
});
export default EventPlugin;
@@ -0,0 +1 @@
{"version":3,"names":["_identity","x"],"sources":["../../src/helpers/identity.ts"],"sourcesContent":["/* @minVersion 7.17.0 */\n\nexport default function _identity<T>(x: T) {\n return x;\n}\n"],"mappings":";;;;;;AAEe,SAASA,SAASA,CAAIC,CAAI,EAAE;EACzC,OAAOA,CAAC;AACV","ignoreList":[]}
@@ -0,0 +1,115 @@
import { c as McpServerFactory, pt as Transport, yr as JSONRPCMessage } from "./createMcpHandler-DZmmlN8e.cjs";
import { Readable, Writable } from "node:stream";
//#region src/server/serveStdio.d.ts
/** Options for {@linkcode serveStdio}. */
interface ServeStdioOptions {
/**
* How a 2025-era opening (an `initialize` request, or any claim-less
* message) is handled:
*
* - `'serve'` (default) — the connection is pinned to a 2025-era instance
* from the same factory and served exactly as a hand-wired stdio server
* serves it today.
* - `'reject'` — the opening request is answered with the
* unsupported-protocol-version error naming the supported modern
* revisions (claim-less notifications are dropped); the connection
* stays open for a modern opening.
*/
legacy?: 'serve' | 'reject';
/**
* Bring your own transport (for example a `StdioServerTransport`
* constructed over a Unix domain socket or TCP stream, per the stdio
* binding's custom-transport guidance). Defaults to a
* {@linkcode StdioServerTransport} over the current process's stdio. The
* entry owns the transport: it starts it, receives every inbound message,
* and closes it when the connection ends.
*/
transport?: Transport;
/** Callback for out-of-band errors (reporting only; it never alters what is written to the wire). */
onerror?: (error: Error) => void;
/**
* Reject a new `subscriptions/listen` with `-32603` 'Subscription limit
* reached' (in-band, before the ack) when this many subscriptions are
* already open on this connection.
* @default 1024
*/
maxSubscriptions?: number;
}
/** The handle returned by {@linkcode serveStdio}. */
interface StdioServerHandle {
/** Tears the connection down: closes the pinned instance (if any) and the underlying transport. */
close(): Promise<void>;
}
/**
* Serves MCP over stdio from a server factory, owning the era decision for
* the connection: the opening exchange selects the era, ONE instance from the
* factory is pinned for the connection lifetime, and everything after passes
* straight through to it. See the module documentation for the opening rules.
*
* ```ts
* import { serveStdio } from '@modelcontextprotocol/server/stdio';
*
* serveStdio(() => {
* const server = new McpServer({ name: 'my-server', version: '1.0.0' }, { capabilities: { tools: {} } });
* // register tools/resources/prompts once — the same factory serves both eras
* return server;
* });
* ```
*/
declare function serveStdio(factory: McpServerFactory, options?: ServeStdioOptions): StdioServerHandle;
//#endregion
//#region src/server/stdio.d.ts
/**
* Server transport for stdio: this communicates with an MCP client by reading from the current process' `stdin` and writing to `stdout`.
*
* This transport is only available in Node.js environments.
*
* When the client closes its end of the pipe (stdin reaches end-of-file), the transport
* closes itself and fires `onclose`, per the MCP stdio binding's guidance that servers
* should exit promptly when their standard input is closed. A server that holds no other
* keep-alive handles will then exit naturally. Requests still in flight when stdin ends are
* aborted and not answered; a client that expects responses keeps stdin open until it has
* read them.
*
* @example
* ```ts source="./stdio.examples.ts#StdioServerTransport_basicUsage"
* const server = new McpServer({ name: 'my-server', version: '1.0.0' });
* const transport = new StdioServerTransport();
* await server.connect(transport);
* ```
*/
declare class StdioServerTransport implements Transport {
private _stdin;
private _stdout;
private _readBuffer;
private _started;
private _closed;
constructor(_stdin?: Readable, _stdout?: Writable, options?: {
/**
* Maximum size of the read buffer in bytes. If a single message exceeds
* this size the transport will emit an error and close.
*
* Defaults to 10 MB.
*/
maxBufferSize?: number;
});
onclose?: () => void;
onerror?: (error: Error) => void;
onmessage?: (message: JSONRPCMessage) => void;
_ondata: (chunk: Buffer) => void;
_onerror: (error: Error) => void;
_onstdouterror: (error: Error) => void;
_onstdinclose: () => void;
/**
* Starts listening for messages on `stdin`.
*/
start(): Promise<void>;
private processReadBuffer;
close(): Promise<void>;
send(message: JSONRPCMessage): Promise<void>;
}
//#endregion
export { type ServeStdioOptions, type StdioServerHandle, StdioServerTransport, serveStdio };
//# sourceMappingURL=stdio.d.cts.map
@@ -0,0 +1,934 @@
export default `# Overview
**TanStack Router is a router for building React and Solid applications**. Some of its features include:
- 100% inferred TypeScript support
- Typesafe navigation
- Nested Routing and layout routes (with pathless layouts)
- Built-in Route Loaders w/ SWR Caching
- Designed for client-side data caches (TanStack Query, SWR, etc.)
- Automatic route prefetching
- Asynchronous route elements and error boundaries
- File-based Route Generation
- Typesafe JSON-first Search Params state management APIs
- Path and Search Parameter Schema Validation
- Search Param Navigation APIs
- Custom Search Param parser/serializer support
- Search param middleware
- Route matching/loading middleware
To get started quickly, head to the next page. For a more lengthy explanation, buckle up while I bring you up to speed!
## "A Fork in the Route"
Using a router to build applications is widely regarded as a must-have and is usually one of the first choices you’ll make in your tech stack.
## Why TanStack Router?
TanStack Router delivers on the same fundamental expectations as other routers that you’ve come to expect:
- Nested routes, layout routes, grouped routes
- File-based Routing
- Parallel data loading
- Prefetching
- URL Path Params
- Error Boundaries and Handling
- SSR
- Route Masking
And it also delivers some new features that raise the bar:
- 100% inferred TypeScript support
- Typesafe navigation
- Built-in SWR Caching for loaders
- Designed for client-side data caches (TanStack Query, SWR, etc.)
- Typesafe JSON-first Search Params state management APIs
- Path and Search Parameter Schema Validation
- Search Parameter Navigation APIs
- Custom Search Param parser/serializer support
- Search param middleware
- Inherited Route Context
- Mixed file-based and code-based routing
Let’s dive into some of the more important ones in more detail!
## 100% Inferred TypeScript Support
Everything these days is written “in Typescript” or at the very least offers type definitions that are veneered over runtime functionality, but too few packages in the ecosystem actually design their APIs with TypeScript in mind. So while I’m pleased that your router is auto-completing your option fields and catching a few property/method typos here and there, there is much more to be had.
- TanStack Router is fully aware of all of your routes and their configuration at any given point in your code. This includes the path, path params, search params, context, and any other configuration you’ve provided. Ultimately this means that you can navigate to any route in your app with 100% type safety and confidence that your link or navigate call will succeed.
- TanStack Router provides lossless type-inference. It uses countless generic type parameters to enforce and propagate any type information you give it throughout the rest of its API and ultimately your app. No other router offers this level of type safety and developer confidence.
What does all of that mean for you?
- Faster feature development with auto-completion and type hints
- Safer and faster refactors
- Confidence that your code will work as expected
## 1st Class Search Parameters
Search parameters are often an afterthought, treated like a black box of strings (or string) that you can parse and update, but not much else. Existing solutions are **not** type-safe either, adding to the caution that is required to deal with them. Even the most "modern" frameworks and routers leave it up to you to figure out how to manage this state. Sometimes they'll parse the search string into an object for you, or sometimes you're left to do it yourself with \`URLSearchParams\`.
Let's step back and remember that **search params are the most powerful state manager in your entire application.** They are global, serializable, bookmarkable, and shareable making them the perfect place to store any kind of state that needs to survive a page refresh or a social share.
To live up to that responsibility, search parameters are a first-class citizen in TanStack Router. While still based on standard URLSearchParams, TanStack Router uses a powerful parser/serializer to manage deeper and more complex data structures in your search params, all while keeping them type-safe and easy to work with.
**It's like having \`useState\` right in the URL!**
Search parameters are:
- Automatically parsed and serialized as JSON
- Validated and typed
- Inherited from parent routes
- Accessible in loaders, components, and hooks
- Easily modified with the useSearch hook, Link, navigate, and router.navigate APIs
- Customizable with a custom search filters and middleware
- Subscribed via fine-grained search param selectors for efficient re-renders
Once you start using TanStack Router's search parameters, you'll wonder how you ever lived without them.
## Built-In Caching and Friendly Data Loading
Data loading is a critical part of any application and while most existing routers offer some form of critical data loading APIs, they often fall short when it comes to caching and data lifecycle management. Existing solutions suffer from a few common problems:
- No caching at all. Data is always fresh, but your users are left waiting for frequently accessed data to load over and over again.
- Overly-aggressive caching. Data is cached for too long, leading to stale data and a poor user experience.
- Blunt invalidation strategies and APIs. Data may be invalidated too often, leading to unnecessary network requests and wasted resources, or you may not have any fine-grained control over when data is invalidated at all.
TanStack Router solves these problems with a two-prong approach to caching and data loading:
### Built-in Cache
TanStack Router provides a light-weight built-in caching layer that works seamlessly with the Router. This caching layer is loosely based on TanStack Query, but with fewer features and a much smaller API surface area. Like TanStack Query, sane but powerful defaults guarantee that your data is cached for reuse, invalidated when necessary, and garbage collected when not in use. It also provides a simple API for invalidating the cache manually when needed.
### Flexible & Powerful Data Lifecycle APIs
TanStack Router is designed with a flexible and powerful data loading API that more easily integrates with existing data fetching libraries like TanStack Query, SWR, Apollo, Relay, or even your own custom data fetching solution. Configurable APIs like \`context\`, \`beforeLoad\`, \`loaderDeps\` and \`loader\` work in unison to make it easy to define declarative data dependencies, prefetch data, and manage the lifecycle of an external data source with ease.
## Inherited Route Context
TanStack Router's router and route context is a powerful feature that allows you to define context that is specific to a route which is then inherited by all child routes. Even the router and root routes themselves can provide context. Context can be built up both synchronously and asynchronously, and can be used to share data, configuration, or even functions between routes and route configurations. This is especially useful for scenarios like:
- Authentication and Authorization
- Hybrid SSR/CSR data fetching and preloading
- Theming
- Singletons and global utilities
- Curried or partial application across preloading, loading, and rendering stages
Also, what would route context be if it weren't type-safe? TanStack Router's route context is fully type-safe and inferred at zero cost to you.
## File-based and/or Code-Based Routing
TanStack Router supports both file-based and code-based routing at the same time. This flexibility allows you to choose the approach that best fits your project's needs.
TanStack Router's file-based routing approach is uniquely user-facing. Route configuration is generated for you either by the Vite plugin or TanStack Router CLI, leaving the usage of said generated code up to you! This means that you're always in total control of your routes and router, even if you use file-based routing.
## Acknowledgements
TanStack Router builds on concepts and patterns popularized by many other OSS projects, including:
- [TRPC](https://trpc.io/)
- [Remix](https://remix.run)
- [Chicane](https://swan-io.github.io/chicane/)
- [Next.js](https://nextjs.org)
We acknowledge the investment, risk and research that went into their development, but are excited to push the bar they have set even higher.
## Let's go!
Enough overview, there's so much more to do with TanStack Router. Hit that next button and let's get started!
# Quick Start
## Impatient?
The fastest way to get started with TanStack Router is to scaffold a new project. Just run:
<!-- ::start:tabs variant="package-managers" mode="local-install" -->
react: @tanstack/cli create --router-only
solid: @tanstack/cli create --router-only --framework solid
<!-- ::end:tabs -->
The CLI will guide you through a short series of prompts to customize your setup, including options for:
- File-based or code-based route configuration
- TypeScript support
- Tailwind CSS integration
- Toolchain setup
- Git initialization
Once complete, a new project will be generated with TanStack Router installed and ready to use.
> [!TIP]
> For full details on available options and templates, visit the [\`@tanstack/cli\` documentation](https://github.com/TanStack/cli).
## Routing Options
TanStack Router supports both file-based and code-based route configurations. You can specify your preference during the CLI setup, or use these commands directly:
### File-Based Route Generation
The file-based approach is the recommended option for most projects. It automatically creates routes based on your file structure, giving you the best mix of performance, simplicity, and developer experience.
For more details, see the [file-based routing documentation](./routing/file-based-routing.md) or
<!-- ::start:framework -->
# React
[explore the live example](https://tanstack.com/router/latest/docs/framework/react/examples/basic-file-based)
# Solid
[explore the live example](https://tanstack.com/router/latest/docs/framework/solid/examples/basic-file-based)
<!-- ::end:framework -->
### Code-Based Route Configuration
If you prefer to define routes programmatically, you can use the code-based route configuration. This approach gives you full control over routing logic.
For more details, see the [code-based routing documentation](./routing/code-based-routing.md) or
<!-- ::start:framework -->
# React
[explore the live example](https://tanstack.com/router/latest/docs/framework/react/examples/basic)
# Solid
[explore the live example](https://tanstack.com/router/latest/docs/framework/solid/examples/basic)
<!-- ::end:framework -->
With either approach, navigate to your project directory and start the development server.
## Existing Project
If you have an existing React project and want to add TanStack Router to it, you can install it manually.
### Requirements
Before installing TanStack Router, please ensure your project meets the following requirements:
<!-- ::start:framework -->
# React
- \`react\` v18 or later with \`createRoot\` support.
- \`react-dom\` v18 or later.
# Solid
- \`solid-js\` v1.x.x
<!-- ::end:framework -->
> [!NOTE]
> Using TypeScript (\`v5.3.x or higher\`) is recommended for the best development experience, though not strictly required. We aim to support the last 5 minor versions of TypeScript, but using the latest version will help avoid potential issues.
TanStack Router is currently only compatible with React (with ReactDOM) and Solid. If you're interested in contributing to support other frameworks, such as React Native, Angular, or Vue, please reach out to us on [Discord](https://tlinz.com/discord).
### Installation
To install TanStack Router in your project, run the following command using your preferred package manager:
<!-- ::start:tabs variant="package-managers" -->
react: @tanstack/react-router
solid: @tanstack/solid-router
<!-- ::end:tabs -->
Once installed, you can verify the installation by checking your \`package.json\` file for the dependency.
<!-- ::start:framework -->
# React
\`\`\`json
{
"dependencies": {
"@tanstack/react-router": "^x.x.x"
}
}
\`\`\`
# Solid
\`\`\`json
{
"dependencies": {
"@tanstack/solid-router": "^x.x.x"
}
}
\`\`\`
<!-- ::end:framework -->
# Decisions on Developer Experience
When people first start using TanStack Router, they often have a lot of questions that revolve around the following themes:
> Why do I have to do things this way?
> Why is it done this way? and not that way?
> I'm used to doing it this way, why should I change?
And they are all valid questions. For the most part, people are used to using routing libraries that are very similar to each other. They all have a similar API, similar concepts, and similar ways of doing things.
But TanStack Router is different. It's not your average routing library. It's not your average state management library. It's not your average anything.
> [!TIP]
> The examples in this guide use React for components and code snippets, but the same principles apply to Solid. The only difference is in the syntax and API of the framework, but the underlying concepts and design decisions are the same.
## TanStack Router's origin story
It's important to remember that TanStack Router's origins stem from [Nozzle.io](https://nozzle.io?utm_source=tanstack)'s need for a client-side routing solution that offered a first-in-class _URL Search Parameters_ experience without compromising on the **_type-safety_** that was required to power its complex dashboards.
And so, from TanStack Router's very inception, every facet of its design was meticulously thought out to ensure that its type-safety and developer experience were second to none.
## How does TanStack Router achieve this?
> TypeScript! TypeScript! TypeScript!
Every aspect of TanStack Router is designed to be as type-safe as possible, and this is achieved by leveraging TypeScript's type system to its fullest extent. This involves using some very advanced and complex types, type inference, and other features to ensure that the developer experience is as smooth as possible.
But to achieve this, we had to make some decisions that deviate from the norms in the routing world.
1. [**Route configuration boilerplate?**](#why-is-the-routers-configuration-done-this-way): You have to define your routes in a way that allows TypeScript to infer the types of your routes as much as possible.
2. [**TypeScript module declaration for the router?**](#declaring-the-router-instance-for-type-inference): You have to pass the \`Router\` instance to the rest of your application using TypeScript's module declaration.
3. [**Why push for file-based routing over code-based?**](#why-is-file-based-routing-the-preferred-way-to-define-routes): We push for file-based routing as the preferred way to define your routes.
> TLDR; All the design decisions in the developer experience of using TanStack Router are made so that you can have a best-in-class type-safety experience without compromising on the control, flexibility, and maintainability of your route configurations.
## Why is the Router's configuration done this way?
When you want to leverage the TypeScript's inference features to its fullest, you'll quickly realize that _Generics_ are your best friend. And so, TanStack Router uses Generics everywhere to ensure that the types of your routes are inferred as much as possible.
This means that you have to define your routes in a way that allows TypeScript to infer the types of your routes as much as possible.
> Can I use JSX to define my routes?
Using JSX for defining your routes is **out of the question**, as TypeScript will not be able to infer the route configuration types of your router.
\`\`\`tsx
// ⛔️ This is not possible
function App() {
return (
<Router>
<Route path="/posts" component={PostsPage} />
<Route path="/posts/$postId" component={PostIdPage} />
{/* ... */}
</Router>
// ^? TypeScript cannot infer the routes in this configuration
)
}
\`\`\`
And since this would mean that you'd have to manually type the \`to\` prop of the \`<Link>\` component and wouldn't catch any errors until runtime, it's not a viable option.
> Maybe I could define my routes as a tree of nested objects?
\`\`\`tsx
// ⛔️ This file will just keep growing and growing...
const router = createRouter({
routes: {
posts: {
component: PostsPage, // /posts
children: {
$postId: {
component: PostIdPage, // /posts/$postId
},
},
},
// ...
},
})
\`\`\`
At first glance, this seems like a good idea. It's easy to visualize the entire route hierarchy in one go. But this approach has a couple of big downsides that make it not ideal for large applications:
- **It's not very scalable**: As your application grows, the tree will grow and become harder to manage. And since it's all defined in one file, it can become very hard to maintain.
- **It's not great for code-splitting**: You'd have to manually code-split each component and then pass it into the \`component\` property of the route, further complicating the route configuration with an ever-growing route configuration file.
This only gets worse as you begin to use more features of the router, such as nested context, loaders, search param validation, etc.
> So, what's the best way to define my routes?
What we found to be the best way to define your routes is to abstract the definition of the route configuration outside of the route-tree. Then stitch together your route configurations into a single cohesive route-tree that is then passed into the \`createRouter\` function.
You can read more about [code-based routing](./routing/code-based-routing.md) to see how to define your routes in this way.
> [!TIP]
> Finding Code-based routing to be a bit too cumbersome? See why [file-based routing](#why-is-file-based-routing-the-preferred-way-to-define-routes) is the preferred way to define your routes.
## Declaring the Router instance for type inference
> Why do I have to declare the \`Router\`?
> This declaration stuff is way too complicated for me...
Once you've constructed your routes into a tree and passed it into your Router instance (using \`createRouter\`) with all the generics working correctly, you then need to somehow pass this information to the rest of your application.
There were two approaches we considered for this:
1. **Imports**: You could import the \`Router\` instance from the file where you created it and use it directly in your components.
\`\`\`tsx
import { router } from '@/src/app'
export const PostsIdLink = () => {
return (
<Link<typeof router> to="/posts/$postId" params={{ postId: '123' }}>
Go to post 123
</Link>
)
}
\`\`\`
A downside to this approach is that you'd have to import the entire \`Router\` instance into every file where you want to use it. This can lead to increased bundle sizes and can be cumbersome to manage, and only get worse as your application grows and you use more features of the router.
2. **Module declaration**: You can use TypeScript's module declaration to declare the \`Router\` instance as a module that can be used for type inference anywhere in your application without having to import it.
You'll do this once in your application.
\`\`\`tsx
// src/app.tsx
declare module '@tanstack/react-router' {
interface Register {
router: typeof router
}
}
\`\`\`
And then you can benefit from its auto-complete anywhere in your app without having to import it.
\`\`\`tsx
export const PostsIdLink = () => {
return (
<Link
to="/posts/$postId"
// ^? TypeScript will auto-complete this for you
params={{ postId: '123' }} // and this too!
>
Go to post 123
</Link>
)
}
\`\`\`
We went with **module declaration**, as it is what we found to be the most scalable and maintainable approach with the least amount of overhead and boilerplate.
## Why is file-based routing the preferred way to define routes?
> Why are the docs pushing for file-based routing?
> I'm used to defining my routes in a single file, why should I change?
Something you'll notice (quite soon) in the TanStack Router documentation is that we push for **file-based routing** as the preferred method for defining your routes. This is because we've found that file-based routing is the most scalable and maintainable way to define your routes.
> [!TIP]
> Before you continue, it's important you have a good understanding of [code-based routing](./routing/code-based-routing.md) and [file-based routing](./routing/file-based-routing.md).
As mentioned in the beginning, TanStack Router was designed for complex applications that require a high degree of type-safety and maintainability. And to achieve this, the configuration of the router has been done in a precise way that allows TypeScript to infer the types of your routes as much as possible.
A key difference in the set-up of a _basic_ application with TanStack Router, is that your route configurations require a function to be provided to \`getParentRoute\`, that returns the parent route of the current route.
\`\`\`tsx
import { createRoute } from '@tanstack/react-router'
import { postsRoute } from './postsRoute'
export const postsIndexRoute = createRoute({
getParentRoute: () => postsRoute,
path: '/',
})
\`\`\`
At this stage, this is done so the definition of \`postsIndexRoute\` can be aware of its location in the route tree and so that it can correctly infer the types of the \`context\`, \`path params\`, \`search params\` returned by the parent route. Incorrectly defining the \`getParentRoute\` function means that the properties of the parent route will not be correctly inferred by the child route.
As such, this is a critical part of the route configuration and a point of failure if not done correctly.
But this is only one part of setting up a basic application. TanStack Router requires all the routes (including the root route) to be stitched into a **_route-tree_** so that it may be passed into the \`createRouter\` function before declaring the \`Router\` instance on the module for type inference. This is another critical part of the route configuration and a point of failure if not done correctly.
> 🤯 If this route-tree were in its own file for an application with ~40-50 routes, it can easily grow up to 700+ lines.
\`\`\`tsx
const routeTree = rootRoute.addChildren([
postsRoute.addChildren([postsIndexRoute, postsIdRoute]),
])
\`\`\`
This complexity only increases as you begin to use more features of the router, such as nested context, loaders, search param validation, etc. As such, it no longer becomes feasible to define your routes in a single file. And so, users end up building their own _semi consistent_ way of defining their routes across multiple files. This can lead to inconsistencies and errors in the route configuration.
Finally, comes the issue of code-splitting. As your application grows, you'll want to code-split your components to reduce the initial bundle size of your application. This can be a bit of a headache to manage when you're defining your routes in a single file or even across multiple files.
\`\`\`tsx
import { createRoute, lazyRouteComponent } from '@tanstack/react-router'
import { postsRoute } from './postsRoute'
export const postsIndexRoute = createRoute({
getParentRoute: () => postsRoute,
path: '/',
component: lazyRouteComponent(() => import('../page-components/posts/index')),
})
\`\`\`
All of this boilerplate, no matter how essential for providing a best-in-class type-inference experience, can be a bit overwhelming and can lead to inconsistencies and errors in the route configuration.
... and this example configuration is just for rendering a single codes-split route. Imagine having to do this for 40-50 routes. Now remember that you still haven't touched the \`context\`, \`loaders\`, \`search param validation\`, and other features of the router 🤕.
> So, why's file-based routing the preferred way?
TanStack Router's file-based routing is designed to solve all of these issues. It allows you to define your routes in a predictable way that is easy to manage and maintain, and is scalable as your application grows.
The file-based routing approach is powered by the TanStack Router Bundler Plugin. It performs 3 essential tasks that solve the pain points in route configuration when using code-based routing:
1. **Route configuration boilerplate**: It generates the boilerplate for your route configurations.
2. **Route tree stitching**: It stitches together your route configurations into a single cohesive route-tree. Also in the background, it correctly updates the route configurations to define the \`getParentRoute\` function match the routes with their parent routes.
3. **Code-splitting**: It automatically code-splits your route content components and updates the route configurations with the correct component. Additionally, at runtime, it ensures that the correct component is loaded when the route is visited.
Let's take a look at how the route configuration for the previous example would look like with file-based routing.
\`\`\`tsx
// src/routes/posts/index.ts
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/posts/')({
component: () => 'Posts index component goes here!!!',
})
\`\`\`
That's it! No need to worry about defining the \`getParentRoute\` function, stitching together the route-tree, or code-splitting your components. The TanStack Router Bundler Plugin handles all of this for you.
At no point does the TanStack Router Bundler Plugin take away your control over your route configurations. It's designed to be as flexible as possible, allowing you to define your routes in a way that suits your application whilst reducing the boilerplate and complexity of the route configuration.
Check out the guides for [file-based routing](./routing/file-based-routing.md) and [code-splitting](./guide/code-splitting.md) for a more in-depth explanation of how they work in TanStack Router.
# Devtools
> Link, take this sword... I mean Devtools!... to help you on your way!
Wave your hands in the air and shout hooray because TanStack Router comes with dedicated devtools! 🥳
When you begin your TanStack Router journey, you'll want these devtools by your side. They help visualize all of the inner workings of TanStack Router and will likely save you hours of debugging if you find yourself in a pinch!
## Installation
The devtools are a separate package that you need to install:
<!-- ::start:tabs variant="package-manager" -->
react: @tanstack/react-router-devtools
solid: @tanstack/solid-router-devtools
<!-- ::end:tabs -->
## Import the Devtools
<!-- ::start:framework -->
# React
\`\`\`tsx
import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
\`\`\`
# Solid
\`\`\`tsx
import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
\`\`\`
<!-- ::end:framework -->
## Using Devtools in production
The Devtools, if imported as \`TanStackRouterDevtools\` will not be shown in production. If you want to have devtools in an environment with \`process.env.NODE_ENV === 'production'\`, use instead \`TanStackRouterDevtoolsInProd\`, which has all the same options:
<!-- ::start:framework -->
# React
\`\`\`tsx
import { TanStackRouterDevtoolsInProd } from '@tanstack/react-router-devtools'
\`\`\`
# Solid
\`\`\`tsx
import { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools'
\`\`\`
<!-- ::end:framework -->
## Using the Devtools in the root route
The easiest way for the devtools to work is to render them inside of your root route (or any other route). This will automatically connect the devtools to the router instance.
<!-- ::start:framework -->
# React
<!-- ::start:tabs variant="files" -->
\`\`\`tsx title="src/routes/__root.tsx"
import { createRootRoute, Outlet } from '@tanstack/react-router'
import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
export const Route = createRootRoute({
component: () => (
<>
<Outlet />
<TanStackRouterDevtools />
</>
),
})
\`\`\`
<!-- ::end:tabs -->
# Solid
<!-- ::start:tabs variant="files" -->
\`\`\`tsx title="src/routes/__root.tsx"
import { createRootRoute, Outlet } from '@tanstack/solid-router'
import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
export const Route = createRootRoute({
component: () => (
<>
<Outlet />
<TanStackRouterDevtools />
</>
),
})
\`\`\`
<!-- ::end:tabs -->
<!-- ::end:framework -->
## Manually passing the Router Instance
If rendering the devtools inside of the \`RouterProvider\` isn't your cup of tea, a \`router\` prop for the devtools accepts the same \`router\` instance you pass to the \`Router\` component. This makes it possible to place the devtools anywhere on the page, not just inside the provider:
<!-- ::start:framework -->
# React
\`\`\`tsx
function App() {
return (
<>
<RouterProvider router={router} />
<TanStackRouterDevtools router={router} />
</>
)
}
\`\`\`
# Solid
\`\`\`tsx
function App() {
return (
<>
<RouterProvider router={router} />
<TanStackRouterDevtools router={router} />
</>
)
}
\`\`\`
<!-- ::end:framework -->
## Floating Mode
Floating Mode will mount the devtools as a fixed, floating element in your app and provide a toggle in the corner of the screen to show and hide the devtools. This toggle state will be stored and remembered in localStorage across reloads.
Place the following code as high in your app as you can. The closer it is to the root of the page, the better it will work!
<!-- ::start:framework -->
# React
\`\`\`tsx
function App() {
return (
<>
<RouterProvider router={router} />
<TanStackRouterDevtools initialIsOpen={false} />
</>
)
}
\`\`\`
# Solid
\`\`\`tsx
function App() {
return (
<>
<RouterProvider router={router} />
<TanStackRouterDevtools initialIsOpen={false} />
</>
)
}
\`\`\`
<!-- ::end:framework -->
### Devtools Options
- \`router: Router\`
- The router instance to connect to.
- \`initialIsOpen: Boolean\`
- Set this \`true\` if you want the devtools to default to being open.
- \`panelProps: PropsObject\`
- Use this to add props to the panel. For example, you can add \`className\`, \`style\` (merge and override default style), etc.
- \`closeButtonProps: PropsObject\`
- Use this to add props to the close button. For example, you can add \`className\`, \`style\` (merge and override default style), \`onClick\` (extend default handler), etc.
- \`toggleButtonProps: PropsObject\`
- Use this to add props to the toggle button. For example, you can add \`className\`, \`style\` (merge and override default style), \`onClick\` (extend default handler), etc.
- \`position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"\`
- Defaults to \`bottom-left\`.
- The position of the TanStack Router logo to open and close the devtools panel.
- \`shadowDOMTarget?: ShadowRoot\`
- Specifies a Shadow DOM target for the devtools.
- By default, devtool styles are applied to the \`<head>\` tag of the main document (light DOM). When a \`shadowDOMTarget\` is provided, styles will be applied within this Shadow DOM instead.
- \`containerElement?: string | any\`
- Use this to render the devtools inside a different type of container element for ally purposes.
- Any string which corresponds to a valid intrinsic JSX element is allowed.
- Defaults to 'footer'.
## Fixed Mode
To control the position of the devtools, import the \`TanStackRouterDevtoolsPanel\`:
<!-- ::start:framework -->
# React
\`\`\`tsx
import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
\`\`\`
# Solid
\`\`\`tsx
import { TanStackRouterDevtoolsPanel } from '@tanstack/solid-router-devtools'
\`\`\`
<!-- ::end:framework -->
It can then be attached to provided shadow DOM target:
<!-- ::start:framework -->
# React
\`\`\`tsx
<TanStackRouterDevtoolsPanel
shadowDOMTarget={shadowContainer}
router={router}
/>
\`\`\`
# Solid
\`\`\`tsx
<TanStackRouterDevtoolsPanel
shadowDOMTarget={shadowContainer}
router={router}
/>
\`\`\`
<!-- ::end:framework -->
Click [here](https://tanstack.com/router/latest/docs/framework/react/examples/basic-devtools-panel) to see a live example of this in StackBlitz.
## Embedded Mode
Embedded Mode will embed the devtools as a regular component in your application. You can style it however you'd like after that!
<!-- ::start:framework -->
# React
\`\`\`tsx
import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
function App() {
return (
<>
<RouterProvider router={router} />
<TanStackRouterDevtoolsPanel
router={router}
style={styles}
className={className}
/>
</>
)
}
\`\`\`
# Solid
\`\`\`tsx
import { TanStackRouterDevtoolsPanel } from '@tanstack/solid-router-devtools'
function App() {
return (
<>
<RouterProvider router={router} />
<TanStackRouterDevtoolsPanel
router={router}
style={styles}
class={className}
/>
</>
)
}
\`\`\`
<!-- ::end:framework -->
### DevtoolsPanel Options
- \`router: Router\`
- The router instance to connect to.
<!-- ::start:framework -->
# React
- \`style?: StyleObject\`
- The standard React style object used to style a component with inline styles.
- \`className?: string\`
- The standard React className property used to style a component with classes.
# Solid
- \`style?: StyleObject\`
- The standard Solid style object used to style a component with inline styles.
- \`class?: string\`
- The standard Solid class property used to style a component with classes.
<!-- ::end:framework -->
- \`isOpen?: boolean\`
- A boolean variable indicating whether the panel is open or closed.
- \`setIsOpen?: (isOpen: boolean) => void\`
- A function that toggles the open and close state of the panel.
- \`handleDragStart?: (e: any) => void\`
- Handles the opening and closing the devtools panel.
- \`shadowDOMTarget?: ShadowRoot\`
- Specifies a Shadow DOM target for the devtools.
- By default, devtool styles are applied to the \`<head>\` tag of the main document (light DOM). When a \`shadowDOMTarget\` is provided, styles will be applied within this Shadow DOM instead.
# Frequently Asked Questions
Welcome to the TanStack Router FAQ! Here you'll find answers to common questions about the TanStack Router. If you have a question that isn't answered here, please feel free to ask in the [TanStack Discord](https://tlinz.com/discord).
## Why should you choose TanStack Router over another router?
To answer this question, it's important to view the other options in the space. There are many alternatives to choose from, but only a couple that are widely adopted and actively maintained:
- **Next.js** - Widely regarded as the leading framework for starting new React projects. Its design focuses on performance, development workflows, and cutting-edge technology. The framework's APIs and abstractions, while powerful, can sometimes present as non-standard. Rapid growth and industry adoption have resulted in a feature-rich experience, sometimes leading to a steeper learning curve and increased overhead.
- **Remix / React Router** - Based on the historically successful React Router, Remix delivers a powerful developer and user experience. Its API and architectural vision are firmly rooted in web standards such as Request/Response, with an emphasis on adaptability across various JavaScript environments. Many of its APIs and abstractions are well-designed and have influenced more than a few of TanStack Router's APIs. However, its rigid design, the integration of type safety as an add-on, and sometimes strict adherence to platform APIs can present limitations for some developers.
These frameworks and routers have their strengths, but they also come with trade-offs that may not align with every project's needs. TanStack Router aims to strike a balance by offering routing APIs designed to improve the developer experience without sacrificing flexibility or performance.
## Is TanStack Router a framework?
TanStack Router itself is not a "framework" in the traditional sense, since it doesn't address a few other common full-stack concerns. However, TanStack Router has been designed to be upgradable to a full-stack framework when used in conjunction with other tools that address bundling, deployments, and server-side-specific functionality. This is why we are currently developing [TanStack Start](https://tanstack.com/start), a full-stack framework that is built on top of TanStack Router and Vite.
For a deeper dive on the history of TanStack Router, feel free to read [TanStack Router's History](./decisions-on-dx.md#tanstack-routers-origin-story).
## Should I commit my \`routeTree.gen.ts\` file into git?
Yes! Although the route tree file (i.e., \`routeTree.gen.ts\`) is generated by TanStack Router, it is essentially part of your application’s runtime, not a build artifact. The route tree file is a critical part of your application’s source code, and it is used by TanStack Router to build your application’s routes at runtime.
You should commit this file into git so that other developers can use it to build your application.
## Can I conditionally render the Root Route component?
No, the root route is always rendered as it is the entry point of your application.
If you need to conditionally render a route's component, this usually means that the page content needs to be different based on some condition (e.g. user authentication). For this use case, you should use a [Layout Route](./routing/routing-concepts.md#layout-routes) or a [Pathless Layout Route](./routing/routing-concepts.md#pathless-layout-routes) to conditionally render the content.
You can restrict access to these routes using a conditional check in the \`beforeLoad\` function of the route.
<details>
<summary>What does this look like?</summary>
<!-- ::start:framework -->
# React
\`\`\`tsx
// src/routes/_pathless-layout.tsx
import { createFileRoute, Outlet } from '@tanstack/react-router'
import { isAuthenticated } from '../utils/auth'
export const Route = createFileRoute('/_pathless-layout', {
beforeLoad: async () => {
// Check if the user is authenticated
const authed = await isAuthenticated()
if (!authed) {
// Redirect the user to the login page
return '/login'
}
},
component: PathlessLayoutRouteComponent,
// ...
})
function PathlessLayoutRouteComponent() {
return (
<div>
<h1>You are authed</h1>
<Outlet />
</div>
)
}
\`\`\`
# Solid
\`\`\`tsx
// src/routes/_pathless-layout.tsx
import { createFileRoute, Outlet } from '@tanstack/solid-router'
import { isAuthenticated } from '../utils/auth'
export const Route = createFileRoute('/_pathless-layout', {
beforeLoad: async () => {
// Check if the user is authenticated
const authed = await isAuthenticated()
if (!authed) {
// Redirect the user to the login page
return '/login'
}
},
component: PathlessLayoutRouteComponent,
// ...
})
function PathlessLayoutRouteComponent() {
return (
<div>
<h1>You are authed</h1>
<Outlet />
</div>
)
}
\`\`\`
<!-- ::end:framework -->
</details>
`;
@@ -0,0 +1,205 @@
/*!
* express
* Copyright(c) 2009-2013 TJ Holowaychuk
* Copyright(c) 2013 Roman Shtylman
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict';
/**
* Module dependencies.
* @private
*/
var debug = require('debug')('express:view');
var path = require('node:path');
var fs = require('node:fs');
/**
* Module variables.
* @private
*/
var dirname = path.dirname;
var basename = path.basename;
var extname = path.extname;
var join = path.join;
var resolve = path.resolve;
/**
* Module exports.
* @public
*/
module.exports = View;
/**
* Initialize a new `View` with the given `name`.
*
* Options:
*
* - `defaultEngine` the default template engine name
* - `engines` template engine require() cache
* - `root` root path for view lookup
*
* @param {string} name
* @param {object} options
* @public
*/
function View(name, options) {
var opts = options || {};
this.defaultEngine = opts.defaultEngine;
this.ext = extname(name);
this.name = name;
this.root = opts.root;
if (!this.ext && !this.defaultEngine) {
throw new Error('No default engine was specified and no extension was provided.');
}
var fileName = name;
if (!this.ext) {
// get extension from default engine name
this.ext = this.defaultEngine[0] !== '.'
? '.' + this.defaultEngine
: this.defaultEngine;
fileName += this.ext;
}
if (!opts.engines[this.ext]) {
// load engine
var mod = this.ext.slice(1)
debug('require "%s"', mod)
// default engine export
var fn = require(mod).__express
if (typeof fn !== 'function') {
throw new Error('Module "' + mod + '" does not provide a view engine.')
}
opts.engines[this.ext] = fn
}
// store loaded engine
this.engine = opts.engines[this.ext];
// lookup path
this.path = this.lookup(fileName);
}
/**
* Lookup view by the given `name`
*
* @param {string} name
* @private
*/
View.prototype.lookup = function lookup(name) {
var path;
var roots = [].concat(this.root);
debug('lookup "%s"', name);
for (var i = 0; i < roots.length && !path; i++) {
var root = roots[i];
// resolve the path
var loc = resolve(root, name);
var dir = dirname(loc);
var file = basename(loc);
// resolve the file
path = this.resolve(dir, file);
}
return path;
};
/**
* Render with the given options.
*
* @param {object} options
* @param {function} callback
* @private
*/
View.prototype.render = function render(options, callback) {
var sync = true;
debug('render "%s"', this.path);
// render, normalizing sync callbacks
this.engine(this.path, options, function onRender() {
if (!sync) {
return callback.apply(this, arguments);
}
// copy arguments
var args = new Array(arguments.length);
var cntx = this;
for (var i = 0; i < arguments.length; i++) {
args[i] = arguments[i];
}
// force callback to be async
return process.nextTick(function renderTick() {
return callback.apply(cntx, args);
});
});
sync = false;
};
/**
* Resolve the file within the given directory.
*
* @param {string} dir
* @param {string} file
* @private
*/
View.prototype.resolve = function resolve(dir, file) {
var ext = this.ext;
// <path>.<ext>
var path = join(dir, file);
var stat = tryStat(path);
if (stat && stat.isFile()) {
return path;
}
// <path>/index.<ext>
path = join(dir, basename(file, ext), 'index' + ext);
stat = tryStat(path);
if (stat && stat.isFile()) {
return path;
}
};
/**
* Return a stat, maybe.
*
* @param {string} path
* @return {fs.Stats}
* @private
*/
function tryStat(path) {
debug('stat "%s"', path);
try {
return fs.statSync(path);
} catch (e) {
return undefined;
}
}
@@ -0,0 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'no-this-alias',
meta: {
type: 'suggestion',
docs: {
description: 'Disallow aliasing `this`',
recommended: 'recommended',
},
messages: {
thisAssignment: "Unexpected aliasing of 'this' to local variable.",
thisDestructure: "Unexpected aliasing of members of 'this' to local variables.",
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
allowDestructuring: {
type: 'boolean',
description: 'Whether to ignore destructurings, such as `const { props, state } = this`.',
},
allowedNames: {
type: 'array',
description: 'Names to ignore, such as ["self"] for `const self = this;`.',
items: {
type: 'string',
},
},
},
},
],
},
defaultOptions: [
{
allowDestructuring: true,
allowedNames: [],
},
],
create(context, [{ allowDestructuring, allowedNames }]) {
return {
"VariableDeclarator[init.type='ThisExpression'], AssignmentExpression[right.type='ThisExpression']"(node) {
const id = node.type === utils_1.AST_NODE_TYPES.VariableDeclarator ? node.id : node.left;
if (allowDestructuring && id.type !== utils_1.AST_NODE_TYPES.Identifier) {
return;
}
const hasAllowedName = id.type === utils_1.AST_NODE_TYPES.Identifier
? // https://github.com/typescript-eslint/typescript-eslint/issues/5439
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
allowedNames.includes(id.name)
: false;
if (!hasAllowedName) {
context.report({
node: id,
messageId: id.type === utils_1.AST_NODE_TYPES.Identifier
? 'thisAssignment'
: 'thisDestructure',
});
}
},
};
},
});
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/side-channel-weakmap
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,7 @@
(function(i){function e(){var f=i();return f.default||f}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.flow=e()}})(function(){"use strict";var DE=Object.create;var gg=Object.defineProperty;var eE=Object.getOwnPropertyDescriptor;var wE=Object.getOwnPropertyNames;var aE=Object.getPrototypeOf,tE=Object.prototype.hasOwnProperty;var h=(A,g)=>()=>{try{return g||A((g={exports:{}}).exports,g),g.exports}catch(I){throw g=0,I}},AB=(A,g)=>{for(var I in g)gg(A,I,{get:g[I],enumerable:!0})},gB=(A,g,I,B)=>{if(g&&typeof g=="object"||typeof g=="function")for(let C of wE(g))!tE.call(A,C)&&C!==I&&gg(A,C,{get:()=>g[C],enumerable:!(B=eE(g,C))||B.enumerable});return A};var sE=(A,g,I)=>(I=A!=null?DE(aE(A)):{},gB(g||!A||!A.__esModule?gg(I,"default",{value:A,enumerable:!0}):I,A)),yE=A=>gB(gg({},"__esModule",{value:!0}),A);var CB=h(Ig=>{"use strict";Ig.byteLength=NE;Ig.toByteArray=rE;Ig.fromByteArray=KE;var QA=[],$=[],GE=typeof Uint8Array<"u"?Uint8Array:Array,ng="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(cA=0,IB=ng.length;cA<IB;++cA)QA[cA]=ng[cA],$[ng.charCodeAt(cA)]=cA;var cA,IB;$[45]=62;$[95]=63;function BB(A){var g=A.length;if(g%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var I=A.indexOf("=");I===-1&&(I=g);var B=I===g?0:4-I%4;return[I,B]}function NE(A){var g=BB(A),I=g[0],B=g[1];return(I+B)*3/4-B}function kE(A,g,I){return(g+I)*3/4-I}function rE(A){var g,I=BB(A),B=I[0],C=I[1],Q=new GE(kE(A,B,C)),i=0,o=C>0?B-4:B,e;for(e=0;e<o;e+=4)g=$[A.charCodeAt(e)]<<18|$[A.charCodeAt(e+1)]<<12|$[A.charCodeAt(e+2)]<<6|$[A.charCodeAt(e+3)],Q[i++]=g>>16&255,Q[i++]=g>>8&255,Q[i++]=g&255;return C===2&&(g=$[A.charCodeAt(e)]<<2|$[A.charCodeAt(e+1)]>>4,Q[i++]=g&255),C===1&&(g=$[A.charCodeAt(e)]<<10|$[A.charCodeAt(e+1)]<<4|$[A.charCodeAt(e+2)]>>2,Q[i++]=g>>8&255,Q[i++]=g&255),Q}function cE(A){return QA[A>>18&63]+QA[A>>12&63]+QA[A>>6&63]+QA[A&63]}function hE(A,g,I){for(var B,C=[],Q=g;Q<I;Q+=3)B=(A[Q]<<16&16711680)+(A[Q+1]<<8&65280)+(A[Q+2]&255),C.push(cE(B));return C.join("")}function KE(A){for(var g,I=A.length,B=I%3,C=[],Q=16383,i=0,o=I-B;i<o;i+=Q)C.push(hE(A,i,i+Q>o?o:i+Q));return B===1?(g=A[I-1],C.push(QA[g>>2]+QA[g<<4&63]+"==")):B===2&&(g=(A[I-2]<<8)+A[I-1],C.push(QA[g>>10]+QA[g>>4&63]+QA[g<<2&63]+"=")),C.join("")}});var QB=h(Yg=>{Yg.read=function(A,g,I,B,C){var Q,i,o=C*8-B-1,e=(1<<o)-1,t=e>>1,s=-7,G=I?C-1:0,r=I?-1:1,F=A[g+G];for(G+=r,Q=F&(1<<-s)-1,F>>=-s,s+=o;s>0;Q=Q*256+A[g+G],G+=r,s-=8);for(i=Q&(1<<-s)-1,Q>>=-s,s+=B;s>0;i=i*256+A[g+G],G+=r,s-=8);if(Q===0)Q=1-t;else{if(Q===e)return i?NaN:(F?-1:1)*(1/0);i=i+Math.pow(2,B),Q=Q-t}return(F?-1:1)*i*Math.pow(2,Q-B)};Yg.write=function(A,g,I,B,C,Q){var i,o,e,t=Q*8-C-1,s=(1<<t)-1,G=s>>1,r=C===23?Math.pow(2,-24)-Math.pow(2,-77):0,F=B?0:Q-1,K=B?1:-1,R=g<0||g===0&&1/g<0?1:0;for(g=Math.abs(g),isNaN(g)||g===1/0?(o=isNaN(g)?1:0,i=s):(i=Math.floor(Math.log(g)/Math.LN2),g*(e=Math.pow(2,-i))<1&&(i--,e*=2),i+G>=1?g+=r/e:g+=r*Math.pow(2,1-G),g*e>=2&&(i++,e/=2),i+G>=s?(o=0,i=s):i+G>=1?(o=(g*e-1)*Math.pow(2,C),i=i+G):(o=g*Math.pow(2,G-1)*Math.pow(2,C),i=0));C>=8;A[I+F]=o&255,F+=K,o/=256,C-=8);for(i=i<<C|o,t+=C;t>0;A[I+F]=i&255,F+=K,i/=256,t-=8);A[I+F-K]|=R*128}});var ug=h(RA=>{"use strict";var Ug=CB(),LA=QB(),EB=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;RA.Buffer=a;RA.SlowBuffer=UE;RA.INSPECT_MAX_BYTES=50;var Bg=2147483647;RA.kMaxLength=Bg;a.TYPED_ARRAY_SUPPORT=FE();!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function FE(){try{let A=new Uint8Array(1),g={foo:function(){return 42}};return Object.setPrototypeOf(g,Uint8Array.prototype),Object.setPrototypeOf(A,g),A.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}});Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function DA(A){if(A>Bg)throw new RangeError('The value "'+A+'" is invalid for option "size"');let g=new Uint8Array(A);return Object.setPrototypeOf(g,a.prototype),g}function a(A,g,I){if(typeof A=="number"){if(typeof g=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Rg(A)}return eB(A,g,I)}a.poolSize=8192;function eB(A,g,I){if(typeof A=="string")return ME(A,g);if(ArrayBuffer.isView(A))return nE(A);if(A==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof A);if(EA(A,ArrayBuffer)||A&&EA(A.buffer,ArrayBuffer)||typeof SharedArrayBufLine truncated
`).map(C=>C.trimStart().replace(/^\* ?/,"").trim()).filter(C=>C.startsWith("@")),I=Object.create(null);for(let C of g){var B;let Q=$E.exec(C);if(Q==null)continue;let i=Q[1],o=((B=Q[2])!=null?B:"").trim();I[i]?I[i].push(o):I[i]=[o]}return I}function Ai(A){let g=(()=>{if(A.type!=="Program")return null;let I=A;if(I.comments.length===0)return null;let B=(()=>{let C=I.comments[0];if(C.type==="Block")return C;if(I.comments.length===1)return null;let Q=I.comments[1];return C.type==="Line"&&C.range[0]===0&&Q.type==="Block"?Q:null})();return B==null||I.body.length>0&&I.body[0].range[0]<B.range[0]?null:B})();return g==null?null:{directives:pB(g.value),comment:g}}});var jB=h(Pg=>{var qB=globalThis.Buffer??ug().Buffer;Object.defineProperty(Pg,"__esModule",{value:!0});Pg.parse=Qi;var gi=lB(nB()),Ii=lB(LB()),Bi=RB();function lB(A){return A&&A.__esModule?A:{default:A}}var f,uB,dB,mB,fB,TB,PB,xB,OB,WB;function Ci(){f==null&&(f=(0,Ii.default)({quit(A,g){throw g}}),uB=f.cwrap("hermesParse","number",["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"]),dB=f.cwrap("hermesParseResult_free","void",["number"]),mB=f.cwrap("hermesParseResult_getError","string",["number"]),fB=f.cwrap("hermesParseResult_getErrorLine","number",["number"]),TB=f.cwrap("hermesParseResult_getErrorColumn","number",["number"]),PB=f.cwrap("hermesParseResult_getProgramBuffer","number",["number"]),xB=f.cwrap("hermesParseResult_getPositionBuffer","number",["number"]),OB=f.cwrap("hermesParseResult_getPositionBufferSize","number",["number"]),WB=f.cwrap("hermesParseResult_getStringBuffer","number",["number"]))}function HB(A,g){f.HEAP8.set(A,g),f.HEAP8[g+A.length]=0}function eA(A){return A===!0?1:0}function Qi(A,g){Ci();let I=qB.from(A,"utf8"),B=typeof g.sourceFilename=="string"?g.sourceFilename:"",C=B.length>0?qB.from(B,"utf8"):null,Q=0,i=0,o=0,e=0;try{let Z=function(q){if(q==null||typeof q!="object")return;let H=q;if(!U.has(H)){if(U.add(H),H.loc!=null){let j=H.loc,W=d.get(j);if(W==null){let _=j.rangeStart,oA=j.rangeEnd;if(_==null||oA==null)throw new Error("Expected serialized source range");j.source=R,W=[_,oA],d.set(j,W),delete j.rangeStart,delete j.rangeEnd}H.range=W}for(let j of Object.keys(H)){let W=H[j];if(Array.isArray(W))for(let _ of W)Z(_);else Z(W)}}};var t=Z;if(Q=f._malloc(I.length+1),!Q)throw new Error("Parser out of memory");if(C!=null){if(i=f._malloc(C.length+1),!i)throw new Error("Parser out of memory");HB(C,i),o=C.length+1}HB(I,Q);let s=g.enableTypes===!1?0:1,G=g.sourceType==="script"?1:g.sourceType==="module"?2:0;e=uB(Q,I.length+1,i,o,eA(g.enableExperimentalComponentSyntax),eA(g.enableExperimentalFlowMatchSyntax),eA(g.enableExperimentalDecorators),eA(g.tokens),eA(g.allowReturnOutsideFunction),eA(g.assertOperator),eA(g.enableEnums),eA(g.enableRecords),s,G,eA(g.enableTypesPragmaDetection),0);let r=PB(e);if(!r){let q=mB(e),H=new SyntaxError(q||"unknown parse error");throw H.loc={line:fB(e),column:TB(e)},H}let K=new gi.default(r,xB(e),OB(e),WB(e),f,g).deserialize();if(K.type!=="Program")throw new Error(`Expected Program, got ${K.type}`);let R=typeof g.sourceFilename=="string"?g.sourceFilename:null,U=new WeakSet,d=new WeakMap;if(Z(K),g.throwOnParseErrors!==!1){let q=K.errors;if(q!=null&&q.length>0){let H=q[0],j=H.loc.start;if(j==null)throw new Error("Expected serialized parser error start location");let W=j.line,_=j.column,oA=new SyntaxError(`${H.message} (${W}:${_})`);throw oA.loc={line:W,column:_},oA}}return g.sourceType==="script"||g.sourceType==="module"?K.sourceType=g.sourceType:K.sourceType=Ei(K),K.docblock=(0,Bi.getModuleDocblock)(K),K}finally{e!==0&&dB(e),Q!==0&&f._free(Q),i!==0&&f._free(i)}}function Ei(A){if(!Array.isArray(A.body))return"script";for(let g of A.body)if(g!=null)switch(g.type){case"ImportDeclaration":if(g.importKind==="value"||g.importKind==null)return"module";break;case"ExportDefaultDeclaration":return"module";case"ExportNamedDeclaration":case"ExportAllDeclaration":if(g.exportKind==="value"||g.exportKind==null)return"module";break}return"script"}});var ig=h((yG,bB)=>{"use strict";bB.exports={AbstractMethodDefinition:["key","value"],AbstractPropertyDefinition:["key","value","variance"],AnyTypeAnnotation:[],ArrayExpression:["elements"],ArrayPattern:["elements","typeAnnotation"],ArrayTypeAnnotation:["elementType"],ArrowFunctionExpression:["params","body","typeParameters","returnType","predicate"],AsConstExpression:["expression"],AsExpression:["expression","typeAnnotation"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BigIntLiteralTypeAnnotation:[],BigIntTypeAnnotation:[],BinaryExpression:["left","right"],BlockStatement:["body"],BooleanLiteralTypeAnnotation:[],BooleanTypeAnnotation:[],BreakStatement:["label"],CallExpression:["callee","typeArguments","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","typeParameters","superLine truncated
`))return[];let g=[];for(let I of`*${A.value}*`.split(`
`)){if(I=I.trimStart(),!I.startsWith("*"))return[];g.push(I)}return g}var VC=new WeakMap;function cy(A){return TA(VC,A,ry)}function vC(A){VC.delete(A)}function UI(A){return cy(A).length>0}function XC(A){if(A.length<2)return;let g;for(let I=A.length-1;I>=0;I--){let B=A[I];if(g&&P(B)===T(g)&&UI(B)&&UI(g)&&(A.splice(I+1,1),B.value+="*//*"+g.value,B.range=[T(B),P(g)],vC(B)),!jC(B)&&!fA(B))throw new TypeError(`Unknown comment type: "${B.type}".`);g=B}}function hy(A){return A!==null&&typeof A=="object"}var _C=hy;var vA=null;function XA(A){if(vA!==null&&typeof vA.property){let g=vA;return vA=XA.prototype=null,g}return vA=XA.prototype=A??Object.create(null),new XA}var Ky=10;for(let A=0;A<=Ky;A++)XA();function JI(A){return XA(A)}function Fy(A,g="type"){JI(A);function I(B){let C=B[g],Q=A[C];if(!Array.isArray(Q))throw Object.assign(new Error(`Missing visitor keys for '${C}'.`),{node:B});return Q}return I}var $C=Fy;var D=[["elements"],["left","right"],["value"],["directives","body"],["label"],["callee","typeArguments","arguments"],["test","consequent","alternate"],["body","test"],["expression"],["left","right","body"],["id","typeParameters","params","predicate","returnType","body"],["object","property"],["properties"],["decorators","key","typeParameters","params","returnType","body"],["decorators","key","value"],["argument"],["expressions"],["id","init"],["body"],["decorators","id","typeParameters","superClass","superTypeArguments","mixins","implements","body"],["declaration","specifiers","source","attributes"],["local"],["exported"],["decorators","variance","key","typeAnnotation","value"],["id"],["key","value"],["elementType"],["id","typeParameters"],["id","typeParameters","extends","body"],["id","body"],["typeAnnotation"],["id","typeParameters","right"],["name","typeAnnotation"],["types"],["qualification","id"],["elementTypes"],["expression","typeAnnotation"],["params"],["members"],["objectType","indexType"],["decorators","key","typeAnnotation","value"],["id","typeParameters","params","returnType","body"],["key","typeParameters","params","returnType"],["typeParameters","params","returnType"],["parameterName","typeAnnotation"],["checkType","extendsType","trueType","falseType"],["typeParameter"],["literal"],["expression","typeArguments"],["decorators","key","typeAnnotation"],["argument","cases"],["pattern","body","guard"],["properties","rest"],["node"]],AQ={ArrayExpression:D[0],AssignmentExpression:D[1],BinaryExpression:D[1],InterpreterDirective:[],Directive:D[2],DirectiveLiteral:[],BlockStatement:D[3],BreakStatement:D[4],CallExpression:D[5],CatchClause:["param","body"],ConditionalExpression:D[6],ContinueStatement:D[4],DebuggerStatement:[],DoWhileStatement:D[7],EmptyStatement:[],ExpressionStatement:D[8],File:["program"],ForInStatement:D[9],ForStatement:["init","test","update","body"],FunctionDeclaration:D[10],FunctionExpression:D[10],Identifier:["typeAnnotation","decorators"],IfStatement:D[6],LabeledStatement:["label","body"],StringLiteral:[],NumericLiteral:[],NullLiteral:[],BooleanLiteral:[],RegExpLiteral:[],LogicalExpression:D[1],MemberExpression:D[11],NewExpression:D[5],Program:D[3],ObjectExpression:D[12],ObjectMethod:D[13],ObjectProperty:D[14],RestElement:["argument","typeAnnotation","decorators"],ReturnStatement:D[15],SequenceExpression:D[16],ParenthesizedExpression:D[8],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],ThisExpression:[],ThrowStatement:D[15],TryStatement:["block","handler","finalizer"],UnaryExpression:D[15],UpdateExpression:D[15],VariableDeclaration:["declarations"],VariableDeclarator:D[17],WhileStatement:D[7],WithStatement:["object","body"],AssignmentPattern:["left","right","decorators","typeAnnotation"],ArrayPattern:["elements","typeAnnotation","decorators"],ArrowFunctionExpression:["typeParameters","params","predicate","returnType","body"],ClassBody:D[18],ClassExpression:D[19],ClassDeclaration:D[19],ExportAllDeclaration:["source","attributes","exported"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:D[20],ExportSpecifier:["local","exported"],ForOfStatement:D[9],ImportDeclaration:["specifiers","source","attributes"],ImportDefaultSpecifier:D[21],ImportNamespaceSpecifier:D[21],ImportSpecifier:["imported","local"],MetaProperty:["meta","property"],ClassMethod:D[13],ObjectPattern:["decorators","properties","typeAnnotation"],SpreadElement:D[15],Super:[],TaggedTemplateExpression:["tag","typeArguments","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],YieldExpression:D[15],AwaitExpression:D[15],ImportExpression:["source","options"],BigIntLiteral:[],ExportNamespaceSpecifier:D[22],OptionalMemberExpression:D[11],OptionalCallExpression:D[5],ClassProperty:D[23],ClassPrivateProperty:D[23],ClassPrivateMethod:D[13],PrivateName:D[24],StaticBlock:D[18],ImportAttribute:D[25],AnyTypeAnnotation:[],ArrayTypeAnnotation:D[26],BooleanTypeAnnotation:[],BooleanLiteralTypeAnnotation:[],NullLiteralTypeAnnotation:[],ClassImplements:D[27],DeclareClass:["id","typePaLine truncated
$1 $2
`);A=A.replace(QQ,"").trimEnd();let B=Object.create(null),C=nA(0,A,EQ,"").replace(QQ,"").trimEnd(),Q;for(;Q=EQ.exec(A);){let i=nA(0,Q[2],py,"");if(typeof B[Q[1]]=="string"||Array.isArray(B[Q[1]])){let o=B[Q[1]];B[Q[1]]=[...Hy,...Array.isArray(o)?o:[o],i]}else B[Q[1]]=i}return{comments:C,pragmas:B}}var DQ=["noformat","noprettier"],eQ=["format","prettier"];function ly(A){if(!A.startsWith("#!"))return"";let g=A.indexOf(`
`);return g===-1?A:A.slice(0,g)}var wQ=ly;function aQ(A){let g=wQ(A);g&&(A=A.slice(g.length+1));let I=iQ(A),{pragmas:B,comments:C}=oQ(I);return{shebang:g,text:A,pragmas:B,comments:C}}function tQ(A){let{pragmas:g}=aQ(A);return eQ.some(I=>pI(g,I))}function sQ(A){let{pragmas:g}=aQ(A);return DQ.some(I=>pI(g,I))}function uy(A){return A=typeof A=="function"?{parse:A}:A,{astFormat:"estree",hasPragma:tQ,hasIgnorePragma:sQ,locStart:T,locEnd:P,...A}}var yQ=uy;var dy={flow:"all",babel:!1,tokens:!1,allowReturnOutsideFunction:!0,enableEnums:!0,enableExperimentalFlowMatchSyntax:!0,enableExperimentalComponentSyntax:!0,enableExperimentalDecorators:!0,enableExperimentalFlowRecordSyntax:!0};function my(A){let{message:g,loc:I}=A;if(!I)return A;let{line:B,column:C}=I,Q=` (${B}:${C})`;return g.endsWith(Q)&&(g=g.slice(0,-Q.length)),TC(g,{loc:{start:{line:B,column:C+1}},cause:A})}function fy(A,g){let I=g?.filepath,B=typeof I=="string"?I:"prettier.js.flow",C;try{C=(0,GQ.parse)(A,{sourceFilename:B,...dy})}catch(Q){throw my(Q)}return CQ(C,{text:A,astType:"flow"})}var Ty=yQ(fy);return yE(Py);});
@@ -0,0 +1,53 @@
import { CompareKeys } from '@vitest/pretty-format';
/**
* 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.
*/
type DiffOptionsColor = (arg: string) => string;
interface DiffOptions {
aAnnotation?: string;
aColor?: DiffOptionsColor;
aIndicator?: string;
bAnnotation?: string;
bColor?: DiffOptionsColor;
bIndicator?: string;
changeColor?: DiffOptionsColor;
changeLineTrailingSpaceColor?: DiffOptionsColor;
commonColor?: DiffOptionsColor;
commonIndicator?: string;
commonLineTrailingSpaceColor?: DiffOptionsColor;
contextLines?: number;
emptyFirstOrLastLinePlaceholder?: string;
expand?: boolean;
includeChangeCounts?: boolean;
omitAnnotationLines?: boolean;
patchColor?: DiffOptionsColor;
printBasicPrototype?: boolean;
maxDepth?: number;
compareKeys?: CompareKeys;
truncateThreshold?: number;
truncateAnnotation?: string;
truncateAnnotationColor?: DiffOptionsColor;
}
interface SerializedDiffOptions {
aAnnotation?: string;
aIndicator?: string;
bAnnotation?: string;
bIndicator?: string;
commonIndicator?: string;
contextLines?: number;
emptyFirstOrLastLinePlaceholder?: string;
expand?: boolean;
includeChangeCounts?: boolean;
omitAnnotationLines?: boolean;
printBasicPrototype?: boolean;
maxDepth?: number;
truncateThreshold?: number;
truncateAnnotation?: string;
}
export type { DiffOptions as D, SerializedDiffOptions as S, DiffOptionsColor as a };
@@ -0,0 +1 @@
{"version":3,"file":"circle-check.js","sources":["../../../src/icons/circle-check.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CircleCheck\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8cGF0aCBkPSJtOSAxMiAyIDIgNC00IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/circle-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 CircleCheck = createLucideIcon('CircleCheck', [\n ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],\n ['path', { d: 'm9 12 2 2 4-4', key: 'dzmm74' }],\n]);\n\nexport default CircleCheck;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAClD,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,CAAA,CAAM,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACzD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,215 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
//#region src/utils/url.ts
const splitPath = (path) => {
const paths = path.split("/");
if (paths[0] === "") paths.shift();
return paths;
};
const splitRoutingPath = (routePath) => {
const { groups, path } = extractGroupsFromPath(routePath);
const paths = splitPath(path);
return replaceGroupMarks(paths, groups);
};
const extractGroupsFromPath = (path) => {
const groups = [];
path = path.replace(/\{[^}]+\}/g, (match, index) => {
const mark = `@${index}`;
groups.push([mark, match]);
return mark;
});
return {
groups,
path
};
};
const replaceGroupMarks = (paths, groups) => {
for (let i = groups.length - 1; i >= 0; i--) {
const [mark] = groups[i];
for (let j = paths.length - 1; j >= 0; j--) if (paths[j].includes(mark)) {
paths[j] = paths[j].replace(mark, groups[i][1]);
break;
}
}
return paths;
};
const patternCache = {};
const getPattern = (label, next) => {
if (label === "*") return "*";
const match = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
if (match) {
const cacheKey = `${label}#${next}`;
if (!patternCache[cacheKey]) {
if (match[2]) patternCache[cacheKey] = next && next[0] !== ":" && next[0] !== "*" ? [
cacheKey,
match[1],
new RegExp(`^${match[2]}(?=/${next})`)
] : [
label,
match[1],
new RegExp(`^${match[2]}$`)
];
else patternCache[cacheKey] = [
label,
match[1],
true
];
}
return patternCache[cacheKey];
}
return null;
};
const tryDecode = (str, decoder) => {
try {
return decoder(str);
} catch {
return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {
try {
return decoder(match);
} catch {
return match;
}
});
}
};
/**
* Try to apply decodeURI() to given string.
* If it fails, skip invalid percent encoding or invalid UTF-8 sequences, and apply decodeURI() to the rest as much as possible.
* @param str The string to decode.
* @returns The decoded string that sometimes contains undecodable percent encoding.
* @example
* tryDecodeURI('Hello%20World') // 'Hello World'
* tryDecodeURI('Hello%20World/%A4%A2') // 'Hello World/%A4%A2'
*/
const tryDecodeURI = (str) => tryDecode(str, decodeURI);
const getPath = (request) => {
const url = request.url;
const start = url.indexOf("/", url.indexOf(":") + 4);
let i = start;
for (; i < url.length; i++) {
const charCode = url.charCodeAt(i);
if (charCode === 37) {
const queryIndex = url.indexOf("?", i);
const hashIndex = url.indexOf("#", i);
const end = queryIndex === -1 ? hashIndex === -1 ? void 0 : hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);
const path = url.slice(start, end);
return tryDecodeURI(path.includes("%25") ? path.replace(/%25/g, "%2525") : path);
} else if (charCode === 63 || charCode === 35) break;
}
return url.slice(start, i);
};
/**
* @deprecated
* Use the `URL` API instead.
*/
const getQueryStrings = (url) => {
const queryIndex = url.indexOf("?", 8);
if (queryIndex === -1) return "";
const hashIndex = url.indexOf("#", 8);
return hashIndex === -1 ? url.slice(queryIndex) : queryIndex < hashIndex ? url.slice(queryIndex, hashIndex) : "";
};
const getPathNoStrict = (request) => {
const result = getPath(request);
return result.length > 1 && result.at(-1) === "/" ? result.slice(0, -1) : result;
};
/**
* Merge paths.
* @param {string[]} ...paths - The paths to merge.
* @returns {string} The merged path.
* @example
* mergePath('/api', '/users') // '/api/users'
* mergePath('/api/', '/users') // '/api/users'
* mergePath('/api', '/') // '/api'
* mergePath('/api/', '/') // '/api/'
*/
const mergePath = (base, sub, ...rest) => {
if (rest.length) sub = mergePath(sub, ...rest);
return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`;
};
const checkOptionalParameter = (path) => {
if (path.charCodeAt(path.length - 1) !== 63 || !path.includes(":")) return null;
const segments = path.split("/");
const results = [];
let basePath = "";
segments.forEach((segment) => {
if (segment !== "" && !/\:/.test(segment)) basePath += "/" + segment;
else if (/\:/.test(segment)) {
if (segment.charCodeAt(segment.length - 1) === 63) {
if (results.length === 0 && basePath === "") results.push("/");
else results.push(basePath);
const optionalSegment = segment.slice(0, -1);
basePath += "/" + optionalSegment;
results.push(basePath);
} else basePath += "/" + segment;
}
});
return results.filter((v, i, a) => a.indexOf(v) === i);
};
const tryDecodeURIComponent = (str) => str.indexOf("%") !== -1 ? tryDecode(str, decodeURIComponent_) : str;
const _decodeURI = (value) => {
if (value.indexOf("+") !== -1) value = value.replace(/\+/g, " ");
return tryDecodeURIComponent(value);
};
const _getQueryParam = (url, key, multiple) => {
const hashIndex = url.indexOf("#", 8);
if (hashIndex !== -1) url = url.slice(0, hashIndex);
let encoded;
if (!multiple && key && key.indexOf("%") === -1 && key.indexOf("+") === -1) {
let keyIndex = url.indexOf("?", 8);
if (keyIndex === -1) return;
if (!url.startsWith(key, keyIndex + 1)) keyIndex = url.indexOf(`&${key}`, keyIndex + 1);
while (keyIndex !== -1) {
const trailingKeyCode = url.charCodeAt(keyIndex + key.length + 1);
if (trailingKeyCode === 61) {
const valueIndex = keyIndex + key.length + 2;
const endIndex = url.indexOf("&", valueIndex);
return _decodeURI(url.slice(valueIndex, endIndex === -1 ? void 0 : endIndex));
} else if (trailingKeyCode == 38 || isNaN(trailingKeyCode)) return "";
keyIndex = url.indexOf(`&${key}`, keyIndex + 1);
}
encoded = /[%+]/.test(url);
if (!encoded) return;
}
const results = Object.create(null);
encoded ??= /[%+]/.test(url);
let keyIndex = url.indexOf("?", 8);
while (keyIndex !== -1) {
const nextKeyIndex = url.indexOf("&", keyIndex + 1);
let valueIndex = url.indexOf("=", keyIndex);
if (valueIndex > nextKeyIndex && nextKeyIndex !== -1) valueIndex = -1;
let name = url.slice(keyIndex + 1, valueIndex === -1 ? nextKeyIndex === -1 ? void 0 : nextKeyIndex : valueIndex);
if (encoded) name = _decodeURI(name);
keyIndex = nextKeyIndex;
if (name === "") continue;
let value;
if (valueIndex === -1) value = "";
else {
value = url.slice(valueIndex + 1, nextKeyIndex === -1 ? void 0 : nextKeyIndex);
if (encoded) value = _decodeURI(value);
}
if (multiple) {
if (!(results[name] && Array.isArray(results[name]))) results[name] = [];
results[name].push(value);
} else results[name] ??= value;
}
return key ? results[key] : results;
};
const getQueryParam = _getQueryParam;
const getQueryParams = (url, key) => {
return _getQueryParam(url, key, true);
};
const decodeURIComponent_ = decodeURIComponent;
//#endregion
exports.checkOptionalParameter = checkOptionalParameter;
exports.decodeURIComponent_ = decodeURIComponent_;
exports.getPath = getPath;
exports.getPathNoStrict = getPathNoStrict;
exports.getPattern = getPattern;
exports.getQueryParam = getQueryParam;
exports.getQueryParams = getQueryParams;
exports.getQueryStrings = getQueryStrings;
exports.mergePath = mergePath;
exports.splitPath = splitPath;
exports.splitRoutingPath = splitRoutingPath;
exports.tryDecode = tryDecode;
exports.tryDecodeURI = tryDecodeURI;
exports.tryDecodeURIComponent = tryDecodeURIComponent;
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,4CAAmB;AACnB,uCAAmC;AAEnC,MAAM,MAAM,GAAG,YAAE,CAAC,MAAM,CAAA;AAExB,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AACzB,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;AACrC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;AAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;AACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;AAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AAcnC,MAAa,UAAW,SAAQ,mBAI/B;IACC,CAAC,QAAQ,CAAC,GAAY,KAAK,CAAC;IAC5B,CAAC,GAAG,CAAC,CAAU;IACf,CAAC,KAAK,CAAC,CAAS;IAChB,CAAC,SAAS,CAAC,CAAS;IACpB,CAAC,QAAQ,CAAC,GAAY,KAAK,CAAC;IAC5B,CAAC,KAAK,CAAC,CAAS;IAChB,CAAC,OAAO,CAAC,CAAS;IAClB,CAAC,UAAU,CAAC,CAAS;IAErB,YAAY,IAAY,EAAE,GAAsB;QAC9C,GAAG,GAAG,GAAG,IAAI,EAAE,CAAA;QACf,KAAK,CAAC,GAAG,CAAC,CAAA;QAEV,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACpB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;QAErB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAA;QAC9C,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAA;QACtB,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QAC3D,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;QAClB,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;QAClD,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAA;QACtB,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAA;QAChE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;QAC3B,IAAI,CAAC,UAAU,CAAC;YACd,OAAO,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA;QAE3D,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;YAClC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;QACf,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;QACf,CAAC;IACH,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;IAClB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;IAED,YAAY;IACZ,KAAK;QACH,MAAM,IAAI,SAAS,CAAC,2BAA2B,CAAC,CAAA;IAClD,CAAC;IAED,YAAY;IACZ,GAAG;QACD,MAAM,IAAI,SAAS,CAAC,2BAA2B,CAAC,CAAA;IAClD,CAAC;IAED,CAAC,KAAK,CAAC;QACL,YAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,CAAC,OAAO,CAAC,CAAC,EAAiC,EAAE,EAAW;QACtD,IAAI,EAAE,EAAE,CAAC;YACP,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAA;QACpB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;YACd,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAY,CAAC,CAAA;YAC/B,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;QACf,CAAC;IACH,CAAC;IAED,CAAC,QAAQ,CAAC;QACR,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACrE,CAAC;IAED,CAAC,KAAK,CAAC;QACL,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;YACrB,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAA;YAC5B,qBAAqB;YACrB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACrB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;YAC5D,CAAC;YACD,oBAAoB;YACpB,YAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAW,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CACnE,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CACzB,CAAA;QACH,CAAC;IACH,CAAC;IAED,CAAC,OAAO,CAAC,CAAC,EAAiC,EAAE,EAAW,EAAE,GAAY;QACpE,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAA;QACtB,IAAI,EAAE,EAAE,CAAC;YACP,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAA;QACpB,CAAC;aAAM,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,EAAY,EAAE,GAAa,CAAC,EAAE,CAAC;YAC3D,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;QACf,CAAC;IACH,CAAC;IAED,CAAC,MAAM,CAAC;QACN,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;YACpB,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA;YACrB,YAAE,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAChB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CACjD,CAAA;QACH,CAAC;IACH,CAAC;IAED,CAAC,QAAQ,CAAC,CAAC,EAAyB;QAClC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;QACrB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAA;Line truncated
@@ -0,0 +1 @@
{"version":3,"file":"step-forward.js","sources":["../../../src/icons/step-forward.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name StepForward\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8bGluZSB4MT0iNiIgeDI9IjYiIHkxPSI0IiB5Mj0iMjAiIC8+CiAgPHBvbHlnb24gcG9pbnRzPSIxMCw0IDIwLDEyIDEwLDIwIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/step-forward\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 StepForward = createLucideIcon('StepForward', [\n ['line', { x1: '6', x2: '6', y1: '4', y2: '20', key: 'fy8qot' }],\n ['polygon', { points: '10,4 20,12 10,20', key: '1mc1pf' }],\n]);\n\nexport default StepForward;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAClD,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC/D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAAE,QAAQ,CAAoB,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;AAC3D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"sanitize.mjs","sources":["../../../../../src/value/types/utils/sanitize.ts"],"sourcesContent":["// If this number is a decimal, make it just five decimal places\n// to avoid exponents\nexport const sanitize = (v: number) => Math.round(v * 100000) / 100000\n"],"names":[],"mappings":"AAAA;AACA;AACO,MAAM,QAAQ,GAAG,CAAC,CAAS,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG;;;;"}
@@ -0,0 +1,17 @@
(function(f){function e(){var i=f();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.graphql=e()}})(function(){"use strict";var ae=Object.defineProperty;var Et=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var xt=Object.prototype.hasOwnProperty;var ce=(e,t)=>{for(var n in t)ae(e,n,{get:t[n],enumerable:!0})},yt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Tt(t))!xt.call(e,i)&&i!==n&&ae(e,i,{get:()=>t[i],enumerable:!(r=Et(t,i))||r.enumerable});return e};var Nt=e=>yt(ae({},"__esModule",{value:!0}),e);var li={};ce(li,{languages:()=>$e,options:()=>He,parsers:()=>Ae,printers:()=>ui});var Ie=(e,t)=>(n,r,...i)=>n|1&&r==null?void 0:(t.call(r)??r[e]).apply(r,i);var Dt=String.prototype.replaceAll??function(e,t){return e.global?this.replace(e,t):this.split(e).join(t)},_t=Ie("replaceAll",function(){if(typeof this=="string")return Dt}),X=_t;var At=()=>{},pe=At;var ge="indent";var Se="group";var Oe="if-break";var H="line";var ve="break-parent";var O=pe,J=pe;function m(e){return O(e),{type:ge,contents:e}}var ue={type:ve};function N(e,t={}){return O(e),J(t.expandedStates,!0),{type:Se,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function _(e,t="",n={}){return O(e),t!==""&&O(t),{type:Oe,breakContents:e,flatContents:t,groupId:n.groupId}}function d(e,t){O(e),J(t);let n=[];for(let r=0;r<t.length;r++)r!==0&&n.push(e),n.push(t[r]);return n}var S={type:H},u={type:H,soft:!0},It={type:H,hard:!0},l=[It,ue];function W(e){return(t,n,r)=>{if(n===!1)return!1;let i=!!r?.backwards,{length:s}=t,a=n;for(;a>=0&&a<s;){let p=t.charAt(a);if(e instanceof RegExp){if(!e.test(p))return a}else if(!e.includes(p))return a;i?a--:a++}return a===-1||a===s?a:!1}}var wi=W(/\s/),z=W(" "),ke=W(",; "),Ce=W(/[^\n\r]/);var Re=e=>e===`
`||e==="\r"||e==="\u2028"||e==="\u2029";function gt(e,t,n){if(t===!1)return!1;let r=!!n?.backwards,i=e.charAt(t);if(r){if(e.charAt(t-1)==="\r"&&i===`
`)return t-2;if(Re(i))return t-1}else{if(i==="\r"&&e.charAt(t+1)===`
`)return t+2;if(Re(i))return t+1}return t}var Z=gt;function St(e,t,n={}){let r=z(e,n.backwards?t-1:t,n),i=Z(e,r,n);return r!==i}var Le=St;var Ot=()=>!0;function vt(e,t){let n=e.node;return n.printed=!0,t.printer.printComment(e,t)}function le(e,t,n={}){let{indent:r=!1,marker:i,filter:s=Ot}=n,a=new Set(e.node?.comments?.filter(x=>!(x.leading||x.trailing||x.marker!==i||!s(x))));if(a.size===0)return"";let p=e.map(({node:x})=>a.has(x)?vt(e,t):"","comments").filter(Boolean),E=d(l,p);return r?m([l,E]):E}function kt(e){return Array.isArray(e)&&e.length>0}var T=kt;var de=class extends Error{name="UnexpectedNodeError";constructor(t,n,r="type"){super(`Unexpected ${n} node ${r}: ${JSON.stringify(t[r])}.`),this.node=t}},be=de;var K=null;function j(e){if(K!==null&&typeof K.property){let t=K;return K=j.prototype=null,t}return K=j.prototype=e??Object.create(null),new j}var Ct=10;for(let e=0;e<=Ct;e++)j();function fe(e){return j(e)}function Rt(e,t="type"){fe(e);function n(r){let i=r[t],s=e[i];if(!Array.isArray(s))throw Object.assign(new Error(`Missing visitor keys for '${i}'.`),{node:r});return s}return n}var Fe=Rt;var D=[["name"],["name","value"],["type"],["description","name","directives"],["description","name","interfaces","directives","fields"],["name","directives"],["name","interfaces","directives","fields"]],Pe={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:D[0],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:D[1],FragmentArgument:D[1],FragmentSpread:["name","arguments","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:D[1],Directive:["name","arguments"],NamedType:D[0],ListType:D[2],NonNullType:D[2],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:D[2],ScalarTypeDefinition:D[3],ObjectTypeDefinition:D[4],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:D[4],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:D[3],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","directives","locations"],SchemaExtension:["directives","operationTypes"],DirectiveExtension:D[5],ScalarTypeExtension:D[5],ObjectTypeExtension:D[6],InterfaceTypeExtension:D[6],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};var Lt=Fe(Pe,"kind"),we=Lt;var ee=e=>e.loc.start,te=e=>e.loc.end;function me(e,t){e.kind==="StringValue"&&e.block&&!e.value.includes(`
`)&&(t.value=e.value.trim())}me.ignoredProperties=new Set(["loc","comments"]);var Ve="format",Me=/^\s*#[^\S\n]*@(?:noformat|noprettier)\s*(?:\n|$)/,Ue=/^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/;var Be=e=>Ue.test(e),Ge=e=>Me.test(e),Ke=e=>`# @${Ve}
${e}`;function bt(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let n=t+2;n<e.length;++n)if(e.charAt(n)==="*"&&e.charAt(n+1)==="/")return n+2}return t}var je=bt;function Ft(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?Ce(e,t):t}var Ye=Ft;function Pt(e,t){let n=null,r=t;for(;r!==n;)n=r,r=ke(e,r),r=je(e,r),r=z(e,r);return r=Ye(e,r),r=Z(e,r),r!==!1&&Le(e,r)}var qe=Pt;function I(e,t,n,r){return e.map(({isLast:i,node:s})=>{let a=n();return!i&&qe(t.originalText,te(s))?[a,l]:a},r)}function he(e,t,n){let{node:r}=e;return T(r.arguments)?N(["(",m([u,d([_("",", "),u],I(e,t,n,"arguments"))]),u,")"]):""}function A(e,t,n){let{node:r}=e;if(!r.description)return"";let i=[n("description")];return r.kind==="InputValueDefinition"&&!r.description.block?i.push(S):i.push(l),i}function y(e,t){let{node:n}=e;if(!T(n.directives))return"";let r=d(S,e.map(t,"directives"));return n.kind==="FragmentDefinition"||n.kind==="OperationDefinition"?N([S,r]):[" ",N(m([u,r]))]}function Ee(e,t){let{node:n}=e;return T(n.variableDefinitions)?N(["(",m([u,d([_("",", "),u],e.map(t,"variableDefinitions"))]),u,")"]):""}function wt(e,t,n){let{node:r}=e;switch(r.kind){case"Document":return[...d(l,I(e,t,n,"definitions")),l];case"OperationDefinition":{let i=t.originalText[ee(r)]!=="{",s=!!r.name;return[A(e,t,n),i?r.operation:"",i&&s?[" ",n("name")]:"",i&&!s&&T(r.variableDefinitions)?" ":"",Ee(e,n),y(e,n),!i&&!s?"":" ",n("selectionSet")]}case"FragmentDefinition":return[A(e,t,n),"fragment ",n("name"),Ee(e,n)," on ",n("typeCondition"),y(e,n)," ",n("selectionSet")];case"SelectionSet":return["{",m([l,d(l,I(e,t,n,"selections"))]),l,"}"];case"Field":return N([r.alias?[n("alias"),": "]:"",n("name"),T(r.arguments)?N(["(",m([u,d([_("",", "),u],I(e,t,n,"arguments"))]),u,")"]):"",y(e,n),r.selectionSet?" ":"",n("selectionSet")]);case"Name":return r.value;case"StringValue":if(r.block){let i=X(0,r.value,'"""','\\"""').split(`
`);return i.length===1&&(i[0]=i[0].trim()),i.every(s=>s==="")&&(i.length=0),d(l,['"""',...i,'"""'])}return['"',X(0,X(0,r.value,/["\\]/g,"\\$&"),`
`,"\\n"),'"'];case"IntValue":case"FloatValue":case"EnumValue":return r.value;case"BooleanValue":return r.value?"true":"false";case"NullValue":return"null";case"Variable":return["$",n("name")];case"ListValue":{let i=!T(r.values);return N(["[",le(e,t,{indent:!0}),i?"":m([u,d([_("",", "),u],e.map(n,"values"))]),u,"]"])}case"ObjectValue":{let i=!T(r.fields),s=t.bracketSpacing&&!i?" ":"";return N(["{",s,le(e,t,{indent:!0}),i?"":[m([u,d([_("",", "),u],e.map(n,"fields"))])],u,_("",s),"}"])}case"ObjectField":case"Argument":case"FragmentArgument":return[n("name"),": ",n("value")];case"Directive":return["@",n("name"),he(e,t,n)];case"NamedType":return n("name");case"VariableDefinition":return[A(e,t,n),n("variable"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",y(e,n)];case"ObjectTypeExtension":case"ObjectTypeDefinition":case"InputObjectTypeExtension":case"InputObjectTypeDefinition":case"InterfaceTypeExtension":case"InterfaceTypeDefinition":{let{kind:i}=r,s=[];return i.endsWith("TypeDefinition")?s.push(A(e,t,n)):s.push("extend "),i.startsWith("ObjectType")?s.push("type"):i.startsWith("InputObjectType")?s.push("input"):s.push("interface"),s.push(" ",n("name")),!i.startsWith("InputObjectType")&&T(r.interfaces)&&s.push(" implements ",m([N([d([" &",S],e.map(n,"interfaces"))])])),s.push(y(e,n)),T(r.fields)&&s.push([" {",m([l,d(l,I(e,t,n,"fields"))]),l,"}"]),s}case"FieldDefinition":return[A(e,t,n),n("name"),T(r.arguments)?N(["(",m([u,d([_("",", "),u],I(e,t,n,"arguments"))]),u,")"]):"",": ",n("type"),y(e,n)];case"DirectiveDefinition":return[A(e,t,n),"directive ","@",n("name"),T(r.arguments)?N(["(",m([u,d([_("",", "),u],I(e,t,n,"arguments"))]),u,")"]):"",y(e,n),r.repeatable?" repeatable":""," on ",...d(" | ",e.map(n,"locations"))];case"DirectiveExtension":return["extend directive @",n("name"),y(e,n)];case"EnumTypeExtension":case"EnumTypeDefinition":return[A(e,t,n),r.kind==="EnumTypeExtension"?"extend ":"","enum ",n("name"),y(e,n),T(r.values)?[" {",m([l,d(l,I(e,t,n,"values"))]),l,"}"]:""];case"EnumValueDefinition":return[A(e,t,n),n("name"),y(e,n)];case"InputValueDefinition":return[A(e,t,n),n("name"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",y(e,n)];case"SchemaExtension":return["extend schema",y(e,n),...T(r.operationTypes)?[" {",m([l,d(l,I(e,t,n,"operationTypes"))]),l,"}"]:[]];case"SchemaDefinition":return[A(e,t,n),"schema",y(e,n)," {",T(r.operationTypes)?m([l,d(l,I(e,t,n,"operationTypes"))]):"",l,"}"];case"OperationTypeDefinition":return[r.operation,": ",n("type")];case"FragmentSpread":return["...",n("name"),he(e,t,n),y(e,n)];case"InlineFragment":return["...",r.typeCondition?[" on ",n("typeCondition")]:"",y(e,n)," ",n("selectionSet")];case"UnionTypeExtension":case"UnionTypeDefinition":return N([A(e,t,n),N([r.kind==="UnionTypeExtension"?"extend ":"","union ",n("name"),y(e,n),T(r.types)?[" =",_(""," "),m([_([S,"| "]),d([S,"| "],e.map(n,"types"))])]:""])]);case"ScalarTypeExtension":case"ScalarTypeDefinition":return[A(e,t,n),r.kind==="ScalarTypeExtension"?"extend ":"","scalar ",n("name"),y(e,n)];case"NonNullType":return[n("type"),"!"];case"ListType":return["[",n("type"),"]"];default:throw new be(r,"Graphql","kind")}}function Vt(e){return e.kind!=="Comment"}function Mt({node:e}){if(e.kind==="Comment")return"#"+e.value.trimEnd();throw new Error("Not a comment: "+JSON.stringify(e))}function Ut(e){let{node:t}=e;return t?.comments?.some(n=>n.value.trim()==="prettier-ignore")}var Bt={print:wt,massageAstNode:me,hasPrettierIgnore:Ut,insertPragma:Ke,printComment:Mt,canAttachComment:Vt,getVisitorKeys:we},Qe=Bt;var $e=[{name:"GraphQL",type:"data",aceMode:"graphqlschema",extensions:[".graphql",".gql",".graphqls"],tmScope:"source.graphql",parsers:["graphql"],vscodeLanguageIds:["graphql"],linguistLanguageId:139}];var Xe={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var Gt={bracketSpacing:Xe.bracketSpacing},He=Gt;var Ae={};ce(Ae,{graLine truncated
`,v=r.split(/\r\n|[\n\r]/g),P=v[i];if(P.length>120){let $=Math.floor(E/80),G=E%80,k=[];for(let C=0;C<P.length;C+=80)k.push(P.slice(C,C+80));return x+Ze([[`${a} |`,k[0]],...k.slice(1,$+1).map(C=>["|",C]),["|","^".padStart(G)],["|",k[$+1]]])}return x+Ze([[`${a-1} |`,v[i-1]],[`${a} |`,P],["|","^".padStart(E)],[`${a+1} |`,v[i+1]]])}function Ze(e){let t=e.filter(([r,i])=>i!==void 0),n=Math.max(...t.map(([r])=>r.length));return t.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(`
`)}var R=class e extends Error{constructor(t,n={}){let{nodes:r,source:i,positions:s,path:a,originalError:p,cause:E,extensions:x}=n,v="cause"in n,P=v?E:p,$=v||p!=null?{cause:P}:void 0;super(t,$),this.name="GraphQLError",this.path=a??void 0;let G=p??(E instanceof Error?E:void 0);this.originalError=G,this.nodes=et(Array.isArray(r)?r:r?[r]:void 0);let k=et(this.nodes?.map(g=>g.loc).filter(g=>g!=null));this.source=i??k?.[0]?.source,this.positions=s??k?.map(g=>g.start),this.locations=s&&i?s.map(g=>w(i,g)):k?.map(g=>w(g.source,g.start));let C=We(G?.extensions)?G.extensions:void 0;this.extensions=x??C??Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),p?.stack!=null?Object.defineProperty(this,"stack",{value:p.stack,writable:!0,configurable:!0}):Error.captureStackTrace!=null?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(let n of this.nodes)n.loc&&(t+=`
`+Te(n.loc));else if(this.source&&this.locations)for(let n of this.locations)t+=`
`+ne(this.source,n);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}};function et(e){return e===void 0||e.length===0?void 0:e}var Yt=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),tt=Yt;var Y=class{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},V=class{constructor(t,n,r,i,s,a){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}};var M={QUERY:"query",MUTATION:"mutation",SUBSCRIPTION:"subscription"};var c={};ce(c,{ARGUMENT:()=>Wt,ARGUMENT_COORDINATE:()=>Un,BOOLEAN:()=>an,DIRECTIVE:()=>fn,DIRECTIVE_ARGUMENT_COORDINATE:()=>Gn,DIRECTIVE_COORDINATE:()=>Bn,DIRECTIVE_DEFINITION:()=>vn,DIRECTIVE_EXTENSION:()=>Cn,DOCUMENT:()=>Qt,ENUM:()=>pn,ENUM_TYPE_DEFINITION:()=>gn,ENUM_TYPE_EXTENSION:()=>Pn,ENUM_VALUE_DEFINITION:()=>Sn,FIELD:()=>Jt,FIELD_DEFINITION:()=>Dn,FLOAT:()=>sn,FRAGMENT_ARGUMENT:()=>zt,FRAGMENT_DEFINITION:()=>tn,FRAGMENT_SPREAD:()=>Zt,INLINE_FRAGMENT:()=>en,INPUT_OBJECT_TYPE_DEFINITION:()=>On,INPUT_OBJECT_TYPE_EXTENSION:()=>wn,INPUT_VALUE_DEFINITION:()=>_n,INT:()=>rn,INTERFACE_TYPE_DEFINITION:()=>An,INTERFACE_TYPE_EXTENSION:()=>bn,LIST:()=>un,LIST_TYPE:()=>hn,MEMBER_COORDINATE:()=>Mn,NAME:()=>qt,NAMED_TYPE:()=>mn,NON_NULL_TYPE:()=>En,NULL:()=>cn,OBJECT:()=>ln,OBJECT_FIELD:()=>dn,OBJECT_TYPE_DEFINITION:()=>Nn,OBJECT_TYPE_EXTENSION:()=>Ln,OPERATION_DEFINITION:()=>$t,OPERATION_TYPE_DEFINITION:()=>xn,SCALAR_TYPE_DEFINITION:()=>yn,SCALAR_TYPE_EXTENSION:()=>Rn,SCHEMA_DEFINITION:()=>Tn,SCHEMA_EXTENSION:()=>kn,SELECTION_SET:()=>Ht,STRING:()=>on,TYPE_COORDINATE:()=>Vn,UNION_TYPE_DEFINITION:()=>In,UNION_TYPE_EXTENSION:()=>Fn,VARIABLE:()=>nn,VARIABLE_DEFINITION:()=>Xt});var qt="Name",Qt="Document",$t="OperationDefinition",Xt="VariableDefinition",Ht="SelectionSet",Jt="Field",Wt="Argument",zt="FragmentArgument",Zt="FragmentSpread",en="InlineFragment",tn="FragmentDefinition",nn="Variable",rn="IntValue",sn="FloatValue",on="StringValue",an="BooleanValue",cn="NullValue",pn="EnumValue",un="ListValue",ln="ObjectValue",dn="ObjectField",fn="Directive",mn="NamedType",hn="ListType",En="NonNullType",Tn="SchemaDefinition",xn="OperationTypeDefinition",yn="ScalarTypeDefinition",Nn="ObjectTypeDefinition",Dn="FieldDefinition",_n="InputValueDefinition",An="InterfaceTypeDefinition",In="UnionTypeDefinition",gn="EnumTypeDefinition",Sn="EnumValueDefinition",On="InputObjectTypeDefinition",vn="DirectiveDefinition",kn="SchemaExtension",Cn="DirectiveExtension",Rn="ScalarTypeExtension",Ln="ObjectTypeExtension",bn="InterfaceTypeExtension",Fn="UnionTypeExtension",Pn="EnumTypeExtension",wn="InputObjectTypeExtension",Vn="TypeCoordinate",Mn="MemberCoordinate",Un="ArgumentCoordinate",Bn="DirectiveCoordinate",Gn="DirectiveArgumentCoordinate";function xe(e,t){if(!e)throw new Error(t)}function nt(e){return e===9||e===32}function L(e){return e>=48&&e<=57}function it(e){return e>=97&&e<=122||e>=65&&e<=90}function ye(e){return it(e)||e===95}function rt(e){return it(e)||L(e)||e===95}function st(e){let t=Number.MAX_SAFE_INTEGER,n=null,r=-1;for(let i=0;i<e.length;++i){let s=e[i],a=Kn(s);a!==s.length&&(n??(n=i),r=i,i!==0&&a<t&&(t=a))}return e.map((i,s)=>s===0?i:i.slice(t)).slice(n??0,r+1)}function Kn(e){let t=0;for(;t<e.length&&nt(e.charCodeAt(t));)++t;return t}var Ne={QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",FRAGMENT_VARIABLE_DEFINITION:"FRAGMENT_VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION",DIRECTIVE_DEFINITION:"DIRECTIVE_DEFINITION"};function f(e,t,n){return new R(`Syntax Error: ${n}`,{source:e,positions:[t]})}function jn(){let e;try{let t=globalThis.process;typeof t?.getBuiltinModule=="function"&&(e=t.getBuiltinModule("node:diagnostics_channel"))}catch{}return e}var b=jn(),De=b?.tracingChannel("graphql:parse"),Ts=b?.tracingChannel("graphql:validate"),xs=b?.tracingChannel("graphql:execute"),ys=b?.tracingChannel("graphql:execute:variableCoercion"),Ns=b?.tracingChannel("graphql:execute:rootSelectionSet"),Ds=b?.tracingChannel("graphql:subscribe"),_s=b?.tracingChannel("graphql:resolve"),Yn=["start","end","asyncStart","asyncEnd","error"];function ot(e){if(e==null)return!1;let t=e.hasSubscribers;if(t!==vLine truncated
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw f(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function zn(e,t){let n=e.source.body,r=n.length,i=e.lineStart,s=t+3,a=s,p="",E=[];for(;s<r;){let x=n.charCodeAt(s);if(x===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){p+=n.slice(a,s),E.push(p);let v=h(e,o.BLOCK_STRING,t,s+3,st(E).join(`
`));return e.line+=E.length-1,e.lineStart=i,v}if(x===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){p+=n.slice(a,s),a=s+1,s+=4;continue}if(x===10||x===13){p+=n.slice(a,s),E.push(p),x===13&&n.charCodeAt(s+1)===10?s+=2:++s,p="",a=s,i=s;continue}if(U(x))++s;else if(re(n,s))s+=2;else throw f(e.source,s,`Invalid character within String: ${F(e,s)}.`)}throw f(e.source,s,"Unterminated string.")}function Zn(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(rt(s))++i;else break}return h(e,o.NAME,t,i,n.slice(t,i))}var lt=Symbol("Source"),B=class{constructor(t,n="GraphQL request",r={line:1,column:1}){this.__kind=lt,this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||xe(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||xe(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function dt(e){return Je(e,lt,B)}function oe(e,t){return ot(De)?De.traceSync(()=>ft(e,t),{source:e}):ft(e,t)}function ft(e,t){let n=new _e(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}var _e=class{constructor(t,n={}){let{lexer:r,...i}=n;if(r)this._lexer=r;else{let s=dt(t)?t:new B(t);this._lexer=new Q(s)}this._options=i,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===o.BRACE_L)throw f(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===o.NAME){switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw f(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(n.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:M.QUERY,description:void 0,name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),r=this.parseOperationType(),i;return this.peek(o.NAME)&&(i=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:r,description:n,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return M.QUERY;case"mutation":return M.MUTATION;case"subscription":return M.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),r,i;return this.expectOptionalToken(o.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:c.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseFragmentArguments(){let t=this.parseFragmentArgument;return this.optionalMany(o.PAREN_L,t,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:r,value:this.parseValueLiteLine truncated
@@ -0,0 +1,453 @@
/**
* @fileoverview A rule to verify `super()` callings in constructor.
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Checks whether or not a given node is a constructor.
* @param {ASTNode} node A node to check. This node type is one of
* `Program`, `FunctionDeclaration`, `FunctionExpression`, and
* `ArrowFunctionExpression`.
* @returns {boolean} `true` if the node is a constructor.
*/
function isConstructorFunction(node) {
return (
node.type === "FunctionExpression" &&
node.parent.type === "MethodDefinition" &&
node.parent.kind === "constructor"
);
}
/**
* Checks whether a given node can be a constructor or not.
* @param {ASTNode} node A node to check.
* @returns {boolean} `true` if the node can be a constructor.
*/
function isPossibleConstructor(node) {
if (!node) {
return false;
}
switch (node.type) {
case "ClassExpression":
case "FunctionExpression":
case "ThisExpression":
case "MemberExpression":
case "CallExpression":
case "NewExpression":
case "ChainExpression":
case "YieldExpression":
case "TaggedTemplateExpression":
case "MetaProperty":
return true;
case "Identifier":
return node.name !== "undefined";
case "AssignmentExpression":
if (["=", "&&="].includes(node.operator)) {
return isPossibleConstructor(node.right);
}
if (["||=", "??="].includes(node.operator)) {
return (
isPossibleConstructor(node.left) ||
isPossibleConstructor(node.right)
);
}
/**
* All other assignment operators are mathematical assignment operators (arithmetic or bitwise).
* An assignment expression with a mathematical operator can either evaluate to a primitive value,
* or throw, depending on the operands. Thus, it cannot evaluate to a constructor function.
*/
return false;
case "LogicalExpression":
/*
* If the && operator short-circuits, the left side was falsy and therefore not a constructor, and if
* it doesn't short-circuit, it takes the value from the right side, so the right side must always be a
* possible constructor. A future improvement could verify that the left side could be truthy by
* excluding falsy literals.
*/
if (node.operator === "&&") {
return isPossibleConstructor(node.right);
}
return (
isPossibleConstructor(node.left) ||
isPossibleConstructor(node.right)
);
case "ConditionalExpression":
return (
isPossibleConstructor(node.alternate) ||
isPossibleConstructor(node.consequent)
);
case "SequenceExpression": {
const lastExpression = node.expressions.at(-1);
return isPossibleConstructor(lastExpression);
}
default:
return false;
}
}
/**
* A class to store information about a code path segment.
*/
class SegmentInfo {
/**
* Indicates if super() is called in all code paths.
* @type {boolean}
*/
calledInEveryPaths = false;
/**
* Indicates if super() is called in any code paths.
* @type {boolean}
*/
calledInSomePaths = false;
/**
* The nodes which have been validated and don't need to be reconsidered.
* @type {ASTNode[]}
*/
validNodes = [];
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "problem",
docs: {
description: "Require `super()` calls in constructors",
recommended: true,
url: "https://eslint.org/docs/latest/rules/constructor-super",
},
schema: [],
messages: {
missingSome: "Lacked a call of 'super()' in some code paths.",
missingAll: "Expected to call 'super()'.",
duplicate: "Unexpected duplicate 'super()'.",
badSuper:
"Unexpected 'super()' because 'super' is not a constructor.",
},
},
create(context) {
/*
* {{hasExtends: boolean, scope: Scope, codePath: CodePath}[]}
* Information for each constructor.
* - upper: Information of the upper constructor.
* - hasExtends: A flag which shows whether own class has a valid `extends`
* part.
* - scope: The scope of own class.
* - codePath: The code path object of the constructor.
*/
let funcInfo = null;
/**
* @type {Record<string, SegmentInfo>}
*/
const segInfoMap = Object.create(null);
/**
* Gets the flag which shows `super()` is called in some paths.
* @param {CodePathSegment} segment A code path segment to get.
* @returns {boolean} The flag which shows `super()` is called in some paths
*/
function isCalledInSomePath(segment) {
return (
segment.reachable && segInfoMap[segment.id].calledInSomePaths
);
}
/**
* Determines if a segment has been seen in the traversal.
* @param {CodePathSegment} segment A code path segment to check.
* @returns {boolean} `true` if the segment has been seen.
*/
function hasSegmentBeenSeen(segment) {
return !!segInfoMap[segment.id];
}
/**
* Gets the flag which shows `super()` is called in all paths.
* @param {CodePathSegment} segment A code path segment to get.
* @returns {boolean} The flag which shows `super()` is called in all paths.
*/
function isCalledInEveryPath(segment) {
return (
segment.reachable && segInfoMap[segment.id].calledInEveryPaths
);
}
return {
/**
* Stacks a constructor information.
* @param {CodePath} codePath A code path which was started.
* @param {ASTNode} node The current node.
* @returns {void}
*/
onCodePathStart(codePath, node) {
if (isConstructorFunction(node)) {
// Class > ClassBody > MethodDefinition > FunctionExpression
const classNode = node.parent.parent.parent;
const superClass = classNode.superClass;
funcInfo = {
upper: funcInfo,
isConstructor: true,
hasExtends: Boolean(superClass),
superIsConstructor: isPossibleConstructor(superClass),
codePath,
currentSegments: new Set(),
};
} else {
funcInfo = {
upper: funcInfo,
isConstructor: false,
hasExtends: false,
superIsConstructor: false,
codePath,
currentSegments: new Set(),
};
}
},
/**
* Pops a constructor information.
* And reports if `super()` lacked.
* @param {CodePath} codePath A code path which was ended.
* @param {ASTNode} node The current node.
* @returns {void}
*/
onCodePathEnd(codePath, node) {
const hasExtends = funcInfo.hasExtends;
// Pop.
funcInfo = funcInfo.upper;
if (!hasExtends) {
return;
}
// Reports if `super()` lacked.
const returnedSegments = codePath.returnedSegments;
const calledInEveryPaths =
returnedSegments.every(isCalledInEveryPath);
const calledInSomePaths =
returnedSegments.some(isCalledInSomePath);
if (!calledInEveryPaths) {
context.report({
messageId: calledInSomePaths
? "missingSome"
: "missingAll",
node: node.parent,
});
}
},
/**
* Initialize information of a given code path segment.
* @param {CodePathSegment} segment A code path segment to initialize.
* @param {CodePathSegment} node Node that starts the segment.
* @returns {void}
*/
onCodePathSegmentStart(segment, node) {
funcInfo.currentSegments.add(segment);
if (!(funcInfo.isConstructor && funcInfo.hasExtends)) {
return;
}
// Initialize info.
const info = (segInfoMap[segment.id] = new SegmentInfo());
const seenPrevSegments =
segment.prevSegments.filter(hasSegmentBeenSeen);
// When there are previous segments, aggregates these.
if (seenPrevSegments.length > 0) {
info.calledInSomePaths =
seenPrevSegments.some(isCalledInSomePath);
info.calledInEveryPaths =
seenPrevSegments.every(isCalledInEveryPath);
}
/*
* ForStatement > *.update segments are a special case as they are created in advance,
* without seen previous segments. Since they logically don't affect `calledInEveryPaths`
* calculations, and they can never be a lone previous segment of another one, we'll set
* their `calledInEveryPaths` to `true` to effectively ignore them in those calculations.
* .
*/
if (
node.parent &&
node.parent.type === "ForStatement" &&
node.parent.update === node
) {
info.calledInEveryPaths = true;
}
},
onUnreachableCodePathSegmentStart(segment) {
funcInfo.currentSegments.add(segment);
},
onUnreachableCodePathSegmentEnd(segment) {
funcInfo.currentSegments.delete(segment);
},
onCodePathSegmentEnd(segment) {
funcInfo.currentSegments.delete(segment);
},
/**
* Update information of the code path segment when a code path was
* looped.
* @param {CodePathSegment} fromSegment The code path segment of the
* end of a loop.
* @param {CodePathSegment} toSegment A code path segment of the head
* of a loop.
* @returns {void}
*/
onCodePathSegmentLoop(fromSegment, toSegment) {
if (!(funcInfo.isConstructor && funcInfo.hasExtends)) {
return;
}
funcInfo.codePath.traverseSegments(
{ first: toSegment, last: fromSegment },
(segment, controller) => {
const info = segInfoMap[segment.id];
// skip segments after the loop
if (!info) {
controller.skip();
return;
}
const seenPrevSegments =
segment.prevSegments.filter(hasSegmentBeenSeen);
const calledInSomePreviousPaths =
seenPrevSegments.some(isCalledInSomePath);
const calledInEveryPreviousPaths =
seenPrevSegments.every(isCalledInEveryPath);
info.calledInSomePaths ||= calledInSomePreviousPaths;
info.calledInEveryPaths ||= calledInEveryPreviousPaths;
// If flags become true anew, reports the valid nodes.
if (calledInSomePreviousPaths) {
const nodes = info.validNodes;
info.validNodes = [];
for (let i = 0; i < nodes.length; ++i) {
const node = nodes[i];
context.report({
messageId: "duplicate",
node,
});
}
}
},
);
},
/**
* Checks for a call of `super()`.
* @param {ASTNode} node A CallExpression node to check.
* @returns {void}
*/
"CallExpression:exit"(node) {
if (!(funcInfo.isConstructor && funcInfo.hasExtends)) {
return;
}
// Skips except `super()`.
if (node.callee.type !== "Super") {
return;
}
// Reports if needed.
const segments = funcInfo.currentSegments;
let duplicate = false;
let info = null;
for (const segment of segments) {
if (segment.reachable) {
info = segInfoMap[segment.id];
duplicate = duplicate || info.calledInSomePaths;
info.calledInSomePaths = info.calledInEveryPaths = true;
}
}
if (info) {
if (duplicate) {
context.report({
messageId: "duplicate",
node,
});
} else if (!funcInfo.superIsConstructor) {
context.report({
messageId: "badSuper",
node,
});
} else {
info.validNodes.push(node);
}
}
},
/**
* Set the mark to the returned path as `super()` was called.
* @param {ASTNode} node A ReturnStatement node to check.
* @returns {void}
*/
ReturnStatement(node) {
if (!(funcInfo.isConstructor && funcInfo.hasExtends)) {
return;
}
// Skips if no argument.
if (!node.argument) {
return;
}
// Returning argument is a substitute of 'super()'.
const segments = funcInfo.currentSegments;
for (const segment of segments) {
if (segment.reachable) {
const info = segInfoMap[segment.id];
info.calledInSomePaths = info.calledInEveryPaths = true;
}
}
},
};
},
};
@@ -0,0 +1,715 @@
/**
* The `node:dgram` module provides an implementation of UDP datagram sockets.
*
* ```js
* import dgram from 'node:dgram';
*
* const server = dgram.createSocket('udp4');
*
* server.on('error', (err) => {
* console.error(`server error:\n${err.stack}`);
* server.close();
* });
*
* server.on('message', (msg, rinfo) => {
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
* });
*
* server.on('listening', () => {
* const address = server.address();
* console.log(`server listening ${address.address}:${address.port}`);
* });
*
* server.bind(41234);
* // Prints: server listening 0.0.0.0:41234
* ```
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/dgram.js)
*/
declare module "dgram" {
import { NonSharedBuffer } from "node:buffer";
import { AddressInfo, BlockList } from "node:net";
import * as dns from "node:dns";
import { Abortable, EventEmitter } from "node:events";
interface RemoteInfo {
address: string;
family: "IPv4" | "IPv6";
port: number;
size: number;
}
interface BindOptions {
port?: number | undefined;
address?: string | undefined;
exclusive?: boolean | undefined;
fd?: number | undefined;
}
interface BindSyncOptions {
port?: number | undefined;
address?: string | undefined;
}
type SocketType = "udp4" | "udp6";
interface SocketOptions extends Abortable {
type: SocketType;
reuseAddr?: boolean | undefined;
reusePort?: boolean | undefined;
/**
* @default false
*/
ipv6Only?: boolean | undefined;
recvBufferSize?: number | undefined;
sendBufferSize?: number | undefined;
lookup?:
| ((
hostname: string,
options: dns.LookupOneOptions,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
) => void)
| undefined;
receiveBlockList?: BlockList | undefined;
sendBlockList?: BlockList | undefined;
}
/**
* Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
* messages. When `address` and `port` are not passed to `socket.bind()` the
* method will bind the socket to the "all interfaces" address on a random port
* (it does the right thing for both `udp4` and `udp6` sockets). The bound address
* and port can be retrieved using `socket.address().address` and `socket.address().port`.
*
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.close()` on the socket:
*
* ```js
* const controller = new AbortController();
* const { signal } = controller;
* const server = dgram.createSocket({ type: 'udp4', signal });
* server.on('message', (msg, rinfo) => {
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
* });
* // Later, when you want to close the server.
* controller.abort();
* ```
* @since v0.11.13
* @param options Available options are:
* @param callback Attached as a listener for `'message'` events. Optional.
*/
function createSocket(type: SocketType, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
function createSocket(options: SocketOptions, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
/**
* Encapsulates the datagram functionality.
*
* New instances of `dgram.Socket` are created using {@link createSocket}.
* The `new` keyword is not to be used to create `dgram.Socket` instances.
* @since v0.1.99
*/
class Socket extends EventEmitter {
/**
* Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not
* specified, the operating system will choose
* one interface and will add membership to it. To add membership to every
* available interface, call `addMembership` multiple times, once per interface.
*
* When called on an unbound socket, this method will implicitly bind to a random
* port, listening on all interfaces.
*
* When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
*
* ```js
* import cluster from 'node:cluster';
* import dgram from 'node:dgram';
*
* if (cluster.isPrimary) {
* cluster.fork(); // Works ok.
* cluster.fork(); // Fails with EADDRINUSE.
* } else {
* const s = dgram.createSocket('udp4');
* s.bind(1234, () => {
* s.addMembership('224.0.0.114');
* });
* }
* ```
* @since v0.6.9
*/
addMembership(multicastAddress: string, multicastInterface?: string): void;
/**
* Returns an object containing the address information for a socket.
* For UDP sockets, this object will contain `address`, `family`, and `port` properties.
*
* This method throws `EBADF` if called on an unbound socket.
* @since v0.1.99
*/
address(): AddressInfo;
/**
* For UDP sockets, causes the `dgram.Socket` to listen for datagram
* messages on a named `port` and optional `address`. If `port` is not
* specified or is `0`, the operating system will attempt to bind to a
* random port. If `address` is not specified, the operating system will
* attempt to listen on all addresses. Once binding is complete, a
* `'listening'` event is emitted and the optional `callback` function is
* called.
*
* Specifying both a `'listening'` event listener and passing a
* `callback` to the `socket.bind()` method is not harmful but not very
* useful.
*
* A bound datagram socket keeps the Node.js process running to receive
* datagram messages.
*
* If binding fails, an `'error'` event is generated. In rare case (e.g.
* attempting to bind with a closed socket), an `Error` may be thrown.
*
* Example of a UDP server listening on port 41234:
*
* ```js
* import dgram from 'node:dgram';
*
* const server = dgram.createSocket('udp4');
*
* server.on('error', (err) => {
* console.error(`server error:\n${err.stack}`);
* server.close();
* });
*
* server.on('message', (msg, rinfo) => {
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
* });
*
* server.on('listening', () => {
* const address = server.address();
* console.log(`server listening ${address.address}:${address.port}`);
* });
*
* server.bind(41234);
* // Prints: server listening 0.0.0.0:41234
* ```
* @since v0.1.99
* @param callback with no parameters. Called when binding is complete.
*/
bind(port?: number, address?: string, callback?: () => void): this;
bind(port: number, callback: () => void): this;
bind(callback: () => void): this;
/**
* For UDP sockets, causes the `dgram.Socket` to listen for datagram
* messages on a named `port` and optional `address` that are passed as
* properties of an `options` object passed as the first argument. If
* `port` is not specified or is `0`, the operating system will attempt
* to bind to a random port. If `address` is not specified, the operating
* system will attempt to listen on all addresses. Once binding is
* complete, a `'listening'` event is emitted and the optional `callback`
* function is called.
*
* The `options` object may contain a `fd` property. When a `fd` greater
* than `0` is set, it will wrap around an existing socket with the given
* file descriptor. In this case, the properties of `port` and `address`
* will be ignored.
*
* Specifying both a `'listening'` event listener and passing a
* `callback` to the `socket.bind()` method is not harmful but not very
* useful.
*
* The `options` object may contain an additional `exclusive` property that is
* used when using `dgram.Socket` objects with the [`cluster`](https://nodejs.org/docs/latest-v24.x/api/cluster.html) module. When
* `exclusive` is set to `false` (the default), cluster workers will use the same
* underlying socket handle allowing connection handling duties to be shared.
* When `exclusive` is `true`, however, the handle is not shared and attempted
* port sharing results in an error. Creating a `dgram.Socket` with the `reusePort`
* option set to `true` causes `exclusive` to always be `true` when `socket.bind()`
* is called.
*
* A bound datagram socket keeps the Node.js process running to receive
* datagram messages.
*
* If binding fails, an `'error'` event is generated. In rare case (e.g.
* attempting to bind with a closed socket), an `Error` may be thrown.
*
* An example socket listening on an exclusive port is shown below.
*
* ```js
* socket.bind({
* address: 'localhost',
* port: 8000,
* exclusive: true,
* });
* ```
* @since v0.11.14
* @param options Required. Supports the following properties:
*/
bind(options: BindOptions, callback?: () => void): this;
/**
* The synchronous counterpart of `socket.bind()`. `bind(2)` is a local,
* non-blocking system call, so the bind is performed inline and the resolved
* address is returned immediately, including the operating-system-assigned
* ephemeral port when `port` is `0`:
*
* ```js
* const dgram = require('node:dgram');
*
* const socket = dgram.createSocket('udp4');
* const address = socket.bindSync({ address: '0.0.0.0', port: 0 });
* console.log(address); // e.g. { address: '0.0.0.0', family: 'IPv4', port: 53124 }
* ```
*
* A bind failure such as `EADDRINUSE` is thrown synchronously rather than emitted
* as an `'error'` event. After `bindSync()` returns, `socket.address()` is
* valid synchronously and the `'listening'` event is emitted on the next tick.
*
* `address` must be a numeric IP literal; `bindSync()` never performs DNS
* resolution (asynchronous name resolution being the only genuinely blocking part
* of binding). Incoming datagrams continue to be delivered asynchronously via the
* `'message'` event. `bindSync()` always binds the socket's own handle and
* does not participate in [`cluster`](https://nodejs.org/docs/latest-v24.x/api/cluster.html) handle sharing.
* @since v24.19.0
* @returns The bound address as returned by `socket.address()`.
*/
bindSync(options?: BindSyncOptions): AddressInfo;
/**
* Close the underlying socket and stop listening for data on it. If a callback is
* provided, it is added as a listener for the `'close'` event.
* @since v0.1.99
* @param callback Called when the socket has been closed.
*/
close(callback?: () => void): this;
/**
* Associates the `dgram.Socket` to a remote address and port. Every
* message sent by this handle is automatically sent to that destination. Also,
* the socket will only receive messages from that remote peer.
* Trying to call `connect()` on an already connected socket will result
* in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not
* provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets)
* will be used by default. Once the connection is complete, a `'connect'` event
* is emitted and the optional `callback` function is called. In case of failure,
* the `callback` is called or, failing this, an `'error'` event is emitted.
* @since v12.0.0
* @param callback Called when the connection is completed or on error.
*/
connect(port: number, address?: string, callback?: () => void): void;
connect(port: number, callback: () => void): void;
/**
* The synchronous counterpart of `socket.connect()`. For a UDP socket
* `connect(2)` only records the default peer address and is a local, non-blocking
* system call, so the association is performed inline. Any error raised by the
* call itself (for example `EAFNOSUPPORT` for a mismatched address family) is
* thrown synchronously rather than reported via the `'error'` event. Because
* `connect(2)` does not probe reachability, errors such as `ECONNREFUSED` are
* still surfaced asynchronously on a later send or receive, exactly as for
* `socket.connect()`:
*
* ```js
* const dgram = require('node:dgram');
*
* const socket = dgram.createSocket('udp4');
* socket.connectSync(41234, '127.0.0.1');
* console.log(socket.remoteAddress()); // { address: '127.0.0.1', family: 'IPv4', port: 41234 }
* ```
*
* If the socket is still unbound it is bound synchronously first. After
* `connectSync()` returns, `socket.remoteAddress()` is valid synchronously
* and the `'connect'` event is emitted on the next tick. Trying to call
* `connectSync()` on an already connected socket throws an
* `ERR_SOCKET_DGRAM_IS_CONNECTED` exception, and calling it while an
* asynchronous `socket.bind()` is still in progress throws an
* `ERR_SOCKET_ALREADY_BOUND` exception.
*
* `address` must be a numeric IP literal; `connectSync()` never performs DNS
* resolution (asynchronous name resolution being the only genuinely blocking part
* of connecting).
* @since v24.19.0
* @param address A numeric IP address to connect to. Unlike
* `socket.connect()`, no DNS resolution is performed, so a host name is not
* accepted. If omitted, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for
* `udp6` sockets) is used.
*/
connectSync(port: number, address?: string): void;
/**
* A synchronous function that disassociates a connected `dgram.Socket` from
* its remote address. Trying to call `disconnect()` on an unbound or already
* disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception.
* @since v12.0.0
*/
disconnect(): void;
/**
* Instructs the kernel to leave a multicast group at `multicastAddress` using the `IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
* kernel when the socket is closed or the process terminates, so most apps will
* never have reason to call this.
*
* If `multicastInterface` is not specified, the operating system will attempt to
* drop membership on all valid interfaces.
* @since v0.6.9
*/
dropMembership(multicastAddress: string, multicastInterface?: string): void;
/**
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
* @since v8.7.0
* @return the `SO_RCVBUF` socket receive buffer size in bytes.
*/
getRecvBufferSize(): number;
/**
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
* @since v8.7.0
* @return the `SO_SNDBUF` socket send buffer size in bytes.
*/
getSendBufferSize(): number;
/**
* @since v18.8.0, v16.19.0
* @return Number of bytes queued for sending.
*/
getSendQueueSize(): number;
/**
* @since v18.8.0, v16.19.0
* @return Number of send requests currently in the queue awaiting to be processed.
*/
getSendQueueCount(): number;
/**
* By default, binding a socket will cause it to block the Node.js process from
* exiting as long as the socket is open. The `socket.unref()` method can be used
* to exclude the socket from the reference counting that keeps the Node.js
* process active. The `socket.ref()` method adds the socket back to the reference
* counting and restores the default behavior.
*
* Calling `socket.ref()` multiples times will have no additional effect.
*
* The `socket.ref()` method returns a reference to the socket so calls can be
* chained.
* @since v0.9.1
*/
ref(): this;
/**
* Returns an object containing the `address`, `family`, and `port` of the remote
* endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception
* if the socket is not connected.
* @since v12.0.0
*/
remoteAddress(): AddressInfo;
/**
* Broadcasts a datagram on the socket.
* For connectionless sockets, the destination `port` and `address` must be
* specified. Connected sockets, on the other hand, will use their associated
* remote endpoint, so the `port` and `address` arguments must not be set.
*
* The `msg` argument contains the message to be sent.
* Depending on its type, different behavior can apply. If `msg` is a `Buffer`,
* any `TypedArray` or a `DataView`,
* the `offset` and `length` specify the offset within the `Buffer` where the
* message begins and the number of bytes in the message, respectively.
* If `msg` is a `String`, then it is automatically converted to a `Buffer` with `'utf8'` encoding. With messages that
* contain multi-byte characters, `offset` and `length` will be calculated with
* respect to `byte length` and not the character position.
* If `msg` is an array, `offset` and `length` must not be specified.
*
* The `address` argument is a string. If the value of `address` is a host name,
* DNS will be used to resolve the address of the host. If `address` is not
* provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) will be used by default.
*
* If the socket has not been previously bound with a call to `bind`, the socket
* is assigned a random port number and is bound to the "all interfaces" address
* (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.)
*
* An optional `callback` function may be specified to as a way of reporting
* DNS errors or for determining when it is safe to reuse the `buf` object.
* DNS lookups delay the time to send for at least one tick of the
* Node.js event loop.
*
* The only way to know for sure that the datagram has been sent is by using a `callback`. If an error occurs and a `callback` is given, the error will be
* passed as the first argument to the `callback`. If a `callback` is not given,
* the error is emitted as an `'error'` event on the `socket` object.
*
* Offset and length are optional but both _must_ be set if either are used.
* They are supported only when the first argument is a `Buffer`, a `TypedArray`,
* or a `DataView`.
*
* This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket.
*
* Example of sending a UDP packet to a port on `localhost`;
*
* ```js
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
*
* const message = Buffer.from('Some bytes');
* const client = dgram.createSocket('udp4');
* client.send(message, 41234, 'localhost', (err) => {
* client.close();
* });
* ```
*
* Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
*
* ```js
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
*
* const buf1 = Buffer.from('Some ');
* const buf2 = Buffer.from('bytes');
* const client = dgram.createSocket('udp4');
* client.send([buf1, buf2], 41234, (err) => {
* client.close();
* });
* ```
*
* Sending multiple buffers might be faster or slower depending on the
* application and operating system. Run benchmarks to
* determine the optimal strategy on a case-by-case basis. Generally speaking,
* however, sending multiple buffers is faster.
*
* Example of sending a UDP packet using a socket connected to a port on `localhost`:
*
* ```js
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
*
* const message = Buffer.from('Some bytes');
* const client = dgram.createSocket('udp4');
* client.connect(41234, 'localhost', (err) => {
* client.send(message, (err) => {
* client.close();
* });
* });
* ```
* @since v0.1.99
* @param msg Message to be sent.
* @param offset Offset in the buffer where the message starts.
* @param length Number of bytes in the message.
* @param port Destination port.
* @param address Destination host name or IP address.
* @param callback Called when the message has been sent.
*/
send(
msg: string | NodeJS.ArrayBufferView | readonly any[],
port?: number,
address?: string,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | NodeJS.ArrayBufferView | readonly any[],
port?: number,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | NodeJS.ArrayBufferView | readonly any[],
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | NodeJS.ArrayBufferView,
offset: number,
length: number,
port?: number,
address?: string,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | NodeJS.ArrayBufferView,
offset: number,
length: number,
port?: number,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | NodeJS.ArrayBufferView,
offset: number,
length: number,
callback?: (error: Error | null, bytes: number) => void,
): void;
/**
* Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
* packets may be sent to a local interface's broadcast address.
*
* This method throws `EBADF` if called on an unbound socket.
* @since v0.6.9
*/
setBroadcast(flag: boolean): void;
/**
* _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC
* 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_
* _with a scope index is written as `'IP%scope'` where scope is an interface name_
* _or interface number._
*
* Sets the default outgoing multicast interface of the socket to a chosen
* interface or back to system interface selection. The `multicastInterface` must
* be a valid string representation of an IP from the socket's family.
*
* For IPv4 sockets, this should be the IP configured for the desired physical
* interface. All packets sent to multicast on the socket will be sent on the
* interface determined by the most recent successful use of this call.
*
* For IPv6 sockets, `multicastInterface` should include a scope to indicate the
* interface as in the examples that follow. In IPv6, individual `send` calls can
* also use explicit scope in addresses, so only packets sent to a multicast
* address without specifying an explicit scope are affected by the most recent
* successful use of this call.
*
* This method throws `EBADF` if called on an unbound socket.
*
* #### Example: IPv6 outgoing multicast interface
*
* On most systems, where scope format uses the interface name:
*
* ```js
* const socket = dgram.createSocket('udp6');
*
* socket.bind(1234, () => {
* socket.setMulticastInterface('::%eth1');
* });
* ```
*
* On Windows, where scope format uses an interface number:
*
* ```js
* const socket = dgram.createSocket('udp6');
*
* socket.bind(1234, () => {
* socket.setMulticastInterface('::%2');
* });
* ```
*
* #### Example: IPv4 outgoing multicast interface
*
* All systems use an IP of the host on the desired physical interface:
*
* ```js
* const socket = dgram.createSocket('udp4');
*
* socket.bind(1234, () => {
* socket.setMulticastInterface('10.0.0.2');
* });
* ```
* @since v8.6.0
*/
setMulticastInterface(multicastInterface: string): void;
/**
* Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
* multicast packets will also be received on the local interface.
*
* This method throws `EBADF` if called on an unbound socket.
* @since v0.3.8
*/
setMulticastLoopback(flag: boolean): boolean;
/**
* Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for
* "Time to Live", in this context it specifies the number of IP hops that a
* packet is allowed to travel through, specifically for multicast traffic. Each
* router or gateway that forwards a packet decrements the TTL. If the TTL is
* decremented to 0 by a router, it will not be forwarded.
*
* The `ttl` argument may be between 0 and 255\. The default on most systems is `1`.
*
* This method throws `EBADF` if called on an unbound socket.
* @since v0.3.8
*/
setMulticastTTL(ttl: number): number;
/**
* Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer
* in bytes.
*
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
* @since v8.7.0
*/
setRecvBufferSize(size: number): void;
/**
* Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer
* in bytes.
*
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
* @since v8.7.0
*/
setSendBufferSize(size: number): void;
/**
* Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live",
* in this context it specifies the number of IP hops that a packet is allowed to
* travel through. Each router or gateway that forwards a packet decrements the
* TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
* Changing TTL values is typically done for network probes or when multicasting.
*
* The `ttl` argument may be between 1 and 255\. The default on most systems
* is 64.
*
* This method throws `EBADF` if called on an unbound socket.
* @since v0.1.101
*/
setTTL(ttl: number): number;
/**
* By default, binding a socket will cause it to block the Node.js process from
* exiting as long as the socket is open. The `socket.unref()` method can be used
* to exclude the socket from the reference counting that keeps the Node.js
* process active, allowing the process to exit even if the socket is still
* listening.
*
* Calling `socket.unref()` multiple times will have no additional effect.
*
* The `socket.unref()` method returns a reference to the socket so calls can be
* chained.
* @since v0.9.1
*/
unref(): this;
/**
* Tells the kernel to join a source-specific multicast channel at the given `sourceAddress` and `groupAddress`, using the `multicastInterface` with the `IP_ADD_SOURCE_MEMBERSHIP` socket
* option. If the `multicastInterface` argument
* is not specified, the operating system will choose one interface and will add
* membership to it. To add membership to every available interface, call `socket.addSourceSpecificMembership()` multiple times, once per interface.
*
* When called on an unbound socket, this method will implicitly bind to a random
* port, listening on all interfaces.
* @since v13.1.0, v12.16.0
*/
addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
/**
* Instructs the kernel to leave a source-specific multicast channel at the given `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` socket option. This method is
* automatically called by the kernel when the
* socket is closed or the process terminates, so most apps will never have
* reason to call this.
*
* If `multicastInterface` is not specified, the operating system will attempt to
* drop membership on all valid interfaces.
* @since v13.1.0, v12.16.0
*/
dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
/**
* events.EventEmitter
* 1. close
* 2. connect
* 3. error
* 4. listening
* 5. message
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connect", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "connect"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "listening"): boolean;
emit(event: "message", msg: NonSharedBuffer, rinfo: RemoteInfo): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "connect", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "listening", listener: () => void): this;
on(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "connect", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "listening", listener: () => void): this;
once(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "connect", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "listening", listener: () => void): this;
prependListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "connect", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "listening", listener: () => void): this;
prependOnceListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
/**
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
}
}
declare module "node:dgram" {
export * from "dgram";
}
@@ -0,0 +1,116 @@
import * as util from "../core/util.js";
const error = () => {
const Sizable = {
string: { unit: "znakov", verb: "mať" },
file: { unit: "bajtov", verb: "mať" },
array: { unit: "prvkov", verb: "mať" },
set: { unit: "prvkov", verb: "mať" },
map: { unit: "položiek", verb: "mať" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "regulárny výraz",
email: "e-mailová adresa",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "dátum a čas vo formáte ISO",
date: "dátum vo formáte ISO",
time: "čas vo formáte ISO",
duration: "doba trvania ISO",
ipv4: "IPv4 adresa",
ipv6: "IPv6 adresa",
mac: "MAC adresa",
cidrv4: "rozsah IPv4",
cidrv6: "rozsah IPv6",
base64: "reťazec zakódovaný vo formáte base64",
base64url: "reťazec zakódovaný vo formáte base64url",
json_string: "reťazec vo formáte JSON",
e164: "číslo E.164",
credit_card: "číslo kreditnej karty",
currency_code: "kód meny",
iban: "IBAN",
jwt: "JWT",
template_literal: "vstup",
};
const TypeDictionary = {
nan: "NaN",
number: "číslo",
string: "reťazec",
function: "funkcia",
array: "pole",
};
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = TypeDictionary[issue.expected] ?? issue.expected;
const receivedType = util.parsedType(issue.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue.expected)) {
return `Neplatný vstup: očakávané instanceof ${issue.expected}, obdržané ${received}`;
}
return `Neplatný vstup: očakávané ${expected}, obdržané ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `Neplatný vstup: očakávané ${util.stringifyPrimitive(issue.values[0])}`;
return `Neplatný vstup: očakávaná jedna z hodnôt ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Hodnota je príliš veľká: ${issue.origin ?? "hodnota"} musí mať ${adj}${issue.maximum.toString()} ${sizing.unit ?? "prvkov"}`;
}
return `Hodnota je príliš veľká: ${issue.origin ?? "hodnota"} musí byť ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Hodnota je príliš malá: ${issue.origin ?? "hodnota"} musí mať ${adj}${issue.minimum.toString()} ${sizing.unit ?? "prvkov"}`;
}
return `Hodnota je príliš malá: ${issue.origin ?? "hodnota"} musí byť ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `Neplatný reťazec: musí začínať na "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Neplatný reťazec: musí končiť na "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Neplatný reťazec: musí obsahovať "${_issue.includes}"`;
if (_issue.format === "regex")
return `Neplatný reťazec: musí zodpovedať vzoru ${_issue.pattern}`;
return `Neplatný formát ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Neplatné číslo: musí byť násobkom ${issue.divisor}`;
case "unrecognized_keys":
return `Neznáme klúče: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Neplatný klúč v ${issue.origin}`;
case "invalid_union":
return "Neplatný vstup";
case "invalid_element":
return `Neplatná hodnota v ${issue.origin}`;
default:
return `Neplatný vstup`;
}
};
};
export default function () {
return {
localeError: error(),
};
}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_K","2":"_I"},C:{"1":"_1R","2":"_o _0Q","194":"LC"},D:{"1":"_3R","2":"_DO"},E:{"1":"_PC","2":"_3C"},F:{"1":"_dR","2":"_IP"},G:{"1":"_AB","2":"_XB"},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":"_yB","2":"_pC"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"ME","2":"LE"}},B:6,C:"JavaScript modules: dynamic import()",D:true};