docs: 仓库链接指向本镜像仓库
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run

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

No files matched your search

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getThisExpression = getThisExpression;
const utils_1 = require("@typescript-eslint/utils");
function getThisExpression(node) {
while (true) {
if (node.type === utils_1.AST_NODE_TYPES.CallExpression) {
node = node.callee;
}
else if (node.type === utils_1.AST_NODE_TYPES.ThisExpression) {
return node;
}
else if (node.type === utils_1.AST_NODE_TYPES.MemberExpression) {
node = node.object;
}
else if (node.type === utils_1.AST_NODE_TYPES.ChainExpression) {
node = node.expression;
}
else {
break;
}
}
return;
}
@@ -0,0 +1,25 @@
import { StreamingApi } from "../../utils/stream.js";
import { isOldBunVersion } from "./utils.js";
//#region src/helper/streaming/stream.ts
const contextStash = /* @__PURE__ */ new WeakMap();
const stream = (c, cb, onError) => {
const { readable, writable } = new TransformStream();
const stream = new StreamingApi(writable, readable);
if (isOldBunVersion()) c.req.raw.signal.addEventListener("abort", () => {
if (!stream.closed) stream.abort();
});
contextStash.set(stream.responseReadable, c);
(async () => {
try {
await cb(stream);
} catch (e) {
if (e === void 0) {} else if (e instanceof Error && onError) await onError(e, stream);
else console.error(e);
} finally {
stream.close();
}
})();
return c.newResponse(stream.responseReadable);
};
//#endregion
export { stream };
@@ -0,0 +1 @@
{"version":3,"file":"sun-dim.js","sources":["../../../src/icons/sun-dim.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name SunDim\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSI0IiAvPgogIDxwYXRoIGQ9Ik0xMiA0aC4wMSIgLz4KICA8cGF0aCBkPSJNMjAgMTJoLjAxIiAvPgogIDxwYXRoIGQ9Ik0xMiAyMGguMDEiIC8+CiAgPHBhdGggZD0iTTQgMTJoLjAxIiAvPgogIDxwYXRoIGQ9Ik0xNy42NTcgNi4zNDNoLjAxIiAvPgogIDxwYXRoIGQ9Ik0xNy42NTcgMTcuNjU3aC4wMSIgLz4KICA8cGF0aCBkPSJNNi4zNDMgMTcuNjU3aC4wMSIgLz4KICA8cGF0aCBkPSJNNi4zNDMgNi4zNDNoLjAxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/sun-dim\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 SunDim = createLucideIcon('SunDim', [\n ['circle', { cx: '12', cy: '12', r: '4', key: '4exip2' }],\n ['path', { d: 'M12 4h.01', key: '1ujb9j' }],\n ['path', { d: 'M20 12h.01', key: '1ykeid' }],\n ['path', { d: 'M12 20h.01', key: 'zekei9' }],\n ['path', { d: 'M4 12h.01', key: '158zrr' }],\n ['path', { d: 'M17.657 6.343h.01', key: '31pqzk' }],\n ['path', { d: 'M17.657 17.657h.01', key: 'jehnf4' }],\n ['path', { d: 'M6.343 17.657h.01', key: 'gdk6ow' }],\n ['path', { d: 'M6.343 6.343h.01', key: '1uurf0' }],\n]);\n\nexport default SunDim;\n"],"names":[],"mappings":";;;;;;;;;AAa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AC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAChD,IAAI,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;IACL,CAAC;IAEO,SAAS,CAAC,CAAS;QACvB,IACI,CAAC,KAAK,SAAS,CAAC,EAAE;YAClB,CAAC,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,EAC5D,CAAC;YACC,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;gBACjC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACnD,CAAC;YACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC;YACjC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC;QACnC,CAAC;aAAM,IAAI,IAAI,CAAC,cAAc,IAAI,CAAC,KAAK,SAAS,CAAC,GAAG,EAAE,CAAC;YACpD,IAAI,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC;IACL,CAAC;IAIO,yBAAyB,CAAC,CAAS;QACvC,MAAM,KAAK,GAAGLine truncated
@@ -0,0 +1,420 @@
/**
* @fileoverview Rule to flag unnecessary double negation in Boolean contexts
* @author Brandon Mills
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
const eslintUtils = require("@eslint-community/eslint-utils");
const precedence = astUtils.getPrecedence;
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: [{}],
docs: {
description: "Disallow unnecessary boolean casts",
recommended: true,
frozen: true,
url: "https://eslint.org/docs/latest/rules/no-extra-boolean-cast",
},
schema: [
{
anyOf: [
{
type: "object",
properties: {
enforceForInnerExpressions: {
type: "boolean",
},
},
additionalProperties: false,
},
// deprecated
{
type: "object",
properties: {
enforceForLogicalOperands: {
type: "boolean",
},
},
additionalProperties: false,
},
],
},
],
fixable: "code",
messages: {
unexpectedCall: "Redundant Boolean call.",
unexpectedNegation: "Redundant double negation.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const [{ enforceForLogicalOperands, enforceForInnerExpressions }] =
context.options;
// Node types which have a test which will coerce values to booleans.
const BOOLEAN_NODE_TYPES = new Set([
"IfStatement",
"DoWhileStatement",
"WhileStatement",
"ConditionalExpression",
"ForStatement",
]);
/**
* Check if a node is a Boolean function or constructor.
* @param {ASTNode} node the node
* @returns {boolean} If the node is Boolean function or constructor
*/
function isBooleanFunctionOrConstructorCall(node) {
// Boolean(<bool>) and new Boolean(<bool>)
return (
(node.type === "CallExpression" ||
node.type === "NewExpression") &&
node.callee.type === "Identifier" &&
node.callee.name === "Boolean"
);
}
/**
* Check if a node is in a context where its value would be coerced to a boolean at runtime.
* @param {ASTNode} node The node
* @returns {boolean} If it is in a boolean context
*/
function isInBooleanContext(node) {
return (
(isBooleanFunctionOrConstructorCall(node.parent) &&
node === node.parent.arguments[0]) ||
(BOOLEAN_NODE_TYPES.has(node.parent.type) &&
node === node.parent.test) ||
// !<bool>
(node.parent.type === "UnaryExpression" &&
node.parent.operator === "!")
);
}
/**
* Checks whether the node is a context that should report an error
* Acts recursively if it is in a logical context
* @param {ASTNode} node the node
* @returns {boolean} If the node is in one of the flagged contexts
*/
function isInFlaggedContext(node) {
if (node.parent.type === "ChainExpression") {
return isInFlaggedContext(node.parent);
}
/*
* legacy behavior - enforceForLogicalOperands will only recurse on
* logical expressions, not on other contexts.
* enforceForInnerExpressions will recurse on logical expressions
* as well as the other recursive syntaxes.
*/
if (enforceForLogicalOperands || enforceForInnerExpressions) {
if (node.parent.type === "LogicalExpression") {
if (
node.parent.operator === "||" ||
node.parent.operator === "&&"
) {
return isInFlaggedContext(node.parent);
}
// Check the right hand side of a `??` operator.
if (
enforceForInnerExpressions &&
node.parent.operator === "??" &&
node.parent.right === node
) {
return isInFlaggedContext(node.parent);
}
}
}
if (enforceForInnerExpressions) {
if (
node.parent.type === "ConditionalExpression" &&
(node.parent.consequent === node ||
node.parent.alternate === node)
) {
return isInFlaggedContext(node.parent);
}
/*
* Check last expression only in a sequence, i.e. if ((1, 2, Boolean(3))) {}, since
* the others don't affect the result of the expression.
*/
if (
node.parent.type === "SequenceExpression" &&
node.parent.expressions.at(-1) === node
) {
return isInFlaggedContext(node.parent);
}
}
return isInBooleanContext(node);
}
/**
* Check if a node has comments inside.
* @param {ASTNode} node The node to check.
* @returns {boolean} `true` if it has comments inside.
*/
function hasCommentsInside(node) {
return Boolean(sourceCode.getCommentsInside(node).length);
}
/**
* Checks if the given node is wrapped in grouping parentheses. Parentheses for constructs such as if() don't count.
* @param {ASTNode} node The node to check.
* @returns {boolean} `true` if the node is parenthesized.
* @private
*/
function isParenthesized(node) {
return eslintUtils.isParenthesized(1, node, sourceCode);
}
/**
* Determines whether the given node needs to be parenthesized when replacing the previous node.
* It assumes that `previousNode` is the node to be reported by this rule, so it has a limited list
* of possible parent node types. By the same assumption, the node's role in a particular parent is already known.
* @param {ASTNode} previousNode Previous node.
* @param {ASTNode} node The node to check.
* @throws {Error} (Unreachable.)
* @returns {boolean} `true` if the node needs to be parenthesized.
*/
function needsParens(previousNode, node) {
if (previousNode.parent.type === "ChainExpression") {
return needsParens(previousNode.parent, node);
}
if (isParenthesized(previousNode)) {
// parentheses around the previous node will stay, so there is no need for an additional pair
return false;
}
// parent of the previous node will become parent of the replacement node
const parent = previousNode.parent;
switch (parent.type) {
case "CallExpression":
case "NewExpression":
return node.type === "SequenceExpression";
case "IfStatement":
case "DoWhileStatement":
case "WhileStatement":
case "ForStatement":
case "SequenceExpression":
return false;
case "ConditionalExpression":
if (previousNode === parent.test) {
return precedence(node) <= precedence(parent);
}
if (
previousNode === parent.consequent ||
previousNode === parent.alternate
) {
return (
precedence(node) <
precedence({ type: "AssignmentExpression" })
);
}
/* c8 ignore next */
throw new Error(
"Ternary child must be test, consequent, or alternate.",
);
case "UnaryExpression":
return precedence(node) < precedence(parent);
case "LogicalExpression":
if (
astUtils.isMixedLogicalAndCoalesceExpressions(
node,
parent,
)
) {
return true;
}
if (previousNode === parent.left) {
return precedence(node) < precedence(parent);
}
return precedence(node) <= precedence(parent);
/* c8 ignore next */
default:
throw new Error(`Unexpected parent type: ${parent.type}`);
}
}
return {
UnaryExpression(node) {
const parent = node.parent;
// Exit early if it's guaranteed not to match
if (
node.operator !== "!" ||
parent.type !== "UnaryExpression" ||
parent.operator !== "!"
) {
return;
}
if (isInFlaggedContext(parent)) {
context.report({
node: parent,
messageId: "unexpectedNegation",
fix(fixer) {
if (hasCommentsInside(parent)) {
return null;
}
if (needsParens(parent, node.argument)) {
return fixer.replaceText(
parent,
`(${sourceCode.getText(node.argument)})`,
);
}
let prefix = "";
const tokenBefore =
sourceCode.getTokenBefore(parent);
const firstReplacementToken =
sourceCode.getFirstToken(node.argument);
if (
tokenBefore &&
tokenBefore.range[1] === parent.range[0] &&
!astUtils.canTokensBeAdjacent(
tokenBefore,
firstReplacementToken,
)
) {
prefix = " ";
}
return fixer.replaceText(
parent,
prefix + sourceCode.getText(node.argument),
);
},
});
}
},
CallExpression(node) {
if (
node.callee.type !== "Identifier" ||
node.callee.name !== "Boolean"
) {
return;
}
if (isInFlaggedContext(node)) {
context.report({
node,
messageId: "unexpectedCall",
fix(fixer) {
const parent = node.parent;
if (node.arguments.length === 0) {
if (
parent.type === "UnaryExpression" &&
parent.operator === "!"
) {
/*
* !Boolean() -> true
*/
if (hasCommentsInside(parent)) {
return null;
}
const replacement = "true";
let prefix = "";
const tokenBefore =
sourceCode.getTokenBefore(parent);
if (
tokenBefore &&
tokenBefore.range[1] ===
parent.range[0] &&
!astUtils.canTokensBeAdjacent(
tokenBefore,
replacement,
)
) {
prefix = " ";
}
return fixer.replaceText(
parent,
prefix + replacement,
);
}
/*
* Boolean() -> false
*/
if (hasCommentsInside(node)) {
return null;
}
return fixer.replaceText(node, "false");
}
if (node.arguments.length === 1) {
const argument = node.arguments[0];
if (
argument.type === "SpreadElement" ||
hasCommentsInside(node)
) {
return null;
}
/*
* Boolean(expression) -> expression
*/
if (needsParens(node, argument)) {
return fixer.replaceText(
node,
`(${sourceCode.getText(argument)})`,
);
}
return fixer.replaceText(
node,
sourceCode.getText(argument),
);
}
// two or more arguments
return null;
},
});
}
},
};
},
};
@@ -0,0 +1 @@
{"version":3,"names":["regeneratorDefine","obj","key","value","noFlags","define","Object","defineProperty","_","exports","default","defineIteratorMethod","method","i","arg","_invoke","enumerable","configurable","writable"],"sources":["../../src/helpers/regeneratorDefine.ts"],"sourcesContent":["/* @minVersion 7.27.0 */\n/* @mangleFns */\n/* @internal */\n\n// Also used to define Iterator Methods\n// Defining the .next, .throw, and .return methods of the Iterator interface in terms of a single ._invoke method.\nexport default function regeneratorDefine(\n obj: any,\n key?: PropertyKey,\n value?: unknown,\n noFlags?: true,\n) {\n var define: typeof Object.defineProperty | 0 = Object.defineProperty;\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\", {});\n } catch (_) {\n define = 0;\n }\n\n // @ts-expect-error explicit function reassign\n regeneratorDefine = function (\n obj: any,\n key?: PropertyKey,\n value?: unknown,\n noFlags?: true,\n ) {\n function defineIteratorMethod(method: string, i: number) {\n regeneratorDefine(obj, method, function (this: any, arg: any) {\n return this._invoke(method, i, arg);\n });\n }\n if (!key) {\n defineIteratorMethod(\"next\", 0);\n defineIteratorMethod(\"throw\", 1);\n defineIteratorMethod(\"return\", 2);\n } else {\n if (define) {\n define(obj, key, {\n value: value,\n enumerable: !noFlags,\n configurable: !noFlags,\n writable: !noFlags,\n });\n } else {\n obj[key] = value;\n }\n }\n };\n regeneratorDefine(obj, key, value, noFlags);\n}\n"],"mappings":";;;;;;AAMe,SAASA,iBAAiBA,CACvCC,GAAQ,EACRC,GAAiB,EACjBC,KAAe,EACfC,OAAc,EACd;EACA,IAAIC,MAAwC,GAAGC,MAAM,CAACC,cAAc;EACpE,IAAI;IAEFF,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;EACpB,CAAC,CAAC,OAAOG,CAAC,EAAE;IACVH,MAAM,GAAG,CAAC;EACZ;EAGAI,OAAA,CAAAC,OAAA,GAAAV,iBAAiB,GAAG,SAAAA,CAClBC,GAAQ,EACRC,GAAiB,EACjBC,KAAe,EACfC,OAAc,EACd;IACA,SAASO,oBAAoBA,CAACC,MAAc,EAAEC,CAAS,EAAE;MACvDb,iBAAiB,CAACC,GAAG,EAAEW,MAAM,EAAE,UAAqBE,GAAQ,EAAE;QAC5D,OAAO,IAAI,CAACC,OAAO,CAACH,MAAM,EAAEC,CAAC,EAAEC,GAAG,CAAC;MACrC,CAAC,CAAC;IACJ;IACA,IAAI,CAACZ,GAAG,EAAE;MACRS,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC;MAC/BA,oBAAoB,CAAC,OAAO,EAAE,CAAC,CAAC;MAChCA,oBAAoB,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnC,CAAC,MAAM;MACL,IAAIN,MAAM,EAAE;QACVA,MAAM,CAACJ,GAAG,EAAEC,GAAG,EAAE;UACfC,KAAK,EAAEA,KAAK;UACZa,UAAU,EAAE,CAACZ,OAAO;UACpBa,YAAY,EAAE,CAACb,OAAO;UACtBc,QAAQ,EAAE,CAACd;QACb,CAAC,CAAC;MACJ,CAAC,MAAM;QACLH,GAAG,CAACC,GAAG,CAAC,GAAGC,KAAK;MAClB;IACF;EACF,CAAC;EACDH,iBAAiB,CAACC,GAAG,EAAEC,GAAG,EAAEC,KAAK,EAAEC,OAAO,CAAC;AAC7C","ignoreList":[]}
@@ -0,0 +1 @@
{"version":3,"file":"pointer.js","sources":["../../../src/icons/pointer.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Pointer\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjIgMTRhOCA4IDAgMCAxLTggOCIgLz4KICA8cGF0aCBkPSJNMTggMTF2LTFhMiAyIDAgMCAwLTItMmEyIDIgMCAwIDAtMiAyIiAvPgogIDxwYXRoIGQ9Ik0xNCAxMFY5YTIgMiAwIDAgMC0yLTJhMiAyIDAgMCAwLTIgMnYxIiAvPgogIDxwYXRoIGQ9Ik0xMCA5LjVWNGEyIDIgMCAwIDAtMi0yYTIgMiAwIDAgMC0yIDJ2MTAiIC8+CiAgPHBhdGggZD0iTTE4IDExYTIgMiAwIDEgMSA0IDB2M2E4IDggMCAwIDEtOCA4aC0yYy0yLjggMC00LjUtLjg2LTUuOTktMi4zNGwtMy42LTMuNmEyIDIgMCAwIDEgMi44My0yLjgyTDcgMTUiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/pointer\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 Pointer = createLucideIcon('Pointer', [\n ['path', { d: 'M22 14a8 8 0 0 1-8 8', key: '56vcr3' }],\n ['path', { d: 'M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2', key: '1agjmk' }],\n ['path', { d: 'M14 10V9a2 2 0 0 0-2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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _createSuper;
var _getPrototypeOf = require("getPrototypeOf");
var _isNativeReflectConstruct = require("isNativeReflectConstruct");
var _possibleConstructorReturn = require("possibleConstructorReturn");
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
//# sourceMappingURL=createSuper.js.map
@@ -0,0 +1,572 @@
import { expect, test } from "vitest";
import * as z from "zod/v4";
// ============================================================================
// stringToNumber
// ============================================================================
const stringToNumber = () =>
z.codec(z.string(), z.number(), {
decode: (str) => Number.parseFloat(str),
encode: (num) => num.toString(),
});
test("stringToNumber codec", () => {
const codec = stringToNumber();
// Test decode
expect(z.decode(codec, "42.5")).toBe(42.5);
expect(z.decode(codec, "0")).toBe(0);
expect(z.decode(codec, "-123.456")).toBe(-123.456);
// Test encode
expect(z.encode(codec, 42.5)).toBe("42.5");
expect(z.encode(codec, 0)).toBe("0");
expect(z.encode(codec, -123.456)).toBe("-123.456");
// Test round trip
const original = "3.14159";
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe("3.14159");
});
// ============================================================================
// stringToInt
// ============================================================================
const stringToInt = () =>
z.codec(z.string(), z.int(), {
decode: (str) => Number.parseInt(str, 10),
encode: (num) => num.toString(),
});
test("stringToInt codec", () => {
const codec = stringToInt();
// Test decode
expect(z.decode(codec, "42")).toBe(42);
expect(z.decode(codec, "0")).toBe(0);
expect(z.decode(codec, "-123")).toBe(-123);
// Test encode
expect(z.encode(codec, 42)).toBe("42");
expect(z.encode(codec, 0)).toBe("0");
expect(z.encode(codec, -123)).toBe("-123");
// Test round trip
const original = "999";
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe("999");
});
// ============================================================================
// stringToBigInt
// ============================================================================
const stringToBigInt = () =>
z.codec(z.string(), z.bigint(), {
decode: (str) => BigInt(str),
encode: (bigint) => bigint.toString(),
});
test("stringToBigInt codec", () => {
const codec = stringToBigInt();
// Test decode
expect(z.decode(codec, "123456789012345678901234567890")).toBe(123456789012345678901234567890n);
expect(z.decode(codec, "0")).toBe(0n);
expect(z.decode(codec, "-999")).toBe(-999n);
// Test encode
expect(z.encode(codec, 123456789012345678901234567890n)).toBe("123456789012345678901234567890");
expect(z.encode(codec, 0n)).toBe("0");
expect(z.encode(codec, -999n)).toBe("-999");
// Test round trip
const original = "987654321098765432109876543210";
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe("987654321098765432109876543210");
});
// ============================================================================
// numberToBigInt
// ============================================================================
const numberToBigInt = () =>
z.codec(z.int(), z.bigint(), {
decode: (num) => BigInt(num),
encode: (bigint) => Number(bigint),
});
test("numberToBigInt codec", () => {
const codec = numberToBigInt();
// Test decode
expect(z.decode(codec, 42)).toBe(42n);
expect(z.decode(codec, 0)).toBe(0n);
expect(z.decode(codec, -123)).toBe(-123n);
// Test encode
expect(z.encode(codec, 42n)).toBe(42);
expect(z.encode(codec, 0n)).toBe(0);
expect(z.encode(codec, -123n)).toBe(-123);
// Test round trip
const original = 999;
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe(999);
});
// ============================================================================
// isoDatetimeToDate
// ============================================================================
const isoDatetimeToDate = () =>
z.codec(z.iso.datetime(), z.date(), {
decode: (isoString) => new Date(isoString),
encode: (date) => date.toISOString(),
});
test("isoDatetimeToDate codec", () => {
const codec = isoDatetimeToDate();
// Test decode
const decoded = z.decode(codec, "2024-01-15T10:30:00.000Z");
expect(decoded).toBeInstanceOf(Date);
expect(decoded.getTime()).toBe(1705314600000);
// Test encode
const date = new Date("2024-01-15T10:30:00.000Z");
expect(z.encode(codec, date)).toBe("2024-01-15T10:30:00.000Z");
// Test round trip
const original = "2024-12-25T15:45:30.123Z";
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe("2024-12-25T15:45:30.123Z");
});
// ============================================================================
// epochSecondsToDate
// ============================================================================
const epochSecondsToDate = () =>
z.codec(z.int().min(0), z.date(), {
decode: (seconds) => new Date(seconds * 1000),
encode: (date) => Math.floor(date.getTime() / 1000),
});
test("epochSecondsToDate codec", () => {
const codec = epochSecondsToDate();
// Test decode
const decoded = z.decode(codec, 1705314600);
expect(decoded).toBeInstanceOf(Date);
expect(decoded.getTime()).toBe(1705314600000);
// Test encode
const date = new Date(1705314600000);
expect(z.encode(codec, date)).toBe(1705314600);
// Test round trip
const original = 1640995200; // 2022-01-01 00:00:00 UTC
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe(1640995200);
});
// ============================================================================
// epochMillisToDate
// ============================================================================
const epochMillisToDate = () =>
z.codec(z.int().min(0), z.date(), {
decode: (millis) => new Date(millis),
encode: (date) => date.getTime(),
});
test("epochMillisToDate codec", () => {
const codec = epochMillisToDate();
// Test decode
const decoded = z.decode(codec, 1705314600000);
expect(decoded).toBeInstanceOf(Date);
expect(decoded.getTime()).toBe(1705314600000);
// Test encode
const date = new Date(1705314600000);
expect(z.encode(codec, date)).toBe(1705314600000);
// Test round trip
const original = 1640995200123; // 2022-01-01 00:00:00.123 UTC
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe(1640995200123);
});
// ============================================================================
// json
// ============================================================================
const jsonCodec = <T extends z.core.$ZodType>(schema: T) =>
z.codec(z.string(), schema, {
decode: (jsonString, ctx) => {
try {
return JSON.parse(jsonString);
} catch (err: any) {
ctx.issues.push({
code: "invalid_format",
format: "json",
input: jsonString,
message: err.message,
});
return z.NEVER;
}
},
encode: (value) => JSON.stringify(value),
});
test("json codec", () => {
const codec = jsonCodec(z.object({ name: z.string(), age: z.number() }));
// Test decode
const decoded = z.decode(codec, '{"name":"Alice","age":30}');
expect(decoded).toEqual({ name: "Alice", age: 30 });
// Test encode
const encoded = z.encode(codec, { name: "Bob", age: 25 });
expect(encoded).toBe('{"name":"Bob","age":25}');
// Test round trip
const original = '{"name":"Charlie","age":35}';
const parsed = z.decode(codec, original);
const roundTrip = z.encode(codec, parsed);
expect(JSON.parse(roundTrip)).toEqual(JSON.parse(original));
});
// ============================================================================
// utf8ToBytes
// ============================================================================
const utf8ToBytes = () =>
z.codec(z.string(), z.instanceof(Uint8Array), {
decode: (str) => new TextEncoder().encode(str),
encode: (bytes) => new TextDecoder().decode(bytes),
});
test("utf8ToBytes codec", () => {
const codec = utf8ToBytes();
// Test decode
const decoded = z.decode(codec, "Hello, 世界!");
expect(decoded).toBeInstanceOf(Uint8Array);
expect(Array.from(decoded)).toEqual([72, 101, 108, 108, 111, 44, 32, 228, 184, 150, 231, 149, 140, 33]);
// Test encode
const bytes = new Uint8Array([72, 101, 108, 108, 111]);
expect(z.encode(codec, bytes)).toBe("Hello");
// Test round trip
const original = "Hello, 世界! 🚀";
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe(original);
});
// ============================================================================
// bytesToUtf8
// ============================================================================
const bytesToUtf8 = () =>
z.codec(z.instanceof(Uint8Array), z.string(), {
decode: (bytes) => new TextDecoder().decode(bytes),
encode: (str) => new TextEncoder().encode(str),
});
test("bytesToUtf8 codec", () => {
const codec = bytesToUtf8();
// Test decode
const bytes = new Uint8Array([72, 101, 108, 108, 111]);
const decoded = z.decode(codec, bytes);
expect(decoded).toBe("Hello");
// Test encode
const encoded = z.encode(codec, "Hello, 世界!");
expect(encoded).toBeInstanceOf(Uint8Array);
expect(Array.from(encoded)).toEqual([72, 101, 108, 108, 111, 44, 32, 228, 184, 150, 231, 149, 140, 33]);
// Test round trip
const original = new Uint8Array([72, 101, 108, 108, 111, 44, 32, 228, 184, 150, 231, 149, 140, 33]);
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toEqual(original);
});
// ============================================================================
// base64
// ============================================================================
const base64 = () =>
z.codec(z.base64(), z.instanceof(Uint8Array), {
decode: (base64String) => z.util.base64ToUint8Array(base64String),
encode: (bytes) => z.util.uint8ArrayToBase64(bytes),
});
test("base64 codec", () => {
const codec = base64();
// Test decode
const decoded = z.decode(codec, "SGVsbG8=");
expect(decoded).toBeInstanceOf(Uint8Array);
expect(Array.from(decoded)).toEqual([72, 101, 108, 108, 111]);
// Test encode
const bytes = new Uint8Array([72, 101, 108, 108, 111]);
expect(z.encode(codec, bytes)).toBe("SGVsbG8=");
// Test round trip
const original = "SGVsbG8gV29ybGQh";
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe(original);
});
// ============================================================================
// base64urlToBytes
// ============================================================================
const base64urlToBytes = () =>
z.codec(z.base64url(), z.instanceof(Uint8Array), {
decode: (base64urlString) => z.util.base64urlToUint8Array(base64urlString),
encode: (bytes) => z.util.uint8ArrayToBase64url(bytes),
});
test("base64urlToBytes codec", () => {
const codec = base64urlToBytes();
// Test decode
const decoded = z.decode(codec, "SGVsbG8");
expect(decoded).toBeInstanceOf(Uint8Array);
expect(Array.from(decoded)).toEqual([72, 101, 108, 108, 111]);
// Test encode
const bytes = new Uint8Array([72, 101, 108, 108, 111]);
expect(z.encode(codec, bytes)).toBe("SGVsbG8");
// Test round trip with padding case
const original = "SGVsbG9Xb3JsZA";
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe(original);
});
// ============================================================================
// hexToBytes
// ============================================================================
const hexToBytes = () =>
z.codec(z.hex(), z.instanceof(Uint8Array), {
decode: (hexString) => z.util.hexToUint8Array(hexString),
encode: (bytes) => z.util.uint8ArrayToHex(bytes),
});
test("hexToBytes codec", () => {
const codec = hexToBytes();
// Test decode
const decoded = z.decode(codec, "48656c6c6f");
expect(decoded).toBeInstanceOf(Uint8Array);
expect(Array.from(decoded)).toEqual([72, 101, 108, 108, 111]);
// Note: z.hex() doesn't accept 0x prefix, but our utility function can handle it
// const decodedWithPrefix = z.decode(codec, "0x48656c6c6f");
// expect(Array.from(decodedWithPrefix)).toEqual([72, 101, 108, 108, 111]);
// Test encode
const bytes = new Uint8Array([72, 101, 108, 108, 111]);
expect(z.encode(codec, bytes)).toBe("48656c6c6f");
// Test round trip
const original = "deadbeef";
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe("deadbeef");
});
// ============================================================================
// stringToURL
// ============================================================================
const stringToURL = () =>
z.codec(z.url(), z.instanceof(URL), {
decode: (urlString) => new URL(urlString),
encode: (url) => url.href,
});
test("stringToURL codec", () => {
const codec = stringToURL();
// Test decode
const decoded = z.decode(codec, "https://example.com/path?query=value");
expect(decoded).toBeInstanceOf(URL);
expect(decoded.hostname).toBe("example.com");
expect(decoded.pathname).toBe("/path");
expect(decoded.search).toBe("?query=value");
// Test encode
const url = new URL("https://example.com/path?query=value");
expect(z.encode(codec, url)).toBe("https://example.com/path?query=value");
// Test round trip
const original = "https://test.com/api/v1?foo=bar&baz=qux";
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe(original);
});
// ============================================================================
// stringToHttpURL
// ============================================================================
const stringToHttpURL = () =>
z.codec(z.httpUrl(), z.instanceof(URL), {
decode: (urlString) => new URL(urlString),
encode: (url) => url.href,
});
test("stringToHttpURL codec", () => {
const codec = stringToHttpURL();
// Test decode HTTPS
const decodedHttps = z.decode(codec, "https://example.com/path");
expect(decodedHttps).toBeInstanceOf(URL);
expect(decodedHttps.protocol).toBe("https:");
// Test decode HTTP
const decodedHttp = z.decode(codec, "http://example.com/path");
expect(decodedHttp).toBeInstanceOf(URL);
expect(decodedHttp.protocol).toBe("http:");
// Test encode
const url = new URL("https://example.com/path");
expect(z.encode(codec, url)).toBe("https://example.com/path");
// Test round trip
const original = "http://api.example.com/v1/users";
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe(original);
});
// ============================================================================
// uriComponent
// ============================================================================
const uriComponent = () =>
z.codec(z.string(), z.string(), {
decode: (encodedString) => decodeURIComponent(encodedString),
encode: (decodedString) => encodeURIComponent(decodedString),
});
test("uriComponent codec", () => {
const codec = uriComponent();
// Test decode
const decoded = z.decode(codec, "Hello%20World%21");
expect(decoded).toBe("Hello World!");
// Test encode
const encoded = z.encode(codec, "Hello World!");
expect(encoded).toBe("Hello%20World!");
// Test round trip
const original = "Hello%20World%21%20%26%20More";
const roundTrip = z.encode(codec, z.decode(codec, original));
expect(roundTrip).toBe("Hello%20World!%20%26%20More");
// Test complex characters
const complex = "café & résumé";
const encodedComplex = z.encode(codec, complex);
const decodedComplex = z.decode(codec, encodedComplex);
expect(decodedComplex).toBe(complex);
});
// ============================================================================
// stringToBoolean
// ============================================================================
const stringToBoolean = (options?: { truthy?: string[]; falsy?: string[] }) => z.stringbool(options);
test("stringToBoolean codec", () => {
const codec = stringToBoolean();
// Test decode - default truthy values
expect(z.decode(codec, "true")).toBe(true);
expect(z.decode(codec, "yes")).toBe(true);
expect(z.decode(codec, "1")).toBe(true);
// Test decode - default falsy values
expect(z.decode(codec, "false")).toBe(false);
expect(z.decode(codec, "no")).toBe(false);
expect(z.decode(codec, "0")).toBe(false);
// Test encode - default behavior
expect(z.encode(codec, true)).toBe("true");
expect(z.encode(codec, false)).toBe("false");
// Test custom options
const customCodec = stringToBoolean({ truthy: ["yes", "y"], falsy: ["no", "n"] });
expect(z.decode(customCodec, "yes")).toBe(true);
expect(z.decode(customCodec, "y")).toBe(true);
expect(z.decode(customCodec, "no")).toBe(false);
expect(z.decode(customCodec, "n")).toBe(false);
expect(z.encode(customCodec, true)).toBe("yes");
expect(z.encode(customCodec, false)).toBe("no");
});
// ============================================================================
// Error Handling Tests
// ============================================================================
// Test error cases - these test input validation, not transform errors
test("codec input validation", () => {
// Test invalid base64 format
const base64Codec = base64();
const invalidBase64Result = z.safeDecode(base64Codec, "invalid!@#");
expect(invalidBase64Result.success).toBe(false);
// Test invalid hex format
const hexCodec = hexToBytes();
const invalidHexResult = z.safeDecode(hexCodec, "gg");
expect(invalidHexResult.success).toBe(false);
// Test invalid URL format
const urlCodec = stringToURL();
const invalidUrlResult = z.safeDecode(urlCodec, "not a url");
expect(invalidUrlResult.success).toBe(false);
// Test invalid HTTP URL format
const httpUrlCodec = stringToHttpURL();
const invalidHttpResult = z.safeDecode(httpUrlCodec, "ftp://example.com");
expect(invalidHttpResult.success).toBe(false);
});
// Test transform errors - these test errors added by transform functions
test("codec transform error handling", () => {
// JSON codec that can fail during transform
const anyJSON = jsonCodec(z.json());
// Test successful JSON parsing
const validResult = z.safeDecode(anyJSON, '{"valid": "json"}');
expect(validResult.success).toBe(true);
if (validResult.success) {
expect(validResult.data).toEqual({ valid: "json" });
}
// Test invalid JSON that should create a single "invalid_format" issue. Verifies that the transform error aborts before reaching the output schema
const invalidResult = z.safeDecode(anyJSON, '{"invalid":,}');
expect(invalidResult.success).toBe(false);
if (!invalidResult.success) {
expect(invalidResult.error.issues).toMatchInlineSnapshot(`
[
{
"code": "invalid_format",
"format": "json",
"message": "Unexpected token ',', "{"invalid":,}" is not valid JSON",
"path": [],
},
]
`);
}
});
@@ -0,0 +1 @@
{"version":3,"names":["_assert","data","require","_fs","_interopRequireWildcard","_process","_url","_path","_module","_v","_util","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","own$1","classRegExp","kTypes","Set","codes","formatList","array","type","length","join","slice","messages","Map","nodeInternalPrefix","userStackTraceLimit","ERR_INVALID_ARG_TYPE","createError","name","expected","actual","assert","Array","isArray","message","endsWith","includes","types","instances","other","value","push","toLowerCase","exec","pos","indexOf","determineSpecificType","TypeError","ERR_INVALID_MODULE_SPECIFIER","request","reason","base","undefined","ERR_INVALID_PACKAGE_CONFIG","path","Error","ERR_INVALID_PACKAGE_TARGET","packagePath","key","target","isImport","relatedError","startsWith","JSON","stringify","ERR_MODULE_NOT_FOUND","exactUrl","ERR_NETWORK_IMPORT_DISALLOWED","ERR_PACKAGE_IMPORT_NOT_DEFINED","specifier","ERR_PACKAGE_PATH_NOT_EXPORTED","subpath","ERR_UNSUPPORTED_DIR_IMPORT","ERR_UNSUPPORTED_RESOLVE_REQUEST","ERR_UNKNOWN_FILE_EXTENSION","extension","ERR_INVALID_ARG_VALUE","inspected","inspect","sym","constructor","makeNodeErrorWithCode","Base","NodeError","parameters","limit","stackTraceLimit","isErrorStackTraceLimitWritable","error","getMessage","defineProperties","enumerable","writable","configurable","toString","captureLargerStackTrace","code","v8","startupSnapshot","isBuildingSnapshot","_unused","desc","isExtensible","hideStackFrames","wrappedFunction","hidden","stackTraceLimitIsWritable","Number","POSITIVE_INFINITY","captureStackTrace","self","Reflect","apply","regex","expectedLength","unshift","format","String","depth","colors","hasOwnProperty$1","ERR_INVALID_PACKAGE_CONFIG$1","cache","read","jsonPath","existing","string","fs","readFileSync","toNamespacedPath","exception","result","exists","pjsonPath","main","exports","imports","parsed","parse","error_","cause","fileURLToPath","getPackageScopeConfig","resolved","packageJSONUrl","URL","packageJSONPath","pathname","packageConfig","lastPackageJSONUrl","getPackageType","url","extensionFormatMap","mimeToFormat","mime","test","protocolHandlers","getDataProtocolModuleFormat","getFileProtocolModuleFormat","getHttpProtocolModuleFormat","node:","extname","index","codePointAt","_context","ignoreErrors","packageType","filepath","defaultGetFormatWithoutErrors","context","protocol","DEFAULT_CONDITIONS","freeze","DEFAULT_CONDITIONS_SET","getDefaultConditions","getDefaultConditionsSet","getConditionsSet","conditions","RegExpPrototypeSymbolReplace","RegExp","prototype","Symbol","replace","own","invalidSegmentRegEx","deprecatedInvalidSegmentRegEx","invalidPackageNameRegEx","patternRegEx","encodedSeparatorRegEx","emittedPackageWarnings","doubleSlashRegEx","emitInvalidSegmentDeprecation","match","packageJsonUrl","internal","isTarget","process","noDeprecation","double","emitWarning","emitLegacyIndexDeprecation","parentURL","href","urlPath","URL$1","basePath","resolve","tryStatSync","statSync","_unused2","fileExists","stats","throwIfNoEntry","isFile","legacyMainResolve","guess","tries","finalizeResolution","preserveSymlinks","filePath","isDirectory","real","realpathSync","search","hash","pathToFileURL","sep","importNotDefined","exportsNotFound","throwInvalidSubpath","invalidPackageTarget","resolvePackageTargetString","pattern","isPathMap","isURL","_unused3","exportTarget","packageResolve","resolvedTarget","resolvedPath","isArrayIndex","keyNumber","resolvePackageTarget","packageSubpath","targetList","lastException","targetItem","resolveResult","keys","getOwnPropertyNames","conditionalTarget","isConditionalExportsMainSugar","isConditionalSugar","keyIndex","currentIsConditionalSugar","emitTrailingSlashPatternDeprecation","pjsonUrl","add","packageExportsResolve","bestMatch","bestMatchSubpath","patternIndex","patternTrailer","patternKeyCompare","lastIndexOf","a","b","aPatternIndex","bPatternIndex","baseLengthA","baseLengthB","packageImportsResolve","parsePackageName","separatorIndex","validPackageName","isScoped","packageName","builtinModules","packageJsonPath","lastPath","stat","isRelativeSpecifier","shouldBeTreatedAsRelativeOrAbsolutePath","moduleResolve","isData","isRemote","checkIfDisallowedImport","parsedParentURL","parentProtocol","parsedProtocol","Boolean","throwIfInvalidParentURL","defaultResolve","_unused4","_unused5","maybeReturn","parent"],"sources":["../../src/vendor/import-meta-resolve.js"],"sourcesContent":["\n/****************************************************************************\\\n * NOTE FROM BABEL AUTHORS *\n * This file is inlined from https://github.com/wooorm/import-meta-resolve, *\n * because we need to compile it to CommonJS. *\n\\****************************************************************************/\n\n/*\n(The MIT License)\n\nCopyright (c) 2021 TitLine truncated
@@ -0,0 +1 @@
{"version":3,"file":"track.mjs","sources":["../../../../../src/render/dom/scroll/track.ts"],"sourcesContent":["import { cancelFrame, frame, frameData, resize, Process } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { createScrollInfo } from \"./info\"\nimport { createOnScrollHandler } from \"./on-scroll-handler\"\nimport { OnScrollHandler, OnScrollInfo, ScrollInfoOptions } from \"./types\"\n\nconst scrollListeners = new WeakMap<Element, VoidFunction>()\nconst resizeListeners = new WeakMap<Element, VoidFunction>()\nconst onScrollHandlers = new WeakMap<Element, Set<OnScrollHandler>>()\nconst scrollSize = new WeakMap<Element, { width: number; height: number }>()\nconst dimensionCheckProcesses = new WeakMap<Element, Process>()\n\nexport type ScrollTargets = Array<HTMLElement>\n\nconst getEventTarget = (element: Element) =>\n element === document.scrollingElement ? window : element\n\nexport function scrollInfo(\n onScroll: OnScrollInfo,\n {\n container = document.scrollingElement as Element,\n trackContentSize = false,\n ...options\n }: ScrollInfoOptions = {}\n) {\n if (!container) return noop as VoidFunction\n\n let containerHandlers = onScrollHandlers.get(container)\n\n /**\n * Get the onScroll handlers for this container.\n * If one isn't found, create a new one.\n */\n if (!containerHandlers) {\n containerHandlers = new Set()\n onScrollHandlers.set(container, containerHandlers)\n }\n\n /**\n * Create a new onScroll handler for the provided callback.\n */\n const info = createScrollInfo()\n const containerHandler = createOnScrollHandler(\n container,\n onScroll,\n info,\n options\n )\n containerHandlers.add(containerHandler)\n\n /**\n * Check if there's a scroll event listener for this container.\n * If not, create one.\n */\n if (!scrollListeners.has(container)) {\n const measureAll = () => {\n for (const handler of containerHandlers) {\n handler.measure(frameData.timestamp)\n }\n\n frame.preUpdate(notifyAll)\n }\n\n const notifyAll = () => {\n for (const handler of containerHandlers) {\n handler.notify()\n }\n }\n\n const listener = () => frame.read(measureAll)\n\n scrollListeners.set(container, listener)\n\n const target = getEventTarget(container)\n window.addEventListener(\"resize\", listener)\n if (container !== document.documentElement) {\n resizeListeners.set(container, resize(container, listener))\n }\n\n target.addEventListener(\"scroll\", listener)\n\n listener()\n }\n\n /**\n * Enable content size tracking if requested and not already enabled.\n */\n if (trackContentSize && !dimensionCheckProcesses.has(container)) {\n const listener = scrollListeners.get(container)!\n\n // Store initial scroll dimensions (object is reused to avoid allocation)\n const size = {\n width: container.scrollWidth,\n height: container.scrollHeight,\n }\n scrollSize.set(container, size)\n\n // Add frame-based scroll dimension checking to detect content changes\n const checkScrollDimensions: Process = () => {\n const newWidth = container.scrollWidth\n const newHeight = container.scrollHeight\n\n if (size.width !== newWidth || size.height !== newHeight) {\n listener()\n size.width = newWidth\n size.height = newHeight\n }\n }\n\n // Schedule with keepAlive=true to run every frame\n const dimensionCheckProcess = frame.read(checkScrollDimensions, true)\n dimensionCheckProcesses.set(container, dimensionCheckProcess)\n }\n\n const listener = scrollListeners.get(container)!\n frame.read(listener, false, true)\n\n return () => {\n cancelFrame(listener)\n\n /**\n * Check if we even have any handlers for this container.\n */\n const currentHandlers = onScrollHandlers.get(container)\n if (!currentHandlers) return\n\n currentHandlers.delete(containerHandler)\n\n if (currentHandlers.size) return\n\n /**\n * If no more handlers, remove the scroll listener too.\n */\n const scrollListener = scrollListeners.get(container)\n scrollListeners.delete(container)\n\n if (scrollListener) {\n getEventTarget(container).removeEventListener(\n \"scroll\",\n scrollListener\n )\n resizeListeners.get(container)?.()\n window.removeEventListener(\"resize\", scrollListener)\n }\n\n // Clean up scroll dimension checking\n const dimensionCheckProcess = dimensionCheckProcesses.get(container)\n if (dimensionLine truncated
@@ -0,0 +1 @@
{"version":3,"file":"package-2.js","sources":["../../../src/icons/package-2.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Package2\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMyA5aDE4djEwYTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0yVjlaIiAvPgogIDxwYXRoIGQ9Im0zIDkgMi40NS00LjlBMiAyIDAgMCAxIDcuMjQgM2g5LjUyYTIgMiAwIDAgMSAxLjggMS4xTDIxIDkiIC8+CiAgPHBhdGggZD0iTTEyIDN2NiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/package-2\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 Package2 = createLucideIcon('Package2', [\n ['path', { d: 'M3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9Z', key: '1ront0' }],\n ['path', { d: 'm3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9', key: '19h2x1' }],\n ['path', { d: 'M12 3v6', key: '1holv5' }],\n]);\n\nexport default Package2;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA+C,CAAA,CAAA,CAAA,CAA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EAAE,CAAC;IAC3B,CAAC;CACF;AAED;;;GAGG;AAEH;;uEAEuE;AACvE,MAAM,CAAC,MAAM,SAAS,GAAsB,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC;IAC3E,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/F,CAAC,CAAC;AAEH;6EAC6E;AAC7E,MAAM,CAAC,MAAM,SAAS,GAAsB,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC;IAC3E,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/F,CAAC,CAAC;AAEH;;;wDAGwD;AACxD,MAAM,CAAC,MAAM,SAAS,GAAsB,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC;IAC3E,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/F,CAAC,CAAC;AAEH;;;gDAGgD;AAChD,MAAM,CAAC,MAAM,SAAS,GAAsB,eAAe,CAAC,WALine truncated
@@ -0,0 +1,18 @@
import { ParsedLocation } from './location.js';
import { AnyRoute } from './route.js';
import { AnyRouteMatch, MakeRouteMatch } from './Matches.js';
import { AnyRouter, UpdateMatchFn } from './router.js';
export declare function loadMatches(arg: {
router: AnyRouter;
location: ParsedLocation;
matches: Array<AnyRouteMatch>;
preload?: boolean;
forceStaleReload?: boolean;
onReady?: () => Promise<void>;
updateMatch: UpdateMatchFn;
sync?: boolean;
}): Promise<Array<MakeRouteMatch>>;
export type RouteComponentType = 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent';
export declare function loadRouteChunk(route: AnyRoute, componentTypesToLoad?: Array<RouteComponentType>): Promise<void> | undefined;
export declare function routeNeedsPreload(route: AnyRoute): boolean;
export declare const componentTypes: Array<RouteComponentType>;
@@ -0,0 +1,3 @@
export {ErrorEvent} from './errors.js'
export {EventSource} from './EventSource.js'
export type * from './types.js'
@@ -0,0 +1 @@
{"version":3,"file":"heart-crack.js","sources":["../../../src/icons/heart-crack.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name HeartCrack\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTkgMTRjMS40OS0xLjQ2IDMtMy4yMSAzLTUuNUE1LjUgNS41IDAgMCAwIDE2LjUgM2MtMS43NiAwLTMgLjUtNC41IDItMS41LTEuNS0yLjc0LTItNC41LTJBNS41IDUuNSAwIDAgMCAyIDguNWMwIDIuMyAxLjUgNC4wNSAzIDUuNWw3IDdaIiAvPgogIDxwYXRoIGQ9Im0xMiAxMy0xLTEgMi0yLTMtMyAyLTIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/heart-crack\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 HeartCrack = createLucideIcon('HeartCrack', [\n [\n 'path',\n {\n d: 'M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5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AA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA0B,CAAA,CAAA,CAAA,CAAA,CAAA,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;AACzD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
module.exports={C:{"7":0.00262,"47":0.00787,"52":0.00262,"53":0.00525,"68":0.00262,"112":0.03935,"115":0.02098,"120":0.1023,"121":0.17836,"127":0.02361,"138":0.00262,"139":0.00787,"140":0.00787,"145":0.00262,"147":0.00262,"149":0.00262,"152":0.01049,"153":0.02098,"154":0.11279,"155":0.32525,"156":0.40394,"157":0.00262,_:"2 3 4 5 6 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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 113 114 116 117 118 119 122 123 124 125 126 128 129 130 131 132 133 134 135 136 137 141 142 143 144 146 148 150 151 158 159 160 3.5","3.6":0.00262},D:{"49":0.00787,"53":0.00525,"55":0.00262,"58":0.01836,"67":0.01049,"68":0.00525,"69":0.01312,"70":0.0341,"71":0.03672,"73":0.00262,"74":0.01836,"75":0.00525,"76":0.00525,"77":0.01574,"79":0.08918,"80":0.00262,"81":0.04721,"83":0.00262,"86":0.00262,"87":0.01049,"88":0.01049,"90":0.00262,"91":0.00525,"92":0.00262,"93":0.01574,"94":0.00262,"95":0.00262,"96":0.00262,"98":0.00787,"99":0.00787,"101":0.04459,"103":0.08394,"104":0.03148,"105":0.03148,"106":0.02361,"107":0.02361,"108":0.03148,"109":0.08394,"110":0.03935,"111":0.04721,"112":0.02885,"113":0.00262,"114":0.00787,"115":0.00262,"116":0.06295,"117":0.01836,"118":0.50099,"119":0.34099,"120":0.28066,"121":0.02361,"122":0.01312,"123":0.00525,"124":0.02885,"125":0.00525,"126":0.01836,"127":0.01049,"128":0.01049,"131":0.06558,"133":0.1023,"134":0.05508,"135":0.05246,"136":0.05771,"137":0.08918,"138":0.11804,"139":0.10492,"140":0.07869,"141":0.08394,"142":0.22296,"143":0.0341,"144":0.03672,"145":0.01836,"146":0.13377,"147":0.03672,"148":0.06033,"149":0.07607,"150":0.32788,"151":0.8551,"152":3.49384,"153":3.96598,"154":1.16199,"155":0.01836,_:"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 54 56 57 59 60 61 62 63 64 65 66 72 78 84 85 89 97 100 102 129 130 132 156 157"},F:{"36":0.00262,"37":0.00262,"42":0.00262,"45":0.00787,"63":0.00262,"64":0.00262,"79":0.02623,"87":0.00262,"90":0.00262,"95":0.02098,"99":0.00262,"100":0.03148,"101":0.05508,"108":0.00525,"113":0.01049,"120":0.00262,"125":0.00525,"126":0.01049,"127":0.00262,"131":0.02098,"132":0.00262,"133":0.03672,"134":0.07607,"135":0.61641,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 38 39 40 41 43 44 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 85 86 88 89 91 92 93 94 96 97 98 102 103 104 105 106 107 109 110 111 112 114 115 116 117 118 119 121 122 123 124 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"14":0.00262,"15":0.00262,"16":0.01312,"18":0.03672,"84":0.00787,"89":0.00525,"90":0.02623,"92":0.08394,"99":0.00262,"100":0.01312,"101":0.00262,"103":0.00262,"119":0.10492,"120":0.09443,"122":0.02885,"126":0.00262,"128":0.00262,"129":0.00787,"131":0.00262,"137":0.00262,"139":0.00262,"140":0.00525,"142":0.00262,"144":0.0341,"145":0.01049,"146":0.00525,"147":0.01574,"148":0.00262,"149":0.02623,"150":0.04197,"151":0.2964,"152":1.36134,"153":1.31937,"154":0.33574,_:"12 13 17 79 80 81 83 85 86 87 88 91 93 94 95 96 97 98 102 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 121 123 124 125 127 130 132 133 134 135 136 138 141 143"},E:{"12":0.00262,"14":0.00262,"27":0.01574,_:"4 5 6 7 8 9 10 11 13 15 3.1 3.2 5.1 6.1 7.1 9.1 15.1 15.2-15.3 15.5 16.0 16.1 16.2 16.3 16.4 16.5 17.0 17.2 17.3 17.4 18.0 18.1 18.2 18.3 18.4 26.1 27.1 27.2 TP","10.1":0.01049,"11.1":0.00525,"12.1":0.00262,"13.1":0.01574,"14.1":0.02885,"15.4":0.00262,"15.6":0.02623,"16.6":0.02098,"17.1":0.01049,"17.5":0.01574,"17.6":0.02098,"18.5-18.7":0.00262,"26.0":0.00262,"26.2":0.00262,"26.3":0.00262,"26.4":0.00262,"26.5":0.06558,"26.6":0.09967},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00059,"5.0-5.1":0.00059,"6.0-6.1":0,"7.0-7.1":0.00118,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00591,"11.0-11.2":0.00059,"11.3-11.4":0.00118,"12.0-12.1":0,"12.2-12.5":0.01536,"13.0-13.1":0,"13.2":0.00295,"13.3":0,"13.4-13.7":0.00059,"14.0-14.4":0.00236,"14.5-14.8":0.00355,"15.0-15.1":0.00355,"15.2-15.3":0.00236,"15.4":0.00295,"15.5":0.00355,"15.6-15.8":0.07682,"16.0":0.00591,"16.1":0.01064,"16.2":0.00591,"16.3":0.013,"16.4":0.00295,"16.5":0.00473,"16.6-16.7":0.10695,"17.0":0.00414,"17.1":0.00591,"17.2":0.00591,"17.3":0.00886,"17.4":0.01241,"17.5":0.02423,"17.6-17.7":0.06264,"18.0":0.013,"18.1":0.026,"18.2":0.03545,"18.3":0.06145,"18.4":0.03841,"18.5-18.7":0.79358,"26.0":0.03841,"26.1":0.039,"26.2":0.10163,"26.3":0.10991,"26.4":0.08036,"26.5":0.53831,"26.6":3.32144,"27.0":0.25468,"27.1":0,"27.2":0.0065},P:{"21":0.00925,"22":0.0185,"24":0.037,"25":0.74004,"26":0.0185,"27":0.11101,"28":0.31452,"29":0.24976,"30":0.73079,_:"4 20 23 6.2-6.4 10.1 11.1-11.2 12.0 14.0 15.0 17.0 18.0","5.0-5.4":0.00925,"7.2-Line truncated
@@ -0,0 +1,3 @@
declare function findMockRedirect(root: string, mockPath: string, external: string | null): string | null;
export { findMockRedirect };
@@ -0,0 +1 @@
{"version":3,"file":"scoring.mjs","sources":["../../../src/matcher/bruteforce/scoring.ts"],"sourcesContent":[null],"names":["token","guesses","BRUTEFORCE_CARDINALITY","length","Number","POSITIVE_INFINITY","MAX_VALUE","minGuesses","MIN_SUBMATCH_GUESSES_SINGLE_CHAR","MIN_SUBMATCH_GUESSES_MULTI_CHAR","Math","max"],"mappings":";;AAOA,wBAAe,CAAC;AAAEA,EAAAA;AAAK,CAAkC,KAAI;AAC3D,EAAA,IAAIC,OAAO,GAAGC,sBAAsB,IAAIF,KAAK,CAACG,MAAM;AACpD,EAAA,IAAIF,OAAO,KAAKG,MAAM,CAACC,iBAAiB,EAAE;IACxCJ,OAAO,GAAGG,MAAM,CAACE,SAAS;AAC5B,EAAA;AACA,EAAA,IAAIC,UAAU;AACd;AACA;AACA,EAAA,IAAIP,KAAK,CAACG,MAAM,KAAK,CAAC,EAAE;IACtBI,UAAU,GAAGC,gCAAgC,GAAG,CAAC;AACnD,EAAA,CAAC,MAAM;IACLD,UAAU,GAAGE,+BAA+B,GAAG,CAAC;AAClD,EAAA;AAEA,EAAA,OAAOC,IAAI,CAACC,GAAG,CAACV,OAAO,EAAEM,UAAU,CAAC;AACtC,CAAC;;;;"}
@@ -0,0 +1,58 @@
/* eslint-disable node/no-deprecated-api */
'use strict'
var buffer = require('buffer')
var Buffer = buffer.Buffer
var safer = require('./safer.js')
var Safer = safer.Buffer
var dangerous = {}
var key
for (key in safer) {
if (!safer.hasOwnProperty(key)) continue
dangerous[key] = safer[key]
}
var Dangereous = dangerous.Buffer = {}
// Copy Safer API
for (key in Safer) {
if (!Safer.hasOwnProperty(key)) continue
Dangereous[key] = Safer[key]
}
// Copy those missing unsafe methods, if they are present
for (key in Buffer) {
if (!Buffer.hasOwnProperty(key)) continue
if (Dangereous.hasOwnProperty(key)) continue
Dangereous[key] = Buffer[key]
}
if (!Dangereous.allocUnsafe) {
Dangereous.allocUnsafe = function (size) {
if (typeof size !== 'number') {
throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
}
if (size < 0 || size >= 2 * (1 << 30)) {
throw new RangeError('The value "' + size + '" is invalid for option "size"')
}
return Buffer(size)
}
}
if (!Dangereous.allocUnsafeSlow) {
Dangereous.allocUnsafeSlow = function (size) {
if (typeof size !== 'number') {
throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
}
if (size < 0 || size >= 2 * (1 << 30)) {
throw new RangeError('The value "' + size + '" is invalid for option "size"')
}
return buffer.SlowBuffer(size)
}
}
module.exports = dangerous
@@ -0,0 +1,14 @@
"use strict";
// When writing files on Windows, translate the characters to their
// 0xf000 higher-encoded versions.
Object.defineProperty(exports, "__esModule", { value: true });
exports.decode = exports.encode = void 0;
const raw = ['|', '<', '>', '?', ':'];
const win = raw.map(char => String.fromCodePoint(0xf000 + Number(char.codePointAt(0))));
const toWin = new Map(raw.map((char, i) => [char, win[i]]));
const toRaw = new Map(win.map((char, i) => [char, raw[i]]));
const encode = (s) => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s);
exports.encode = encode;
const decode = (s) => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s);
exports.decode = decode;
//# sourceMappingURL=winchars.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Matches.cjs","names":[],"sources":["../../src/Matches.ts"],"sourcesContent":["import type { AnyRoute, StaticDataRouteOption } from './route'\nimport type {\n AllContext,\n AllLoaderData,\n AllParams,\n FullSearchSchema,\n ParseRoute,\n RouteById,\n RouteIds,\n} from './routeInfo'\nimport type { AnyRouter, RegisteredRouter, SSROption } from './router'\nimport type { Constrain, ControlledPromise } from './utils'\n\nexport type AnyMatchAndValue = { match: any; value: any }\n\nexport type FindValueByIndex<\n TKey,\n TValue extends ReadonlyArray<any>,\n> = TKey extends `${infer TIndex extends number}` ? TValue[TIndex] : never\n\nexport type FindValueByKey<TKey, TValue> =\n TValue extends ReadonlyArray<any>\n ? FindValueByIndex<TKey, TValue>\n : TValue[TKey & keyof TValue]\n\nexport type CreateMatchAndValue<TMatch, TValue> = TValue extends any\n ? {\n match: TMatch\n value: TValue\n }\n : never\n\nexport type NextMatchAndValue<\n TKey,\n TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n ? CreateMatchAndValue<\n TMatchAndValue['match'],\n FindValueByKey<TKey, TMatchAndValue['value']>\n >\n : never\n\nexport type IsMatchKeyOf<TValue> =\n TValue extends ReadonlyArray<any>\n ? number extends TValue['length']\n ? `${number}`\n : keyof TValue & `${number}`\n : TValue extends object\n ? keyof TValue & string\n : never\n\nexport type IsMatchPath<\n TParentPath extends string,\n TMatchAndValue extends AnyMatchAndValue,\n> = `${TParentPath}${IsMatchKeyOf<TMatchAndValue['value']>}`\n\nexport type IsMatchResult<\n TKey,\n TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n ? TKey extends keyof TMatchAndValue['value']\n ? TMatchAndValue['match']\n : never\n : never\n\nexport type IsMatchParse<\n TPath,\n TMatchAndValue extends AnyMatchAndValue,\n TParentPath extends string = '',\n> = TPath extends `${string}.${string}`\n ? TPath extends `${infer TFirst}.${infer TRest}`\n ? IsMatchParse<\n TRest,\n NextMatchAndValue<TFirst, TMatchAndValue>,\n `${TParentPath}${TFirst}.`\n >\n : never\n : {\n path: IsMatchPath<TParentPath, TMatchAndValue>\n result: IsMatchResult<TPath, TMatchAndValue>\n }\n\nexport type IsMatch<TMatch, TPath> = IsMatchParse<\n TPath,\n TMatch extends any ? { match: TMatch; value: TMatch } : never\n>\n\n/**\n * Narrows matches based on a path\n * @experimental\n */\nexport const isMatch = <TMatch, TPath extends string>(\n match: TMatch,\n path: Constrain<TPath, IsMatch<TMatch, TPath>['path']>,\n): match is IsMatch<TMatch, TPath>['result'] => {\n const parts = (path as string).split('.')\n let part\n let i = 0\n let value: any = match\n\n while ((part = parts[i++]) != null && value != null) {\n value = value[part]\n }\n\n return value != null\n}\n\nexport interface DefaultRouteMatchExtensions {\n scripts?: unknown\n links?: unknown\n headScripts?: unknown\n meta?: unknown\n styles?: unknown\n}\n\nexport interface RouteMatchExtensions extends DefaultRouteMatchExtensions {}\n\nexport interface RouteMatch<\n out TRouteId,\n out TFullPath,\n out TAllParams,\n out TFullSearchSchema,\n out TLoaderData,\n out TAllContext,\n out TLoaderDeps,\n> extends RouteMatchExtensions {\n id: string\n routeId: TRouteId\n fullPath: TFullPath\n index: number\n pathname: string\n params: TAllParams\n _strictParams: TAllParams\n status: 'pending' | 'success' | 'error' | 'redirected' | 'notFound'\n isFetching: false | 'beforeLoad' | 'loader'\n error: unknown\n paramsError: unknown\n searchError: unknown\n updatedAt: number\n _nonReactive: {\n /** @internal */\n beforeLoadPromise?: ControlledPromise<void>\n /** @internal */\n loaderPromise?: ControlledPromise<void>\n /** @internal */\n pendingTimeout?: ReturnType<typeof setTimeout>\n loadPromise?: ControlledPromise<void>\n displayPendingPromise?: Promise<void>\n minPendingPromise?: ControlledPromise<void>\n dehydrated?: boolean\n /** @internal */\n error?: unknown\n }\n loaderData?: TLoaderData\n /** @internal */\n __routeContext?: Record<string, unknown>\n /** @internal */\n __beforeLoadContext?: Record<string, unknown>\n context: TAllContext\n search: TFullSearchSchema\n _strictSearch: TFullSearchSchema\n fetchCount: number\n abortController: AbortController\n cause: 'preload' | 'enter' | 'stay'\n loaderDeps: TLoaderDeps\n preload: boolean\n invalid: boolean\n headers?: Record<string, string>\n globalNotFound?: boolean\n staticData: StaticDataRouteOption\n /** This attribute is not reactive */\n ssr?: SSROption\n _forcePending?: boolean\n _displayPending?: boolean\n}\n\nexport interface PreValidationErrorHandlingRouteMatch<\n TRouteId,\n TFullPath,\n TAllParams,\n TFullSearchSchema,\n> {\n id: string\n routeId: TRouteId\n fullPath: TFullPath\n index: number\n pathname: string\n Line truncated
@@ -0,0 +1 @@
{"version":3,"file":"proportions.js","sources":["../../../src/icons/proportions.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Proportions\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHg9IjIiIHk9IjQiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Ik0xMiA5djExIiAvPgogIDxwYXRoIGQ9Ik0yIDloMTNhMiAyIDAgMCAxIDIgMnY5IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/proportions\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 Proportions = createLucideIcon('Proportions', [\n ['rect', { width: '20', height: '16', x: '2', y: '4', rx: '2', key: '18n3k1' }],\n ['path', { d: 'M12 9v11', key: '1fnkrn' }],\n ['path', { d: 'M2 9h13a2 2 0 0 1 2 2v9', key: '11z3ex' }],\n]);\n\nexport default Proportions;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAAA,CAClD,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,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,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,65 @@
export const isCode = (c) => name.has(c);
export const isName = (c) => code.has(c);
/**
* types that are a normal file system entry, not metadata.
*
* These can be the subject of extended/globalExtended headers, long path
* names, long linkpath names, etc.
*
* Any other types are meta, and cannot be targetted by extended PAX headers.
*/
export const normalFsTypes = new Set([
'0',
'',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'D',
]);
// map types from key to human-friendly name
export const name = new Map([
['0', 'File'],
// same as File
['', 'OldFile'],
['1', 'Link'],
['2', 'SymbolicLink'],
// Devices and FIFOs aren't fully supported
// they are parsed, but skipped when unpacking
['3', 'CharacterDevice'],
['4', 'BlockDevice'],
['5', 'Directory'],
['6', 'FIFO'],
// same as File
['7', 'ContiguousFile'],
// pax headers
['g', 'GlobalExtendedHeader'],
['x', 'ExtendedHeader'],
// vendor-specific stuff
// skip
['A', 'SolarisACL'],
// like 5, but with data, which should be skipped
['D', 'GNUDumpDir'],
// metadata only, skip
['I', 'Inode'],
// data = link path of next file
['K', 'NextFileHasLongLinkpath'],
// data = path of next file
['L', 'NextFileHasLongPath'],
// skip
['M', 'ContinuationFile'],
// like L
['N', 'OldGnuLongPath'],
// skip
['S', 'SparseFile'],
// skip
['V', 'TapeVolumeHeader'],
// like x
['X', 'OldExtendedHeader'],
]);
// map the other direction
export const code = new Map(Array.from(name).map(kv => [kv[1], kv[0]]));
//# sourceMappingURL=types.js.map
@@ -0,0 +1,8 @@
"use strict";
const isLeapYear = require("./isLeapYear-CZo5eAQg.js");
const arr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
const arr2 = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function daysOfYear(year) {
return isLeapYear.isLeapYear(year) ? arr2 : arr;
}
exports.daysOfYear = daysOfYear;
@@ -0,0 +1,179 @@
import type { NavigateOptions } from './link'
import type { AnyRouter, RegisteredRouter } from './router'
import type { ParsedLocation } from './location'
export type AnyRedirect = Redirect<any, any, any, any, any>
/**
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)
*/
export type Redirect<
TRouter extends AnyRouter = RegisteredRouter,
TFrom extends string = string,
TTo extends string | undefined = undefined,
TMaskFrom extends string = TFrom,
TMaskTo extends string = '.',
> = Response & {
options: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
/**
* @internal
* A **trusted** built location that can be used to redirect to.
*/
_builtLocation?: ParsedLocation
}
redirectHandled?: boolean
}
export type RedirectOptions<
TRouter extends AnyRouter = RegisteredRouter,
TFrom extends string = string,
TTo extends string | undefined = undefined,
TMaskFrom extends string = TFrom,
TMaskTo extends string = '.',
> = {
href?: string
/**
* @deprecated Use `statusCode` instead
**/
code?: number
/**
* The HTTP status code to use when redirecting.
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#statuscode-property)
*/
statusCode?: number
/**
* If provided, will throw the redirect object instead of returning it. This can be useful in places where `throwing` in a function might cause it to have a return type of `never`. In that case, you can use `redirect({ throw: true })` to throw the redirect object instead of returning it.
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#throw-property)
*/
throw?: any
/**
* The HTTP headers to use when redirecting.
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#headers-property)
*/
headers?: HeadersInit
/**
* @internal
* A **trusted** built location that can be used to redirect to.
*/
_builtLocation?: ParsedLocation
} & NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>
export type ResolvedRedirect<
TRouter extends AnyRouter = RegisteredRouter,
TFrom extends string = string,
TTo extends string = '',
TMaskFrom extends string = TFrom,
TMaskTo extends string = '',
> = Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>
/**
* Options for route-bound redirect, where 'from' is automatically set.
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)
*/
export type RedirectOptionsRoute<
TDefaultFrom extends string = string,
TRouter extends AnyRouter = RegisteredRouter,
TTo extends string | undefined = undefined,
TMaskTo extends string = '',
> = Omit<
RedirectOptions<TRouter, TDefaultFrom, TTo, TDefaultFrom, TMaskTo>,
'from'
>
/**
* A redirect function bound to a specific route, with 'from' pre-set to the route's fullPath.
* This enables relative redirects like `Route.redirect({ to: './overview' })`.
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)
*/
export interface RedirectFnRoute<in out TDefaultFrom extends string = string> {
<
TRouter extends AnyRouter = RegisteredRouter,
const TTo extends string | undefined = undefined,
const TMaskTo extends string = '',
>(
opts: RedirectOptionsRoute<TDefaultFrom, TRouter, TTo, TMaskTo>,
): Redirect<TRouter, TDefaultFrom, TTo, TDefaultFrom, TMaskTo>
}
/**
* Create a redirect Response understood by TanStack Router.
*
* Use from route `loader`/`beforeLoad` or server functions to trigger a
* navigation. If `throw: true` is set, the redirect is thrown instead of
* returned. When an absolute `href` is supplied and `reloadDocument` is not
* set, a full-document navigation is inferred.
*
* @param opts Options for the redirect. Common fields:
* - `href`: absolute URL for external redirects; infers `reloadDocument`.
* - `statusCode`: HTTP status code to use (defaults to 307).
* - `headers`: additional headers to include on the Response.
* - Standard navigation options like `to`, `params`, `search`, `replace`,
* and `reloadDocument` for internal redirects.
* @returns A Response augmented with router navigation options.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction
*/
export function redirect<
TRouter extends AnyRouter = RegisteredRouter,
const TTo extends string | undefined = '.',
const TFrom extends string = string,
const TMaskFrom extends string = TFrom,
const TMaskTo extends string = '',
>(
opts: RedirectOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,
): Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> {
opts.statusCode = opts.statusCode || opts.code || 307
if (
!opts._builtLocation &&
!opts.reloadDocument &&
typeof opts.href === 'string'
) {
try {
new URL(opts.href)
opts.reloadDocument = true
} catch {}
}
const headers = new Headers(opts.headers)
if (opts.href && headers.get('Location') === null) {
headers.set('Location', opts.href)
}
const response = new Response(null, {
status: opts.statusCode,
headers,
})
;(response as Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>).options =
opts
if (opts.throw) {
throw response
}
return response as Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>
}
/** Check whether a value is a TanStack Router redirect Response. */
/** Check whether a value is a TanStack Router redirect Response. */
export function isRedirect(obj: any): obj is AnyRedirect {
return obj instanceof Response && !!(obj as any).options
}
/** True if value is a redirect with a resolved `href` location. */
/** True if value is a redirect with a resolved `href` location. */
export function isResolvedRedirect(
obj: any,
): obj is AnyRedirect & { options: { href: string } } {
return isRedirect(obj) && !!obj.options.href
}
/** Parse a serialized redirect object back into a redirect Response. */
/** Parse a serialized redirect object back into a redirect Response. */
export function parseRedirect(obj: any) {
if (obj !== null && typeof obj === 'object' && obj.isSerializedRedirect) {
return redirect(obj)
}
return undefined
}
@@ -0,0 +1,42 @@
/**
* Signing JSON Web Signature (JWS) in Flattened JSON Serialization
*
* @module
*/
import type * as types from '../../types.d.ts';
/**
* The FlattenedSign class is used to build and sign Flattened JWS objects.
*
* This class is exported (as a named export) from the main `'jose'` module entry point as well as
* from its subpath export `'jose/jws/flattened/sign'`.
*
*/
export declare class FlattenedSign {
#private;
/**
* {@link FlattenedSign} constructor
*
* @param payload Binary representation of the payload to sign.
*/
constructor(payload: Uint8Array);
/**
* Sets the JWS Protected Header on the FlattenedSign object.
*
* @param protectedHeader JWS Protected Header.
*/
setProtectedHeader(protectedHeader: types.JWSHeaderParameters): this;
/**
* Sets the JWS Unprotected Header on the FlattenedSign object.
*
* @param unprotectedHeader JWS Unprotected Header.
*/
setUnprotectedHeader(unprotectedHeader: types.JWSHeaderParameters): this;
/**
* Signs and resolves the value of the Flattened JWS object.
*
* @param key Private Key or Secret to sign the JWS with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Sign options.
*/
sign(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.SignOptions): Promise<types.FlattenedJWS>;
}
@@ -0,0 +1,26 @@
import { parseDef } from "../parseDef.js";
import { parseRecordDef } from "./record.js";
import { parseAnyDef } from "./any.js";
export function parseMapDef(def, refs) {
if (refs.mapStrategy === "record") {
return parseRecordDef(def, refs);
}
const keys = parseDef(def.keyType._def, {
...refs,
currentPath: [...refs.currentPath, "items", "items", "0"],
}) || parseAnyDef(refs);
const values = parseDef(def.valueType._def, {
...refs,
currentPath: [...refs.currentPath, "items", "items", "1"],
}) || parseAnyDef(refs);
return {
type: "array",
maxItems: 125,
items: {
type: "array",
items: [keys, values],
minItems: 2,
maxItems: 2,
},
};
}
@@ -0,0 +1 @@
{"version":3,"file":"dimensions.mjs","sources":["../../../../src/value/types/dimensions.ts"],"sourcesContent":["import { auto } from \"./auto\"\nimport { number } from \"./numbers\"\nimport { degrees, percent, px, vh, vw } from \"./numbers/units\"\nimport { testValueType } from \"./test\"\n\n/**\n * A list of value types commonly used for dimensions\n */\nexport const dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto]\n\n/**\n * Tests a dimensional value against the list of dimension ValueTypes\n */\nexport const findDimensionValueType = (v: any) =>\n dimensionValueTypes.find(testValueType(v))\n"],"names":[],"mappings":";;;;;AAKA;;AAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI;AAE9E;;AAEG;AACI,MAAM,sBAAsB,GAAG,CAAC,CAAM,KACzC,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;;;;"}
@@ -0,0 +1,42 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
//#region src/middleware/timeout/index.ts
const defaultTimeoutException = new (require("../../http-exception.js")).HTTPException(504, { message: "Gateway Timeout" });
/**
* Timeout Middleware for Hono.
*
* @param {number} duration - The timeout duration in milliseconds.
* @param {HTTPExceptionFunction | HTTPException} [exception=defaultTimeoutException] - The exception to throw when the timeout occurs. Can be a function that returns an HTTPException or an HTTPException object.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* const app = new Hono()
*
* app.use(
* '/long-request',
* timeout(5000) // Set timeout to 5 seconds
* )
*
* app.get('/long-request', async (c) => {
* await someLongRunningFunction()
* return c.text('Completed within time limit')
* })
* ```
*/
const timeout = (duration, exception = defaultTimeoutException) => {
return async function timeout(context, next) {
let timer;
const timeoutPromise = new Promise((_, reject) => {
timer = setTimeout(() => {
reject(typeof exception === "function" ? exception(context) : exception);
}, duration);
});
try {
await Promise.race([next(), timeoutPromise]);
} finally {
if (timer !== void 0) clearTimeout(timer);
}
};
};
//#endregion
exports.timeout = timeout;
@@ -0,0 +1,122 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
exports.get = get;
exports.getDependencies = getDependencies;
exports.isInternal = isInternal;
exports.list = void 0;
exports.minVersion = minVersion;
var _t = require("@babel/types");
var _helpersGenerated = require("./helpers-generated.js");
const {
cloneNode,
identifier
} = _t;
function deep(obj, path, value) {
try {
const parts = path.split(".");
let last = parts.shift();
while (parts.length > 0) {
obj = obj[last];
last = parts.shift();
}
if (arguments.length > 2) {
obj[last] = value;
} else {
return obj[last];
}
} catch (e) {
e.message += ` (when accessing ${path})`;
throw e;
}
}
function permuteHelperAST(ast, metadata, bindingName, localBindings, getDependency, adjustAst) {
const {
locals,
dependencies,
exportBindingAssignments,
exportName
} = metadata;
const bindings = new Set(localBindings || []);
if (bindingName) bindings.add(bindingName);
for (const [name, paths] of (Object.entries || (o => Object.keys(o).map(k => [k, o[k]])))(locals)) {
let newName = name;
if (bindingName && name === exportName) {
newName = bindingName;
} else {
while (bindings.has(newName)) newName = "_" + newName;
}
if (newName !== name) {
for (const path of paths) {
deep(ast, path, identifier(newName));
}
}
}
for (const [name, paths] of (Object.entries || (o => Object.keys(o).map(k => [k, o[k]])))(dependencies)) {
const ref = typeof getDependency === "function" && getDependency(name) || identifier(name);
for (const path of paths) {
deep(ast, path, cloneNode(ref));
}
}
adjustAst == null || adjustAst(ast, exportName, map => {
exportBindingAssignments.forEach(p => deep(ast, p, map(deep(ast, p))));
});
}
const helperData = Object.create(null);
function loadHelper(name) {
if (!helperData[name]) {
const helper = _helpersGenerated.default[name];
if (!helper) {
throw Object.assign(new ReferenceError(`Unknown helper ${name}`), {
code: "BABEL_HELPER_UNKNOWN",
helper: name
});
}
helperData[name] = {
minVersion: helper.minVersion,
build(getDependency, bindingName, localBindings, adjustAst) {
const ast = helper.ast();
permuteHelperAST(ast, helper.metadata, bindingName, localBindings, getDependency, adjustAst);
return {
nodes: ast.body,
globals: helper.metadata.globals
};
},
getDependencies() {
return Object.keys(helper.metadata.dependencies);
}
};
}
return helperData[name];
}
function get(name, getDependency, bindingName, localBindings, adjustAst) {
if (typeof bindingName === "object") {
const id = bindingName;
if ((id == null ? void 0 : id.type) === "Identifier") {
bindingName = id.name;
} else {
bindingName = undefined;
}
}
return loadHelper(name).build(getDependency, bindingName, localBindings, adjustAst);
}
function minVersion(name) {
return loadHelper(name).minVersion;
}
function getDependencies(name) {
return loadHelper(name).getDependencies();
}
function isInternal(name) {
var _helpers$name;
return (_helpers$name = _helpersGenerated.default[name]) == null ? void 0 : _helpers$name.metadata.internal;
}
exports.ensure = name => {
loadHelper(name);
};
const list = exports.list = Object.keys(_helpersGenerated.default).map(name => name.replace(/^_/, ""));
var _default = exports.default = get;
//# sourceMappingURL=index.js.map
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const CaseUpper = createLucideIcon("CaseUpper", [
["path", { d: "m3 15 4-8 4 8", key: "1vwr6u" }],
["path", { d: "M4 13h6", key: "1r9ots" }],
["path", { d: "M15 11h4.5a2 2 0 0 1 0 4H15V7h4a2 2 0 0 1 0 4", key: "1sqfas" }]
]);
export { CaseUpper as default };
//# sourceMappingURL=case-upper.js.map
@@ -0,0 +1,2 @@
import type Ajv from "../../core";
export default function addMetaSchema2019(this: Ajv, $data?: boolean): Ajv;
@@ -0,0 +1 @@
{"version":3,"file":"cake.js","sources":["../../../src/icons/cake.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Cake\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjAgMjF2LThhMiAyIDAgMCAwLTItMkg2YTIgMiAwIDAgMC0yIDJ2OCIgLz4KICA8cGF0aCBkPSJNNCAxNnMuNS0xIDItMSAyLjUgMiA0IDIgMi41LTIgNC0yIDIuNSAyIDQgMiAyLTEgMi0xIiAvPgogIDxwYXRoIGQ9Ik0yIDIxaDIwIiAvPgogIDxwYXRoIGQ9Ik03IDh2MyIgLz4KICA8cGF0aCBkPSJNMTIgOHYzIiAvPgogIDxwYXRoIGQ9Ik0xNyA4djMiIC8+CiAgPHBhdGggZD0iTTcgNGguMDEiIC8+CiAgPHBhdGggZD0iTTEyIDRoLjAxIiAvPgogIDxwYXRoIGQ9Ik0xNyA0aC4wMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/cake\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 Cake = createLucideIcon('Cake', [\n ['path', { d: 'M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8', key: '1w3rig' }],\n ['path', { d: 'M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1', key: 'n2jgmb' }],\n ['path', { d: 'M2 21h20', key: '1nyx9w' }],\n ['path', { d: 'M7 8v3', key: '1qtyvj' }],\n ['path', { d: 'M12 8v3', key: 'hwp4zt' }],\n ['path', { d: 'M17 8v3', key: '1i6e5u' }],\n ['path', { d: 'M7 4h.01', key: '1bh4kh' }],\n ['path', { d: 'M12 4h.01', key: '1ujb9j' }],\n ['path', { d: 'M17 4h.01', key: '1upcoc' }],\n]);\n\nexport default Cake;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,iBAAiB,MAAQ,CAAA,CAAA,CAAA;AAAA,CAAA,CACpC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA6C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC5C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,7 @@
{
"type": "module",
"main": "./index.cjs",
"module": "./index.js",
"types": "./index.d.cts",
"sideEffects": false
}
@@ -0,0 +1 @@
module.exports={A:{A:{"132":"_E"},B:{"1":"_pH _i","2":"_I","292":"_xD _vH"},C:{"1":"_qR","2":"_rL","3138":"IC"},D:{"1":"_pH _l","292":"_xD _xG"},E:{"1":"K _jM _sT","16":"_4","292":"_fJ _UD _lL _5Q"},F:{"1":"_UL _h","2":"_T","292":"_MC _IK"},G:{"1":"_jM _fL","2":"_nN _nK _5Q","16":"_r","292":"gD","804":"_vJ _4K"},H:{"2":"1D"},I:{"16":"_m","292":"_SB"},J:{"292":"_B"},K:{"2":"_D","292":"H"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"292":"bC"},P:{"1":"_NB","292":"_JM"},Q:{"292":"JE"},R:{"292":"KE"},S:{"2":"_C"}},B:4,C:"CSS scrollbar styling",D:true};
@@ -0,0 +1 @@
{"version":3,"names":["_isType","require","_index","isImmutable","node","isType","type","isIdentifier","name"],"sources":["../../src/validators/isImmutable.ts"],"sourcesContent":["import isType from \"./isType.ts\";\nimport { isIdentifier } from \"./generated/index.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * Check if the input `node` is definitely immutable.\n */\nexport default function isImmutable(node: t.Node): boolean {\n if (isType(node.type, \"Immutable\")) return true;\n\n if (isIdentifier(node)) {\n if (node.name === \"undefined\") {\n // immutable!\n return true;\n } else {\n // no idea...\n return false;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAMe,SAASE,WAAWA,CAACC,IAAY,EAAW;EACzD,IAAI,IAAAC,eAAM,EAACD,IAAI,CAACE,IAAI,EAAE,WAAW,CAAC,EAAE,OAAO,IAAI;EAE/C,IAAI,IAAAC,mBAAY,EAACH,IAAI,CAAC,EAAE;IACtB,IAAIA,IAAI,CAACI,IAAI,KAAK,WAAW,EAAE;MAE7B,OAAO,IAAI;IACb,CAAC,MAAM;MAEL,OAAO,KAAK;IACd;EACF;EAEA,OAAO,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,16 @@
<!doctype html>
<html>
<head>
<title>Attributes test</title>
</head>
<body>
<!-- Normal attributes -->
<button id="test0" class="value0" title="value1">class="value0" title="value1"</button>
<!-- Attributes with no quotes or value -->
<button id="test1" class=value2 disabled>class=value2 disabled</button>
<!-- Attributes with no space between them. No valid, but accepted by the browser -->
<button id="test2" class="value4"title="value5">class="value4"title="value5"</button>
</body>
</html>
@@ -0,0 +1 @@
{"version":3,"file":"user-search.js","sources":["../../../src/icons/user-search.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name UserSearch\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMCIgY3k9IjciIHI9IjQiIC8+CiAgPHBhdGggZD0iTTEwLjMgMTVIN2E0IDQgMCAwIDAtNCA0djIiIC8+CiAgPGNpcmNsZSBjeD0iMTciIGN5PSIxNyIgcj0iMyIgLz4KICA8cGF0aCBkPSJtMjEgMjEtMS45LTEuOSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/user-search\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 UserSearch = createLucideIcon('UserSearch', [\n ['circle', { cx: '10', cy: '7', r: '4', key: 'e45bow' }],\n ['path', { d: 'M10.3 15H7a4 4 0 0 0-4 4v2', key: '3bnktk' }],\n ['circle', { cx: '17', cy: '17', r: '3', key: '18b49y' }],\n ['path', { d: 'm21 21-1.9-1.9', key: '1g2n9r' }],\n]);\n\nexport default U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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACjD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,12 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
Object.defineProperty(exports, "__esModule", { value: true });
exports.es2018_intl = void 0;
const base_config_1 = require("./base-config");
exports.es2018_intl = {
libs: [],
variables: [['Intl', base_config_1.TYPE_VALUE]],
};
@@ -0,0 +1,27 @@
# PostCSS
<img align="right" width="95" height="95"
alt="Philosopher’s stone, logo of PostCSS"
src="https://postcss.org/logo.svg">
PostCSS is a tool for transforming styles with JS plugins.
These plugins can lint your CSS, support variables and mixins,
transpile future CSS syntax, inline images, and more.
PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba,
and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins are some of the most popular CSS tools.
---
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" />  PostCSS is built by <b><a href="https://evilmartians.com/">Evil Martians</a></b>, an American design and engineering consultancy for <b>developer tools, AI, and cybersecurity startups</b>.
---
[Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree
[Evil Martians]: https://evilmartians.com/?utm_source=postcss
[Autoprefixer]: https://github.com/postcss/autoprefixer
[Stylelint]: https://stylelint.io/
[plugins]: https://github.com/postcss/postcss#plugins
## Docs
Read full docs **[here](https://postcss.org/)**.
@@ -0,0 +1,852 @@
/*
Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import estraverse from "estraverse";
import Reference from "./reference.js";
import Variable from "./variable.js";
import { Definition } from "./definition.js";
import { assert } from "./assert.js";
/** @import * as types from "eslint-scope" */
/** @import ESTree from "estree" */
/** @import ScopeManager from "./scope-manager.js" */
/** @typedef {ESTree.Function | ESTree.Program | ESTree.StaticBlock} Block */
/** @typedef {{pattern: unknown, node: unknown}} MaybeImplicitGlobal */
const { Syntax } = estraverse;
/**
* Test if scope is struct
* @param {Scope} scope scope
* @param {Block} block block
* @param {boolean} isMethodDefinition is method definition
* @returns {boolean} is strict scope
*/
function isStrictScope(scope, block, isMethodDefinition) {
let body;
// When upper scope is exists and strict, inner scope is also strict.
if (scope.upper && scope.upper.isStrict) {
return true;
}
if (isMethodDefinition) {
return true;
}
if (scope.type === "class" || scope.type === "module") {
return true;
}
if (scope.type === "block" || scope.type === "switch") {
return false;
}
if (scope.type === "function") {
if (
block.type === Syntax.ArrowFunctionExpression &&
// @ts-ignore -- when block is ArrowFunctionExpression
block.body.type !== Syntax.BlockStatement
) {
return false;
}
if (block.type === Syntax.Program) {
body = block;
} else {
body = block.body;
}
if (!body) {
return false;
}
} else if (scope.type === "global") {
body = block;
} else {
return false;
}
// Search for a 'use strict' directive.
// @ts-ignore -- body is a function body
for (let i = 0, iz = body.body.length; i < iz; ++i) {
// @ts-ignore -- body is a function body
const stmt = body.body[i];
/*
* Check if the current statement is a directive.
* If it isn't, then we're past the directive prologue
* so stop the search because directives cannot
* appear after this point.
*
* Some parsers set `directive:null` on non-directive
* statements, so the `typeof` check is safer than
* checking for property existence.
*/
if (typeof stmt.directive !== "string") {
break;
}
if (stmt.directive === "use strict") {
return true;
}
}
return false;
}
/**
* Register scope
* @param {ScopeManager} scopeManager scope manager
* @param {Scope} scope scope
* @returns {void}
*/
function registerScope(scopeManager, scope) {
scopeManager.scopes.push(scope);
const scopes = scopeManager.__nodeToScope.get(scope.block);
if (scopes) {
scopes.push(scope);
} else {
scopeManager.__nodeToScope.set(scope.block, [scope]);
}
}
/**
* @constructor Scope
* @implements {types.Scope}
*/
class Scope {
constructor(scopeManager, type, upperScope, block, isMethodDefinition) {
/**
* One of "global", "module", "function", "function-expression-name", "block", "switch", "catch", "with", "for",
* "class", "class-field-initializer", "class-static-block".
* @member {string} Scope#type
*/
this.type = type;
/**
* The scoped {@link Variable}s of this scope, as <code>{ Variable.name
* : Variable }</code>.
* @member {Map} Scope#set
*/
this.set = new Map();
/**
* The tainted variables of this scope, as <code>{ Variable.name :
* boolean }</code>.
* @member {Map} Scope#taints
*/
this.taints = new Map();
/**
* Generally, through the lexical scoping of JS you can always know
* which variable an identifier in the source code refers to. There are
* a few exceptions to this rule. With 'global' and 'with' scopes you
* can only decide at runtime which variable a reference refers to.
* Moreover, if 'eval()' is used in a scope, it might introduce new
* bindings in this or its parent scopes.
* All those scopes are considered 'dynamic'.
* @member {boolean} Scope#dynamic
*/
this.dynamic = this.type === "global" || this.type === "with";
/**
* A reference to the scope-defining syntax node.
* @member {espree.Node} Scope#block
*/
this.block = block;
/**
* The {@link Reference|references} that are not resolved with this scope.
* @member {Reference[]} Scope#through
*/
this.through = [];
/**
* The scoped {@link Variable}s of this scope. In the case of a
* 'function' scope this includes the automatic argument <em>arguments</em> as
* its first element, as well as all further formal arguments.
* @member {Variable[]} Scope#variables
*/
this.variables = [];
/**
* Any variable {@link Reference|reference} found in this scope. This
* includes occurrences of local variables as well as variables from
* parent scopes (including the global scope). For local variables
* this also includes defining occurrences (like in a 'var' statement).
* In a 'function' scope this does not include the occurrences of the
* formal parameter in the parameter list.
* @member {Reference[]} Scope#references
*/
this.references = [];
/**
* For 'global' and 'function' scopes, this is a self-reference. For
* other scope types this is the <em>variableScope</em> value of the
* parent scope.
* @member {Scope} Scope#variableScope
*/
this.variableScope =
this.type === "global" ||
this.type === "module" ||
this.type === "function" ||
this.type === "class-field-initializer" ||
this.type === "class-static-block"
? this
: upperScope.variableScope;
/**
* Whether this scope is created by a FunctionExpression.
* @member {boolean} Scope#functionExpressionScope
*/
this.functionExpressionScope = /** @type {any} */ (false);
/**
* Whether this is a scope that contains an 'eval()' invocation.
* @member {boolean} Scope#directCallToEvalScope
*/
this.directCallToEvalScope = false;
/**
* @member {boolean} Scope#thisFound
*/
this.thisFound = false;
/** @type {?Reference[]} */
this.__left = [];
/**
* Reference to the parent {@link Scope|scope}.
* @member {Scope} Scope#upper
*/
this.upper = upperScope;
/**
* Whether 'use strict' is in effect in this scope.
* @member {boolean} Scope#isStrict
*/
this.isStrict = scopeManager.isStrictModeSupported()
? isStrictScope(this, block, isMethodDefinition)
: false;
/**
* List of nested {@link Scope}s.
* @member {Scope[]} Scope#childScopes
*/
this.childScopes = [];
if (this.upper) {
this.upper.childScopes.push(this);
}
this.__declaredVariables = scopeManager.__declaredVariables;
registerScope(scopeManager, this);
}
__shouldStaticallyClose(scopeManager) {
return (
!this.dynamic ||
scopeManager.__isOptimistic() ||
this.type === "global"
);
}
__staticCloseRef(ref) {
if (!this.__resolve(ref)) {
this.__delegateToUpperScope(ref);
}
}
__dynamicCloseRef(ref) {
// notify all names are through to global
let current = this;
do {
current.through.push(ref);
current = current.upper;
} while (current);
}
__close(scopeManager) {
let closeRef;
if (this.__shouldStaticallyClose(scopeManager)) {
closeRef = this.__staticCloseRef;
} else {
closeRef = this.__dynamicCloseRef;
}
// Try Resolving all references in this scope.
// @ts-ignore -- __left should be an array here
for (let i = 0, iz = this.__left.length; i < iz; ++i) {
// @ts-ignore -- __left should be an array here
const ref = this.__left[i];
closeRef.call(this, ref);
}
this.__left = null;
return this.upper;
}
// To override by function scopes.
// References in default parameters isn't resolved to variables which are in their function body.
// eslint-disable-next-line class-methods-use-this, no-unused-vars -- Desired as instance method with signature
__isValidResolution(ref, variable) {
return true;
}
__resolve(ref) {
const name = ref.identifier.name;
if (!this.set.has(name)) {
return false;
}
const variable = this.set.get(name);
if (!this.__isValidResolution(ref, variable)) {
return false;
}
variable.references.push(ref);
variable.stack =
variable.stack && ref.from.variableScope === this.variableScope;
if (ref.tainted) {
variable.tainted = true;
this.taints.set(variable.name, true);
}
ref.resolved = variable;
return true;
}
__delegateToUpperScope(ref) {
if (this.upper) {
this.upper.__left.push(ref);
}
this.through.push(ref);
}
__addDeclaredVariablesOfNode(variable, node) {
if (node === null || node === void 0) {
return;
}
let variables = this.__declaredVariables.get(node);
if (variables === null || variables === void 0) {
variables = [];
this.__declaredVariables.set(node, variables);
}
if (!variables.includes(variable)) {
variables.push(variable);
}
}
__defineGeneric(name, set, variables, node, def) {
let variable;
variable = set.get(name);
if (!variable) {
variable = new Variable(name, this);
set.set(name, variable);
variables.push(variable);
}
if (def) {
variable.defs.push(def);
this.__addDeclaredVariablesOfNode(variable, def.node);
this.__addDeclaredVariablesOfNode(variable, def.parent);
}
if (node) {
variable.identifiers.push(node);
}
}
__define(node, def) {
if (node && node.type === Syntax.Identifier) {
this.__defineGeneric(
node.name,
this.set,
this.variables,
node,
def,
);
}
}
__referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) {
// because Array element may be null
if (
!node ||
(node.type !== Syntax.Identifier && node.type !== "JSXIdentifier")
) {
return;
}
// Specially handle like `this`.
if (node.name === "super") {
return;
}
const ref = new Reference(
node,
this,
assign || Reference.READ,
writeExpr,
maybeImplicitGlobal,
!!partial,
!!init,
);
this.references.push(ref);
// @ts-ignore -- __left should be an array here
this.__left.push(ref);
}
__detectEval() {
let current = this;
this.directCallToEvalScope = true;
do {
current.dynamic = true;
current = current.upper;
} while (current);
}
__detectThis() {
this.thisFound = true;
}
__isClosed() {
return this.__left === null;
}
/**
* returns resolved {Reference}
* @function Scope#resolve
* @param {ESTree.Identifier} ident identifier to be resolved.
* @returns {?Reference} reference
*/
resolve(ident) {
let ref, i, iz;
assert(this.__isClosed(), "Scope should be closed.");
assert(
ident.type === Syntax.Identifier,
"Target should be identifier.",
);
for (i = 0, iz = this.references.length; i < iz; ++i) {
ref = this.references[i];
if (ref.identifier === ident) {
return ref;
}
}
return null;
}
/**
* returns this scope is static
* @function Scope#isStatic
* @returns {boolean} static
*/
isStatic() {
return !this.dynamic;
}
/**
* returns this scope has materialized arguments
* @function Scope#isArgumentsMaterialized
* @returns {any} arguments materialized
*/ // eslint-disable-next-line class-methods-use-this -- Desired as instance method
isArgumentsMaterialized() {
return true;
}
/**
* returns this scope has materialized `this` reference
* @function Scope#isThisMaterialized
* @returns {any} this materialized
*/ // eslint-disable-next-line class-methods-use-this -- Desired as instance method
isThisMaterialized() {
return true;
}
isUsedName(name) {
if (this.set.has(name)) {
return true;
}
for (let i = 0, iz = this.through.length; i < iz; ++i) {
if (this.through[i].identifier.name === name) {
return true;
}
}
return false;
}
}
/**
* Global scope.
* @implements {types.GlobalScope}
*/
class GlobalScope extends Scope {
constructor(scopeManager, block) {
super(scopeManager, "global", null, block, false);
this.implicit = {
set: new Map(),
/** @type {Variable[]} */
variables: [],
/**
* List of {@link Reference}s that are left to be resolved (i.e. which
* need to be linked to the variable they refer to).
* @member {Reference[]} Scope#implicit#left
* @type {Reference[]}
*/
left: [],
};
}
__close(scopeManager) {
const implicit = [];
// @ts-ignore -- __left should be an array here
for (let i = 0, iz = this.__left.length; i < iz; ++i) {
// @ts-ignore -- __left should be an array here
const ref = this.__left[i];
if (
ref.__maybeImplicitGlobal &&
!this.set.has(ref.identifier.name)
) {
implicit.push(ref.__maybeImplicitGlobal);
}
}
// create an implicit global variable from assignment expression
for (let i = 0, iz = implicit.length; i < iz; ++i) {
const info = implicit[i];
this.__defineImplicit(
info.pattern,
new Definition(
Variable.ImplicitGlobalVariable,
info.pattern,
info.node,
null,
null,
null,
),
);
}
super.__close(scopeManager);
this.implicit.left = [...this.through];
return null;
}
__defineImplicit(node, def) {
if (node && node.type === Syntax.Identifier) {
this.__defineGeneric(
node.name,
this.implicit.set,
this.implicit.variables,
node,
def,
);
}
}
__addVariables(names) {
for (const name of names) {
this.__defineGeneric(name, this.set, this.variables, null, null);
}
const namesSet = new Set(names);
this.through = this.through.filter(reference => {
const name = reference.identifier.name;
if (namesSet.has(name)) {
const variable = this.set.get(name);
reference.resolved = variable;
variable.references.push(reference);
return false;
}
return true;
});
this.implicit.variables = this.implicit.variables.filter(variable => {
const name = variable.name;
if (namesSet.has(name)) {
this.implicit.set.delete(name);
return false;
}
return true;
});
this.implicit.left = this.implicit.left.filter(
reference => !namesSet.has(reference.identifier.name),
);
}
}
/**
* Module scope.
* @implements {types.ModuleScope}
*/
class ModuleScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "module", upperScope, block, false);
}
}
/**
* Function expression name scope.
* @implements {types.FunctionExpressionNameScope}
*/
class FunctionExpressionNameScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(
scopeManager,
"function-expression-name",
upperScope,
block,
false,
);
this.__define(
block.id,
new Definition(
Variable.FunctionName,
block.id,
block,
null,
null,
null,
),
);
this.functionExpressionScope = /** @type {const} */ (true);
}
}
/**
* Catch scope.
* @implements {types.CatchScope}
*/
class CatchScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "catch", upperScope, block, false);
}
}
/**
* With statement scope.
* @implements {types.WithScope}
*/
class WithScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "with", upperScope, block, false);
}
__close(scopeManager) {
if (this.__shouldStaticallyClose(scopeManager)) {
return super.__close(scopeManager);
}
// @ts-ignore -- __left should be an array here
for (let i = 0, iz = this.__left.length; i < iz; ++i) {
// @ts-ignore -- __left should be an array here
const ref = this.__left[i];
ref.tainted = true;
this.__delegateToUpperScope(ref);
}
this.__left = null;
return this.upper;
}
}
/**
* Block scope.
* @implements {types.BlockScope}
*/
class BlockScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "block", upperScope, block, false);
}
}
/**
* Switch scope.
* @implements {types.SwitchScope}
*/
class SwitchScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "switch", upperScope, block, false);
}
}
/**
* Function scope.
* @implements {types.FunctionScope}
*/
class FunctionScope extends Scope {
constructor(scopeManager, upperScope, block, isMethodDefinition) {
super(scopeManager, "function", upperScope, block, isMethodDefinition);
// section 9.2.13, FunctionDeclarationInstantiation.
// NOTE Arrow functions never have an arguments objects.
if (this.block.type !== Syntax.ArrowFunctionExpression) {
this.__defineArguments();
}
}
isArgumentsMaterialized() {
// TODO(Constellation)
// We can more aggressive on this condition like this.
//
// function t() {
// // arguments of t is always hidden.
// function arguments() {
// }
// }
if (this.block.type === Syntax.ArrowFunctionExpression) {
return false;
}
if (!this.isStatic()) {
return true;
}
const variable = this.set.get("arguments");
assert(variable, "Always have arguments variable.");
return variable.tainted || variable.references.length !== 0;
}
isThisMaterialized() {
if (!this.isStatic()) {
return true;
}
return this.thisFound;
}
__defineArguments() {
this.__defineGeneric("arguments", this.set, this.variables, null, null);
this.taints.set("arguments", true);
}
// References in default parameters isn't resolved to variables which are in their function body.
// const x = 1
// function f(a = x) { // This `x` is resolved to the `x` in the outer scope.
// const x = 2
// console.log(a)
// }
__isValidResolution(ref, variable) {
// If `options.nodejsScope` is true, `this.block` becomes a Program node.
if (this.block.type === "Program") {
return true;
}
const bodyStart = this.block.body.range[0];
// It's invalid resolution in the following case:
return !(
variable.scope === this &&
ref.identifier.range[0] < bodyStart && // the reference is in the parameter part.
variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body.
);
}
}
/**
* Scope of for, for-in, and for-of statements.
* @implements {types.ForScope}
*/
class ForScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "for", upperScope, block, false);
}
}
/**
* Class scope.
* @implements {types.ClassScope}
*/
class ClassScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "class", upperScope, block, false);
}
}
/**
* Class field initializer scope.
* @implements {types.ClassFieldInitializerScope}
*/
class ClassFieldInitializerScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "class-field-initializer", upperScope, block, true);
}
}
/**
* Class static block scope.
* @implements {types.ClassStaticBlockScope}
*/
class ClassStaticBlockScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "class-static-block", upperScope, block, true);
}
}
export {
Scope,
GlobalScope,
ModuleScope,
FunctionExpressionNameScope,
CatchScope,
WithScope,
BlockScope,
SwitchScope,
FunctionScope,
ForScope,
ClassScope,
ClassFieldInitializerScope,
ClassStaticBlockScope,
};
/* vim: set sw=4 ts=4 et tw=80 : */
@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.rangeToLoc = rangeToLoc;
function rangeToLoc(sourceCode, range) {
return {
end: sourceCode.getLocFromIndex(range[1]),
start: sourceCode.getLocFromIndex(range[0]),
};
}
@@ -0,0 +1,156 @@
import { type CHash, type Hash, type TArg, type TRet } from './utils.ts';
/** Blake1 options. Basically just `salt`. */
export type BlakeOpts = {
/** Optional salt mixed into initialization. */
salt?: Uint8Array;
};
declare abstract class BLAKE1<T extends BLAKE1<T>> implements Hash<T> {
readonly canXOF = false;
protected finished: boolean;
protected length: number;
protected pos: number;
protected destroyed: boolean;
protected buffer: Uint8Array;
protected view: DataView;
protected salt: Uint32Array;
abstract compress(view: DataView, offset: number, withLength?: boolean): void;
protected abstract get(): number[];
protected abstract set(...args: number[]): void;
readonly blockLen: number;
readonly outputLen: number;
private lengthFlag;
private counterLen;
protected constants: Uint32Array;
constructor(blockLen: number, outputLen: number, lengthFlag: number, counterLen: number, saltLen: number, constants: Uint32Array, opts?: BlakeOpts);
update(data: TArg<Uint8Array>): this;
destroy(): void;
_cloneInto(to?: T): T;
clone(): T;
digestInto(out: TArg<Uint8Array>): void;
digest(): TRet<Uint8Array>;
}
declare class BLAKE1_32B extends BLAKE1<BLAKE1_32B> {
private v0;
private v1;
private v2;
private v3;
private v4;
private v5;
private v6;
private v7;
constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts?: BlakeOpts);
protected get(): [number, number, number, number, number, number, number, number];
protected set(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number): void;
destroy(): void;
compress(view: DataView, offset: number, withLength?: boolean): void;
}
declare class BLAKE1_64B extends BLAKE1<BLAKE1_64B> {
private v0l;
private v0h;
private v1l;
private v1h;
private v2l;
private v2h;
private v3l;
private v3h;
private v4l;
private v4h;
private v5l;
private v5h;
private v6l;
private v6h;
private v7l;
private v7h;
constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts?: BlakeOpts);
protected get(): [
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number
];
protected set(v0l: number, v0h: number, v1l: number, v1h: number, v2l: number, v2h: number, v3l: number, v3h: number, v4l: number, v4h: number, v5l: number, v5h: number, v6l: number, v6h: number, v7l: number, v7h: number): void;
destroy(): void;
compress(view: DataView, offset: number, withLength?: boolean): void;
}
/** Internal blake1-224 hash class. */
export declare class _BLAKE224 extends BLAKE1_32B {
constructor(opts?: BlakeOpts);
}
/** Internal blake1-256 hash class. */
export declare class _BLAKE256 extends BLAKE1_32B {
constructor(opts?: BlakeOpts);
}
/** Internal blake1-384 hash class. */
export declare class _BLAKE384 extends BLAKE1_64B {
constructor(opts?: BlakeOpts);
}
/** Internal blake1-512 hash class. */
export declare class _BLAKE512 extends BLAKE1_64B {
constructor(opts?: BlakeOpts);
}
/**
* Blake1-224 hash function.
* @param msg - message bytes to hash
* @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set,
* `opts.salt` must be exactly 16 bytes.
* @returns Digest bytes.
* @example
* Hash a message with Blake1-224.
* ```ts
* blake224(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const blake224: TRet<CHash<_BLAKE224, BlakeOpts>>;
/**
* Blake1-256 hash function.
* @param msg - message bytes to hash
* @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set,
* `opts.salt` must be exactly 16 bytes.
* @returns Digest bytes.
* @example
* Hash a message with Blake1-256.
* ```ts
* blake256(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const blake256: TRet<CHash<_BLAKE256, BlakeOpts>>;
/**
* Blake1-384 hash function.
* @param msg - message bytes to hash
* @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set,
* `opts.salt` must be exactly 32 bytes.
* @returns Digest bytes.
* @example
* Hash a message with Blake1-384.
* ```ts
* blake384(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const blake384: TRet<CHash<_BLAKE384, BlakeOpts>>;
/**
* Blake1-512 hash function.
* @param msg - message bytes to hash
* @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set,
* `opts.salt` must be exactly 32 bytes.
* @returns Digest bytes.
* @example
* Hash a message with Blake1-512.
* ```ts
* blake512(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const blake512: TRet<CHash<_BLAKE512, BlakeOpts>>;
export {};
//# sourceMappingURL=blake1.d.ts.map
@@ -0,0 +1,17 @@
//#region src/Matches.ts
/**
* Narrows matches based on a path
* @experimental
*/
const isMatch = (match, path) => {
const parts = path.split(".");
let part;
let i = 0;
let value = match;
while ((part = parts[i++]) != null && value != null) value = value[part];
return value != null;
};
//#endregion
exports.isMatch = isMatch;
//# sourceMappingURL=Matches.cjs.map
@@ -0,0 +1,48 @@
// @flow
declare type FilePath = string;
declare type GlobPattern = string;
export type BackendType =
| 'fs-events'
| 'watchman'
| 'inotify'
| 'windows'
| 'brute-force';
export type EventType = 'create' | 'update' | 'delete';
export interface Options {
ignore?: Array<FilePath | GlobPattern>,
backend?: BackendType
}
export type SubscribeCallback = (
err: ?Error,
events: Array<Event>
) => mixed;
export interface AsyncSubscription {
unsubscribe(): Promise<void>
}
export interface Event {
path: FilePath,
type: EventType
}
declare module.exports: {
getEventsSince(
dir: FilePath,
snapshot: FilePath,
opts?: Options
): Promise<Array<Event>>,
subscribe(
dir: FilePath,
fn: SubscribeCallback,
opts?: Options
): Promise<AsyncSubscription>,
unsubscribe(
dir: FilePath,
fn: SubscribeCallback,
opts?: Options
): Promise<void>,
writeSnapshot(
dir: FilePath,
snapshot: FilePath,
opts?: Options
): Promise<FilePath>
}
@@ -0,0 +1,296 @@
"use client";
import { useLayoutEffect } from "./utils.js";
import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";
import { ClientOnly } from "./ClientOnly.js";
import { matchContext } from "./matchContext.js";
import { useRouter } from "./useRouter.js";
import { CatchNotFound } from "./not-found.js";
import { SafeFragment } from "./SafeFragment.js";
import { renderRouteNotFound } from "./renderRouteNotFound.js";
import { ScrollRestoration } from "./scroll-restoration.js";
import { createControlledPromise, getLocationChangeInfo, invariant, isNotFound, isRedirect, rootRouteId } from "@tanstack/router-core";
import * as React$1 from "react";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import { useStore } from "@tanstack/react-store";
import { isServer } from "@tanstack/router-core/isServer";
//#region src/Match.tsx
var Match = React$1.memo(function MatchImpl({ matchId }) {
const router = useRouter();
if (isServer ?? router.isServer) {
const match = router.stores.matchStores.get(matchId)?.get();
if (!match) {
if (process.env.NODE_ENV !== "production") throw new Error(`Invariant failed: Could not find match for matchId "${matchId}". Please file an issue!`);
invariant();
}
const routeId = match.routeId;
const parentRouteId = router.routesById[routeId].parentRoute?.id;
return /* @__PURE__ */ jsx(MatchView, {
router,
matchId,
resetKey: router.stores.loadedAt.get(),
matchState: {
routeId,
ssr: match.ssr,
_displayPending: match._displayPending,
parentRouteId
}
});
}
const matchStore = router.stores.matchStores.get(matchId);
if (!matchStore) {
if (process.env.NODE_ENV !== "production") throw new Error(`Invariant failed: Could not find match for matchId "${matchId}". Please file an issue!`);
invariant();
}
const resetKey = useStore(router.stores.loadedAt, (loadedAt) => loadedAt);
const match = useStore(matchStore, (value) => value);
return /* @__PURE__ */ jsx(MatchView, {
router,
matchId,
resetKey,
matchState: React$1.useMemo(() => {
const routeId = match.routeId;
const parentRouteId = router.routesById[routeId].parentRoute?.id;
return {
routeId,
ssr: match.ssr,
_displayPending: match._displayPending,
parentRouteId
};
}, [
match._displayPending,
match.routeId,
match.ssr,
router.routesById
])
});
});
function MatchView({ router, matchId, resetKey, matchState }) {
const route = router.routesById[matchState.routeId];
const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent;
const pendingElement = PendingComponent ? /* @__PURE__ */ jsx(PendingComponent, {}) : null;
const routeErrorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent;
const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch;
const routeNotFoundComponent = route.isRoot ? route.options.notFoundComponent ?? router.options.notFoundRoute?.options.component : route.options.notFoundComponent;
const resolvedNoSsr = matchState.ssr === false || matchState.ssr === "data-only";
const ResolvedSuspenseBoundary = (!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) && (route.options.wrapInSuspense ?? PendingComponent ?? (route.options.errorComponent?.preload || resolvedNoSsr)) ? React$1.Suspense : SafeFragment;
const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
const ResolvedNotFoundBoundary = routeNotFoundComponent ? CatchNotFound : SafeFragment;
return /* @__PURE__ */ jsxs(route.isRoot ? route.options.shellComponent ?? SafeFragment : SafeFragment, { children: [/* @__PURE__ */ jsx(matchContext.Provider, {
value: matchId,
children: /* @__PURE__ */ jsx(ResolvedSuspenseBoundary, {
fallback: pendingElement,
children: /* @__PURE__ */ jsx(ResolvedCatchBoundary, {
getResetKey: () => resetKey,
errorComponent: routeErrorComponent || ErrorComponent,
onCatch: (error, errorInfo) => {
if (isNotFound(error)) {
error.routeId ??= matchState.routeId;
throw error;
}
if (process.env.NODE_ENV !== "production") console.warn(`Warning: Error in route match: ${matchId}`);
routeOnCatch?.(error, errorInfo);
},
children: /* @__PURE__ */ jsx(ResolvedNotFoundBoundary, {
fallback: (error) => {
error.routeId ??= matchState.routeId;
if (!routeNotFoundComponent || error.routeId && error.routeId !== matchState.routeId || !error.routeId && !route.isRoot) throw error;
return React$1.createElement(routeNotFoundComponent, error);
},
children: resolvedNoSsr || matchState._displayPending ? /* @__PURE__ */ jsx(ClientOnly, {
fallback: pendingElement,
children: /* @__PURE__ */ jsx(MatchInner, { matchId })
}) : /* @__PURE__ */ jsx(MatchInner, { matchId })
})
})
})
}), matchState.parentRouteId === rootRouteId ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(OnRendered, { resetKey }), router.options.scrollRestoration && (isServer ?? router.isServer) ? /* @__PURE__ */ jsx(ScrollRestoration, {}) : null] }) : null] });
}
function OnRendered({ resetKey }) {
const router = useRouter();
if (isServer ?? router.isServer) return null;
const prevHrefRef = React$1.useRef(void 0);
useLayoutEffect(() => {
const currentHref = router.latestLocation.href;
if (prevHrefRef.current === void 0 || prevHrefRef.current !== currentHref) {
router.emit({
type: "onRendered",
...getLocationChangeInfo(router.stores.location.get(), router.stores.resolvedLocation.get())
});
prevHrefRef.current = currentHref;
}
}, [
router.latestLocation.state.__TSR_key,
resetKey,
router
]);
return null;
}
var MatchInner = React$1.memo(function MatchInnerImpl({ matchId }) {
const router = useRouter();
const getMatchPromise = (match, key) => {
return router.getMatch(match.id)?._nonReactive[key] ?? match._nonReactive[key];
};
if (isServer ?? router.isServer) {
const match = router.stores.matchStores.get(matchId)?.get();
if (!match) {
if (process.env.NODE_ENV !== "production") throw new Error(`Invariant failed: Could not find match for matchId "${matchId}". Please file an issue!`);
invariant();
}
const routeId = match.routeId;
const route = router.routesById[routeId];
const remountDeps = (router.routesById[routeId].options.remountDeps ?? router.options.defaultRemountDeps)?.({
routeId,
loaderDeps: match.loaderDeps,
params: match._strictParams,
search: match._strictSearch
});
const key = remountDeps ? JSON.stringify(remountDeps) : void 0;
const Comp = route.options.component ?? router.options.defaultComponent;
const out = Comp ? /* @__PURE__ */ jsx(Comp, {}, key) : /* @__PURE__ */ jsx(Outlet, {});
if (match._displayPending) throw getMatchPromise(match, "displayPendingPromise");
if (match._forcePending) throw getMatchPromise(match, "minPendingPromise");
if (match.status === "pending") throw getMatchPromise(match, "loadPromise");
if (match.status === "notFound") {
if (!isNotFound(match.error)) {
if (process.env.NODE_ENV !== "production") throw new Error("Invariant failed: Expected a notFound error");
invariant();
}
return renderRouteNotFound(router, route, match.error);
}
if (match.status === "redirected") {
if (!isRedirect(match.error)) {
if (process.env.NODE_ENV !== "production") throw new Error("Invariant failed: Expected a redirect error");
invariant();
}
throw getMatchPromise(match, "loadPromise");
}
if (match.status === "error") return /* @__PURE__ */ jsx((route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
error: match.error,
reset: void 0,
info: { componentStack: "" }
});
return out;
}
const matchStore = router.stores.matchStores.get(matchId);
if (!matchStore) {
if (process.env.NODE_ENV !== "production") throw new Error(`Invariant failed: Could not find match for matchId "${matchId}". Please file an issue!`);
invariant();
}
const match = useStore(matchStore, (value) => value);
const routeId = match.routeId;
const route = router.routesById[routeId];
const key = React$1.useMemo(() => {
const remountDeps = (router.routesById[routeId].options.remountDeps ?? router.options.defaultRemountDeps)?.({
routeId,
loaderDeps: match.loaderDeps,
params: match._strictParams,
search: match._strictSearch
});
return remountDeps ? JSON.stringify(remountDeps) : void 0;
}, [
routeId,
match.loaderDeps,
match._strictParams,
match._strictSearch,
router.options.defaultRemountDeps,
router.routesById
]);
const out = React$1.useMemo(() => {
const Comp = route.options.component ?? router.options.defaultComponent;
if (Comp) return /* @__PURE__ */ jsx(Comp, {}, key);
return /* @__PURE__ */ jsx(Outlet, {});
}, [
key,
route.options.component,
router.options.defaultComponent
]);
if (match._displayPending) throw getMatchPromise(match, "displayPendingPromise");
if (match._forcePending) throw getMatchPromise(match, "minPendingPromise");
if (match.status === "pending") {
const pendingMinMs = route.options.pendingMinMs ?? router.options.defaultPendingMinMs;
if (pendingMinMs) {
const routerMatch = router.getMatch(match.id);
if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {
if (!(isServer ?? router.isServer)) {
const minPendingPromise = createControlledPromise();
routerMatch._nonReactive.minPendingPromise = minPendingPromise;
setTimeout(() => {
minPendingPromise.resolve();
routerMatch._nonReactive.minPendingPromise = void 0;
}, pendingMinMs);
}
}
}
throw getMatchPromise(match, "loadPromise");
}
if (match.status === "notFound") {
if (!isNotFound(match.error)) {
if (process.env.NODE_ENV !== "production") throw new Error("Invariant failed: Expected a notFound error");
invariant();
}
return renderRouteNotFound(router, route, match.error);
}
if (match.status === "redirected") {
if (!isRedirect(match.error)) {
if (process.env.NODE_ENV !== "production") throw new Error("Invariant failed: Expected a redirect error");
invariant();
}
throw getMatchPromise(match, "loadPromise");
}
if (match.status === "error") {
if (isServer ?? router.isServer) return /* @__PURE__ */ jsx((route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
error: match.error,
reset: void 0,
info: { componentStack: "" }
});
throw match.error;
}
return out;
});
/**
* Render the next child match in the route tree. Typically used inside
* a route component to render nested routes.
*
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent
*/
var Outlet = React$1.memo(function OutletImpl() {
const router = useRouter();
const matchId = React$1.useContext(matchContext);
let routeId;
let parentGlobalNotFound = false;
let childMatchId;
if (isServer ?? router.isServer) {
const matches = router.stores.matches.get();
const parentIndex = matchId ? matches.findIndex((match) => match.id === matchId) : -1;
const parentMatch = parentIndex >= 0 ? matches[parentIndex] : void 0;
routeId = parentMatch?.routeId;
parentGlobalNotFound = parentMatch?.globalNotFound ?? false;
childMatchId = parentIndex >= 0 ? matches[parentIndex + 1]?.id : void 0;
} else {
const parentMatchStore = matchId ? router.stores.matchStores.get(matchId) : void 0;
[routeId, parentGlobalNotFound] = useStore(parentMatchStore, (match) => [match?.routeId, match?.globalNotFound ?? false]);
childMatchId = useStore(router.stores.matchesId, (ids) => {
return ids[ids.findIndex((id) => id === matchId) + 1];
});
}
const route = routeId ? router.routesById[routeId] : void 0;
const pendingElement = router.options.defaultPendingComponent ? /* @__PURE__ */ jsx(router.options.defaultPendingComponent, {}) : null;
if (parentGlobalNotFound) {
if (!route) {
if (process.env.NODE_ENV !== "production") throw new Error("Invariant failed: Could not resolve route for Outlet render");
invariant();
}
return renderRouteNotFound(router, route, void 0);
}
if (!childMatchId) return null;
const nextMatch = /* @__PURE__ */ jsx(Match, { matchId: childMatchId });
if (routeId === rootRouteId) return /* @__PURE__ */ jsx(React$1.Suspense, {
fallback: pendingElement,
children: nextMatch
});
return nextMatch;
});
//#endregion
export { Match, Outlet };
//# sourceMappingURL=Match.js.map
@@ -0,0 +1,109 @@
import { getErrorMap } from "../errors.js";
import defaultErrorMap from "../locales/en.js";
export const makeIssue = (params) => {
const { data, path, errorMaps, issueData } = params;
const fullPath = [...path, ...(issueData.path || [])];
const fullIssue = {
...issueData,
path: fullPath,
};
if (issueData.message !== undefined) {
return {
...issueData,
path: fullPath,
message: issueData.message,
};
}
let errorMessage = "";
const maps = errorMaps
.filter((m) => !!m)
.slice()
.reverse();
for (const map of maps) {
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
}
return {
...issueData,
path: fullPath,
message: errorMessage,
};
};
export const EMPTY_PATH = [];
export function addIssueToContext(ctx, issueData) {
const overrideMap = getErrorMap();
const issue = makeIssue({
issueData: issueData,
data: ctx.data,
path: ctx.path,
errorMaps: [
ctx.common.contextualErrorMap, // contextual error map is first priority
ctx.schemaErrorMap, // then schema-bound map if available
overrideMap, // then global override map
overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map
].filter((x) => !!x),
});
ctx.common.issues.push(issue);
}
export class ParseStatus {
constructor() {
this.value = "valid";
}
dirty() {
if (this.value === "valid")
this.value = "dirty";
}
abort() {
if (this.value !== "aborted")
this.value = "aborted";
}
static mergeArray(status, results) {
const arrayValue = [];
for (const s of results) {
if (s.status === "aborted")
return INVALID;
if (s.status === "dirty")
status.dirty();
arrayValue.push(s.value);
}
return { status: status.value, value: arrayValue };
}
static async mergeObjectAsync(status, pairs) {
const syncPairs = [];
for (const pair of pairs) {
const key = await pair.key;
const value = await pair.value;
syncPairs.push({
key,
value,
});
}
return ParseStatus.mergeObjectSync(status, syncPairs);
}
static mergeObjectSync(status, pairs) {
const finalObject = {};
for (const pair of pairs) {
const { key, value } = pair;
if (key.status === "aborted")
return INVALID;
if (value.status === "aborted")
return INVALID;
if (key.status === "dirty")
status.dirty();
if (value.status === "dirty")
status.dirty();
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
finalObject[key.value] = value.value;
}
}
return { status: status.value, value: finalObject };
}
}
export const INVALID = Object.freeze({
status: "aborted",
});
export const DIRTY = (value) => ({ status: "dirty", value });
export const OK = (value) => ({ status: "valid", value });
export const isAborted = (x) => x.status === "aborted";
export const isDirty = (x) => x.status === "dirty";
export const isValid = (x) => x.status === "valid";
export const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
@@ -0,0 +1,50 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_router = require("../../router.js");
//#region src/router/smart-router/router.ts
var SmartRouter = class {
name = "SmartRouter";
#routers = [];
#routes = [];
constructor(init) {
this.#routers = init.routers;
}
add(method, path, handler) {
if (!this.#routes) throw new Error(require_router.MESSAGE_MATCHER_IS_ALREADY_BUILT);
this.#routes.push([
method,
path,
handler
]);
}
match(method, path) {
if (!this.#routes) throw new Error("Fatal error");
const routers = this.#routers;
const routes = this.#routes;
const len = routers.length;
let i = 0;
let res;
for (; i < len; i++) {
const router = routers[i];
try {
for (let i = 0, len = routes.length; i < len; i++) router.add(...routes[i]);
res = router.match(method, path);
} catch (e) {
if (e instanceof require_router.UnsupportedPathError) continue;
throw e;
}
this.match = router.match.bind(router);
this.#routers = [router];
this.#routes = void 0;
break;
}
if (i === len) throw new Error("Fatal error");
this.name = `SmartRouter + ${this.activeRouter.name}`;
return res;
}
get activeRouter() {
if (this.#routes || this.#routers.length !== 1) throw new Error("No active router has been determined yet.");
return this.#routers[0];
}
};
//#endregion
exports.SmartRouter = SmartRouter;
@@ -0,0 +1,13 @@
import * as React from 'react';
interface FocusGuardsProps {
children?: React.ReactNode;
}
declare function FocusGuards(props: FocusGuardsProps): React.ReactNode;
/**
* Injects a pair of focus guards at the edges of the whole DOM tree
* to ensure `focusin` & `focusout` events can be caught consistently.
*/
declare function useFocusGuards(): void;
export { FocusGuards, FocusGuards as Root, useFocusGuards };
@@ -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 X = createLucideIcon("X", [
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
]);
export { X as default };
//# sourceMappingURL=x.js.map
@@ -0,0 +1,12 @@
/**
* Simple interactive task server demonstrating elicitation and sampling.
*
* This server demonstrates the task message queue pattern from the MCP Tasks spec:
* - confirm_delete: Uses elicitation to ask the user for confirmation
* - write_haiku: Uses sampling to request an LLM to generate content
*
* Both tools use the "call-now, fetch-later" pattern where the initial call
* creates a task, and the result is fetched via tasks/result endpoint.
*/
export {};
//# sourceMappingURL=simpleTaskInteractive.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"philippine-peso.js","sources":["../../../src/icons/philippine-peso.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name PhilippinePeso\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjAgMTFINCIgLz4KICA8cGF0aCBkPSJNMjAgN0g0IiAvPgogIDxwYXRoIGQ9Ik03IDIxVjRhMSAxIDAgMCAxIDEtMWg0YTEgMSAwIDAgMSAwIDEySDciIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/philippine-peso\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 PhilippinePeso = createLucideIcon('PhilippinePeso', [\n ['path', { d: 'M20 11H4', key: '6ut86h' }],\n ['path', { d: 'M20 7H4', key: 'zbl0bi' }],\n ['path', { d: 'M7 21V4a1 1 0 0 1 1-1h4a1 1 0 0 1 0 12H7', key: '1ana5r' }],\n]);\n\nexport default PhilippinePeso;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,iBAAiB,gBAAkB,CAAA,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3E,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,431 @@
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
import { util } from "../helpers/util.js";
const Test = z.object({
f1: z.number(),
f2: z.string().optional(),
f3: z.string().nullable(),
f4: z.array(z.object({ t: z.union([z.string(), z.boolean()]) })),
});
test("object type inference", () => {
type TestType = {
f1: number;
f2?: string | undefined;
f3: string | null;
f4: { t: string | boolean }[];
};
util.assertEqual<z.TypeOf<typeof Test>, TestType>(true);
});
test("unknown throw", () => {
const asdf: unknown = 35;
expect(() => Test.parse(asdf)).toThrow();
});
test("shape() should return schema of particular key", () => {
const f1Schema = Test.shape.f1;
const f2Schema = Test.shape.f2;
const f3Schema = Test.shape.f3;
const f4Schema = Test.shape.f4;
expect(f1Schema).toBeInstanceOf(z.ZodNumber);
expect(f2Schema).toBeInstanceOf(z.ZodOptional);
expect(f3Schema).toBeInstanceOf(z.ZodNullable);
expect(f4Schema).toBeInstanceOf(z.ZodArray);
});
test("correct parsing", () => {
Test.parse({
f1: 12,
f2: "string",
f3: "string",
f4: [
{
t: "string",
},
],
});
Test.parse({
f1: 12,
f3: null,
f4: [
{
t: false,
},
],
});
});
test("incorrect #1", () => {
expect(() => Test.parse({} as any)).toThrow();
});
test("nonstrict by default", () => {
z.object({ points: z.number() }).parse({
points: 2314,
unknown: "asdf",
});
});
const data = {
points: 2314,
unknown: "asdf",
};
test("strip by default", () => {
const val = z.object({ points: z.number() }).parse(data);
expect(val).toEqual({ points: 2314 });
});
test("unknownkeys override", () => {
const val = z.object({ points: z.number() }).strict().passthrough().strip().nonstrict().parse(data);
expect(val).toEqual(data);
});
test("passthrough unknown", () => {
const val = z.object({ points: z.number() }).passthrough().parse(data);
expect(val).toEqual(data);
});
test("strip unknown", () => {
const val = z.object({ points: z.number() }).strip().parse(data);
expect(val).toEqual({ points: 2314 });
});
test("strict", () => {
const val = z.object({ points: z.number() }).strict().safeParse(data);
expect(val.success).toEqual(false);
});
test("catchall inference", () => {
const o1 = z
.object({
first: z.string(),
})
.catchall(z.number());
const d1 = o1.parse({ first: "asdf", num: 1243 });
util.assertEqual<number, (typeof d1)["asdf"]>(true);
util.assertEqual<string, (typeof d1)["first"]>(true);
});
test("catchall overrides strict", () => {
const o1 = z.object({ first: z.string().optional() }).strict().catchall(z.number());
// should run fine setting a catchall overrides the unknownKeys behavior
o1.parse({
asdf: 1234,
});
// should only run catchall validation against unknown keys
o1.parse({
first: "asdf",
asdf: 1234,
});
});
test("catchall overrides strict", () => {
const o1 = z
.object({
first: z.string(),
})
.strict()
.catchall(z.number());
// should run fine setting a catchall overrides the unknownKeys behavior
o1.parse({
first: "asdf",
asdf: 1234,
});
});
test("test that optional keys are unset", () => {
const SNamedEntity = z.object({
id: z.string(),
set: z.string().optional(),
unset: z.string().optional(),
});
const result = SNamedEntity.parse({
id: "asdf",
set: undefined,
});
// eslint-disable-next-line ban/ban
expect(Object.keys(result)).toEqual(["id", "set"]);
});
test("test catchall parsing", async () => {
const result = z.object({ name: z.string() }).catchall(z.number()).parse({ name: "Foo", validExtraKey: 61 });
expect(result).toEqual({ name: "Foo", validExtraKey: 61 });
const result2 = z
.object({ name: z.string() })
.catchall(z.number())
.safeParse({ name: "Foo", validExtraKey: 61, invalid: "asdf" });
expect(result2.success).toEqual(false);
});
test("test nonexistent keys", async () => {
const Schema = z.union([z.object({ a: z.string() }), z.object({ b: z.number() })]);
const obj = { a: "A" };
const result = await Schema.spa(obj); // Works with 1.11.10, breaks with 2.0.0-beta.21
expect(result.success).toBe(true);
});
test("test async union", async () => {
const Schema2 = z.union([
z.object({
ty: z.string(),
}),
z.object({
ty: z.number(),
}),
]);
const obj = { ty: "A" };
const result = await Schema2.spa(obj); // Works with 1.11.10, breaks with 2.0.0-beta.21
expect(result.success).toEqual(true);
});
test("test inferred merged type", async () => {
const asdf = z.object({ a: z.string() }).merge(z.object({ a: z.number() }));
type asdf = z.infer<typeof asdf>;
util.assertEqual<asdf, { a: number }>(true);
});
test("inferred merged object type with optional properties", async () => {
const Merged = z
.object({ a: z.string(), b: z.string().optional() })
.merge(z.object({ a: z.string().optional(), b: z.string() }));
type Merged = z.infer<typeof Merged>;
util.assertEqual<Merged, { a?: string | undefined; b: string }>(true);
// todo
// util.assertEqual<Merged, { a?: string | undefined; b: string }>(true);
});
test("inferred unioned object type with optional properties", async () => {
const Unioned = z.union([
z.object({ a: z.string(), b: z.string().optional() }),
z.object({ a: z.string().optional(), b: z.string() }),
]);
type Unioned = z.infer<typeof Unioned>;
util.assertEqual<Unioned, { a: string; b?: string | undefined } | { a?: string | undefined; b: string }>(true);
});
test("inferred enum type", async () => {
const Enum = z.object({ a: z.string(), b: z.string().optional() }).keyof();
expect(Enum.Values).toEqual({
a: "a",
b: "b",
});
expect(Enum.enum).toEqual({
a: "a",
b: "b",
});
expect(Enum._def.values).toEqual(["a", "b"]);
type Enum = z.infer<typeof Enum>;
util.assertEqual<Enum, "a" | "b">(true);
});
test("inferred partial object type with optional properties", async () => {
const Partial = z.object({ a: z.string(), b: z.string().optional() }).partial();
type Partial = z.infer<typeof Partial>;
util.assertEqual<Partial, { a?: string | undefined; b?: string | undefined }>(true);
});
test("inferred picked object type with optional properties", async () => {
const Picked = z.object({ a: z.string(), b: z.string().optional() }).pick({ b: true });
type Picked = z.infer<typeof Picked>;
util.assertEqual<Picked, { b?: string | undefined }>(true);
});
test("inferred type for unknown/any keys", () => {
const myType = z.object({
anyOptional: z.any().optional(),
anyRequired: z.any(),
unknownOptional: z.unknown().optional(),
unknownRequired: z.unknown(),
});
type myType = z.infer<typeof myType>;
util.assertEqual<
myType,
{
anyOptional?: any;
anyRequired?: any;
unknownOptional?: unknown;
unknownRequired?: unknown;
}
>(true);
});
test("setKey", () => {
const base = z.object({ name: z.string() });
const withNewKey = base.setKey("age", z.number());
type withNewKey = z.infer<typeof withNewKey>;
util.assertEqual<withNewKey, { name: string; age: number }>(true);
withNewKey.parse({ name: "asdf", age: 1234 });
});
test("strictcreate", async () => {
const strictObj = z.strictObject({
name: z.string(),
});
const syncResult = strictObj.safeParse({ name: "asdf", unexpected: 13 });
expect(syncResult.success).toEqual(false);
const asyncResult = await strictObj.spa({ name: "asdf", unexpected: 13 });
expect(asyncResult.success).toEqual(false);
});
test("object with refine", async () => {
const schema = z
.object({
a: z.string().default("foo"),
b: z.number(),
})
.refine(() => true);
expect(schema.parse({ b: 5 })).toEqual({ b: 5, a: "foo" });
const result = await schema.parseAsync({ b: 5 });
expect(result).toEqual({ b: 5, a: "foo" });
});
test("intersection of object with date", async () => {
const schema = z.object({
a: z.date(),
});
expect(schema.and(schema).parse({ a: new Date(1637353595983) })).toEqual({
a: new Date(1637353595983),
});
const result = await schema.parseAsync({ a: new Date(1637353595983) });
expect(result).toEqual({ a: new Date(1637353595983) });
});
test("intersection of object with refine with date", async () => {
const schema = z
.object({
a: z.date(),
})
.refine(() => true);
expect(schema.and(schema).parse({ a: new Date(1637353595983) })).toEqual({
a: new Date(1637353595983),
});
const result = await schema.parseAsync({ a: new Date(1637353595983) });
expect(result).toEqual({ a: new Date(1637353595983) });
});
test("constructor key", () => {
const person = z
.object({
name: z.string(),
})
.strict();
expect(() =>
person.parse({
name: "bob dylan",
constructor: 61,
})
).toThrow();
});
test("constructor key", () => {
const Example = z.object({
prop: z.string(),
opt: z.number().optional(),
arr: z.string().array(),
});
type Example = z.infer<typeof Example>;
util.assertEqual<keyof Example, "prop" | "opt" | "arr">(true);
});
test("unknownkeys merging", () => {
// This one is "strict"
const schemaA = z
.object({
a: z.string(),
})
.strict();
// This one is "strip"
const schemaB = z
.object({
b: z.string(),
})
.catchall(z.string());
const mergedSchema = schemaA.merge(schemaB);
type mergedSchema = typeof mergedSchema;
util.assertEqual<mergedSchema["_def"]["unknownKeys"], "strip">(true);
expect(mergedSchema._def.unknownKeys).toEqual("strip");
util.assertEqual<mergedSchema["_def"]["catchall"], z.ZodString>(true);
expect(mergedSchema._def.catchall instanceof z.ZodString).toEqual(true);
});
const personToExtend = z.object({
firstName: z.string(),
lastName: z.string(),
});
test("extend() should return schema with new key", () => {
const PersonWithNickname = personToExtend.extend({ nickName: z.string() });
type PersonWithNickname = z.infer<typeof PersonWithNickname>;
const expected = { firstName: "f", nickName: "n", lastName: "l" };
const actual = PersonWithNickname.parse(expected);
expect(actual).toEqual(expected);
util.assertEqual<keyof PersonWithNickname, "firstName" | "lastName" | "nickName">(true);
util.assertEqual<PersonWithNickname, { firstName: string; lastName: string; nickName: string }>(true);
});
test("extend() should have power to override existing key", () => {
const PersonWithNumberAsLastName = personToExtend.extend({
lastName: z.number(),
});
type PersonWithNumberAsLastName = z.infer<typeof PersonWithNumberAsLastName>;
const expected = { firstName: "f", lastName: 42 };
const actual = PersonWithNumberAsLastName.parse(expected);
expect(actual).toEqual(expected);
util.assertEqual<PersonWithNumberAsLastName, { firstName: string; lastName: number }>(true);
});
test("passthrough index signature", () => {
const a = z.object({ a: z.string() });
type a = z.infer<typeof a>;
util.assertEqual<{ a: string }, a>(true);
const b = a.passthrough();
type b = z.infer<typeof b>;
util.assertEqual<{ a: string } & { [k: string]: unknown }, b>(true);
});
test("xor", () => {
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
type XOR<T, U> = T extends object ? (U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : U) : T;
type A = { name: string; a: number };
type B = { name: string; b: number };
type C = XOR<A, B>;
type Outer = { data: C };
const _Outer: z.ZodType<Outer> = z.object({
data: z.union([z.object({ name: z.string(), a: z.number() }), z.object({ name: z.string(), b: z.number() })]),
});
});
@@ -0,0 +1,16 @@
/**
* @fileoverview Common utils for directives.
*
* This file contains only shared items for directives.
* If you make a utility for rules, please see `../rules/utils/ast-utils.js`.
*
* @author gfyoung <https://github.com/gfyoung>
*/
"use strict";
const directivesPattern =
/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u;
module.exports = {
directivesPattern,
};
@@ -0,0 +1,111 @@
import * as util from "../core/util.js";
const error = () => {
const Sizable = {
string: { unit: "karakter", verb: "memiliki" },
file: { unit: "byte", verb: "memiliki" },
array: { unit: "item", verb: "memiliki" },
set: { unit: "item", verb: "memiliki" },
map: { unit: "item", verb: "memiliki" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "alamat email",
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: "tanggal dan waktu format ISO",
date: "tanggal format ISO",
time: "jam format ISO",
duration: "durasi format ISO",
ipv4: "alamat IPv4",
ipv6: "alamat IPv6",
mac: "alamat MAC",
cidrv4: "rentang alamat IPv4",
cidrv6: "rentang alamat IPv6",
base64: "string dengan enkode base64",
base64url: "string dengan enkode base64url",
json_string: "string JSON",
e164: "angka E.164",
credit_card: "nomor kartu kredit",
currency_code: "kode mata uang",
iban: "IBAN",
jwt: "JWT",
template_literal: "input",
};
const TypeDictionary = {
nan: "NaN",
};
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 `Input tidak valid: diharapkan instanceof ${issue.expected}, diterima ${received}`;
}
return `Input tidak valid: diharapkan ${expected}, diterima ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `Input tidak valid: diharapkan ${util.stringifyPrimitive(issue.values[0])}`;
return `Pilihan tidak valid: diharapkan salah satu dari ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Terlalu besar: diharapkan ${issue.origin ?? "value"} memiliki ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemen"}`;
return `Terlalu besar: diharapkan ${issue.origin ?? "value"} menjadi ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Terlalu kecil: diharapkan ${issue.origin} memiliki ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `Terlalu kecil: diharapkan ${issue.origin} menjadi ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `String tidak valid: harus dimulai dengan "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `String tidak valid: harus berakhir dengan "${_issue.suffix}"`;
if (_issue.format === "includes")
return `String tidak valid: harus menyertakan "${_issue.includes}"`;
if (_issue.format === "regex")
return `String tidak valid: harus sesuai pola ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue.format} tidak valid`;
}
case "not_multiple_of":
return `Angka tidak valid: harus kelipatan dari ${issue.divisor}`;
case "unrecognized_keys":
return `Kunci tidak dikenali ${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Kunci tidak valid di ${issue.origin}`;
case "invalid_union":
return "Input tidak valid";
case "invalid_element":
return `Nilai tidak valid di ${issue.origin}`;
default:
return `Input tidak valid`;
}
};
};
export default function () {
return {
localeError: error(),
};
}
@@ -0,0 +1 @@
{"version":3,"file":"circle-play.js","sources":["../../../src/icons/circle-play.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CirclePlay\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8cG9seWdvbiBwb2ludHM9IjEwIDggMTYgMTIgMTAgMTYgMTAgOCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/circle-play\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 CirclePlay = createLucideIcon('CirclePlay', [\n ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],\n ['polygon', { points: '10 8 16 12 10 16 10 8', key: '1cimsy' }],\n]);\n\nexport default CirclePlay;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,iBAAiB,YAAc,CAAA,CAAA,CAAA;AAAA,CAChD,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACzD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAAE,QAAQ,CAAyB,CAAA,CAAA,CAAA,CAAA,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;AAChE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
module.exports={C:{"120":0.06809,"121":0.1498,"149":0.00681,"150":0.00681,"154":0.29279,"155":0.92602,"156":0.97369,"157":0.01362,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 151 152 153 158 159 160 3.5 3.6"},D:{"26":0.00681,"103":0.00681,"104":0.03405,"106":0.00681,"107":0.00681,"109":0.10894,"110":0.01362,"111":0.00681,"112":0.49706,"114":0.00681,"115":0.23832,"116":0.02043,"117":0.03405,"118":0.09533,"119":0.74218,"120":0.15661,"121":0.09533,"122":0.12256,"123":0.12937,"124":0.00681,"126":0.01362,"127":0.06128,"128":0.06128,"131":0.06128,"133":0.04085,"134":0.21789,"135":0.10214,"136":0.02724,"137":0.06809,"138":0.31321,"139":0.12256,"140":0.19746,"141":0.05447,"142":0.20427,"144":0.04085,"145":0.04766,"146":0.05447,"147":0.12937,"148":0.05447,"149":0.26555,"150":0.49025,"151":2.73722,"152":14.11506,"153":12.71921,"154":2.29463,"155":0.06809,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 105 108 113 125 129 130 132 143 156 157"},F:{"134":0.06809,"135":0.61962,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 131 132 133 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"119":0.0749,"120":0.04085,"138":0.04085,"139":0.00681,"146":0.00681,"148":0.04766,"150":0.02724,"151":0.19065,"152":9.06278,"153":7.8644,"154":2.1176,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 140 141 142 143 144 145 147 149"},E:{"27":0.10214,_:"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 15.1 15.2-15.3 15.4 16.0 16.2 16.3 16.5 17.0 17.2 17.3 17.4 18.0 18.2 18.4 18.5-18.7 26.4 27.1 27.2 TP","14.1":0.01362,"15.5":0.01362,"15.6":0.03405,"16.1":0.00681,"16.4":0.00681,"16.6":0.3745,"17.1":4.4599,"17.5":0.01362,"17.6":0.02724,"18.1":0.00681,"18.3":0.00681,"26.0":0.01362,"26.1":0.06128,"26.2":0.10894,"26.3":0.03405,"26.5":0.26555,"26.6":0.68771},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00064,"5.0-5.1":0.00064,"6.0-6.1":0,"7.0-7.1":0.00128,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00642,"11.0-11.2":0.00064,"11.3-11.4":0.00128,"12.0-12.1":0,"12.2-12.5":0.01668,"13.0-13.1":0,"13.2":0.00321,"13.3":0,"13.4-13.7":0.00064,"14.0-14.4":0.00257,"14.5-14.8":0.00385,"15.0-15.1":0.00385,"15.2-15.3":0.00257,"15.4":0.00321,"15.5":0.00385,"15.6-15.8":0.08342,"16.0":0.00642,"16.1":0.01155,"16.2":0.00642,"16.3":0.01412,"16.4":0.00321,"16.5":0.00513,"16.6-16.7":0.11615,"17.0":0.00449,"17.1":0.00642,"17.2":0.00642,"17.3":0.00963,"17.4":0.01348,"17.5":0.02631,"17.6-17.7":0.06802,"18.0":0.01412,"18.1":0.02824,"18.2":0.0385,"18.3":0.06674,"18.4":0.04171,"18.5-18.7":0.86182,"26.0":0.04171,"26.1":0.04235,"26.2":0.11037,"26.3":0.11936,"26.4":0.08727,"26.5":0.5846,"26.6":3.60705,"27.0":0.27658,"27.1":0,"27.2":0.00706},P:{"26":0.01146,"28":0.10311,"29":0.01146,"30":4.37648,_:"4 20 21 22 23 24 25 27 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0"},I:{"0":0.01594,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.03191,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0":20.95494},R:{_:"0"},M:{"0":0.25528},Q:{_:"14.9"},O:{_:"0"},H:{all:0}};
@@ -0,0 +1 @@
{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAW,wBAAwB,CAAC;AAE5D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACvB,CAAC,EAAE,EAAE,QAAQ,CAAC;IACd,CAAC,EAAE,EAAE,OAAO,CAAC;IACb,CAAC,EAAE,EAAE,QAAQ,CAAC;IACd,CAAC,EAAE,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY;AACrB,uEAAuE;AACvE,MAAM,CAAC,SAAS,CAAC,WAAW,IAAI,IAAI;IAChC,CAAC,CAAC,CAAC,CAAS,EAAE,KAAa,EAAU,EAAE,CACjC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,KAAO,CAAC,KAAK,KAAO;QACvC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,KAAO,CAAC,GAAG,IAAM;YACxC,CAAC,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,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AAE,OAAO,CAAC;IACb,CAAC,EAAE,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,EAAE,MAAM,CAAC;IACZ,CAAC,GAAG,EAAE,QAAQ,CAAC;CAClB,CAAC,CACL,CAAC"}
@@ -0,0 +1,31 @@
/*! *****************************************************************************
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.
***************************************************************************** */
/// <reference lib="es2015.iterable" />
interface ObjectConstructor {
/**
* Returns an object created by key-value entries for properties and methods
* @param entries An iterable object that contains key-value entries for properties and methods.
*/
fromEntries<T = any>(entries: Iterable<readonly [PropertyKey, T]>): { [k: string]: T; };
/**
* Returns an object created by key-value entries for properties and methods
* @param entries An iterable object that contains key-value entries for properties and methods.
*/
fromEntries(entries: Iterable<readonly any[]>): any;
}
@@ -0,0 +1,28 @@
import type { AddedKeywordDefinition } from "../types";
declare const _jsonTypes: readonly ["string", "number", "integer", "boolean", "null", "object", "array"];
export type JSONType = (typeof _jsonTypes)[number];
export declare function isJSONType(x: unknown): x is JSONType;
type ValidationTypes = {
[K in JSONType]: boolean | RuleGroup | undefined;
};
export interface ValidationRules {
rules: RuleGroup[];
post: RuleGroup;
all: {
[Key in string]?: boolean | Rule;
};
keywords: {
[Key in string]?: boolean;
};
types: ValidationTypes;
}
export interface RuleGroup {
type?: JSONType;
rules: Rule[];
}
export interface Rule {
keyword: string;
definition: AddedKeywordDefinition;
}
export declare function getRules(): ValidationRules;
export {};
@@ -0,0 +1,33 @@
"use client";
import { jsx } from 'react/jsx-runtime';
import { useContext, useRef, useMemo } from 'react';
import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
import { DeprecatedLayoutGroupContext } from '../../context/DeprecatedLayoutGroupContext.mjs';
import { useForceUpdate } from '../../utils/use-force-update.mjs';
import { nodeGroup } from 'motion-dom';
const shouldInheritGroup = (inherit) => inherit === true;
const shouldInheritId = (inherit) => shouldInheritGroup(inherit === true) || inherit === "id";
const LayoutGroup = ({ children, id, inherit = true }) => {
const layoutGroupContext = useContext(LayoutGroupContext);
const deprecatedLayoutGroupContext = useContext(DeprecatedLayoutGroupContext);
const [forceRender, key] = useForceUpdate();
const context = useRef(null);
const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext;
if (context.current === null) {
if (shouldInheritId(inherit) && upstreamId) {
id = id ? upstreamId + "-" + id : upstreamId;
}
context.current = {
id,
group: shouldInheritGroup(inherit)
? layoutGroupContext.group || nodeGroup()
: nodeGroup(),
};
}
const memoizedContext = useMemo(() => ({ ...context.current, forceRender }), [key]);
return (jsx(LayoutGroupContext.Provider, { value: memoizedContext, children: children }));
};
export { LayoutGroup };
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
{"version":3,"names":["_traverseNode","require","_index","_removal","t","call","key","opts","debug","node","_call","_opts$this$node$type","type","fns","fn","ret","state","then","Error","_traverseFlags","isDenylisted","_this$opts$denylist","denylist","blacklist","includes","exports","isBlacklisted","restoreContext","path","context","visit","_this$opts$shouldSkip","_this$opts","shouldSkip","currentContext","shouldStop","traverseNode","scope","skipKeys","skip","skipKey","stop","SHOULD_SKIP","SHOULD_STOP","_forceSetScope","_this$scope","parentPath","listKey","isMethod","isSwitchStatement","target","getScope","init","setScope","_this$opts2","_this$scope2","noScope","_path$opts","setContext","resync","removed","_resyncParent","_resyncList","_resyncKey","parent","container","Array","isArray","i","length","setKey","Object","keys","inList","newContainer","_resyncRemoved","_markRemoved","popContext","contexts","pop","undefined","pushContext","push","setup","_this$node","requeue","pathToQueue","maybeQueue","requeueComputedKeyAndDecorators","isPrivate","computed","get","decorators","decorator","_getQueueContexts"],"sources":["../../src/path/context.ts"],"sourcesContent":["// This file contains methods responsible for maintaining a TraversalContext.\n\nimport { traverseNode } from \"../traverse-node.ts\";\nimport { SHOULD_SKIP, SHOULD_STOP } from \"./index.ts\";\nimport { _markRemoved } from \"./removal.ts\";\nimport type TraversalContext from \"../context.ts\";\nimport type { VisitPhase } from \"../types.ts\";\nimport type NodePath from \"./index.ts\";\nimport * as t from \"@babel/types\";\n\nexport function call(this: NodePath, key: VisitPhase): boolean {\n const opts = this.opts;\n\n this.debug(key);\n\n if (this.node) {\n if (_call.call(this, opts[key])) return true;\n }\n\n if (this.node) {\n return _call.call(this, opts[this.node.type]?.[key]);\n }\n\n return false;\n}\n\nexport function _call(this: NodePath, fns?: Function[]): boolean {\n if (!fns) return false;\n\n for (const fn of fns) {\n if (!fn) continue;\n\n const node = this.node;\n if (!node) return true;\n\n const ret = fn.call(this.state, this, this.state);\n if (ret && typeof ret === \"object\" && typeof ret.then === \"function\") {\n throw new Error(\n `You appear to be using a plugin with an async traversal visitor, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n if (ret) {\n throw new Error(`Unexpected return value from visitor method ${fn}`);\n }\n\n // node has been replaced, it will have been requeued\n if (this.node !== node) return true;\n\n // this.shouldSkip || this.shouldStop || this.removed\n if (this._traverseFlags > 0) return true;\n }\n\n return false;\n}\n\nexport function isDenylisted(this: NodePath): boolean {\n // @ts-expect-error TODO(Babel 8): Remove blacklist\n const denylist = this.opts.denylist ?? this.opts.blacklist;\n return denylist?.includes(this.node.type);\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n // eslint-disable-next-line no-restricted-globals\n exports.isBlacklisted = isDenylisted;\n}\n\nfunction restoreContext(path: NodePath, context: TraversalContext) {\n if (path.context !== context) {\n path.context = context;\n path.state = context.state;\n path.opts = context.opts;\n }\n}\n\nexport function visit(this: NodePath): boolean {\n if (!this.node) {\n return false;\n }\n\n if (this.isDenylisted()) {\n return false;\n }\n\n if (this.opts.shouldSkip?.(this)) {\n return false;\n }\n\n const currentContext = this.context;\n // Note: We need to check \"this.shouldSkip\" first because\n // another visitor can set it to true. Usually .shouldSkip is false\n // before calling the enter visitor, but it can be true in case of\n // a requeued node (e.g. by .replaceWith()) that is then marked\n // with .skip().\n if (this.shouldSkip || call.call(this, \"enter\")) {\n this.debug(\"Skip...\");\n return this.shouldStop;\n }\n restoreContext(this, currentContext);\n\n this.debug(\"Recursing into...\");\n this.shouldStop = traverseNode(\n this.node,\n this.opts,\n this.scope,\n this.state,\n this,\n this.skipKeys,\n );\n\n restoreContext(this, currentContext);\n\n call.call(this, \"exit\");\n\n return this.shouldStop;\n}\n\nexport function skip(this: NodePath) {\n this.shouldSkip = true;\n}\n\nexport function skipKey(this: NodePath, key: string) {\n if (this.skipKeys == null) {\n this.skipKeys = {};\n }\n this.skipKeys[key] = true;\n}\n\nexport function stop(this: NodePath) {\n // this.shouldSkip = true; this.shouldStop = true;\n this._traverseFlags |= SHOULD_SKIP | SHOULD_STOP;\n}\n\nexport function _forceSetScope(this: NodePath) {\n let path = this.parentPath;\n\n if (\n // Skip method scope if is computed method Line truncated
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/id.tsx"],
"sourcesContent": ["import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\n// We spaces with `.trim().toString()` to prevent bundlers from trying to `import { useId } from 'react';`\nconst useReactId = (React as any)[' useId '.trim().toString()] || (() => undefined);\nlet count = 0;\n\nfunction useId(deterministicId?: string): string {\n const [id, setId] = React.useState<string | undefined>(useReactId());\n // React versions older than 18 will have client-side ids only.\n useLayoutEffect(() => {\n if (!deterministicId) setId((reactId) => reactId ?? String(count++));\n }, [deterministicId]);\n return deterministicId || (id ? `radix-${id}` : '');\n}\n\nexport { useId };\n"],
"mappings": ";AAAA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAGhC,IAAM,aAAc,MAAc,UAAU,KAAK,EAAE,SAAS,CAAC,MAAM,MAAM;AACzE,IAAI,QAAQ;AAEZ,SAAS,MAAM,iBAAkC;AAC/C,QAAM,CAAC,IAAI,KAAK,IAAU,eAA6B,WAAW,CAAC;AAEnE,kBAAgB,MAAM;AACpB,QAAI,CAAC,gBAAiB,OAAM,CAAC,YAAY,WAAW,OAAO,OAAO,CAAC;AAAA,EACrE,GAAG,CAAC,eAAe,CAAC;AACpB,SAAO,oBAAoB,KAAK,SAAS,EAAE,KAAK;AAClD;",
"names": []
}
@@ -0,0 +1,62 @@
/**
* @fileoverview Rule to disallow returning value from constructor.
* @author Pig Fang <https://github.com/g-plane>
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "problem",
docs: {
description: "Disallow returning value from constructor",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-constructor-return",
},
schema: [],
fixable: null,
messages: {
unexpected: "Unexpected return statement in constructor.",
},
},
create(context) {
const stack = [];
return {
onCodePathStart(_, node) {
stack.push(node);
},
onCodePathEnd() {
stack.pop();
},
ReturnStatement(node) {
const last = stack.at(-1);
if (!last.parent) {
return;
}
if (
last.parent.type === "MethodDefinition" &&
last.parent.kind === "constructor" &&
node.argument
) {
context.report({
node,
messageId: "unexpected",
});
}
},
};
},
};
@@ -0,0 +1,6 @@
/**
* Type-checked examples for the useHostStyles hooks.
*
* @module
*/
export {};
@@ -0,0 +1,238 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const alien = require("./alien.cjs");
function toObserver(nextHandler, errorHandler, completionHandler) {
const isObserver = typeof nextHandler === "object";
const self = isObserver ? nextHandler : void 0;
return {
next: (isObserver ? nextHandler.next : nextHandler)?.bind(self),
error: (isObserver ? nextHandler.error : errorHandler)?.bind(self),
complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(
self
)
};
}
const queuedEffects = [];
let cycle = 0;
const { link, unlink, propagate, checkDirty, shallowPropagate } = alien.createReactiveSystem({
update(atom) {
return atom._update();
},
// eslint-disable-next-line no-shadow
notify(effect2) {
queuedEffects[queuedEffectsLength++] = effect2;
effect2.flags &= ~alien.ReactiveFlags.Watching;
},
unwatched(atom) {
if (atom.depsTail !== void 0) {
atom.depsTail = void 0;
atom.flags = alien.ReactiveFlags.Mutable | alien.ReactiveFlags.Dirty;
purgeDeps(atom);
}
}
});
let notifyIndex = 0;
let queuedEffectsLength = 0;
let activeSub;
let batchDepth = 0;
function batch(fn) {
try {
++batchDepth;
fn();
} finally {
if (!--batchDepth) {
flush();
}
}
}
function purgeDeps(sub) {
const depsTail = sub.depsTail;
let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
while (dep !== void 0) {
dep = unlink(dep, sub);
}
}
function flush() {
if (batchDepth > 0) {
return;
}
while (notifyIndex < queuedEffectsLength) {
const effect2 = queuedEffects[notifyIndex];
queuedEffects[notifyIndex++] = void 0;
effect2.notify();
}
notifyIndex = 0;
queuedEffectsLength = 0;
}
function createAsyncAtom(getValue, options) {
const ref = {};
const atom = createAtom(() => {
getValue().then(
(data) => {
const internalAtom = ref.current;
if (internalAtom._update({ status: "done", data })) {
const subs = internalAtom.subs;
if (subs !== void 0) {
propagate(subs);
shallowPropagate(subs);
flush();
}
}
},
(error) => {
const internalAtom = ref.current;
if (internalAtom._update({ status: "error", error })) {
const subs = internalAtom.subs;
if (subs !== void 0) {
propagate(subs);
shallowPropagate(subs);
flush();
}
}
}
);
return { status: "pending" };
}, options);
ref.current = atom;
return atom;
}
function createAtom(valueOrFn, options) {
const isComputed = typeof valueOrFn === "function";
const getter = valueOrFn;
const atom = {
_snapshot: isComputed ? void 0 : valueOrFn,
subs: void 0,
subsTail: void 0,
deps: void 0,
depsTail: void 0,
flags: isComputed ? alien.ReactiveFlags.None : alien.ReactiveFlags.Mutable,
get() {
if (activeSub !== void 0) {
link(atom, activeSub, cycle);
}
return atom._snapshot;
},
subscribe(observerOrFn) {
const obs = toObserver(observerOrFn);
const observed = { current: false };
const e = effect(() => {
atom.get();
if (!observed.current) {
observed.current = true;
} else {
obs.next?.(atom._snapshot);
}
});
return {
unsubscribe: () => {
e.stop();
}
};
},
_update(getValue) {
const prevSub = activeSub;
const compare = options?.compare ?? Object.is;
if (isComputed) {
activeSub = atom;
++cycle;
atom.depsTail = void 0;
} else if (getValue === void 0) {
return false;
}
if (isComputed) {
atom.flags = alien.ReactiveFlags.Mutable | alien.ReactiveFlags.RecursedCheck;
}
try {
const oldValue = atom._snapshot;
const newValue = typeof getValue === "function" ? getValue(oldValue) : getValue === void 0 && isComputed ? getter(oldValue) : getValue;
if (oldValue === void 0 || !compare(oldValue, newValue)) {
atom._snapshot = newValue;
return true;
}
return false;
} finally {
activeSub = prevSub;
if (isComputed) {
atom.flags &= ~alien.ReactiveFlags.RecursedCheck;
}
purgeDeps(atom);
}
}
};
if (isComputed) {
atom.flags = alien.ReactiveFlags.Mutable | alien.ReactiveFlags.Dirty;
atom.get = function() {
const flags = atom.flags;
if (flags & alien.ReactiveFlags.Dirty || flags & alien.ReactiveFlags.Pending && checkDirty(atom.deps, atom)) {
if (atom._update()) {
const subs = atom.subs;
if (subs !== void 0) {
shallowPropagate(subs);
}
}
} else if (flags & alien.ReactiveFlags.Pending) {
atom.flags = flags & ~alien.ReactiveFlags.Pending;
}
if (activeSub !== void 0) {
link(atom, activeSub, cycle);
}
return atom._snapshot;
};
} else {
atom.set = function(valueOrFn2) {
if (atom._update(valueOrFn2)) {
const subs = atom.subs;
if (subs !== void 0) {
propagate(subs);
shallowPropagate(subs);
flush();
}
}
};
}
return atom;
}
function effect(fn) {
const run = () => {
const prevSub = activeSub;
activeSub = effectObj;
++cycle;
effectObj.depsTail = void 0;
effectObj.flags = alien.ReactiveFlags.Watching | alien.ReactiveFlags.RecursedCheck;
try {
return fn();
} finally {
activeSub = prevSub;
effectObj.flags &= ~alien.ReactiveFlags.RecursedCheck;
purgeDeps(effectObj);
}
};
const effectObj = {
deps: void 0,
depsTail: void 0,
subs: void 0,
subsTail: void 0,
flags: alien.ReactiveFlags.Watching | alien.ReactiveFlags.RecursedCheck,
notify() {
const flags = this.flags;
if (flags & alien.ReactiveFlags.Dirty || flags & alien.ReactiveFlags.Pending && checkDirty(this.deps, this)) {
run();
} else {
this.flags = alien.ReactiveFlags.Watching;
}
},
stop() {
this.flags = alien.ReactiveFlags.None;
this.depsTail = void 0;
purgeDeps(this);
}
};
run();
return effectObj;
}
exports.batch = batch;
exports.createAsyncAtom = createAsyncAtom;
exports.createAtom = createAtom;
exports.flush = flush;
exports.toObserver = toObserver;
//# sourceMappingURL=atom.cjs.map
@@ -0,0 +1,72 @@
// Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134
var _a;
const decodeMap = new Map([
[0, 65533],
// C1 Unicode control character reference replacements
[128, 8364],
[130, 8218],
[131, 402],
[132, 8222],
[133, 8230],
[134, 8224],
[135, 8225],
[136, 710],
[137, 8240],
[138, 352],
[139, 8249],
[140, 338],
[142, 381],
[145, 8216],
[146, 8217],
[147, 8220],
[148, 8221],
[149, 8226],
[150, 8211],
[151, 8212],
[152, 732],
[153, 8482],
[154, 353],
[155, 8250],
[156, 339],
[158, 382],
[159, 376],
]);
/**
* Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
*/
export const fromCodePoint =
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins
(_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function (codePoint) {
let output = "";
if (codePoint > 65535) {
codePoint -= 65536;
output += String.fromCharCode(((codePoint >>> 10) & 1023) | 55296);
codePoint = 56320 | (codePoint & 1023);
}
output += String.fromCharCode(codePoint);
return output;
};
/**
* Replace the given code point with a replacement character if it is a
* surrogate or is outside the valid range. Otherwise return the code
* point unchanged.
*/
export function replaceCodePoint(codePoint) {
var _a;
if ((codePoint >= 55296 && codePoint <= 57343) ||
codePoint > 1114111) {
return 65533;
}
return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
}
/**
* Replace the code point if relevant, then convert it to a string.
*
* @deprecated Use `fromCodePoint(replaceCodePoint(codePoint))` instead.
* @param codePoint The code point to decode.
* @returns The decoded code point.
*/
export function decodeCodePoint(codePoint) {
return fromCodePoint(replaceCodePoint(codePoint));
}
//# sourceMappingURL=decode-codepoint.js.map
@@ -0,0 +1 @@
{"version":3,"file":"atom.js","sources":["../../src/atom.ts"],"sourcesContent":["import { ReactiveFlags, createReactiveSystem } from './alien'\n\nimport type { ReactiveNode } from './alien'\nimport type {\n Atom,\n AtomOptions,\n Observer,\n ReadonlyAtom,\n Subscription,\n} from './types'\n\nexport function toObserver<T>(\n nextHandler?: Observer<T> | ((value: T) => void),\n errorHandler?: (error: any) => void,\n completionHandler?: () => void,\n): Observer<T> {\n const isObserver = typeof nextHandler === 'object'\n const self = isObserver ? nextHandler : undefined\n\n return {\n next: (isObserver ? nextHandler.next : nextHandler)?.bind(self),\n error: (isObserver ? nextHandler.error : errorHandler)?.bind(self),\n complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(\n self,\n ),\n }\n}\n\ninterface InternalAtom<T> extends ReactiveNode {\n _snapshot: T\n _update: (getValue?: T | ((snapshot: T) => T)) => boolean\n get: () => T\n subscribe: (observerOrFn: Observer<T> | ((value: T) => void)) => Subscription\n}\n\nconst queuedEffects: Array<Effect | undefined> = []\nlet cycle = 0\nconst { link, unlink, propagate, checkDirty, shallowPropagate } =\n createReactiveSystem({\n update(atom: InternalAtom<any>): boolean {\n return atom._update()\n },\n // eslint-disable-next-line no-shadow\n notify(effect: Effect): void {\n queuedEffects[queuedEffectsLength++] = effect\n effect.flags &= ~ReactiveFlags.Watching\n },\n unwatched(atom: InternalAtom<any>): void {\n if (atom.depsTail !== undefined) {\n atom.depsTail = undefined\n atom.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty\n purgeDeps(atom)\n }\n },\n })\n\nlet notifyIndex = 0\nlet queuedEffectsLength = 0\nlet activeSub: ReactiveNode | undefined\nlet batchDepth = 0\n\nexport function batch(fn: () => void) {\n try {\n ++batchDepth\n fn()\n } finally {\n if (!--batchDepth) {\n flush()\n }\n }\n}\n\nfunction purgeDeps(sub: ReactiveNode) {\n const depsTail = sub.depsTail\n let dep = depsTail !== undefined ? depsTail.nextDep : sub.deps\n while (dep !== undefined) {\n dep = unlink(dep, sub)\n }\n}\n\nexport function flush(): void {\n if (batchDepth > 0) {\n return\n }\n while (notifyIndex < queuedEffectsLength) {\n // eslint-disable-next-line no-shadow\n const effect = queuedEffects[notifyIndex]!\n queuedEffects[notifyIndex++] = undefined\n effect.notify()\n }\n notifyIndex = 0\n queuedEffectsLength = 0\n}\n\ntype AsyncAtomState<TData, TError = unknown> =\n | { status: 'pending' }\n | { status: 'done'; data: TData }\n | { status: 'error'; error: TError }\n\nexport function createAsyncAtom<T>(\n getValue: () => Promise<T>,\n options?: AtomOptions<AsyncAtomState<T>>,\n): ReadonlyAtom<AsyncAtomState<T>> {\n const ref: { current?: InternalAtom<AsyncAtomState<T>> } = {}\n const atom = createAtom<AsyncAtomState<T>>(() => {\n getValue().then(\n (data) => {\n const internalAtom = ref.current!\n if (internalAtom._update({ status: 'done', data })) {\n const subs = internalAtom.subs\n if (subs !== undefined) {\n propagate(subs)\n shallowPropagate(subs)\n flush()\n }\n }\n },\n (error) => {\n const internalAtom = ref.current!\n if (internalAtom._update({ status: 'error', error })) {\n const subs = internalAtom.subs\n if (subs !== undefined) {\n propagate(subs)\n shallowPropagate(subs)\n flush()\n }\n }\n },\n )\n\n return { status: 'pending' }\n }, options)\n ref.current = atom as unknown as InternalAtom<AsyncAtomState<T>>\n\n return atom\n}\n\nexport function createAtom<T>(\n getValue: (prev?: NoInfer<T>) => T,\n options?: AtomOptions<T>,\n): ReadonlyAtom<T>\nexport function createAtom<T>(\n initialValue: T,\n options?: AtomOptions<T>,\n): Atom<T>\nexport function createAtom<T>(\n valueOrFn: T | ((prev?: T) => T),\n options?: AtomOptions<T>,\n): Atom<T> | ReadonlyAtom<T> {\n const isComputed = typeof valueOrFn === 'function'\n const getter = valueOrFn as (prev?: T) => T\n\n // Create plain object atom\n const atom: InternalAtom<T> = {\n _snapshot: isComputed ? undefined! : valueOrFn,\n\n subs: undefined,\n subsTail: undefined,\n deps: undefined,\n depsTail: undefined,\n flags: isComputed ? ReactiveFlags.None : ReactiveFlags.Mutable,\n\n get(): T {\n if (activeSub !== undefined) {\n link(atom, activeSub, cycle)\n }\n return atom._snapshot\n },\n\n subscribe(observerOrFn: Observer<T> | ((value: T) => void)) {\n const obs = toObserver(observerOrFn)\n const observed = { current: false }\n const e = effect(() => {\n atom.get()\n if (!observed.current) {\n observed.current = true\n } else {\n obs.next?.(atom.Line truncated
@@ -0,0 +1 @@
{"version":3,"names":["_t","require","_index","isCallExpression","isLiteral","isMemberExpression","isNewExpression","isPattern","UnaryExpression","node","operator","firstChar","charCodeAt","word","space","tokenChar","print","argument","DoExpression","async","body","ParenthesizedExpression","token","oldNoLineTerminatorAfterNode","enterDelimited","expression","undefined","_noLineTerminatorAfterNode","rightParens","UpdateExpression","prefix","ConditionalExpression","test","consequent","alternate","NewExpression","parent","callee","format","minified","arguments","length","optional","typeArguments","typeParameters","tokenMap","endMatches","printList","shouldPrintTrailingComma","SequenceExpression","expressions","ThisExpression","Super","_shouldPrintDecoratorsBeforeExport","decoratorsBeforeExport","start","declaration","Decorator","newline","OptionalMemberExpression","computed","property","object","TypeError","value","OptionalCallExpression","CallExpression","Import","AwaitExpression","YieldExpression","delegate","EmptyStatement","semicolon","ExpressionStatement","tokenContext","TokenContext","expressionStatement","AssignmentPattern","left","type","typeAnnotation","right","AssignmentExpression","BinaryExpression","setLastChar","BindExpression","MemberExpression","MetaProperty","meta","PrivateName","id","V8IntrinsicIdentifier","name","ModuleExpression","indent","directives","dedent","rightBrace"],"sources":["../../src/generators/expressions.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport {\n isCallExpression,\n isLiteral,\n isMemberExpression,\n isNewExpression,\n isPattern,\n} from \"@babel/types\";\n// We inline this package\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport * as charCodes from \"charcodes\";\nimport type * as t from \"@babel/types\";\nimport { TokenContext } from \"../node/index.ts\";\n\nexport function UnaryExpression(this: Printer, node: t.UnaryExpression) {\n const { operator } = node;\n const firstChar = operator.charCodeAt(0);\n if (firstChar >= charCodes.lowercaseA && firstChar <= charCodes.lowercaseZ) {\n this.word(operator);\n this.space();\n } else {\n this.tokenChar(firstChar);\n }\n\n this.print(node.argument);\n}\n\nexport function DoExpression(this: Printer, node: t.DoExpression) {\n if (node.async) {\n this.word(\"async\", true);\n this.space();\n }\n this.word(\"do\");\n this.space();\n this.print(node.body);\n}\n\nexport function ParenthesizedExpression(\n this: Printer,\n node: t.ParenthesizedExpression,\n) {\n this.token(\"(\");\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n this.print(node.expression, undefined, true);\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n this.rightParens(node);\n}\n\nexport function UpdateExpression(this: Printer, node: t.UpdateExpression) {\n if (node.prefix) {\n this.token(node.operator, false, 0, true);\n this.print(node.argument);\n } else {\n this.print(node.argument, true);\n this.token(node.operator, false, 0, true);\n }\n}\n\nexport function ConditionalExpression(\n this: Printer,\n node: t.ConditionalExpression,\n) {\n this.print(node.test);\n this.space();\n this.token(\"?\");\n this.space();\n this.print(node.consequent);\n this.space();\n this.token(\":\");\n this.space();\n this.print(node.alternate);\n}\n\nexport function NewExpression(\n this: Printer,\n node: t.NewExpression,\n parent: t.Node,\n) {\n this.word(\"new\");\n this.space();\n this.print(node.callee);\n if (\n this.format.minified &&\n node.arguments.length === 0 &&\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n !node.optional &&\n !isCallExpression(parent, { callee: node }) &&\n !isMemberExpression(parent) &&\n !isNewExpression(parent)\n ) {\n return;\n }\n\n this.print(node.typeArguments);\n if (!process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n this.print(node.typeParameters); // Legacy TS AST\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n if (node.optional) {\n this.token(\"?.\");\n }\n }\n\n if (\n node.arguments.length === 0 &&\n this.tokenMap &&\n !this.tokenMap.endMatches(node, \")\")\n ) {\n return;\n }\n\n this.token(\"(\");\n const oldNoLineTerminatorAfterNode = this.enterDelimited();\n this.printList(\n node.arguments,\n this.shouldPrintTrailingComma(\")\"),\n undefined,\n undefined,\n undefined,\n true,\n );\n this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;\n this.rightParens(node);\n}\n\nexport function SequenceExpression(this: Printer, node: t.SequenceExpression) {\n this.printList(node.expressions);\n}\n\nexport function ThisExpression(this: Printer) {\n this.word(\"this\");\n}\n\nexport function Super(this: Printer) {\n this.word(\"super\");\n}\n\nexport function _shouldPrintDecoratorsBeforeExport(\n this: Printer,\n node: t.ExportDeclLine truncated
@@ -0,0 +1,33 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_helper_websocket_index = require("../../helper/websocket/index.js");
//#region src/adapter/deno/websocket.ts
/**
* @deprecated `hono/deno` will be removed in v5. Install `@hono/deno` and import from there instead.
*/
const upgradeWebSocket = require_helper_websocket_index.defineWebSocketHelper(async (c, events, options) => {
if (c.req.header("upgrade") !== "websocket") return;
const subprotocol = c.req.header("sec-websocket-protocol")?.split(",")[0]?.trim();
const { response, socket } = Deno.upgradeWebSocket(c.req.raw, {
...subprotocol ? { protocol: subprotocol } : {},
...options
});
const wsContext = new require_helper_websocket_index.WSContext({
close: (code, reason) => socket.close(code, reason),
get protocol() {
return socket.protocol;
},
raw: socket,
get readyState() {
return socket.readyState;
},
url: socket.url ? new URL(socket.url) : null,
send: (source) => socket.send(source)
});
socket.onopen = (evt) => events.onOpen?.(evt, wsContext);
socket.onmessage = (evt) => events.onMessage?.(evt, wsContext);
socket.onclose = (evt) => events.onClose?.(evt, wsContext);
socket.onerror = (evt) => events.onError?.(evt, wsContext);
return response;
});
//#endregion
exports.upgradeWebSocket = upgradeWebSocket;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_yN _i","2":"_I","164":"_FB _GO"},C:{"1":"_ZJ _2E","2":"_KJ _bC _L","322":"2B"},D:{"1":"_yN _l","2":"_qG","164":"_NB _uG _GO"},E:{"1":"_VI","2":"_4C","164":"D OD"},F:{"1":"_nG _RR","2":"_T","164":"_MC _sD"},G:{"1":"_2","2":"_r"},H:{"2":"1D"},I:{"1":"I","2":"_W","164":"_y"},J:{"2":"D","164":"A"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_vQ","164":"_AP"},Q:{"164":"JE"},R:{"164":"KE"},S:{"1":"_C"}},B:4,C:"text-emphasis styling",D:true};
@@ -0,0 +1,117 @@
import * as util from "../core/util.js";
const error = () => {
// singular units after numerals in Tajik
const Sizable = {
string: { unit: "аломат", verb: "дошта бошад" },
file: { unit: "байт", verb: "дошта бошад" },
array: { unit: "унсур", verb: "дошта бошад" },
set: { unit: "унсур", verb: "дошта бошад" },
map: { unit: "сабт", verb: "дошта бошад" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "вуруд",
email: "суроғаи email",
url: "URL",
emoji: "эмоҷи",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "санаву вақти ISO",
date: "санаи ISO",
time: "вақти ISO",
duration: "давомнокии ISO",
ipv4: "суроғаи IPv4",
ipv6: "суроғаи IPv6",
mac: "суроғаи MAC",
cidrv4: "маҳдудаи IPv4",
cidrv6: "маҳдудаи IPv6",
base64: "сатри дар формати base64",
base64url: "сатри дар формати base64url",
json_string: "сатри JSON",
e164: "рақами E.164",
credit_card: "рақами корти кредитӣ",
currency_code: "рамзи асъор",
iban: "IBAN",
jwt: "JWT",
template_literal: "вуруд",
};
const TypeDictionary = {
nan: "NaN",
number: "рақам",
string: "сатр",
array: "массив",
object: "объект",
date: "сана",
};
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;
return `Вуруди нодуруст: ${expected} интизор мерафт, ${received} гирифта шуд`;
}
case "invalid_value":
if (issue.values.length === 1)
return `Вуруди нодуруст: ${util.stringifyPrimitive(issue.values[0])} интизор мерафт`;
return `Интихоби нодуруст: яке аз ${util.joinValues(issue.values, "|")} интизор мерафт`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Хеле калон: ${issue.origin ?? "қимат"} бояд ${adj}${issue.maximum.toString()} ${sizing.unit} ${sizing.verb}`;
return `Хеле калон: ${issue.origin ?? "қимат"} бояд ${adj}${issue.maximum.toString()} бошад`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing)
return `Хеле хурд: ${issue.origin} бояд ${adj}${issue.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
return `Хеле хурд: ${issue.origin} бояд ${adj}${issue.minimum.toString()} бошад`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `Сатри нодуруст: бояд бо "${_issue.prefix}" оғоз шавад`;
if (_issue.format === "ends_with")
return `Сатри нодуруст: бояд бо "${_issue.suffix}" анҷом ёбад`;
if (_issue.format === "includes")
return `Сатри нодуруст: бояд "${_issue.includes}"-ро дар бар гирад`;
if (_issue.format === "regex")
return `Сатри нодуруст: бояд ба намунаи ${_issue.pattern} мувофиқат кунад`;
return `${FormatDictionary[_issue.format] ?? issue.format}-и нодуруст`;
}
case "not_multiple_of":
return `Рақами нодуруст: бояд ба ${issue.divisor} бе бақия тақсим шавад`;
case "unrecognized_keys":
return `Калид${issue.keys.length > 1 ? "ҳои" : "и"} номаълум: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Калиди нодуруст дар ${issue.origin}`;
case "invalid_union":
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
return `Қимати нодурусти дискриминатор: ${opts} интизор мерафт`;
}
return "Вуруди нодуруст";
case "invalid_element":
return `Қимати нодуруст дар ${issue.origin}`;
default:
return `Вуруди нодуруст`;
}
};
};
export default function () {
return {
localeError: error(),
};
}
@@ -0,0 +1,23 @@
'use strict'
module.exports = clone
var getPrototypeOf = Object.getPrototypeOf || function (obj) {
return obj.__proto__
}
function clone (obj) {
if (obj === null || typeof obj !== 'object')
return obj
if (obj instanceof Object)
var copy = { __proto__: getPrototypeOf(obj) }
else
var copy = Object.create(null)
Object.getOwnPropertyNames(obj).forEach(function (key) {
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
})
return copy
}
@@ -0,0 +1,32 @@
import { expect, test } from "vitest";
import * as z from "zod/v4";
const description = "a description";
// test("passing `description` to schema should add a description", () => {
// expect(z.string({ description }).description).toEqual(description);
// expect(z.number({ description }).description).toEqual(description);
// expect(z.boolean({ description }).description).toEqual(description);
// });
test(".describe", () => {
expect(z.string().describe(description).description).toEqual(description);
expect(z.number().describe(description).description).toEqual(description);
expect(z.boolean().describe(description).description).toEqual(description);
});
test("adding description with z.globalRegistry", () => {
const schema = z.string();
z.core.globalRegistry.add(schema, { description });
z.core.globalRegistry.get(schema);
expect(schema.description).toEqual(description);
});
// in Zod 4 descriptions are not inherited
// test("description should carry over to chained schemas", () => {
// const schema = z.string().describe(description);
// expect(schema.description).toEqual(description);
// expect(schema.optional().description).toEqual(description);
// expect(schema.optional().nullable().default("default").description).toEqual(description);
// });
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const codegen_1 = require("../../compile/codegen");
const error = {
message({ keyword, schemaCode }) {
const comp = keyword === "maxItems" ? "more" : "fewer";
return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} items`;
},
params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`,
};
const def = {
keyword: ["maxItems", "minItems"],
type: "array",
schemaType: "number",
$data: true,
error,
code(cxt) {
const { keyword, data, schemaCode } = cxt;
const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT;
cxt.fail$data((0, codegen_1._) `${data}.length ${op} ${schemaCode}`);
},
};
exports.default = def;
//# sourceMappingURL=limitItems.js.map