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,9 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
export { default } from './rotate-3d.js';
//# sourceMappingURL=rotate-3-d.js.map
@@ -0,0 +1 @@
{"version":3,"file":"paint-bucket.js","sources":["../../../src/icons/paint-bucket.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name PaintBucket\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTkgMTEtOC04LTguNiA4LjZhMiAyIDAgMCAwIDAgMi44bDUuMiA1LjJjLjguOCAyIC44IDIuOCAwTDE5IDExWiIgLz4KICA8cGF0aCBkPSJtNSAyIDUgNSIgLz4KICA8cGF0aCBkPSJNMiAxM2gxNSIgLz4KICA8cGF0aCBkPSJNMjIgMjBhMiAyIDAgMSAxLTQgMGMwLTEuNiAxLjctMi40IDItNCAuMyAxLjYgMiAyLjQgMiA0WiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/paint-bucket\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 PaintBucket = createLucideIcon('PaintBucket', [\n [\n 'path',\n { d: 'm19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z', key: 'irua1i' },\n ],\n ['path', { d: 'm5 2 5 5', key: '1lls2c' }],\n ['path', { d: 'M2 13h15', key: '1hkzvu' }],\n ['path', { d: 'M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z', key: 'xk76lq' }],\n]);\n\nexport default PaintBucket;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAClD,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqE,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAS,CAAA,CAAA;AAAA,CAC1F,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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;AAC3F,CAAC,CAAA,CAAA;;"}
@@ -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 MessageCircleX = createLucideIcon("MessageCircleX", [
["path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z", key: "vv11sd" }],
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
["path", { d: "m9 9 6 6", key: "z0biqf" }]
]);
export { MessageCircleX as default };
//# sourceMappingURL=message-circle-x.js.map
@@ -0,0 +1,79 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_middleware_etag_digest = require("./digest.js");
//#region src/middleware/etag/index.ts
/**
* Default headers to pass through on 304 responses. From the spec:
* > The response must not contain a body and must include the headers that
* > would have been sent in an equivalent 200 OK response: Cache-Control,
* > Content-Location, Date, ETag, Expires, and Vary.
*/
const RETAINED_304_HEADERS = [
"cache-control",
"content-location",
"date",
"etag",
"expires",
"vary"
];
const stripWeak = (tag) => tag.replace(/^W\//, "");
function etagMatches(etag, ifNoneMatch) {
return ifNoneMatch != null && ifNoneMatch.split(",").some((t) => stripWeak(t.trim()) === stripWeak(etag));
}
function initializeGenerator(generator) {
if (!generator) {
if (crypto && crypto.subtle) generator = (body) => crypto.subtle.digest({ name: "SHA-1" }, body);
}
return generator;
}
/**
* ETag Middleware for Hono.
*
* @see {@link https://hono.dev/docs/middleware/builtin/etag}
*
* @param {ETagOptions} [options] - The options for the ETag middleware.
* @param {boolean} [options.weak=false] - Define using or not using a weak validation. If true is set, then `W/` is added to the prefix of the value.
* @param {string[]} [options.retainedHeaders=RETAINED_304_HEADERS] - The headers that you want to retain in the 304 Response.
* @param {function(Uint8Array): ArrayBuffer | Promise<ArrayBuffer>} [options.generateDigest] -
* A custom digest generation function. By default, it uses 'SHA-1'
* This function is called with the response body as a `Uint8Array` and should return a hash as an `ArrayBuffer` or a Promise of one.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* const app = new Hono()
*
* app.use('/etag/*', etag())
* app.get('/etag/abc', (c) => {
* return c.text('Hono is hot')
* })
* ```
*/
const etag = (options) => {
const retainedHeaders = new Set((options?.retainedHeaders ?? RETAINED_304_HEADERS).map((header) => header.toLowerCase()));
const weak = options?.weak ?? false;
const generator = initializeGenerator(options?.generateDigest);
return async function etag(c, next) {
const ifNoneMatch = c.req.header("If-None-Match") ?? null;
await next();
if (!(c.req.method === "GET" || c.req.method === "HEAD" || c.req.method === "QUERY") || !c.res.ok) return;
const res = c.res;
let etag = res.headers.get("ETag");
if (!etag) {
if (!generator) return;
const hash = await require_middleware_etag_digest.generateDigest(res.clone().body, generator);
if (hash === null) return;
etag = weak ? `W/"${hash}"` : `"${hash}"`;
}
if (ifNoneMatch === "*" || etagMatches(etag, ifNoneMatch)) {
c.res = new Response(null, {
status: 304,
statusText: "Not Modified",
headers: { ETag: etag }
});
for (const key of Array.from(c.res.headers.keys())) if (!retainedHeaders.has(key.toLowerCase())) c.res.headers.delete(key);
} else c.res.headers.set("ETag", etag);
};
};
//#endregion
exports.RETAINED_304_HEADERS = RETAINED_304_HEADERS;
exports.etag = etag;
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:ev="http://purl.org/rss/1.0/modules/event/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:admin="http://webns.net/mvcb/">
<channel rdf:about="https://github.com/fb55/htmlparser2/">
<title>A title to parse and remember</title>
<link>https://github.com/fb55/htmlparser2/</link>
<description/>
<dc:language>en-us</dc:language>
<dc:rights>Copyright 2015 the authors</dc:rights>
<dc:publisher>webmaster@thisisafakedoma.in</dc:publisher>
<dc:creator>webmaster@thisisafakedoma.in</dc:creator>
<dc:source>https://github.com/fb55/htmlparser2/</dc:source>
<dc:title>A title to parse and remember</dc:title>
<dc:type>Collection</dc:type>
<syn:updateBase>2011-11-04T09:39:10-07:00</syn:updateBase>
<syn:updateFrequency>4</syn:updateFrequency>
<syn:updatePeriod>hourly</syn:updatePeriod>
<items>
<rdf:Seq>
<rdf:li rdf:resource="http://somefakesite/path/to/something.html"/>
</rdf:Seq>
</items>
</channel>
<item rdf:about="http://somefakesite/path/to/something.html">
<title><![CDATA[ Fast HTML Parsing ]]></title>
<link>
http://somefakesite/path/to/something.html
</link>
<description><![CDATA[
Great test content<br>A link: <a href="http://github.com">Github</a>
]]></description>
<dc:date>2011-11-04T09:35:17-07:00</dc:date>
<dc:language>en-us</dc:language>
<dc:rights>Copyright 2015 the authors</dc:rights>
<dc:source>
http://somefakesite/path/to/something.html
</dc:source>
<dc:title><![CDATA[ Fast HTML Parsing ]]></dc:title>
<dc:type>text</dc:type>
<dcterms:issued>2011-11-04T09:35:17-07:00</dcterms:issued>
</item>
<item rdf:about="http://somefakesite/path/to/something-else.html">
<title><![CDATA[
This space intentionally left blank
]]></title>
<link>
http://somefakesite/path/to/something-else.html
</link>
<description><![CDATA[
The early bird gets the worm
]]></description>
<dc:date>2011-11-04T09:34:54-07:00</dc:date>
<dc:language>en-us</dc:language>
<dc:rights>Copyright 2015 the authors</dc:rights>
<dc:source>
http://somefakesite/path/to/something-else.html
</dc:source>
<dc:title><![CDATA[
This space intentionally left blank
]]></dc:title>
<dc:type>text</dc:type>
<dcterms:issued>2011-11-04T09:34:54-07:00</dcterms:issued>
</item>
</rdf:RDF>
@@ -0,0 +1,78 @@
{
"name": "semver",
"version": "7.7.4",
"description": "The semantic version parser used by npm.",
"main": "index.js",
"scripts": {
"test": "tap",
"snap": "tap",
"lint": "npm run eslint",
"postlint": "template-oss-check",
"lintfix": "npm run eslint -- --fix",
"posttest": "npm run lint",
"template-oss-apply": "template-oss-apply --force",
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
},
"devDependencies": {
"@npmcli/eslint-config": "^6.0.0",
"@npmcli/template-oss": "4.29.0",
"benchmark": "^2.1.4",
"tap": "^16.0.0"
},
"license": "ISC",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/node-semver.git"
},
"bin": {
"semver": "bin/semver.js"
},
"files": [
"bin/",
"lib/",
"classes/",
"functions/",
"internal/",
"ranges/",
"index.js",
"preload.js",
"range.bnf"
],
"tap": {
"timeout": 30,
"coverage-map": "map.js",
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
},
"engines": {
"node": ">=10"
},
"author": "GitHub Inc.",
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.29.0",
"engines": ">=10",
"distPaths": [
"classes/",
"functions/",
"internal/",
"ranges/",
"index.js",
"preload.js",
"range.bnf"
],
"allowPaths": [
"/classes/",
"/functions/",
"/internal/",
"/ranges/",
"/index.js",
"/preload.js",
"/range.bnf",
"/benchmarks"
],
"publish": "true"
}
}
@@ -0,0 +1,9 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
export { default } from './arrow-down-0-1.js';
//# sourceMappingURL=arrow-down-01.js.map
@@ -0,0 +1 @@
{"version":3,"file":"message-square-x.js","sources":["../../../src/icons/message-square-x.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name MessageSquareX\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjEgMTVhMiAyIDAgMCAxLTIgMkg3bC00IDRWNWEyIDIgMCAwIDEgMi0yaDE0YTIgMiAwIDAgMSAyIDJ6IiAvPgogIDxwYXRoIGQ9Im0xNC41IDcuNS01IDUiIC8+CiAgPHBhdGggZD0ibTkuNSA3LjUgNSA1IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/message-square-x\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 MessageSquareX = createLucideIcon('MessageSquareX', [\n ['path', { d: 'M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z', key: '1lielz' }],\n ['path', { d: 'm14.5 7.5-5 5', key: '3lb6iw' }],\n ['path', { d: 'm9.5 7.5 5 5', key: 'ko136h' }],\n]);\n\nexport default MessageSquareX;\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,CAAiE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,C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AC;QACrD,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC;QACnB,sEAAsE;QACtE,IAAI,IAAI,CAAC,QAAQ,KAAK,EAAE,IAAI,MAAM,EAAE,CAAC;YACnC,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,Line truncated
@@ -0,0 +1,27 @@
/*
Value in range from progress
Given a lower limit and an upper limit, we return the value within
that range as expressed by progress (usually a number from 0 to 1)
So progress = 0.5 would change
from -------- to
to
from ---- to
E.g. from = 10, to = 20, progress = 0.5 => 15
@param [number]: Lower limit of range
@param [number]: Upper limit of range
@param [number]: The progress between lower and upper limits expressed 0-1
@return [number]: Value as calculated from progress within range (not limited within range)
*/
const mixNumber = (from, to, progress) => {
return from + (to - from) * progress;
};
export { mixNumber };
//# sourceMappingURL=number.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"scoring.mjs","sources":["../../../src/matcher/wordSequence/scoring.ts"],"sourcesContent":[null],"names":["factorial","n","match","pattern","baseGuesses","wordCount","lengthPenalty"],"mappings":"AAEA,SAASA,SAASA,CAACC,CAAS,EAAA;AAC1B,EAAA,IAAIA,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;AACpB,EAAA,OAAOA,CAAC,GAAGD,SAAS,CAACC,CAAC,GAAG,CAAC,CAAC;AAC7B;AAEA,0BAAgBC,KAAqC,IAAY;AAC/D,EAAA,IAAIA,KAAK,CAACC,OAAO,KAAK,cAAc,EAAE;AACpC,IAAA,OAAO,CAAC;AACV,EAAA;AAEA;AACA,EAAA,MAAMC,WAAW,GAAGJ,SAAS,CAACE,KAAK,CAACG,SAAS,CAAC;AAE9C;EACA,MAAMC,aAAa,GAAG,CAAC,KAAKJ,KAAK,CAACG,SAAS,GAAG,CAAC,CAAC;EAEhD,OAAOD,WAAW,GAAGE,aAAa;AACpC,CAAC;;;;"}
@@ -0,0 +1,58 @@
import { f as createRule } from "../utils.js";
const tupleRe = /^([\w$]+)(\s*)(\?\s*)?:(\s*)(.*)$/;
var type_named_tuple_spacing_default = createRule({
name: "type-named-tuple-spacing",
meta: {
type: "layout",
docs: { description: "Expect space before the type declaration in the named tuple" },
fixable: "whitespace",
schema: [],
messages: {
expectedSpaceAfter: "Expected a space after the ':'.",
unexpectedSpaceBetween: "Unexpected space between '?' and the ':'.",
unexpectedSpaceBefore: "Unexpected space before the ':'."
}
},
create: (context) => {
const sourceCode = context.sourceCode;
return { TSNamedTupleMember(node) {
const code = sourceCode.text.slice(node.range[0], node.range[1]);
const match = code.match(tupleRe);
if (!match) return;
const labelName = node.label.name;
const spaceBeforeColon = match[2];
const optionalMark = match[3];
const spacesAfterColon = match[4];
const elementType = match[5];
function getReplaceValue() {
let ret = labelName;
if (node.optional) ret += "?";
ret += ": ";
ret += elementType;
return ret;
}
if (optionalMark?.length > 1) context.report({
node,
messageId: "unexpectedSpaceBetween",
*fix(fixer) {
yield fixer.replaceTextRange(node.range, code.replace(tupleRe, getReplaceValue()));
}
});
if (spaceBeforeColon?.length) context.report({
node,
messageId: "unexpectedSpaceBefore",
*fix(fixer) {
yield fixer.replaceTextRange(node.range, code.replace(tupleRe, getReplaceValue()));
}
});
if (spacesAfterColon != null && spacesAfterColon.length !== 1) context.report({
node,
messageId: "expectedSpaceAfter",
*fix(fixer) {
yield fixer.replaceTextRange(node.range, code.replace(tupleRe, getReplaceValue()));
}
});
} };
}
});
export { type_named_tuple_spacing_default as t };
@@ -0,0 +1 @@
{"version":3,"file":"calendar-days.js","sources":["../../../src/icons/calendar-days.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CalendarDays\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNOCAydjQiIC8+CiAgPHBhdGggZD0iTTE2IDJ2NCIgLz4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHg9IjMiIHk9IjQiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Ik0zIDEwaDE4IiAvPgogIDxwYXRoIGQ9Ik04IDE0aC4wMSIgLz4KICA8cGF0aCBkPSJNMTIgMTRoLjAxIiAvPgogIDxwYXRoIGQ9Ik0xNiAxNGguMDEiIC8+CiAgPHBhdGggZD0iTTggMThoLjAxIiAvPgogIDxwYXRoIGQ9Ik0xMiAxOGguMDEiIC8+CiAgPHBhdGggZD0iTTE2IDE4aC4wMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/calendar-days\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 CalendarDays = createLucideIcon('CalendarDays', [\n ['path', { d: 'M8 2v4', key: '1cmpym' }],\n ['path', { d: 'M16 2v4', key: '4m81vk' }],\n ['rect', { width: '18', height: '18', x: '3', y: '4', rx: '2', key: '1hopcy' }],\n ['path', { d: 'M3 10h18', key: '8toen8' }],\n ['path', { d: 'M8 14h.01', key: '6423bh' }],\n ['path', { d: 'M12 14h.01', key: '1etili' }],\n ['path', { d: 'M16 14h.01', key: '1gbofw' }],\n ['path', { d: 'M8 18h.01', key: 'lrp35t' }],\n ['path', { d: 'M12 18h.01', key: 'mhygvu' }],\n ['path', { d: 'M16 18h.01', key: 'kzsmim' }],\n]);\n\nexport default CalendarDays;\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C9E,qCAAqC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrE,gDAAgD,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAChF,wBAAwB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxD,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrD,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAChD,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5C,wBAAwB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxD,oBAAoB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpD,0BAA0B,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAClD,2BAA2B,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACnD,+BAA+Line truncated
@@ -0,0 +1,43 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_jsx_constants = require("../constants.js");
const require_jsx_dom_utils = require("./utils.js");
const require_jsx_context = require("../context.js");
//#region src/jsx/dom/context.ts
const createContextProviderFunction = (values) => ({ value, children }) => {
if (!children) return;
const props = { children: [{
tag: require_jsx_dom_utils.setInternalTagFlag(() => {
values.push(value);
}),
props: {}
}] };
if (Array.isArray(children)) props.children.push(...children.flat());
else props.children.push(children);
props.children.push({
tag: require_jsx_dom_utils.setInternalTagFlag(() => {
values.pop();
}),
props: {}
});
const res = {
tag: "",
props,
type: ""
};
res[require_jsx_constants.DOM_ERROR_HANDLER] = (err) => {
values.pop();
throw err;
};
return res;
};
const createContext = (defaultValue) => {
const values = [defaultValue];
const context = createContextProviderFunction(values);
context.values = values;
context.Provider = context;
require_jsx_context.globalContexts.push(context);
return context;
};
//#endregion
exports.createContext = createContext;
exports.createContextProviderFunction = createContextProviderFunction;
@@ -0,0 +1,122 @@
import * as util from "../core/util.js";
const error = () => {
const Sizable = {
string: { unit: "caractere", verb: "să aibă" },
file: { unit: "octeți", verb: "să aibă" },
array: { unit: "elemente", verb: "să aibă" },
set: { unit: "elemente", verb: "să aibă" },
map: { unit: "intrări", verb: "să aibă" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "intrare",
email: "adresă de 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: "dată și oră ISO",
date: "dată ISO",
time: "oră ISO",
duration: "durată ISO",
ipv4: "adresă IPv4",
ipv6: "adresă IPv6",
mac: "adresă MAC",
cidrv4: "interval IPv4",
cidrv6: "interval IPv6",
base64: "șir codat base64",
base64url: "șir codat base64url",
json_string: "șir JSON",
e164: "număr E.164",
credit_card: "număr de card de credit",
currency_code: "cod valutar",
iban: "IBAN",
jwt: "JWT",
template_literal: "intrare",
};
const TypeDictionary = {
nan: "NaN",
string: "șir",
number: "număr",
boolean: "boolean",
function: "funcție",
array: "matrice",
object: "obiect",
undefined: "nedefinit",
symbol: "simbol",
bigint: "număr mare",
void: "void",
never: "never",
map: "hartă",
set: "set",
};
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 `Intrare invalidă: așteptat ${expected}, primit ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `Intrare invalidă: așteptat ${util.stringifyPrimitive(issue.values[0])}`;
return `Opțiune invalidă: așteptat una dintre ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Prea mare: așteptat ca ${issue.origin ?? "valoarea"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemente"}`;
return `Prea mare: așteptat ca ${issue.origin ?? "valoarea"} să fie ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Prea mic: așteptat ca ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `Prea mic: așteptat ca ${issue.origin} să fie ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with") {
return `Șir invalid: trebuie să înceapă cu "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Șir invalid: trebuie să se termine cu "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Șir invalid: trebuie să includă "${_issue.includes}"`;
if (_issue.format === "regex")
return `Șir invalid: trebuie să se potrivească cu modelul ${_issue.pattern}`;
return `Format invalid: ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Număr invalid: trebuie să fie multiplu de ${issue.divisor}`;
case "unrecognized_keys":
return `Chei nerecunoscute: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Cheie invalidă în ${issue.origin}`;
case "invalid_union":
return "Intrare invalidă";
case "invalid_element":
return `Valoare invalidă în ${issue.origin}`;
default:
return `Intrare invalidă`;
}
};
};
export default function () {
return {
localeError: error(),
};
}
@@ -0,0 +1,196 @@
/**
* @fileoverview The schema to validate language options
* @author Nicholas C. Zakas
*/
"use strict";
//-----------------------------------------------------------------------------
// Data
//-----------------------------------------------------------------------------
const globalVariablesValues = new Set([
true,
"true",
"writable",
"writeable",
false,
"false",
"readonly",
"readable",
null,
"off",
]);
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Check if a value is a non-null object.
* @param {any} value The value to check.
* @returns {boolean} `true` if the value is a non-null object.
*/
function isNonNullObject(value) {
return typeof value === "object" && value !== null;
}
/**
* Check if a value is a non-null non-array object.
* @param {any} value The value to check.
* @returns {boolean} `true` if the value is a non-null non-array object.
*/
function isNonArrayObject(value) {
return isNonNullObject(value) && !Array.isArray(value);
}
/**
* Check if a value is undefined.
* @param {any} value The value to check.
* @returns {boolean} `true` if the value is undefined.
*/
function isUndefined(value) {
return typeof value === "undefined";
}
//-----------------------------------------------------------------------------
// Schemas
//-----------------------------------------------------------------------------
/**
* Validates the ecmaVersion property.
* @param {string|number} ecmaVersion The value to check.
* @returns {void}
* @throws {TypeError} If the value is invalid.
*/
function validateEcmaVersion(ecmaVersion) {
if (isUndefined(ecmaVersion)) {
throw new TypeError(
'Key "ecmaVersion": Expected an "ecmaVersion" property.',
);
}
if (typeof ecmaVersion !== "number" && ecmaVersion !== "latest") {
throw new TypeError(
'Key "ecmaVersion": Expected a number or "latest".',
);
}
}
/**
* Validates the sourceType property.
* @param {string} sourceType The value to check.
* @returns {void}
* @throws {TypeError} If the value is invalid.
*/
function validateSourceType(sourceType) {
if (
typeof sourceType !== "string" ||
!/^(?:script|module|commonjs)$/u.test(sourceType)
) {
throw new TypeError(
'Key "sourceType": Expected "script", "module", or "commonjs".',
);
}
}
/**
* Validates the globals property.
* @param {Object} globals The value to check.
* @returns {void}
* @throws {TypeError} If the value is invalid.
*/
function validateGlobals(globals) {
if (!isNonArrayObject(globals)) {
throw new TypeError('Key "globals": Expected an object.');
}
for (const key of Object.keys(globals)) {
// avoid hairy edge case
if (key === "__proto__") {
continue;
}
if (key !== key.trim()) {
throw new TypeError(
`Key "globals": Global "${key}" has leading or trailing whitespace.`,
);
}
if (!globalVariablesValues.has(globals[key])) {
throw new TypeError(
`Key "globals": Key "${key}": Expected "readonly", "writable", or "off".`,
);
}
}
}
/**
* Validates the parser property.
* @param {Object} parser The value to check.
* @returns {void}
* @throws {TypeError} If the value is invalid.
*/
function validateParser(parser) {
if (
!parser ||
typeof parser !== "object" ||
(typeof parser.parse !== "function" &&
typeof parser.parseForESLint !== "function")
) {
throw new TypeError(
'Key "parser": Expected object with parse() or parseForESLint() method.',
);
}
}
/**
* Validates the language options.
* @param {Object} languageOptions The language options to validate.
* @returns {void}
* @throws {TypeError} If the language options are invalid.
*/
function validateLanguageOptions(languageOptions) {
if (!isNonArrayObject(languageOptions)) {
throw new TypeError("Expected an object.");
}
const {
ecmaVersion,
sourceType,
globals,
parser,
parserOptions,
...otherOptions
} = languageOptions;
if ("ecmaVersion" in languageOptions) {
validateEcmaVersion(ecmaVersion);
}
if ("sourceType" in languageOptions) {
validateSourceType(sourceType);
}
if ("globals" in languageOptions) {
validateGlobals(globals);
}
if ("parser" in languageOptions) {
validateParser(parser);
}
if ("parserOptions" in languageOptions) {
if (!isNonArrayObject(parserOptions)) {
throw new TypeError('Key "parserOptions": Expected an object.');
}
}
const otherOptionKeys = Object.keys(otherOptions);
if (otherOptionKeys.length > 0) {
throw new TypeError(`Unexpected key "${otherOptionKeys[0]}" found.`);
}
}
module.exports = { validateLanguageOptions };
@@ -0,0 +1,101 @@
import { expect, test } from "vitest";
import * as z from "zod/v4";
test("string to number pipe", () => {
const schema = z.string().transform(Number).pipe(z.number());
expect(schema.parse("1234")).toEqual(1234);
});
test("string to number pipe async", async () => {
const schema = z
.string()
.transform(async (val) => Number(val))
.pipe(z.number());
expect(await schema.parseAsync("1234")).toEqual(1234);
});
test("string with default fallback", () => {
const stringWithDefault = z
.pipe(
z.transform((v) => (v === "none" ? undefined : v)),
z.string()
)
.catch("default");
expect(stringWithDefault.parse("ok")).toBe("ok");
expect(stringWithDefault.parse(undefined)).toBe("default");
expect(stringWithDefault.parse("none")).toBe("default");
expect(stringWithDefault.parse(15)).toBe("default");
});
test("continue on non-fatal errors", () => {
const schema = z
.string()
.refine((c) => c === "1234", "A")
.transform((val) => Number(val))
.refine((c) => c === 1234, "B");
schema.parse("1234");
expect(schema.safeParse("4321")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"path": [],
"message": "A"
}
]],
"success": false,
}
`);
});
test("break on fatal errors", () => {
const schema = z
.string()
.refine((c) => c === "1234", { message: "A", abort: true })
.transform((val) => Number(val))
.refine((c) => c === 1234, "B");
schema.parse("1234");
expect(schema.safeParse("4321")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"path": [],
"message": "A"
}
]],
"success": false,
}
`);
});
test("reverse parsing with pipe", () => {
const schema = z.string().pipe(z.string());
// Reverse direction: default should NOT be applied
expect(z.safeDecode(schema, "asdf")).toMatchInlineSnapshot(`
{
"data": "asdf",
"success": true,
}
`);
expect(z.safeEncode(schema, "asdf")).toMatchInlineSnapshot(`
{
"data": "asdf",
"success": true,
}
`);
});
test("reverse parsing with pipe", () => {
const schema = z.string().transform((val) => val.length);
// should throw
expect(() => z.encode(schema, 1234)).toThrow();
});
@@ -0,0 +1,21 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const TramFront = createLucideIcon("TramFront", [
["rect", { width: "16", height: "16", x: "4", y: "3", rx: "2", key: "1wxw4b" }],
["path", { d: "M4 11h16", key: "mpoxn0" }],
["path", { d: "M12 3v8", key: "1h2ygw" }],
["path", { d: "m8 19-2 3", key: "13i0xs" }],
["path", { d: "m18 22-2-3", key: "1p0ohu" }],
["path", { d: "M8 15h.01", key: "a7atzg" }],
["path", { d: "M16 15h.01", key: "rnfrdf" }]
]);
export { TramFront as default };
//# sourceMappingURL=tram-front.js.map
@@ -0,0 +1,848 @@
import { asyncWalk } from "estree-walker";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { LEAST_UPPER_BOUND, TraceMap, allGeneratedPositionsFor, originalPositionFor, sourceContentFor } from "@jridgewell/trace-mapping";
import { readFileSync } from "node:fs";
import { readFile } from "node:fs/promises";
import jsTokens from "js-tokens";
//#region src/ast.ts
function getWalker() {
let nextIgnore = false;
function onIgnore(node) {
nextIgnore = node;
}
async function walk(ast, ignoreHints, ignoreClassMethods, visitors) {
return await asyncWalk(ast, {
async enter(node) {
if (nextIgnore !== false) return;
const hint = getIgnoreHint(node);
if (hint === "next") return onIgnore(node);
if (isSkipped(node)) onIgnore(node);
switch (node.type) {
case "FunctionDeclaration": return visitors.onFunctionDeclaration(node);
case "FunctionExpression":
if (ignoreClassMethods && node.id?.name) {
if (ignoreClassMethods.includes(node.id.name)) return onIgnore(node);
}
return visitors.onFunctionExpression(node);
case "MethodDefinition": return visitors.onMethodDefinition(node);
case "Property": return visitors.onProperty(node);
case "ArrowFunctionExpression":
if (node.body?.type === "ParenthesizedExpression") node.body = node.body.expression;
return visitors.onArrowFunctionExpression(node);
case "ExpressionStatement": return visitors.onExpressionStatement(node);
case "BreakStatement": return visitors.onBreakStatement(node);
case "ContinueStatement": return visitors.onContinueStatement(node);
case "DebuggerStatement": return visitors.onDebuggerStatement(node);
case "ReturnStatement": return visitors.onReturnStatement(node);
case "ThrowStatement": return visitors.onThrowStatement(node);
case "TryStatement": return visitors.onTryStatement(node);
case "ForStatement": return visitors.onForStatement(node);
case "ForInStatement": return visitors.onForInStatement(node);
case "ForOfStatement": return visitors.onForOfStatement(node);
case "WhileStatement": return visitors.onWhileStatement(node);
case "DoWhileStatement": return visitors.onDoWhileStatement(node);
case "WithStatement": return visitors.onWithStatement(node);
case "LabeledStatement": return visitors.onLabeledStatement(node);
case "VariableDeclarator": return visitors.onVariableDeclarator(node);
case "ClassBody": {
const classBody = node;
if (ignoreClassMethods) {
for (const child of classBody.body) if (child.type === "MethodDefinition" || child.type === "ClassMethod") {
const name = child.key.type === "Identifier" && child.key.name;
if (name && ignoreClassMethods.includes(name)) setSkipped(child);
}
classBody.body = classBody.body.filter((child) => !isSkipped(child));
}
return visitors.onClassBody(classBody);
}
case "IfStatement": {
const branches = [];
if (node.consequent.type !== "BlockStatement") node.consequent = {
type: "BlockStatement",
body: [node.consequent],
start: node.consequent.start,
end: node.consequent.end
};
if (node.alternate && node.alternate.type !== "BlockStatement") node.alternate = {
type: "BlockStatement",
body: [node.alternate],
start: node.alternate.start,
end: node.alternate.end
};
if (hint === "if") setSkipped(node.consequent);
else branches.push(node.consequent);
if (hint === "else" && node.alternate) setSkipped(node.alternate);
else if (hint !== "if" && hint !== "else") branches.push(node.alternate);
return visitors.onIfStatement(node, branches);
}
case "SwitchStatement": {
const cases = [];
for (const _case of node.cases) if (getIgnoreHint(_case) !== "next") cases.push(_case);
return visitors.onSwitchStatement(node, cases);
}
case "ConditionalExpression": {
const branches = [];
if (node.consequent.type === "ParenthesizedExpression") node.consequent = node.consequent.expression;
if (node.alternate.type === "ParenthesizedExpression") node.alternate = node.alternate.expression;
if (getIgnoreHint(node.consequent) === "next") setSkipped(node.consequent);
else branches.push(node.consequent);
if (getIgnoreHint(node.alternate) === "next") setSkipped(node.alternate);
else branches.push(node.alternate);
return visitors.onConditionalExpression(node, branches);
}
case "LogicalExpression": {
if (isSkipped(node)) return;
const branches = [];
function visit(child) {
if (child.type === "LogicalExpression") {
setSkipped(child);
if (getIgnoreHint(child) !== "next") {
visit(child.left);
return visit(child.right);
}
}
branches.push(child);
}
visit(node);
return visitors.onLogicalExpression(node, branches);
}
case "AssignmentPattern": return visitors.onAssignmentPattern(node);
case "ClassMethod": return visitors.onClassMethod(node);
case "ObjectMethod": return visitors.onObjectMethod(node);
}
},
async leave(node) {
if (node === nextIgnore) nextIgnore = false;
}
});
function getIgnoreHint(node) {
for (const hint of ignoreHints) if (hint.loc.end === node.start) return hint.type;
return null;
}
}
return {
walk,
onIgnore
};
}
const skippedNodes = /* @__PURE__ */ new WeakSet();
function getFunctionName(node) {
if (node.type === "Identifier") return node.name;
if ("id" in node && node.id) return getFunctionName(node.id);
}
function setSkipped(node) {
skippedNodes.add(node);
}
function isSkipped(node) {
return skippedNodes.has(node);
}
//#endregion
//#region src/coverage-map.ts
function createCoverageMapData(filename, sourceMap) {
const data = {};
const directory = dirname(filename);
for (const source of sourceMap.sources) {
let path = filename;
if (source) if (source.startsWith("file://")) path = fileURLToPath(source);
else path = resolve(directory, source);
data[path] = {
path,
statementMap: {},
fnMap: {},
branchMap: {},
s: {},
f: {},
b: {},
meta: {
lastBranch: 0,
lastFunction: 0,
lastStatement: 0,
seen: {}
}
};
}
return data;
}
function addFunction(options) {
const fileCoverage = options.coverageMapData[options.filename];
const meta = fileCoverage.meta;
const key = `f:${cacheKey(options.decl)}`;
let index = meta.seen[key];
if (index == null) {
index = meta.lastFunction;
meta.lastFunction++;
meta.seen[key] = index;
fileCoverage.fnMap[index] = {
name: options.name || `(anonymous_${index})`,
decl: pickLocation(options.decl),
loc: pickLocation(options.loc),
line: options.loc.start.line
};
}
fileCoverage.f[index] ||= 0;
fileCoverage.f[index] += options.covered || 0;
}
function addStatement(options) {
const fileCoverage = options.coverageMapData[options.filename];
const meta = fileCoverage.meta;
const key = `s:${cacheKey(options.loc)}`;
let index = meta.seen[key];
if (index == null) {
index = meta.lastStatement;
meta.lastStatement++;
meta.seen[key] = index;
fileCoverage.statementMap[index] = pickLocation(options.loc);
}
fileCoverage.s[index] = options.covered || 0;
}
function addBranch(options) {
const fileCoverage = options.coverageMapData[options.filename];
const meta = fileCoverage.meta;
const key = ["b", ...options.locations.map(cacheKey)].join(":");
let index = meta.seen[key];
if (index == null) {
index = meta.lastBranch;
meta.lastBranch++;
meta.seen[key] = index;
fileCoverage.branchMap[index] = {
loc: pickLocation(options.loc),
type: options.type,
locations: options.locations.map((loc) => pickLocation(loc)),
line: options.loc.start.line
};
}
if (!fileCoverage.b[index]) fileCoverage.b[index] = Array(options.locations.length).fill(0);
options.covered?.forEach((hit, i) => {
if (fileCoverage.b[index][i] !== void 0) fileCoverage.b[index][i] += hit;
});
}
function pickLocation(loc) {
return {
start: {
line: loc.start.line,
column: loc.start.column
},
end: {
line: loc.end.line,
column: loc.end.column
}
};
}
function cacheKey(loc) {
return `${loc.start.line}:${loc.start.column}:${loc.end.line}:${loc.end.column}`;
}
//#endregion
//#region src/ignore-hints.ts
const IGNORE_PATTERN = /^\s*(?:istanbul|[cv]8|node:coverage)\s+ignore\s+(if|else|next|file)(?=\W|$)/;
const IGNORE_LINES_PATTERN = /\s*(?:istanbul|[cv]8|node:coverage)\s+ignore\s+(start|stop)(?=\W|$)/;
const EOL_PATTERN = /\r?\n/g;
/**
* Parse ignore hints from **Javascript** code based on AST
* - Most AST parsers don't emit comments in AST like Acorn does, so parse comments manually instead.
*/
function getIgnoreHints(code) {
const ignoreHints = [];
const tokens = jsTokens(code);
let current = 0;
let previousTokenWasIgnoreHint = false;
for (const token of tokens) {
if (previousTokenWasIgnoreHint && token.type !== "WhiteSpace" && token.type !== "LineTerminatorSequence") {
const previous = ignoreHints.at(-1);
if (previous) previous.loc.end = current;
previousTokenWasIgnoreHint = false;
}
if (token.type === "SingleLineComment" || token.type === "MultiLineComment") {
const loc = {
start: current,
end: current + token.value.length
};
const type = token.value.replace(/^\/\*\*/, "").replace(/^\/\*/, "").replace(/\*\*\/$/, "").replace(/\*\/$/, "").replace(/^\/\//, "").match(IGNORE_PATTERN)?.[1];
if (type === "file") return [{
type: "file",
loc: {
start: 0,
end: 0
}
}];
if (type === "if" || type === "else" || type === "next") {
ignoreHints.push({
type,
loc
});
previousTokenWasIgnoreHint = true;
}
}
current += token.value.length;
}
return ignoreHints;
}
/**
* Parse ignore start/stop hints from **text file** based on regular expressions
* - Does not understand what a comment is in Javascript (or JSX, Vue, Svelte)
* - Parses source code (JS, TS, Vue, Svelte, anything) based on text search by
* matching for `/* <name> ignore start *\/` pattern - not by looking for real comments
*
* ```js
* /* v8 ignore start *\/
* <!-- /* v8 ignore start *\/ -->
* <SomeFrameworkComment content="/* v8 ignore start *\/">
* ```
*/
function getIgnoredLines(text) {
if (!text) return /* @__PURE__ */ new Set();
const ranges = [];
let lineNumber = 0;
for (const line of text.split(EOL_PATTERN)) {
lineNumber++;
const match = line.match(IGNORE_LINES_PATTERN);
if (match) {
if (match[1] === "stop") {
const previous = ranges.at(-1);
if (previous && previous.stop === Infinity) previous.stop = lineNumber;
continue;
}
ranges.push({
start: lineNumber,
stop: Infinity
});
}
}
const ignoredLines = /* @__PURE__ */ new Set();
for (const range of ranges) for (let line = range.start; line <= range.stop; line++) {
ignoredLines.add(line);
if (line >= lineNumber) break;
}
return ignoredLines;
}
//#endregion
//#region src/location.ts
const WORD_PATTERN = /(\w+|\s|[^\w\s])/g;
const INLINE_MAP_PATTERN = /#\s*sourceMappingURL=(.*)\s*$/m;
const BASE_64_PREFIX = "data:application/json;base64,";
/** How often should offset calculations be cached */
const CACHE_THRESHOLD = 250;
var Locator = class {
#cache = /* @__PURE__ */ new Map();
#codeParts;
#map;
#directory;
#ignoredLines = /* @__PURE__ */ new Map();
constructor(code, map, directory) {
this.#codeParts = code.split("");
this.#map = map;
this.#directory = directory;
}
reset() {
this.#cache.clear();
this.#ignoredLines.clear();
this.#codeParts = [];
}
offsetToNeedle(offset) {
const closestThreshold = Math.floor(offset / CACHE_THRESHOLD) * CACHE_THRESHOLD;
const cacheHit = this.#cache.get(closestThreshold);
let current = cacheHit ? closestThreshold : 0;
let line = cacheHit?.line ?? 1;
let column = cacheHit?.column ?? 0;
for (let i = current; i <= this.#codeParts.length; i++) {
if (current === offset) return {
line,
column
};
if (current % CACHE_THRESHOLD === 0) this.#cache.set(current, {
line,
column
});
if (this.#codeParts[i] === "\n") {
line++;
column = 0;
} else column++;
current++;
}
return {
line,
column
};
}
getLoc(node) {
const startNeedle = this.offsetToNeedle(node.start);
const start = getPosition(startNeedle, this.#map);
if (start === null) return null;
const endNeedle = this.offsetToNeedle(node.end);
endNeedle.column -= 1;
let end = getPosition(endNeedle, this.#map);
if (end === null) {
for (let line = endNeedle.line; line >= startNeedle.line && end === null; line--) end = getPosition({
line,
column: Infinity
}, this.#map);
if (end === null) return null;
}
const loc = {
start,
end
};
const afterEndMappings = allGeneratedPositionsFor(this.#map, {
source: loc.end.filename,
line: loc.end.line,
column: loc.end.column + 1,
bias: LEAST_UPPER_BOUND
});
if (afterEndMappings.length === 0) loc.end.column = Infinity;
else for (const mapping of afterEndMappings) {
if (mapping.line === null) continue;
const original = originalPositionFor(this.#map, mapping);
if (original.line === loc.end.line) {
loc.end = {
...original,
filename: original.source
};
break;
}
}
const filename = loc.start.filename;
let ignoredLines = this.#ignoredLines.get(filename);
if (!ignoredLines) {
ignoredLines = getIgnoredLines(sourceContentFor(this.#map, filename) ?? tryReadFileSync(filename));
this.#ignoredLines.set(filename, ignoredLines);
}
if (ignoredLines.has(loc.start.line)) return null;
return loc;
}
getSourceLines(loc, filename) {
const index = this.#map.resolvedSources.findIndex((source) => source === filename || resolve(this.#directory, source) === filename);
const sourcesContent = this.#map.sourcesContent?.[index];
if (sourcesContent == null) return null;
const lines = sourcesContent.split("\n").slice(loc.start.line - 1, loc.end.line);
lines[0] = lines[0].slice(loc.start.column);
lines[lines.length - 1] = lines[lines.length - 1].slice(0, loc.end.column);
return lines.join("\n");
}
};
function getPosition(needle, map) {
let position = originalPositionFor(map, needle);
if (position.source == null) position = originalPositionFor(map, {
column: needle.column,
line: needle.line,
bias: LEAST_UPPER_BOUND
});
if (position.source == null) return null;
return {
line: position.line,
column: position.column,
filename: position.source
};
}
function createEmptySourceMap(filename, code) {
const mappings = [];
for (const [line, content] of code.split("\n").entries()) {
const parts = content.match(WORD_PATTERN) || [];
const segments = [];
let column = 0;
for (const part of parts) {
segments.push([
column,
0,
line,
column
]);
column += part.length;
}
mappings.push(segments);
}
return {
version: 3,
mappings,
file: filename,
sources: [filename],
sourcesContent: [code],
names: []
};
}
async function getInlineSourceMap(filename, code) {
const match = code.match(INLINE_MAP_PATTERN)?.[1];
if (!match) return null;
try {
if (match.includes(BASE_64_PREFIX)) {
const encoded = match.split(BASE_64_PREFIX).at(-1) || "";
const decoded = atob(encoded);
return JSON.parse(decoded);
}
const content = await readFile(resolve(dirname(filename), match), "utf-8");
return JSON.parse(content);
} catch {
return null;
}
}
function tryReadFileSync(filename) {
try {
return readFileSync(filename, "utf8");
} catch {
return;
}
}
//#endregion
//#region src/script-coverage.ts
function normalize(scriptCoverage) {
if (scriptCoverage.functions.length === 0) return [];
const ranges = scriptCoverage.functions.flatMap((fn) => fn.ranges.map((range) => ({
start: range.startOffset,
end: range.endOffset,
count: range.count,
area: range.endOffset - range.startOffset
}))).sort((a, b) => {
const diff = b.area - a.area;
if (diff !== 0) return diff;
return a.end - b.end;
});
let maxEnd = 0;
for (const r of ranges) if (r.end > maxEnd) maxEnd = r.end;
const hits = new Uint32Array(maxEnd + 1);
for (const range of ranges) hits.fill(range.count, range.start, range.end + 1);
const normalized = [];
let start = 0;
for (let end = 1; end <= hits.length; end++) {
const isLast = end === hits.length;
const current = isLast ? null : hits[end];
const previous = hits[start];
if (current !== previous || isLast) {
normalized.push({
start,
end: end - 1,
count: previous
});
start = end;
}
}
return normalized;
}
function getCount(offset, coverages) {
let low = 0;
let high = coverages.length - 1;
while (low <= high) {
const mid = Math.floor((low + high) / 2);
const coverage = coverages[mid];
if (coverage.start <= offset.startOffset && offset.startOffset <= coverage.end) return coverage.count;
else if (offset.startOffset < coverage.start) high = mid - 1;
else low = mid + 1;
}
return 0;
}
//#endregion
//#region src/coverage-mapper.ts
var CoverageMapper = class CoverageMapper {
constructor(locator, coverageMapData, ranges, wrapperLength, directory, onIgnoreNode, ignoreNode, ignoreSourceCode) {
this.locator = locator;
this.coverageMapData = coverageMapData;
this.ranges = ranges;
this.wrapperLength = wrapperLength;
this.directory = directory;
this.onIgnoreNode = onIgnoreNode;
this.ignoreNode = ignoreNode;
this.ignoreSourceCode = ignoreSourceCode;
}
static async create(options, onIgnoreNode) {
const filename = fileURLToPath(options.coverage.url);
const directory = dirname(filename);
const map = new TraceMap(options.sourceMap || await getInlineSourceMap(filename, options.code) || createEmptySourceMap(filename, options.code));
return new CoverageMapper(new Locator(options.code, map, directory), createCoverageMapData(filename, map), normalize(options.coverage), options.wrapperLength || 0, directory, onIgnoreNode, options.ignoreNode, options.ignoreSourceCode);
}
onFunction(node, positions) {
if (this.#onIgnore(node, "function")) return;
const loc = this.locator.getLoc(positions.loc);
if (loc === null) return;
const decl = this.locator.getLoc(positions.decl);
if (decl === null) return;
const covered = getCount({
startOffset: node.start + this.wrapperLength,
endOffset: node.end + this.wrapperLength
}, this.ranges);
if (this.ignoreSourceCode) {
const current = this.locator.getLoc(node) || loc;
const sources = this.locator.getSourceLines(current, this.#getSourceFilename(current));
if (sources != null && this.ignoreSourceCode(sources, "function", {
start: {
line: current.start.line,
column: current.start.column
},
end: {
line: current.end.line,
column: current.end.column
}
})) return;
}
addFunction({
coverageMapData: this.coverageMapData,
covered,
loc,
decl,
filename: this.#getSourceFilename(loc),
name: getFunctionName(node)
});
}
onStatement(node, parent) {
if (this.#onIgnore(parent || node, "statement")) return;
const loc = this.locator.getLoc(node);
if (loc === null) return;
const covered = getCount({
startOffset: (parent || node).start + this.wrapperLength,
endOffset: (parent || node).end + this.wrapperLength
}, this.ranges);
if (this.ignoreSourceCode) {
const current = parent && this.locator.getLoc(parent) || loc;
const sources = this.locator.getSourceLines(current, this.#getSourceFilename(current));
if (sources != null && this.ignoreSourceCode(sources, "statement", {
start: {
line: current.start.line,
column: current.start.column
},
end: {
line: current.end.line,
column: current.end.column
}
})) return;
}
addStatement({
coverageMapData: this.coverageMapData,
loc,
covered,
filename: this.#getSourceFilename(loc)
});
}
onBranch(type, node, branches) {
if (this.#onIgnore(node, "branch")) return;
const loc = this.locator.getLoc(node);
if (loc === null) return;
const locations = [];
const covered = [];
for (const branch of branches) {
if (!branch) {
locations.push({
start: {
line: void 0,
column: void 0
},
end: {
line: void 0,
column: void 0
}
});
const count = getCount({
startOffset: node.start + this.wrapperLength,
endOffset: node.end + this.wrapperLength
}, this.ranges);
const previous = covered.at(-1) || 0;
covered.push(count - previous);
continue;
}
const location = this.locator.getLoc(branch);
if (location !== null) locations.push(location);
const bias = branch.type === "BlockStatement" ? 1 : 0;
covered.push(getCount({
startOffset: branch.start + bias + this.wrapperLength,
endOffset: branch.end - bias + this.wrapperLength
}, this.ranges));
}
if (type === "if") {
if (locations.length > 0) locations[0] = loc;
}
if (locations.length === 0) return;
if (this.ignoreSourceCode) {
const sources = this.locator.getSourceLines(loc, this.#getSourceFilename(loc));
if (sources != null && this.ignoreSourceCode(sources, "branch", {
start: {
line: loc.start.line,
column: loc.start.column
},
end: {
line: loc.end.line,
column: loc.end.column
}
})) return;
}
addBranch({
coverageMapData: this.coverageMapData,
loc,
locations,
type,
covered,
filename: this.#getSourceFilename(loc)
});
}
generate() {
this.locator.reset();
return this.coverageMapData;
}
#getSourceFilename(position) {
const sourceFilename = position.start.filename || position.end.filename;
if (!sourceFilename) throw new Error(`Missing original filename for ${JSON.stringify(position, null, 2)}`);
if (sourceFilename.startsWith("file://")) return fileURLToPath(sourceFilename);
return resolve(this.directory, sourceFilename);
}
#onIgnore(node, type) {
if (!this.ignoreNode) return false;
const scope = this.ignoreNode(node, type);
if (scope === "ignore-this-and-nested-nodes") this.onIgnoreNode(node);
return scope;
}
};
//#endregion
//#region src/index.ts
/**
* Maps V8 `ScriptCoverage` to Istanbul's `CoverageMap`.
* Results are identical with `istanbul-lib-instrument`.
*/
async function convert(options) {
const ignoreHints = getIgnoreHints(options.code);
if (ignoreHints.length === 1 && ignoreHints[0].type === "file") return {};
const walker = getWalker();
const mapper = await CoverageMapper.create(options, walker.onIgnore);
const ast = await options.ast;
await walker.walk(ast, ignoreHints, options.ignoreClassMethods, {
onFunctionDeclaration(node) {
mapper.onFunction(node, {
loc: node.body,
decl: node.id || {
...node,
end: node.start + 1
}
});
},
onFunctionExpression(node) {
if (isCovered(node)) return;
mapper.onFunction(node, {
loc: node.body,
decl: node.id || {
...node,
end: node.start + 1
}
});
},
onArrowFunctionExpression(node) {
mapper.onFunction(node, {
loc: node.body,
decl: {
...node,
end: node.start + 1
}
});
if (node.body.type !== "BlockStatement") mapper.onStatement(node.body, node);
},
onMethodDefinition(node) {
if (node.value.type === "FunctionExpression") setCovered(node.value);
mapper.onFunction(node, {
loc: node.value.body,
decl: node.key
});
},
onProperty(node) {
if (node.value.type === "FunctionExpression") {
setCovered(node.value);
mapper.onFunction(node, {
loc: node.value.body,
decl: node.key
});
}
},
onClassMethod(babelNode) {
const node = {
type: "FunctionExpression",
start: babelNode.start,
end: babelNode.end,
body: {
type: "BlockStatement",
start: babelNode.body.start,
end: babelNode.body.end,
body: []
},
params: []
};
mapper.onFunction(node, {
loc: node.body,
decl: {
start: babelNode.key.start,
end: babelNode.key.end
}
});
},
onObjectMethod(babelNode) {
const node = {
type: "FunctionExpression",
start: babelNode.start,
end: babelNode.end,
body: {
type: "BlockStatement",
start: babelNode.body.start,
end: babelNode.body.end,
body: []
},
params: []
};
mapper.onFunction(node, {
loc: node.body,
decl: {
start: babelNode.key.start,
end: babelNode.key.end
}
});
},
onBreakStatement: (node) => mapper.onStatement(node),
onContinueStatement: (node) => mapper.onStatement(node),
onDebuggerStatement: (node) => mapper.onStatement(node),
onReturnStatement: (node) => mapper.onStatement(node),
onThrowStatement: (node) => mapper.onStatement(node),
onTryStatement: (node) => mapper.onStatement(node),
onForStatement: (node) => mapper.onStatement(node),
onForInStatement: (node) => mapper.onStatement(node),
onForOfStatement: (node) => mapper.onStatement(node),
onWhileStatement: (node) => mapper.onStatement(node),
onDoWhileStatement: (node) => mapper.onStatement(node),
onWithStatement: (node) => mapper.onStatement(node),
onLabeledStatement: (node) => mapper.onStatement(node),
onExpressionStatement(node) {
if (node.expression.type === "Literal" && node.expression.value === "use strict") return;
mapper.onStatement(node);
},
onVariableDeclarator(node) {
if (node.init) mapper.onStatement(node.init, node);
},
onClassBody(node) {
for (const child of node.body) if ((child.type === "PropertyDefinition" || child.type === "ClassProperty" || child.type === "ClassPrivateProperty") && child.value) mapper.onStatement(child.value);
},
onIfStatement(node, branches) {
mapper.onBranch("if", node, branches);
mapper.onStatement(node);
},
onConditionalExpression(node, branches) {
mapper.onBranch("cond-expr", node, branches);
},
onLogicalExpression(node, branches) {
mapper.onBranch("binary-expr", node, branches);
},
onSwitchStatement(node, cases) {
mapper.onBranch("switch", node, cases);
mapper.onStatement(node);
},
onAssignmentPattern(node) {
mapper.onBranch("default-arg", node, [node.right]);
}
});
return mapper.generate();
}
const coveredNodes = /* @__PURE__ */ new WeakSet();
function setCovered(node) {
coveredNodes.add(node);
}
function isCovered(node) {
return coveredNodes.has(node);
}
//#endregion
export { convert, convert as default };
@@ -0,0 +1,41 @@
import { F as FormatOptions } from './shared/confbox.9745c98f.cjs';
/**
*
* Converts a [JSONC](https://github.com/microsoft/node-jsonc-parser) string into an object.
*
* @NOTE On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
*
* @NOTE Comments and trailing commas are not preserved after parsing.
*
* @template T The type of the return value.
* @param text The string to parse as JSONC.
* @param options Parsing options.
* @returns The JavaScript value converted from the JSONC string.
*/
declare function parseJSONC<T = unknown>(text: string, options?: JSONCParseOptions): T;
/**
* Converts a JavaScript value to a [JSONC](https://github.com/microsoft/node-jsonc-parser) string.
*
* @NOTE Comments and trailing commas are not preserved in the output.
*
* @param value
* @param options
* @returns The JSON string converted from the JavaScript value.
*/
declare function stringifyJSONC(value: any, options?: JSONCStringifyOptions): string;
interface JSONCParseOptions extends FormatOptions {
disallowComments?: boolean;
allowTrailingComma?: boolean;
allowEmptyContent?: boolean;
errors?: JSONCParseError[];
}
interface JSONCStringifyOptions extends FormatOptions {
}
interface JSONCParseError {
error: number;
offset: number;
length: number;
}
export { type JSONCParseError, type JSONCParseOptions, type JSONCStringifyOptions, parseJSONC, stringifyJSONC };
@@ -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 Gem = createLucideIcon("Gem", [
["path", { d: "M6 3h12l4 6-10 13L2 9Z", key: "1pcd5k" }],
["path", { d: "M11 3 8 9l4 13 4-13-3-6", key: "1fcu3u" }],
["path", { d: "M2 9h20", key: "16fsjt" }]
]);
export { Gem as default };
//# sourceMappingURL=gem.js.map
@@ -0,0 +1,22 @@
"use strict";
const units = require("./units.js");
const { DATE, DAY, HOUR, MILLISECOND, MINUTE, MONTH, SECOND, TIME, YEAR } = units;
const compatUnits = {};
function mapUnit(key, ...args) {
for (let i = 0; i < arguments.length; i++) {
compatUnits[arguments[i]] = key;
}
}
mapUnit(YEAR, "Y", "y", "years");
mapUnit(MONTH, "M", "months");
mapUnit(DATE, "D", "dates");
mapUnit(DAY, "d", "days");
mapUnit(HOUR, "h", "hours");
mapUnit(MINUTE, "m", "minutes");
mapUnit(SECOND, "s", "seconds");
mapUnit(MILLISECOND, "ms", "milliseconds");
mapUnit(TIME, "t");
function normalizeUnit(u) {
return compatUnits[u];
}
exports.normalizeUnit = normalizeUnit;
@@ -0,0 +1,228 @@
import { describe, it, expect, vi } from "vitest";
import { Parser, type ParserOptions } from "./Parser.js";
import * as helper from "./__fixtures__/testHelper.js";
/**
* Write to the parser twice, once a bytes, once as a single blob. Then check
* that we received the expected events.
*
* @internal
* @param input Data to write.
* @param options Parser options.
* @returns Promise that resolves if the test passes.
*/
function runTest(input: string, options?: ParserOptions) {
let firstResult: unknown[] | undefined;
return new Promise<void>((resolve, reject) => {
const handler = helper.getEventCollector((error, actual) => {
if (error) {
return reject(error);
}
if (firstResult) {
expect(actual).toEqual(firstResult);
resolve();
} else {
firstResult = actual;
expect(actual).toMatchSnapshot();
}
});
const parser = new Parser(handler, options);
// First, try to run the test via chunks
for (let index = 0; index < input.length; index++) {
parser.write(input.charAt(index));
}
parser.end();
// Then, parse everything
parser.parseComplete(input);
});
}
describe("Events", () => {
it("simple", () => runTest("<h1 class=test>adsf</h1>"));
it("Template script tags", () =>
runTest(
'<p><script type="text/template"><h1>Heading1</h1></script></p>',
));
it("Lowercase tags", () =>
runTest("<H1 class=test>adsf</H1>", { lowerCaseTags: true }));
it("CDATA", () =>
runTest("<tag><![CDATA[ asdf ><asdf></adsf><> fo]]></tag><![CD>", {
xmlMode: true,
}));
it("CDATA (inside special)", () =>
runTest(
"<script>/*<![CDATA[*/ asdf ><asdf></adsf><> fo/*]]>*/</script>",
));
it("leading lt", () => runTest(">a>"));
it("end slash: void element ending with />", () =>
runTest("<hr / ><p>Hold the line."));
it("end slash: void element ending with >", () =>
runTest("<hr ><p>Hold the line."));
it("end slash: void element ending with >, xmlMode=true", () =>
runTest("<hr ><p>Hold the line.", { xmlMode: true }));
it("end slash: non-void element ending with />", () =>
runTest("<xx / ><p>Hold the line."));
it("end slash: non-void element ending with />, xmlMode=true", () =>
runTest("<xx / ><p>Hold the line.", { xmlMode: true }));
it("end slash: non-void element ending with />, recognizeSelfClosing=true", () =>
runTest("<xx / ><p>Hold the line.", { recognizeSelfClosing: true }));
it("end slash: as part of attrib value of void element", () =>
runTest("<img src=gif.com/123/><p>Hold the line."));
it("end slash: as part of attrib value of non-void element", () =>
runTest("<a href=http://test.com/>Foo</a><p>Hold the line."));
it("Implicit close tags", () =>
runTest(
"<ol><li class=test><div><table style=width:100%><tr><th>TH<td colspan=2><h3>Heading</h3><tr><td><div>Div</div><td><div>Div2</div></table></div><li><div><h3>Heading 2</h3></div></li></ol><p>Para<h4>Heading 4</h4><p><ul><li>Hi<li>bye</ul>",
));
it("attributes (no white space, no value, no quotes)", () =>
runTest(
'<button class="test0"title="test1" disabled value=test2>adsf</button>',
));
it("crazy attribute", () => runTest("<p < = '' FAIL>stuff</p><a"));
it("Scripts creating other scripts", () =>
runTest("<p><script>var str = '<script></'+'script>';</script></p>"));
it("Long comment ending", () =>
runTest("<meta id='before'><!-- text ---><meta id='after'>"));
it("Long CDATA ending", () =>
runTest("<before /><tag><![CDATA[ text ]]]></tag><after />", {
xmlMode: true,
}));
it("Implicit open p and br tags", () =>
runTest("<div>Hallo</p>World</br></ignore></div></p></br>"));
it("lt followed by whitespace", () => runTest("a < b"));
it("double attribute", () => runTest("<h1 class=test class=boo></h1>"));
it("numeric entities", () =>
runTest("&#x61;&#x62&#99;&#100&#x66g&#x;&#x68"));
it("legacy entities", () => runTest("&AMPel&iacutee&ampeer;s&lter&sum"));
it("named entities", () =>
runTest("&amp;el&lt;er&CounterClockwiseContourIntegral;foo&bar"));
it("xml entities", () =>
runTest("&amp;&gt;&amp&lt;&uuml;&#x61;&#x62&#99;&#100&#101", {
xmlMode: true,
}));
it("entity in attribute", () =>
runTest(
"<a href='http://example.com/p&#x61;#x61ge?param=value&param2&param3=&lt;val&; & &'>",
));
it("double brackets", () =>
runTest("<<princess-purpose>>testing</princess-purpose>"));
it("legacy entities fail", () => runTest("M&M"));
it("Special special tags", () =>
runTest(
"<tItLe><b>foo</b><title></TiTlE><sitle><b></b></sitle><ttyle><b></b></ttyle><sCriPT></scripter</soo</sCript><STyLE></styler</STylE><sCiPt><stylee><scriptee><soo>",
));
it("Empty tag name", () => runTest("< ></ >"));
it("Not quite closed", () => runTest("<foo /bar></foo bar>"));
it("Entities in attributes", () =>
runTest("<foo bar=&amp; baz=\"&amp;\" boo='&amp;' noo=>"));
it("CDATA in HTML", () => runTest("<![CDATA[ foo ]]>"));
it("Comment edge-cases", () => runTest("<!-foo><!-- --- --><!--foo"));
it("CDATA edge-cases", () =>
runTest("<![CDATA><![CDATA[[]]sdaf]]><![CDATA[foo", {
recognizeCDATA: true,
}));
it("Comment false ending", () => runTest("<!-- a-b-> -->"));
it("Scripts ending with <", () => runTest("<script><</script>"));
it("CDATA more edge-cases", () =>
runTest("<![CDATA[foo]bar]>baz]]>", { recognizeCDATA: true }));
it("tag names are not ASCII alpha", () => runTest("<12>text</12>"));
it("open-implies-close case of (non-br) void close tag in non-XML mode", () =>
runTest("<select><input></select>", { lowerCaseAttributeNames: true }));
it("entity in attribute (#276)", () =>
runTest(
'<img src="?&image_uri=1&&image;=2&image=3"/>?&image_uri=1&&image;=2&image=3',
));
it("entity in title (#592)", () => runTest("<title>the &quot;title&quot"));
it("entity in title - decodeEntities=false (#592)", () =>
runTest("<title>the &quot;title&quot;", { decodeEntities: false }));
it("</title> in <script> (#745)", () =>
runTest("<script>'</title>'</script>"));
it("XML tags", () => runTest("<:foo><_bar>", { xmlMode: true }));
it("Trailing legacy entity", () => runTest("&timesbar;&timesbar"));
it("Trailing numeric entity", () => runTest("&#53&#53"));
it("Multi-byte entity", () => runTest("&NotGreaterFullEqual;"));
it("Start & end indices from domhandler", () =>
runTest(
"<!DOCTYPE html> <html> <title>The Title</title> <body class='foo'>Hello world <p></p></body> <!-- the comment --> </html> ",
));
it("Self-closing indices (#941)", () =>
runTest("<xml><a/><b/></xml>", { xmlMode: true }));
it("Entity after <", () => runTest("<&amp;"));
it("Attribute in XML (see #1350)", () =>
runTest(
'<Page\n title="Hello world"\n actionBarVisible="false"/>',
{ xmlMode: true },
));
});
describe("Helper", () => {
it("should handle errors", () => {
const eventCallback = vi.fn();
const parser = new Parser(helper.getEventCollector(eventCallback));
parser.end();
parser.write("foo");
expect(eventCallback).toHaveBeenCalledTimes(2);
expect(eventCallback).toHaveBeenNthCalledWith(1, null, []);
expect(eventCallback).toHaveBeenLastCalledWith(
new Error(".write() after done!"),
);
});
});
@@ -0,0 +1,70 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_adapter_bun_server = require("./server.js");
const require_helper_websocket_index = require("../../helper/websocket/index.js");
//#region src/adapter/bun/websocket.ts
/**
* @internal
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
const createWSContext = (ws) => {
return new require_helper_websocket_index.WSContext({
send: (source, options) => {
ws.send(source, options?.compress);
},
raw: ws,
readyState: ws.readyState,
url: ws.data.url,
protocol: ws.data.protocol,
close(code, reason) {
ws.close(code, reason);
}
});
};
/**
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
const upgradeWebSocket = require_helper_websocket_index.defineWebSocketHelper((c, events) => {
const server = require_adapter_bun_server.getBunServer(c);
if (!server) throw new TypeError("env has to include the 2nd argument of fetch.");
if (server.upgrade(c.req.raw, { data: {
events,
url: new URL(c.req.url),
protocol: c.req.header("sec-websocket-protocol")?.split(",")[0]?.trim() ?? ""
} })) return new Response(null);
});
/**
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
const websocket = {
open(ws) {
const websocketListeners = ws.data.events;
if (websocketListeners.onOpen) websocketListeners.onOpen(new Event("open"), createWSContext(ws));
},
close(ws, code, reason) {
const websocketListeners = ws.data.events;
if (websocketListeners.onClose) websocketListeners.onClose(new CloseEvent("close", {
code,
reason
}), createWSContext(ws));
},
message(ws, message) {
const websocketListeners = ws.data.events;
if (websocketListeners.onMessage) {
const normalizedReceiveData = typeof message === "string" ? message : message.buffer;
websocketListeners.onMessage(require_helper_websocket_index.createWSMessageEvent(normalizedReceiveData), createWSContext(ws));
}
}
};
/**
* @deprecated Import `upgradeWebSocket` and `websocket` directly from `hono/bun` instead.
* @returns A function to create a Bun WebSocket handler.
*/
const createBunWebSocket = () => ({
upgradeWebSocket,
websocket
});
//#endregion
exports.createBunWebSocket = createBunWebSocket;
exports.createWSContext = createWSContext;
exports.upgradeWebSocket = upgradeWebSocket;
exports.websocket = websocket;
@@ -0,0 +1,72 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _asyncIterator;
function _asyncIterator(iterable) {
var method,
async,
sync,
retry = 2;
if (typeof Symbol !== "undefined") {
async = Symbol.asyncIterator;
sync = Symbol.iterator;
}
while (retry--) {
if (async && (method = iterable[async]) != null) {
return method.call(iterable);
}
if (sync && (method = iterable[sync]) != null) {
return new AsyncFromSyncIterator(method.call(iterable));
}
async = "@@asyncIterator";
sync = "@@iterator";
}
throw new TypeError("Object is not async iterable");
}
function AsyncFromSyncIterator(s) {
AsyncFromSyncIterator = function (s) {
this.s = s;
this.n = s.next;
};
AsyncFromSyncIterator.prototype = {
s: null,
n: null,
next: function () {
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
},
return: function (value) {
var ret = this.s["return"];
if (ret === undefined) {
return Promise.resolve({
value: value,
done: true
});
}
return AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
},
throw: function (maybeError) {
var thr = this.s["return"];
if (thr === undefined) {
return Promise.reject(maybeError);
}
return AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
}
};
function AsyncFromSyncIteratorContinuation(r) {
if (Object(r) !== r) {
return Promise.reject(new TypeError(r + " is not an object."));
}
var done = r.done;
return Promise.resolve(r.value).then(function (value) {
return {
value: value,
done: done
};
});
}
return new AsyncFromSyncIterator(s);
}
//# sourceMappingURL=asyncIterator.js.map
@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const codegen_1 = require("../../compile/codegen");
const error = {
message: ({ schemaCode }) => (0, codegen_1.str) `must be multiple of ${schemaCode}`,
params: ({ schemaCode }) => (0, codegen_1._) `{multipleOf: ${schemaCode}}`,
};
const def = {
keyword: "multipleOf",
type: "number",
schemaType: "number",
$data: true,
error,
code(cxt) {
const { gen, data, schemaCode, it } = cxt;
// const bdt = bad$DataType(schemaCode, <string>def.schemaType, $data)
const prec = it.opts.multipleOfPrecision;
const res = gen.let("res");
const invalid = prec
? (0, codegen_1._) `Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}`
: (0, codegen_1._) `${res} !== parseInt(${res})`;
cxt.fail$data((0, codegen_1._) `(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`);
},
};
exports.default = def;
//# sourceMappingURL=multipleOf.js.map
@@ -0,0 +1,142 @@
import { isTag, hasChildren } from "domhandler";
/**
* Search a node and its children for nodes passing a test function. If `node` is not an array, it will be wrapped in one.
*
* @category Querying
* @param test Function to test nodes on.
* @param node Node to search. Will be included in the result set if it matches.
* @param recurse Also consider child nodes.
* @param limit Maximum number of nodes to return.
* @returns All nodes passing `test`.
*/
export function filter(test, node, recurse = true, limit = Infinity) {
return find(test, Array.isArray(node) ? node : [node], recurse, limit);
}
/**
* Search an array of nodes and their children for nodes passing a test function.
*
* @category Querying
* @param test Function to test nodes on.
* @param nodes Array of nodes to search.
* @param recurse Also consider child nodes.
* @param limit Maximum number of nodes to return.
* @returns All nodes passing `test`.
*/
export function find(test, nodes, recurse, limit) {
const result = [];
/** Stack of the arrays we are looking at. */
const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];
/** Stack of the indices within the arrays. */
const indexStack = [0];
for (;;) {
// First, check if the current array has any more elements to look at.
if (indexStack[0] >= nodeStack[0].length) {
// If we have no more arrays to look at, we are done.
if (indexStack.length === 1) {
return result;
}
// Otherwise, remove the current array from the stack.
nodeStack.shift();
indexStack.shift();
// Loop back to the start to continue with the next array.
continue;
}
const elem = nodeStack[0][indexStack[0]++];
if (test(elem)) {
result.push(elem);
if (--limit <= 0)
return result;
}
if (recurse && hasChildren(elem) && elem.children.length > 0) {
/*
* Add the children to the stack. We are depth-first, so this is
* the next array we look at.
*/
indexStack.unshift(0);
nodeStack.unshift(elem.children);
}
}
}
/**
* Finds the first element inside of an array that matches a test function. This is an alias for `Array.prototype.find`.
*
* @category Querying
* @param test Function to test nodes on.
* @param nodes Array of nodes to search.
* @returns The first node in the array that passes `test`.
* @deprecated Use `Array.prototype.find` directly.
*/
export function findOneChild(test, nodes) {
return nodes.find(test);
}
/**
* Finds one element in a tree that passes a test.
*
* @category Querying
* @param test Function to test nodes on.
* @param nodes Node or array of nodes to search.
* @param recurse Also consider child nodes.
* @returns The first node that passes `test`.
*/
export function findOne(test, nodes, recurse = true) {
const searchedNodes = Array.isArray(nodes) ? nodes : [nodes];
for (let i = 0; i < searchedNodes.length; i++) {
const node = searchedNodes[i];
if (isTag(node) && test(node)) {
return node;
}
if (recurse && hasChildren(node) && node.children.length > 0) {
const found = findOne(test, node.children, true);
if (found)
return found;
}
}
return null;
}
/**
* Checks if a tree of nodes contains at least one node passing a test.
*
* @category Querying
* @param test Function to test nodes on.
* @param nodes Array of nodes to search.
* @returns Whether a tree of nodes contains at least one node passing the test.
*/
export function existsOne(test, nodes) {
return (Array.isArray(nodes) ? nodes : [nodes]).some((node) => (isTag(node) && test(node)) ||
(hasChildren(node) && existsOne(test, node.children)));
}
/**
* Search an array of nodes and their children for elements passing a test function.
*
* Same as `find`, but limited to elements and with less options, leading to reduced complexity.
*
* @category Querying
* @param test Function to test nodes on.
* @param nodes Array of nodes to search.
* @returns All nodes passing `test`.
*/
export function findAll(test, nodes) {
const result = [];
const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];
const indexStack = [0];
for (;;) {
if (indexStack[0] >= nodeStack[0].length) {
if (nodeStack.length === 1) {
return result;
}
// Otherwise, remove the current array from the stack.
nodeStack.shift();
indexStack.shift();
// Loop back to the start to continue with the next array.
continue;
}
const elem = nodeStack[0][indexStack[0]++];
if (isTag(elem) && test(elem))
result.push(elem);
if (hasChildren(elem) && elem.children.length > 0) {
indexStack.unshift(0);
nodeStack.unshift(elem.children);
}
}
}
//# sourceMappingURL=querying.js.map
@@ -0,0 +1 @@
{"version":3,"file":"blake1.d.ts","sourceRoot":"","sources":["src/blake1.ts"],"names":[],"mappings":"AA4BA,OAAO,EAIL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,6CAA6C;AAC7C,MAAM,MAAM,SAAS,GAAG;IACtB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAOF,uBAAe,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,CAAE,YAAW,IAAI,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,MAAM,SAAS;IACxB,SAAS,CAAC,QAAQ,UAAS;IAC3B,SAAS,CAAC,MAAM,SAAK;IACrB,SAAS,CAAC,GAAG,SAAK;IAClB,SAAS,CAAC,SAAS,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,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAEtD,CAAC;AACF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAEtD,CAAC;AACF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAEtD,CAAC;AACF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAEtD,CAAC"}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_jT _i","2":"_uL","516":"p"},C:{"1":"_4H _p","2":"_bB _6F _L"},D:{"1":"_jT _l","2":"_JO b","194":"_aN _BG","450":"c","516":"p"},E:{"1":"_1C","2":"_pD"},F:{"1":"_ES","2":"_4B _eH _O","194":"_4E _MB","516":"_QP d"},G:{"1":"_kB","2":"_yC"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"2":"bC"},P:{"1":"_GB","2":"_gN"},Q:{"2":"JE"},R:{"2":"KE"},S:{"2":"_C"}},B:5,C:"CSS Container Queries (Size)",D:true};
@@ -0,0 +1,23 @@
/*! *****************************************************************************
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="es2021" />
/// <reference lib="es2022.array" />
/// <reference lib="es2022.error" />
/// <reference lib="es2022.intl" />
/// <reference lib="es2022.object" />
/// <reference lib="es2022.regexp" />
/// <reference lib="es2022.string" />
@@ -0,0 +1,112 @@
import {EventEmitter} from 'events';
type WithRequiredProperties<T, K extends keyof T> = T & Required<Pick<T, K>>;
declare class Keyv<Value = any, Options extends Record<string, any> = Record<string, unknown>> extends EventEmitter {
/**
* `this.opts` is an object containing at least the properties listed
* below. However, `Keyv.Options` allows arbitrary properties as well.
* These properties can be specified as the second type parameter to `Keyv`.
*/
opts: WithRequiredProperties<
Keyv.Options<Value>,
'deserialize' | 'namespace' | 'serialize' | 'store' | 'uri'
> &
Options;
/**
* @param opts The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options.
*/
constructor(options?: Keyv.Options<Value> & Options);
/**
* @param uri The connection string URI.
*
* Merged into the options object as options.uri.
* @param opts The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options.
*/
constructor(uri?: string, options?: Keyv.Options<Value> & Options);
/** Returns the value. */
get(key: string, options?: {raw?: false}): Promise<Value | undefined>;
/** Returns the raw value. */
get(key: string, options: {raw: true}): Promise<Keyv.DeserializedData<Value> | undefined>;
/** Returns an array of values. Uses `store.getMany` if it exists, otherwise uses parallel calls to `store.get`. */
get(key: string[], options?: {raw?: false}): Promise<Array<Value | undefined>>;
/** Returns an array of raw values. Uses `store.getMany` if it exists, otherwise uses parallel calls to `store.get`. */
get(key: string[], options: {raw: true}): Promise<Array<Keyv.DeserializedData<Value> | undefined>>;
/**
* Set a value.
*
* By default keys are persistent. You can set an expiry TTL in milliseconds.
*/
set(key: string, value: Value, ttl?: number): Promise<true>;
/**
* Deletes an entry.
*
* Returns `true` if the key existed, `false` if not.
*/
delete(key: string | string[]): Promise<boolean>;
/** Delete all entries in the current namespace. */
clear(): Promise<void>;
/** Check if key exists in current namespace. */
has(key: string): Promise<boolean>;
/** Iterator */
iterator(namespace?: string): AsyncGenerator<any, void, any>;
/**
* Closes the connection.
*
* Returns `undefined` when the connection closes.
*/
disconnect(): Promise<void>;
}
declare namespace Keyv {
interface Options<Value> {
[key: string]: any;
/** Namespace for the current instance. */
namespace?: string | undefined;
/** A custom serialization function. */
serialize?: ((data: DeserializedData<Value>) => string) | undefined;
/** A custom deserialization function. */
deserialize?: ((data: string) => DeserializedData<Value> | undefined) | undefined;
/** The connection string URI. */
uri?: string | undefined;
/** The storage adapter instance to be used by Keyv. */
store?: Store<string | undefined> | undefined;
/** Default TTL. Can be overridden by specififying a TTL on `.set()`. */
ttl?: number | undefined;
/** Specify an adapter to use. e.g `'redis'` or `'mongodb'`. */
adapter?: 'redis' | 'mongodb' | 'mongo' | 'sqlite' | 'postgresql' | 'postgres' | 'mysql' | undefined;
/** Enable compression option **/
compression?: CompressionAdapter | undefined;
}
interface CompressionAdapter {
compress(value: any, options?: any): Promise<any>;
decompress(value: any, options?: any): Promise<any>;
serialize(value: any): Promise<any>;
deserialize(value: any): Promise<any>;
}
interface DeserializedData<Value> {
value: Value; expires: number | undefined;
}
type StoredData<Value> = DeserializedData<Value> | string | undefined;
interface Store<Value> {
get(key: string): Value | Promise<Value | undefined> | undefined;
set(key: string, value: Value, ttl?: number): any;
delete(key: string): boolean | Promise<boolean>;
clear(): void | Promise<void>;
has?(key: string): boolean | Promise<boolean>;
getMany?(
keys: string[]
): Array<StoredData<Value>> | Promise<Array<StoredData<Value>>> | undefined;
}
}
export = Keyv;
@@ -0,0 +1,378 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
test("transform ctx.addIssue with parse", () => {
const strs = ["foo", "bar"];
const schema = z.string().transform((data, ctx) => {
const i = strs.indexOf(data);
if (i === -1) {
ctx.addIssue({
input: data,
code: "custom",
message: `${data} is not one of our allowed strings`,
});
}
return data.length;
});
const result = schema.safeParse("asdf");
expect(result.success).toEqual(false);
expect(result.error!).toMatchInlineSnapshot(`
[ZodError: [
{
"code": "custom",
"message": "asdf is not one of our allowed strings",
"path": []
}
]]
`);
});
test("transform ctx.addIssue with parseAsync", async () => {
const strs = ["foo", "bar"];
const result = await z
.string()
.transform(async (data, ctx) => {
const i = strs.indexOf(data);
if (i === -1) {
ctx.addIssue({
input: data,
code: "custom",
message: `${data} is not one of our allowed strings`,
});
}
return data.length;
})
.safeParseAsync("asdf");
expect(result).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"message": "asdf is not one of our allowed strings",
"path": []
}
]],
"success": false,
}
`);
});
test("z.NEVER in transform", () => {
const foo = z
.number()
.optional()
.transform((val, ctx) => {
if (!val) {
ctx.addIssue({
input: val,
code: z.ZodIssueCode.custom,
message: "bad",
});
return z.NEVER;
}
return val;
});
type foo = z.infer<typeof foo>;
expectTypeOf<foo>().toEqualTypeOf<number>();
const arg = foo.safeParse(undefined);
if (!arg.success) {
expect(arg.error.issues[0].message).toEqual("bad");
}
});
test("basic transformations", () => {
const r1 = z
.string()
.transform((data) => data.length)
.parse("asdf");
expect(r1).toEqual(4);
});
test("coercion", () => {
const numToString = z.number().transform((n) => String(n));
const data = z
.object({
id: numToString,
})
.parse({ id: 5 });
expect(data).toEqual({ id: "5" });
});
test("async coercion", async () => {
const numToString = z.number().transform(async (n) => String(n));
const data = await z
.object({
id: numToString,
})
.parseAsync({ id: 5 });
expect(data).toEqual({ id: "5" });
});
test("sync coercion async error", async () => {
const asyncNumberToString = z.number().transform(async (n) => String(n));
expect(() =>
z
.object({
id: asyncNumberToString,
})
.parse({ id: 5 })
).toThrow();
// expect(data).toEqual({ id: '5' });
});
test("default", () => {
const data = z.string().default("asdf").parse(undefined); // => "asdf"
expect(data).toEqual("asdf");
});
test("dynamic default", () => {
const data = z
.string()
.default(() => "string")
.parse(undefined); // => "asdf"
expect(data).toEqual("string");
});
test("default when property is null or undefined", () => {
const data = z
.object({
foo: z.boolean().nullable().default(true),
bar: z.boolean().default(true),
})
.parse({ foo: null });
expect(data).toEqual({ foo: null, bar: true });
});
test("default with falsy values", () => {
const schema = z.object({
emptyStr: z.string().default("def"),
zero: z.number().default(5),
falseBoolean: z.boolean().default(true),
});
const input = { emptyStr: "", zero: 0, falseBoolean: true };
const output = schema.parse(input);
// defaults are not supposed to be used
expect(output).toEqual(input);
});
test("object typing", () => {
const stringToNumber = z.string().transform((arg) => Number.parseFloat(arg));
const t1 = z.object({
stringToNumber,
});
type t1 = z.input<typeof t1>;
type t2 = z.output<typeof t1>;
expectTypeOf<t1>().toEqualTypeOf<{ stringToNumber: string }>();
expectTypeOf<t2>().toEqualTypeOf<{ stringToNumber: number }>();
});
test("transform method overloads", () => {
const t1 = z.string().transform((val) => val.toUpperCase());
expect(t1.parse("asdf")).toEqual("ASDF");
const t2 = z.string().transform((val) => val.length);
expect(t2.parse("asdf")).toEqual(4);
});
test("multiple transformers", () => {
const stringToNumber = z.string().transform((arg) => Number.parseFloat(arg));
const doubler = stringToNumber.transform((val) => {
return val * 2;
});
expect(doubler.parse("5")).toEqual(10);
});
test("short circuit on dirty", () => {
const schema = z
.string()
.refine(() => false)
.transform((val) => val.toUpperCase());
const result = schema.safeParse("asdf");
expect(result.success).toEqual(false);
expect(result.error).toMatchInlineSnapshot(`
[ZodError: [
{
"code": "custom",
"path": [],
"message": "Invalid input"
}
]]
`);
const result2 = schema.safeParse(1234);
expect(result2.success).toEqual(false);
if (!result2.success) {
expect(result2.error.issues[0].code).toEqual(z.ZodIssueCode.invalid_type);
}
});
test("async short circuit on dirty", async () => {
const schema = z
.string()
.refine(() => false)
.transform((val) => val.toUpperCase());
const result = await schema.spa("asdf");
expect(result.success).toEqual(false);
expect(result.error).toMatchInlineSnapshot(`
[ZodError: [
{
"code": "custom",
"path": [],
"message": "Invalid input"
}
]]
`);
const result2 = await schema.spa(1234);
expect(result2.success).toEqual(false);
expect(result2.error).toMatchInlineSnapshot(`
[ZodError: [
{
"expected": "string",
"code": "invalid_type",
"path": [],
"message": "Invalid input: expected string, received number"
}
]]
`);
});
test("do not continue by default", () => {
const A = z
.string()
.transform((val, ctx) => {
ctx.addIssue({
code: "custom",
message: `custom error`,
});
ctx.addIssue({
code: "custom",
message: `custom error`,
});
return val;
})
.pipe(z.number() as any);
expect(A.safeParse("asdf")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"message": "custom error",
"path": []
},
{
"code": "custom",
"message": "custom error",
"path": []
}
]],
"success": false,
}
`);
const B = z
.string()
.transform((val, ctx) => {
ctx.issues.push({
code: "custom",
message: `custom error`,
input: val,
});
ctx.issues.push({
code: "custom",
message: `custom error`,
input: val,
});
return val;
})
.pipe(z.number() as any);
expect(B.safeParse("asdf")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"message": "custom error",
"path": []
},
{
"code": "custom",
"message": "custom error",
"path": []
}
]],
"success": false,
}
`);
const C = z
.string()
.transform((val, ctx) => {
ctx.issues.push({
code: "custom",
message: `custom error`,
input: val,
continue: true,
});
ctx.issues.push({
code: "custom",
message: `custom error`,
input: val,
continue: true,
});
return val;
})
.pipe(z.number() as any);
expect(C.safeParse("asdf")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"message": "custom error",
"path": []
},
{
"code": "custom",
"message": "custom error",
"path": []
}
]],
"success": false,
}
`);
});
test("encode error", () => {
const schema = z.string().transform((val) => val.length);
expect(() => z.encode(schema, 1234)).toThrowErrorMatchingInlineSnapshot(
`[ZodEncodeError: Encountered unidirectional transform during encode: ZodTransform]`
);
});
test("transform context should have addIssue", () => {
const schema = z.transform((val, ctx) => {
ctx.addIssue({
code: "custom",
message: "Not valid",
});
return val;
});
const result = schema.safeParse("test");
expect(result.success).toBe(false);
if (!result.success) {
expect(result.error.issues[0].message).toBe("Not valid");
}
});
@@ -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 BetweenHorizontalStart = createLucideIcon("BetweenHorizontalStart", [
["rect", { width: "13", height: "7", x: "8", y: "3", rx: "1", key: "pkso9a" }],
["path", { d: "m2 9 3 3-3 3", key: "1agib5" }],
["rect", { width: "13", height: "7", x: "8", y: "14", rx: "1", key: "1q5fc1" }]
]);
export { BetweenHorizontalStart as default };
//# sourceMappingURL=between-horizontal-start.js.map
@@ -0,0 +1,3 @@
import { n as AjvJsonSchemaValidator } from "./ajvProvider-CgI-5L6O.mjs";
import process from "node:process";
export { AjvJsonSchemaValidator as DefaultJsonSchemaValidator, process };
@@ -0,0 +1,33 @@
/**
* @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 LocateOff = createLucideIcon("LocateOff", [
["line", { x1: "2", x2: "5", y1: "12", y2: "12", key: "bvdh0s" }],
["line", { x1: "19", x2: "22", y1: "12", y2: "12", key: "1tbv5k" }],
["line", { x1: "12", x2: "12", y1: "2", y2: "5", key: "11lu5j" }],
["line", { x1: "12", x2: "12", y1: "19", y2: "22", key: "x3vr5v" }],
[
"path",
{
d: "M7.11 7.11C5.83 8.39 5 10.1 5 12c0 3.87 3.13 7 7 7 1.9 0 3.61-.83 4.89-2.11",
key: "1oh7ia"
}
],
[
"path",
{
d: "M18.71 13.96c.19-.63.29-1.29.29-1.96 0-3.87-3.13-7-7-7-.67 0-1.33.1-1.96.29",
key: "3qdecy"
}
],
["line", { x1: "2", x2: "22", y1: "2", y2: "22", key: "a6p6uj" }]
]);
export { LocateOff as default };
//# sourceMappingURL=locate-off.js.map
@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiscrError = void 0;
var DiscrError;
(function (DiscrError) {
DiscrError["Tag"] = "tag";
DiscrError["Mapping"] = "mapping";
})(DiscrError || (exports.DiscrError = DiscrError = {}));
//# sourceMappingURL=types.js.map
@@ -0,0 +1,157 @@
class RangeTree {
start;
end;
delta;
children;
constructor(start, end, delta, children) {
this.start = start;
this.end = end;
this.delta = delta;
this.children = children;
}
/**
* @precodition `ranges` are well-formed and pre-order sorted
*/
static fromSortedRanges(ranges) {
let root;
// Stack of parent trees and parent counts.
const stack = [];
for (const range of ranges) {
const node = new RangeTree(
range.startOffset,
range.endOffset,
range.count,
[],
);
if (root === undefined) {
root = node;
stack.push([node, range.count]);
continue;
}
let parent;
let parentCount;
while (true) {
[parent, parentCount] = stack[stack.length - 1];
// assert: `top !== undefined` (the ranges are sorted)
if (range.startOffset < parent.end) {
break;
} else {
stack.pop();
}
if (stack.length === 0) {
break;
}
}
node.delta -= parentCount;
parent.children.push(node);
stack.push([node, range.count]);
}
return root;
}
normalize() {
const children = [];
let curEnd;
let head;
const tail = [];
for (const child of this.children) {
if (head === undefined) {
head = child;
} else if (child.delta === head.delta && child.start === curEnd) {
tail.push(child);
} else {
endChain();
head = child;
}
curEnd = child.end;
}
if (head !== undefined) {
endChain();
}
if (children.length === 1) {
const child = children[0];
if (child.start === this.start && child.end === this.end) {
this.delta += child.delta;
this.children = child.children;
// `.lazyCount` is zero for both (both are after normalization)
return;
}
}
this.children = children;
function endChain() {
if (tail.length !== 0) {
head.end = tail[tail.length - 1].end;
for (const tailTree of tail) {
for (const subChild of tailTree.children) {
subChild.delta += tailTree.delta - head.delta;
head.children.push(subChild);
}
}
tail.length = 0;
}
head.normalize();
children.push(head);
}
}
/**
* @precondition `tree.start < value && value < tree.end`
* @return RangeTree Right part
*/
split(value) {
let leftChildLen = this.children.length;
let mid;
// TODO(perf): Binary search (check overhead)
for (let i = 0; i < this.children.length; i++) {
const child = this.children[i];
if (child.start < value && value < child.end) {
mid = child.split(value);
leftChildLen = i + 1;
break;
} else if (child.start >= value) {
leftChildLen = i;
break;
}
}
const rightLen = this.children.length - leftChildLen;
const rightChildren = this.children.splice(leftChildLen, rightLen);
if (mid !== undefined) {
rightChildren.unshift(mid);
}
const result = new RangeTree(value, this.end, this.delta, rightChildren);
this.end = value;
return result;
}
/**
* Get the range coverages corresponding to the tree.
*
* The ranges are pre-order sorted.
*/
toRanges() {
const ranges = [];
// Stack of parent trees and counts.
const stack = [[this, 0]];
while (stack.length > 0) {
const [cur, parentCount] = stack.pop();
const count = parentCount + cur.delta;
ranges.push({ startOffset: cur.start, endOffset: cur.end, count });
for (let i = cur.children.length - 1; i >= 0; i--) {
stack.push([cur.children[i], count]);
}
}
return ranges;
}
}
module.exports = {
RangeTree,
};
@@ -0,0 +1,135 @@
import type { $ZodStringFormats } from "../core/checks.js";
import type * as errors from "../core/errors.js";
import * as util from "../core/util.js";
const error: () => errors.$ZodErrorMap = () => {
const Sizable: Record<string, { unit: string; verb: string }> = {
string: { unit: "znakova", verb: "imati" },
file: { unit: "bajtova", verb: "imati" },
array: { unit: "stavki", verb: "imati" },
set: { unit: "stavki", verb: "imati" },
};
function getSizing(origin: string): { unit: string; verb: string } | null {
return Sizable[origin] ?? null;
}
const FormatDictionary: {
[k in $ZodStringFormats | (string & {})]?: string;
} = {
regex: "unos",
email: "email adresa",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datum i vrijeme",
date: "ISO datum",
time: "ISO vrijeme",
duration: "ISO trajanje",
ipv4: "IPv4 adresa",
ipv6: "IPv6 adresa",
mac: "MAC adresa",
cidrv4: "IPv4 raspon",
cidrv6: "IPv6 raspon",
base64: "base64 kodirani tekst",
base64url: "base64url kodirani tekst",
json_string: "JSON tekst",
e164: "E.164 broj",
credit_card: "broj kreditne kartice",
currency_code: "kod valute",
iban: "IBAN",
jwt: "JWT",
template_literal: "unos",
};
const TypeDictionary: {
[k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;
} = {
nan: "NaN",
string: "tekst",
number: "broj",
boolean: "boolean",
array: "niz",
object: "objekt",
set: "skup",
file: "datoteka",
date: "datum",
bigint: "bigint",
symbol: "simbol",
undefined: "undefined",
null: "null",
function: "funkcija",
map: "mapa",
};
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 `Neispravan unos: očekuje se instanceof ${issue.expected}, a primljeno je ${received}`;
}
return `Neispravan unos: očekuje se ${expected}, a primljeno je ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `Neispravna vrijednost: očekivano ${util.stringifyPrimitive(issue.values[0])}`;
return `Neispravna opcija: očekivano jedno od ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
const origin = TypeDictionary[issue.origin] ?? issue.origin;
if (sizing)
return `Preveliko: očekivano da ${origin ?? "vrijednost"} ima ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemenata"}`;
return `Preveliko: očekivano da ${origin ?? "vrijednost"} bude ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
const origin = TypeDictionary[issue.origin] ?? issue.origin;
if (sizing) {
return `Premalo: očekivano da ${origin} ima ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `Premalo: očekivano da ${origin} bude ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue as errors.$ZodStringFormatIssues;
if (_issue.format === "starts_with") return `Neispravan tekst: mora započinjati s "${_issue.prefix}"`;
if (_issue.format === "ends_with") return `Neispravan tekst: mora završavati s "${_issue.suffix}"`;
if (_issue.format === "includes") return `Neispravan tekst: mora sadržavati "${_issue.includes}"`;
if (_issue.format === "regex") return `Neispravan tekst: mora odgovarati uzorku ${_issue.pattern}`;
return `Neispravna ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Neispravan broj: mora biti višekratnik od ${issue.divisor}`;
case "unrecognized_keys":
return `Neprepoznat${issue.keys.length > 1 ? "i ključevi" : " ključ"}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Neispravan ključ u ${TypeDictionary[issue.origin] ?? issue.origin}`;
case "invalid_union":
return "Neispravan unos";
case "invalid_element":
return `Neispravna vrijednost u ${TypeDictionary[issue.origin] ?? issue.origin}`;
default:
return `Neispravan unos`;
}
};
};
export default function (): { localeError: errors.$ZodErrorMap } {
return {
localeError: error(),
};
}
@@ -0,0 +1,52 @@
export * as core from "../core/index.js";
export * from "./parse.js";
export * from "./schemas.js";
export * from "./checks.js";
export { deepPartial } from "./deep-partial.js";
export { input, output } from "./in-out.js";
export type { infer } from "../core/index.js";
export type { JSONType } from "../core/util.js";
export type { CompileOptions } from "../core/index.js";
export {
globalRegistry,
registry,
config,
memoizer,
$output,
$input,
$brand,
clone,
regexes,
treeifyError,
prettifyError,
formatError,
flattenError,
TimePrecision,
util,
NEVER,
INVALID,
toZod,
compile,
withParser,
ZodCompileAsyncError,
ZodCompileUnsupportedError,
getDiscriminatedOption,
} from "../core/index.js";
export { toJSONSchema } from "../core/json-schema-processors.js";
export * as locales from "../locales/index.js";
/** A special constant with type `never` */
// export const NEVER = {} as never;
// iso
export * as iso from "./iso.js";
export {
ZodMiniISODateTime,
ZodMiniISODate,
ZodMiniISOTime,
ZodMiniISODuration,
} from "./iso.js";
// coerce
export * as coerce from "./coerce.js";
@@ -0,0 +1,17 @@
import { ZodTypeDef } from "zod/v3";
import { Options, Targets } from "./Options.js";
import { JsonSchema7Type } from "./parseTypes.js";
export type Refs = {
seen: Map<ZodTypeDef, Seen>;
currentPath: string[];
propertyPath: string[] | undefined;
flags: {
hasReferencedOpenAiAnyType: boolean;
};
} & Options<Targets>;
export type Seen = {
def: ZodTypeDef;
path: string[];
jsonSchema: JsonSchema7Type | undefined;
};
export declare const getRefs: (options?: string | Partial<Options<Targets>>) => Refs;
@@ -0,0 +1 @@
{"version":3,"file":"arrow-up-01.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,14 @@
import { useRouter } from "./useRouter.js";
import { ScriptOnce } from "./ScriptOnce.js";
import { jsx } from "react/jsx-runtime";
import { getScrollRestorationScriptForRouter } from "@tanstack/router-core/scroll-restoration-script";
//#region src/scroll-restoration.tsx
function ScrollRestoration() {
const script = getScrollRestorationScriptForRouter(useRouter());
if (!script) return null;
return /* @__PURE__ */ jsx(ScriptOnce, { children: script });
}
//#endregion
export { ScrollRestoration };
//# sourceMappingURL=scroll-restoration.js.map
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGapWidth = exports.removedBarSizeVariable = exports.noScrollbarsClassName = exports.fullWidthClassName = exports.zeroRightClassName = exports.RemoveScrollBar = void 0;
var component_1 = require("./component");
Object.defineProperty(exports, "RemoveScrollBar", { enumerable: true, get: function () { return component_1.RemoveScrollBar; } });
var constants_1 = require("./constants");
Object.defineProperty(exports, "zeroRightClassName", { enumerable: true, get: function () { return constants_1.zeroRightClassName; } });
Object.defineProperty(exports, "fullWidthClassName", { enumerable: true, get: function () { return constants_1.fullWidthClassName; } });
Object.defineProperty(exports, "noScrollbarsClassName", { enumerable: true, get: function () { return constants_1.noScrollbarsClassName; } });
Object.defineProperty(exports, "removedBarSizeVariable", { enumerable: true, get: function () { return constants_1.removedBarSizeVariable; } });
var utils_1 = require("./utils");
Object.defineProperty(exports, "getGapWidth", { enumerable: true, get: function () { return utils_1.getGapWidth; } });
@@ -0,0 +1,259 @@
import { DOM_STASH } from "../constants.js";
import { buildDataStack, update } from "../dom/render.js";
//#region src/jsx/hooks/index.ts
const STASH_SATE = 0;
const STASH_EFFECT = 1;
const STASH_CALLBACK = 2;
const STASH_MEMO = 3;
const STASH_REF = 4;
const resolvedPromiseValueMap = /* @__PURE__ */ new WeakMap();
const isDepsChanged = (prevDeps, deps) => !prevDeps || !deps || prevDeps.length !== deps.length || deps.some((dep, i) => dep !== prevDeps[i]);
let viewTransitionState = void 0;
const documentStartViewTransition = (cb) => {
if (document?.startViewTransition) return document.startViewTransition(cb);
else {
cb();
return { finished: Promise.resolve() };
}
};
let updateHook = void 0;
const viewTransitionHook = (context, node, cb) => {
const state = [true, false];
let lastVC = node.vC;
return documentStartViewTransition(() => {
if (lastVC === node.vC) {
viewTransitionState = state;
cb(context);
viewTransitionState = void 0;
lastVC = node.vC;
}
}).finished.then(() => {
if (state[1] && lastVC === node.vC) {
state[0] = false;
viewTransitionState = state;
cb(context);
viewTransitionState = void 0;
}
});
};
const startViewTransition = (callback) => {
updateHook = viewTransitionHook;
try {
callback();
} finally {
updateHook = void 0;
}
};
const useViewTransition = () => {
if (!buildDataStack.at(-1)) return [false, () => {}];
if (viewTransitionState) viewTransitionState[1] = true;
return [!!viewTransitionState?.[0], startViewTransition];
};
const pendingStack = [];
const runCallback = (type, callback) => {
let resolve;
const promise = new Promise((r) => resolve = r);
pendingStack.push([type, promise]);
try {
const res = callback();
if (res instanceof Promise) res.then(resolve, resolve);
else resolve();
} finally {
pendingStack.pop();
}
};
const startTransition = (callback) => {
runCallback(1, callback);
};
const startTransitionHook = (callback) => {
runCallback(2, callback);
};
const useTransition = () => {
const buildData = buildDataStack.at(-1);
if (!buildData) return [false, () => {}];
const [error, setError] = useState();
const [state, updateState] = useState();
if (error) throw error[0];
const startTransitionLocalHook = useCallback((callback) => {
startTransitionHook(() => {
updateState((state) => !state);
let res = callback();
if (res instanceof Promise) res = res.catch((e) => {
setError([e]);
});
return res;
});
}, [state]);
const [context] = buildData;
return [context[0] === 2, startTransitionLocalHook];
};
const useDeferredValue = (value, ...rest) => {
const [values, setValues] = useState(rest.length ? [rest[0], rest[0]] : [value, value]);
if (Object.is(values[1], value)) return values[1];
pendingStack.push([3, Promise.resolve()]);
updateHook = async (context, _, cb) => {
cb(context);
values[0] = value;
};
setValues([values[0], value]);
updateHook = void 0;
pendingStack.pop();
return values[0];
};
const useState = (initialState) => {
const resolveInitialState = () => typeof initialState === "function" ? initialState() : initialState;
const buildData = buildDataStack.at(-1);
if (!buildData) return [resolveInitialState(), () => {}];
const [, node] = buildData;
const stateArray = node[DOM_STASH][1][STASH_SATE] ||= [];
const hookIndex = node[DOM_STASH][0]++;
return stateArray[hookIndex] ||= [resolveInitialState(), (newState) => {
const localUpdateHook = updateHook;
const stateData = stateArray[hookIndex];
if (typeof newState === "function") newState = newState(stateData[0]);
if (!Object.is(newState, stateData[0])) {
stateData[0] = newState;
if (pendingStack.length) {
const [pendingType, pendingPromise] = pendingStack.at(-1);
Promise.all([pendingType === 3 ? node : update([
pendingType,
false,
localUpdateHook
], node), pendingPromise]).then(([node]) => {
if (!node || !(pendingType === 2 || pendingType === 3)) return;
const lastVC = node.vC;
const addUpdateTask = () => {
setTimeout(() => {
if (lastVC !== node.vC) return;
update([
pendingType === 3 ? 1 : 0,
false,
localUpdateHook
], node);
});
};
requestAnimationFrame(addUpdateTask);
});
} else update([
0,
false,
localUpdateHook
], node);
}
}];
};
const useReducer = (reducer, initialArg, init) => {
const handler = useCallback((action) => {
setState((state) => reducer(state, action));
}, [reducer]);
const [state, setState] = useState(() => init ? init(initialArg) : initialArg);
return [state, handler];
};
const useEffectCommon = (index, effect, deps) => {
const buildData = buildDataStack.at(-1);
if (!buildData) return;
const [, node] = buildData;
const effectDepsArray = node[DOM_STASH][1][1] ||= [];
const hookIndex = node[DOM_STASH][0]++;
const [prevDeps, , prevCleanup] = effectDepsArray[hookIndex] ||= [];
if (isDepsChanged(prevDeps, deps)) {
if (prevCleanup) prevCleanup();
const runner = () => {
data[index] = void 0;
data[2] = effect();
};
const data = [
deps,
void 0,
void 0,
void 0,
void 0
];
data[index] = runner;
effectDepsArray[hookIndex] = data;
}
};
const useEffect = (effect, deps) => useEffectCommon(3, effect, deps);
const useLayoutEffect = (effect, deps) => useEffectCommon(1, effect, deps);
const useInsertionEffect = (effect, deps) => useEffectCommon(4, effect, deps);
const useCallback = (callback, deps) => {
const buildData = buildDataStack.at(-1);
if (!buildData) return callback;
const [, node] = buildData;
const callbackArray = node[DOM_STASH][1][STASH_CALLBACK] ||= [];
const hookIndex = node[DOM_STASH][0]++;
const prevDeps = callbackArray[hookIndex];
if (isDepsChanged(prevDeps?.[1], deps)) callbackArray[hookIndex] = [callback, deps];
else callback = callbackArray[hookIndex][0];
return callback;
};
function useRef(initialValue) {
const buildData = buildDataStack.at(-1);
if (!buildData) return { current: initialValue };
const [, node] = buildData;
const refArray = node[DOM_STASH][1][STASH_REF] ||= [];
const hookIndex = node[DOM_STASH][0]++;
return refArray[hookIndex] ||= { current: initialValue };
}
const use = (promise) => {
const cachedRes = resolvedPromiseValueMap.get(promise);
if (cachedRes) {
if (cachedRes.length === 2) throw cachedRes[1];
return cachedRes[0];
}
promise.then((res) => resolvedPromiseValueMap.set(promise, [res]), (e) => resolvedPromiseValueMap.set(promise, [void 0, e]));
throw promise;
};
const useMemo = (factory, deps) => {
const buildData = buildDataStack.at(-1);
if (!buildData) return factory();
const [, node] = buildData;
const memoArray = node[DOM_STASH][1][STASH_MEMO] ||= [];
const hookIndex = node[DOM_STASH][0]++;
const prevDeps = memoArray[hookIndex];
if (isDepsChanged(prevDeps?.[1], deps)) memoArray[hookIndex] = [factory(), deps];
return memoArray[hookIndex][0];
};
let idCounter = 0;
const useId = () => useMemo(() => `:r${(idCounter++).toString(32)}:`, []);
const useDebugValue = (_value, _formatter) => {};
const createRef = () => {
return { current: null };
};
const forwardRef = (Component) => {
return (props) => {
const { ref, ...rest } = props;
return Component(rest, ref);
};
};
const useImperativeHandle = (ref, createHandle, deps) => {
useEffect(() => {
ref.current = createHandle();
return () => {
ref.current = null;
};
}, deps);
};
const useSyncExternalStore = (subscribe, getSnapshot, getServerSnapshot) => {
const buildData = buildDataStack.at(-1);
if (!buildData) {
if (!getServerSnapshot) throw new Error("getServerSnapshot is required for server side rendering");
return getServerSnapshot();
}
const snapshot = buildData[0][4] && getServerSnapshot ? getServerSnapshot() : getSnapshot();
const [, setVersion] = useState(0);
const latestSnapshot = useRef([snapshot, getSnapshot]);
latestSnapshot.current = [snapshot, getSnapshot];
const unsubscribeRef = useRef(null);
useEffect(() => {
const update = () => setVersion((version) => version + 1);
unsubscribeRef.current?.();
unsubscribeRef.current = subscribe(update);
const [snapshot, getSnapshot] = latestSnapshot.current;
if (!Object.is(snapshot, getSnapshot())) update();
}, [subscribe]);
useEffect(() => () => unsubscribeRef.current?.(), []);
return snapshot;
};
//#endregion
export { STASH_EFFECT, createRef, forwardRef, startTransition, startViewTransition, use, useCallback, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition };
@@ -0,0 +1 @@
{"version":3,"names":["_index","require","isScope","node","parent","isBlockStatement","isFunction","isCatchClause","isPattern","isScopable"],"sources":["../../src/validators/isScope.ts"],"sourcesContent":["import {\n isFunction,\n isCatchClause,\n isBlockStatement,\n isScopable,\n isPattern,\n} from \"./generated/index.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * Check if the input `node` is a scope.\n */\nexport default function isScope(\n node: t.Node | null | undefined,\n parent: t.Node,\n): boolean {\n // If a BlockStatement is an immediate descendent of a Function/CatchClause, it must be in the body.\n // Hence we skipped the parentKey === \"params\" check\n if (isBlockStatement(node) && (isFunction(parent) || isCatchClause(parent))) {\n return false;\n }\n\n // If a Pattern is an immediate descendent of a Function/CatchClause, it must be in the params.\n // Hence we skipped the parentKey === \"params\" check\n if (isPattern(node) && (isFunction(parent) || isCatchClause(parent))) {\n return true;\n }\n\n return isScopable(node);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAYe,SAASC,OAAOA,CAC7BC,IAA+B,EAC/BC,MAAc,EACL;EAGT,IAAI,IAAAC,uBAAgB,EAACF,IAAI,CAAC,KAAK,IAAAG,iBAAU,EAACF,MAAM,CAAC,IAAI,IAAAG,oBAAa,EAACH,MAAM,CAAC,CAAC,EAAE;IAC3E,OAAO,KAAK;EACd;EAIA,IAAI,IAAAI,gBAAS,EAACL,IAAI,CAAC,KAAK,IAAAG,iBAAU,EAACF,MAAM,CAAC,IAAI,IAAAG,oBAAa,EAACH,MAAM,CAAC,CAAC,EAAE;IACpE,OAAO,IAAI;EACb;EAEA,OAAO,IAAAK,iBAAU,EAACN,IAAI,CAAC;AACzB","ignoreList":[]}
@@ -0,0 +1,19 @@
import { DateInput } from './types';
/**
* Calculates the difference in months between two dates.
* 计算两个日期之间的月份差
*
* @param date - The first date to compare.
* @param input - The second date to compare.
* @param asFloat - Whether to return the result as a float.
* @returns The difference in months between the two dates.
* @example
* ```ts
* diffInMonths(new Date(), new Date()); // 0
* diffInMonths(new Date(), new Date(Date.now() + 1000 * 60 * 60 * 24 * 30)); // 1
* diffInMonths(new Date(), new Date(Date.now() - 1000 * 60 * 60 * 24 * 30)); // -1
* diffInMonths(new Date(), new Date(Date.now() - 1000 * 60 * 60 * 24 * 30 * 2)); // -2
* diffInMonths(new Date(), new Date(Date.now() + 1000 * 60 * 60 * 24 * 30 * 2)); // 2
* ```
*/
export default function diffInMonths(date: Date, input: DateInput, asFloat?: boolean): number;
@@ -0,0 +1,8 @@
import type { TSESTree } from '@typescript-eslint/types';
import type { ScopeManager } from '../ScopeManager';
import type { Scope } from './Scope';
import { ScopeBase } from './ScopeBase';
import { ScopeType } from './ScopeType';
export declare class ModuleScope extends ScopeBase<ScopeType.module, TSESTree.Program, Scope> {
constructor(scopeManager: ScopeManager, upperScope: ModuleScope['upper'], block: ModuleScope['block']);
}
@@ -0,0 +1 @@
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).MotionUtils={})}(this,function(n){"use strict";function t(n,t){-1===n.indexOf(t)&&n.push(t)}function e(n,t){const e=n.indexOf(t);e>-1&&n.splice(e,1)}const i=(n,t,e)=>e>t?t:e<n?n:e;function s(n,t){return t?`${n}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:n}n.warning=()=>{},n.invariant=()=>{},"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(n.warning=(n,t,e)=>{n||"undefined"==typeof console||console.warn(s(t,e))},n.invariant=(n,t,e)=>{if(!n)throw new Error(s(t,e))});const o=n=>n,r=(n,t)=>e=>t(n(e));const c=new Set;const u=(n,t,e)=>{const i=t-n;return((e-n)%i+i)%i+n},a=(n,t,e)=>(((1-3*e+3*t)*n+(3*e-6*t))*n+3*t)*n;function f(n,t,e,i){if(n===t&&e===i)return o;const s=t=>function(n,t,e,i,s){let o,r,c=0;do{r=t+(e-t)/2,o=a(r,i,s)-n,o>0?e=r:t=r}while(Math.abs(o)>1e-7&&++c<12);return r}(t,0,1,n,e);return n=>0===n||1===n?n:a(s(n),t,i)}const l=n=>t=>t<=.5?n(2*t)/2:(2-n(2*(1-t)))/2,p=n=>t=>1-n(1-t),d=f(.33,1.53,.69,.99),h=p(d),g=l(h),b=n=>n>=1?1:(n*=2)<1?.5*h(n):.5*(2-Math.pow(2,-10*(n-1))),m=n=>1-Math.sin(Math.acos(n)),y=p(m),v=l(m),O=f(.42,0,1,1),I=f(0,0,.58,1),M=f(.42,0,.58,1);const w=n=>Array.isArray(n)&&"number"!=typeof n[0];const S=n=>Array.isArray(n)&&"number"==typeof n[0],E={linear:o,easeIn:O,easeInOut:M,easeOut:I,circIn:m,circInOut:v,circOut:y,backIn:h,backInOut:g,backOut:d,anticipate:b};n.MotionGlobalConfig={},n.SubscriptionManager=class{constructor(){this.subscriptions=[]}add(n){return t(this.subscriptions,n),()=>e(this.subscriptions,n)}notify(n,t,e){const i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](n,t,e);else for(let s=0;s<i;s++){const i=this.subscriptions[s];i&&i(n,t,e)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},n.addUniqueItem=t,n.anticipate=b,n.backIn=h,n.backInOut=g,n.backOut=d,n.circIn=m,n.circInOut=v,n.circOut=y,n.clamp=i,n.cubicBezier=f,n.easeIn=O,n.easeInOut=M,n.easeOut=I,n.easingDefinitionToFunction=t=>{if(S(t)){n.invariant(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,i,s,o]=t;return f(e,i,s,o)}return"string"==typeof t?(n.invariant(void 0!==E[t],`Invalid easing type '${t}'`,"invalid-easing-type"),E[t]):t},n.getEasingForSegment=function(n,t){return w(n)?n[u(0,n.length,t)]:n},n.hasWarned=function(n){return c.has(n)},n.isBezierDefinition=S,n.isEasingArray=w,n.isNumericalString=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),n.isObject=function(n){return"object"==typeof n&&null!==n},n.isZeroValueString=n=>/^0[^.\s]+$/u.test(n),n.memo=function(n){let t;return()=>(void 0===t&&(t=n()),t)},n.millisecondsToSeconds=n=>n/1e3,n.mirrorEasing=l,n.moveItem=function([...n],t,e){const i=t<0?n.length+t:t;if(i>=0&&i<n.length){const i=e<0?n.length+e:e,[s]=n.splice(t,1);n.splice(i,0,s)}return n},n.noop=o,n.pipe=(...n)=>n.reduce(r),n.progress=(n,t,e)=>{const i=t-n;return 0===i?1:(e-n)/i},n.removeItem=e,n.reverseEasing=p,n.secondsToMilliseconds=n=>1e3*n,n.steps=function(n,t="end"){return e=>{const s=(e="end"===t?Math.min(e,.999):Math.max(e,.001))*n,o="end"===t?Math.floor(s):Math.ceil(s);return i(0,1,o/n)}},n.velocityPerSecond=function(n,t){return t?n*(1e3/t):0},n.warnOnce=function(n,t,e){n||c.has(t)||(console.warn(s(t,e)),c.add(t))},n.wrap=u});
@@ -0,0 +1,25 @@
{
"name": "@types/deep-eql",
"version": "4.0.2",
"description": "TypeScript definitions for deep-eql",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/deep-eql",
"license": "MIT",
"contributors": [
{
"name": "Rodrigo Pietnechuk",
"githubUsername": "ghnoob",
"url": "https://github.com/ghnoob"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/deep-eql"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "3b8981ce557947fc00ca08cbd93b4206bfc0943360956867381a0a3f6b1eabf5",
"typeScriptVersion": "4.5"
}
@@ -0,0 +1,297 @@
/**
* @fileoverview Validates spacing before and after semicolon
* @author Mathias Schreck
* @deprecated in ESLint v8.53.0
*/
"use strict";
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "11.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin",
url: "https://eslint.style",
},
rule: {
name: "semi-spacing",
url: "https://eslint.style/rules/semi-spacing",
},
},
],
},
type: "layout",
docs: {
description:
"Enforce consistent spacing before and after semicolons",
recommended: false,
url: "https://eslint.org/docs/latest/rules/semi-spacing",
},
fixable: "whitespace",
schema: [
{
type: "object",
properties: {
before: {
type: "boolean",
default: false,
},
after: {
type: "boolean",
default: true,
},
},
additionalProperties: false,
},
],
messages: {
unexpectedWhitespaceBefore:
"Unexpected whitespace before semicolon.",
unexpectedWhitespaceAfter: "Unexpected whitespace after semicolon.",
missingWhitespaceBefore: "Missing whitespace before semicolon.",
missingWhitespaceAfter: "Missing whitespace after semicolon.",
},
},
create(context) {
const config = context.options[0],
sourceCode = context.sourceCode;
let requireSpaceBefore = false,
requireSpaceAfter = true;
if (typeof config === "object") {
requireSpaceBefore = config.before;
requireSpaceAfter = config.after;
}
/**
* Checks if a given token has leading whitespace.
* @param {Object} token The token to check.
* @returns {boolean} True if the given token has leading space, false if not.
*/
function hasLeadingSpace(token) {
const tokenBefore = sourceCode.getTokenBefore(token);
return (
tokenBefore &&
astUtils.isTokenOnSameLine(tokenBefore, token) &&
sourceCode.isSpaceBetween(tokenBefore, token)
);
}
/**
* Checks if a given token has trailing whitespace.
* @param {Object} token The token to check.
* @returns {boolean} True if the given token has trailing space, false if not.
*/
function hasTrailingSpace(token) {
const tokenAfter = sourceCode.getTokenAfter(token);
return (
tokenAfter &&
astUtils.isTokenOnSameLine(token, tokenAfter) &&
sourceCode.isSpaceBetween(token, tokenAfter)
);
}
/**
* Checks if the given token is the last token in its line.
* @param {Token} token The token to check.
* @returns {boolean} Whether or not the token is the last in its line.
*/
function isLastTokenInCurrentLine(token) {
const tokenAfter = sourceCode.getTokenAfter(token);
return !(
tokenAfter && astUtils.isTokenOnSameLine(token, tokenAfter)
);
}
/**
* Checks if the given token is the first token in its line
* @param {Token} token The token to check.
* @returns {boolean} Whether or not the token is the first in its line.
*/
function isFirstTokenInCurrentLine(token) {
const tokenBefore = sourceCode.getTokenBefore(token);
return !(
tokenBefore && astUtils.isTokenOnSameLine(token, tokenBefore)
);
}
/**
* Checks if the next token of a given token is a closing parenthesis.
* @param {Token} token The token to check.
* @returns {boolean} Whether or not the next token of a given token is a closing parenthesis.
*/
function isBeforeClosingParen(token) {
const nextToken = sourceCode.getTokenAfter(token);
return (
(nextToken && astUtils.isClosingBraceToken(nextToken)) ||
astUtils.isClosingParenToken(nextToken)
);
}
/**
* Report location example :
*
* for unexpected space `before`
*
* var a = 'b' ;
* ^^^
*
* for unexpected space `after`
*
* var a = 'b'; c = 10;
* ^^
*
* Reports if the given token has invalid spacing.
* @param {Token} token The semicolon token to check.
* @param {ASTNode} node The corresponding node of the token.
* @returns {void}
*/
function checkSemicolonSpacing(token, node) {
if (astUtils.isSemicolonToken(token)) {
if (hasLeadingSpace(token)) {
if (!requireSpaceBefore) {
const tokenBefore = sourceCode.getTokenBefore(token);
const loc = {
start: tokenBefore.loc.end,
end: token.loc.start,
};
context.report({
node,
loc,
messageId: "unexpectedWhitespaceBefore",
fix(fixer) {
return fixer.removeRange([
tokenBefore.range[1],
token.range[0],
]);
},
});
}
} else {
if (requireSpaceBefore) {
const loc = token.loc;
context.report({
node,
loc,
messageId: "missingWhitespaceBefore",
fix(fixer) {
return fixer.insertTextBefore(token, " ");
},
});
}
}
if (
!isFirstTokenInCurrentLine(token) &&
!isLastTokenInCurrentLine(token) &&
!isBeforeClosingParen(token)
) {
if (hasTrailingSpace(token)) {
if (!requireSpaceAfter) {
const tokenAfter = sourceCode.getTokenAfter(token);
const loc = {
start: token.loc.end,
end: tokenAfter.loc.start,
};
context.report({
node,
loc,
messageId: "unexpectedWhitespaceAfter",
fix(fixer) {
return fixer.removeRange([
token.range[1],
tokenAfter.range[0],
]);
},
});
}
} else {
if (requireSpaceAfter) {
const loc = token.loc;
context.report({
node,
loc,
messageId: "missingWhitespaceAfter",
fix(fixer) {
return fixer.insertTextAfter(token, " ");
},
});
}
}
}
}
}
/**
* Checks the spacing of the semicolon with the assumption that the last token is the semicolon.
* @param {ASTNode} node The node to check.
* @returns {void}
*/
function checkNode(node) {
const token = sourceCode.getLastToken(node);
checkSemicolonSpacing(token, node);
}
return {
VariableDeclaration: checkNode,
ExpressionStatement: checkNode,
BreakStatement: checkNode,
ContinueStatement: checkNode,
DebuggerStatement: checkNode,
DoWhileStatement: checkNode,
ReturnStatement: checkNode,
ThrowStatement: checkNode,
ImportDeclaration: checkNode,
ExportNamedDeclaration: checkNode,
ExportAllDeclaration: checkNode,
ExportDefaultDeclaration: checkNode,
ForStatement(node) {
if (node.init) {
checkSemicolonSpacing(
sourceCode.getTokenAfter(node.init),
node,
);
}
if (node.test) {
checkSemicolonSpacing(
sourceCode.getTokenAfter(node.test),
node,
);
}
},
PropertyDefinition: checkNode,
};
},
};
@@ -0,0 +1,70 @@
import { f as createRule, g as import_ast_utils } from "../utils.js";
var no_multi_spaces_default = createRule({
name: "no-multi-spaces",
meta: {
type: "layout",
docs: { description: "Disallow multiple spaces" },
fixable: "whitespace",
schema: [{
type: "object",
properties: {
exceptions: {
type: "object",
patternProperties: { "^([A-Z][a-z]*)+$": { type: "boolean" } },
additionalProperties: false
},
ignoreEOLComments: { type: "boolean" },
includeTabs: { type: "boolean" }
},
additionalProperties: false
}],
defaultOptions: [{
exceptions: {
Property: true,
ImportAttribute: true
},
ignoreEOLComments: false,
includeTabs: true
}],
messages: { multipleSpaces: "Multiple spaces found before '{{displayValue}}'." }
},
create(context, [options]) {
const { ignoreEOLComments, exceptions, includeTabs } = options;
const sourceCode = context.sourceCode;
const hasExceptions = Object.keys(exceptions).some((key) => exceptions[key]);
const spacesRe = includeTabs ? /[ \t]{2}/ : / {2}/;
function formatReportedCommentValue(token) {
const valueLines = token.value.split("\n");
const value = valueLines[0];
const formattedValue = `${value.slice(0, 12)}...`;
return valueLines.length === 1 && value.length <= 12 ? value : formattedValue;
}
return { Program() {
sourceCode.tokensAndComments.forEach((leftToken, leftIndex, tokensAndComments) => {
if (leftIndex === tokensAndComments.length - 1) return;
const rightToken = tokensAndComments[leftIndex + 1];
if (!spacesRe.test(sourceCode.text.slice(leftToken.range[1], rightToken.range[0])) || leftToken.loc.end.line < rightToken.loc.start.line) return;
if (ignoreEOLComments && (0, import_ast_utils.isCommentToken)(rightToken) && (leftIndex === tokensAndComments.length - 2 || rightToken.loc.end.line < tokensAndComments[leftIndex + 2].loc.start.line)) return;
if (hasExceptions) {
const parentNode = sourceCode.getNodeByRangeIndex(rightToken.range[0] - 1);
if (parentNode && exceptions[parentNode.type]) return;
}
let displayValue;
if (rightToken.type === "Block") displayValue = `/*${formatReportedCommentValue(rightToken)}*/`;
else if (rightToken.type === "Line") displayValue = `//${formatReportedCommentValue(rightToken)}`;
else displayValue = rightToken.value;
context.report({
node: rightToken,
loc: {
start: leftToken.loc.end,
end: rightToken.loc.start
},
messageId: "multipleSpaces",
data: { displayValue },
fix: (fixer) => fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], " ")
});
});
} };
}
});
export { no_multi_spaces_default as t };
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_K","2":"_x","260":"_VB"},C:{"1":"_OJ _hC _rD z _tH","2":"_UN vB _L","129":"wB","514":"_iI _LD _jF y"},D:{"1":"_ZJ _mD","2":"_LE _zD"},E:{"1":"_PC","2":"_3C"},F:{"1":"_NN _NG","2":"_j _dG _O"},G:{"1":"_NC","2":"_0C"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_U","2":"J"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:5,C:"Resource Hints: preconnect",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"list-start.js","sources":["../../../src/icons/list-start.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ListStart\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTYgMTJIMyIgLz4KICA8cGF0aCBkPSJNMTYgMThIMyIgLz4KICA8cGF0aCBkPSJNMTAgNkgzIiAvPgogIDxwYXRoIGQ9Ik0yMSAxOFY4YTIgMiAwIDAgMC0yLTJoLTUiIC8+CiAgPHBhdGggZD0ibTE2IDgtMi0yIDItMiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/list-start\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 ListStart = createLucideIcon('ListStart', [\n ['path', { d: 'M16 12H3', key: '1a2rj7' }],\n ['path', { d: 'M16 18H3', key: '12xzn7' }],\n ['path', { d: 'M10 6H3', key: 'lf8lx7' }],\n ['path', { d: 'M21 18V8a2 2 0 0 0-2-2h-5', key: '1hghli' }],\n ['path', { d: 'm16 8-2-2 2-2', key: '160uvd' }],\n]);\n\nexport default ListStart;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,iBAAiB,WAAa,CAAA,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,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,CAA6B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,151 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _t = require("@babel/types");
var _util = require("./util.js");
const {
BOOLEAN_NUMBER_BINARY_OPERATORS,
createTypeAnnotationBasedOnTypeof,
numberTypeAnnotation,
voidTypeAnnotation
} = _t;
function _default(node) {
if (!this.isReferenced()) return;
const binding = this.scope.getBinding(node.name);
if (binding) {
if (binding.identifier.typeAnnotation) {
return binding.identifier.typeAnnotation;
} else {
return getTypeAnnotationBindingConstantViolations(binding, this, node.name);
}
}
if (node.name === "undefined") {
return voidTypeAnnotation();
} else if (node.name === "NaN" || node.name === "Infinity") {
return numberTypeAnnotation();
} else if (node.name === "arguments") {}
}
function getTypeAnnotationBindingConstantViolations(binding, path, name) {
const types = [];
const functionConstantViolations = [];
let constantViolations = getConstantViolationsBefore(binding, path, functionConstantViolations);
const testType = getConditionalAnnotation(binding, path, name);
if (testType) {
const testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement);
constantViolations = constantViolations.filter(path => !testConstantViolations.includes(path));
types.push(testType.typeAnnotation);
}
if (constantViolations.length) {
constantViolations.push(...functionConstantViolations);
for (const violation of constantViolations) {
types.push(violation.getTypeAnnotation());
}
}
if (!types.length) {
return;
}
return (0, _util.createUnionType)(types);
}
function getConstantViolationsBefore(binding, path, functions) {
const violations = binding.constantViolations.slice();
violations.unshift(binding.path);
return violations.filter(violation => {
violation = violation.resolve();
const status = violation._guessExecutionStatusRelativeTo(path);
if (functions && status === "unknown") functions.push(violation);
return status === "before";
});
}
function inferAnnotationFromBinaryExpression(name, path) {
const operator = path.node.operator;
const right = path.get("right").resolve();
const left = path.get("left").resolve();
let target;
if (left.isIdentifier({
name
})) {
target = right;
} else if (right.isIdentifier({
name
})) {
target = left;
}
if (target) {
if (operator === "===") {
return target.getTypeAnnotation();
}
if (BOOLEAN_NUMBER_BINARY_OPERATORS.includes(operator)) {
return numberTypeAnnotation();
}
return;
}
if (operator !== "===" && operator !== "==") return;
let typeofPath;
let typePath;
if (left.isUnaryExpression({
operator: "typeof"
})) {
typeofPath = left;
typePath = right;
} else if (right.isUnaryExpression({
operator: "typeof"
})) {
typeofPath = right;
typePath = left;
}
if (!typeofPath) return;
if (!typeofPath.get("argument").isIdentifier({
name
})) return;
typePath = typePath.resolve();
if (!typePath.isLiteral()) return;
const typeValue = typePath.node.value;
if (typeof typeValue !== "string") return;
return createTypeAnnotationBasedOnTypeof(typeValue);
}
function getParentConditionalPath(binding, path, name) {
let parentPath;
while (parentPath = path.parentPath) {
if (parentPath.isIfStatement() || parentPath.isConditionalExpression()) {
if (path.key === "test") {
return;
}
return parentPath;
}
if (parentPath.isFunction()) {
if (name == null || parentPath.parentPath.scope.getBinding(name) !== binding) return;
}
path = parentPath;
}
}
function getConditionalAnnotation(binding, path, name) {
const ifStatement = getParentConditionalPath(binding, path, name);
if (!ifStatement) return;
const test = ifStatement.get("test");
const paths = [test];
const types = [];
for (let i = 0; i < paths.length; i++) {
const path = paths[i];
if (path.isLogicalExpression()) {
if (path.node.operator === "&&") {
paths.push(path.get("left"));
paths.push(path.get("right"));
}
} else if (path.isBinaryExpression()) {
const type = inferAnnotationFromBinaryExpression(name, path);
if (type) types.push(type);
}
}
if (types.length) {
return {
typeAnnotation: (0, _util.createUnionType)(types),
ifStatement
};
}
return getConditionalAnnotation(binding, ifStatement, name);
}
//# sourceMappingURL=inferer-reference.js.map
@@ -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 LockOpen = createLucideIcon("LockOpen", [
["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
]);
export { LockOpen as default };
//# sourceMappingURL=lock-open.js.map
@@ -0,0 +1 @@
{"version":3,"file":"code-xml.js","sources":["../../../src/icons/code-xml.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CodeXml\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTggMTYgNC00LTQtNCIgLz4KICA8cGF0aCBkPSJtNiA4LTQgNCA0IDQiIC8+CiAgPHBhdGggZD0ibTE0LjUgNC01IDE2IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/code-xml\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 CodeXml = createLucideIcon('CodeXml', [\n ['path', { d: 'm18 16 4-4-4-4', key: '1inbqp' }],\n ['path', { d: 'm6 8-4 4 4 4', key: '15zrgr' }],\n ['path', { d: 'm14.5 4-5 16', key: 'e7oirm' }],\n]);\n\nexport default CodeXml;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC/C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC7C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC/C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"names":["_classCallCheck","instance","Constructor","TypeError"],"sources":["../../src/helpers/classCallCheck.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _classCallCheck<T extends object>(\n instance: unknown,\n Constructor: new (...args: any[]) => T,\n): asserts instance is T {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n"],"mappings":";;;;;;AAEe,SAASA,eAAeA,CACrCC,QAAiB,EACjBC,WAAsC,EACf;EACvB,IAAI,EAAED,QAAQ,YAAYC,WAAW,CAAC,EAAE;IACtC,MAAM,IAAIC,SAAS,CAAC,mCAAmC,CAAC;EAC1D;AACF","ignoreList":[]}
@@ -0,0 +1,232 @@
// Matches the scheme of a URL, eg "http://"
const schemeRegex = /^[\w+.-]+:\/\//;
/**
* Matches the parts of a URL:
* 1. Scheme, including ":", guaranteed.
* 2. User/password, including "@", optional.
* 3. Host, guaranteed.
* 4. Port, including ":", optional.
* 5. Path, including "/", optional.
* 6. Query, including "?", optional.
* 7. Hash, including "#", optional.
*/
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
/**
* File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
* with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
*
* 1. Host, optional.
* 2. Path, which may include "/", guaranteed.
* 3. Query, including "?", optional.
* 4. Hash, including "#", optional.
*/
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
function isAbsoluteUrl(input) {
return schemeRegex.test(input);
}
function isSchemeRelativeUrl(input) {
return input.startsWith('//');
}
function isAbsolutePath(input) {
return input.startsWith('/');
}
function isFileUrl(input) {
return input.startsWith('file:');
}
function isRelative(input) {
return /^[.?#]/.test(input);
}
function parseAbsoluteUrl(input) {
const match = urlRegex.exec(input);
return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
}
function parseFileUrl(input) {
const match = fileRegex.exec(input);
const path = match[2];
return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
}
function makeUrl(scheme, user, host, port, path, query, hash) {
return {
scheme,
user,
host,
port,
path,
query,
hash,
type: 7 /* Absolute */,
};
}
function parseUrl(input) {
if (isSchemeRelativeUrl(input)) {
const url = parseAbsoluteUrl('http:' + input);
url.scheme = '';
url.type = 6 /* SchemeRelative */;
return url;
}
if (isAbsolutePath(input)) {
const url = parseAbsoluteUrl('http://foo.com' + input);
url.scheme = '';
url.host = '';
url.type = 5 /* AbsolutePath */;
return url;
}
if (isFileUrl(input))
return parseFileUrl(input);
if (isAbsoluteUrl(input))
return parseAbsoluteUrl(input);
const url = parseAbsoluteUrl('http://foo.com/' + input);
url.scheme = '';
url.host = '';
url.type = input
? input.startsWith('?')
? 3 /* Query */
: input.startsWith('#')
? 2 /* Hash */
: 4 /* RelativePath */
: 1 /* Empty */;
return url;
}
function stripPathFilename(path) {
// If a path ends with a parent directory "..", then it's a relative path with excess parent
// paths. It's not a file, so we can't strip it.
if (path.endsWith('/..'))
return path;
const index = path.lastIndexOf('/');
return path.slice(0, index + 1);
}
function mergePaths(url, base) {
normalizePath(base, base.type);
// If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
// path).
if (url.path === '/') {
url.path = base.path;
}
else {
// Resolution happens relative to the base path's directory, not the file.
url.path = stripPathFilename(base.path) + url.path;
}
}
/**
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
* "foo/.". We need to normalize to a standard representation.
*/
function normalizePath(url, type) {
const rel = type <= 4 /* RelativePath */;
const pieces = url.path.split('/');
// We need to preserve the first piece always, so that we output a leading slash. The item at
// pieces[0] is an empty string.
let pointer = 1;
// Positive is the number of real directories we've output, used for popping a parent directory.
// Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
let positive = 0;
// We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
// generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
// real directory, we won't need to append, unless the other conditions happen again.
let addTrailingSlash = false;
for (let i = 1; i < pieces.length; i++) {
const piece = pieces[i];
// An empty directory, could be a trailing slash, or just a double "//" in the path.
if (!piece) {
addTrailingSlash = true;
continue;
}
// If we encounter a real directory, then we don't need to append anymore.
addTrailingSlash = false;
// A current directory, which we can always drop.
if (piece === '.')
continue;
// A parent directory, we need to see if there are any real directories we can pop. Else, we
// have an excess of parents, and we'll need to keep the "..".
if (piece === '..') {
if (positive) {
addTrailingSlash = true;
positive--;
pointer--;
}
else if (rel) {
// If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
// URL, protocol relative URL, or an absolute path, we don't need to keep excess.
pieces[pointer++] = piece;
}
continue;
}
// We've encountered a real directory. Move it to the next insertion pointer, which accounts for
// any popped or dropped directories.
pieces[pointer++] = piece;
positive++;
}
let path = '';
for (let i = 1; i < pointer; i++) {
path += '/' + pieces[i];
}
if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
path += '/';
}
url.path = path;
}
/**
* Attempts to resolve `input` URL/path relative to `base`.
*/
function resolve(input, base) {
if (!input && !base)
return '';
const url = parseUrl(input);
let inputType = url.type;
if (base && inputType !== 7 /* Absolute */) {
const baseUrl = parseUrl(base);
const baseType = baseUrl.type;
switch (inputType) {
case 1 /* Empty */:
url.hash = baseUrl.hash;
// fall through
case 2 /* Hash */:
url.query = baseUrl.query;
// fall through
case 3 /* Query */:
case 4 /* RelativePath */:
mergePaths(url, baseUrl);
// fall through
case 5 /* AbsolutePath */:
// The host, user, and port are joined, you can't copy one without the others.
url.user = baseUrl.user;
url.host = baseUrl.host;
url.port = baseUrl.port;
// fall through
case 6 /* SchemeRelative */:
// The input doesn't have a schema at least, so we need to copy at least that over.
url.scheme = baseUrl.scheme;
}
if (baseType > inputType)
inputType = baseType;
}
normalizePath(url, inputType);
const queryHash = url.query + url.hash;
switch (inputType) {
// This is impossible, because of the empty checks at the start of the function.
// case UrlType.Empty:
case 2 /* Hash */:
case 3 /* Query */:
return queryHash;
case 4 /* RelativePath */: {
// The first char is always a "/", and we need it to be relative.
const path = url.path.slice(1);
if (!path)
return queryHash || '.';
if (isRelative(base || input) && !isRelative(path)) {
// If base started with a leading ".", or there is no base and input started with a ".",
// then we need to ensure that the relative path starts with a ".". We don't know if
// relative starts with a "..", though, so check before prepending.
return './' + path + queryHash;
}
return path + queryHash;
}
case 5 /* AbsolutePath */:
return url.path + queryHash;
default:
return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
}
}
export { resolve as default };
//# sourceMappingURL=resolve-uri.mjs.map
@@ -0,0 +1,16 @@
import { MutableRefObject } from 'react';
/**
* creates a MutableRef with ref change callback
* @param initialValue - initial ref value
* @param {Function} callback - a callback to run when value changes
*
* @example
* const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);
* ref.current = 1;
* // prints 0 -> 1
*
* @see https://reactjs.org/docs/hooks-reference.html#useref
* @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref
* @returns {MutableRefObject}
*/
export declare function useCallbackRef<T>(initialValue: T | null, callback: (newValue: T | null, lastValue: T | null) => void): MutableRefObject<T | null>;
@@ -0,0 +1,35 @@
/**
* @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 Brain = createLucideIcon("Brain", [
[
"path",
{
d: "M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",
key: "l5xja"
}
],
[
"path",
{
d: "M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",
key: "ep3f8r"
}
],
["path", { d: "M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4", key: "1p4c4q" }],
["path", { d: "M17.599 6.5a3 3 0 0 0 .399-1.375", key: "tmeiqw" }],
["path", { d: "M6.003 5.125A3 3 0 0 0 6.401 6.5", key: "105sqy" }],
["path", { d: "M3.477 10.896a4 4 0 0 1 .585-.396", key: "ql3yin" }],
["path", { d: "M19.938 10.5a4 4 0 0 1 .585.396", key: "1qfode" }],
["path", { d: "M6 18a4 4 0 0 1-1.967-.516", key: "2e4loj" }],
["path", { d: "M19.967 17.484A4 4 0 0 1 18 18", key: "159ez6" }]
]);
export { Brain as default };
//# sourceMappingURL=brain.js.map
@@ -0,0 +1 @@
{"version":3,"file":"inMemory.js","sourceRoot":"","sources":["../../src/inMemory.ts"],"names":[],"mappings":";;;AASA;;GAEG;AACH,MAAa,iBAAiB;IAA9B;QAEY,kBAAa,GAAoB,EAAE,CAAC;IAgDhD,CAAC;IAzCG;;OAEG;IACH,MAAM,CAAC,gBAAgB;QACnB,MAAM,eAAe,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAChD,MAAM,eAAe,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAChD,eAAe,CAAC,eAAe,GAAG,eAAe,CAAC;QAClD,eAAe,CAAC,eAAe,GAAG,eAAe,CAAC;QAClD,OAAO,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,KAAK;QACP,gEAAgE;QAChE,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAG,CAAC;YAClD,IAAI,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;QACjE,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAK;QACP,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,MAAM,KAAK,EAAE,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB,EAAE,OAA+D;QAC/F,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC7E,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;QACjG,CAAC;IACL,CAAC;CACJ;AAlDD,8CAkDC"}
@@ -0,0 +1,11 @@
//#region src/adapter/bun/server.ts
/**
* Get Bun Server Object from Context
* @template T - The type of Bun Server
* @param c Context
* @returns Bun Server
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
const getBunServer = (c) => "server" in c.env ? c.env.server : c.env;
//#endregion
export { getBunServer };
@@ -0,0 +1 @@
{"version":3,"names":["_index","require","isPlaceholderType","placeholderType","targetType","aliases","PLACEHOLDERS_ALIAS","includes"],"sources":["../../src/validators/isPlaceholderType.ts"],"sourcesContent":["import { PLACEHOLDERS_ALIAS } from \"../definitions/index.ts\";\n\n/**\n * Test if a `placeholderType` is a `targetType` or if `targetType` is an alias of `placeholderType`.\n */\nexport default function isPlaceholderType(\n placeholderType: string,\n targetType: string,\n): boolean {\n if (placeholderType === targetType) return true;\n\n const aliases: string[] | undefined = PLACEHOLDERS_ALIAS[placeholderType];\n if (aliases?.includes(targetType)) return true;\n\n return false;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKe,SAASC,iBAAiBA,CACvCC,eAAuB,EACvBC,UAAkB,EACT;EACT,IAAID,eAAe,KAAKC,UAAU,EAAE,OAAO,IAAI;EAE/C,MAAMC,OAA6B,GAAGC,yBAAkB,CAACH,eAAe,CAAC;EACzE,IAAIE,OAAO,YAAPA,OAAO,CAAEE,QAAQ,CAACH,UAAU,CAAC,EAAE,OAAO,IAAI;EAE9C,OAAO,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const uri = require("fast-uri");
uri.code = 'require("ajv/dist/runtime/uri").default';
exports.default = uri;
//# sourceMappingURL=uri.js.map
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=clients.js.map
@@ -0,0 +1,101 @@
import Options from './Options'
import { DefaultFeedbackFunction, FeedbackType, MatchEstimated } from './types'
import bruteforceMatcher from './matcher/bruteforce/feedback'
import dateMatcher from './matcher/date/feedback'
import dictionaryMatcher from './matcher/dictionary/feedback'
import regexMatcher from './matcher/regex/feedback'
import repeatMatcher from './matcher/repeat/feedback'
import sequenceMatcher from './matcher/sequence/feedback'
import spatialMatcher from './matcher/spatial/feedback'
import separatorMatcher from './matcher/separator/feedback'
import wordSequenceMatcher from './matcher/wordSequence/feedback'
const defaultFeedback = {
warning: null,
suggestions: [],
}
type Matchers = Record<string, DefaultFeedbackFunction>
/*
* -------------------------------------------------------------------------------
* Generate feedback ---------------------------------------------------------------
* -------------------------------------------------------------------------------
*/
class Feedback {
private matchers: Matchers = {}
private defaultFeedback: FeedbackType = {
warning: null,
suggestions: [],
}
constructor(private options: Options) {
this.setDefaultSuggestions()
this.matchers = {
bruteforce: bruteforceMatcher,
date: dateMatcher,
dictionary: dictionaryMatcher,
regex: regexMatcher,
repeat: repeatMatcher,
sequence: sequenceMatcher,
spatial: spatialMatcher,
separator: separatorMatcher,
wordSequence: wordSequenceMatcher,
}
Object.entries(this.options.matchers).forEach(([key, matcher]) => {
if (matcher.feedback) {
this.matchers[key] = matcher.feedback
}
})
}
private setDefaultSuggestions() {
this.defaultFeedback.suggestions.push(
this.options.translations.suggestions.useWords,
this.options.translations.suggestions.noNeed,
)
}
public getFeedback(score: number, sequence: MatchEstimated[]) {
if (sequence.length === 0) {
return this.defaultFeedback
}
if (score > 2) {
return defaultFeedback
}
const extraFeedback = this.options.translations.suggestions.anotherWord
const longestMatch = this.getLongestMatch(sequence)
let feedback = this.getMatchFeedback(longestMatch, sequence.length === 1)
if (feedback !== null && feedback !== undefined) {
feedback.suggestions.unshift(extraFeedback)
} else {
feedback = {
warning: null,
suggestions: [extraFeedback],
}
}
return feedback
}
private getLongestMatch(sequence: MatchEstimated[]) {
let longestMatch = sequence[0]
// ignore first entry
for (let i = 1; i < sequence.length; i += 1) {
const match = sequence[i]
if (match.token.length > longestMatch.token.length) {
longestMatch = match
}
}
return longestMatch
}
private getMatchFeedback(match: MatchEstimated, isSoleMatch: boolean) {
if (this.matchers[match.pattern]) {
return this.matchers[match.pattern](this.options, match, isSoleMatch)
}
return defaultFeedback
}
}
export default Feedback
@@ -0,0 +1 @@
{"version":3,"file":"popsicle.js","sources":["../../../src/icons/popsicle.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Popsicle\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTguNiAxNC40Yy44LS44LjgtMiAwLTIuOGwtOC4xLTguMWE0Ljk1IDQuOTUgMCAxIDAtNy4xIDcuMWw4LjEgOC4xYy45LjcgMi4xLjcgMi45LS4xWiIgLz4KICA8cGF0aCBkPSJtMjIgMjItNS41LTUuNSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/popsicle\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 Popsicle = createLucideIcon('Popsicle', [\n [\n 'path',\n {\n d: 'M18.6 14.4c.8-.8.8-2 0-2.8l-8.1-8.1a4.95 4.95 0 1 0-7.1 7.1l8.1 8.1c.9.7 2.1.7 2.9-.1Z',\n key: '1o68ps',\n },\n ],\n ['path', { d: 'm22 22-5.5-5.5', key: '17o70y' }],\n]);\n\nexport default Popsicle;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAC5C,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;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,CAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACjD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,4 @@
import type Ajv from "../../core";
import { SchemaObjectMap } from "./types";
import { SchemaEnv } from "..";
export default function compileSerializer(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv;
@@ -0,0 +1,716 @@
export type Platform = 'browser' | 'node' | 'neutral'
export type Format = 'iife' | 'cjs' | 'esm'
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
export type Charset = 'ascii' | 'utf8'
export type Drop = 'console' | 'debugger'
export type AbsPaths = 'code' | 'log' | 'metafile'
interface CommonOptions {
/** Documentation: https://esbuild.github.io/api/#sourcemap */
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'
/** Documentation: https://esbuild.github.io/api/#legal-comments */
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'
/** Documentation: https://esbuild.github.io/api/#source-root */
sourceRoot?: string
/** Documentation: https://esbuild.github.io/api/#sources-content */
sourcesContent?: boolean
/** Documentation: https://esbuild.github.io/api/#format */
format?: Format
/** Documentation: https://esbuild.github.io/api/#global-name */
globalName?: string
/** Documentation: https://esbuild.github.io/api/#target */
target?: string | string[]
/** Documentation: https://esbuild.github.io/api/#supported */
supported?: Record<string, boolean>
/** Documentation: https://esbuild.github.io/api/#platform */
platform?: Platform
/** Documentation: https://esbuild.github.io/api/#mangle-props */
mangleProps?: RegExp
/** Documentation: https://esbuild.github.io/api/#mangle-props */
reserveProps?: RegExp
/** Documentation: https://esbuild.github.io/api/#mangle-props */
mangleQuoted?: boolean
/** Documentation: https://esbuild.github.io/api/#mangle-props */
mangleCache?: Record<string, string | false>
/** Documentation: https://esbuild.github.io/api/#drop */
drop?: Drop[]
/** Documentation: https://esbuild.github.io/api/#drop-labels */
dropLabels?: string[]
/** Documentation: https://esbuild.github.io/api/#minify */
minify?: boolean
/** Documentation: https://esbuild.github.io/api/#minify */
minifyWhitespace?: boolean
/** Documentation: https://esbuild.github.io/api/#minify */
minifyIdentifiers?: boolean
/** Documentation: https://esbuild.github.io/api/#minify */
minifySyntax?: boolean
/** Documentation: https://esbuild.github.io/api/#line-limit */
lineLimit?: number
/** Documentation: https://esbuild.github.io/api/#charset */
charset?: Charset
/** Documentation: https://esbuild.github.io/api/#tree-shaking */
treeShaking?: boolean
/** Documentation: https://esbuild.github.io/api/#ignore-annotations */
ignoreAnnotations?: boolean
/** Documentation: https://esbuild.github.io/api/#jsx */
jsx?: 'transform' | 'preserve' | 'automatic'
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
jsxFactory?: string
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
jsxFragment?: string
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
jsxImportSource?: string
/** Documentation: https://esbuild.github.io/api/#jsx-development */
jsxDev?: boolean
/** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
jsxSideEffects?: boolean
/** Documentation: https://esbuild.github.io/api/#define */
define?: { [key: string]: string }
/** Documentation: https://esbuild.github.io/api/#pure */
pure?: string[]
/** Documentation: https://esbuild.github.io/api/#keep-names */
keepNames?: boolean
/** Documentation: https://esbuild.github.io/api/#abs-paths */
absPaths?: AbsPaths[]
/** Documentation: https://esbuild.github.io/api/#color */
color?: boolean
/** Documentation: https://esbuild.github.io/api/#log-level */
logLevel?: LogLevel
/** Documentation: https://esbuild.github.io/api/#log-limit */
logLimit?: number
/** Documentation: https://esbuild.github.io/api/#log-override */
logOverride?: Record<string, LogLevel>
/** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
tsconfigRaw?: string | TsconfigRaw
}
export interface TsconfigRaw {
compilerOptions?: {
alwaysStrict?: boolean
baseUrl?: string
experimentalDecorators?: boolean
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'
jsx?: 'preserve' | 'react-native' | 'react' | 'react-jsx' | 'react-jsxdev'
jsxFactory?: string
jsxFragmentFactory?: string
jsxImportSource?: string
paths?: Record<string, string[]>
preserveValueImports?: boolean
strict?: boolean
target?: string
useDefineForClassFields?: boolean
verbatimModuleSyntax?: boolean
}
}
export interface BuildOptions extends CommonOptions {
/** Documentation: https://esbuild.github.io/api/#bundle */
bundle?: boolean
/** Documentation: https://esbuild.github.io/api/#splitting */
splitting?: boolean
/** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
preserveSymlinks?: boolean
/** Documentation: https://esbuild.github.io/api/#outfile */
outfile?: string
/** Documentation: https://esbuild.github.io/api/#metafile */
metafile?: boolean
/** Documentation: https://esbuild.github.io/api/#outdir */
outdir?: string
/** Documentation: https://esbuild.github.io/api/#outbase */
outbase?: string
/** Documentation: https://esbuild.github.io/api/#external */
external?: string[]
/** Documentation: https://esbuild.github.io/api/#packages */
packages?: 'bundle' | 'external'
/** Documentation: https://esbuild.github.io/api/#alias */
alias?: Record<string, string>
/** Documentation: https://esbuild.github.io/api/#loader */
loader?: { [ext: string]: Loader }
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
resolveExtensions?: string[]
/** Documentation: https://esbuild.github.io/api/#main-fields */
mainFields?: string[]
/** Documentation: https://esbuild.github.io/api/#conditions */
conditions?: string[]
/** Documentation: https://esbuild.github.io/api/#write */
write?: boolean
/** Documentation: https://esbuild.github.io/api/#allow-overwrite */
allowOverwrite?: boolean
/** Documentation: https://esbuild.github.io/api/#tsconfig */
tsconfig?: string
/** Documentation: https://esbuild.github.io/api/#out-extension */
outExtension?: { [ext: string]: string }
/** Documentation: https://esbuild.github.io/api/#public-path */
publicPath?: string
/** Documentation: https://esbuild.github.io/api/#entry-names */
entryNames?: string
/** Documentation: https://esbuild.github.io/api/#chunk-names */
chunkNames?: string
/** Documentation: https://esbuild.github.io/api/#asset-names */
assetNames?: string
/** Documentation: https://esbuild.github.io/api/#inject */
inject?: string[]
/** Documentation: https://esbuild.github.io/api/#banner */
banner?: { [type: string]: string }
/** Documentation: https://esbuild.github.io/api/#footer */
footer?: { [type: string]: string }
/** Documentation: https://esbuild.github.io/api/#entry-points */
entryPoints?: (string | { in: string, out: string })[] | Record<string, string>
/** Documentation: https://esbuild.github.io/api/#stdin */
stdin?: StdinOptions
/** Documentation: https://esbuild.github.io/plugins/ */
plugins?: Plugin[]
/** Documentation: https://esbuild.github.io/api/#working-directory */
absWorkingDir?: string
/** Documentation: https://esbuild.github.io/api/#node-paths */
nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
}
export interface StdinOptions {
contents: string | Uint8Array
resolveDir?: string
sourcefile?: string
loader?: Loader
}
export interface Message {
id: string
pluginName: string
text: string
location: Location | null
notes: Note[]
/**
* Optional user-specified data that is passed through unmodified. You can
* use this to stash the original error, for example.
*/
detail: any
}
export interface Note {
text: string
location: Location | null
}
export interface Location {
file: string
namespace: string
/** 1-based */
line: number
/** 0-based, in bytes */
column: number
/** in bytes */
length: number
lineText: string
suggestion: string
}
export interface OutputFile {
path: string
contents: Uint8Array
hash: string
/** "contents" as text (changes automatically with "contents") */
readonly text: string
}
export interface BuildResult<ProvidedOptions extends BuildOptions = BuildOptions> {
errors: Message[]
warnings: Message[]
/** Only when "write: false" */
outputFiles: OutputFile[] | (ProvidedOptions['write'] extends false ? never : undefined)
/** Only when "metafile: true" */
metafile: Metafile | (ProvidedOptions['metafile'] extends true ? never : undefined)
/** Only when "mangleCache" is present */
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
}
export interface BuildFailure extends Error {
errors: Message[]
warnings: Message[]
}
/** Documentation: https://esbuild.github.io/api/#serve-arguments */
export interface ServeOptions {
port?: number
host?: string
servedir?: string
keyfile?: string
certfile?: string
fallback?: string
cors?: CORSOptions
onRequest?: (args: ServeOnRequestArgs) => void
}
/** Documentation: https://esbuild.github.io/api/#cors */
export interface CORSOptions {
origin?: string | string[]
}
export interface ServeOnRequestArgs {
remoteAddress: string
method: string
path: string
status: number
/** The time to generate the response, not to send it */
timeInMS: number
}
/** Documentation: https://esbuild.github.io/api/#serve-return-values */
export interface ServeResult {
port: number
hosts: string[]
}
export interface TransformOptions extends CommonOptions {
/** Documentation: https://esbuild.github.io/api/#sourcefile */
sourcefile?: string
/** Documentation: https://esbuild.github.io/api/#loader */
loader?: Loader
/** Documentation: https://esbuild.github.io/api/#banner */
banner?: string
/** Documentation: https://esbuild.github.io/api/#footer */
footer?: string
}
export interface TransformResult<ProvidedOptions extends TransformOptions = TransformOptions> {
code: string
map: string
warnings: Message[]
/** Only when "mangleCache" is present */
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
/** Only when "legalComments" is "external" */
legalComments: string | (ProvidedOptions['legalComments'] extends 'external' ? never : undefined)
}
export interface TransformFailure extends Error {
errors: Message[]
warnings: Message[]
}
export interface Plugin {
name: string
setup: (build: PluginBuild) => (void | Promise<void>)
}
export interface PluginBuild {
/** Documentation: https://esbuild.github.io/plugins/#build-options */
initialOptions: BuildOptions
/** Documentation: https://esbuild.github.io/plugins/#resolve */
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>
/** Documentation: https://esbuild.github.io/plugins/#on-start */
onStart(callback: () =>
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
/** Documentation: https://esbuild.github.io/plugins/#on-end */
onEnd(callback: (result: BuildResult) =>
(OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
/** Documentation: https://esbuild.github.io/plugins/#on-resolve */
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
/** Documentation: https://esbuild.github.io/plugins/#on-load */
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
/** Documentation: https://esbuild.github.io/plugins/#on-dispose */
onDispose(callback: () => void): void
// This is a full copy of the esbuild library in case you need it
esbuild: {
context: typeof context,
build: typeof build,
buildSync: typeof buildSync,
transform: typeof transform,
transformSync: typeof transformSync,
formatMessages: typeof formatMessages,
formatMessagesSync: typeof formatMessagesSync,
analyzeMetafile: typeof analyzeMetafile,
analyzeMetafileSync: typeof analyzeMetafileSync,
initialize: typeof initialize,
version: typeof version,
}
}
/** Documentation: https://esbuild.github.io/plugins/#resolve-options */
export interface ResolveOptions {
pluginName?: string
importer?: string
namespace?: string
resolveDir?: string
kind?: ImportKind
pluginData?: any
with?: Record<string, string>
}
/** Documentation: https://esbuild.github.io/plugins/#resolve-results */
export interface ResolveResult {
errors: Message[]
warnings: Message[]
path: string
external: boolean
sideEffects: boolean
namespace: string
suffix: string
pluginData: any
}
export interface OnStartResult {
errors?: PartialMessage[]
warnings?: PartialMessage[]
}
export interface OnEndResult {
errors?: PartialMessage[]
warnings?: PartialMessage[]
}
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */
export interface OnResolveOptions {
filter: RegExp
namespace?: string
}
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */
export interface OnResolveArgs {
path: string
importer: string
namespace: string
resolveDir: string
kind: ImportKind
pluginData: any
with: Record<string, string>
}
export type ImportKind =
| 'entry-point'
// JS
| 'import-statement'
| 'require-call'
| 'dynamic-import'
| 'require-resolve'
// CSS
| 'import-rule'
| 'composes-from'
| 'url-token'
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
export interface OnResolveResult {
pluginName?: string
errors?: PartialMessage[]
warnings?: PartialMessage[]
path?: string
external?: boolean
sideEffects?: boolean
namespace?: string
suffix?: string
pluginData?: any
watchFiles?: string[]
watchDirs?: string[]
}
/** Documentation: https://esbuild.github.io/plugins/#on-load-options */
export interface OnLoadOptions {
filter: RegExp
namespace?: string
}
/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */
export interface OnLoadArgs {
path: string
namespace: string
suffix: string
pluginData: any
with: Record<string, string>
}
/** Documentation: https://esbuild.github.io/plugins/#on-load-results */
export interface OnLoadResult {
pluginName?: string
errors?: PartialMessage[]
warnings?: PartialMessage[]
contents?: string | Uint8Array
resolveDir?: string
loader?: Loader
pluginData?: any
watchFiles?: string[]
watchDirs?: string[]
}
export interface PartialMessage {
id?: string
pluginName?: string
text?: string
location?: Partial<Location> | null
notes?: PartialNote[]
detail?: any
}
export interface PartialNote {
text?: string
location?: Partial<Location> | null
}
/** Documentation: https://esbuild.github.io/api/#metafile */
export interface Metafile {
inputs: {
[path: string]: {
bytes: number
imports: {
path: string
kind: ImportKind
external?: boolean
original?: string
with?: Record<string, string>
}[]
format?: 'cjs' | 'esm'
with?: Record<string, string>
}
}
outputs: {
[path: string]: {
bytes: number
inputs: {
[path: string]: {
bytesInOutput: number
}
}
imports: {
path: string
kind: ImportKind | 'file-loader'
external?: boolean
}[]
exports: string[]
entryPoint?: string
cssBundle?: string
}
}
}
export interface FormatMessagesOptions {
kind: 'error' | 'warning'
color?: boolean
terminalWidth?: number
}
export interface AnalyzeMetafileOptions {
color?: boolean
verbose?: boolean
}
/** Documentation: https://esbuild.github.io/api/#watch-arguments */
export interface WatchOptions {
delay?: number // In milliseconds
}
export interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
/** Documentation: https://esbuild.github.io/api/#rebuild */
rebuild(): Promise<BuildResult<ProvidedOptions>>
/** Documentation: https://esbuild.github.io/api/#watch */
watch(options?: WatchOptions): Promise<void>
/** Documentation: https://esbuild.github.io/api/#serve */
serve(options?: ServeOptions): Promise<ServeResult>
cancel(): Promise<void>
dispose(): Promise<void>
}
// This is a TypeScript type-level function which replaces any keys in "In"
// that aren't in "Out" with "never". We use this to reject properties with
// typos in object literals. See: https://stackoverflow.com/questions/49580725
type SameShape<Out, In extends Out> = In & { [Key in Exclude<keyof In, keyof Out>]: never }
/**
* This function invokes the "esbuild" command-line tool for you. It returns a
* promise that either resolves with a "BuildResult" object or rejects with a
* "BuildFailure" object.
*
* - Works in node: yes
* - Works in browser: yes
*
* Documentation: https://esbuild.github.io/api/#build
*/
export declare function build<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildResult<T>>
/**
* This is the advanced long-running form of "build" that supports additional
* features such as watch mode and a local development server.
*
* - Works in node: yes
* - Works in browser: no
*
* Documentation: https://esbuild.github.io/api/#build
*/
export declare function context<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildContext<T>>
/**
* This function transforms a single JavaScript file. It can be used to minify
* JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript
* to older JavaScript. It returns a promise that is either resolved with a
* "TransformResult" object or rejected with a "TransformFailure" object.
*
* - Works in node: yes
* - Works in browser: yes
*
* Documentation: https://esbuild.github.io/api/#transform
*/
export declare function transform<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): Promise<TransformResult<T>>
/**
* Converts log messages to formatted message strings suitable for printing in
* the terminal. This allows you to reuse the built-in behavior of esbuild's
* log message formatter. This is a batch-oriented API for efficiency.
*
* - Works in node: yes
* - Works in browser: yes
*/
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>
/**
* Pretty-prints an analysis of the metafile JSON to a string. This is just for
* convenience to be able to match esbuild's pretty-printing exactly. If you want
* to customize it, you can just inspect the data in the metafile yourself.
*
* - Works in node: yes
* - Works in browser: yes
*
* Documentation: https://esbuild.github.io/api/#analyze
*/
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>
/**
* A synchronous version of "build".
*
* - Works in node: yes
* - Works in browser: no
*
* Documentation: https://esbuild.github.io/api/#build
*/
export declare function buildSync<T extends BuildOptions>(options: SameShape<BuildOptions, T>): BuildResult<T>
/**
* A synchronous version of "transform".
*
* - Works in node: yes
* - Works in browser: no
*
* Documentation: https://esbuild.github.io/api/#transform
*/
export declare function transformSync<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): TransformResult<T>
/**
* A synchronous version of "formatMessages".
*
* - Works in node: yes
* - Works in browser: no
*/
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
/**
* A synchronous version of "analyzeMetafile".
*
* - Works in node: yes
* - Works in browser: no
*
* Documentation: https://esbuild.github.io/api/#analyze
*/
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
/**
* This configures the browser-based version of esbuild. It is necessary to
* call this first and wait for the returned promise to be resolved before
* making other API calls when using esbuild in the browser.
*
* - Works in node: yes
* - Works in browser: yes ("options" is required)
*
* Documentation: https://esbuild.github.io/api/#browser
*/
export declare function initialize(options: InitializeOptions): Promise<void>
export interface InitializeOptions {
/**
* The URL of the "esbuild.wasm" file. This must be provided when running
* esbuild in the browser.
*/
wasmURL?: string | URL
/**
* The result of calling "new WebAssembly.Module(buffer)" where "buffer"
* is a typed array or ArrayBuffer containing the binary code of the
* "esbuild.wasm" file.
*
* You can use this as an alternative to "wasmURL" for environments where it's
* not possible to download the WebAssembly module.
*/
wasmModule?: WebAssembly.Module
/**
* By default esbuild runs the WebAssembly-based browser API in a web worker
* to avoid blocking the UI thread. This can be disabled by setting "worker"
* to false.
*/
worker?: boolean
}
export let version: string
// Call this function to terminate esbuild's child process. The child process
// is not terminated and re-created after each API call because it's more
// efficient to keep it around when there are multiple API calls.
//
// In node this happens automatically before the parent node process exits. So
// you only need to call this if you know you will not make any more esbuild
// API calls and you want to clean up resources.
//
// Unlike node, Deno lacks the necessary APIs to clean up child processes
// automatically. You must manually call stop() in Deno when you're done
// using esbuild or Deno will continue running forever.
//
// Another reason you might want to call this is if you are using esbuild from
// within a Deno test. Deno fails tests that create a child process without
// killing it before the test ends, so you have to call this function (and
// await the returned promise) in every Deno test that uses esbuild.
export declare function stop(): Promise<void>
// Note: These declarations exist to avoid type errors when you omit "dom" from
// "lib" in your "tsconfig.json" file. TypeScript confusingly declares the
// global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do
// with the browser DOM and is present in many non-browser JavaScript runtimes
// (e.g. node and deno). Declaring it here allows esbuild's API to be used in
// these scenarios.
//
// There's an open issue about getting this problem corrected (although these
// declarations will need to remain even if this is fixed for backward
// compatibility with older TypeScript versions):
//
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826
//
declare global {
namespace WebAssembly {
interface Module {
}
}
interface URL {
}
}
@@ -0,0 +1,122 @@
/**
* @fileoverview Ensure handling of errors when we know they exist.
* @author Jamund Ferguson
* @deprecated in ESLint v7.0.0
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
deprecated: {
message: "Node.js rules were moved out of ESLint core.",
url: "https://eslint.org/docs/latest/use/migrating-to-7.0.0#deprecate-node-rules",
deprecatedSince: "7.0.0",
availableUntil: "11.0.0",
replacedBy: [
{
message:
"eslint-plugin-n now maintains deprecated Node.js-related rules.",
plugin: {
name: "eslint-plugin-n",
url: "https://github.com/eslint-community/eslint-plugin-n",
},
rule: {
name: "handle-callback-err",
url: "https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules/handle-callback-err.md",
},
},
],
},
type: "suggestion",
docs: {
description: "Require error handling in callbacks",
recommended: false,
url: "https://eslint.org/docs/latest/rules/handle-callback-err",
},
schema: [
{
type: "string",
},
],
messages: {
expected: "Expected error to be handled.",
},
},
create(context) {
const errorArgument = context.options[0] || "err";
const sourceCode = context.sourceCode;
/**
* Checks if the given argument should be interpreted as a regexp pattern.
* @param {string} stringToCheck The string which should be checked.
* @returns {boolean} Whether or not the string should be interpreted as a pattern.
*/
function isPattern(stringToCheck) {
const firstChar = stringToCheck[0];
return firstChar === "^";
}
/**
* Checks if the given name matches the configured error argument.
* @param {string} name The name which should be compared.
* @returns {boolean} Whether or not the given name matches the configured error variable name.
*/
function matchesConfiguredErrorName(name) {
if (isPattern(errorArgument)) {
const regexp = new RegExp(errorArgument, "u");
return regexp.test(name);
}
return name === errorArgument;
}
/**
* Get the parameters of a given function scope.
* @param {Object} scope The function scope.
* @returns {Array} All parameters of the given scope.
*/
function getParameters(scope) {
return scope.variables.filter(
variable =>
variable.defs[0] && variable.defs[0].type === "Parameter",
);
}
/**
* Check to see if we're handling the error object properly.
* @param {ASTNode} node The AST node to check.
* @returns {void}
*/
function checkForError(node) {
const scope = sourceCode.getScope(node),
parameters = getParameters(scope),
firstParameter = parameters[0];
if (
firstParameter &&
matchesConfiguredErrorName(firstParameter.name)
) {
if (firstParameter.references.length === 0) {
context.report({ node, messageId: "expected" });
}
}
}
return {
FunctionDeclaration: checkForError,
FunctionExpression: checkForError,
ArrowFunctionExpression: checkForError,
};
},
};
@@ -0,0 +1,516 @@
import { LazyRoute } from './fileRoute.js';
import { NotFoundError } from './not-found.js';
import { RedirectFnRoute } from './redirect.js';
import { NavigateOptions, ParsePathParams } from './link.js';
import { ParsedLocation } from './location.js';
import { AnyRouteMatch, MakePreValidationErrorHandlingRouteMatchUnion, MakeRouteMatchFromRoute, MakeRouteMatchUnion, RouteMatch } from './Matches.js';
import { RootRouteId } from './root.js';
import { ParseRoute, RouteById, RouteIds, RoutePaths } from './routeInfo.js';
import { AnyRouter, Register, RegisteredRouter, SSROption } from './router.js';
import { BuildLocationFn, NavigateFn } from './RouterProvider.js';
import { Assign, Awaitable, Constrain, Expand, IntersectAssign, LooseAsyncReturnType, LooseReturnType, NoInfer } from './utils.js';
import { AnySchema, AnyStandardSchemaValidator, AnyValidator, AnyValidatorAdapter, AnyValidatorObj, DefaultValidator, ResolveSearchValidatorInput, ResolveValidatorOutput, StandardSchemaValidator, ValidatorAdapter, ValidatorFn, ValidatorObj } from './validators.js';
import { ValidateSerializableLifecycleResult } from './ssr/serializer/transformer.js';
export type AnyPathParams = {};
export type SearchSchemaInput = {
__TSearchSchemaInput__: 'TSearchSchemaInput';
};
export type AnyContext = {};
export interface RouteContext {
}
export type PreloadableObj = {
preload?: () => Promise<void>;
};
export type RoutePathOptions<TCustomId, TPath> = {
path: TPath;
} | {
id: TCustomId;
};
export interface StaticDataRouteOption {
}
export type RoutePathOptionsIntersection<TCustomId, TPath> = {
path: TPath;
id: TCustomId;
};
export type SearchFilter<TInput, TResult = TInput> = (prev: TInput) => TResult;
export type SearchMiddlewareContext<TSearchSchema> = {
search: TSearchSchema;
next: (newSearch: TSearchSchema) => TSearchSchema;
};
export type SearchMiddleware<TSearchSchema> = (ctx: SearchMiddlewareContext<TSearchSchema>) => TSearchSchema;
export type ResolveId<TParentRoute, TCustomId extends string, TPath extends string> = TParentRoute extends {
id: infer TParentId extends string;
} ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId> : RootRouteId;
export type InferFullSearchSchema<TRoute> = TRoute extends {
types: {
fullSearchSchema: infer TFullSearchSchema;
};
} ? TFullSearchSchema : {};
export type InferFullSearchSchemaInput<TRoute> = TRoute extends {
types: {
fullSearchSchemaInput: infer TFullSearchSchemaInput;
};
} ? TFullSearchSchemaInput : {};
export type InferAllParams<TRoute> = TRoute extends {
types: {
allParams: infer TAllParams;
};
} ? TAllParams : {};
export type InferAllContext<TRoute> = unknown extends TRoute ? TRoute : TRoute extends {
types: {
allContext: infer TAllContext;
};
} ? TAllContext : {};
export type ResolveSearchSchemaFnInput<TSearchValidator> = TSearchValidator extends (input: infer TSearchSchemaInput) => any ? TSearchSchemaInput extends SearchSchemaInput ? Omit<TSearchSchemaInput, keyof SearchSchemaInput> : ResolveSearchSchemaFn<TSearchValidator> : AnySchema;
export type ResolveSearchSchemaInput<TSearchValidator> = TSearchValidator extends AnyStandardSchemaValidator ? NonNullable<TSearchValidator['~standard']['types']>['input'] : TSearchValidator extends AnyValidatorAdapter ? TSearchValidator['types']['input'] : TSearchValidator extends AnyValidatorObj ? ResolveSearchSchemaFnInput<TSearchValidator['parse']> : ResolveSearchSchemaFnInput<TSearchValidator>;
export type ResolveSearchSchemaFn<TSearchValidator> = TSearchValidator extends (...args: any) => infer TSearchSchema ? TSearchSchema : AnySchema;
export type ResolveSearchSchema<TSearchValidator> = unknown extends TSearchValidator ? TSearchValidator : TSearchValidator extends AnyStandardSchemaValidator ? NonNullable<TSearchValidator['~standard']['types']>['output'] : TSearchValidator extends AnyValidatorAdapter ? TSearchValidator['types']['output'] : TSearchValidator extends AnyValidatorObj ? ResolveSearchSchemaFn<TSearchValidator['parse']> : ResolveSearchSchemaFn<TSearchValidator>;
export type ResolveRequiredParams<TPath extends string, T> = {
[K in ParsePathParams<TPath>['required']]: T;
};
export type ResolveOptionalParams<TPath extends string, T> = {
[K in ParsePathParams<TPath>['optional']]?: T | undefined;
};
export type ResolveParams<TPath extends string, T = string> = ResolveRequiredParams<TPath, T> & ResolveOptionalParams<TPath, T>;
export type ParseParamsFn<in out TPath extends string, in out TParams> = (rawParams: Expand<ResolveParams<TPath>>) => TParams | false;
type ValidateParsedParams<TPath extends string, TParams> = [TParams] extends [
ResolveParams<TPath, any>
] ? unknown : never;
export type StringifyParamsFn<in out TPath extends string, in out TParams> = (params: TParams) => ResolveParams<TPath>;
export type ParamsOptions<in out TPath extends string, in out TParams> = {
params?: {
parse?: ParseParamsFn<TPath, TParams> & ValidateParsedParams<TPath, TParams>;
stringify?: StringifyParamsFn<TPath, TParams>;
};
/**
@deprecated Use params.parse instead
*/
parseParams?: ParseParamsFn<TPath, TParams> & ValidateParsedParams<TPath, TParams>;
/**
@deprecated Use params.stringify instead
*/
stringifyParams?: StringifyParamsFn<TPath, TParams>;
};
interface RequiredStaticDataRouteOption {
staticData: StaticDataRouteOption;
}
interface OptionalStaticDataRouteOption {
staticData?: StaticDataRouteOption;
}
export type UpdatableStaticRouteOption = {} extends StaticDataRouteOption ? OptionalStaticDataRouteOption : RequiredStaticDataRouteOption;
export type MetaDescriptor = {
charSet: 'utf-8';
} | {
title: string;
} | {
name: string;
content: string;
} | {
property: string;
content: string;
} | {
httpEquiv: string;
content: string;
} | {
'script:ld+json': LdJsonObject;
} | {
tagName: 'meta' | 'link';
[name: string]: string;
} | Record<string, unknown>;
type LdJsonObject = {
[Key in string]: LdJsonValue;
} & {
[Key in string]?: LdJsonValue | undefined;
};
type LdJsonArray = Array<LdJsonValue> | ReadonlyArray<LdJsonValue>;
type LdJsonPrimitive = string | number | boolean | null;
type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
export type RouteLinkEntry = {};
export type SearchValidator<TInput, TOutput> = ValidatorObj<TInput, TOutput> | ValidatorFn<TInput, TOutput> | ValidatorAdapter<TInput, TOutput> | StandardSchemaValidator<TInput, TOutput> | undefined;
export type AnySearchValidator = SearchValidator<any, any>;
export type DefaultSearchValidator = SearchValidator<Record<string, unknown>, AnySchema>;
export type RoutePrefix<TPrefix extends string, TPath extends string> = string extends TPath ? RootRouteId : TPath extends string ? TPrefix extends RootRouteId ? TPath extends '/' ? '/' : `/${TrimPath<TPath>}` : `${TPrefix}/${TPath}` extends '/' ? '/' : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}` : never;
export type TrimPath<T extends string> = '' extends T ? '' : TrimPathRight<TrimPathLeft<T>>;
export type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}` ? TrimPathLeft<U> : T extends `/${infer U}` ? TrimPathLeft<U> : T;
export type TrimPathRight<T extends string> = T extends '/' ? '/' : T extends `${infer U}/` ? TrimPathRight<U> : T;
export type ContextReturnType<TContextFn> = unknown extends TContextFn ? TContextFn : LooseReturnType<TContextFn> extends never ? AnyContext : LooseReturnType<TContextFn>;
export type ContextAsyncReturnType<TContextFn> = unknown extends TContextFn ? TContextFn : LooseAsyncReturnType<TContextFn> extends never ? AnyContext : LooseAsyncReturnType<TContextFn>;
export type ResolveRouteContext<TRouteContextFn, TBeforeLoadFn> = Assign<ContextReturnType<TRouteContextFn>, ContextAsyncReturnType<TBeforeLoadFn>>;
export type ResolveRouteLoaderFn<TLoaderFn> = TLoaderFn extends {
handler: infer THandler;
} ? THandler : TLoaderFn;
export type RouteLoaderObject<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TParams = {}, TLoaderDeps = {}, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TServerMiddlewares = unknown, THandlers = undefined> = {
handler: RouteLoaderFn<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers>;
staleReloadMode?: LoaderStaleReloadMode;
};
export type ResolveLoaderData<TLoaderFn> = unknown extends TLoaderFn ? TLoaderFn : LooseAsyncReturnType<ResolveRouteLoaderFn<TLoaderFn>> extends never ? undefined : LooseAsyncReturnType<ResolveRouteLoaderFn<TLoaderFn>>;
export type ResolveFullSearchSchema<TParentRoute extends AnyRoute, TSearchValidator> = unknown extends TParentRoute ? ResolveValidatorOutput<TSearchValidator> : IntersectAssign<InferFullSearchSchema<TParentRoute>, ResolveValidatorOutput<TSearchValidator>>;
export type ResolveFullSearchSchemaInput<TParentRoute extends AnyRoute, TSearchValidator> = IntersectAssign<InferFullSearchSchemaInput<TParentRoute>, ResolveSearchValidatorInput<TSearchValidator>>;
export type ResolveAllParamsFromParent<TParentRoute extends AnyRoute, TParams> = Assign<InferAllParams<TParentRoute>, TParams>;
export type RouteContextParameter<TParentRoute extends AnyRoute, TRouterContext> = unknown extends TParentRoute ? TRouterContext : Assign<TRouterContext, InferAllContext<TParentRoute>>;
export type BeforeLoadContextParameter<TParentRoute extends AnyRoute, TRouterContext, TRouteContextFn> = Assign<RouteContextParameter<TParentRoute, TRouterContext>, ContextReturnType<TRouteContextFn>>;
export type ResolveAllContext<TParentRoute extends AnyRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn> = Assign<BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>, ContextAsyncReturnType<TBeforeLoadFn>>;
export interface FullSearchSchemaOption<in out TParentRoute extends AnyRoute, in out TSearchValidator> {
search: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>;
}
export interface RemountDepsOptions<in out TRouteId, in out TFullSearchSchema, in out TAllParams, in out TLoaderDeps> {
routeId: TRouteId;
search: TFullSearchSchema;
params: TAllParams;
loaderDeps: TLoaderDeps;
}
export type MakeRemountDepsOptionsUnion<TRouteTree extends AnyRoute = RegisteredRouter['routeTree']> = ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute ? TRoute extends any ? RemountDepsOptions<TRoute['id'], TRoute['types']['fullSearchSchema'], TRoute['types']['allParams'], TRoute['types']['loaderDeps']> : never : never;
export interface RouteTypes<in out TRegister, in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps, in out TLoaderFn, in out TChildren, in out TFileRouteTypes, in out TSSR, in out TServerMiddlewares, in out THandlers> {
parentRoute: TParentRoute;
path: TPath;
to: TrimPathRight<TFullPath>;
fullPath: TFullPath;
customId: TCustomId;
id: TId;
searchSchema: ResolveValidatorOutput<TSearchValidator>;
searchSchemaInput: ResolveSearchValidatorInput<TSearchValidator>;
searchValidator: TSearchValidator;
fullSearchSchema: ResolveFullSearchSchema<TParentRoute, TSearchValidator>;
fullSearchSchemaInput: ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>;
params: TParams;
allParams: ResolveAllParamsFromParent<TParentRoute, TParams>;
routerContext: TRouterContext;
routeContext: ResolveRouteContext<TRouteContextFn, TBeforeLoadFn>;
routeContextFn: TRouteContextFn;
beforeLoadFn: TBeforeLoadFn;
allContext: ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>;
children: TChildren;
loaderData: ResolveLoaderData<TLoaderFn>;
loaderDeps: TLoaderDeps;
fileRouteTypes: TFileRouteTypes;
ssr: ResolveSSR<TSSR>;
allSsr: ResolveAllSSR<TParentRoute, TSSR>;
}
export type ResolveSSR<TSSR> = TSSR extends (...args: ReadonlyArray<any>) => any ? LooseReturnType<TSSR> : TSSR;
export type ResolveAllSSR<TParentRoute extends AnyRoute, TSSR> = unknown extends TParentRoute ? ResolveSSR<TSSR> : unknown extends TSSR ? TParentRoute['types']['allSsr'] : ResolveSSR<TSSR>;
export type ResolveFullPath<TParentRoute extends AnyRoute, TPath extends string, TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>> = TPrefixed extends RootRouteId ? '/' : TPrefixed;
export interface RouteExtensions<in out TId, in out TFullPath> {
id: TId;
fullPath: TFullPath;
}
export type RouteLazyFn<TRoute extends AnyRoute> = (lazyFn: () => Promise<LazyRoute<TRoute>>) => TRoute;
export type RouteAddChildrenFn<in out TRegister, in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TFileRouteTypes, in out TSSR, in out TServerMiddlewares, in out THandlers> = <const TNewChildren>(children: Constrain<TNewChildren, ReadonlyArray<AnyRoute> | Record<string, AnyRoute>>) => Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
export type RouteAddFileChildrenFn<in out TRegister, in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TFileRouteTypes, in out TSSR, in out TServerMiddlewares, in out THandlers> = <const TNewChildren>(children: TNewChildren) => Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
export type RouteAddFileTypesFn<TRegister, TParentRoute extends AnyRoute, TPath extends string, TFullPath extends string, TCustomId extends string, TId extends string, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps extends Record<string, any>, TLoaderFn, TChildren, TSSR, TServerMiddlewares, THandlers> = <TNewFileRouteTypes>() => Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TNewFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
export interface Route<in out TRegister, in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TChildren, in out TFileRouteTypes, in out TSSR, in out TServerMiddlewares, in out THandlers> extends RouteExtensions<TId, TFullPath> {
path: TPath;
parentRoute: TParentRoute;
children?: TChildren;
types: RouteTypes<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
options: RouteOptions<TRegister, TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TSSR, TServerMiddlewares, THandlers>;
isRoot: TParentRoute extends AnyRoute ? true : false;
lazyFn?: () => Promise<LazyRoute<Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>>>;
rank: number;
to: TrimPathRight<TFullPath>;
init: (opts: {
originalIndex: number;
}) => void;
update: (options: UpdatableRouteOptions<TParentRoute, TCustomId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => this;
lazy: RouteLazyFn<Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>>;
addChildren: RouteAddChildrenFn<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
_addFileChildren: RouteAddFileChildrenFn<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
_addFileTypes: RouteAddFileTypesFn<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TSSR, TServerMiddlewares, THandlers>;
/**
* Create a redirect with `from` automatically set to this route's path.
* Enables relative redirects like `Route.redirect({ to: './overview' })`.
* @param opts Redirect options (same as `redirect()` but without `from`)
* @returns A redirect Response that can be thrown from loaders/beforeLoad
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction
*/
redirect: RedirectFnRoute<TFullPath>;
}
export type AnyRoute = Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
export type AnyRouteWithContext<TContext> = AnyRoute & {
types: {
allContext: TContext;
};
};
export type RouteOptions<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TCustomId extends string = string, TFullPath extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = AnyPathParams, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TSSR = unknown, TServerMiddlewares = unknown, THandlers = undefined> = BaseRouteOptions<TRegister, TParentRoute, TId, TCustomId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TSSR, TServerMiddlewares, THandlers> & UpdatableRouteOptions<NoInfer<TParentRoute>, NoInfer<TCustomId>, NoInfer<TFullPath>, NoInfer<TParams>, NoInfer<TSearchValidator>, NoInfer<TLoaderFn>, NoInfer<TLoaderDeps>, NoInfer<TRouterContext>, NoInfer<TRouteContextFn>, NoInfer<TBeforeLoadFn>>;
export type RouteContextFn<in out TParentRoute extends AnyRoute, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteId> = (ctx: RouteContextOptions<TParentRoute, TSearchValidator, TParams, TRouterContext, TRouteId>) => any;
export type FileBaseRouteOptions<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TRemountDepsFn = AnyContext, TSSR = unknown, TServerMiddlewares = unknown, THandlers = undefined> = ParamsOptions<TPath, TParams> & FilebaseRouteOptionsInterface<TRegister, TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TRemountDepsFn, TSSR, TServerMiddlewares, THandlers>;
export interface FilebaseRouteOptionsInterface<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TRemountDepsFn = AnyContext, TSSR = unknown, TServerMiddlewares = unknown, THandlers = undefined> {
validateSearch?: Constrain<TSearchValidator, AnyValidator, DefaultValidator>;
shouldReload?: boolean | ((match: LoaderFnContext<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers>) => any);
context?: Constrain<TRouteContextFn, (ctx: RouteContextOptions<TParentRoute, TParams, TRouterContext, TLoaderDeps, TId>) => any>;
ssr?: Constrain<TSSR, undefined | SSROption | ((ctx: SsrContextOptions<TParentRoute, TSearchValidator, TParams>) => Awaitable<undefined | SSROption>)>;
beforeLoad?: Constrain<TBeforeLoadFn, (ctx: BeforeLoadContextOptions<TRegister, TParentRoute, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TId, TServerMiddlewares, THandlers>) => ValidateSerializableLifecycleResult<TRegister, TParentRoute, TSSR, TBeforeLoadFn>>;
loaderDeps?: (opts: FullSearchSchemaOption<TParentRoute, TSearchValidator>) => TLoaderDeps;
remountDeps?: Constrain<TRemountDepsFn, (opt: RemountDepsOptions<TId, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>, TLoaderDeps>) => any>;
loader?: Constrain<TLoaderFn, RouteLoaderFn<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers> | RouteLoaderObject<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers>>;
}
export type BaseRouteOptions<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TCustomId extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TSSR = unknown, TServerMiddlewares = unknown, THandlers = undefined> = RoutePathOptions<TCustomId, TPath> & FileBaseRouteOptions<TRegister, TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, AnyContext, TSSR, TServerMiddlewares, THandlers> & {
getParentRoute: () => TParentRoute;
};
export interface ContextOptions<in out TParentRoute extends AnyRoute, in out TParams, in out TRouteId> {
abortController: AbortController;
preload: boolean;
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
location: ParsedLocation;
/**
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
**/
navigate: NavigateFn;
buildLocation: BuildLocationFn;
cause: 'preload' | 'enter' | 'stay';
matches: Array<MakeRouteMatchUnion>;
routeId: TRouteId;
}
export interface RouteContextOptions<in out TParentRoute extends AnyRoute, in out TParams, in out TRouterContext, in out TLoaderDeps, in out TRouteId> extends ContextOptions<TParentRoute, TParams, TRouteId> {
deps: TLoaderDeps;
context: Expand<RouteContextParameter<TParentRoute, TRouterContext>>;
}
export interface SsrContextOptions<in out TParentRoute extends AnyRoute, in out TSearchValidator, in out TParams> {
params: {
status: 'success';
value: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
} | {
status: 'error';
error: unknown;
};
search: {
status: 'success';
value: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>;
} | {
status: 'error';
error: unknown;
};
location: ParsedLocation;
matches: Array<MakePreValidationErrorHandlingRouteMatchUnion>;
}
export interface BeforeLoadContextOptions<in out TRegister, in out TParentRoute extends AnyRoute, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TRouteId, in out TServerMiddlewares, in out THandlers> extends ContextOptions<TParentRoute, TParams, TRouteId>, FullSearchSchemaOption<TParentRoute, TSearchValidator> {
context: Expand<BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>>;
}
type AssetFnContextOptions<in out TRouteId, in out TFullPath, in out TParentRoute extends AnyRoute, in out TParams, in out TSearchValidator, in out TLoaderFn, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps> = {
ssr?: {
nonce?: string;
};
matches: Array<RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>>;
match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>;
params: ResolveAllParamsFromParent<TParentRoute, TParams>;
loaderData?: ResolveLoaderData<TLoaderFn>;
};
export interface DefaultUpdatableRouteOptionsExtensions {
component?: unknown;
errorComponent?: unknown;
notFoundComponent?: unknown;
pendingComponent?: unknown;
}
export interface UpdatableRouteOptionsExtensions extends DefaultUpdatableRouteOptionsExtensions {
}
export interface UpdatableRouteOptions<in out TParentRoute extends AnyRoute, in out TRouteId, in out TFullPath, in out TParams, in out TSearchValidator, in out TLoaderFn, in out TLoaderDeps, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn> extends UpdatableStaticRouteOption, UpdatableRouteOptionsExtensions {
/**
* If true, this route will be matched as case-sensitive
*
* @default false
*/
caseSensitive?: boolean;
/**
* If true, this route will be forcefully wrapped in a suspense boundary
*/
wrapInSuspense?: boolean;
pendingMs?: number;
pendingMinMs?: number;
staleTime?: number;
gcTime?: number;
preload?: boolean;
preloadStaleTime?: number;
preloadGcTime?: number;
search?: {
middlewares?: Array<SearchMiddleware<ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>>>;
};
/**
@deprecated Use search.middlewares instead
*/
preSearchFilters?: Array<SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>>;
/**
@deprecated Use search.middlewares instead
*/
postSearchFilters?: Array<SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>>;
onCatch?: (error: Error) => void;
onError?: (err: any) => void;
onEnter?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
onStay?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
onLeave?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
headers?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => Awaitable<Record<string, string> | undefined>;
head?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => Awaitable<{
links?: AnyRouteMatch['links'];
scripts?: AnyRouteMatch['headScripts'];
meta?: AnyRouteMatch['meta'];
styles?: AnyRouteMatch['styles'];
}>;
scripts?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => Awaitable<AnyRouteMatch['scripts']>;
codeSplitGroupings?: Array<Array<'loader' | 'component' | 'pendingComponent' | 'notFoundComponent' | 'errorComponent'>>;
}
export type RouteLoaderFn<in out TRegister, in out TParentRoute extends AnyRoute = AnyRoute, in out TId extends string = string, in out TParams = {}, in out TLoaderDeps = {}, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TServerMiddlewares = unknown, in out THandlers = undefined> = (match: LoaderFnContext<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers>) => any;
export type LoaderStaleReloadMode = 'background' | 'blocking';
export type RouteLoaderEntry<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TParams = {}, TLoaderDeps = {}, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TServerMiddlewares = unknown, THandlers = undefined> = RouteLoaderFn<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers> | RouteLoaderObject<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers>;
export interface LoaderFnContext<in out TRegister = unknown, in out TParentRoute extends AnyRoute = AnyRoute, in out TId extends string = string, in out TParams = {}, in out TLoaderDeps = {}, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TServerMiddlewares = unknown, in out THandlers = undefined> {
abortController: AbortController;
preload: boolean;
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
deps: TLoaderDeps;
context: Expand<ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>>;
location: ParsedLocation;
/**
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
**/
navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void;
parentMatchPromise: TId extends RootRouteId ? never : Promise<MakeRouteMatchFromRoute<TParentRoute>>;
cause: 'preload' | 'enter' | 'stay';
route: AnyRoute;
}
export interface DefaultRootRouteOptionsExtensions {
shellComponent?: unknown;
}
export interface RootRouteOptionsExtensions extends DefaultRootRouteOptionsExtensions {
}
export interface RootRouteOptions<TRegister = unknown, TSearchValidator = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TSSR = unknown, TServerMiddlewares = unknown, THandlers = undefined> extends Omit<RouteOptions<TRegister, any, // TParentRoute
RootRouteId, // TId
RootRouteId, // TCustomId
'', // TFullPath
'', // TPath
TSearchValidator, {}, // TParams
TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TSSR, TServerMiddlewares, THandlers>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'params'>, RootRouteOptionsExtensions {
}
export type RouteConstraints = {
TParentRoute: AnyRoute;
TPath: string;
TFullPath: string;
TCustomId: string;
TId: string;
TSearchSchema: AnySchema;
TFullSearchSchema: AnySchema;
TParams: Record<string, any>;
TAllParams: Record<string, any>;
TParentContext: AnyContext;
TRouteContext: RouteContext;
TAllContext: AnyContext;
TRouterContext: AnyContext;
TChildren: unknown;
TRouteTree: AnyRoute;
};
export type RouteTypesById<TRouter extends AnyRouter, TId> = RouteById<TRouter['routeTree'], TId>['types'];
export type RouteMask<TRouteTree extends AnyRoute> = {
routeTree: TRouteTree;
from: RoutePaths<TRouteTree>;
to?: any;
params?: any;
search?: any;
hash?: any;
state?: any;
unmaskOnReload?: boolean;
};
/**
* @deprecated Use `ErrorComponentProps` instead.
*/
export type ErrorRouteProps = {
error: unknown;
info?: {
componentStack: string;
};
reset: () => void;
};
export type ErrorComponentProps<TError = Error> = {
error: TError;
info?: {
componentStack: string;
};
reset: () => void;
};
export type NotFoundRouteProps = {
data?: unknown;
isNotFound: boolean;
routeId: RouteIds<RegisteredRouter['routeTree']>;
};
export declare class BaseRoute<in out TRegister = Register, in out TParentRoute extends AnyRoute = AnyRoute, in out TPath extends string = '/', in out TFullPath extends string = ResolveFullPath<TParentRoute, TPath>, in out TCustomId extends string = string, in out TId extends string = ResolveId<TParentRoute, TCustomId, TPath>, in out TSearchValidator = undefined, in out TParams = ResolveParams<TPath>, in out TRouterContext = AnyContext, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown, in out TSSR = unknown, in out TServerMiddlewares = unknown, in out THandlers = undefined> {
isRoot: TParentRoute extends AnyRoute ? true : false;
options: RouteOptions<TRegister, TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TSSR, TServerMiddlewares, THandlers>;
parentRoute: TParentRoute;
private _id;
private _path;
private _fullPath;
private _to;
get to(): TrimPathRight<TFullPath>;
get id(): TId;
get path(): TPath;
get fullPath(): TFullPath;
children?: TChildren;
originalIndex?: number;
rank: number;
lazyFn?: () => Promise<LazyRoute<Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>>>;
constructor(options?: RouteOptions<TRegister, TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TSSR, TServerMiddlewares, THandlers>);
types: RouteTypes<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
init: (opts: {
originalIndex: number;
}) => void;
addChildren: RouteAddChildrenFn<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
_addFileChildren: RouteAddFileChildrenFn<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
_addFileTypes: RouteAddFileTypesFn<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TSSR, TServerMiddlewares, THandlers>;
updateLoader: <TNewLoaderFn>(options: {
loader: Constrain<TNewLoaderFn, RouteLoaderFn<TRegister, TParentRoute, TCustomId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>>;
}) => BaseRoute<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TNewLoaderFn, TChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
update: (options: UpdatableRouteOptions<TParentRoute, TCustomId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => this;
lazy: RouteLazyFn<Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>>;
/**
* Create a redirect with `from` automatically set to this route's fullPath.
* Enables relative redirects like `Route.redirect({ to: './overview' })`.
* @param opts Redirect options (same as `redirect()` but without `from`)
* @returns A redirect Response that can be thrown from loaders/beforeLoad
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction
*/
redirect: RedirectFnRoute<TFullPath>;
}
export declare class BaseRouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> {
id: TId;
constructor({ id }: {
id: TId;
});
notFound: (opts?: NotFoundError) => NotFoundError;
/**
* Create a redirect with `from` automatically set to this route's path.
* Enables relative redirects like `routeApi.redirect({ to: './overview' })`.
* @param opts Redirect options (same as `redirect()` but without `from`)
* @returns A redirect Response that can be thrown from loaders/beforeLoad
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction
*/
redirect: RedirectFnRoute<RouteTypesById<TRouter, TId>['fullPath']>;
}
export interface RootRoute<in out TRegister, in out TSearchValidator = undefined, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown, in out TSSR = unknown, in out TServerMiddlewares = unknown, in out THandlers = undefined> extends Route<TRegister, any, // TParentRoute
'/', // TPath
'/', // TFullPath
string, // TCustomId
RootRouteId, // TId
TSearchValidator, // TSearchValidator
{}, // TParams
TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, // TChildren
TFileRouteTypes, TSSR, TServerMiddlewares, THandlers> {
}
export declare class BaseRootRoute<in out TRegister = Register, in out TSearchValidator = undefined, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown, in out TSSR = unknown, in out TServerMiddlewares = unknown, in out THandlers = undefined> extends BaseRoute<TRegister, any, // TParentRoute
'/', // TPath
'/', // TFullPath
string, // TCustomId
RootRouteId, // TId
TSearchValidator, // TSearchValidator
{}, // TParams
TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, // TChildren
TFileRouteTypes, TSSR, TServerMiddlewares, THandlers> {
constructor(options?: RootRouteOptions<TRegister, TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TSSR, TServerMiddlewares, THandlers>);
}
export interface RouteLike {
id: string;
isRoot?: boolean;
path?: string;
fullPath: string;
rank?: number;
parentRoute?: RouteLike;
children?: Array<RouteLike>;
options?: {
caseSensitive?: boolean;
};
}
export {};
@@ -0,0 +1,39 @@
/**
* CommanderError class
*/
class CommanderError extends Error {
/**
* Constructs the CommanderError class
* @param {number} exitCode suggested exit code which could be used with process.exit
* @param {string} code an id string representing the error
* @param {string} message human-readable description of the error
*/
constructor(exitCode, code, message) {
super(message);
// properly capture stack trace in Node.js
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.code = code;
this.exitCode = exitCode;
this.nestedError = undefined;
}
}
/**
* InvalidArgumentError class
*/
class InvalidArgumentError extends CommanderError {
/**
* Constructs the InvalidArgumentError class
* @param {string} [message] explanation of why argument is invalid
*/
constructor(message) {
super(1, 'commander.invalidArgument', message);
// properly capture stack trace in Node.js
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
}
}
exports.CommanderError = CommanderError;
exports.InvalidArgumentError = InvalidArgumentError;
@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,CAAC,IAAI,aACV,CAAA;AAE9B,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,CAAC,IAAI,aACV,CAAA;AAE9B,MAAM,MAAM,aAAa,GACrB,GAAG,GACH,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAA;AAEP,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,SAAS,GACT,MAAM,GACN,cAAc,GACd,iBAAiB,GACjB,aAAa,GACb,WAAW,GACX,MAAM,GACN,gBAAgB,GAChB,sBAAsB,GACtB,gBAAgB,GAChB,YAAY,GACZ,YAAY,GACZ,OAAO,GACP,yBAAyB,GACzB,qBAAqB,GACrB,kBAAkB,GAClB,gBAAgB,GAChB,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,aAAa,CAAA;AAEjB;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,oBAWxB,CAAA;AAGF,eAAO,MAAM,IAAI,mCAsCf,CAAA;AAGF,eAAO,MAAM,IAAI,mCAEhB,CAAA"}
@@ -0,0 +1 @@
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/parse.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sEAAsE;AACtE,gEAAgE;AAChE,EAAE;AACF,6DAA6D;AAC7D,qEAAqE;AACrE,sEAAsE;AACtE,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,qCAAqC;AACrC,EAAE;AACF,uEAAuE;AACvE,4BAA4B;AAC5B,EAAE;AACF,uEAAuE;AACvE,kDAAkD;AAClD,EAAE;AACF,6DAA6D;;;AAE7D,mCAA2C;A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AAC,CAAC,GAAG,CAAC,MAAM;gBAChE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;oBACnB,CAAC,CAAC,KAAK,CAAA;QAET,4EAA4E;QAC5E,+BAA+B;QAC/B,MAAM,MAAM,GACV,GAAG,CAAC,IAAI;YACR,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;QAC/D,IAAI,CAAC,IAAI;YACP,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI;gBAC9D,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;oBACf,CAAC,CAAC,SAAS,CAAA;QAEb,yDAAyD;QACzD,IAAI,CAAC,EAAE,CAAC,KAAK,EALine truncated
@@ -0,0 +1 @@
{"version":3,"file":"cfWorkerProvider-B3ZJEoRM.d.mts","names":[],"sources":["../../core-internal/src/validators/cfWorkerProvider.ts"],"sourcesContent":[],"mappings":";;;;;;;KAkBY,mBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgCC,2BAAA,YAAuC;;;;;;;;;;;;;;;YAcQ;;;;;;;;;;;;;;;;0BAuBhC,iBAAiB,oBAAoB"}
@@ -0,0 +1,335 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const tsutils = __importStar(require("ts-api-utils"));
const ts = __importStar(require("typescript"));
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'consistent-type-exports',
meta: {
type: 'suggestion',
docs: {
description: 'Enforce consistent usage of type exports',
requiresTypeChecking: true,
},
fixable: 'code',
messages: {
multipleExportsAreTypes: 'Type exports {{exportNames}} are not values and should be exported using `export type`.',
singleExportIsType: 'Type export {{exportNames}} is not a value and should be exported using `export type`.',
typeOverValue: 'All exports in the declaration are only used as types. Use `export type`.',
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
fixMixedExportsWithInlineTypeSpecifier: {
type: 'boolean',
description: 'Whether the rule will autofix "mixed" export cases using TS inline type specifiers.',
},
},
},
],
},
defaultOptions: [
{
fixMixedExportsWithInlineTypeSpecifier: false,
},
],
create(context, [{ fixMixedExportsWithInlineTypeSpecifier }]) {
const sourceExportsMap = {};
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
/**
* Helper for identifying if a symbol resolves to a
* JavaScript value or a TypeScript type.
*
* @returns True/false if is a type or not, or undefined if the specifier
* can't be resolved.
*/
function isSymbolTypeBased(symbol) {
if (!symbol || checker.isUnknownSymbol(symbol)) {
return undefined;
}
if (symbol.getDeclarations()?.some(ts.isTypeOnlyImportOrExportDeclaration)) {
return true;
}
if (tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Value)) {
return false;
}
return tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias)
? isSymbolTypeBased(checker.getImmediateAliasedSymbol(symbol))
: true;
}
return {
ExportAllDeclaration(node) {
if (node.exportKind === 'type') {
return;
}
const sourceModule = ts.resolveModuleName(node.source.value, context.filename, services.program.getCompilerOptions(), ts.sys);
if (sourceModule.resolvedModule == null) {
return;
}
const sourceFile = services.program.getSourceFile(sourceModule.resolvedModule.resolvedFileName);
if (sourceFile == null) {
return;
}
const sourceFileSymbol = checker.getSymbolAtLocation(sourceFile);
if (sourceFileSymbol == null) {
return;
}
const sourceFileType = checker.getTypeOfSymbol(sourceFileSymbol);
// Module can explicitly export types or values, and it's not difficult
// to distinguish one from the other, since we can get the flags of
// the exported symbols or check if symbol export declaration has
// the "type" keyword in it.
//
// Things get a lot more complicated when we're dealing with
// export * from './module-with-type-only-exports'
// export type * from './module-with-type-and-value-exports'
//
// TS checker has an internal function getExportsOfModuleWorker that
// recursively visits all module exports, including "export *". It then
// puts type-only-star-exported symbols into the typeOnlyExportStarMap
// property of sourceFile's SymbolLinks. Since symbol links aren't
// exposed outside the checker, we cannot access it directly.
//
// Therefore, to filter out value properties, we use the following hack:
// checker.getPropertiesOfType returns all exports that were originally
// values, but checker.getPropertyOfType returns undefined for
// properties that are mentioned in the typeOnlyExportStarMap.
const isThereAnyExportedValue = checker
.getPropertiesOfType(sourceFileType)
.some(propertyTypeSymbol => checker.getPropertyOfType(sourceFileType, propertyTypeSymbol.escapedName.toString()) != null);
if (isThereAnyExportedValue) {
return;
}
context.report({
node,
messageId: 'typeOverValue',
fix(fixer) {
const asteriskToken = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(node, token => token.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
token.value === '*'), util_1.NullThrowsReasons.MissingToken('asterisk', 'export all declaration'));
return fixer.insertTextBefore(asteriskToken, 'type ');
},
});
},
ExportNamedDeclaration(node) {
// Coerce the source into a string for use as a lookup entry.
const source = getSourceFromExport(node) ?? 'undefined';
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const sourceExports = (sourceExportsMap[source] ||= {
reportValueExports: [],
source,
typeOnlyNamedExport: null,
valueOnlyNamedExport: null,
});
// Cache the first encountered exports for the package. We will need to come
// back to these later when fixing the problems.
if (node.exportKind === 'type') {
// The export is a type export
sourceExports.typeOnlyNamedExport ??= node;
}
else {
// The export is a value export
sourceExports.valueOnlyNamedExport ??= node;
}
// Next for the current export, we will separate type/value specifiers.
const typeBasedSpecifiers = [];
const inlineTypeSpecifiers = [];
const valueSpecifiers = [];
// Note: it is valid to export values as types. We will avoid reporting errors
// when this is encountered.
if (node.exportKind !== 'type') {
for (const specifier of node.specifiers) {
if (specifier.exportKind === 'type') {
inlineTypeSpecifiers.push(specifier);
continue;
}
const isTypeBased = isSymbolTypeBased(services.getSymbolAtLocation(specifier.exported));
if (isTypeBased === true) {
typeBasedSpecifiers.push(specifier);
}
else if (isTypeBased === false) {
// When isTypeBased is undefined, we should avoid reporting them.
valueSpecifiers.push(specifier);
}
}
}
if ((node.exportKind === 'value' && typeBasedSpecifiers.length) ||
(node.exportKind === 'type' && valueSpecifiers.length)) {
sourceExports.reportValueExports.push({
node,
inlineTypeSpecifiers,
typeBasedSpecifiers,
valueSpecifiers,
});
}
},
'Program:exit'() {
for (const sourceExports of Object.values(sourceExportsMap)) {
// If this export has no issues, move on.
if (sourceExports.reportValueExports.length === 0) {
continue;
}
for (const report of sourceExports.reportValueExports) {
if (report.valueSpecifiers.length === 0) {
// Export is all type-only with no type specifiers; convert the entire export to `export type`.
context.report({
node: report.node,
messageId: 'typeOverValue',
*fix(fixer) {
yield* fixExportInsertType(fixer, context.sourceCode, report.node);
},
});
continue;
}
// We have both type and value violations.
const allExportNames = report.typeBasedSpecifiers.map(specifier => specifier.local.type === utils_1.AST_NODE_TYPES.Identifier
? specifier.local.name
: specifier.local.value);
if (allExportNames.length === 1) {
const exportNames = allExportNames[0];
context.report({
node: report.node,
messageId: 'singleExportIsType',
data: { exportNames },
*fix(fixer) {
if (fixMixedExportsWithInlineTypeSpecifier) {
yield* fixAddTypeSpecifierToNamedExports(fixer, report);
}
else {
yield* fixSeparateNamedExports(fixer, context.sourceCode, report);
}
},
});
}
else {
const exportNames = (0, util_1.formatWordList)(allExportNames);
context.report({
node: report.node,
messageId: 'multipleExportsAreTypes',
data: { exportNames },
*fix(fixer) {
if (fixMixedExportsWithInlineTypeSpecifier) {
yield* fixAddTypeSpecifierToNamedExports(fixer, report);
}
else {
yield* fixSeparateNamedExports(fixer, context.sourceCode, report);
}
},
});
}
}
}
},
};
},
});
/**
* Inserts "type" into an export.
*
* Example:
*
* export type { Foo } from 'foo';
* ^^^^
*/
function* fixExportInsertType(fixer, sourceCode, node) {
const exportToken = (0, util_1.nullThrows)(sourceCode.getFirstToken(node), util_1.NullThrowsReasons.MissingToken('export', node.type));
yield fixer.insertTextAfter(exportToken, ' type');
for (const specifier of node.specifiers) {
if (specifier.exportKind === 'type') {
const kindToken = (0, util_1.nullThrows)(sourceCode.getFirstToken(specifier), util_1.NullThrowsReasons.MissingToken('export', specifier.type));
const firstTokenAfter = (0, util_1.nullThrows)(sourceCode.getTokenAfter(kindToken, {
includeComments: true,
}), 'Missing token following the export kind.');
yield fixer.removeRange([kindToken.range[0], firstTokenAfter.range[0]]);
}
}
}
/**
* Separates the exports which mismatch the kind of export the given
* node represents. For example, a type export's named specifiers which
* represent values will be inserted in a separate `export` statement.
*/
function* fixSeparateNamedExports(fixer, sourceCode, report) {
const { node, inlineTypeSpecifiers, typeBasedSpecifiers, valueSpecifiers } = report;
const typeSpecifiers = [...typeBasedSpecifiers, ...inlineTypeSpecifiers];
const source = getSourceFromExport(node);
const specifierNames = typeSpecifiers.map(getSpecifierText).join(', ');
const exportToken = (0, util_1.nullThrows)(sourceCode.getFirstToken(node), util_1.NullThrowsReasons.MissingToken('export', node.type));
// Filter the bad exports from the current line.
const filteredSpecifierNames = valueSpecifiers
.map(getSpecifierText)
.join(', ');
const openToken = (0, util_1.nullThrows)(sourceCode.getFirstToken(node, util_1.isOpeningBraceToken), util_1.NullThrowsReasons.MissingToken('{', node.type));
const closeToken = (0, util_1.nullThrows)(sourceCode.getLastToken(node, util_1.isClosingBraceToken), util_1.NullThrowsReasons.MissingToken('}', node.type));
// Remove exports from the current line which we're going to re-insert.
yield fixer.replaceTextRange([openToken.range[1], closeToken.range[0]], ` ${filteredSpecifierNames} `);
// Insert the bad exports into a new export line above.
yield fixer.insertTextBefore(exportToken, `export type { ${specifierNames} }${source ? ` from '${source}'` : ''};\n`);
}
function* fixAddTypeSpecifierToNamedExports(fixer, report) {
if (report.node.exportKind === 'type') {
return;
}
for (const specifier of report.typeBasedSpecifiers) {
yield fixer.insertTextBefore(specifier, 'type ');
}
}
/**
* Returns the source of the export, or undefined if the named export has no source.
*/
function getSourceFromExport(node) {
if (node.source?.type === utils_1.AST_NODE_TYPES.Literal &&
typeof node.source.value === 'string') {
return node.source.value;
}
return undefined;
}
/**
* Returns the specifier text for the export. If it is aliased, we take care to return
* the proper formatting.
*/
function getSpecifierText(specifier) {
const exportedName = specifier.exported.type === utils_1.AST_NODE_TYPES.Literal
? specifier.exported.raw
: specifier.exported.name;
const localName = specifier.local.type === utils_1.AST_NODE_TYPES.Literal
? specifier.local.raw
: specifier.local.name;
return `${localName}${exportedName !== localName ? ` as ${exportedName}` : ''}`;
}
@@ -0,0 +1 @@
{"version":3,"file":"Matches.js","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 sLine truncated
@@ -0,0 +1 @@
{"version":3,"file":"warn-once.mjs","sources":["../../src/warn-once.ts"],"sourcesContent":["import { formatErrorMessage } from \"./format-error-message\"\n\nconst warned = new Set<string>()\n\nexport function hasWarned(message: string) {\n return warned.has(message)\n}\n\nexport function warnOnce(\n condition: boolean,\n message: string,\n errorCode?: string\n) {\n if (condition || warned.has(message)) return\n\n console.warn(formatErrorMessage(message, errorCode))\n warned.add(message)\n}\n"],"names":[],"mappings":";;AAEA,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU;AAE1B,SAAU,SAAS,CAAC,OAAe,EAAA;AACrC,IAAA,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;AAC9B;SAEgB,QAAQ,CACpB,SAAkB,EAClB,OAAe,EACf,SAAkB,EAAA;AAElB,IAAA,IAAI,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE;IAEtC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACpD,IAAA,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;AACvB;;;;"}
@@ -0,0 +1,68 @@
import { _BLAKE2 } from './blake2.ts';
import { type CHashXOF, type HashXOF, type TArg, type TRet } from './utils.ts';
/**
* Ensure to use EITHER `key` OR `context`, not both.
*
* * `key`: 32-byte MAC key.
* * `context`: caller-encoded KDF context bytes. If your protocol defines a
* string context, encode it before passing it here.
* A good default format for the original context string is
* "[application] [commit timestamp] [purpose]".
*/
export type Blake3Opts = {
/** Desired digest length in bytes. The BLAKE3 spec allows 0..2^64-1 bytes of output. */
dkLen?: number;
/** Optional 32-byte MAC key. */
key?: Uint8Array;
/** Optional KDF context bytes. */
context?: Uint8Array;
};
/** Blake3 hash. Can be used as MAC and KDF with caller-encoded context bytes. */
export declare class _BLAKE3 extends _BLAKE2<_BLAKE3> implements HashXOF<_BLAKE3> {
readonly canXOF = true;
private chunkPos;
private chunksDone;
private flags;
private IV;
private state;
private stack;
private posOut;
private bufferOut32;
private bufferOut;
private chunkOut;
private enableXOF;
constructor(opts?: Blake3Opts, flags?: number);
protected get(): [];
protected set(): void;
private b2Compress;
protected compress(buf: Uint32Array, bufPos?: number, isLast?: boolean): void;
_cloneInto(to?: _BLAKE3): _BLAKE3;
destroy(): void;
private b2CompressOut;
protected finish(): void;
private writeInto;
xofInto(out: TArg<Uint8Array>): TRet<Uint8Array>;
xof(bytes: number): TRet<Uint8Array>;
digestInto(out: TArg<Uint8Array>): void;
digest(): TRet<Uint8Array>;
}
/**
* BLAKE3 hash function. Can be used as MAC and KDF.
* @param msg - message that would be hashed
* @param opts - Optional output, MAC, or KDF configuration. `key` must be
* exactly 32 bytes, `context` is caller-encoded bytes, and `dkLen` can be
* 0..2^64-1 via the XOF-backed output path. See {@link Blake3Opts}.
* @returns Digest bytes.
* @example
* Hash, MAC, or derive key material with BLAKE3.
* ```ts
* import { blake3 } from '@noble/hashes/blake3.js';
* import { utf8ToBytes } from '@noble/hashes/utils.js';
* const data = new Uint8Array(32);
* const hash = blake3(data);
* const mac = blake3(data, { key: new Uint8Array(32) });
* const kdf = blake3(data, { context: utf8ToBytes('application name') });
* ```
*/
export declare const blake3: TRet<CHashXOF<_BLAKE3, Blake3Opts>>;
//# sourceMappingURL=blake3.d.ts.map