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 @@
{"version":3,"file":"limitProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitProperties.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AAEvD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QAC3D,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,aAAa,CAAA;IACjE,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;IAC3C,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,MAAM,EAAE,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QACpE,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,eAAe,IAAI,YAAY,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IACnE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const BasicLayout = require("./BasicLayout.js");
const ConsoleAppender = require("./ConsoleAppender.js");
const Level = require("./Level.js");
const LogFactory = require("./LogFactory.js");
const Logger = require("./Logger.js");
const PatternLayout = require("./PatternLayout.js");
const basicLogPrefix = require("./basicLogPrefix.js");
const compilePattern = require("./compilePattern.js");
const formatMessage = require("./formatMessage.js");
const normalizeLevel = require("./normalizeLevel.js");
const pad = require("./pad.js");
exports.BasicLayout = BasicLayout;
exports.ConsoleAppender = ConsoleAppender;
exports.Level = Level;
exports.LogFactory = LogFactory;
exports.Logger = Logger;
exports.PatternLayout = PatternLayout;
exports.basicLogPrefix = basicLogPrefix;
exports.compilePattern = compilePattern;
exports.formatMessage = formatMessage;
exports.normalizeLevel = normalizeLevel;
exports.pad = pad;
@@ -0,0 +1,70 @@
{
"name": "seroval-plugins",
"type": "module",
"version": "1.5.4",
"files": [
"dist",
"web"
],
"engines": {
"node": ">=10"
},
"license": "MIT",
"keywords": [
"pridepack"
],
"devDependencies": {
"@types/node": "^24.10.0",
"@vitest/ui": "^4.0.6",
"pridepack": "2.6.4",
"seroval": "1.5.4",
"tslib": "^2.8.1",
"typescript": "^5.9.3",
"vitest": "^4.0.6"
},
"peerDependencies": {
"seroval": "^1.0"
},
"private": false,
"description": "Stringify JS values",
"repository": {
"url": "https://github.com/lxsmnsyc/seroval.git",
"type": "git"
},
"homepage": "https://github.com/lxsmnsyc/seroval/tree/main/packages/plugins",
"bugs": {
"url": "https://github.com/lxsmnsyc/seroval/issues"
},
"publishConfig": {
"access": "public"
},
"author": "Alexis Munsayac",
"exports": {
"./web": {
"types": "./dist/types/web/index.d.ts",
"development": {
"require": "./dist/cjs/development/web.cjs",
"import": "./dist/esm/development/web.mjs"
},
"require": "./dist/cjs/production/web.cjs",
"import": "./dist/esm/production/web.mjs"
}
},
"typesVersions": {
"*": {
"web": [
"./dist/types/web/index.d.ts"
]
}
},
"scripts": {
"build": "pridepack build",
"type-check": "pridepack check",
"clean": "pridepack clean",
"watch": "pridepack watch",
"start": "pridepack start",
"dev": "pridepack dev",
"test": "vitest",
"test:ui": "vitest --ui"
}
}
@@ -0,0 +1,142 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DocumentPosition = void 0;
exports.removeSubsets = removeSubsets;
exports.compareDocumentPosition = compareDocumentPosition;
exports.uniqueSort = uniqueSort;
var domhandler_1 = require("domhandler");
/**
* Given an array of nodes, remove any member that is contained by another
* member.
*
* @category Helpers
* @param nodes Nodes to filter.
* @returns Remaining nodes that aren't contained by other nodes.
*/
function removeSubsets(nodes) {
var idx = nodes.length;
/*
* Check if each node (or one of its ancestors) is already contained in the
* array.
*/
while (--idx >= 0) {
var node = nodes[idx];
/*
* Remove the node if it is not unique.
* We are going through the array from the end, so we only
* have to check nodes that preceed the node under consideration in the array.
*/
if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {
nodes.splice(idx, 1);
continue;
}
for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
if (nodes.includes(ancestor)) {
nodes.splice(idx, 1);
break;
}
}
}
return nodes;
}
/**
* @category Helpers
* @see {@link http://dom.spec.whatwg.org/#dom-node-comparedocumentposition}
*/
var DocumentPosition;
(function (DocumentPosition) {
DocumentPosition[DocumentPosition["DISCONNECTED"] = 1] = "DISCONNECTED";
DocumentPosition[DocumentPosition["PRECEDING"] = 2] = "PRECEDING";
DocumentPosition[DocumentPosition["FOLLOWING"] = 4] = "FOLLOWING";
DocumentPosition[DocumentPosition["CONTAINS"] = 8] = "CONTAINS";
DocumentPosition[DocumentPosition["CONTAINED_BY"] = 16] = "CONTAINED_BY";
})(DocumentPosition || (exports.DocumentPosition = DocumentPosition = {}));
/**
* Compare the position of one node against another node in any other document,
* returning a bitmask with the values from {@link DocumentPosition}.
*
* Document order:
* > There is an ordering, document order, defined on all the nodes in the
* > document corresponding to the order in which the first character of the
* > XML representation of each node occurs in the XML representation of the
* > document after expansion of general entities. Thus, the document element
* > node will be the first node. Element nodes occur before their children.
* > Thus, document order orders element nodes in order of the occurrence of
* > their start-tag in the XML (after expansion of entities). The attribute
* > nodes of an element occur after the element and before its children. The
* > relative order of attribute nodes is implementation-dependent.
*
* Source:
* http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
*
* @category Helpers
* @param nodeA The first node to use in the comparison
* @param nodeB The second node to use in the comparison
* @returns A bitmask describing the input nodes' relative position.
*
* See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
* a description of these values.
*/
function compareDocumentPosition(nodeA, nodeB) {
var aParents = [];
var bParents = [];
if (nodeA === nodeB) {
return 0;
}
var current = (0, domhandler_1.hasChildren)(nodeA) ? nodeA : nodeA.parent;
while (current) {
aParents.unshift(current);
current = current.parent;
}
current = (0, domhandler_1.hasChildren)(nodeB) ? nodeB : nodeB.parent;
while (current) {
bParents.unshift(current);
current = current.parent;
}
var maxIdx = Math.min(aParents.length, bParents.length);
var idx = 0;
while (idx < maxIdx && aParents[idx] === bParents[idx]) {
idx++;
}
if (idx === 0) {
return DocumentPosition.DISCONNECTED;
}
var sharedParent = aParents[idx - 1];
var siblings = sharedParent.children;
var aSibling = aParents[idx];
var bSibling = bParents[idx];
if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
if (sharedParent === nodeB) {
return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY;
}
return DocumentPosition.FOLLOWING;
}
if (sharedParent === nodeA) {
return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS;
}
return DocumentPosition.PRECEDING;
}
/**
* Sort an array of nodes based on their relative position in the document,
* removing any duplicate nodes. If the array contains nodes that do not belong
* to the same document, sort order is unspecified.
*
* @category Helpers
* @param nodes Array of DOM nodes.
* @returns Collection of unique nodes, sorted in document order.
*/
function uniqueSort(nodes) {
nodes = nodes.filter(function (node, i, arr) { return !arr.includes(node, i + 1); });
nodes.sort(function (a, b) {
var relative = compareDocumentPosition(a, b);
if (relative & DocumentPosition.PRECEDING) {
return -1;
}
else if (relative & DocumentPosition.FOLLOWING) {
return 1;
}
return 0;
});
return nodes;
}
//# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
{"version":3,"file":"uri.js","sourceRoot":"","sources":["../../src/uri.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAiDrD,MAAM,CAAC,MAAM,OAAO,GAAsC,EAAE,CAAC;AAE7D,MAAM,qBAAqB,GAAU;IACpC,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5B,IAAI,CAAQ,CAAC;IAEb,IAAI,CAAC,GAAG,EAAE;QAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;SAC/C,IAAI,CAAC,GAAG,GAAG;QAAE,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;SACpD,IAAI,CAAC,GAAG,IAAI;QAAE,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;;QACxH,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAE3K,OAAO,CAAC,CAAC;AACV,CAAC;AAED,MAAM,sBAAsB,GAAU;IACrC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;IAEtB,OAAO,CAAC,GAAG,EAAE,EAAE;QACd,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE7C,IAAI,CAAC,GAAG,GAAG,EAAE;YACZ,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACjC,CAAC,IAAI,CAAC,CAAC;SACP;aACI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,GAAG,EAAE;YAC7B,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE;gBAClB,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9C,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;aAC3D;iBAAM;gBACN,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3B;YACD,CAAC,IAAI,CAAC,CAAC;SACP;aACI,IAAI,CAAC,IAAI,GAAG,EAAE;YAClB,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE;gBAClB,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9C,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9C,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;aAC/E;iBAAM;gBACN,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3B;YACD,CAAC,IAAI,CAAC,CAAC;SACP;aACI;YACJ,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3B,CAAC,IAAI,CAAC,CAAC;SACP;KACD;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED,qCAAqC,UAAwB,EAAE,QAAmB;IACjF,0BAA0B,GAAU;QACnC,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,UAAU,CAAC,MAAM;QAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACpK,IAAI,UAAU,CAAC,QAAQ,KAAK,SAAS;QAAE,UAAU,CAAC,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC/N,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS;QAAE,UAAU,CAAC,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC7N,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS;QAAE,UAAU,CAAC,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAClQ,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS;QAAE,UAAU,CAAC,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACnN,IAAI,UAAU,CAAC,QAAQ,KAAK,SAAS;QAAE,UAAU,CAAC,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAE/N,OAAO,UAAU,CAAC;AACnB,CAAC;AAAA,CAAC;AAEF,4BAA4B,GAAU;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC;AAC5C,CAAC;AAED,wBAAwB,IAAW,EAAE,QAAmB;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;IAE5B,IAAI,OAAO,EAAE;QACZ,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC5D;SAAM;QACN,OAAO,IAAI,CAAC;KACZ;AACF,CAAC;AAED,wBAAwB,IAAW,EAAE,QAAmB;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACvD,MAAM,CAAC,EAAE,OAAO,EAAE,ILine truncated
@@ -0,0 +1,7 @@
#!/usr/bin/env node
/**
* Example MCP server using the high-level McpServer API with outputSchema
* This demonstrates how to easily create tools with structured output
*/
export {};
//# sourceMappingURL=mcpServerOutputSchema.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"form-input.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,56 @@
/**
* Copyright 2022 Joe Bell. All rights reserved.
*
* This file is licensed to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/ import { clsx } from "clsx";
const falsyToString = (value)=>typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
export const cx = clsx;
export const cva = (base, config)=>(props)=>{
var _config_compoundVariants;
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
const { variants, defaultVariants } = config;
const getVariantClassNames = Object.keys(variants).map((variant)=>{
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
if (variantProp === null) return null;
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
return variants[variant][variantKey];
});
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{
let [key, value] = param;
if (value === undefined) {
return acc;
}
acc[key] = value;
return acc;
}, {});
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
return Object.entries(compoundVariantOptions).every((param)=>{
let [key, value] = param;
return Array.isArray(value) ? value.includes({
...defaultVariants,
...propsWithoutUndefined
}[key]) : ({
...defaultVariants,
...propsWithoutUndefined
})[key] === value;
}) ? [
...acc,
cvClass,
cvClassName
] : acc;
}, []);
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
};
@@ -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 SquareCheck = createLucideIcon("SquareCheck", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
]);
export { SquareCheck as default };
//# sourceMappingURL=square-check.js.map
@@ -0,0 +1,9 @@
import type { KeywordErrorDefinition, KeywordErrorCxt, ErrorObject } from "../../types";
import { Code } from "../../compile/codegen";
export type _JTDTypeError<K extends string, T extends string, S> = ErrorObject<K, {
type: T;
nullable: boolean;
}, S>;
export declare function typeError(t: string): KeywordErrorDefinition;
export declare function typeErrorMessage({ parentSchema }: KeywordErrorCxt, t: string): string;
export declare function typeErrorParams({ parentSchema }: KeywordErrorCxt, t: string): Code;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"2":"_KB","132":"_fN","322":"_K"},C:{"2":"_HF","132":"_1B _eG gC","194":"_JS"},D:{"2":"_MI","322":"_LM"},E:{"2":"_R"},F:{"2":"_XS","322":"_bJ"},G:{"2":"_M"},H:{"2":"1D"},I:{"2":"_P"},J:{"2":"_B"},K:{"2":"_N"},L:{"322":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"2":"bC"},P:{"2":"_F"},Q:{"2":"JE"},R:{"2":"KE"},S:{"132":"_C"}},B:4,C:"Ambient Light Sensor",D:true};
@@ -0,0 +1,278 @@
# Pool
<!--introduced_in=v1.0.0-->
<!--type=module-->
<!-- source_link=lib/dispatcher/pool.js -->
> Stability: 2 - Stable
A pool of [`Client`][] instances connected to the same upstream origin. A `Pool`
spreads requests across several connections to the same host, which allows more
than one request to be in flight at a time without enabling pipelining on a
single connection.
`Pool` extends [`Dispatcher`][]. Each [`Client`][] in the pool is created lazily
through a configurable `factory` and shares the same options. Requests are not
guaranteed to be dispatched in the order in which they are invoked.
```mjs
import { Pool } from 'undici'
const pool = new Pool('http://localhost:3000', { connections: 10 })
const { statusCode, body } = await pool.request({ path: '/', method: 'GET' })
console.log(statusCode, await body.text())
await pool.close()
```
## Class: `Pool`
<!-- YAML
added: v1.0.0
changes:
- version: v4.10.4
pr-url: https://github.com/nodejs/undici/pull/1114
description: Reworked as part of the balanced pool implementation.
-->
* Extends: {Dispatcher}
### `new Pool(url[, options])`
<!-- YAML
added: v1.0.0
-->
* `url` {URL|string} The upstream origin. It should only include the protocol,
hostname, and port.
* `options` {PoolOptions} (optional) Extends {ClientOptions}, so every
[`Client`][] option is also accepted and forwarded to each pooled client.
* `factory` {Function} Creates the [`Client`][] (or other [`Dispatcher`][])
instances used by the pool.
**Default:** `(origin, opts) => new Client(origin, opts)`.
* `origin` {URL} The parsed upstream origin.
* `opts` {Object} The resolved client options.
* Returns: {Dispatcher}
* `connections` {number|null} The maximum number of [`Client`][] instances the
pool may create. When set to `null` the pool creates an unlimited number of
clients. **Default:** `null`.
* `clientTtl` {number|null} The amount of time, in milliseconds, before an idle
[`Client`][] is removed from the pool and closed. When set to `null` clients
are never removed based on age. **Default:** `null`.
Creates a new `Pool` against `url`. If `connections` is provided it must be a
finite, non-negative number, otherwise an [`InvalidArgumentError`][] is thrown.
The `factory` must be a function, and `connect` (inherited from {ClientOptions})
must be a function or an object when provided.
The connection-related {ClientOptions} (`connect`, `connectTimeout`, `tls`,
`maxCachedSessions`, `socketPath`, `autoSelectFamily`,
`autoSelectFamilyAttemptTimeout`, `allowH2`, and `useH2c`) are used to build the
connector shared by every pooled client.
> [!NOTE]
> `Pool` inherits all {ClientOptions}, including `allowH2` and
> `maxConcurrentStreams`. For an h2-capable HTTPS origin, the pool waits for
> the first TLS connection to finish ALPN negotiation before opening more
> clients. If the server selects h2, concurrent requests share that session up
> to `maxConcurrentStreams`. If it selects HTTP/1.1, the pool resumes normal
> connection fan-out up to `connections`.
```mjs
import { Pool } from 'undici'
const pool = new Pool('http://localhost:3000', {
connections: 128,
pipelining: 1
})
```
### `pool.closed`
<!-- YAML
added: v1.0.0
-->
* Type: {boolean}
`true` after [`pool.close()`][] has been called.
### `pool.destroyed`
<!-- YAML
added: v1.0.0
changes:
- version: v2.0.0
pr-url: https://github.com/nodejs/undici/pull/384
description: Reflects the state set by `pool.close()`.
- version: v4.10.4
pr-url: https://github.com/nodejs/undici/pull/1114
description: Reworked as part of the balanced pool implementation.
-->
* Type: {boolean}
`true` after [`pool.destroy()`][] has been called, or after [`pool.close()`][]
has been called and the pool shutdown has completed.
### `pool.stats`
<!-- YAML
added: v1.0.0
-->
* Type: {PoolStats}
Aggregate statistics for the pool. See [`PoolStats`][].
### `pool.close([callback])`
<!-- YAML
added: v1.0.0
-->
Implements [`dispatcher.close([callback])`][]. Gracefully closes the pool and
all of its clients, waiting for in-flight requests to complete. Resolves once
every pooled client has closed.
### `pool.destroy([error[, callback]])`
<!-- YAML
added: v1.0.0
-->
Implements [`dispatcher.destroy([error[, callback]])`][]. Forcefully destroys
the pool and all of its clients, aborting any in-flight requests with `error`.
### `pool.connect(options[, callback])`
<!-- YAML
added: v1.0.0
-->
See [`dispatcher.connect(options[, callback])`][]. Performs an HTTP `CONNECT`
request through one of the pooled clients.
### `pool.dispatch(options, handler)`
<!-- YAML
added: v1.3.0
changes:
- version: v4.10.4
pr-url: https://github.com/nodejs/undici/pull/1114
description: Reworked as part of the balanced pool implementation.
-->
Implements [`dispatcher.dispatch(options, handler)`][]. Selects an available
client - creating a new one through `factory` when none is free and the
`connections` limit has not been reached - and dispatches the request to it.
### `pool.pipeline(options, handler)`
<!-- YAML
added: v1.0.0
-->
See [`dispatcher.pipeline(options, handler)`][]. Sends a request and returns a
{Duplex} stream that pipes the request body to the response body through
`handler`.
### `pool.request(options[, callback])`
<!-- YAML
added: v1.0.0
-->
See [`dispatcher.request(options[, callback])`][]. Performs a request through one
of the pooled clients.
```mjs
import { Pool } from 'undici'
const pool = new Pool('http://localhost:3000', { connections: 10 })
const { statusCode, headers, body } = await pool.request({
path: '/',
method: 'GET'
})
console.log(statusCode, headers)
console.log(await body.text())
await pool.close()
```
### `pool.stream(options, factory[, callback])`
<!-- YAML
added: v1.0.0
-->
See [`dispatcher.stream(options, factory[, callback])`][]. Performs a request and
writes the response body into the {Writable} stream returned by `factory`.
### `pool.upgrade(options[, callback])`
<!-- YAML
added: v1.0.0
-->
See [`dispatcher.upgrade(options[, callback])`][]. Upgrades a connection
(for example to a WebSocket) through one of the pooled clients.
### Event: `'connect'`
<!-- YAML
added: v1.0.0
-->
* `origin` {URL}
* `targets` {Array} The pool followed by the client that connected,
`[pool, ...targets]`.
Emitted by a pooled client when a socket has connected. See
[`Dispatcher` Event: `'connect'`][]. When `clientTtl` is set, the connecting
client's time-to-live timer starts on this event.
### Event: `'disconnect'`
<!-- YAML
added: v1.0.0
-->
* `origin` {URL}
* `targets` {Array} The pool followed by the client that disconnected,
`[pool, ...targets]`.
* `error` {Error}
Emitted by a pooled client when a socket has disconnected. See
[`Dispatcher` Event: `'disconnect'`][].
### Event: `'drain'`
<!-- YAML
added: v1.0.0
-->
* `origin` {URL}
* `targets` {Array} The pool followed by the client that drained,
`[pool, ...targets]`.
Emitted when a pooled client is no longer busy and can accept more requests. See
[`Dispatcher` Event: `'drain'`][].
[`Client`]: Client.md#class-client
[`Dispatcher` Event: `'connect'`]: Dispatcher.md#event-connect
[`Dispatcher` Event: `'disconnect'`]: Dispatcher.md#event-disconnect
[`Dispatcher` Event: `'drain'`]: Dispatcher.md#event-drain
[`Dispatcher`]: Dispatcher.md#class-dispatcher
[`InvalidArgumentError`]: Errors.md#class-invalidargumenterror
[`PoolStats`]: PoolStats.md
[`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
[`pool.close()`]: #poolclosecallback
[`pool.destroy()`]: #pooldestroyerror-callback
@@ -0,0 +1 @@
const t=["top","right","bottom","left"],e=["start","end"],n=t.reduce(((t,n)=>t.concat(n,n+"-"+e[0],n+"-"+e[1])),[]),r=Math.min,i=Math.max,o={left:"right",right:"left",bottom:"top",top:"bottom"};function a(t,e,n){return i(t,r(e,n))}function l(t,e){return"function"==typeof t?t(e):t}function s(t){return t.split("-")[0]}function c(t){return t.split("-")[1]}function f(t){return"x"===t?"y":"x"}function m(t){return"y"===t?"height":"width"}function u(t){const e=t[0];return"t"===e||"b"===e?"y":"x"}function d(t){return f(u(t))}function g(t,e,n){void 0===n&&(n=!1);const r=c(t),i=d(t),o=m(i);let a="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return e.reference[o]>e.floating[o]&&(a=b(a)),[a,b(a)]}function p(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const h=["left","right"],y=["right","left"],w=["top","bottom"],x=["bottom","top"];function v(t,e,n,r){const i=c(t);let o=function(t,e,n){switch(t){case"top":case"bottom":return n?e?y:h:e?h:y;case"left":case"right":return e?w:x;default:return[]}}(s(t),"start"===n,r);return i&&(o=o.map((t=>t+"-"+i)),e&&(o=o.concat(o.map(p)))),o}function b(t){const e=s(t);return o[e]+t.slice(e.length)}function A(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function R(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function O(t,e,n){let{reference:r,floating:i}=t;const o=u(e),a=d(e),l=m(a),f=s(e),g="y"===o,p=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,y=r[l]/2-i[l]/2;let w;switch(f){case"top":w={x:p,y:r.y-i.height};break;case"bottom":w={x:p,y:r.y+r.height};break;case"right":w={x:r.x+r.width,y:h};break;case"left":w={x:r.x-i.width,y:h};break;default:w={x:r.x,y:r.y}}switch(c(e)){case"start":w[a]-=y*(n&&g?-1:1);break;case"end":w[a]+=y*(n&&g?-1:1)}return w}async function D(t,e){var n;void 0===e&&(e={});const{x:r,y:i,platform:o,rects:a,elements:s,strategy:c}=t,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:u="floating",altBoundary:d=!1,padding:g=0}=l(e,t),p=A(g),h=s[d?"floating"===u?"reference":"floating":u],y=R(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(h)))||n?h:h.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:f,rootBoundary:m,strategy:c})),w="floating"===u?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,x=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),v=await(null==o.isElement?void 0:o.isElement(x))&&await(null==o.getScale?void 0:o.getScale(x))||{x:1,y:1},b=R(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:x,strategy:c}):w);return{top:(y.top-b.top+p.top)/v.y,bottom:(b.bottom-y.bottom+p.bottom)/v.y,left:(y.left-b.left+p.left)/v.x,right:(b.right-y.right+p.right)/v.x}}const P=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:D},s=await(null==a.isRTL?void 0:a.isRTL(e));let c=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:m}=O(c,r,s),u=r,d=0;const g={};for(let n=0;n<o.length;n++){const p=o[n];if(!p)continue;const{name:h,fn:y}=p,{x:w,y:x,data:v,reset:b}=await y({x:f,y:m,initialPlacement:r,placement:u,strategy:i,middlewareData:g,rects:c,platform:l,elements:{reference:t,floating:e}});f=null!=w?w:f,m=null!=x?x:m,g[h]={...g[h],...v},b&&d<50&&(d++,"object"==typeof b&&(b.placement&&(u=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:t,floating:e,strategy:i}):b.rects),({x:f,y:m}=O(c,u,s))),n=-1)}return{x:f,y:m,placement:u,strategy:i,middlewareData:g}},E=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:i,placement:o,rects:s,platform:f,elements:u,middlewareData:g}=e,{element:p,padding:h=0}=l(t,e)||{};if(null==p)return{};const y=A(h),w={x:n,y:i},x=d(o),v=m(x),b=await f.getDimensions(p),R="y"===x,O=R?"top":"left",D=R?"bottom":"right",P=R?"clientHeight":"clientWidth",E=s.reference[v]+s.reference[x]-w[x]-s.floating[v],T=w[x]-s.reference[x],L=await(null==f.getOffsetParent?void 0:f.getOffsetParent(p));let k=L?L[P]:0;k&&await(null==f.isElement?void 0:f.isElement(L))||(k=u.floating[P]||s.floating[v]);const C=E/2-T/2,H=k/2-b[v]/2-1,B=r(y[O],H),S=r(y[D],H),F=B,M=k-b[v]-S,V=k/2-b[v]/2+C,W=a(F,V,M),j=!g.arrow&&null!=c(o)&&V!==W&&s.reference[v]/2-(V<F?B:S)-b[v]/2<0,z=j?V<F?V-F:V-M:0;return{[x]:w[x]+z,data:{[x]:W,centerOffset:V-W-z,...j&&{alignmentOffset:z}},reset:j}}});const T=function(t){return void 0===t&&(t={}),{name:"autoPlacement",options:t,async fn(e){var r,i,o;const{rects:a,middlewareData:f,placement:m,platform:u,elements:d}=e,{crossAxis:h=!1,alignment:y,allowedPlacements:w=n,autoAlignment:x=!0,...v}=l(t,e),b=void 0!==y||w===n?function(t,e,n){return(t?[...n.filter((e=>c(e)===t)),...n.filter((e=>c(e)!==t))]:n.filter((t=>s(t)===t))Line truncated
@@ -0,0 +1,798 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuoteType = void 0;
const decode_1 = require("entities/decode");
var CharCodes;
(function (CharCodes) {
CharCodes[CharCodes["Tab"] = 9] = "Tab";
CharCodes[CharCodes["NewLine"] = 10] = "NewLine";
CharCodes[CharCodes["FormFeed"] = 12] = "FormFeed";
CharCodes[CharCodes["CarriageReturn"] = 13] = "CarriageReturn";
CharCodes[CharCodes["Space"] = 32] = "Space";
CharCodes[CharCodes["ExclamationMark"] = 33] = "ExclamationMark";
CharCodes[CharCodes["Number"] = 35] = "Number";
CharCodes[CharCodes["Amp"] = 38] = "Amp";
CharCodes[CharCodes["SingleQuote"] = 39] = "SingleQuote";
CharCodes[CharCodes["DoubleQuote"] = 34] = "DoubleQuote";
CharCodes[CharCodes["Dash"] = 45] = "Dash";
CharCodes[CharCodes["Slash"] = 47] = "Slash";
CharCodes[CharCodes["Zero"] = 48] = "Zero";
CharCodes[CharCodes["Nine"] = 57] = "Nine";
CharCodes[CharCodes["Semi"] = 59] = "Semi";
CharCodes[CharCodes["Lt"] = 60] = "Lt";
CharCodes[CharCodes["Eq"] = 61] = "Eq";
CharCodes[CharCodes["Gt"] = 62] = "Gt";
CharCodes[CharCodes["Questionmark"] = 63] = "Questionmark";
CharCodes[CharCodes["UpperA"] = 65] = "UpperA";
CharCodes[CharCodes["LowerA"] = 97] = "LowerA";
CharCodes[CharCodes["UpperF"] = 70] = "UpperF";
CharCodes[CharCodes["LowerF"] = 102] = "LowerF";
CharCodes[CharCodes["UpperZ"] = 90] = "UpperZ";
CharCodes[CharCodes["LowerZ"] = 122] = "LowerZ";
CharCodes[CharCodes["LowerX"] = 120] = "LowerX";
CharCodes[CharCodes["OpeningSquareBracket"] = 91] = "OpeningSquareBracket";
})(CharCodes || (CharCodes = {}));
/** All the states the tokenizer can be in. */
var State;
(function (State) {
State[State["Text"] = 1] = "Text";
State[State["BeforeTagName"] = 2] = "BeforeTagName";
State[State["InTagName"] = 3] = "InTagName";
State[State["InSelfClosingTag"] = 4] = "InSelfClosingTag";
State[State["BeforeClosingTagName"] = 5] = "BeforeClosingTagName";
State[State["InClosingTagName"] = 6] = "InClosingTagName";
State[State["AfterClosingTagName"] = 7] = "AfterClosingTagName";
// Attributes
State[State["BeforeAttributeName"] = 8] = "BeforeAttributeName";
State[State["InAttributeName"] = 9] = "InAttributeName";
State[State["AfterAttributeName"] = 10] = "AfterAttributeName";
State[State["BeforeAttributeValue"] = 11] = "BeforeAttributeValue";
State[State["InAttributeValueDq"] = 12] = "InAttributeValueDq";
State[State["InAttributeValueSq"] = 13] = "InAttributeValueSq";
State[State["InAttributeValueNq"] = 14] = "InAttributeValueNq";
// Declarations
State[State["BeforeDeclaration"] = 15] = "BeforeDeclaration";
State[State["InDeclaration"] = 16] = "InDeclaration";
// Processing instructions
State[State["InProcessingInstruction"] = 17] = "InProcessingInstruction";
// Comments & CDATA
State[State["BeforeComment"] = 18] = "BeforeComment";
State[State["CDATASequence"] = 19] = "CDATASequence";
State[State["InSpecialComment"] = 20] = "InSpecialComment";
State[State["InCommentLike"] = 21] = "InCommentLike";
// Special tags
State[State["BeforeSpecialS"] = 22] = "BeforeSpecialS";
State[State["BeforeSpecialT"] = 23] = "BeforeSpecialT";
State[State["SpecialStartSequence"] = 24] = "SpecialStartSequence";
State[State["InSpecialTag"] = 25] = "InSpecialTag";
State[State["InEntity"] = 26] = "InEntity";
})(State || (State = {}));
function isWhitespace(c) {
return (c === CharCodes.Space ||
c === CharCodes.NewLine ||
c === CharCodes.Tab ||
c === CharCodes.FormFeed ||
c === CharCodes.CarriageReturn);
}
function isEndOfTagSection(c) {
return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace(c);
}
function isASCIIAlpha(c) {
return ((c >= CharCodes.LowerA && c <= CharCodes.LowerZ) ||
(c >= CharCodes.UpperA && c <= CharCodes.UpperZ));
}
var QuoteType;
(function (QuoteType) {
QuoteType[QuoteType["NoValue"] = 0] = "NoValue";
QuoteType[QuoteType["Unquoted"] = 1] = "Unquoted";
QuoteType[QuoteType["Single"] = 2] = "Single";
QuoteType[QuoteType["Double"] = 3] = "Double";
})(QuoteType || (exports.QuoteType = QuoteType = {}));
/**
* Sequences used to match longer strings.
*
* We don't have `Script`, `Style`, or `Title` here. Instead, we re-use the *End
* sequences with an increased offset.
*/
const Sequences = {
Cdata: new Uint8Array([0x43, 0x44, 0x41, 0x54, 0x41, 0x5b]), // CDATA[
CdataEnd: new Uint8Array([0x5d, 0x5d, 0x3e]), // ]]>
CommentEnd: new Uint8Array([0x2d, 0x2d, 0x3e]), // `-->`
ScriptEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74]), // `</script`
StyleEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65]), // `</style`
TitleEnd: new Uint8Array([0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65]), // `</title`
TextareaEnd: new Uint8Array([
0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x61, 0x72, 0x65, 0x61,
]), // `</textarea`
XmpEnd: new Uint8Array([0x3c, 0x2f, 0x78, 0x6d, 0x70]), // `</xmp`
};
class Tokenizer {
constructor({ xmlMode = false, decodeEntities = true, }, cbs) {
this.cbs = cbs;
/** The current state the tokenizer is in. */
this.state = State.Text;
/** The read buffer. */
this.buffer = "";
/** The beginning of the section that is currently being read. */
this.sectionStart = 0;
/** The index within the buffer that we are currently looking at. */
this.index = 0;
/** The start of the last entity. */
this.entityStart = 0;
/** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
this.baseState = State.Text;
/** For special parsing behavior inside of script and style tags. */
this.isSpecial = false;
/** Indicates whether the tokenizer has been paused. */
this.running = true;
/** The offset of the current buffer. */
this.offset = 0;
this.currentSequence = undefined;
this.sequenceIndex = 0;
this.xmlMode = xmlMode;
this.decodeEntities = decodeEntities;
this.entityDecoder = new decode_1.EntityDecoder(xmlMode ? decode_1.xmlDecodeTree : decode_1.htmlDecodeTree, (cp, consumed) => this.emitCodePoint(cp, consumed));
}
reset() {
this.state = State.Text;
this.buffer = "";
this.sectionStart = 0;
this.index = 0;
this.baseState = State.Text;
this.currentSequence = undefined;
this.running = true;
this.offset = 0;
}
write(chunk) {
this.offset += this.buffer.length;
this.buffer = chunk;
this.parse();
}
end() {
if (this.running)
this.finish();
}
pause() {
this.running = false;
}
resume() {
this.running = true;
if (this.index < this.buffer.length + this.offset) {
this.parse();
}
}
stateText(c) {
if (c === CharCodes.Lt ||
(!this.decodeEntities && this.fastForwardTo(CharCodes.Lt))) {
if (this.index > this.sectionStart) {
this.cbs.ontext(this.sectionStart, this.index);
}
this.state = State.BeforeTagName;
this.sectionStart = this.index;
}
else if (this.decodeEntities && c === CharCodes.Amp) {
this.startEntity();
}
}
stateSpecialStartSequence(c) {
const isEnd = this.sequenceIndex === this.currentSequence.length;
const isMatch = isEnd
? // If we are at the end of the sequence, make sure the tag name has ended
isEndOfTagSection(c)
: // Otherwise, do a case-insensitive comparison
(c | 0x20) === this.currentSequence[this.sequenceIndex];
if (!isMatch) {
this.isSpecial = false;
}
else if (!isEnd) {
this.sequenceIndex++;
return;
}
this.sequenceIndex = 0;
this.state = State.InTagName;
this.stateInTagName(c);
}
/** Look for an end tag. For <title> tags, also decode entities. */
stateInSpecialTag(c) {
if (this.sequenceIndex === this.currentSequence.length) {
if (c === CharCodes.Gt || isWhitespace(c)) {
const endOfText = this.index - this.currentSequence.length;
if (this.sectionStart < endOfText) {
// Spoof the index so that reported locations match up.
const actualIndex = this.index;
this.index = endOfText;
this.cbs.ontext(this.sectionStart, endOfText);
this.index = actualIndex;
}
this.isSpecial = false;
this.sectionStart = endOfText + 2; // Skip over the `</`
this.stateInClosingTagName(c);
return; // We are done; skip the rest of the function.
}
this.sequenceIndex = 0;
}
if ((c | 0x20) === this.currentSequence[this.sequenceIndex]) {
this.sequenceIndex += 1;
}
else if (this.sequenceIndex === 0) {
if (this.currentSequence === Sequences.TitleEnd) {
// We have to parse entities in <title> tags.
if (this.decodeEntities && c === CharCodes.Amp) {
this.startEntity();
}
}
else if (this.fastForwardTo(CharCodes.Lt)) {
// Outside of <title> tags, we can fast-forward.
this.sequenceIndex = 1;
}
}
else {
// If we see a `<`, set the sequence index to 1; useful for eg. `<</script>`.
this.sequenceIndex = Number(c === CharCodes.Lt);
}
}
stateCDATASequence(c) {
if (c === Sequences.Cdata[this.sequenceIndex]) {
if (++this.sequenceIndex === Sequences.Cdata.length) {
this.state = State.InCommentLike;
this.currentSequence = Sequences.CdataEnd;
this.sequenceIndex = 0;
this.sectionStart = this.index + 1;
}
}
else {
this.sequenceIndex = 0;
this.state = State.InDeclaration;
this.stateInDeclaration(c); // Reconsume the character
}
}
/**
* When we wait for one specific character, we can speed things up
* by skipping through the buffer until we find it.
*
* @returns Whether the character was found.
*/
fastForwardTo(c) {
while (++this.index < this.buffer.length + this.offset) {
if (this.buffer.charCodeAt(this.index - this.offset) === c) {
return true;
}
}
/*
* We increment the index at the end of the `parse` loop,
* so set it to `buffer.length - 1` here.
*
* TODO: Refactor `parse` to increment index before calling states.
*/
this.index = this.buffer.length + this.offset - 1;
return false;
}
/**
* Comments and CDATA end with `-->` and `]]>`.
*
* Their common qualities are:
* - Their end sequences have a distinct character they start with.
* - That character is then repeated, so we have to check multiple repeats.
* - All characters but the start character of the sequence can be skipped.
*/
stateInCommentLike(c) {
if (c === this.currentSequence[this.sequenceIndex]) {
if (++this.sequenceIndex === this.currentSequence.length) {
if (this.currentSequence === Sequences.CdataEnd) {
this.cbs.oncdata(this.sectionStart, this.index, 2);
}
else {
this.cbs.oncomment(this.sectionStart, this.index, 2);
}
this.sequenceIndex = 0;
this.sectionStart = this.index + 1;
this.state = State.Text;
}
}
else if (this.sequenceIndex === 0) {
// Fast-forward to the first character of the sequence
if (this.fastForwardTo(this.currentSequence[0])) {
this.sequenceIndex = 1;
}
}
else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
// Allow long sequences, eg. --->, ]]]>
this.sequenceIndex = 0;
}
}
/**
* HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.
*
* XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).
* We allow anything that wouldn't end the tag.
*/
isTagStartChar(c) {
return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);
}
startSpecial(sequence, offset) {
this.isSpecial = true;
this.currentSequence = sequence;
this.sequenceIndex = offset;
this.state = State.SpecialStartSequence;
}
stateBeforeTagName(c) {
if (c === CharCodes.ExclamationMark) {
this.state = State.BeforeDeclaration;
this.sectionStart = this.index + 1;
}
else if (c === CharCodes.Questionmark) {
this.state = State.InProcessingInstruction;
this.sectionStart = this.index + 1;
}
else if (this.isTagStartChar(c)) {
const lower = c | 0x20;
this.sectionStart = this.index;
if (this.xmlMode) {
this.state = State.InTagName;
}
else if (lower === Sequences.ScriptEnd[2]) {
this.state = State.BeforeSpecialS;
}
else if (lower === Sequences.TitleEnd[2] ||
lower === Sequences.XmpEnd[2]) {
this.state = State.BeforeSpecialT;
}
else {
this.state = State.InTagName;
}
}
else if (c === CharCodes.Slash) {
this.state = State.BeforeClosingTagName;
}
else {
this.state = State.Text;
this.stateText(c);
}
}
stateInTagName(c) {
if (isEndOfTagSection(c)) {
this.cbs.onopentagname(this.sectionStart, this.index);
this.sectionStart = -1;
this.state = State.BeforeAttributeName;
this.stateBeforeAttributeName(c);
}
}
stateBeforeClosingTagName(c) {
if (isWhitespace(c)) {
// Ignore
}
else if (c === CharCodes.Gt) {
this.state = State.Text;
}
else {
this.state = this.isTagStartChar(c)
? State.InClosingTagName
: State.InSpecialComment;
this.sectionStart = this.index;
}
}
stateInClosingTagName(c) {
if (c === CharCodes.Gt || isWhitespace(c)) {
this.cbs.onclosetag(this.sectionStart, this.index);
this.sectionStart = -1;
this.state = State.AfterClosingTagName;
this.stateAfterClosingTagName(c);
}
}
stateAfterClosingTagName(c) {
// Skip everything until ">"
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
this.state = State.Text;
this.sectionStart = this.index + 1;
}
}
stateBeforeAttributeName(c) {
if (c === CharCodes.Gt) {
this.cbs.onopentagend(this.index);
if (this.isSpecial) {
this.state = State.InSpecialTag;
this.sequenceIndex = 0;
}
else {
this.state = State.Text;
}
this.sectionStart = this.index + 1;
}
else if (c === CharCodes.Slash) {
this.state = State.InSelfClosingTag;
}
else if (!isWhitespace(c)) {
this.state = State.InAttributeName;
this.sectionStart = this.index;
}
}
stateInSelfClosingTag(c) {
if (c === CharCodes.Gt) {
this.cbs.onselfclosingtag(this.index);
this.state = State.Text;
this.sectionStart = this.index + 1;
this.isSpecial = false; // Reset special state, in case of self-closing special tags
}
else if (!isWhitespace(c)) {
this.state = State.BeforeAttributeName;
this.stateBeforeAttributeName(c);
}
}
stateInAttributeName(c) {
if (c === CharCodes.Eq || isEndOfTagSection(c)) {
this.cbs.onattribname(this.sectionStart, this.index);
this.sectionStart = this.index;
this.state = State.AfterAttributeName;
this.stateAfterAttributeName(c);
}
}
stateAfterAttributeName(c) {
if (c === CharCodes.Eq) {
this.state = State.BeforeAttributeValue;
}
else if (c === CharCodes.Slash || c === CharCodes.Gt) {
this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
this.sectionStart = -1;
this.state = State.BeforeAttributeName;
this.stateBeforeAttributeName(c);
}
else if (!isWhitespace(c)) {
this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
this.state = State.InAttributeName;
this.sectionStart = this.index;
}
}
stateBeforeAttributeValue(c) {
if (c === CharCodes.DoubleQuote) {
this.state = State.InAttributeValueDq;
this.sectionStart = this.index + 1;
}
else if (c === CharCodes.SingleQuote) {
this.state = State.InAttributeValueSq;
this.sectionStart = this.index + 1;
}
else if (!isWhitespace(c)) {
this.sectionStart = this.index;
this.state = State.InAttributeValueNq;
this.stateInAttributeValueNoQuotes(c); // Reconsume token
}
}
handleInAttributeValue(c, quote) {
if (c === quote ||
(!this.decodeEntities && this.fastForwardTo(quote))) {
this.cbs.onattribdata(this.sectionStart, this.index);
this.sectionStart = -1;
this.cbs.onattribend(quote === CharCodes.DoubleQuote
? QuoteType.Double
: QuoteType.Single, this.index + 1);
this.state = State.BeforeAttributeName;
}
else if (this.decodeEntities && c === CharCodes.Amp) {
this.startEntity();
}
}
stateInAttributeValueDoubleQuotes(c) {
this.handleInAttributeValue(c, CharCodes.DoubleQuote);
}
stateInAttributeValueSingleQuotes(c) {
this.handleInAttributeValue(c, CharCodes.SingleQuote);
}
stateInAttributeValueNoQuotes(c) {
if (isWhitespace(c) || c === CharCodes.Gt) {
this.cbs.onattribdata(this.sectionStart, this.index);
this.sectionStart = -1;
this.cbs.onattribend(QuoteType.Unquoted, this.index);
this.state = State.BeforeAttributeName;
this.stateBeforeAttributeName(c);
}
else if (this.decodeEntities && c === CharCodes.Amp) {
this.startEntity();
}
}
stateBeforeDeclaration(c) {
if (c === CharCodes.OpeningSquareBracket) {
this.state = State.CDATASequence;
this.sequenceIndex = 0;
}
else {
this.state =
c === CharCodes.Dash
? State.BeforeComment
: State.InDeclaration;
}
}
stateInDeclaration(c) {
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
this.cbs.ondeclaration(this.sectionStart, this.index);
this.state = State.Text;
this.sectionStart = this.index + 1;
}
}
stateInProcessingInstruction(c) {
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
this.cbs.onprocessinginstruction(this.sectionStart, this.index);
this.state = State.Text;
this.sectionStart = this.index + 1;
}
}
stateBeforeComment(c) {
if (c === CharCodes.Dash) {
this.state = State.InCommentLike;
this.currentSequence = Sequences.CommentEnd;
// Allow short comments (eg. <!-->)
this.sequenceIndex = 2;
this.sectionStart = this.index + 1;
}
else {
this.state = State.InDeclaration;
}
}
stateInSpecialComment(c) {
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
this.cbs.oncomment(this.sectionStart, this.index, 0);
this.state = State.Text;
this.sectionStart = this.index + 1;
}
}
stateBeforeSpecialS(c) {
const lower = c | 0x20;
if (lower === Sequences.ScriptEnd[3]) {
this.startSpecial(Sequences.ScriptEnd, 4);
}
else if (lower === Sequences.StyleEnd[3]) {
this.startSpecial(Sequences.StyleEnd, 4);
}
else {
this.state = State.InTagName;
this.stateInTagName(c); // Consume the token again
}
}
stateBeforeSpecialT(c) {
const lower = c | 0x20;
switch (lower) {
case Sequences.TitleEnd[3]: {
this.startSpecial(Sequences.TitleEnd, 4);
break;
}
case Sequences.TextareaEnd[3]: {
this.startSpecial(Sequences.TextareaEnd, 4);
break;
}
case Sequences.XmpEnd[3]: {
this.startSpecial(Sequences.XmpEnd, 4);
break;
}
default: {
this.state = State.InTagName;
this.stateInTagName(c); // Consume the token again
}
}
}
startEntity() {
this.baseState = this.state;
this.state = State.InEntity;
this.entityStart = this.index;
this.entityDecoder.startEntity(this.xmlMode
? decode_1.DecodingMode.Strict
: this.baseState === State.Text ||
this.baseState === State.InSpecialTag
? decode_1.DecodingMode.Legacy
: decode_1.DecodingMode.Attribute);
}
stateInEntity() {
const length = this.entityDecoder.write(this.buffer, this.index - this.offset);
// If `length` is positive, we are done with the entity.
if (length >= 0) {
this.state = this.baseState;
if (length === 0) {
this.index = this.entityStart;
}
}
else {
// Mark buffer as consumed.
this.index = this.offset + this.buffer.length - 1;
}
}
/**
* Remove data that has already been consumed from the buffer.
*/
cleanup() {
// If we are inside of text or attributes, emit what we already have.
if (this.running && this.sectionStart !== this.index) {
if (this.state === State.Text ||
(this.state === State.InSpecialTag && this.sequenceIndex === 0)) {
this.cbs.ontext(this.sectionStart, this.index);
this.sectionStart = this.index;
}
else if (this.state === State.InAttributeValueDq ||
this.state === State.InAttributeValueSq ||
this.state === State.InAttributeValueNq) {
this.cbs.onattribdata(this.sectionStart, this.index);
this.sectionStart = this.index;
}
}
}
shouldContinue() {
return this.index < this.buffer.length + this.offset && this.running;
}
/**
* Iterates through the buffer, calling the function corresponding to the current state.
*
* States that are more likely to be hit are higher up, as a performance improvement.
*/
parse() {
while (this.shouldContinue()) {
const c = this.buffer.charCodeAt(this.index - this.offset);
switch (this.state) {
case State.Text: {
this.stateText(c);
break;
}
case State.SpecialStartSequence: {
this.stateSpecialStartSequence(c);
break;
}
case State.InSpecialTag: {
this.stateInSpecialTag(c);
break;
}
case State.CDATASequence: {
this.stateCDATASequence(c);
break;
}
case State.InAttributeValueDq: {
this.stateInAttributeValueDoubleQuotes(c);
break;
}
case State.InAttributeName: {
this.stateInAttributeName(c);
break;
}
case State.InCommentLike: {
this.stateInCommentLike(c);
break;
}
case State.InSpecialComment: {
this.stateInSpecialComment(c);
break;
}
case State.BeforeAttributeName: {
this.stateBeforeAttributeName(c);
break;
}
case State.InTagName: {
this.stateInTagName(c);
break;
}
case State.InClosingTagName: {
this.stateInClosingTagName(c);
break;
}
case State.BeforeTagName: {
this.stateBeforeTagName(c);
break;
}
case State.AfterAttributeName: {
this.stateAfterAttributeName(c);
break;
}
case State.InAttributeValueSq: {
this.stateInAttributeValueSingleQuotes(c);
break;
}
case State.BeforeAttributeValue: {
this.stateBeforeAttributeValue(c);
break;
}
case State.BeforeClosingTagName: {
this.stateBeforeClosingTagName(c);
break;
}
case State.AfterClosingTagName: {
this.stateAfterClosingTagName(c);
break;
}
case State.BeforeSpecialS: {
this.stateBeforeSpecialS(c);
break;
}
case State.BeforeSpecialT: {
this.stateBeforeSpecialT(c);
break;
}
case State.InAttributeValueNq: {
this.stateInAttributeValueNoQuotes(c);
break;
}
case State.InSelfClosingTag: {
this.stateInSelfClosingTag(c);
break;
}
case State.InDeclaration: {
this.stateInDeclaration(c);
break;
}
case State.BeforeDeclaration: {
this.stateBeforeDeclaration(c);
break;
}
case State.BeforeComment: {
this.stateBeforeComment(c);
break;
}
case State.InProcessingInstruction: {
this.stateInProcessingInstruction(c);
break;
}
case State.InEntity: {
this.stateInEntity();
break;
}
}
this.index++;
}
this.cleanup();
}
finish() {
if (this.state === State.InEntity) {
this.entityDecoder.end();
this.state = this.baseState;
}
this.handleTrailingData();
this.cbs.onend();
}
/** Handle any trailing data. */
handleTrailingData() {
const endIndex = this.buffer.length + this.offset;
// If there is no remaining data, we are done.
if (this.sectionStart >= endIndex) {
return;
}
if (this.state === State.InCommentLike) {
if (this.currentSequence === Sequences.CdataEnd) {
this.cbs.oncdata(this.sectionStart, endIndex, 0);
}
else {
this.cbs.oncomment(this.sectionStart, endIndex, 0);
}
}
else if (this.state === State.InTagName ||
this.state === State.BeforeAttributeName ||
this.state === State.BeforeAttributeValue ||
this.state === State.AfterAttributeName ||
this.state === State.InAttributeName ||
this.state === State.InAttributeValueSq ||
this.state === State.InAttributeValueDq ||
this.state === State.InAttributeValueNq ||
this.state === State.InClosingTagName) {
/*
* If we are currently in an opening or closing tag, us not calling the
* respective callback signals that the tag should be ignored.
*/
}
else {
this.cbs.ontext(this.sectionStart, endIndex);
}
}
emitCodePoint(cp, consumed) {
if (this.baseState !== State.Text &&
this.baseState !== State.InSpecialTag) {
if (this.sectionStart < this.entityStart) {
this.cbs.onattribdata(this.sectionStart, this.entityStart);
}
this.sectionStart = this.entityStart + consumed;
this.index = this.sectionStart - 1;
this.cbs.onattribentity(cp);
}
else {
if (this.sectionStart < this.entityStart) {
this.cbs.ontext(this.sectionStart, this.entityStart);
}
this.sectionStart = this.entityStart + consumed;
this.index = this.sectionStart - 1;
this.cbs.ontextentity(cp, this.sectionStart);
}
}
}
exports.default = Tokenizer;
//# sourceMappingURL=Tokenizer.js.map
@@ -0,0 +1 @@
module.exports={C:{"47":0.0034,"52":0.0068,"56":0.0034,"60":0.0034,"68":0.0034,"72":0.0034,"102":0.01019,"106":0.0034,"115":0.8461,"120":0.28883,"121":0.57766,"123":0.0034,"127":0.02039,"128":0.0034,"133":0.0034,"134":0.0034,"135":0.0034,"136":0.0068,"137":0.0034,"138":0.0034,"139":0.0034,"140":0.10194,"141":0.0034,"142":0.01019,"143":0.0068,"144":0.0068,"145":0.01019,"146":0.01359,"147":0.01699,"148":0.0068,"149":0.0034,"150":0.0068,"151":0.02039,"152":0.04078,"153":0.07815,"154":0.23446,"155":1.03979,"156":1.16891,"157":0.03398,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 48 49 50 51 53 54 55 57 58 59 61 62 63 64 65 66 67 69 70 71 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 103 104 105 107 108 109 110 111 112 113 114 116 117 118 119 122 124 125 126 129 130 131 132 158 159 160 3.5 3.6"},D:{"49":0.0034,"70":0.0034,"71":0.0068,"72":0.0034,"73":0.0034,"74":0.0034,"75":0.0034,"77":0.0034,"78":0.0068,"79":0.0068,"80":0.0034,"81":0.0034,"83":0.01699,"84":0.0034,"85":0.0034,"86":0.02039,"87":0.0068,"88":0.0068,"89":0.0068,"90":0.0034,"91":0.0034,"92":0.0068,"93":0.0034,"94":0.0034,"95":0.0034,"96":0.0068,"97":0.0034,"98":0.0068,"99":0.0068,"100":0.0034,"101":0.0068,"102":0.0034,"103":0.09854,"104":0.09175,"105":0.09175,"106":0.09514,"107":0.10194,"108":0.09854,"109":2.78976,"110":0.08835,"111":0.09854,"112":0.08835,"113":0.0034,"114":0.0068,"115":0.0034,"116":0.18689,"117":0.09175,"118":0.53688,"119":0.59465,"120":0.683,"121":0.01359,"122":0.03738,"123":0.02039,"124":0.09854,"125":0.01019,"126":0.02039,"127":0.01359,"128":0.01359,"129":0.01019,"130":0.02379,"131":0.22767,"132":0.01359,"133":0.21747,"134":0.05777,"135":0.05777,"136":0.04417,"137":0.05097,"138":0.09514,"139":0.05097,"140":0.06456,"141":0.07136,"142":0.15971,"143":0.05777,"144":0.06456,"145":0.09854,"146":0.14611,"147":0.03058,"148":0.09514,"149":0.24805,"150":0.30922,"151":1.12814,"152":6.85716,"153":6.92512,"154":1.33541,"155":0.01699,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 76 156 157"},F:{"46":0.0034,"54":0.0034,"56":0.0034,"79":0.01019,"85":0.01699,"95":0.05437,"101":0.01019,"125":0.0068,"127":0.0034,"131":0.0068,"133":0.01019,"134":0.04078,"135":0.29563,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 55 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 86 87 88 89 90 91 92 93 94 96 97 98 99 100 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 126 132 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"14":0.0034,"15":0.0034,"16":0.0034,"18":0.01019,"88":0.0034,"89":0.0034,"90":0.0034,"92":0.06456,"100":0.0068,"109":0.09514,"114":0.0034,"119":0.28203,"120":0.29223,"122":0.01019,"123":0.0034,"131":0.0034,"136":0.0034,"138":0.0034,"139":0.0034,"140":0.0034,"141":0.0068,"142":0.0068,"143":0.01359,"144":0.0068,"145":0.01359,"146":0.0034,"147":0.0068,"148":0.0068,"149":0.01359,"150":0.03398,"151":0.05777,"152":0.39077,"153":0.57086,"154":0.13592,_:"12 13 17 79 80 81 83 84 85 86 87 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 111 112 113 115 116 117 118 121 124 125 126 127 128 129 130 132 133 134 135 137"},E:{"27":0.04078,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.2 16.3 16.5 17.0 17.2 17.3 27.1 27.2 TP","15.6":0.01699,"16.4":0.0034,"16.6":0.02039,"17.1":0.01019,"17.4":0.0034,"17.5":0.0034,"17.6":0.01359,"18.0":0.0034,"18.1":0.0034,"18.2":0.0034,"18.3":0.0068,"18.4":0.0034,"18.5-18.7":0.0068,"26.0":0.0034,"26.1":0.0068,"26.2":0.01699,"26.3":0.01359,"26.4":0.01359,"26.5":0.05097,"26.6":0.22087},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.0008,"5.0-5.1":0.0008,"6.0-6.1":0,"7.0-7.1":0.0016,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00798,"11.0-11.2":0.0008,"11.3-11.4":0.0016,"12.0-12.1":0,"12.2-12.5":0.02075,"13.0-13.1":0,"13.2":0.00399,"13.3":0,"13.4-13.7":0.0008,"14.0-14.4":0.00319,"14.5-14.8":0.00479,"15.0-15.1":0.00479,"15.2-15.3":0.00319,"15.4":0.00399,"15.5":0.00479,"15.6-15.8":0.10375,"16.0":0.00798,"16.1":0.01437,"16.2":0.00798,"16.3":0.01756,"16.4":0.00399,"16.5":0.00638,"16.6-16.7":0.14445,"17.0":0.00559,"17.1":0.00798,"17.2":0.00798,"17.3":0.01197,"17.4":0.01676,"17.5":0.03272,"17.6-17.7":0.08459,"18.0":0.01756,"18.1":0.03511,"18.2":0.04788,"18.3":0.083,"18.4":0.05187,"18.5-18.7":1.0718,"26.0":0.05187,"26.1":0.05267,"26.2":0.13727,"26.3":0.14844,"26.4":0.10854,"26.5":0.72703,"26.6":4.4859,"27.0":0.34396,"27.1":0,"27.2":0.00878},P:{"4":0.01921,"20":0.01921,"21":0.02882,"22":0.05764,"23":0.05764,"24":0.06724,"25":0.06724,"26":0.1633,"27":0.11527,"28":0.27858,"29":0.29779,"30":2.29585,_:"5.0-5.4 6.2-6.4 10.1","7.2-7.4":0.0864Line truncated
@@ -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 Dice4 = createLucideIcon("Dice4", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
["path", { d: "M16 8h.01", key: "cr5u4v" }],
["path", { d: "M8 8h.01", key: "1e4136" }],
["path", { d: "M8 16h.01", key: "18s6g9" }],
["path", { d: "M16 16h.01", key: "1f9h7w" }]
]);
export { Dice4 as default };
//# sourceMappingURL=dice-4.js.map
@@ -0,0 +1,140 @@
"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: "Zeichen", verb: "zu haben" },
file: { unit: "Bytes", verb: "zu haben" },
array: { unit: "Elemente", verb: "zu haben" },
set: { unit: "Elemente", verb: "zu haben" },
map: { unit: "Elemente", verb: "zu haben" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "Eingabe",
email: "E-Mail-Adresse",
url: "URL",
emoji: "Emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO-Datum und -Uhrzeit",
date: "ISO-Datum",
time: "ISO-Uhrzeit",
duration: "ISO-Dauer",
ipv4: "IPv4-Adresse",
ipv6: "IPv6-Adresse",
mac: "MAC-Adresse",
cidrv4: "IPv4-Bereich",
cidrv6: "IPv6-Bereich",
base64: "Base64-codierter String",
base64url: "Base64-URL-codierter String",
json_string: "JSON-String",
e164: "E.164-Nummer",
credit_card: "Kreditkartennummer",
currency_code: "Währungscode",
iban: "IBAN",
jwt: "JWT",
template_literal: "Eingabe",
};
const TypeDictionary = {
nan: "NaN",
number: "Zahl",
array: "Array",
};
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 `Ungültige Eingabe: erwartet instanceof ${issue.expected}, erhalten ${received}`;
}
return `Ungültige Eingabe: erwartet ${expected}, erhalten ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `Ungültige Eingabe: erwartet ${util.stringifyPrimitive(issue.values[0])}`;
return `Ungültige Option: erwartet eine von ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Zu groß: erwartet, dass ${issue.origin ?? "Wert"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "Elemente"} hat`;
return `Zu groß: erwartet, dass ${issue.origin ?? "Wert"} ${adj}${issue.maximum.toString()} ist`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Zu klein: erwartet, dass ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} hat`;
}
return `Zu klein: erwartet, dass ${issue.origin} ${adj}${issue.minimum.toString()} ist`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `Ungültiger String: muss mit "${_issue.prefix}" beginnen`;
if (_issue.format === "ends_with")
return `Ungültiger String: muss mit "${_issue.suffix}" enden`;
if (_issue.format === "includes")
return `Ungültiger String: muss "${_issue.includes}" enthalten`;
if (_issue.format === "regex")
return `Ungültiger String: muss dem Muster ${_issue.pattern} entsprechen`;
return `Ungültig: ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Ungültige Zahl: muss ein Vielfaches von ${issue.divisor} sein`;
case "unrecognized_keys":
return `${issue.keys.length > 1 ? "Unbekannte Schlüssel" : "Unbekannter Schlüssel"}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Ungültiger Schlüssel in ${issue.origin}`;
case "invalid_union":
return "Ungültige Eingabe";
case "invalid_element":
return `Ungültiger Wert in ${issue.origin}`;
default:
return `Ungültige Eingabe`;
}
};
};
function default_1() {
return {
localeError: error(),
};
}
module.exports = exports.default;
@@ -0,0 +1 @@
{"version":3,"file":"ajv-provider.js","sourceRoot":"","sources":["../../../src/validation/ajv-provider.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAEH,8CAAsB;AACtB,8DAAsC;AAGtC,SAAS,wBAAwB;IAC7B,MAAM,GAAG,GAAG,IAAI,aAAG,CAAC;QAChB,MAAM,EAAE,KAAK;QACb,eAAe,EAAE,IAAI;QACrB,cAAc,EAAE,KAAK;QACrB,SAAS,EAAE,IAAI;KAClB,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,qBAAoD,CAAC;IACxE,UAAU,CAAC,GAAG,CAAC,CAAC;IAEhB,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAa,sBAAsB;IAG/B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,YAAY,GAAS;QACjB,IAAI,CAAC,IAAI,GAAG,GAAG,IAAI,wBAAwB,EAAE,CAAC;IAClD,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAI,MAAsB;QAClC,yDAAyD;QACzD,MAAM,YAAY,GACd,KAAK,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YAC7C,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAChE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEpC,OAAO,CAAC,KAAc,EAAgC,EAAE;YACpD,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;YAElC,IAAI,KAAK,EAAE,CAAC;gBACR,OAAO;oBACH,KAAK,EAAE,IAAI;oBACX,IAAI,EAAE,KAAU;oBAChB,YAAY,EAAE,SAAS;iBAC1B,CAAC;YACN,CAAC;iBAAM,CAAC;gBACJ,OAAO;oBACH,KAAK,EAAE,KAAK;oBACZ,IAAI,EAAE,SAAS;oBACf,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC;iBAC1D,CAAC;YACN,CAAC;QACL,CAAC,CAAC;IACN,CAAC;CACJ;AA7DD,wDA6DC"}
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isNode;
var _index = require("../definitions/index.js");
function isNode(node) {
return !!(node && _index.VISITOR_KEYS[node.type]);
}
//# sourceMappingURL=isNode.js.map
@@ -0,0 +1,9 @@
'use strict';
var util = require('./util');
module.exports = SchemaObject;
function SchemaObject(obj) {
util.copy(obj, this);
}
@@ -0,0 +1,733 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _xhtml = require('../parser/plugins/jsx/xhtml'); var _xhtml2 = _interopRequireDefault(_xhtml);
var _tokenizer = require('../parser/tokenizer');
var _types = require('../parser/tokenizer/types');
var _charcodes = require('../parser/util/charcodes');
var _getJSXPragmaInfo = require('../util/getJSXPragmaInfo'); var _getJSXPragmaInfo2 = _interopRequireDefault(_getJSXPragmaInfo);
var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer);
class JSXTransformer extends _Transformer2.default {
// State for calculating the line number of each JSX tag in development.
__init() {this.lastLineNumber = 1}
__init2() {this.lastIndex = 0}
// In development, variable name holding the name of the current file.
__init3() {this.filenameVarName = null}
// Mapping of claimed names for imports in the automatic transform, e,g.
// {jsx: "_jsx"}. This determines which imports to generate in the prefix.
__init4() {this.esmAutomaticImportNameResolutions = {}}
// When automatically adding imports in CJS mode, we store the variable name
// holding the imported CJS module so we can require it in the prefix.
__init5() {this.cjsAutomaticModuleNameResolutions = {}}
constructor(
rootTransformer,
tokens,
importProcessor,
nameManager,
options,
) {
super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.importProcessor = importProcessor;this.nameManager = nameManager;this.options = options;JSXTransformer.prototype.__init.call(this);JSXTransformer.prototype.__init2.call(this);JSXTransformer.prototype.__init3.call(this);JSXTransformer.prototype.__init4.call(this);JSXTransformer.prototype.__init5.call(this);;
this.jsxPragmaInfo = _getJSXPragmaInfo2.default.call(void 0, options);
this.isAutomaticRuntime = options.jsxRuntime === "automatic";
this.jsxImportSource = options.jsxImportSource || "react";
}
process() {
if (this.tokens.matches1(_types.TokenType.jsxTagStart)) {
this.processJSXTag();
return true;
}
return false;
}
getPrefixCode() {
let prefix = "";
if (this.filenameVarName) {
prefix += `const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath || "")};`;
}
if (this.isAutomaticRuntime) {
if (this.importProcessor) {
// CJS mode: emit require statements for all modules that were referenced.
for (const [path, resolvedName] of Object.entries(this.cjsAutomaticModuleNameResolutions)) {
prefix += `var ${resolvedName} = require("${path}");`;
}
} else {
// ESM mode: consolidate and emit import statements for referenced names.
const {createElement: createElementResolution, ...otherResolutions} =
this.esmAutomaticImportNameResolutions;
if (createElementResolution) {
prefix += `import {createElement as ${createElementResolution}} from "${this.jsxImportSource}";`;
}
const importSpecifiers = Object.entries(otherResolutions)
.map(([name, resolvedName]) => `${name} as ${resolvedName}`)
.join(", ");
if (importSpecifiers) {
const importPath =
this.jsxImportSource + (this.options.production ? "/jsx-runtime" : "/jsx-dev-runtime");
prefix += `import {${importSpecifiers}} from "${importPath}";`;
}
}
}
return prefix;
}
processJSXTag() {
const {jsxRole, start} = this.tokens.currentToken();
// Calculate line number information at the very start (if in development
// mode) so that the information is guaranteed to be queried in token order.
const elementLocationCode = this.options.production ? null : this.getElementLocationCode(start);
if (this.isAutomaticRuntime && jsxRole !== _tokenizer.JSXRole.KeyAfterPropSpread) {
this.transformTagToJSXFunc(elementLocationCode, jsxRole);
} else {
this.transformTagToCreateElement(elementLocationCode);
}
}
getElementLocationCode(firstTokenStart) {
const lineNumber = this.getLineNumberForIndex(firstTokenStart);
return `lineNumber: ${lineNumber}`;
}
/**
* Get the line number for this source position. This is calculated lazily and
* must be called in increasing order by index.
*/
getLineNumberForIndex(index) {
const code = this.tokens.code;
while (this.lastIndex < index && this.lastIndex < code.length) {
if (code[this.lastIndex] === "\n") {
this.lastLineNumber++;
}
this.lastIndex++;
}
return this.lastLineNumber;
}
/**
* Convert the current JSX element to a call to jsx, jsxs, or jsxDEV. This is
* the primary transformation for the automatic transform.
*
* Example:
* <div a={1} key={2}>Hello{x}</div>
* becomes
* jsxs('div', {a: 1, children: ["Hello", x]}, 2)
*/
transformTagToJSXFunc(elementLocationCode, jsxRole) {
const isStatic = jsxRole === _tokenizer.JSXRole.StaticChildren;
// First tag is always jsxTagStart.
this.tokens.replaceToken(this.getJSXFuncInvocationCode(isStatic));
let keyCode = null;
if (this.tokens.matches1(_types.TokenType.jsxTagEnd)) {
// Fragment syntax.
this.tokens.replaceToken(`${this.getFragmentCode()}, {`);
this.processAutomaticChildrenAndEndProps(jsxRole);
} else {
// Normal open tag or self-closing tag.
this.processTagIntro();
this.tokens.appendCode(", {");
keyCode = this.processProps(true);
if (this.tokens.matches2(_types.TokenType.slash, _types.TokenType.jsxTagEnd)) {
// Self-closing tag, no children to add, so close the props.
this.tokens.appendCode("}");
} else if (this.tokens.matches1(_types.TokenType.jsxTagEnd)) {
// Tag with children.
this.tokens.removeToken();
this.processAutomaticChildrenAndEndProps(jsxRole);
} else {
throw new Error("Expected either /> or > at the end of the tag.");
}
// If a key was present, move it to its own arg. Note that moving code
// like this will cause line numbers to get out of sync within the JSX
// element if the key expression has a newline in it. This is unfortunate,
// but hopefully should be rare.
if (keyCode) {
this.tokens.appendCode(`, ${keyCode}`);
}
}
if (!this.options.production) {
// If the key wasn't already added, add it now so we can correctly set
// positional args for jsxDEV.
if (keyCode === null) {
this.tokens.appendCode(", void 0");
}
this.tokens.appendCode(`, ${isStatic}, ${this.getDevSource(elementLocationCode)}, this`);
}
// We're at the close-tag or the end of a self-closing tag, so remove
// everything else and close the function call.
this.tokens.removeInitialToken();
while (!this.tokens.matches1(_types.TokenType.jsxTagEnd)) {
this.tokens.removeToken();
}
this.tokens.replaceToken(")");
}
/**
* Convert the current JSX element to a createElement call. In the classic
* runtime, this is the only case. In the automatic runtime, this is called
* as a fallback in some situations.
*
* Example:
* <div a={1} key={2}>Hello{x}</div>
* becomes
* React.createElement('div', {a: 1, key: 2}, "Hello", x)
*/
transformTagToCreateElement(elementLocationCode) {
// First tag is always jsxTagStart.
this.tokens.replaceToken(this.getCreateElementInvocationCode());
if (this.tokens.matches1(_types.TokenType.jsxTagEnd)) {
// Fragment syntax.
this.tokens.replaceToken(`${this.getFragmentCode()}, null`);
this.processChildren(true);
} else {
// Normal open tag or self-closing tag.
this.processTagIntro();
this.processPropsObjectWithDevInfo(elementLocationCode);
if (this.tokens.matches2(_types.TokenType.slash, _types.TokenType.jsxTagEnd)) {
// Self-closing tag; no children to process.
} else if (this.tokens.matches1(_types.TokenType.jsxTagEnd)) {
// Tag with children and a close-tag; process the children as args.
this.tokens.removeToken();
this.processChildren(true);
} else {
throw new Error("Expected either /> or > at the end of the tag.");
}
}
// We're at the close-tag or the end of a self-closing tag, so remove
// everything else and close the function call.
this.tokens.removeInitialToken();
while (!this.tokens.matches1(_types.TokenType.jsxTagEnd)) {
this.tokens.removeToken();
}
this.tokens.replaceToken(")");
}
/**
* Get the code for the relevant function for this context: jsx, jsxs,
* or jsxDEV. The following open-paren is included as well.
*
* These functions are only used for the automatic runtime, so they are always
* auto-imported, but the auto-import will be either CJS or ESM based on the
* target module format.
*/
getJSXFuncInvocationCode(isStatic) {
if (this.options.production) {
if (isStatic) {
return this.claimAutoImportedFuncInvocation("jsxs", "/jsx-runtime");
} else {
return this.claimAutoImportedFuncInvocation("jsx", "/jsx-runtime");
}
} else {
return this.claimAutoImportedFuncInvocation("jsxDEV", "/jsx-dev-runtime");
}
}
/**
* Return the code to use for the createElement function, e.g.
* `React.createElement`, including the following open-paren.
*
* This is the main function to use for the classic runtime. For the
* automatic runtime, this function is used as a fallback function to
* preserve behavior when there is a prop spread followed by an explicit
* key. In that automatic runtime case, the function should be automatically
* imported.
*/
getCreateElementInvocationCode() {
if (this.isAutomaticRuntime) {
return this.claimAutoImportedFuncInvocation("createElement", "");
} else {
const {jsxPragmaInfo} = this;
const resolvedPragmaBaseName = this.importProcessor
? this.importProcessor.getIdentifierReplacement(jsxPragmaInfo.base) || jsxPragmaInfo.base
: jsxPragmaInfo.base;
return `${resolvedPragmaBaseName}${jsxPragmaInfo.suffix}(`;
}
}
/**
* Return the code to use as the component when compiling a shorthand
* fragment, e.g. `React.Fragment`.
*
* This may be called from either the classic or automatic runtime, and
* the value should be auto-imported for the automatic runtime.
*/
getFragmentCode() {
if (this.isAutomaticRuntime) {
return this.claimAutoImportedName(
"Fragment",
this.options.production ? "/jsx-runtime" : "/jsx-dev-runtime",
);
} else {
const {jsxPragmaInfo} = this;
const resolvedFragmentPragmaBaseName = this.importProcessor
? this.importProcessor.getIdentifierReplacement(jsxPragmaInfo.fragmentBase) ||
jsxPragmaInfo.fragmentBase
: jsxPragmaInfo.fragmentBase;
return resolvedFragmentPragmaBaseName + jsxPragmaInfo.fragmentSuffix;
}
}
/**
* Return code that invokes the given function.
*
* When the imports transform is enabled, use the CJSImportTransformer
* strategy of using `.call(void 0, ...` to avoid passing a `this` value in a
* situation that would otherwise look like a method call.
*/
claimAutoImportedFuncInvocation(funcName, importPathSuffix) {
const funcCode = this.claimAutoImportedName(funcName, importPathSuffix);
if (this.importProcessor) {
return `${funcCode}.call(void 0, `;
} else {
return `${funcCode}(`;
}
}
claimAutoImportedName(funcName, importPathSuffix) {
if (this.importProcessor) {
// CJS mode: claim a name for the module and mark it for import.
const path = this.jsxImportSource + importPathSuffix;
if (!this.cjsAutomaticModuleNameResolutions[path]) {
this.cjsAutomaticModuleNameResolutions[path] =
this.importProcessor.getFreeIdentifierForPath(path);
}
return `${this.cjsAutomaticModuleNameResolutions[path]}.${funcName}`;
} else {
// ESM mode: claim a name for this function and add it to the names that
// should be auto-imported when the prefix is generated.
if (!this.esmAutomaticImportNameResolutions[funcName]) {
this.esmAutomaticImportNameResolutions[funcName] = this.nameManager.claimFreeName(
`_${funcName}`,
);
}
return this.esmAutomaticImportNameResolutions[funcName];
}
}
/**
* Process the first part of a tag, before any props.
*/
processTagIntro() {
// Walk forward until we see one of these patterns:
// jsxName to start the first prop, preceded by another jsxName to end the tag name.
// jsxName to start the first prop, preceded by greaterThan to end the type argument.
// [open brace] to start the first prop.
// [jsxTagEnd] to end the open-tag.
// [slash, jsxTagEnd] to end the self-closing tag.
let introEnd = this.tokens.currentIndex() + 1;
while (
this.tokens.tokens[introEnd].isType ||
(!this.tokens.matches2AtIndex(introEnd - 1, _types.TokenType.jsxName, _types.TokenType.jsxName) &&
!this.tokens.matches2AtIndex(introEnd - 1, _types.TokenType.greaterThan, _types.TokenType.jsxName) &&
!this.tokens.matches1AtIndex(introEnd, _types.TokenType.braceL) &&
!this.tokens.matches1AtIndex(introEnd, _types.TokenType.jsxTagEnd) &&
!this.tokens.matches2AtIndex(introEnd, _types.TokenType.slash, _types.TokenType.jsxTagEnd))
) {
introEnd++;
}
if (introEnd === this.tokens.currentIndex() + 1) {
const tagName = this.tokens.identifierName();
if (startsWithLowerCase(tagName)) {
this.tokens.replaceToken(`'${tagName}'`);
}
}
while (this.tokens.currentIndex() < introEnd) {
this.rootTransformer.processToken();
}
}
/**
* Starting at the beginning of the props, add the props argument to
* React.createElement, including the comma before it.
*/
processPropsObjectWithDevInfo(elementLocationCode) {
const devProps = this.options.production
? ""
: `__self: this, __source: ${this.getDevSource(elementLocationCode)}`;
if (!this.tokens.matches1(_types.TokenType.jsxName) && !this.tokens.matches1(_types.TokenType.braceL)) {
if (devProps) {
this.tokens.appendCode(`, {${devProps}}`);
} else {
this.tokens.appendCode(`, null`);
}
return;
}
this.tokens.appendCode(`, {`);
this.processProps(false);
if (devProps) {
this.tokens.appendCode(` ${devProps}}`);
} else {
this.tokens.appendCode("}");
}
}
/**
* Transform the core part of the props, assuming that a { has already been
* inserted before us and that a } will be inserted after us.
*
* If extractKeyCode is true (i.e. when using any jsx... function), any prop
* named "key" has its code captured and returned rather than being emitted to
* the output code. This shifts line numbers, and emitting the code later will
* correct line numbers again. If no key is found or if extractKeyCode is
* false, this function returns null.
*/
processProps(extractKeyCode) {
let keyCode = null;
while (true) {
if (this.tokens.matches2(_types.TokenType.jsxName, _types.TokenType.eq)) {
// This is a regular key={value} or key="value" prop.
const propName = this.tokens.identifierName();
if (extractKeyCode && propName === "key") {
if (keyCode !== null) {
// The props list has multiple keys. Different implementations are
// inconsistent about what to do here: as of this writing, Babel and
// swc keep the *last* key and completely remove the rest, while
// TypeScript uses the *first* key and leaves the others as regular
// props. The React team collaborated with Babel on the
// implementation of this behavior, so presumably the Babel behavior
// is the one to use.
// Since we won't ever be emitting the previous key code, we need to
// at least emit its newlines here so that the line numbers match up
// in the long run.
this.tokens.appendCode(keyCode.replace(/[^\n]/g, ""));
}
// key
this.tokens.removeToken();
// =
this.tokens.removeToken();
const snapshot = this.tokens.snapshot();
this.processPropValue();
keyCode = this.tokens.dangerouslyGetAndRemoveCodeSinceSnapshot(snapshot);
// Don't add a comma
continue;
} else {
this.processPropName(propName);
this.tokens.replaceToken(": ");
this.processPropValue();
}
} else if (this.tokens.matches1(_types.TokenType.jsxName)) {
// This is a shorthand prop like <input disabled />.
const propName = this.tokens.identifierName();
this.processPropName(propName);
this.tokens.appendCode(": true");
} else if (this.tokens.matches1(_types.TokenType.braceL)) {
// This is prop spread, like <div {...getProps()}>, which we can pass
// through fairly directly as an object spread.
this.tokens.replaceToken("");
this.rootTransformer.processBalancedCode();
this.tokens.replaceToken("");
} else {
break;
}
this.tokens.appendCode(",");
}
return keyCode;
}
processPropName(propName) {
if (propName.includes("-")) {
this.tokens.replaceToken(`'${propName}'`);
} else {
this.tokens.copyToken();
}
}
processPropValue() {
if (this.tokens.matches1(_types.TokenType.braceL)) {
this.tokens.replaceToken("");
this.rootTransformer.processBalancedCode();
this.tokens.replaceToken("");
} else if (this.tokens.matches1(_types.TokenType.jsxTagStart)) {
this.processJSXTag();
} else {
this.processStringPropValue();
}
}
processStringPropValue() {
const token = this.tokens.currentToken();
const valueCode = this.tokens.code.slice(token.start + 1, token.end - 1);
const replacementCode = formatJSXTextReplacement(valueCode);
const literalCode = formatJSXStringValueLiteral(valueCode);
this.tokens.replaceToken(literalCode + replacementCode);
}
/**
* Starting in the middle of the props object literal, produce an additional
* prop for the children and close the object literal.
*/
processAutomaticChildrenAndEndProps(jsxRole) {
if (jsxRole === _tokenizer.JSXRole.StaticChildren) {
this.tokens.appendCode(" children: [");
this.processChildren(false);
this.tokens.appendCode("]}");
} else {
// The parser information tells us whether we will see a real child or if
// all remaining children (if any) will resolve to empty. If there are no
// non-empty children, don't emit a children prop at all, but still
// process children so that we properly transform the code into nothing.
if (jsxRole === _tokenizer.JSXRole.OneChild) {
this.tokens.appendCode(" children: ");
}
this.processChildren(false);
this.tokens.appendCode("}");
}
}
/**
* Transform children into a comma-separated list, which will be either
* arguments to createElement or array elements of a children prop.
*/
processChildren(needsInitialComma) {
let needsComma = needsInitialComma;
while (true) {
if (this.tokens.matches2(_types.TokenType.jsxTagStart, _types.TokenType.slash)) {
// Closing tag, so no more children.
return;
}
let didEmitElement = false;
if (this.tokens.matches1(_types.TokenType.braceL)) {
if (this.tokens.matches2(_types.TokenType.braceL, _types.TokenType.braceR)) {
// Empty interpolations and comment-only interpolations are allowed
// and don't create an extra child arg.
this.tokens.replaceToken("");
this.tokens.replaceToken("");
} else {
// Interpolated expression.
this.tokens.replaceToken(needsComma ? ", " : "");
this.rootTransformer.processBalancedCode();
this.tokens.replaceToken("");
didEmitElement = true;
}
} else if (this.tokens.matches1(_types.TokenType.jsxTagStart)) {
// Child JSX element
this.tokens.appendCode(needsComma ? ", " : "");
this.processJSXTag();
didEmitElement = true;
} else if (this.tokens.matches1(_types.TokenType.jsxText) || this.tokens.matches1(_types.TokenType.jsxEmptyText)) {
didEmitElement = this.processChildTextElement(needsComma);
} else {
throw new Error("Unexpected token when processing JSX children.");
}
if (didEmitElement) {
needsComma = true;
}
}
}
/**
* Turn a JSX text element into a string literal, or nothing at all if the JSX
* text resolves to the empty string.
*
* Returns true if a string literal is emitted, false otherwise.
*/
processChildTextElement(needsComma) {
const token = this.tokens.currentToken();
const valueCode = this.tokens.code.slice(token.start, token.end);
const replacementCode = formatJSXTextReplacement(valueCode);
const literalCode = formatJSXTextLiteral(valueCode);
if (literalCode === '""') {
this.tokens.replaceToken(replacementCode);
return false;
} else {
this.tokens.replaceToken(`${needsComma ? ", " : ""}${literalCode}${replacementCode}`);
return true;
}
}
getDevSource(elementLocationCode) {
return `{fileName: ${this.getFilenameVarName()}, ${elementLocationCode}}`;
}
getFilenameVarName() {
if (!this.filenameVarName) {
this.filenameVarName = this.nameManager.claimFreeName("_jsxFileName");
}
return this.filenameVarName;
}
} exports.default = JSXTransformer;
/**
* Spec for identifiers: https://tc39.github.io/ecma262/#prod-IdentifierStart.
*
* Really only treat anything starting with a-z as tag names. `_`, `$`, `é`
* should be treated as component names
*/
function startsWithLowerCase(s) {
const firstChar = s.charCodeAt(0);
return firstChar >= _charcodes.charCodes.lowercaseA && firstChar <= _charcodes.charCodes.lowercaseZ;
} exports.startsWithLowerCase = startsWithLowerCase;
/**
* Turn the given jsxText string into a JS string literal. Leading and trailing
* whitespace on lines is removed, except immediately after the open-tag and
* before the close-tag. Empty lines are completely removed, and spaces are
* added between lines after that.
*
* We use JSON.stringify to introduce escape characters as necessary, and trim
* the start and end of each line and remove blank lines.
*/
function formatJSXTextLiteral(text) {
let result = "";
let whitespace = "";
let isInInitialLineWhitespace = false;
let seenNonWhitespace = false;
for (let i = 0; i < text.length; i++) {
const c = text[i];
if (c === " " || c === "\t" || c === "\r") {
if (!isInInitialLineWhitespace) {
whitespace += c;
}
} else if (c === "\n") {
whitespace = "";
isInInitialLineWhitespace = true;
} else {
if (seenNonWhitespace && isInInitialLineWhitespace) {
result += " ";
}
result += whitespace;
whitespace = "";
if (c === "&") {
const {entity, newI} = processEntity(text, i + 1);
i = newI - 1;
result += entity;
} else {
result += c;
}
seenNonWhitespace = true;
isInInitialLineWhitespace = false;
}
}
if (!isInInitialLineWhitespace) {
result += whitespace;
}
return JSON.stringify(result);
}
/**
* Produce the code that should be printed after the JSX text string literal,
* with most content removed, but all newlines preserved and all spacing at the
* end preserved.
*/
function formatJSXTextReplacement(text) {
let numNewlines = 0;
let numSpaces = 0;
for (const c of text) {
if (c === "\n") {
numNewlines++;
numSpaces = 0;
} else if (c === " ") {
numSpaces++;
}
}
return "\n".repeat(numNewlines) + " ".repeat(numSpaces);
}
/**
* Format a string in the value position of a JSX prop.
*
* Use the same implementation as convertAttribute from
* babel-helper-builder-react-jsx.
*/
function formatJSXStringValueLiteral(text) {
let result = "";
for (let i = 0; i < text.length; i++) {
const c = text[i];
if (c === "\n") {
if (/\s/.test(text[i + 1])) {
result += " ";
while (i < text.length && /\s/.test(text[i + 1])) {
i++;
}
} else {
result += "\n";
}
} else if (c === "&") {
const {entity, newI} = processEntity(text, i + 1);
result += entity;
i = newI - 1;
} else {
result += c;
}
}
return JSON.stringify(result);
}
/**
* Starting at a &, see if there's an HTML entity (specified by name, decimal
* char code, or hex char code) and return it if so.
*
* Modified from jsxReadString in babel-parser.
*/
function processEntity(text, indexAfterAmpersand) {
let str = "";
let count = 0;
let entity;
let i = indexAfterAmpersand;
if (text[i] === "#") {
let radix = 10;
i++;
let numStart;
if (text[i] === "x") {
radix = 16;
i++;
numStart = i;
while (i < text.length && isHexDigit(text.charCodeAt(i))) {
i++;
}
} else {
numStart = i;
while (i < text.length && isDecimalDigit(text.charCodeAt(i))) {
i++;
}
}
if (text[i] === ";") {
const numStr = text.slice(numStart, i);
if (numStr) {
i++;
entity = String.fromCodePoint(parseInt(numStr, radix));
}
}
} else {
while (i < text.length && count++ < 10) {
const ch = text[i];
i++;
if (ch === ";") {
entity = _xhtml2.default.get(str);
break;
}
str += ch;
}
}
if (!entity) {
return {entity: "&", newI: indexAfterAmpersand};
}
return {entity, newI: i};
}
function isDecimalDigit(code) {
return code >= _charcodes.charCodes.digit0 && code <= _charcodes.charCodes.digit9;
}
function isHexDigit(code) {
return (
(code >= _charcodes.charCodes.digit0 && code <= _charcodes.charCodes.digit9) ||
(code >= _charcodes.charCodes.lowercaseA && code <= _charcodes.charCodes.lowercaseF) ||
(code >= _charcodes.charCodes.uppercaseA && code <= _charcodes.charCodes.uppercaseF)
);
}
@@ -0,0 +1 @@
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyBH;;;;;;;;;GASG;AACH,MAAM,OAAO,0BAA0B;IACnC,YAA6B,UAAqB;QAArB,eAAU,GAAV,UAAU,CAAW;IAAG,CAAC;IAgEtD,gBAAgB,CAIZ,IAAY,EACZ,MAQC,EACD,OAAmC;QAEnC,oEAAoE;QACpE,MAAM,SAAS,GAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QAClF,IAAI,SAAS,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,6DAA6D,CAAC,CAAC;QAC3H,CAAC;QAED,2DAA2D;QAC3D,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAA0C,CAAC;QAC1E,OAAO,iBAAiB,CAAC,qBAAqB,CAC1C,IAAI,EACJ,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,YAAY,EACnB,MAAM,CAAC,WAAW,EAClB,SAAS,EACT,MAAM,CAAC,KAAK,EACZ,OAAwD,CAC3D,CAAC;IACN,CAAC;CACJ"}
@@ -0,0 +1,88 @@
//#region src/utils/stream.ts
/**
* @module
* Stream utility.
*/
var StreamingApi = class {
writer;
encoder;
writable;
abortSubscribers = [];
responseReadable;
/**
* Whether the stream has been aborted.
*/
aborted = false;
/**
* Whether the stream has been closed normally.
*/
closed = false;
constructor(writable, _readable) {
this.writable = writable;
this.writer = writable.getWriter();
this.encoder = new TextEncoder();
const reader = _readable.getReader();
this.abortSubscribers.push(async () => {
await reader.cancel();
});
this.responseReadable = new ReadableStream({
async pull(controller) {
const { done, value } = await reader.read();
done ? controller.close() : controller.enqueue(value);
},
cancel: () => {
if (!this.closed) this.abort();
}
});
}
async write(input) {
try {
if (typeof input === "string") input = this.encoder.encode(input);
await this.writer.write(input);
} catch {}
return this;
}
async writeln(input) {
await this.write(input + "\n");
return this;
}
sleep(ms) {
return new Promise((res) => setTimeout(res, ms));
}
async close() {
this.closed = true;
try {
await this.writer.close();
} catch {}
}
async pipe(body) {
this.writer.releaseLock();
try {
await body.pipeTo(this.writable, {
preventClose: true,
preventAbort: true
});
} finally {
this.writer = this.writable.getWriter();
}
}
onAbort(listener) {
this.abortSubscribers.push(listener);
}
/**
* Abort the stream.
* You can call this method when stream is aborted by external event.
*/
abort() {
if (!this.aborted) {
this.aborted = true;
this.abortSubscribers.forEach((subscriber) => {
try {
Promise.resolve(subscriber()).catch(() => {});
} catch {}
});
}
}
};
//#endregion
export { StreamingApi };
@@ -0,0 +1,429 @@
import { mergeCapabilities, Protocol } from '../shared/protocol.js';
import { CreateMessageResultSchema, CreateMessageResultWithToolsSchema, ElicitResultSchema, EmptyResultSchema, ErrorCode, InitializedNotificationSchema, InitializeRequestSchema, LATEST_PROTOCOL_VERSION, ListRootsResultSchema, LoggingLevelSchema, McpError, SetLevelRequestSchema, SUPPORTED_PROTOCOL_VERSIONS, CallToolRequestSchema, CallToolResultSchema, CreateTaskResultSchema } from '../types.js';
import { AjvJsonSchemaValidator } from '../validation/ajv-provider.js';
import { getLiteralValue, getObjectShape, safeParse } from './zod-compat.js';
import { ExperimentalServerTasks } from '../experimental/tasks/server.js';
import { assertToolsCallTaskCapability, assertClientRequestTaskCapability } from '../experimental/tasks/helpers.js';
/**
* An MCP server on top of a pluggable transport.
*
* This server will automatically respond to the initialization flow as initiated from the client.
*
* To use with custom types, extend the base Request/Notification/Result types and pass them as type parameters:
*
* ```typescript
* // Custom schemas
* const CustomRequestSchema = RequestSchema.extend({...})
* const CustomNotificationSchema = NotificationSchema.extend({...})
* const CustomResultSchema = ResultSchema.extend({...})
*
* // Type aliases
* type CustomRequest = z.infer<typeof CustomRequestSchema>
* type CustomNotification = z.infer<typeof CustomNotificationSchema>
* type CustomResult = z.infer<typeof CustomResultSchema>
*
* // Create typed server
* const server = new Server<CustomRequest, CustomNotification, CustomResult>({
* name: "CustomServer",
* version: "1.0.0"
* })
* ```
* @deprecated Use `McpServer` instead for the high-level API. Only use `Server` for advanced use cases.
*/
export class Server extends Protocol {
/**
* Initializes this server with the given name and version information.
*/
constructor(_serverInfo, options) {
super(options);
this._serverInfo = _serverInfo;
// Map log levels by session id
this._loggingLevels = new Map();
// Map LogLevelSchema to severity index
this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index]));
// Is a message with the given level ignored in the log level set for the given session id?
this.isMessageIgnored = (level, sessionId) => {
const currentLevel = this._loggingLevels.get(sessionId);
return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;
};
this._capabilities = options?.capabilities ?? {};
this._instructions = options?.instructions;
this._jsonSchemaValidator = options?.jsonSchemaValidator ?? new AjvJsonSchemaValidator();
this.setRequestHandler(InitializeRequestSchema, request => this._oninitialize(request));
this.setNotificationHandler(InitializedNotificationSchema, () => this.oninitialized?.());
if (this._capabilities.logging) {
this.setRequestHandler(SetLevelRequestSchema, async (request, extra) => {
const transportSessionId = extra.sessionId || extra.requestInfo?.headers['mcp-session-id'] || undefined;
const { level } = request.params;
const parseResult = LoggingLevelSchema.safeParse(level);
if (parseResult.success) {
this._loggingLevels.set(transportSessionId, parseResult.data);
}
return {};
});
}
}
/**
* Access experimental features.
*
* WARNING: These APIs are experimental and may change without notice.
*
* @experimental
*/
get experimental() {
if (!this._experimental) {
this._experimental = {
tasks: new ExperimentalServerTasks(this)
};
}
return this._experimental;
}
/**
* Registers new capabilities. This can only be called before connecting to a transport.
*
* The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization).
*/
registerCapabilities(capabilities) {
if (this.transport) {
throw new Error('Cannot register capabilities after connecting to transport');
}
this._capabilities = mergeCapabilities(this._capabilities, capabilities);
}
/**
* Override request handler registration to enforce server-side validation for tools/call.
*/
setRequestHandler(requestSchema, handler) {
const shape = getObjectShape(requestSchema);
const methodSchema = shape?.method;
if (!methodSchema) {
throw new Error('Schema is missing a method literal');
}
const methodValue = getLiteralValue(methodSchema);
if (typeof methodValue !== 'string') {
throw new Error('Schema method literal must be a string');
}
const method = methodValue;
if (method === 'tools/call') {
const wrappedHandler = async (request, extra) => {
const validatedRequest = safeParse(CallToolRequestSchema, request);
if (!validatedRequest.success) {
const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage}`);
}
const { params } = validatedRequest.data;
const result = await Promise.resolve(handler(request, extra));
// When task creation is requested, validate and return CreateTaskResult
if (params.task) {
const taskValidationResult = safeParse(CreateTaskResultSchema, result);
if (!taskValidationResult.success) {
const errorMessage = taskValidationResult.error instanceof Error
? taskValidationResult.error.message
: String(taskValidationResult.error);
throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);
}
return taskValidationResult.data;
}
// For non-task requests, validate against CallToolResultSchema
const validationResult = safeParse(CallToolResultSchema, result);
if (!validationResult.success) {
const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage}`);
}
return validationResult.data;
};
// Install the wrapped handler
return super.setRequestHandler(requestSchema, wrappedHandler);
}
// Other handlers use default behavior
return super.setRequestHandler(requestSchema, handler);
}
assertCapabilityForMethod(method) {
switch (method) {
case 'sampling/createMessage':
if (!this._clientCapabilities?.sampling) {
throw new Error(`Client does not support sampling (required for ${method})`);
}
break;
case 'elicitation/create':
if (!this._clientCapabilities?.elicitation) {
throw new Error(`Client does not support elicitation (required for ${method})`);
}
break;
case 'roots/list':
if (!this._clientCapabilities?.roots) {
throw new Error(`Client does not support listing roots (required for ${method})`);
}
break;
case 'ping':
// No specific capability required for ping
break;
}
}
assertNotificationCapability(method) {
switch (method) {
case 'notifications/message':
if (!this._capabilities.logging) {
throw new Error(`Server does not support logging (required for ${method})`);
}
break;
case 'notifications/resources/updated':
case 'notifications/resources/list_changed':
if (!this._capabilities.resources) {
throw new Error(`Server does not support notifying about resources (required for ${method})`);
}
break;
case 'notifications/tools/list_changed':
if (!this._capabilities.tools) {
throw new Error(`Server does not support notifying of tool list changes (required for ${method})`);
}
break;
case 'notifications/prompts/list_changed':
if (!this._capabilities.prompts) {
throw new Error(`Server does not support notifying of prompt list changes (required for ${method})`);
}
break;
case 'notifications/elicitation/complete':
if (!this._clientCapabilities?.elicitation?.url) {
throw new Error(`Client does not support URL elicitation (required for ${method})`);
}
break;
case 'notifications/cancelled':
// Cancellation notifications are always allowed
break;
case 'notifications/progress':
// Progress notifications are always allowed
break;
}
}
assertRequestHandlerCapability(method) {
// Task handlers are registered in Protocol constructor before _capabilities is initialized
// Skip capability check for task methods during initialization
if (!this._capabilities) {
return;
}
switch (method) {
case 'completion/complete':
if (!this._capabilities.completions) {
throw new Error(`Server does not support completions (required for ${method})`);
}
break;
case 'logging/setLevel':
if (!this._capabilities.logging) {
throw new Error(`Server does not support logging (required for ${method})`);
}
break;
case 'prompts/get':
case 'prompts/list':
if (!this._capabilities.prompts) {
throw new Error(`Server does not support prompts (required for ${method})`);
}
break;
case 'resources/list':
case 'resources/templates/list':
case 'resources/read':
if (!this._capabilities.resources) {
throw new Error(`Server does not support resources (required for ${method})`);
}
break;
case 'tools/call':
case 'tools/list':
if (!this._capabilities.tools) {
throw new Error(`Server does not support tools (required for ${method})`);
}
break;
case 'tasks/get':
case 'tasks/list':
case 'tasks/result':
case 'tasks/cancel':
if (!this._capabilities.tasks) {
throw new Error(`Server does not support tasks capability (required for ${method})`);
}
break;
case 'ping':
case 'initialize':
// No specific capability required for these methods
break;
}
}
assertTaskCapability(method) {
assertClientRequestTaskCapability(this._clientCapabilities?.tasks?.requests, method, 'Client');
}
assertTaskHandlerCapability(method) {
// Task handlers are registered in Protocol constructor before _capabilities is initialized
// Skip capability check for task methods during initialization
if (!this._capabilities) {
return;
}
assertToolsCallTaskCapability(this._capabilities.tasks?.requests, method, 'Server');
}
async _oninitialize(request) {
const requestedVersion = request.params.protocolVersion;
this._clientCapabilities = request.params.capabilities;
this._clientVersion = request.params.clientInfo;
const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS.includes(requestedVersion) ? requestedVersion : LATEST_PROTOCOL_VERSION;
return {
protocolVersion,
capabilities: this.getCapabilities(),
serverInfo: this._serverInfo,
...(this._instructions && { instructions: this._instructions })
};
}
/**
* After initialization has completed, this will be populated with the client's reported capabilities.
*/
getClientCapabilities() {
return this._clientCapabilities;
}
/**
* After initialization has completed, this will be populated with information about the client's name and version.
*/
getClientVersion() {
return this._clientVersion;
}
getCapabilities() {
return this._capabilities;
}
async ping() {
return this.request({ method: 'ping' }, EmptyResultSchema);
}
// Implementation
async createMessage(params, options) {
// Capability check - only required when tools/toolChoice are provided
if (params.tools || params.toolChoice) {
if (!this._clientCapabilities?.sampling?.tools) {
throw new Error('Client does not support sampling tools capability.');
}
}
// Message structure validation - always validate tool_use/tool_result pairs.
// These may appear even without tools/toolChoice in the current request when
// a previous sampling request returned tool_use and this is a follow-up with results.
if (params.messages.length > 0) {
const lastMessage = params.messages[params.messages.length - 1];
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
const hasToolResults = lastContent.some(c => c.type === 'tool_result');
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
const previousContent = previousMessage
? Array.isArray(previousMessage.content)
? previousMessage.content
: [previousMessage.content]
: [];
const hasPreviousToolUse = previousContent.some(c => c.type === 'tool_use');
if (hasToolResults) {
if (lastContent.some(c => c.type !== 'tool_result')) {
throw new Error('The last message must contain only tool_result content if any is present');
}
if (!hasPreviousToolUse) {
throw new Error('tool_result blocks are not matching any tool_use from the previous message');
}
}
if (hasPreviousToolUse) {
const toolUseIds = new Set(previousContent.filter(c => c.type === 'tool_use').map(c => c.id));
const toolResultIds = new Set(lastContent.filter(c => c.type === 'tool_result').map(c => c.toolUseId));
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every(id => toolResultIds.has(id))) {
throw new Error('ids of tool_result blocks and tool_use blocks from previous message do not match');
}
}
}
// Use different schemas based on whether tools are provided
if (params.tools) {
return this.request({ method: 'sampling/createMessage', params }, CreateMessageResultWithToolsSchema, options);
}
return this.request({ method: 'sampling/createMessage', params }, CreateMessageResultSchema, options);
}
/**
* Creates an elicitation request for the given parameters.
* For backwards compatibility, `mode` may be omitted for form requests and will default to `'form'`.
* @param params The parameters for the elicitation request.
* @param options Optional request options.
* @returns The result of the elicitation request.
*/
async elicitInput(params, options) {
const mode = (params.mode ?? 'form');
switch (mode) {
case 'url': {
if (!this._clientCapabilities?.elicitation?.url) {
throw new Error('Client does not support url elicitation.');
}
const urlParams = params;
return this.request({ method: 'elicitation/create', params: urlParams }, ElicitResultSchema, options);
}
case 'form': {
if (!this._clientCapabilities?.elicitation?.form) {
throw new Error('Client does not support form elicitation.');
}
const formParams = params.mode === 'form' ? params : { ...params, mode: 'form' };
const result = await this.request({ method: 'elicitation/create', params: formParams }, ElicitResultSchema, options);
if (result.action === 'accept' && result.content && formParams.requestedSchema) {
try {
const validator = this._jsonSchemaValidator.getValidator(formParams.requestedSchema);
const validationResult = validator(result.content);
if (!validationResult.valid) {
throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${validationResult.errorMessage}`);
}
}
catch (error) {
if (error instanceof McpError) {
throw error;
}
throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error instanceof Error ? error.message : String(error)}`);
}
}
return result;
}
}
}
/**
* Creates a reusable callback that, when invoked, will send a `notifications/elicitation/complete`
* notification for the specified elicitation ID.
*
* @param elicitationId The ID of the elicitation to mark as complete.
* @param options Optional notification options. Useful when the completion notification should be related to a prior request.
* @returns A function that emits the completion notification when awaited.
*/
createElicitationCompletionNotifier(elicitationId, options) {
if (!this._clientCapabilities?.elicitation?.url) {
throw new Error('Client does not support URL elicitation (required for notifications/elicitation/complete)');
}
return () => this.notification({
method: 'notifications/elicitation/complete',
params: {
elicitationId
}
}, options);
}
async listRoots(params, options) {
return this.request({ method: 'roots/list', params }, ListRootsResultSchema, options);
}
/**
* Sends a logging message to the client, if connected.
* Note: You only need to send the parameters object, not the entire JSON RPC message
* @see LoggingMessageNotification
* @param params
* @param sessionId optional for stateless and backward compatibility
*/
async sendLoggingMessage(params, sessionId) {
if (this._capabilities.logging) {
if (!this.isMessageIgnored(params.level, sessionId)) {
return this.notification({ method: 'notifications/message', params });
}
}
}
async sendResourceUpdated(params) {
return this.notification({
method: 'notifications/resources/updated',
params
});
}
async sendResourceListChanged() {
return this.notification({
method: 'notifications/resources/list_changed'
});
}
async sendToolListChanged() {
return this.notification({ method: 'notifications/tools/list_changed' });
}
async sendPromptListChanged() {
return this.notification({ method: 'notifications/prompts/list_changed' });
}
}
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"banknote.js","sources":["../../../src/icons/banknote.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Banknote\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMjAiIGhlaWdodD0iMTIiIHg9IjIiIHk9IjYiIHJ4PSIyIiAvPgogIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjIiIC8+CiAgPHBhdGggZD0iTTYgMTJoLjAxTTE4IDEyaC4wMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/banknote\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 Banknote = createLucideIcon('Banknote', [\n ['rect', { width: '20', height: '12', x: '2', y: '6', rx: '2', key: '9lu3g6' }],\n ['circle', { cx: '12', cy: '12', r: '2', key: '1c9p78' }],\n ['path', { d: 'M6 12h.01M18 12h.01', key: '113zkx' }],\n]);\n\nexport default Banknote;\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,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,CAC9E,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAuB,CAAA,CAAA,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;AACtD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,224 @@
/**
* @fileoverview Rule to flag unnecessary bind calls
* @author Bence Dányi <bence@danyi.me>
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const SIDE_EFFECT_FREE_NODE_TYPES = new Set([
"Literal",
"Identifier",
"ThisExpression",
"FunctionExpression",
]);
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow unnecessary calls to `.bind()`",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-extra-bind",
},
schema: [],
fixable: "code",
messages: {
unexpected: "The function binding is unnecessary.",
},
},
create(context) {
const sourceCode = context.sourceCode;
let scopeInfo = null;
/**
* Checks if a node is free of side effects.
*
* This check is stricter than it needs to be, in order to keep the implementation simple.
* @param {ASTNode} node A node to check.
* @returns {boolean} True if the node is known to be side-effect free, false otherwise.
*/
function isSideEffectFree(node) {
return SIDE_EFFECT_FREE_NODE_TYPES.has(node.type);
}
/**
* Reports a given function node.
* @param {ASTNode} node A node to report. This is a FunctionExpression or
* an ArrowFunctionExpression.
* @returns {void}
*/
function report(node) {
const memberNode = node.parent;
const callNode =
memberNode.parent.type === "ChainExpression"
? memberNode.parent.parent
: memberNode.parent;
context.report({
node: callNode,
messageId: "unexpected",
loc: memberNode.property.loc,
fix(fixer) {
if (!isSideEffectFree(callNode.arguments[0])) {
return null;
}
/*
* The list of the first/last token pair of a removal range.
* This is two parts because closing parentheses may exist between the method name and arguments.
* E.g. `(function(){}.bind ) (obj)`
* ^^^^^ ^^^^^ < removal ranges
* E.g. `(function(){}?.['bind'] ) ?.(obj)`
* ^^^^^^^^^^ ^^^^^^^ < removal ranges
*/
const tokenPairs = [
[
// `.`, `?.`, or `[` token.
sourceCode.getTokenAfter(
memberNode.object,
astUtils.isNotClosingParenToken,
),
// property name or `]` token.
sourceCode.getLastToken(memberNode),
],
[
// `?.` or `(` token of arguments.
sourceCode.getTokenAfter(
memberNode,
astUtils.isNotClosingParenToken,
),
// `)` token of arguments.
sourceCode.getLastToken(callNode),
],
];
const firstTokenToRemove = tokenPairs[0][0];
const lastTokenToRemove = tokenPairs[1][1];
if (
sourceCode.commentsExistBetween(
firstTokenToRemove,
lastTokenToRemove,
)
) {
return null;
}
return tokenPairs.map(([start, end]) =>
fixer.removeRange([start.range[0], end.range[1]]),
);
},
});
}
/**
* Checks whether or not a given function node is the callee of `.bind()`
* method.
*
* e.g. `(function() {}.bind(foo))`
* @param {ASTNode} node A node to report. This is a FunctionExpression or
* an ArrowFunctionExpression.
* @returns {boolean} `true` if the node is the callee of `.bind()` method.
*/
function isCalleeOfBindMethod(node) {
if (!astUtils.isSpecificMemberAccess(node.parent, null, "bind")) {
return false;
}
// The node of `*.bind` member access.
const bindNode =
node.parent.parent.type === "ChainExpression"
? node.parent.parent
: node.parent;
return (
bindNode.parent.type === "CallExpression" &&
bindNode.parent.callee === bindNode &&
bindNode.parent.arguments.length === 1 &&
bindNode.parent.arguments[0].type !== "SpreadElement"
);
}
/**
* Adds a scope information object to the stack.
* @param {ASTNode} node A node to add. This node is a FunctionExpression
* or a FunctionDeclaration node.
* @returns {void}
*/
function enterFunction(node) {
scopeInfo = {
isBound: isCalleeOfBindMethod(node),
thisFound: false,
upper: scopeInfo,
};
}
/**
* Removes the scope information object from the top of the stack.
* At the same time, this reports the function node if the function has
* `.bind()` and the `this` keywords found.
* @param {ASTNode} node A node to remove. This node is a
* FunctionExpression or a FunctionDeclaration node.
* @returns {void}
*/
function exitFunction(node) {
if (scopeInfo.isBound && !scopeInfo.thisFound) {
report(node);
}
scopeInfo = scopeInfo.upper;
}
/**
* Reports a given arrow function if the function is callee of `.bind()`
* method.
* @param {ASTNode} node A node to report. This node is an
* ArrowFunctionExpression.
* @returns {void}
*/
function exitArrowFunction(node) {
if (isCalleeOfBindMethod(node)) {
report(node);
}
}
/**
* Set the mark as the `this` keyword was found in this scope.
* @returns {void}
*/
function markAsThisFound() {
if (scopeInfo) {
scopeInfo.thisFound = true;
}
}
return {
"ArrowFunctionExpression:exit": exitArrowFunction,
FunctionDeclaration: enterFunction,
"FunctionDeclaration:exit": exitFunction,
FunctionExpression: enterFunction,
"FunctionExpression:exit": exitFunction,
ThisExpression: markAsThisFound,
};
},
};
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2024_sharedmemory: LibDefinition;
@@ -0,0 +1,642 @@
import * as i0 from '@angular/core';
import { Injectable, ViewContainerRef, Component, ViewChild, Input, EventEmitter, reflectComponentType, ContentChildren, Output, NgModule } from '@angular/core';
import { NgIf } from '@angular/common';
import { GridStack } from 'gridstack';
/**
* gridstack-item.component.ts 12.6.0
* Copyright (c) 2025 Alain Dumesny - see GridStack root license
*/
/**
* gridstack-item.component.ts 12.6.0
* Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license
*/
/**
* Base widget class for GridStack Angular integration.
*/
class BaseWidget {
/**
* Override this method to return serializable data for this widget.
*
* Return an object with properties that map to your component's @Input() fields.
* The selector is handled automatically, so only include component-specific data.
*
* @returns Object containing serializable component data
*
* @example
* ```typescript
* serialize() {
* return {
* title: this.title,
* value: this.value,
* settings: this.settings
* };
* }
* ```
*/
serialize() { return; }
/**
* Override this method to handle widget restoration from saved data.
*
* Use this for complex initialization that goes beyond simple @Input() mapping.
* The default implementation automatically assigns input data to component properties.
*
* @param w The saved widget data including input properties
*
* @example
* ```typescript
* deserialize(w: NgGridStackWidget) {
* super.deserialize(w); // Call parent for basic setup
*
* // Custom initialization logic
* if (w.input?.complexData) {
* this.processComplexData(w.input.complexData);
* }
* }
* ```
*/
deserialize(w) {
// save full description for meta data
this.widgetItem = w;
if (!w)
return;
if (w.input)
Object.assign(this, w.input);
}
}
BaseWidget.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BaseWidget, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
BaseWidget.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BaseWidget });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: BaseWidget, decorators: [{
type: Injectable
}] });
/**
* gridstack-item.component.ts 12.6.0
* Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license
*/
/**
* Angular component wrapper for individual GridStack items.
*
* This component represents a single grid item and handles:
* - Dynamic content creation and management
* - Integration with parent GridStack component
* - Component lifecycle and cleanup
* - Widget options and configuration
*
* Use in combination with GridstackComponent for the parent grid.
*
* @example
* ```html
* <gridstack>
* <gridstack-item [options]="{x: 0, y: 0, w: 2, h: 1}">
* <my-widget-component></my-widget-component>
* </gridstack-item>
* </gridstack>
* ```
*/
class GridstackItemComponent {
constructor(elementRef) {
this.elementRef = elementRef;
this.el._gridItemComp = this;
}
/**
* Grid item configuration options.
* Defines position, size, and behavior of this grid item.
*
* @example
* ```typescript
* itemOptions: GridStackNode = {
* x: 0, y: 0, w: 2, h: 1,
* noResize: true,
* content: 'Item content'
* };
* ```
*/
set options(val) {
const grid = this.el.gridstackNode?.grid;
if (grid) {
// already built, do an update...
grid.update(this.el, val);
}
else {
// store our custom element in options so we can update it and not re-create a generic div!
this._options = { ...val, el: this.el };
}
}
/** return the latest grid options (from GS once built, otherwise initial values) */
get options() {
return this.el.gridstackNode || this._options || { el: this.el };
}
/** return the native element that contains grid specific fields as well */
get el() { return this.elementRef.nativeElement; }
/** clears the initial options now that we've built */
clearOptions() {
delete this._options;
}
ngOnDestroy() {
this.clearOptions();
delete this.childWidget;
delete this.el._gridItemComp;
delete this.container;
delete this.ref;
}
}
GridstackItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackItemComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
GridstackItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: GridstackItemComponent, isStandalone: true, selector: "gridstack-item", inputs: { options: "options" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: `
<div class="grid-stack-item-content">
<!-- where dynamic items go based on component selector (recommended way), or sub-grids, etc...) -->
<ng-template #container></ng-template>
<!-- any static (defined in DOM - not recommended) content goes here -->
<ng-content></ng-content>
<!-- fallback HTML content from GridStackWidget.content if used instead (not recommended) -->
{{options.content}}
</div>`, isInline: true, styles: [":host{display:block}\n"] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackItemComponent, decorators: [{
type: Component,
args: [{ selector: 'gridstack-item', template: `
<div class="grid-stack-item-content">
<!-- where dynamic items go based on component selector (recommended way), or sub-grids, etc...) -->
<ng-template #container></ng-template>
<!-- any static (defined in DOM - not recommended) content goes here -->
<ng-content></ng-content>
<!-- fallback HTML content from GridStackWidget.content if used instead (not recommended) -->
{{options.content}}
</div>`, standalone: true, styles: [":host{display:block}\n"] }]
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { container: [{
type: ViewChild,
args: ['container', { read: ViewContainerRef, static: true }]
}], options: [{
type: Input
}] } });
/**
* gridstack.component.ts 12.6.0
* Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license
*/
/**
* Angular component wrapper for GridStack.
*
* This component provides Angular integration for GridStack grids, handling:
* - Grid initialization and lifecycle
* - Dynamic component creation and management
* - Event binding and emission
* - Integration with Angular change detection
*
* Use in combination with GridstackItemComponent for individual grid items.
*
* @example
* ```html
* <gridstack [options]="gridOptions" (change)="onGridChange($event)">
* <div empty-content>Drag widgets here</div>
* </gridstack>
* ```
*/
class GridstackComponent {
constructor(elementRef) {
this.elementRef = elementRef;
/**
* GridStack event emitters for Angular integration.
*
* These provide Angular-style event handling for GridStack events.
* Alternatively, use `this.grid.on('event1 event2', callback)` for multiple events.
*
* Note: 'CB' suffix prevents conflicts with native DOM events.
*
* @example
* ```html
* <gridstack (changeCB)="onGridChange($event)" (droppedCB)="onItemDropped($event)">
* </gridstack>
* ```
*/
/** Emitted when widgets are added to the grid */
this.addedCB = new EventEmitter();
/** Emitted when grid layout changes */
this.changeCB = new EventEmitter();
/** Emitted when grid is disabled */
this.disableCB = new EventEmitter();
/** Emitted during widget drag operations */
this.dragCB = new EventEmitter();
/** Emitted when widget drag starts */
this.dragStartCB = new EventEmitter();
/** Emitted when widget drag stops */
this.dragStopCB = new EventEmitter();
/** Emitted when widget is dropped */
this.droppedCB = new EventEmitter();
/** Emitted when grid is enabled */
this.enableCB = new EventEmitter();
/** Emitted when widgets are removed from the grid */
this.removedCB = new EventEmitter();
/** Emitted during widget resize operations */
this.resizeCB = new EventEmitter();
/** Emitted when widget resize starts */
this.resizeStartCB = new EventEmitter();
/** Emitted when widget resize stops */
this.resizeStopCB = new EventEmitter();
// set globally our method to create the right widget type
if (!GridStack.addRemoveCB) {
GridStack.addRemoveCB = gsCreateNgComponents;
}
if (!GridStack.saveCB) {
GridStack.saveCB = gsSaveAdditionalNgInfo;
}
if (!GridStack.updateCB) {
GridStack.updateCB = gsUpdateNgComponents;
}
this.el._gridComp = this;
}
/**
* Grid configuration options.
* Can be set before grid initialization or updated after grid is created.
*
* @example
* ```typescript
* gridOptions: GridStackOptions = {
* column: 12,
* cellHeight: 'auto',
* animate: true
* };
* ```
*/
set options(o) {
if (this._grid) {
this._grid.updateOptions(o);
}
else {
this._options = o;
}
}
/** Get the current running grid options */
get options() { return this._grid?.opts || this._options || {}; }
/**
* Get the native DOM element that contains grid-specific fields.
* This element has GridStack properties attached to it.
*/
get el() { return this.elementRef.nativeElement; }
/**
* Get the underlying GridStack instance.
* Use this to access GridStack API methods directly.
*
* @example
* ```typescript
* this.gridComponent.grid.addWidget({x: 0, y: 0, w: 2, h: 1});
* ```
*/
get grid() { return this._grid; }
/**
* Register a list of Angular components for dynamic creation.
*
* @param typeList Array of component types to register
*
* @example
* ```typescript
* GridstackComponent.addComponentToSelectorType([
* MyWidgetComponent,
* AnotherWidgetComponent
* ]);
* ```
*/
static addComponentToSelectorType(typeList) {
typeList.forEach(type => GridstackComponent.selectorToType[GridstackComponent.getSelector(type)] = type);
}
/**
* Extract the selector string from an Angular component type.
*
* @param type The component type to get selector from
* @returns The component's selector string
*/
static getSelector(type) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return reflectComponentType(type).selector;
}
ngOnInit() {
// init ourself before any template children are created since we track them below anyway - no need to double create+update widgets
this.loaded = !!this.options?.children?.length;
this._grid = GridStack.init(this._options, this.el);
delete this._options; // GS has it now
this.checkEmpty();
}
/** wait until after all DOM is ready to init gridstack children (after angular ngFor and sub-components run first) */
ngAfterContentInit() {
// track whenever the children list changes and update the layout...
this._sub = this.gridstackItems?.changes.subscribe(() => this.updateAll());
// ...and do this once at least unless we loaded children already
if (!this.loaded)
this.updateAll();
this.hookEvents(this.grid);
}
ngOnDestroy() {
this.unhookEvents(this._grid);
this._sub?.unsubscribe();
this._grid?.destroy();
delete this._grid;
delete this.el._gridComp;
delete this.container;
delete this.ref;
}
/**
* called when the TEMPLATE (not recommended) list of items changes - get a list of nodes and
* update the layout accordingly (which will take care of adding/removing items changed by Angular)
*/
updateAll() {
if (!this.grid)
return;
const layout = [];
this.gridstackItems?.forEach(item => {
layout.push(item.options);
item.clearOptions();
});
this.grid.load(layout); // efficient that does diffs only
}
/** check if the grid is empty, if so show alternative content */
checkEmpty() {
if (!this.grid)
return;
this.isEmpty = !this.grid.engine.nodes.length;
}
/** get all known events as easy to use Outputs for convenience */
hookEvents(grid) {
if (!grid)
return;
// nested grids don't have events in v12.1+ so skip
if (grid.parentGridNode)
return;
grid
.on('added', (event, nodes) => {
const gridComp = nodes[0].grid?.el._gridComp || this;
gridComp.checkEmpty();
this.addedCB.emit({ event, nodes });
})
.on('change', (event, nodes) => this.changeCB.emit({ event, nodes }))
.on('disable', (event) => this.disableCB.emit({ event }))
.on('drag', (event, el) => this.dragCB.emit({ event, el }))
.on('dragstart', (event, el) => this.dragStartCB.emit({ event, el }))
.on('dragstop', (event, el) => this.dragStopCB.emit({ event, el }))
.on('dropped', (event, previousNode, newNode) => this.droppedCB.emit({ event, previousNode, newNode }))
.on('enable', (event) => this.enableCB.emit({ event }))
.on('removed', (event, nodes) => {
const gridComp = nodes[0].grid?.el._gridComp || this;
gridComp.checkEmpty();
this.removedCB.emit({ event, nodes });
})
.on('resize', (event, el) => this.resizeCB.emit({ event, el }))
.on('resizestart', (event, el) => this.resizeStartCB.emit({ event, el }))
.on('resizestop', (event, el) => this.resizeStopCB.emit({ event, el }));
}
unhookEvents(grid) {
if (!grid)
return;
// nested grids don't have events in v12.1+ so skip
if (grid.parentGridNode)
return;
grid.off('added change disable drag dragstart dragstop dropped enable removed resize resizestart resizestop');
}
}
/**
* Mapping of component selectors to their types for dynamic creation.
*
* This enables dynamic component instantiation from string selectors.
* Angular doesn't provide public access to this mapping, so we maintain our own.
*
* @example
* ```typescript
* GridstackComponent.addComponentToSelectorType([MyWidgetComponent]);
* ```
*/
GridstackComponent.selectorToType = {};
GridstackComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
GridstackComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: GridstackComponent, isStandalone: true, selector: "gridstack", inputs: { options: "options", isEmpty: "isEmpty" }, outputs: { addedCB: "addedCB", changeCB: "changeCB", disableCB: "disableCB", dragCB: "dragCB", dragStartCB: "dragStartCB", dragStopCB: "dragStopCB", droppedCB: "droppedCB", enableCB: "enableCB", removedCB: "removedCB", resizeCB: "resizeCB", resizeStartCB: "resizeStartCB", resizeStopCB: "resizeStopCB" }, queries: [{ propertyName: "gridstackItems", predicate: GridstackItemComponent }], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: `
<!-- content to show when when grid is empty, like instructions on how to add widgets -->
<ng-content select="[empty-content]" *ngIf="isEmpty"></ng-content>
<!-- where dynamic items go -->
<ng-template #container></ng-template>
<!-- where template items go -->
<ng-content></ng-content>
`, isInline: true, styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackComponent, decorators: [{
type: Component,
args: [{ selector: 'gridstack', template: `
<!-- content to show when when grid is empty, like instructions on how to add widgets -->
<ng-content select="[empty-content]" *ngIf="isEmpty"></ng-content>
<!-- where dynamic items go -->
<ng-template #container></ng-template>
<!-- where template items go -->
<ng-content></ng-content>
`, standalone: true, imports: [NgIf], styles: [":host{display:block}\n"] }]
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { gridstackItems: [{
type: ContentChildren,
args: [GridstackItemComponent]
}], container: [{
type: ViewChild,
args: ['container', { read: ViewContainerRef, static: true }]
}], options: [{
type: Input
}], isEmpty: [{
type: Input
}], addedCB: [{
type: Output
}], changeCB: [{
type: Output
}], disableCB: [{
type: Output
}], dragCB: [{
type: Output
}], dragStartCB: [{
type: Output
}], dragStopCB: [{
type: Output
}], droppedCB: [{
type: Output
}], enableCB: [{
type: Output
}], removedCB: [{
type: Output
}], resizeCB: [{
type: Output
}], resizeStartCB: [{
type: Output
}], resizeStopCB: [{
type: Output
}] } });
/**
* can be used when a new item needs to be created, which we do as a Angular component, or deleted (skip)
**/
function gsCreateNgComponents(host, n, add, isGrid) {
if (add) {
//
// create the component dynamically - see https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html
//
if (!host)
return;
if (isGrid) {
// TODO: figure out how to create ng component inside regular Div. need to access app injectors...
// if (!container) {
// const hostElement: Element = host;
// const environmentInjector: EnvironmentInjector;
// grid = createComponent(GridstackComponent, {environmentInjector, hostElement})?.instance;
// }
const gridItemComp = host.parentElement?._gridItemComp;
if (!gridItemComp)
return;
// check if gridItem has a child component with 'container' exposed to create under..
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const container = gridItemComp.childWidget?.container || gridItemComp.container;
const gridRef = container?.createComponent(GridstackComponent);
const grid = gridRef?.instance;
if (!grid)
return;
grid.ref = gridRef;
grid.options = n;
return grid.el;
}
else {
const gridComp = host._gridComp;
const gridItemRef = gridComp?.container?.createComponent(GridstackItemComponent);
const gridItem = gridItemRef?.instance;
if (!gridItem)
return;
gridItem.ref = gridItemRef;
// define what type of component to create as child, OR you can do it GridstackItemComponent template, but this is more generic
const selector = n.selector;
const type = selector ? GridstackComponent.selectorToType[selector] : undefined;
if (type) {
// shared code to create our selector component
const createComp = () => {
const childWidget = gridItem.container?.createComponent(type)?.instance;
// if proper BaseWidget subclass, save it and load additional data
if (childWidget && typeof childWidget.serialize === 'function' && typeof childWidget.deserialize === 'function') {
gridItem.childWidget = childWidget;
childWidget.deserialize(n);
}
};
const lazyLoad = n.lazyLoad || n.grid?.opts?.lazyLoad && n.lazyLoad !== false;
if (lazyLoad) {
if (!n.visibleObservable) {
n.visibleObservable = new IntersectionObserver(([entry]) => {
if (entry.isIntersecting) {
n.visibleObservable?.disconnect();
delete n.visibleObservable;
createComp();
}
});
window.setTimeout(() => n.visibleObservable?.observe(gridItem.el)); // wait until callee sets position attributes
}
}
else
createComp();
}
return gridItem.el;
}
}
else {
//
// REMOVE - have to call ComponentRef:destroy() for dynamic objects to correctly remove themselves
// Note: this will destroy all children dynamic components as well: gridItem -> childWidget
//
if (isGrid) {
const grid = n.el?._gridComp;
if (grid?.ref)
grid.ref.destroy();
else
grid?.ngOnDestroy();
}
else {
const gridItem = n.el?._gridItemComp;
if (gridItem?.ref)
gridItem.ref.destroy();
else
gridItem?.ngOnDestroy();
}
}
return;
}
/**
* called for each item in the grid - check if additional information needs to be saved.
* Note: since this is options minus gridstack protected members using Utils.removeInternalForSave(),
* this typically doesn't need to do anything. However your custom Component @Input() are now supported
* using BaseWidget.serialize()
*/
function gsSaveAdditionalNgInfo(n, w) {
const gridItem = n.el?._gridItemComp;
if (gridItem) {
const input = gridItem.childWidget?.serialize();
if (input) {
w.input = input;
}
return;
}
// else check if Grid
const grid = n.el?._gridComp;
if (grid) {
//.... save any custom data
}
}
/**
* track when widgeta re updated (rather than created) to make sure we de-serialize them as well
*/
function gsUpdateNgComponents(n) {
const w = n;
const gridItem = n.el?._gridItemComp;
if (gridItem?.childWidget && w.input)
gridItem.childWidget.deserialize(w);
}
/**
* gridstack.component.ts 12.6.0
* Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license
*/
/**
* @deprecated Use GridstackComponent and GridstackItemComponent as standalone components instead.
*
* This NgModule is provided for backward compatibility but is no longer the recommended approach.
* Import components directly in your standalone components or use the new Angular module structure.
*
* @example
* ```typescript
* // Preferred approach - standalone components
* @Component({
* selector: 'my-app',
* imports: [GridstackComponent, GridstackItemComponent],
* template: '<gridstack></gridstack>'
* })
* export class AppComponent {}
*
* // Legacy approach (deprecated)
* @NgModule({
* imports: [GridstackModule]
* })
* export class AppModule {}
* ```
*/
class GridstackModule {
}
GridstackModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
GridstackModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, imports: [GridstackItemComponent,
GridstackComponent], exports: [GridstackItemComponent,
GridstackComponent] });
GridstackModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, imports: [GridstackItemComponent,
GridstackComponent] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: GridstackModule, decorators: [{
type: NgModule,
args: [{
imports: [
GridstackItemComponent,
GridstackComponent,
],
exports: [
GridstackItemComponent,
GridstackComponent,
],
}]
}] });
/*
* Public API Surface of gridstack-angular
*/
/**
* Generated bundle index. Do not edit.
*/
export { BaseWidget, GridstackComponent, GridstackItemComponent, GridstackModule, gsCreateNgComponents, gsSaveAdditionalNgInfo, gsUpdateNgComponents };
//# sourceMappingURL=gridstack-angular.mjs.map
@@ -0,0 +1,210 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'no-invalid-void-type',
meta: {
type: 'problem',
docs: {
description: 'Disallow `void` type outside of generic or return types',
recommended: 'strict',
},
messages: {
invalidVoidForGeneric: '{{ generic }} may not have void as a type argument.',
invalidVoidNotReturn: 'void is only valid as a return type.',
invalidVoidNotReturnOrGeneric: 'void is only valid as a return type or generic type argument.',
invalidVoidNotReturnOrThisParam: 'void is only valid as return type or type of `this` parameter.',
invalidVoidNotReturnOrThisParamOrGeneric: 'void is only valid as a return type or generic type argument or the type of a `this` parameter.',
invalidVoidUnionConstituent: 'void is not valid as a constituent in a union type',
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
allowAsThisParameter: {
type: 'boolean',
description: 'Whether a `this` parameter of a function may be `void`.',
},
allowInGenericTypeArguments: {
description: 'Whether `void` can be used as a valid value for generic type parameters.',
oneOf: [
{
type: 'boolean',
description: 'Whether `void` can be used as a valid value for all generic type parameters.',
},
{
type: 'array',
description: 'Allowlist of types that may accept `void` as a generic type parameter.',
items: { type: 'string' },
minItems: 1,
},
],
},
},
},
],
},
defaultOptions: [
{ allowAsThisParameter: false, allowInGenericTypeArguments: true },
],
create(context, [{ allowAsThisParameter, allowInGenericTypeArguments }]) {
const validParents = [
utils_1.AST_NODE_TYPES.TSTypeAnnotation, //
];
const invalidGrandParents = [
utils_1.AST_NODE_TYPES.TSPropertySignature,
utils_1.AST_NODE_TYPES.CallExpression,
utils_1.AST_NODE_TYPES.PropertyDefinition,
utils_1.AST_NODE_TYPES.AccessorProperty,
utils_1.AST_NODE_TYPES.Identifier,
];
const validUnionMembers = [
utils_1.AST_NODE_TYPES.TSVoidKeyword,
utils_1.AST_NODE_TYPES.TSNeverKeyword,
];
if (allowInGenericTypeArguments === true) {
validParents.push(utils_1.AST_NODE_TYPES.TSTypeParameterInstantiation);
}
/**
* @brief check if the given void keyword is used as a valid generic type
*
* reports if the type parametrized by void is not in the allowlist, or
* allowInGenericTypeArguments is false.
* no-op if the given void keyword is not used as generic type
*/
function checkGenericTypeArgument(node) {
// only matches T<..., void, ...>
// extra check for precaution
/* istanbul ignore next */
if (node.parent.type !== utils_1.AST_NODE_TYPES.TSTypeParameterInstantiation ||
node.parent.parent.type !== utils_1.AST_NODE_TYPES.TSTypeReference) {
return;
}
// check allowlist
if (Array.isArray(allowInGenericTypeArguments)) {
const fullyQualifiedName = context.sourceCode
.getText(node.parent.parent.typeName)
.replaceAll(' ', '');
if (!allowInGenericTypeArguments
.map(s => s.replaceAll(' ', ''))
.includes(fullyQualifiedName)) {
context.report({
node,
messageId: 'invalidVoidForGeneric',
data: { generic: fullyQualifiedName },
});
}
return;
}
if (!allowInGenericTypeArguments) {
context.report({
node,
messageId: allowAsThisParameter
? 'invalidVoidNotReturnOrThisParam'
: 'invalidVoidNotReturn',
});
}
}
/**
* @brief checks if the generic type parameter defaults to void
*/
function checkDefaultVoid(node, parentNode) {
if (parentNode.default !== node) {
context.report({
node,
messageId: getNotReturnOrGenericMessageId(node),
});
}
}
/**
* @brief checks that a union containing void is valid
* @return true if every member of the union is specified as a valid type in
* validUnionMembers, or is a valid generic type parametrized by void
*/
function isValidUnionType(node) {
return node.types.every(member => validUnionMembers.includes(member.type) ||
// allows any T<..., void, ...> here, checked by checkGenericTypeArgument
(member.type === utils_1.AST_NODE_TYPES.TSTypeReference &&
member.typeArguments?.type ===
utils_1.AST_NODE_TYPES.TSTypeParameterInstantiation &&
member.typeArguments.params
.map(param => param.type)
.includes(utils_1.AST_NODE_TYPES.TSVoidKeyword)));
}
return {
TSVoidKeyword(node) {
// checks T<..., void, ...> against specification of allowInGenericArguments option
if (node.parent.type === utils_1.AST_NODE_TYPES.TSTypeParameterInstantiation &&
node.parent.parent.type === utils_1.AST_NODE_TYPES.TSTypeReference) {
checkGenericTypeArgument(node);
return;
}
// allow <T = void> if allowInGenericTypeArguments is specified, and report if the generic type parameter extends void
if (allowInGenericTypeArguments &&
node.parent.type === utils_1.AST_NODE_TYPES.TSTypeParameter &&
node.parent.default?.type === utils_1.AST_NODE_TYPES.TSVoidKeyword) {
checkDefaultVoid(node, node.parent);
return;
}
// union w/ void must contain types from validUnionMembers, or a valid generic void type
if (node.parent.type === utils_1.AST_NODE_TYPES.TSUnionType &&
isValidUnionType(node.parent)) {
return;
}
// using `void` as part of the return type of function overloading implementation
if (node.parent.type === utils_1.AST_NODE_TYPES.TSUnionType) {
const declaringFunction = getParentFunctionDeclarationNode(node.parent);
if (declaringFunction &&
(0, util_1.hasOverloadSignatures)(declaringFunction, context)) {
return;
}
}
// this parameter is ok to be void.
if (allowAsThisParameter &&
node.parent.type === utils_1.AST_NODE_TYPES.TSTypeAnnotation &&
node.parent.parent.type === utils_1.AST_NODE_TYPES.Identifier &&
node.parent.parent.name === 'this') {
return;
}
// default cases
if (validParents.includes(node.parent.type) &&
// https://github.com/typescript-eslint/typescript-eslint/issues/6225
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
!invalidGrandParents.includes(node.parent.parent.type)) {
return;
}
context.report({
node,
messageId: allowInGenericTypeArguments && allowAsThisParameter
? 'invalidVoidNotReturnOrThisParamOrGeneric'
: allowInGenericTypeArguments
? getNotReturnOrGenericMessageId(node)
: allowAsThisParameter
? 'invalidVoidNotReturnOrThisParam'
: 'invalidVoidNotReturn',
});
},
};
},
});
function getNotReturnOrGenericMessageId(node) {
return node.parent.type === utils_1.AST_NODE_TYPES.TSUnionType
? 'invalidVoidUnionConstituent'
: 'invalidVoidNotReturnOrGeneric';
}
function getParentFunctionDeclarationNode(node) {
let current = node.parent;
while (current) {
if (current.type === utils_1.AST_NODE_TYPES.FunctionDeclaration) {
return current;
}
if (current.type === utils_1.AST_NODE_TYPES.MethodDefinition &&
current.value.body != null) {
return current;
}
current = current.parent;
}
return null;
}
@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Variable = void 0;
const VariableBase_1 = require("./VariableBase");
/**
* A Variable represents a locally scoped identifier. These include arguments to functions.
*/
class Variable extends VariableBase_1.VariableBase {
/**
* `true` if the variable is valid in a type context, false otherwise
* @public
*/
get isTypeVariable() {
if (this.defs.length === 0) {
// we don't statically know whether this is a type or a value
return true;
}
return this.defs.some(def => def.isTypeDefinition);
}
/**
* `true` if the variable is valid in a value context, false otherwise
* @public
*/
get isValueVariable() {
if (this.defs.length === 0) {
// we don't statically know whether this is a type or a value
return true;
}
return this.defs.some(def => def.isVariableDefinition);
}
}
exports.Variable = Variable;
@@ -0,0 +1,49 @@
import { Response } from 'express';
import { OAuthRegisteredClientsStore } from '../clients.js';
import { OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '../../../shared/auth.js';
import { AuthInfo } from '../types.js';
import { AuthorizationParams, OAuthServerProvider } from '../provider.js';
import { FetchLike } from '../../../shared/transport.js';
export type ProxyEndpoints = {
authorizationUrl: string;
tokenUrl: string;
revocationUrl?: string;
registrationUrl?: string;
};
export type ProxyOptions = {
/**
* Individual endpoint URLs for proxying specific OAuth operations
*/
endpoints: ProxyEndpoints;
/**
* Function to verify access tokens and return auth info
*/
verifyAccessToken: (token: string) => Promise<AuthInfo>;
/**
* Function to fetch client information from the upstream server
*/
getClient: (clientId: string) => Promise<OAuthClientInformationFull | undefined>;
/**
* Custom fetch implementation used for all network requests.
*/
fetch?: FetchLike;
};
/**
* Implements an OAuth server that proxies requests to another OAuth server.
*/
export declare class ProxyOAuthServerProvider implements OAuthServerProvider {
protected readonly _endpoints: ProxyEndpoints;
protected readonly _verifyAccessToken: (token: string) => Promise<AuthInfo>;
protected readonly _getClient: (clientId: string) => Promise<OAuthClientInformationFull | undefined>;
protected readonly _fetch?: FetchLike;
skipLocalPkceValidation: boolean;
revokeToken?: (client: OAuthClientInformationFull, request: OAuthTokenRevocationRequest) => Promise<void>;
constructor(options: ProxyOptions);
get clientsStore(): OAuthRegisteredClientsStore;
authorize(client: OAuthClientInformationFull, params: AuthorizationParams, res: Response): Promise<void>;
challengeForAuthorizationCode(_client: OAuthClientInformationFull, _authorizationCode: string): Promise<string>;
exchangeAuthorizationCode(client: OAuthClientInformationFull, authorizationCode: string, codeVerifier?: string, redirectUri?: string, resource?: URL): Promise<OAuthTokens>;
exchangeRefreshToken(client: OAuthClientInformationFull, refreshToken: string, scopes?: string[], resource?: URL): Promise<OAuthTokens>;
verifyAccessToken(token: string): Promise<AuthInfo>;
}
//# sourceMappingURL=proxyProvider.d.ts.map
@@ -0,0 +1,332 @@
/**
* @fileoverview A class of the code path.
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const CodePathState = require("./code-path-state");
const IdGenerator = require("./id-generator");
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
/**
* A code path.
*/
class CodePath {
/**
* Creates a new instance.
* @param {Object} options Options for the function (see below).
* @param {string} options.id An identifier.
* @param {string} options.origin The type of code path origin.
* @param {CodePath|null} options.upper The code path of the upper function scope.
* @param {Function} options.onLooped A callback function to notify looping.
*/
constructor({ id, origin, upper, onLooped }) {
/**
* The identifier of this code path.
* Rules use it to store additional information of each rule.
* @type {string}
*/
this.id = id;
/**
* The reason that this code path was started. May be "program",
* "function", "class-field-initializer", or "class-static-block".
* @type {string}
*/
this.origin = origin;
/**
* The code path of the upper function scope.
* @type {CodePath|null}
*/
this.upper = upper;
/**
* The code paths of nested function scopes.
* @type {CodePath[]}
*/
this.childCodePaths = [];
// Initializes internal state.
Object.defineProperty(this, "internal", {
value: new CodePathState(new IdGenerator(`${id}_`), onLooped),
});
// Adds this into `childCodePaths` of `upper`.
if (upper) {
upper.childCodePaths.push(this);
}
}
/**
* Gets the state of a given code path.
* @param {CodePath} codePath A code path to get.
* @returns {CodePathState} The state of the code path.
*/
static getState(codePath) {
return codePath.internal;
}
/**
* The initial code path segment. This is the segment that is at the head
* of the code path.
* This is a passthrough to the underlying `CodePathState`.
* @type {CodePathSegment}
*/
get initialSegment() {
return this.internal.initialSegment;
}
/**
* Final code path segments. These are the terminal (tail) segments in the
* code path, which is the combination of `returnedSegments` and `thrownSegments`.
* All segments in this array are reachable.
* This is a passthrough to the underlying `CodePathState`.
* @type {CodePathSegment[]}
*/
get finalSegments() {
return this.internal.finalSegments;
}
/**
* Final code path segments that represent normal completion of the code path.
* For functions, this means both explicit `return` statements and implicit returns,
* such as the last reachable segment in a function that does not have an
* explicit `return` as this implicitly returns `undefined`. For scripts,
* modules, class field initializers, and class static blocks, this means
* all lines of code have been executed.
* These segments are also present in `finalSegments`.
* This is a passthrough to the underlying `CodePathState`.
* @type {CodePathSegment[]}
*/
get returnedSegments() {
return this.internal.returnedForkContext;
}
/**
* Final code path segments that represent `throw` statements.
* This is a passthrough to the underlying `CodePathState`.
* These segments are also present in `finalSegments`.
* @type {CodePathSegment[]}
*/
get thrownSegments() {
return this.internal.thrownForkContext;
}
/**
* Traverses all segments in this code path.
*
* codePath.traverseSegments((segment, controller) => {
* // do something.
* });
*
* This method enumerates segments in order from the head.
*
* The `controller` argument has two methods:
*
* - `skip()` - skips the following segments in this branch
* - `break()` - skips all following segments in the traversal
*
* A note on the parameters: the `options` argument is optional. This means
* the first argument might be an options object or the callback function.
* @param {Object} [optionsOrCallback] Optional first and last segments to traverse.
* @param {CodePathSegment} [optionsOrCallback.first] The first segment to traverse.
* @param {CodePathSegment} [optionsOrCallback.last] The last segment to traverse.
* @param {Function} callback A callback function.
* @returns {void}
*/
traverseSegments(optionsOrCallback, callback) {
// normalize the arguments into a callback and options
let resolvedOptions;
let resolvedCallback;
if (typeof optionsOrCallback === "function") {
resolvedCallback = optionsOrCallback;
resolvedOptions = {};
} else {
resolvedOptions = optionsOrCallback || {};
resolvedCallback = callback;
}
// determine where to start traversing from based on the options
const startSegment =
resolvedOptions.first || this.internal.initialSegment;
const lastSegment = resolvedOptions.last;
// set up initial location information
let record;
let index;
let end;
let segment = null;
// segments that have already been visited during traversal
const visited = new Set();
// tracks the traversal steps
const stack = [[startSegment, 0]];
// segments that have been skipped during traversal
const skipped = new Set();
// indicates if we exited early from the traversal
let broken = false;
/**
* Maintains traversal state.
*/
const controller = {
/**
* Skip the following segments in this branch.
* @returns {void}
*/
skip() {
skipped.add(segment);
},
/**
* Stop traversal completely - do not traverse to any
* other segments.
* @returns {void}
*/
break() {
broken = true;
},
};
/**
* Checks if a given previous segment has been visited.
* @param {CodePathSegment} prevSegment A previous segment to check.
* @returns {boolean} `true` if the segment has been visited.
*/
function isVisited(prevSegment) {
return (
visited.has(prevSegment) ||
segment.isLoopedPrevSegment(prevSegment)
);
}
/**
* Checks if a given previous segment has been skipped.
* @param {CodePathSegment} prevSegment A previous segment to check.
* @returns {boolean} `true` if the segment has been skipped.
*/
function isSkipped(prevSegment) {
return (
skipped.has(prevSegment) ||
segment.isLoopedPrevSegment(prevSegment)
);
}
// the traversal
while (stack.length > 0) {
/*
* This isn't a pure stack. We use the top record all the time
* but don't always pop it off. The record is popped only if
* one of the following is true:
*
* 1) We have already visited the segment.
* 2) We have not visited *all* of the previous segments.
* 3) We have traversed past the available next segments.
*
* Otherwise, we just read the value and sometimes modify the
* record as we traverse.
*/
record = stack.at(-1);
segment = record[0];
index = record[1];
if (index === 0) {
// Skip if this segment has been visited already.
if (visited.has(segment)) {
stack.pop();
continue;
}
// Skip if all previous segments have not been visited.
if (
segment !== startSegment &&
segment.prevSegments.length > 0 &&
!segment.prevSegments.every(isVisited)
) {
stack.pop();
continue;
}
visited.add(segment);
// Skips the segment if all previous segments have been skipped.
const shouldSkip =
skipped.size > 0 &&
segment.prevSegments.length > 0 &&
segment.prevSegments.every(isSkipped);
/*
* If the most recent segment hasn't been skipped, then we call
* the callback, passing in the segment and the controller.
*/
if (!shouldSkip) {
resolvedCallback.call(this, segment, controller);
// exit if we're at the last segment
if (segment === lastSegment) {
controller.skip();
}
/*
* If the previous statement was executed, or if the callback
* called a method on the controller, we might need to exit the
* loop, so check for that and break accordingly.
*/
if (broken) {
break;
}
} else {
// If the most recent segment has been skipped, then mark it as skipped.
skipped.add(segment);
}
}
// Update the stack.
end = segment.nextSegments.length - 1;
if (index < end) {
/*
* If we haven't yet visited all of the next segments, update
* the current top record on the stack to the next index to visit
* and then push a record for the current segment on top.
*
* Setting the current top record's index lets us know how many
* times we've been here and ensures that the segment won't be
* reprocessed (because we only process segments with an index
* of 0).
*/
record[1] += 1;
stack.push([segment.nextSegments[index], 0]);
} else if (index === end) {
/*
* If we are at the last next segment, then reset the top record
* in the stack to next segment and set its index to 0 so it will
* be processed next.
*/
record[0] = segment.nextSegments[index];
record[1] = 0;
} else {
/*
* If index > end, that means we have no more segments that need
* processing. So, we pop that record off of the stack in order to
* continue traversing at the next level up.
*/
stack.pop();
}
}
}
}
module.exports = CodePath;
@@ -0,0 +1,65 @@
{
"name": "@radix-ui/react-use-effect-event",
"version": "0.0.2",
"license": "MIT",
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"files": [
"src",
"dist",
"README.md"
],
"sideEffects": false,
"peerDependencies": {
"@types/react": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
},
"dependencies": {
"@radix-ui/react-use-layout-effect": "1.1.1"
},
"devDependencies": {
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
"@types/use-sync-external-store": "^0.0.6",
"eslint": "^9.18.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"typescript": "^5.7.3",
"@repo/typescript-config": "0.0.0",
"@repo/builder": "0.0.0",
"@repo/eslint-config": "0.0.0"
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"scripts": {
"lint": "eslint --max-warnings 0 src",
"clean": "rm -rf dist",
"typecheck": "tsc --noEmit",
"build": "radix-build"
},
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
}
}
@@ -0,0 +1 @@
{"version":3,"file":"sseKeepAlive.js","sourceRoot":"","sources":["../../../src/server/sseKeepAlive.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAM,CAAC;AAEhD,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEvC,wEAAwE;AACxE,MAAM,UAAU,eAAe,CAAC,UAAkB,EAAE,MAAkB;IAClE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACjD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC3E,KAAgC,CAAC,KAAK,EAAE,EAAE,CAAC;IAC5C,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1 @@
{"version":3,"file":"arrow-down-right-from-square.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,99 @@
import { JSONRPCMessage, MessageExtraInfo, RequestId } from '../types.js';
export type FetchLike = (url: string | URL, init?: RequestInit) => Promise<Response>;
/**
* Normalizes HeadersInit to a plain Record<string, string> for manipulation.
* Handles Headers objects, arrays of tuples, and plain objects.
*/
export declare function normalizeHeaders(headers: HeadersInit | undefined): Record<string, string>;
/**
* Creates a fetch function that includes base RequestInit options.
* This ensures requests inherit settings like credentials, mode, headers, etc. from the base init.
*
* @param baseFetch - The base fetch function to wrap (defaults to global fetch)
* @param baseInit - The base RequestInit to merge with each request
* @returns A wrapped fetch function that merges base options with call-specific options
*/
export declare function createFetchWithInit(baseFetch?: FetchLike, baseInit?: RequestInit): FetchLike;
/** @internal Whether `to` has the scheme, host and port of `from`, or is its https form with both on default ports. */
export declare function isWithinOrigin(from: URL, to: URL): boolean;
/** @internal Follows the redirect in `response` while it stays within the origin of `url`; undefined when `response` is to be used as is. */
export declare function followWithinOrigin(baseFetch: FetchLike, url: string | URL, init: RequestInit | undefined, response: Response, followed?: number): Promise<Response> | undefined;
/** @internal Wraps a fetch for `redirectPolicy: 'follow'`: `fetchWithinOrigin` returns the result as it is, so redirects are left to the fetch. */
export declare function fetchLeavingRedirects(baseFetch?: FetchLike): FetchLike;
/** @internal Wraps a fetch so it follows a redirect only within the request's origin; any other redirect response is returned as is. */
export declare function fetchWithinOrigin(baseFetch?: FetchLike): FetchLike;
/** @internal Describes a redirect that `fetchWithinOrigin` returned unfollowed, naming its target without userinfo, query or fragment. */
export declare function unfollowedRedirect(response: Response, requestUrl: string | URL): string | undefined;
/**
* Options for sending a JSON-RPC message.
*/
export type TransportSendOptions = {
/**
* If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.
*/
relatedRequestId?: RequestId;
/**
* The resumption token used to continue long-running requests that were interrupted.
*
* This allows clients to reconnect and continue from where they left off, if supported by the transport.
*/
resumptionToken?: string;
/**
* A callback that is invoked when the resumption token changes, if supported by the transport.
*
* This allows clients to persist the latest token for potential reconnection.
*/
onresumptiontoken?: (token: string) => void;
};
/**
* Describes the minimal contract for an MCP transport that a client or server can communicate over.
*/
export interface Transport {
/**
* Starts processing messages on the transport, including any connection steps that might need to be taken.
*
* This method should only be called after callbacks are installed, or else messages may be lost.
*
* NOTE: This method should not be called explicitly when using Client, Server, or Protocol classes, as they will implicitly call start().
*/
start(): Promise<void>;
/**
* Sends a JSON-RPC message (request or response).
*
* If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.
*/
send(message: JSONRPCMessage, options?: TransportSendOptions): Promise<void>;
/**
* Closes the connection.
*/
close(): Promise<void>;
/**
* Callback for when the connection is closed for any reason.
*
* This should be invoked when close() is called as well.
*/
onclose?: () => void;
/**
* Callback for when an error occurs.
*
* Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.
*/
onerror?: (error: Error) => void;
/**
* Callback for when a message (request or response) is received over the connection.
*
* Includes the requestInfo and authInfo if the transport is authenticated.
*
* The requestInfo can be used to get the original request information (headers, etc.)
*/
onmessage?: <T extends JSONRPCMessage>(message: T, extra?: MessageExtraInfo) => void;
/**
* The session ID generated for this connection.
*/
sessionId?: string;
/**
* Sets the protocol version used for the connection (called when the initialize response is received).
*/
setProtocolVersion?: (version: string) => void;
}
//# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"align-vertical-space-around.js","sources":["../../../src/icons/align-vertical-space-around.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name AlignVerticalSpaceAround\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTAiIGhlaWdodD0iNiIgeD0iNyIgeT0iOSIgcng9IjIiIC8+CiAgPHBhdGggZD0iTTIyIDIwSDIiIC8+CiAgPHBhdGggZD0iTTIyIDRIMiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/align-vertical-space-around\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 AlignVerticalSpaceAround = createLucideIcon('AlignVerticalSpaceAround', [\n ['rect', { width: '10', height: '6', x: '7', y: '9', rx: '2', key: 'b1zbii' }],\n ['path', { d: 'M22 20H2', key: '1p1f7z' }],\n ['path', { d: 'M22 4H2', key: '1b7qnq' }],\n]);\n\nexport default AlignVerticalSpaceAround;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2B,iBAAiB,0BAA4B,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5E,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,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,CAC7E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,44 @@
{
"name": "serve-static",
"description": "Serve static files",
"version": "2.2.1",
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
"license": "MIT",
"repository": "expressjs/serve-static",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
},
"dependencies": {
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"parseurl": "^1.3.3",
"send": "^1.2.0"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-standard": "14.1.1",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-markdown": "2.2.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "5.2.0",
"eslint-plugin-standard": "4.1.0",
"mocha": "^10.7.0",
"nyc": "^17.0.0",
"supertest": "^6.3.4"
},
"files": [
"LICENSE",
"index.js"
],
"engines": {
"node": ">= 18"
},
"scripts": {
"lint": "eslint .",
"test": "mocha --reporter spec --bail --check-leaks test/",
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test",
"version": "node scripts/version-history.js && git add HISTORY.md"
}
}
@@ -0,0 +1,331 @@
import { EventEmitter } from "https://deno.land/std@0.114.0/node/events.ts";
import mri from "https://cdn.skypack.dev/mri";
import Command, { GlobalCommand, CommandConfig, HelpCallback, CommandExample } from "./Command.ts";
import { OptionConfig } from "./Option.ts";
import { getMriOptions, setDotProp, setByType, getFileName, camelcaseOptionName } from "./utils.ts";
import { processArgs } from "./deno.ts";
interface ParsedArgv {
args: ReadonlyArray<string>;
options: {
[k: string]: any;
};
}
class CAC extends EventEmitter {
/** The program name to display in help and version message */
name: string;
commands: Command[];
globalCommand: GlobalCommand;
matchedCommand?: Command;
matchedCommandName?: string;
/**
* Raw CLI arguments
*/
rawArgs: string[];
/**
* Parsed CLI arguments
*/
args: ParsedArgv['args'];
/**
* Parsed CLI options, camelCased
*/
options: ParsedArgv['options'];
showHelpOnExit?: boolean;
showVersionOnExit?: boolean;
/**
* @param name The program name to display in help and version message
*/
constructor(name = '') {
super();
this.name = name;
this.commands = [];
this.rawArgs = [];
this.args = [];
this.options = {};
this.globalCommand = new GlobalCommand(this);
this.globalCommand.usage('<command> [options]');
}
/**
* Add a global usage text.
*
* This is not used by sub-commands.
*/
usage(text: string) {
this.globalCommand.usage(text);
return this;
}
/**
* Add a sub-command
*/
command(rawName: string, description?: string, config?: CommandConfig) {
const command = new Command(rawName, description || '', config, this);
command.globalCommand = this.globalCommand;
this.commands.push(command);
return command;
}
/**
* Add a global CLI option.
*
* Which is also applied to sub-commands.
*/
option(rawName: string, description: string, config?: OptionConfig) {
this.globalCommand.option(rawName, description, config);
return this;
}
/**
* Show help message when `-h, --help` flags appear.
*
*/
help(callback?: HelpCallback) {
this.globalCommand.option('-h, --help', 'Display this message');
this.globalCommand.helpCallback = callback;
this.showHelpOnExit = true;
return this;
}
/**
* Show version number when `-v, --version` flags appear.
*
*/
version(version: string, customFlags = '-v, --version') {
this.globalCommand.version(version, customFlags);
this.showVersionOnExit = true;
return this;
}
/**
* Add a global example.
*
* This example added here will not be used by sub-commands.
*/
example(example: CommandExample) {
this.globalCommand.example(example);
return this;
}
/**
* Output the corresponding help message
* When a sub-command is matched, output the help message for the command
* Otherwise output the global one.
*
*/
outputHelp() {
if (this.matchedCommand) {
this.matchedCommand.outputHelp();
} else {
this.globalCommand.outputHelp();
}
}
/**
* Output the version number.
*
*/
outputVersion() {
this.globalCommand.outputVersion();
}
private setParsedInfo({
args,
options
}: ParsedArgv, matchedCommand?: Command, matchedCommandName?: string) {
this.args = args;
this.options = options;
if (matchedCommand) {
this.matchedCommand = matchedCommand;
}
if (matchedCommandName) {
this.matchedCommandName = matchedCommandName;
}
return this;
}
unsetMatchedCommand() {
this.matchedCommand = undefined;
this.matchedCommandName = undefined;
}
/**
* Parse argv
*/
parse(argv = processArgs, {
/** Whether to run the action for matched command */
run = true
} = {}): ParsedArgv {
this.rawArgs = argv;
if (!this.name) {
this.name = argv[1] ? getFileName(argv[1]) : 'cli';
}
let shouldParse = true; // Search sub-commands
for (const command of this.commands) {
const parsed = this.mri(argv.slice(2), command);
const commandName = parsed.args[0];
if (command.isMatched(commandName)) {
shouldParse = false;
const parsedInfo = { ...parsed,
args: parsed.args.slice(1)
};
this.setParsedInfo(parsedInfo, command, commandName);
this.emit(`command:${commandName}`, command);
}
}
if (shouldParse) {
// Search the default command
for (const command of this.commands) {
if (command.name === '') {
shouldParse = false;
const parsed = this.mri(argv.slice(2), command);
this.setParsedInfo(parsed, command);
this.emit(`command:!`, command);
}
}
}
if (shouldParse) {
const parsed = this.mri(argv.slice(2));
this.setParsedInfo(parsed);
}
if (this.options.help && this.showHelpOnExit) {
this.outputHelp();
run = false;
this.unsetMatchedCommand();
}
if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
this.outputVersion();
run = false;
this.unsetMatchedCommand();
}
const parsedArgv = {
args: this.args,
options: this.options
};
if (run) {
this.runMatchedCommand();
}
if (!this.matchedCommand && this.args[0]) {
this.emit('command:*');
}
return parsedArgv;
}
private mri(argv: string[],
/** Matched command */
command?: Command): ParsedArgv {
// All added options
const cliOptions = [...this.globalCommand.options, ...(command ? command.options : [])];
const mriOptions = getMriOptions(cliOptions); // Extract everything after `--` since mri doesn't support it
let argsAfterDoubleDashes: string[] = [];
const doubleDashesIndex = argv.indexOf('--');
if (doubleDashesIndex > -1) {
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
argv = argv.slice(0, doubleDashesIndex);
}
let parsed = mri(argv, mriOptions);
parsed = Object.keys(parsed).reduce((res, name) => {
return { ...res,
[camelcaseOptionName(name)]: parsed[name]
};
}, {
_: []
});
const args = parsed._;
const options: {
[k: string]: any;
} = {
'--': argsAfterDoubleDashes
}; // Set option default value
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
let transforms = Object.create(null);
for (const cliOption of cliOptions) {
if (!ignoreDefault && cliOption.config.default !== undefined) {
for (const name of cliOption.names) {
options[name] = cliOption.config.default;
}
} // If options type is defined
if (Array.isArray(cliOption.config.type)) {
if (transforms[cliOption.name] === undefined) {
transforms[cliOption.name] = Object.create(null);
transforms[cliOption.name]['shouldTransform'] = true;
transforms[cliOption.name]['transformFunction'] = cliOption.config.type[0];
}
}
} // Set option values (support dot-nested property name)
for (const key of Object.keys(parsed)) {
if (key !== '_') {
const keys = key.split('.');
setDotProp(options, keys, parsed[key]);
setByType(options, transforms);
}
}
return {
args,
options
};
}
runMatchedCommand() {
const {
args,
options,
matchedCommand: command
} = this;
if (!command || !command.commandAction) return;
command.checkUnknownOptions();
command.checkOptionValue();
command.checkRequiredArgs();
const actionArgs: any[] = [];
command.args.forEach((arg, index) => {
if (arg.variadic) {
actionArgs.push(args.slice(index));
} else {
actionArgs.push(args[index]);
}
});
actionArgs.push(options);
return command.commandAction.apply(this, actionArgs);
}
}
export default CAC;
@@ -0,0 +1,27 @@
import { NavigateOptions, ToOptions } from './link.cjs';
import { ParsedLocation } from './location.cjs';
import { RoutePaths } from './routeInfo.cjs';
import { RegisteredRouter, ViewTransitionOptions } from './router.cjs';
export interface MatchLocation {
to?: string | number | null;
fuzzy?: boolean;
caseSensitive?: boolean;
from?: string;
}
export interface CommitLocationOptions {
replace?: boolean;
resetScroll?: boolean;
hashScrollIntoView?: boolean | ScrollIntoViewOptions;
viewTransition?: boolean | ViewTransitionOptions;
/**
* @deprecated All navigations use transitions under the hood now
**/
startTransition?: boolean;
ignoreBlocker?: boolean;
}
export type NavigateFn = <TRouter extends RegisteredRouter, TTo extends string | undefined, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(opts: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void>;
export type BuildLocationFn = <TRouter extends RegisteredRouter, TTo extends string | undefined, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(opts: ToOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
leaveParams?: boolean;
_includeValidateSearch?: boolean;
_isNavigate?: boolean;
}) => ParsedLocation;
@@ -0,0 +1,825 @@
export default `flf2a$ 8 7 20 -1 7
TUBULAR by Ron Fritz 8/94
Figlet Release 2.0
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
O~~@
O~~@
O~~@
O~ @
O~ @
@
O~~@
@@
O~ O~@
O~ O~@
@
@
@
@
@
@@
@
O~~ O~~ @
O~~~~~~ O~~~~@
O~~ O~~ @
O~~ O~~ @
O~~~~~~ O~~~~@
O~~ O~~ @
@@
O~~ @
O~ O~~ @
O~~ @
O~~ @
O~~@
O~~ O~~ @
O~~ @
@@
@
O~~ O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~ O~~ @
@@
O~ @
O~~ O~~@
O~~ @
O~~~ @
O~~ @
O~~ O~~@
O~ @
@@
O~~@
O~@
@
@
@
@
@
@@
O~~@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~@
@@
O~~ @
O~~ @
O~~@
O~~@
O~~@
O~~ @
O~~ @
@@
O~~ @
O~~ O~~ O~~@
O~ O~ O~~ @
O~~~~ O~~~~~~~@
O~ O~ O~~ @
O~~ O~~ O~~@
O~~ @
@@
@
O~~ @
O~~ @
O~~~ O~~~~~@
O~~ @
O~~ @
@
@@
@
@
@
@
@
@
O~~@
O~@@
@
@
@
O~~~~~@
@
@
@
@@
@
@
@
@
@
@
O~~@
@@
O~~@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
@@
@
O~~ @
O~~ O~~ @
O~~ O~~ @
O~~ O~~@
O~~ O~~ @
O~~~ @
@@
@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~~~@
@@
@
O~ O~~ @
O~ O~~@
O~~ @
O~~ @
O~~ @
O~~~~~~~~ @
@@
@
O~~ O~~ @
O~~ @
O~~ @
O~~ @
O~~@
O~~~~~ @
@@
@
O~~ @
O O~~ @
O~ O~~ @
O~~ O~~ @
O~~~~ O~ O~~@
O~~ @
@@
@
O~~ O~~~ @
O~~ @
O~~~ @
O~~ @
O~~@
O~~~ O~~ @
@@
@
O~~ @
O~~ @
O~~ @
O~ O~~ @
O~~ O~~@
O~~ O~~ @
@@
@
O~~~~~ O~~@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
@@
@
O~ @
O~~ O~~ @
O~~ O~ @
O~~ O~ @
O~~ O~~@
O~~~~ @
@@
@
O~ O~~ @
O~~ O~~@
O~ O~~ @
O~ O~~ @
O~~ @
O~~ @
@@
@
@
@
@
O~~@
@
O~~@
@@
@
@
@
@
O~~@
@
O~~@
O~@@
O~~@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~@
@@
@
@
O~~~~~~@
@
O~~~~~~@
@
@
@@
O~~ @
O~~ @
O~~ @
O~~@
O~~ @
O~~ @
O~~ @
@@
O~~~ @
O~~ @
O~~@
O~~ @
O~~ @
@
O~~ @
@@
@
O~~~ @
O~ O~~ @
O~ O~~ O~~@
O~~ O~~O O~~@
O~~ \`\`\` @
O~~ @
@@
O~ @
O~ ~~ @
O~ O~~ @
O~~ O~~ @
O~~~~~~ O~~ @
O~~ O~~ @
O~~ O~~@
@@
O~~ O~~ @
O~ O~~ @
O~ O~~@
O~~~ O~ @
O~ O~~@
O~ O~@
O~~~~ O~~ @
@@
O~~ @
O~~ O~~@
O~~ @
O~~ @
O~~ @
O~~ O~~@
O~~~~ @
@@
O~~~~~ @
O~~ O~~ @
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~ O~~ @
O~~~~~ @
@@
O~~~~~~~~@
O~~ @
O~~ @
O~~~~~~ @
O~~ @
O~~ @
O~~~~~~~~@
@@
O~~~~~~~~@
O~~ @
O~~ @
O~~~~~~ @
O~~ @
O~~ @
O~~ @
@@
O~~~~ @
O~ O~~ @
O~~ @
O~~ @
O~~ O~~~~@
O~~ O~ @
O~~~~~ @
@@
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~~~~~ O~~@
O~~ O~~@
O~~ O~~@
O~~ O~~@
@@
O~~@
O~~@
O~~@
O~~@
O~~@
O~~@
O~~@
@@
O~~@
O~~@
O~~@
O~~@
O~~@
O~ O~~@
O~~~~ @
@@
O~~ O~~ @
O~~ O~~ @
O~~ O~~ @
O~ O~ @
O~~ O~~ @
O~~ O~~ @
O~~ O~~@
@@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~~~~~~~@
@@
O~~ O~~@
O~ O~~ O~~~@
O~~ O~~ O O~~@
O~~ O~~ O~~@
O~~ O~ O~~@
O~~ O~~@
O~~ O~~@
@@
O~~~ O~~@
O~ O~~ O~~@
O~~ O~~ O~~@
O~~ O~~ O~~@
O~~ O~ O~~@
O~~ O~ ~~@
O~~ O~~@
@@
O~~~~ @
O~~ O~~ @
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~ O~~ @
O~~~~ @
@@
O~~~~~~~ @
O~~ O~~@
O~~ O~~@
O~~~~~~~ @
O~~ @
O~~ @
O~~ @
@@
O~~~~ @
O~~ O~~ @
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~ O~ O~~ @
O~~ ~~ @
O~ @@
O~~~~~~~ @
O~~ O~~ @
O~~ O~~ @
O~ O~~ @
O~~ O~~ @
O~~ O~~ @
O~~ O~~@
@@
O~~ ~~ @
O~~ O~~@
O~~ @
O~~ @
O~~ @
O~~ O~~@
O~~ ~~ @
@@
O~~~ O~~~~~~@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
@@
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~~~~ @
@@
O~~ O~~@
O~~ O~~ @
O~~ O~~ @
O~~ O~~ @
O~~ O~~ @
O~~~~ @
O~~ @
@@
O~~ O~~@
O~~ O~~@
O~~ O~ O~~@
O~~ O~~ O~~@
O~~ O~ O~~ O~~@
O~ O~ O~~~~@
O~~ O~~@
@@
O~~ O~~@
O~~ O~~ @
O~~ O~~ @
O~~ @
O~~ O~~ @
O~~ O~~ @
O~~ O~~@
@@
O~~ O~~@
O~~ O~~ @
O~~ O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
@@
O~~~~~~~ O~~@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~~~~~~~~~~@
@@
O~~~~@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~~~@
@@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~@
@@
O~~~~@
O~~@
O~~@
O~~@
O~~@
O~~@
O~~~~@
@@
O~~ @
O~~ O~~ @
O~~ O~~@
@
@
@
@
@@
@
@
@
@
@
@
@
O~~~~~@@
O~~@
O~ @
@
@
@
@
@
@@
@
@
O~~ @
O~~ O~~ @
O~~ O~~ @
O~~ O~~ @
O~~ O~~~@
@@
O~~ @
O~~ @
O~~ @
O~~ O~~ @
O~~ O~~@
O~~ O~~@
O~~ O~~ @
@@
@
@
O~~~@
O~~ @
O~~ @
O~~ @
O~~~@
@@
O~~@
O~~@
O~~@
O~~ O~~@
O~ O~~@
O~ O~~@
O~~ O~~@
@@
@
@
O~~ @
O~ O~~ @
O~~~~~ O~~@
O~ @
O~~~~ @
@@
O~~@
O~ @
O~O~ O~@
O~~ @
O~~ @
O~~ @
O~~ @
@@
@
@
O~~ @
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~ @
O~~ @@
@
O~~ @
O~~ @
O~ O~ @
O~~ O~~@
O~ O~~@
O~~ O~~@
@@
@
O~@
@
O~~@
O~~@
O~~@
O~~@
@@
@
O~~@
@
O~~@
O~~@
O~~@
O~~@
O~~~ @@
O~~ @
O~~ @
O~~ O~~@
O~~ O~~ @
O~O~~ @
O~~ O~~ @
O~~ O~~@
@@
O~~@
O~~@
O~~@
O~~@
O~~@
O~~@
O~~~@
@@
@
@
O~~~ O~~ O~~ @
O~~ O~ O~~@
O~~ O~ O~~@
O~~ O~ O~~@
O~~~ O~ O~~@
@@
@
@
O~~ O~~ @
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~~ O~~@
@@
@
@
O~~ @
O~~ O~~ @
O~~ O~~@
O~~ O~~ @
O~~ @
@@
@
@
O~ O~~ @
O~ O~~ @
O~ O~~@
O~~ O~~ @
O~~ @
O~~ @@
@
@
O~~ @
O~ O~~ @
O~ O~~ @
O~~O~~ @
O~~ @
O~~~@@
@
@
O~ O~~~@
O~~ @
O~~ @
O~~ @
O~~~ @
@@
@
@
O~~~~ @
O~~ @
O~~~ @
O~~@
O~~ O~~@
@@
O~~ @
O~~ @
O~O~ O~@
O~~ @
O~~ @
O~~ @
O~~ @
@@
@
@
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~ O~~@
O~~O~~@
@@
@
@
O~~ O~~@
O~~ O~~ @
O~~ O~~ @
O~O~~ @
O~~ @
@@
@
@
O~~ O~~@
O~~ ~ O~~@
O~~ O~ O~~@
O~ O~ O~O~~@
O~~~ O~~@
@@
@
@
O~~ O~~@
O~ O~~ @
O~ @
O~ O~~ @
O~~ O~~@
@@
@
@
O~~ O~~@
O~~ O~~ @
O~~~ @
O~~ @
O~~ @
O~~ @@
@
@
O~~~~ O~~@
O~~ @
O~~ @
O~~ @
O~~~~~~~~@
@@
O~~@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~@
@@
O~@
O~@
O~@
@
O~@
O~@
O~@
@@
O~~ @
O~~ @
O~~ @
O~~@
O~~ @
O~~ @
O~~ @
@@
O~~ O~ @
O~ O~~@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
`
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,cAAc,CAAC;AAG7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,uBAAuB,CAAC;AAGtC,YAAY,EACR,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,mBAAmB,EACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,31 @@
import type { TSESTree } from '../../ts-estree';
type IsSpecificTokenFunction<SpecificToken extends TSESTree.Token> = (token: TSESTree.Token) => token is SpecificToken;
type IsNotSpecificTokenFunction<SpecificToken extends TSESTree.Token> = (token: TSESTree.Token) => token is Exclude<TSESTree.Token, SpecificToken>;
type PunctuatorTokenWithValue<Value extends string> = {
value: Value;
} & TSESTree.PunctuatorToken;
type IsPunctuatorTokenWithValueFunction<Value extends string> = IsSpecificTokenFunction<PunctuatorTokenWithValue<Value>>;
type IsNotPunctuatorTokenWithValueFunction<Value extends string> = IsNotSpecificTokenFunction<PunctuatorTokenWithValue<Value>>;
export declare const isArrowToken: IsPunctuatorTokenWithValueFunction<"=>">;
export declare const isNotArrowToken: IsNotPunctuatorTokenWithValueFunction<"=>">;
export declare const isClosingBraceToken: IsPunctuatorTokenWithValueFunction<"}">;
export declare const isNotClosingBraceToken: IsNotPunctuatorTokenWithValueFunction<"}">;
export declare const isClosingBracketToken: IsPunctuatorTokenWithValueFunction<"]">;
export declare const isNotClosingBracketToken: IsNotPunctuatorTokenWithValueFunction<"]">;
export declare const isClosingParenToken: IsPunctuatorTokenWithValueFunction<")">;
export declare const isNotClosingParenToken: IsNotPunctuatorTokenWithValueFunction<")">;
export declare const isColonToken: IsPunctuatorTokenWithValueFunction<":">;
export declare const isNotColonToken: IsNotPunctuatorTokenWithValueFunction<":">;
export declare const isCommaToken: IsPunctuatorTokenWithValueFunction<",">;
export declare const isNotCommaToken: IsNotPunctuatorTokenWithValueFunction<",">;
export declare const isCommentToken: IsSpecificTokenFunction<TSESTree.Comment>;
export declare const isNotCommentToken: IsNotSpecificTokenFunction<TSESTree.Comment>;
export declare const isOpeningBraceToken: IsPunctuatorTokenWithValueFunction<"{">;
export declare const isNotOpeningBraceToken: IsNotPunctuatorTokenWithValueFunction<"{">;
export declare const isOpeningBracketToken: IsPunctuatorTokenWithValueFunction<"[">;
export declare const isNotOpeningBracketToken: IsNotPunctuatorTokenWithValueFunction<"[">;
export declare const isOpeningParenToken: IsPunctuatorTokenWithValueFunction<"(">;
export declare const isNotOpeningParenToken: IsNotPunctuatorTokenWithValueFunction<"(">;
export declare const isSemicolonToken: IsPunctuatorTokenWithValueFunction<";">;
export declare const isNotSemicolonToken: IsNotPunctuatorTokenWithValueFunction<";">;
export {};
@@ -0,0 +1,718 @@
flf2a$ 7 4 8 0 3 0 64 0
Font Author: RubixTW
FIGFont created with: http://patorjk.com/figfont-editor
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
▗▄▖ @
▐▌ ▐▌@
▐▛▀▜▌@
▐▌ ▐▌@
@
@
@@
▗▄▄▖ @
▐▌ ▐▌@
▐▛▀▚▖@
▐▙▄▞▘@
@
@
@@
▗▄▄▖@
▐▌ @
▐▌ @
▝▚▄▄▖@
@
@
@@
▗▄▄▄ @
▐▌ █@
▐▌ █@
▐▙▄▄▀@
@
@
@@
▗▄▄▄▖@
▐▌ @
▐▛▀▀▘@
▐▙▄▄▖@
@
@
@@
▗▄▄▄▖@
▐▌ @
▐▛▀▀▘@
▐▌ @
@
@
@@
▗▄▄▖@
▐▌ @
▐▌▝▜▌@
▝▚▄▞▘@
@
@
@@
▗▖ ▗▖@
▐▌ ▐▌@
▐▛▀▜▌@
▐▌ ▐▌@
@
@
@@
▗▄▄▄▖@
█ @
█ @
▗▄█▄▖@
@
@
@@
▗▖@
▐▌@
▐▌@
▗▄▄▞▘@
@
@
@@
▗▖ ▗▖@
▐▌▗▞▘@
▐▛▚▖ @
▐▌ ▐▌@
@
@
@@
▗▖ @
▐▌ @
▐▌ @
▐▙▄▄▖@
@
@
@@
▗▖ ▗▖@
▐▛▚▞▜▌@
▐▌ ▐▌@
▐▌ ▐▌@
@
@
@@
▗▖ ▗▖@
▐▛▚▖▐▌@
▐▌ ▝▜▌@
▐▌ ▐▌@
@
@
@@
▗▄▖ @
▐▌ ▐▌@
▐▌ ▐▌@
▝▚▄▞▘@
@
@
@@
▗▄▄▖ @
▐▌ ▐▌@
▐▛▀▘ @
▐▌ @
@
@
@@
▗▄▄▄▖ @
▐▌ ▐▌ @
▐▌ ▐▌ @
▐▙▄▟▙▖@
@
@
@@
▗▄▄▖ @
▐▌ ▐▌@
▐▛▀▚▖@
▐▌ ▐▌@
@
@
@@
▗▄▄▖@
▐▌ @
▝▀▚▖@
▗▄▄▞▘@
@
@
@@
▗▄▄▄▖@
█ @
█ @
█ @
@
@
@@
▗▖ ▗▖@
▐▌ ▐▌@
▐▌ ▐▌@
▝▚▄▞▘@
@
@
@@
▗▖ ▗▖@
▐▌ ▐▌@
▐▌ ▐▌@
▝▚▞▘ @
@
@
@@
▗▖ ▗▖@
▐▌ ▐▌@
▐▌ ▐▌@
▐▙█▟▌@
@
@
@@
▗▖ ▗▖@
▝▚▞▘ @
▐▌ @
▗▞▘▝▚▖@
@
@
@@
▗▖ ▗▖@
▝▚▞▘ @
▐▌ @
▐▌ @
@
@
@@
▗▄▄▄▄▖@
▗▞▘@
▗▞▘ @
▐▙▄▄▄▖@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
▗▄▖ @
▐▌ ▐▌@
▐▛▀▜▌@
▐▌ ▐▌@
@
@
@@
▗▄▄▖ @
▐▌ ▐▌@
▐▛▀▚▖@
▐▙▄▞▘@
@
@
@@
▗▄▄▖@
▐▌ @
▐▌ @
▝▚▄▄▖@
@
@
@@
▗▄▄▄ @
▐▌ █@
▐▌ █@
▐▙▄▄▀@
@
@
@@
▗▄▄▄▖@
▐▌ @
▐▛▀▀▘@
▐▙▄▄▖@
@
@
@@
▗▄▄▄▖@
▐▌ @
▐▛▀▀▘@
▐▌ @
@
@
@@
▗▄▄▖@
▐▌ @
▐▌▝▜▌@
▝▚▄▞▘@
@
@
@@
▗▖ ▗▖@
▐▌ ▐▌@
▐▛▀▜▌@
▐▌ ▐▌@
@
@
@@
▗▄▄▄▖@
█ @
█ @
▗▄█▄▖@
@
@
@@
▗▖@
▐▌@
▐▌@
▗▄▄▞▘@
@
@
@@
▗▖ ▗▖@
▐▌▗▞▘@
▐▛▚▖ @
▐▌ ▐▌@
@
@
@@
▗▖ @
▐▌ @
▐▌ @
▐▙▄▄▖@
@
@
@@
▗▖ ▗▖@
▐▛▚▞▜▌@
▐▌ ▐▌@
▐▌ ▐▌@
@
@
@@
▗▖ ▗▖@
▐▛▚▖▐▌@
▐▌ ▝▜▌@
▐▌ ▐▌@
@
@
@@
▗▄▖ @
▐▌ ▐▌@
▐▌ ▐▌@
▝▚▄▞▘@
@
@
@@
▗▄▄▖ @
▐▌ ▐▌@
▐▛▀▘ @
▐▌ @
@
@
@@
▗▄▄▄▖ @
▐▌ ▐▌ @
▐▌ ▐▌ @
▐▙▄▟▙▖@
@
@
@@
▗▄▄▖ @
▐▌ ▐▌@
▐▛▀▚▖@
▐▌ ▐▌@
@
@
@@
▗▄▄▖@
▐▌ @
▝▀▚▖@
▗▄▄▞▘@
@
@
@@
▗▄▄▄▖@
█ @
█ @
█ @
@
@
@@
▗▖ ▗▖@
▐▌ ▐▌@
▐▌ ▐▌@
▝▚▄▞▘@
@
@
@@
▗▖ ▗▖@
▐▌ ▐▌@
▐▌ ▐▌@
▝▚▞▘ @
@
@
@@
▗▖ ▗▖@
▐▌ ▐▌@
▐▌ ▐▌@
▐▙█▟▌@
@
@
@@
▗▖ ▗▖@
▝▚▞▘ @
▐▌ @
▗▞▘▝▚▖@
@
@
@@
▗▖ ▗▖@
▝▚▞▘ @
▐▌ @
▐▌ @
@
@
@@
▗▄▄▄▄▖@
▗▞▘@
▗▞▘ @
▐▙▄▄▄▖@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@@ -0,0 +1 @@
{"version":3,"file":"square-gantt-chart.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"arrow-down-to-dot.js","sources":["../../../src/icons/arrow-down-to-dot.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ArrowDownToDot\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMnYxNCIgLz4KICA8cGF0aCBkPSJtMTkgOS03IDctNy03IiAvPgogIDxjaXJjbGUgY3g9IjEyIiBjeT0iMjEiIHI9IjEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/arrow-down-to-dot\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 ArrowDownToDot = createLucideIcon('ArrowDownToDot', [\n ['path', { d: 'M12 2v14', key: 'jyx4ut' }],\n ['path', { d: 'm19 9-7 7-7-7', key: '1oe3oy' }],\n ['circle', { cx: '12', cy: '21', r: '1', key: 'o0uj5v' }],\n]);\n\nexport default ArrowDownToDot;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,iBAAiB,gBAAkB,CAAA,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,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,CAC9C,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA;AAC1D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,69 @@
"use client";
import { jsx } from 'react/jsx-runtime';
import { useState, useRef, useEffect } from 'react';
import { LazyContext } from '../../context/LazyContext.mjs';
import { loadFeatures } from '../../motion/features/load-features.mjs';
/**
* Used in conjunction with the `m` component to reduce bundle size.
*
* `m` is a version of the `motion` component that only loads functionality
* critical for the initial render.
*
* `LazyMotion` can then be used to either synchronously or asynchronously
* load animation and gesture support.
*
* ```jsx
* // Synchronous loading
* import { LazyMotion, m, domAnimation } from "framer-motion"
*
* function App() {
* return (
* <LazyMotion features={domAnimation}>
* <m.div animate={{ scale: 2 }} />
* </LazyMotion>
* )
* }
*
* // Asynchronous loading
* import { LazyMotion, m } from "framer-motion"
*
* function App() {
* return (
* <LazyMotion features={() => import('./path/to/domAnimation')}>
* <m.div animate={{ scale: 2 }} />
* </LazyMotion>
* )
* }
* ```
*
* @public
*/
function LazyMotion({ children, features, strict = false }) {
const [, setIsLoaded] = useState(!isLazyBundle(features));
const loadedRenderer = useRef(undefined);
/**
* If this is a synchronous load, load features immediately
*/
if (!isLazyBundle(features)) {
const { renderer, ...loadedFeatures } = features;
loadedRenderer.current = renderer;
loadFeatures(loadedFeatures);
}
useEffect(() => {
if (isLazyBundle(features)) {
features().then(({ renderer, ...loadedFeatures }) => {
loadFeatures(loadedFeatures);
loadedRenderer.current = renderer;
setIsLoaded(true);
});
}
}, []);
return (jsx(LazyContext.Provider, { value: { renderer: loadedRenderer.current, strict }, children: children }));
}
function isLazyBundle(features) {
return typeof features === "function";
}
export { LazyMotion };
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,616 @@
export default `flf2a$ 6 4 20 0 2
invita.flf 06/94 pk6811s@acad.drake.edu
alas, the computer has better handwriting than I do
@
$$@
$$ @
$$ @
$$ @
$$ @@
/$$@
$/$ @
/ @
$o$ @
@
@@
@
//$@
@
$ @
@
@@
@
-/--/-$@
-/--/-$ @
@
@
@@
__/_ @
( / )$@
\\ $ @
(__/_)$ @
/ @
@@
@
()/$$@
/ @
$/()$ @
@
@@
__ $@
( )$@
,\\ $ @
(__\\_ @
($@
@@
@
/ $@
@
$ @
@
@@
$ .-$@
$ / $ @
$ / $ @
$ / $ @
$ (__ $ @
@@
$-. $@
$ / $ @
$ / $ @
$ / $ @
$_./ $ @
@@
@
@
$_\\/_$@
$ /\\ $@
@
@@
@
$ @
$_|_$@
$ | $@
@
@@
$@
$@
$@
$ $@
$/ @
@@
@
$ $@
__ $@
$ $ @
$ $ @
@@
$@
@
@
$o $@
@
@@
$@
$ /$@
/ @
$/ $ @
$ @
@@
__ $@
/ )$@
/ / $@
(__ / $ @
@
@@
_ $@
/ / $@
/ $@
/ $ @
/ @
@@
_ $@
' )$@
,--' $@
/___ $ @
$@
@@
_ $@
' )$@
-( $@
(__ )$ @
@
@@
_ $@
/ /$@
/___/_$@
/ $@
/ @
@@
___$@
/ $@
/__ $@
____)$ @
@
@@
$__$@
/ $@
/__ $@
(__ )$ @
@
@@
___ $@
/ / $@
/ $@
/ $ @
/ @
@@
___ $@
( )$@
.--' $@
(___)$ @
@
@@
__ $@
/ )$@
(__,/ $@
/ $ @
/ @
@@
@
$@
$'$ @
$'$ @
@
@@
@
@
$o$ @
$ $ @
$/$ @
@@
@
/$$@
$<$$$@
\\$$@
@
@@
$@
$__$@
$__$@
$@
@
@@
@
\\ @
$>$$@
/ @
@
@@
___ $@
( )$@
/ $ @
o $ @
@
@@
_ $@
/ )$@
/ () $@
\\____/$@
@
@@
_____ $ @
(, / |$ @
/---|$ @
) / |_ @
(_/ @
@@
______ $ @
(, / )$@
/---( $ @
) / ____) @
(_/ ( @
@@
) ___ $ @
(__/_____)$@
/ $ @
/ @
(______)$ @
@@
______ $ @
(, / )$@
/ / @
_/___ /_ @
(_/___ / @
@@
_____)$@
/ $ @
)__ $ @
/ @
(_____)$ @
@@
________)$@
(, / $ @
/___,$ @
) / $ @
(_/ @
@@
_____)$@
/ $ @
/ ___ $ @
/ / )$ @
(____ / $ @
@@
____ ___)$@
(, / / $ @
/---/$ @
) / (__ @
(_/ @
@@
_____$@
(, / $ @
/$ @
___/__ @
(__ / $ @
@@
_____$@
(, / $ @
/$ @
___/__ @
/ / $ @
(__ / $ @@
__ __)$@
(, ) / $ @
/( $ @
) / \\_ @
(_/ @
@@
_ $ @
$___/__)$ @
(, / $ @
/ $ @
(_____$ @
) @@
__ __)$@
(, /| /|$ @
/ | / |$ @
) / |/ |_ @
(_/ ' $ @
@@
__ __)$@
(, /| / $ @
/ | / $ @
) / |/ $ @
(_/ ' $ @
@@
___ $@
/(, )$@
/ /$ @
/ /$ @
(___ /$ @
@@
_____ $ @
(, / )$@
_/__ /$ @
/ $ @
) / $ @
(_/ @@
____ $ @
(, )$@
/$ @
____ /$ @
(____ ( @
) @@
_____ $ @
(, / )$@
/__ /$ @
) / \\_ @
(_/ @
@@
__ $@
(__/ )$@
/$ @
) /$ @
(_/$ @
@@
______)$@
(, / $ @
/ $ @
$ ) / $ @
$(_/ $ @
@@
__ __)$@
(, / / $ @
/ /$ @
/ /$ @
(___(_ @
@@
__ __)$@
(, ) / $ @
| /$ @
|/$ @
|$ @
@@
__ __)$@
(, ) | / $ @
| /| /$ @
|/ |/$ @
/ |$ @
@@
__ __)$ @
(, |/ $ @
| $ @
) /|_ @
(_/ $ @
@@
__ __)$@
(, ) / $ @
/ /$ @
(___/_ @
) / $ @
(__ / $ @@
___$ @
(, )$@
/$ @
_/_ @
) / @
(__ / @@
$ _ $@
$ / $ @
$ / $ @
$ / $ @
$ /_ $ @
@@
$ @
$\\ $ @
\\ @
$ \\$@
$@
@@
$ _ $@
$ / $ @
$ / $ @
$ / $ @
$ _/ $ @
@@
_ @
$/ \\$@
@
$ $@
@
@@
@
@
@
@
_@
@@
@
$$$\\$$$@
@
$ $ @
@
@@
@
@
_$ @
(_(_@
@
@@
@
/)$@
(/_ @
/_)$ @
@
@@
@
@
_$@
(__@
@
@@
@
/)$@
_(/$ @
(_(_ @
@
@@
@
@
$_$@
_(/_@
@
@@
@
/)$@
//$ @
/(_ @
/) @
(/ @@
@
@
_ $@
(_/_@
.-/ @
(_/ @@
@
/)$@
(/ $@
/ )_@
@
@@
@
,$@
$ @
_(_ @
@
@@
@
$,$@
$ @
$/_ @
.-/ @
(_/ @@
@
/)$@
(/_$@
/(__@
@
@@
@
/)$@
//$ @
(/_ @
@
@@
@
@
___$ @
// (_@
@
@@
@
@
__$ @
/ (_@
@
@@
@
@
___@
(_) @
@
@@
@
@
__ $@
/_)_@
.-/ @
(_/ @@
@
@
_ $@
(_/_@
/( @
(_) @@
@
@
__$@
/ (_@
@
@@
@
@
$_ $@
/_)_@
@
@@
@
@
_/_ @
(__ @
@
@@
@
@
$@
(_(_@
@
@@
@
@
_ _ @
(/__@
@
@@
@
@
_ _@
(_(/$@
@
@@
@
@
__/$$@
$/(__@
/ @
@@
@
@
$ $@
(_/_@
.-/ @
(_/ @@
@
@
_ $@
'_)_@
.-/ @
(_/ @@
$ .-$@
$ / $ @
$ - $ @
$ / $ @
$ (__ $ @
@@
$ $@
$ | $@
$ | $@
$ | $@
@
@@
$-. $@
$ / $ @
$ - $ @
$ / $ @
$_./ $ @
@@
_ _$@
$' \`-' @
@
$ $ @
@
@@
___'_'$ @
(, / |$ @
/---|$ @
) / |_ @
(_/ @
@@
'__'$@
/(, )$@
/ /$ @
/ /$ @
(___ /$ @
@@
__ ' '__)$@
(, / / $ @
/ /$ @
/ /$ @
(___(_ @
@@
@
. .@
_ @
(_(_@
@
@@
@
. .@
___@
(_) @
@
@@
@
. .@
$@
(_(_@
@
@@
______ $ @
(, // )$@
//--( $ @
) //____) @
(_// @
@@
`
@@ -0,0 +1,98 @@
"use client";
import * as React$1 from "react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/CatchBoundary.tsx
function CatchBoundary(props) {
const errorComponent = props.errorComponent ?? ErrorComponent;
return /* @__PURE__ */ jsx(CatchBoundaryImpl, {
getResetKey: props.getResetKey,
onCatch: props.onCatch,
children: ({ error, reset }) => {
if (error) return React$1.createElement(errorComponent, {
error,
reset
});
return props.children;
}
});
}
var CatchBoundaryImpl = class extends React$1.Component {
constructor(..._args) {
super(..._args);
this.state = { error: null };
}
static getDerivedStateFromProps(props, state) {
const resetKey = props.getResetKey();
if (state.error && state.resetKey !== resetKey) return {
resetKey,
error: null
};
return { resetKey };
}
static getDerivedStateFromError(error) {
return { error };
}
reset() {
this.setState({ error: null });
}
componentDidCatch(error, errorInfo) {
if (this.props.onCatch) this.props.onCatch(error, errorInfo);
}
render() {
return this.props.children({
error: this.state.error,
reset: () => {
this.reset();
}
});
}
};
function ErrorComponent({ error }) {
const [show, setShow] = React$1.useState(process.env.NODE_ENV !== "production");
return /* @__PURE__ */ jsxs("div", {
style: {
padding: ".5rem",
maxWidth: "100%"
},
children: [
/* @__PURE__ */ jsxs("div", {
style: {
display: "flex",
alignItems: "center",
gap: ".5rem"
},
children: [/* @__PURE__ */ jsx("strong", {
style: { fontSize: "1rem" },
children: "Something went wrong!"
}), /* @__PURE__ */ jsx("button", {
style: {
appearance: "none",
fontSize: ".6em",
border: "1px solid currentColor",
padding: ".1rem .2rem",
fontWeight: "bold",
borderRadius: ".25rem"
},
onClick: () => setShow((d) => !d),
children: show ? "Hide Error" : "Show Error"
})]
}),
/* @__PURE__ */ jsx("div", { style: { height: ".25rem" } }),
show ? /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("pre", {
style: {
fontSize: ".7em",
border: "1px solid red",
borderRadius: ".25rem",
padding: ".3rem",
color: "red",
overflow: "auto"
},
children: error.message ? /* @__PURE__ */ jsx("code", { children: error.message }) : null
}) }) : null
]
});
}
//#endregion
export { CatchBoundary, ErrorComponent };
//# sourceMappingURL=CatchBoundary.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_9C","2":"_aB"},C:{"1":"_1D","2":"_RM"},D:{"1":"_9L","2":"_KO","194":"_cQ"},E:{"1":"_QB","2":"_TB"},F:{"1":"_TO","2":"_EP","194":"xB"},G:{"1":"_BB","2":"_OB"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_hB","2":"_rC"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"ME","2":"LE"}},B:1,C:"DOM manipulation convenience methods",D:true};
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"FD","4":"_A","8":"_RC"},B:{"1":"_ZE","4":"_5B"},C:{"4":"_w","8":"_f"},D:{"1":"_AH","4":"_fO"},E:{"4":"_DB","8":"_e"},F:{"1":"_0B _nC _7I _O","4":"_KR"},G:{"2":"lC","4":"_eB"},H:{"2":"1D"},I:{"1":"I","2":"_W","4":"_y"},J:{"2":"D","4":"A"},K:{"1":"_N"},L:{"1":"I"},M:{"4":"YC"},N:{"4":"_A"},O:{"1":"bC"},P:{"1":"_yB","4":"_pC"},Q:{"1":"JE"},R:{"1":"KE"},S:{"4":"_C"}},B:1,C:"HTML5 form features",D:false};
@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
function createLazyMeasurementsView(count, flat, getItemKey) {
const cache = new Array(count);
return new Proxy(cache, {
get(target, prop, receiver) {
if (typeof prop === "string") {
const c = prop.charCodeAt(0);
if (c >= 48 && c <= 57) {
const i = +prop;
if (Number.isInteger(i) && i >= 0 && i < count) {
let v = target[i];
if (!v) {
const s = flat[i * 2];
v = target[i] = {
index: i,
key: getItemKey(i),
start: s,
size: flat[i * 2 + 1],
end: s + flat[i * 2 + 1],
lane: 0
};
}
return v;
}
}
if (prop === "length") return count;
}
return Reflect.get(target, prop, receiver);
}
});
}
exports.createLazyMeasurementsView = createLazyMeasurementsView;
//# sourceMappingURL=lazy-measurements.cjs.map
@@ -0,0 +1,206 @@
# convert-source-map [![Build Status][ci-image]][ci-url]
Converts a source-map from/to different formats and allows adding/changing properties.
```js
var convert = require('convert-source-map');
var json = convert
.fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
.toJSON();
var modified = convert
.fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
.setProperty('sources', [ 'SRC/FOO.JS' ])
.toJSON();
console.log(json);
console.log(modified);
```
```json
{"version":3,"file":"build/foo.min.js","sources":["src/foo.js"],"names":[],"mappings":"AAAA","sourceRoot":"/"}
{"version":3,"file":"build/foo.min.js","sources":["SRC/FOO.JS"],"names":[],"mappings":"AAAA","sourceRoot":"/"}
```
## Upgrading
Prior to v2.0.0, the `fromMapFileComment` and `fromMapFileSource` functions took a String directory path and used that to resolve & read the source map file from the filesystem. However, this made the library limited to nodejs environments and broke on sources with querystrings.
In v2.0.0, you now need to pass a function that does the file reading. It will receive the source filename as a String that you can resolve to a filesystem path, URL, or anything else.
If you are using `convert-source-map` in nodejs and want the previous behavior, you'll use a function like such:
```diff
+ var fs = require('fs'); // Import the fs module to read a file
+ var path = require('path'); // Import the path module to resolve a path against your directory
- var conv = convert.fromMapFileSource(css, '../my-dir');
+ var conv = convert.fromMapFileSource(css, function (filename) {
+ return fs.readFileSync(path.resolve('../my-dir', filename), 'utf-8');
+ });
```
## API
### fromObject(obj)
Returns source map converter from given object.
### fromJSON(json)
Returns source map converter from given json string.
### fromURI(uri)
Returns source map converter from given uri encoded json string.
### fromBase64(base64)
Returns source map converter from given base64 encoded json string.
### fromComment(comment)
Returns source map converter from given base64 or uri encoded json string prefixed with `//# sourceMappingURL=...`.
### fromMapFileComment(comment, readMap)
Returns source map converter from given `filename` by parsing `//# sourceMappingURL=filename`.
`readMap` must be a function which receives the source map filename and returns either a String or Buffer of the source map (if read synchronously), or a `Promise` containing a String or Buffer of the source map (if read asynchronously).
If `readMap` doesn't return a `Promise`, `fromMapFileComment` will return a source map converter synchronously.
If `readMap` returns a `Promise`, `fromMapFileComment` will also return `Promise`. The `Promise` will be either resolved with the source map converter or rejected with an error.
#### Examples
**Synchronous read in Node.js:**
```js
var convert = require('convert-source-map');
var fs = require('fs');
function readMap(filename) {
return fs.readFileSync(filename, 'utf8');
}
var json = convert
.fromMapFileComment('//# sourceMappingURL=map-file-comment.css.map', readMap)
.toJSON();
console.log(json);
```
**Asynchronous read in Node.js:**
```js
var convert = require('convert-source-map');
var { promises: fs } = require('fs'); // Notice the `promises` import
function readMap(filename) {
return fs.readFile(filename, 'utf8');
}
var converter = await convert.fromMapFileComment('//# sourceMappingURL=map-file-comment.css.map', readMap)
var json = converter.toJSON();
console.log(json);
```
**Asynchronous read in the browser:**
```js
var convert = require('convert-source-map');
async function readMap(url) {
const res = await fetch(url);
return res.text();
}
const converter = await convert.fromMapFileComment('//# sourceMappingURL=map-file-comment.css.map', readMap)
var json = converter.toJSON();
console.log(json);
```
### fromSource(source)
Finds last sourcemap comment in file and returns source map converter or returns `null` if no source map comment was found.
### fromMapFileSource(source, readMap)
Finds last sourcemap comment in file and returns source map converter or returns `null` if no source map comment was found.
`readMap` must be a function which receives the source map filename and returns either a String or Buffer of the source map (if read synchronously), or a `Promise` containing a String or Buffer of the source map (if read asynchronously).
If `readMap` doesn't return a `Promise`, `fromMapFileSource` will return a source map converter synchronously.
If `readMap` returns a `Promise`, `fromMapFileSource` will also return `Promise`. The `Promise` will be either resolved with the source map converter or rejected with an error.
### toObject()
Returns a copy of the underlying source map.
### toJSON([space])
Converts source map to json string. If `space` is given (optional), this will be passed to
[JSON.stringify](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify) when the
JSON string is generated.
### toURI()
Converts source map to uri encoded json string.
### toBase64()
Converts source map to base64 encoded json string.
### toComment([options])
Converts source map to an inline comment that can be appended to the source-file.
By default, the comment is formatted like: `//# sourceMappingURL=...`, which you would
normally see in a JS source file.
When `options.encoding == 'uri'`, the data will be uri encoded, otherwise they will be base64 encoded.
When `options.multiline == true`, the comment is formatted like: `/*# sourceMappingURL=... */`, which you would find in a CSS source file.
### addProperty(key, value)
Adds given property to the source map. Throws an error if property already exists.
### setProperty(key, value)
Sets given property to the source map. If property doesn't exist it is added, otherwise its value is updated.
### getProperty(key)
Gets given property of the source map.
### removeComments(src)
Returns `src` with all source map comments removed
### removeMapFileComments(src)
Returns `src` with all source map comments pointing to map files removed.
### commentRegex
Provides __a fresh__ RegExp each time it is accessed. Can be used to find source map comments.
Breaks down a source map comment into groups: Groups: 1: media type, 2: MIME type, 3: charset, 4: encoding, 5: data.
### mapFileCommentRegex
Provides __a fresh__ RegExp each time it is accessed. Can be used to find source map comments pointing to map files.
### generateMapFileComment(file, [options])
Returns a comment that links to an external source map via `file`.
By default, the comment is formatted like: `//# sourceMappingURL=...`, which you would normally see in a JS source file.
When `options.multiline == true`, the comment is formatted like: `/*# sourceMappingURL=... */`, which you would find in a CSS source file.
[ci-url]: https://github.com/thlorenz/convert-source-map/actions?query=workflow:ci
[ci-image]: https://img.shields.io/github/workflow/status/thlorenz/convert-source-map/CI?style=flat-square
@@ -0,0 +1,33 @@
import { isVariantLabel } from './is-variant-label.mjs';
import { variantProps } from './variant-props.mjs';
const numVariantProps = variantProps.length;
/**
* Get variant context from a visual element's parent chain.
* Uses `any` type for visualElement to avoid circular dependencies.
*/
function getVariantContext(visualElement) {
if (!visualElement)
return undefined;
if (!visualElement.isControllingVariants) {
const context = visualElement.parent
? getVariantContext(visualElement.parent) || {}
: {};
if (visualElement.props.initial !== undefined) {
context.initial = visualElement.props.initial;
}
return context;
}
const context = {};
for (let i = 0; i < numVariantProps; i++) {
const name = variantProps[i];
const prop = visualElement.props[name];
if (isVariantLabel(prop) || prop === false) {
context[name] = prop;
}
}
return context;
}
export { getVariantContext };
//# sourceMappingURL=get-variant-context.mjs.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_z","161":"B"},B:{"2":"_K","161":"_I"},C:{"2":"_S"},D:{"2":"_Q"},E:{"2":"_R"},F:{"2":"_c"},G:{"2":"_M"},H:{"2":"1D"},I:{"2":"_P"},J:{"2":"_B"},K:{"2":"_N"},L:{"2":"I"},M:{"2":"YC"},N:{"2":"A","161":"B"},O:{"2":"bC"},P:{"2":"_F"},Q:{"2":"JE"},R:{"2":"KE"},S:{"2":"_C"}},B:7,C:"Input Method Editor API",D:true};
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.escapeRegExp = escapeRegExp;
/**
* Lodash <https://lodash.com/>
* Released under MIT license <https://lodash.com/license>
*/
const reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
const reHasRegExpChar = RegExp(reRegExpChar.source);
function escapeRegExp(string = '') {
return string && reHasRegExpChar.test(string)
? string.replaceAll(reRegExpChar, '\\$&')
: string;
}
@@ -0,0 +1 @@
{"version":3,"file":"mcpServerOutputSchema.js","sourceRoot":"","sources":["../../../../src/examples/server/mcpServerOutputSchema.ts"],"names":[],"mappings":";;AACA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAAgD;AAChD,oDAA6D;AAC7D,0CAA4B;AAE5B,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC;IACzB,IAAI,EAAE,sCAAsC;IAC5C,OAAO,EAAE,OAAO;CACnB,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,CAAC,YAAY,CACf,aAAa,EACb;IACI,WAAW,EAAE,oCAAoC;IACjD,WAAW,EAAE;QACT,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;QACtC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;KAC9D;IACD,YAAY,EAAE;QACV,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;YACnB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;SACzB,CAAC;QACF,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;QACpC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;YACX,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;YACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;SACxB,CAAC;KACL;CACJ,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;IACxB,wDAAwD;IACxD,KAAK,IAAI,CAAC;IACV,KAAK,OAAO,CAAC;IACb,4BAA4B;IAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;IAC9D,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAElG,MAAM,iBAAiB,GAAG;QACtB,WAAW,EAAE;YACT,OAAO,EAAE,MAAM;YACf,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE;SAC5D;QACD,UAAU;QACV,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;QACzC,IAAI,EAAE;YACF,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;YACzC,SAAS,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;SACzF;KACJ,CAAC;IAEF,OAAO;QACH,OAAO,EAAE;YACL;gBACI,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;aACnD;SACJ;QACD,iBAAiB;KACpB,CAAC;AACN,CAAC,CACJ,CAAC;AAEF,KAAK,UAAU,IAAI;IACf,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;AAC9E,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
import { getBunServer } from "./server.js";
import { getConnInfo } from "./conninfo.js";
import { serveStatic } from "./serve-static.js";
import { bunFileSystemModule, toSSG } from "./ssg.js";
import { createBunWebSocket, upgradeWebSocket, websocket } from "./websocket.js";
export { bunFileSystemModule, createBunWebSocket, getBunServer, getConnInfo, serveStatic, toSSG, upgradeWebSocket, websocket };
@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _wrapNativeSuper;
var _getPrototypeOf = require("./getPrototypeOf.js");
var _setPrototypeOf = require("./setPrototypeOf.js");
var _isNativeFunction = require("./isNativeFunction.js");
var _construct = require("./construct.js");
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
exports.default = _wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !(0, _isNativeFunction.default)(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (_cache !== undefined) {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return (0, _construct.default)(Class, arguments, (0, _getPrototypeOf.default)(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return (0, _setPrototypeOf.default)(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
//# sourceMappingURL=wrapNativeSuper.js.map
@@ -0,0 +1,12 @@
import type { TSESTreeOptions } from '../parser-options';
import type { ParseSettings } from './index';
/**
* Checks for a matching TSConfig to a file including its parent directories,
* permanently caching results under each directory it checks.
*
* @remarks
* We don't (yet!) have a way to attach file watchers on disk, but still need to
* cache file checks for rapid subsequent calls to fs.existsSync. See discussion
* in https://github.com/typescript-eslint/typescript-eslint/issues/101.
*/
export declare function getProjectConfigFiles(parseSettings: Pick<ParseSettings, 'filePath' | 'tsconfigMatchCache' | 'tsconfigRootDir'>, project: TSESTreeOptions['project']): string[] | null;
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = prependToMemberExpression;
var _index = require("../builders/generated/index.js");
var _index2 = require("../index.js");
function prependToMemberExpression(member, prepend) {
if ((0, _index2.isSuper)(member.object)) {
throw new Error("Cannot prepend node to super property access (`super.foo`).");
}
member.object = (0, _index.memberExpression)(prepend, member.object);
return member;
}
//# sourceMappingURL=prependToMemberExpression.js.map
@@ -0,0 +1,23 @@
import { ConsolaInstance, ConsolaOptions } from './core.js';
export { ConfirmPromptOptions, Consola, ConsolaReporter, FormatOptions, InputLogObject, LogLevel, LogLevels, LogObject, LogType, LogTypes, MultiSelectOptions, PromptOptions, SelectPromptOptions, TextPromptOptions } from './core.js';
/**
* Factory function to create a new Consola instance
*
* @param {Partial<ConsolaOptions & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link ConsolaOptions}.
* @returns {ConsolaInstance} A new Consola instance configured with the given options.
*/
declare function createConsola(options?: Partial<ConsolaOptions & {
fancy: boolean;
}>): ConsolaInstance;
/**
* Creates and exports a standard instance of Consola with the default configuration.
* This instance can be used directly for logging throughout the application.
*
* @type {ConsolaInstance} consola - The default instance of Consola.
*/
declare const consola: ConsolaInstance;
// @ts-ignore
export = consola;
export { ConsolaInstance, ConsolaOptions, consola, createConsola };
@@ -0,0 +1,62 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABILITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
declare namespace Intl {
interface NumberFormatOptionsUseGroupingRegistry {
min2: never;
auto: never;
always: never;
}
interface NumberFormatOptionsSignDisplayRegistry {
negative: never;
}
interface NumberFormatRangePartTypeRegistry extends NumberFormatPartTypeRegistry {
approximatelySign: never;
}
type NumberFormatRangePartTypes = keyof NumberFormatRangePartTypeRegistry;
interface NumberFormatOptions {
roundingPriority?: "auto" | "morePrecision" | "lessPrecision" | undefined;
roundingIncrement?: 1 | 2 | 5 | 10 | 20 | 25 | 50 | 100 | 200 | 250 | 500 | 1000 | 2000 | 2500 | 5000 | undefined;
roundingMode?: "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven" | undefined;
trailingZeroDisplay?: "auto" | "stripIfInteger" | undefined;
}
interface ResolvedNumberFormatOptions {
roundingPriority: "auto" | "morePrecision" | "lessPrecision";
roundingMode: "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven";
roundingIncrement: 1 | 2 | 5 | 10 | 20 | 25 | 50 | 100 | 200 | 250 | 500 | 1000 | 2000 | 2500 | 5000;
trailingZeroDisplay: "auto" | "stripIfInteger";
}
interface NumberRangeFormatPart {
type: NumberFormatRangePartTypes;
value: string;
source: "startRange" | "endRange" | "shared";
}
type StringNumericLiteral = `${number}` | "Infinity" | "-Infinity" | "+Infinity";
interface NumberFormat {
format(value: number | bigint | StringNumericLiteral): string;
formatToParts(value: number | bigint | StringNumericLiteral): NumberFormatPart[];
formatRange(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): string;
formatRangeToParts(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): NumberRangeFormatPart[];
}
}
@@ -0,0 +1,70 @@
import * as tinybench from 'tinybench';
import { VitestRunner, VitestRunnerImportSource, Suite, File, Task, CancelReason, Test, TestContext, ImportDuration, createTaskCollector, getCurrentSuite, getCurrentTest, getHooks, getFn } from '@vitest/runner';
export { VitestRunner } from '@vitest/runner';
import { S as SerializedConfig } from './chunks/config.d.A1h_Y6Jt.js';
import { T as Traces } from './chunks/traces.d.D2T_R8rx.js';
import { createChainable, matchesTags } from '@vitest/runner/utils';
import { g as getBenchFn, a as getBenchOptions } from './chunks/suite.d.udJtyAgw.js';
import '@vitest/pretty-format';
import '@vitest/snapshot';
import '@vitest/utils/diff';
import './chunks/benchmark.d.DAaHLpsq.js';
declare class NodeBenchmarkRunner implements VitestRunner {
config: SerializedConfig;
private moduleRunner;
constructor(config: SerializedConfig);
importTinybench(): Promise<typeof tinybench>;
importFile(filepath: string, source: VitestRunnerImportSource): unknown;
runSuite(suite: Suite): Promise<void>;
runTask(): Promise<void>;
}
declare class TestRunner implements VitestRunner {
config: SerializedConfig;
private snapshotClient;
private workerState;
private moduleRunner;
private cancelRun;
private assertionsErrors;
pool: string;
private _otel;
viteEnvironment: string;
private viteModuleRunner;
constructor(config: SerializedConfig);
importFile(filepath: string, source: VitestRunnerImportSource): unknown;
onCollectStart(file: File): void;
onCleanupWorkerContext(listener: () => unknown): void;
onAfterRunFiles(): void;
onAfterRunSuite(suite: Suite): Promise<void>;
onAfterRunTask(test: Task): void;
cancel(_reason: CancelReason): void;
injectValue(key: string): any;
onBeforeRunTask(test: Task): Promise<void>;
onBeforeRunSuite(suite: Suite): Promise<void>;
onBeforeTryTask(test: Task): void;
onAfterTryTask(test: Test): void;
extendTaskContext(context: TestContext): TestContext;
getImportDurations(): Record<string, ImportDuration>;
trace: <T>(name: string, attributes: Record<string, any> | (() => T), cb?: () => T) => T;
__setTraces(traces: Traces): void;
static createTaskCollector: typeof createTaskCollector;
static getCurrentSuite: typeof getCurrentSuite;
static getCurrentTest: typeof getCurrentTest;
static createChainable: typeof createChainable;
static getSuiteHooks: typeof getHooks;
static getTestFn: typeof getFn;
static setSuiteHooks: typeof getHooks;
static setTestFn: typeof getFn;
static matchesTags: typeof matchesTags;
/**
* @deprecated
*/
static getBenchFn: typeof getBenchFn;
/**
* @deprecated
*/
static getBenchOptions: typeof getBenchOptions;
}
export { NodeBenchmarkRunner, TestRunner as VitestTestRunner };
@@ -0,0 +1,5 @@
'use strict'
const compare = require('./compare')
const neq = (a, b, loose) => compare(a, b, loose) !== 0
module.exports = neq
@@ -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 Usb = createLucideIcon("Usb", [
["circle", { cx: "10", cy: "7", r: "1", key: "dypaad" }],
["circle", { cx: "4", cy: "20", r: "1", key: "22iqad" }],
["path", { d: "M4.7 19.3 19 5", key: "1enqfc" }],
["path", { d: "m21 3-3 1 2 2Z", key: "d3ov82" }],
["path", { d: "M9.26 7.68 5 12l2 5", key: "1esawj" }],
["path", { d: "m10 14 5 2 3.5-3.5", key: "v8oal5" }],
["path", { d: "m18 12 1-1 1 1-1 1Z", key: "1bh22v" }]
]);
export { Usb as default };
//# sourceMappingURL=usb.js.map
@@ -0,0 +1,465 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'unified-signatures',
meta: {
type: 'suggestion',
docs: {
description: 'Disallow two overloads that could be unified into one with a union or an optional/rest parameter',
// too opinionated to be recommended
recommended: 'strict',
},
messages: {
omittingRestParameter: '{{failureStringStart}} with a rest parameter.',
omittingSingleParameter: '{{failureStringStart}} with an optional parameter.',
singleParameterDifference: '{{failureStringStart}} taking `{{type1}} | {{type2}}`.',
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
ignoreDifferentlyNamedParameters: {
type: 'boolean',
description: 'Whether two parameters with different names at the same index should be considered different even if their types are the same.',
},
ignoreOverloadsWithDifferentJSDoc: {
type: 'boolean',
description: 'Whether two overloads with different JSDoc comments should be considered different even if their parameter and return types are the same.',
},
},
},
],
},
defaultOptions: [
{
ignoreDifferentlyNamedParameters: false,
ignoreOverloadsWithDifferentJSDoc: false,
},
],
create(context, [{ ignoreDifferentlyNamedParameters, ignoreOverloadsWithDifferentJSDoc }]) {
//----------------------------------------------------------------------
// Helpers
//----------------------------------------------------------------------
function failureStringStart(otherLine) {
// For only 2 overloads we don't need to specify which is the other one.
const overloads = otherLine == null
? 'These overloads'
: `This overload and the one on line ${otherLine}`;
return `${overloads} can be combined into one signature`;
}
function addFailures(failures) {
for (const failure of failures) {
const { only2, unify } = failure;
switch (unify.kind) {
case 'single-parameter-difference': {
const { p0, p1 } = unify;
const lineOfOtherOverload = only2 ? undefined : p0.loc.start.line;
const typeAnnotation0 = isTSParameterProperty(p0)
? p0.parameter.typeAnnotation
: p0.typeAnnotation;
const typeAnnotation1 = isTSParameterProperty(p1)
? p1.parameter.typeAnnotation
: p1.typeAnnotation;
context.report({
loc: p1.loc,
node: p1,
messageId: 'singleParameterDifference',
data: {
failureStringStart: failureStringStart(lineOfOtherOverload),
type1: context.sourceCode.getText(typeAnnotation0?.typeAnnotation),
type2: context.sourceCode.getText(typeAnnotation1?.typeAnnotation),
},
});
break;
}
case 'extra-parameter': {
const { extraParameter, otherSignature } = unify;
const lineOfOtherOverload = only2
? undefined
: otherSignature.loc.start.line;
context.report({
loc: extraParameter.loc,
node: extraParameter,
messageId: extraParameter.type === utils_1.AST_NODE_TYPES.RestElement
? 'omittingRestParameter'
: 'omittingSingleParameter',
data: {
failureStringStart: failureStringStart(lineOfOtherOverload),
},
});
}
}
}
}
function checkOverloads(signatures, typeParameters) {
const result = [];
const isTypeParameter = getIsTypeParameter(typeParameters);
for (const overloads of signatures) {
forEachPair(overloads, (a, b) => {
const signature0 = a.value ?? a;
const signature1 = b.value ?? b;
const unify = compareSignatures(signature0, signature1, isTypeParameter);
if (unify != null) {
result.push({ only2: overloads.length === 2, unify });
}
});
}
return result;
}
function compareSignatures(a, b, isTypeParameter) {
if (!signaturesCanBeUnified(a, b, isTypeParameter)) {
return undefined;
}
return a.params.length === b.params.length
? signaturesDifferBySingleParameter(a.params, b.params)
: signaturesDifferByOptionalOrRestParameter(a, b);
}
function signaturesCanBeUnified(a, b, isTypeParameter) {
// Must return the same type.
const aTypeParams = a.typeParameters != null ? a.typeParameters.params : undefined;
const bTypeParams = b.typeParameters != null ? b.typeParameters.params : undefined;
if (ignoreDifferentlyNamedParameters) {
const commonParamsLength = Math.min(a.params.length, b.params.length);
for (let i = 0; i < commonParamsLength; i += 1) {
if (a.params[i].type === b.params[i].type &&
getStaticParameterName(a.params[i]) !==
getStaticParameterName(b.params[i])) {
return false;
}
}
}
if (ignoreOverloadsWithDifferentJSDoc) {
const aComment = getBlockCommentForNode(getCommentTargetNode(a));
const bComment = getBlockCommentForNode(getCommentTargetNode(b));
if (aComment?.value !== bComment?.value) {
return false;
}
}
return (typesAreEqual(a.returnType, b.returnType) &&
// Must take the same type parameters.
// If one uses a type parameter (from outside) and the other doesn't, they shouldn't be joined.
(0, util_1.arraysAreEqual)(aTypeParams, bTypeParams, typeParametersAreEqual) &&
signatureUsesTypeParameter(a, isTypeParameter) ===
signatureUsesTypeParameter(b, isTypeParameter));
}
/** Detect `a(x: number, y: number, z: number)` and `a(x: number, y: string, z: number)`. */
function signaturesDifferBySingleParameter(types1, types2) {
const firstParam1 = types1[0];
const firstParam2 = types2[0];
// exempt signatures with `this: void` from the rule
if (isThisVoidParam(firstParam1) || isThisVoidParam(firstParam2)) {
return undefined;
}
const index = getIndexOfFirstDifference(types1, types2, parametersAreEqual);
if (index == null) {
return undefined;
}
// If remaining arrays are equal, the signatures differ by just one parameter type
if (!(0, util_1.arraysAreEqual)(types1.slice(index + 1), types2.slice(index + 1), parametersAreEqual)) {
return undefined;
}
const a = types1[index];
const b = types2[index];
// Can unify `a?: string` and `b?: number`. Can't unify `...args: string[]` and `...args: number[]`.
// See https://github.com/Microsoft/TypeScript/issues/5077
return parametersHaveEqualSigils(a, b) &&
a.type !== utils_1.AST_NODE_TYPES.RestElement
? { kind: 'single-parameter-difference', p0: a, p1: b }
: undefined;
}
function isThisParam(param) {
return param?.type === utils_1.AST_NODE_TYPES.Identifier && param.name === 'this';
}
function isThisVoidParam(param) {
return (isThisParam(param) &&
param.typeAnnotation?.typeAnnotation.type ===
utils_1.AST_NODE_TYPES.TSVoidKeyword);
}
/**
* Detect `a(): void` and `a(x: number): void`.
* Returns the parameter declaration (`x: number` in this example) that should be optional/rest, and overload it's a part of.
*/
function signaturesDifferByOptionalOrRestParameter(a, b) {
const sig1 = a.params;
const sig2 = b.params;
const minLength = Math.min(sig1.length, sig2.length);
const longer = sig1.length < sig2.length ? sig2 : sig1;
const shorter = sig1.length < sig2.length ? sig1 : sig2;
const shorterSig = sig1.length < sig2.length ? a : b;
const firstParam1 = sig1.at(0);
const firstParam2 = sig2.at(0);
// If one signature has explicit this type and another doesn't, they can't
// be unified.
if (isThisParam(firstParam1) !== isThisParam(firstParam2)) {
return undefined;
}
// exempt signatures with `this: void` from the rule
if (isThisVoidParam(firstParam1) || isThisVoidParam(firstParam2)) {
return undefined;
}
// If one is has 2+ parameters more than the other, they must all be optional/rest.
// Differ by optional parameters: f() and f(x), f() and f(x, ?y, ...z)
// Not allowed: f() and f(x, y)
for (let i = minLength + 1; i < longer.length; i++) {
if (!parameterMayBeMissing(longer[i])) {
return undefined;
}
}
for (let i = 0; i < minLength; i++) {
const sig1i = sig1[i];
const sig2i = sig2[i];
const typeAnnotation1 = isTSParameterProperty(sig1i)
? sig1i.parameter.typeAnnotation
: sig1i.typeAnnotation;
const typeAnnotation2 = isTSParameterProperty(sig2i)
? sig2i.parameter.typeAnnotation
: sig2i.typeAnnotation;
if (!typesAreEqual(typeAnnotation1, typeAnnotation2)) {
return undefined;
}
}
if (minLength > 0 &&
shorter[minLength - 1].type === utils_1.AST_NODE_TYPES.RestElement) {
return undefined;
}
return {
extraParameter: longer[longer.length - 1],
kind: 'extra-parameter',
otherSignature: shorterSig,
};
}
/** Given type parameters, returns a function to test whether a type is one of those parameters. */
function getIsTypeParameter(typeParameters) {
if (typeParameters == null) {
return (() => false);
}
const set = new Set();
for (const t of typeParameters.params) {
set.add(t.name.name);
}
return (typeName => set.has(typeName));
}
/** True if any of the outer type parameters are used in a signature. */
function signatureUsesTypeParameter(sig, isTypeParameter) {
return sig.params.some((p) => typeContainsTypeParameter(isTSParameterProperty(p)
? p.parameter.typeAnnotation
: p.typeAnnotation));
function typeContainsTypeParameter(type) {
if (!type) {
return false;
}
if (type.type === utils_1.AST_NODE_TYPES.TSTypeReference) {
const typeName = type.typeName;
if (isIdentifier(typeName) && isTypeParameter(typeName.name)) {
return true;
}
}
return typeContainsTypeParameter(type.typeAnnotation ??
type.elementType);
}
}
function isTSParameterProperty(node) {
return node.type === utils_1.AST_NODE_TYPES.TSParameterProperty;
}
function parametersAreEqual(a, b) {
const typeAnnotationA = isTSParameterProperty(a)
? a.parameter.typeAnnotation
: a.typeAnnotation;
const typeAnnotationB = isTSParameterProperty(b)
? b.parameter.typeAnnotation
: b.typeAnnotation;
return (parametersHaveEqualSigils(a, b) &&
typesAreEqual(typeAnnotationA, typeAnnotationB));
}
/** True for optional/rest parameters. */
function parameterMayBeMissing(p) {
const optional = isTSParameterProperty(p)
? p.parameter.optional
: p.optional;
return p.type === utils_1.AST_NODE_TYPES.RestElement || optional;
}
/** False if one is optional and the other isn't, or one is a rest parameter and the other isn't. */
function parametersHaveEqualSigils(a, b) {
const optionalA = isTSParameterProperty(a)
? a.parameter.optional
: a.optional;
const optionalB = isTSParameterProperty(b)
? b.parameter.optional
: b.optional;
return ((a.type === utils_1.AST_NODE_TYPES.RestElement) ===
(b.type === utils_1.AST_NODE_TYPES.RestElement) && optionalA === optionalB);
}
function typeParametersAreEqual(a, b) {
return (a.name.name === b.name.name &&
constraintsAreEqual(a.constraint, b.constraint));
}
function typesAreEqual(a, b) {
return (a === b ||
(a != null &&
b != null &&
context.sourceCode.getText(a.typeAnnotation) ===
context.sourceCode.getText(b.typeAnnotation)));
}
function constraintsAreEqual(a, b) {
return a === b || (a != null && a.type === b?.type);
}
/* Returns the first index where `a` and `b` differ. */
function getIndexOfFirstDifference(a, b, equal) {
for (let i = 0; i < a.length && i < b.length; i++) {
if (!equal(a[i], b[i])) {
return i;
}
}
return undefined;
}
/** Calls `action` for every pair of values in `values`. */
function forEachPair(values, action) {
for (let i = 0; i < values.length; i++) {
for (let j = i + 1; j < values.length; j++) {
action(values[i], values[j]);
}
}
}
const scopes = [];
let currentScope = {
overloads: new Map(),
};
function createScope(parent, typeParameters) {
if (currentScope) {
scopes.push(currentScope);
}
currentScope = {
overloads: new Map(),
parent,
typeParameters,
};
}
function checkScope() {
const scope = (0, util_1.nullThrows)(currentScope, 'checkScope() called without a current scope');
const failures = checkOverloads([...scope.overloads.values()], scope.typeParameters);
addFailures(failures);
currentScope = scopes.pop();
}
/**
* @returns the first valid JSDoc comment annotating `node`
*/
function getBlockCommentForNode(node) {
return context.sourceCode
.getCommentsBefore(node)
.reverse()
.find(comment => comment.type === utils_1.AST_TOKEN_TYPES.Block);
}
function addOverload(signature, key, containingNode) {
key ??= getOverloadKey(signature);
if ((containingNode ?? signature).parent === currentScope?.parent) {
const overloads = currentScope.overloads.get(key);
if (overloads != null) {
overloads.push(signature);
}
else {
currentScope.overloads.set(key, [signature]);
}
}
}
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------
return {
ClassDeclaration(node) {
createScope(node.body, node.typeParameters);
},
Program: createScope,
TSInterfaceDeclaration(node) {
createScope(node.body, node.typeParameters);
},
TSModuleBlock: createScope,
TSTypeLiteral: createScope,
// collect overloads
MethodDefinition(node) {
if (!node.value.body && !isGetterOrSetter(node)) {
addOverload(node);
}
},
TSAbstractMethodDefinition(node) {
if (!node.value.body && !isGetterOrSetter(node)) {
addOverload(node);
}
},
TSCallSignatureDeclaration: addOverload,
TSConstructSignatureDeclaration: addOverload,
TSDeclareFunction(node) {
const exportingNode = getExportingNode(node);
addOverload(node, node.id?.name ?? exportingNode?.type, exportingNode);
},
TSMethodSignature(node) {
if (!isGetterOrSetter(node)) {
addOverload(node);
}
},
// validate scopes
'ClassDeclaration:exit': checkScope,
'Program:exit': checkScope,
'TSInterfaceDeclaration:exit': checkScope,
'TSModuleBlock:exit': checkScope,
'TSTypeLiteral:exit': checkScope,
};
},
});
function getCommentTargetNode(node) {
if (node.type === utils_1.AST_NODE_TYPES.TSEmptyBodyFunctionExpression) {
return node.parent;
}
return getExportingNode(node) ?? node;
}
function getExportingNode(node) {
return node.parent.type === utils_1.AST_NODE_TYPES.ExportNamedDeclaration ||
node.parent.type === utils_1.AST_NODE_TYPES.ExportDefaultDeclaration
? node.parent
: undefined;
}
function getOverloadKey(node) {
const info = getOverloadInfo(node);
return ((node.computed ? '0' : '1') +
(node.static ? '0' : '1') +
info);
}
function getOverloadInfo(node) {
switch (node.type) {
case utils_1.AST_NODE_TYPES.TSConstructSignatureDeclaration:
return 'constructor';
case utils_1.AST_NODE_TYPES.TSCallSignatureDeclaration:
return '()';
default: {
const { key } = node;
if (isPrivateIdentifier(key)) {
return `private_identifier_${key.name}`;
}
if (isIdentifier(key)) {
return `identifier_${key.name}`;
}
return key.raw;
}
}
}
function getStaticParameterName(param) {
switch (param.type) {
case utils_1.AST_NODE_TYPES.Identifier:
return param.name;
case utils_1.AST_NODE_TYPES.RestElement:
return getStaticParameterName(param.argument);
default:
return undefined;
}
}
function isIdentifier(node) {
return node.type === utils_1.AST_NODE_TYPES.Identifier;
}
function isPrivateIdentifier(node) {
return node.type === utils_1.AST_NODE_TYPES.PrivateIdentifier;
}
function isGetterOrSetter(node) {
return node.kind === 'get' || node.kind === 'set';
}
@@ -0,0 +1,57 @@
var fs = require('fs')
var core
if (process.platform === 'win32' || global.TESTING_WINDOWS) {
core = require('./windows.js')
} else {
core = require('./mode.js')
}
module.exports = isexe
isexe.sync = sync
function isexe (path, options, cb) {
if (typeof options === 'function') {
cb = options
options = {}
}
if (!cb) {
if (typeof Promise !== 'function') {
throw new TypeError('callback not provided')
}
return new Promise(function (resolve, reject) {
isexe(path, options || {}, function (er, is) {
if (er) {
reject(er)
} else {
resolve(is)
}
})
})
}
core(path, options || {}, function (er, is) {
// ignore EACCES because that just means we aren't allowed to run it
if (er) {
if (er.code === 'EACCES' || options && options.ignoreErrors) {
er = null
is = false
}
}
cb(er, is)
})
}
function sync (path, options) {
// my kingdom for a filtered catch
try {
return core.sync(path, options || {})
} catch (er) {
if (options && options.ignoreErrors || er.code === 'EACCES') {
return false
} else {
throw er
}
}
}
@@ -0,0 +1 @@
{"version":3,"file":"speaker.js","sources":["../../../src/icons/speaker.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Speaker\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTYiIGhlaWdodD0iMjAiIHg9IjQiIHk9IjIiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Ik0xMiA2aC4wMSIgLz4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjE0IiByPSI0IiAvPgogIDxwYXRoIGQ9Ik0xMiAxNGguMDEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/speaker\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 Speaker = createLucideIcon('Speaker', [\n ['rect', { width: '16', height: '20', x: '4', y: '2', rx: '2', key: '1nb95v' }],\n ['path', { d: 'M12 6h.01', key: '1vi96p' }],\n ['circle', { cx: '12', cy: '14', r: '4', key: '1jruaj' }],\n ['path', { d: 'M12 14h.01', key: '1etili' }],\n]);\n\nexport default Speaker;\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,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,MAAM,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAC1C,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"transformer.js","names":[],"sources":["../../../../src/ssr/serializer/transformer.ts"],"sourcesContent":["import { createPlugin } from 'seroval'\nimport { GLOBAL_TSR } from '../constants'\nimport type { Plugin, PluginInfo, SerovalNode } from 'seroval'\nimport type {\n RegisteredConfigType,\n RegisteredSsr,\n SSROption,\n} from '../../router'\nimport type { LooseReturnType } from '../../utils'\nimport type { AnyRoute, ResolveAllSSR } from '../../route'\nimport type { RawStream } from './RawStream'\n\ndeclare const TSR_SERIALIZABLE: unique symbol\nexport type TSR_SERIALIZABLE = typeof TSR_SERIALIZABLE\n\nexport type TsrSerializable = { [TSR_SERIALIZABLE]: true }\n\nexport interface DefaultSerializable {\n number: number\n string: string\n boolean: boolean\n null: null\n undefined: undefined\n bigint: bigint\n Date: Date\n Uint8Array: Uint8Array\n RawStream: RawStream\n TsrSerializable: TsrSerializable\n void: void\n}\n\nexport interface SerializableExtensions extends DefaultSerializable {}\n\nexport type Serializable = SerializableExtensions[keyof SerializableExtensions]\n\nexport type UnionizeSerializationAdaptersInput<\n TAdapters extends ReadonlyArray<AnySerializationAdapter>,\n> = TAdapters[number]['~types']['input']\n\n/**\n * Create a strongly-typed serialization adapter for SSR hydration.\n * Use to register custom types with the router serializer.\n */\nexport function createSerializationAdapter<\n TInput = unknown,\n TOutput = unknown,\n const TExtendsAdapters extends\n | ReadonlyArray<AnySerializationAdapter>\n | never = never,\n>(\n opts: CreateSerializationAdapterOptions<TInput, TOutput, TExtendsAdapters>,\n): SerializationAdapter<TInput, TOutput, TExtendsAdapters> {\n return opts as unknown as SerializationAdapter<\n TInput,\n TOutput,\n TExtendsAdapters\n >\n}\n\nexport interface CreateSerializationAdapterOptions<\n TInput,\n TOutput,\n TExtendsAdapters extends ReadonlyArray<AnySerializationAdapter> | never,\n> {\n key: string\n extends?: TExtendsAdapters\n test: (value: unknown) => value is TInput\n toSerializable: (\n value: TInput,\n ) => ValidateSerializable<\n TOutput,\n Serializable | UnionizeSerializationAdaptersInput<TExtendsAdapters>\n >\n fromSerializable: (value: TOutput) => TInput\n}\n\nexport type ValidateSerializable<T, TSerializable> = T extends TSerializable\n ? T\n : T extends (...args: Array<any>) => any\n ? SerializationError<'Function may not be serializable'>\n : T extends RegisteredReadableStream\n ? SerializationError<'JSX is not be serializable'>\n : T extends ReadonlyArray<any>\n ? ValidateSerializableArray<T, TSerializable>\n : T extends Promise<any>\n ? ValidateSerializablePromise<T, TSerializable>\n : T extends ReadableStream<any>\n ? ValidateReadableStream<T, TSerializable>\n : T extends Set<any>\n ? ValidateSerializableSet<T, TSerializable>\n : T extends Map<any, any>\n ? ValidateSerializableMap<T, TSerializable>\n : T extends AsyncGenerator<any, any>\n ? ValidateSerializableAsyncGenerator<T, TSerializable>\n : T extends object\n ? ValidateSerializableMapped<T, TSerializable>\n : SerializationError<'Type may not be serializable'>\n\nexport type ValidateSerializableAsyncGenerator<T, TSerializable> =\n T extends AsyncGenerator<infer T, infer TReturn, infer TNext>\n ? AsyncGenerator<\n ValidateSerializable<T, TSerializable>,\n ValidateSerializable<TReturn, TSerializable>,\n TNext\n >\n : never\n\nexport type ValidateSerializablePromise<T, TSerializable> =\n T extends Promise<infer TAwaited>\n ? Promise<ValidateSerializable<TAwaited, TSerializable>>\n : never\n\nexport type ValidateReadableStream<T, TSerializable> =\n T extends ReadableStream<infer TStreamed>\n ? ReadableStream<ValidateSerializable<TStreamed, TSerializable>>\n : never\n\nexport type ValidateSerializableSet<T, TSerializable> =\n T extends Set<infer TItem>\n ? Set<ValidateSerializable<TItem, TSerializable>>\n : never\n\nexport type ValidateSerializableMap<T, TSerializable> =\n T extends Map<infer TKey, infer TValue>\n ? Map<\n ValidateSerializable<TKey, TSerializable>,\n ValidateSerializable<TValue, TSerializable>\n >\n : never\n\nexport type ValidateSerializableArray<T, TSerializable> = T extends readonly [\n any,\n ...Array<any>,\n]\n ? ValidateSerializableMapped<T, TSerializable>\n : T extends Array<infer U>\n ? Array<ValidateSerializable<U, TSerializable>>\n : T extends ReadonlyArray<infer U>\n ? ReadonlyArray<ValidateSerializable<U, TSerializable>>\n : never\n\nexport type ValidateSerializableMapped<T, TSerializable> = {\n [K in keyof T]: ValidateSerializable<T[K], TSerializable>\n}\n\nconst SERIALIZATION_ERROR = Symbol.for('TSR_Line truncated