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,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 MonitorSmartphone = createLucideIcon("MonitorSmartphone", [
["path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8", key: "10dyio" }],
["path", { d: "M10 19v-3.96 3.15", key: "1irgej" }],
["path", { d: "M7 19h5", key: "qswx4l" }],
["rect", { width: "6", height: "10", x: "16", y: "12", rx: "2", key: "1egngj" }]
]);
export { MonitorSmartphone as default };
//# sourceMappingURL=monitor-smartphone.js.map
@@ -0,0 +1,9 @@
/**
* @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.
*/
export { default } from './circle-check.js';
//# sourceMappingURL=check-circle-2.js.map
@@ -0,0 +1 @@
{"version":3,"file":"heart-pulse.js","sources":["../../../src/icons/heart-pulse.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name HeartPulse\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTkgMTRjMS40OS0xLjQ2IDMtMy4yMSAzLTUuNUE1LjUgNS41IDAgMCAwIDE2LjUgM2MtMS43NiAwLTMgLjUtNC41IDItMS41LTEuNS0yLjc0LTItNC41LTJBNS41IDUuNSAwIDAgMCAyIDguNWMwIDIuMyAxLjUgNC4wNSAzIDUuNWw3IDdaIiAvPgogIDxwYXRoIGQ9Ik0zLjIyIDEySDkuNWwuNS0xIDIgNC41IDItNyAxLjUgMy41aDUuMjciIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/heart-pulse\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 HeartPulse = createLucideIcon('HeartPulse', [\n [\n 'path',\n {\n d: 'M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z',\n key: 'c3ymky',\n },\n ],\n ['path', { d: 'M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27', key: '1uw2ng' }],\n]);\n\nexport default HeartPulse;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,iBAAiB,YAAc,CAAA,CAAA,CAAA;AAAA,CAChD,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3E,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,14 @@
import basicLogPrefix from "./basicLogPrefix.mjs";
import formatMessage from "./formatMessage.mjs";
class BasicLayout {
/**
* Format the log event (格式化日志事件)
* @param event Log event (日志事件)
*/
format(event) {
return `${basicLogPrefix(event)} ${formatMessage(event.message)}`;
}
}
export {
BasicLayout as default
};
@@ -0,0 +1,19 @@
const isPrimaryPointer = (event) => {
if (event.pointerType === "mouse") {
return typeof event.button !== "number" || event.button <= 0;
}
else {
/**
* isPrimary is true for all mice buttons, whereas every touch point
* is regarded as its own input. So subsequent concurrent touch points
* will be false.
*
* Specifically match against false here as incomplete versions of
* PointerEvents in very old browser might have it set as undefined.
*/
return event.isPrimary !== false;
}
};
export { isPrimaryPointer };
//# sourceMappingURL=is-primary-pointer.mjs.map
@@ -0,0 +1,526 @@
export default `flf2a$ 5 4 15 0 14
Thick by Randall Ransom 2/94
Figlet release 2.0 -- August 5, 1993
Date: 5 Mar 1994
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
5 - height of a character
4 - height of a character, not including descenders
15 - max line length (excluding comment lines) + a fudge factor
0 - default smushmode for this font (like "-m 0" on command line)
14 - number of comment lines
$$$@
$$$@
$$$@
$$$@
$$$@@
8$@
8$@
"$@
w$@
$$@@
w w$@
" "$@
$ $$@
$ $$@
$ $$@@
8 8 $@
w8ww8w$@
w8ww8w$@
8 8 $@
$@@
.w8w.$@
"w8 "$@
8w $@
"w8w"$@
" $@@
o dP$@
dP $@
dP $@
dP o$@
$@@
dP8P$@
Ybww$@
dP $@
Yb8b$@
" $@@
w$@
."$@
$$$@
$$$@
$$$@@
.dP$@
8P $@
8 $@
8b $@
'Yb$@@
Yb.$@
Y8$@
8$@
d8$@
dP'$@@
Yb dP$@
wYbdPw$@
dPYb $@
dP Yb$@
$@@
$@
8 $@
ww8ww$@
8 $@
$@@
$$$@
$$$@
$$$@
$w$@
."$@@
$ $$@
$ $$@
wwww$@
$ $$@
$ $$@@
$$@
$$@
$$@
w$@
$$@@
dP$@
dP $@
dP $@
dP $@
$@@
.d88b.$@
8P Y8$@
8b d8$@
\`Y88P'$@
$@@
d8$@
8$@
8$@
8$@
$@@
d88b$@
" dP$@
dP $@
d888$@
$@@
d88b$@
wwP$@
8$@
Y88P$@
$@@
d8$@
dP8$@
dPw8$@
8$@
$@@
8888$@
8ww.$@
\`8$@
Y88P$@
$@@
d88b $@
8Pwww.$@
8b d8$@
\`Y88P'$@
$@@
8888P$@
dP $@
dP $@
dP $@
$@@
.dPYb.$@
YbwwdP$@
dP""Yb$@
\`YbdP'$@
$@@
.d88b$@
8 8$@
\`8w88$@
8$@
$@@
$$@
w$@
$$@
w$@
$$@@
$$@
w$@
$$@
w$@
."$@@
dP$@
dP $@
db $@
Yb $@
Yb$@@
$ $$@
wwww$@
wwww$@
$ $$@
$ $$@@
Yb $@
Yb $@
db$@
dP $@
dP $@@
dP"Yb$@
" d8$@
dP $@
w $@
$@@
d""""b$@
P PY 8$@
b bdwP$@
Ybwww'$@
$@@
db $@
dPYb $@
dPwwYb $@
dP Yb$@
$@@
888b.$@
8wwwP$@
8 b$@
888P'$@
$@@
.d88b$@
8P $@
8b $@
\`Y88P$@
$@@
888b.$@
8 8$@
8 8$@
888P'$@
$@@
8888$@
8www$@
8 $@
8888$@
$@@
8888$@
8www$@
8 $@
8 $@
$@@
.d88b $@
8P www$@
8b d8$@
\`Y88P'$@
$@@
8 8$@
8www8$@
8 8$@
8 8$@
$@@
888$@
8 $@
8 $@
888$@
$@@
8888$@
8 $@
w 8 $@
\`Yw" $@
$@@
8 dP$@
8wdP $@
88Yb $@
8 Yb$@
$@@
8 $@
8 $@
8 $@
8888$@
$@@
8b d8$@
8YbmdP8$@
8 " 8$@
8 8$@
$@@
8b 8$@
8Ybm8$@
8 "8$@
8 8$@
$@@
.d88b.$@
8P Y8$@
8b d8$@
\`Y88P'$@
$@@
888b.$@
8 .8$@
8wwP'$@
8 $@
$@@
.d88b.$@
8P Y8$@
8b wd8$@
\`Y88Pw$@
$@@
888b.$@
8 .8$@
8wwK'$@
8 Yb$@
$@@
.d88b.$@
YPwww.$@
d8$@
\`Y88P'$@
$@@
88888$@
8 $@
8 $@
8 $@
$@@
8 8$@
8 8$@
8b..d8$@
\`Y88P'$@
$@@
Yb dP$@
Yb dP $@
YbdP $@
YP $@
$@@
Yb dP$@
Yb db dP $@
YbdPYbdP $@
YP YP $@
$@@
Yb dP$@
YbdP $@
dPYb $@
dP Yb$@
$@@
Yb dP$@
YbdP $@
YP $@
88 $@
$@@
8888P$@
dP $@
dP $@
d8888$@
$@@
88$@
8 $@
8 $@
8 $@
88$@@
Yb $@
Yb $@
Yb $@
Yb$@
$@@
88$@
8$@
8$@
8$@
88$@@
dPYb $@
dP Yb$@
$ $$@
$ $$@
$ $$@@
$ $$@
$ $$@
$ $$@
wwww$@
$ $$@@
w $@
".$@
$$$@
$$$@
$$$@@
$@
.d88$@
8 8$@
\`Y88$@
$@@
8 $@
88b.$@
8 8$@
88P'$@
$@@
$@
.d8b$@
8 $@
\`Y8P$@
$@@
8$@
.d88$@
8 8$@
\`Y88$@
$@@
$@
.d88b$@
8.dP'$@
\`Y88P$@
$@@
d8b$@
8' $@
w8ww$@
8 $@
$@@
$@
.d88$@
8 8$@
\`Y88$@
wwdP$@@
8 $@
8d8b.$@
8P Y8$@
8 8$@
$@@
w$@
w$@
8$@
8$@
$@@
w$@
w$@
8$@
8$@
wdP$@@
8 $@
8.dP$@
88b $@
8 Yb$@
$@@
8$@
8$@
8$@
8$@
$@@
$@
8d8b.d8b.$@
8P Y8P Y8$@
8 8 8$@
$@@
$@
8d8b.$@
8P Y8$@
8 8$@
$@@
$@
.d8b.$@
8' .8$@
\`Y8P'$@
$@@
$@
88b.$@
8 8$@
88P'$@
8 $@@
$@
.d88 $@
8 8 $@
\`Y88 $@
8P$@@
$@
8d8b$@
8P $@
8 $@
$@@
$@
d88b$@
\`Yb.$@
Y88P$@
$@@
w $@
w8ww$@
8 $@
Y8P$@
$@@
$@
8 8$@
8b d8$@
\`Y8P8$@
$@@
$@
Yb dP$@
YbdP $@
YP $@
$@@
$@
Yb db dP$@
YbdPYbdP $@
YP YP $@
$@@
$@
Yb dP$@
\`8. $@
dP Yb$@
$@@
$@
Yb dP$@
YbdP $@
dP $@
dP $@@
$@
888P$@
dP $@
d888$@
$@@
.dP$@
8P $@
w' $@
8b $@
'Yb$@@
8$@
8$@
8$@
8$@
8$@@
Yb. $@
Y8 $@
\`w$@
d8 $@
dP' $@@
dPYb dP$@
dP YbdP $@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@@
`
@@ -0,0 +1,19 @@
import actualApply from './actualApply';
type TupleSplitHead<T extends any[], N extends number> = T['length'] extends N
? T
: T extends [...infer R, any]
? TupleSplitHead<R, N>
: never
type TupleSplitTail<T, N extends number, O extends any[] = []> = O['length'] extends N
? T
: T extends [infer F, ...infer R]
? TupleSplitTail<[...R], N, [...O, F]>
: never
type TupleSplit<T extends any[], N extends number> = [TupleSplitHead<T, N>, TupleSplitTail<T, N>]
declare function applyBind(...args: TupleSplit<Parameters<typeof actualApply>, 2>[1]): ReturnType<typeof actualApply>;
export = applyBind;
@@ -0,0 +1,64 @@
import { getValueAsType } from '../../../value/types/utils/get-as-type.mjs';
import { numberValueTypes } from '../../../value/types/maps/number.mjs';
import { transformPropOrder } from '../../utils/keys-transform.mjs';
const translateAlias = {
x: "translateX",
y: "translateY",
z: "translateZ",
transformPerspective: "perspective",
};
const numTransforms = transformPropOrder.length;
/**
* Build a CSS transform style from individual x/y/scale etc properties.
*
* This outputs with a default order of transforms/scales/rotations, this can be customised by
* providing a transformTemplate function.
*/
function buildTransform(latestValues, transform, transformTemplate) {
// The transform string we're going to build into.
let transformString = "";
let transformIsDefault = true;
/**
* Loop over all possible transforms in order, adding the ones that
* are present to the transform string.
*/
for (let i = 0; i < numTransforms; i++) {
const key = transformPropOrder[i];
const value = latestValues[key];
if (value === undefined)
continue;
let valueIsDefault = true;
if (typeof value === "number") {
valueIsDefault = value === (key.startsWith("scale") ? 1 : 0);
}
else {
const parsed = parseFloat(value);
valueIsDefault = key.startsWith("scale") ? parsed === 1 : parsed === 0;
}
if (!valueIsDefault || transformTemplate) {
const valueAsType = getValueAsType(value, numberValueTypes[key]);
if (!valueIsDefault) {
transformIsDefault = false;
const transformName = translateAlias[key] || key;
transformString += `${transformName}(${valueAsType}) `;
}
if (transformTemplate) {
transform[key] = valueAsType;
}
}
}
transformString = transformString.trim();
// If we have a custom `transform` template, pass our transform values and
// generated transformString to that before returning
if (transformTemplate) {
transformString = transformTemplate(transform, transformIsDefault ? "" : transformString);
}
else if (transformIsDefault) {
transformString = "none";
}
return transformString;
}
export { buildTransform };
//# sourceMappingURL=build-transform.mjs.map
@@ -0,0 +1,29 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./CatchClauseDefinition"), exports);
__exportStar(require("./ClassNameDefinition"), exports);
__exportStar(require("./Definition"), exports);
__exportStar(require("./DefinitionType"), exports);
__exportStar(require("./FunctionNameDefinition"), exports);
__exportStar(require("./ImplicitGlobalVariableDefinition"), exports);
__exportStar(require("./ImportBindingDefinition"), exports);
__exportStar(require("./ParameterDefinition"), exports);
__exportStar(require("./TSEnumMemberDefinition"), exports);
__exportStar(require("./TSEnumNameDefinition"), exports);
__exportStar(require("./TSModuleNameDefinition"), exports);
__exportStar(require("./TypeDefinition"), exports);
__exportStar(require("./VariableDefinition"), exports);
@@ -0,0 +1,15 @@
import * as core from "../core/index.js";
import { ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime } from "./schemas.js";
export { ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime } from "./schemas.js";
export function datetime(params) {
return core._isoDateTime(ZodISODateTime, params);
}
export function date(params) {
return core._isoDate(ZodISODate, params);
}
export function time(params) {
return core._isoTime(ZodISOTime, params);
}
export function duration(params) {
return core._isoDuration(ZodISODuration, params);
}
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017 Mathias Buus
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,538 @@
/*!
* depd
* Copyright(c) 2014-2018 Douglas Christopher Wilson
* MIT Licensed
*/
/**
* Module dependencies.
*/
var relative = require('path').relative
/**
* Module exports.
*/
module.exports = depd
/**
* Get the path to base files on.
*/
var basePath = process.cwd()
/**
* Determine if namespace is contained in the string.
*/
function containsNamespace (str, namespace) {
var vals = str.split(/[ ,]+/)
var ns = String(namespace).toLowerCase()
for (var i = 0; i < vals.length; i++) {
var val = vals[i]
// namespace contained
if (val && (val === '*' || val.toLowerCase() === ns)) {
return true
}
}
return false
}
/**
* Convert a data descriptor to accessor descriptor.
*/
function convertDataDescriptorToAccessor (obj, prop, message) {
var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
var value = descriptor.value
descriptor.get = function getter () { return value }
if (descriptor.writable) {
descriptor.set = function setter (val) { return (value = val) }
}
delete descriptor.value
delete descriptor.writable
Object.defineProperty(obj, prop, descriptor)
return descriptor
}
/**
* Create arguments string to keep arity.
*/
function createArgumentsString (arity) {
var str = ''
for (var i = 0; i < arity; i++) {
str += ', arg' + i
}
return str.substr(2)
}
/**
* Create stack string from stack.
*/
function createStackString (stack) {
var str = this.name + ': ' + this.namespace
if (this.message) {
str += ' deprecated ' + this.message
}
for (var i = 0; i < stack.length; i++) {
str += '\n at ' + stack[i].toString()
}
return str
}
/**
* Create deprecate for namespace in caller.
*/
function depd (namespace) {
if (!namespace) {
throw new TypeError('argument namespace is required')
}
var stack = getStack()
var site = callSiteLocation(stack[1])
var file = site[0]
function deprecate (message) {
// call to self as log
log.call(deprecate, message)
}
deprecate._file = file
deprecate._ignored = isignored(namespace)
deprecate._namespace = namespace
deprecate._traced = istraced(namespace)
deprecate._warned = Object.create(null)
deprecate.function = wrapfunction
deprecate.property = wrapproperty
return deprecate
}
/**
* Determine if event emitter has listeners of a given type.
*
* The way to do this check is done three different ways in Node.js >= 0.8
* so this consolidates them into a minimal set using instance methods.
*
* @param {EventEmitter} emitter
* @param {string} type
* @returns {boolean}
* @private
*/
function eehaslisteners (emitter, type) {
var count = typeof emitter.listenerCount !== 'function'
? emitter.listeners(type).length
: emitter.listenerCount(type)
return count > 0
}
/**
* Determine if namespace is ignored.
*/
function isignored (namespace) {
if (process.noDeprecation) {
// --no-deprecation support
return true
}
var str = process.env.NO_DEPRECATION || ''
// namespace ignored
return containsNamespace(str, namespace)
}
/**
* Determine if namespace is traced.
*/
function istraced (namespace) {
if (process.traceDeprecation) {
// --trace-deprecation support
return true
}
var str = process.env.TRACE_DEPRECATION || ''
// namespace traced
return containsNamespace(str, namespace)
}
/**
* Display deprecation message.
*/
function log (message, site) {
var haslisteners = eehaslisteners(process, 'deprecation')
// abort early if no destination
if (!haslisteners && this._ignored) {
return
}
var caller
var callFile
var callSite
var depSite
var i = 0
var seen = false
var stack = getStack()
var file = this._file
if (site) {
// provided site
depSite = site
callSite = callSiteLocation(stack[1])
callSite.name = depSite.name
file = callSite[0]
} else {
// get call site
i = 2
depSite = callSiteLocation(stack[i])
callSite = depSite
}
// get caller of deprecated thing in relation to file
for (; i < stack.length; i++) {
caller = callSiteLocation(stack[i])
callFile = caller[0]
if (callFile === file) {
seen = true
} else if (callFile === this._file) {
file = this._file
} else if (seen) {
break
}
}
var key = caller
? depSite.join(':') + '__' + caller.join(':')
: undefined
if (key !== undefined && key in this._warned) {
// already warned
return
}
this._warned[key] = true
// generate automatic message from call site
var msg = message
if (!msg) {
msg = callSite === depSite || !callSite.name
? defaultMessage(depSite)
: defaultMessage(callSite)
}
// emit deprecation if listeners exist
if (haslisteners) {
var err = DeprecationError(this._namespace, msg, stack.slice(i))
process.emit('deprecation', err)
return
}
// format and write message
var format = process.stderr.isTTY
? formatColor
: formatPlain
var output = format.call(this, msg, caller, stack.slice(i))
process.stderr.write(output + '\n', 'utf8')
}
/**
* Get call site location as array.
*/
function callSiteLocation (callSite) {
var file = callSite.getFileName() || '<anonymous>'
var line = callSite.getLineNumber()
var colm = callSite.getColumnNumber()
if (callSite.isEval()) {
file = callSite.getEvalOrigin() + ', ' + file
}
var site = [file, line, colm]
site.callSite = callSite
site.name = callSite.getFunctionName()
return site
}
/**
* Generate a default message from the site.
*/
function defaultMessage (site) {
var callSite = site.callSite
var funcName = site.name
// make useful anonymous name
if (!funcName) {
funcName = '<anonymous@' + formatLocation(site) + '>'
}
var context = callSite.getThis()
var typeName = context && callSite.getTypeName()
// ignore useless type name
if (typeName === 'Object') {
typeName = undefined
}
// make useful type name
if (typeName === 'Function') {
typeName = context.name || typeName
}
return typeName && callSite.getMethodName()
? typeName + '.' + funcName
: funcName
}
/**
* Format deprecation message without color.
*/
function formatPlain (msg, caller, stack) {
var timestamp = new Date().toUTCString()
var formatted = timestamp +
' ' + this._namespace +
' deprecated ' + msg
// add stack trace
if (this._traced) {
for (var i = 0; i < stack.length; i++) {
formatted += '\n at ' + stack[i].toString()
}
return formatted
}
if (caller) {
formatted += ' at ' + formatLocation(caller)
}
return formatted
}
/**
* Format deprecation message with color.
*/
function formatColor (msg, caller, stack) {
var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' + // bold cyan
' \x1b[33;1mdeprecated\x1b[22;39m' + // bold yellow
' \x1b[0m' + msg + '\x1b[39m' // reset
// add stack trace
if (this._traced) {
for (var i = 0; i < stack.length; i++) {
formatted += '\n \x1b[36mat ' + stack[i].toString() + '\x1b[39m' // cyan
}
return formatted
}
if (caller) {
formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan
}
return formatted
}
/**
* Format call site location.
*/
function formatLocation (callSite) {
return relative(basePath, callSite[0]) +
':' + callSite[1] +
':' + callSite[2]
}
/**
* Get the stack as array of call sites.
*/
function getStack () {
var limit = Error.stackTraceLimit
var obj = {}
var prep = Error.prepareStackTrace
Error.prepareStackTrace = prepareObjectStackTrace
Error.stackTraceLimit = Math.max(10, limit)
// capture the stack
Error.captureStackTrace(obj)
// slice this function off the top
var stack = obj.stack.slice(1)
Error.prepareStackTrace = prep
Error.stackTraceLimit = limit
return stack
}
/**
* Capture call site stack from v8.
*/
function prepareObjectStackTrace (obj, stack) {
return stack
}
/**
* Return a wrapped function in a deprecation message.
*/
function wrapfunction (fn, message) {
if (typeof fn !== 'function') {
throw new TypeError('argument fn must be a function')
}
var args = createArgumentsString(fn.length)
var stack = getStack()
var site = callSiteLocation(stack[1])
site.name = fn.name
// eslint-disable-next-line no-new-func
var deprecatedfn = new Function('fn', 'log', 'deprecate', 'message', 'site',
'"use strict"\n' +
'return function (' + args + ') {' +
'log.call(deprecate, message, site)\n' +
'return fn.apply(this, arguments)\n' +
'}')(fn, log, this, message, site)
return deprecatedfn
}
/**
* Wrap property in a deprecation message.
*/
function wrapproperty (obj, prop, message) {
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
throw new TypeError('argument obj must be object')
}
var descriptor = Object.getOwnPropertyDescriptor(obj, prop)
if (!descriptor) {
throw new TypeError('must call property on owner object')
}
if (!descriptor.configurable) {
throw new TypeError('property must be configurable')
}
var deprecate = this
var stack = getStack()
var site = callSiteLocation(stack[1])
// set site name
site.name = prop
// convert data descriptor
if ('value' in descriptor) {
descriptor = convertDataDescriptorToAccessor(obj, prop, message)
}
var get = descriptor.get
var set = descriptor.set
// wrap getter
if (typeof get === 'function') {
descriptor.get = function getter () {
log.call(deprecate, message, site)
return get.apply(this, arguments)
}
}
// wrap setter
if (typeof set === 'function') {
descriptor.set = function setter () {
log.call(deprecate, message, site)
return set.apply(this, arguments)
}
}
Object.defineProperty(obj, prop, descriptor)
}
/**
* Create DeprecationError for deprecation
*/
function DeprecationError (namespace, message, stack) {
var error = new Error()
var stackString
Object.defineProperty(error, 'constructor', {
value: DeprecationError
})
Object.defineProperty(error, 'message', {
configurable: true,
enumerable: false,
value: message,
writable: true
})
Object.defineProperty(error, 'name', {
enumerable: false,
configurable: true,
value: 'DeprecationError',
writable: true
})
Object.defineProperty(error, 'namespace', {
configurable: true,
enumerable: false,
value: namespace,
writable: true
})
Object.defineProperty(error, 'stack', {
configurable: true,
enumerable: false,
get: function () {
if (stackString !== undefined) {
return stackString
}
// prepare stack trace
return (stackString = createStackString.call(this, stack))
},
set: function setter (val) {
stackString = val
}
})
return error
}
@@ -0,0 +1 @@
{"version":3,"file":"box.js","sources":["../../../src/icons/box.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Box\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjEgOGEyIDIgMCAwIDAtMS0xLjczbC03LTRhMiAyIDAgMCAwLTIgMGwtNyA0QTIgMiAwIDAgMCAzIDh2OGEyIDIgMCAwIDAgMSAxLjczbDcgNGEyIDIgMCAwIDAgMiAwbDctNEEyIDIgMCAwIDAgMjEgMTZaIiAvPgogIDxwYXRoIGQ9Im0zLjMgNyA4LjcgNSA4LjctNSIgLz4KICA8cGF0aCBkPSJNMTIgMjJWMTIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/box\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 Box = createLucideIcon('Box', [\n [\n 'path',\n {\n d: 'M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z',\n key: 'hh9hay',\n },\n ],\n ['path', { d: 'm3.3 7 8.7 5 8.7-5', key: 'g66t2b' }],\n ['path', { d: 'M12 22V12', key: 'd0xqtd' }],\n]);\n\nexport default Box;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,iBAAiB,KAAO,CAAA,CAAA,CAAA;AAAA,CAClC,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,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,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 @@
module.exports={C:{"49":0.0087,"55":0.00174,"65":0.00348,"68":0.00522,"72":0.00348,"115":0.04521,"120":0.11651,"121":0.2365,"125":0.00348,"126":0.00174,"127":0.00348,"140":0.02435,"141":0.00522,"144":0.00174,"146":0.00174,"148":0.00174,"149":0.00174,"150":0.00522,"151":0.01739,"152":0.0087,"153":0.01391,"154":0.04174,"155":0.11304,"156":0.1113,"157":0.0087,_:"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 50 51 52 53 54 56 57 58 59 60 61 62 63 64 66 67 69 70 71 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 122 123 124 128 129 130 131 132 133 134 135 136 137 138 139 142 143 145 147 158 159 160 3.5 3.6"},D:{"50":0.00348,"53":0.00174,"54":0.00174,"56":0.00348,"64":0.00522,"69":0.01391,"70":0.00696,"72":0.00348,"75":0.00696,"77":0.01913,"79":0.00522,"80":0.01043,"81":0.01217,"83":0.02435,"84":0.00348,"86":0.00348,"87":0.0087,"91":0.00696,"95":0.01565,"96":0.00522,"98":0.02609,"101":0.0713,"103":0.02782,"104":0.02435,"105":0.01565,"106":0.02261,"107":0.02435,"108":0.01913,"109":0.31824,"110":0.01565,"111":0.02261,"112":0.01739,"113":0.01391,"114":0.02956,"116":0.04695,"117":0.02261,"118":0.52518,"119":0.26955,"120":0.29215,"122":0.00174,"124":0.02087,"125":0.00174,"126":0.0087,"127":0.00348,"128":0.01391,"130":0.01043,"131":0.04348,"132":0.00522,"133":0.07304,"134":0.04348,"135":0.03478,"136":0.12695,"137":0.04695,"138":0.08521,"139":0.05565,"140":0.04869,"141":0.03826,"142":0.11825,"143":0.02609,"144":0.01913,"145":0.00522,"146":0.05391,"147":0.01739,"148":0.04348,"149":0.0313,"150":0.23303,"151":0.77386,"152":2.19984,"153":1.85725,"154":0.56691,"155":0.00174,_:"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 51 52 55 57 58 59 60 61 62 63 65 66 67 68 71 73 74 76 78 85 88 89 90 92 93 94 97 99 100 102 115 121 123 129 156 157"},F:{"40":0.00174,"46":0.01043,"79":0.00522,"95":0.01565,"100":0.00522,"101":0.03478,"105":0.00522,"110":0.00174,"116":0.00174,"131":0.00174,"133":0.00696,"134":0.01043,"135":0.21564,_:"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 41 42 43 44 45 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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 102 103 104 106 107 108 109 111 112 113 114 115 117 118 119 120 121 122 123 124 125 126 127 132 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.00174,"92":0.02435,"109":0.00174,"119":0.10434,"120":0.12173,"122":0.0087,"123":0.00174,"127":0.00696,"131":0.00174,"132":0.00522,"137":0.00696,"140":0.00348,"141":0.01217,"145":0.00174,"146":0.00696,"147":0.00348,"148":0.01043,"150":0.02609,"151":0.08173,"152":0.47127,"153":0.45562,"154":0.19825,_:"12 13 14 15 16 17 79 80 81 83 84 85 86 87 88 89 90 91 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 124 125 126 128 129 130 133 134 135 136 138 139 142 143 144 149"},E:{"11":0.00174,"27":0.05565,_:"4 5 6 7 8 9 10 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 11.1 12.1 13.1 14.1 15.1 15.2-15.3 15.4 15.5 16.0 16.2 16.3 16.4 17.0 17.2 17.3 18.0 18.1 18.2 18.3 18.4 27.1 27.2 TP","10.1":0.00174,"15.6":0.02609,"16.1":0.00174,"16.5":0.00348,"16.6":0.01391,"17.1":0.02087,"17.4":0.00174,"17.5":0.00174,"17.6":0.00174,"18.5-18.7":0.08869,"26.0":0.02956,"26.1":0.00522,"26.2":0.01739,"26.3":0.00522,"26.4":0.03304,"26.5":0.19999,"26.6":0.12347},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00192,"5.0-5.1":0.00192,"6.0-6.1":0,"7.0-7.1":0.00383,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.01917,"11.0-11.2":0.00192,"11.3-11.4":0.00383,"12.0-12.1":0,"12.2-12.5":0.04983,"13.0-13.1":0,"13.2":0.00958,"13.3":0,"13.4-13.7":0.00192,"14.0-14.4":0.00767,"14.5-14.8":0.0115,"15.0-15.1":0.0115,"15.2-15.3":0.00767,"15.4":0.00958,"15.5":0.0115,"15.6-15.8":0.24915,"16.0":0.01917,"16.1":0.0345,"16.2":0.01917,"16.3":0.04216,"16.4":0.00958,"16.5":0.01533,"16.6-16.7":0.3469,"17.0":0.01342,"17.1":0.01917,"17.2":0.01917,"17.3":0.02875,"17.4":0.04025,"17.5":0.07858,"17.6-17.7":0.20315,"18.0":0.04216,"18.1":0.08433,"18.2":0.11499,"18.3":0.19932,"18.4":0.12458,"18.5-18.7":2.57393,"26.0":0.12458,"26.1":0.12649,"26.2":0.32965,"26.3":0.35648,"26.4":0.26065,"26.5":1.74598,"26.6":10.77294,"27.0":0.82603,"27.1":0,"27.2":0.02108},P:{"4":0.01841,"21":0.0092,"22":0.06442,"23":0.0092,"24":0.14726,"25":0.06442,"26":0.32212,"27":0.22088,"28":0.7915,"29":0.44177,"30":2.85309,_:"20 5.0-5.4 6.2-6.4 8.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 17.0","7.2-7.4":0.45097,"9.2":0.03681,"16.0":0.01841,"18.0":0.0092,"19.0":0.02761},I:{"0":0.04953,"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.00002},K:{"0":0.88393,_:"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":61.05402},R:{_:Line truncated
@@ -0,0 +1,29 @@
import { RequestHandler } from 'express';
import { OAuthRegisteredClientsStore } from '../clients.js';
import { Options as RateLimitOptions } from 'express-rate-limit';
export type ClientRegistrationHandlerOptions = {
/**
* A store used to save information about dynamically registered OAuth clients.
*/
clientsStore: OAuthRegisteredClientsStore;
/**
* The number of seconds after which to expire issued client secrets, or 0 to prevent expiration of client secrets (not recommended).
*
* If not set, defaults to 30 days.
*/
clientSecretExpirySeconds?: number;
/**
* Rate limiting configuration for the client registration endpoint.
* Set to false to disable rate limiting for this endpoint.
* Registration endpoints are particularly sensitive to abuse and should be rate limited.
*/
rateLimit?: Partial<RateLimitOptions> | false;
/**
* Whether to generate a client ID before calling the client registration endpoint.
*
* If not set, defaults to true.
*/
clientIdGeneration?: boolean;
};
export declare function clientRegistrationHandler({ clientsStore, clientSecretExpirySeconds, rateLimit: rateLimitConfig, clientIdGeneration }: ClientRegistrationHandlerOptions): RequestHandler;
//# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"square-library.js","sources":["../../../src/icons/square-library.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name SquareLibrary\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHg9IjMiIHk9IjMiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Ik03IDd2MTAiIC8+CiAgPHBhdGggZD0iTTExIDd2MTAiIC8+CiAgPHBhdGggZD0ibTE1IDcgMiAxMCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/square-library\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 SquareLibrary = createLucideIcon('SquareLibrary', [\n ['rect', { width: '18', height: '18', x: '3', y: '3', rx: '2', key: 'afitv7' }],\n ['path', { d: 'M7 7v10', key: 'd5nglc' }],\n ['path', { d: 'M11 7v10', key: 'pptsnr' }],\n ['path', { d: 'm15 7 2 10', key: '1m7qm5' }],\n]);\n\nexport default SquareLibrary;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,iBAAiB,eAAiB,CAAA,CAAA,CAAA;AAAA,CAAA,CACtD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,MAAM,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,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,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,718 @@
export default `flf2a$ 7 7 16 -1 2
Relief by Nick Miners N.M.Miners@durham.ac.uk
June 1994
_____#
_____#
_____#
_____#
_____#
_____#
_____##
_____#
/~~\\_#
/~~\\_#
/~~\\_#
_____#
/~~\\_#
_____##
________#
/~\\_/~\\_#
/~\\_/~\\_#
________#
________#
________#
________##
____________#
__/~\\_/~\\___#
/~~~~~~~~~\\_#
__/~\\_/~\\___#
/~~~~~~~~~\\_#
__/~\\_/~\\___#
____________##
__________#
___/~~~~\\_#
__/~~\\____#
/~~~~~\\___#
__/~~\\____#
/~~~~~~~\\_#
__________##
_________#
/~\\_/~~\\_#
___/~~\\__#
__/~~\\___#
_/~~\\____#
/~~\\_/~\\_#
_________##
__________#
_/~~~~~\\__#
/~~\\______#
_/~~~~~~~\\#
/~~\\/~~\\__#
_/~~~~~\\__#
__________##
____#
/~\\_#
/\\__#
____#
____#
____#
____##
______#
_/~~\\_#
/~~\\__#
/~~\\__#
/~~\\__#
_/~~\\_#
______##
______#
/~~\\__#
_/~~\\_#
_/~~\\_#
_/~~\\_#
/~~\\__#
______##
__________#
___/~~\\___#
/~\\/~~\\/~\\#
_/~~~~~~\\_#
/~\\/~~\\/~\\#
___/~~\\___#
__________##
___________#
___/~~\\____#
___/~~\\____#
/~~~~~~~~\\_#
___/~~\\____#
___/~~\\____#
___________##
_____#
_____#
_____#
_____#
_____#
/~~\\_#
/~\\__##
__________#
__________#
__________#
/~~~~~~~\\_#
__________#
__________#
__________##
_____#
_____#
_____#
_____#
_____#
/~~\\_#
_____##
_________#
____/~~\\_#
___/~~\\__#
__/~~\\___#
_/~~\\____#
/~~\\_____#
_________##
____________#
__/~~~~~\\___#
_/~~\\_/~~\\__#
/~~\\___/~~\\_#
_/~~\\_/~~\\__#
__/~~~~~\\___#
____________##
_________#
__/~~\\___#
_/~~~\\___#
__/~~\\___#
__/~~\\___#
/~~~~~~\\_#
_________##
__________#
_/~~~~~~\\_#
/~~\\_/~~\\_#
___/~~\\___#
_/~~\\_____#
/~~~~~~~\\_#
__________##
__________#
_/~~~~~~\\_#
/~~\\_/~~\\_#
___/~~~\\__#
/~~\\_/~~\\_#
_/~~~~~~\\_#
__________##
___________#
__/~~~~~\\__#
_/~~\\/~~\\__#
/~~\\_/~~\\__#
/~~~~~~~~\\_#
_____/~~\\__#
___________##
_________#
/~~~~~~\\_#
/~~\\_____#
/~~~~~\\__#
____/~~\\_#
/~~~~~\\__#
_________##
__________#
___/~~\\___#
__/~~\\____#
_/~~~~~\\__#
/~~\\_/~~\\_#
_/~~~~~\\__#
__________##
_________#
/~~~~~~\\_#
___/~~\\__#
__/~~\\___#
_/~~\\____#
/~~\\_____#
_________##
__________#
_/~~~~~\\__#
/~~\\_/~~\\_#
_/~~~~~\\__#
/~~\\_/~~\\_#
_/~~~~~\\__#
__________##
__________#
_/~~~~~\\__#
/~~\\_/~~\\_#
_/~~~~~\\__#
___/~~\\___#
__/~~\\____#
__________##
_____#
_____#
_____#
_/~~\\#
_____#
_/~~\\#
_____##
_____#
_____#
_____#
_/~~\\#
_____#
_/~~\\#
_/~\\_##
_______#
__/~~\\_#
_/~~\\__#
/~~\\___#
_/~~\\__#
__/~~\\_#
_______##
__________#
__________#
/~~~~~~~\\_#
__________#
/~~~~~~~\\_#
__________#
__________##
_______#
_/~~\\__#
__/~~\\_#
__/~~\\_#
_/~~\\__#
/~~\\___#
_______##
_________#
_/~~~~\\__#
____/~~\\_#
___/~~\\__#
_________#
___/~~\\__#
_________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\/~~~~\\_#
/~~\\_______#
_/~~~~~~\\__#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
___________##
___________#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~\\__#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\_______#
/~~\\__/~~\\_#
_/~~~~~~\\__#
___________##
___________#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~~~~~~\\__#
___________##
___________#
/~~~~~~~~\\_#
/~~\\_______#
/~~~~~~\\___#
/~~\\_______#
/~~~~~~~~\\_#
___________##
___________#
/~~~~~~~~\\_#
/~~\\_______#
/~~~~~~\\___#
/~~\\_______#
/~~\\_______#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\_______#
/~~\\__/~~\\_#
_/~~~~~~~\\_#
______/~~\\_##
___________#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~~~~~~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
___________##
_______#
/~~~~\\_#
_/~~\\__#
_/~~\\__#
_/~~\\__#
/~~~~\\_#
_______##
_________#
__/~~~~\\_#
___/~~\\__#
___/~~\\__#
___/~~\\__#
/~~~~\\___#
_________##
___________#
/~~\\__/~~\\_#
/~~\\_/~~\\__#
/~~~~~\\____#
/~~\\_/~~\\__#
/~~\\__/~~\\_#
___________##
___________#
/~~\\_______#
/~~\\_______#
/~~\\_______#
/~~\\_______#
/~~~~~~~~\\_#
___________##
___________#
/~~\\__/~~\\_#
/~~~\\/~~~\\_#
/~~~~~~~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
___________##
___________#
/~~\\__/~~\\_#
/~~~~\\/~~\\_#
/~~~~~~~~\\_#
/~~\\/~~~~\\_#
/~~\\__/~~\\_#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
_/~~~~~~\\__#
___________##
___________#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~\\__#
/~~\\_______#
/~~\\_______#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\_/~~\\__#
_/~~~~~~~\\_#
___________##
___________#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
___________##
___________#
_/~~~~~~\\__#
/~~\\_______#
_/~~~~~~\\__#
______/~~\\_#
_/~~~~~~\\__#
___________##
___________#
/~~~~~~~~\\_#
___/~~\\____#
___/~~\\____#
___/~~\\____#
___/~~\\____#
___________##
___________#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
_/~~~~~~\\__#
___________##
___________#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
_/~~\\/~~\\__#
__/~~~~\\___#
___________##
_____________#
/~~\\/~~\\/~~\\_#
/~~\\/~~\\/~~\\_#
/~~\\/~~\\/~~\\_#
/~~\\/~~\\/~~\\_#
_/~~~~~~~~\\__#
_____________##
___________#
/~~\\__/~~\\_#
_/~~\\/~~\\__#
__/~~~~\\___#
_/~~\\/~~\\__#
/~~\\__/~~\\_#
___________##
___________#
/~~\\__/~~\\_#
_/~~\\/~~\\__#
__/~~~~\\___#
___/~~\\____#
___/~~\\____#
___________##
___________#
/~~~~~~~~\\_#
_____/~~\\__#
___/~~\\____#
_/~~\\______#
/~~~~~~~~\\_#
___________##
_______#
/~~~~\\_#
/~~\\___#
/~~\\___#
/~~\\___#
/~~~~\\_#
_______##
_________#
/~~\\_____#
_/~~\\____#
__/~~\\___#
___/~~\\__#
____/~~\\_#
_________##
_______#
/~~~~\\_#
__/~~\\_#
__/~~\\_#
__/~~\\_#
/~~~~\\_#
_______##
___________#
____/\\_____#
__/~~~~\\___#
/~~\\__/~~\\_#
___________#
___________#
___________##
___________#
___________#
___________#
___________#
___________#
/~~~~~~~~\\_#
___________##
____#
/~\\_#
_/\\_#
____#
____#
____#
____##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
___________##
___________#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~\\__#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\_______#
/~~\\__/~~\\_#
_/~~~~~~\\__#
___________##
___________#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~~~~~~\\__#
___________##
___________#
/~~~~~~~~\\_#
/~~\\_______#
/~~~~~~\\___#
/~~\\_______#
/~~~~~~~~\\_#
___________##
___________#
/~~~~~~~~\\_#
/~~\\_______#
/~~~~~~\\___#
/~~\\_______#
/~~\\_______#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\_______#
/~~\\__/~~\\_#
_/~~~~~~~\\_#
______/~~\\_##
___________#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~~~~~~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
___________##
_______#
/~~~~\\_#
_/~~\\__#
_/~~\\__#
_/~~\\__#
/~~~~\\_#
_______##
_________#
__/~~~~\\_#
___/~~\\__#
___/~~\\__#
___/~~\\__#
/~~~~\\___#
_________##
___________#
/~~\\__/~~\\_#
/~~\\_/~~\\__#
/~~~~~\\____#
/~~\\_/~~\\__#
/~~\\__/~~\\_#
___________##
___________#
/~~\\_______#
/~~\\_______#
/~~\\_______#
/~~\\_______#
/~~~~~~~~\\_#
___________##
___________#
/~~\\__/~~\\_#
/~~~\\/~~~\\_#
/~~~~~~~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
___________##
___________#
/~~\\__/~~\\_#
/~~~~\\/~~\\_#
/~~~~~~~~\\_#
/~~\\/~~~~\\_#
/~~\\__/~~\\_#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
_/~~~~~~\\__#
___________##
___________#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~\\__#
/~~\\_______#
/~~\\_______#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\_/~~\\__#
_/~~~~~~~\\_#
___________##
___________#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
___________##
___________#
_/~~~~~~\\__#
/~~\\_______#
_/~~~~~~\\__#
______/~~\\_#
_/~~~~~~\\__#
___________##
___________#
/~~~~~~~~\\_#
___/~~\\____#
___/~~\\____#
___/~~\\____#
___/~~\\____#
___________##
___________#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
_/~~~~~~\\__#
___________##
___________#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
_/~~\\/~~\\__#
__/~~~~\\___#
___________##
_____________#
/~~\\/~~\\/~~\\_#
/~~\\/~~\\/~~\\_#
/~~\\/~~\\/~~\\_#
/~~\\/~~\\/~~\\_#
_/~~~~~~~~\\__#
_____________##
___________#
/~~\\__/~~\\_#
_/~~\\/~~\\__#
__/~~~~\\___#
_/~~\\/~~\\__#
/~~\\__/~~\\_#
___________##
___________#
/~~\\__/~~\\_#
_/~~\\/~~\\__#
__/~~~~\\___#
___/~~\\____#
___/~~\\____#
___________##
___________#
/~~~~~~~~\\_#
_____/~~\\__#
___/~~\\____#
_/~~\\______#
/~~~~~~~~\\_#
___________##
_________#
__/~~~~\\_#
__/~~\\___#
/~~~~\\___#
__/~~\\___#
__/~~~~\\_#
_________##
_____#
/~~\\_#
/~~\\_#
/~~\\_#
/~~\\_#
/~~\\_#
_____##
_________#
/~~~~\\___#
__/~~\\___#
__/~~~~\\_#
__/~~\\___#
/~~~~\\___#
_________##
______________#
__/~~~\\__/~~\\_#
_/~~~~~~~~~\\__#
/~~\\__/~~~\\___#
______________#
______________#
______________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
_/~~~~~~\\__#
___________##
___________#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
_/~~~~~~\\__#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~~~~~~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
_/~~~~~~\\__#
___________##
___________#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
/~~\\__/~~\\_#
_/~~~~~~\\__#
___________##
___________#
_/~~~~~~\\__#
/~~\\__/~~\\_#
/~~\\_/~~\\__#
/~~\\__/~~\\_#
/~~\\_/~~\\__#
___________##
`
@@ -0,0 +1,11 @@
Copyright (c) Felix Böhm
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -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 MessageCircleDashed = createLucideIcon("MessageCircleDashed", [
["path", { d: "M13.5 3.1c-.5 0-1-.1-1.5-.1s-1 .1-1.5.1", key: "16ll65" }],
["path", { d: "M19.3 6.8a10.45 10.45 0 0 0-2.1-2.1", key: "1nq77a" }],
["path", { d: "M20.9 13.5c.1-.5.1-1 .1-1.5s-.1-1-.1-1.5", key: "1sf7wn" }],
["path", { d: "M17.2 19.3a10.45 10.45 0 0 0 2.1-2.1", key: "x1hs5g" }],
["path", { d: "M10.5 20.9c.5.1 1 .1 1.5.1s1-.1 1.5-.1", key: "19m18z" }],
["path", { d: "M3.5 17.5 2 22l4.5-1.5", key: "1f36qi" }],
["path", { d: "M3.1 10.5c0 .5-.1 1-.1 1.5s.1 1 .1 1.5", key: "1vz3ju" }],
["path", { d: "M6.8 4.7a10.45 10.45 0 0 0-2.1 2.1", key: "19f9do" }]
]);
export { MessageCircleDashed as default };
//# sourceMappingURL=message-circle-dashed.js.map
@@ -0,0 +1,2 @@
import { validator } from "./validator.js";
export { validator };
@@ -0,0 +1,103 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`parseFeed > (atomFeed) 1`] = `
{
"author": "johndoe@example.com",
"description": "A subtitle.",
"id": "urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6",
"items": [
{
"description": "Some content.",
"id": "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a",
"link": "http://example.org/2003/12/13/atom03",
"media": [],
"pubDate": 2003-12-13T18:30:02.000Z,
"title": "Atom-Powered Robots Run Amok",
},
{
"media": [],
},
],
"link": "http://example.org/feed/",
"title": "Example Feed",
"type": "atom",
"updated": 2003-12-13T18:30:02.000Z,
}
`;
exports[`parseFeed > (rdfFeed) 1`] = `
{
"id": "",
"items": [
{
"description": "Great test content<br>A link: <a href="http://github.com">Github</a>",
"link": "http://somefakesite/path/to/something.html",
"media": [],
"pubDate": 2011-11-04T16:35:17.000Z,
"title": "Fast HTML Parsing",
},
{
"description": "The early bird gets the worm",
"link": "http://somefakesite/path/to/something-else.html",
"media": [],
"pubDate": 2011-11-04T16:34:54.000Z,
"title": "This space intentionally left blank",
},
],
"link": "https://github.com/fb55/htmlparser2/",
"title": "A title to parse and remember",
"type": "rdf",
}
`;
exports[`parseFeed > (rssFeed) 1`] = `
{
"author": "editor@example.com",
"description": "Liftoff to Space Exploration.",
"id": "",
"items": [
{
"description": "How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's <a href="http://howe.iki.rssi.ru/GCTC/gctc_e.htm">Star City</a>.",
"id": "http://liftoff.msfc.nasa.gov/2003/06/03.html#item573",
"link": "http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp",
"media": [],
"pubDate": 2003-06-03T09:39:21.000Z,
"title": "Star City",
},
{
"description": "Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a <a href="http://science.nasa.gov/headlines/y2003/30may_solareclipse.htm">partial eclipse of the Sun</a> on Saturday, May 31st.",
"id": "http://liftoff.msfc.nasa.gov/2003/05/30.html#item572",
"media": [],
"pubDate": 2003-05-30T11:06:42.000Z,
},
{
"description": "Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that.",
"id": "http://liftoff.msfc.nasa.gov/2003/05/27.html#item571",
"link": "http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp",
"media": [],
"pubDate": 2003-05-27T08:37:32.000Z,
"title": "The Engine That Does More",
},
{
"description": "Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them. Instead, astronauts have other options.",
"id": "http://liftoff.msfc.nasa.gov/2003/05/20.html#item570",
"link": "http://liftoff.msfc.nasa.gov/news/2003/news-laundry.asp",
"media": [
{
"height": 200,
"isDefault": false,
"medium": "image",
"url": "https://picsum.photos/200",
"width": 200,
},
],
"pubDate": 2003-05-20T08:56:02.000Z,
"title": "Astronauts' Dirty Laundry",
},
],
"link": "http://liftoff.msfc.nasa.gov/",
"title": "Liftoff News",
"type": "rss",
"updated": 2003-06-10T09:41:01.000Z,
}
`;
@@ -0,0 +1,24 @@
/**
* @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 LandPlot = createLucideIcon("LandPlot", [
["path", { d: "m12 8 6-3-6-3v10", key: "mvpnpy" }],
[
"path",
{
d: "m8 11.99-5.5 3.14a1 1 0 0 0 0 1.74l8.5 4.86a2 2 0 0 0 2 0l8.5-4.86a1 1 0 0 0 0-1.74L16 12",
key: "ek95tt"
}
],
["path", { d: "m6.49 12.85 11.02 6.3", key: "1kt42w" }],
["path", { d: "M17.51 12.85 6.5 19.15", key: "v55bdg" }]
]);
export { LandPlot as default };
//# sourceMappingURL=land-plot.js.map
@@ -0,0 +1,20 @@
import { Name } from "./codegen";
declare const names: {
data: Name;
valCxt: Name;
instancePath: Name;
parentData: Name;
parentDataProperty: Name;
rootData: Name;
dynamicAnchors: Name;
vErrors: Name;
errors: Name;
this: Name;
self: Name;
scope: Name;
json: Name;
jsonPos: Name;
jsonLen: Name;
jsonPart: Name;
};
export default names;
@@ -0,0 +1,130 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.DetailContext = exports.NoopContext = exports.VError = void 0;
/**
* Error thrown by validation. Besides an informative message, it includes the path to the
* property which triggered the failure.
*/
var VError = /** @class */ (function (_super) {
__extends(VError, _super);
function VError(path, message) {
var _this = _super.call(this, message) || this;
_this.path = path;
// See https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work for info about this workaround.
Object.setPrototypeOf(_this, VError.prototype);
return _this;
}
return VError;
}(Error));
exports.VError = VError;
/**
* Fast implementation of IContext used for first-pass validation. If that fails, we can validate
* using DetailContext to collect error messages. That's faster for the common case when messages
* normally pass validation.
*/
var NoopContext = /** @class */ (function () {
function NoopContext() {
}
NoopContext.prototype.fail = function (relPath, message, score) {
return false;
};
NoopContext.prototype.unionResolver = function () { return this; };
NoopContext.prototype.createContext = function () { return this; };
NoopContext.prototype.resolveUnion = function (ur) { };
return NoopContext;
}());
exports.NoopContext = NoopContext;
/**
* Complete implementation of IContext that collects meaningfull errors.
*/
var DetailContext = /** @class */ (function () {
function DetailContext() {
// Stack of property names and associated messages for reporting helpful error messages.
this._propNames = [""];
this._messages = [null];
// Score is used to choose the best union member whose DetailContext to use for reporting.
// Higher score means better match (or rather less severe mismatch).
this._score = 0;
}
DetailContext.prototype.fail = function (relPath, message, score) {
this._propNames.push(relPath);
this._messages.push(message);
this._score += score;
return false;
};
DetailContext.prototype.unionResolver = function () {
return new DetailUnionResolver();
};
DetailContext.prototype.resolveUnion = function (unionResolver) {
var _a, _b;
var u = unionResolver;
var best = null;
for (var _i = 0, _c = u.contexts; _i < _c.length; _i++) {
var ctx = _c[_i];
if (!best || ctx._score >= best._score) {
best = ctx;
}
}
if (best && best._score > 0) {
(_a = this._propNames).push.apply(_a, best._propNames);
(_b = this._messages).push.apply(_b, best._messages);
}
};
DetailContext.prototype.getError = function (path) {
var msgParts = [];
for (var i = this._propNames.length - 1; i >= 0; i--) {
var p = this._propNames[i];
path += (typeof p === "number") ? "[" + p + "]" : (p ? "." + p : "");
var m = this._messages[i];
if (m) {
msgParts.push(path + " " + m);
}
}
return new VError(path, msgParts.join("; "));
};
DetailContext.prototype.getErrorDetail = function (path) {
var details = [];
for (var i = this._propNames.length - 1; i >= 0; i--) {
var p = this._propNames[i];
path += (typeof p === "number") ? "[" + p + "]" : (p ? "." + p : "");
var message = this._messages[i];
if (message) {
details.push({ path: path, message: message });
}
}
var detail = null;
for (var i = details.length - 1; i >= 0; i--) {
if (detail) {
details[i].nested = [detail];
}
detail = details[i];
}
return detail;
};
return DetailContext;
}());
exports.DetailContext = DetailContext;
var DetailUnionResolver = /** @class */ (function () {
function DetailUnionResolver() {
this.contexts = [];
}
DetailUnionResolver.prototype.createContext = function () {
var ctx = new DetailContext();
this.contexts.push(ctx);
return ctx;
};
return DetailUnionResolver;
}());
@@ -0,0 +1 @@
{"version":3,"file":"users.js","sources":["../../../src/icons/users.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Users\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTYgMjF2LTJhNCA0IDAgMCAwLTQtNEg2YTQgNCAwIDAgMC00IDR2MiIgLz4KICA8Y2lyY2xlIGN4PSI5IiBjeT0iNyIgcj0iNCIgLz4KICA8cGF0aCBkPSJNMjIgMjF2LTJhNCA0IDAgMCAwLTMtMy44NyIgLz4KICA8cGF0aCBkPSJNMTYgMy4xM2E0IDQgMCAwIDEgMCA3Ljc1IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/users\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 Users = createLucideIcon('Users', [\n ['path', { d: 'M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2', key: '1yyitq' }],\n ['circle', { cx: '9', cy: '7', r: '4', key: 'nufk8' }],\n ['path', { d: 'M22 21v-2a4 4 0 0 0-3-3.87', key: 'kshegd' }],\n ['path', { d: 'M16 3.13a4 4 0 0 1 0 7.75', key: '1da9ce' }],\n]);\n\nexport default Users;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,iBAAiB,OAAS,CAAA,CAAA,CAAA;AAAA,CAAA,CACtC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA6C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAC1E,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,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,EAAS,CAAA,CAAA;AAAA,CAAA,CACrD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA8B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAC3D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA6B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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;AAC5D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,9 @@
import { Parser } from './postcss.js'
interface Parse extends Parser {
default: Parse
}
declare let parse: Parse
export = parse
@@ -0,0 +1,61 @@
/*!
* word-wrap <https://github.com/jonschlinkert/word-wrap>
*
* Copyright (c) 2014-2023, Jon Schlinkert.
* Released under the MIT License.
*/
function trimEnd(str) {
let lastCharPos = str.length - 1;
let lastChar = str[lastCharPos];
while(lastChar === ' ' || lastChar === '\t') {
lastChar = str[--lastCharPos];
}
return str.substring(0, lastCharPos + 1);
}
function trimTabAndSpaces(str) {
const lines = str.split('\n');
const trimmedLines = lines.map((line) => trimEnd(line));
return trimmedLines.join('\n');
}
module.exports = function(str, options) {
options = options || {};
if (str == null) {
return str;
}
var width = options.width || 50;
var indent = (typeof options.indent === 'string')
? options.indent
: ' ';
var newline = options.newline || '\n' + indent;
var escape = typeof options.escape === 'function'
? options.escape
: identity;
var regexString = '.{1,' + width + '}';
if (options.cut !== true) {
regexString += '([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)';
}
var re = new RegExp(regexString, 'g');
var lines = str.match(re) || [];
var result = indent + lines.map(function(line) {
if (line.slice(-1) === '\n') {
line = line.slice(0, line.length - 1);
}
return escape(line);
}).join(newline);
if (options.trim === true) {
result = trimTabAndSpaces(result);
}
return result;
};
function identity(str) {
return str;
}
@@ -0,0 +1 @@
{"version":3,"file":"power.js","sources":["../../../src/icons/power.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Power\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMnYxMCIgLz4KICA8cGF0aCBkPSJNMTguNCA2LjZhOSA5IDAgMSAxLTEyLjc3LjA0IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/power\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 Power = createLucideIcon('Power', [\n ['path', { d: 'M12 2v10', key: 'mnfbl' }],\n ['path', { d: 'M18.4 6.6a9 9 0 1 1-12.77.04', key: 'obofu9' }],\n]);\n\nexport default Power;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,iBAAiB,OAAS,CAAA,CAAA,CAAA;AAAA,CAAA,CACtC,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,SAAS,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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;AAC/D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"_V","132":"_b"},B:{"1":"_J"},C:{"1":"_S"},D:{"1":"_Q"},E:{"1":"_R"},F:{"1":"_c"},G:{"1":"_M"},H:{"1":"1D"},I:{"1":"_P"},J:{"1":"_B"},K:{"1":"_N"},L:{"1":"I"},M:{"1":"YC"},N:{"1":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:2,C:"CSS first-line pseudo-element",D:true};
@@ -0,0 +1,33 @@
'use strict'
const test = require('tape')
const fastURI = require('..')
test('query percent-encoding is normalized (RFC 3986 §6.2.2)', (t) => {
// hex digits are uppercased, like the path component already does
t.equal(fastURI.normalize('x://h/p?a=%2a'), 'x://h/p?a=%2A', 'uppercases hex in query')
// unreserved characters are decoded
t.equal(fastURI.normalize('x://h/p?a=%7e%2e'), 'x://h/p?a=~.', 'decodes unreserved in query')
// reserved characters stay percent-encoded
t.equal(fastURI.normalize('x://h/p?a=%2F'), 'x://h/p?a=%2F', 'keeps reserved encoded in query')
// raw characters that are not allowed are percent-encoded
t.equal(fastURI.normalize('x://h/p?a b'), 'x://h/p?a%20b', 'encodes a raw space in query')
t.equal(fastURI.normalize('x://h/p?café'), 'x://h/p?caf%C3%A9', 'encodes raw non-ASCII in query')
// `?` is allowed unencoded in a query
t.equal(fastURI.normalize('x://h/p?a?b'), 'x://h/p?a?b', 'keeps `?` raw in query')
t.end()
})
test('fragment percent-encoding is normalized without decoding reserved characters', (t) => {
// reserved characters must NOT be decoded — `%2F` is not `/`
t.equal(fastURI.normalize('x://h/p#a%2Fb%2A'), 'x://h/p#a%2Fb%2A', 'keeps reserved encoded in fragment')
// hex is uppercased and unreserved is decoded
t.equal(fastURI.normalize('x://h/p#a%2a%7e'), 'x://h/p#a%2A~', 'uppercases hex and decodes unreserved in fragment')
// raw characters are still encoded
t.equal(fastURI.normalize('x://h/p#a b'), 'x://h/p#a%20b', 'encodes a raw space in fragment')
// `?` and `/` are allowed unencoded in a fragment
t.equal(fastURI.normalize('x://h/p#f?x/y'), 'x://h/p#f?x/y', 'keeps `?` and `/` raw in fragment')
t.end()
})
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DEPRECATED_ALIASES = void 0;
const DEPRECATED_ALIASES = exports.DEPRECATED_ALIASES = {
ModuleDeclaration: "ImportOrExportDeclaration"
};
//# sourceMappingURL=deprecated-aliases.js.map
@@ -0,0 +1,141 @@
import { McpServer } from '../../server/mcp.js';
import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js';
import * as z from 'zod/v4';
import { createMcpExpressApp } from '../../server/express.js';
const getServer = () => {
// Create an MCP server with implementation details
const server = new McpServer({
name: 'stateless-streamable-http-server',
version: '1.0.0'
}, { capabilities: { logging: {} } });
// Register a simple prompt
server.registerPrompt('greeting-template', {
description: 'A simple greeting prompt template',
argsSchema: {
name: z.string().describe('Name to include in greeting')
}
}, async ({ name }) => {
return {
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Please greet ${name} in a friendly manner.`
}
}
]
};
});
// Register a tool specifically for testing resumability
server.registerTool('start-notification-stream', {
description: 'Starts sending periodic notifications for testing resumability',
inputSchema: {
interval: z.number().describe('Interval in milliseconds between notifications').default(100),
count: z.number().describe('Number of notifications to send (0 for 100)').default(10)
}
}, async ({ interval, count }, extra) => {
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
let counter = 0;
while (count === 0 || counter < count) {
counter++;
try {
await server.sendLoggingMessage({
level: 'info',
data: `Periodic notification #${counter} at ${new Date().toISOString()}`
}, extra.sessionId);
}
catch (error) {
console.error('Error sending notification:', error);
}
// Wait for the specified interval
await sleep(interval);
}
return {
content: [
{
type: 'text',
text: `Started sending periodic notifications every ${interval}ms`
}
]
};
});
// Create a simple resource at a fixed URI
server.registerResource('greeting-resource', 'https://example.com/greetings/default', { mimeType: 'text/plain' }, async () => {
return {
contents: [
{
uri: 'https://example.com/greetings/default',
text: 'Hello, world!'
}
]
};
});
return server;
};
const app = createMcpExpressApp();
app.post('/mcp', async (req, res) => {
const server = getServer();
try {
const transport = new StreamableHTTPServerTransport({
sessionIdGenerator: undefined
});
await server.connect(transport);
await transport.handleRequest(req, res, req.body);
res.on('close', () => {
console.log('Request closed');
transport.close();
server.close();
});
}
catch (error) {
console.error('Error handling MCP request:', error);
if (!res.headersSent) {
res.status(500).json({
jsonrpc: '2.0',
error: {
code: -32603,
message: 'Internal server error'
},
id: null
});
}
}
});
app.get('/mcp', async (req, res) => {
console.log('Received GET MCP request');
res.writeHead(405).end(JSON.stringify({
jsonrpc: '2.0',
error: {
code: -32000,
message: 'Method not allowed.'
},
id: null
}));
});
app.delete('/mcp', async (req, res) => {
console.log('Received DELETE MCP request');
res.writeHead(405).end(JSON.stringify({
jsonrpc: '2.0',
error: {
code: -32000,
message: 'Method not allowed.'
},
id: null
}));
});
// Start the server
const PORT = 3000;
app.listen(PORT, error => {
if (error) {
console.error('Failed to start server:', error);
process.exit(1);
}
console.log(`MCP Stateless Streamable HTTP Server listening on port ${PORT}`);
});
// Handle server shutdown
process.on('SIGINT', async () => {
console.log('Shutting down server...');
process.exit(0);
});
//# sourceMappingURL=simpleStatelessStreamableHttp.js.map
@@ -0,0 +1,77 @@
{
"name": "minipass",
"version": "7.1.3",
"description": "minimal implementation of a PassThrough stream",
"main": "./dist/commonjs/index.js",
"types": "./dist/commonjs/index.d.ts",
"module": "./dist/esm/index.js",
"type": "module",
"tshy": {
"selfLink": false,
"compiler": "tsgo",
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts"
}
},
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
},
"files": [
"dist"
],
"scripts": {
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"prepare": "tshy",
"pretest": "npm run prepare",
"presnap": "npm run prepare",
"test": "tap",
"snap": "tap",
"format": "prettier --write . --loglevel warn",
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
},
"prettier": {
"semi": false,
"printWidth": 75,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"jsxSingleQuote": false,
"bracketSameLine": true,
"arrowParens": "avoid",
"endOfLine": "lf"
},
"devDependencies": {
"@types/end-of-stream": "^1.4.2",
"@types/node": "^25.2.3",
"end-of-stream": "^1.4.0",
"node-abort-controller": "^3.1.1",
"prettier": "^3.8.1",
"tap": "^21.6.1",
"through2": "^2.0.3",
"tshy": "^3.3.2",
"typedoc": "^0.28.17"
},
"repository": "https://github.com/isaacs/minipass",
"keywords": [
"passthrough",
"stream"
],
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"license": "BlueOak-1.0.0",
"engines": {
"node": ">=16 || 14 >=14.17"
}
}
@@ -0,0 +1,29 @@
# 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.0.1](https://github.com/ljharb/es-define-property/compare/v1.0.0...v1.0.1) - 2024-12-06
### Commits
- [types] use shared tsconfig [`954a663`](https://github.com/ljharb/es-define-property/commit/954a66360326e508a0e5daa4b07493d58f5e110e)
- [actions] split out node 10-20, and 20+ [`3a8e84b`](https://github.com/ljharb/es-define-property/commit/3a8e84b23883f26ff37b3e82ff283834228e18c6)
- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/get-intrinsic`, `@types/tape`, `auto-changelog`, `gopd`, `tape` [`86ae27b`](https://github.com/ljharb/es-define-property/commit/86ae27bb8cc857b23885136fad9cbe965ae36612)
- [Refactor] avoid using `get-intrinsic` [`02480c0`](https://github.com/ljharb/es-define-property/commit/02480c0353ef6118965282977c3864aff53d98b1)
- [Tests] replace `aud` with `npm audit` [`f6093ff`](https://github.com/ljharb/es-define-property/commit/f6093ff74ab51c98015c2592cd393bd42478e773)
- [Tests] configure testling [`7139e66`](https://github.com/ljharb/es-define-property/commit/7139e66959247a56086d9977359caef27c6849e7)
- [Dev Deps] update `tape` [`b901b51`](https://github.com/ljharb/es-define-property/commit/b901b511a75e001a40ce1a59fef7d9ffcfc87482)
- [Tests] fix types in tests [`469d269`](https://github.com/ljharb/es-define-property/commit/469d269fd141b1e773ec053a9fa35843493583e0)
- [Dev Deps] add missing peer dep [`733acfb`](https://github.com/ljharb/es-define-property/commit/733acfb0c4c96edf337e470b89a25a5b3724c352)
## v1.0.0 - 2024-02-12
### Commits
- Initial implementation, tests, readme, types [`3e154e1`](https://github.com/ljharb/es-define-property/commit/3e154e11a2fee09127220f5e503bf2c0a31dd480)
- Initial commit [`07d98de`](https://github.com/ljharb/es-define-property/commit/07d98de34a4dc31ff5e83a37c0c3f49e0d85cd50)
- npm init [`c4eb634`](https://github.com/ljharb/es-define-property/commit/c4eb6348b0d3886aac36cef34ad2ee0665ea6f3e)
- Only apps should have lockfiles [`7af86ec`](https://github.com/ljharb/es-define-property/commit/7af86ec1d311ec0b17fdfe616a25f64276903856)
@@ -0,0 +1,39 @@
{
"name": "path-key",
"version": "3.1.1",
"description": "Get the PATH environment variable key cross-platform",
"license": "MIT",
"repository": "sindresorhus/path-key",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"path",
"key",
"environment",
"env",
"variable",
"var",
"get",
"cross-platform",
"windows"
],
"devDependencies": {
"@types/node": "^11.13.0",
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}
@@ -0,0 +1,90 @@
'use strict';
var path = require('path');
var fs = require('fs');
var acorn = require('./acorn.js');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var acorn__namespace = /*#__PURE__*/_interopNamespaceDefault(acorn);
var inputFilePaths = [], forceFileName = false, fileMode = false, silent = false, compact = false, tokenize = false;
var options = {};
function help(status) {
var print = (status === 0) ? console.log : console.error;
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
print(" [--tokenize] [--locations] [--allow-hash-bang] [--allow-await-outside-function] [--compact] [--silent] [--module] [--help] [--] [<infile>...]");
process.exit(status);
}
for (var i = 2; i < process.argv.length; ++i) {
var arg = process.argv[i];
if (arg[0] !== "-" || arg === "-") { inputFilePaths.push(arg); }
else if (arg === "--") {
inputFilePaths.push.apply(inputFilePaths, process.argv.slice(i + 1));
forceFileName = true;
break
} else if (arg === "--locations") { options.locations = true; }
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
else if (arg === "--allow-await-outside-function") { options.allowAwaitOutsideFunction = true; }
else if (arg === "--silent") { silent = true; }
else if (arg === "--compact") { compact = true; }
else if (arg === "--help") { help(0); }
else if (arg === "--tokenize") { tokenize = true; }
else if (arg === "--module") { options.sourceType = "module"; }
else {
var match = arg.match(/^--ecma(\d+)$/);
if (match)
{ options.ecmaVersion = +match[1]; }
else
{ help(1); }
}
}
function run(codeList) {
var result = [], fileIdx = 0;
try {
codeList.forEach(function (code, idx) {
fileIdx = idx;
if (!tokenize) {
result = acorn__namespace.parse(code, options);
options.program = result;
} else {
var tokenizer = acorn__namespace.tokenizer(code, options), token;
do {
token = tokenizer.getToken();
result.push(token);
} while (token.type !== acorn__namespace.tokTypes.eof)
}
});
} catch (e) {
console.error(fileMode ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + inputFilePaths[fileIdx] + " " + m.slice(1); }) : e.message);
process.exit(1);
}
if (!silent) { console.log(JSON.stringify(result, function (_, value) { return typeof value === "bigint" ? null : value; }, compact ? null : 2)); }
}
if (fileMode = inputFilePaths.length && (forceFileName || !inputFilePaths.includes("-") || inputFilePaths.length !== 1)) {
run(inputFilePaths.map(function (path) { return fs.readFileSync(path, "utf8"); }));
} else {
var code = "";
process.stdin.resume();
process.stdin.on("data", function (chunk) { return code += chunk; });
process.stdin.on("end", function () { return run([code]); });
}
@@ -0,0 +1,12 @@
import { useMatch } from "./useMatch.js";
//#region src/useRouteContext.ts
function useRouteContext(opts) {
return useMatch({
...opts,
select: (match) => opts.select ? opts.select(match.context) : match.context
});
}
//#endregion
export { useRouteContext };
//# sourceMappingURL=useRouteContext.js.map
@@ -0,0 +1,2 @@
import { TCreateConverter, TPatternConverter } from './typings';
export default function compilePattern(pattern: string, createConverter: TCreateConverter, literalConverter: (text: string) => TPatternConverter): TPatternConverter[];
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,QAAQ,EAAE,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzI,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAExB,KAAK,4BAA4B,EAEjC,KAAK,8BAA8B,EACnC,KAAK,mCAAmC,EACxC,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAIjB,KAAK,cAAc,EAMnB,KAAK,gBAAgB,EAIrB,KAAK,0BAA0B,EAE/B,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,YAAY,EAQjB,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,MAAM,EACd,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAkB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,eAAe,EAA8C,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC5G,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG1E,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG;IAC1C;;OAEG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAElC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC7C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,MAAM,CACf,QAAQ,SAAS,OAAO,GAAG,OAAO,EAClC,aAAa,SAAS,YAAY,GAAG,YAAY,EACjD,OAAO,SAAS,MAAM,GAAG,MAAM,CACjC,SAAQ,QAAQ,CAAC,aAAa,GAAG,QAAQ,EAAE,kBAAkB,GAAG,aAAa,EAAE,YAAY,GAAG,OAAO,CAAC;IAiBhG,OAAO,CAAC,WAAW;IAhBvB,OAAO,CAAC,mBAAmB,CAAC,CAAqB;IACjD,OAAO,CAAC,cAAc,CAAC,CAAiB;IACxC,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,oBAAoB,CAAsB;IAClD,OAAO,CAAC,aAAa,CAAC,CAAuE;IAE7F;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAE3B;;OAEG;gBAES,WAAW,EAAE,cAAc,EACnC,OAAO,CAAC,EAAE,aAAa;IAwB3B;;;;;;OAMG;IACH,IAAI,YAAY,IAAI;QAAE,KAAK,EAAE,uBAAuB,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,CAAA;KAAE,CAOvF;IAGD,OAAO,CAAC,cAAc,CAA+C;IAGrE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6E;IAGhH,OAAO,CAAC,gBAAgB,CAGtB;IAEF;;;;OAIG;IACI,oBAAoB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;IAOnE;;OAEG;IACa,iBAAiB,CAAC,CAAC,SAAS,eAAe,EACvD,aAAa,EAAE,CAAC,EAChB,OAAO,EAAE,CACL,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EACxB,KAAK,EAAE,mBAAmB,CAAC,aAAa,GAAG,QAAQ,EAAE,kBAAkB,GAAG,aAAa,CAAC,KACvF,YAAY,GAAG,OAAO,GAAG,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,GAC9D,IAAI;IA6DP,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI;IA0BrE,SAAS,CAAC,4BAA4B,CAAC,MAAM,EAAE,CAAC,kBAAkB,GAAG,aAAa,CAAC,CAAC,QAAQ,CAAC,GAAG,IAAI;IA2CpG,SAAS,CAAC,8BAA8B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IA0D9D,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIpD,SAAS,CAAC,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;YAU7C,aAAa;IAgB3B;;OAEG;IACH,qBAAqB,IAAI,kBAAkB,GAAG,SAAS;IAIvD;;OAEG;IACH,gBAAgB,IAAI,cAAc,GAAG,SAAS;IAI9C,OAAO,CAAC,eAAe;IAIjB,IAAI;;;;;;;;;IAIV;;;OAGG;IACG,aAAa,CAAC,MAAM,EAAE,8BAA8B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAEnH;;;OAGG;IACG,aAAa,CAAC,MAAM,EAAE,mCAAmC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAEjI;;;OAGG;IACG,aAAa,CACf,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EACtC,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,mBAAmB,GAAG,4BAA4B,CAAC;IAwD9D;;;;;;OAMG;IACG,WAAW,CAAC,MAAM,EAAE,uBAAuB,GAAG,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAgD5H;;;;;;;OAOG;IACH,mCAAmC,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;IAiBxG,SAAS,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc;;;;;;;;;;;;;;;IAI7E;;;;;;OAMG;IACG,kBAAkB,CAAC,MAAM,EAAE,0BAA0B,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM;IAQnF,mBAAmB,CAAC,MAAM,EAAE,2BAA2B,CAAC,QAAQ,CAAC;IAOjE,uBAAuB;IAMvB,mBAAmB;IAInB,qBAAqB;CAG9B"}
@@ -0,0 +1,162 @@
/**
* This feature allows the distribution of a Node.js application conveniently to a
* system that does not have Node.js installed.
*
* Node.js supports the creation of [single executable applications](https://github.com/nodejs/single-executable) by allowing
* the injection of a blob prepared by Node.js, which can contain a bundled script,
* into the `node` binary. During start up, the program checks if anything has been
* injected. If the blob is found, it executes the script in the blob. Otherwise
* Node.js operates as it normally does.
*
* The single executable application feature currently only supports running a
* single embedded script using the `CommonJS` module system.
*
* Users can create a single executable application from their bundled script
* with the `node` binary itself and any tool which can inject resources into the
* binary.
*
* Here are the steps for creating a single executable application using one such
* tool, [postject](https://github.com/nodejs/postject):
*
* 1. Create a JavaScript file:
* ```bash
* echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js
* ```
* 2. Create a configuration file building a blob that can be injected into the
* single executable application (see `Generating single executable preparation blobs` for details):
* ```bash
* echo '{ "main": "hello.js", "output": "sea-prep.blob" }' > sea-config.json
* ```
* 3. Generate the blob to be injected:
* ```bash
* node --experimental-sea-config sea-config.json
* ```
* 4. Create a copy of the `node` executable and name it according to your needs:
* * On systems other than Windows:
* ```bash
* cp $(command -v node) hello
* ```
* * On Windows:
* ```text
* node -e "require('fs').copyFileSync(process.execPath, 'hello.exe')"
* ```
* The `.exe` extension is necessary.
* 5. Remove the signature of the binary (macOS and Windows only):
* * On macOS:
* ```bash
* codesign --remove-signature hello
* ```
* * On Windows (optional):
* [signtool](https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool) can be used from the installed [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/).
* If this step is
* skipped, ignore any signature-related warning from postject.
* ```powershell
* signtool remove /s hello.exe
* ```
* 6. Inject the blob into the copied binary by running `postject` with
* the following options:
* * `hello` / `hello.exe` \- The name of the copy of the `node` executable
* created in step 4.
* * `NODE_SEA_BLOB` \- The name of the resource / note / section in the binary
* where the contents of the blob will be stored.
* * `sea-prep.blob` \- The name of the blob created in step 1.
* * `--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2` \- The [fuse](https://www.electronjs.org/docs/latest/tutorial/fuses) used by the Node.js project to detect if a file has been
* injected.
* * `--macho-segment-name NODE_SEA` (only needed on macOS) - The name of the
* segment in the binary where the contents of the blob will be
* stored.
* To summarize, here is the required command for each platform:
* * On Linux:
* ```bash
* npx postject hello NODE_SEA_BLOB sea-prep.blob \
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
* ```
* * On Windows - PowerShell:
* ```powershell
* npx postject hello.exe NODE_SEA_BLOB sea-prep.blob `
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
* ```
* * On Windows - Command Prompt:
* ```text
* npx postject hello.exe NODE_SEA_BLOB sea-prep.blob ^
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
* ```
* * On macOS:
* ```bash
* npx postject hello NODE_SEA_BLOB sea-prep.blob \
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
* --macho-segment-name NODE_SEA
* ```
* 7. Sign the binary (macOS and Windows only):
* * On macOS:
* ```bash
* codesign --sign - hello
* ```
* * On Windows (optional):
* A certificate needs to be present for this to work. However, the unsigned
* binary would still be runnable.
* ```powershell
* signtool sign /fd SHA256 hello.exe
* ```
* 8. Run the binary:
* * On systems other than Windows
* ```console
* $ ./hello world
* Hello, world!
* ```
* * On Windows
* ```console
* $ .\hello.exe world
* Hello, world!
* ```
* @since v19.7.0, v18.16.0
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v24.x/src/node_sea.cc)
*/
declare module "node:sea" {
type AssetKey = string;
/**
* @since v20.12.0
* @return Whether this script is running inside a single-executable application.
*/
function isSea(): boolean;
/**
* This method can be used to retrieve the assets configured to be bundled into the
* single-executable application at build time.
* An error is thrown when no matching asset can be found.
* @since v20.12.0
*/
function getAsset(key: AssetKey): ArrayBuffer;
function getAsset(key: AssetKey, encoding: string): string;
/**
* Similar to `sea.getAsset()`, but returns the result in a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob).
* An error is thrown when no matching asset can be found.
* @since v20.12.0
*/
function getAssetAsBlob(key: AssetKey, options?: {
type: string;
}): Blob;
/**
* This method can be used to retrieve the assets configured to be bundled into the
* single-executable application at build time.
* An error is thrown when no matching asset can be found.
*
* Unlike `sea.getRawAsset()` or `sea.getAssetAsBlob()`, this method does not
* return a copy. Instead, it returns the raw asset bundled inside the executable.
*
* For now, users should avoid writing to the returned array buffer. If the
* injected section is not marked as writable or not aligned properly,
* writes to the returned array buffer is likely to result in a crash.
* @since v20.12.0
*/
function getRawAsset(key: AssetKey): ArrayBuffer;
/**
* This method can be used to retrieve an array of all the keys of assets
* embedded into the single-executable application.
* An error is thrown when not running inside a single-executable application.
* @since v24.8.0
* @returns An array containing all the keys of the assets
* embedded in the executable. If no assets are embedded, returns an empty array.
*/
function getAssetKeys(): string[];
}
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const esnext_sharedmemory: LibDefinition;
@@ -0,0 +1,46 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const Hook = require("./Hook");
const HookCodeFactory = require("./HookCodeFactory");
class SyncHookCodeFactory extends HookCodeFactory {
content({ onError, onDone, rethrowIfPossible }) {
return this.callTapsSeries({
onError: (i, err) => onError(err),
onDone,
rethrowIfPossible
});
}
}
const factory = new SyncHookCodeFactory();
const TAP_ASYNC = () => {
throw new Error("tapAsync is not supported on a SyncHook");
};
const TAP_PROMISE = () => {
throw new Error("tapPromise is not supported on a SyncHook");
};
function COMPILE(options) {
factory.setup(this, options);
return factory.create(options);
}
function SyncHook(args = [], name = undefined) {
const hook = new Hook(args, name);
hook.constructor = SyncHook;
hook.tapAsync = TAP_ASYNC;
hook.tapPromise = TAP_PROMISE;
hook.compile = COMPILE;
return hook;
}
SyncHook.prototype = null;
module.exports = SyncHook;
@@ -0,0 +1,2 @@
declare const _default: (word: string) => number;
export default _default;
@@ -0,0 +1,634 @@
import * as common from './common';
import { Address4 } from './ipv4';
interface SixToFourProperties {
prefix: string;
gateway: string;
}
interface TeredoProperties {
prefix: string;
server4: string;
client4: string;
flags: string;
coneNat: boolean;
microsoft: {
reserved: boolean;
universalLocal: boolean;
groupIndividual: boolean;
nonce: string;
};
udpPort: string;
}
/**
* Represents an IPv6 address
* @param {string} address - An IPv6 address string
* @param {number} [groups=8] - How many octets to parse
* @example
* var address = new Address6('2001::/32');
*/
export declare class Address6 {
address4?: Address4;
address: string;
addressMinusSuffix: string;
elidedGroups?: number;
elisionBegin?: number;
elisionEnd?: number;
groups: number;
parsedAddress4?: string;
parsedAddress: string[];
parsedSubnet: string;
subnet: string;
subnetMask: number;
v4: boolean;
zone: string;
private _binaryZeroPad?;
constructor(address: string, optionalGroups?: number);
/**
* Returns true if the given string is a valid IPv6 address (with optional
* CIDR subnet and zone identifier), false otherwise. Host bits in the
* subnet portion are allowed (e.g. `2001:db8::1/32` is valid); for strict
* network-address validation compare `correctForm()` to
* `startAddress().correctForm()`, or use `networkForm()`.
*/
static isValid(address: string): boolean;
/**
* Convert a BigInt to a v6 address object. The value must be in the
* range `[0, 2**128 - 1]`; otherwise `AddressError` is thrown.
* @param {bigint} bigInt - a BigInt to convert
* @returns {Address6}
* @example
* var bigInt = BigInt('1000000000000');
* var address = Address6.fromBigInt(bigInt);
* address.correctForm(); // '::e8:d4a5:1000'
*/
static fromBigInt(bigInt: bigint): Address6;
/**
* Parse a URL (with optional bracketed host and port) into an address and
* port. Returns either `{ address, port }` on success or
* `{ error, address: null, port: null }` if the URL could not be parsed.
* Ports are returned as numbers (or `null` if absent or out of range).
* @example
* var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/');
* addressAndPort.address.correctForm(); // 'ffff::'
* addressAndPort.port; // 8080
*/
static fromURL(url: string): {
error: string;
address: null;
port: null;
} | {
address: Address6;
port: number | null;
error?: undefined;
};
/**
* Construct an `Address6` from an address and a hex subnet mask given as
* separate strings (e.g. as returned by Node's `os.networkInterfaces()`).
* Throws `AddressError` if the mask is non-contiguous (e.g.
* `ffff::ffff`).
* @example
* var address = Address6.fromAddressAndMask('fe80::1', 'ffff:ffff:ffff:ffff::');
* address.subnetMask; // 64
*/
static fromAddressAndMask(address: string, mask: string): Address6;
/**
* Construct an `Address6` from an address and a Cisco-style wildcard mask
* given as separate strings (e.g. `::ffff:ffff:ffff:ffff` for a `/64`).
* The wildcard mask is the bitwise inverse of the subnet mask. Throws
* `AddressError` if the mask is non-contiguous.
* @example
* var address = Address6.fromAddressAndWildcardMask('fe80::1', '::ffff:ffff:ffff:ffff');
* address.subnetMask; // 64
*/
static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address6;
/**
* Construct an `Address6` from a wildcard pattern with trailing `*`
* groups. The number of trailing wildcards determines the prefix
* length: each `*` represents 16 bits. `::` is expanded to zero groups
* (not wildcards) before evaluating trailing wildcards.
*
* Only trailing whole-group wildcards are supported. Partial-group
* wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g.
* `*::1`) throw `AddressError`.
* @example
* Address6.fromWildcard('2001:db8:*:*:*:*:*:*').subnet; // '/32'
* Address6.fromWildcard('2001:db8::*').subnet; // '/112'
* Address6.fromWildcard('*:*:*:*:*:*:*:*').subnet; // '/0'
*/
static fromWildcard(input: string): Address6;
/**
* Create an IPv6-mapped address given an IPv4 address
* @param {string} address - An IPv4 address string
* @returns {Address6}
* @example
* var address = Address6.fromAddress4('192.168.0.1');
* address.correctForm(); // '::ffff:c0a8:1'
* address.to4in6(); // '::ffff:192.168.0.1'
*/
static fromAddress4(address: string): Address6;
/**
* Return an address from ip6.arpa form. A full 32-nibble name gives a /128
* address; a shorter name, as used for a delegated reverse zone, gives the
* network it covers, with a subnet mask of four bits per nibble, so
* `fromArpa(x.reverseForm())` round-trips {@link reverseForm} for any prefix.
* @param {string} arpaFormAddress - an 'ip6.arpa' form address
* @returns {Adress6}
* @example
* var address = Address6.fromArpa(e.f.f.f.3.c.2.6.f.f.f.e.6.6.8.e.1.0.6.7.9.4.e.c.0.0.0.0.1.0.0.2.ip6.arpa.)
* address.correctForm(); // '2001:0:ce49:7601:e866:efff:62c3:fffe'
* Address6.fromArpa('8.b.d.0.1.0.0.2.ip6.arpa.').networkForm(); // '2001:db8::/32'
*/
static fromArpa(arpaFormAddress: string): Address6;
/**
* Return the Microsoft UNC transcription of the address
* @returns {String} the Microsoft UNC transcription of the address
*/
microsoftTranscription(): string;
/**
* Return the first n bits of the address, defaulting to the subnet mask
* @param {number} [mask=subnet] - the number of bits to mask
* @returns {String} the first n bits of the address as a string
*/
mask(mask?: number): string;
/**
* Return the number of possible subnets of a given size in the address
* @param {number} [subnetSize=128] - the subnet size
* @returns {String}
*/
possibleSubnets(subnetSize?: number): string;
/**
* Helper function getting start address.
* @returns {bigint}
*/
_startAddress(): bigint;
/**
* The first address in the range given by this address' subnet
* Often referred to as the Network Address.
* @returns {Address6}
*/
startAddress(): Address6;
/**
* The first host address in the range given by this address's subnet ie
* the first address after the Network Address
* @returns {Address6}
*/
startAddressExclusive(): Address6;
/**
* Helper function getting end address.
* @returns {bigint}
*/
_endAddress(): bigint;
/**
* The last address in the range given by this address's subnet. IPv6 has
* no broadcast address, so this is an ordinary assignable address (in a
* 64-bit-interface-identifier subnet it falls inside the reserved
* subnet-anycast block of [RFC 2526](https://datatracker.ietf.org/doc/html/rfc2526)).
* @returns {Address6}
*/
endAddress(): Address6;
/**
* The address one before {@link endAddress}. This is the IPv6 counterpart
* of the IPv4 method that skips the broadcast address; IPv6 has no broadcast,
* so it drops exactly one address and does not model the 128 reserved
* subnet-anycast identifiers of [RFC 2526](https://datatracker.ietf.org/doc/html/rfc2526).
* @returns {Address6}
*/
endAddressExclusive(): Address6;
/**
* Returns the address `n` addresses after this one (or before, when `n` is
* negative), keeping this address's subnet mask. Throws `AddressError` when
* the result would fall outside the IPv6 address space or `n` is not an
* integer.
* @param {number | bigint} n
* @returns {Address6}
* @example
* new Address6('2001:db8::/64').offset(1).correctForm(); // '2001:db8::1'
*/
offset(n: number | bigint): Address6;
/**
* Returns the network that follows this address's network: the address after
* {@link endAddress}, with the same subnet mask. Throws `AddressError` when
* this network is the last one in the address space.
* @returns {Address6}
* @example
* new Address6('2001:db8::/64').nextNetwork().networkForm(); // '2001:db8:0:1::/64'
*/
nextNetwork(): Address6;
private withSubnetMask;
/**
* The hex form of the subnet mask, e.g. `ffff:ffff:ffff:ffff::` for a
* `/64`. Returns an `Address6`; call `.correctForm()` for the string.
* @returns {Address6}
*/
subnetMaskAddress(): Address6;
/**
* The Cisco-style wildcard mask, e.g. `::ffff:ffff:ffff:ffff` for a
* `/64`. This is the bitwise inverse of `subnetMaskAddress()`. Returns
* an `Address6`; call `.correctForm()` for the string.
* @returns {Address6}
*/
wildcardMask(): Address6;
/**
* The network address in CIDR string form, e.g. `2001:db8::/32` for
* `2001:db8::1/32`. For an address with no explicit subnet the prefix
* is `/128`, e.g. `networkForm()` on `2001:db8::1` returns
* `2001:db8::1/128`.
* @returns {string}
*/
networkForm(): string;
/**
* Return the scope of the address. The 4-bit scope field
* ([RFC 4291 §2.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.7))
* is only defined for multicast addresses; for unicast addresses the scope
* is derived from the address type per
* [RFC 4007 §6](https://datatracker.ietf.org/doc/html/rfc4007#section-6).
* @returns {String}
*/
getScope(): string;
/**
* Return the type of the address
* @returns {String}
*/
getType(): string;
/**
* Return the bits in the given range as a BigInt
* @returns {bigint}
*/
getBits(start: number, end: number): bigint;
/**
* Return the bits in the given range as a base-2 string
* @returns {String}
*/
getBitsBase2(start: number, end: number): string;
/**
* Return the bits in the given range as a base-16 string
* @returns {String}
*/
getBitsBase16(start: number, end: number): string;
/**
* Return the bits that are set past the subnet mask length
* @returns {String}
*/
getBitsPastSubnet(): string;
/**
* Return the reversed ip6.arpa form of the address
* @param {Object} options
* @param {boolean} options.omitSuffix - omit the "ip6.arpa" suffix
* @returns {String}
*/
reverseForm(options?: common.ReverseFormOptions): string;
/**
* Returns the address in correct form, per
* [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros
* stripped, the longest run of zero groups collapsed to `::`, and hex digits
* lowercased (e.g. `2001:db8::1`). This is the recommended form for display.
*/
correctForm(): string;
/**
* Return a zero-padded base-2 string representation of the address
* @returns {String}
* @example
* var address = new Address6('2001:4860:4001:803::1011');
* address.binaryZeroPad();
* // '0010000000000001010010000110000001000000000000010000100000000011
* // 0000000000000000000000000000000000000000000000000001000000010001'
*/
binaryZeroPad(): string;
/**
* Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the
* trailing IPv4 address into `this.address4` / `this.parsedAddress4` and
* returning the address with the v4 portion converted to two v6 groups.
* Used internally by `parse()`.
*/
parse4in6(address: string): string;
/**
* Parses an IPv6 address string into its 8 hexadecimal groups (expanding
* any `::` elision and any trailing v4-in-v6 portion) and stores the result
* on `this.parsedAddress`. Called automatically by the constructor; you
* typically don't need to call it directly. Throws `AddressError` if the
* input is malformed.
*/
parse(address: string): string[];
/**
* Returns the canonical (fully expanded) form of the address: all 8 groups,
* each padded to 4 hex digits, with no `::` collapsing
* (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and
* byte-exact comparison.
*/
canonicalForm(): string;
/**
* Return the decimal form of the address
* @returns {String}
*/
decimal(): string;
/**
* Return the address as a BigInt
* @returns {bigint}
*/
bigInt(): bigint;
/**
* Return the last two groups of this address as an IPv4 address string.
* If this address carries a CIDR prefix that covers the trailing 32 bits
* (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the
* corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to
* `/32`.
* @returns {Address4}
* @example
* var address = new Address6('2001:4860:4001::1825:bf11');
* address.to4().correctForm(); // '24.37.191.17'
*/
to4(): Address4;
/**
* Return the v4-in-v6 form of the address
* @returns {String}
*/
to4in6(): string;
/**
* Decodes the Teredo tunneling fields embedded in this address. Returns the
* Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag,
* UDP port, and Microsoft-format flag breakdown (reserved, universal/local,
* group/individual, nonce). Only meaningful for addresses in `2001::/32`.
*/
inspectTeredo(): TeredoProperties;
/**
* Decodes the 6to4 tunneling fields embedded in this address. Returns the
* 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for
* addresses in `2002::/16`.
*/
inspect6to4(): SixToFourProperties;
/**
* Return a v6 6to4 address from a v6 v4inv6 address
* @returns {Address6}
*/
to6to4(): Address6 | null;
/**
* Embed an IPv4 address into a NAT64 IPv6 address using the encoding
* defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
* The default prefix is the well-known prefix `64:ff9b::/96`. The prefix
* length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter
* than /64 the IPv4 octets are split around the reserved bits 64–71.
* @example
* Address6.fromAddress4Nat64('192.0.2.33').correctForm(); // '64:ff9b::c000:221'
* Address6.fromAddress4Nat64('192.0.2.33', '2001:db8::/32').correctForm(); // '2001:db8:c000:221::'
*/
static fromAddress4Nat64(address: string, prefix?: string): Address6;
/**
* Extract the embedded IPv4 address from a NAT64 IPv6 address using the
* encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
* The default prefix is the well-known prefix `64:ff9b::/96`. Returns
* `null` if this address is not contained within the given prefix.
* @example
* new Address6('64:ff9b::c000:221').toAddress4Nat64()!.correctForm(); // '192.0.2.33'
*/
toAddress4Nat64(prefix?: string): Address4 | null;
/**
* Return a byte array.
*
* To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`.
* @returns {Array}
*/
toByteArray(): number[];
/**
* Return an unsigned byte array.
*
* To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`.
* @returns {Array}
*/
toUnsignedByteArray(): number[];
/**
* Convert a byte array to an Address6 object.
*
* Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an
* `Int8Array` or a Java `byte[]` holds them), folding signed values to their
* unsigned equivalent. Throws `AddressError` unless given exactly 16
* integers from -128 to 255.
*
* To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`.
* @returns {Address6}
*/
static fromByteArray(bytes: Array<number>): Address6;
/**
* Convert an unsigned byte array to an Address6 object.
*
* Throws `AddressError` unless given exactly 16 integers from 0 to 255.
*
* To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`.
* @returns {Address6}
*/
static fromUnsignedByteArray(bytes: Array<number>): Address6;
/**
* Returns true if the given address is in the subnet of the current address.
* An `Address4` is never in the subnet of an `Address6`; convert with
* `Address6.fromAddress4()` or `to4()` to compare across families.
* @returns {boolean}
*/
isInSubnet: typeof common.isInSubnet;
/**
* Returns true if this address's host bits fall inside the given subnet,
* ignoring this address's own subnet mask. Prefer this over `isInSubnet`
* when classifying a single address, so the answer doesn't change with the
* CIDR suffix the caller happened to write — notably when the address came
* from untrusted input and the result backs a trust-boundary decision.
* An `Address4` is never in the subnet of an `Address6`; convert with
* `Address6.fromAddress4()` or `to4()` to compare across families.
* @returns {boolean}
*/
isHostInSubnet: typeof common.isHostInSubnet;
/**
* Returns true if the address is correct, false otherwise
* @returns {boolean}
*/
isCorrect: (this: Address4 | Address6) => boolean;
/**
* Returns true if the address is in the canonical form, false otherwise
* @returns {boolean}
*/
isCanonical(): boolean;
/**
* Returns true if the address is a link-local unicast address in `fe80::/10`
* ([RFC 4291 §2.4](https://datatracker.ietf.org/doc/html/rfc4291#section-2.4))
* or an IPv4-mapped / NAT64 address whose embedded IPv4 address is link-local
* (`169.254.0.0/16`, e.g. `::ffff:169.254.169.254`), false otherwise.
* @returns {boolean}
*/
isLinkLocal(): boolean;
/**
* Returns true if the address is a multicast address, false otherwise
* @returns {boolean}
*/
isMulticast(): boolean;
/**
* Returns true if the address was written in v4-in-v6 dotted-quad notation
* (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag
* and does not reflect whether the address bits lie in the IPv4-mapped
* (`::ffff:0:0/96`) subnet — for that, see {@link isMapped4}.
* @returns {boolean}
*/
is4(): boolean;
/**
* Returns true if the address is an IPv4-mapped IPv6 address in
* `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)),
* false otherwise. Unlike {@link is4}, this checks the underlying address
* bits rather than the textual notation, so `::ffff:127.0.0.1` and
* `::ffff:7f00:1` both return true.
* @returns {boolean}
*/
isMapped4(): boolean;
/**
* If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped
* (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`,
* [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that
* embedded address as an {@link Address4}; otherwise return null.
*
* The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`,
* `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and
* delegate to the embedded {@link Address4} when present, so a literal such as
* `::ffff:127.0.0.1` is classified by what it actually reaches (loopback)
* rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped).
* This matters wherever the checks back a trust-boundary decision (e.g. an
* SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`,
* `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as
* non-internal.
* @returns {Address4 | null}
*/
embeddedIPv4(): Address4 | null;
/**
* Returns true if the address is a Teredo address, false otherwise
* @returns {boolean}
*/
isTeredo(): boolean;
/**
* Returns true if the address is a 6to4 address, false otherwise
* @returns {boolean}
*/
is6to4(): boolean;
/**
* Returns true if the address is a loopback address, false otherwise
* @returns {boolean}
*/
isLoopback(): boolean;
/**
* Returns true if the address is a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)). ULAs are the IPv6 equivalent of IPv4 [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private addresses.
* @returns {boolean}
*/
isULA(): boolean;
/**
* Returns true if the address is private, i.e. a Unique Local Address in
* `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)), an
* address in the NAT64 local-use range `64:ff9b:1::/48`
* ([RFC 8215](https://datatracker.ietf.org/doc/html/rfc8215)), or an
* IPv4-mapped / NAT64 well-known address whose embedded IPv4 address is in
* one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918)
* private ranges (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to
* {@link Address4.isPrivate}; use it instead of {@link isULA} when you need to
* catch mapped RFC 1918 addresses as well as native ULAs.
*
* The local-use NAT64 range is reported private as a whole rather than by
* its embedded IPv4 address: an operator may carve a prefix of any RFC 6052
* length out of `64:ff9b:1::/48`, so the same bits decode to different IPv4
* addresses under different deployments and no single decoding is correct.
* Use {@link toAddress4Nat64} with the deployment's prefix to decode one.
* @returns {boolean}
*/
isPrivate(): boolean;
/**
* Returns true if the address is an IPv4-mapped / NAT64 address whose embedded
* IPv4 address is in the carrier-grade NAT range `100.64.0.0/10`
* ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false
* otherwise. There is no native IPv6 CGNAT range, so this only ever returns
* true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`).
* @returns {boolean}
*/
isCGNAT(): boolean;
/**
* Returns true if the address is an IPv4-mapped / NAT64 address whose embedded
* IPv4 address is the limited broadcast address `255.255.255.255`
* ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise.
* There is no IPv6 broadcast, so this only ever returns true for an embedded
* IPv4 address (e.g. `::ffff:255.255.255.255`).
* @returns {boolean}
*/
isBroadcast(): boolean;
/**
* Returns true if the address is the unspecified address `::`.
* @returns {boolean}
*/
isUnspecified(): boolean;
/**
* Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)).
* @returns {boolean}
*/
isDocumentation(): boolean;
/**
* Returns true if the address is in the benchmarking range `2001:2::/48`
* ([RFC 5180](https://datatracker.ietf.org/doc/html/rfc5180)) or is an
* IPv4-mapped / NAT64 address whose embedded IPv4 address is in
* `198.18.0.0/15`, false otherwise.
* @returns {boolean}
*/
isBenchmarking(): boolean;
/**
* Returns true if the address is globally reachable: inside the global
* unicast allocation `2000::/3` (the only range the [IANA IPv6 Address Space
* Registry](https://www.iana.org/assignments/ipv6-address-space/) assigns
* for global unicast; everything else is reserved, ULA, link-local, or
* multicast) and not in any block the [IANA IPv6 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv6-special-registry/)
* marks as not globally reachable. An IPv4-mapped or NAT64 well-known
* address answers for its embedded IPv4 address, so `::ffff:10.0.0.1` and
* `64:ff9b::7f00:1` are not global. Teredo (`2001::/32`) and 6to4
* (`2002::/16`) are not global either: the registry lists them as N/A and a
* packet to one needs a relay.
*
* This covers everything the individual classifiers name and the blocks they
* do not: the discard-only prefix `100::/64`, the IETF protocol assignments
* in `2001::/23`, the deprecated site-local `fec0::/10` and IPv4-compatible
* `::/96` ranges, and unallocated space such as `4000::/3`. It is the single
* predicate to use where a request must not reach an internal or
* special-purpose destination; see SECURITY.md.
* @returns {boolean}
*/
isGlobal(): boolean;
/**
* Returns the address as an HTTP URL with the host bracketed, e.g.
* `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended,
* e.g. `http://[2001:db8::1]:8080/`.
*/
href(optionalPort?: number | string): string;
/**
* Returns an HTML `<a>` element whose `href` encodes the address in a URL
* hash fragment (default prefix `/#address=`). Useful for linking between
* pages of an address-inspector UI.
* @param options.className - CSS class for the rendered `<a>` element
* @param options.prefix - hash prefix prepended to the address (default `/#address=`)
* @param options.v4 - when true, render the address in v4-in-v6 form
*/
link(options?: {
className?: string;
prefix?: string;
v4?: boolean;
}): string;
/**
* Groups an address.
*
* Returns an HTML fragment: each group is wrapped in a `<span>` carrying
* the group classes an address-inspector UI hovers on. The address content
* is HTML-escaped; anything you concatenate around it is your
* responsibility.
* @returns {String}
*/
group(): string;
/**
* Generate a regular expression string that can be used to find or validate
* all variations of this address
* @param {boolean} substringSearch
* @returns {string}
*/
regularExpressionString(this: Address6, substringSearch?: boolean): string;
/**
* Generate a regular expression that can be used to find or validate all
* variations of this address.
* @param {boolean} substringSearch
* @returns {RegExp}
*/
regularExpression(this: Address6, substringSearch?: boolean): RegExp;
}
export {};
@@ -0,0 +1,160 @@
"use client";
// src/switch.tsx
import * as React from "react";
import { composeEventHandlers } from "@radix-ui/primitive";
import { useComposedRefs } from "@radix-ui/react-compose-refs";
import { createContextScope } from "@radix-ui/react-context";
import { useControllableState } from "@radix-ui/react-use-controllable-state";
import { usePrevious } from "@radix-ui/react-use-previous";
import { useSize } from "@radix-ui/react-use-size";
import { Primitive } from "@radix-ui/react-primitive";
import { jsx, jsxs } from "react/jsx-runtime";
var SWITCH_NAME = "Switch";
var [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);
var [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME);
var Switch = React.forwardRef(
(props, forwardedRef) => {
const {
__scopeSwitch,
name,
checked: checkedProp,
defaultChecked,
required,
disabled,
value = "on",
onCheckedChange,
form,
...switchProps
} = props;
const [button, setButton] = React.useState(null);
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
const hasConsumerStoppedPropagationRef = React.useRef(false);
const isFormControl = button ? form || !!button.closest("form") : true;
const [checked, setChecked] = useControllableState({
prop: checkedProp,
defaultProp: defaultChecked ?? false,
onChange: onCheckedChange,
caller: SWITCH_NAME
});
return /* @__PURE__ */ jsxs(SwitchProvider, { scope: __scopeSwitch, checked, disabled, children: [
/* @__PURE__ */ jsx(
Primitive.button,
{
type: "button",
role: "switch",
"aria-checked": checked,
"aria-required": required,
"data-state": getState(checked),
"data-disabled": disabled ? "" : void 0,
disabled,
value,
...switchProps,
ref: composedRefs,
onClick: composeEventHandlers(props.onClick, (event) => {
setChecked((prevChecked) => !prevChecked);
if (isFormControl) {
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
}
})
}
),
isFormControl && /* @__PURE__ */ jsx(
SwitchBubbleInput,
{
control: button,
bubbles: !hasConsumerStoppedPropagationRef.current,
name,
value,
checked,
required,
disabled,
form,
style: { transform: "translateX(-100%)" }
}
)
] });
}
);
Switch.displayName = SWITCH_NAME;
var THUMB_NAME = "SwitchThumb";
var SwitchThumb = React.forwardRef(
(props, forwardedRef) => {
const { __scopeSwitch, ...thumbProps } = props;
const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
return /* @__PURE__ */ jsx(
Primitive.span,
{
"data-state": getState(context.checked),
"data-disabled": context.disabled ? "" : void 0,
...thumbProps,
ref: forwardedRef
}
);
}
);
SwitchThumb.displayName = THUMB_NAME;
var BUBBLE_INPUT_NAME = "SwitchBubbleInput";
var SwitchBubbleInput = React.forwardRef(
({
__scopeSwitch,
control,
checked,
bubbles = true,
...props
}, forwardedRef) => {
const ref = React.useRef(null);
const composedRefs = useComposedRefs(ref, forwardedRef);
const prevChecked = usePrevious(checked);
const controlSize = useSize(control);
React.useEffect(() => {
const input = ref.current;
if (!input) return;
const inputProto = window.HTMLInputElement.prototype;
const descriptor = Object.getOwnPropertyDescriptor(
inputProto,
"checked"
);
const setChecked = descriptor.set;
if (prevChecked !== checked && setChecked) {
const event = new Event("click", { bubbles });
setChecked.call(input, checked);
input.dispatchEvent(event);
}
}, [prevChecked, checked, bubbles]);
return /* @__PURE__ */ jsx(
"input",
{
type: "checkbox",
"aria-hidden": true,
defaultChecked: checked,
...props,
tabIndex: -1,
ref: composedRefs,
style: {
...props.style,
...controlSize,
position: "absolute",
pointerEvents: "none",
opacity: 0,
margin: 0
}
}
);
}
);
SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME;
function getState(checked) {
return checked ? "checked" : "unchecked";
}
var Root = Switch;
var Thumb = SwitchThumb;
export {
Root,
Switch,
SwitchThumb,
Thumb,
createSwitchScope
};
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,572 @@
/*
@license
Rollup.js v4.60.4
Thu, 14 May 2026 17:52:21 GMT - commit d311a84b0bb4d4a6f50d19ffd2c29cca28660c88
https://github.com/rollup/rollup
Released under the MIT License.
*/
'use strict';
const promises = require('node:fs/promises');
const path = require('node:path');
const process$1 = require('node:process');
const node_url = require('node:url');
const rollup = require('./rollup.js');
const parseAst_js = require('./parseAst.js');
const getLogFilter_js = require('../getLogFilter.js');
function batchWarnings(command) {
const silent = !!command.silent;
const logFilter = generateLogFilter(command);
let count = 0;
const deferredWarnings = new Map();
let warningOccurred = false;
const add = (warning) => {
count += 1;
warningOccurred = true;
if (silent)
return;
if (warning.code in deferredHandlers) {
rollup.getOrCreate(deferredWarnings, warning.code, rollup.getNewArray).push(warning);
}
else if (warning.code in immediateHandlers) {
immediateHandlers[warning.code](warning);
}
else {
title(warning.message);
defaultBody(warning);
}
};
return {
add,
get count() {
return count;
},
flush() {
if (count === 0 || silent)
return;
const codes = [...deferredWarnings.keys()].sort((a, b) => deferredWarnings.get(b).length - deferredWarnings.get(a).length);
for (const code of codes) {
deferredHandlers[code](deferredWarnings.get(code));
}
deferredWarnings.clear();
count = 0;
},
log(level, log) {
if (!logFilter(log))
return;
switch (level) {
case parseAst_js.LOGLEVEL_WARN: {
return add(log);
}
case parseAst_js.LOGLEVEL_DEBUG: {
if (!silent) {
rollup.stderr(rollup.bold(rollup.pc.blue(log.message)));
defaultBody(log);
}
return;
}
default: {
if (!silent) {
rollup.stderr(rollup.bold(rollup.pc.cyan(log.message)));
defaultBody(log);
}
}
}
},
get warningOccurred() {
return warningOccurred;
}
};
}
const immediateHandlers = {
MISSING_NODE_BUILTINS(warning) {
title(`Missing shims for Node.js built-ins`);
rollup.stderr(`Creating a browser bundle that depends on ${parseAst_js.printQuotedStringList(warning.ids)}. You might need to include https://github.com/FredKSchott/rollup-plugin-polyfill-node`);
},
UNKNOWN_OPTION(warning) {
title(`You have passed an unrecognized option`);
rollup.stderr(warning.message);
}
};
const deferredHandlers = {
CIRCULAR_DEPENDENCY(warnings) {
title(`Circular dependenc${warnings.length > 1 ? 'ies' : 'y'}`);
const displayed = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
for (const warning of displayed) {
rollup.stderr(warning.ids.map(parseAst_js.relativeId).join(' -> '));
}
if (warnings.length > displayed.length) {
rollup.stderr(`...and ${warnings.length - displayed.length} more`);
}
},
EMPTY_BUNDLE(warnings) {
title(`Generated${warnings.length === 1 ? ' an' : ''} empty ${warnings.length > 1 ? 'chunks' : 'chunk'}`);
rollup.stderr(parseAst_js.printQuotedStringList(warnings.map(warning => warning.names[0])));
},
EVAL(warnings) {
title('Use of eval is strongly discouraged');
info(parseAst_js.getRollupUrl(parseAst_js.URL_AVOIDING_EVAL));
showTruncatedWarnings(warnings);
},
MISSING_EXPORT(warnings) {
title('Missing exports');
info(parseAst_js.getRollupUrl(parseAst_js.URL_NAME_IS_NOT_EXPORTED));
for (const warning of warnings) {
rollup.stderr(rollup.bold(parseAst_js.relativeId(warning.id)));
rollup.stderr(`${warning.binding} is not exported by ${parseAst_js.relativeId(warning.exporter)}`);
rollup.stderr(rollup.gray(warning.frame));
}
},
MISSING_GLOBAL_NAME(warnings) {
title(`Missing global variable ${warnings.length > 1 ? 'names' : 'name'}`);
info(parseAst_js.getRollupUrl(parseAst_js.URL_OUTPUT_GLOBALS));
rollup.stderr(`Use "output.globals" to specify browser global variable names corresponding to external modules:`);
for (const warning of warnings) {
rollup.stderr(`${rollup.bold(warning.id)} (guessing "${warning.names[0]}")`);
}
},
MIXED_EXPORTS(warnings) {
title('Mixing named and default exports');
info(parseAst_js.getRollupUrl(parseAst_js.URL_OUTPUT_EXPORTS));
rollup.stderr(rollup.bold('The following entry modules are using named and default exports together:'));
warnings.sort((a, b) => (a.id < b.id ? -1 : 1));
const displayedWarnings = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
for (const warning of displayedWarnings) {
rollup.stderr(parseAst_js.relativeId(warning.id));
}
if (displayedWarnings.length < warnings.length) {
rollup.stderr(`...and ${warnings.length - displayedWarnings.length} other entry modules`);
}
rollup.stderr(`\nConsumers of your bundle will have to use chunk.default to access their default export, which may not be what you want. Use \`output.exports: "named"\` to disable this warning.`);
},
NAMESPACE_CONFLICT(warnings) {
title(`Conflicting re-exports`);
for (const warning of warnings) {
rollup.stderr(`"${rollup.bold(parseAst_js.relativeId(warning.reexporter))}" re-exports "${warning.binding}" from both "${parseAst_js.relativeId(warning.ids[0])}" and "${parseAst_js.relativeId(warning.ids[1])}" (will be ignored).`);
}
},
PLUGIN_WARNING(warnings) {
const nestedByPlugin = nest(warnings, 'plugin');
for (const { items } of nestedByPlugin) {
const nestedByMessage = nest(items, 'message');
let lastUrl = '';
for (const { key: message, items } of nestedByMessage) {
title(message);
for (const warning of items) {
if (warning.url && warning.url !== lastUrl)
info((lastUrl = warning.url));
const loc = formatLocation(warning);
if (loc) {
rollup.stderr(rollup.bold(loc));
}
if (warning.frame)
info(warning.frame);
}
}
}
},
SOURCEMAP_BROKEN(warnings) {
title(`Broken sourcemap`);
info(parseAst_js.getRollupUrl(parseAst_js.URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT));
const plugins = [...new Set(warnings.map(({ plugin }) => plugin).filter(Boolean))];
rollup.stderr(`Plugins that transform code (such as ${parseAst_js.printQuotedStringList(plugins)}) should generate accompanying sourcemaps.`);
},
THIS_IS_UNDEFINED(warnings) {
title('"this" has been rewritten to "undefined"');
info(parseAst_js.getRollupUrl(parseAst_js.URL_THIS_IS_UNDEFINED));
showTruncatedWarnings(warnings);
},
UNRESOLVED_IMPORT(warnings) {
title('Unresolved dependencies');
info(parseAst_js.getRollupUrl(parseAst_js.URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY));
const dependencies = new Map();
for (const warning of warnings) {
rollup.getOrCreate(dependencies, parseAst_js.relativeId(warning.exporter), rollup.getNewArray).push(parseAst_js.relativeId(warning.id));
}
for (const [dependency, importers] of dependencies) {
rollup.stderr(`${rollup.bold(dependency)} (imported by ${parseAst_js.printQuotedStringList(importers)})`);
}
},
UNUSED_EXTERNAL_IMPORT(warnings) {
title('Unused external imports');
for (const warning of warnings) {
rollup.stderr(warning.names +
' imported from external module "' +
warning.exporter +
'" but never used in ' +
parseAst_js.printQuotedStringList(warning.ids.map(parseAst_js.relativeId)) +
'.');
}
}
};
function defaultBody(log) {
if (log.url) {
info(log.url);
}
const loc = formatLocation(log);
if (loc) {
rollup.stderr(rollup.bold(loc));
}
if (log.frame)
info(log.frame);
}
function title(string_) {
rollup.stderr(rollup.bold(rollup.yellow(`(!) ${string_}`)));
}
function info(url) {
rollup.stderr(rollup.gray(url));
}
function nest(array, property) {
const nested = [];
const lookup = new Map();
for (const item of array) {
const key = item[property];
rollup.getOrCreate(lookup, key, () => {
const items = {
items: [],
key
};
nested.push(items);
return items;
}).items.push(item);
}
return nested;
}
function showTruncatedWarnings(warnings) {
const nestedByModule = nest(warnings, 'id');
const displayedByModule = nestedByModule.length > 5 ? nestedByModule.slice(0, 3) : nestedByModule;
for (const { key: id, items } of displayedByModule) {
rollup.stderr(rollup.bold(parseAst_js.relativeId(id)));
rollup.stderr(rollup.gray(items[0].frame));
if (items.length > 1) {
rollup.stderr(`...and ${items.length - 1} other ${items.length > 2 ? 'occurrences' : 'occurrence'}`);
}
}
if (nestedByModule.length > displayedByModule.length) {
rollup.stderr(`\n...and ${nestedByModule.length - displayedByModule.length} other files`);
}
}
function generateLogFilter(command) {
const filters = rollup.ensureArray(command.filterLogs).flatMap(filter => String(filter).split(','));
if (process.env.ROLLUP_FILTER_LOGS) {
filters.push(...process.env.ROLLUP_FILTER_LOGS.split(','));
}
return getLogFilter_js.getLogFilter(filters);
}
function formatLocation(log) {
const id = log.loc?.file || log.id;
if (!id)
return null;
return log.loc ? `${id}:${log.loc.line}:${log.loc.column}` : id;
}
const stdinName = '-';
let stdinResult = null;
function stdinPlugin(argument) {
const suffix = typeof argument == 'string' && argument.length > 0 ? '.' + argument : '';
return {
load(id) {
if (id === stdinName || id.startsWith(stdinName + '.')) {
return stdinResult || (stdinResult = readStdin());
}
},
name: 'stdin',
resolveId(id) {
if (id === stdinName) {
return id + suffix;
}
}
};
}
function readStdin() {
return new Promise((resolve, reject) => {
const chunks = [];
process$1.stdin.setEncoding('utf8');
process$1.stdin
.on('data', chunk => chunks.push(chunk))
.on('end', () => {
const result = chunks.join('');
resolve(result);
})
.on('error', error => {
reject(error);
});
});
}
function waitForInputPlugin() {
return {
async buildStart(options) {
const inputSpecifiers = Array.isArray(options.input)
? options.input
: Object.keys(options.input);
let lastAwaitedSpecifier = null;
checkSpecifiers: while (true) {
for (const specifier of inputSpecifiers) {
if ((await this.resolve(specifier)) === null) {
if (lastAwaitedSpecifier !== specifier) {
rollup.stderr(`waiting for input ${rollup.bold(specifier)}...`);
lastAwaitedSpecifier = specifier;
}
await new Promise(resolve => setTimeout(resolve, 500));
continue checkSpecifiers;
}
}
break;
}
},
name: 'wait-for-input'
};
}
async function addCommandPluginsToInputOptions(inputOptions, command) {
if (command.stdin !== false) {
inputOptions.plugins.push(stdinPlugin(command.stdin));
}
if (command.waitForBundleInput === true) {
inputOptions.plugins.push(waitForInputPlugin());
}
await addPluginsFromCommandOption(command.plugin, inputOptions);
}
async function addPluginsFromCommandOption(commandPlugin, inputOptions) {
if (commandPlugin) {
const plugins = await rollup.normalizePluginOption(commandPlugin);
for (const plugin of plugins) {
if (/[={}]/.test(plugin)) {
// -p plugin=value
// -p "{transform(c,i){...}}"
await loadAndRegisterPlugin(inputOptions, plugin);
}
else {
// split out plugins joined by commas
// -p node-resolve,commonjs,buble
for (const p of plugin.split(',')) {
await loadAndRegisterPlugin(inputOptions, p);
}
}
}
}
}
async function loadAndRegisterPlugin(inputOptions, pluginText) {
let plugin = null;
let pluginArgument = undefined;
if (pluginText[0] === '{') {
// -p "{transform(c,i){...}}"
plugin = new Function('return ' + pluginText);
}
else {
const match = pluginText.match(/^([\w./:@\\^{|}-]+)(=(.*))?$/);
if (match) {
// -p plugin
// -p plugin=arg
pluginText = match[1];
pluginArgument = new Function('return ' + match[3])();
}
else {
throw new Error(`Invalid --plugin argument format: ${JSON.stringify(pluginText)}`);
}
if (!/^\.|^rollup-plugin-|[/@\\]/.test(pluginText)) {
// Try using plugin prefix variations first if applicable.
// Prefix order is significant - left has higher precedence.
for (const prefix of ['@rollup/plugin-', 'rollup-plugin-']) {
try {
plugin = await requireOrImport(prefix + pluginText);
break;
}
catch {
// if this does not work, we try requiring the actual name below
}
}
}
if (!plugin) {
try {
if (pluginText[0] == '.')
pluginText = path.resolve(pluginText);
// Windows absolute paths must be specified as file:// protocol URL
// Note that we do not have coverage for Windows-only code paths
else if (/^[A-Za-z]:\\/.test(pluginText)) {
pluginText = node_url.pathToFileURL(path.resolve(pluginText)).href;
}
plugin = await requireOrImport(pluginText);
}
catch (error) {
throw new Error(`Cannot load plugin "${pluginText}": ${error.message}.`, { cause: error });
}
}
}
// some plugins do not use `module.exports` for their entry point,
// in which case we try the named default export and the plugin name
if (typeof plugin === 'object') {
plugin = plugin.default || plugin[getCamelizedPluginBaseName(pluginText)];
}
if (!plugin) {
throw new Error(`Cannot find entry for plugin "${pluginText}". The plugin needs to export a function either as "default" or "${getCamelizedPluginBaseName(pluginText)}" for Rollup to recognize it.`);
}
inputOptions.plugins.push(typeof plugin === 'function' ? plugin.call(plugin, pluginArgument) : plugin);
}
function getCamelizedPluginBaseName(pluginText) {
return (pluginText.match(/(@rollup\/plugin-|rollup-plugin-)(.+)$/)?.[2] || pluginText)
.split(/[/\\]/)
.slice(-1)[0]
.split('.')[0]
.split('-')
.map((part, index) => (index === 0 || !part ? part : part[0].toUpperCase() + part.slice(1)))
.join('');
}
async function requireOrImport(pluginPath) {
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
return require(pluginPath);
}
catch {
return import(pluginPath);
}
}
const loadConfigFile = async (fileName, commandOptions = {}, watchMode = false) => {
const configs = await getConfigList(getDefaultFromCjs(await getConfigFileExport(fileName, commandOptions, watchMode)), commandOptions);
const warnings = batchWarnings(commandOptions);
try {
const normalizedConfigs = [];
for (const config of configs) {
const options = await rollup.mergeOptions(config, watchMode, commandOptions, warnings.log);
await addCommandPluginsToInputOptions(options, commandOptions);
normalizedConfigs.push(options);
}
return { options: normalizedConfigs, warnings };
}
catch (error_) {
warnings.flush();
throw error_;
}
};
async function getConfigFileExport(fileName, commandOptions, watchMode) {
if (commandOptions.configPlugin || commandOptions.bundleConfigAsCjs) {
try {
return await loadTranspiledConfigFile(fileName, commandOptions);
}
catch (error_) {
if (error_.message.includes('not defined in ES module scope')) {
return parseAst_js.error(parseAst_js.logCannotBundleConfigAsEsm(error_));
}
throw error_;
}
}
let cannotLoadEsm = false;
const handleWarning = (warning) => {
if (warning.message?.includes('To load an ES module') ||
warning.message?.includes('Failed to load the ES module')) {
cannotLoadEsm = true;
}
};
process$1.on('warning', handleWarning);
try {
const fileUrl = node_url.pathToFileURL(fileName);
if (watchMode) {
// We are adding the current date to allow reloads in watch mode
fileUrl.search = `?${Date.now()}`;
}
return (await import(fileUrl.href)).default;
}
catch (error_) {
if (cannotLoadEsm) {
return parseAst_js.error(parseAst_js.logCannotLoadConfigAsCjs(error_));
}
if (error_.message.includes('not defined in ES module scope')) {
return parseAst_js.error(parseAst_js.logCannotLoadConfigAsEsm(error_));
}
throw error_;
}
finally {
process$1.off('warning', handleWarning);
}
}
function getDefaultFromCjs(namespace) {
return namespace.default || namespace;
}
function getConfigImportAttributesKey(input) {
if (input === 'assert' || input === 'with')
return input;
return;
}
async function loadTranspiledConfigFile(fileName, commandOptions) {
const { bundleConfigAsCjs, configPlugin, configImportAttributesKey, silent } = commandOptions;
const warnings = batchWarnings(commandOptions);
const inputOptions = {
// Do *not* specify external callback here - instead, perform the externality check it via fallback-plugin just below this comment.
// This allows config plugin to first decide whether some import is external or not, and only then trigger the check in fallback-plugin.
// Since the check is ultra-simple during this stage of transforming the config file itself, it should be fallback instead of primary check.
// That way, e.g. importing workspace packages will work as expected - the workspace package will be bundled.
input: fileName,
onwarn: warnings.add,
plugins: [],
treeshake: false
};
await addPluginsFromCommandOption(configPlugin, inputOptions);
// Add plugin as *last* item after addPluginsFromCommandOption is complete.
// This plugin will trigger for imports not resolved by config plugin, and mark all non-relative imports as external.
inputOptions.plugins.push({
name: 'external-fallback',
resolveId: source => {
const looksLikeExternal = (source[0] !== '.' && !path.isAbsolute(source)) || source.slice(-5) === '.json';
return looksLikeExternal ? false : null;
}
});
const bundle = await rollup.rollup(inputOptions);
const { output: [{ code }] } = await bundle.generate({
exports: 'named',
format: bundleConfigAsCjs ? 'cjs' : 'es',
importAttributesKey: getConfigImportAttributesKey(configImportAttributesKey),
plugins: [
{
name: 'transpile-import-meta',
resolveImportMeta(property, { moduleId }) {
if (property === 'url') {
return `'${node_url.pathToFileURL(moduleId).href}'`;
}
if (property == 'filename') {
return `'${moduleId}'`;
}
if (property == 'dirname') {
return `'${path.dirname(moduleId)}'`;
}
if (property == null) {
return `{url:'${node_url.pathToFileURL(moduleId).href}', filename: '${moduleId}', dirname: '${path.dirname(moduleId)}'}`;
}
}
}
]
});
if (!silent && warnings.count > 0) {
rollup.stderr(rollup.bold(`loaded ${parseAst_js.relativeId(fileName)} with warnings`));
warnings.flush();
}
return loadConfigFromWrittenFile(path.join(path.dirname(fileName), `rollup.config-${Date.now()}.${bundleConfigAsCjs ? 'cjs' : 'mjs'}`), code);
}
async function loadConfigFromWrittenFile(bundledFileName, bundledCode) {
await promises.writeFile(bundledFileName, bundledCode);
try {
return (await import(node_url.pathToFileURL(bundledFileName).href)).default;
}
finally {
promises.unlink(bundledFileName).catch(error => console.warn(error?.message || error));
}
}
async function getConfigList(configFileExport, commandOptions) {
const config = await (typeof configFileExport === 'function'
? configFileExport(commandOptions)
: configFileExport);
if (Object.keys(config).length === 0) {
return parseAst_js.error(parseAst_js.logMissingConfig());
}
return Array.isArray(config) ? config : [config];
}
exports.addCommandPluginsToInputOptions = addCommandPluginsToInputOptions;
exports.batchWarnings = batchWarnings;
exports.loadConfigFile = loadConfigFile;
exports.stdinName = stdinName;
//# sourceMappingURL=loadConfigFile.js.map
@@ -0,0 +1,75 @@
{
"name": "@radix-ui/react-direction",
"version": "1.1.1",
"license": "MIT",
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"publishConfig": {
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
}
},
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"scripts": {
"lint": "eslint --max-warnings 0 src",
"clean": "rm -rf dist",
"version": "yarn version"
},
"devDependencies": {
"@repo/eslint-config": "0.0.0",
"@repo/typescript-config": "0.0.0",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
"eslint": "^9.18.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"typescript": "^5.7.3"
},
"peerDependencies": {
"@types/react": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"types": "./dist/index.d.ts"
}
@@ -0,0 +1,215 @@
import { f as createRule, g as import_ast_utils } from "../utils.js";
const commonProperties = {
multiline: { type: "boolean" },
minElements: {
type: "integer",
minimum: 0
},
consistent: { type: "boolean" }
};
const optionValueSchema = { oneOf: [{
type: "string",
enum: ["always", "never"]
}, {
type: "object",
properties: commonProperties,
additionalProperties: false
}] };
var Specialization = /* @__PURE__ */ function(Specialization) {
Specialization["IfStatementConsequent"] = "IfStatementConsequent";
Specialization["IfStatementAlternative"] = "IfStatementAlternative";
Specialization["DoWhileStatement"] = "DoWhileStatement";
Specialization["ForInStatement"] = "ForInStatement";
Specialization["ForOfStatement"] = "ForOfStatement";
Specialization["ForStatement"] = "ForStatement";
Specialization["WhileStatement"] = "WhileStatement";
Specialization["SwitchStatement"] = "SwitchStatement";
Specialization["SwitchCase"] = "SwitchCase";
Specialization["TryStatementBlock"] = "TryStatementBlock";
Specialization["TryStatementHandler"] = "TryStatementHandler";
Specialization["TryStatementFinalizer"] = "TryStatementFinalizer";
Specialization["BlockStatement"] = "BlockStatement";
Specialization["ArrowFunctionExpression"] = "ArrowFunctionExpression";
Specialization["FunctionDeclaration"] = "FunctionDeclaration";
Specialization["FunctionExpression"] = "FunctionExpression";
Specialization["Property"] = "Property";
Specialization["ClassBody"] = "ClassBody";
Specialization["StaticBlock"] = "StaticBlock";
Specialization["WithStatement"] = "WithStatement";
Specialization["TSModuleBlock"] = "TSModuleBlock";
return Specialization;
}(Specialization || {});
const presets = {
default: {
multiline: false,
minElements: Number.POSITIVE_INFINITY,
consistent: true
},
always: {
multiline: false,
minElements: 0,
consistent: false
},
never: {
multiline: false,
minElements: Number.POSITIVE_INFINITY,
consistent: false
}
};
function normalizeOptionValue(value) {
if (value === "always") return presets.always;
if (value === "never") return presets.never;
if (value) return {
consistent: !!value.consistent,
minElements: value.minElements ?? Number.POSITIVE_INFINITY,
multiline: !!value.multiline
};
return presets.default;
}
function normalizeOptions(options) {
const value = normalizeOptionValue(options);
return Object.fromEntries(Object.entries(Specialization).map(([k]) => [k, typeof options === "object" && options != null && k in options ? normalizeOptionValue(options[k]) : value]));
}
var curly_newline_default = createRule({
name: "curly-newline",
meta: {
type: "layout",
docs: { description: "Enforce consistent line breaks after opening and before closing braces" },
fixable: "whitespace",
schema: [{ oneOf: [{
type: "string",
enum: ["always", "never"]
}, {
type: "object",
properties: {
...Object.fromEntries(Object.entries(Specialization).map(([k]) => [k, optionValueSchema])),
...commonProperties
},
additionalProperties: false
}] }],
defaultOptions: [],
messages: {
unexpectedLinebreakBeforeClosingBrace: "Unexpected line break before this closing brace.",
unexpectedLinebreakAfterOpeningBrace: "Unexpected line break after this opening brace.",
expectedLinebreakBeforeClosingBrace: "Expected a line break before this closing brace.",
expectedLinebreakAfterOpeningBrace: "Expected a line break after this opening brace."
}
},
create(context, [options]) {
const sourceCode = context.sourceCode;
const normalizedOptions = normalizeOptions(options);
function check(node, specialization) {
const options = normalizedOptions[specialization];
let openBrace;
let closeBrace;
let elementCount;
switch (node.type) {
case "SwitchStatement":
closeBrace = sourceCode.getLastToken(node);
openBrace = sourceCode.getTokenBefore(node.cases.length ? node.cases[0] : closeBrace);
elementCount = node.cases.length;
break;
case "StaticBlock":
openBrace = sourceCode.getFirstToken(node, (token) => token.value === "{");
closeBrace = sourceCode.getLastToken(node);
elementCount = node.body.length;
break;
default:
openBrace = sourceCode.getFirstToken(node);
closeBrace = sourceCode.getLastToken(node);
elementCount = node.body.length;
}
let first = sourceCode.getTokenAfter(openBrace, { includeComments: true });
let last = sourceCode.getTokenBefore(closeBrace, { includeComments: true });
const needsLineBreaks = elementCount >= options.minElements || options.multiline && elementCount > 0 && !(0, import_ast_utils.isTokenOnSameLine)(last, first);
const hasCommentsFirstToken = (0, import_ast_utils.isCommentToken)(first);
const hasCommentsLastToken = (0, import_ast_utils.isCommentToken)(last);
first = sourceCode.getTokenAfter(openBrace);
last = sourceCode.getTokenBefore(closeBrace);
if (needsLineBreaks) {
if ((0, import_ast_utils.isTokenOnSameLine)(openBrace, first)) context.report({
messageId: "expectedLinebreakAfterOpeningBrace",
node,
loc: openBrace.loc,
fix(fixer) {
if (hasCommentsFirstToken) return null;
return fixer.insertTextAfter(openBrace, "\n");
}
});
if ((0, import_ast_utils.isTokenOnSameLine)(last, closeBrace)) context.report({
messageId: "expectedLinebreakBeforeClosingBrace",
node,
loc: closeBrace.loc,
fix(fixer) {
if (hasCommentsLastToken) return null;
return fixer.insertTextBefore(closeBrace, "\n");
}
});
} else {
const consistent = options.consistent;
const hasLineBreakBetweenOpenBraceAndFirst = !(0, import_ast_utils.isTokenOnSameLine)(openBrace, first);
const hasLineBreakBetweenCloseBraceAndLast = !(0, import_ast_utils.isTokenOnSameLine)(last, closeBrace);
if (!consistent && hasLineBreakBetweenOpenBraceAndFirst || consistent && hasLineBreakBetweenOpenBraceAndFirst && !hasLineBreakBetweenCloseBraceAndLast) context.report({
messageId: "unexpectedLinebreakAfterOpeningBrace",
node,
loc: openBrace.loc,
fix(fixer) {
if (hasCommentsFirstToken) return null;
return fixer.removeRange([openBrace.range[1], first.range[0]]);
}
});
if (!consistent && hasLineBreakBetweenCloseBraceAndLast || consistent && !hasLineBreakBetweenOpenBraceAndFirst && hasLineBreakBetweenCloseBraceAndLast) context.report({
messageId: "unexpectedLinebreakBeforeClosingBrace",
node,
loc: closeBrace.loc,
fix(fixer) {
if (hasCommentsLastToken) return null;
return fixer.removeRange([last.range[1], closeBrace.range[0]]);
}
});
}
}
function checkBlockLike(node) {
check(node, node.type);
}
return {
BlockStatement(node) {
const { parent } = node;
switch (parent.type) {
case "DoWhileStatement":
case "ForInStatement":
case "ForOfStatement":
case "ForStatement":
case "WhileStatement":
case "ArrowFunctionExpression":
case "FunctionDeclaration":
case "WithStatement":
check(node, parent.type);
break;
case "FunctionExpression":
if (parent.parent.type === "Property" && parent.parent.method) check(node, "Property");
else check(node, parent.type);
break;
case "IfStatement":
if (node === parent.consequent) check(node, "IfStatementConsequent");
if (node === parent.alternate) check(node, "IfStatementAlternative");
break;
case "TryStatement":
if (node === parent.block) check(node, "TryStatementBlock");
if (node === parent.finalizer) check(node, "TryStatementFinalizer");
break;
case "CatchClause":
check(node, "TryStatementHandler");
break;
default: if (parent.type === "SwitchCase" && parent.consequent.length === 1) check(node, "SwitchCase");
else check(node, "BlockStatement");
}
},
SwitchStatement: checkBlockLike,
ClassBody: checkBlockLike,
StaticBlock: checkBlockLike,
TSModuleBlock: checkBlockLike
};
}
});
export { curly_newline_default as t };
@@ -0,0 +1,6 @@
export * from './ast-converter';
export * from './create-program/getScriptKind';
export type { ParseSettings } from './parseSettings';
export * from './getModifiers';
export { typescriptVersionIsAtLeast } from './version-check';
export { getCanonicalFileName } from './create-program/shared';
@@ -0,0 +1,965 @@
"use strict";
/**
* Web Standards Streamable HTTP Server Transport
*
* This is the core transport implementation using Web Standard APIs (Request, Response, ReadableStream).
* It can run on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc.
*
* For Node.js Express/HTTP compatibility, use `StreamableHTTPServerTransport` which wraps this transport.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebStandardStreamableHTTPServerTransport = void 0;
const mediaType_js_1 = require("../shared/mediaType.js");
const requestBody_js_1 = require("./requestBody.js");
const sseKeepAlive_js_1 = require("./sseKeepAlive.js");
const types_js_1 = require("../types.js");
/**
* Server transport for Web Standards Streamable HTTP: this implements the MCP Streamable HTTP transport specification
* using Web Standard APIs (Request, Response, ReadableStream).
*
* This transport works on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc.
*
* Usage example:
*
* ```typescript
* // Stateful mode - server sets the session ID
* const statefulTransport = new WebStandardStreamableHTTPServerTransport({
* sessionIdGenerator: () => crypto.randomUUID(),
* });
*
* // Stateless mode - explicitly set session ID to undefined
* const statelessTransport = new WebStandardStreamableHTTPServerTransport({
* sessionIdGenerator: undefined,
* });
*
* // Hono.js usage
* app.all('/mcp', async (c) => {
* return transport.handleRequest(c.req.raw);
* });
*
* // Cloudflare Workers usage
* export default {
* async fetch(request: Request): Promise<Response> {
* return transport.handleRequest(request);
* }
* };
* ```
*
* In stateful mode:
* - Session ID is generated and included in response headers
* - Session ID is always included in initialization responses
* - Requests with invalid session IDs are rejected with 404 Not Found
* - Non-initialization requests without a session ID are rejected with 400 Bad Request
* - State is maintained in-memory (connections, message history)
*
* In stateless mode:
* - No Session ID is included in any responses
* - No session validation is performed
*/
class WebStandardStreamableHTTPServerTransport {
constructor(options = {}) {
this._started = false;
this._hasHandledRequest = false;
this._streamMapping = new Map();
this._requestToStreamMapping = new Map();
/**
* Request streams whose client holds a Last-Event-ID cursor (at least one
* id-bearing event was delivered on them), so a stored response can be
* replayed on resume.
*/
this._resumableStreams = new Set();
this._requestResponseMap = new Map();
this._initialized = false;
this._enableJsonResponse = false;
this._standaloneSseStreamId = '_GET_stream';
this._closed = false;
this.sessionIdGenerator = options.sessionIdGenerator;
this._enableJsonResponse = options.enableJsonResponse ?? false;
this._eventStore = options.eventStore;
this._onsessioninitialized = options.onsessioninitialized;
this._onsessionclosed = options.onsessionclosed;
this._allowedHosts = options.allowedHosts;
this._allowedOrigins = options.allowedOrigins;
this._enableDnsRebindingProtection = options.enableDnsRebindingProtection ?? false;
this._retryInterval = options.retryInterval;
this._keepAliveMs = options.keepAliveMs ?? sseKeepAlive_js_1.DEFAULT_SSE_KEEP_ALIVE_MS;
this._maxRequestBodySize = (0, requestBody_js_1.resolveMaxRequestBodySize)(options.maxRequestBodySize);
}
/**
* Arms a keep-alive interval for an SSE stream that periodically writes an SSE
* comment frame so intermediaries and idle timeouts don't kill the connection.
* The returned timer is owned by the stream it was armed for: the stream's
* cancel/cleanup callbacks must clear it. The interval clears itself if a
* write fails (stream already closed/cancelled).
*/
startKeepAlive(controller, encoder) {
// After close() nothing may arm: the stream cleanups have already run.
if (this._closed)
return undefined;
const timer = (0, sseKeepAlive_js_1.armSseKeepAlive)(this._keepAliveMs, () => {
try {
controller.enqueue(encoder.encode(': keepalive\n\n'));
}
catch {
if (timer !== undefined)
clearInterval(timer);
}
});
return timer;
}
/**
* Starts the transport. This is required by the Transport interface but is a no-op
* for the Streamable HTTP transport as connections are managed per-request.
*/
async start() {
if (this._started) {
throw new Error('Transport already started');
}
this._started = true;
}
/**
* Helper to create a JSON error response
*/
createJsonErrorResponse(status, code, message, options) {
const error = { code, message };
if (options?.data !== undefined) {
error.data = options.data;
}
return new Response(JSON.stringify({
jsonrpc: '2.0',
error,
id: null
}), {
status,
headers: {
'Content-Type': 'application/json',
...options?.headers
}
});
}
/**
* Validates request headers for DNS rebinding protection.
* @returns Error response if validation fails, undefined if validation passes.
*/
validateRequestHeaders(req) {
// Skip validation if protection is not enabled
if (!this._enableDnsRebindingProtection) {
return undefined;
}
// Validate Host header if allowedHosts is configured
if (this._allowedHosts && this._allowedHosts.length > 0) {
const hostHeader = req.headers.get('host');
if (!hostHeader || !this._allowedHosts.includes(hostHeader)) {
const error = `Invalid Host header: ${hostHeader}`;
this.onerror?.(new Error(error));
return this.createJsonErrorResponse(403, -32000, error);
}
}
// Validate Origin header if allowedOrigins is configured
if (this._allowedOrigins && this._allowedOrigins.length > 0) {
const originHeader = req.headers.get('origin');
if (originHeader && !this._allowedOrigins.includes(originHeader)) {
const error = `Invalid Origin header: ${originHeader}`;
this.onerror?.(new Error(error));
return this.createJsonErrorResponse(403, -32000, error);
}
}
return undefined;
}
/**
* Handles an incoming HTTP request, whether GET, POST, or DELETE
* Returns a Response object (Web Standard)
*/
async handleRequest(req, options) {
if (this._closed) {
return this.createJsonErrorResponse(404, -32001, 'Session not found');
}
// In stateless mode (no sessionIdGenerator), each request must use a fresh transport.
// Reusing a stateless transport causes message ID collisions between clients.
if (!this.sessionIdGenerator && this._hasHandledRequest) {
throw new Error('Stateless transport cannot be reused across requests. Create a new transport per request.');
}
this._hasHandledRequest = true;
// Validate request headers for DNS rebinding protection
const validationError = this.validateRequestHeaders(req);
if (validationError) {
return validationError;
}
switch (req.method) {
case 'POST':
return this.handlePostRequest(req, options);
case 'GET':
return this.handleGetRequest(req);
case 'DELETE':
return this.handleDeleteRequest(req);
default:
return this.handleUnsupportedRequest();
}
}
/**
* Writes a priming event to establish resumption capability.
* Only sends if eventStore is configured (opt-in for resumability) and
* the client's protocol version supports empty SSE data (>= 2025-11-25).
*/
async writePrimingEvent(controller, encoder, streamId, protocolVersion) {
if (!this._eventStore) {
return;
}
// Priming events have empty data which older clients cannot handle.
// Only send priming events to clients with protocol version >= 2025-11-25
// which includes the fix for handling empty SSE data.
if (protocolVersion < '2025-11-25') {
return;
}
const primingEventId = await this._eventStore.storeEvent(streamId, {});
let primingEvent = `id: ${primingEventId}\ndata: \n\n`;
if (this._retryInterval !== undefined) {
primingEvent = `id: ${primingEventId}\nretry: ${this._retryInterval}\ndata: \n\n`;
}
controller.enqueue(encoder.encode(primingEvent));
this._resumableStreams.add(streamId);
}
/**
* Handles GET requests for SSE stream
*/
async handleGetRequest(req) {
// The client MUST include an Accept header, listing text/event-stream as a supported content type.
const acceptHeader = req.headers.get('accept');
if (!acceptHeader?.includes('text/event-stream')) {
this.onerror?.(new Error('Not Acceptable: Client must accept text/event-stream'));
return this.createJsonErrorResponse(406, -32000, 'Not Acceptable: Client must accept text/event-stream');
}
// If an Mcp-Session-Id is returned by the server during initialization,
// clients using the Streamable HTTP transport MUST include it
// in the Mcp-Session-Id header on all of their subsequent HTTP requests.
const sessionError = this.validateSession(req);
if (sessionError) {
return sessionError;
}
const protocolError = this.validateProtocolVersion(req);
if (protocolError) {
return protocolError;
}
// Handle resumability: check for Last-Event-ID header
if (this._eventStore) {
const lastEventId = req.headers.get('last-event-id');
if (lastEventId) {
return this.replayEvents(lastEventId);
}
}
// Check if there's already an active standalone SSE stream for this session
if (this._streamMapping.get(this._standaloneSseStreamId) !== undefined) {
// Only one GET SSE stream is allowed per session
this.onerror?.(new Error('Conflict: Only one SSE stream is allowed per session'));
return this.createJsonErrorResponse(409, -32000, 'Conflict: Only one SSE stream is allowed per session');
}
const encoder = new TextEncoder();
let streamController;
let keepAliveTimer = undefined;
// Create a ReadableStream with a controller we can use to push SSE events
const readable = new ReadableStream({
start: controller => {
streamController = controller;
},
cancel: () => {
// Stream was cancelled by client. Only tear down the mapping if it
// still points at this stream — a stale cancel arriving after a
// reconnect re-registered the id must not tear down the successor.
if (keepAliveTimer !== undefined) {
clearInterval(keepAliveTimer);
}
if (this._streamMapping.get(this._standaloneSseStreamId)?.controller === streamController) {
this._streamMapping.delete(this._standaloneSseStreamId);
}
}
});
const headers = {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache, no-transform',
Connection: 'keep-alive',
'X-Accel-Buffering': 'no'
};
// After initialization, always include the session ID if we have one
if (this.sessionId !== undefined) {
headers['mcp-session-id'] = this.sessionId;
}
// Store the stream mapping with the controller for pushing data
this._streamMapping.set(this._standaloneSseStreamId, {
controller: streamController,
encoder,
cleanup: () => {
if (keepAliveTimer !== undefined) {
clearInterval(keepAliveTimer);
}
this._streamMapping.delete(this._standaloneSseStreamId);
try {
streamController.close();
}
catch {
// Controller might already be closed
}
}
});
keepAliveTimer = this.startKeepAlive(streamController, encoder);
return new Response(readable, { headers });
}
/**
* Replays events that would have been sent after the specified event ID
* Only used when resumability is enabled
*/
async replayEvents(lastEventId) {
if (!this._eventStore) {
this.onerror?.(new Error('Event store not configured'));
return this.createJsonErrorResponse(400, -32000, 'Event store not configured');
}
try {
// If getStreamIdForEventId is available, use it for conflict checking
let streamId;
if (this._eventStore.getStreamIdForEventId) {
streamId = await this._eventStore.getStreamIdForEventId(lastEventId);
if (!streamId) {
this.onerror?.(new Error('Invalid event ID format'));
return this.createJsonErrorResponse(400, -32000, 'Invalid event ID format');
}
// Check conflict with the SAME streamId we'll use for mapping
if (this._streamMapping.get(streamId) !== undefined) {
this.onerror?.(new Error('Conflict: Stream already has an active connection'));
return this.createJsonErrorResponse(409, -32000, 'Conflict: Stream already has an active connection');
}
}
const headers = {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache, no-transform',
Connection: 'keep-alive',
'X-Accel-Buffering': 'no'
};
if (this.sessionId !== undefined) {
headers['mcp-session-id'] = this.sessionId;
}
// Create a ReadableStream with controller for SSE
const encoder = new TextEncoder();
let streamController;
let keepAliveTimer = undefined;
let replayedStreamId = undefined;
let cancelled = false;
const readable = new ReadableStream({
start: controller => {
streamController = controller;
},
cancel: () => {
// Stream was cancelled by client. Only tear down the mapping if
// it still points at this stream — a stale cancel must not tear
// down a successor registered by a later resume.
cancelled = true;
if (keepAliveTimer !== undefined) {
clearInterval(keepAliveTimer);
}
if (replayedStreamId !== undefined && this._streamMapping.get(replayedStreamId)?.controller === streamController) {
this._streamMapping.delete(replayedStreamId);
}
}
});
// Replay events - returns the streamId for backwards compatibility
const replayedEventIds = new Set();
replayedStreamId = await this._eventStore.replayEventsAfter(lastEventId, {
send: async (eventId, message) => {
const success = this.writeSSEEvent(streamController, encoder, message, eventId);
if (!success) {
this.onerror?.(new Error('Failed replay events'));
try {
streamController.close();
}
catch {
// Controller might already be closed
}
}
else {
replayedEventIds.add(eventId);
}
}
});
// close() may have run, or the stream may have been cancelled, while
// the event store was replaying: don't hand out or register a stream
// that nothing can ever clean up again.
if (this._closed || cancelled) {
try {
streamController.close();
}
catch {
// Controller might already be closed
}
return this.createJsonErrorResponse(404, -32001, 'Session not found');
}
// A reconnect re-registers the same stream id: close the predecessor
// stream cleanly (clearing its keep-alive timer) instead of leaving it
// registered nowhere with its timer still running.
this._streamMapping.get(replayedStreamId)?.cleanup();
this._streamMapping.set(replayedStreamId, {
controller: streamController,
encoder,
replayedEventIds,
cleanup: () => {
if (keepAliveTimer !== undefined) {
clearInterval(keepAliveTimer);
}
this._streamMapping.delete(replayedStreamId);
try {
streamController.close();
}
catch {
// Controller might already be closed
}
}
});
// The resume itself proves the client holds a Last-Event-ID cursor
this._resumableStreams.add(replayedStreamId);
keepAliveTimer = this.startKeepAlive(streamController, encoder);
return new Response(readable, { headers });
}
catch (error) {
this.onerror?.(error);
return this.createJsonErrorResponse(500, -32000, 'Error replaying events');
}
}
/**
* Writes an event to an SSE stream via controller with proper formatting
*/
writeSSEEvent(controller, encoder, message, eventId) {
try {
let eventData = `event: message\n`;
// Include event ID if provided - this is important for resumability
if (eventId) {
eventData += `id: ${eventId}\n`;
}
eventData += `data: ${JSON.stringify(message)}\n\n`;
controller.enqueue(encoder.encode(eventData));
return true;
}
catch (error) {
this.onerror?.(error);
return false;
}
}
/**
* Handles unsupported requests (PUT, PATCH, etc.)
*/
handleUnsupportedRequest() {
this.onerror?.(new Error('Method not allowed.'));
return new Response(JSON.stringify({
jsonrpc: '2.0',
error: {
code: -32000,
message: 'Method not allowed.'
},
id: null
}), {
status: 405,
headers: {
Allow: 'GET, POST, DELETE',
'Content-Type': 'application/json'
}
});
}
/**
* Handles POST requests containing JSON-RPC messages
*/
async handlePostRequest(req, options) {
try {
// Validate the Accept header
const acceptHeader = req.headers.get('accept');
// The client MUST include an Accept header, listing both application/json and text/event-stream as supported content types.
// Accept is a comma-separated list, so a substring check is the intended semantics here (unlike Content-Type below).
// eslint-disable-next-line no-restricted-syntax
if (!acceptHeader?.includes('application/json') || !acceptHeader.includes('text/event-stream')) {
this.onerror?.(new Error('Not Acceptable: Client must accept both application/json and text/event-stream'));
return this.createJsonErrorResponse(406, -32000, 'Not Acceptable: Client must accept both application/json and text/event-stream');
}
// Parsed media type, never a substring match — see isJsonContentType.
const ct = req.headers.get('content-type');
if (!(0, mediaType_js_1.isJsonContentType)(ct)) {
this.onerror?.(new Error('Unsupported Media Type: Content-Type must be application/json'));
return this.createJsonErrorResponse(415, -32000, 'Unsupported Media Type: Content-Type must be application/json');
}
// Build request info from headers and URL
const requestInfo = {
headers: Object.fromEntries(req.headers.entries()),
url: new URL(req.url)
};
let rawMessage;
if (options?.parsedBody !== undefined) {
rawMessage = options.parsedBody;
}
else {
try {
const body = await (0, requestBody_js_1.readRequestBody)(req, this._maxRequestBodySize);
if (body.tooLarge) {
const message = (0, requestBody_js_1.requestBodyTooLargeMessage)(this._maxRequestBodySize);
this.onerror?.(new Error(message));
return this.createJsonErrorResponse(413, -32000, message);
}
rawMessage = JSON.parse(body.text);
}
catch {
this.onerror?.(new Error('Parse error: Invalid JSON'));
return this.createJsonErrorResponse(400, -32700, 'Parse error: Invalid JSON');
}
}
if (Array.isArray(rawMessage) && rawMessage.length > requestBody_js_1.MAX_BATCH_SIZE) {
this.onerror?.(new Error(`Invalid Request: Batch must not exceed ${requestBody_js_1.MAX_BATCH_SIZE} messages`));
return this.createJsonErrorResponse(400, -32600, `Invalid Request: Batch must not exceed ${requestBody_js_1.MAX_BATCH_SIZE} messages`);
}
let messages;
// handle batch and single messages
try {
if (Array.isArray(rawMessage)) {
messages = rawMessage.map(msg => types_js_1.JSONRPCMessageSchema.parse(msg));
}
else {
messages = [types_js_1.JSONRPCMessageSchema.parse(rawMessage)];
}
}
catch {
this.onerror?.(new Error('Parse error: Invalid JSON-RPC message'));
return this.createJsonErrorResponse(400, -32700, 'Parse error: Invalid JSON-RPC message');
}
// close() may have run while awaiting the request body above: don't
// initialize a session (or fire onsessioninitialized) on a transport
// whose cleanups have already run.
if (this._closed) {
return this.createJsonErrorResponse(404, -32001, 'Session not found');
}
// Check if this is an initialization request
// https://spec.modelcontextprotocol.io/specification/2025-03-26/basic/lifecycle/
const isInitializationRequest = messages.some(types_js_1.isInitializeRequest);
if (isInitializationRequest) {
// If it's a server with session management and the session ID is already set we should reject the request
// to avoid re-initialization.
if (this._initialized && this.sessionId !== undefined) {
this.onerror?.(new Error('Invalid Request: Server already initialized'));
return this.createJsonErrorResponse(400, -32600, 'Invalid Request: Server already initialized');
}
if (messages.length > 1) {
this.onerror?.(new Error('Invalid Request: Only one initialization request is allowed'));
return this.createJsonErrorResponse(400, -32600, 'Invalid Request: Only one initialization request is allowed');
}
this.sessionId = this.sessionIdGenerator?.();
this._initialized = true;
// If we have a session ID and an onsessioninitialized handler, call it immediately
// This is needed in cases where the server needs to keep track of multiple sessions
if (this.sessionId && this._onsessioninitialized) {
await Promise.resolve(this._onsessioninitialized(this.sessionId));
}
}
if (!isInitializationRequest) {
// If an Mcp-Session-Id is returned by the server during initialization,
// clients using the Streamable HTTP transport MUST include it
// in the Mcp-Session-Id header on all of their subsequent HTTP requests.
const sessionError = this.validateSession(req);
if (sessionError) {
return sessionError;
}
// Mcp-Protocol-Version header is required for all requests after initialization.
const protocolError = this.validateProtocolVersion(req);
if (protocolError) {
return protocolError;
}
}
// close() may have run while awaiting the request body or the session
// initialization callback above: don't register streams into maps the
// close sweep has already cleared, or hand out a stream that nothing
// will ever write to.
if (this._closed) {
return this.createJsonErrorResponse(404, -32001, 'Session not found');
}
// check if it contains requests
const hasRequests = messages.some(types_js_1.isJSONRPCRequest);
if (!hasRequests) {
// if it only contains notifications or responses, return 202
for (const message of messages) {
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo });
}
return new Response(null, { status: 202 });
}
// The default behavior is to use SSE streaming
// but in some cases server will return JSON responses
const streamId = crypto.randomUUID();
// Extract protocol version for priming event decision.
// For initialize requests, get from request params.
// For other requests, get from header (already validated).
const initRequest = messages.find(m => (0, types_js_1.isInitializeRequest)(m));
const clientProtocolVersion = initRequest
? initRequest.params.protocolVersion
: (req.headers.get('mcp-protocol-version') ?? types_js_1.DEFAULT_NEGOTIATED_PROTOCOL_VERSION);
if (this._enableJsonResponse) {
// For JSON response mode, return a Promise that resolves when all responses are ready
return new Promise(resolve => {
this._streamMapping.set(streamId, {
resolveJson: resolve,
cleanup: () => {
this._streamMapping.delete(streamId);
}
});
for (const message of messages) {
if ((0, types_js_1.isJSONRPCRequest)(message)) {
this._requestToStreamMapping.set(message.id, streamId);
}
}
for (const message of messages) {
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo });
}
});
}
// SSE streaming mode - use ReadableStream with controller for more reliable data pushing
const encoder = new TextEncoder();
let streamController;
let keepAliveTimer = undefined;
const readable = new ReadableStream({
start: controller => {
streamController = controller;
},
cancel: () => {
// Stream was cancelled by client. Only tear down the mapping if
// it still points at this stream — a stale cancel arriving after
// a resume re-registered the id must not tear down the successor.
if (keepAliveTimer !== undefined) {
clearInterval(keepAliveTimer);
}
if (this._streamMapping.get(streamId)?.controller === streamController) {
this._streamMapping.delete(streamId);
}
}
});
const headers = {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache, no-transform',
Connection: 'keep-alive',
'X-Accel-Buffering': 'no'
};
// After initialization, always include the session ID if we have one
if (this.sessionId !== undefined) {
headers['mcp-session-id'] = this.sessionId;
}
// Store the response for this request to send messages back through this connection
// We need to track by request ID to maintain the connection
for (const message of messages) {
if ((0, types_js_1.isJSONRPCRequest)(message)) {
this._streamMapping.set(streamId, {
controller: streamController,
encoder,
cleanup: () => {
if (keepAliveTimer !== undefined) {
clearInterval(keepAliveTimer);
}
this._streamMapping.delete(streamId);
try {
streamController.close();
}
catch {
// Controller might already be closed
}
}
});
this._requestToStreamMapping.set(message.id, streamId);
}
}
try {
// Write priming event if event store is configured (after mapping is set up)
await this.writePrimingEvent(streamController, encoder, streamId, clientProtocolVersion);
// handle each message
for (const message of messages) {
// Build closeSSEStream callback for requests when eventStore is configured
// AND client supports resumability (protocol version >= 2025-11-25).
// Old clients can't resume if the stream is closed early because they
// didn't receive a priming event with an event ID.
let closeSSEStream;
let closeStandaloneSSEStream;
if ((0, types_js_1.isJSONRPCRequest)(message) && this._eventStore && clientProtocolVersion >= '2025-11-25') {
closeSSEStream = () => {
this.closeSSEStream(message.id);
};
closeStandaloneSSEStream = () => {
this.closeStandaloneSSEStream();
};
}
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo, closeSSEStream, closeStandaloneSSEStream });
}
}
catch (error) {
// Failing before the Response is handed out means nothing can ever
// cancel this stream: release it and its request correlations here.
this._streamMapping.get(streamId)?.cleanup();
this._resumableStreams.delete(streamId);
for (const message of messages) {
if ((0, types_js_1.isJSONRPCRequest)(message)) {
this._requestToStreamMapping.delete(message.id);
}
}
throw error;
}
// The server SHOULD NOT close the SSE stream before sending all JSON-RPC responses
// This will be handled by the send() method when responses are ready
// Arm keep-alive only after the fallible awaits above: an error path
// returns 400 and discards the Response, so nothing could ever cancel
// the stream and clear an already-armed timer. Skip if the responses
// already completed and cleaned the stream up.
if (this._streamMapping.get(streamId)?.controller === streamController) {
keepAliveTimer = this.startKeepAlive(streamController, encoder);
}
return new Response(readable, { status: 200, headers });
}
catch (error) {
// return JSON-RPC formatted error
this.onerror?.(error);
return this.createJsonErrorResponse(400, -32700, 'Parse error', { data: String(error) });
}
}
/**
* Handles DELETE requests to terminate sessions
*/
async handleDeleteRequest(req) {
const sessionError = this.validateSession(req);
if (sessionError) {
return sessionError;
}
const protocolError = this.validateProtocolVersion(req);
if (protocolError) {
return protocolError;
}
try {
await Promise.resolve(this._onsessionclosed?.(this.sessionId));
return new Response(null, { status: 200 });
}
finally {
await this.close();
}
}
/**
* Validates session ID for non-initialization requests.
* Returns Response error if invalid, undefined otherwise
*/
validateSession(req) {
if (this.sessionIdGenerator === undefined) {
// If the sessionIdGenerator ID is not set, the session management is disabled
// and we don't need to validate the session ID
return undefined;
}
if (!this._initialized) {
// If the server has not been initialized yet, reject all requests
this.onerror?.(new Error('Bad Request: Server not initialized'));
return this.createJsonErrorResponse(400, -32000, 'Bad Request: Server not initialized');
}
const sessionId = req.headers.get('mcp-session-id');
if (!sessionId) {
// Non-initialization requests without a session ID should return 400 Bad Request
this.onerror?.(new Error('Bad Request: Mcp-Session-Id header is required'));
return this.createJsonErrorResponse(400, -32000, 'Bad Request: Mcp-Session-Id header is required');
}
if (sessionId !== this.sessionId) {
// Reject requests with invalid session ID with 404 Not Found
this.onerror?.(new Error('Session not found'));
return this.createJsonErrorResponse(404, -32001, 'Session not found');
}
return undefined;
}
/**
* Validates the MCP-Protocol-Version header on incoming requests.
*
* For initialization: Version negotiation handles unknown versions gracefully
* (server responds with its supported version).
*
* For subsequent requests with MCP-Protocol-Version header:
* - Accept if in supported list
* - 400 if unsupported
*
* For HTTP requests without the MCP-Protocol-Version header:
* - Accept and default to the version negotiated at initialization
*/
validateProtocolVersion(req) {
const protocolVersion = req.headers.get('mcp-protocol-version');
if (protocolVersion !== null && !types_js_1.SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion)) {
this.onerror?.(new Error(`Bad Request: Unsupported protocol version: ${protocolVersion}` +
` (supported versions: ${types_js_1.SUPPORTED_PROTOCOL_VERSIONS.join(', ')})`));
return this.createJsonErrorResponse(400, -32000, `Bad Request: Unsupported protocol version: ${protocolVersion} (supported versions: ${types_js_1.SUPPORTED_PROTOCOL_VERSIONS.join(', ')})`);
}
return undefined;
}
async close() {
if (this._closed) {
return;
}
// Stop any deferred keep-alive arm (e.g. a replay await resolving after
// close) from creating a timer nothing can clear.
this._closed = true;
// Close all SSE connections (each cleanup clears its own keep-alive timer)
this._streamMapping.forEach(({ cleanup }) => {
cleanup();
});
this._streamMapping.clear();
// Clear any pending responses
this._requestResponseMap.clear();
this._resumableStreams.clear();
this.onclose?.();
}
/**
* Close an SSE stream for a specific request, triggering client reconnection.
* Use this to implement polling behavior during long-running operations -
* client will reconnect after the retry interval specified in the priming event.
*/
closeSSEStream(requestId) {
const streamId = this._requestToStreamMapping.get(requestId);
if (!streamId)
return;
const stream = this._streamMapping.get(streamId);
if (stream) {
stream.cleanup();
}
}
/**
* Close the standalone GET SSE stream, triggering client reconnection.
* Use this to implement polling behavior for server-initiated notifications.
*/
closeStandaloneSSEStream() {
const stream = this._streamMapping.get(this._standaloneSseStreamId);
if (stream) {
stream.cleanup();
}
}
async send(message, options) {
let requestId = options?.relatedRequestId;
if ((0, types_js_1.isJSONRPCResultResponse)(message) || (0, types_js_1.isJSONRPCErrorResponse)(message)) {
// If the message is a response, use the request ID from the message
requestId = message.id;
}
// Check if this message should be sent on the standalone SSE stream (no request ID)
// Ignore notifications from tools (which have relatedRequestId set)
// Those will be sent via dedicated response SSE streams
if (requestId === undefined) {
// For standalone SSE streams, we can only send requests and notifications
if ((0, types_js_1.isJSONRPCResultResponse)(message) || (0, types_js_1.isJSONRPCErrorResponse)(message)) {
throw new Error('Cannot send a response on a standalone SSE stream unless resuming a previous client request');
}
// Generate and store event ID if event store is provided
// Store even if stream is disconnected so events can be replayed on reconnect
let eventId;
if (this._eventStore) {
// Stores the event and gets the generated event ID
eventId = await this._eventStore.storeEvent(this._standaloneSseStreamId, message);
}
const standaloneSse = this._streamMapping.get(this._standaloneSseStreamId);
if (standaloneSse === undefined) {
// Stream is disconnected - event is stored for replay, nothing more to do
return;
}
// Send the message to the standalone SSE stream, unless this stream
// was registered by a replay that already delivered this event (the
// store made it visible before this call resumed).
if (standaloneSse.controller &&
standaloneSse.encoder &&
(eventId === undefined || !standaloneSse.replayedEventIds?.has(eventId))) {
this.writeSSEEvent(standaloneSse.controller, standaloneSse.encoder, message, eventId);
}
return;
}
// Get the response for this request
const streamId = this._requestToStreamMapping.get(requestId);
if (!streamId) {
throw new Error(`No connection established for request ID: ${String(requestId)}`);
}
let stream = this._streamMapping.get(streamId);
if (!this._enableJsonResponse) {
// Store the event even if the stream is disconnected (e.g. after
// closeSSEStream switched the client to polling), so it can be
// replayed on reconnect — mirroring the standalone stream path.
let eventId;
if (this._eventStore) {
eventId = await this._eventStore.storeEvent(streamId, message);
// Re-fetch after the await: a resume completing meanwhile replaces
// this stream's registration with a successor, and the message
// must go to the live stream, not the evicted one.
stream = this._streamMapping.get(streamId);
}
// Skip the write if the stream was registered by a replay that
// already delivered this event (the store made it visible before
// this call resumed).
if (stream?.controller && stream?.encoder && (eventId === undefined || !stream.replayedEventIds?.has(eventId))) {
const written = this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
// The client now holds a Last-Event-ID cursor for this stream
if (written && eventId !== undefined) {
this._resumableStreams.add(streamId);
}
}
}
if ((0, types_js_1.isJSONRPCResultResponse)(message) || (0, types_js_1.isJSONRPCErrorResponse)(message)) {
this._requestResponseMap.set(requestId, message);
const relatedIds = Array.from(this._requestToStreamMapping.entries())
.filter(([_, sid]) => sid === streamId)
.map(([id]) => id);
// Check if we have responses for all requests using this connection
const allResponsesReady = relatedIds.every(id => this._requestResponseMap.has(id));
if (allResponsesReady) {
if (!stream) {
// close() ran while the event store write above was awaiting:
// release the entries this call re-created after the sweep,
// then treat the late completion as a no-op.
if (this._closed) {
for (const id of relatedIds) {
this._requestResponseMap.delete(id);
this._requestToStreamMapping.delete(id);
}
return;
}
if (!this._enableJsonResponse && this._eventStore && this._resumableStreams.has(streamId)) {
// The stream went away (client disconnect, or
// closeSSEStream switched the client to polling), but the
// response was stored above and will be replayed on
// resume — release the correlations rather than throwing.
for (const id of relatedIds) {
this._requestResponseMap.delete(id);
this._requestToStreamMapping.delete(id);
}
this._resumableStreams.delete(streamId);
return;
}
// Without resumability (or in JSON response mode, where the
// pending HTTP response can never be settled by a replay),
// a missing stream means the response cannot be delivered.
// Release the correlations so the entries don't outlive the
// undeliverable response.
for (const id of relatedIds) {
this._requestResponseMap.delete(id);
this._requestToStreamMapping.delete(id);
}
throw new Error(`No connection established for request ID: ${String(requestId)}`);
}
if (this._enableJsonResponse && stream.resolveJson) {
// All responses ready, send as JSON
const headers = {
'Content-Type': 'application/json'
};
if (this.sessionId !== undefined) {
headers['mcp-session-id'] = this.sessionId;
}
const responses = relatedIds.map(id => this._requestResponseMap.get(id));
if (responses.length === 1) {
stream.resolveJson(new Response(JSON.stringify(responses[0]), { status: 200, headers }));
}
else {
stream.resolveJson(new Response(JSON.stringify(responses), { status: 200, headers }));
}
}
else {
// End the SSE stream
stream.cleanup();
}
// Clean up
for (const id of relatedIds) {
this._requestResponseMap.delete(id);
this._requestToStreamMapping.delete(id);
}
this._resumableStreams.delete(streamId);
}
}
}
}
exports.WebStandardStreamableHTTPServerTransport = WebStandardStreamableHTTPServerTransport;
//# sourceMappingURL=webStandardStreamableHttp.js.map
@@ -0,0 +1,485 @@
---
name: router-core/data-loading
description: >-
Route loader option, loaderDeps for cache keys, staleTime/gcTime/
defaultPreloadStaleTime SWR caching, pendingComponent/pendingMs/
pendingMinMs, errorComponent/onError/onCatch, beforeLoad, router
context and createRootRouteWithContext DI pattern, router.invalidate,
Await component, deferred data loading with unawaited promises.
type: sub-skill
library: tanstack-router
library_version: '1.166.2'
requires:
- router-core
sources:
- TanStack/router:docs/router/guide/data-loading.md
- TanStack/router:docs/router/guide/deferred-data-loading.md
- TanStack/router:docs/router/guide/router-context.md
- TanStack/router:docs/router/guide/data-mutations.md
---
# Data Loading
## Setup
Basic loader returning data, consumed via `useLoaderData`:
```tsx
// src/routes/posts.tsx
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/posts')({
loader: () => fetchPosts(),
component: PostsComponent,
})
function PostsComponent() {
const posts = Route.useLoaderData()
return (
<ul>
{posts.map((post) => (
<li key={post.id}>{post.title}</li>
))}
</ul>
)
}
```
In code-split components, use `getRouteApi` instead of importing Route:
```tsx
import { getRouteApi } from '@tanstack/react-router'
const routeApi = getRouteApi('/posts')
function PostsComponent() {
const posts = routeApi.useLoaderData()
return <ul>{/* ... */}</ul>
}
```
## Route Loading Lifecycle
The router executes this sequence on every URL/history update:
1. **Route Matching** (top-down)
- `route.params.parse`
- `route.validateSearch`
2. **Route Pre-Loading** (serial)
- `route.beforeLoad`
- `route.onError` → `route.errorComponent`
3. **Route Loading** (parallel)
- `route.component.preload?`
- `route.loader`
- `route.pendingComponent` (optional)
- `route.component`
- `route.onError` → `route.errorComponent`
Key: `beforeLoad` runs before `loader`. `beforeLoad` for a parent runs before its children's `beforeLoad`. Throwing in `beforeLoad` prevents all children from loading.
## Core Patterns
### loaderDeps for Search-Param-Driven Cache Keys
Loaders don't receive search params directly. Use `loaderDeps` to declare which search params affect the cache key:
```tsx
// src/routes/posts.tsx
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/posts')({
validateSearch: (search) => ({
offset: Number(search.offset) || 0,
limit: Number(search.limit) || 10,
}),
loaderDeps: ({ search: { offset, limit } }) => ({ offset, limit }),
loader: ({ deps: { offset, limit } }) => fetchPosts({ offset, limit }),
})
```
When deps change, the route reloads regardless of `staleTime`.
### SWR Caching Configuration
TanStack Router has built-in Stale-While-Revalidate caching keyed on the route's parsed pathname + `loaderDeps`.
Defaults:
- **`staleTime`: 0** — data is always considered stale, reloads in background on re-match
- **`preloadStaleTime`: 30 seconds** — preloaded data won't be refetched for 30s
- **`gcTime`: 30 minutes** — unused cache entries garbage collected after 30min
```tsx
export const Route = createFileRoute('/posts')({
loader: () => fetchPosts(),
staleTime: 10_000, // 10s: data considered fresh for 10 seconds
gcTime: 5 * 60 * 1000, // 5min: garbage collect after 5 minutes
})
```
Disable SWR caching entirely:
```tsx
export const Route = createFileRoute('/posts')({
loader: () => fetchPosts(),
staleTime: Infinity,
})
```
Globally:
```tsx
const router = createRouter({
routeTree,
defaultStaleTime: Infinity,
})
```
### Pending States (pendingComponent / pendingMs / pendingMinMs)
By default, a pending component shows after 1 second (`pendingMs: 1000`) and stays for at least 500ms (`pendingMinMs: 500`) to avoid flash.
```tsx
export const Route = createFileRoute('/posts')({
loader: () => fetchPosts(),
pendingMs: 500,
pendingMinMs: 300,
pendingComponent: () => <div>Loading posts...</div>,
component: PostsComponent,
})
```
### Router Context with createRootRouteWithContext (Factory Pattern)
`createRootRouteWithContext` is a factory that returns a function. You must call it twice — the first call passes the generic type, the second passes route options:
```tsx
// src/routes/__root.tsx
import { createRootRouteWithContext, Outlet } from '@tanstack/react-router'
interface MyRouterContext {
auth: { userId: string }
fetchPosts: () => Promise<Post[]>
}
// NOTE: double call — createRootRouteWithContext<Type>()({...})
export const Route = createRootRouteWithContext<MyRouterContext>()({
component: () => <Outlet />,
})
```
Supply the context when creating the router:
```tsx
// src/router.tsx
import { createRouter } from '@tanstack/react-router'
import { routeTree } from './routeTree.gen'
const router = createRouter({
routeTree,
context: {
auth: { userId: '123' },
fetchPosts,
},
})
```
Consume in loaders and beforeLoad:
```tsx
// src/routes/posts.tsx
export const Route = createFileRoute('/posts')({
loader: ({ context: { fetchPosts } }) => fetchPosts(),
})
```
To pass React hook values into the router context, call the hook above `RouterProvider` and inject via the `context` prop:
```tsx
import { RouterProvider } from '@tanstack/react-router'
function InnerApp() {
const auth = useAuth()
return <RouterProvider router={router} context={{ auth }} />
}
function App() {
return (
<AuthProvider>
<InnerApp />
</AuthProvider>
)
}
```
Route-level context via `beforeLoad`:
```tsx
export const Route = createFileRoute('/posts')({
beforeLoad: () => ({
fetchPosts: () => fetch('/api/posts').then((r) => r.json()),
}),
loader: ({ context: { fetchPosts } }) => fetchPosts(),
})
```
### Deferred Data Loading
Return unawaited promises from the loader for non-critical data. Use the `Await` component to render them:
```tsx
import { createFileRoute, Await } from '@tanstack/react-router'
export const Route = createFileRoute('/posts/$postId')({
loader: async ({ params: { postId } }) => {
// Slow data — do NOT await
const slowDataPromise = fetchComments(postId)
// Fast data — await
const post = await fetchPost(postId)
return { post, deferredComments: slowDataPromise }
},
component: PostComponent,
})
function PostComponent() {
const { post, deferredComments } = Route.useLoaderData()
return (
<div>
<h1>{post.title}</h1>
<Await
promise={deferredComments}
fallback={<div>Loading comments...</div>}
>
{(comments) => (
<ul>
{comments.map((c) => (
<li key={c.id}>{c.body}</li>
))}
</ul>
)}
</Await>
</div>
)
}
```
### Invalidation After Mutations
`router.invalidate()` forces all active route loaders to re-run and marks all cached data as stale:
```tsx
import { useRouter } from '@tanstack/react-router'
function AddPostButton() {
const router = useRouter()
const handleAdd = async () => {
await fetch('/api/posts', { method: 'POST', body: '...' })
router.invalidate()
}
return <button onClick={handleAdd}>Add Post</button>
}
```
For synchronous invalidation (wait until loaders finish):
```tsx
await router.invalidate({ sync: true })
```
### Error Handling
```tsx
import {
createFileRoute,
ErrorComponent,
useRouter,
} from '@tanstack/react-router'
export const Route = createFileRoute('/posts')({
loader: () => fetchPosts(),
errorComponent: ({ error, reset }) => {
const router = useRouter()
if (error instanceof CustomError) {
return <div>{error.message}</div>
}
return (
<div>
<ErrorComponent error={error} />
<button
onClick={() => {
// For loader errors, invalidate to re-run loader + reset boundary
router.invalidate()
}}
>
Retry
</button>
</div>
)
},
})
```
### Loader Parameters
The `loader` function receives:
- `params` — parsed path params
- `deps` — object from `loaderDeps`
- `context` — merged parent + beforeLoad context
- `abortController` — cancelled when route unloads or becomes stale
- `cause` — `'enter'`, `'stay'`, or `'preload'`
- `preload` — `true` during preloading
- `location` — current location object
- `parentMatchPromise` — promise of parent route match
- `route` — the route object itself
```tsx
export const Route = createFileRoute('/posts/$postId')({
loader: ({ params: { postId }, abortController }) =>
fetchPost(postId, { signal: abortController.signal }),
})
```
## Common Mistakes
### CRITICAL: Assuming loaders only run on the server
TanStack Router is **client-first**. Loaders run on the **client** by default. They also run on the server when using TanStack Start for SSR, but the default mental model is client-side execution.
```tsx
// WRONG — this will crash in the browser
export const Route = createFileRoute('/posts')({
loader: async () => {
const fs = await import('fs') // Node.js only!
return JSON.parse(fs.readFileSync('...')) // fails in browser
},
})
// CORRECT — loaders run in the browser, use fetch or API calls
export const Route = createFileRoute('/posts')({
loader: async () => {
const res = await fetch('/api/posts')
return res.json()
},
})
```
Do NOT put database queries, filesystem access, or server-only code in loaders unless you are using TanStack Start server functions.
### MEDIUM: Not understanding staleTime default is 0
Default `staleTime` is `0`. This means data reloads in the background on every route re-match. This is intentional — it ensures fresh data. But if your data is expensive or static, set `staleTime`:
```tsx
export const Route = createFileRoute('/posts')({
loader: () => fetchPosts(),
staleTime: 60_000, // Consider fresh for 1 minute
})
```
### HIGH: Using reset() instead of router.invalidate() in error components
`reset()` only resets the error boundary UI. It does NOT re-run the loader. For loader errors, use `router.invalidate()` which re-runs loaders and resets the boundary:
```tsx
// WRONG — resets boundary but loader still has stale error
function PostErrorComponent({ error, reset }) {
return <button onClick={reset}>Retry</button>
}
// CORRECT — re-runs loader and resets the error boundary
function PostErrorComponent({ error }) {
const router = useRouter()
return <button onClick={() => router.invalidate()}>Retry</button>
}
```
### HIGH: Missing double parentheses on createRootRouteWithContext
`createRootRouteWithContext<Type>()` is a factory — it returns a function. Must call twice:
```tsx
// WRONG — missing second call, passes options to the factory
const rootRoute = createRootRouteWithContext<{ auth: AuthState }>({
component: RootComponent,
})
// CORRECT — factory()({options})
const rootRoute = createRootRouteWithContext<{ auth: AuthState }>()({
component: RootComponent,
})
```
### HIGH: Using React hooks in beforeLoad or loader
`beforeLoad` and `loader` are NOT React components. You cannot call hooks inside them. Use router context to inject values from hooks:
```tsx
// WRONG — hooks cannot be called outside React components
export const Route = createFileRoute('/posts')({
loader: () => {
const auth = useAuth() // This will crash!
return fetchPosts(auth.userId)
},
})
// CORRECT — inject hook values via router context
// In your App component:
function InnerApp() {
const auth = useAuth()
return <RouterProvider router={router} context={{ auth }} />
}
// In your route:
export const Route = createFileRoute('/posts')({
loader: ({ context: { auth } }) => fetchPosts(auth.userId),
})
```
### HIGH: Property order affects TypeScript inference
Router infers types from earlier properties into later ones. Declaring `beforeLoad` after `loader` means context from `beforeLoad` is unknown in the loader:
```tsx
// WRONG — context.user is unknown because beforeLoad declared after loader
export const Route = createFileRoute('/admin')({
loader: ({ context }) => fetchData(context.user),
beforeLoad: () => ({ user: getUser() }),
})
// CORRECT — validateSearch → loaderDeps → beforeLoad → loader
export const Route = createFileRoute('/admin')({
beforeLoad: () => ({ user: getUser() }),
loader: ({ context }) => fetchData(context.user),
})
```
### HIGH: Returning entire search object from loaderDeps
```tsx
// WRONG — loader re-runs on ANY search param change
loaderDeps: ({ search }) => search
// CORRECT — only re-run when page changes
loaderDeps: ({ search }) => ({ page: search.page })
```
Returning the whole `search` object means unrelated param changes (e.g., `sortDirection`, `viewMode`) trigger unnecessary reloads because deep equality fails on the entire object.
## Tensions
- **Client-first loaders vs SSR expectations**: Loaders run on the client by default. When using SSR (TanStack Start), they run on both client and server. Browser-only APIs work by default but break under SSR. Server-only APIs (fs, db) break by default but work under Start server functions. See **router-core/ssr/SKILL.md**.
- **Built-in SWR cache vs external cache coordination**: Router has built-in caching. When using TanStack Query, set `defaultPreloadStaleTime: 0` to avoid double-caching. See **compositions/router-query/SKILL.md**.
---
## Cross-References
- See also: **router-core/search-params/SKILL.md** — `loaderDeps` consumes validated search params as cache keys
- See also: **compositions/router-query/SKILL.md** — for external cache coordination with TanStack Query
@@ -0,0 +1,111 @@
import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq';
import { StringWriter, StringReader } from './strings';
export {
decodeOriginalScopes,
encodeOriginalScopes,
decodeGeneratedRanges,
encodeGeneratedRanges,
} from './scopes';
export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes';
export type SourceMapSegment =
| [number]
| [number, number, number, number]
| [number, number, number, number, number];
export type SourceMapLine = SourceMapSegment[];
export type SourceMapMappings = SourceMapLine[];
export function decode(mappings: string): SourceMapMappings {
const { length } = mappings;
const reader = new StringReader(mappings);
const decoded: SourceMapMappings = [];
let genColumn = 0;
let sourcesIndex = 0;
let sourceLine = 0;
let sourceColumn = 0;
let namesIndex = 0;
do {
const semi = reader.indexOf(';');
const line: SourceMapLine = [];
let sorted = true;
let lastCol = 0;
genColumn = 0;
while (reader.pos < semi) {
let seg: SourceMapSegment;
genColumn = decodeInteger(reader, genColumn);
if (genColumn < lastCol) sorted = false;
lastCol = genColumn;
if (hasMoreVlq(reader, semi)) {
sourcesIndex = decodeInteger(reader, sourcesIndex);
sourceLine = decodeInteger(reader, sourceLine);
sourceColumn = decodeInteger(reader, sourceColumn);
if (hasMoreVlq(reader, semi)) {
namesIndex = decodeInteger(reader, namesIndex);
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
} else {
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
}
} else {
seg = [genColumn];
}
line.push(seg);
reader.pos++;
}
if (!sorted) sort(line);
decoded.push(line);
reader.pos = semi + 1;
} while (reader.pos <= length);
return decoded;
}
function sort(line: SourceMapSegment[]) {
line.sort(sortComparator);
}
function sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {
return a[0] - b[0];
}
export function encode(decoded: SourceMapMappings): string;
export function encode(decoded: Readonly<SourceMapMappings>): string;
export function encode(decoded: Readonly<SourceMapMappings>): string {
const writer = new StringWriter();
let sourcesIndex = 0;
let sourceLine = 0;
let sourceColumn = 0;
let namesIndex = 0;
for (let i = 0; i < decoded.length; i++) {
const line = decoded[i];
if (i > 0) writer.write(semicolon);
if (line.length === 0) continue;
let genColumn = 0;
for (let j = 0; j < line.length; j++) {
const segment = line[j];
if (j > 0) writer.write(comma);
genColumn = encodeInteger(writer, segment[0], genColumn);
if (segment.length === 1) continue;
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
sourceLine = encodeInteger(writer, segment[2], sourceLine);
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
if (segment.length === 4) continue;
namesIndex = encodeInteger(writer, segment[4], namesIndex);
}
}
return writer.flush();
}
@@ -0,0 +1,72 @@
'use strict';
var _const = require('../../data/const.cjs');
const getDictionaryWarningPassword = (options, match, isSoleMatch) => {
let warning = null;
if (isSoleMatch && !match.l33t && !match.reversed) {
if (match.rank <= 10) {
warning = options.translations.warnings.topTen;
} else if (match.rank <= 100) {
warning = options.translations.warnings.topHundred;
} else {
warning = options.translations.warnings.common;
}
} else if (match.guessesLog10 <= 4) {
warning = options.translations.warnings.similarToCommon;
}
return warning;
};
const getDictionaryWarningWikipedia = (options, match, isSoleMatch) => {
let warning = null;
if (isSoleMatch) {
warning = options.translations.warnings.wordByItself;
}
return warning;
};
const getDictionaryWarningNames = (options, match, isSoleMatch) => {
if (isSoleMatch) {
return options.translations.warnings.namesByThemselves;
}
return options.translations.warnings.commonNames;
};
const getDictionaryWarning = (options, match, isSoleMatch) => {
const dictName = match.dictionaryName;
const isAName = dictName.toLowerCase().includes('lastnames') || dictName.toLowerCase().includes('firstnames') || dictName.toLowerCase().includes('names');
if (dictName.includes('passwords')) {
return getDictionaryWarningPassword(options, match, isSoleMatch);
}
if (dictName.includes('wikipedia')) {
return getDictionaryWarningWikipedia(options, match, isSoleMatch);
}
if (isAName) {
return getDictionaryWarningNames(options, match, isSoleMatch);
}
if (dictName.includes('userInputs')) {
return options.translations.warnings.userInputs;
}
return null;
};
var dictionaryMatcher = (options, match, isSoleMatch) => {
const warning = getDictionaryWarning(options, match, isSoleMatch);
const suggestions = [];
const word = match.token;
if (word.match(_const.START_UPPER)) {
suggestions.push(options.translations.suggestions.capitalization);
} else if (word.match(_const.ALL_UPPER_INVERTED) && word.toLowerCase() !== word) {
suggestions.push(options.translations.suggestions.allUppercase);
}
if (match.reversed && match.token.length >= 4) {
suggestions.push(options.translations.suggestions.reverseWords);
}
if (match.l33t) {
suggestions.push(options.translations.suggestions.l33t);
}
return {
warning,
suggestions
};
};
module.exports = dictionaryMatcher;
//# sourceMappingURL=feedback.cjs.map
@@ -0,0 +1,77 @@
{
"name": "gopd",
"version": "1.2.0",
"description": "`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation.",
"main": "index.js",
"exports": {
".": "./index.js",
"./gOPD": "./gOPD.js",
"./package.json": "./package.json"
},
"sideEffects": false,
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prelint": "tsc -p . && attw -P",
"lint": "eslint --ext=js,mjs .",
"postlint": "evalmd README.md",
"pretest": "npm run lint",
"tests-only": "tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "npx npm@'>=10.2' audit --production",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/ljharb/gopd.git"
},
"keywords": [
"ecmascript",
"javascript",
"getownpropertydescriptor",
"property",
"descriptor"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/ljharb/gopd/issues"
},
"homepage": "https://github.com/ljharb/gopd#readme",
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.0",
"@ljharb/eslint-config": "^21.1.1",
"@ljharb/tsconfig": "^0.2.0",
"@types/tape": "^5.6.5",
"auto-changelog": "^2.5.0",
"encoding": "^0.1.13",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0",
"typescript": "next"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"engines": {
"node": ">= 0.4"
}
}
@@ -0,0 +1 @@
{"version":3,"file":"transform.mjs","sources":["../../../../src/effects/style/transform.ts"],"sourcesContent":["import { transformPropOrder } from \"../../render/utils/keys-transform\"\nimport { MotionValueState } from \"../MotionValueState\"\n\nconst translateAlias = {\n x: \"translateX\",\n y: \"translateY\",\n z: \"translateZ\",\n transformPerspective: \"perspective\",\n}\n\nexport function buildTransform(state: MotionValueState) {\n let transform = \"\"\n let transformIsDefault = true\n\n /**\n * Loop over all possible transforms in order, adding the ones that\n * are present to the transform string.\n */\n for (let i = 0; i < transformPropOrder.length; i++) {\n const key = transformPropOrder[i] as keyof typeof translateAlias\n const value = state.latest[key]\n\n if (value === undefined) continue\n\n let valueIsDefault = true\n if (typeof value === \"number\") {\n valueIsDefault = value === (key.startsWith(\"scale\") ? 1 : 0)\n } else {\n const parsed = parseFloat(value)\n valueIsDefault = key.startsWith(\"scale\") ? parsed === 1 : parsed === 0\n }\n\n if (!valueIsDefault) {\n transformIsDefault = false\n const transformName = translateAlias[key] || key\n transform += `${transformName}(${value}) `\n }\n }\n\n return transformIsDefault ? \"none\" : transform.trim()\n}\n"],"names":[],"mappings":";;AAGA,MAAM,cAAc,GAAG;AACnB,IAAA,CAAC,EAAE,YAAY;AACf,IAAA,CAAC,EAAE,YAAY;AACf,IAAA,CAAC,EAAE,YAAY;AACf,IAAA,oBAAoB,EAAE,aAAa;CACtC;AAEK,SAAU,cAAc,CAAC,KAAuB,EAAA;IAClD,IAAI,SAAS,GAAG,EAAE;IAClB,IAAI,kBAAkB,GAAG,IAAI;AAE7B;;;AAGG;AACH,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,kBAAkB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAChD,QAAA,MAAM,GAAG,GAAG,kBAAkB,CAAC,CAAC,CAAgC;QAChE,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;QAE/B,IAAI,KAAK,KAAK,SAAS;YAAE;QAEzB,IAAI,cAAc,GAAG,IAAI;AACzB,QAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC3B,YAAA,cAAc,GAAG,KAAK,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChE;aAAO;AACH,YAAA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC;AAChC,YAAA,cAAc,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,KAAK,CAAC;QAC1E;QAEA,IAAI,CAAC,cAAc,EAAE;YACjB,kBAAkB,GAAG,KAAK;YAC1B,MAAM,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,GAAG;AAChD,YAAA,SAAS,IAAI,CAAA,EAAG,aAAa,CAAA,CAAA,EAAI,KAAK,IAAI;QAC9C;IACJ;AAEA,IAAA,OAAO,kBAAkB,GAAG,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE;AACzD;;;;"}
@@ -0,0 +1,620 @@
import { htmlDecodeTree } from "./generated/decode-data-html.js";
import { xmlDecodeTree } from "./generated/decode-data-xml.js";
import { replaceCodePoint, fromCodePoint } from "./decode-codepoint.js";
const enum CharCodes {
NUM = 35, // "#"
SEMI = 59, // ";"
EQUALS = 61, // "="
ZERO = 48, // "0"
NINE = 57, // "9"
LOWER_A = 97, // "a"
LOWER_F = 102, // "f"
LOWER_X = 120, // "x"
LOWER_Z = 122, // "z"
UPPER_A = 65, // "A"
UPPER_F = 70, // "F"
UPPER_Z = 90, // "Z"
}
/** Bit that needs to be set to convert an upper case ASCII character to lower case */
const TO_LOWER_BIT = 0b10_0000;
export enum BinTrieFlags {
VALUE_LENGTH = 0b1100_0000_0000_0000,
BRANCH_LENGTH = 0b0011_1111_1000_0000,
JUMP_TABLE = 0b0000_0000_0111_1111,
}
function isNumber(code: number): boolean {
return code >= CharCodes.ZERO && code <= CharCodes.NINE;
}
function isHexadecimalCharacter(code: number): boolean {
return (
(code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F) ||
(code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F)
);
}
function isAsciiAlphaNumeric(code: number): boolean {
return (
(code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z) ||
(code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z) ||
isNumber(code)
);
}
/**
* Checks if the given character is a valid end character for an entity in an attribute.
*
* Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
* See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
*/
function isEntityInAttributeInvalidEnd(code: number): boolean {
return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
}
const enum EntityDecoderState {
EntityStart,
NumericStart,
NumericDecimal,
NumericHex,
NamedEntity,
}
export enum DecodingMode {
/** Entities in text nodes that can end with any character. */
Legacy = 0,
/** Only allow entities terminated with a semicolon. */
Strict = 1,
/** Entities in attributes have limitations on ending characters. */
Attribute = 2,
}
/**
* Producers for character reference errors as defined in the HTML spec.
*/
export interface EntityErrorProducer {
missingSemicolonAfterCharacterReference(): void;
absenceOfDigitsInNumericCharacterReference(
consumedCharacters: number,
): void;
validateNumericCharacterReference(code: number): void;
}
/**
* Token decoder with support of writing partial entities.
*/
export class EntityDecoder {
constructor(
/** The tree used to decode entities. */
private readonly decodeTree: Uint16Array,
/**
* The function that is called when a codepoint is decoded.
*
* For multi-byte named entities, this will be called multiple times,
* with the second codepoint, and the same `consumed` value.
*
* @param codepoint The decoded codepoint.
* @param consumed The number of bytes consumed by the decoder.
*/
private readonly emitCodePoint: (cp: number, consumed: number) => void,
/** An object that is used to produce errors. */
private readonly errors?: EntityErrorProducer | undefined,
) {}
/** The current state of the decoder. */
private state = EntityDecoderState.EntityStart;
/** Characters that were consumed while parsing an entity. */
private consumed = 1;
/**
* The result of the entity.
*
* Either the result index of a numeric entity, or the codepoint of a
* numeric entity.
*/
private result = 0;
/** The current index in the decode tree. */
private treeIndex = 0;
/** The number of characters that were consumed in excess. */
private excess = 1;
/** The mode in which the decoder is operating. */
private decodeMode = DecodingMode.Strict;
/** Resets the instance to make it reusable. */
startEntity(decodeMode: DecodingMode): void {
this.decodeMode = decodeMode;
this.state = EntityDecoderState.EntityStart;
this.result = 0;
this.treeIndex = 0;
this.excess = 1;
this.consumed = 1;
}
/**
* Write an entity to the decoder. This can be called multiple times with partial entities.
* If the entity is incomplete, the decoder will return -1.
*
* Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
* entity is incomplete, and resume when the next string is written.
*
* @param input The string containing the entity (or a continuation of the entity).
* @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
write(input: string, offset: number): number {
switch (this.state) {
case EntityDecoderState.EntityStart: {
if (input.charCodeAt(offset) === CharCodes.NUM) {
this.state = EntityDecoderState.NumericStart;
this.consumed += 1;
return this.stateNumericStart(input, offset + 1);
}
this.state = EntityDecoderState.NamedEntity;
return this.stateNamedEntity(input, offset);
}
case EntityDecoderState.NumericStart: {
return this.stateNumericStart(input, offset);
}
case EntityDecoderState.NumericDecimal: {
return this.stateNumericDecimal(input, offset);
}
case EntityDecoderState.NumericHex: {
return this.stateNumericHex(input, offset);
}
case EntityDecoderState.NamedEntity: {
return this.stateNamedEntity(input, offset);
}
}
}
/**
* Switches between the numeric decimal and hexadecimal states.
*
* Equivalent to the `Numeric character reference state` in the HTML spec.
*
* @param input The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
private stateNumericStart(input: string, offset: number): number {
if (offset >= input.length) {
return -1;
}
if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
this.state = EntityDecoderState.NumericHex;
this.consumed += 1;
return this.stateNumericHex(input, offset + 1);
}
this.state = EntityDecoderState.NumericDecimal;
return this.stateNumericDecimal(input, offset);
}
private addToNumericResult(
input: string,
start: number,
end: number,
base: number,
): void {
if (start !== end) {
const digitCount = end - start;
this.result =
this.result * Math.pow(base, digitCount) +
Number.parseInt(input.substr(start, digitCount), base);
this.consumed += digitCount;
}
}
/**
* Parses a hexadecimal numeric entity.
*
* Equivalent to the `Hexademical character reference state` in the HTML spec.
*
* @param input The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
private stateNumericHex(input: string, offset: number): number {
const startIndex = offset;
while (offset < input.length) {
const char = input.charCodeAt(offset);
if (isNumber(char) || isHexadecimalCharacter(char)) {
offset += 1;
} else {
this.addToNumericResult(input, startIndex, offset, 16);
return this.emitNumericEntity(char, 3);
}
}
this.addToNumericResult(input, startIndex, offset, 16);
return -1;
}
/**
* Parses a decimal numeric entity.
*
* Equivalent to the `Decimal character reference state` in the HTML spec.
*
* @param input The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
private stateNumericDecimal(input: string, offset: number): number {
const startIndex = offset;
while (offset < input.length) {
const char = input.charCodeAt(offset);
if (isNumber(char)) {
offset += 1;
} else {
this.addToNumericResult(input, startIndex, offset, 10);
return this.emitNumericEntity(char, 2);
}
}
this.addToNumericResult(input, startIndex, offset, 10);
return -1;
}
/**
* Validate and emit a numeric entity.
*
* Implements the logic from the `Hexademical character reference start
* state` and `Numeric character reference end state` in the HTML spec.
*
* @param lastCp The last code point of the entity. Used to see if the
* entity was terminated with a semicolon.
* @param expectedLength The minimum number of characters that should be
* consumed. Used to validate that at least one digit
* was consumed.
* @returns The number of characters that were consumed.
*/
private emitNumericEntity(lastCp: number, expectedLength: number): number {
// Ensure we consumed at least one digit.
if (this.consumed <= expectedLength) {
this.errors?.absenceOfDigitsInNumericCharacterReference(
this.consumed,
);
return 0;
}
// Figure out if this is a legit end of the entity
if (lastCp === CharCodes.SEMI) {
this.consumed += 1;
} else if (this.decodeMode === DecodingMode.Strict) {
return 0;
}
this.emitCodePoint(replaceCodePoint(this.result), this.consumed);
if (this.errors) {
if (lastCp !== CharCodes.SEMI) {
this.errors.missingSemicolonAfterCharacterReference();
}
this.errors.validateNumericCharacterReference(this.result);
}
return this.consumed;
}
/**
* Parses a named entity.
*
* Equivalent to the `Named character reference state` in the HTML spec.
*
* @param input The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
private stateNamedEntity(input: string, offset: number): number {
const { decodeTree } = this;
let current = decodeTree[this.treeIndex];
// The mask is the number of bytes of the value, including the current byte.
let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
for (; offset < input.length; offset++, this.excess++) {
const char = input.charCodeAt(offset);
this.treeIndex = determineBranch(
decodeTree,
current,
this.treeIndex + Math.max(1, valueLength),
char,
);
if (this.treeIndex < 0) {
return this.result === 0 ||
// If we are parsing an attribute
(this.decodeMode === DecodingMode.Attribute &&
// We shouldn't have consumed any characters after the entity,
(valueLength === 0 ||
// And there should be no invalid characters.
isEntityInAttributeInvalidEnd(char)))
? 0
: this.emitNotTerminatedNamedEntity();
}
current = decodeTree[this.treeIndex];
valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
// If the branch is a value, store it and continue
if (valueLength !== 0) {
// If the entity is terminated by a semicolon, we are done.
if (char === CharCodes.SEMI) {
return this.emitNamedEntityData(
this.treeIndex,
valueLength,
this.consumed + this.excess,
);
}
// If we encounter a non-terminated (legacy) entity while parsing strictly, then ignore it.
if (this.decodeMode !== DecodingMode.Strict) {
this.result = this.treeIndex;
this.consumed += this.excess;
this.excess = 0;
}
}
}
return -1;
}
/**
* Emit a named entity that was not terminated with a semicolon.
*
* @returns The number of characters consumed.
*/
private emitNotTerminatedNamedEntity(): number {
const { result, decodeTree } = this;
const valueLength =
(decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
this.emitNamedEntityData(result, valueLength, this.consumed);
this.errors?.missingSemicolonAfterCharacterReference();
return this.consumed;
}
/**
* Emit a named entity.
*
* @param result The index of the entity in the decode tree.
* @param valueLength The number of bytes in the entity.
* @param consumed The number of characters consumed.
*
* @returns The number of characters consumed.
*/
private emitNamedEntityData(
result: number,
valueLength: number,
consumed: number,
): number {
const { decodeTree } = this;
this.emitCodePoint(
valueLength === 1
? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH
: decodeTree[result + 1],
consumed,
);
if (valueLength === 3) {
// For multi-byte values, we need to emit the second byte.
this.emitCodePoint(decodeTree[result + 2], consumed);
}
return consumed;
}
/**
* Signal to the parser that the end of the input was reached.
*
* Remaining data will be emitted and relevant errors will be produced.
*
* @returns The number of characters consumed.
*/
end(): number {
switch (this.state) {
case EntityDecoderState.NamedEntity: {
// Emit a named entity if we have one.
return this.result !== 0 &&
(this.decodeMode !== DecodingMode.Attribute ||
this.result === this.treeIndex)
? this.emitNotTerminatedNamedEntity()
: 0;
}
// Otherwise, emit a numeric entity if we have one.
case EntityDecoderState.NumericDecimal: {
return this.emitNumericEntity(0, 2);
}
case EntityDecoderState.NumericHex: {
return this.emitNumericEntity(0, 3);
}
case EntityDecoderState.NumericStart: {
this.errors?.absenceOfDigitsInNumericCharacterReference(
this.consumed,
);
return 0;
}
case EntityDecoderState.EntityStart: {
// Return 0 if we have no entity.
return 0;
}
}
}
}
/**
* Creates a function that decodes entities in a string.
*
* @param decodeTree The decode tree.
* @returns A function that decodes entities in a string.
*/
function getDecoder(decodeTree: Uint16Array) {
let returnValue = "";
const decoder = new EntityDecoder(
decodeTree,
(data) => (returnValue += fromCodePoint(data)),
);
return function decodeWithTrie(
input: string,
decodeMode: DecodingMode,
): string {
let lastIndex = 0;
let offset = 0;
while ((offset = input.indexOf("&", offset)) >= 0) {
returnValue += input.slice(lastIndex, offset);
decoder.startEntity(decodeMode);
const length = decoder.write(
input,
// Skip the "&"
offset + 1,
);
if (length < 0) {
lastIndex = offset + decoder.end();
break;
}
lastIndex = offset + length;
// If `length` is 0, skip the current `&` and continue.
offset = length === 0 ? lastIndex + 1 : lastIndex;
}
const result = returnValue + input.slice(lastIndex);
// Make sure we don't keep a reference to the final string.
returnValue = "";
return result;
};
}
/**
* Determines the branch of the current node that is taken given the current
* character. This function is used to traverse the trie.
*
* @param decodeTree The trie.
* @param current The current node.
* @param nodeIdx The index right after the current node and its value.
* @param char The current character.
* @returns The index of the next node, or -1 if no branch is taken.
*/
export function determineBranch(
decodeTree: Uint16Array,
current: number,
nodeIndex: number,
char: number,
): number {
const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
// Case 1: Single branch encoded in jump offset
if (branchCount === 0) {
return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;
}
// Case 2: Multiple branches encoded in jump table
if (jumpOffset) {
const value = char - jumpOffset;
return value < 0 || value >= branchCount
? -1
: decodeTree[nodeIndex + value] - 1;
}
// Case 3: Multiple branches encoded in dictionary
// Binary search for the character.
let lo = nodeIndex;
let hi = lo + branchCount - 1;
while (lo <= hi) {
const mid = (lo + hi) >>> 1;
const midValue = decodeTree[mid];
if (midValue < char) {
lo = mid + 1;
} else if (midValue > char) {
hi = mid - 1;
} else {
return decodeTree[mid + branchCount];
}
}
return -1;
}
const htmlDecoder = /* #__PURE__ */ getDecoder(htmlDecodeTree);
const xmlDecoder = /* #__PURE__ */ getDecoder(xmlDecodeTree);
/**
* Decodes an HTML string.
*
* @param htmlString The string to decode.
* @param mode The decoding mode.
* @returns The decoded string.
*/
export function decodeHTML(
htmlString: string,
mode: DecodingMode = DecodingMode.Legacy,
): string {
return htmlDecoder(htmlString, mode);
}
/**
* Decodes an HTML string in an attribute.
*
* @param htmlAttribute The string to decode.
* @returns The decoded string.
*/
export function decodeHTMLAttribute(htmlAttribute: string): string {
return htmlDecoder(htmlAttribute, DecodingMode.Attribute);
}
/**
* Decodes an HTML string, requiring all entities to be terminated by a semicolon.
*
* @param htmlString The string to decode.
* @returns The decoded string.
*/
export function decodeHTMLStrict(htmlString: string): string {
return htmlDecoder(htmlString, DecodingMode.Strict);
}
/**
* Decodes an XML string, requiring all entities to be terminated by a semicolon.
*
* @param xmlString The string to decode.
* @returns The decoded string.
*/
export function decodeXML(xmlString: string): string {
return xmlDecoder(xmlString, DecodingMode.Strict);
}
// Re-export for use by eg. htmlparser2
export { htmlDecodeTree } from "./generated/decode-data-html.js";
export { xmlDecodeTree } from "./generated/decode-data-xml.js";
export {
decodeCodePoint,
replaceCodePoint,
fromCodePoint,
} from "./decode-codepoint.js";
@@ -0,0 +1,28 @@
/**
* @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 FolderHeart = createLucideIcon("FolderHeart", [
[
"path",
{
d: "M11 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v1.5",
key: "6hud8k"
}
],
[
"path",
{
d: "M13.9 17.45c-1.2-1.2-1.14-2.8-.2-3.73a2.43 2.43 0 0 1 3.44 0l.36.34.34-.34a2.43 2.43 0 0 1 3.45-.01c.95.95 1 2.53-.2 3.74L17.5 21Z",
key: "wpff58"
}
]
]);
export { FolderHeart as default };
//# sourceMappingURL=folder-heart.js.map
@@ -0,0 +1,5 @@
import type { TSESLint } from '@typescript-eslint/utils';
declare const _default: TSESLint.RuleModule<"bannedClassType", [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1 @@
{"version":3,"names":["_iterableToArray","iter","Symbol","iterator","Array","from"],"sources":["../../src/helpers/iterableToArray.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _iterableToArray<T>(iter: Iterable<T>) {\n if (\n (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null) ||\n (iter as any)[\"@@iterator\"] != null\n ) {\n return Array.from(iter);\n }\n}\n"],"mappings":";;;;;;AAEe,SAASA,gBAAgBA,CAAIC,IAAiB,EAAE;EAC7D,IACG,OAAOC,MAAM,KAAK,WAAW,IAAID,IAAI,CAACC,MAAM,CAACC,QAAQ,CAAC,IAAI,IAAI,IAC9DF,IAAI,CAAS,YAAY,CAAC,IAAI,IAAI,EACnC;IACA,OAAOG,KAAK,CAACC,IAAI,CAACJ,IAAI,CAAC;EACzB;AACF","ignoreList":[]}
@@ -0,0 +1,2 @@
export * from "./dist/toml";
export { default } from "./dist/toml";
@@ -0,0 +1,2 @@
import { AddressType, ConnInfo, GetConnInfo, NetAddrInfo } from "./types.js";
export type { AddressType, ConnInfo, GetConnInfo, NetAddrInfo };
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const webworker_iterable: LibDefinition;
@@ -0,0 +1,9 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
// TODO remove in next major
module.exports = require("./ModulesInHierarchicalDirectoriesPlugin");
@@ -0,0 +1 @@
{"version":3,"file":"ajv-provider.d.ts","sourceRoot":"","sources":["../../../src/validation/ajv-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAA6B,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAgBtH;;;;;;;;;;;;GAYG;AACH,qBAAa,sBAAuB,YAAW,mBAAmB;IAC9D,OAAO,CAAC,IAAI,CAAM;IAElB;;;;;;;;;;;;;;;;;;;OAmBG;gBACS,GAAG,CAAC,EAAE,GAAG;IAIrB;;;;;;;;OAQG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,GAAG,mBAAmB,CAAC,CAAC,CAAC;CAyBlE"}
@@ -0,0 +1,21 @@
/**
* @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 Volume = createLucideIcon("Volume", [
[
"path",
{
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
key: "uqj9uw"
}
]
]);
export { Volume as default };
//# sourceMappingURL=volume.js.map
@@ -0,0 +1,5 @@
export * from './astUtilities';
export * from './PatternMatcher';
export * from './predicates';
export * from './ReferenceTracker';
export * from './scopeAnalysis';
@@ -0,0 +1,131 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
const PROMISE_TO_ABORT_SIGNAL = (promise: Promise<unknown>) => {
const controller = new AbortController();
const abort = controller.abort.bind(controller);
promise.then(abort, abort);
return controller;
};
function resolveAbortSignalResult(
this: AbortSignal,
resolve: (value: unknown) => void,
): void {
resolve(this.reason);
}
function resolveAbortSignal(
this: AbortSignal,
resolve: (value: unknown) => void,
): void {
this.addEventListener('abort', resolveAbortSignalResult.bind(this, resolve), {
once: true,
});
}
function abortSignalToPromise(signal: AbortSignal): Promise<unknown> {
return new Promise(resolveAbortSignal.bind(signal));
}
const ABORT_CONTROLLER = {};
const AbortControllerFactoryPlugin = /* @__PURE__ */ createPlugin<object, {}>({
tag: 'seroval-plugins/web/AbortControllerFactoryPlugin',
test(value) {
return value === ABORT_CONTROLLER;
},
parse: {
sync() {
return ABORT_CONTROLLER;
},
async async() {
return await Promise.resolve(ABORT_CONTROLLER);
},
stream() {
return ABORT_CONTROLLER;
},
},
serialize() {
return PROMISE_TO_ABORT_SIGNAL.toString();
},
deserialize() {
return PROMISE_TO_ABORT_SIGNAL;
},
});
const AbortSignalPlugin = /* @__PURE__ */ createPlugin<
AbortSignal,
{ reason?: SerovalNode; controller?: SerovalNode; factory?: SerovalNode }
>({
tag: 'seroval-plugins/web/AbortSignal',
extends: [AbortControllerFactoryPlugin],
test(value) {
if (typeof AbortSignal === 'undefined') {
return false;
}
return value instanceof AbortSignal;
},
parse: {
sync(value, ctx) {
if (value.aborted) {
return {
reason: ctx.parse(value.reason),
};
}
return {};
},
async async(value, ctx) {
if (value.aborted) {
return {
reason: await ctx.parse(value.reason),
};
}
const result = await abortSignalToPromise(value);
return {
reason: await ctx.parse(result),
};
},
stream(value, ctx) {
if (value.aborted) {
return {
reason: ctx.parse(value.reason),
};
}
const promise = abortSignalToPromise(value);
return {
factory: ctx.parse(ABORT_CONTROLLER),
controller: ctx.parse(promise),
};
},
},
serialize(node, ctx) {
if (node.reason) {
return 'AbortSignal.abort(' + ctx.serialize(node.reason) + ')';
}
if (node.controller && node.factory) {
return (
'(' +
ctx.serialize(node.factory) +
')(' +
ctx.serialize(node.controller) +
').signal'
);
}
return '(new AbortController).signal';
},
deserialize(node, ctx) {
if (node.reason) {
return AbortSignal.abort(ctx.deserialize(node.reason));
}
if (node.controller) {
return PROMISE_TO_ABORT_SIGNAL(ctx.deserialize(node.controller)).signal;
}
const controller = new AbortController();
return controller.signal;
},
});
export default AbortSignalPlugin;
@@ -0,0 +1,15 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
Object.defineProperty(exports, "__esModule", { value: true });
exports.esnext_temporal = void 0;
const base_config_1 = require("./base-config");
const es2015_symbol_wellknown_1 = require("./es2015.symbol.wellknown");
const es2020_intl_1 = require("./es2020.intl");
const es2025_intl_1 = require("./es2025.intl");
exports.esnext_temporal = {
libs: [es2015_symbol_wellknown_1.es2015_symbol_wellknown, es2020_intl_1.es2020_intl, es2025_intl_1.es2025_intl],
variables: [['Temporal', base_config_1.TYPE_VALUE]],
};
@@ -0,0 +1,18 @@
import { dirname, resolve } from 'path';
import { readdirSync, statSync } from 'fs';
export default function (start, callback) {
let dir = resolve('.', start);
let tmp, stats = statSync(dir);
if (!stats.isDirectory()) {
dir = dirname(dir);
}
while (true) {
tmp = callback(dir, readdirSync(dir));
if (tmp) return resolve(dir, tmp);
dir = dirname(tmp = dir);
if (tmp === dir) break;
}
}
@@ -0,0 +1,2 @@
import { AnyRouter } from '../router.js';
export declare function getScrollRestorationScriptForRouter(_router: AnyRouter): null;
@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports._assertUnremoved = _assertUnremoved;
exports._callRemovalHooks = _callRemovalHooks;
exports._markRemoved = _markRemoved;
exports._remove = _remove;
exports._removeFromScope = _removeFromScope;
exports.remove = remove;
var _removalHooks = require("./lib/removal-hooks.js");
var _cache = require("../cache.js");
var _replacement = require("./replacement.js");
var _index = require("./index.js");
var t = require("@babel/types");
var _modification = require("./modification.js");
var _context = require("./context.js");
function remove() {
var _this$opts;
_assertUnremoved.call(this);
_context.resync.call(this);
if (_callRemovalHooks.call(this)) {
_markRemoved.call(this);
return;
}
if (!((_this$opts = this.opts) != null && _this$opts.noScope)) {
_removeFromScope.call(this);
}
this.shareCommentsWithSiblings();
_remove.call(this);
_markRemoved.call(this);
}
function _removeFromScope() {
const bindings = t.getBindingIdentifiers(this.node, false, false, true);
Object.keys(bindings).forEach(name => this.scope.removeBinding(name));
}
function _callRemovalHooks() {
if (this.parentPath) {
for (const fn of _removalHooks.hooks) {
if (fn(this, this.parentPath)) return true;
}
}
}
function _remove() {
if (Array.isArray(this.container)) {
this.container.splice(this.key, 1);
_modification.updateSiblingKeys.call(this, this.key, -1);
} else {
_replacement._replaceWith.call(this, null);
}
}
function _markRemoved() {
this._traverseFlags |= _index.SHOULD_SKIP | _index.REMOVED;
if (this.parent) {
var _getCachedPaths;
(_getCachedPaths = (0, _cache.getCachedPaths)(this)) == null || _getCachedPaths.delete(this.node);
}
this.node = null;
}
function _assertUnremoved() {
if (this.removed) {
throw this.buildCodeFrameError("NodePath has been removed so is read-only.");
}
}
//# sourceMappingURL=removal.js.map
@@ -0,0 +1,34 @@
import type { Plugin } from 'vite';
import type { Options } from './typings';
export * from './typings';
/**
* Copy files and directories.
*
* @example
* ```js
* import { defineConfig } from 'vite';
* import cp from 'vite-plugin-cp';
*
* export default defineConfig({
* plugins: [
* cp({
* targets: [
* // copy files of './node_modules/vite/dist' to './dist/test'
* { src: './node_modules/vite/dist', dest: './dist/test', flatten: false },
*
* // copy files of './node_modules/vite/dist' to './dist/test2'
* // and keep the directory structure of copied files
* { src: './node_modules/vite/dist', dest: './dist/test2' },
*
* // copy './node_modules/vite/README.md' to './dist/README.md'
* { src: './node_modules/vite/README.md', dest: './dist' },
* ]
* })
* ]
* });
* ```
*
* @param opts Options
* @returns a vite plugin
*/
export default function pluginCp(opts: Options): Plugin<any> | undefined;
@@ -0,0 +1,78 @@
function ItoI(a) {
return a;
}
function innerCreateMedium(defaults, middleware = ItoI) {
let buffer = [];
let assigned = false;
const medium = {
read() {
if (assigned) {
throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.');
}
if (buffer.length) {
return buffer[buffer.length - 1];
}
return defaults;
},
useMedium(data) {
const item = middleware(data, assigned);
buffer.push(item);
return () => {
buffer = buffer.filter((x) => x !== item);
};
},
assignSyncMedium(cb) {
assigned = true;
while (buffer.length) {
const cbs = buffer;
buffer = [];
cbs.forEach(cb);
}
buffer = {
push: (x) => cb(x),
filter: () => buffer,
};
},
assignMedium(cb) {
assigned = true;
let pendingQueue = [];
if (buffer.length) {
const cbs = buffer;
buffer = [];
cbs.forEach(cb);
pendingQueue = buffer;
}
const executeQueue = () => {
const cbs = pendingQueue;
pendingQueue = [];
cbs.forEach(cb);
};
const cycle = () => Promise.resolve().then(executeQueue);
cycle();
buffer = {
push: (x) => {
pendingQueue.push(x);
cycle();
},
filter: (filter) => {
pendingQueue = pendingQueue.filter(filter);
return buffer;
},
};
},
};
return medium;
}
export function createMedium(defaults, middleware = ItoI) {
return innerCreateMedium(defaults, middleware);
}
// eslint-disable-next-line @typescript-eslint/ban-types
export function createSidecarMedium(options = {}) {
const medium = innerCreateMedium(null);
medium.options = {
async: true,
ssr: false,
...options,
};
return medium;
}
@@ -0,0 +1,9 @@
/*
* Public API Surface of gridstack-angular
*/
export * from './lib/types';
export * from './lib/base-widget';
export * from './lib/gridstack-item.component';
export * from './lib/gridstack.component';
export * from './lib/gridstack.module';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9hbmd1bGFyL3Byb2plY3RzL2xpYi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsZ0NBQWdDLENBQUM7QUFDL0MsY0FBYywyQkFBMkIsQ0FBQztBQUMxQyxjQUFjLHdCQUF3QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBncmlkc3RhY2stYW5ndWxhclxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vbGliL3R5cGVzJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2Jhc2Utd2lkZ2V0JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2dyaWRzdGFjay1pdGVtLmNvbXBvbmVudCc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9ncmlkc3RhY2suY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2dyaWRzdGFjay5tb2R1bGUnO1xuIl19
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,gEAAgE;AAChE,OAAO,EACH,KAAK,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACV,WAAW,GACd,MAAM,YAAY,CAAC"}
@@ -0,0 +1,13 @@
# `react-use-escape-keydown`
## Installation
```sh
$ yarn add @radix-ui/react-use-escape-keydown
# or
$ npm install @radix-ui/react-use-escape-keydown
```
## Usage
This is an internal utility, not intended for public usage.
@@ -0,0 +1 @@
{"version":3,"file":"delta-apply.mjs","sources":["../../../../src/projection/geometry/delta-apply.ts"],"sourcesContent":["import { Axis, Box, Delta, Point } from \"motion-utils\"\nimport { mixNumber } from \"../../utils/mix/number\"\nimport { ResolvedValues } from \"../../render/types\"\nimport { hasTransform } from \"../utils/has-transform\"\n\n/**\n * Scales a point based on a factor and an originPoint\n */\nexport function scalePoint(point: number, scale: number, originPoint: number) {\n const distanceFromOrigin = point - originPoint\n const scaled = scale * distanceFromOrigin\n return originPoint + scaled\n}\n\n/**\n * Applies a translate/scale delta to a point\n */\nexport function applyPointDelta(\n point: number,\n translate: number,\n scale: number,\n originPoint: number,\n boxScale?: number\n): number {\n if (boxScale !== undefined) {\n point = scalePoint(point, boxScale, originPoint)\n }\n\n return scalePoint(point, scale, originPoint) + translate\n}\n\n/**\n * Applies a translate/scale delta to an axis\n */\nexport function applyAxisDelta(\n axis: Axis,\n translate: number = 0,\n scale: number = 1,\n originPoint: number,\n boxScale?: number\n): void {\n axis.min = applyPointDelta(\n axis.min,\n translate,\n scale,\n originPoint,\n boxScale\n )\n\n axis.max = applyPointDelta(\n axis.max,\n translate,\n scale,\n originPoint,\n boxScale\n )\n}\n\n/**\n * Applies a translate/scale delta to a box\n */\nexport function applyBoxDelta(box: Box, { x, y }: Delta): void {\n applyAxisDelta(box.x, x.translate, x.scale, x.originPoint)\n applyAxisDelta(box.y, y.translate, y.scale, y.originPoint)\n}\n\nconst TREE_SCALE_SNAP_MIN = 0.999999999999\nconst TREE_SCALE_SNAP_MAX = 1.0000000000001\n\n/**\n * Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms\n * in a tree upon our box before then calculating how to project it into our desired viewport-relative box\n *\n * This is the final nested loop within updateLayoutDelta for future refactoring\n */\nexport function applyTreeDeltas(\n box: Box,\n treeScale: Point,\n treePath: any[],\n isSharedTransition: boolean = false\n) {\n const treeLength = treePath.length\n if (!treeLength) return\n\n // Reset the treeScale\n treeScale.x = treeScale.y = 1\n\n let node: any\n let delta: Delta | undefined\n\n for (let i = 0; i < treeLength; i++) {\n node = treePath[i]\n delta = node.projectionDelta\n\n /**\n * TODO: Prefer to remove this, but currently we have motion components with\n * display: contents in Framer.\n */\n const { visualElement } = node.options\n if (\n visualElement &&\n visualElement.props.style &&\n visualElement.props.style.display === \"contents\"\n ) {\n continue\n }\n\n if (\n isSharedTransition &&\n node.options.layoutScroll &&\n node.scroll &&\n node !== node.root\n ) {\n translateAxis(box.x, -node.scroll.offset.x)\n translateAxis(box.y, -node.scroll.offset.y)\n }\n\n if (delta) {\n // Incoporate each ancestor's scale into a cumulative treeScale for this component\n treeScale.x *= delta.x.scale\n treeScale.y *= delta.y.scale\n\n // Apply each ancestor's calculated delta into this component's recorded layout box\n applyBoxDelta(box, delta)\n }\n\n if (isSharedTransition && hasTransform(node.latestValues)) {\n transformBox(box, node.latestValues, node.layout?.layoutBox)\n }\n }\n\n /**\n * Snap tree scale back to 1 if it's within a non-perceivable threshold.\n * This will help reduce useless scales getting rendered.\n */\n if (\n treeScale.x < TREE_SCALE_SNAP_MAX &&\n treeScale.x > TREE_SCALE_SNAP_MIN\n ) {\n treeScale.x = 1.0\n }\n if (\n treeScale.y < TREE_SCALE_SNAP_MAX &&\n treeScale.y > TREE_SCALE_SNAP_MIN\n ) {\n treeScale.y = 1.0\n }\n}\n\nexport function translateAxis(axis: Axis, distance: number) {\n axis.min += distance\n axis.max += distance\n}\n\n/**\n * Apply a transform to an axis from the latest resolved motion values.\n * This function basically acts as a bridge between a flat motion value map\n * and applyAxisDelta\n */\nexport function transformAxis(\n axis: Axis,\n axisTranslate?: number,\n axisScale?: number,\n boxScale?: number,\n axisOrigin: number = 0.5\n): void {\n const originPoint = mixNumber(axis.min, axis.max, axisOrigin)\n\n // Apply the axis delta to the final axis\n applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale)\n}\n\nfunction resolveAxisTranslate(\n value: number | string | undefined,\n Line truncated
@@ -0,0 +1,20 @@
/**
* @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 FireExtinguisher = createLucideIcon("FireExtinguisher", [
["path", { d: "M15 6.5V3a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3.5", key: "sqyvz" }],
["path", { d: "M9 18h8", key: "i7pszb" }],
["path", { d: "M18 3h-3", key: "7idoqj" }],
["path", { d: "M11 3a6 6 0 0 0-6 6v11", key: "1v5je3" }],
["path", { d: "M5 13h4", key: "svpcxo" }],
["path", { d: "M17 10a4 4 0 0 0-8 0v10a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2Z", key: "vsjego" }]
]);
export { FireExtinguisher as default };
//# sourceMappingURL=fire-extinguisher.js.map
@@ -0,0 +1 @@
{"version":3,"file":"panel-top-inactive.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}