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

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

No files matched your search

@@ -0,0 +1,16 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Torus = createLucideIcon("Torus", [
["ellipse", { cx: "12", cy: "11", rx: "3", ry: "2", key: "1b2qxu" }],
["ellipse", { cx: "12", cy: "12.5", rx: "10", ry: "8.5", key: "h8emeu" }]
]);
export { Torus as default };
//# sourceMappingURL=torus.js.map
@@ -0,0 +1,149 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateProperties = exports.error = void 0;
const code_1 = require("../code");
const util_1 = require("../../compile/util");
const codegen_1 = require("../../compile/codegen");
const metadata_1 = require("./metadata");
const nullable_1 = require("./nullable");
const error_1 = require("./error");
var PropError;
(function (PropError) {
PropError["Additional"] = "additional";
PropError["Missing"] = "missing";
})(PropError || (PropError = {}));
exports.error = {
message: (cxt) => {
const { params } = cxt;
return params.propError
? params.propError === PropError.Additional
? "must NOT have additional properties"
: `must have property '${params.missingProperty}'`
: (0, error_1.typeErrorMessage)(cxt, "object");
},
params: (cxt) => {
const { params } = cxt;
return params.propError
? params.propError === PropError.Additional
? (0, codegen_1._) `{error: ${params.propError}, additionalProperty: ${params.additionalProperty}}`
: (0, codegen_1._) `{error: ${params.propError}, missingProperty: ${params.missingProperty}}`
: (0, error_1.typeErrorParams)(cxt, "object");
},
};
const def = {
keyword: "properties",
schemaType: "object",
error: exports.error,
code: validateProperties,
};
// const error: KeywordErrorDefinition = {
// message: "should NOT have additional properties",
// params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`,
// }
function validateProperties(cxt) {
(0, metadata_1.checkMetadata)(cxt);
const { gen, data, parentSchema, it } = cxt;
const { additionalProperties, nullable } = parentSchema;
if (it.jtdDiscriminator && nullable)
throw new Error("JTD: nullable inside discriminator mapping");
if (commonProperties()) {
throw new Error("JTD: properties and optionalProperties have common members");
}
const [allProps, properties] = schemaProperties("properties");
const [allOptProps, optProperties] = schemaProperties("optionalProperties");
if (properties.length === 0 && optProperties.length === 0 && additionalProperties) {
return;
}
const [valid, cond] = it.jtdDiscriminator === undefined
? (0, nullable_1.checkNullableObject)(cxt, data)
: [gen.let("valid", false), true];
gen.if(cond, () => gen.assign(valid, true).block(() => {
validateProps(properties, "properties", true);
validateProps(optProperties, "optionalProperties");
if (!additionalProperties)
validateAdditional();
}));
cxt.pass(valid);
function commonProperties() {
const props = parentSchema.properties;
const optProps = parentSchema.optionalProperties;
if (!(props && optProps))
return false;
for (const p in props) {
if (Object.prototype.hasOwnProperty.call(optProps, p))
return true;
}
return false;
}
function schemaProperties(keyword) {
const schema = parentSchema[keyword];
const allPs = schema ? (0, code_1.allSchemaProperties)(schema) : [];
if (it.jtdDiscriminator && allPs.some((p) => p === it.jtdDiscriminator)) {
throw new Error(`JTD: discriminator tag used in ${keyword}`);
}
const ps = allPs.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p]));
return [allPs, ps];
}
function validateProps(props, keyword, required) {
const _valid = gen.var("valid");
for (const prop of props) {
gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => applyPropertySchema(prop, keyword, _valid), () => missingProperty(prop));
cxt.ok(_valid);
}
function missingProperty(prop) {
if (required) {
gen.assign(_valid, false);
cxt.error(false, { propError: PropError.Missing, missingProperty: prop }, { schemaPath: prop });
}
else {
gen.assign(_valid, true);
}
}
}
function applyPropertySchema(prop, keyword, _valid) {
cxt.subschema({
keyword,
schemaProp: prop,
dataProp: prop,
}, _valid);
}
function validateAdditional() {
gen.forIn("key", data, (key) => {
const addProp = isAdditional(key, allProps, "properties", it.jtdDiscriminator);
const addOptProp = isAdditional(key, allOptProps, "optionalProperties");
const extra = addProp === true ? addOptProp : addOptProp === true ? addProp : (0, codegen_1.and)(addProp, addOptProp);
gen.if(extra, () => {
if (it.opts.removeAdditional) {
gen.code((0, codegen_1._) `delete ${data}[${key}]`);
}
else {
cxt.error(false, { propError: PropError.Additional, additionalProperty: key }, { instancePath: key, parentSchema: true });
if (!it.opts.allErrors)
gen.break();
}
});
});
}
function isAdditional(key, props, keyword, jtdDiscriminator) {
let additional;
if (props.length > 8) {
// TODO maybe an option instead of hard-coded 8?
const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema[keyword], keyword);
additional = (0, codegen_1.not)((0, code_1.isOwnProperty)(gen, propsSchema, key));
if (jtdDiscriminator !== undefined) {
additional = (0, codegen_1.and)(additional, (0, codegen_1._) `${key} !== ${jtdDiscriminator}`);
}
}
else if (props.length || jtdDiscriminator !== undefined) {
const ps = jtdDiscriminator === undefined ? props : [jtdDiscriminator].concat(props);
additional = (0, codegen_1.and)(...ps.map((p) => (0, codegen_1._) `${key} !== ${p}`));
}
else {
additional = true;
}
return additional;
}
}
exports.validateProperties = validateProperties;
exports.default = def;
//# sourceMappingURL=properties.js.map
@@ -0,0 +1 @@
{"version":3,"file":"layout-list.js","sources":["../../../src/icons/layout-list.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name LayoutList\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSI3IiB4PSIzIiB5PSIzIiByeD0iMSIgLz4KICA8cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSI3IiB4PSIzIiB5PSIxNCIgcng9IjEiIC8+CiAgPHBhdGggZD0iTTE0IDRoNyIgLz4KICA8cGF0aCBkPSJNMTQgOWg3IiAvPgogIDxwYXRoIGQ9Ik0xNCAxNWg3IiAvPgogIDxwYXRoIGQ9Ik0xNCAyMGg3IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/layout-list\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 LayoutList = createLucideIcon('LayoutList', [\n ['rect', { width: '7', height: '7', x: '3', y: '3', rx: '1', key: '1g98yp' }],\n ['rect', { width: '7', height: '7', x: '3', y: '14', rx: '1', key: '1bb6yr' }],\n ['path', { d: 'M14 4h7', key: '3xa0d5' }],\n ['path', { d: 'M14 9h7', key: '1icrd9' }],\n ['path', { d: 'M14 15h7', key: '1mj8o2' }],\n ['path', { d: 'M14 20h7', key: '11slyb' }],\n]);\n\nexport default LayoutList;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,iBAAiB,YAAc,CAAA,CAAA,CAAA;AAAA,CAAA,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,KAAK,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAC5E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,KAAK,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC7E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,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,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,57 @@
import Benchmark from "benchmark";
const suite = new Benchmark.Suite("ipv4");
const DATA = "127.0.0.1";
const ipv4RegexA =
/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
const ipv4RegexB =
/^(?:(?:(?=(25[0-5]))\1|(?=(2[0-4][0-9]))\2|(?=(1[0-9]{2}))\3|(?=([0-9]{1,2}))\4)\.){3}(?:(?=(25[0-5]))\5|(?=(2[0-4][0-9]))\6|(?=(1[0-9]{2}))\7|(?=([0-9]{1,2}))\8)$/;
const ipv4RegexC = /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;
const ipv4RegexD = /^(\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/;
const ipv4RegexE = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.){3}(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)$/;
const ipv4RegexF = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/;
const ipv4RegexG = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/;
const ipv4RegexH = /^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])(\.(?!$)|$)){4}$/;
const ipv4RegexI =
/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
suite
.add("A", () => {
return ipv4RegexA.test(DATA);
})
.add("B", () => {
return ipv4RegexB.test(DATA);
})
.add("C", () => {
return ipv4RegexC.test(DATA);
})
.add("D", () => {
return ipv4RegexD.test(DATA);
})
.add("E", () => {
return ipv4RegexE.test(DATA);
})
.add("F", () => {
return ipv4RegexF.test(DATA);
})
.add("G", () => {
return ipv4RegexG.test(DATA);
})
.add("H", () => {
return ipv4RegexH.test(DATA);
})
.add("I", () => {
return ipv4RegexI.test(DATA);
})
.on("cycle", (e: Benchmark.Event) => {
console.log(`${suite.name!}: ${e.target}`);
});
export default {
suites: [suite],
};
if (require.main === module) {
suite.run();
}
@@ -0,0 +1 @@
{"version":3,"file":"types-mS0yxCL0.d.mts","names":["draft","$schema","MaybeReadonlyArray","T","Array","ReadonlyArray","ValueOf","JSONSchema","Value","SchemaType","Record","TypeValue","TypeName","Exclude","Interface","KeywordByType","Any","Pick","Number","Object","String","ContentEncoding","Format","keywords"],"sources":["../../../node_modules/.pnpm/json-schema-typed@8.0.2/node_modules/json-schema-typed/draft_2020_12.d.ts","../../core-internal/src/validators/types.ts"],"sourcesContent":["export declare const draft: \"2020-12\";\r\nexport declare const $schema: \"https://json-schema.org/draft/2020-12/schema\";\r\ntype MaybeReadonlyArray<T> = Array<T> | ReadonlyArray<T>;\r\ntype ValueOf<T> = T[keyof T];\r\n/**\r\n * JSON Schema [Draft 2020-12](https://json-schema.org/draft/2020-12/json-schema-validation.html)\r\n */\r\nexport type JSONSchema<Value = any, SchemaType = Value extends boolean ? \"boolean\" : Value extends null ? \"null\" : Value extends number ? \"number\" | \"integer\" : Value extends string ? \"string\" : Value extends unknown[] ? \"array\" : Value extends Record<string | number, unknown> ? \"object\" : JSONSchema.TypeValue> = boolean | {\r\n /**\r\n * Using JSON Pointer fragments requires knowledge of the structure of the\r\n * schema. When writing schema documents with the intention to provide\r\n * re-usable schemas, it may be preferable to use a plain name fragment\r\n * that is not tied to any particular structural location. This allows a\r\n * subschema to be relocated without requiring JSON Pointer references to\r\n * be updated.\r\n *\r\n * The `$anchor` keyword is used to specify such a fragment. It is an\r\n * identifier keyword that can only be used to create plain name fragments.\r\n *\r\n * If present, the value of this keyword MUST be a string, which MUST start\r\n * with a letter `[A-Za-z]`, followed by any number of letters, digits\r\n * `[0-9]`, hyphens `-`, underscores `_`, colons `:`,\r\n * or periods `.`.\r\n *\r\n * Note that the anchor string does not include the `#` character,\r\n * as it is not a URI-reference. An `{\"$anchor\": \"foo\"}` becomes the\r\n * fragment `#foo` when used in a URI.\r\n *\r\n * The base URI to which the resulting fragment is appended is determined\r\n * by the `$id` keyword as explained in the previous section.\r\n * Two `$anchor` keywords in the same schema document MAY have the same\r\n * value if they apply to different base URIs, as the resulting full URIs\r\n * will be distinct. However, the effect of two `$anchor` keywords\r\n * with the same value and the same base URI is undefined. Implementations\r\n * MAY raise an error if such usage is detected.\r\n */\r\n $anchor?: string;\r\n /**\r\n * This keyword reserves a location for comments from schema authors to\r\n * readers or maintainers of the schema.\r\n *\r\n * The value of this keyword MUST be a string. Implementations MUST NOT\r\n * present this string to end users. Tools for editing schemas SHOULD\r\n * support displaying and editing this keyword. The value of this keyword\r\n * MAY be used in debug or error output which is intended for developers\r\n * making use of schemas.\r\n *\r\n * Schema vocabularies SHOULD allow `$comment` within any object\r\n * containing vocabulary keywords. Implementations MAY assume `$comment`\r\n * is allowed unless the vocabulary specifically forbids it. Vocabularies\r\n * MUST NOT specify any effect of `$comment` beyond what is described in\r\n * this specification.\r\n *\r\n * Tools that translate other media types or programming languages\r\n * to and from `application/schema+json` MAY choose to convert that media\r\n * type or programming language's native comments to or from `$comment`\r\n * values. The behavior of such translation when both native comments and\r\n * `$comment` properties are present is implementation-dependent.\r\n *\r\n * Implementations MAY strip `$comment` values at any point during\r\n * processing. In particular, this allows for shortening schemas when the\r\n * size of deployed schemas is a concern.\r\n *\r\n * Implementations MUST NOT take any other action based on the presence,\r\n * absence, or contents of `$comment` properties. In particular, the\r\n * value of `$comment` MUST NOT be collected as an annotation result.\r\n */\r\n $comment?: string;\r\n /**\r\n * The `$defs` keyword reserves a location for schema authors to inline\r\n * re-usable JSON Schemas into a more general schema. The keyword does not\r\n * directly affect the validation result.\r\n *\r\n * This keyword's value MUST be an object. Each member value of this object\r\n * MUST be a valid JSON Schema.\r\n */\r\n $defs?: Record<string, JSONSchema>;\r\n /**\r\n * \"The `$dLine truncated
@@ -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-parking-off.js';
//# sourceMappingURL=parking-circle-off.js.map
@@ -0,0 +1,17 @@
import { S as SnapshotEnvironment, a as SnapshotEnvironmentOptions } from './environment.d-DOJxxZV9.js';
import '@vitest/utils';
declare class NodeSnapshotEnvironment implements SnapshotEnvironment {
private options;
constructor(options?: SnapshotEnvironmentOptions);
getVersion(): string;
getHeader(): string;
resolveRawPath(testPath: string, rawPath: string): Promise<string>;
resolvePath(filepath: string): Promise<string>;
prepareDirectory(dirPath: string): Promise<void>;
saveSnapshotFile(filepath: string, snapshot: string): Promise<void>;
readSnapshotFile(filepath: string): Promise<string | null>;
removeSnapshotFile(filepath: string): Promise<void>;
}
export { NodeSnapshotEnvironment, SnapshotEnvironment };
@@ -0,0 +1,23 @@
/**
* Check if the value is what you want
*
* 校验是否是想要的类型
*
* @example
* ```js
* import { isWhat } from 'is-what-type';
*
* const value: string | number | boolean | null | undefined | symbol | bigint = null;
const whatType = typeof value;
if (isWhat<object>(value, whatType, 'object')) {
Object.keys(value); // Throws TypeError: Cannot convert undefined or null to object
}
* ```
*
* @param value - The value to check
* @param type - The type of the value
* @param comparingType - The type to compare with
* @returns
*/
export declare function isWhat<T = unknown>(value: unknown, type: unknown, comparingType: unknown): value is T;
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const SquareSplitHorizontal = createLucideIcon("SquareSplitHorizontal", [
["path", { d: "M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3", key: "lubmu8" }],
["path", { d: "M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3", key: "1ag34g" }],
["line", { x1: "12", x2: "12", y1: "4", y2: "20", key: "1tx1rr" }]
]);
export { SquareSplitHorizontal as default };
//# sourceMappingURL=square-split-horizontal.js.map
@@ -0,0 +1 @@
{"version":3,"names":["_index","require","_isLet","isBlockScoped","node","isFunctionDeclaration","isClassDeclaration","isLet"],"sources":["../../src/validators/isBlockScoped.ts"],"sourcesContent":["import {\n isClassDeclaration,\n isFunctionDeclaration,\n} from \"./generated/index.ts\";\nimport isLet from \"./isLet.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * Check if the input `node` is block scoped.\n */\nexport default function isBlockScoped(\n node: t.Node | null | undefined,\n): boolean {\n return isFunctionDeclaration(node) || isClassDeclaration(node) || isLet(node);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAMe,SAASE,aAAaA,CACnCC,IAA+B,EACtB;EACT,OAAO,IAAAC,4BAAqB,EAACD,IAAI,CAAC,IAAI,IAAAE,yBAAkB,EAACF,IAAI,CAAC,IAAI,IAAAG,cAAK,EAACH,IAAI,CAAC;AAC/E","ignoreList":[]}
@@ -0,0 +1,19 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const ListTree = createLucideIcon("ListTree", [
["path", { d: "M21 12h-8", key: "1bmf0i" }],
["path", { d: "M21 6H8", key: "1pqkrb" }],
["path", { d: "M21 18h-8", key: "1tm79t" }],
["path", { d: "M3 6v4c0 1.1.9 2 2 2h3", key: "1ywdgy" }],
["path", { d: "M3 10v6c0 1.1.9 2 2 2h3", key: "2wc746" }]
]);
export { ListTree as default };
//# sourceMappingURL=list-tree.js.map
@@ -0,0 +1,27 @@
/**
* Check if the value is a number
*
* 校验是否是一个数字
*
* @example
* ```js
* import { isNumber } from 'is-what-type';
*
* isNumber(1); // true
* isNumber(0); // true
* isNumber(-1); // true
* isNumber(3.14); // true
* isNumber(NaN); // false
* isNumber(Infinity); // true
* isNumber(-Infinity); // true
* isNumber({}); // false
* isNumber('1'); // false
* isNumber(null); // false
* isNumber(undefined); // false
* isNumber(function() {}); // false
* ```
*
* @param value - The value to check
* @returns `true` if the value is a number, `false` otherwise
*/
export declare function isNumber(value: unknown): value is number;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_3H","2":"_I","1028":"_CQ","1540":"_mG W"},C:{"1":"_tO","2":"GD","164":"fC _aD _L","1540":"_aC _hC _DD"},D:{"1":"_2H","292":"_BR","1028":"_CQ","1540":"_dK _ZL W"},E:{"1":"_dE","292":"_VD","1540":"_CC _DE","3076":"SD"},F:{"1":"_aJ","2":"_T","292":"_lD _SE","1028":"_DG","1540":"DC _eM GC _kE"},G:{"1":"_cE","292":"_ND","1540":"_pI","3076":"vD"},H:{"2":"1D"},I:{"1":"I","292":"_G"},J:{"292":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_rF","292":"_OD","1540":"_8Q"},Q:{"1540":"JE"},R:{"1":"KE"},S:{"1":"ME","1540":"LE"}},B:5,C:"CSS Logical Properties",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"tsrScript.js","names":[],"sources":["../../../src/ssr/tsrScript.ts?script-string"],"sourcesContent":["self.$_TSR = {\n h() {\n this.hydrated = true\n this.c()\n },\n e() {\n this.streamEnded = true\n this.c()\n },\n c() {\n if (this.hydrated && this.streamEnded) {\n delete self.$_TSR\n delete self.$R['tsr']\n }\n },\n p(script) {\n !this.initialized ? this.buffer.push(script) : script()\n },\n buffer: [],\n}\n"],"mappings":";AAAA,IAAA,oBAAa"}
@@ -0,0 +1 @@
{"version":3,"file":"l33t.cjs","sources":["../../../../../src/matcher/dictionary/variants/scoring/l33t.ts"],"sourcesContent":[null],"names":["countSubstring","string","substring","count","pos","indexOf","length","getCounts","sub","token","tokenLower","toLowerCase","subbedCount","substitution","unsubbedCount","letter","l33t","subs","variations","forEach","p","Math","min","possibilities","i","utils","nCk"],"mappings":";;;;AAcA,MAAMA,cAAc,GAAGA,CAACC,MAAc,EAAEC,SAAiB,KAAI;EAC3D,IAAIC,KAAK,GAAG,CAAC;AACb,EAAA,IAAIC,GAAG,GAAGH,MAAM,CAACI,OAAO,CAACH,SAAS,CAAC;EACnC,OAAOE,GAAG,IAAI,CAAC,EAAE;AACfD,IAAAA,KAAK,IAAI,CAAC;AACVC,IAAAA,GAAG,GAAGH,MAAM,CAACI,OAAO,CAACH,SAAS,EAAEE,GAAG,GAAGF,SAAS,CAACI,MAAM,CAAC;AACzD,EAAA;AACA,EAAA,OAAOH,KAAK;AACd,CAAC;AAED,MAAMI,SAAS,GAAGA,CAAC;EAAEC,GAAG;AAAEC,EAAAA;AAAK,CAAoB,KAAI;AACrD;AACA,EAAA,MAAMC,UAAU,GAAGD,KAAK,CAACE,WAAW,EAAE;AACtC;EACA,MAAMC,WAAW,GAAGZ,cAAc,CAACU,UAAU,EAAEF,GAAG,CAACK,YAAY,CAAC;AAEhE;EACA,MAAMC,aAAa,GAAGd,cAAc,CAACU,UAAU,EAAEF,GAAG,CAACO,MAAM,CAAC;EAC5D,OAAO;IACLH,WAAW;AACXE,IAAAA;GACD;AACH,CAAC;AAED,kBAAe,CAAC;EAAEE,IAAI;EAAEC,IAAI;AAAER,EAAAA;AAAK,CAAe,KAAI;EACpD,IAAI,CAACO,IAAI,EAAE;AACT,IAAA,OAAO,CAAC;AACV,EAAA;EACA,IAAIE,UAAU,GAAG,CAAC;AAClBD,EAAAA,IAAI,CAACE,OAAO,CAAEX,GAAG,IAAI;IACnB,MAAM;MAAEI,WAAW;AAAEE,MAAAA;KAAe,GAAGP,SAAS,CAAC;MAAEC,GAAG;AAAEC,MAAAA;AAAK,KAAE,CAAC;AAEhE,IAAA,IAAIG,WAAW,KAAK,CAAC,IAAIE,aAAa,KAAK,CAAC,EAAE;AAC5C;AACA;AACA;AACAI,MAAAA,UAAU,IAAI,CAAC;AACjB,IAAA,CAAC,MAAM;AACL;AACA;MACA,MAAME,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACR,aAAa,EAAEF,WAAW,CAAC;MAC9C,IAAIW,aAAa,GAAG,CAAC;AACrB,MAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAIJ,CAAC,EAAEI,CAAC,IAAI,CAAC,EAAE;QAC9BD,aAAa,IAAIE,KAAK,CAACC,GAAG,CAACZ,aAAa,GAAGF,WAAW,EAAEY,CAAC,CAAC;AAC5D,MAAA;AACAN,MAAAA,UAAU,IAAIK,aAAa;AAC7B,IAAA;AACF,EAAA,CAAC,CAAC;AACF,EAAA,OAAOL,UAAU;AACnB,CAAC;;;;"}
@@ -0,0 +1,131 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLAttribute = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.DecodingMode = exports.EntityDecoder = exports.encodeHTML5 = exports.encodeHTML4 = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.escapeText = exports.escapeAttribute = exports.escapeUTF8 = exports.encodeXML = exports.EncodingMode = exports.EntityLevel = void 0;
exports.decode = decode;
exports.decodeStrict = decodeStrict;
exports.encode = encode;
const decode_js_1 = require("./decode.js");
const encode_js_1 = require("./encode.js");
const escape_js_1 = require("./escape.js");
/** The level of entities to support. */
var EntityLevel;
(function (EntityLevel) {
/** Support only XML entities. */
EntityLevel[EntityLevel["XML"] = 0] = "XML";
/** Support HTML entities, which are a superset of XML entities. */
EntityLevel[EntityLevel["HTML"] = 1] = "HTML";
})(EntityLevel || (exports.EntityLevel = EntityLevel = {}));
var EncodingMode;
(function (EncodingMode) {
/**
* The output is UTF-8 encoded. Only characters that need escaping within
* XML will be escaped.
*/
EncodingMode[EncodingMode["UTF8"] = 0] = "UTF8";
/**
* The output consists only of ASCII characters. Characters that need
* escaping within HTML, and characters that aren't ASCII characters will
* be escaped.
*/
EncodingMode[EncodingMode["ASCII"] = 1] = "ASCII";
/**
* Encode all characters that have an equivalent entity, as well as all
* characters that are not ASCII characters.
*/
EncodingMode[EncodingMode["Extensive"] = 2] = "Extensive";
/**
* Encode all characters that have to be escaped in HTML attributes,
* following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.
*/
EncodingMode[EncodingMode["Attribute"] = 3] = "Attribute";
/**
* Encode all characters that have to be escaped in HTML text,
* following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.
*/
EncodingMode[EncodingMode["Text"] = 4] = "Text";
})(EncodingMode || (exports.EncodingMode = EncodingMode = {}));
/**
* Decodes a string with entities.
*
* @param input String to decode.
* @param options Decoding options.
*/
function decode(input, options = EntityLevel.XML) {
const level = typeof options === "number" ? options : options.level;
if (level === EntityLevel.HTML) {
const mode = typeof options === "object" ? options.mode : undefined;
return (0, decode_js_1.decodeHTML)(input, mode);
}
return (0, decode_js_1.decodeXML)(input);
}
/**
* Decodes a string with entities. Does not allow missing trailing semicolons for entities.
*
* @param input String to decode.
* @param options Decoding options.
* @deprecated Use `decode` with the `mode` set to `Strict`.
*/
function decodeStrict(input, options = EntityLevel.XML) {
var _a;
const normalizedOptions = typeof options === "number" ? { level: options } : options;
(_a = normalizedOptions.mode) !== null && _a !== void 0 ? _a : (normalizedOptions.mode = decode_js_1.DecodingMode.Strict);
return decode(input, normalizedOptions);
}
/**
* Encodes a string with entities.
*
* @param input String to encode.
* @param options Encoding options.
*/
function encode(input, options = EntityLevel.XML) {
const { mode = EncodingMode.Extensive, level = EntityLevel.XML } = typeof options === "number" ? { level: options } : options;
switch (mode) {
case EncodingMode.UTF8: {
return (0, escape_js_1.escapeUTF8)(input);
}
case EncodingMode.Attribute: {
return (0, escape_js_1.escapeAttribute)(input);
}
case EncodingMode.Text: {
return (0, escape_js_1.escapeText)(input);
}
case EncodingMode.ASCII: {
return level === EntityLevel.HTML
? (0, encode_js_1.encodeNonAsciiHTML)(input)
: (0, escape_js_1.encodeXML)(input);
}
// eslint-disable-next-line unicorn/no-useless-switch-case
case EncodingMode.Extensive:
default: {
return level === EntityLevel.HTML
? (0, encode_js_1.encodeHTML)(input)
: (0, escape_js_1.encodeXML)(input);
}
}
}
var escape_js_2 = require("./escape.js");
Object.defineProperty(exports, "encodeXML", { enumerable: true, get: function () { return escape_js_2.encodeXML; } });
Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return escape_js_2.escape; } });
Object.defineProperty(exports, "escapeUTF8", { enumerable: true, get: function () { return escape_js_2.escapeUTF8; } });
Object.defineProperty(exports, "escapeAttribute", { enumerable: true, get: function () { return escape_js_2.escapeAttribute; } });
Object.defineProperty(exports, "escapeText", { enumerable: true, get: function () { return escape_js_2.escapeText; } });
var encode_js_2 = require("./encode.js");
Object.defineProperty(exports, "encodeHTML", { enumerable: true, get: function () { return encode_js_2.encodeHTML; } });
Object.defineProperty(exports, "encodeNonAsciiHTML", { enumerable: true, get: function () { return encode_js_2.encodeNonAsciiHTML; } });
// Legacy aliases (deprecated)
Object.defineProperty(exports, "encodeHTML4", { enumerable: true, get: function () { return encode_js_2.encodeHTML; } });
Object.defineProperty(exports, "encodeHTML5", { enumerable: true, get: function () { return encode_js_2.encodeHTML; } });
var decode_js_2 = require("./decode.js");
Object.defineProperty(exports, "EntityDecoder", { enumerable: true, get: function () { return decode_js_2.EntityDecoder; } });
Object.defineProperty(exports, "DecodingMode", { enumerable: true, get: function () { return decode_js_2.DecodingMode; } });
Object.defineProperty(exports, "decodeXML", { enumerable: true, get: function () { return decode_js_2.decodeXML; } });
Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return decode_js_2.decodeHTML; } });
Object.defineProperty(exports, "decodeHTMLStrict", { enumerable: true, get: function () { return decode_js_2.decodeHTMLStrict; } });
Object.defineProperty(exports, "decodeHTMLAttribute", { enumerable: true, get: function () { return decode_js_2.decodeHTMLAttribute; } });
// Legacy aliases (deprecated)
Object.defineProperty(exports, "decodeHTML4", { enumerable: true, get: function () { return decode_js_2.decodeHTML; } });
Object.defineProperty(exports, "decodeHTML5", { enumerable: true, get: function () { return decode_js_2.decodeHTML; } });
Object.defineProperty(exports, "decodeHTML4Strict", { enumerable: true, get: function () { return decode_js_2.decodeHTMLStrict; } });
Object.defineProperty(exports, "decodeHTML5Strict", { enumerable: true, get: function () { return decode_js_2.decodeHTMLStrict; } });
Object.defineProperty(exports, "decodeXMLStrict", { enumerable: true, get: function () { return decode_js_2.decodeXML; } });
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"useRouteContext.cjs","names":[],"sources":["../../src/useRouteContext.ts"],"sourcesContent":["import { useMatch } from './useMatch'\nimport type {\n AnyRouter,\n RegisteredRouter,\n UseRouteContextBaseOptions,\n UseRouteContextOptions,\n UseRouteContextResult,\n} from '@tanstack/router-core'\n\nexport type UseRouteContextRoute<out TFrom> = <\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseRouteContextBaseOptions<TRouter, TFrom, true, TSelected>,\n) => UseRouteContextResult<TRouter, TFrom, true, TSelected>\n\nexport function useRouteContext<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string | undefined = undefined,\n TStrict extends boolean = true,\n TSelected = unknown,\n>(\n opts: UseRouteContextOptions<TRouter, TFrom, TStrict, TSelected>,\n): UseRouteContextResult<TRouter, TFrom, TStrict, TSelected> {\n return useMatch({\n ...(opts as any),\n select: (match) =>\n opts.select ? opts.select(match.context) : match.context,\n }) as UseRouteContextResult<TRouter, TFrom, TStrict, TSelected>\n}\n"],"mappings":";;AAgBA,SAAgB,gBAMd,MAC2D;AAC3D,QAAO,iBAAA,SAAS;EACd,GAAI;EACJ,SAAS,UACP,KAAK,SAAS,KAAK,OAAO,MAAM,QAAQ,GAAG,MAAM;EACpD,CAAC"}
@@ -0,0 +1,810 @@
import { $ as isJsonContentType, $a as checkResourceAllowed, $i as SetLevelRequestParams, $n as HandlerResultTypeMap, $r as NotificationMethod, $t as InboundModernRoute, A as RegisteredResource, Aa as UnsubscribeRequestParams, Ai as Resource, An as CreateMessageResult, Ar as ListPromptsResult, At as isJSONRPCResultResponse, B as requireScopes, Ba as INVALID_REQUEST, Bi as ResultMetaObject, Bn as ElicitResult, Br as ListToolsResult, Bt as InputResponseView, C as ListResourcesCallback, Ca as ToolAnnotations, Ci as RequestId, Cn as CompleteRequestResourceTemplate, Cr as JSONRPCResultResponse, Ct as isInitializeRequest, D as ReadResourceCallback, Da as ToolResultContent, Di as RequestMethod, Dn as CreateMessageRequestParams, Dr as ListChangedHandlers, Dt as isJSONRPCNotification, E as PromptCallback, Ea as ToolListChangedNotification, Ei as RequestMetaObject, En as CreateMessageRequest, Er as ListChangedCallback, Et as isJSONRPCErrorResponse, F as ToolCallback, Fa as CLIENT_CAPABILITIES_META_KEY, Fi as ResourceTemplateReference, Fn as DiscoverResult, Fr as ListRootsRequest, Ft as ResourceNotFoundError, G as ReadBuffer, Ga as PARSE_ERROR, Gi as SamplingContent, Gn as EnumSchema, Gr as MessageExtraInfo, Gt as StandardSchemaV1, H as InMemoryTransport, Ha as LATEST_PROTOCOL_VERSION, Hi as Role, Hn as ElicitationCompleteNotificationParams, Hr as LoggingMessageNotification, Ht as inputRequired, I as Server, Ia as CLIENT_INFO_META_KEY, Ii as ResourceTemplateType, In as ElicitRequest, Ir as ListRootsResult, It as UnsupportedProtocolVersionError, J as serializeMessage, Ja as SERVER_INFO_META_KEY, Ji as ServerCapabilities, Jn as GetPromptResult, Jr as MissingRequiredClientCapabilityErrorData, Jt as InboundClassificationOutcome, K as STDIO_DEFAULT_MAX_BUFFER_SIZE, Ka as PROTOCOL_VERSION_META_KEY, Ki as SamplingMessage, Kn as GetPromptRequest, Kr as MetaObject, Kt as StandardSchemaV1Sync, L as ServerOptions, La as DEFAULT_NEGOTIATED_PROTOCOL_VERSION, Li as ResourceUpdatedNotification, Ln as ElicitRequestFormParams, Lr as ListTasksRequest, Lt as UrlElicitationRequiredError, M as RegisteredTool, Ma as UntitledMultiSelectEnumSchema, Mi as ResourceLink, Mn as CreateTaskResult, Mr as ListResourceTemplatesResult, Mt as parseJSONRPCMessage, N as ResourceMetadata, Na as UntitledSingleSelectEnumSchema, Ni as ResourceListChangedNotification, Nn as Cursor, Nr as ListResourcesRequest, Nt as MissingRequiredClientCapabilityError, O as ReadResourceTemplateCallback, Oa as ToolUseContent, Oi as RequestParams, On as CreateMessageRequestParamsBase, Or as ListChangedOptions, Ot as isJSONRPCRequest, P as ResourceTemplate, Pa as BAGGAGE_META_KEY, Pi as ResourceRequestParams, Pn as DiscoverRequest, Pr as ListResourcesResult, Pt as ProtocolError, Q as getDisplayName, Qa as TRACESTATE_META_KEY, Qi as SetLevelRequest, Qn as GetTaskResult, Qr as Notification, Qt as InboundLegacyRouteReason, R as ScopeChallenge, Ra as INTERNAL_ERROR, Ri as ResourceUpdatedNotificationParams, Rn as ElicitRequestParams, Rr as ListTasksResult, Rt as ProtocolErrorCode, S as CompleteResourceTemplateCallback, Sa as Tool, Si as Request$1, Sn as CompleteRequestPrompt, So as StoredOAuthTokens, Sr as JSONRPCResponse, St as isCallToolResult, T as McpServerOptions, Ta as ToolExecution, Ti as RequestMetaEnvelope, Tn as ContentBlock, Tr as LegacyTitledEnumSchema, Tt as isInputRequiredResult, U as UriTemplate, Ua as LOG_LEVEL_META_KEY, Ui as Root, Un as EmbeddedResource, Ur as LoggingMessageNotificationParams, Ut as inputResponse, V as preloadSchemas, Va as JSONRPC_VERSION, Vi as ResultTypeMap, Vn as ElicitationCompleteNotification, Vr as LoggingLevel, Vt as acceptedContent, W as Variables, Wa as METHOD_NOT_FOUND, Wi as RootsListChangedNotification, Wn as EmptyResult, Wr as MessageClassification, Wt as ElicitInputParams, X as CacheScope, Xa as SUPPORTED_PROTOCOL_VERSIONS, Xi as ServerRequest, Xn as GetTaskPayloadResult, Xr as ModelPreferences, Xt as InboundLadderRejection, Y as CacheHint, Ya as SUBSCRIPTION_ID_META_KEY, Yi as ServerNotification, Yn as GetTaskPayloadRequest, Yr as ModelHint, Yt as InboundHttpRequest, Z as ProtocolEra, Za as TRACEPARENT_META_KEY, Zi as ServerResult, Zn as GetTaskRequest, Zr as MultiSelectEnumSchema, Zt as InboundLegacyRoute, _ as PerRequestHTTPServerTransportOptions, _a as TaskStatusNotificationParams, _i as PromptReference, _n as ClientRequest, _o as OAuthTokenRevocationRequest, _r as JSONObject, _t as SpecTypes, a as McpHandlerRequestOptions, aa as SubscriptionsAcknowledgedNotification, ai as PaginatedResult, an as BaseMetadata, ao as OAuthError, ar as InitializeRequestParams, at as Protocol, b as AnyToolHandler, ba as TitledMultiSelectEnumSchema, bi as ReadResourceResult, bn as CompleteRequest, bo as OpenIdProviderMetadata, br as JSONRPCNotification, bt as assertCompleteRequestPrompt, c as McpServerFactory, ca as SubscriptionsListenRequestParams, ci as PrimitiveSchemaDefinition, cn as CallToolRequest, co as IdJagTokenExchangeResponse, cr as InputRLine truncated
import { i as jsonSchemaValidator, n as JsonSchemaValidator, r as JsonSchemaValidatorResult, t as JsonSchemaType } from "./types-DsbMXNFL.cjs";
//#region src/server/completable.d.ts
declare const COMPLETABLE_SYMBOL: unique symbol;
type CompleteCallback<T extends StandardSchemaV1 = StandardSchemaV1> = (value: StandardSchemaV1.InferInput<T>, context?: {
arguments?: Record<string, string>;
}) => StandardSchemaV1.InferInput<T>[] | Promise<StandardSchemaV1.InferInput<T>[]>;
type CompletableMeta<T extends StandardSchemaV1 = StandardSchemaV1> = {
complete: CompleteCallback<T>;
};
type CompletableSchema<T extends StandardSchemaV1> = T & {
[COMPLETABLE_SYMBOL]: CompletableMeta<T>;
};
/**
* Wraps a schema to provide autocompletion capabilities. Useful for, e.g., prompt arguments in MCP.
*
* @example
* ```ts source="./completable.examples.ts#completable_basicUsage"
* server.registerPrompt(
* 'review-code',
* {
* title: 'Code Review',
* argsSchema: z.object({
* language: completable(z.string().describe('Programming language'), value =>
* ['typescript', 'javascript', 'python', 'rust', 'go'].filter(lang => lang.startsWith(value))
* )
* })
* },
* ({ language }) => ({
* messages: [
* {
* role: 'user' as const,
* content: {
* type: 'text' as const,
* text: `Review this ${language} code.`
* }
* }
* ]
* })
* );
* ```
*
* @see {@linkcode server/mcp.McpServer.registerPrompt | McpServer.registerPrompt} for using completable schemas in prompt argument definitions
*/
declare function completable<T extends StandardSchemaV1>(schema: T, complete: CompleteCallback<T>): CompletableSchema<T>;
/**
* Checks if a schema is completable (has completion metadata).
*/
declare function isCompletable(schema: unknown): schema is CompletableSchema<StandardSchemaV1>;
//#endregion
//#region src/server/middleware/bearerAuth.d.ts
/**
* Minimal token-verifier interface for MCP servers acting as an OAuth 2.0
* Resource Server. Implementations introspect or locally validate an access
* token and return the resulting {@link AuthInfo}, which the serving entry
* surfaces to MCP request handlers via `ctx.http.authInfo`.
*
* This is intentionally narrower than a full OAuth Authorization Server
* provider — it only covers the verification step a Resource Server needs.
*/
interface OAuthTokenVerifier {
/**
* Verifies an access token and returns information about it.
*
* Implementations should throw an {@link OAuthError} with
* `OAuthErrorCode.InvalidToken` when the token is unknown, revoked, or
* otherwise invalid; the bearer-auth helpers map that to a `401` with a
* `WWW-Authenticate` challenge.
*
* Note: bearer-auth verification rejects tokens whose
* `AuthInfo.expiresAt` is unset (matches v1 behavior). Ensure your
* verifier populates it (e.g. from RFC 7662 introspection `exp` or the
* JWT `exp` claim).
*/
verifyAccessToken(token: string): Promise<AuthInfo>;
}
/**
* Options for {@link verifyBearerToken}, {@link requireBearerAuth}, and
* {@link bearerAuthChallengeResponse}.
*/
interface BearerAuthOptions {
/**
* A verifier used to validate access tokens.
*/
verifier: OAuthTokenVerifier;
/**
* Optional scopes that the token must have. When any are missing the
* request is refused with `403 insufficient_scope`.
*/
requiredScopes?: string[];
/**
* Optional Protected Resource Metadata URL to advertise in the
* `WWW-Authenticate` header on 401/403 responses, per
* {@link https://datatracker.ietf.org/doc/html/rfc9728 | RFC 9728}.
*
* Typically built with `getOAuthProtectedResourceMetadataUrl`, exported
* from this package.
*
* When verification succeeds the value is also stamped onto the returned
* {@link AuthInfo} (`authInfo.resourceMetadataUrl`, unless the verifier
* already set one), so challenges built after authentication — such as
* per-operation `insufficient_scope` scope challenges — advertise the
* same document without being configured separately.
*/
resourceMetadataUrl?: string;
}
/**
* Options for {@link verifyBearerToken} and {@link requireBearerAuth}:
* {@link BearerAuthOptions} plus `expectedResource`.
*/
interface VerifyBearerTokenOptions extends BearerAuthOptions {
/**
* Accept only tokens issued for this resource (the token's audience):
* the value your authorization server puts into tokens meant for this
* server, usually the server's URL (its
* {@link https://datatracker.ietf.org/doc/html/rfc8707 | RFC 8707}
* resource identifier).
*
* When set, a token is accepted only if the verifier reports that value
* in `AuthInfo.resource`. The two are compared as strings, ignoring a
* fragment and one trailing slash. A token reported for another value, or
* for none, is refused with `401 invalid_token`, so the verifier has to
* fill `AuthInfo.resource`, for example from the token's `aud` claim.
* When unset, `AuthInfo.resource` is not compared with anything.
*/
expectedResource?: URL;
}
/**
* Validate a raw `Authorization` header value as a Bearer token and return
* the verified {@link AuthInfo}.
*
* The runtime-neutral core of Bearer authentication: it parses the header,
* runs the verifier, compares the token's resource with `expectedResource`,
* enforces `requiredScopes`, and rejects tokens without an
* expiration or past it. On any failure it throws an {@link OAuthError} —
* pass that to {@link bearerAuthChallengeResponse} for the matching HTTP
* answer, or use {@link requireBearerAuth} to get both steps as one call.
*
* Framework adapters build on this: `requireBearerAuth` from
* `@modelcontextprotocol/express` feeds it `req.headers.authorization`.
*/
declare function verifyBearerToken(authorizationHeader: string | null | undefined, options: VerifyBearerTokenOptions): Promise<AuthInfo>;
/**
* Build the HTTP answer for a Bearer authentication failure.
*
* Maps an {@link OAuthError} to its status — `401` for `invalid_token` and
* `403` for `insufficient_scope` (both carrying the `WWW-Authenticate: Bearer …`
* challenge, with `resource_metadata` when configured so clients can discover
* the Authorization Server), `500` for `server_error`, `400` for anything
* else. A non-`OAuthError` value answers `500 server_error`. The body is the
* OAuth error JSON.
*/
declare function bearerAuthChallengeResponse(error: unknown, options?: Pick<BearerAuthOptions, 'requiredScopes' | 'resourceMetadataUrl'>): Response;
/**
* Require a valid Bearer token on web-standard requests.
*
* The framework-free counterpart of `requireBearerAuth` from
* `@modelcontextprotocol/express`, for hosts whose HTTP surface is a
* `fetch(request)` handler — Cloudflare Workers, Deno, Bun, Hono. The
* returned gate resolves to the verified {@link AuthInfo}, or to the
* ready-to-return challenge `Response` when the request must be refused.
*
* @example
* ```ts source="./bearerAuth.examples.ts#requireBearerAuth_fetchGate"
* const gate = requireBearerAuth({ verifier, requiredScopes: ['mcp'] });
*
* async function fetchHandler(request: Request): Promise<Response> {
* const auth: AuthInfo | Response = await gate(request);
* if (auth instanceof Response) return auth;
* return handler.fetch(request, { authInfo: auth });
* }
* ```
*/
declare function requireBearerAuth(options: VerifyBearerTokenOptions): (request: Request) => Promise<AuthInfo | Response>;
//#endregion
//#region src/server/middleware/hostHeaderValidation.d.ts
type HostHeaderValidationResult = {
ok: true;
hostname: string;
} | {
ok: false;
errorCode: 'missing_host' | 'invalid_host_header' | 'invalid_host';
message: string;
hostHeader?: string;
hostname?: string;
};
/**
* Parse and validate a `Host` header against an allowlist of hostnames (port-agnostic).
*
* - Input host header may include a port (e.g. `localhost:3000`) or IPv6 brackets (e.g. `[::1]:3000`).
* - Allowlist items should be hostnames only (no ports). For IPv6, include brackets (e.g. `[::1]`).
*/
declare function validateHostHeader(hostHeader: string | null | undefined, allowedHostnames: string[]): HostHeaderValidationResult;
/**
* Convenience allowlist for `localhost` DNS rebinding protection.
*/
declare function localhostAllowedHostnames(): string[];
/**
* Web-standard `Request` helper for DNS rebinding protection.
* @example
* ```ts source="./hostHeaderValidation.examples.ts#hostHeaderValidationResponse_basicUsage"
* const result = validateHostHeader(req.headers.get('host'), ['localhost']);
* ```
*/
declare function hostHeaderValidationResponse(req: Request, allowedHostnames: string[]): Response | undefined;
//#endregion
//#region src/server/middleware/oauthMetadata.d.ts
/**
* Options for {@link oauthMetadataResponse} and
* {@link buildOAuthProtectedResourceMetadata}.
*/
interface AuthMetadataOptions {
/**
* Authorization Server metadata (RFC 8414) for the AS this MCP server
* relies on. Served at `/.well-known/oauth-authorization-server` so
* legacy clients that probe the resource origin still discover the AS.
*/
oauthMetadata: OAuthMetadata;
/**
* The public URL of this MCP server, used as the `resource` value in the
* Protected Resource Metadata document. Any path component is reflected
* in the well-known route per RFC 9728.
*/
resourceServerUrl: URL;
/**
* Optional documentation URL advertised as `resource_documentation`.
*/
serviceDocumentationUrl?: URL;
/**
* Optional list of scopes this MCP server understands, advertised as
* `scopes_supported`.
*/
scopesSupported?: string[];
/**
* Optional human-readable name advertised as `resource_name`.
*/
resourceName?: string;
/**
* Allow a non-HTTPS issuer URL. Local testing only — never enable in
* production. The Express adapter maps its
* `MCP_DANGEROUSLY_ALLOW_INSECURE_ISSUER_URL` environment variable here.
*/
dangerouslyAllowInsecureIssuerUrl?: boolean;
}
/**
* Derive the RFC 9728 Protected Resource Metadata document from
* {@link AuthMetadataOptions}, validating the Authorization Server issuer URL
* (HTTPS required outside localhost) in the process.
*
* `oauthMetadataResponse` and the Express `mcpAuthMetadataRouter` both build
* on this; use it directly when serving the document through your own
* routing — or call it once at startup to fail fast on a misconfigured
* issuer before any request arrives.
*/
declare function buildOAuthProtectedResourceMetadata(options: AuthMetadataOptions): OAuthProtectedResourceMetadata;
/**
* Builds the RFC 9728 Protected Resource Metadata URL for a given MCP server
* URL by inserting `/.well-known/oauth-protected-resource` ahead of the path.
*
* @example
* ```ts
* getOAuthProtectedResourceMetadataUrl(new URL('https://api.example.com/mcp'))
* // → 'https://api.example.com/.well-known/oauth-protected-resource/mcp'
* ```
*/
declare function getOAuthProtectedResourceMetadataUrl(serverUrl: URL): string;
/**
* Serve the two OAuth discovery documents an MCP server acting as a Resource
* Server exposes, from a web-standard `fetch(request)` handler:
*
* - `/.well-known/oauth-protected-resource[/<path>]` — RFC 9728 Protected
* Resource Metadata, derived from the supplied options (path-aware: the
* resource URL's path is reflected in the route).
* - `/.well-known/oauth-authorization-server` — RFC 8414 Authorization
* Server Metadata, passed through verbatim.
*
* Returns the matched document `Response` (JSON with permissive CORS, `405`
* with an `Allow` header for non-GET methods, `204` for CORS preflight), or
* `undefined` when the request path is neither well-known route — fall
* through to your own routing. The framework-free counterpart of
* `mcpAuthMetadataRouter` from `@modelcontextprotocol/express`; pair it with
* `requireBearerAuth` and `getOAuthProtectedResourceMetadataUrl` so
* unauthenticated clients can discover the AS from the `401` challenge.
*
* @example
* ```ts source="./oauthMetadata.examples.ts#oauthMetadataResponse_fetchHandler"
* async function fetchHandler(request: Request): Promise<Response> {
* return oauthMetadataResponse(request, options) ?? serveMcp(request);
* }
* ```
*/
declare function oauthMetadataResponse(request: Request, options: AuthMetadataOptions): Response | undefined;
//#endregion
//#region src/server/middleware/originValidation.d.ts
/**
* Framework-agnostic Origin header validation helpers.
*
* Browsers attach an `Origin` header to cross-origin requests; validating it
* against an allowlist (alongside Host header validation) protects local and
* development MCP servers against DNS rebinding and cross-site request
* forgery. The framework middleware packages (`@modelcontextprotocol/express`,
* `@modelcontextprotocol/hono`, `@modelcontextprotocol/fastify`,
* `@modelcontextprotocol/node`) wrap these helpers; use them directly when
* mounting a handler bare on a fetch-native runtime.
*
* Validation is deny-on-failure: a present `Origin` value that cannot be
* parsed (including the opaque `null` origin) is rejected, never passed
* through. Requests without an `Origin` header pass — non-browser MCP clients
* do not send one.
*/
type OriginValidationResult = {
ok: true;
origin?: string;
hostname?: string;
} | {
ok: false;
errorCode: 'invalid_origin_header' | 'invalid_origin';
message: string;
originHeader?: string;
hostname?: string;
};
/**
* Validate an `Origin` header against an allowlist of hostnames (port-agnostic).
*
* - A missing/empty `Origin` header passes: non-browser clients do not send one,
* and only browser-originated requests carry the header this check defends against.
* - Allowlist items are hostnames only (no scheme, no port), the same convention as
* `validateHostHeader`. For IPv6, include brackets (e.g. `[::1]`).
* - A browser extension's origin carries its extension ID as the hostname; list the
* ID to allow one extension. An allowlist item of the form `<scheme>://*`
* (lowercase, e.g. `moz-extension://*`) allows every origin of that scheme, which
* Firefox needs because its extension IDs differ on every install.
* `http://*` and `https://*` are not honoured: list websites by hostname.
* - Any present value that cannot be parsed as an origin URL — including the literal
* `null` origin browsers send for opaque contexts — is rejected (deny on failure).
*/
declare function validateOriginHeader(originHeader: string | null | undefined, allowedOriginHostnames: string[]): OriginValidationResult;
/**
* Convenience allowlist of localhost-class origin hostnames, mirroring
* `localhostAllowedHostnames`.
*/
declare function localhostAllowedOrigins(): string[];
/**
* Web-standard `Request` helper for Origin validation: returns a `403` JSON-RPC
* error response when the request's `Origin` header is not allowed, and
* `undefined` when the request may proceed.
*
* ```ts
* const rejected = originValidationResponse(request, localhostAllowedOrigins());
* if (rejected) return rejected;
* ```
*/
declare function originValidationResponse(req: Request, allowedOriginHostnames: string[]): Response | undefined;
//#endregion
//#region src/server/requestStateCodec.d.ts
/**
* Options for {@linkcode createRequestStateCodec}.
*/
interface RequestStateCodecOptions {
/**
* The HMAC secret. A `string` value is UTF-8-encoded. MUST be at least
* 32 bytes (256 bits) long; a `RangeError` is thrown at
* construction otherwise. The same key must be available to every server
* instance that may receive an echoed `requestState` (so a per-process
* random key only works when one process serves every round of a flow).
*/
key: Uint8Array | string;
/**
* How long a minted `requestState` stays valid, in seconds. An echoed
* value past its expiry is rejected by {@linkcode RequestStateCodec.verify}.
* Defaults to `600` (ten minutes).
*/
ttlSeconds?: number;
/**
* Optional context binding. Called at mint time and again at verify time;
* a `requestState` minted under one binding value is rejected when echoed
* under a different one. Use this to bind state to the authenticated
* principal and/or the originating method (the spec's user-binding MUST
* for state that influences authorization), for example:
*
* ```ts
* bind: ctx => `${ctx.mcpReq.method}\0${ctx.http?.authInfo?.clientId ?? ''}`
* ```
*
* The returned value is stored in the envelope as a domain-separated HMAC
* tag (keyed by the codec's `key`), not the raw string — so a principal
* identifier in the binding does not appear in the wire value the client
* holds.
*
* When configured, {@linkcode RequestStateCodec.mint} requires its `ctx`
* argument.
*/
bind?: (ctx: ServerContext) => string;
}
/**
* The codec returned by {@linkcode createRequestStateCodec}: `mint` seals a
* JSON-serializable payload into the wire string a handler returns from
* `inputRequired({ requestState })`; `verify` is the function to drop into
* {@linkcode server/server.ServerOptions | ServerOptions}`.requestState.verify`
* (it throws on any failure, which the seam answers as the frozen `-32602`).
* The decoded payload `verify` resolves with is handed to the handler by the
* seam via the typed `ctx.mcpReq.requestState<T>()` accessor — `mint<T>` and
* `requestState<T>()` are the typed encode/read pair.
*/
interface RequestStateCodec<T = unknown> {
/**
* Seal `payload` into an opaque wire string. The result is what the
* handler returns from `inputRequired({ requestState })`.
*
* @param ctx The handler's context. Required when the codec was created
* with a {@linkcode RequestStateCodecOptions.bind | bind}
* callback; ignored otherwise.
*/
mint(payload: T, ctx?: ServerContext): Promise<string>;
/**
* Verify an echoed `requestState` and return the original payload. Throws
* on any failure (bad MAC, expired, bind mismatch, malformed). The thrown
* message is a fixed opaque reason code (`'malformed'` / `'mac'` /
* `'expired'` / `'bind'`) — never the decoded payload, the binding value,
* or any other context-derived field.
*
* Pass this directly as `ServerOptions.requestState.verify`.
*/
verify(state: string, ctx: ServerContext): Promise<T>;
}
/**
* Create an opt-in HMAC-SHA256 codec for the multi-round-trip `requestState`
* (protocol revision 2026-07-28).
*
* `requestState` round-trips through the client and is attacker-controlled
* input on re-entry. The SDK applies no protection of its own; this helper is
* the convenience implementation of the spec's integrity MUST so authors don't
* hand-roll HMAC. Wire shape:
*
* "v1." b64url({"p":<payload>,"exp":<unixSeconds>,"b":<bindTag>?}) "." b64url(mac)
*
* where `bindTag` is `b64url(HMAC(key, "mcp.requestState.bind:" + bind(ctx))[:16])`
* — the binding value is never embedded raw.
*
* The codec is **signed, not encrypted**: the body is integrity-protected but
* the client can base64url-decode it and read the payload (`p`) in clear. Do
* not put secrets in the payload; use an AEAD construction if confidentiality
* is required. The handler reads its payload back via the typed
* `ctx.mcpReq.requestState<T>()` accessor — the seam has already run `verify`
* (integrity proven, payload decoded) by the time the handler is entered.
*
* Verification is fail-closed and constant-time (WebCrypto `subtle.verify` for
* the body MAC; a fixed-length XOR-accumulator compare for the bind tag).
* See `examples/mrtr/server.ts` for a worked end-to-end example.
*
* Design comparison (mcp.d `secureRequestState`, the peer SDK's reference
* implementation): mcp.d additionally offers an AES-256-GCM encrypted mode and
* derives independent cipher / bind-HMAC sub-keys from the operator secret via
* HKDF-SHA256, with an auto-generated per-process ephemeral key when none is
* supplied. This codec deliberately ships only the signed mode and a single
* keyed HMAC (domain-separated by input prefix) — HKDF sub-key derivation and
* an encrypted mode are intentionally out of scope for the initial release.
*/
declare function createRequestStateCodec<T = unknown>(options: RequestStateCodecOptions): RequestStateCodec<T>;
//#endregion
//#region src/server/streamableHttp.d.ts
type StreamId = string;
type EventId = string;
/**
* Interface for resumability support via event storage
*/
interface EventStore {
/**
* Stores an event for later retrieval
* @param streamId ID of the stream the event belongs to
* @param message The JSON-RPC message to store
* @returns The generated event ID for the stored event
*/
storeEvent(streamId: StreamId, message: JSONRPCMessage): Promise<EventId>;
/**
* Get the stream ID associated with a given event ID.
* @param eventId The event ID to look up
* @returns The stream ID, or `undefined` if not found
*
* Optional: If not provided, the SDK will use the `streamId` returned by
* {@linkcode replayEventsAfter} for stream mapping.
*/
getStreamIdForEventId?(eventId: EventId): Promise<StreamId | undefined>;
replayEventsAfter(lastEventId: EventId, {
send
}: {
send: (eventId: EventId, message: JSONRPCMessage) => Promise<void>;
}): Promise<StreamId>;
}
/**
* Configuration options for {@linkcode WebStandardStreamableHTTPServerTransport}
*/
interface WebStandardStreamableHTTPServerTransportOptions {
/**
* Function that generates a session ID for the transport.
* The session ID SHOULD be globally unique and cryptographically secure (e.g., a securely generated UUID, a JWT, or a cryptographic hash)
*
* If not provided, session management is disabled (stateless mode).
*/
sessionIdGenerator?: (() => string) | undefined;
/**
* A callback for session initialization events
* This is called when the server initializes a new session.
* Useful in cases when you need to register multiple mcp sessions
* and need to keep track of them.
* @param sessionId The generated session ID
*/
onsessioninitialized?: ((sessionId: string) => void | Promise<void>) | undefined;
/**
* A callback for session close events
* This is called when the server closes a session due to a `DELETE` request.
* Useful in cases when you need to clean up resources associated with the session.
* Note that this is different from the transport closing, if you are handling
* HTTP requests from multiple nodes you might want to close each
* {@linkcode WebStandardStreamableHTTPServerTransport} after a request is completed while still keeping the
* session open/running.
* @param sessionId The session ID that was closed
*/
onsessionclosed?: ((sessionId: string) => void | Promise<void>) | undefined;
/**
* If `true`, the server will return JSON responses instead of starting an SSE stream.
* This can be useful for simple request/response scenarios without streaming.
* Default is `false` (SSE streams are preferred).
*/
enableJsonResponse?: boolean;
/**
* Event store for resumability support
* If provided, resumability will be enabled, allowing clients to reconnect and resume messages
*/
eventStore?: EventStore;
/**
* List of allowed `Host` header values for DNS rebinding protection.
* If not specified, host validation is disabled.
* @deprecated Use external middleware for host validation instead.
*/
allowedHosts?: string[];
/**
* List of allowed `Origin` header values for DNS rebinding protection.
* If not specified, origin validation is disabled.
* @deprecated Use external middleware for origin validation instead.
*/
allowedOrigins?: string[];
/**
* Enable DNS rebinding protection (requires `allowedHosts` and/or `allowedOrigins` to be configured).
* Default is `false` for backwards compatibility.
* @deprecated Use external middleware for DNS rebinding protection instead.
*/
enableDnsRebindingProtection?: boolean;
/**
* Retry interval in milliseconds to suggest to clients in SSE `retry` field.
* When set, the server will send a `retry` field in SSE priming events to control
* client reconnection timing for polling behavior.
*/
retryInterval?: number;
/**
* Interval in milliseconds between SSE keep-alive comment frames.
* Defaults to `15000`; set to `0` to disable.
*/
keepAliveMs?: number;
/**
* Upper bound, in bytes, on a POST body the transport reads itself. A body
* over the bound (declared `Content-Length`, or observed while streaming)
* is answered `413` before anything is parsed. Not applied when the caller
* supplies `parsedBody`. Must be a positive number.
* @default 4194304 (4 MiB)
*/
maxRequestBodySize?: number;
/**
* List of protocol versions that this transport will accept.
* Used to validate the `mcp-protocol-version` header in incoming requests.
*
* Note: When using {@linkcode server/server.Server.connect | Server.connect()}, the server automatically passes its
* `supportedProtocolVersions` to the transport, so you typically don't need
* to set this option directly.
*
* @default {@linkcode SUPPORTED_PROTOCOL_VERSIONS}
*/
supportedProtocolVersions?: string[];
}
/**
* Options for handling a request
*/
interface HandleRequestOptions {
/**
* Pre-parsed request body. If provided, the transport will use this instead of reading and parsing the request body.
* Useful when using body-parser middleware that has already parsed the body.
*/
parsedBody?: unknown;
/**
* Authentication info from middleware. If provided, will be passed to message handlers.
*/
authInfo?: AuthInfo;
}
/**
* 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.
*
* 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
*
* @example Stateful setup
* ```ts source="./streamableHttp.examples.ts#WebStandardStreamableHTTPServerTransport_stateful"
* const server = new McpServer({ name: 'my-server', version: '1.0.0' });
*
* const transport = new WebStandardStreamableHTTPServerTransport({
* sessionIdGenerator: () => crypto.randomUUID()
* });
*
* await server.connect(transport);
* ```
*
* @example Stateless setup
* ```ts source="./streamableHttp.examples.ts#WebStandardStreamableHTTPServerTransport_stateless"
* const transport = new WebStandardStreamableHTTPServerTransport({
* sessionIdGenerator: undefined
* });
* ```
*
* @example Hono.js
* ```ts source="./streamableHttp.examples.ts#WebStandardStreamableHTTPServerTransport_hono"
* app.all('/mcp', async c => {
* // Stateless example: create a server and a transport per request.
* const server = new McpServer({ name: 'my-server', version: '1.0.0' });
* const transport = new WebStandardStreamableHTTPServerTransport({ sessionIdGenerator: undefined });
* await server.connect(transport);
* return transport.handleRequest(c.req.raw);
* });
* ```
*
* @example Cloudflare Workers
* ```ts source="./streamableHttp.examples.ts#WebStandardStreamableHTTPServerTransport_workers"
* const worker = {
* async fetch(request: Request): Promise<Response> {
* // Stateless example: create a server and a transport per request.
* const server = new McpServer({ name: 'my-server', version: '1.0.0' });
* const transport = new WebStandardStreamableHTTPServerTransport({ sessionIdGenerator: undefined });
* await server.connect(transport);
* return transport.handleRequest(request);
* }
* };
* ```
*/
declare class WebStandardStreamableHTTPServerTransport implements Transport {
private sessionIdGenerator;
private _started;
private _hasHandledRequest;
private _closed;
private _streamMapping;
private _requestToStreamMapping;
private _requestResponseMap;
private _initialized;
private _enableJsonResponse;
private _standaloneSseStreamId;
private _eventStore?;
private _onsessioninitialized?;
private _onsessionclosed?;
private _allowedHosts?;
private _allowedOrigins?;
private _enableDnsRebindingProtection;
private _retryInterval?;
private _supportedProtocolVersions;
private _keepAliveMs;
private _maxRequestBodySize;
private _scopeChallengeResolver?;
sessionId?: string;
onclose?: () => void;
onerror?: (error: Error) => void;
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
constructor(options?: WebStandardStreamableHTTPServerTransportOptions);
private startKeepAlive;
/** Sets the scope challenge resolver for parsed JSON-RPC requests. */
setScopeChallengeResolver(resolver: ScopeChallengeHandler): void;
/**
* Starts the transport. This is required by the {@linkcode Transport} interface but is a no-op
* for the Streamable HTTP transport as connections are managed per-request.
*/
start(): Promise<void>;
/**
* Sets the supported protocol versions for header validation.
* Called by the server during {@linkcode server/server.Server.connect | connect()} to pass its supported versions.
*/
setSupportedProtocolVersions(versions: string[]): void;
/**
* Helper to create a JSON error response
*/
private createJsonErrorResponse;
private _checkScopeChallenge;
/**
* Validates request headers for DNS rebinding protection.
* @returns Error response if validation fails, `undefined` if validation passes.
*/
private validateRequestHeaders;
/**
* Handles an incoming HTTP request, whether `GET`, `POST`, or `DELETE`
* Returns a `Response` object (Web Standard)
*/
handleRequest(req: Request, options?: HandleRequestOptions): Promise<Response>;
/**
* Returns true if the client's protocol version supports empty SSE data in
* priming events (the fix shipped with protocol version `2025-11-25`).
*
* The version is checked for membership in this transport instance's
* supported protocol versions rather than with an open-ended
* `>= '2025-11-25'` comparison: the value may come from an `initialize`
* request body, which (unlike the `MCP-Protocol-Version` header) is not
* validated against `supportedProtocolVersions` before reaching this
* check. An unknown future version string must not silently enable
* behavior reserved for versions this transport actually supports.
*/
private supportsEmptySSEData;
/**
* 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 (a supported
* version that is >= `2025-11-25`).
*/
private writePrimingEvent;
/**
* Handles `GET` requests for SSE stream
*/
private handleGetRequest;
/**
* Replays events that would have been sent after the specified event ID
* Only used when resumability is enabled
*/
private replayEvents;
/**
* Writes an event to an SSE stream via controller with proper formatting
*/
private writeSSEEvent;
/**
* Handles unsupported requests (`PUT`, `PATCH`, etc.)
*/
private handleUnsupportedRequest;
/**
* Handles `POST` requests containing JSON-RPC messages
*/
private handlePostRequest;
/**
* Handles `DELETE` requests to terminate sessions
*/
private handleDeleteRequest;
/**
* Validates session ID for non-initialization requests.
* Returns `Response` error if invalid, `undefined` otherwise
*/
private validateSession;
/**
* 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
*/
private validateProtocolVersion;
close(): Promise<void>;
/**
* 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: RequestId): void;
/**
* Close the standalone `GET` SSE stream, triggering client reconnection.
* Use this to implement polling behavior for server-initiated notifications.
*/
closeStandaloneSSEStream(): void;
send(message: JSONRPCMessage, options?: {
relatedRequestId?: RequestId;
}): Promise<void>;
}
//#endregion
//#region src/server/requestBody.d.ts
/** Default upper bound, in bytes, on a request body read by the HTTP entry points (4 MiB). */
declare const DEFAULT_MAX_REQUEST_BODY_SIZE: number;
/**
* Reads a request body as text, up to `maxBytes` (default
* {@linkcode DEFAULT_MAX_REQUEST_BODY_SIZE}). A declared `Content-Length` over the
* limit is refused without reading anything; otherwise the read stops as soon as
* more than the limit has arrived. Stream failures propagate.
*/
declare function readRequestBody(request: Request, maxBytes?: number): Promise<{
tooLarge: true;
} | {
tooLarge: false;
text: string;
}>;
//#endregion
//#region src/fromJsonSchema.d.ts
declare function fromJsonSchema<T = unknown>(schema: JsonSchemaType, validator?: jsonSchemaValidator): StandardSchemaWithJSON<T, T>;
//#endregion
export { Annotations, type AnyToolHandler, AudioContent, AuthInfo, type AuthMetadataOptions, type AuthorizationServerMetadata, BAGGAGE_META_KEY, type BaseContext, BaseMetadata, type BaseToolCallback, type BearerAuthOptions, BlobResourceContents, BooleanSchema, CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, type CacheHint, type CacheScope, CallToolRequest, CallToolRequestParams, CallToolResult, CancelTaskRequest, CancelTaskResult, CancelledNotification, CancelledNotificationParams, ClientCapabilities, type ClientContext, ClientNotification, ClientRequest, ClientResult, CompatibilityCallToolResult, type CompletableSchema, type CompleteCallback, CompleteRequest, CompleteRequestParams, CompleteRequestPrompt, CompleteRequestResourceTemplate, type CompleteResourceTemplateCallback, CompleteResult, ContentBlock, type CreateMcpHandlerOptions, CreateMessageRequest, CreateMessageRequestParams, CreateMessageRequestParamsBase, CreateMessageRequestParamsWithTools, CreateMessageResult, CreateMessageResultWithTools, CreateTaskResult, Cursor, DEFAULT_MAX_REQUEST_BODY_SIZE, DEFAULT_NEGOTIATED_PROTOCOL_VERSION, DEFAULT_REQUEST_TIMEOUT_MSEC, DiscoverRequest, DiscoverResult, type ElicitInputParams, ElicitRequest, ElicitRequestFormParams, ElicitRequestParams, ElicitRequestURLParams, ElicitResult, ElicitationCompleteNotification, ElicitationCompleteNotificationParams, EmbeddedResource, EmptyResult, EnumSchema, type EventId, type EventStore, type FetchLike, GetPromptRequest, GetPromptRequestParams, GetPromptResult, GetTaskPayloadRequest, GetTaskPayloadResult, GetTaskRequest, GetTaskResult, type HandleRequestOptions, HandlerResultTypeMap, type HostHeaderValidationResult, INTERNAL_ERROR, INVALID_PARAMS, INVALID_REQUEST, Icon, Icons, type IdJagTokenExchangeResponse, ImageContent, Implementation, InMemoryServerEventBus, InMemoryTransport, type InboundClassificationOutcome, type InboundHttpRequest, type InboundLadderRejection, type InboundLegacyRoute, type InboundLegacyRouteReason, type InboundModernRoute, type InboundValidationRung, InitializeRequest, InitializeRequestParams, InitializeResult, InitializedNotification, InputRequest, InputRequests, InputRequiredResult, type InputRequiredSpec, InputResponse, type InputResponseView, InputResponses, InternalError, InvalidParamsError, InvalidRequestError, type IsLegacyRequestOptions, JSONArray, JSONObject, JSONRPCErrorResponse, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONRPCResultResponse, JSONRPC_VERSION, JSONValue, type JsonSchemaType, type JsonSchemaValidator, type JsonSchemaValidatorResult, LATEST_PROTOCOL_VERSION, LOG_LEVEL_META_KEY, type LegacyHttpHandler, type LegacyStatelessFallbackOptions, LegacyTitledEnumSchema, ListChangedCallback, ListChangedHandlers, ListChangedOptions, ListPromptsRequest, ListPromptsResult, ListResourceTemplatesRequest, ListResourceTemplatesResult, type ListResourcesCallback, ListResourcesRequest, ListResourcesResult, ListRootsRequest, ListRootsResult, ListTasksRequest, ListTasksResult, ListToolsRequest, ListToolsResult, LoggingLevel, LoggingMessageNotification, LoggingMessageNotificationParams, METHOD_NOT_FOUND, type McpHandlerRequestOptions, type McpHttpHandler, type McpRequestContext, McpServer, type McpServerFactory, type McpServerOptions, MessageClassification, MessageExtraInfo, MetaObject, MethodNotFoundError, MissingRequiredClientCapabilityError, MissingRequiredClientCapabilityErrorData, ModelHint, ModelPreferences, MultiSelectEnumSchema, Notification, NotificationMethod, type NotificationOptions, NotificationParams, NotificationTypeMap, NumberSchema, type OAuthClientInformation, type OAuthClientInformationFull, type OAuthClientInformationMixed, type OAuthClientMetadata, type OAuthClientRegistrationError, OAuthError, OAuthErrorCode, type OAuthErrorResponse, type OAuthMetadata, type OAuthProtectedResourceMetadata, type OAuthTokenRevocationRequest, type OAuthTokenVerifier, type OAuthTokens, type OpenIdProviderDiscoveryMetadata, type OpenIdProviderMetadata, type OriginValidationResult, PARSE_ERROR, PROTOCOL_VERSION_META_KEY, PaginatedRequest, PaginatedRequestParams, PaginatedResult, ParseError, PerRequestHTTPServerTransport, type PerRequestHTTPServerTransportOptions, type PerRequestMessageExtra, type PerRequestResponseMode, PingRequest, PrimitiveSchemaDefinition, Progress, type ProgressCallback, ProgressNotification, ProgressNotificationParams, ProgressToken, Prompt, PromptArgument, type PromptCallback, PromptListChangedNotification, PromptMessage, PromptReference, Protocol, type ProtocolEra, ProtocolError, ProtocolErrorCode, type ProtocolOptions, RELATED_TASK_META_KEY, ReadBuffer, type ReadResourceCallback, ReadResourceRequest, ReadResourceRequestParams, ReadResourceResult, type ReadResourceTemplateCallback, type RegisteredPrompt, type RegisteredResource, type RegisteredResourceTemplate, type RegisteredTool, RelatedTaskMetadata, Request$1 as Request, type RequestHandlerSchemas, RequestId, RequestMeta, RequestMetaEnvelopLine truncated
//# sourceMappingURL=index.d.cts.map
@@ -0,0 +1,29 @@
import { MiddlewareHandler } from "../../types.js";
import { Context } from "../../context.js";
import { HTTPException } from "../../http-exception.js";
//#region src/middleware/timeout/index.d.ts
export type HTTPExceptionFunction = (context: Context) => HTTPException;
/**
* Timeout Middleware for Hono.
*
* @param {number} duration - The timeout duration in milliseconds.
* @param {HTTPExceptionFunction | HTTPException} [exception=defaultTimeoutException] - The exception to throw when the timeout occurs. Can be a function that returns an HTTPException or an HTTPException object.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* const app = new Hono()
*
* app.use(
* '/long-request',
* timeout(5000) // Set timeout to 5 seconds
* )
*
* app.get('/long-request', async (c) => {
* await someLongRunningFunction()
* return c.text('Completed within time limit')
* })
* ```
*/
export declare const timeout: (duration: number, exception?: HTTPExceptionFunction | HTTPException) => MiddlewareHandler;
//#endregion
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../src/slot.tsx"],
"sourcesContent": ["export {\n Slot,\n Slottable,\n //\n Root,\n createSlot,\n createSlottable,\n} from './slot';\nexport type { SlotProps } from './slot';\n", "import * as React from 'react';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\n\ndeclare module 'react' {\n interface ReactElement {\n $$typeof?: symbol | string;\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\nexport type Usable<T> = PromiseLike<T> | React.Context<T>;\n\ntype SlotProps<Elem extends Element = HTMLElement, Props = React.HTMLAttributes<Elem>> = Props & {\n children?: React.ReactNode;\n};\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlot<\n Elem extends Element = HTMLElement,\n Props = React.HTMLAttributes<Elem>,\n>(ownerName: string) {\n const Slot = React.forwardRef<Elem, SlotProps<Elem, Props>>((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n let slottableElement: React.ReactElement | null = null;\n let hasSlottable = false;\n const newChildren: React.ReactNode[] = [];\n\n if (isLazyComponent(children) && typeof use === 'function') {\n children = use(children._payload);\n }\n\n React.Children.forEach(children, (maybeSlottable) => {\n if (isSlottable(maybeSlottable)) {\n hasSlottable = true;\n const slottable = maybeSlottable;\n let child = 'child' in slottable.props ? slottable.props.child : slottable.props.children;\n\n if (isLazyComponent(child) && typeof use === 'function') {\n child = use(child._payload);\n }\n\n slottableElement = getSlottableElementFromSlottable(slottable, child);\n newChildren.push((slottableElement?.props as any)?.children);\n } else {\n newChildren.push(maybeSlottable);\n }\n });\n\n if (slottableElement) {\n slottableElement = React.cloneElement(slottableElement, undefined, newChildren);\n } else if (\n // A `Slottable` was found but it didn't resolve to a single element (e.g.\n // it wrapped multiple elements, text, or a render-prop `child` that\n // wasn't an element). Don't fall back to treating the `Slottable` wrapper\n // itself as the slot target \u2014 throw a descriptive error below instead.\n !hasSlottable &&\n React.Children.count(children) === 1 &&\n React.isValidElement(children)\n ) {\n slottableElement = children;\n }\n\n const slottableElementRef = slottableElement ? getElementRef(slottableElement) : undefined;\n const composedRef = useComposedRefs(forwardedRef, slottableElementRef);\n\n if (!slottableElement) {\n // Empty/falsy children (`null`, `undefined`, `false`, no children, etc.) are valid and\n // render nothing. Anything else is content we couldn't slot onto a single element, which\n // is a usage error, so we fail loudly with a clear message.\n if (children || children === 0) {\n throw new Error(\n hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName),\n );\n }\n return children;\n }\n\n const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});\n\n // do not pass ref to React.Fragment for React 19 compatibility\n if (slottableElement.type !== React.Fragment) {\n mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;\n }\n\n return React.cloneElement(slottableElement, mergedProps);\n });\n\n Slot.displayName = `${ownerName}.Slot`;\n return Slot;\n}\n\nconst Slot = createSlot('Slot');\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst SLOTTABLE_IDENTIFIER = Symbol.for('radix.slottable');\n\ntype SlottableChildrenProps = { children: React.ReactNode };\ntype SlottableRenderFnProps = {\n child: React.ReactNode;\n children: (slottable: React.ReactNode) => React.ReactNode;\n};\n\ntype SlottableProps = SlottableRenderFnProps | SlottableChildrenProps;\ninterface SlottableComponent extends React.FC<SlottableProps> {\n __radixId: symbol;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlottable(ownerName: string) {\n const Slottable: SlottableComponent = (props) =>\n 'child' in props ? props.children(props.child) : props.children;\n\n Slottable.displayName = `${ownerName}.Slottable`;\n Slottable.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable;\n}\n\nconst Slottable = createSlottable('Slottable');\n\n/* -------------------------------------------------------------------------------------------------\n * getSlottableElementFromSlottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst getSlottableElemLine truncated
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,gCAAgC;AAAA;AAkBE,SAAS,WAGzC,WAAmB;AACnB,QAAMA,QAAa,iBAAyC,CAAC,OAAO,iBAAiB;AACnF,QAAI,EAAE,UAAU,GAAG,UAAU,IAAI;AACjC,QAAI,mBAA8C;AAClD,QAAI,eAAe;AACnB,UAAM,cAAiC,CAAC;AAExC,QAAI,gBAAgB,QAAQ,KAAK,OAAO,QAAQ,YAAY;AAC1D,iBAAW,IAAI,SAAS,QAAQ;AAAA,IAClC;AAEA,IAAM,eAAS,QAAQ,UAAU,CAAC,mBAAmB;AACnD,UAAI,YAAY,cAAc,GAAG;AAC/B,uBAAe;AACf,cAAM,YAAY;AAClB,YAAI,QAAQ,WAAW,UAAU,QAAQ,UAAU,MAAM,QAAQ,UAAU,MAAM;AAEjF,YAAI,gBAAgB,KAAK,KAAK,OAAO,QAAQ,YAAY;AACvD,kBAAQ,IAAI,MAAM,QAAQ;AAAA,QAC5B;AAEA,2BAAmB,iCAAiC,WAAW,KAAK;AACpE,oBAAY,KAAM,kBAAkB,OAAe,QAAQ;AAAA,MAC7D,OAAO;AACL,oBAAY,KAAK,cAAc;AAAA,MACjC;AAAA,IACF,CAAC;AAED,QAAI,kBAAkB;AACpB,yBAAyB,mBAAa,kBAAkB,QAAW,WAAW;AAAA,IAChF;AAAA;AAAA;AAAA;AAAA;AAAA,MAKE,CAAC,gBACK,eAAS,MAAM,QAAQ,MAAM,KAC7B,qBAAe,QAAQ;AAAA,MAC7B;AACA,yBAAmB;AAAA,IACrB;AAEA,UAAM,sBAAsB,mBAAmB,cAAc,gBAAgB,IAAI;AACjF,UAAM,kBAAc,2CAAgB,cAAc,mBAAmB;AAErE,QAAI,CAAC,kBAAkB;AAIrB,UAAI,YAAY,aAAa,GAAG;AAC9B,cAAM,IAAI;AAAA,UACR,eAAe,qBAAqB,SAAS,IAAI,gBAAgB,SAAS;AAAA,QAC5E;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAEA,UAAM,cAAc,WAAW,WAAW,iBAAiB,SAAS,CAAC,CAAC;AAGtE,QAAI,iBAAiB,SAAe,gBAAU;AAC5C,kBAAY,MAAM,eAAe,cAAc;AAAA,IACjD;AAEA,WAAa,mBAAa,kBAAkB,WAAW;AAAA,EACzD,CAAC;AAED,EAAAA,MAAK,cAAc,GAAG,SAAS;AAC/B,SAAOA;AACT;AAEA,IAAM,OAAO,2BAAW,MAAM;AAM9B,IAAM,uBAAuB,OAAO,IAAI,iBAAiB;AAAA;AAavB,SAAS,gBAAgB,WAAmB;AAC5E,QAAMC,aAAgC,CAAC,UACrC,WAAW,QAAQ,MAAM,SAAS,MAAM,KAAK,IAAI,MAAM;AAEzD,EAAAA,WAAU,cAAc,GAAG,SAAS;AACpC,EAAAA,WAAU,YAAY;AACtB,SAAOA;AACT;AAEA,IAAM,YAAY,gCAAgB,WAAW;AAM7C,IAAM,mCAAmC,CAAC,WAA6B,UAA2B;AAChG,MAAI,WAAW,UAAU,OAAO;AAC9B,UAAMC,SAAQ,UAAU,MAAM;AAC9B,QAAI,CAAO,qBAAwCA,MAAK,EAAG,QAAO;AAClE,WAAa,mBAAaA,QAAO,QAAW,UAAU,MAAM,SAASA,OAAM,MAAM,QAAQ,CAAC;AAAA,EAC5F;AAEA,SAAa,qBAAe,KAAK,IAAI,QAAQ;AAC/C;AAQA,SAAS,WAAW,WAAqB,YAAsB;AAE7D,QAAM,gBAAgB,EAAE,GAAG,WAAW;AAEtC,aAAW,YAAY,YAAY;AACjC,UAAM,gBAAgB,UAAU,QAAQ;AACxC,UAAM,iBAAiB,WAAW,QAAQ;AAE1C,UAAM,YAAY,WAAW,KAAK,QAAQ;AAC1C,QAAI,WAAW;AAEb,UAAI,iBAAiB,gBAAgB;AACnC,sBAAc,QAAQ,IAAI,IAAI,SAAoB;AAChD,gBAAM,SAAS,eAAe,GAAG,IAAI;AACrC,wBAAc,GAAG,IAAI;AACrB,iBAAO;AAAA,QACT;AAAA,MACF,WAES,eAAe;AACtB,sBAAc,QAAQ,IAAI;AAAA,MAC5B;AAAA,IACF,WAES,aAAa,SAAS;AAC7B,oBAAc,QAAQ,IAAI,EAAE,GAAG,eAAe,GAAG,eAAe;AAAA,IAClE,WAAW,aAAa,aAAa;AACnC,oBAAc,QAAQ,IAAI,CAAC,eAAe,cAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,IACpF;AAAA,EACF;AAEA,SAAO,EAAE,GAAG,WAAW,GAAG,cAAc;AAC1C;AAWA,SAAS,cAAc,SAA6B;AAElD,MAAI,SAAS,OAAO,yBAAyB,QAAQ,OAAO,KAAK,GAAG;AACpE,MAAI,UAAU,UAAU,oBAAoB,UAAU,OAAO;AAC7D,MAAI,SAAS;AACX,WAAQ,QAAgB;AAAA,EAC1B;AAGA,WAAS,OAAO,yBAAyB,SAAS,KAAK,GAAG;AAC1D,YAAU,UAAU,oBAAoB,UAAU,OAAO;AACzD,MAAI,SAAS;AACX,WAAQ,QAAQ,MAAuC;AAAA,EACzD;AAGA,SAAQ,QAAQ,MAAuC,OAAQ,QAAgB;AACjF;AAMA,SAAS,YACP,OAC+D;AAC/D,SACQ,qBAAe,KAAK,KAC1B,OAAO,MAAM,SAAS,cACtB,eAAe,MAAM,QACrB,MAAM,KAAK,cAAc;AAE7B;AAEA,IAAM,kBAAkB,OAAO,IAAI,YAAY;AAO/C,SAAS,gBAAgB,SAAuD;AAC9E,SACE,WAAW,QACX,OAAO,YAAY,YACnB,cAAc,WACd,QAAQ,aAAa,mBACrB,cAAc,WACd,cAAc,QAAQ,QAAQ;AAElC;AAEA,SAAS,cAAc,OAA+C;AACpE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AAClE;AAEA,IAAM,kBAAkB,CAAC,cAAsB;AAC7C,SAAO,GAAG,SAAS;AACrB;AAEA,IAAM,uBAAuB,CAAC,cAAsB;AAClD,SAAO,GAAG,SAAS;AACrB;AAEA,IAAM,MAAqC,MAAc,QAAQ,KAAK,EAAE,SAAS,CAAC;",
"names": ["Slot", "Slottable", "child"]
}
@@ -0,0 +1,158 @@
'use strict'
const { Cache } = require('./cache')
const { webidl } = require('../webidl')
const { kEnumerableProperty } = require('../../core/util')
const { kConstruct } = require('../../core/symbols')
class CacheStorage {
/**
* @see https://w3c.github.io/ServiceWorker/#dfn-relevant-name-to-cache-map
* @type {Map<string, import('./cache').requestResponseList}
*/
#caches = new Map()
constructor () {
if (arguments[0] !== kConstruct) {
webidl.illegalConstructor()
}
webidl.util.markAsUncloneable(this)
}
async match (request, options = {}) {
webidl.brandCheck(this, webidl.is.CacheStorage)
webidl.argumentLengthCheck(arguments, 1, 'CacheStorage.match')
request = webidl.converters.RequestInfo(request)
options = webidl.converters.MultiCacheQueryOptions(options)
// 1.
if (options.cacheName != null) {
// 1.1.1.1
if (this.#caches.has(options.cacheName)) {
// 1.1.1.1.1
const cacheList = this.#caches.get(options.cacheName)
const cache = new Cache(kConstruct, cacheList)
return await cache.match(request, options)
}
} else { // 2.
// 2.2
for (const cacheList of this.#caches.values()) {
const cache = new Cache(kConstruct, cacheList)
// 2.2.1.2
const response = await cache.match(request, options)
if (response !== undefined) {
return response
}
}
}
}
/**
* @see https://w3c.github.io/ServiceWorker/#cache-storage-has
* @param {string} cacheName
* @returns {Promise<boolean>}
*/
async has (cacheName) {
webidl.brandCheck(this, webidl.is.CacheStorage)
const prefix = 'CacheStorage.has'
webidl.argumentLengthCheck(arguments, 1, prefix)
cacheName = webidl.converters.DOMString(cacheName, prefix, 'cacheName')
// 2.1.1
// 2.2
return this.#caches.has(cacheName)
}
/**
* @see https://w3c.github.io/ServiceWorker/#dom-cachestorage-open
* @param {string} cacheName
* @returns {Promise<Cache>}
*/
async open (cacheName) {
webidl.brandCheck(this, webidl.is.CacheStorage)
const prefix = 'CacheStorage.open'
webidl.argumentLengthCheck(arguments, 1, prefix)
cacheName = webidl.converters.DOMString(cacheName, prefix, 'cacheName')
// 2.1
if (this.#caches.has(cacheName)) {
// await caches.open('v1') !== await caches.open('v1')
// 2.1.1
const cache = this.#caches.get(cacheName)
// 2.1.1.1
return new Cache(kConstruct, cache)
}
// 2.2
const cache = []
// 2.3
this.#caches.set(cacheName, cache)
// 2.4
return new Cache(kConstruct, cache)
}
/**
* @see https://w3c.github.io/ServiceWorker/#cache-storage-delete
* @param {string} cacheName
* @returns {Promise<boolean>}
*/
async delete (cacheName) {
webidl.brandCheck(this, webidl.is.CacheStorage)
const prefix = 'CacheStorage.delete'
webidl.argumentLengthCheck(arguments, 1, prefix)
cacheName = webidl.converters.DOMString(cacheName, prefix, 'cacheName')
return this.#caches.delete(cacheName)
}
/**
* @see https://w3c.github.io/ServiceWorker/#cache-storage-keys
* @returns {Promise<string[]>}
*/
async keys () {
webidl.brandCheck(this, webidl.is.CacheStorage)
// 2.1
const keys = this.#caches.keys()
// 2.2
return [...keys]
}
static {
webidl.is.CacheStorage = (arg) => {
return arg != null && typeof arg === 'object' && #caches in arg
}
}
}
Object.defineProperties(CacheStorage.prototype, {
[Symbol.toStringTag]: {
value: 'CacheStorage',
configurable: true
},
match: kEnumerableProperty,
has: kEnumerableProperty,
open: kEnumerableProperty,
delete: kEnumerableProperty,
keys: kEnumerableProperty
})
module.exports = {
CacheStorage
}
@@ -0,0 +1,698 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WriteEntryTar = exports.WriteEntrySync = exports.WriteEntry = void 0;
const fs_1 = __importDefault(require("fs"));
const minipass_1 = require("minipass");
const path_1 = __importDefault(require("path"));
const header_js_1 = require("./header.js");
const mode_fix_js_1 = require("./mode-fix.js");
const normalize_windows_path_js_1 = require("./normalize-windows-path.js");
const options_js_1 = require("./options.js");
const pax_js_1 = require("./pax.js");
const strip_absolute_path_js_1 = require("./strip-absolute-path.js");
const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js");
const warn_method_js_1 = require("./warn-method.js");
const winchars = __importStar(require("./winchars.js"));
const prefixPath = (path, prefix) => {
if (!prefix) {
return (0, normalize_windows_path_js_1.normalizeWindowsPath)(path);
}
path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path).replace(/^\.(\/|$)/, '');
return (0, strip_trailing_slashes_js_1.stripTrailingSlashes)(prefix) + '/' + path;
};
const maxReadSize = 16 * 1024 * 1024;
const PROCESS = Symbol('process');
const FILE = Symbol('file');
const DIRECTORY = Symbol('directory');
const SYMLINK = Symbol('symlink');
const HARDLINK = Symbol('hardlink');
const HEADER = Symbol('header');
const READ = Symbol('read');
const LSTAT = Symbol('lstat');
const ONLSTAT = Symbol('onlstat');
const ONREAD = Symbol('onread');
const ONREADLINK = Symbol('onreadlink');
const OPENFILE = Symbol('openfile');
const ONOPENFILE = Symbol('onopenfile');
const CLOSE = Symbol('close');
const MODE = Symbol('mode');
const AWAITDRAIN = Symbol('awaitDrain');
const ONDRAIN = Symbol('ondrain');
const PREFIX = Symbol('prefix');
class WriteEntry extends minipass_1.Minipass {
path;
portable;
myuid = (process.getuid && process.getuid()) || 0;
// until node has builtin pwnam functions, this'll have to do
myuser = process.env.USER || '';
maxReadSize;
linkCache;
statCache;
preservePaths;
cwd;
strict;
mtime;
noPax;
noMtime;
prefix;
fd;
blockLen = 0;
blockRemain = 0;
buf;
pos = 0;
remain = 0;
length = 0;
offset = 0;
win32;
absolute;
header;
type;
linkpath;
stat;
onWriteEntry;
#hadError = false;
constructor(p, opt_ = {}) {
const opt = (0, options_js_1.dealias)(opt_);
super();
this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(p);
// suppress atime, ctime, uid, gid, uname, gname
this.portable = !!opt.portable;
this.maxReadSize = opt.maxReadSize || maxReadSize;
this.linkCache = opt.linkCache || new Map();
this.statCache = opt.statCache || new Map();
this.preservePaths = !!opt.preservePaths;
this.cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd || process.cwd());
this.strict = !!opt.strict;
this.noPax = !!opt.noPax;
this.noMtime = !!opt.noMtime;
this.mtime = opt.mtime;
this.prefix = opt.prefix ? (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.prefix) : undefined;
this.onWriteEntry = opt.onWriteEntry;
if (typeof opt.onwarn === 'function') {
this.on('warn', opt.onwarn);
}
let pathWarn = false;
if (!this.preservePaths) {
const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(this.path);
if (root && typeof stripped === 'string') {
this.path = stripped;
pathWarn = root;
}
}
this.win32 = !!opt.win32 || process.platform === 'win32';
if (this.win32) {
// force the \ to / normalization, since we might not *actually*
// be on windows, but want \ to be considered a path separator.
this.path = winchars.decode(this.path.replaceAll(/\\/g, '/'));
p = p.replaceAll(/\\/g, '/');
}
this.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.absolute || path_1.default.resolve(this.cwd, p));
if (this.path === '') {
this.path = './';
}
if (pathWarn) {
this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {
entry: this,
path: pathWarn + this.path,
});
}
const cs = this.statCache.get(this.absolute);
if (cs) {
this[ONLSTAT](cs);
}
else {
this[LSTAT]();
}
}
warn(code, message, data = {}) {
return (0, warn_method_js_1.warnMethod)(this, code, message, data);
}
emit(ev, ...data) {
if (ev === 'error') {
this.#hadError = true;
}
return super.emit(ev, ...data);
}
[LSTAT]() {
fs_1.default.lstat(this.absolute, (er, stat) => {
if (er) {
return this.emit('error', er);
}
this[ONLSTAT](stat);
});
}
[ONLSTAT](stat) {
this.statCache.set(this.absolute, stat);
this.stat = stat;
if (!stat.isFile()) {
stat.size = 0;
}
this.type = getType(stat);
this.emit('stat', stat);
this[PROCESS]();
}
[PROCESS]() {
switch (this.type) {
case 'File':
return this[FILE]();
case 'Directory':
return this[DIRECTORY]();
case 'SymbolicLink':
return this[SYMLINK]();
// unsupported types are ignored.
default:
return this.end();
}
}
[MODE](mode) {
return (0, mode_fix_js_1.modeFix)(mode, this.type === 'Directory', this.portable);
}
[PREFIX](path) {
return prefixPath(path, this.prefix);
}
[HEADER]() {
/* c8 ignore start */
if (!this.stat) {
throw new Error('cannot write header before stat');
}
/* c8 ignore stop */
if (this.type === 'Directory' && this.portable) {
this.noMtime = true;
}
this.onWriteEntry?.(this);
this.header = new header_js_1.Header({
path: this[PREFIX](this.path),
// only apply the prefix to hard links.
linkpath: this.type === 'Link' && this.linkpath !== undefined ?
this[PREFIX](this.linkpath)
: this.linkpath,
// only the permissions and setuid/setgid/sticky bitflags
// not the higher-order bits that specify file type
mode: this[MODE](this.stat.mode),
uid: this.portable ? undefined : this.stat.uid,
gid: this.portable ? undefined : this.stat.gid,
size: this.stat.size,
mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime,
/* c8 ignore next */
type: this.type === 'Unsupported' ? undefined : this.type,
uname: this.portable ? undefined
: this.stat.uid === this.myuid ? this.myuser
: '',
atime: this.portable ? undefined : this.stat.atime,
ctime: this.portable ? undefined : this.stat.ctime,
});
if (this.header.encode() && !this.noPax) {
super.write(new pax_js_1.Pax({
atime: this.portable ? undefined : this.header.atime,
ctime: this.portable ? undefined : this.header.ctime,
gid: this.portable ? undefined : this.header.gid,
mtime: this.noMtime ? undefined : this.mtime || this.header.mtime,
path: this[PREFIX](this.path),
linkpath: this.type === 'Link' && this.linkpath !== undefined ?
this[PREFIX](this.linkpath)
: this.linkpath,
size: this.header.size,
uid: this.portable ? undefined : this.header.uid,
uname: this.portable ? undefined : this.header.uname,
dev: this.portable ? undefined : this.stat.dev,
ino: this.portable ? undefined : this.stat.ino,
nlink: this.portable ? undefined : this.stat.nlink,
}).encode());
}
const block = this.header?.block;
/* c8 ignore start */
if (!block) {
throw new Error('failed to encode header');
}
/* c8 ignore stop */
super.write(block);
}
[DIRECTORY]() {
/* c8 ignore start */
if (!this.stat) {
throw new Error('cannot create directory entry without stat');
}
/* c8 ignore stop */
if (this.path.slice(-1) !== '/') {
this.path += '/';
}
this.stat.size = 0;
this[HEADER]();
this.end();
}
[SYMLINK]() {
fs_1.default.readlink(this.absolute, (er, linkpath) => {
if (er) {
return this.emit('error', er);
}
this[ONREADLINK](linkpath);
});
}
[ONREADLINK](linkpath) {
this.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(linkpath);
this[HEADER]();
this.end();
}
[HARDLINK](linkpath) {
/* c8 ignore start */
if (!this.stat) {
throw new Error('cannot create link entry without stat');
}
/* c8 ignore stop */
this.type = 'Link';
this.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.relative(this.cwd, linkpath));
this.stat.size = 0;
this[HEADER]();
this.end();
}
[FILE]() {
/* c8 ignore start */
if (!this.stat) {
throw new Error('cannot create file entry without stat');
}
/* c8 ignore stop */
if (this.stat.nlink > 1) {
const linkKey = `${this.stat.dev}:${this.stat.ino}`;
const linkpath = this.linkCache.get(linkKey);
if (linkpath?.indexOf(this.cwd) === 0) {
return this[HARDLINK](linkpath);
}
this.linkCache.set(linkKey, this.absolute);
}
this[HEADER]();
if (this.stat.size === 0) {
return this.end();
}
this[OPENFILE]();
}
[OPENFILE]() {
fs_1.default.open(this.absolute, 'r', (er, fd) => {
if (er) {
return this.emit('error', er);
}
this[ONOPENFILE](fd);
});
}
[ONOPENFILE](fd) {
this.fd = fd;
if (this.#hadError) {
return this[CLOSE]();
}
/* c8 ignore start */
if (!this.stat) {
throw new Error('should stat before calling onopenfile');
}
/* c8 ignore start */
this.blockLen = 512 * Math.ceil(this.stat.size / 512);
this.blockRemain = this.blockLen;
const bufLen = Math.min(this.blockLen, this.maxReadSize);
this.buf = Buffer.allocUnsafe(bufLen);
this.offset = 0;
this.pos = 0;
this.remain = this.stat.size;
this.length = this.buf.length;
this[READ]();
}
[READ]() {
const { fd, buf, offset, length, pos } = this;
if (fd === undefined || buf === undefined) {
throw new Error('cannot read file without first opening');
}
fs_1.default.read(fd, buf, offset, length, pos, (er, bytesRead) => {
if (er) {
// ignoring the error from close(2) is a bad practice, but at
// this point we already have an error, don't need another one
return this[CLOSE](() => this.emit('error', er));
}
this[ONREAD](bytesRead);
});
}
/* c8 ignore start */
[CLOSE](cb = () => { }) {
/* c8 ignore stop */
if (this.fd !== undefined)
fs_1.default.close(this.fd, cb);
}
[ONREAD](bytesRead) {
if (bytesRead <= 0 && this.remain > 0) {
const er = Object.assign(new Error('encountered unexpected EOF'), {
path: this.absolute,
syscall: 'read',
code: 'EOF',
});
return this[CLOSE](() => this.emit('error', er));
}
if (bytesRead > this.remain) {
const er = Object.assign(new Error('did not encounter expected EOF'), {
path: this.absolute,
syscall: 'read',
code: 'EOF',
});
return this[CLOSE](() => this.emit('error', er));
}
/* c8 ignore start */
if (!this.buf) {
throw new Error('should have created buffer prior to reading');
}
/* c8 ignore stop */
// null out the rest of the buffer, if we could fit the block padding
// at the end of this loop, we've incremented bytesRead and this.remain
// to be incremented up to the blockRemain level, as if we had expected
// to get a null-padded file, and read it until the end. then we will
// decrement both remain and blockRemain by bytesRead, and know that we
// reached the expected EOF, without any null buffer to append.
if (bytesRead === this.remain) {
for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) {
this.buf[i + this.offset] = 0;
bytesRead++;
this.remain++;
}
}
const chunk = this.offset === 0 && bytesRead === this.buf.length ?
this.buf
: this.buf.subarray(this.offset, this.offset + bytesRead);
const flushed = this.write(chunk);
if (!flushed) {
this[AWAITDRAIN](() => this[ONDRAIN]());
}
else {
this[ONDRAIN]();
}
}
[AWAITDRAIN](cb) {
this.once('drain', cb);
}
write(chunk, encoding, cb) {
/* c8 ignore start - just junk to comply with NodeJS.WritableStream */
if (typeof encoding === 'function') {
cb = encoding;
encoding = undefined;
}
if (typeof chunk === 'string') {
chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8');
}
/* c8 ignore stop */
if (this.blockRemain < chunk.length) {
const er = Object.assign(new Error('writing more data than expected'), {
path: this.absolute,
});
return this.emit('error', er);
}
this.remain -= chunk.length;
this.blockRemain -= chunk.length;
this.pos += chunk.length;
this.offset += chunk.length;
return super.write(chunk, null, cb);
}
[ONDRAIN]() {
if (!this.remain) {
if (this.blockRemain) {
super.write(Buffer.alloc(this.blockRemain));
}
return this[CLOSE](er => (er ? this.emit('error', er) : this.end()));
}
/* c8 ignore start */
if (!this.buf) {
throw new Error('buffer lost somehow in ONDRAIN');
}
/* c8 ignore stop */
if (this.offset >= this.length) {
// if we only have a smaller bit left to read, alloc a smaller buffer
// otherwise, keep it the same length it was before.
this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length));
this.offset = 0;
}
this.length = this.buf.length - this.offset;
this[READ]();
}
}
exports.WriteEntry = WriteEntry;
class WriteEntrySync extends WriteEntry {
sync = true;
[LSTAT]() {
this[ONLSTAT](fs_1.default.lstatSync(this.absolute));
}
[SYMLINK]() {
this[ONREADLINK](fs_1.default.readlinkSync(this.absolute));
}
[OPENFILE]() {
this[ONOPENFILE](fs_1.default.openSync(this.absolute, 'r'));
}
[READ]() {
let threw = true;
try {
const { fd, buf, offset, length, pos } = this;
/* c8 ignore start */
if (fd === undefined || buf === undefined) {
throw new Error('fd and buf must be set in READ method');
}
/* c8 ignore stop */
const bytesRead = fs_1.default.readSync(fd, buf, offset, length, pos);
this[ONREAD](bytesRead);
threw = false;
}
finally {
// ignoring the error from close(2) is a bad practice, but at
// this point we already have an error, don't need another one
if (threw) {
try {
this[CLOSE](() => { });
}
catch { }
}
}
}
[AWAITDRAIN](cb) {
cb();
}
/* c8 ignore start */
[CLOSE](cb = () => { }) {
/* c8 ignore stop */
if (this.fd !== undefined)
fs_1.default.closeSync(this.fd);
cb();
}
}
exports.WriteEntrySync = WriteEntrySync;
class WriteEntryTar extends minipass_1.Minipass {
blockLen = 0;
blockRemain = 0;
buf = 0;
pos = 0;
remain = 0;
length = 0;
preservePaths;
portable;
strict;
noPax;
noMtime;
readEntry;
type;
prefix;
path;
mode;
uid;
gid;
uname;
gname;
header;
mtime;
atime;
ctime;
linkpath;
size;
onWriteEntry;
warn(code, message, data = {}) {
return (0, warn_method_js_1.warnMethod)(this, code, message, data);
}
constructor(readEntry, opt_ = {}) {
const opt = (0, options_js_1.dealias)(opt_);
super();
this.preservePaths = !!opt.preservePaths;
this.portable = !!opt.portable;
this.strict = !!opt.strict;
this.noPax = !!opt.noPax;
this.noMtime = !!opt.noMtime;
this.onWriteEntry = opt.onWriteEntry;
this.readEntry = readEntry;
const { type } = readEntry;
/* c8 ignore start */
if (type === 'Unsupported') {
throw new Error('writing entry that should be ignored');
}
/* c8 ignore stop */
this.type = type;
if (this.type === 'Directory' && this.portable) {
this.noMtime = true;
}
this.prefix = opt.prefix;
this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(readEntry.path);
this.mode =
readEntry.mode !== undefined ? this[MODE](readEntry.mode) : undefined;
this.uid = this.portable ? undefined : readEntry.uid;
this.gid = this.portable ? undefined : readEntry.gid;
this.uname = this.portable ? undefined : readEntry.uname;
this.gname = this.portable ? undefined : readEntry.gname;
this.size = readEntry.size;
this.mtime = this.noMtime ? undefined : opt.mtime || readEntry.mtime;
this.atime = this.portable ? undefined : readEntry.atime;
this.ctime = this.portable ? undefined : readEntry.ctime;
this.linkpath =
readEntry.linkpath !== undefined ?
(0, normalize_windows_path_js_1.normalizeWindowsPath)(readEntry.linkpath)
: undefined;
if (typeof opt.onwarn === 'function') {
this.on('warn', opt.onwarn);
}
let pathWarn = false;
if (!this.preservePaths) {
const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(this.path);
if (root && typeof stripped === 'string') {
this.path = stripped;
pathWarn = root;
}
}
this.remain = readEntry.size;
this.blockRemain = readEntry.startBlockSize;
this.onWriteEntry?.(this);
this.header = new header_js_1.Header({
path: this[PREFIX](this.path),
linkpath: this.type === 'Link' && this.linkpath !== undefined ?
this[PREFIX](this.linkpath)
: this.linkpath,
// only the permissions and setuid/setgid/sticky bitflags
// not the higher-order bits that specify file type
mode: this.mode,
uid: this.portable ? undefined : this.uid,
gid: this.portable ? undefined : this.gid,
size: this.size,
mtime: this.noMtime ? undefined : this.mtime,
type: this.type,
uname: this.portable ? undefined : this.uname,
atime: this.portable ? undefined : this.atime,
ctime: this.portable ? undefined : this.ctime,
});
if (pathWarn) {
this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {
entry: this,
path: pathWarn + this.path,
});
}
if (this.header.encode() && !this.noPax) {
super.write(new pax_js_1.Pax({
atime: this.portable ? undefined : this.atime,
ctime: this.portable ? undefined : this.ctime,
gid: this.portable ? undefined : this.gid,
mtime: this.noMtime ? undefined : this.mtime,
path: this[PREFIX](this.path),
linkpath: this.type === 'Link' && this.linkpath !== undefined ?
this[PREFIX](this.linkpath)
: this.linkpath,
size: this.size,
uid: this.portable ? undefined : this.uid,
uname: this.portable ? undefined : this.uname,
dev: this.portable ? undefined : this.readEntry.dev,
ino: this.portable ? undefined : this.readEntry.ino,
nlink: this.portable ? undefined : this.readEntry.nlink,
}).encode());
}
const b = this.header?.block;
/* c8 ignore start */
if (!b)
throw new Error('failed to encode header');
/* c8 ignore stop */
super.write(b);
readEntry.pipe(this);
}
[PREFIX](path) {
return prefixPath(path, this.prefix);
}
[MODE](mode) {
return (0, mode_fix_js_1.modeFix)(mode, this.type === 'Directory', this.portable);
}
write(chunk, encoding, cb) {
/* c8 ignore start - just junk to comply with NodeJS.WritableStream */
if (typeof encoding === 'function') {
cb = encoding;
encoding = undefined;
}
if (typeof chunk === 'string') {
chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8');
}
/* c8 ignore stop */
const writeLen = chunk.length;
if (writeLen > this.blockRemain) {
throw new Error('writing more to entry than is appropriate');
}
this.blockRemain -= writeLen;
return super.write(chunk, cb);
}
end(chunk, encoding, cb) {
if (this.blockRemain) {
super.write(Buffer.alloc(this.blockRemain));
}
/* c8 ignore start - just junk to comply with NodeJS.WritableStream */
if (typeof chunk === 'function') {
cb = chunk;
encoding = undefined;
chunk = undefined;
}
if (typeof encoding === 'function') {
cb = encoding;
encoding = undefined;
}
if (typeof chunk === 'string') {
chunk = Buffer.from(chunk, encoding ?? 'utf8');
}
if (cb)
this.once('finish', cb);
if (chunk)
super.end(chunk, cb);
else
super.end(cb);
/* c8 ignore stop */
return this;
}
}
exports.WriteEntryTar = WriteEntryTar;
const getType = (stat) => stat.isFile() ? 'File'
: stat.isDirectory() ? 'Directory'
: stat.isSymbolicLink() ? 'SymbolicLink'
: 'Unsupported';
//# sourceMappingURL=write-entry.js.map
@@ -0,0 +1,31 @@
import { flattenedDecrypt } from '../flattened/decrypt.js';
import { JWEDecryptionFailed, JWEInvalid } from '../../util/errors.js';
import { isObject } from '../../lib/type_checks.js';
export async function generalDecrypt(jwe, key, options) {
if (!isObject(jwe)) {
throw new JWEInvalid('General JWE must be an object');
}
if (!Array.isArray(jwe.recipients) || !jwe.recipients.every(isObject)) {
throw new JWEInvalid('JWE Recipients missing or incorrect type');
}
if (!jwe.recipients.length) {
throw new JWEInvalid('JWE Recipients has no members');
}
for (const recipient of jwe.recipients) {
try {
return await flattenedDecrypt({
aad: jwe.aad,
ciphertext: jwe.ciphertext,
encrypted_key: recipient.encrypted_key,
header: recipient.header,
iv: jwe.iv,
protected: jwe.protected,
tag: jwe.tag,
unprotected: jwe.unprotected,
}, key, options);
}
catch {
}
}
throw new JWEDecryptionFailed();
}
@@ -0,0 +1 @@
{"version":3,"file":"ssePollingClient.js","sourceRoot":"","sources":["../../../../src/examples/client/ssePollingClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,gCAAgC,EAAE,MAAM,gBAAgB,CAAC;AAExF,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAE/C,KAAK,UAAU,IAAI;IACf,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,iBAAiB,UAAU,KAAK,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,6CAA6C;IAC7C,MAAM,SAAS,GAAG,IAAI,6BAA6B,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,EAAE;IACrE,wEAAwE;KAC3E,CAAC,CAAC;IAEH,wCAAwC;IACxC,IAAI,WAA+B,CAAC;IAEpC,2DAA2D;IAC3D,mDAAmD;IACnD,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE;QACxB,6CAA6C;QAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;YAAE,OAAO;QACjD,2DAA2D;QAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,CAAC;YACnD,OAAO,CAAC,GAAG,CAAC,kEAAkE,CAAC,CAAC;YAChF,OAAO;QACX,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC,CAAC;IAEF,iCAAiC;IACjC,SAAS,CAAC,OAAO,GAAG,GAAG,EAAE;QACrB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;IACjD,CAAC,CAAC;IAEF,4BAA4B;IAC5B,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACtB,IAAI,EAAE,oBAAoB;QAC1B,OAAO,EAAE,OAAO;KACnB,CAAC,CAAC;IAEH,0DAA0D;IAC1D,MAAM,CAAC,sBAAsB,CAAC,gCAAgC,EAAE,YAAY,CAAC,EAAE;QAC3E,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC;QACD,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAEhB,0BAA0B;QAC1B,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,iEAAiE,CAAC,CAAC;QAC/E,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAEhB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAC/B;YACI,MAAM,EAAE,YAAY;YACpB,MAAM,EAAE;gBACJ,IAAI,EAAE,WAAW;gBACjB,SAAS,EAAE,EAAE;aAChB;SACJ,EACD,oBAAoB,EACpB;YACI,wCAAwC;YACxC,iBAAiB,EAAE,KAAK,CAAC,EAAE;gBACvB,WAAW,GAAG,KAAK,CAAC;gBACpB,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,EAAE,CAAC,CAAC;YACvC,CAAC;SACJ,CACJ,CAAC;QAEF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACnE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,2BAA2B,WAAW,EAAE,CAAC,CAAC;IAC1D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;YAAS,CAAC;QACP,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACzC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
@@ -0,0 +1 @@
{"version":3,"file":"hostHeaderValidation.d.ts","sourceRoot":"","sources":["../../../../src/server/middleware/hostHeaderValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,cAAc,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,cAAc,CA4C/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,IAAI,cAAc,CAExD"}
@@ -0,0 +1,535 @@
export default `tlf2a$ 3 3 8 0 15 0 64 0
===============================================================================
This is pagga.tlf, or “Pagga”, by Sam Hocevar and pagga.
2010/01/17 -- Sam Hocevar <sam@hocevar.net>
font creation, all base characters
This font is free software. It comes without any warranty, to the extent
permitted by applicable law. You can redistribute it and/or modify it under
the terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
details.
This font is part of TOIlet’s official distribution. More information
on the TOIlet website at http://caca.zoy.org/wiki/toilet
===============================================================================
░░@
░░@
░░@@
░█@
░▀@
░▀@@
░▀░▀@
░░░░@
░░░░@@
░▄█▄█▄@
░▄█▄█▄@
░░▀░▀░@@
░▄█▀@
░▀██@
░▀▀░@@
░▀░█@
░▄▀░@
░▀░▀@@
░▄▀░@
░▄█▀@
░░▀▀@@
░▀@
░░@
░░@@
░▄▀░@
░█░░@
░░▀░@@
░▀▄░@
░░█░@
░▀░░@@
░▄░▄@
░▄█▄@
░▄▀▄@@
░░░░@
░▄█▄@
░░▀░@@
░░░░@
░░░░@
░▄▀░@@
░░░░@
░▄▄▄@
░░░░@@
░░░@
░░░@
░▀░@@
░░░█@
░▄▀░@
░▀░░@@
░▄▀▄@
░█/█@
░░▀░@@
░▀█░@
░░█░@
░▀▀▀@@
░▀▀▄@
░▄▀░@
░▀▀▀@@
░▀▀█@
░░▀▄@
░▀▀░@@
░█░█@
░░▀█@
░░░▀@@
░█▀▀@
░▀▀▄@
░▀▀░@@
░▄▀▀@
░█▀▄@
░░▀░@@
░▀▀█@
░▄▀░@
░▀░░@@
░▄▀▄@
░▄▀▄@
░░▀░@@
░▄▀▄@
░░▀█@
░▀▀░@@
░░░░@
░░▀░@
░░▀░@@
░░░░@
░░▀░@
░▄▀░@@
░░▄▀@
░▀▄░@
░░░▀@@
░░░░@
░▀▀▀@
░▀▀▀@@
░▀▄░@
░░▄▀@
░▀░░@@
░▀▀█@
░░▀░@
░░▀░@@
░▄▀▄@
░█▀▀@
░░▀░@@
░█▀█@
░█▀█@
░▀░▀@@
░█▀▄@
░█▀▄@
░▀▀░@@
░█▀▀@
░█░░@
░▀▀▀@@
░█▀▄@
░█░█@
░▀▀░@@
░█▀▀@
░█▀▀@
░▀▀▀@@
░█▀▀@
░█▀▀@
░▀░░@@
░█▀▀@
░█░█@
░▀▀▀@@
░█░█@
░█▀█@
░▀░▀@@
░▀█▀@
░░█░@
░▀▀▀@@
░▀▀█@
░░░█@
░▀▀░@@
░█░█@
░█▀▄@
░▀░▀@@
░█░░@
░█░░@
░▀▀▀@@
░█▄█@
░█░█@
░▀░▀@@
░█▀█@
░█░█@
░▀░▀@@
░█▀█@
░█░█@
░▀▀▀@@
░█▀█@
░█▀▀@
░▀░░@@
░▄▀▄@
░█\\█@
░░▀\\@@
░█▀▄@
░█▀▄@
░▀░▀@@
░█▀▀@
░▀▀█@
░▀▀▀@@
░▀█▀@
░░█░@
░░▀░@@
░█░█@
░█░█@
░▀▀▀@@
░█░█@
░▀▄▀@
░░▀░@@
░█░█@
░█▄█@
░▀░▀@@
░█░█@
░▄▀▄@
░▀░▀@@
░█░█@
░░█░@
░░▀░@@
░▀▀█@
░▄▀░@
░▀▀▀@@
░█▀░@
░█░░@
░▀▀░@@
░█░░@
░░▀▄@
░░░▀@@
░▀█░@
░░█░@
░▀▀░@@
░▄▀▄@
░░░░@
░░░░@@
░░░░@
░░░░@
░▀▀▀@@
░▀▄@
░░░@
░░░@@
░█▀█@
░█▀█@
░▀░▀@@
░█▀▄@
░█▀▄@
░▀▀░@@
░█▀▀@
░█░░@
░▀▀▀@@
░█▀▄@
░█░█@
░▀▀░@@
░█▀▀@
░█▀▀@
░▀▀▀@@
░█▀▀@
░█▀▀@
░▀░░@@
░█▀▀@
░█░█@
░▀▀▀@@
░█░█@
░█▀█@
░▀░▀@@
░▀█▀@
░░█░@
░▀▀▀@@
░▀▀█@
░░░█@
░▀▀░@@
░█░█@
░█▀▄@
░▀░▀@@
░█░░@
░█░░@
░▀▀▀@@
░█▄█@
░█░█@
░▀░▀@@
░█▀█@
░█░█@
░▀░▀@@
░█▀█@
░█░█@
░▀▀▀@@
░█▀█@
░█▀▀@
░▀░░@@
░▄▀▄@
░█\\█@
░░▀\\@@
░█▀▄@
░█▀▄@
░▀░▀@@
░█▀▀@
░▀▀█@
░▀▀▀@@
░▀█▀@
░░█░@
░░▀░@@
░█░█@
░█░█@
░▀▀▀@@
░█░█@
░▀▄▀@
░░▀░@@
░█░█@
░█▄█@
░▀░▀@@
░█░█@
░▄▀▄@
░▀░▀@@
░█░█@
░░█░@
░░▀░@@
░▀▀█@
░▄▀░@
░▀▀▀@@
░░█▀@
░▀▄░@
░░▀▀@@
░░█░@
░░█░@
░░▀░@@
░▀█░@
░░▄▀@
░▀▀░@@
░▄▀▄▀@
░░░░░@
░░░░░@@
░█▀█@
░█▀█@
░▀░▀@@
░█▀█@
░█░█@
░▀▀▀@@
░█░█@
░█░█@
░▀▀▀@@
░█▀█@
░█▀█@
░▀░▀@@
░█▀█@
░█░█@
░▀▀▀@@
░█░█@
░█░█@
░▀▀▀@@
░█▀▀░█▀▀@
░▀▀█░▀▀█@
░▀▀▀░▀▀▀@@
0x00C0 À LATIN CAPITAL LETTER A WITH GRAVE
░█▀█@
░█▀█@
░▀░▀@@
0x00C1 Á LATIN CAPITAL LETTER A WITH ACUTE
░█▀█@
░█▀█@
░▀░▀@@
0x00C2 Â LATIN CAPITAL LETTER A WITH CIRCUMFLEX
░█▀█@
░█▀█@
░▀░▀@@
0x00C3 Ã LATIN CAPITAL LETTER A WITH TILDE
░█▀█@
░█▀█@
░▀░▀@@
0x00C5 Å LATIN CAPITAL LETTER A WITH RING ABOVE
░█▀█@
░█▀█@
░▀░▀@@
0x00C6 Æ LATIN CAPITAL LETTER AE
░█▀█▀▀@
░█▀█▀▀@
░▀░▀▀▀@@
0x00C7 Ç LATIN CAPITAL LETTER C WITH CEDILLA
░█▀▀@
░█░░@
░▀▀▀@@
0x00C8 È LATIN CAPITAL LETTER E WITH GRAVE
░█▀▀@
░█▀▀@
░▀▀▀@@
0x00C9 É LATIN CAPITAL LETTER E WITH ACUTE
░█▀▀@
░█▀▀@
░▀▀▀@@
0x00CA Ê LATIN CAPITAL LETTER E WITH CIRCUMFLEX
░█▀▀@
░█▀▀@
░▀▀▀@@
0x00CB Ë LATIN CAPITAL LETTER E WITH DIAERESIS
░█▀▀@
░█▀▀@
░▀▀▀@@
0x00CC Ì LATIN CAPITAL LETTER I WITH GRAVE
░▀█▀@
░░█░@
░▀▀▀@@
0x00CD Í LATIN CAPITAL LETTER I WITH ACUTE
░▀█▀@
░░█░@
░▀▀▀@@
0x00CE Î LATIN CAPITAL LETTER I WITH CIRCUMFLEX
░▀█▀@
░░█░@
░▀▀▀@@
0x00CF Ï LATIN CAPITAL LETTER I WITH DIAERESIS
░▀█▀@
░░█░@
░▀▀▀@@
0x00D1 Ñ LATIN CAPITAL LETTER N WITH TILDE
░█▀█@
░█░█@
░▀░▀@@
0x00D2 Ò LATIN CAPITAL LETTER O WITH GRAVE
░█▀█@
░█░█@
░▀▀▀@@
0x00D3 Ó LATIN CAPITAL LETTER O WITH ACUTE
░█▀█@
░█░█@
░▀▀▀@@
0x00D4 Ô LATIN CAPITAL LETTER O WITH CIRCUMFLEX
░█▀█@
░█░█@
░▀▀▀@@
0x00D5 Õ LATIN CAPITAL LETTER O WITH TILDE
░█▀█@
░█░█@
░▀▀▀@@
0x00D8 Ø LATIN CAPITAL LETTER O WITH STROKE
░█▀█@
░█░█@
░▀▀▀@@
0x00D9 Ù LATIN CAPITAL LETTER U WITH GRAVE
░█░█@
░█░█@
░▀▀▀@@
0x00DA Ú LATIN CAPITAL LETTER U WITH ACUTE
░█░█@
░█░█@
░▀▀▀@@
0x00DB Û LATIN CAPITAL LETTER U WITH CIRCUMFLEX
░█░█@
░█░█@
░▀▀▀@@
0x00DD Ý LATIN CAPITAL LETTER Y WITH ACUTE
░█░█@
░░█░@
░░▀░@@
0x00E0 à LATIN SMALL LETTER A WITH GRAVE
░█▀█@
░█▀█@
░▀░▀@@
0x00E1 á LATIN SMALL LETTER A WITH ACUTE
░█▀█@
░█▀█@
░▀░▀@@
0x00E2 â LATIN SMALL LETTER A WITH CIRCUMFLEX
░█▀█@
░█▀█@
░▀░▀@@
0x00E3 ã LATIN SMALL LETTER A WITH TILDE
░█▀█@
░█▀█@
░▀░▀@@
0x00E5 å LATIN SMALL LETTER A WITH RING ABOVE
░█▀█@
░█▀█@
░▀░▀@@
0x00E6 æ LATIN SMALL LETTER AE
░█▀█▀▀@
░█▀█▀▀@
░▀░▀▀▀@@
0x00E7 ç LATIN SMALL LETTER C WITH CEDILLA
░█▀▀@
░█░░@
░▀▀▀@@
0x00E8 è LATIN SMALL LETTER E WITH GRAVE
░█▀▀@
░█▀▀@
░▀▀▀@@
0x00E9 é LATIN SMALL LETTER E WITH ACUTE
░█▀▀@
░█▀▀@
░▀▀▀@@
0x00EA ê LATIN SMALL LETTER E WITH CIRCUMFLEX
░█▀▀@
░█▀▀@
░▀▀▀@@
0x00EB ë LATIN SMALL LETTER E WITH DIAERESIS
░█▀▀@
░█▀▀@
░▀▀▀@@
0x00EC ì LATIN SMALL LETTER I WITH GRAVE
░▀█▀@
░░█░@
░▀▀▀@@
0x00ED í LATIN SMALL LETTER I WITH ACUTE
░▀█▀@
░░█░@
░▀▀▀@@
0x00EE î LATIN SMALL LETTER I WITH CIRCUMFLEX
░▀█▀@
░░█░@
░▀▀▀@@
0x00EF ï LATIN SMALL LETTER I WITH DIAERESIS
░▀█▀@
░░█░@
░▀▀▀@@
0x00F1 ñ LATIN SMALL LETTER N WITH TILDE
░█▀█@
░█░█@
░▀░▀@@
0x00F2 ò LATIN SMALL LETTER O WITH GRAVE
░█▀█@
░█░█@
░▀▀▀@@
0x00F3 ó LATIN SMALL LETTER O WITH ACUTE
░█▀█@
░█░█@
░▀▀▀@@
0x00F4 ô LATIN SMALL LETTER O WITH CIRCUMFLEX
░█▀█@
░█░█@
░▀▀▀@@
0x00F5 õ LATIN SMALL LETTER O WITH TILDE
░█▀█@
░█░█@
░▀▀▀@@
0x00F8 ø LATIN SMALL LETTER O WITH STROKE
░█▀█@
░█░█@
░▀▀▀@@
0x00F9 ù LATIN SMALL LETTER U WITH GRAVE
░█░█@
░█░█@
░▀▀▀@@
0x00FA ú LATIN SMALL LETTER U WITH ACUTE
░█░█@
░█░█@
░▀▀▀@@
0x00FB û LATIN SMALL LETTER U WITH CIRCUMFLEX
░█░█@
░█░█@
░▀▀▀@@
0x00FC ü LATIN SMALL LETTER U WITH DIAERESIS
░█░█@
░█░█@
░▀▀▀@@
0x00FD ý LATIN SMALL LETTER Y WITH ACUTE
░█░█@
░░█░@
░░▀░@@
0x00FF ÿ LATIN SMALL LETTER Y WITH DIAERESIS
░█░█@
░░█░@
░░▀░@@
0x0153 œ LATIN SMALL LIGATURE OE
░█▀█▀▀@
░█░█▀▀@
░▀▀▀▀▀@@
`
@@ -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 FileInput = createLucideIcon("FileInput", [
["path", { d: "M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4", key: "1pf5j1" }],
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
["path", { d: "M2 15h10", key: "jfw4w8" }],
["path", { d: "m9 18 3-3-3-3", key: "112psh" }]
]);
export { FileInput as default };
//# sourceMappingURL=file-input.js.map
@@ -0,0 +1,386 @@
# H2CClient
<!--introduced_in=v7.7.0-->
<!--type=module-->
<!-- source_link=lib/dispatcher/h2c-client.js -->
> Stability: 2 - Stable
An `H2CClient` is a [`Dispatcher`][] that speaks HTTP/2 in cleartext (h2c) over a
single TCP connection to an `http:` origin, without the protocol upgrade or prior
knowledge negotiation that a regular [`Client`][] performs. It is a thin
specialization of [`Client`][] that forces `allowH2` and `useH2c` on and aliases
`pipelining` to `maxConcurrentStreams`, so multiple requests are multiplexed as
HTTP/2 streams rather than pipelined HTTP/1.x requests.
Use an `H2CClient` when the server is known to accept cleartext HTTP/2 directly,
for example a service behind a trusted proxy or in a test environment. Only the
`http:` protocol is supported; passing any other protocol throws
`InvalidArgumentError`.
```mjs
import { H2CClient } from 'undici'
const client = new H2CClient('http://localhost:3000')
const { statusCode, body } = await client.request({ path: '/', method: 'GET' })
console.log(statusCode)
console.log(await body.text())
```
## Class: `H2CClient`
<!-- YAML
added: v7.7.0
changes:
- version: v7.17.0
pr-url: https://github.com/nodejs/undici/pull/4690
description: Added support for h2c over Unix domain sockets.
-->
* Extends: {Client}
`H2CClient` inherits the full instance API of [`Client`][] (and therefore of
[`Dispatcher`][]). The sections below cover the surface that is meaningful for an
h2c client; refer to [`Dispatcher`][] for the complete semantics of each method
and event.
### `new H2CClient(url[, options])`
<!-- YAML
added: v7.7.0
-->
* `url` {URL|string} The origin to connect to. Should include only the protocol,
hostname, and port. Only the `http:` protocol is supported.
* `options` {H2CClientOptions} (optional)
* `maxConcurrentStreams` {number} The maximum number of concurrent HTTP/2
streams for the session. The server's `SETTINGS_MAX_CONCURRENT_STREAMS` can
lower this limit, but not raise it. Must be a positive integer.
**Default:** `100`.
* `pipelining` {number} The number of concurrent requests multiplexed over the
single connection. For an `H2CClient` this is aliased to
`maxConcurrentStreams` and may not exceed it. Must be a positive integer.
**Default:** `100`.
* `maxHeaderSize` {number} The maximum length of request headers in bytes.
**Default:** Node.js' `--max-http-header-size` or `16384` (16 KiB).
* `headersTimeout` {number} The amount of time, in milliseconds, the parser
waits to receive the complete HTTP headers. **Default:** `300e3`.
* `connectTimeout` {number} The timeout for establishing a socket connection,
in milliseconds. Use `0` to disable it entirely. **Default:** `10e3`.
* `bodyTimeout` {number} The timeout, in milliseconds, after which a request
times out. Monitors the time between received body data. Use `0` to disable
it entirely. **Default:** `300e3`.
* `keepAliveTimeout` {number} The timeout, in milliseconds, after which a
socket without active requests times out. May be overridden by _keep-alive_
hints from the server. **Default:** `4e3`.
* `keepAliveMaxTimeout` {number} The maximum allowed `keepAliveTimeout`, in
milliseconds, when overridden by _keep-alive_ hints from the server.
**Default:** `600e3`.
* `keepAliveTimeoutThreshold` {number} A number of milliseconds subtracted from
server _keep-alive_ hints when overriding `keepAliveTimeout`, to account for
timing inaccuracies such as transport latency. **Default:** `1e3`.
* `socketPath` {string} An IPC endpoint, either a Unix domain socket or a
Windows named pipe. **Default:** `null`.
* `strictContentLength` {boolean} If `true`, an error is thrown when the
request `content-length` header does not match the length of the request
body. **Default:** `true`.
* `maxCachedSessions` {number} The maximum number of TLS sessions cached by the
built-in connector. Use `0` to disable TLS session caching. **Default:** `100`.
* `connect` {Object|Function} Connector options passed to `buildConnector`, or
a custom connector function. The `allowH2` option may not be set here.
**Default:** `null`.
* `maxRequestsPerClient` {number} The maximum number of requests to send over
a single connection before it is reset. Use `0` to disable this limit.
**Default:** `null`.
* `localAddress` {string} The local IP address the socket should connect from.
* `maxResponseSize` {number} The maximum allowed response body size in bytes.
Use `-1` to disable. **Default:** `-1`.
* `autoSelectFamily` {boolean} Enables a family autodetection algorithm that
loosely implements section 5 of [RFC 8305][]. Ignored if not supported by the
current Node.js version.
* `autoSelectFamilyAttemptTimeout` {number} The amount of time, in
milliseconds, to wait for a connection attempt to finish before trying the
next address when `autoSelectFamily` is enabled.
Creates a new `H2CClient` for the given origin. The client does not connect until
a request is queued; call [`h2cClient.connect()`](#h2cclientconnectoptions-callback)
to connect eagerly.
```mjs
import { H2CClient } from 'undici'
const client = new H2CClient('http://localhost:3000')
```
### `h2cClient.close([callback])`
<!-- YAML
added: v7.7.0
-->
* `callback` {Function} (optional) Invoked once all queued requests have settled
and the client is closed.
* Returns: {Promise|undefined} A `Promise` that resolves once the client is
closed, when `callback` is not provided.
Closes the client and gracefully waits for enqueued requests to complete before
resolving. See [`dispatcher.close([callback])`][].
### `h2cClient.destroy([error[, callback]])`
<!-- YAML
added: v7.7.0
-->
* `error` {Error} (optional) The error with which to reject pending requests.
**Default:** `null`.
* `callback` {Function} (optional) Invoked once the client is destroyed.
* Returns: {Promise|undefined} A `Promise` that resolves once the client is
destroyed, when `callback` is not provided.
Destroys the client abruptly, aborting any pending requests. Waits until the
socket is closed before invoking `callback` (or resolving the returned `Promise`).
See [`dispatcher.destroy([error[, callback]])`][].
### `h2cClient.connect(options[, callback])`
<!-- YAML
added: v7.7.0
-->
* `options` {Object}
* `path` {string}
* `headers` {Object} (optional) **Default:** `null`.
* `signal` {AbortSignal|EventEmitter|null} (optional) **Default:** `null`.
* `opaque` {any} (optional) An opaque value passed through to the returned
connect data.
* `responseHeaders` {string|null} (optional) Set to `'raw'` to return the
response headers as a raw array instead of an object. **Default:** `null`.
* `callback` {Function} (optional) Invoked with `(err, data)` once the connection
is established. If omitted, a `Promise` is returned instead.
* Returns: {Promise|undefined} A `Promise` resolving to the connect data, when
`callback` is not provided.
Starts an HTTP `CONNECT` request. See [`dispatcher.connect(options[, callback])`][].
### `h2cClient.dispatch(options, handlers)`
<!-- YAML
added: v7.7.0
-->
* `options` {Object} The request options.
* `handlers` {Object} The dispatch handler callbacks.
* Returns: {boolean} `false` if the dispatcher is busy and the caller should wait
for the [`'drain'`](#event-drain) event before dispatching again.
The lowest-level request API. All other request methods are implemented on top of
it. See [`dispatcher.dispatch(options, handler)`][].
### `h2cClient.pipeline(options, handler)`
<!-- YAML
added: v7.7.0
-->
* `options` {Object} The request options.
* `handler` {Function} A handler that receives the response data and returns a
{Readable} body.
* Returns: {Duplex} A duplex stream for the request body and response body.
Sends a request and returns a duplex stream, suitable for piping. See
[`dispatcher.pipeline(options, handler)`][].
### `h2cClient.request(options[, callback])`
<!-- YAML
added: v7.7.0
-->
* `options` {Object} The request options.
* `callback` {Function} (optional) Invoked with `(err, data)` once the response
is received. If omitted, a `Promise` is returned instead.
* Returns: {Promise|undefined} A `Promise` resolving to the response data, when
`callback` is not provided.
Performs an HTTP request. See [`dispatcher.request(options[, callback])`][].
### `h2cClient.stream(options, factory[, callback])`
<!-- YAML
added: v7.7.0
-->
* `options` {Object} The request options.
* `factory` {Function} A factory that returns a {Writable} to which the response
body is written.
* `callback` {Function} (optional) Invoked once the request completes. If
omitted, a `Promise` is returned instead.
* Returns: {Promise|undefined} A `Promise` that resolves once the request
completes, when `callback` is not provided.
Sends a request and writes the response body to the stream returned by `factory`.
See [`dispatcher.stream(options, factory[, callback])`][].
### `h2cClient.upgrade(options[, callback])`
<!-- YAML
added: v7.7.0
-->
* `options` {Object} The request options.
* `callback` {Function} (optional) Invoked with `(err, data)` once the upgrade
completes. If omitted, a `Promise` is returned instead.
* Returns: {Promise|undefined} A `Promise` resolving to the upgrade data, when
`callback` is not provided.
Upgrades a connection to a different protocol. See
[`dispatcher.upgrade(options[, callback])`][].
### `h2cClient.closed`
<!-- YAML
added: v7.7.0
-->
* Type: {boolean}
`true` after [`h2cClient.close()`](#h2cclientclosecallback) has been called.
### `h2cClient.destroyed`
<!-- YAML
added: v7.7.0
-->
* Type: {boolean}
`true` after [`h2cClient.destroy()`](#h2cclientdestroyerror-callback) has been
called, or after [`h2cClient.close()`](#h2cclientclosecallback) has been called
and the client shutdown has completed.
### `h2cClient.pipelining`
<!-- YAML
added: v7.7.0
-->
* Type: {number}
Gets and sets the pipelining factor, i.e. the number of requests multiplexed over
the connection.
### Event: `'connect'`
<!-- YAML
added: v7.7.0
-->
* `origin` {URL}
* `targets` {Array<Dispatcher>}
Emitted when the socket has been created and connected. The client connects once
`client.size > 0`. See [Dispatcher Event: `'connect'`][].
```mjs
import { createServer } from 'node:http2'
import { once } from 'node:events'
import { H2CClient } from 'undici'
const server = createServer((request, response) => {
response.end('Hello, World!')
}).listen()
await once(server, 'listening')
const client = new H2CClient(`http://localhost:${server.address().port}`)
client.on('connect', (origin) => {
console.log(`Connected to ${origin}`)
})
const { body } = await client.request({ path: '/', method: 'GET' })
console.log(await body.text())
client.close()
server.close()
```
### Event: `'disconnect'`
<!-- YAML
added: v7.7.0
-->
* `origin` {URL}
* `targets` {Array<Dispatcher>}
* `error` {Error}
Emitted when the socket has disconnected. The `error` argument is the error that
caused the socket to disconnect. The client reconnects if (or once)
`client.size > 0`. See [Dispatcher Event: `'disconnect'`][].
```mjs
import { createServer } from 'node:http2'
import { once } from 'node:events'
import { H2CClient } from 'undici'
const server = createServer((request, response) => {
response.destroy()
}).listen()
await once(server, 'listening')
const client = new H2CClient(`http://localhost:${server.address().port}`)
client.on('disconnect', (origin) => {
console.log(`Disconnected from ${origin}`)
})
try {
await client.request({ path: '/', method: 'GET' })
} catch (error) {
console.error(error.message)
} finally {
client.close()
server.close()
}
```
### Event: `'drain'`
<!-- YAML
added: v7.7.0
-->
* `origin` {URL}
Emitted when the client is no longer busy and can accept more requests. See
[Dispatcher Event: `'drain'`][].
### Event: `'error'`
<!-- YAML
added: v7.7.0
-->
* `error` {Error}
Emitted for user errors, such as an error thrown from an `onResponseError`
handler.
[RFC 8305]: https://tools.ietf.org/html/rfc8305#section-5
[Dispatcher Event: `'connect'`]: Dispatcher.md#event-connect
[Dispatcher Event: `'disconnect'`]: Dispatcher.md#event-disconnect
[Dispatcher Event: `'drain'`]: Dispatcher.md#event-drain
[`Client`]: Client.md#class-client
[`Dispatcher`]: Dispatcher.md#class-dispatcher
[`dispatcher.close([callback])`]: Dispatcher.md#dispatcherclosecallback
[`dispatcher.connect(options[, callback])`]: Dispatcher.md#dispatcherconnectoptions-callback
[`dispatcher.destroy([error[, callback]])`]: Dispatcher.md#dispatcherdestroyerror-callback
[`dispatcher.dispatch(options, handler)`]: Dispatcher.md#dispatcherdispatchoptions-handler
[`dispatcher.pipeline(options, handler)`]: Dispatcher.md#dispatcherpipelineoptions-handler
[`dispatcher.request(options[, callback])`]: Dispatcher.md#dispatcherrequestoptions-callback
[`dispatcher.stream(options, factory[, callback])`]: Dispatcher.md#dispatcherstreamoptions-factory-callback
[`dispatcher.upgrade(options[, callback])`]: Dispatcher.md#dispatcherupgradeoptions-callback
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const FilterX = createLucideIcon("FilterX", [
["path", { d: "M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055", key: "1fi1da" }],
["path", { d: "m22 3-5 5", key: "12jva0" }],
["path", { d: "m17 3 5 5", key: "k36vhe" }]
]);
export { FilterX as default };
//# sourceMappingURL=filter-x.js.map
@@ -0,0 +1 @@
{"version":3,"file":"shuffle.js","sources":["../../../src/icons/shuffle.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Shuffle\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTggMTQgNCA0LTQgNCIgLz4KICA8cGF0aCBkPSJtMTggMiA0IDQtNCA0IiAvPgogIDxwYXRoIGQ9Ik0yIDE4aDEuOTczYTQgNCAwIDAgMCAzLjMtMS43bDUuNDU0LTguNmE0IDQgMCAwIDEgMy4zLTEuN0gyMiIgLz4KICA8cGF0aCBkPSJNMiA2aDEuOTcyYTQgNCAwIDAgMSAzLjYgMi4yIiAvPgogIDxwYXRoIGQ9Ik0yMiAxOGgtNi4wNDFhNCA0IDAgMCAxLTMuMy0xLjhsLS4zNTktLjQ1IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/shuffle\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 Shuffle = createLucideIcon('Shuffle', [\n ['path', { d: 'm18 14 4 4-4 4', key: '10pe0f' }],\n ['path', { d: 'm18 2 4 4-4 4', key: 'pucp1d' }],\n ['path', { d: 'M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22', key: '1ailkh' }],\n ['path', { d: 'M2 6h1.972a4 4 0 0 1 3.6 2.2', key: 'km57vx' }],\n ['path', { d: 'M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45', key: 'os18l9' }],\n]);\n\nexport default Shuffle;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC/C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAC7F,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,CAAA;AAAA,CAAA,CAC7D,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;AAC5E,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,10 @@
/**
* Example MCP server using Hono with WebStandardStreamableHTTPServerTransport
*
* This example demonstrates using the Web Standard transport directly with Hono,
* which works on any runtime: Node.js, Cloudflare Workers, Deno, Bun, etc.
*
* Run with: npx tsx src/examples/server/honoWebStandardStreamableHttp.ts
*/
export {};
//# sourceMappingURL=honoWebStandardStreamableHttp.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"folder-kanban.js","sources":["../../../src/icons/folder-kanban.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name FolderKanban\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNCAyMGgxNmEyIDIgMCAwIDAgMi0yVjhhMiAyIDAgMCAwLTItMmgtNy45M2EyIDIgMCAwIDEtMS42Ni0uOWwtLjgyLTEuMkEyIDIgMCAwIDAgNy45MyAzSDRhMiAyIDAgMCAwLTIgMnYxM2MwIDEuMS45IDIgMiAyWiIgLz4KICA8cGF0aCBkPSJNOCAxMHY0IiAvPgogIDxwYXRoIGQ9Ik0xMiAxMHYyIiAvPgogIDxwYXRoIGQ9Ik0xNiAxMHY2IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/folder-kanban\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 FolderKanban = createLucideIcon('FolderKanban', [\n [\n 'path',\n {\n d: 'M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z',\n key: '1fr9dc',\n },\n ],\n ['path', { d: 'M8 10v4', key: 'tgpxqk' }],\n ['path', { d: 'M12 10v2', key: 'hh53o1' }],\n ['path', { d: 'M16 10v6', key: '1d6xys' }],\n]);\n\nexport default FolderKanban;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,iBAAiB,cAAgB,CAAA,CAAA,CAAA;AAAA,CACpD,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;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,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,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,142 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const util = __importStar(require("../core/util.cjs"));
const error = () => {
const Sizable = {
string: { unit: "តួអក្សរ", verb: "គួរមាន" },
file: { unit: "បៃ", verb: "គួរមាន" },
array: { unit: "ធាតុ", verb: "គួរមាន" },
set: { unit: "ធាតុ", verb: "គួរមាន" },
map: { unit: "ធាតុ", verb: "គួរមាន" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "ទិន្នន័យបញ្ចូល",
email: "អាសយដ្ឋានអ៊ីមែល",
url: "URL",
emoji: "សញ្ញាអារម្មណ៍",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "កាលបរិច្ឆេទ និងម៉ោង ISO",
date: "កាលបរិច្ឆេទ ISO",
time: "ម៉ោង ISO",
duration: "រយៈពេល ISO",
ipv4: "អាសយដ្ឋាន IPv4",
ipv6: "អាសយដ្ឋាន IPv6",
mac: "អាសយដ្ឋាន MAC",
cidrv4: "ដែនអាសយដ្ឋាន IPv4",
cidrv6: "ដែនអាសយដ្ឋាន IPv6",
base64: "ខ្សែអក្សរអ៊ិកូដ base64",
base64url: "ខ្សែអក្សរអ៊ិកូដ base64url",
json_string: "ខ្សែអក្សរ JSON",
e164: "លេខ E.164",
credit_card: "លេខប័ណ្ណឥណទាន",
currency_code: "កូដរូបិយប័ណ្ណ",
iban: "IBAN",
jwt: "JWT",
template_literal: "ទិន្នន័យបញ្ចូល",
};
const TypeDictionary = {
nan: "NaN",
number: "លេខ",
array: "អារេ (Array)",
null: "គ្មានតម្លៃ (null)",
};
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = TypeDictionary[issue.expected] ?? issue.expected;
const receivedType = util.parsedType(issue.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue.expected)) {
return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${issue.expected} ប៉ុន្តែទទួលបាន ${received}`;
}
return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${expected} ប៉ុន្តែទទួលបាន ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${util.stringifyPrimitive(issue.values[0])}`;
return `ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `ធំពេក៖ ត្រូវការ ${issue.origin ?? "តម្លៃ"} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "ធាតុ"}`;
return `ធំពេក៖ ត្រូវការ ${issue.origin ?? "តម្លៃ"} ${adj} ${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `តូចពេក៖ ត្រូវការ ${issue.origin} ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
}
return `តូចពេក៖ ត្រូវការ ${issue.origin} ${adj} ${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with") {
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${_issue.suffix}"`;
if (_issue.format === "includes")
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${_issue.includes}"`;
if (_issue.format === "regex")
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${_issue.pattern}`;
return `មិនត្រឹមត្រូវ៖ ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${issue.divisor}`;
case "unrecognized_keys":
return `រកឃើញសោមិនស្គាល់៖ ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `សោមិនត្រឹមត្រូវនៅក្នុង ${issue.origin}`;
case "invalid_union":
return `ទិន្នន័យមិនត្រឹមត្រូវ`;
case "invalid_element":
return `ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${issue.origin}`;
default:
return `ទិន្នន័យមិនត្រឹមត្រូវ`;
}
};
};
function default_1() {
return {
localeError: error(),
};
}
module.exports = exports.default;
@@ -0,0 +1 @@
{"version":3,"file":"file-text.js","sources":["../../../src/icons/file-text.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name FileText\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTUgMkg2YTIgMiAwIDAgMC0yIDJ2MTZhMiAyIDAgMCAwIDIgMmgxMmEyIDIgMCAwIDAgMi0yVjdaIiAvPgogIDxwYXRoIGQ9Ik0xNCAydjRhMiAyIDAgMCAwIDIgMmg0IiAvPgogIDxwYXRoIGQ9Ik0xMCA5SDgiIC8+CiAgPHBhdGggZD0iTTE2IDEzSDgiIC8+CiAgPHBhdGggZD0iTTE2IDE3SDgiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/file-text\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 FileText = createLucideIcon('FileText', [\n ['path', { d: 'M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z', key: '1rqfz7' }],\n ['path', { d: 'M14 2v4a2 2 0 0 0 2 2h4', key: 'tnqrlb' }],\n ['path', { d: 'M10 9H8', key: 'b1mrlr' }],\n ['path', { d: 'M16 13H8', key: 't4e002' }],\n ['path', { d: 'M16 17H8', key: 'z1uh3a' }],\n]);\n\nexport default FileText;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA8D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAC3F,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxD,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,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,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 ReceiptSwissFranc = createLucideIcon("ReceiptSwissFranc", [
[
"path",
{ d: "M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z", key: "q3az6g" }
],
["path", { d: "M10 17V7h5", key: "k7jq18" }],
["path", { d: "M10 11h4", key: "1i0mka" }],
["path", { d: "M8 15h5", key: "vxg57a" }]
]);
export { ReceiptSwissFranc as default };
//# sourceMappingURL=receipt-swiss-franc.js.map
@@ -0,0 +1 @@
{"version":3,"file":"mic-2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,197 @@
/**
* @fileoverview Rule to enforce requiring named capture groups in regular expression.
* @author Pig Fang <https://github.com/g-plane>
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const {
CALL,
CONSTRUCT,
ReferenceTracker,
getStringIfConstant,
} = require("@eslint-community/eslint-utils");
const regexpp = require("@eslint-community/regexpp");
//------------------------------------------------------------------------------
// Typedefs
//------------------------------------------------------------------------------
/** @import { SuggestedEdit } from "@eslint/core"; */
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const parser = new regexpp.RegExpParser();
/**
* Creates fixer suggestions for the regex, if statically determinable.
* @param {number} groupStart Starting index of the regex group.
* @param {string} pattern The regular expression pattern to be checked.
* @param {string} rawText Source text of the regexNode.
* @param {ASTNode} regexNode AST node which contains the regular expression.
* @returns {Array<SuggestedEdit>} Fixer suggestions for the regex, if statically determinable.
*/
function suggestIfPossible(groupStart, pattern, rawText, regexNode) {
switch (regexNode.type) {
case "Literal":
if (typeof regexNode.value === "string" && rawText.includes("\\")) {
return null;
}
break;
case "TemplateLiteral":
if (
regexNode.expressions.length ||
rawText.slice(1, -1) !== pattern
) {
return null;
}
break;
default:
return null;
}
const start = regexNode.range[0] + groupStart + 2;
return [
{
fix(fixer) {
const existingTemps = pattern.match(/temp\d+/gu) || [];
const highestTempCount = existingTemps.reduce(
(previous, next) =>
Math.max(previous, Number(next.slice("temp".length))),
0,
);
return fixer.insertTextBeforeRange(
[start, start],
`?<temp${highestTempCount + 1}>`,
);
},
messageId: "addGroupName",
},
{
fix(fixer) {
return fixer.insertTextBeforeRange([start, start], "?:");
},
messageId: "addNonCapture",
},
];
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"Enforce using named capture group in regular expression",
recommended: false,
url: "https://eslint.org/docs/latest/rules/prefer-named-capture-group",
},
hasSuggestions: true,
schema: [],
messages: {
addGroupName: "Add name to capture group.",
addNonCapture: "Convert group to non-capturing.",
required:
"Capture group '{{group}}' should be converted to a named or non-capturing group.",
},
},
create(context) {
const sourceCode = context.sourceCode;
/**
* Function to check regular expression.
* @param {string} pattern The regular expression pattern to be checked.
* @param {ASTNode} node AST node which contains the regular expression or a call/new expression.
* @param {ASTNode} regexNode AST node which contains the regular expression.
* @param {string|null} flags The regular expression flags to be checked.
* @returns {void}
*/
function checkRegex(pattern, node, regexNode, flags) {
let ast;
try {
ast = parser.parsePattern(pattern, 0, pattern.length, {
unicode: Boolean(flags && flags.includes("u")),
unicodeSets: Boolean(flags && flags.includes("v")),
});
} catch {
// ignore regex syntax errors
return;
}
regexpp.visitRegExpAST(ast, {
onCapturingGroupEnter(group) {
if (!group.name) {
const rawText = sourceCode.getText(regexNode);
const suggest = suggestIfPossible(
group.start,
pattern,
rawText,
regexNode,
);
context.report({
node,
messageId: "required",
data: {
group: group.raw,
},
suggest,
});
}
},
});
}
return {
Literal(node) {
if (node.regex) {
checkRegex(
node.regex.pattern,
node,
node,
node.regex.flags,
);
}
},
Program(node) {
const scope = sourceCode.getScope(node);
const tracker = new ReferenceTracker(scope);
const traceMap = {
RegExp: {
[CALL]: true,
[CONSTRUCT]: true,
},
};
for (const { node: refNode } of tracker.iterateGlobalReferences(
traceMap,
)) {
const regex = getStringIfConstant(refNode.arguments[0]);
const flags = getStringIfConstant(refNode.arguments[1]);
if (regex) {
checkRegex(regex, refNode, refNode.arguments[0], flags);
}
}
},
};
},
};
@@ -0,0 +1,175 @@
/**
* @fileoverview Rule to flag assignment in a conditional statement's test expression
* @author Stephen Murray <spmurrayzzz>
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const TEST_CONDITION_PARENT_TYPES = new Set([
"IfStatement",
"WhileStatement",
"DoWhileStatement",
"ForStatement",
"ConditionalExpression",
]);
const NODE_DESCRIPTIONS = {
DoWhileStatement: "a 'do...while' statement",
ForStatement: "a 'for' statement",
IfStatement: "an 'if' statement",
WhileStatement: "a 'while' statement",
};
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "problem",
defaultOptions: ["except-parens"],
docs: {
description:
"Disallow assignment operators in conditional expressions",
recommended: true,
url: "https://eslint.org/docs/latest/rules/no-cond-assign",
},
schema: [
{
enum: ["except-parens", "always"],
},
],
messages: {
unexpected: "Unexpected assignment within {{type}}.",
// must match JSHint's error message
missing:
"Expected a conditional expression and instead saw an assignment.",
},
},
create(context) {
const [prohibitAssign] = context.options;
const sourceCode = context.sourceCode;
/**
* Check whether an AST node is the test expression for a conditional statement.
* @param {!Object} node The node to test.
* @returns {boolean} `true` if the node is the text expression for a conditional statement; otherwise, `false`.
*/
function isConditionalTestExpression(node) {
return (
node.parent &&
TEST_CONDITION_PARENT_TYPES.has(node.parent.type) &&
node === node.parent.test
);
}
/**
* Given an AST node, perform a bottom-up search for the first ancestor that represents a conditional statement.
* @param {!Object} node The node to use at the start of the search.
* @returns {?Object} The closest ancestor node that represents a conditional statement.
*/
function findConditionalAncestor(node) {
let currentAncestor = node;
do {
if (isConditionalTestExpression(currentAncestor)) {
return currentAncestor.parent;
}
} while (
(currentAncestor = currentAncestor.parent) &&
!astUtils.isFunction(currentAncestor)
);
return null;
}
/**
* Check whether the code represented by an AST node is enclosed in two sets of parentheses.
* @param {!Object} node The node to test.
* @returns {boolean} `true` if the code is enclosed in two sets of parentheses; otherwise, `false`.
*/
function isParenthesisedTwice(node) {
const previousToken = sourceCode.getTokenBefore(node, 1),
nextToken = sourceCode.getTokenAfter(node, 1);
return (
astUtils.isParenthesised(sourceCode, node) &&
previousToken &&
astUtils.isOpeningParenToken(previousToken) &&
previousToken.range[1] <= node.range[0] &&
astUtils.isClosingParenToken(nextToken) &&
nextToken.range[0] >= node.range[1]
);
}
/**
* Check a conditional statement's test expression for top-level assignments that are not enclosed in parentheses.
* @param {!Object} node The node for the conditional statement.
* @returns {void}
*/
function testForAssign(node) {
if (
node.test &&
node.test.type === "AssignmentExpression" &&
(node.type === "ForStatement"
? !astUtils.isParenthesised(sourceCode, node.test)
: !isParenthesisedTwice(node.test))
) {
context.report({
node: node.test,
messageId: "missing",
});
}
}
/**
* Check whether an assignment expression is descended from a conditional statement's test expression.
* @param {!Object} node The node for the assignment expression.
* @returns {void}
*/
function testForConditionalAncestor(node) {
const ancestor = findConditionalAncestor(node);
if (ancestor) {
context.report({
node,
messageId: "unexpected",
data: {
type: NODE_DESCRIPTIONS[ancestor.type] || ancestor.type,
},
});
}
}
if (prohibitAssign === "always") {
return {
AssignmentExpression: testForConditionalAncestor,
};
}
return {
DoWhileStatement: testForAssign,
ForStatement: testForAssign,
IfStatement: testForAssign,
WhileStatement: testForAssign,
ConditionalExpression: testForAssign,
};
},
};
@@ -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 Drum = createLucideIcon("Drum", [
["path", { d: "m2 2 8 8", key: "1v6059" }],
["path", { d: "m22 2-8 8", key: "173r8a" }],
["ellipse", { cx: "12", cy: "9", rx: "10", ry: "5", key: "liohsx" }],
["path", { d: "M7 13.4v7.9", key: "1yi6u9" }],
["path", { d: "M12 14v8", key: "1tn2tj" }],
["path", { d: "M17 13.4v7.9", key: "eqz2v3" }],
["path", { d: "M2 9v8a10 5 0 0 0 20 0V9", key: "1750ul" }]
]);
export { Drum as default };
//# sourceMappingURL=drum.js.map
@@ -0,0 +1,217 @@
/**
* @fileoverview Flat Config Array
* @author Nicholas C. Zakas
*/
"use strict";
//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------
const { ConfigArray, ConfigArraySymbol } = require("@eslint/config-array");
const { flatConfigSchema } = require("./flat-config-schema");
const { defaultConfig } = require("./default-config");
const { Config } = require("./config");
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
/**
* Fields that are considered metadata and not part of the config object.
*/
const META_FIELDS = new Set(["name", "basePath"]);
/**
* Wraps a config error with details about where the error occurred.
* @param {Error} error The original error.
* @param {number} originalLength The original length of the config array.
* @param {number} baseLength The length of the base config.
* @returns {TypeError} The new error with details.
*/
function wrapConfigErrorWithDetails(error, originalLength, baseLength) {
let location = "user-defined";
let configIndex = error.index;
/*
* A config array is set up in this order:
* 1. Base config
* 2. Original configs
* 3. User-defined configs
* 4. CLI-defined configs
*
* So we need to adjust the index to account for the base config.
*
* - If the index is less than the base length, it's in the base config
* (as specified by `baseConfig` argument to `FlatConfigArray` constructor).
* - If the index is greater than the base length but less than the original
* length + base length, it's in the original config. The original config
* is passed to the `FlatConfigArray` constructor as the first argument.
* - Otherwise, it's in the user-defined config, which is loaded from the
* config file and merged with any command-line options.
*/
if (error.index < baseLength) {
location = "base";
} else if (error.index < originalLength + baseLength) {
location = "original";
configIndex = error.index - baseLength;
} else {
configIndex = error.index - originalLength - baseLength;
}
return new TypeError(
`${error.message.slice(0, -1)} at ${location} index ${configIndex}.`,
{ cause: error },
);
}
const originalBaseConfig = Symbol("originalBaseConfig");
const originalLength = Symbol("originalLength");
const baseLength = Symbol("baseLength");
//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------
/**
* Represents an array containing configuration information for ESLint.
*/
class FlatConfigArray extends ConfigArray {
/**
* Creates a new instance.
* @param {*[]} configs An array of configuration information.
* @param {{basePath: string, shouldIgnore: boolean, baseConfig: FlatConfig}} options The options
* to use for the config array instance.
*/
constructor(
configs,
{ basePath, shouldIgnore = true, baseConfig = defaultConfig } = {},
) {
super(configs, {
basePath,
schema: flatConfigSchema,
});
/**
* The original length of the array before any modifications.
* @type {number}
*/
this[originalLength] = this.length;
if (baseConfig[Symbol.iterator]) {
this.unshift(...baseConfig);
} else {
this.unshift(baseConfig);
}
/**
* The length of the array after applying the base config.
* @type {number}
*/
this[baseLength] = this.length - this[originalLength];
/**
* The base config used to build the config array.
* @type {Array<FlatConfig>}
*/
this[originalBaseConfig] = baseConfig;
Object.defineProperty(this, originalBaseConfig, { writable: false });
/**
* Determines if `ignores` fields should be honored.
* If true, then all `ignores` fields are honored.
* if false, then only `ignores` fields in the baseConfig are honored.
* @type {boolean}
*/
this.shouldIgnore = shouldIgnore;
Object.defineProperty(this, "shouldIgnore", { writable: false });
}
/**
* Normalizes the array by calling the superclass method and catching/rethrowing
* any ConfigError exceptions with additional details.
* @param {any} [context] The context to use to normalize the array.
* @returns {Promise<FlatConfigArray>} A promise that resolves when the array is normalized.
*/
normalize(context) {
return super.normalize(context).catch(error => {
if (error.name === "ConfigError") {
throw wrapConfigErrorWithDetails(
error,
this[originalLength],
this[baseLength],
);
}
throw error;
});
}
/**
* Normalizes the array by calling the superclass method and catching/rethrowing
* any ConfigError exceptions with additional details.
* @param {any} [context] The context to use to normalize the array.
* @returns {FlatConfigArray} The current instance.
* @throws {TypeError} If the config is invalid.
*/
normalizeSync(context) {
try {
return super.normalizeSync(context);
} catch (error) {
if (error.name === "ConfigError") {
throw wrapConfigErrorWithDetails(
error,
this[originalLength],
this[baseLength],
);
}
throw error;
}
}
/* eslint-disable class-methods-use-this -- Desired as instance method */
/**
* Replaces a config with another config to allow us to put strings
* in the config array that will be replaced by objects before
* normalization.
* @param {Object} config The config to preprocess.
* @returns {Object} The preprocessed config.
*/
[ConfigArraySymbol.preprocessConfig](config) {
/*
* If a config object has `ignores` and no other non-meta fields, then it's an object
* for global ignores. If `shouldIgnore` is false, that object shouldn't apply,
* so we'll remove its `ignores`.
*/
if (
!this.shouldIgnore &&
!this[originalBaseConfig].includes(config) &&
config.ignores &&
Object.keys(config).filter(key => !META_FIELDS.has(key)).length ===
1
) {
/* eslint-disable-next-line no-unused-vars -- need to strip off other keys */
const { ignores, ...otherKeys } = config;
return otherKeys;
}
return config;
}
/**
* Finalizes the config by replacing plugin references with their objects
* and validating rule option schemas.
* @param {Object} config The config to finalize.
* @returns {Object} The finalized config.
* @throws {TypeError} If the config is invalid.
*/
[ConfigArraySymbol.finalizeConfig](config) {
return new Config(config);
}
/* eslint-enable class-methods-use-this -- Desired as instance method */
}
exports.FlatConfigArray = FlatConfigArray;
@@ -0,0 +1,148 @@
#!/usr/bin/env node
(function() {
var fs = require('fs');
var stringEscape = require('../jsesc.js');
var strings = process.argv.splice(2);
var stdin = process.stdin;
var data;
var timeout;
var isObject = false;
var options = {};
var log = console.log;
var main = function() {
var option = strings[0];
if (/^(?:-h|--help|undefined)$/.test(option)) {
log(
'jsesc v%s - https://mths.be/jsesc',
stringEscape.version
);
log([
'\nUsage:\n',
'\tjsesc [string]',
'\tjsesc [-s | --single-quotes] [string]',
'\tjsesc [-d | --double-quotes] [string]',
'\tjsesc [-w | --wrap] [string]',
'\tjsesc [-e | --escape-everything] [string]',
'\tjsesc [-t | --escape-etago] [string]',
'\tjsesc [-6 | --es6] [string]',
'\tjsesc [-l | --lowercase-hex] [string]',
'\tjsesc [-j | --json] [string]',
'\tjsesc [-o | --object] [stringified_object]', // `JSON.parse()` the argument
'\tjsesc [-p | --pretty] [string]', // `compact: false`
'\tjsesc [-v | --version]',
'\tjsesc [-h | --help]',
'\nExamples:\n',
'\tjsesc \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
'\tjsesc --json \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
'\tjsesc --json --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
'\tjsesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
'\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | jsesc'
].join('\n'));
return process.exit(1);
}
if (/^(?:-v|--version)$/.test(option)) {
log('v%s', stringEscape.version);
return process.exit(1);
}
strings.forEach(function(string) {
// Process options
if (/^(?:-s|--single-quotes)$/.test(string)) {
options.quotes = 'single';
return;
}
if (/^(?:-d|--double-quotes)$/.test(string)) {
options.quotes = 'double';
return;
}
if (/^(?:-w|--wrap)$/.test(string)) {
options.wrap = true;
return;
}
if (/^(?:-e|--escape-everything)$/.test(string)) {
options.escapeEverything = true;
return;
}
if (/^(?:-t|--escape-etago)$/.test(string)) {
options.escapeEtago = true;
return;
}
if (/^(?:-6|--es6)$/.test(string)) {
options.es6 = true;
return;
}
if (/^(?:-l|--lowercase-hex)$/.test(string)) {
options.lowercaseHex = true;
return;
}
if (/^(?:-j|--json)$/.test(string)) {
options.json = true;
return;
}
if (/^(?:-o|--object)$/.test(string)) {
isObject = true;
return;
}
if (/^(?:-p|--pretty)$/.test(string)) {
isObject = true;
options.compact = false;
return;
}
// Process string(s)
var result;
try {
if (isObject) {
string = JSON.parse(string);
}
result = stringEscape(string, options);
log(result);
} catch(error) {
log(error.message + '\n');
log('Error: failed to escape.');
log('If you think this is a bug in jsesc, please report it:');
log('https://github.com/mathiasbynens/jsesc/issues/new');
log(
'\nStack trace using jsesc@%s:\n',
stringEscape.version
);
log(error.stack);
return process.exit(1);
}
});
// Return with exit status 0 outside of the `forEach` loop, in case
// multiple strings were passed in.
return process.exit(0);
};
if (stdin.isTTY) {
// handle shell arguments
main();
} else {
// Either the script is called from within a non-TTY context,
// or `stdin` content is being piped in.
if (!process.stdout.isTTY) { // called from a non-TTY context
timeout = setTimeout(function() {
// if no piped data arrived after a while, handle shell arguments
main();
}, 250);
}
data = '';
stdin.on('data', function(chunk) {
clearTimeout(timeout);
data += chunk;
});
stdin.on('end', function() {
strings.push(data.trim());
main();
});
stdin.resume();
}
}());
@@ -0,0 +1,275 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
createIsbot: () => createIsbot,
createIsbotFromList: () => createIsbotFromList,
getPattern: () => getPattern,
isbot: () => isbot,
isbotMatch: () => isbotMatch,
isbotMatches: () => isbotMatches,
isbotNaive: () => isbotNaive,
isbotPattern: () => isbotPattern,
isbotPatterns: () => isbotPatterns,
list: () => list
});
module.exports = __toCommonJS(index_exports);
// src/patterns.json
var patterns_default = [
" daum[ /]",
" deusu/",
"(?:^|[^g])news(?!sapphire)",
"(?<! (?:channel/|google/))google(?!(app|/google| pixel))",
"(?<! cu)bots?(?:\\b|_)",
"(?<!(?:lib))http",
"(?<!cam)scan",
"24x7",
"@[a-z][\\w-]+\\.",
"\\(\\)",
"\\.com\\b",
"\\b\\w+\\.ai",
"\\bcursor/",
"\\bmanus-user/",
"\\bort/",
"\\bperl\\b",
"\\bplaywright\\b",
"\\bsecurityheaders\\b",
"\\bselenium\\b",
"\\btime/",
"\\|",
"^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)",
"^[\\w\\-]+/[\\w]+$",
"^[^ ]{50,}$",
"^\\d+\\b",
"^\\W",
"^\\w*search\\b",
"^\\w+/[\\w\\(\\)]*$",
"^\\w+/\\d\\.\\d\\s\\([\\w@]+\\)$",
"^active",
"^ad muncher",
"^amaya",
"^apache/",
"^avsdevicesdk/",
"^azure",
"^biglotron",
"^bot",
"^bw/",
"^clamav[ /]",
"^claude-code/",
"^client/",
"^cobweb/",
"^custom",
"^ddg[_-]android",
"^discourse",
"^dispatch/\\d",
"^downcast/",
"^duckduckgo",
"^email",
"^facebook",
"^getright/",
"^gozilla/",
"^hobbit",
"^hotzonu",
"^hwcdn/",
"^igetter/",
"^jeode/",
"^jetty/",
"^jigsaw",
"^microsoft bits",
"^movabletype",
"^mozilla/\\d\\.\\d\\s[\\w\\.-]+$",
"^mozilla/\\d\\.\\d\\s\\((?:compatible;)?(?:\\s?[\\w\\d-.]+\\/\\d+\\.\\d+)?\\)$",
"^navermailapp",
"^netsurf",
"^offline",
"^openai/",
"^owler",
"^php",
"^postman",
"^python",
"^rank",
"^read",
"^reed",
"^rest",
"^rss",
"^snapchat",
"^space bison",
"^svn",
"^swcd ",
"^taringa",
"^thumbor/",
"^track",
"^w3c",
"^webbandit/",
"^webcopier",
"^wget",
"^whatsapp",
"^wordpress",
"^xenu link sleuth",
"^yahoo",
"^yandex",
"^zdm/\\d",
"^zoom marketplace/",
"advisor",
"agent\\b",
"analyzer",
"archive",
"ask jeeves/teoma",
"audit",
"bit\\.ly/",
"bluecoat drtr",
"browsex",
"burpcollaborator",
"capture",
"catch",
"check\\b",
"checker",
"chrome-lighthouse",
"chromeframe",
"classifier",
"cloudflare",
"convertify",
"crawl",
"cypress/",
"dareboost",
"datanyze",
"dejaclick",
"detect",
"dmbrowser",
"download",
"exaleadcloudview",
"feed",
"fetcher",
"firephp",
"functionize",
"grab",
"headless",
"httrack",
"hubspot marketing grader",
"ibisbrowser",
"infrawatch",
"insight",
"inspect",
"iplabel",
"java(?!;)",
"library",
"linkcheck",
"mail\\.ru/",
"manager",
"measure",
"monitor\\b",
"neustar wpm",
"node\\b",
"nutch",
"offbyone",
"onetrust",
"optimize",
"pageburst",
"pagespeed",
"parser",
"phantomjs",
"pingdom",
"powermarks",
"preview",
"proxy",
"ptst[ /]\\d",
"retriever",
"rexx;",
"rigor",
"rss\\b",
"scrape",
"server",
"sogou",
"sparkler/",
"speedcurve",
"spider",
"splash",
"statuscake",
"supercleaner",
"synapse",
"synthetic",
"tools",
"torrent",
"transcoder",
"url",
"validator",
"virtuoso",
"wappalyzer",
"webglance",
"webkit2png",
"whatcms/",
"xtate/"
];
// src/pattern.ts
var fullPattern = " daum[ /]| deusu/|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<!cam)scan|24x7|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\b\\w+\\.ai|\\bcursor/|\\bmanus-user/|\\bort/|\\bperl\\b|\\bplaywright\\b|\\bsecurityheaders\\b|\\bselenium\\b|\\btime/|\\||^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[\\w\\-]+/[\\w]+$|^[^ ]{50,}$|^\\d+\\b|^\\W|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^\\w+/\\d\\.\\d\\s\\([\\w@]+\\)$|^active|^ad muncher|^amaya|^apache/|^avsdevicesdk/|^azure|^biglotron|^bot|^bw/|^clamav[ /]|^claude-code/|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\((?:compatible;)?(?:\\s?[\\w\\d-.]+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|advisor|agent\\b|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|exaleadcloudview|feed|fetcher|firephp|functionize|grab|headless|httrack|hubspot marketing grader|ibisbrowser|infrawatch|insight|inspect|iplabel|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|monitor\\b|neustar wpm|node\\b|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/";
// src/index.ts
var naivePattern = /bot|crawl|http|lighthouse|scan|search|spider/i;
var pattern;
function getPattern() {
if (pattern instanceof RegExp) {
return pattern;
}
try {
pattern = new RegExp(fullPattern, "i");
} catch (error) {
pattern = naivePattern;
}
return pattern;
}
var isNonEmptyString = (value) => typeof value === "string" && value !== "";
var list = patterns_default;
function isbot(userAgent) {
return isNonEmptyString(userAgent) && getPattern().test(userAgent);
}
var isbotNaive = (userAgent) => isNonEmptyString(userAgent) && naivePattern.test(userAgent);
var createIsbot = (customPattern) => (userAgent) => isNonEmptyString(userAgent) && customPattern.test(userAgent);
var createIsbotFromList = (list2) => {
const pattern2 = new RegExp(list2.join("|"), "i");
return (userAgent) => isNonEmptyString(userAgent) && pattern2.test(userAgent);
};
var isbotMatch = (userAgent) => {
var _a, _b;
return (_b = (_a = userAgent == null ? void 0 : userAgent.match(getPattern())) == null ? void 0 : _a[0]) != null ? _b : null;
};
var isbotMatches = (userAgent) => list.map((part) => {
var _a;
return (_a = userAgent == null ? void 0 : userAgent.match(new RegExp(part, "i"))) == null ? void 0 : _a[0];
}).filter(isNonEmptyString);
var isbotPattern = (userAgent) => {
var _a;
return userAgent ? (_a = list.find((pattern2) => new RegExp(pattern2, "i").test(userAgent))) != null ? _a : null : null;
};
var isbotPatterns = (userAgent) => userAgent ? list.filter((pattern2) => new RegExp(pattern2, "i").test(userAgent)) : [];
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createIsbot,
createIsbotFromList,
getPattern,
isbot,
isbotMatch,
isbotMatches,
isbotNaive,
isbotPattern,
isbotPatterns,
list
});
@@ -0,0 +1,42 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_router = require("../../router.js");
//#region src/router/pattern-router/router.ts
const emptyParams = Object.create(null);
var PatternRouter = class {
name = "PatternRouter";
#routes = [];
add(method, path, handler) {
const suffix = path.endsWith("/*") ? "(?:$|/)" : path.endsWith("*") ? "" : "/?$";
path = path.replace(/\*$/, "");
if (path.at(-1) === "?") {
path = path.slice(0, -1);
this.add(method, path.replace(/\/[^/]+$/, ""), handler);
}
const parts = (path.match(/\/?(:\w+(?:{(?:(?:{[\d,]+})|[^}])+})?)|\/?[^\/\?]+/g) || []).map((part) => {
const match = part.match(/^\/:([^{]+)(?:{(.*)})?/);
return match ? `/(?<${match[1]}>${match[2] || "[^/]+"})` : part === "/*" ? "/[^/]+" : part.replace(/[.\\+*[^\]$()]/g, "\\$&");
});
try {
this.#routes.push([
new RegExp(`^${parts.join("")}${suffix}`),
method,
handler
]);
} catch {
throw new require_router.UnsupportedPathError();
}
}
match(method, path) {
const handlers = [];
for (let i = 0, len = this.#routes.length; i < len; i++) {
const [pattern, routeMethod, handler] = this.#routes[i];
if (routeMethod === method || routeMethod === "ALL") {
const match = pattern.exec(path);
if (match) handlers.push([handler, match.groups || emptyParams]);
}
}
return [handlers];
}
};
//#endregion
exports.PatternRouter = PatternRouter;
@@ -0,0 +1,5 @@
export declare function isSpaceSeparator(c?: string): boolean
export declare function isIdStartChar(c?: string): boolean
export declare function isIdContinueChar(c?: string): boolean
export declare function isDigit(c?: string): boolean
export declare function isHexDigit(c?: string): boolean
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../src/use-rect.tsx"],
"sourcesContent": ["export { useRect } from './use-rect';\n", "import * as React from 'react';\nimport { observeElementRect } from '@radix-ui/rect';\n\nimport type { Measurable } from '@radix-ui/rect';\n\n/**\n * Use this custom hook to get access to an element's rect (getBoundingClientRect)\n * and observe it along time.\n */\nfunction useRect(measurable: Measurable | null) {\n const [rect, setRect] = React.useState<DOMRect>();\n React.useEffect(() => {\n if (measurable) {\n const unobserve = observeElementRect(measurable, setRect);\n return () => {\n setRect(undefined);\n unobserve();\n };\n }\n return;\n }, [measurable]);\n return rect;\n}\n\nexport { useRect };\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,kBAAmC;AAQnC,SAAS,QAAQ,YAA+B;AAC9C,QAAM,CAAC,MAAM,OAAO,IAAU,eAAkB;AAChD,EAAM,gBAAU,MAAM;AACpB,QAAI,YAAY;AACd,YAAM,gBAAY,gCAAmB,YAAY,OAAO;AACxD,aAAO,MAAM;AACX,gBAAQ,MAAS;AACjB,kBAAU;AAAA,MACZ;AAAA,IACF;AACA;AAAA,EACF,GAAG,CAAC,UAAU,CAAC;AACf,SAAO;AACT;",
"names": []
}
@@ -0,0 +1,92 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const codegen_1 = require("../../compile/codegen");
const error = {
message: ({ schemaCode }) => (0, codegen_1.str) `must match format "${schemaCode}"`,
params: ({ schemaCode }) => (0, codegen_1._) `{format: ${schemaCode}}`,
};
const def = {
keyword: "format",
type: ["number", "string"],
schemaType: "string",
$data: true,
error,
code(cxt, ruleType) {
const { gen, data, $data, schema, schemaCode, it } = cxt;
const { opts, errSchemaPath, schemaEnv, self } = it;
if (!opts.validateFormats)
return;
if ($data)
validate$DataFormat();
else
validateFormat();
function validate$DataFormat() {
const fmts = gen.scopeValue("formats", {
ref: self.formats,
code: opts.code.formats,
});
const fDef = gen.const("fDef", (0, codegen_1._) `${fmts}[${schemaCode}]`);
const fType = gen.let("fType");
const format = gen.let("format");
// TODO simplify
gen.if((0, codegen_1._) `typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._) `${fDef}.type || "string"`).assign(format, (0, codegen_1._) `${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._) `"string"`).assign(format, fDef));
cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt()));
function unknownFmt() {
if (opts.strictSchema === false)
return codegen_1.nil;
return (0, codegen_1._) `${schemaCode} && !${format}`;
}
function invalidFmt() {
const callFormat = schemaEnv.$async
? (0, codegen_1._) `(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))`
: (0, codegen_1._) `${format}(${data})`;
const validData = (0, codegen_1._) `(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`;
return (0, codegen_1._) `${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`;
}
}
function validateFormat() {
const formatDef = self.formats[schema];
if (!formatDef) {
unknownFormat();
return;
}
if (formatDef === true)
return;
const [fmtType, format, fmtRef] = getFormat(formatDef);
if (fmtType === ruleType)
cxt.pass(validCondition());
function unknownFormat() {
if (opts.strictSchema === false) {
self.logger.warn(unknownMsg());
return;
}
throw new Error(unknownMsg());
function unknownMsg() {
return `unknown format "${schema}" ignored in schema at path "${errSchemaPath}"`;
}
}
function getFormat(fmtDef) {
const code = fmtDef instanceof RegExp
? (0, codegen_1.regexpCode)(fmtDef)
: opts.code.formats
? (0, codegen_1._) `${opts.code.formats}${(0, codegen_1.getProperty)(schema)}`
: undefined;
const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code });
if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._) `${fmt}.validate`];
}
return ["string", fmtDef, fmt];
}
function validCondition() {
if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) {
if (!schemaEnv.$async)
throw new Error("async format in sync schema");
return (0, codegen_1._) `await ${fmtRef}(${data})`;
}
return typeof format == "function" ? (0, codegen_1._) `${fmtRef}(${data})` : (0, codegen_1._) `${fmtRef}.test(${data})`;
}
}
},
};
exports.default = def;
//# sourceMappingURL=format.js.map
@@ -0,0 +1,227 @@
'use strict'
const { getResponseData, buildKey, addMockDispatch } = require('./mock-utils')
const {
kDispatches,
kDispatchKey,
kDefaultHeaders,
kDefaultTrailers,
kContentLength,
kMockDispatch,
kIgnoreTrailingSlash
} = require('./mock-symbols')
const { InvalidArgumentError } = require('../core/errors')
const { serializePathWithQuery } = require('../core/util')
const {
types: {
isPromise
}
} = require('node:util')
/**
* Defines the scope API for an interceptor reply
*/
class MockScope {
constructor (mockDispatch) {
this[kMockDispatch] = mockDispatch
}
/**
* Delay a reply by a set amount in ms.
*/
delay (waitInMs) {
if (typeof waitInMs !== 'number' || !Number.isInteger(waitInMs) || waitInMs <= 0) {
throw new InvalidArgumentError('waitInMs must be a valid integer > 0')
}
this[kMockDispatch].delay = waitInMs
return this
}
/**
* For a defined reply, never mark as consumed.
*/
persist () {
this[kMockDispatch].persist = true
return this
}
/**
* Allow one to define a reply for a set amount of matching requests.
*/
times (repeatTimes) {
if (typeof repeatTimes !== 'number' || !Number.isInteger(repeatTimes) || repeatTimes <= 0) {
throw new InvalidArgumentError('repeatTimes must be a valid integer > 0')
}
this[kMockDispatch].times = repeatTimes
return this
}
}
/**
* Defines an interceptor for a Mock
*/
class MockInterceptor {
constructor (opts, mockDispatches) {
if (typeof opts !== 'object') {
throw new InvalidArgumentError('opts must be an object')
}
if (typeof opts.path === 'undefined') {
throw new InvalidArgumentError('opts.path must be defined')
}
if (typeof opts.method === 'undefined') {
opts.method = 'GET'
}
// See https://github.com/nodejs/undici/issues/1245
// As per RFC 3986, clients are not supposed to send URI
// fragments to servers when they retrieve a document,
if (typeof opts.path === 'string') {
if (opts.query) {
opts.path = serializePathWithQuery(opts.path, opts.query)
} else {
// Matches https://github.com/nodejs/undici/blob/main/lib/web/fetch/index.js#L1811
const parsedURL = new URL(opts.path, 'data://')
opts.path = parsedURL.pathname + parsedURL.search
}
}
if (typeof opts.method === 'string') {
opts.method = opts.method.toUpperCase()
}
this[kDispatchKey] = buildKey(opts)
this[kDispatches] = mockDispatches
this[kIgnoreTrailingSlash] = opts.ignoreTrailingSlash ?? false
this[kDefaultHeaders] = {}
this[kDefaultTrailers] = {}
this[kContentLength] = false
}
createMockScopeDispatchData ({ statusCode, data, responseOptions }) {
const responseData = getResponseData(data)
const contentLength = this[kContentLength] ? { 'content-length': responseData.length } : {}
const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers }
const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers }
return { statusCode, data, headers, trailers }
}
validateReplyParameters (replyParameters) {
if (typeof replyParameters.statusCode === 'undefined') {
throw new InvalidArgumentError('statusCode must be defined')
}
if (typeof replyParameters.responseOptions !== 'object' || replyParameters.responseOptions === null) {
throw new InvalidArgumentError('responseOptions must be an object')
}
}
/**
* Mock an undici request with a defined reply.
*/
reply (replyOptionsCallbackOrStatusCode) {
// Values of reply aren't available right now as they
// can only be available when the reply callback is invoked.
if (typeof replyOptionsCallbackOrStatusCode === 'function') {
// Resolves the data returned by a reply options callback into
// dispatch data, validating its format along the way.
const resolveReplyCallbackData = (resolvedData) => {
// Check if it is in the right format
if (typeof resolvedData !== 'object' || resolvedData === null) {
throw new InvalidArgumentError('reply options callback must return an object')
}
const replyParameters = { data: '', responseOptions: {}, ...resolvedData }
this.validateReplyParameters(replyParameters)
// Since the values can be obtained immediately we return them
// from this higher order function that will be resolved later.
return {
...this.createMockScopeDispatchData(replyParameters)
}
}
// We'll first wrap the provided callback in another function,
// this function will properly resolve the data from the callback
// when invoked.
const wrappedDefaultsCallback = (opts) => {
// Our reply options callback contains the parameter for statusCode, data and options.
const resolvedData = replyOptionsCallbackOrStatusCode(opts)
// An asynchronous reply options callback resolves to the reply
// parameters, so the dispatch data can only be resolved once the
// returned promise settles.
if (isPromise(resolvedData)) {
return resolvedData.then(resolveReplyCallbackData)
}
return resolveReplyCallbackData(resolvedData)
}
// Add usual dispatch data, but this time set the data parameter to function that will eventually provide data.
const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], wrappedDefaultsCallback, { ignoreTrailingSlash: this[kIgnoreTrailingSlash] })
return new MockScope(newMockDispatch)
}
// We can have either one or three parameters, if we get here,
// we should have 1-3 parameters. So we spread the arguments of
// this function to obtain the parameters, since replyData will always
// just be the statusCode.
const replyParameters = {
statusCode: replyOptionsCallbackOrStatusCode,
data: arguments[1] === undefined ? '' : arguments[1],
responseOptions: arguments[2] === undefined ? {} : arguments[2]
}
this.validateReplyParameters(replyParameters)
// Send in-already provided data like usual
const dispatchData = this.createMockScopeDispatchData(replyParameters)
const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], dispatchData, { ignoreTrailingSlash: this[kIgnoreTrailingSlash] })
return new MockScope(newMockDispatch)
}
/**
* Mock an undici request with a defined error.
*/
replyWithError (error) {
if (typeof error === 'undefined') {
throw new InvalidArgumentError('error must be defined')
}
const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error }, { ignoreTrailingSlash: this[kIgnoreTrailingSlash] })
return new MockScope(newMockDispatch)
}
/**
* Set default reply headers on the interceptor for subsequent replies
*/
defaultReplyHeaders (headers) {
if (typeof headers === 'undefined') {
throw new InvalidArgumentError('headers must be defined')
}
this[kDefaultHeaders] = headers
return this
}
/**
* Set default reply trailers on the interceptor for subsequent replies
*/
defaultReplyTrailers (trailers) {
if (typeof trailers === 'undefined') {
throw new InvalidArgumentError('trailers must be defined')
}
this[kDefaultTrailers] = trailers
return this
}
/**
* Set reply content length header for replies on the interceptor
*/
replyContentLength () {
this[kContentLength] = true
return this
}
}
module.exports.MockInterceptor = MockInterceptor
module.exports.MockScope = MockScope
@@ -0,0 +1,73 @@
"use strict";
// Run with: npx tsx src/examples/server/toolWithSampleServer.ts
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const mcp_js_1 = require("../../server/mcp.js");
const stdio_js_1 = require("../../server/stdio.js");
const z = __importStar(require("zod/v4"));
const mcpServer = new mcp_js_1.McpServer({
name: 'tools-with-sample-server',
version: '1.0.0'
});
// Tool that uses LLM sampling to summarize any text
mcpServer.registerTool('summarize', {
description: 'Summarize any text using an LLM',
inputSchema: {
text: z.string().describe('Text to summarize')
}
}, async ({ text }) => {
// Call the LLM through MCP sampling
const response = await mcpServer.server.createMessage({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Please summarize the following text concisely:\n\n${text}`
}
}
],
maxTokens: 500
});
// Since we're not passing tools param to createMessage, response.content is single content
return {
content: [
{
type: 'text',
text: response.content.type === 'text' ? response.content.text : 'Unable to generate summary'
}
]
};
});
async function main() {
const transport = new stdio_js_1.StdioServerTransport();
await mcpServer.connect(transport);
console.log('MCP server is running...');
}
main().catch(error => {
console.error('Server error:', error);
process.exit(1);
});
//# sourceMappingURL=toolWithSampleServer.js.map
@@ -0,0 +1 @@
{"version":3,"file":"command.js","sources":["../../../src/icons/command.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Command\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTUgNnYxMmEzIDMgMCAxIDAgMy0zSDZhMyAzIDAgMSAwIDMgM1Y2YTMgMyAwIDEgMC0zIDNoMTJhMyAzIDAgMSAwLTMtMyIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/command\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 Command = createLucideIcon('Command', [\n [\n 'path',\n { d: 'M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3', key: '11bfej' },\n ],\n]);\n\nexport default Command;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAC1C,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2E,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAS,CAAA,CAAA;AAAA,CAChG,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,835 @@
flf2a$ 8 7 16 -1 18
AMC untitled font by LESTER
=============================
-> Conversion to FigLet font by MEPH. (Part of ASCII Editor Service Pack I)
(http://studenten.freepage.de/meph/ascii/ascii/editor/_index.htm)
-> Defined: ASCII code alphanumeric
.-~~-.
(_^..^_)
Lester||||AMC - Anthony Cucchiara
*Mythos Online : Internet Magazine of Lovecraftian Horror - Dead Alice*
http://www.fortunecity.com/victorian/redlion/157/deadal.htm
*Visit my web page ANSI/ASCII/Fonts*
http://members.aol.com/lester5374/
$@
$@
$@
$@
$@
$@
$@
$@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
,''. @
',,' @
@@
@
@
@
@
@
@
@
@@
,'',,'', @
; ,'', ; @
; ; ; ; @
; ;\ ; ; @
; ; \; ; @
; ',,' ; @
',,'',,' @
@@
,'''''', @
',,'; ; @
; ; @
; ; @
; ; @
; ; @
',,' @
@@
,'''''', @
',,'; ; @
,,'' @
',,' @
,'', @
; ;,'', @
',,,,,,' @
@@
,'''''', @
',,'; ; @
,'',; ; @
',,'; ; @
; ; @
,'',; ; @
',,,,,,' @
@@
,'',,'', @
; ;; ; @
; ;; ; @
',,'; ; @
; ; @
; ; @
',,' @
@@
,'''''', @
; ;',,' @
; ; @
',,','', @
; ; @
,'',; ; @
',,,,,,' @
@@
,'''''', @
; ;',,' @
; ; @
; ;,'', @
; ;', ; @
; ;,' ; @
',,'',,' @
@@
,'''''', @
',,'; ; @
,,'' @
',,' @
,'', @
; ; @
',,' @
@@
,'',,''', @
; ,'', ; @
; ',,' ; @
; ,'', ; @
; ; ; ; @
; ',,' ; @
',,'',,,' @
@@
,'',,'', @
; ,'; ; @
; ',; ; @
',,'; ; @
; ; @
,'',; ; @
',,,,,,' @
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
,'',,''', @
; ;', ; @
; ;,' ; @
; ;', ; @
; ; ; ; @
; ; ; ; @
',,' ',,' @
@@
,'',,''', @
; ;', ; @
; ;,' ; @
; ;', ; @
; ; ; ; @
; ;,' ; @
',,'',,,' @
@@
,'',,'', @
; ;',,' @
; ; @
; ; @
; ; @
; ;,'', @
',,'',,' @
@@
,'',,'', @
; ;; ; @
; ;; ; @
; ;; ; @
; ;; ; @
; ;; ; @
',,'',,' @
@@
,'',,'', @
; ;',,' @
; ;,'', @
; ;',,' @
; ; @
; ;,'', @
',,'',,' @
@@
,'',,'', @
; ;',,' @
; ;,'', @
; ;',,' @
; ; @
; ; @
',,' @
@@
,'',,'', @
; ;',,' @
; ; @
; ;,'', @
; ;', ; @
; ;,' ; @
',,'',,' @
@@
,'', ,'', @
; ; ; ; @
; ;,',; ; @
; ;','; ; @
; ; ; ; @
; ; ; ; @
',,' ',,' @
@@
,'', @
; ; @
; ; @
; ; @
; ; @
; ; @
',,' @
@@
,'', @
; ; @
; ; @
; ; @
; ; @
,'',; ; @
',,'',,' @
@@
,'', ,'', @
; ; ',,' @
; ;,'', @
; ;; ; @
; ; ; ; @
; ; ; ; @
',,' ',,' @
@@
,'', @
; ; @
; ; @
; ; @
; ; @
; ;,'', @
',,'',,' @
@@
,'',,'',,'', @
; ;', ;', ; @
; ; ; ; ; ; @
; ; ; ; ; ; @
; ; ; ; ; ; @
; ; ; ; ; ; @
',,' ',' ',' @
@@
,'',,'', @
; ;', ; @
; ; ; ; @
; ; ; ; @
; ; ; ; @
; ; ; ; @
',,' ',' @
@@
,'',,'', @
; ;; ; @
; ;; ; @
; ;; ; @
; ;; ; @
; ;; ; @
',,'',,' @
@@
,'',,'', @
; ;; ; @
; ;',,' @
; ; @
; ; @
; ; @
',,' @
@@
,'',,'', @
; ;; ; @
; ;; ; @
; ;; ; @
; ;', ; @
; ;,' ', @
',,'',,,,' @
@@
,'',,''', @
; ;', ; @
; ;,' ,' @
; ;', ', @
; ; ; ; @
; ; ; ; @
',,' ',,' @
@@
,'',,'', @
; ;',,' @
; ; @
',,','', @
; ; @
,'',; ; @
',,'',,' @
@@
,'',,'',,'', @
',,'; ;',,' @
; ; @
; ; @
; ; @
; ; @
',,' @
@@
,'', ,'', @
; ; ; ; @
; ; ; ; @
; ; ; ; @
; ; ; ; @
; ',,' ; @
',,,'',,,' @
@@
,'',,'', @
; ;; ; @
; ;; ; @
; ;; ; @
; ;; ; @
; ;; ; @
','',' @
@@
,'', ,', ,', @
; ; ; ; ; ; @
; ; ; ; ; ; @
; ; ; ; ; ; @
; ; ; ; ; ; @
; ;,' ;,' ; @
',,'',,'',,' @
@@
,'',,'', @
; ;; ; @
', ;; ,' @
; ;; ; @
,' ;; ', @
; ;; ; @
',,'',,' @
@@
,'',,'', @
; ;; ; @
',,'',,' @
,'', @
; ; @
; ; @
',,' @
@@
,'',,'', @
',,'; ; @
,,'' @
',,' @
,'', @
; ;,'', @
',,'',,' @
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
,'',,''', @
; ;', ; @
; ;,' ; @
; ;', ; @
',,' ',,' @
@@
@
@
,'',,''', @
; ;', ; @
; ;', ; @
; ;,' ; @
',,'',,,' @
@@
@
@
,'',,'', @
; ;',,' @
; ; @
; ;,'', @
',,'',,' @
@@
@
@
,'',,'', @
; ;; ; @
; ;; ; @
; ;; ; @
',,'',,' @
@@
@
@
,'',,'', @
; ;',,' @
; ;',,' @
; ; ,, @
',,'',,' @
@@
@
@
,'',,'', @
; ;',,' @
; ;',,' @
; ; @
',,' @
@@
@
@
,'',,'', @
; ; '' @
; ;,'', @
; ;,' ; @
',,'',,' @
@@
@
@
,'', ,'', @
; ;,; ; @
; ;'; ; @
; ; ; ; @
',,' ',,' @
@@
@
@
,'', @
; ; @
; ; @
; ; @
',,' @
@@
@
@
,'', @
; ; @
; ; @
,'',; ; @
',,'',,' @
@@
@
@
,'',,'', @
; ;',,' @
; ;; ; @
; ; ; ; @
',,' ',,' @
@@
@
@
,'', @
; ; @
; ; @
; ;,'', @
',,'',,' @
@@
@
@
,'',,'',,'', @
; ;', ;', ; @
; ; ; ; ; ; @
; ; ; ; ; ; @
',,' ',' ',' @
@@
@
@
,'',,'', @
; ;', ; @
; ; ; ; @
; ; ; ; @
',,' ',' @
@@
@
@
,'',,'', @
; ;; ; @
; ;; ; @
; ;; ; @
',,'',,' @
@@
@
@
,'',,'', @
; ;; ; @
; ;',,' @
; ; @
',,' @
@@
@
@
,'',,'', @
; ;; ; @
; ;', ; @
; ;,' ', @
',,'',,,,' @
@@
@
@
,'',,'', @
; ;', ; @
; ;,' ,' @
; ;', ', @
',,' ',,' @
@@
@
@
,'',,'', @
; ;',,' @
',,','', @
,'',; ; @
',,'',,' @
@@
@
@
,'',,'',,'', @
',,'; ;',,' @
; ; @
; ; @
',,' @
@@
@
@
,', ,', @
; ; ; ; @
; ; ; ; @
; ',,' ; @
',,'',,' @
@@
@
@
,'',,'', @
; ;; ; @
; ;; ; @
; ;; ; @
','',' @
@@
@
@
,'', ,', ,', @
; ; ; ; ; ; @
; ; ; ; ; ; @
; ;,' ;,' ; @
',,'',,'',,' @
@@
@
@
,'',,'', @
', ;; ,' @
,' ;; ', @
; ;; ; @
',,'',,' @
@@
@
@
,'',,'', @
',,'',,' @
,'', @
; ; @
',,' @
@@
@
@
,'',,'', @
'',;,,' @
',,' @
,'', ,, @
',,'',,' @
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@@ -0,0 +1,13 @@
import { ZodTupleDef, ZodTupleItems, ZodTypeAny } from "zod/v3";
import { JsonSchema7Type } from "../parseTypes.js";
import { Refs } from "../Refs.js";
export type JsonSchema7TupleType = {
type: "array";
minItems: number;
items: JsonSchema7Type[];
} & ({
maxItems: number;
} | {
additionalItems?: JsonSchema7Type;
});
export declare function parseTupleDef(def: ZodTupleDef<ZodTupleItems | [], ZodTypeAny | null>, refs: Refs): JsonSchema7TupleType;
@@ -0,0 +1,40 @@
// This file is autogenerated by build-prefixes.js. DO NOT EDIT!
export interface Targets {
android?: number,
chrome?: number,
edge?: number,
firefox?: number,
ie?: number,
ios_saf?: number,
opera?: number,
safari?: number,
samsung?: number
}
export const Features: {
Nesting: 1,
NotSelectorList: 2,
DirSelector: 4,
LangSelectorList: 8,
IsSelector: 16,
TextDecorationThicknessPercent: 32,
MediaIntervalSyntax: 64,
MediaRangeSyntax: 128,
CustomMediaQueries: 256,
ClampFunction: 512,
ColorFunction: 1024,
OklabColors: 2048,
LabColors: 4096,
P3Colors: 8192,
HexAlphaColors: 16384,
SpaceSeparatedColorNotation: 32768,
FontFamilySystemUi: 65536,
DoublePositionGradients: 131072,
VendorPrefixes: 262144,
LogicalProperties: 524288,
LightDark: 1048576,
Selectors: 31,
MediaQueries: 448,
Colors: 1113088,
};
@@ -0,0 +1,118 @@
/* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
*/
/**
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
*/
/* eslint-enable jsdoc/valid-types -- doesn't allow `readonly string[]`. TODO: check why */
/**
* @type {VisitorKeys}
*/
const KEYS = {
ArrayExpression: ["elements"],
ArrayPattern: ["elements"],
ArrowFunctionExpression: ["params", "body"],
AssignmentExpression: ["left", "right"],
AssignmentPattern: ["left", "right"],
AwaitExpression: ["argument"],
BinaryExpression: ["left", "right"],
BlockStatement: ["body"],
BreakStatement: ["label"],
CallExpression: ["callee", "arguments"],
CatchClause: ["param", "body"],
ChainExpression: ["expression"],
ClassBody: ["body"],
ClassDeclaration: ["id", "superClass", "body"],
ClassExpression: ["id", "superClass", "body"],
ConditionalExpression: ["test", "consequent", "alternate"],
ContinueStatement: ["label"],
DebuggerStatement: [],
DoWhileStatement: ["body", "test"],
EmptyStatement: [],
ExperimentalRestProperty: ["argument"],
ExperimentalSpreadProperty: ["argument"],
ExportAllDeclaration: ["exported", "source", "attributes"],
ExportDefaultDeclaration: ["declaration"],
ExportNamedDeclaration: [
"declaration",
"specifiers",
"source",
"attributes",
],
ExportSpecifier: ["local", "exported"],
ExpressionStatement: ["expression"],
ForInStatement: ["left", "right", "body"],
ForOfStatement: ["left", "right", "body"],
ForStatement: ["init", "test", "update", "body"],
FunctionDeclaration: ["id", "params", "body"],
FunctionExpression: ["id", "params", "body"],
Identifier: [],
IfStatement: ["test", "consequent", "alternate"],
ImportAttribute: ["key", "value"],
ImportDeclaration: ["specifiers", "source", "attributes"],
ImportDefaultSpecifier: ["local"],
ImportExpression: ["source", "options"],
ImportNamespaceSpecifier: ["local"],
ImportSpecifier: ["imported", "local"],
JSXAttribute: ["name", "value"],
JSXClosingElement: ["name"],
JSXClosingFragment: [],
JSXElement: ["openingElement", "children", "closingElement"],
JSXEmptyExpression: [],
JSXExpressionContainer: ["expression"],
JSXFragment: ["openingFragment", "children", "closingFragment"],
JSXIdentifier: [],
JSXMemberExpression: ["object", "property"],
JSXNamespacedName: ["namespace", "name"],
JSXOpeningElement: ["name", "attributes"],
JSXOpeningFragment: [],
JSXSpreadAttribute: ["argument"],
JSXSpreadChild: ["expression"],
JSXText: [],
LabeledStatement: ["label", "body"],
Literal: [],
LogicalExpression: ["left", "right"],
MemberExpression: ["object", "property"],
MetaProperty: ["meta", "property"],
MethodDefinition: ["key", "value"],
NewExpression: ["callee", "arguments"],
ObjectExpression: ["properties"],
ObjectPattern: ["properties"],
PrivateIdentifier: [],
Program: ["body"],
Property: ["key", "value"],
PropertyDefinition: ["key", "value"],
RestElement: ["argument"],
ReturnStatement: ["argument"],
SequenceExpression: ["expressions"],
SpreadElement: ["argument"],
StaticBlock: ["body"],
Super: [],
SwitchCase: ["test", "consequent"],
SwitchStatement: ["discriminant", "cases"],
TaggedTemplateExpression: ["tag", "quasi"],
TemplateElement: [],
TemplateLiteral: ["quasis", "expressions"],
ThisExpression: [],
ThrowStatement: ["argument"],
TryStatement: ["block", "handler", "finalizer"],
UnaryExpression: ["argument"],
UpdateExpression: ["argument"],
VariableDeclaration: ["declarations"],
VariableDeclarator: ["id", "init"],
WhileStatement: ["test", "body"],
WithStatement: ["object", "body"],
YieldExpression: ["argument"],
};
// Types.
const NODE_TYPES = Object.keys(KEYS);
// Freeze the keys.
for (const type of NODE_TYPES) {
Object.freeze(KEYS[type]);
}
Object.freeze(KEYS);
export default KEYS;
@@ -0,0 +1 @@
{"version":3,"file":"dollar-sign.js","sources":["../../../src/icons/dollar-sign.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name DollarSign\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8bGluZSB4MT0iMTIiIHgyPSIxMiIgeTE9IjIiIHkyPSIyMiIgLz4KICA8cGF0aCBkPSJNMTcgNUg5LjVhMy41IDMuNSAwIDAgMCAwIDdoNWEzLjUgMy41IDAgMCAxIDAgN0g2IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/dollar-sign\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 DollarSign = createLucideIcon('DollarSign', [\n ['line', { x1: '12', x2: '12', y1: '2', y2: '22', key: '7eqyqh' }],\n ['path', { d: 'M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6', key: '1b0p4s' }],\n]);\n\nexport default DollarSign;\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,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACjE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAqD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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;AACpF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,IAAI,EACJ,SAAS,EACT,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,aAAa,EACb,OAAO,EACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAM5F;;;GAGG;AACH,MAAM,WAAW,6BAA8B,SAAQ,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC;IACzG,SAAS,EAAE,gBAAgB,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC;IACnG,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,gBAAgB,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CACxB,WAAW,SAAS,MAAM,EAC1B,MAAM,SAAS,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,EACrE,IAAI,SAAS,SAAS,GAAG,iBAAiB,GAAG,SAAS,GAAG,SAAS,IAClE,IAAI,SAAS,iBAAiB,GAC5B,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,GAC9E,IAAI,SAAS,SAAS,GACpB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,GACpE,CAAC,KAAK,EAAE,MAAM,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,CAChC,WAAW,SAAS,MAAM,EAC1B,IAAI,SAAS,SAAS,GAAG,iBAAiB,GAAG,SAAS,GAAG,SAAS,IAClE,gBAAgB,CAAC,WAAW,EAAE,6BAA6B,EAAE,IAAI,CAAC,CAAC;AAEvE;;;GAGG;AACH,MAAM,MAAM,kBAAkB,CAC1B,WAAW,SAAS,MAAM,EAC1B,IAAI,SAAS,SAAS,GAAG,iBAAiB,GAAG,SAAS,GAAG,SAAS,IAClE,gBAAgB,CAAC,WAAW,EAAE,uBAAuB,EAAE,IAAI,CAAC,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,eAAe,CAAC,IAAI,SAAS,SAAS,GAAG,iBAAiB,GAAG,SAAS,GAAG,SAAS;IAC/F,UAAU,EAAE,wBAAwB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAC7D,OAAO,EAAE,kBAAkB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACjD,aAAa,EAAE,kBAAkB,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;CAC3D;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,CAAC,WAAW,GAAG,aAAa,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG;IAC7G,WAAW,EAAE,WAAW,SAAS,WAAW,GAAG,SAAS,GAAG,KAAK,GAAG,WAAW,CAAC;CAClF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,kBAAkB,GAAG,cAAc,GAAG,WAAW,CAAC;AAE9F,MAAM,WAAW,iBAAiB;IAC9B,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACpD,IAAI,EAAE,SAAS,CAAC;IAChB,iCAAiC;IACjC,OAAO,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IACzD,IAAI,EAAE,cAAc,CAAC;IACrB,sCAAsC;IACtC,OAAO,EAAE,mBAAmB,CAAC;CAChC;AAED,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACrD,IAAI,EAAE,UAAU,CAAC;IACjB,kCAAkC;IAClC,OAAO,EAAE,qBAAqB,CAAC;CAClC;AAED,MAAM,WAAW,WAAY,SAAQ,iBAAiB;IAClD,IAAI,EAAE,OAAO,CAAC;IACd,+BAA+B;IAC/B,OAAO,EAAE,oBAAoB,CAAC;CACjC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErG;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;IAEhF;;;;;;OAMG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;CAC5E;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS;IACtB;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,CAAC,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErH;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAElE;;;;;;;OAOG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnH;;;;;;OAMG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnE;;;;;;;OAOG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpH;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnG;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,OAAO,CAE1D"}
@@ -0,0 +1,10 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_adapter_deno_conninfo = require("./conninfo.js");
const require_adapter_deno_serve_static = require("./serve-static.js");
const require_adapter_deno_ssg = require("./ssg.js");
const require_adapter_deno_websocket = require("./websocket.js");
exports.denoFileSystemModule = require_adapter_deno_ssg.denoFileSystemModule;
exports.getConnInfo = require_adapter_deno_conninfo.getConnInfo;
exports.serveStatic = require_adapter_deno_serve_static.serveStatic;
exports.toSSG = require_adapter_deno_ssg.toSSG;
exports.upgradeWebSocket = require_adapter_deno_websocket.upgradeWebSocket;
@@ -0,0 +1 @@
{"version":3,"file":"bundle-cjs.js","sources":["../../src/src/lib/utils.ts","../../src/src/lib/class-group-utils.ts","../../src/src/lib/lru-cache.ts","../../src/src/lib/parse-class-name.ts","../../src/src/lib/sort-modifiers.ts","../../src/src/lib/config-utils.ts","../../src/src/lib/merge-classlist.ts","../../src/src/lib/tw-join.ts","../../src/src/lib/create-tailwind-merge.ts","../../src/src/lib/from-theme.ts","../../src/src/lib/validators.ts","../../src/src/lib/default-config.ts","../../src/src/lib/merge-configs.ts","../../src/src/lib/extend-tailwind-merge.ts","../../src/src/lib/tw-merge.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["concatArrays","array1","array2","combinedArray","Array","length","i","createClassValidatorObject","classGroupId","validator","createClassPartObject","nextPart","validators","Map","CLASS_PART_SEPARATOR","EMPTY_CONFLICTS","ARBITRARY_PROPERTY_PREFIX","createClassGroupUtils","config","classMap","createClassMap","conflictingClassGroups","conflictingClassGroupModifiers","getClassGroupId","className","startsWith","endsWith","getGroupIdForArbitraryProperty","classParts","split","startIndex","getGroupRecursive","getConflictingClassGroupIds","hasPostfixModifier","modifierConflicts","baseConflicts","classPartObject","classPathsLength","currentClassPart","nextClassPartObject","get","result","undefined","classRest","join","slice","validatorsLength","validatorObj","indexOf","content","colonIndex","property","theme","classGroups","processClassGroups","group","processClassesRecursively","classGroup","len","classDefinition","processClassDefinition","processStringDefinition","processFunctionDefinition","processObjectDefinition","classPartObjectToEdit","getPart","isThemeGetter","push","entries","Object","_entries$i","key","value","path","current","parts","part","next","set","func","createLruCache","maxCacheSize","cacheSize","cache","create","previousCache","update","IMPORTANT_MODIFIER","MODIFIER_SEPARATOR","EMPTY_MODIFIERS","createResultObject","modifiers","hasImportantModifier","baseClassName","maybePostfixModifierPosition","isExternal","createParseClassName","prefix","experimentalParseClassName","parseClassName","bracketDepth","parenDepth","modifierStart","postfixModifierPosition","index","currentCharacter","baseClassNameWithImportantModifier","fullPrefix","parseClassNameOriginal","createSortModifiers","modifierWeights","orderSensitiveModifiers","forEach","mod","currentSegment","modifier","isArbitrary","isOrderSensitive","has","sort","apply","createConfigUtils","_extends","sortModifiers","SPLIT_CLASSES_REGEX","mergeClassList","classList","configUtils","classGroupsInConflict","classNames","trim","originalClassName","_parseClassName","substring","variantModifier","modifierId","classId","conflictGroups","twJoin","argument","resolvedValue","string","arguments","_index","toValue","mix","k","createTailwindMerge","createConfigFirst","_len","createConfigRest","_key","cacheGet","cacheSet","functionToCall","initTailwindMerge","reduce","previousConfig","createConfigCurrent","tailwindMerge","cachedResult","fallbackThemeArr","fromTheme","themeGetter","arbitraryValueRegex","arbitraryVariableRegex","fractionRegex","tshirtUnitRegex","lengthUnitRegex","colorFunctionRegex","shadowRegex","imageRegex","isFraction","test","isNumber","Number","isNaN","isInteger","isPercent","isTshirtSize","isAny","isLengthOnly","isNever","isShadow","isImage","isAnyNonArbitrary","isArbitraryValue","isArbitraryVariable","isArbitrarySize","getIsArbitraryValue","isLabelSize","isArbitraryLength","isLabelLength","isArbitraryNumber","isLabelNumber","isArbitraryWeight","isLabelWeight","isArbitraryFamilyName","isLabelFamilyName","isArbitraryPosition","isLabelPosition","isArbitraryImage","isLabelImage","isArbitraryShadow","isLabelShadow","isArbitraryVariableLength","getIsArbitraryVariable","isArbitraryVariableFamilyName","isArbitraryVariablePosition","isArbitraryVariableSize","isArbitraryVariableImage","isArbitraryVariableShadow","isArbitraryVariableWeight","testLabel","testValue","exec","shouldMatchNoLabel","label","getDefaultConfig","themeColor","themeFont","themeText","themeFontWeight","themeTracking","themeLeading","themeBreakpoint","themeContainer","themeSpacing","themeRadius","themeShadow","themeInsetShadow","themeTextShadow","themeDropShadow","themeBlur","themePerspective","themeAspect","themeEase","themeAnimate","scaleBreak","scalePosition","scalePositionWithArbitrary","concat","scaleOverflow","scaleOverscroll","scaleUnambiguousSpacing","scaleInset","scaleGridTemplateColsRows","scaleGridColRowStartAndEnd","span","scaleGridColRowStartOrEnd","scaleGridAutoColsRows","scaleAlignPrimaryAxis","scaleAlignSecondaryAxis","scaleMargin","scaleSizing","scaleSizingInline","scaleSizingBlock","scaleColor","scaleBgPosition","position","scaleBgRepeat","repeat","scaleBgSize","size","scaleGradientStopPosition","scaleRadius","scaleBorderWidth","scaleLineStyle","scaleBlendMode","scaleMaskImageLine truncated
@@ -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 SquareAsterisk = createLucideIcon("SquareAsterisk", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "M12 8v8", key: "napkw2" }],
["path", { d: "m8.5 14 7-4", key: "12hpby" }],
["path", { d: "m8.5 10 7 4", key: "wwy2dy" }]
]);
export { SquareAsterisk as default };
//# sourceMappingURL=square-asterisk.js.map
@@ -0,0 +1,78 @@
"use client";
import { resolveMotionValue, isControllingVariants, isVariantNode, isAnimationControls, resolveVariantFromProps } from 'motion-dom';
import { useContext } from 'react';
import { MotionContext } from '../../context/MotionContext/index.mjs';
import { PresenceContext } from '../../context/PresenceContext.mjs';
import { useConstant } from '../../utils/use-constant.mjs';
function makeState({ scrapeMotionValuesFromProps, createRenderState, }, props, context, presenceContext) {
const state = {
latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),
renderState: createRenderState(),
};
return state;
}
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
const values = {};
const motionValues = scrapeMotionValues(props, {});
for (const key in motionValues) {
values[key] = resolveMotionValue(motionValues[key]);
}
let { initial, animate } = props;
const isControllingVariants$1 = isControllingVariants(props);
const isVariantNode$1 = isVariantNode(props);
if (context &&
isVariantNode$1 &&
!isControllingVariants$1 &&
props.inherit !== false) {
if (initial === undefined)
initial = context.initial;
if (animate === undefined)
animate = context.animate;
}
let isInitialAnimationBlocked = presenceContext
? presenceContext.initial === false
: false;
isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false;
const variantToSet = isInitialAnimationBlocked ? animate : initial;
if (variantToSet &&
typeof variantToSet !== "boolean" &&
!isAnimationControls(variantToSet)) {
const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
for (let i = 0; i < list.length; i++) {
const resolved = resolveVariantFromProps(props, list[i]);
if (resolved) {
const { transitionEnd, transition, ...target } = resolved;
for (const key in target) {
let valueTarget = target[key];
if (Array.isArray(valueTarget)) {
/**
* Take final keyframe if the initial animation is blocked because
* we want to initialise at the end of that blocked animation.
*/
const index = isInitialAnimationBlocked
? valueTarget.length - 1
: 0;
valueTarget = valueTarget[index];
}
if (valueTarget !== null) {
values[key] = valueTarget;
}
}
for (const key in transitionEnd) {
values[key] = transitionEnd[key];
}
}
}
}
return values;
}
const makeUseVisualState = (config) => (props, isStatic) => {
const context = useContext(MotionContext);
const presenceContext = useContext(PresenceContext);
const make = () => makeState(config, props, context, presenceContext);
return isStatic ? make() : useConstant(make);
};
export { makeUseVisualState };
//# sourceMappingURL=use-visual-state.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"panel-top-dashed.js","sources":["../../../src/icons/panel-top-dashed.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name PanelTopDashed\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHg9IjMiIHk9IjMiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Ik0xNCA5aDEiIC8+CiAgPHBhdGggZD0iTTE5IDloMiIgLz4KICA8cGF0aCBkPSJNMyA5aDIiIC8+CiAgPHBhdGggZD0iTTkgOWgxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/panel-top-dashed\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 PanelTopDashed = createLucideIcon('PanelTopDashed', [\n ['rect', { width: '18', height: '18', x: '3', y: '3', rx: '2', key: 'afitv7' }],\n ['path', { d: 'M14 9h1', key: 'l0svgy' }],\n ['path', { d: 'M19 9h2', key: 'te2zfg' }],\n ['path', { d: 'M3 9h2', key: '1h4ldw' }],\n ['path', { d: 'M9 9h1', key: '15jzuz' }],\n]);\n\nexport default PanelTopDashed;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,iBAAiB,gBAAkB,CAAA,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,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,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,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACvC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACzC,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/use-sync-external-store.production.js');
} else {
module.exports = require('./cjs/use-sync-external-store.development.js');
}
@@ -0,0 +1,58 @@
import { isDynamicRoute } from "./utils.js";
//#region src/helper/ssg/middleware.ts
const SSG_CONTEXT = "HONO_SSG_CONTEXT";
const X_HONO_DISABLE_SSG_HEADER_KEY = "x-hono-disable-ssg";
/**
* @deprecated
* Use `X_HONO_DISABLE_SSG_HEADER_KEY` instead.
* This constant will be removed in the next minor version.
*/
const SSG_DISABLED_RESPONSE = (() => {
try {
return new Response("SSG is disabled", {
status: 404,
headers: { [X_HONO_DISABLE_SSG_HEADER_KEY]: "true" }
});
} catch {
return null;
}
})();
/**
* Define SSG Route
*/
const ssgParams = (params) => async (c, next) => {
if (isDynamicRoute(c.req.path)) {
c.req.raw.ssgParams = Array.isArray(params) ? params : await params(c);
return c.notFound();
}
await next();
};
/**
* @experimental
* `isSSGContext` is an experimental feature.
* The API might be changed.
*/
const isSSGContext = (c) => !!c.env?.[SSG_CONTEXT];
/**
* @experimental
* `disableSSG` is an experimental feature.
* The API might be changed.
*/
const disableSSG = () => async function disableSSG(c, next) {
if (isSSGContext(c)) {
c.header(X_HONO_DISABLE_SSG_HEADER_KEY, "true");
return c.notFound();
}
await next();
};
/**
* @experimental
* `onlySSG` is an experimental feature.
* The API might be changed.
*/
const onlySSG = () => async function onlySSG(c, next) {
if (!isSSGContext(c)) return c.notFound();
await next();
};
//#endregion
export { SSG_CONTEXT, SSG_DISABLED_RESPONSE, X_HONO_DISABLE_SSG_HEADER_KEY, disableSSG, isSSGContext, onlySSG, ssgParams };
@@ -0,0 +1,230 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DEFAULT_EXTENSIONS = void 0;
Object.defineProperty(exports, "File", {
enumerable: true,
get: function () {
return _file.default;
}
});
Object.defineProperty(exports, "buildExternalHelpers", {
enumerable: true,
get: function () {
return _buildExternalHelpers.default;
}
});
Object.defineProperty(exports, "createConfigItem", {
enumerable: true,
get: function () {
return _index2.createConfigItem;
}
});
Object.defineProperty(exports, "createConfigItemAsync", {
enumerable: true,
get: function () {
return _index2.createConfigItemAsync;
}
});
Object.defineProperty(exports, "createConfigItemSync", {
enumerable: true,
get: function () {
return _index2.createConfigItemSync;
}
});
Object.defineProperty(exports, "getEnv", {
enumerable: true,
get: function () {
return _environment.getEnv;
}
});
Object.defineProperty(exports, "loadOptions", {
enumerable: true,
get: function () {
return _index2.loadOptions;
}
});
Object.defineProperty(exports, "loadOptionsAsync", {
enumerable: true,
get: function () {
return _index2.loadOptionsAsync;
}
});
Object.defineProperty(exports, "loadOptionsSync", {
enumerable: true,
get: function () {
return _index2.loadOptionsSync;
}
});
Object.defineProperty(exports, "loadPartialConfig", {
enumerable: true,
get: function () {
return _index2.loadPartialConfig;
}
});
Object.defineProperty(exports, "loadPartialConfigAsync", {
enumerable: true,
get: function () {
return _index2.loadPartialConfigAsync;
}
});
Object.defineProperty(exports, "loadPartialConfigSync", {
enumerable: true,
get: function () {
return _index2.loadPartialConfigSync;
}
});
Object.defineProperty(exports, "parse", {
enumerable: true,
get: function () {
return _parse.parse;
}
});
Object.defineProperty(exports, "parseAsync", {
enumerable: true,
get: function () {
return _parse.parseAsync;
}
});
Object.defineProperty(exports, "parseSync", {
enumerable: true,
get: function () {
return _parse.parseSync;
}
});
exports.resolvePreset = exports.resolvePlugin = void 0;
Object.defineProperty((0, exports), "template", {
enumerable: true,
get: function () {
return _template().default;
}
});
Object.defineProperty((0, exports), "tokTypes", {
enumerable: true,
get: function () {
return _parser().tokTypes;
}
});
Object.defineProperty(exports, "transform", {
enumerable: true,
get: function () {
return _transform.transform;
}
});
Object.defineProperty(exports, "transformAsync", {
enumerable: true,
get: function () {
return _transform.transformAsync;
}
});
Object.defineProperty(exports, "transformFile", {
enumerable: true,
get: function () {
return _transformFile.transformFile;
}
});
Object.defineProperty(exports, "transformFileAsync", {
enumerable: true,
get: function () {
return _transformFile.transformFileAsync;
}
});
Object.defineProperty(exports, "transformFileSync", {
enumerable: true,
get: function () {
return _transformFile.transformFileSync;
}
});
Object.defineProperty(exports, "transformFromAst", {
enumerable: true,
get: function () {
return _transformAst.transformFromAst;
}
});
Object.defineProperty(exports, "transformFromAstAsync", {
enumerable: true,
get: function () {
return _transformAst.transformFromAstAsync;
}
});
Object.defineProperty(exports, "transformFromAstSync", {
enumerable: true,
get: function () {
return _transformAst.transformFromAstSync;
}
});
Object.defineProperty(exports, "transformSync", {
enumerable: true,
get: function () {
return _transform.transformSync;
}
});
Object.defineProperty((0, exports), "traverse", {
enumerable: true,
get: function () {
return _traverse().default;
}
});
exports.version = exports.types = void 0;
var _file = require("./transformation/file/file.js");
var _buildExternalHelpers = require("./tools/build-external-helpers.js");
var resolvers = require("./config/files/index.js");
var _environment = require("./config/helpers/environment.js");
function _types() {
const data = require("@babel/types");
_types = function () {
return data;
};
return data;
}
Object.defineProperty((0, exports), "types", {
enumerable: true,
get: function () {
return _types();
}
});
function _parser() {
const data = require("@babel/parser");
_parser = function () {
return data;
};
return data;
}
function _traverse() {
const data = require("@babel/traverse");
_traverse = function () {
return data;
};
return data;
}
function _template() {
const data = require("@babel/template");
_template = function () {
return data;
};
return data;
}
var _index2 = require("./config/index.js");
var _transform = require("./transform.js");
var _transformFile = require("./transform-file.js");
var _transformAst = require("./transform-ast.js");
var _parse = require("./parse.js");
const version = exports.version = "7.29.7";
const resolvePlugin = (name, dirname) => resolvers.resolvePlugin(name, dirname, false).filepath;
exports.resolvePlugin = resolvePlugin;
const resolvePreset = (name, dirname) => resolvers.resolvePreset(name, dirname, false).filepath;
exports.resolvePreset = resolvePreset;
const DEFAULT_EXTENSIONS = exports.DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"]);
exports.OptionManager = class OptionManager {
init(opts) {
return (0, _index2.loadOptionsSync)(opts);
}
};
exports.Plugin = function Plugin(alias) {
throw new Error(`The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`);
};
0 && (exports.types = exports.traverse = exports.tokTypes = exports.template = 0);
//# sourceMappingURL=index.js.map
@@ -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 Video = createLucideIcon("Video", [
[
"path",
{
d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",
key: "ftymec"
}
],
["rect", { x: "2", y: "6", width: "14", height: "12", rx: "2", key: "158x01" }]
]);
export { Video as default };
//# sourceMappingURL=video.js.map
@@ -0,0 +1 @@
{"version":3,"names":["_gensync","data","require","_index","_index2","_rewriteStackTrace","transformRunner","gensync","transform","code","opts","config","loadConfig","run","exports","optsOrCallback","maybeCallback","callback","undefined","beginHiddenCallStack","sync","errback","transformSync","args","transformAsync","async"],"sources":["../src/transform.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config/index.ts\";\nimport type { InputOptions, ResolvedConfig } from \"./config/index.ts\";\nimport { run } from \"./transformation/index.ts\";\n\nimport type { FileResult, FileResultCallback } from \"./transformation/index.ts\";\nimport { beginHiddenCallStack } from \"./errors/rewrite-stack-trace.ts\";\n\nexport type { FileResult } from \"./transformation/index.ts\";\n\ntype Transform = {\n (code: string, callback: FileResultCallback): void;\n (\n code: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n ): void;\n (code: string, opts?: InputOptions | null): FileResult | null;\n};\n\nconst transformRunner = gensync(function* transform(\n code: string,\n opts?: InputOptions,\n): Handler<FileResult | null> {\n const config: ResolvedConfig | null = yield* loadConfig(opts);\n if (config === null) return null;\n\n return yield* run(config, code);\n});\n\nexport const transform: Transform = function transform(\n code,\n optsOrCallback?: InputOptions | null | undefined | FileResultCallback,\n maybeCallback?: FileResultCallback,\n) {\n let opts: InputOptions | undefined | null;\n let callback: FileResultCallback | undefined;\n if (typeof optsOrCallback === \"function\") {\n callback = optsOrCallback;\n opts = undefined;\n } else {\n opts = optsOrCallback;\n callback = maybeCallback;\n }\n\n if (callback === undefined) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'transform' function expects a callback. If you need to call it synchronously, please use 'transformSync'.\",\n );\n } else {\n // console.warn(\n // \"Starting from Babel 8.0.0, the 'transform' function will expect a callback. If you need to call it synchronously, please use 'transformSync'.\",\n // );\n return beginHiddenCallStack(transformRunner.sync)(code, opts);\n }\n }\n\n beginHiddenCallStack(transformRunner.errback)(code, opts, callback);\n};\n\nexport function transformSync(\n ...args: Parameters<typeof transformRunner.sync>\n) {\n return beginHiddenCallStack(transformRunner.sync)(...args);\n}\nexport function transformAsync(\n ...args: Parameters<typeof transformRunner.async>\n) {\n return beginHiddenCallStack(transformRunner.async)(...args);\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAE,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAGA,IAAAG,kBAAA,GAAAH,OAAA;AAcA,MAAMI,eAAe,GAAGC,SAAMA,CAAC,CAAC,UAAUC,SAASA,CACjDC,IAAY,EACZC,IAAmB,EACS;EAC5B,MAAMC,MAA6B,GAAG,OAAO,IAAAC,cAAU,EAACF,IAAI,CAAC;EAC7D,IAAIC,MAAM,KAAK,IAAI,EAAE,OAAO,IAAI;EAEhC,OAAO,OAAO,IAAAE,WAAG,EAACF,MAAM,EAAEF,IAAI,CAAC;AACjC,CAAC,CAAC;AAEK,MAAMD,SAAoB,GAAAM,OAAA,CAAAN,SAAA,GAAG,SAASA,SAASA,CACpDC,IAAI,EACJM,cAAqE,EACrEC,aAAkC,EAClC;EACA,IAAIN,IAAqC;EACzC,IAAIO,QAAwC;EAC5C,IAAI,OAAOF,cAAc,KAAK,UAAU,EAAE;IACxCE,QAAQ,GAAGF,cAAc;IACzBL,IAAI,GAAGQ,SAAS;EAClB,CAAC,MAAM;IACLR,IAAI,GAAGK,cAAc;IACrBE,QAAQ,GAAGD,aAAa;EAC1B;EAEA,IAAIC,QAAQ,KAAKC,SAAS,EAAE;IASxB,OAAO,IAAAC,uCAAoB,EAACb,eAAe,CAACc,IAAI,CAAC,CAACX,IAAI,EAAEC,IAAI,CAAC;EAEjE;EAEA,IAAAS,uCAAoB,EAACb,eAAe,CAACe,OAAO,CAAC,CAACZ,IAAI,EAAEC,IAAI,EAAEO,QAAQ,CAAC;AACrE,CAAC;AAEM,SAASK,aAAaA,CAC3B,GAAGC,IAA6C,EAChD;EACA,OAAO,IAAAJ,uCAAoB,EAACb,eAAe,CAACc,IAAI,CAAC,CAAC,GAAGG,IAAI,CAAC;AAC5D;AACO,SAASC,cAAcA,CAC5B,GAAGD,IAA8C,EACjD;EACA,OAAO,IAAAJ,uCAAoB,EAACb,eAAe,CAACmB,KAAK,CAAC,CAAC,GAAGF,IAAI,CAAC;AAC7D;AAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2022_full: LibDefinition;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_4D","2":"_KB"},C:{"1":"_OJ _bF","2":"_LP","1025":"wB","1218":"_iE _yQ"},D:{"1":"_LJ _KE","2":"_9E _hD","260":"xB","772":"yB"},E:{"1":"_JB","2":"_RB"},F:{"1":"_XO","2":"_JP","260":"K","772":"OB"},G:{"1":"_9","2":"_iB"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:1,C:"Fetch",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"badge-indian-rupee.js","sources":["../../../src/icons/badge-indian-rupee.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BadgeIndianRupee\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMy44NSA4LjYyYTQgNCAwIDAgMSA0Ljc4LTQuNzcgNCA0IDAgMCAxIDYuNzQgMCA0IDQgMCAwIDEgNC43OCA0Ljc4IDQgNCAwIDAgMSAwIDYuNzQgNCA0IDAgMCAxLTQuNzcgNC43OCA0IDQgMCAwIDEtNi43NSAwIDQgNCAwIDAgMS00Ljc4LTQuNzcgNCA0IDAgMCAxIDAtNi43NloiIC8+CiAgPHBhdGggZD0iTTggOGg4IiAvPgogIDxwYXRoIGQ9Ik04IDEyaDgiIC8+CiAgPHBhdGggZD0ibTEzIDE3LTUtMWgxYTQgNCAwIDAgMCAwLTgiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/badge-indian-rupee\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 BadgeIndianRupee = createLucideIcon('BadgeIndianRupee', [\n [\n 'path',\n {\n d: 'M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z',\n key: '3c2336',\n },\n ],\n ['path', { d: 'M8 8h8', key: '1bis0t' }],\n ['path', { d: 'M8 12h8', key: '1wcyev' }],\n ['path', { d: 'm13 17-5-1h1a4 4 0 0 0 0-8', key: 'nu2bwa' }],\n]);\n\nexport default BadgeIndianRupee;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmB,iBAAiB,kBAAoB,CAAA,CAAA,CAAA;AAAA,CAC5D,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,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,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACvC,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,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;AAC7D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,26 @@
/**
* @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 PackagePlus = createLucideIcon("PackagePlus", [
["path", { d: "M16 16h6", key: "100bgy" }],
["path", { d: "M19 13v6", key: "85cyf1" }],
[
"path",
{
d: "M21 10V8a2 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 0l2-1.14",
key: "e7tb2h"
}
],
["path", { d: "m7.5 4.27 9 5.15", key: "1c824w" }],
["polyline", { points: "3.29 7 12 12 20.71 7", key: "ousv84" }],
["line", { x1: "12", x2: "12", y1: "22", y2: "12", key: "a4e8g8" }]
]);
export { PackagePlus as default };
//# sourceMappingURL=package-plus.js.map
@@ -0,0 +1 @@
{"version":3,"file":"scroll-restoration-inline.js","names":[],"sources":["../../src/scroll-restoration-inline.ts?script-string"],"sourcesContent":["export default function (options: {\n storageKey: string\n key?: string\n behavior?: ScrollToOptions['behavior']\n shouldScrollRestoration?: boolean\n}) {\n let byKey\n\n try {\n byKey = JSON.parse(sessionStorage.getItem(options.storageKey) || '{}')\n } catch (error) {\n console.error(error)\n return\n }\n\n const resolvedKey = options.key || window.history.state?.__TSR_key\n const elementEntries = resolvedKey ? byKey[resolvedKey] : undefined\n\n if (\n options.shouldScrollRestoration &&\n elementEntries &&\n typeof elementEntries === 'object' &&\n Object.keys(elementEntries).length > 0\n ) {\n for (const elementSelector in elementEntries) {\n const entry = elementEntries[elementSelector]\n\n if (!entry || typeof entry !== 'object') {\n continue\n }\n\n const scrollX = entry.scrollX\n const scrollY = entry.scrollY\n\n if (!Number.isFinite(scrollX) || !Number.isFinite(scrollY)) {\n continue\n }\n\n if (elementSelector === 'window') {\n window.scrollTo({\n top: scrollY,\n left: scrollX,\n behavior: options.behavior,\n })\n } else if (elementSelector) {\n let element\n\n try {\n element = document.querySelector(elementSelector)\n } catch {\n continue\n }\n\n if (element) {\n element.scrollLeft = scrollX\n element.scrollTop = scrollY\n }\n }\n }\n\n return\n }\n\n const hash = window.location.hash.split('#', 2)[1]\n\n if (hash) {\n const hashScrollIntoViewOptions =\n window.history.state?.__hashScrollIntoViewOptions ?? true\n\n if (hashScrollIntoViewOptions) {\n const el = document.getElementById(hash)\n if (el) {\n el.scrollIntoView(hashScrollIntoViewOptions)\n }\n }\n\n return\n }\n\n window.scrollTo({ top: 0, left: 0, behavior: options.behavior })\n}\n"],"mappings":";AAAA,IAAA,oCAAe"}
@@ -0,0 +1,21 @@
import { flattenedVerify } from '../flattened/verify.js';
import { JWSInvalid } from '../../util/errors.js';
import { decoder } from '../../lib/buffer_utils.js';
export async function compactVerify(jws, key, options) {
if (jws instanceof Uint8Array) {
jws = decoder.decode(jws);
}
if (typeof jws !== 'string') {
throw new JWSInvalid('Compact JWS must be a string or Uint8Array');
}
const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split('.');
if (length !== 3) {
throw new JWSInvalid('Invalid Compact JWS');
}
const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options);
const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };
if (typeof key === 'function') {
return { ...result, key: verified.key };
}
return result;
}
@@ -0,0 +1 @@
{"version":3,"file":"use-viewport-scroll.mjs","sources":["../../../../src/value/scroll/use-viewport-scroll.ts"],"sourcesContent":["import { warnOnce } from \"motion-utils\"\nimport { useScroll } from \"../use-scroll\"\n\n/**\n * @deprecated useViewportScroll is deprecated. Convert to useScroll()\n */\nexport function useViewportScroll() {\n if (process.env.NODE_ENV !== \"production\") {\n warnOnce(\n false,\n \"useViewportScroll is deprecated. Convert to useScroll().\"\n )\n }\n return useScroll()\n}\n"],"names":[],"mappings":";;;AAGA;;AAEG;SACa,iBAAiB,GAAA;IAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;AACvC,QAAA,QAAQ,CACJ,KAAK,EACL,0DAA0D,CAC7D;IACL;IACA,OAAO,SAAS,EAAE;AACtB;;;;"}
@@ -0,0 +1,466 @@
flf2a$ 4 4 16 1 57
smkeyboard.flf
Adapted for figlet by Kent Nassen, kentn@cyberspace.org, 11/22/94, based
on the idea:
From: bas@damek.kth.se (Bas Meijer)
Newsgroups: rec.arts.ascii
Subject: Talk-line: keyboard.flf
Date: 22 Nov 1994 07:26:10 -0600
Organization: Royal Institute of Technology
Lines: 41
Sender: boba@gagme.wwa.com
Approved: boba@wwa.com
Message-ID: <3asrhi$con@gagme.wwa.com>
References: <3asltp$aog@gagme.wwa.com>
Reply-To: bas@damek.kth.se
NNTP-Posting-Host: gagme.wwa.com
In article aog@gagme.wwa.com, ssfiit@cs.umb.edu (SuperStreetFighter2Turbo) writes:
>
> I have composed a new figlet font! =)
> it is called keyboard.flf. It resemble the actual keyboard, well, kinda! =)
> anyway! here is a sample! =)
> _______ _______ _______ _______ _______ _______
> |\ /|\ /|\ /|\ /|\ /|\ /|
> | +---+ | +---+ | +---+ | +---+ | +---+ | +---+ |
> | | | | | | | | | | | | | | | | | | |
> | |s | | |a | | |m | | |p | | |l | | |e | |
> | +---+ | +---+ | +---+ | +---+ | +---+ | +---+ |
> |/_____\|/_____\|/_____\|/_____\|/_____\|/_____\|
____ _________ ____ ____ ____ _________ ____ ____ ____ _________
||A ||| |||B |||I |||T ||| |||T |||O |||O ||| ||
||__|||_______|||__|||__|||__|||_______|||__|||__|||__|||_______||
|/__\|/_______\|/__\|/__\|/__\|/_______\|/__\|/__\|/__\|/_______\|____
||B |||I |||G ||| |||I |||F ||| |||Y |||O |||U ||| ||
||__|||__|||__|||_______|||__|||__|||_______|||__|||__|||__|||_______||
|/__\|/__\|/__\|/_______\|/__\|/__\|/_______\|/__\|/__\|/__\|/_______\|
||A |||S |||K ||| |||M |||E |||! ||| |||: |||) |||Return||
||__|||__|||__|||_______|||__|||__|||__|||_______|||__|||__||| ||
|/__\|/__\|/__\|/_______\|/__\|/__\|/__\|/_______\|/__\|/__\|/l ||
l|_____||
Bas. |/_____\|
email: bas@damek.kth.se ____ ____ KTH, Dept. of Mach. Design
_______ ___ ______ / \/ \ ____________________________
( \/ \/ \ / \ ) ) ) ) \
| | ) \ \___) / \ \__/\ /\ \ \__/ | )
| ( | \_ \ ( ( ) ) )_ ( )_) \ )_| (
| | ) _ )\ ) \ \__/ / / \/ \ / / \ \ \
(_______/_/ \__/_____/ \ \/ /_______)___)___/______)__/\___)
\____/\____/
tel.: +46-(0)8-790 6308 S-100 44 Stockholm, Sweden
_________ @
|| ||@
||_______||@
|/_______\|@@
____ @
||! ||@
||__||@
|/__\|@@
____ @
||" ||@
||__||@
|/__\|@@
____ @
||# ||@
||__||@
|/__\|@@
____ @
||$ ||@
||__||@
|/__\|@@
____ @
||% ||@
||__||@
|/__\|@@
____ @
||& ||@
||__||@
|/__\|@@
____ @
||' ||@
||__||@
|/__\|@@
____ @
||( ||@
||__||@
|/__\|@@
____ @
||) ||@
||__||@
|/__\|@@
____ @
||* ||@
||__||@
|/__\|@@
____ @
||+ ||@
||__||@
|/__\|@@
____ @
||, ||@
||__||@
|/__\|@@
____ @
||- ||@
||__||@
|/__\|@@
____ @
||. ||@
||__||@
|/__\|@@
____ @
||/ ||@
||__||@
|/__\|@@
____ @
||0 ||@
||__||@
|/__\|@@
____ @
||1 ||@
||__||@
|/__\|@@
____ @
||2 ||@
||__||@
|/__\|@@
____ @
||3 ||@
||__||@
|/__\|@@
____ @
||4 ||@
||__||@
|/__\|@@
____ @
||5 ||@
||__||@
|/__\|@@
____ @
||6 ||@
||__||@
|/__\|@@
____ @
||7 ||@
||__||@
|/__\|@@
____ @
||8 ||@
||__||@
|/__\|@@
____ @
||9 ||@
||__||@
|/__\|@@
____ @
||: ||@
||__||@
|/__\|@@
____ @
||; ||@
||__||@
|/__\|@@
____ @
||< ||@
||__||@
|/__\|@@
____ @
||= ||@
||__||@
|/__\|@@
____ @
||> ||@
||__||@
|/__\|@@
____ @
||? ||@
||__||@
|/__\|@@
____ @
||@ ||@
||__||@
|/__\|@@
____ @
||A ||@
||__||@
|/__\|@@
____ @
||B ||@
||__||@
|/__\|@@
____ @
||C ||@
||__||@
|/__\|@@
____ @
||D ||@
||__||@
|/__\|@@
____ @
||E ||@
||__||@
|/__\|@@
____ @
||F ||@
||__||@
|/__\|@@
____ @
||G ||@
||__||@
|/__\|@@
____ @
||H ||@
||__||@
|/__\|@@
____ @
||I ||@
||__||@
|/__\|@@
____ @
||J ||@
||__||@
|/__\|@@
____ @
||K ||@
||__||@
|/__\|@@
____ @
||L ||@
||__||@
|/__\|@@
____ @
||M ||@
||__||@
|/__\|@@
____ @
||N ||@
||__||@
|/__\|@@
____ @
||O ||@
||__||@
|/__\|@@
____ @
||P ||@
||__||@
|/__\|@@
____ @
||Q ||@
||__||@
|/__\|@@
____ @
||R ||@
||__||@
|/__\|@@
____ @
||S ||@
||__||@
|/__\|@@
____ @
||T ||@
||__||@
|/__\|@@
____ @
||U ||@
||__||@
|/__\|@@
____ @
||V ||@
||__||@
|/__\|@@
____ @
||W ||@
||__||@
|/__\|@@
____ @
||X ||@
||__||@
|/__\|@@
____ @
||Y ||@
||__||@
|/__\|@@
____ @
||Z ||@
||__||@
|/__\|@@
____ @
||[ ||@
||__||@
|/__\|@@
____ @
||\ ||@
||__||@
|/__\|@@
____ @
||] ||@
||__||@
|/__\|@@
____ @
||^ ||@
||__||@
|/__\|@@
____ @
||_ ||@
||__||@
|/__\|@@
____ @
||` ||@
||__||@
|/__\|@@
____ @
||a ||@
||__||@
|/__\|@@
____ @
||b ||@
||__||@
|/__\|@@
____ @
||c ||@
||__||@
|/__\|@@
____ @
||d ||@
||__||@
|/__\|@@
____ @
||e ||@
||__||@
|/__\|@@
____ @
||f ||@
||__||@
|/__\|@@
____ @
||g ||@
||__||@
|/__\|@@
____ @
||h ||@
||__||@
|/__\|@@
____ @
||i ||@
||__||@
|/__\|@@
____ @
||j ||@
||__||@
|/__\|@@
____ @
||k ||@
||__||@
|/__\|@@
____ @
||l ||@
||__||@
|/__\|@@
____ @
||m ||@
||__||@
|/__\|@@
____ @
||n ||@
||__||@
|/__\|@@
____ @
||o ||@
||__||@
|/__\|@@
____ @
||p ||@
||__||@
|/__\|@@
____ @
||q ||@
||__||@
|/__\|@@
____ @
||r ||@
||__||@
|/__\|@@
____ @
||s ||@
||__||@
|/__\|@@
____ @
||t ||@
||__||@
|/__\|@@
____ @
||u ||@
||__||@
|/__\|@@
____ @
||v ||@
||__||@
|/__\|@@
____ @
||w ||@
||__||@
|/__\|@@
____ @
||x ||@
||__||@
|/__\|@@
____ @
||y ||@
||__||@
|/__\|@@
____ @
||z ||@
||__||@
|/__\|@@
____ @
||{ ||@
||__||@
|/__\|@@
____ @
||| ||@
||__||@
|/__\|@@
____ @
||} ||@
||__||@
|/__\|@@
____ @
||~ ||@
||__||@
|/__\|@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@@ -0,0 +1,735 @@
import { loadRouteChunk } from './load-matches.cjs';
import { LRUCache } from './lru-cache.cjs';
import { ProcessRouteTreeResult, ProcessedTree } from './new-process-route-tree.cjs';
import { SearchParser, SearchSerializer } from './searchParams.cjs';
import { AnyRedirect, ResolvedRedirect } from './redirect.cjs';
import { HistoryLocation, HistoryState, ParsedHistoryState, RouterHistory } from '@tanstack/history';
import { Awaitable, Constrain, ControlledPromise, NoInfer, NonNullableUpdater, PickAsRequired, Updater } from './utils.cjs';
import { ParsedLocation } from './location.cjs';
import { AnyContext, AnyRoute, AnyRouteWithContext, LoaderStaleReloadMode, MakeRemountDepsOptionsUnion, RouteLike, RouteMask } from './route.cjs';
import { FullSearchSchema, RouteById, RoutePaths, RoutesById, RoutesByPath } from './routeInfo.cjs';
import { AnyRouteMatch, MakeRouteMatchUnion, MatchRouteOptions } from './Matches.cjs';
import { BuildLocationFn, CommitLocationOptions, NavigateFn } from './RouterProvider.cjs';
import { Manifest, RouterManagedTag } from './manifest.cjs';
import { AnySchema } from './validators.cjs';
import { NavigateOptions, ResolveRelativePath, ToOptions } from './link.cjs';
import { AnySerializationAdapter, ValidateSerializableInput } from './ssr/serializer/transformer.cjs';
import { GetStoreConfig, RouterStores } from './stores.cjs';
export type ControllablePromise<T = any> = Promise<T> & {
resolve: (value: T) => void;
reject: (value?: any) => void;
};
export type InjectedHtmlEntry = Promise<string>;
export interface Register {
}
export type RegisteredSsr<TRegister = Register> = TRegister extends {
ssr: infer TSSR;
} ? TSSR : false;
export type RegisteredRouter<TRegister = Register> = TRegister extends {
router: infer TRouter;
} ? TRouter : AnyRouter;
export type RegisteredConfigType<TRegister, TKey> = TRegister extends {
config: infer TConfig;
} ? TConfig extends {
'~types': infer TTypes;
} ? TKey extends keyof TTypes ? TTypes[TKey] : unknown : unknown : unknown;
export type DefaultRemountDepsFn<TRouteTree extends AnyRoute> = (opts: MakeRemountDepsOptionsUnion<TRouteTree>) => any;
export interface DefaultRouterOptionsExtensions {
}
export interface RouterOptionsExtensions extends DefaultRouterOptionsExtensions {
}
export type SSROption = boolean | 'data-only';
export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean = false, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated = undefined> extends RouterOptionsExtensions {
/**
* The history object that will be used to manage the browser history.
*
* If not provided, a new createBrowserHistory instance will be created and used.
*
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#history-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/history-types)
*/
history?: TRouterHistory;
/**
* A function that will be used to stringify search params when generating links.
*
* @default defaultStringifySearch
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#stringifysearch-method)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
*/
stringifySearch?: SearchSerializer;
/**
* A function that will be used to parse search params when parsing the current location.
*
* @default defaultParseSearch
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#parsesearch-method)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
*/
parseSearch?: SearchParser;
/**
* If `false`, routes will not be preloaded by default in any way.
*
* If `'intent'`, routes will be preloaded by default when the user hovers over a link or a `touchstart` event is detected on a `<Link>`.
*
* If `'viewport'`, routes will be preloaded by default when they are within the viewport.
*
* @default false
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreload-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
*/
defaultPreload?: false | 'intent' | 'viewport' | 'render';
/**
* The delay in milliseconds that a route must be hovered over or touched before it is preloaded.
*
* @default 50
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloaddelay-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-delay)
*/
defaultPreloadDelay?: number;
/**
* The default `preloadIntentProximity` a route should use if no preloadIntentProximity is provided.
*
* @default 0
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadintentproximity-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-intent-proximity)
*/
defaultPreloadIntentProximity?: number;
/**
* The default `pendingMs` a route should use if no pendingMs is provided.
*
* @default 1000
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingms-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
*/
defaultPendingMs?: number;
/**
* The default `pendingMinMs` a route should use if no pendingMinMs is provided.
*
* @default 500
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingminms-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
*/
defaultPendingMinMs?: number;
/**
* The default `staleTime` a route should use if no staleTime is provided. This is the time in milliseconds that a route will be considered fresh.
*
* @default 0
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstaletime-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
*/
defaultStaleTime?: number;
/**
* The default stale reload mode a route loader should use if no `loader.staleReloadMode` is provided.
*
* `'background'` preserves the current stale-while-revalidate behavior.
* `'blocking'` waits for stale loader reloads to complete before resolving navigation.
*
* @default 'background'
*/
defaultStaleReloadMode?: LoaderStaleReloadMode;
/**
* The default `preloadStaleTime` a route should use if no preloadStaleTime is provided.
*
* @default 30_000 `(30 seconds)`
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadstaletime-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
*/
defaultPreloadStaleTime?: number;
/**
* The default `defaultPreloadGcTime` a route should use if no preloadGcTime is provided.
*
* @default 1_800_000 `(30 minutes)`
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadgctime-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
*/
defaultPreloadGcTime?: number;
/**
* If `true`, route navigations will called using `document.startViewTransition()`.
*
* If the browser does not support this api, this option will be ignored.
*
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works.
*
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultviewtransition-property)
*/
defaultViewTransition?: boolean | ViewTransitionOptions;
/**
* The default `hashScrollIntoView` a route should use if no hashScrollIntoView is provided while navigating
*
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`.
*
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulthashscrollintoview-property)
*/
defaultHashScrollIntoView?: boolean | ScrollIntoViewOptions;
/**
* @default 'fuzzy'
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundmode-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#the-notfoundmode-option)
*/
notFoundMode?: 'root' | 'fuzzy';
/**
* The default `gcTime` a route should use if no gcTime is provided.
*
* @default 1_800_000 `(30 minutes)`
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultgctime-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
*/
defaultGcTime?: number;
/**
* If `true`, all routes will be matched as case-sensitive.
*
* @default false
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#casesensitive-property)
*/
caseSensitive?: boolean;
/**
*
* The route tree that will be used to configure the router instance.
*
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routetree-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/routing/route-trees)
*/
routeTree?: TRouteTree;
/**
* The basepath for then entire router. This is useful for mounting a router instance at a subpath.
* ```
* @default '/'
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#basepath-property)
*/
basepath?: string;
/**
* The root context that will be provided to all routes in the route tree.
*
* This can be used to provide a context to all routes in the tree without having to provide it to each route individually.
*
* Optional or required if the root route was created with [`createRootRouteWithContext()`](https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction).
*
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#context-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/router-context)
*/
context?: InferRouterContext<TRouteTree>;
additionalContext?: any;
/**
* A function that will be called when the router is dehydrated.
*
* The return value of this function will be serialized and stored in the router's dehydrated state.
*
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#dehydrate-method)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
*/
dehydrate?: () => Constrain<TDehydrated, ValidateSerializableInput<Register, TDehydrated>>;
/**
* A function that will be called when the router is hydrated.
*
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#hydrate-method)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
*/
hydrate?: (dehydrated: TDehydrated) => Awaitable<void>;
/**
* An array of route masks that will be used to mask routes in the route tree.
*
* Route masking is when you display a route at a different path than the one it is configured to match, like a modal popup that when shared will unmask to the modal's content instead of the modal's context.
*
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routemasks-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking)
*/
routeMasks?: Array<RouteMask<TRouteTree>>;
/**
* If `true`, route masks will, by default, be removed when the page is reloaded.
*
* This can be overridden on a per-mask basis by setting the `unmaskOnReload` option on the mask, or on a per-navigation basis by setting the `unmaskOnReload` option in the `Navigate` options.
*
* @default false
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#unmaskonreload-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking#unmasking-on-page-reload)
*/
unmaskOnReload?: boolean;
/**
* Use `notFoundComponent` instead.
*
* @deprecated
* See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundroute-property)
*/
notFoundRoute?: AnyRoute;
/**
* Configures how trailing slashes are treated.
*
* - `'always'` will add a trailing slash if not present
* - `'never'` will remove the trailing slash if present
* - `'preserve'` will not modify the trailing slash.
*
* @default 'never'
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#trailingslash-property)
*/
trailingSlash?: TTrailingSlashOption;
/**
* While usually automatic, sometimes it can be useful to force the router into a server-side state, e.g. when using the router in a non-browser environment that has access to a global.document object.
*
* @default typeof document !== 'undefined'
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver-property)
*/
isServer?: boolean;
/**
* @default false
*/
isShell?: boolean;
/**
* @default false
*/
isPrerendering?: boolean;
/**
* The default `ssr` a route should use if no `ssr` is provided.
*
* @default true
*/
defaultSsr?: SSROption;
search?: {
/**
* Configures how unknown search params (= not returned by any `validateSearch`) are treated.
*
* @default false
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#search.strict-property)
*/
strict?: boolean;
};
/**
* Configures whether structural sharing is enabled by default for fine-grained selectors.
*
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstructuralsharing-property)
*/
defaultStructuralSharing?: TDefaultStructuralSharingOption;
/**
* Configures which URI characters are allowed in path params that would ordinarily be escaped by encodeURIComponent.
*
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#pathparamsallowedcharacters-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/path-params#allowed-characters)
*/
pathParamsAllowedCharacters?: Array<';' | ':' | '@' | '&' | '=' | '+' | '$' | ','>;
defaultRemountDeps?: DefaultRemountDepsFn<TRouteTree>;
/**
* If `true`, scroll restoration will be enabled
*
* @default false
*/
scrollRestoration?: boolean | ((opts: {
location: ParsedLocation;
}) => boolean);
/**
* A function that will be called to get the key for the scroll restoration cache.
*
* @default (location) => location.href
*/
getScrollRestorationKey?: (location: ParsedLocation) => string;
/**
* The default behavior for scroll restoration.
*
* @default 'auto'
*/
scrollRestorationBehavior?: ScrollBehavior;
/**
* An array of selectors that will be used to scroll to the top of the page in addition to `window`
*
* @default ['window']
*/
scrollToTopSelectors?: Array<string | (() => Element | null | undefined)>;
/**
* When `true`, disables the global catch boundary that normally wraps all route matches.
* This allows unhandled errors to bubble up to top-level error handlers in the browser.
*
* Useful for testing tools (like Storybook Test Runner), error reporting services,
* and debugging scenarios where you want errors to reach the browser's global error handlers.
*
* @default false
*/
disableGlobalCatchBoundary?: boolean;
/**
* An array of URL protocols to allow in links, redirects, and navigation.
* Absolute URLs with protocols not in this list will be rejected.
*
* @default DEFAULT_PROTOCOL_ALLOWLIST (http:, https:, mailto:, tel:)
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#protocolallowlist-property)
*/
protocolAllowlist?: Array<string>;
serializationAdapters?: ReadonlyArray<AnySerializationAdapter>;
/**
* Configures how the router will rewrite the location between the actual href and the internal href of the router.
*
* @default undefined
* @description You can provide a custom rewrite pair (in/out).
* This is useful for shifting data from the origin to the path (for things like subdomain routing), or other advanced use cases.
*/
rewrite?: LocationRewrite;
origin?: string;
ssr?: {
nonce?: string;
};
}
export type LocationRewrite = {
/**
* A function that will be called to rewrite the URL before it is interpreted by the router from the history instance.
*
* @default undefined
*/
input?: LocationRewriteFunction;
/**
* A function that will be called to rewrite the URL before it is committed to the actual history instance from the router.
*
* @default undefined
*/
output?: LocationRewriteFunction;
};
/**
* A function that will be called to rewrite the URL.
*
* @param url The URL to rewrite.
* @returns The rewritten URL (as a URL instance or full href string) or undefined if no rewrite is needed.
*/
export type LocationRewriteFunction = ({ url, }: {
url: URL;
}) => undefined | string | URL;
export interface RouterState<in out TRouteTree extends AnyRoute = AnyRoute, in out TRouteMatch = MakeRouteMatchUnion> {
status: 'pending' | 'idle';
loadedAt: number;
isLoading: boolean;
isTransitioning: boolean;
matches: Array<TRouteMatch>;
location: ParsedLocation<FullSearchSchema<TRouteTree>>;
resolvedLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>;
statusCode: number;
redirect?: AnyRedirect;
}
export interface BuildNextOptions {
to?: string | number | null;
params?: true | Updater<unknown>;
search?: true | Updater<unknown>;
hash?: true | Updater<string>;
state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>;
mask?: {
to?: string | number | null;
params?: true | Updater<unknown>;
search?: true | Updater<unknown>;
hash?: true | Updater<string>;
state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>;
unmaskOnReload?: boolean;
};
from?: string;
href?: string;
_fromLocation?: ParsedLocation;
unsafeRelative?: 'path';
_isNavigate?: boolean;
}
type NavigationEventInfo = {
fromLocation?: ParsedLocation;
toLocation: ParsedLocation;
pathChanged: boolean;
hrefChanged: boolean;
hashChanged: boolean;
};
export interface RouterEvents {
onBeforeNavigate: {
type: 'onBeforeNavigate';
} & NavigationEventInfo;
onBeforeLoad: {
type: 'onBeforeLoad';
} & NavigationEventInfo;
onLoad: {
type: 'onLoad';
} & NavigationEventInfo;
onResolved: {
type: 'onResolved';
} & NavigationEventInfo;
onBeforeRouteMount: {
type: 'onBeforeRouteMount';
} & NavigationEventInfo;
onRendered: {
type: 'onRendered';
} & NavigationEventInfo;
}
export type RouterEvent = RouterEvents[keyof RouterEvents];
export type ListenerFn<TEvent extends RouterEvent> = (event: TEvent) => void;
export type RouterListener<TRouterEvent extends RouterEvent> = {
eventType: TRouterEvent['type'];
fn: ListenerFn<TRouterEvent>;
};
export type SubscribeFn = <TType extends keyof RouterEvents>(eventType: TType, fn: ListenerFn<RouterEvents[TType]>) => () => void;
export interface MatchRoutesOpts {
preload?: boolean;
throwOnError?: boolean;
dest?: BuildNextOptions;
}
export type InferRouterContext<TRouteTree extends AnyRoute> = TRouteTree['types']['routerContext'];
export type RouterContextOptions<TRouteTree extends AnyRoute> = AnyContext extends InferRouterContext<TRouteTree> ? {
context?: InferRouterContext<TRouteTree>;
} : {
context: InferRouterContext<TRouteTree>;
};
export type RouterConstructorOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>> = Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, 'context' | 'serializationAdapters' | 'defaultSsr'> & RouterContextOptions<TRouteTree>;
export type PreloadRouteFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory> = <TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string | undefined = undefined, TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''>(opts: NavigateOptions<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>, TFrom, TTo, TMaskFrom, TMaskTo> & {}) => Promise<Array<AnyRouteMatch> | undefined>;
export type MatchRouteFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory> = <TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string | undefined = undefined, TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>, TFrom, TTo>, opts?: MatchRouteOptions) => false | RouteById<TRouteTree, TResolved>['types']['allParams'];
export type UpdateFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>> = (newOptions: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>) => void;
export type InvalidateFn<TRouter extends AnyRouter> = (opts?: {
filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean;
sync?: boolean;
forcePending?: boolean;
}) => Promise<void>;
export type ParseLocationFn<TRouteTree extends AnyRoute> = (locationToParse: HistoryLocation, previousLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>) => ParsedLocation<FullSearchSchema<TRouteTree>>;
export type GetMatchRoutesFn = (pathname: string) => {
matchedRoutes: ReadonlyArray<AnyRoute>;
/** exhaustive params, still in their string form */
routeParams: Record<string, string>;
foundRoute: AnyRoute | undefined;
parseError?: unknown;
};
export type EmitFn = (routerEvent: RouterEvent) => void;
export type LoadFn = (opts?: {
sync?: boolean;
}) => Promise<void>;
export type CommitLocationFn = ({ viewTransition, ignoreBlocker, ...next }: ParsedLocation & CommitLocationOptions) => Promise<void>;
export type StartTransitionFn = (fn: () => void) => void;
export interface MatchRoutesFn {
(pathname: string, locationSearch?: AnySchema, opts?: MatchRoutesOpts): Array<MakeRouteMatchUnion>;
/**
* @deprecated use the following signature instead
*/
(next: ParsedLocation, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
(pathnameOrNext: string | ParsedLocation, locationSearchOrOpts?: AnySchema | MatchRoutesOpts, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
}
export type GetMatchFn = (matchId: string) => AnyRouteMatch | undefined;
export type UpdateMatchFn = (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
export type LoadRouteChunkFn = (route: AnyRoute) => Promise<Array<void>>;
export type ResolveRedirect = (err: AnyRedirect) => ResolvedRedirect;
export type ClearCacheFn<TRouter extends AnyRouter> = (opts?: {
filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean;
}) => void;
export interface ServerSsr {
/**
* Injects HTML synchronously into the stream.
* Emits an onInjectedHtml event that listeners can handle.
* If no subscriber is listening, the HTML is buffered and can be retrieved via takeBufferedHtml().
*/
injectHtml: (html: string) => void;
/**
* Injects a script tag synchronously into the stream.
*/
injectScript: (script: string) => void;
isDehydrated: () => boolean;
isSerializationFinished: () => boolean;
onRenderFinished: (listener: () => void) => void;
setRenderFinished: () => void;
cleanup: () => void;
onSerializationFinished: (listener: () => void) => void;
dehydrate: (opts?: {
requestAssets?: Array<RouterManagedTag>;
}) => Promise<void>;
takeBufferedScripts: () => RouterManagedTag | undefined;
/**
* Takes any buffered HTML that was injected.
* Returns the buffered HTML string (which may include multiple script tags) or undefined if empty.
*/
takeBufferedHtml: () => string | undefined;
liftScriptBarrier: () => void;
}
export type AnyRouterWithContext<TContext> = RouterCore<AnyRouteWithContext<TContext>, any, any, any, any>;
export type AnyRouter = RouterCore<any, any, any, any, any>;
export interface ViewTransitionOptions {
types: Array<string> | ((locationChangeInfo: {
fromLocation?: ParsedLocation;
toLocation: ParsedLocation;
pathChanged: boolean;
hrefChanged: boolean;
hashChanged: boolean;
}) => Array<string> | false);
}
/**
* Convert an unknown error into a minimal, serializable object.
* Includes name and message (and stack in development).
*/
export declare function defaultSerializeError(err: unknown): {
name: string;
message: string;
} | {
data: unknown;
};
/** Options for configuring trailing-slash behavior. */
export declare const trailingSlashOptions: {
readonly always: "always";
readonly never: "never";
readonly preserve: "preserve";
};
export type TrailingSlashOption = (typeof trailingSlashOptions)[keyof typeof trailingSlashOptions];
/**
* Compute whether path, href or hash changed between previous and current
* resolved locations.
*/
export declare function getLocationChangeInfo(location: ParsedLocation, resolvedLocation?: ParsedLocation): {
fromLocation: ParsedLocation<{}> | undefined;
toLocation: ParsedLocation<{}>;
pathChanged: boolean;
hrefChanged: boolean;
hashChanged: boolean;
};
export type CreateRouterFn = <TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption = 'never', TDefaultStructuralSharingOption extends boolean = false, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated extends Record<string, any> = Record<string, any>>(options: undefined extends number ? 'strictNullChecks must be enabled in tsconfig.json' : RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>) => RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
declare global {
var __TSR_CACHE__: {
routeTree: AnyRoute;
processRouteTreeResult: ProcessRouteTreeResult<AnyRoute>;
resolvePathCache: LRUCache<string, string>;
} | undefined;
}
/**
* Core, framework-agnostic router engine that powers TanStack Router.
*
* Provides navigation, matching, loading, preloading, caching and event APIs
* used by framework adapters (React/Solid). Prefer framework helpers like
* `createRouter` in app code.
*
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType
*/
export declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption, in out TDefaultStructuralSharingOption extends boolean, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> {
tempLocationKey: string | undefined;
resetNextScroll: boolean;
shouldViewTransition?: boolean | ViewTransitionOptions;
isViewTransitionTypesSupported?: boolean;
subscribers: Set<RouterListener<RouterEvent>>;
viewTransitionPromise?: ControlledPromise<true>;
isScrollRestoring: boolean;
isScrollRestorationSetup: boolean;
stores: RouterStores<TRouteTree>;
private getStoreConfig;
batch: (fn: () => void) => void;
options: PickAsRequired<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, 'stringifySearch' | 'parseSearch' | 'context'>;
history: TRouterHistory;
rewrite?: LocationRewrite;
origin?: string;
latestLocation: ParsedLocation<FullSearchSchema<TRouteTree>>;
pendingBuiltLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>;
basepath: string;
routeTree: TRouteTree;
routesById: RoutesById<TRouteTree>;
routesByPath: RoutesByPath<TRouteTree>;
processedTree: ProcessedTree<TRouteTree, any, any>;
resolvePathCache: LRUCache<string, string>;
private routeBranchCache;
isServer: boolean;
pathParamsDecoder?: (encoded: string) => string;
protocolAllowlist: Set<string>;
/**
* @deprecated Use the `createRouter` function instead
*/
constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, getStoreConfig: GetStoreConfig);
startTransition: StartTransitionFn;
isShell(): boolean;
isPrerendering(): boolean;
update: UpdateFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
get state(): RouterState<TRouteTree>;
updateLatestLocation: () => void;
buildRouteTree: () => ProcessRouteTreeResult<TRouteTree>;
setRoutes({ routesById, routesByPath, processedTree, }: ProcessRouteTreeResult<TRouteTree>): void;
/**
* Subscribe to router lifecycle events like `onBeforeNavigate`, `onLoad`,
* `onResolved`, etc. Returns an unsubscribe function.
*
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterEventsType
*/
subscribe: SubscribeFn;
emit: EmitFn;
/**
* Parse a HistoryLocation into a strongly-typed ParsedLocation using the
* current router options, rewrite rules and search parser/stringifier.
*/
parseLocation: ParseLocationFn<TRouteTree>;
/** Resolve a path using the router's trailing-slash policy. */
resolvePathWithBase: (from: string, path: string) => string;
private getRouteBranch;
get looseRoutesById(): Record<string, AnyRoute>;
matchRoutes: MatchRoutesFn;
private getParentContext;
private matchRoutesInternal;
getMatchedRoutes: GetMatchRoutesFn;
/**
* Lightweight route matching for buildLocation.
* Only computes fullPath, accumulated search, and params - skipping expensive
* operations like AbortController, ControlledPromise, loaderDeps, and full match objects.
*/
private matchRoutesLightweight;
cancelMatch: (id: string) => void;
cancelMatches: () => void;
/**
* Build the next ParsedLocation from navigation options without committing.
* Resolves `to`/`from`, params/search/hash/state, applies search validation
* and middlewares, and returns a stable, stringified location object.
*
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType#buildlocation-method
*/
buildLocation: BuildLocationFn;
commitLocationPromise: undefined | ControlledPromise<void>;
/**
* Commit a previously built location to history (push/replace), optionally
* using view transitions and scroll restoration options.
*/
commitLocation: CommitLocationFn;
/** Convenience helper: build a location from options, then commit it. */
buildAndCommitLocation: ({ replace, resetScroll, hashScrollIntoView, viewTransition, ignoreBlocker, href, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
/**
* Imperatively navigate using standard `NavigateOptions`. When `reloadDocument`
* or an absolute `href` is provided, performs a full document navigation.
* Otherwise, builds and commits a client-side location.
*
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType
*/
navigate: NavigateFn;
latestLoadPromise: undefined | Promise<void>;
beforeLoad: () => void;
load: LoadFn;
startViewTransition: (fn: () => Promise<void>) => void;
updateMatch: UpdateMatchFn;
getMatch: GetMatchFn;
/**
* Invalidate the current matches and optionally force them back into a pending state.
*
* - Marks all matches that pass the optional `filter` as `invalid: true`.
* - If `forcePending` is true, or a match is currently in `'error'` or `'notFound'` status,
* its status is reset to `'pending'` and its `error` cleared so that the loader is re-run
* on the next `load()` call (eg. after HMR or a manual invalidation).
*/
invalidate: InvalidateFn<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>>;
getParsedLocationHref: (location: ParsedLocation) => string;
resolveRedirect: (redirect: AnyRedirect) => AnyRedirect;
clearCache: ClearCacheFn<this>;
clearExpiredCache: () => void;
loadRouteChunk: typeof loadRouteChunk;
preloadRoute: PreloadRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
matchRoute: MatchRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
ssr?: {
manifest: Manifest | undefined;
};
serverSsr?: ServerSsr;
hasNotFoundMatch: () => boolean;
}
/** Error thrown when search parameter validation fails. */
export declare class SearchParamError extends Error {
}
/** Error thrown when path parameter parsing/validation fails. */
export declare class PathParamError extends Error {
}
/**
* Lazily import a module function and forward arguments to it, retaining
* parameter and return types for the selected export key.
*/
export declare function lazyFn<T extends Record<string, (...args: Array<any>) => any>, TKey extends keyof T = 'default'>(fn: () => Promise<T>, key?: TKey): (...args: Parameters<T[TKey]>) => Promise<Awaited<ReturnType<T[TKey]>>>;
/** Create an initial RouterState from a parsed location. */
export declare function getInitialRouterState(location: ParsedLocation): RouterState<any>;
/**
* Build the matched route chain and extract params for a pathname.
* Falls back to the root route if no specific route is found.
*/
export declare function getMatchedRoutes<TRouteLike extends RouteLike>({ pathname, routesById, processedTree, }: {
pathname: string;
routesById: Record<string, TRouteLike>;
processedTree: ProcessedTree<any, any, any>;
}): {
matchedRoutes: readonly TRouteLike[];
routeParams: Record<string, string>;
foundRoute: TRouteLike | undefined;
};
export {};