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

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

No files matched your search

@@ -0,0 +1,237 @@
/**
* @fileoverview The Path class.
* @author Nicholas C. Zakas
*/
/* globals URL */
//-----------------------------------------------------------------------------
// Types
//-----------------------------------------------------------------------------
/** @typedef{import("@humanfs/types").HfsImpl} HfsImpl */
/** @typedef{import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
/**
* Normalizes a path to use forward slashes.
* @param {string} filePath The path to normalize.
* @returns {string} The normalized path.
*/
function normalizePath(filePath) {
let startIndex = 0;
let endIndex = filePath.length;
if (/[a-z]:\//i.test(filePath)) {
startIndex = 3;
}
if (filePath.startsWith("./")) {
startIndex = 2;
}
if (filePath.startsWith("/")) {
startIndex = 1;
}
if (filePath.endsWith("/")) {
endIndex = filePath.length - 1;
}
return filePath.slice(startIndex, endIndex).replace(/\\/g, "/");
}
/**
* Asserts that the given name is a non-empty string, no equal to "." or "..",
* and does not contain a forward slash or backslash.
* @param {string} name The name to check.
* @returns {void}
* @throws {TypeError} When name is not valid.
*/
function assertValidName(name) {
if (typeof name !== "string") {
throw new TypeError("name must be a string");
}
if (!name) {
throw new TypeError("name cannot be empty");
}
if (name === ".") {
throw new TypeError(`name cannot be "."`);
}
if (name === "..") {
throw new TypeError(`name cannot be ".."`);
}
if (name.includes("/") || name.includes("\\")) {
throw new TypeError(
`name cannot contain a slash or backslash: "${name}"`,
);
}
}
//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------
export class Path {
/**
* The steps in the path.
* @type {Array<string>}
*/
#steps;
/**
* Creates a new instance.
* @param {Iterable<string>} [steps] The steps to use for the path.
* @throws {TypeError} When steps is not iterable.
*/
constructor(steps = []) {
if (typeof steps[Symbol.iterator] !== "function") {
throw new TypeError("steps must be iterable");
}
this.#steps = [...steps];
this.#steps.forEach(assertValidName);
}
/**
* Adds steps to the end of the path.
* @param {...string} steps The steps to add to the path.
* @returns {void}
*/
push(...steps) {
steps.forEach(assertValidName);
this.#steps.push(...steps);
}
/**
* Removes the last step from the path.
* @returns {string} The last step in the path.
*/
pop() {
return this.#steps.pop();
}
/**
* Returns an iterator for steps in the path.
* @returns {IterableIterator<string>} An iterator for the steps in the path.
*/
steps() {
return this.#steps.values();
}
/**
* Returns an iterator for the steps in the path.
* @returns {IterableIterator<string>} An iterator for the steps in the path.
*/
[Symbol.iterator]() {
return this.steps();
}
/**
* Retrieves the name (the last step) of the path.
* @type {string}
*/
get name() {
return this.#steps[this.#steps.length - 1];
}
/**
* Sets the name (the last step) of the path.
* @type {string}
*/
set name(value) {
assertValidName(value);
this.#steps[this.#steps.length - 1] = value;
}
/**
* Retrieves the size of the path.
* @type {number}
*/
get size() {
return this.#steps.length;
}
/**
* Returns the path as a string.
* @returns {string} The path as a string.
*/
toString() {
return this.#steps.join("/");
}
/**
* Creates a new path based on the argument type. If the argument is a string,
* it is assumed to be a file or directory path and is converted to a Path
* instance. If the argument is a URL, it is assumed to be a file URL and is
* converted to a Path instance. If the argument is a Path instance, it is
* copied into a new Path instance. If the argument is an array, it is assumed
* to be the steps of a path and is used to create a new Path instance.
* @param {string|URL|Path|Array<string>} pathish The value to convert to a Path instance.
* @returns {Path} A new Path instance.
* @throws {TypeError} When pathish is not a string, URL, Path, or Array.
* @throws {TypeError} When pathish is a string and is empty.
*/
static from(pathish) {
if (typeof pathish === "string") {
if (!pathish) {
throw new TypeError("argument cannot be empty");
}
return Path.fromString(pathish);
}
if (pathish instanceof URL) {
return Path.fromURL(pathish);
}
if (pathish instanceof Path || Array.isArray(pathish)) {
return new Path(pathish);
}
throw new TypeError("argument must be a string, URL, Path, or Array");
}
/**
* Creates a new Path instance from a string.
* @param {string} fileOrDirPath The file or directory path to convert.
* @returns {Path} A new Path instance.
* @deprecated Use Path.from() instead.
*/
static fromString(fileOrDirPath) {
return new Path(normalizePath(fileOrDirPath).split("/"));
}
/**
* Creates a new Path instance from a URL.
* @param {URL} url The URL to convert.
* @returns {Path} A new Path instance.
* @throws {TypeError} When url is not a URL instance.
* @throws {TypeError} When url.pathname is empty.
* @throws {TypeError} When url.protocol is not "file:".
* @deprecated Use Path.from() instead.
*/
static fromURL(url) {
if (!(url instanceof URL)) {
throw new TypeError("url must be a URL instance");
}
if (!url.pathname || url.pathname === "/") {
throw new TypeError("url.pathname cannot be empty");
}
if (url.protocol !== "file:") {
throw new TypeError(`url.protocol must be "file:"`);
}
// Remove leading slash in pathname
return new Path(normalizePath(url.pathname.slice(1)).split("/"));
}
}
@@ -0,0 +1,3 @@
export { ReorderGroup as Group } from './Group.mjs';
export { ReorderItem as Item } from './Item.mjs';
//# sourceMappingURL=namespace.mjs.map
@@ -0,0 +1,148 @@
export type Schema =
| ObjectSchema
| ArraySchema
| StringSchema
| NumberSchema
| IntegerSchema
| BooleanSchema
| NullSchema;
// export type JsonType = "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
// export interface JSONSchema {
// type?: string ;
// $id?: string ;
// id?: string ;
// $schema?: string ;
// $ref?: string ;
// $anchor?: string ;
// $defs?: { [key: string]: JSONSchema } ;
// definitions?: { [key: string]: JSONSchema } ;
// $comment?: string ;
// title?: string ;
// description?: string ;
// default?: unknown ;
// examples?: unknown[] ;
// readOnly?: boolean ;
// writeOnly?: boolean ;
// deprecated?: boolean ;
// allOf?: JSONSchema[] ;
// anyOf?: JSONSchema[] ;
// oneOf?: JSONSchema[] ;
// not?: JSONSchema ;
// if?: JSONSchema ;
// then?: JSONSchema ;
// else?: JSONSchema ;
// enum?: Array<string | number | boolean | null> ;
// const?: string | number | boolean | null ;
// [k: string]: unknown;
// /** A special key used as an intermediate representation of extends-style relationships. Omitted as a $ref with additional properties. */
// // _ref?: JSONSchema;
// _prefault?: unknown ;
// }
export type _JSONSchema = boolean | JSONSchema;
export type SchemaType = "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
export type JSONSchema = {
[k: string]: unknown;
$schema?:
| "https://json-schema.org/draft/2020-12/schema"
| "http://json-schema.org/draft-07/schema#"
| "http://json-schema.org/draft-04/schema#";
$id?: string;
$anchor?: string;
$ref?: string;
$dynamicRef?: string;
$dynamicAnchor?: string;
$vocabulary?: Record<string, boolean>;
$comment?: string;
$defs?: Record<string, JSONSchema>;
type?: SchemaType | SchemaType[];
additionalItems?: _JSONSchema;
unevaluatedItems?: _JSONSchema;
prefixItems?: _JSONSchema[];
items?: _JSONSchema | _JSONSchema[];
contains?: _JSONSchema;
additionalProperties?: _JSONSchema;
unevaluatedProperties?: _JSONSchema;
properties?: Record<string, _JSONSchema>;
patternProperties?: Record<string, _JSONSchema>;
dependentSchemas?: Record<string, _JSONSchema>;
propertyNames?: _JSONSchema;
if?: _JSONSchema;
then?: _JSONSchema;
else?: _JSONSchema;
allOf?: JSONSchema[];
anyOf?: JSONSchema[];
oneOf?: JSONSchema[];
not?: _JSONSchema;
multipleOf?: number;
maximum?: number;
exclusiveMaximum?: number | boolean;
minimum?: number;
exclusiveMinimum?: number | boolean;
maxLength?: number;
minLength?: number;
pattern?: string;
maxItems?: number;
minItems?: number;
uniqueItems?: boolean;
maxContains?: number;
minContains?: number;
maxProperties?: number;
minProperties?: number;
required?: string[];
dependentRequired?: Record<string, string[]>;
enum?: Array<string | number | boolean | null>;
const?: string | number | boolean | null;
// metadata
id?: string;
title?: string;
description?: string;
default?: unknown;
deprecated?: boolean;
readOnly?: boolean;
writeOnly?: boolean;
nullable?: boolean;
examples?: unknown[];
format?: string;
contentMediaType?: string;
contentEncoding?: string;
contentSchema?: JSONSchema;
// internal
_prefault?: unknown;
};
// for backwards compatibility
export type BaseSchema = JSONSchema;
export interface ObjectSchema extends JSONSchema {
type: "object";
}
export interface ArraySchema extends JSONSchema {
type: "array";
}
export interface StringSchema extends JSONSchema {
type: "string";
}
export interface NumberSchema extends JSONSchema {
type: "number";
}
export interface IntegerSchema extends JSONSchema {
type: "integer";
}
export interface BooleanSchema extends JSONSchema {
type: "boolean";
}
export interface NullSchema extends JSONSchema {
type: "null";
}
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"_V","2":"_b"},B:{"1":"_J"},C:{"1":"_w","2":"_f"},D:{"1":"_oO","132":"_kJ"},E:{"1":"_PB","2":"MD","4":"lC","132":"_OG _VJ"},F:{"1":"_c"},G:{"1":"_s","132":"_3"},H:{"1":"1D"},I:{"1":"_X","2":"_n","132":"_GF"},J:{"1":"_B"},K:{"1":"_N"},L:{"1":"I"},M:{"1":"YC"},N:{"1":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:1,C:"SVG in HTML img element",D:true};
@@ -0,0 +1,22 @@
/*! *****************************************************************************
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.
***************************************************************************** */
interface Symbol {
/**
* Expose the [[Description]] internal slot of a symbol directly.
*/
readonly description: string | undefined;
}
@@ -0,0 +1 @@
{"version":3,"file":"badge-percent.js","sources":["../../../src/icons/badge-percent.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BadgePercent\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMy44NSA4LjYyYTQgNCAwIDAgMSA0Ljc4LTQuNzcgNCA0IDAgMCAxIDYuNzQgMCA0IDQgMCAwIDEgNC43OCA0Ljc4IDQgNCAwIDAgMSAwIDYuNzQgNCA0IDAgMCAxLTQuNzcgNC43OCA0IDQgMCAwIDEtNi43NSAwIDQgNCAwIDAgMS00Ljc4LTQuNzcgNCA0IDAgMCAxIDAtNi43NloiIC8+CiAgPHBhdGggZD0ibTE1IDktNiA2IiAvPgogIDxwYXRoIGQ9Ik05IDloLjAxIiAvPgogIDxwYXRoIGQ9Ik0xNSAxNWguMDEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/badge-percent\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 BadgePercent = createLucideIcon('BadgePercent', [\n [\n 'path',\n {\n d: 'M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z',\n key: '3c2336',\n },\n ],\n ['path', { d: 'm15 9-6 6', key: '1uzhvr' }],\n ['path', { d: 'M9 9h.01', key: '1q5me6' }],\n ['path', { d: 'M15 15h.01', key: 'lqbp3k' }],\n]);\n\nexport default BadgePercent;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,iBAAiB,cAAgB,CAAA,CAAA,CAAA;AAAA,CACpD,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"create.mjs","sources":["../../../../src/context/MotionContext/create.ts"],"sourcesContent":["\"use client\"\n\nimport { useContext, useMemo } from \"react\"\nimport { MotionContext, type MotionContextProps } from \".\"\nimport { MotionProps } from \"../../motion/types\"\nimport { getCurrentTreeVariants } from \"./utils\"\n\nexport function useCreateMotionContext<Instance>(\n props: MotionProps\n): MotionContextProps<Instance> {\n const { initial, animate } = getCurrentTreeVariants(\n props,\n useContext(MotionContext)\n )\n\n return useMemo(\n () => ({ initial, animate }),\n [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]\n )\n}\n\nfunction variantLabelsAsDependency(\n prop: undefined | string | string[] | boolean\n) {\n return Array.isArray(prop) ? prop.join(\" \") : prop\n}\n"],"names":[],"mappings":";;;;;AAOM;AAGF;;AASJ;AAEA;AAGI;AACJ;;"}
@@ -0,0 +1,16 @@
import resolveUri from '@jridgewell/resolve-uri';
import stripFilename from './strip-filename';
type Resolve = (source: string | null) => string;
export default function resolver(
mapUrl: string | null | undefined,
sourceRoot: string | undefined,
): Resolve {
const from = stripFilename(mapUrl);
// The sourceRoot is always treated as a directory, if it's not empty.
// https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
// https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
const prefix = sourceRoot ? sourceRoot + '/' : '';
return (source) => resolveUri(prefix + (source || ''), from);
}
@@ -0,0 +1,5 @@
rules:
adhoc-packages:
disable: true
excessive-permissions:
disable: true
@@ -0,0 +1,97 @@
import { f as createRule } from "../utils.js";
var no_multiple_empty_lines_default = createRule({
name: "no-multiple-empty-lines",
meta: {
type: "layout",
docs: { description: "Disallow multiple empty lines" },
fixable: "whitespace",
schema: [{
type: "object",
properties: {
max: {
type: "integer",
minimum: 0
},
maxEOF: {
type: "integer",
minimum: 0
},
maxBOF: {
type: "integer",
minimum: 0
}
},
required: ["max"],
additionalProperties: false
}],
defaultOptions: [{ max: 2 }],
messages: {
blankBeginningOfFile: "Too many blank lines at the beginning of file. Max of {{max}} allowed.",
blankEndOfFile: "Too many blank lines at the end of file. Max of {{max}} allowed.",
consecutiveBlank: "More than {{max}} blank {{pluralizedLines}} not allowed."
}
},
create(context, [options]) {
const { max, maxEOF = max, maxBOF = max } = options;
const sourceCode = context.sourceCode;
const allLines = sourceCode.lines[sourceCode.lines.length - 1] === "" ? sourceCode.lines.slice(0, -1) : sourceCode.lines;
const templateLiteralLines = /* @__PURE__ */ new Set();
return {
TemplateLiteral(node) {
node.quasis.forEach((literalPart) => {
for (let ignoredLine = literalPart.loc.start.line; ignoredLine < literalPart.loc.end.line; ignoredLine++) templateLiteralLines.add(ignoredLine);
});
},
"Program:exit": function(node) {
return allLines.reduce((nonEmptyLineNumbers, line, index) => {
if (line.trim() || templateLiteralLines.has(index + 1)) nonEmptyLineNumbers.push(index + 1);
return nonEmptyLineNumbers;
}, []).concat(allLines.length + 1).reduce((lastLineNumber, lineNumber) => {
let messageId, maxAllowed;
if (lastLineNumber === 0) {
messageId = "blankBeginningOfFile";
maxAllowed = maxBOF;
} else if (lineNumber === allLines.length + 1) {
messageId = "blankEndOfFile";
maxAllowed = maxEOF;
} else {
messageId = "consecutiveBlank";
maxAllowed = max;
}
if (lineNumber - lastLineNumber - 1 > maxAllowed) context.report({
node,
loc: {
start: {
line: lastLineNumber + maxAllowed + 1,
column: 0
},
end: {
line: lineNumber,
column: 0
}
},
messageId,
data: {
max: maxAllowed,
pluralizedLines: maxAllowed === 1 ? "line" : "lines"
},
fix(fixer) {
const rangeStart = sourceCode.getIndexFromLoc({
line: lastLineNumber + 1,
column: 0
});
const lineNumberAfterRemovedLines = lineNumber - maxAllowed;
const rangeEnd = lineNumberAfterRemovedLines <= allLines.length ? sourceCode.getIndexFromLoc({
line: lineNumberAfterRemovedLines,
column: 0
}) : sourceCode.text.length;
return fixer.removeRange([rangeStart, rangeEnd]);
}
});
return lineNumber;
}, 0);
}
};
}
});
export { no_multiple_empty_lines_default as t };
@@ -0,0 +1,49 @@
//#region src/manifest.ts
function getAssetCrossOrigin(assetCrossOrigin, kind) {
if (!assetCrossOrigin) return;
if (typeof assetCrossOrigin === "string") return assetCrossOrigin;
return assetCrossOrigin[kind];
}
function resolveManifestAssetLink(link) {
if (typeof link === "string") return {
href: link,
crossOrigin: void 0
};
return link;
}
function getStylesheetHref(asset) {
if (asset.tag !== "link") return void 0;
const rel = asset.attrs?.rel;
const href = asset.attrs?.href;
if (typeof href !== "string") return void 0;
if (!(typeof rel === "string" ? rel.split(/\s+/) : []).includes("stylesheet")) return void 0;
return href;
}
function isInlinableStylesheet(manifest, asset) {
const href = getStylesheetHref(asset);
return !!href && manifest?.inlineCss?.styles[href] !== void 0;
}
function createInlineCssStyleAsset(css) {
return {
tag: "style",
attrs: { suppressHydrationWarning: true },
inlineCss: true,
children: css
};
}
function createInlineCssPlaceholderAsset() {
return {
tag: "style",
attrs: { suppressHydrationWarning: true },
inlineCss: true
};
}
//#endregion
exports.createInlineCssPlaceholderAsset = createInlineCssPlaceholderAsset;
exports.createInlineCssStyleAsset = createInlineCssStyleAsset;
exports.getAssetCrossOrigin = getAssetCrossOrigin;
exports.getStylesheetHref = getStylesheetHref;
exports.isInlinableStylesheet = isInlinableStylesheet;
exports.resolveManifestAssetLink = resolveManifestAssetLink;
//# sourceMappingURL=manifest.cjs.map
@@ -0,0 +1,517 @@
/**
* Argon2 KDF from RFC 9106. Can be used to create a key from password and salt.
* We suggest to use Scrypt. JS Argon is 2-10x slower than native code because of 64-bitness:
* * argon uses uint64, but JS doesn't have fast uint64array
* * uint64 multiplication is 1/3 of time
* * `P` function would be very nice with u64, because most of value will be in registers,
* hovewer with u32 it will require 32 registers, which is too much.
* * JS arrays do slow bound checks, so reading from `A2_BUF` slows it down
* @module
*/
import { add3H, add3L, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL } from "./_u64.js";
import { blake2b } from "./blake2.js";
import { anumber, clean, kdfInputToBytes, nextTick, swap32IfBE, swap8IfBE, u32, u8, } from "./utils.js";
// RFC 9106 §3.1 type `y`: 0 = Argon2d, 1 = Argon2i, 2 = Argon2id. The numeric values are the
// spec-bound part here; the object keys are internal labels.
const AT = { Argond2d: 0, Argon2i: 1, Argon2id: 2 };
// RFC 9106 sync points constant `SL = 4`, fixed by the design rather than exposed as a tuning knob.
const ARGON2_SYNC_POINTS = 4;
// Preserve Argon2's `LE32(len(X)) || X` encoding for omitted
// optional fields by emitting empty bytes.
const abytesOrZero = (buf, errorTitle = '') => {
if (buf === undefined)
return Uint8Array.of();
return kdfInputToBytes(buf, errorTitle);
};
// Unsigned `u32 * u32 = { h, l }`, returned as split 64-bit halves.
function mul(a, b) {
// Split into 16-bit limbs so each partial product stays exact under `Math.imul`.
const aL = a & 0xffff;
const aH = a >>> 16;
const bL = b & 0xffff;
const bH = b >>> 16;
const ll = Math.imul(aL, bL);
const hl = Math.imul(aH, bL);
const lh = Math.imul(aL, bH);
const hh = Math.imul(aH, bH);
const carry = (ll >>> 16) + (hl & 0xffff) + lh;
const high = (hh + (hl >>> 16) + (carry >>> 16)) | 0;
const low = (carry << 16) | (ll & 0xffff);
return { h: high, l: low };
}
function mul2(a, b) {
// Double the split 64-bit product; carry from `l` is folded back into `h` via `l >>> 31`.
const { h, l } = mul(a, b);
return { h: ((h << 1) | (l >>> 31)) & 0xffff_ffff, l: (l << 1) & 0xffff_ffff };
}
// BlaMka permutation for Argon2
// `A + B + 2 * trunc(A) * trunc(B)`, where `trunc(...)` means the low 32-bit halves.
function blamka(Ah, Al, Bh, Bl) {
const { h: Ch, l: Cl } = mul2(Al, Bl);
// A + B + (2 * A * B)
const Rll = add3L(Al, Bl, Cl);
return { h: add3H(Rll, Ah, Bh, Ch), l: Rll | 0 };
}
// Temporary block buffer.
// 1024-byte block: 256 u32 = 128 interleaved low/high halves = RFC's
// 8x8 matrix of 16-byte registers.
const A2_BUF = new Uint32Array(256);
// Quarter-round over 64-bit word indices into `A2_BUF`; each index maps to adjacent low/high u32s.
function G(a, b, c, d) {
let Al = A2_BUF[2 * a], Ah = A2_BUF[2 * a + 1]; // prettier-ignore
let Bl = A2_BUF[2 * b], Bh = A2_BUF[2 * b + 1]; // prettier-ignore
let Cl = A2_BUF[2 * c], Ch = A2_BUF[2 * c + 1]; // prettier-ignore
let Dl = A2_BUF[2 * d], Dh = A2_BUF[2 * d + 1]; // prettier-ignore
// RFC 9106 Figure 19 GB rotates by 32, 24, 16, and 63 bits after each XOR step.
({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl));
({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) });
({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl));
({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) });
({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl));
({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) });
({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl));
({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) });
((A2_BUF[2 * a] = Al), (A2_BUF[2 * a + 1] = Ah));
((A2_BUF[2 * b] = Bl), (A2_BUF[2 * b + 1] = Bh));
((A2_BUF[2 * c] = Cl), (A2_BUF[2 * c + 1] = Ch));
((A2_BUF[2 * d] = Dl), (A2_BUF[2 * d + 1] = Dh));
}
// Argon2 permutation over 16 register indices into `A2_BUF`, not the register values themselves.
// RFC 9106 Figure 17: these arguments are the 16 `v0..v15` 64-bit word
// indices inside eight 16-byte inputs, not copied word values.
// prettier-ignore
function P(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11, v12, v13, v14, v15) {
// RFC 9106 Figure 18: first apply GB across rows, then across columns of the 8x8 register matrix.
G(v00, v04, v08, v12);
G(v01, v05, v09, v13);
G(v02, v06, v10, v14);
G(v03, v07, v11, v15);
G(v00, v05, v10, v15);
G(v01, v06, v11, v12);
G(v02, v07, v08, v13);
G(v03, v04, v09, v14);
}
function block(x, xPos, yPos, outPos, needXor) {
for (let i = 0; i < 256; i++)
A2_BUF[i] = x[xPos + i] ^ x[yPos + i];
// rows (8 consecutive 16-register groups)
for (let i = 0; i < 128; i += 16) {
// prettier-ignore
P(i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8, i + 9, i + 10, i + 11, i + 12, i + 13, i + 14, i + 15);
}
// columns (8 strided 16-register groups)
for (let i = 0; i < 16; i += 2) {
// prettier-ignore
P(i, i + 1, i + 16, i + 17, i + 32, i + 33, i + 48, i + 49, i + 64, i + 65, i + 80, i + 81, i + 96, i + 97, i + 112, i + 113);
}
// RFC 9106 step 6: passes after the first XOR the old destination block into the new G(X, Y).
if (needXor)
for (let i = 0; i < 256; i++)
x[outPos + i] ^= A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i];
else
for (let i = 0; i < 256; i++)
x[outPos + i] = A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i];
clean(A2_BUF);
}
// Variable-Length Hash Function H'
// Returns bytes, not words; 1024-byte block callers explicitly reinterpret with `u32(...)`.
function Hp(A, dkLen) {
const A8 = u8(A);
const T = new Uint32Array(1);
const T8 = u8(T);
// Argon2 H' prefixes dkLen as LE32; native Uint32Array writes would serialize as BE on s390x.
T[0] = swap8IfBE(dkLen);
// Fast path
if (dkLen <= 64)
return blake2b.create({ dkLen }).update(T8).update(A8).digest();
const out = new Uint8Array(dkLen);
let V = blake2b.create({}).update(T8).update(A8).digest();
let pos = 0;
// RFC 9106 Figure 8: each intermediate `V_i` contributes only `W_i`, its first 32 bytes; only
// `V_{r+1}` is emitted in full at the remaining length.
out.set(V.subarray(0, 32));
pos += 32;
// Rest blocks
for (; dkLen - pos > 64; pos += 32) {
const Vh = blake2b.create({}).update(V);
Vh.digestInto(V);
Vh.destroy();
out.set(V.subarray(0, 32), pos);
}
// Last block
out.set(blake2b(V, { dkLen: dkLen - pos }), pos);
clean(V, T);
// H' is byte-oriented; returning `u32(out)` would silently drop dkLen % 4 tail bytes.
return out;
}
// Used only inside process block!
function indexAlpha(r, s, laneLen, segmentLen, index, randL, sameLane = false) {
// RFC 9106 §3.4.2 Figures 12-13: map `J1` / `J2` into the current lane's reference area `W`.
let area;
if (r === 0) {
if (s === 0)
area = index - 1;
else if (sameLane)
area = s * segmentLen + index - 1;
else
area = s * segmentLen + (index == 0 ? -1 : 0);
}
else if (sameLane)
area = laneLen - segmentLen + index - 1;
else
area = laneLen - segmentLen + (index == 0 ? -1 : 0);
const startPos = r !== 0 && s !== ARGON2_SYNC_POINTS - 1 ? (s + 1) * segmentLen : 0;
// RFC 9106 Figure 13: `mul(randL, randL).h` is `floor(J_1^2 / 2^32)`, and the outer high-half
// multiply computes `floor(|W| * x / 2^32)` without floating-point math.
const rel = area - 1 - mul(area, mul(randL, randL).h).h;
return (startPos + rel) % laneLen;
}
// Exclusive `2^32` sentinel used by `isU32(...)`, not the inclusive maximum u32 value.
const maxUint32 = Math.pow(2, 32);
// Validate safe JS integers in `[0, 2^32 - 1]`.
function isU32(num) {
return Number.isSafeInteger(num) && num >= 0 && num < maxUint32;
}
function argon2Opts(opts) {
const merged = {
version: 0x13,
dkLen: 32,
maxmem: maxUint32 - 1,
asyncTick: 10,
};
// Unknown keys are copied through unchanged here and later ignored unless
// destructuring consumes them.
for (let [k, v] of Object.entries(opts))
if (v !== undefined)
merged[k] = v;
const { dkLen, p, m, t, version, onProgress, asyncTick } = merged;
// RFC 9106 §3.1: tag length `T` MUST be an integer number of bytes from 4 to 2^32-1.
if (!isU32(dkLen) || dkLen < 4)
throw new Error('"dkLen" must be 4..');
if (!isU32(p) || p < 1 || p >= Math.pow(2, 24))
throw new Error('"p" must be 1..2^24');
if (!isU32(m))
throw new Error('"m" must be 0..2^32');
if (!isU32(t) || t < 1)
throw new Error('"t" (iterations) must be 1..2^32');
if (onProgress !== undefined && typeof onProgress !== 'function')
throw new Error('"progressCb" must be a function');
anumber(asyncTick, 'asyncTick');
/*
Memory size m MUST be an integer number of kibibytes from 8*p
to 2^(32)-1. The actual number of blocks is m', which is m
rounded down to the nearest multiple of 4*p.
*/
if (!isU32(m) || m < 8 * p)
throw new Error('"m" (memory) must be at least 8*p bytes');
// Accept legacy `0x10` for compatibility even though RFC 9106 profiles standardize `0x13`.
if (version !== 0x10 && version !== 0x13)
throw new Error('"version" must be 0x10 or 0x13, got ' + version);
return merged;
}
function argon2Init(password, salt, type, opts) {
password = kdfInputToBytes(password, 'password');
salt = kdfInputToBytes(salt, 'salt');
if (!isU32(password.length))
throw new Error('"password" must be less of length 1..4Gb');
// RFC 9106 §3.1 only requires S <= 2^32-1 bytes and says 16 bytes is RECOMMENDED for password
// hashing; this library intentionally takes the stricter common >=8-byte salt path.
if (!isU32(salt.length) || salt.length < 8)
throw new Error('"salt" must be of length 8..4Gb');
if (!Object.values(AT).includes(type))
throw new Error('"type" was invalid');
let { p, dkLen, m, t, version, key, personalization, maxmem, onProgress, asyncTick } = argon2Opts(opts);
// Validation
key = abytesOrZero(key, 'key');
personalization = abytesOrZero(personalization, 'personalization');
// H_0 = H^(64)(LE32(p) || LE32(T) || LE32(m) || LE32(t) ||
// LE32(v) || LE32(y) || LE32(length(P)) || P ||
// LE32(length(S)) || S || LE32(length(K)) || K ||
// LE32(length(X)) || X)
const h = blake2b.create();
const BUF = new Uint32Array(1);
const BUF8 = u8(BUF);
for (let item of [p, dkLen, m, t, version, type]) {
// RFC 9106 H0 encodes these scalars as LE32, so normalize the host word before exposing bytes.
BUF[0] = swap8IfBE(item);
h.update(BUF8);
}
for (let i of [password, salt, key, personalization]) {
BUF[0] = swap8IfBE(i.length); // BUF is u32 array, this is valid once normalized to LE bytes
h.update(BUF8).update(i);
}
// Reserve two extra LE32 words after the 64-byte `H_0` so Figures 3-4 can append
// `LE32(0 or 1) || LE32(i)` in place for the lane-starting blocks.
const H0 = new Uint32Array(18);
const H0_8 = u8(H0);
h.digestInto(H0_8);
// 256 u32 = 1024 (BLOCK_SIZE), fills A2_BUF on processing
// Params
const lanes = p;
// m' = 4 * p * floor (m / 4p)
const mP = 4 * p * Math.floor(m / (ARGON2_SYNC_POINTS * p));
//q = m' / p columns
const laneLen = Math.floor(mP / p);
const segmentLen = Math.floor(laneLen / ARGON2_SYNC_POINTS);
// `maxmem` is documented in bytes; compare against the actual 1024-byte block allocation.
const memUsed = mP * 1024;
if (!isU32(maxmem))
throw new Error('"maxmem" expected <2**32, got ' + maxmem);
if (memUsed > maxmem)
throw new Error('"maxmem" limit was hit: memUsed(mP*1024)=' + memUsed + ', maxmem=' + maxmem);
const B = new Uint32Array(memUsed / 4);
// Fill first blocks
for (let l = 0; l < p; l++) {
const i = 256 * laneLen * l;
// B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i))
H0[17] = swap8IfBE(l);
H0[16] = swap8IfBE(0);
B.set(swap32IfBE(u32(Hp(H0, 1024))), i);
// B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i))
H0[16] = swap8IfBE(1);
B.set(swap32IfBE(u32(Hp(H0, 1024))), i + 256);
}
let perBlock = () => { };
if (onProgress) {
// The first segment of the first pass skips two preinitialized blocks per lane.
const totalBlock = t * ARGON2_SYNC_POINTS * p * segmentLen - 2 * p;
// Invoke callback if progress changes from 10.01 to 10.02
// Allows to draw smooth progress bar on up to 8K screen
const callbackPer = Math.max(Math.floor(totalBlock / 10000), 1);
let blockCnt = 0;
perBlock = () => {
blockCnt++;
if (onProgress && (!(blockCnt % callbackPer) || blockCnt === totalBlock))
onProgress(blockCnt / totalBlock);
};
}
clean(BUF, H0);
return { type, mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock, asyncTick };
}
function argon2Output(B, p, laneLen, dkLen) {
const B_final = new Uint32Array(256);
for (let l = 0; l < p; l++)
for (let j = 0; j < 256; j++)
B_final[j] ^= B[256 * (laneLen * l + laneLen - 1) + j];
// RFC 9106 steps 7-8 feed the byte string `C` into `H'^T(C)`, so normalize the xor'ed words
// back to spec byte order before `Hp(...)` reinterprets them as bytes.
const res = Hp(swap32IfBE(B_final), dkLen);
// Wipe both the xor scratch and the full working matrix once final digest bytes exist.
// JS cleanup is still only best-effort, but this local buffer is no longer needed here.
clean(B, B_final);
return res;
}
function processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor) {
if (offset % laneLen)
prev = offset - 1;
let randL, randH;
if (dataIndependent) {
let i128 = index % 128;
// RFC 9106 §3.4.1.2: each 1024-byte address block yields 128 `(J1, J2)` pairs, so regenerate
// it whenever the segment index crosses a multiple of 128.
if (i128 === 0) {
address[256 + 12]++;
block(address, 256, 2 * 256, 0, false);
block(address, 0, 2 * 256, 0, false);
}
randL = address[2 * i128];
randH = address[2 * i128 + 1];
}
else {
const T = 256 * prev;
randL = B[T];
randH = B[T + 1];
}
// Address-block path selects `J1` / `J2`, then maps them to the reference
// lane/block per RFC 9106 §3.4.
const refLane = r === 0 && s === 0 ? l : randH % lanes;
const refPos = indexAlpha(r, s, laneLen, segmentLen, index, randL, refLane == l);
const refBlock = laneLen * refLane + refPos;
// B[i][j] = G(B[i][j-1], B[l][z])
block(B, 256 * prev, 256 * refBlock, offset * 256, needXor);
}
function argon2(type, password, salt, opts) {
const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock } = argon2Init(password, salt, type, opts);
// Pre-loop setup
// [address, input, zero_block] format so we can pass single U32 to block function
const address = new Uint32Array(3 * 256);
address[256 + 6] = mP;
address[256 + 8] = t;
address[256 + 10] = type;
for (let r = 0; r < t; r++) {
// RFC 9106 step 6 applies the XOR-on-later-passes rule only for version `0x13`; legacy
// `0x10` keeps the older overwrite behavior used by the v16 test vectors.
const needXor = r !== 0 && version === 0x13;
address[256 + 0] = r;
for (let s = 0; s < ARGON2_SYNC_POINTS; s++) {
address[256 + 4] = s;
// RFC 9106 §3.4.1.3: Argon2id uses Argon2i's data-independent `J1` / `J2` generation only
// in pass 0, slices 0 and 1; Argon2i uses it in every segment.
const dataIndependent = type == AT.Argon2i || (type == AT.Argon2id && r === 0 && s < 2);
for (let l = 0; l < p; l++) {
address[256 + 2] = l;
address[256 + 12] = 0;
let startPos = 0;
if (r === 0 && s === 0) {
startPos = 2;
if (dataIndependent) {
address[256 + 12]++;
block(address, 256, 2 * 256, 0, false);
block(address, 0, 2 * 256, 0, false);
}
}
// current block postion
let offset = l * laneLen + s * segmentLen + startPos;
// previous block position
let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1;
for (let index = startPos; index < segmentLen; index++, offset++, prev++) {
perBlock();
processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor);
}
}
}
}
clean(address);
return argon2Output(B, p, laneLen, dkLen);
}
/**
* Argon2d GPU-resistant version.
* @param password - password or input key material
* @param salt - unique salt value
* @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}.
* @returns Derived key bytes.
* @throws If the Argon2 input or cost parameters are invalid. {@link Error}
* @example
* Derive a key with Argon2d.
* ```ts
* argon2d('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 });
* ```
*/
export const argon2d = (password, salt, opts) => argon2(AT.Argond2d, password, salt, opts);
/**
* Argon2i side-channel-resistant version.
* @param password - password or input key material
* @param salt - unique salt value
* @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}.
* @returns Derived key bytes.
* @throws If the Argon2 input or cost parameters are invalid. {@link Error}
* @example
* Derive a key with Argon2i.
* ```ts
* argon2i('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 });
* ```
*/
export const argon2i = (password, salt, opts) => argon2(AT.Argon2i, password, salt, opts);
/**
* Argon2id, combining i+d, the most popular version from RFC 9106.
* @param password - password or input key material
* @param salt - unique salt value
* @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}.
* @returns Derived key bytes.
* @throws If the Argon2 input or cost parameters are invalid. {@link Error}
* @example
* Derive a key with Argon2id.
* ```ts
* argon2id('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 });
* ```
*/
export const argon2id = (password, salt, opts) => argon2(AT.Argon2id, password, salt, opts);
async function argon2Async(type, password, salt, opts) {
const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock, asyncTick } = argon2Init(password, salt, type, opts);
// Pre-loop setup
// [address, input, zero_block] format so we can pass single U32 to block function
const address = new Uint32Array(3 * 256);
address[256 + 6] = mP;
address[256 + 8] = t;
address[256 + 10] = type;
let ts = Date.now();
for (let r = 0; r < t; r++) {
// RFC 9106 step 6 applies the XOR-on-later-passes rule only for version `0x13`; legacy
// `0x10` keeps the older overwrite behavior used by the v16 test vectors.
const needXor = r !== 0 && version === 0x13;
address[256 + 0] = r;
for (let s = 0; s < ARGON2_SYNC_POINTS; s++) {
address[256 + 4] = s;
// RFC 9106 §3.4.1.3: Argon2id uses Argon2i's data-independent `J1` / `J2` generation only
// in pass 0, slices 0 and 1; Argon2i uses it in every segment.
const dataIndependent = type == AT.Argon2i || (type == AT.Argon2id && r === 0 && s < 2);
for (let l = 0; l < p; l++) {
address[256 + 2] = l;
address[256 + 12] = 0;
let startPos = 0;
if (r === 0 && s === 0) {
startPos = 2;
if (dataIndependent) {
address[256 + 12]++;
block(address, 256, 2 * 256, 0, false);
block(address, 0, 2 * 256, 0, false);
}
}
// current block postion
let offset = l * laneLen + s * segmentLen + startPos;
// previous block position
let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1;
for (let index = startPos; index < segmentLen; index++, offset++, prev++) {
perBlock();
processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor);
// Date.now() is not monotonic. If the clock goes backwards,
// still yield control.
const diff = Date.now() - ts;
if (!(diff >= 0 && diff < asyncTick)) {
await nextTick();
ts += diff;
}
}
}
}
}
clean(address);
return argon2Output(B, p, laneLen, dkLen);
}
/**
* Argon2d async GPU-resistant version.
* @param password - password or input key material
* @param salt - unique salt value
* @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}.
* @returns Promise resolving to derived key bytes.
* @throws If the Argon2 input or cost parameters are invalid. {@link Error}
* @example
* Derive a key with Argon2d asynchronously.
* ```ts
* await argon2dAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 });
* ```
*/
export const argon2dAsync = (password, salt, opts) => argon2Async(AT.Argond2d, password, salt, opts);
/**
* Argon2i async side-channel-resistant version.
* @param password - password or input key material
* @param salt - unique salt value
* @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}.
* @returns Promise resolving to derived key bytes.
* @throws If the Argon2 input or cost parameters are invalid. {@link Error}
* @example
* Derive a key with Argon2i asynchronously.
* ```ts
* await argon2iAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 });
* ```
*/
export const argon2iAsync = (password, salt, opts) => argon2Async(AT.Argon2i, password, salt, opts);
/**
* Argon2id async, combining i+d, the most popular version from RFC 9106.
* @param password - password or input key material
* @param salt - unique salt value
* @param opts - Argon2 cost and optional tuning parameters. See {@link ArgonOpts}.
* @returns Promise resolving to derived key bytes.
* @throws If the Argon2 input or cost parameters are invalid. {@link Error}
* @example
* Derive a key with Argon2id asynchronously.
* ```ts
* await argon2idAsync('password', 'salt1234', { t: 1, m: 8, p: 1, dkLen: 32 });
* ```
*/
export const argon2idAsync = (password, salt, opts) => argon2Async(AT.Argon2id, password, salt, opts);
//# sourceMappingURL=argon2.js.map
@@ -0,0 +1,70 @@
//#region src/lru-cache.ts
function createLRUCache(max) {
const cache = /* @__PURE__ */ new Map();
let oldest;
let newest;
const touch = (entry) => {
if (!entry.next) return;
if (!entry.prev) {
entry.next.prev = void 0;
oldest = entry.next;
entry.next = void 0;
if (newest) {
entry.prev = newest;
newest.next = entry;
}
} else {
entry.prev.next = entry.next;
entry.next.prev = entry.prev;
entry.next = void 0;
if (newest) {
newest.next = entry;
entry.prev = newest;
}
}
newest = entry;
};
return {
get(key) {
const entry = cache.get(key);
if (!entry) return void 0;
touch(entry);
return entry.value;
},
set(key, value) {
if (cache.size >= max && oldest) {
const toDelete = oldest;
cache.delete(toDelete.key);
if (toDelete.next) {
oldest = toDelete.next;
toDelete.next.prev = void 0;
}
if (toDelete === newest) newest = void 0;
}
const existing = cache.get(key);
if (existing) {
existing.value = value;
touch(existing);
} else {
const entry = {
key,
value,
prev: newest
};
if (newest) newest.next = entry;
newest = entry;
if (!oldest) oldest = entry;
cache.set(key, entry);
}
},
clear() {
cache.clear();
oldest = void 0;
newest = void 0;
}
};
}
//#endregion
export { createLRUCache };
//# sourceMappingURL=lru-cache.js.map
@@ -0,0 +1,29 @@
export type Undo = () => void;
/**
* Marks everything except given node(or nodes) as aria-hidden
* @param {Element | Element[]} originalTarget - elements to keep on the page
* @param [parentNode] - top element, defaults to document.body
* @param {String} [markerName] - a special attribute to mark every node
* @return {Undo} undo command
*/
export declare const hideOthers: (originalTarget: Element | Element[], parentNode?: HTMLElement, markerName?: string) => Undo;
/**
* Marks everything except given node(or nodes) as inert
* @param {Element | Element[]} originalTarget - elements to keep on the page
* @param [parentNode] - top element, defaults to document.body
* @param {String} [markerName] - a special attribute to mark every node
* @return {Undo} undo command
*/
export declare const inertOthers: (originalTarget: Element | Element[], parentNode?: HTMLElement, markerName?: string) => Undo;
/**
* @returns if current browser supports inert
*/
export declare const supportsInert: () => boolean;
/**
* Automatic function to "suppress" DOM elements - _hide_ or _inert_ in the best possible way
* @param {Element | Element[]} originalTarget - elements to keep on the page
* @param [parentNode] - top element, defaults to document.body
* @param {String} [markerName] - a special attribute to mark every node
* @return {Undo} undo command
*/
export declare const suppressOthers: (originalTarget: Element | Element[], parentNode?: HTMLElement, markerName?: string) => Undo;
@@ -0,0 +1,36 @@
import * as React from "./";
export { Fragment } from "./";
export namespace JSX {
type ElementType = React.JSX.ElementType;
interface Element extends React.JSX.Element {}
interface ElementClass extends React.JSX.ElementClass {}
interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
}
/**
* Create a React element.
*
* You should not use this function directly. Use JSX and a transpiler instead.
*/
export function jsx(
type: React.ElementType,
props: unknown,
key?: React.Key,
): React.ReactElement;
/**
* Create a React element.
*
* You should not use this function directly. Use JSX and a transpiler instead.
*/
export function jsxs(
type: React.ElementType,
props: unknown,
key?: React.Key,
): React.ReactElement;
@@ -0,0 +1,414 @@
/**
* @license React
* scheduler-unstable_mock.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
"use strict";
"production" !== process.env.NODE_ENV &&
(function () {
function push(heap, node) {
var index = heap.length;
heap.push(node);
a: for (; 0 < index; ) {
var parentIndex = (index - 1) >>> 1,
parent = heap[parentIndex];
if (0 < compare(parent, node))
(heap[parentIndex] = node),
(heap[index] = parent),
(index = parentIndex);
else break a;
}
}
function peek(heap) {
return 0 === heap.length ? null : heap[0];
}
function pop(heap) {
if (0 === heap.length) return null;
var first = heap[0],
last = heap.pop();
if (last !== first) {
heap[0] = last;
a: for (
var index = 0, length = heap.length, halfLength = length >>> 1;
index < halfLength;
) {
var leftIndex = 2 * (index + 1) - 1,
left = heap[leftIndex],
rightIndex = leftIndex + 1,
right = heap[rightIndex];
if (0 > compare(left, last))
rightIndex < length && 0 > compare(right, left)
? ((heap[index] = right),
(heap[rightIndex] = last),
(index = rightIndex))
: ((heap[index] = left),
(heap[leftIndex] = last),
(index = leftIndex));
else if (rightIndex < length && 0 > compare(right, last))
(heap[index] = right),
(heap[rightIndex] = last),
(index = rightIndex);
else break a;
}
}
return first;
}
function compare(a, b) {
var diff = a.sortIndex - b.sortIndex;
return 0 !== diff ? diff : a.id - b.id;
}
function advanceTimers(currentTime) {
for (var timer = peek(timerQueue); null !== timer; ) {
if (null === timer.callback) pop(timerQueue);
else if (timer.startTime <= currentTime)
pop(timerQueue),
(timer.sortIndex = timer.expirationTime),
push(taskQueue, timer);
else break;
timer = peek(timerQueue);
}
}
function handleTimeout(currentTime) {
isHostTimeoutScheduled = !1;
advanceTimers(currentTime);
if (!isHostCallbackScheduled)
if (null !== peek(taskQueue))
(isHostCallbackScheduled = !0), (scheduledCallback = flushWork);
else {
var firstTimer = peek(timerQueue);
null !== firstTimer &&
((currentTime = firstTimer.startTime - currentTime),
(scheduledTimeout = handleTimeout),
(timeoutTime = currentMockTime + currentTime));
}
}
function flushWork(hasTimeRemaining, initialTime) {
isHostCallbackScheduled = !1;
isHostTimeoutScheduled &&
((isHostTimeoutScheduled = !1),
(scheduledTimeout = null),
(timeoutTime = -1));
isPerformingWork = !0;
var previousPriorityLevel = currentPriorityLevel;
try {
a: {
advanceTimers(initialTime);
for (
currentTask = peek(taskQueue);
null !== currentTask &&
(!(currentTask.expirationTime > initialTime) ||
(hasTimeRemaining && !shouldYieldToHost()));
) {
var callback = currentTask.callback;
if ("function" === typeof callback) {
currentTask.callback = null;
currentPriorityLevel = currentTask.priorityLevel;
var continuationCallback = callback(
currentTask.expirationTime <= initialTime
);
initialTime = currentMockTime;
if ("function" === typeof continuationCallback) {
if (
((currentTask.callback = continuationCallback),
advanceTimers(initialTime),
shouldYieldForPaint)
) {
var JSCompiler_inline_result = (needsPaint = !0);
break a;
}
} else
currentTask === peek(taskQueue) && pop(taskQueue),
advanceTimers(initialTime);
} else pop(taskQueue);
currentTask = peek(taskQueue);
}
if (null !== currentTask) JSCompiler_inline_result = !0;
else {
var firstTimer = peek(timerQueue);
if (null !== firstTimer) {
var ms = firstTimer.startTime - initialTime;
scheduledTimeout = handleTimeout;
timeoutTime = currentMockTime + ms;
}
JSCompiler_inline_result = !1;
}
}
return JSCompiler_inline_result;
} finally {
(currentTask = null),
(currentPriorityLevel = previousPriorityLevel),
(isPerformingWork = !1);
}
}
function shouldYieldToHost() {
return (0 === expectedNumberOfYields && null === yieldedValues) ||
(-1 !== expectedNumberOfYields &&
null !== yieldedValues &&
yieldedValues.length >= expectedNumberOfYields) ||
(shouldYieldForPaint && needsPaint)
? (didStop = !0)
: !1;
}
function unstable_flushAllWithoutAsserting() {
if (isFlushing) throw Error("Already flushing work.");
if (null !== scheduledCallback) {
var cb = scheduledCallback;
isFlushing = !0;
try {
var hasMoreWork = !0;
do hasMoreWork = cb(!0, currentMockTime);
while (hasMoreWork);
hasMoreWork || (scheduledCallback = null);
return !0;
} finally {
isFlushing = !1;
}
} else return !1;
}
var taskQueue = [],
timerQueue = [],
taskIdCounter = 1,
currentTask = null,
currentPriorityLevel = 3,
isPerformingWork = !1,
isHostCallbackScheduled = !1,
isHostTimeoutScheduled = !1,
currentMockTime = 0,
scheduledCallback = null,
scheduledTimeout = null,
timeoutTime = -1,
yieldedValues = null,
expectedNumberOfYields = -1,
didStop = !1,
isFlushing = !1,
needsPaint = !1,
shouldYieldForPaint = !1,
disableYieldValue = !1;
exports.log = function (value) {
"disabledLog" === console.log.name ||
disableYieldValue ||
(null === yieldedValues
? (yieldedValues = [value])
: yieldedValues.push(value));
};
exports.reset = function () {
if (isFlushing) throw Error("Cannot reset while already flushing work.");
currentMockTime = 0;
scheduledTimeout = scheduledCallback = null;
timeoutTime = -1;
yieldedValues = null;
expectedNumberOfYields = -1;
needsPaint = isFlushing = didStop = !1;
};
exports.unstable_IdlePriority = 5;
exports.unstable_ImmediatePriority = 1;
exports.unstable_LowPriority = 4;
exports.unstable_NormalPriority = 3;
exports.unstable_Profiling = null;
exports.unstable_UserBlockingPriority = 2;
exports.unstable_advanceTime = function (ms) {
"disabledLog" === console.log.name ||
disableYieldValue ||
((currentMockTime += ms),
null !== scheduledTimeout &&
timeoutTime <= currentMockTime &&
(scheduledTimeout(currentMockTime),
(timeoutTime = -1),
(scheduledTimeout = null)));
};
exports.unstable_cancelCallback = function (task) {
task.callback = null;
};
exports.unstable_clearLog = function () {
if (null === yieldedValues) return [];
var values = yieldedValues;
yieldedValues = null;
return values;
};
exports.unstable_flushAll = function () {
if (null !== yieldedValues)
throw Error(
"Log is not empty. Assert on the log of yielded values before flushing additional work."
);
unstable_flushAllWithoutAsserting();
if (null !== yieldedValues)
throw Error(
"While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])"
);
};
exports.unstable_flushAllWithoutAsserting =
unstable_flushAllWithoutAsserting;
exports.unstable_flushExpired = function () {
if (isFlushing) throw Error("Already flushing work.");
if (null !== scheduledCallback) {
isFlushing = !0;
try {
scheduledCallback(!1, currentMockTime) || (scheduledCallback = null);
} finally {
isFlushing = !1;
}
}
};
exports.unstable_flushNumberOfYields = function (count) {
if (isFlushing) throw Error("Already flushing work.");
if (null !== scheduledCallback) {
var cb = scheduledCallback;
expectedNumberOfYields = count;
isFlushing = !0;
try {
count = !0;
do count = cb(!0, currentMockTime);
while (count && !didStop);
count || (scheduledCallback = null);
} finally {
(expectedNumberOfYields = -1), (isFlushing = didStop = !1);
}
}
};
exports.unstable_flushUntilNextPaint = function () {
if (isFlushing) throw Error("Already flushing work.");
if (null !== scheduledCallback) {
var cb = scheduledCallback;
shouldYieldForPaint = !0;
needsPaint = !1;
isFlushing = !0;
try {
var hasMoreWork = !0;
do hasMoreWork = cb(!0, currentMockTime);
while (hasMoreWork && !didStop);
hasMoreWork || (scheduledCallback = null);
} finally {
isFlushing = didStop = shouldYieldForPaint = !1;
}
}
return !1;
};
exports.unstable_forceFrameRate = function () {};
exports.unstable_getCurrentPriorityLevel = function () {
return currentPriorityLevel;
};
exports.unstable_hasPendingWork = function () {
return null !== scheduledCallback;
};
exports.unstable_next = function (eventHandler) {
switch (currentPriorityLevel) {
case 1:
case 2:
case 3:
var priorityLevel = 3;
break;
default:
priorityLevel = currentPriorityLevel;
}
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = priorityLevel;
try {
return eventHandler();
} finally {
currentPriorityLevel = previousPriorityLevel;
}
};
exports.unstable_now = function () {
return currentMockTime;
};
exports.unstable_requestPaint = function () {
needsPaint = !0;
};
exports.unstable_runWithPriority = function (priorityLevel, eventHandler) {
switch (priorityLevel) {
case 1:
case 2:
case 3:
case 4:
case 5:
break;
default:
priorityLevel = 3;
}
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = priorityLevel;
try {
return eventHandler();
} finally {
currentPriorityLevel = previousPriorityLevel;
}
};
exports.unstable_scheduleCallback = function (
priorityLevel,
callback,
options
) {
var currentTime = currentMockTime;
"object" === typeof options && null !== options
? ((options = options.delay),
(options =
"number" === typeof options && 0 < options
? currentTime + options
: currentTime))
: (options = currentTime);
switch (priorityLevel) {
case 1:
var timeout = -1;
break;
case 2:
timeout = 250;
break;
case 5:
timeout = 1073741823;
break;
case 4:
timeout = 1e4;
break;
default:
timeout = 5e3;
}
timeout = options + timeout;
priorityLevel = {
id: taskIdCounter++,
callback: callback,
priorityLevel: priorityLevel,
startTime: options,
expirationTime: timeout,
sortIndex: -1
};
options > currentTime
? ((priorityLevel.sortIndex = options),
push(timerQueue, priorityLevel),
null === peek(taskQueue) &&
priorityLevel === peek(timerQueue) &&
(isHostTimeoutScheduled
? ((scheduledTimeout = null), (timeoutTime = -1))
: (isHostTimeoutScheduled = !0),
(scheduledTimeout = handleTimeout),
(timeoutTime = currentMockTime + (options - currentTime))))
: ((priorityLevel.sortIndex = timeout),
push(taskQueue, priorityLevel),
isHostCallbackScheduled ||
isPerformingWork ||
((isHostCallbackScheduled = !0), (scheduledCallback = flushWork)));
return priorityLevel;
};
exports.unstable_setDisableYieldValue = function (newValue) {
disableYieldValue = newValue;
};
exports.unstable_shouldYield = shouldYieldToHost;
exports.unstable_wrapCallback = function (callback) {
var parentPriorityLevel = currentPriorityLevel;
return function () {
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = parentPriorityLevel;
try {
return callback.apply(this, arguments);
} finally {
currentPriorityLevel = previousPriorityLevel;
}
};
};
})();
@@ -0,0 +1,218 @@
/**
* @fileoverview Rule to enforce location of semicolons.
* @author Toru Nagashima
* @deprecated in ESLint v8.53.0
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
const SELECTOR = [
"BreakStatement",
"ContinueStatement",
"DebuggerStatement",
"DoWhileStatement",
"ExportAllDeclaration",
"ExportDefaultDeclaration",
"ExportNamedDeclaration",
"ExpressionStatement",
"ImportDeclaration",
"ReturnStatement",
"ThrowStatement",
"VariableDeclaration",
"PropertyDefinition",
].join(",");
/**
* Get the child node list of a given node.
* This returns `BlockStatement#body`, `StaticBlock#body`, `Program#body`,
* `ClassBody#body`, or `SwitchCase#consequent`.
* This is used to check whether a node is the first/last child.
* @param {Node} node A node to get child node list.
* @returns {Node[]|null} The child node list.
*/
function getChildren(node) {
const t = node.type;
if (
t === "BlockStatement" ||
t === "StaticBlock" ||
t === "Program" ||
t === "ClassBody"
) {
return node.body;
}
if (t === "SwitchCase") {
return node.consequent;
}
return null;
}
/**
* Check whether a given node is the last statement in the parent block.
* @param {Node} node A node to check.
* @returns {boolean} `true` if the node is the last statement in the parent block.
*/
function isLastChild(node) {
const t = node.parent.type;
if (
t === "IfStatement" &&
node.parent.consequent === node &&
node.parent.alternate
) {
// before `else` keyword.
return true;
}
if (t === "DoWhileStatement") {
// before `while` keyword.
return true;
}
const nodeList = getChildren(node.parent);
return nodeList !== null && nodeList.at(-1) === node; // before `}` or etc.
}
/** @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-style",
url: "https://eslint.style/rules/semi-style",
},
},
],
},
type: "layout",
docs: {
description: "Enforce location of semicolons",
recommended: false,
url: "https://eslint.org/docs/latest/rules/semi-style",
},
schema: [{ enum: ["last", "first"] }],
fixable: "whitespace",
messages: {
expectedSemiColon: "Expected this semicolon to be at {{pos}}.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const option = context.options[0] || "last";
/**
* Check the given semicolon token.
* @param {Token} semiToken The semicolon token to check.
* @param {"first"|"last"} expected The expected location to check.
* @returns {void}
*/
function check(semiToken, expected) {
const prevToken = sourceCode.getTokenBefore(semiToken);
const nextToken = sourceCode.getTokenAfter(semiToken);
const prevIsSameLine =
!prevToken || astUtils.isTokenOnSameLine(prevToken, semiToken);
const nextIsSameLine =
!nextToken || astUtils.isTokenOnSameLine(semiToken, nextToken);
if (
(expected === "last" && !prevIsSameLine) ||
(expected === "first" && !nextIsSameLine)
) {
context.report({
loc: semiToken.loc,
messageId: "expectedSemiColon",
data: {
pos:
expected === "last"
? "the end of the previous line"
: "the beginning of the next line",
},
fix(fixer) {
if (
prevToken &&
nextToken &&
sourceCode.commentsExistBetween(
prevToken,
nextToken,
)
) {
return null;
}
const start = prevToken
? prevToken.range[1]
: semiToken.range[0];
const end = nextToken
? nextToken.range[0]
: semiToken.range[1];
const text = expected === "last" ? ";\n" : "\n;";
return fixer.replaceTextRange([start, end], text);
},
});
}
}
return {
[SELECTOR](node) {
if (option === "first" && isLastChild(node)) {
return;
}
const lastToken = sourceCode.getLastToken(node);
if (astUtils.isSemicolonToken(lastToken)) {
check(lastToken, option);
}
},
ForStatement(node) {
const firstSemi =
node.init &&
sourceCode.getTokenAfter(
node.init,
astUtils.isSemicolonToken,
);
const secondSemi =
node.test &&
sourceCode.getTokenAfter(
node.test,
astUtils.isSemicolonToken,
);
if (firstSemi) {
check(firstSemi, "last");
}
if (secondSemi) {
check(secondSemi, "last");
}
},
};
},
};
@@ -0,0 +1,13 @@
/**
* Converts seconds to milliseconds
*
* @param seconds - Time in seconds.
* @return milliseconds - Converted time in milliseconds.
*/
/*#__NO_SIDE_EFFECTS__*/
const secondsToMilliseconds = (seconds) => seconds * 1000;
/*#__NO_SIDE_EFFECTS__*/
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
export { millisecondsToSeconds, secondsToMilliseconds };
//# sourceMappingURL=time-conversion.mjs.map
@@ -0,0 +1,61 @@
{
"name": "fast-deep-equal",
"version": "3.1.3",
"description": "Fast deep equal",
"main": "index.js",
"scripts": {
"eslint": "eslint *.js benchmark/*.js spec/*.js",
"build": "node build",
"benchmark": "npm i && npm run build && cd ./benchmark && npm i && node ./",
"test-spec": "mocha spec/*.spec.js -R spec",
"test-cov": "nyc npm run test-spec",
"test-ts": "tsc --target ES5 --noImplicitAny index.d.ts",
"test": "npm run build && npm run eslint && npm run test-ts && npm run test-cov",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/epoberezkin/fast-deep-equal.git"
},
"keywords": [
"fast",
"equal",
"deep-equal"
],
"author": "Evgeny Poberezkin",
"license": "MIT",
"bugs": {
"url": "https://github.com/epoberezkin/fast-deep-equal/issues"
},
"homepage": "https://github.com/epoberezkin/fast-deep-equal#readme",
"devDependencies": {
"coveralls": "^3.1.0",
"dot": "^1.1.2",
"eslint": "^7.2.0",
"mocha": "^7.2.0",
"nyc": "^15.1.0",
"pre-commit": "^1.2.2",
"react": "^16.12.0",
"react-test-renderer": "^16.12.0",
"sinon": "^9.0.2",
"typescript": "^3.9.5"
},
"nyc": {
"exclude": [
"**/spec/**",
"node_modules"
],
"reporter": [
"lcov",
"text-summary"
]
},
"files": [
"index.js",
"index.d.ts",
"react.js",
"react.d.ts",
"es6/"
],
"types": "index.d.ts"
}
@@ -0,0 +1,3 @@
import { getConnInfo } from "./conninfo.js";
import { EventContext, handle, handleMiddleware, serveStatic } from "./handler.js";
export { type EventContext, getConnInfo, handle, handleMiddleware, serveStatic };
@@ -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 MoveUpRight = createLucideIcon("MoveUpRight", [
["path", { d: "M13 5H19V11", key: "1n1gyv" }],
["path", { d: "M19 5L5 19", key: "72u4yj" }]
]);
export { MoveUpRight as default };
//# sourceMappingURL=move-up-right.js.map
@@ -0,0 +1 @@
{"version":3,"file":"useNavigate.cjs","names":[],"sources":["../../src/useNavigate.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useLayoutEffect } from './utils'\nimport { useRouter } from './useRouter'\nimport type {\n AnyRouter,\n FromPathOption,\n NavigateOptions,\n RegisteredRouter,\n UseNavigateResult,\n} from '@tanstack/router-core'\n\n/**\n * Imperative navigation hook.\n *\n * Returns a stable `navigate(options)` function to change the current location\n * programmatically. Prefer the `Link` component for user-initiated navigation,\n * and use this hook from effects, callbacks, or handlers where imperative\n * navigation is required.\n *\n * Options:\n * - `from`: Optional route base used to resolve relative `to` paths.\n *\n * @returns A function that accepts `NavigateOptions`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useNavigateHook\n */\nexport function useNavigate<\n TRouter extends AnyRouter = RegisteredRouter,\n TDefaultFrom extends string = string,\n>(_defaultOpts?: {\n from?: FromPathOption<TRouter, TDefaultFrom>\n}): UseNavigateResult<TDefaultFrom> {\n const router = useRouter()\n\n return React.useCallback(\n (options: NavigateOptions) => {\n return router.navigate({\n ...options,\n from: options.from ?? _defaultOpts?.from,\n })\n },\n [_defaultOpts?.from, router],\n ) as UseNavigateResult<TDefaultFrom>\n}\n\n/**\n * Component that triggers a navigation when rendered. Navigation executes\n * in an effect after mount/update.\n *\n * Props are the same as `NavigateOptions` used by `navigate()`.\n *\n * @returns null\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/navigateComponent\n */\nexport function Navigate<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): null {\n const router = useRouter()\n const navigate = useNavigate()\n\n const previousPropsRef = React.useRef<NavigateOptions<\n TRouter,\n TFrom,\n TTo,\n TMaskFrom,\n TMaskTo\n > | null>(null)\n useLayoutEffect(() => {\n if (previousPropsRef.current !== props) {\n navigate(props)\n previousPropsRef.current = props\n }\n }, [router, props, navigate])\n return null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BA,SAAgB,YAGd,cAEkC;CAClC,MAAM,SAAS,kBAAA,WAAW;AAE1B,QAAO,MAAM,aACV,YAA6B;AAC5B,SAAO,OAAO,SAAS;GACrB,GAAG;GACH,MAAM,QAAQ,QAAQ,cAAc;GACrC,CAAC;IAEJ,CAAC,cAAc,MAAM,OAAO,CAC7B;;;;;;;;;;;AAYH,SAAgB,SAMd,OAAuE;CACvE,MAAM,SAAS,kBAAA,WAAW;CAC1B,MAAM,WAAW,aAAa;CAE9B,MAAM,mBAAmB,MAAM,OAMrB,KAAK;AACf,eAAA,sBAAsB;AACpB,MAAI,iBAAiB,YAAY,OAAO;AACtC,YAAS,MAAM;AACf,oBAAiB,UAAU;;IAE5B;EAAC;EAAQ;EAAO;EAAS,CAAC;AAC7B,QAAO"}
@@ -0,0 +1,113 @@
import { App } from "../app.js";
import { McpUiHostContext } from "../types.js";
/**
* React hook that applies host style variables and theme as CSS custom properties.
*
* This hook listens to host context changes and automatically applies:
* - `styles.variables` CSS variables to `document.documentElement` (e.g., `--color-background-primary`)
* - `theme` via `color-scheme` CSS property, enabling `light-dark()` CSS function support
*
* The hook also applies styles and theme from the initial host context when
* the app first connects.
*
* **Note:** If the host provides style values using CSS `light-dark()` function,
* this hook ensures they work correctly by setting the `color-scheme` property
* based on the host's theme preference.
*
* @param app - The connected {@link App `App`} instance, or null during initialization
* @param initialContext - Initial host context from the connection (optional).
* If provided, styles and theme will be applied immediately on mount.
*
* @example
* ```tsx source="./useHostStyles.examples.tsx#useHostStyleVariables_basicUsage"
* function MyApp() {
* const { app } = useApp({
* appInfo: { name: "MyApp", version: "1.0.0" },
* capabilities: {},
* });
*
* // Apply host styles - pass initial context to apply styles from connect() immediately
* useHostStyleVariables(app, app?.getHostContext());
*
* return (
* <div style={{ background: "var(--color-background-primary)" }}>
* Hello!
* </div>
* );
* }
* ```
*
* @see {@link applyHostStyleVariables `applyHostStyleVariables`} for the underlying styles function
* @see {@link applyDocumentTheme `applyDocumentTheme`} for the underlying theme function
* @see {@link useHostFonts `useHostFonts`} for applying host fonts
* @see {@link McpUiStyles `McpUiStyles`} for available CSS variables
*/
export declare function useHostStyleVariables(app: App | null, initialContext?: McpUiHostContext | null): void;
/**
* React hook that applies host fonts from CSS.
*
* This hook listens to host context changes and automatically applies:
* - `styles.css.fonts` as a `<style>` tag for custom fonts
*
* The CSS can contain `@font-face` rules for self-hosted fonts,
* `@import` statements for Google Fonts or other font services, or both.
*
* The hook also applies fonts from the initial host context when
* the app first connects.
*
* @param app - The connected {@link App `App`} instance, or null during initialization
* @param initialContext - Initial host context from the connection (optional).
* If provided, fonts will be applied immediately on mount.
*
* @example Basic usage with useApp
* ```tsx source="./useHostStyles.examples.tsx#useHostFonts_basicUsage"
* function MyApp() {
* const { app } = useApp({
* appInfo: { name: "MyApp", version: "1.0.0" },
* capabilities: {},
* });
*
* // Apply host fonts - pass initial context to apply fonts from connect() immediately
* useHostFonts(app, app?.getHostContext());
*
* return <div style={{ fontFamily: "var(--font-sans)" }}>Hello!</div>;
* }
* ```
*
* @see {@link applyHostFonts `applyHostFonts`} for the underlying fonts function
* @see {@link useHostStyleVariables `useHostStyleVariables`} for applying style variables and theme
*/
export declare function useHostFonts(app: App | null, initialContext?: McpUiHostContext | null): void;
/**
* Applies all host styling (CSS variables, theme, and fonts) to match the host application.
*
* This is a convenience hook that combines {@link useHostStyleVariables `useHostStyleVariables`} and
* {@link useHostFonts `useHostFonts`}. Use the individual hooks if you need more control.
*
* @param app - The connected {@link App `App`} instance, or null during initialization
* @param initialContext - Initial host context from the connection (optional).
* Pass `app?.getHostContext()` to apply styles immediately on mount.
*
* @example
* ```tsx source="./useHostStyles.examples.tsx#useHostStyles_basicUsage"
* function MyApp() {
* const { app } = useApp({
* appInfo: { name: "MyApp", version: "1.0.0" },
* capabilities: {},
* });
*
* // Apply all host styles - pass initial context to apply styles from connect() immediately
* useHostStyles(app, app?.getHostContext());
*
* return (
* <div style={{ background: "var(--color-background-primary)" }}>
* Hello!
* </div>
* );
* }
* ```
*
* @see {@link useHostStyleVariables `useHostStyleVariables`} for style variables and theme only
* @see {@link useHostFonts `useHostFonts`} for fonts only
*/
export declare function useHostStyles(app: App | null, initialContext?: McpUiHostContext | null): void;
@@ -0,0 +1 @@
{"version":3,"file":"check-reorder.mjs","sources":["../../../../../src/components/Reorder/utils/check-reorder.ts"],"sourcesContent":["import { mixNumber } from \"motion-dom\"\nimport { moveItem } from \"motion-utils\"\nimport { ItemData } from \"../types\"\n\nexport function checkReorder<T>(\n order: ItemData<T>[],\n value: T,\n offset: number,\n velocity: number\n): ItemData<T>[] {\n if (!velocity) return order\n\n const index = order.findIndex((item) => item.value === value)\n\n if (index === -1) return order\n\n const nextOffset = velocity > 0 ? 1 : -1\n const nextItem = order[index + nextOffset]\n\n if (!nextItem) return order\n\n const item = order[index]\n const nextLayout = nextItem.layout\n const nextItemCenter = mixNumber(nextLayout.min, nextLayout.max, 0.5)\n\n if (\n (nextOffset === 1 && item.layout.max + offset > nextItemCenter) ||\n (nextOffset === -1 && item.layout.min + offset < nextItemCenter)\n ) {\n return moveItem(order, index, index + nextOffset)\n }\n\n return order\n}\n"],"names":[],"mappings":";;;AAIM,SAAU,YAAY,CACxB,KAAoB,EACpB,KAAQ,EACR,MAAc,EACd,QAAgB,EAAA;AAEhB,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,OAAO,KAAK;AAE3B,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC;IAE7D,IAAI,KAAK,KAAK,EAAE;AAAE,QAAA,OAAO,KAAK;AAE9B,IAAA,MAAM,UAAU,GAAG,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE;IACxC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;AAE1C,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,OAAO,KAAK;AAE3B,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC;AACzB,IAAA,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM;AAClC,IAAA,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;AAErE,IAAA,IACI,CAAC,UAAU,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,GAAG,cAAc;AAC9D,SAAC,UAAU,KAAK,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,GAAG,cAAc,CAAC,EAClE;QACE,OAAO,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,UAAU,CAAC;IACrD;AAEA,IAAA,OAAO,KAAK;AAChB;;;;"}
@@ -0,0 +1,14 @@
import { assignRef } from './assignRef';
import { createCallbackRef } from './createRef';
/**
* Transforms one ref to another
* @example
* ```tsx
* const ResizableWithRef = forwardRef((props, ref) =>
* <Resizable {...props} ref={transformRef(ref, i => i ? i.resizable : null)}/>
* );
* ```
*/
export function transformRef(ref, transformer) {
return createCallbackRef(function (value) { return assignRef(ref, transformer(value)); });
}
@@ -0,0 +1,211 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
const fish = z.object({
name: z.string(),
age: z.number(),
nested: z.object({}),
});
test("pick type inference", () => {
const nameonlyFish = fish.pick({ name: true });
type nameonlyFish = z.infer<typeof nameonlyFish>;
expectTypeOf<nameonlyFish>().toEqualTypeOf<{ name: string }>();
});
test("pick parse - success", () => {
const nameonlyFish = fish.pick({ name: true });
nameonlyFish.parse({ name: "bob" });
// @ts-expect-error checking runtime picks `name` only.
const anotherNameonlyFish = fish.pick({ name: true, age: false });
anotherNameonlyFish.parse({ name: "bob" });
});
test("pick parse - fail", () => {
fish.pick({ name: true }).parse({ name: "12" } as any);
fish.pick({ name: true }).parse({ name: "bob", age: 12 } as any);
fish.pick({ age: true }).parse({ age: 12 } as any);
const nameonlyFish = fish.pick({ name: true }).strict();
const bad1 = () => nameonlyFish.parse({ name: 12 } as any);
const bad2 = () => nameonlyFish.parse({ name: "bob", age: 12 } as any);
const bad3 = () => nameonlyFish.parse({ age: 12 } as any);
// @ts-expect-error checking runtime picks `name` only.
const anotherNameonlyFish = fish.pick({ name: true, age: false }).strict();
const bad4 = () => anotherNameonlyFish.parse({ name: "bob", age: 12 } as any);
expect(bad1).toThrow();
expect(bad2).toThrow();
expect(bad3).toThrow();
expect(bad4).toThrow();
});
test("pick - remove optional", () => {
const schema = z.object({ a: z.string(), b: z.string().optional() });
expect("a" in schema._zod.def.shape).toEqual(true);
expect("b" in schema._zod.def.shape!).toEqual(true);
const picked = schema.pick({ a: true });
expect("a" in picked._zod.def.shape).toEqual(true);
expect("b" in picked._zod.def.shape!).toEqual(false);
});
test("omit type inference", () => {
const nonameFish = fish.omit({ name: true });
type nonameFish = z.infer<typeof nonameFish>;
expectTypeOf<nonameFish>().toEqualTypeOf<{ age: number; nested: Record<string, never> }>();
});
test("omit parse - success", () => {
const nonameFish = fish.omit({ name: true });
nonameFish.parse({ age: 12, nested: {} });
// @ts-expect-error checking runtime omits `name` only.
const anotherNonameFish = fish.omit({ name: true, age: false });
anotherNonameFish.parse({ age: 12, nested: {} });
});
test("omit parse - fail", () => {
const nonameFish = fish.omit({ name: true });
const bad1 = () => nonameFish.parse({ name: 12 } as any);
const bad2 = () => nonameFish.parse({ age: 12 } as any);
const bad3 = () => nonameFish.parse({} as any);
// @ts-expect-error checking runtime omits `name` only.
const anotherNonameFish = fish.omit({ name: true, age: false });
const bad4 = () => anotherNonameFish.parse({ nested: {} } as any);
expect(bad1).toThrow();
expect(bad2).toThrow();
expect(bad3).toThrow();
expect(bad4).toThrow();
});
test("omit - remove optional", () => {
const schema = z.object({ a: z.string(), b: z.string().optional() });
expect("a" in schema._zod.def.shape).toEqual(true);
const omitted = schema.omit({ a: true });
expect("a" in omitted._zod.def.shape).toEqual(false);
});
test("nonstrict inference", () => {
const laxfish = fish.pick({ name: true }).catchall(z.any());
type laxfish = z.infer<typeof laxfish>;
expectTypeOf<laxfish>().toEqualTypeOf<{ name: string; [k: string]: any }>();
});
test("nonstrict parsing - pass", () => {
const laxfish = fish.passthrough().pick({ name: true });
laxfish.parse({ name: "asdf", whatever: "asdf" });
laxfish.parse({ name: "asdf", age: 12, nested: {} });
});
test("nonstrict parsing - fail", () => {
const laxfish = fish.passthrough().pick({ name: true });
const bad = () => laxfish.parse({ whatever: "asdf" } as any);
expect(bad).toThrow();
});
test("pick/omit/required/partial - do not allow unknown keys", () => {
const schema = z.object({
name: z.string(),
age: z.number(),
});
// Mixed valid + invalid keys
// @ts-expect-error
expect(() => schema.pick({ name: true, asdf: true }).safeParse({})).toThrow();
// @ts-expect-error
expect(() => schema.omit({ name: true, asdf: true }).safeParse({})).toThrow();
// @ts-expect-error
expect(() => schema.partial({ name: true, asdf: true }).safeParse({})).toThrow();
// @ts-expect-error
expect(() => schema.required({ name: true, asdf: true }).safeParse({})).toThrow();
// Only invalid keys
// @ts-expect-error
expect(() => schema.pick({ $unknown: true }).safeParse({})).toThrow();
// @ts-expect-error
expect(() => schema.omit({ $unknown: true }).safeParse({})).toThrow();
// @ts-expect-error
expect(() => schema.required({ $unknown: true }).safeParse({})).toThrow();
// @ts-expect-error
expect(() => schema.partial({ $unknown: true }).safeParse({})).toThrow();
});
test("pick - throws error on schema with refinements", () => {
const baseSchema = z.object({
id: z.string(),
name: z.string(),
items: z.string().array(),
});
const refinedSchema = baseSchema.superRefine((val, ctx) => {
if (val.items.length === 0) {
ctx.addIssue({
message: "Must have at least one item",
code: "custom",
path: ["items"],
});
}
});
expect(() => refinedSchema.pick({ name: true })).toThrow(
".pick() cannot be used on object schemas containing refinements"
);
});
test("omit - throws error on schema with refinements", () => {
const baseSchema = z.object({
id: z.string(),
name: z.string(),
items: z.string().array(),
});
const refinedSchema = baseSchema.superRefine((val, ctx) => {
if (val.items.length === 0) {
ctx.addIssue({
message: "Must have at least one item",
code: "custom",
path: ["items"],
});
}
});
expect(() => refinedSchema.omit({ id: true })).toThrow(
".omit() cannot be used on object schemas containing refinements"
);
});
test("pick - throws error on schema with refine", () => {
const baseSchema = z.object({
password: z.string(),
confirmPassword: z.string(),
});
const refinedSchema = baseSchema.refine((data) => data.password === data.confirmPassword, {
message: "Passwords must match",
});
expect(() => refinedSchema.pick({ password: true })).toThrow(
".pick() cannot be used on object schemas containing refinements"
);
});
test("omit - throws error on schema with refine", () => {
const baseSchema = z.object({
password: z.string(),
confirmPassword: z.string(),
email: z.string(),
});
const refinedSchema = baseSchema.refine((data) => data.password === data.confirmPassword, {
message: "Passwords must match",
});
expect(() => refinedSchema.omit({ email: true })).toThrow(
".omit() cannot be used on object schemas containing refinements"
);
});
@@ -0,0 +1 @@
{"version":3,"file":"arrow-up-from-dot.js","sources":["../../../src/icons/arrow-up-from-dot.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ArrowUpFromDot\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtNSA5IDctNyA3IDciIC8+CiAgPHBhdGggZD0iTTEyIDE2VjIiIC8+CiAgPGNpcmNsZSBjeD0iMTIiIGN5PSIyMSIgcj0iMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/arrow-up-from-dot\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst ArrowUpFromDot = createLucideIcon('ArrowUpFromDot', [\n ['path', { d: 'm5 9 7-7 7 7', key: '1hw5ic' }],\n ['path', { d: 'M12 16V2', key: 'ywoabb' }],\n ['circle', { cx: '12', cy: '21', r: '1', key: 'o0uj5v' }],\n]);\n\nexport default ArrowUpFromDot;\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,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,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACzC,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA;AAC1D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,695 @@
/**
* @fileoverview Rule to flag on declaring variables already declared in the outer scope
* @author Ilya Volodin
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Types
//------------------------------------------------------------------------------
/** @typedef {import("eslint-scope").Variable} Variable */
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const FUNC_EXPR_NODE_TYPES = new Set([
"ArrowFunctionExpression",
"FunctionExpression",
]);
const CALL_EXPR_NODE_TYPE = new Set(["CallExpression"]);
const FOR_IN_OF_TYPE = /^For(?:In|Of)Statement$/u;
const SENTINEL_TYPE =
/^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/u;
// TS-specific node types
const TYPES_HOISTED_NODES = new Set([
"TSInterfaceDeclaration",
"TSTypeAliasDeclaration",
]);
// TS-specific function variable def types
const ALLOWED_FUNCTION_VARIABLE_DEF_TYPES = new Set([
"TSCallSignatureDeclaration",
"TSFunctionType",
"TSMethodSignature",
"TSEmptyBodyFunctionExpression",
"TSDeclareFunction",
"TSConstructSignatureDeclaration",
"TSConstructorType",
]);
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
dialects: ["typescript", "javascript"],
language: "javascript",
defaultOptions: [
{
allow: [],
builtinGlobals: false,
hoist: "functions",
ignoreOnInitialization: false,
ignoreTypeValueShadow: true,
ignoreFunctionTypeParameterNameValueShadow: true,
},
],
docs: {
description:
"Disallow variable declarations from shadowing variables declared in the outer scope",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-shadow",
},
schema: [
{
type: "object",
properties: {
builtinGlobals: { type: "boolean" },
hoist: {
enum: [
"all",
"functions",
"never",
"types",
"functions-and-types",
],
},
allow: {
type: "array",
items: {
type: "string",
},
},
ignoreOnInitialization: { type: "boolean" },
ignoreTypeValueShadow: { type: "boolean" },
ignoreFunctionTypeParameterNameValueShadow: {
type: "boolean",
},
},
additionalProperties: false,
},
],
messages: {
noShadow:
"'{{name}}' is already declared in the upper scope on line {{shadowedLine}} column {{shadowedColumn}}.",
noShadowGlobal: "'{{name}}' is already a global variable.",
},
},
create(context) {
const [
{
builtinGlobals,
hoist,
allow,
ignoreOnInitialization,
ignoreTypeValueShadow,
ignoreFunctionTypeParameterNameValueShadow,
},
] = context.options;
const sourceCode = context.sourceCode;
/**
* Check if a scope is a TypeScript module augmenting the global namespace.
* @param {Scope} scope The scope to check
* @returns {boolean} Whether the scope is a global augmentation
*/
function isGlobalAugmentation(scope) {
return (
scope.block.kind === "global" ||
(!!scope.upper && isGlobalAugmentation(scope.upper))
);
}
/**
* Check if variable is a `this` parameter.
* @param {Object} variable The variable to check
* @returns {boolean} Whether the variable is a this parameter
*/
function isThisParam(variable) {
return variable.name === "this";
}
/**
* Checks if type and value shadows each other
* @param {Object} variable The variable to check
* @param {Object} shadowedVariable The shadowed variable
* @returns {boolean} Whether it's a type/value shadow case to ignore
*/
function isTypeValueShadow(variable, shadowedVariable) {
if (ignoreTypeValueShadow !== true) {
return false;
}
if (!("isValueVariable" in variable)) {
return false;
}
const firstDefinition = shadowedVariable.defs[0];
// Check if shadowedVariable is a type import
const isTypeImport =
firstDefinition &&
firstDefinition.parent?.type === "ImportDeclaration" &&
(firstDefinition.parent.importKind === "type" ||
firstDefinition.parent.specifiers.some(
s => s.importKind === "type",
));
const isShadowedValue =
!firstDefinition ||
(isTypeImport ? false : shadowedVariable.isValueVariable);
return variable.isValueVariable !== isShadowedValue;
}
/**
* Checks if it's a function type parameter shadow
* @param {Object} variable The variable to check
* @returns {boolean} Whether it's a function type parameter shadow case to ignore
*/
function isFunctionTypeParameterNameValueShadow(variable) {
if (ignoreFunctionTypeParameterNameValueShadow !== true) {
return false;
}
return variable.defs.some(def =>
ALLOWED_FUNCTION_VARIABLE_DEF_TYPES.has(def.node.type),
);
}
/**
* Checks if the variable is a generic of a static method
* @param {Object} variable The variable to check
* @returns {boolean} Whether the variable is a generic of a static method
*/
function isTypeParameterOfStaticMethod(variable) {
const typeParameter = variable.identifiers[0].parent;
const typeParameterDecl = typeParameter.parent;
if (typeParameterDecl.type !== "TSTypeParameterDeclaration") {
return false;
}
const functionExpr = typeParameterDecl.parent;
const methodDefinition = functionExpr.parent;
return methodDefinition.static;
}
/**
* Checks for static method generic shadowing class generic
* @param {Object} variable The variable to check
* @returns {boolean} Whether it's a static method generic shadowing class generic
*/
function isGenericOfAStaticMethodShadow(variable) {
return isTypeParameterOfStaticMethod(variable);
}
/**
* Checks whether or not a given location is inside of the range of a given node.
* @param {ASTNode} node An node to check.
* @param {number} location A location to check.
* @returns {boolean} `true` if the location is inside of the range of the node.
*/
function isInRange(node, location) {
return (
node && node.range[0] <= location && location <= node.range[1]
);
}
/**
* Searches from the current node through its ancestry to find a matching node.
* @param {ASTNode} node a node to get.
* @param {(node: ASTNode) => boolean} match a callback that checks whether or not the node verifies its condition or not.
* @returns {ASTNode|null} the matching node.
*/
function findSelfOrAncestor(node, match) {
let currentNode = node;
while (currentNode && !match(currentNode)) {
currentNode = currentNode.parent;
}
return currentNode;
}
/**
* Finds function's outer scope.
* @param {Scope} scope Function's own scope.
* @returns {Scope} Function's outer scope.
*/
function getOuterScope(scope) {
const upper = scope.upper;
if (upper && upper.type === "function-expression-name") {
return upper.upper;
}
return upper;
}
/**
* Checks if a variable and a shadowedVariable have the same init pattern ancestor.
* @param {Object} variable a variable to check.
* @param {Object} shadowedVariable a shadowedVariable to check.
* @returns {boolean} Whether or not the variable and the shadowedVariable have the same init pattern ancestor.
*/
function isInitPatternNode(variable, shadowedVariable) {
const outerDef = shadowedVariable.defs[0];
if (!outerDef) {
return false;
}
const { variableScope } = variable.scope;
if (
!(
FUNC_EXPR_NODE_TYPES.has(variableScope.block.type) &&
getOuterScope(variableScope) === shadowedVariable.scope
)
) {
return false;
}
const fun = variableScope.block;
const { parent } = fun;
const callExpression = findSelfOrAncestor(parent, node =>
CALL_EXPR_NODE_TYPE.has(node.type),
);
if (!callExpression) {
return false;
}
let node = outerDef.name;
const location = callExpression.range[1];
while (node) {
if (node.type === "VariableDeclarator") {
if (isInRange(node.init, location)) {
return true;
}
if (
FOR_IN_OF_TYPE.test(node.parent.parent.type) &&
isInRange(node.parent.parent.right, location)
) {
return true;
}
break;
} else if (node.type === "AssignmentPattern") {
if (isInRange(node.right, location)) {
return true;
}
} else if (SENTINEL_TYPE.test(node.type)) {
break;
}
node = node.parent;
}
return false;
}
/**
* Check if variable name is allowed.
* @param {ASTNode} variable The variable to check.
* @returns {boolean} Whether or not the variable name is allowed.
*/
function isAllowed(variable) {
return allow.includes(variable.name);
}
/**
* Checks if a variable of the class name in the class scope of ClassDeclaration.
*
* ClassDeclaration creates two variables of its name into its outer scope and its class scope.
* So we should ignore the variable in the class scope.
* @param {Object} variable The variable to check.
* @returns {boolean} Whether or not the variable of the class name in the class scope of ClassDeclaration.
*/
function isDuplicatedClassNameVariable(variable) {
const block = variable.scope.block;
return (
block.type === "ClassDeclaration" &&
block.id === variable.identifiers[0]
);
}
/**
* Finds the uppermost expression node that can evaluate to the given one.
*
* Examples:
* If given `a` in `a || foo`, it returns the `a || foo` node.
* If given `a` in `foo ? a : bar`, it returns the `foo ? a : bar` node.
* If given `a` in `foo ? bar : (baz && a)`, it returns the `foo ? bar : (baz && a)` node.
* If given `a` in `a ? foo : bar`, it returns the `a` node.
* If given `a` in `foo(a)`, it returns the `a` node.
* @param {ASTNode} expression The expression node to unwrap.
* @returns {ASTNode} The uppermost ancestor that can evaluate to the given node
* or the given node if there is no such ancestor.
*/
function unwrapExpression(expression) {
const { parent } = expression;
const shouldUnwrap =
parent.type === "LogicalExpression" ||
(parent.type === "ConditionalExpression" &&
parent.test !== expression);
return shouldUnwrap ? unwrapExpression(parent) : expression;
}
/**
* Checks if inner variable is the name of a function or class
* that is assigned to outer variable as its initializer.
*
* To avoid reporting at declarations such as:
* var a = function a() {};
* var A = class A {};
* var a = foo || function a() {};
* var a = foo ? function a() {} : bar;
* var { a = function a() {} } = foo;
*
* But it should report at declarations such as:
* var a = function(a) {};
* var a = function() { function a() {} };
* var a = wrap(function a() {});
* @param {Object} innerVariable The inner variable to check.
* @param {Object} outerVariable The outer variable.
* @returns {boolean} Whether or not inner variable is the name of a
* function or class that is assigned to outer variable as its initializer.
*/
function isFunctionNameInitializerException(
innerVariable,
outerVariable,
) {
const outerDef = outerVariable.defs[0];
const innerDef = innerVariable.defs[0];
if (!outerDef || !innerDef) {
return false;
}
if (
!(
(innerDef.type === "FunctionName" &&
innerDef.node.type === "FunctionExpression") ||
(innerDef.type === "ClassName" &&
innerDef.node.type === "ClassExpression")
)
) {
return false;
}
const outerIdentifier = outerDef.name;
let initializerNode;
if (outerIdentifier.parent.type === "VariableDeclarator") {
initializerNode = outerIdentifier.parent.init;
} else if (outerIdentifier.parent.type === "AssignmentPattern") {
initializerNode = outerIdentifier.parent.right;
}
if (!initializerNode) {
return false;
}
const nodeToCheck = innerDef.node; // FunctionExpression or ClassExpression node
// Exit early if the node to check isn't inside the initializer
if (
!(
initializerNode.range[0] <= nodeToCheck.range[0] &&
nodeToCheck.range[1] <= initializerNode.range[1]
)
) {
return false;
}
return initializerNode === unwrapExpression(nodeToCheck);
}
/**
* Get a range of a variable's identifier node.
* @param {Object} variable The variable to get.
* @returns {Array|undefined} The range of the variable's identifier node.
*/
function getNameRange(variable) {
const def = variable.defs[0];
return def && def.name.range;
}
/**
* Get declared line and column of a variable.
* @param {Variable} variable The variable to get.
* @returns {Object} The declared line and column of the variable.
*/
function getDeclaredLocation(variable) {
const identifier = variable.identifiers[0];
let obj;
if (identifier) {
obj = {
global: false,
line: identifier.loc.start.line,
column: identifier.loc.start.column + 1,
};
} else {
obj = {
global: true,
};
}
return obj;
}
/**
* Checks if a variable is in TDZ of scopeVar.
* @param {Object} variable The variable to check.
* @param {Object} scopeVar The variable of TDZ.
* @returns {boolean} Whether or not the variable is in TDZ of scopeVar.
*/
function isInTdz(variable, scopeVar) {
const outerDef = scopeVar.defs[0];
const inner = getNameRange(variable);
const outer = getNameRange(scopeVar);
if (!outer || inner[1] >= outer[0]) {
return false;
}
if (hoist === "types") {
return !TYPES_HOISTED_NODES.has(outerDef.node.type);
}
if (hoist === "functions-and-types") {
return (
outerDef.node.type !== "FunctionDeclaration" &&
!TYPES_HOISTED_NODES.has(outerDef.node.type)
);
}
return (
inner &&
outer &&
inner[1] < outer[0] &&
// Excepts FunctionDeclaration if is {"hoist":"function"}.
(hoist !== "functions" ||
!outerDef ||
outerDef.node.type !== "FunctionDeclaration")
);
}
/**
* Checks if the initialization of a variable has the declare modifier in a
* definition file.
* @param {Object} variable The variable to check
* @returns {boolean} Whether the variable is declared in a definition file
*/
function isDeclareInDTSFile(variable) {
const fileName = context.filename;
if (
!fileName.endsWith(".d.ts") &&
!fileName.endsWith(".d.cts") &&
!fileName.endsWith(".d.mts")
) {
return false;
}
return variable.defs.some(
def =>
(def.type === "Variable" && def.parent.declare) ||
(def.type === "ClassName" && def.node.declare) ||
(def.type === "TSEnumName" && def.node.declare) ||
(def.type === "TSModuleName" && def.node.declare),
);
}
/**
* Checks if a variable is a duplicate of an enum name in the enum scope
* @param {Object} variable The variable to check
* @returns {boolean} Whether it's a duplicate enum name variable
*/
function isDuplicatedEnumNameVariable(variable) {
const block = variable.scope.block;
return (
block.type === "TSEnumDeclaration" &&
block.id === variable.identifiers[0]
);
}
/**
* Check if this is an external module declaration merging with a type import
* @param {Scope} scope Current scope
* @param {Object} variable Current variable
* @param {Object} shadowedVariable Shadowed variable
* @returns {boolean} Whether it's an external declaration merging
*/
function isExternalDeclarationMerging(
scope,
variable,
shadowedVariable,
) {
const firstDefinition = shadowedVariable.defs[0];
if (!firstDefinition || !firstDefinition.parent) {
return false;
}
// Check if the shadowed variable is a type import
const isTypeImport =
firstDefinition.parent.type === "ImportDeclaration" &&
(firstDefinition.parent.importKind === "type" ||
firstDefinition.parent.specifiers?.some(
s =>
s.type === "ImportSpecifier" &&
s.importKind === "type" &&
s.local.name === shadowedVariable.name,
));
if (!isTypeImport) {
return false;
}
// Check if the current variable is within a module declaration
const moduleDecl = findSelfOrAncestor(
variable.identifiers[0]?.parent,
node => node.type === "TSModuleDeclaration",
);
if (!moduleDecl) {
return false;
}
/*
* Module declaration merging should only happen within the same module
* Check if the module name matches the import source
*/
const importSource = firstDefinition.parent.source.value;
const moduleName =
moduleDecl.id.type === "Literal"
? moduleDecl.id.value
: moduleDecl.id.name;
return importSource === moduleName;
}
/**
* Checks the current context for shadowed variables.
* @param {Scope} scope Fixme
* @returns {void}
*/
function checkForShadows(scope) {
// ignore global augmentation
if (isGlobalAugmentation(scope)) {
return;
}
const variables = scope.variables;
for (let i = 0; i < variables.length; ++i) {
const variable = variables[i];
// Skips "arguments" or variables of a class name in the class scope of ClassDeclaration.
if (
variable.identifiers.length === 0 ||
isDuplicatedClassNameVariable(variable) ||
isDuplicatedEnumNameVariable(variable) ||
isAllowed(variable) ||
isDeclareInDTSFile(variable) ||
isThisParam(variable)
) {
continue;
}
// Gets shadowed variable.
const shadowed = astUtils.getVariableByName(
scope.upper,
variable.name,
);
if (
shadowed &&
(shadowed.identifiers.length > 0 ||
(builtinGlobals && "writeable" in shadowed)) &&
!isFunctionNameInitializerException(variable, shadowed) &&
!(
ignoreOnInitialization &&
isInitPatternNode(variable, shadowed)
) &&
!(hoist !== "all" && isInTdz(variable, shadowed)) &&
!isTypeValueShadow(variable, shadowed) &&
!isFunctionTypeParameterNameValueShadow(variable) &&
!isGenericOfAStaticMethodShadow(variable, shadowed) &&
!isExternalDeclarationMerging(scope, variable, shadowed)
) {
const location = getDeclaredLocation(shadowed);
const messageId = location.global
? "noShadowGlobal"
: "noShadow";
const data = { name: variable.name };
if (!location.global) {
data.shadowedLine = location.line;
data.shadowedColumn = location.column;
}
context.report({
node: variable.identifiers[0],
messageId,
data,
});
}
}
}
return {
"Program:exit"(node) {
const globalScope = sourceCode.getScope(node);
const stack = globalScope.childScopes.slice();
while (stack.length) {
const scope = stack.pop();
stack.push(...scope.childScopes);
checkForShadows(scope);
}
},
};
},
};
@@ -0,0 +1,176 @@
'use strict'
let { existsSync, readFileSync, realpathSync } = require('fs')
let { dirname, isAbsolute, join, relative, sep } = require('path')
let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js')
function realPath(path) {
try {
return realpathSync(path)
} catch {
// Missing or dangling: keep the literal path. The existsSync() check below
// still gates the read, and a path that does not exist cannot escape.
return path
}
}
function fromBase64(str) {
if (Buffer) {
return Buffer.from(str, 'base64').toString()
} else {
/* c8 ignore next 2 */
return window.atob(str)
}
}
class PreviousMap {
constructor(css, opts) {
if (opts.map === false) return
if (opts.unsafeMap) this.unsafeMap = true
this.loadAnnotation(css)
this.inline = this.startWith(this.annotation, 'data:')
let prev = opts.map ? opts.map.prev : undefined
let text = this.loadMap(opts.from, prev)
if (!this.mapFile && opts.from) {
this.mapFile = opts.from
}
if (this.mapFile) this.root = dirname(this.mapFile)
if (text) this.text = text
}
consumer() {
if (!this.consumerCache) {
this.consumerCache = new SourceMapConsumer(this.json || this.text)
}
return this.consumerCache
}
decodeInline(text) {
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/
let baseUri = /^data:application\/json;base64,/
let charsetUri = /^data:application\/json;charset=utf-?8,/
let uri = /^data:application\/json,/
let uriMatch = text.match(charsetUri) || text.match(uri)
if (uriMatch) {
return decodeURIComponent(text.substr(uriMatch[0].length))
}
let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri)
if (baseUriMatch) {
return fromBase64(text.substr(baseUriMatch[0].length))
}
let encoding = text.slice('data:application/json;'.length)
encoding = encoding.slice(0, encoding.indexOf(','))
throw new Error('Unsupported source map encoding ' + encoding)
}
getAnnotationURL(sourceMapString) {
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim()
}
isMap(map) {
if (typeof map !== 'object') return false
return (
typeof map.mappings === 'string' ||
typeof map._mappings === 'string' ||
Array.isArray(map.sections)
)
}
loadAnnotation(css) {
let comments = css.match(/\/\*\s*# sourceMappingURL=/g)
if (!comments) return
// sourceMappingURLs from comments, strings, etc.
let start = css.lastIndexOf(comments.pop())
let end = css.indexOf('*/', start)
if (start > -1 && end > -1) {
// Locate the last sourceMappingURL to avoid pickin
this.annotation = this.getAnnotationURL(css.substring(start, end))
}
}
loadFile(path, cssFile, trusted) {
if (!trusted && !this.unsafeMap) {
if (!/\.map$/i.test(path)) return undefined
if (!cssFile) return undefined
// Compare *resolved* paths: relative() is textual, so without this a
// symlink at or below the CSS file's directory points the map outside it.
let rel = relative(realPath(dirname(cssFile)), realPath(path))
if (rel === '..' || rel.startsWith('..' + sep) || isAbsolute(rel)) {
return undefined
}
}
this.root = dirname(path)
if (existsSync(path)) {
this.mapFile = path
return readFileSync(path, 'utf-8').toString().trim()
}
}
loadMap(file, prev) {
if (prev === false) return false
if (prev) {
if (typeof prev === 'string') {
return prev
} else if (typeof prev === 'function') {
let prevPath = prev(file)
if (prevPath) {
let map = this.loadFile(prevPath, file, true)
if (!map) {
throw new Error(
'Unable to load previous source map: ' + prevPath.toString()
)
}
return map
}
} else if (prev instanceof SourceMapConsumer) {
return SourceMapGenerator.fromSourceMap(prev).toString()
} else if (prev instanceof SourceMapGenerator) {
return prev.toString()
} else if (this.isMap(prev)) {
return JSON.stringify(prev)
} else {
throw new Error(
'Unsupported previous source map format: ' + prev.toString()
)
}
} else if (this.inline) {
return this.decodeInline(this.annotation)
} else if (this.annotation) {
let map = this.annotation
if (file) map = join(dirname(file), map)
let unknown = this.loadFile(map, file, false)
if (unknown) {
try {
/* c8 ignore next 4 */
this.json = JSON.parse(unknown.replace(/^\)]}'[^\n]*\n/, ''))
} catch {
return undefined
}
}
return unknown
}
}
startWith(string, start) {
if (!string) return false
return string.substr(0, start.length) === start
}
withContent() {
return !!(
this.consumer().sourcesContent &&
this.consumer().sourcesContent.length > 0
)
}
}
module.exports = PreviousMap
PreviousMap.default = PreviousMap
@@ -0,0 +1,13 @@
import { t as CfWorkerJsonSchemaValidator } from "./cfWorkerProvider-B3ZJEoRM.mjs";
//#region src/shimsWorkerd.d.ts
/**
* Whether `fetch()` may throw `TypeError` due to CORS. CORS is a browser-only concept —
* in Cloudflare Workers, a `TypeError` from `fetch` is always a real network/configuration
* error, never a CORS error.
*/
declare const CORS_IS_POSSIBLE = false;
//#endregion
export { CORS_IS_POSSIBLE, CfWorkerJsonSchemaValidator as DefaultJsonSchemaValidator };
//# sourceMappingURL=shimsWorkerd.d.mts.map
@@ -0,0 +1,17 @@
import { DateInput } from './types';
/**
* Calculates the difference in milliseconds 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 milliseconds between the two dates.
* @example
* ```ts
* diffInMilliseconds(new Date(), new Date()); // 0
* diffInMilliseconds(new Date(), new Date(Date.now() + 1000)); // 1000
* diffInMilliseconds(new Date(), new Date(Date.now() - 1000)); // -1000
* ```
*/
export default function diffInMilliseconds(date: Date, input: DateInput, asFloat?: boolean): number;
@@ -0,0 +1,3 @@
import { InferInput } from "./utils.js";
import { ValidationFunction, validator } from "./validator.js";
export { type InferInput, type ValidationFunction, validator };
@@ -0,0 +1,18 @@
import { FlattenedSign } from '../flattened/sign.js';
export class CompactSign {
#flattened;
constructor(payload) {
this.#flattened = new FlattenedSign(payload);
}
setProtectedHeader(protectedHeader) {
this.#flattened.setProtectedHeader(protectedHeader);
return this;
}
async sign(key, options) {
const jws = await this.#flattened.sign(key, options);
if (jws.payload === undefined) {
throw new TypeError('use the flattened module for creating JWS with b64: false');
}
return `${jws.protected}.${jws.payload}.${jws.signature}`;
}
}
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRelativePath = void 0;
const getRelativePath = (pathA, pathB) => {
let i = 0;
for (; i < pathA.length && i < pathB.length; i++) {
if (pathA[i] !== pathB[i])
break;
}
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
};
exports.getRelativePath = getRelativePath;
@@ -0,0 +1 @@
{"version":3,"names":["Hub","getCode","getScope","addHelper","Error","buildError","node","msg","TypeError","exports","default"],"sources":["../src/hub.ts"],"sourcesContent":["import type Scope from \"./scope/index.ts\";\nimport type { Node } from \"@babel/types\";\n\nexport interface HubInterface {\n getCode(): string | void;\n getScope(): Scope | void;\n addHelper(name: string): any;\n buildError(node: Node, msg: string, Error: new (msg: string) => Error): Error;\n}\n\nexport default class Hub implements HubInterface {\n getCode() {}\n\n getScope() {}\n\n addHelper() {\n throw new Error(\"Helpers are not supported by the default hub.\");\n }\n\n buildError(\n node: Node,\n msg: string,\n Error: new (msg: string) => Error = TypeError,\n ): Error {\n return new Error(msg);\n }\n}\n"],"mappings":";;;;;;AAUe,MAAMA,GAAG,CAAyB;EAC/CC,OAAOA,CAAA,EAAG,CAAC;EAEXC,QAAQA,CAAA,EAAG,CAAC;EAEZC,SAASA,CAAA,EAAG;IACV,MAAM,IAAIC,KAAK,CAAC,+CAA+C,CAAC;EAClE;EAEAC,UAAUA,CACRC,IAAU,EACVC,GAAW,EACXH,KAAiC,GAAGI,SAAS,EACtC;IACP,OAAO,IAAIJ,KAAK,CAACG,GAAG,CAAC;EACvB;AACF;AAACE,OAAA,CAAAC,OAAA,GAAAV,GAAA","ignoreList":[]}
@@ -0,0 +1 @@
{"version":3,"names":["_templateLiterals","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_expressions","_statements","_classes","_methods","_modules","_types","_flow","_base","_jsx","_typescript"],"sources":["../../src/generators/index.ts"],"sourcesContent":["export * from \"./template-literals.ts\";\nexport * from \"./expressions.ts\";\nexport * from \"./statements.ts\";\nexport * from \"./classes.ts\";\nexport * from \"./methods.ts\";\nexport * from \"./modules.ts\";\nexport * from \"./types.ts\";\nexport * from \"./flow.ts\";\nexport * from \"./base.ts\";\nexport * from \"./jsx.ts\";\nexport * from \"./typescript.ts\";\n"],"mappings":";;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,iBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,iBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,iBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,WAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,WAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,WAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,WAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,QAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,QAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,QAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,QAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,QAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,QAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,QAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,QAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,QAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,QAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,QAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,QAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,MAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,MAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAU,MAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAM,MAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,KAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,KAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAW,KAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAO,KAAA,CAAAX,GAAA;IAAA;EAAA;AAAA;AACA,IAAAY,KAAA,GAAAhB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAc,KAAA,EAAAb,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAY,KAAA,CAAAZ,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAQ,KAAA,CAAAZ,GAAA;IAAA;EAAA;AAAA;AACA,IAAAa,IAAA,GAAAjB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAe,IAAA,EAAAd,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAa,IAAA,CAAAb,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAS,IAAA,CAAAb,GAAA;IAAA;EAAA;AAAA;AACA,IAAAc,WAAA,GAAAlB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAgB,WAAA,EAAAf,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAc,WAAA,CAAAd,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAU,WAAA,CAAAd,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,15 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
Object.defineProperty(exports, "__esModule", { value: true });
exports.lib = void 0;
const dom_1 = require("./dom");
const es5_1 = require("./es5");
const scripthost_1 = require("./scripthost");
const webworker_importscripts_1 = require("./webworker.importscripts");
exports.lib = {
libs: [es5_1.es5, dom_1.dom, webworker_importscripts_1.webworker_importscripts, scripthost_1.scripthost],
variables: [],
};
@@ -0,0 +1,55 @@
/**
* Error thrown by validation. Besides an informative message, it includes the path to the
* property which triggered the failure.
*/
export declare class VError extends Error {
path: string;
constructor(path: string, message: string);
}
/**
* IContext is used during validation to collect error messages. There is a "noop" fast
* implementation that does not pay attention to messages, and a full implementation that does.
*/
export interface IContext {
fail(relPath: string | number | null, message: string | null, score: number): false;
unionResolver(): IUnionResolver;
resolveUnion(ur: IUnionResolver): void;
}
/**
* This helper class is used to collect error messages reported while validating unions.
*/
export interface IUnionResolver {
createContext(): IContext;
}
/**
* IErrorDetail describes errors as returned by the validate() and validateStrict() methods.
*/
export interface IErrorDetail {
path: string;
message: string;
nested?: IErrorDetail[];
}
/**
* Fast implementation of IContext used for first-pass validation. If that fails, we can validate
* using DetailContext to collect error messages. That's faster for the common case when messages
* normally pass validation.
*/
export declare class NoopContext implements IContext, IUnionResolver {
fail(relPath: string | number | null, message: string | null, score: number): false;
unionResolver(): IUnionResolver;
createContext(): IContext;
resolveUnion(ur: IUnionResolver): void;
}
/**
* Complete implementation of IContext that collects meaningfull errors.
*/
export declare class DetailContext implements IContext {
private _propNames;
private _messages;
private _score;
fail(relPath: string | number | null, message: string | null, score: number): false;
unionResolver(): IUnionResolver;
resolveUnion(unionResolver: IUnionResolver): void;
getError(path: string): VError;
getErrorDetail(path: string): IErrorDetail | null;
}
@@ -0,0 +1,25 @@
//#region src/utils/filepath.ts
const getFilePath = (options) => {
let filename = options.filename;
const defaultDocument = options.defaultDocument || "index.html";
if (filename.endsWith("/")) filename = filename.concat(defaultDocument);
else if (!filename.match(/\.[a-zA-Z0-9_-]+$/)) filename = filename.concat("/" + defaultDocument);
return getFilePathWithoutDefaultDocument({
root: options.root,
filename
});
};
const getFilePathWithoutDefaultDocument = (options) => {
let root = options.root || "";
let filename = options.filename;
if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) return;
filename = filename.replace(/^\.?[\/\\]/, "");
filename = filename.replace(/\\/g, "/");
root = root.replace(/\/$/, "");
let path = root ? root + "/" + filename : filename;
path = path.replace(/^\.?\//, "");
if (root[0] !== "/" && path[0] === "/") return;
return path;
};
//#endregion
export { getFilePath, getFilePathWithoutDefaultDocument };
@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = filterItems;
exports.isRequired = isRequired;
exports.targetsSupported = targetsSupported;
var _semver = require("semver");
var _utils = require("./utils.js");
const pluginsCompatData = require("@babel/compat-data/plugins");
function targetsSupported(target, support) {
const targetEnvironments = Object.keys(target);
if (targetEnvironments.length === 0) {
return false;
}
const unsupportedEnvironments = targetEnvironments.filter(environment => {
const lowestImplementedVersion = (0, _utils.getLowestImplementedVersion)(support, environment);
if (!lowestImplementedVersion) {
return true;
}
const lowestTargetedVersion = target[environment];
if ((0, _utils.isUnreleasedVersion)(lowestTargetedVersion, environment)) {
return false;
}
if ((0, _utils.isUnreleasedVersion)(lowestImplementedVersion, environment)) {
return true;
}
if (!_semver.valid(lowestTargetedVersion.toString())) {
throw new Error(`Invalid version passed for target "${environment}": "${lowestTargetedVersion}". ` + "Versions must be in semver format (major.minor.patch)");
}
return _semver.gt((0, _utils.semverify)(lowestImplementedVersion), lowestTargetedVersion.toString());
});
return unsupportedEnvironments.length === 0;
}
function isRequired(name, targets, {
compatData = pluginsCompatData,
includes,
excludes
} = {}) {
if (excludes != null && excludes.has(name)) return false;
if (includes != null && includes.has(name)) return true;
return !targetsSupported(targets, compatData[name]);
}
function filterItems(list, includes, excludes, targets, defaultIncludes, defaultExcludes, pluginSyntaxMap) {
const result = new Set();
const options = {
compatData: list,
includes,
excludes
};
for (const item in list) {
if (isRequired(item, targets, options)) {
result.add(item);
} else if (pluginSyntaxMap) {
const shippedProposalsSyntax = pluginSyntaxMap.get(item);
if (shippedProposalsSyntax) {
result.add(shippedProposalsSyntax);
}
}
}
defaultIncludes == null || defaultIncludes.forEach(item => !excludes.has(item) && result.add(item));
defaultExcludes == null || defaultExcludes.forEach(item => !includes.has(item) && result.delete(item));
return result;
}
//# sourceMappingURL=filter-items.js.map
@@ -0,0 +1,115 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var charCodes; (function (charCodes) {
const backSpace = 8; charCodes[charCodes["backSpace"] = backSpace] = "backSpace";
const lineFeed = 10; charCodes[charCodes["lineFeed"] = lineFeed] = "lineFeed"; // '\n'
const tab = 9; charCodes[charCodes["tab"] = tab] = "tab"; // '\t'
const carriageReturn = 13; charCodes[charCodes["carriageReturn"] = carriageReturn] = "carriageReturn"; // '\r'
const shiftOut = 14; charCodes[charCodes["shiftOut"] = shiftOut] = "shiftOut";
const space = 32; charCodes[charCodes["space"] = space] = "space";
const exclamationMark = 33; charCodes[charCodes["exclamationMark"] = exclamationMark] = "exclamationMark"; // '!'
const quotationMark = 34; charCodes[charCodes["quotationMark"] = quotationMark] = "quotationMark"; // '"'
const numberSign = 35; charCodes[charCodes["numberSign"] = numberSign] = "numberSign"; // '#'
const dollarSign = 36; charCodes[charCodes["dollarSign"] = dollarSign] = "dollarSign"; // '$'
const percentSign = 37; charCodes[charCodes["percentSign"] = percentSign] = "percentSign"; // '%'
const ampersand = 38; charCodes[charCodes["ampersand"] = ampersand] = "ampersand"; // '&'
const apostrophe = 39; charCodes[charCodes["apostrophe"] = apostrophe] = "apostrophe"; // '''
const leftParenthesis = 40; charCodes[charCodes["leftParenthesis"] = leftParenthesis] = "leftParenthesis"; // '('
const rightParenthesis = 41; charCodes[charCodes["rightParenthesis"] = rightParenthesis] = "rightParenthesis"; // ')'
const asterisk = 42; charCodes[charCodes["asterisk"] = asterisk] = "asterisk"; // '*'
const plusSign = 43; charCodes[charCodes["plusSign"] = plusSign] = "plusSign"; // '+'
const comma = 44; charCodes[charCodes["comma"] = comma] = "comma"; // ','
const dash = 45; charCodes[charCodes["dash"] = dash] = "dash"; // '-'
const dot = 46; charCodes[charCodes["dot"] = dot] = "dot"; // '.'
const slash = 47; charCodes[charCodes["slash"] = slash] = "slash"; // '/'
const digit0 = 48; charCodes[charCodes["digit0"] = digit0] = "digit0"; // '0'
const digit1 = 49; charCodes[charCodes["digit1"] = digit1] = "digit1"; // '1'
const digit2 = 50; charCodes[charCodes["digit2"] = digit2] = "digit2"; // '2'
const digit3 = 51; charCodes[charCodes["digit3"] = digit3] = "digit3"; // '3'
const digit4 = 52; charCodes[charCodes["digit4"] = digit4] = "digit4"; // '4'
const digit5 = 53; charCodes[charCodes["digit5"] = digit5] = "digit5"; // '5'
const digit6 = 54; charCodes[charCodes["digit6"] = digit6] = "digit6"; // '6'
const digit7 = 55; charCodes[charCodes["digit7"] = digit7] = "digit7"; // '7'
const digit8 = 56; charCodes[charCodes["digit8"] = digit8] = "digit8"; // '8'
const digit9 = 57; charCodes[charCodes["digit9"] = digit9] = "digit9"; // '9'
const colon = 58; charCodes[charCodes["colon"] = colon] = "colon"; // ':'
const semicolon = 59; charCodes[charCodes["semicolon"] = semicolon] = "semicolon"; // ';'
const lessThan = 60; charCodes[charCodes["lessThan"] = lessThan] = "lessThan"; // '<'
const equalsTo = 61; charCodes[charCodes["equalsTo"] = equalsTo] = "equalsTo"; // '='
const greaterThan = 62; charCodes[charCodes["greaterThan"] = greaterThan] = "greaterThan"; // '>'
const questionMark = 63; charCodes[charCodes["questionMark"] = questionMark] = "questionMark"; // '?'
const atSign = 64; charCodes[charCodes["atSign"] = atSign] = "atSign"; // '@'
const uppercaseA = 65; charCodes[charCodes["uppercaseA"] = uppercaseA] = "uppercaseA"; // 'A'
const uppercaseB = 66; charCodes[charCodes["uppercaseB"] = uppercaseB] = "uppercaseB"; // 'B'
const uppercaseC = 67; charCodes[charCodes["uppercaseC"] = uppercaseC] = "uppercaseC"; // 'C'
const uppercaseD = 68; charCodes[charCodes["uppercaseD"] = uppercaseD] = "uppercaseD"; // 'D'
const uppercaseE = 69; charCodes[charCodes["uppercaseE"] = uppercaseE] = "uppercaseE"; // 'E'
const uppercaseF = 70; charCodes[charCodes["uppercaseF"] = uppercaseF] = "uppercaseF"; // 'F'
const uppercaseG = 71; charCodes[charCodes["uppercaseG"] = uppercaseG] = "uppercaseG"; // 'G'
const uppercaseH = 72; charCodes[charCodes["uppercaseH"] = uppercaseH] = "uppercaseH"; // 'H'
const uppercaseI = 73; charCodes[charCodes["uppercaseI"] = uppercaseI] = "uppercaseI"; // 'I'
const uppercaseJ = 74; charCodes[charCodes["uppercaseJ"] = uppercaseJ] = "uppercaseJ"; // 'J'
const uppercaseK = 75; charCodes[charCodes["uppercaseK"] = uppercaseK] = "uppercaseK"; // 'K'
const uppercaseL = 76; charCodes[charCodes["uppercaseL"] = uppercaseL] = "uppercaseL"; // 'L'
const uppercaseM = 77; charCodes[charCodes["uppercaseM"] = uppercaseM] = "uppercaseM"; // 'M'
const uppercaseN = 78; charCodes[charCodes["uppercaseN"] = uppercaseN] = "uppercaseN"; // 'N'
const uppercaseO = 79; charCodes[charCodes["uppercaseO"] = uppercaseO] = "uppercaseO"; // 'O'
const uppercaseP = 80; charCodes[charCodes["uppercaseP"] = uppercaseP] = "uppercaseP"; // 'P'
const uppercaseQ = 81; charCodes[charCodes["uppercaseQ"] = uppercaseQ] = "uppercaseQ"; // 'Q'
const uppercaseR = 82; charCodes[charCodes["uppercaseR"] = uppercaseR] = "uppercaseR"; // 'R'
const uppercaseS = 83; charCodes[charCodes["uppercaseS"] = uppercaseS] = "uppercaseS"; // 'S'
const uppercaseT = 84; charCodes[charCodes["uppercaseT"] = uppercaseT] = "uppercaseT"; // 'T'
const uppercaseU = 85; charCodes[charCodes["uppercaseU"] = uppercaseU] = "uppercaseU"; // 'U'
const uppercaseV = 86; charCodes[charCodes["uppercaseV"] = uppercaseV] = "uppercaseV"; // 'V'
const uppercaseW = 87; charCodes[charCodes["uppercaseW"] = uppercaseW] = "uppercaseW"; // 'W'
const uppercaseX = 88; charCodes[charCodes["uppercaseX"] = uppercaseX] = "uppercaseX"; // 'X'
const uppercaseY = 89; charCodes[charCodes["uppercaseY"] = uppercaseY] = "uppercaseY"; // 'Y'
const uppercaseZ = 90; charCodes[charCodes["uppercaseZ"] = uppercaseZ] = "uppercaseZ"; // 'Z'
const leftSquareBracket = 91; charCodes[charCodes["leftSquareBracket"] = leftSquareBracket] = "leftSquareBracket"; // '['
const backslash = 92; charCodes[charCodes["backslash"] = backslash] = "backslash"; // '\ '
const rightSquareBracket = 93; charCodes[charCodes["rightSquareBracket"] = rightSquareBracket] = "rightSquareBracket"; // ']'
const caret = 94; charCodes[charCodes["caret"] = caret] = "caret"; // '^'
const underscore = 95; charCodes[charCodes["underscore"] = underscore] = "underscore"; // '_'
const graveAccent = 96; charCodes[charCodes["graveAccent"] = graveAccent] = "graveAccent"; // '`'
const lowercaseA = 97; charCodes[charCodes["lowercaseA"] = lowercaseA] = "lowercaseA"; // 'a'
const lowercaseB = 98; charCodes[charCodes["lowercaseB"] = lowercaseB] = "lowercaseB"; // 'b'
const lowercaseC = 99; charCodes[charCodes["lowercaseC"] = lowercaseC] = "lowercaseC"; // 'c'
const lowercaseD = 100; charCodes[charCodes["lowercaseD"] = lowercaseD] = "lowercaseD"; // 'd'
const lowercaseE = 101; charCodes[charCodes["lowercaseE"] = lowercaseE] = "lowercaseE"; // 'e'
const lowercaseF = 102; charCodes[charCodes["lowercaseF"] = lowercaseF] = "lowercaseF"; // 'f'
const lowercaseG = 103; charCodes[charCodes["lowercaseG"] = lowercaseG] = "lowercaseG"; // 'g'
const lowercaseH = 104; charCodes[charCodes["lowercaseH"] = lowercaseH] = "lowercaseH"; // 'h'
const lowercaseI = 105; charCodes[charCodes["lowercaseI"] = lowercaseI] = "lowercaseI"; // 'i'
const lowercaseJ = 106; charCodes[charCodes["lowercaseJ"] = lowercaseJ] = "lowercaseJ"; // 'j'
const lowercaseK = 107; charCodes[charCodes["lowercaseK"] = lowercaseK] = "lowercaseK"; // 'k'
const lowercaseL = 108; charCodes[charCodes["lowercaseL"] = lowercaseL] = "lowercaseL"; // 'l'
const lowercaseM = 109; charCodes[charCodes["lowercaseM"] = lowercaseM] = "lowercaseM"; // 'm'
const lowercaseN = 110; charCodes[charCodes["lowercaseN"] = lowercaseN] = "lowercaseN"; // 'n'
const lowercaseO = 111; charCodes[charCodes["lowercaseO"] = lowercaseO] = "lowercaseO"; // 'o'
const lowercaseP = 112; charCodes[charCodes["lowercaseP"] = lowercaseP] = "lowercaseP"; // 'p'
const lowercaseQ = 113; charCodes[charCodes["lowercaseQ"] = lowercaseQ] = "lowercaseQ"; // 'q'
const lowercaseR = 114; charCodes[charCodes["lowercaseR"] = lowercaseR] = "lowercaseR"; // 'r'
const lowercaseS = 115; charCodes[charCodes["lowercaseS"] = lowercaseS] = "lowercaseS"; // 's'
const lowercaseT = 116; charCodes[charCodes["lowercaseT"] = lowercaseT] = "lowercaseT"; // 't'
const lowercaseU = 117; charCodes[charCodes["lowercaseU"] = lowercaseU] = "lowercaseU"; // 'u'
const lowercaseV = 118; charCodes[charCodes["lowercaseV"] = lowercaseV] = "lowercaseV"; // 'v'
const lowercaseW = 119; charCodes[charCodes["lowercaseW"] = lowercaseW] = "lowercaseW"; // 'w'
const lowercaseX = 120; charCodes[charCodes["lowercaseX"] = lowercaseX] = "lowercaseX"; // 'x'
const lowercaseY = 121; charCodes[charCodes["lowercaseY"] = lowercaseY] = "lowercaseY"; // 'y'
const lowercaseZ = 122; charCodes[charCodes["lowercaseZ"] = lowercaseZ] = "lowercaseZ"; // 'z'
const leftCurlyBrace = 123; charCodes[charCodes["leftCurlyBrace"] = leftCurlyBrace] = "leftCurlyBrace"; // '{'
const verticalBar = 124; charCodes[charCodes["verticalBar"] = verticalBar] = "verticalBar"; // '|'
const rightCurlyBrace = 125; charCodes[charCodes["rightCurlyBrace"] = rightCurlyBrace] = "rightCurlyBrace"; // '}'
const tilde = 126; charCodes[charCodes["tilde"] = tilde] = "tilde"; // '~'
const nonBreakingSpace = 160; charCodes[charCodes["nonBreakingSpace"] = nonBreakingSpace] = "nonBreakingSpace";
// eslint-disable-next-line no-irregular-whitespace
const oghamSpaceMark = 5760; charCodes[charCodes["oghamSpaceMark"] = oghamSpaceMark] = "oghamSpaceMark"; // ' '
const lineSeparator = 8232; charCodes[charCodes["lineSeparator"] = lineSeparator] = "lineSeparator";
const paragraphSeparator = 8233; charCodes[charCodes["paragraphSeparator"] = paragraphSeparator] = "paragraphSeparator";
})(charCodes || (exports.charCodes = charCodes = {}));
function isDigit(code) {
return (
(code >= charCodes.digit0 && code <= charCodes.digit9) ||
(code >= charCodes.lowercaseA && code <= charCodes.lowercaseF) ||
(code >= charCodes.uppercaseA && code <= charCodes.uppercaseF)
);
} exports.isDigit = isDigit;
@@ -0,0 +1,9 @@
import SemVer = require("../classes/semver");
import semver = require("../index");
/**
* Return the minor version number.
*/
declare function minor(version: string | SemVer, optionsOrLoose?: boolean | semver.Options): number;
export = minor;
@@ -0,0 +1 @@
{"version":3,"file":"x-circle.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,826 @@
flf2a$ 8 6 15 -1 9
nancyj.flf
named after the login of a woman who asked me to make her a
sig. this is the font that came out of it. this is my first
attempt at a figlet font, so leave me alone.
vampyr@acs.bu.edu
$$ @
$$ @
$$ @
$$ @
$$ @
$$ @
$$ @
$$ @@
dP @
88 @
88 @
dP @
@
oo @
@
@@
dP dP @
dP dP @
@
@
@
@
@
@@
@
dP dP @
8888888 @
88 88 @
8888888 @
dP dP @
@
@@
# # @
.d8888P' @
Y8#oo#o. @
# #88 @
`88888P' @
# # @
@
@@
d8P dP @
8 8 d8' @
Y8P d8' @
d8' d8P @
d8' 8 8 @
88 Y8P @
@
@@
d88b @
8`'8 @
d8b @
d8P`8b @
d8' `8bP @
`888P'`YP @
@
@@
d8 @
88 @
.P @
@
@
@
@
@@
a88P @
d8' @
88 @
88 @
Y8. @
Y88b @
@
@@
Y88o @
`8b @
88 @
88 @
.8P @
d88Y @
@
@@
dP @
8b. 88 .d8 @
`8b88d8' @
.8P88Y8. @
8P' 88 `Y8 @
dP @
@
@@
@
dP @
88 @
88888888 @
88 @
dP @
@
@@
@
@
@
@
dP @
88 @
.P @
@@
@
@
@
88888888 @
@
@
@
@@
@
@
@
@
dP @
88 @
@
@@
d8' @
d8' @
d8' @
d8' @
d8' @
88 @
@
@@
a8888a @
d8' ..8b @
88 .P 88 @
88 d' 88 @
Y8'' .8P @
Y8888P @
@
@@
d88 @
88 @
88 @
88 @
88 @
d88P @
@
@@
d8888b. @
`88 @
.aaadP' @
88' @
88. @
Y88888P @
@
@@
d8888b. @
`88 @
aaad8' @
`88 @
.88 @
d88888P @
@
@@
dP dP @
88 88 @
88aaa88 @
88 @
88 @
dP @
@
@@
888888P @
88' @
88baaa. @
`88 @
88 @
d88888P @
@
@@
.d8888P @
88' @
88baaa. @
88` `88 @
8b. .d8 @
`Y888P' @
@
@@
d88888P @
d8' @
d8' @
d8' @
d8' @
d8' @
@
@@
.d888b. @
Y8' `8P @
d8bad8b @
88` `88 @
8b. .88 @
Y88888P @
@
@@
.d888b. @
Y8' `88 @
`8bad88 @
`88 @
d. .88 @
`8888P @
@
@@
dP @
88 @
@
@
dP @
88 @
@
@@
dP @
88 @
@
@
dP @
88 @
.P @
@@
d8 @
d8' @
d8' @
Y8. @
Y8. @
Y8 @
@
@@
@
@
aaaaaaaa @
@
88888888 @
@
@
@@
8b @
`8b @
`8b @
.8P @
.8P @
8P @
@
@@
.d8888ba @
`8' `8b @
.d8' @
d8P' @
"" @
oo @
@
@@
a88888b. @
d8' `88 @
88 d8P 88 @
88 Yo8b88 @
Y8. @
Y88888P' @
@
@@
.d888888 @
d8' 88 @
88aaaaa88a @
88 88 @
88 88 @
88 88 @
@
@@
888888ba @
88 `8b @
a88aaaa8P' @
88 `8b. @
88 .88 @
88888888P @
@
@@
a88888b. @
d8' `88 @
88 @
88 @
Y8. .88 @
Y88888P' @
@
@@
888888ba @
88 `8b @
88 88 @
88 88 @
88 .8P @
8888888P @
@
@@
88888888b @
88 @
a88aaaa @
88 @
88 @
88888888P @
@
@@
88888888b @
88 @
a88aaaa @
88 @
88 @
dP @
@
@@
.88888. @
d8' `88 @
88 @
88 YP88 @
Y8. .88 @
`88888' @
@
@@
dP dP @
88 88 @
88aaaaa88a @
88 88 @
88 88 @
dP dP @
@
@@
dP @
88 @
88 @
88 @
88 @
dP @
@
@@
dP @
88 @
88 @
88 @
88. .d8P @
`Y8888' @
@
@@
dP dP @
88 .d8' @
88aaa8P' @
88 `8b. @
88 88 @
dP dP @
@
@@
dP @
88 @
88 @
88 @
88 @
88888888P @
@
@@
8888ba.88ba @
88 `8b `8b @
88 88 88 @
88 88 88 @
88 88 88 @
dP dP dP @
@
@@
888888ba @
88 `8b @
88 88 @
88 88 @
88 88 @
dP dP @
@
@@
.88888. @
d8' `8b @
88 88 @
88 88 @
Y8. .8P @
`8888P' @
@
@@
888888ba @
88 `8b @
a88aaaa8P' @
88 @
88 @
dP @
@
@@
.88888. @
d8' `8b @
88 88 @
88 db 88 @
Y8. Y88P @
`8888PY8b @
@
@@
888888ba @
88 `8b @
a88aaaa8P' @
88 `8b. @
88 88 @
dP dP @
@
@@
.d88888b @
88. "' @
`Y88888b. @
`8b @
d8' .8P @
Y88888P @
@
@@
d888888P @
88 @
88 @
88 @
88 @
dP @
@
@@
dP dP @
88 88 @
88 88 @
88 88 @
Y8. .8P @
`Y88888P' @
@
@@
dP dP @
88 88 @
88 .8P @
88 d8' @
88 .d8P @
888888' @
@
@@
dP dP dP @
88 88 88 @
88 .8P .8P @
88 d8' d8' @
88.d8P8.d8P @
8888' Y88' @
@
@@
dP dP @
Y8. .8P @
Y8aa8P @
d8' `8b @
88 88 @
dP dP @
@
@@
dP dP @
Y8. .8P @
Y8aa8P @
88 @
88 @
dP @
@
@@
d8888888P @
.d8' @
.d8' @
.d8' @
d8' @
Y8888888P @
@
@@
8888P @
88 @
88 @
88 @
88 @
88888 @
@
@@
Yb @
`Yb @
`Yb @
`Yb @
`Yb @
88 @
@
@@
d8888 @
88 @
88 @
88 @
88 @
88888 @
@
@@
db @
d8'`8b @
`" "' @
@
@
@
@
@@
@
@
@
@
@
@
oooooooooooo @
@@
dP @
88 @
Y. @
@
@
@
@
@@
@
@
.d8888b. @
88' `88 @
88. .88 @
`88888P8 @
@
@@
dP @
88 @
88d888b. @
88' `88 @
88. .88 @
88Y8888' @
@
@@
@
@
.d8888b. @
88' `"" @
88. ... @
`88888P' @
@
@@
dP @
88 @
.d888b88 @
88' `88 @
88. .88 @
`88888P8 @
@
@@
@
@
.d8888b. @
88ooood8 @
88. ... @
`88888P' @
@
@@
.8888b @
88 " @
88aaa @
88 @
88 @
dP @
@
@@
@
@
.d8888b. @
88' `88 @
88. .88 @
`8888P88 @
.88 @
d8888P @@
dP @
88 @
88d888b. @
88' `88 @
88 88 @
dP dP @
@
@@
oo @
@
dP @
88 @
88 @
dP @
@
@@
oo @
@
dP @
88 @
88 @
88 @
88 @
dP @@
dP @
88 @
88 .dP @
88888" @
88 `8b. @
dP `YP @
@
@@
dP @
88 @
88 @
88 @
88 @
dP @
@
@@
@
@
88d8b.d8b. @
88'`88'`88 @
88 88 88 @
dP dP dP @
@
@@
@
@
88d888b. @
88' `88 @
88 88 @
dP dP @
@
@@
@
@
.d8888b. @
88' `88 @
88. .88 @
`88888P' @
@
@@
@
@
88d888b. @
88' `88 @
88. .88 @
88Y888P' @
88 @
dP @@
@
@
.d8888b. @
88' `88 @
88. .88 @
`8888P88 @
88 @
dP @@
@
@
88d888b. @
88' `88 @
88 @
dP @
@
@@
@
@
.d8888b. @
Y8ooooo. @
88 @
`88888P' @
@
@@
dP @
88 @
d8888P @
88 @
88 @
dP @
@
@@
@
@
dP dP @
88 88 @
88. .88 @
`88888P' @
@
@@
@
@
dP .dP @
88 d8' @
88 .88' @
8888P' @
@
@@
@
@
dP dP dP @
88 88 88 @
88.88b.88' @
8888P Y8P @
@
@@
@
@
dP. .dP @
`8bd8' @
.d88b. @
dP' `dP @
@
@@
@
@
dP dP @
88 88 @
88. .88 @
`8888P88 @
.88 @
d8888P @@
@
@
d888888b @
.d8P' @
.Y8P @
d888888P @
@
@@
.d88P @
8: @
.oY8. @
d8 @
8: @
`Y88b @
@
@@
dP @
88 @
"' @
dP @
88 @
"' @
@
@@
d88b. @
:8 @
.8Yo. @
8b @
:8 @
Y88P' @
@
@@
.oo. .d @
dP" "d8P @
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2016_intl: LibDefinition;
@@ -0,0 +1,53 @@
import * as React from 'react';
import { styleSingleton } from 'react-style-singleton';
import { fullWidthClassName, zeroRightClassName, noScrollbarsClassName, removedBarSizeVariable } from './constants';
import { getGapWidth } from './utils';
var Style = styleSingleton();
export var lockAttribute = 'data-scroll-locked';
// important tip - once we measure scrollBar width and remove them
// we could not repeat this operation
// thus we are using style-singleton - only the first "yet correct" style will be applied.
var getStyles = function (_a, allowRelative, gapMode, important) {
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
if (gapMode === void 0) { gapMode = 'margin'; }
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
allowRelative && "position: relative ".concat(important, ";"),
gapMode === 'margin' &&
"\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
gapMode === 'padding' && "padding-right: ".concat(gap, "px ").concat(important, ";"),
]
.filter(Boolean)
.join(''), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
};
var getCurrentUseCounter = function () {
var counter = parseInt(document.body.getAttribute(lockAttribute) || '0', 10);
return isFinite(counter) ? counter : 0;
};
export var useLockAttribute = function () {
React.useEffect(function () {
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
return function () {
var newCounter = getCurrentUseCounter() - 1;
if (newCounter <= 0) {
document.body.removeAttribute(lockAttribute);
}
else {
document.body.setAttribute(lockAttribute, newCounter.toString());
}
};
}, []);
};
/**
* Removes page scrollbar and blocks page scroll when mounted
*/
export var RemoveScrollBar = function (_a) {
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? 'margin' : _b;
useLockAttribute();
/*
gap will be measured on every component mount
however it will be used only by the "first" invocation
due to singleton nature of <Style
*/
var gap = React.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]);
return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });
};
@@ -0,0 +1,159 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
*/
'use strict';
import type {HermesNode} from './HermesAST';
import type {ParserOptions} from './ParserOptions';
import HermesParserDeserializer from './HermesParserDeserializer';
import HermesParserWASMModule from './HermesParserWASM';
let HermesParserWASM;
let hermesParse;
let hermesParseResult_free;
let hermesParseResult_getError;
let hermesParseResult_getErrorLine;
let hermesParseResult_getErrorColumn;
let hermesParseResult_getProgramBuffer;
let hermesParseResult_getPositionBuffer;
let hermesParseResult_getPositionBufferSize;
/**
* Init the WASM wrapper code generated by `emscripten` to preparse the
* HermesParser WASM code.
*/
function initHermesParserWASM() {
if (HermesParserWASM != null) {
return;
}
HermesParserWASM = HermesParserWASMModule({
/**
* The emscripten version of `quit` unconditionally assigns the `status` to
* `process.exitCode` which overrides any pre-existing code that has been
* set, even if it is non zero. For our use case we never want an
* `exitCode` to be set so this override removes that functionality.
*/
quit(_status: number, toThrow: Error) {
throw toThrow;
},
});
hermesParse = HermesParserWASM.cwrap('hermesParse', 'number', [
'number',
'number',
'number',
'number',
'number',
'number',
]);
hermesParseResult_free = HermesParserWASM.cwrap(
'hermesParseResult_free',
'void',
['number'],
);
hermesParseResult_getError = HermesParserWASM.cwrap(
'hermesParseResult_getError',
'string',
['number'],
);
hermesParseResult_getErrorLine = HermesParserWASM.cwrap(
'hermesParseResult_getErrorLine',
'number',
['number'],
);
hermesParseResult_getErrorColumn = HermesParserWASM.cwrap(
'hermesParseResult_getErrorColumn',
'number',
['number'],
);
hermesParseResult_getProgramBuffer = HermesParserWASM.cwrap(
'hermesParseResult_getProgramBuffer',
'number',
['number'],
);
hermesParseResult_getPositionBuffer = HermesParserWASM.cwrap(
'hermesParseResult_getPositionBuffer',
'number',
['number'],
);
hermesParseResult_getPositionBufferSize = HermesParserWASM.cwrap(
'hermesParseResult_getPositionBufferSize',
'number',
['number'],
);
}
// Copy a string into the WASM heap and null-terminate
function copyToHeap(buffer: Buffer, addr: number) {
HermesParserWASM.HEAP8.set(buffer, addr);
HermesParserWASM.HEAP8[addr + buffer.length] = 0;
}
export function parse(source: string, options: ParserOptions): HermesNode {
initHermesParserWASM();
// Allocate space on heap for source text
const sourceBuffer = Buffer.from(source, 'utf8');
const sourceAddr = HermesParserWASM._malloc(sourceBuffer.length + 1);
if (!sourceAddr) {
throw new Error('Parser out of memory');
}
try {
// Copy source text onto WASM heap
copyToHeap(sourceBuffer, sourceAddr);
const parseResult = hermesParse(
sourceAddr,
sourceBuffer.length + 1,
options.flow === 'detect',
options.enableExperimentalComponentSyntax,
options.tokens,
options.allowReturnOutsideFunction,
);
try {
// Extract and throw error from parse result if parsing failed
const err = hermesParseResult_getError(parseResult);
if (err) {
const syntaxError = new SyntaxError(err);
// $FlowExpectedError[prop-missing]
syntaxError.loc = {
line: hermesParseResult_getErrorLine(parseResult),
column: hermesParseResult_getErrorColumn(parseResult),
};
throw syntaxError;
}
const deserializer = new HermesParserDeserializer(
hermesParseResult_getProgramBuffer(parseResult),
hermesParseResult_getPositionBuffer(parseResult),
hermesParseResult_getPositionBufferSize(parseResult),
HermesParserWASM,
options,
);
return deserializer.deserialize();
} finally {
hermesParseResult_free(parseResult);
}
} finally {
HermesParserWASM._free(sourceAddr);
}
}
@@ -0,0 +1,42 @@
/**
* @fileoverview Rule to flag statements with function invocation preceded by
* "new" and not part of assignment
* @author Ilya Volodin
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"Disallow `new` operators outside of assignments or comparisons",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-new",
},
schema: [],
messages: {
noNewStatement: "Do not use 'new' for side effects.",
},
},
create(context) {
return {
"ExpressionStatement > NewExpression"(node) {
context.report({
node: node.parent,
messageId: "noNewStatement",
});
},
};
},
};
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const FileX = createLucideIcon("FileX", [
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
["path", { d: "m14.5 12.5-5 5", key: "b62r18" }],
["path", { d: "m9.5 12.5 5 5", key: "1rk7el" }]
]);
export { FileX as default };
//# sourceMappingURL=file-x.js.map
@@ -0,0 +1 @@
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../../src/server/stdio.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAmC;AAEnC,iDAAkE;AAIlE;;;;GAIG;AACH,MAAa,oBAAoB;IAI7B,YACY,SAAmB,sBAAO,CAAC,KAAK,EAChC,UAAoB,sBAAO,CAAC,MAAM,EAC1C,OAQC;QAVO,WAAM,GAAN,MAAM,CAA0B;QAChC,YAAO,GAAP,OAAO,CAA2B;QAJtC,aAAQ,GAAG,KAAK,CAAC;QAsBzB,gFAAgF;QAChF,YAAO,GAAG,CAAC,KAAa,EAAE,EAAE;YACxB,IAAI,CAAC;gBACD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC/B,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC7B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,OAAO,EAAE,CAAC,KAAc,CAAC,CAAC;gBAC/B,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACjC,CAAC;QACL,CAAC,CAAC;QACF,aAAQ,GAAG,CAAC,KAAY,EAAE,EAAE;YACxB,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC,CAAC;QAnBE,IAAI,CAAC,WAAW,GAAG,IAAI,qBAAU,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;IACjF,CAAC;IAoBD;;OAEG;IACH,KAAK,CAAC,KAAK;QACP,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACX,+GAA+G,CAClH,CAAC;QACN,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAEO,iBAAiB;QACrB,OAAO,IAAI,EAAE,CAAC;YACV,IAAI,CAAC;gBACD,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;gBAC/C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;oBACnB,MAAM;gBACV,CAAC;gBAED,IAAI,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC;YAC9B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,OAAO,EAAE,CAAC,KAAc,CAAC,CAAC;YACnC,CAAC;QACL,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAK;QACP,mCAAmC;QACnC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAExC,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACjE,IAAI,sBAAsB,KAAK,CAAC,EAAE,CAAC;YAC/B,gDAAgD;YAChD,0FAA0F;YAC1F,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;QAED,sCAAsC;QACtC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,OAAuB;QACxB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;YACzB,MAAM,IAAI,GAAG,IAAA,2BAAgB,EAAC,OAAO,CAAC,CAAC;YACvC,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3B,OAAO,EAAE,CAAC;YACd,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxC,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAhGD,oDAgGC"}
@@ -0,0 +1 @@
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../web/file.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,UAAU,KAsCd,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1 @@
{"version":3,"file":"RouterProvider.js","names":[],"sources":["../../src/RouterProvider.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { hasKeys } from '@tanstack/router-core'\nimport { Matches } from './Matches'\nimport { routerContext } from './routerContext'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterOptions,\n} from '@tanstack/router-core'\n\n/**\n * Low-level provider that places the router into React context and optionally\n * updates router options from props. Most apps should use `RouterProvider`.\n */\nexport function RouterContextProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({\n router,\n children,\n ...rest\n}: RouterProps<TRouter, TDehydrated> & {\n children: React.ReactNode\n}) {\n if (hasKeys(rest)) {\n // Allow the router to update options on the router instance\n router.update({\n ...router.options,\n ...rest,\n context: {\n ...router.options.context,\n ...rest.context,\n },\n })\n }\n\n const provider = (\n <routerContext.Provider value={router as AnyRouter}>\n {children}\n </routerContext.Provider>\n )\n\n if (router.options.Wrap) {\n return <router.options.Wrap>{provider}</router.options.Wrap>\n }\n\n return provider\n}\n\n/**\n * Top-level component that renders the active route matches and provides the\n * router to the React tree via context.\n *\n * Accepts the same options as `createRouter` via props to update the router\n * instance after creation.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction\n */\nexport function RouterProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n return (\n <RouterContextProvider router={router} {...rest}>\n <Matches />\n </RouterContextProvider>\n )\n}\n\nexport type RouterProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n NonNullable<TRouter['options']['defaultStructuralSharing']>,\n TRouter['history'],\n TDehydrated\n >,\n 'context'\n> & {\n router: TRouter\n context?: Partial<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n NonNullable<TRouter['options']['defaultStructuralSharing']>,\n TRouter['history'],\n TDehydrated\n >['context']\n >\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgB,sBAGd,EACA,QACA,UACA,GAAG,QAGF;AACD,KAAI,QAAQ,KAAK,CAEf,QAAO,OAAO;EACZ,GAAG,OAAO;EACV,GAAG;EACH,SAAS;GACP,GAAG,OAAO,QAAQ;GAClB,GAAG,KAAK;GACT;EACF,CAAC;CAGJ,MAAM,WACJ,oBAAC,cAAc,UAAf;EAAwB,OAAO;EAC5B;EACsB,CAAA;AAG3B,KAAI,OAAO,QAAQ,KACjB,QAAO,oBAAC,OAAO,QAAQ,MAAhB,EAAA,UAAsB,UAA+B,CAAA;AAG9D,QAAO;;;;;;;;;;;AAYT,SAAgB,eAGd,EAAE,QAAQ,GAAG,QAA2C;AACxD,QACE,oBAAC,uBAAD;EAA+B;EAAQ,GAAI;YACzC,oBAAC,SAAD,EAAW,CAAA;EACW,CAAA"}
@@ -0,0 +1,179 @@
import { JOSEError, JWKSNoMatchingKey, JWKSTimeout } from '../util/errors.js';
import { createLocalJWKSet } from './local.js';
import { isObject } from '../lib/type_checks.js';
function isCloudflareWorkers() {
return (typeof WebSocketPair !== 'undefined' ||
(typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') ||
(typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel'));
}
let USER_AGENT;
if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
const NAME = 'jose';
const VERSION = 'v6.2.3';
USER_AGENT = `${NAME}/${VERSION}`;
}
export const customFetch = Symbol();
async function fetchJwks(url, headers, signal, fetchImpl = fetch) {
const response = await fetchImpl(url, {
method: 'GET',
signal,
redirect: 'manual',
headers,
}).catch((err) => {
if (err.name === 'TimeoutError') {
throw new JWKSTimeout();
}
throw err;
});
if (response.status !== 200) {
throw new JOSEError('Expected 200 OK from the JSON Web Key Set HTTP response');
}
try {
return await response.json();
}
catch {
throw new JOSEError('Failed to parse the JSON Web Key Set HTTP response as JSON');
}
}
export const jwksCache = Symbol();
function isFreshJwksCache(input, cacheMaxAge) {
if (typeof input !== 'object' || input === null) {
return false;
}
if (!('uat' in input) || typeof input.uat !== 'number' || Date.now() - input.uat >= cacheMaxAge) {
return false;
}
if (!('jwks' in input) ||
!isObject(input.jwks) ||
!Array.isArray(input.jwks.keys) ||
!Array.prototype.every.call(input.jwks.keys, isObject)) {
return false;
}
return true;
}
class RemoteJWKSet {
#url;
#timeoutDuration;
#cooldownDuration;
#cacheMaxAge;
#jwksTimestamp;
#pendingFetch;
#headers;
#customFetch;
#local;
#cache;
constructor(url, options) {
if (!(url instanceof URL)) {
throw new TypeError('url must be an instance of URL');
}
this.#url = new URL(url.href);
this.#timeoutDuration =
typeof options?.timeoutDuration === 'number' ? options?.timeoutDuration : 5000;
this.#cooldownDuration =
typeof options?.cooldownDuration === 'number' ? options?.cooldownDuration : 30000;
this.#cacheMaxAge = typeof options?.cacheMaxAge === 'number' ? options?.cacheMaxAge : 600000;
this.#headers = new Headers(options?.headers);
if (USER_AGENT && !this.#headers.has('User-Agent')) {
this.#headers.set('User-Agent', USER_AGENT);
}
if (!this.#headers.has('accept')) {
this.#headers.set('accept', 'application/json');
this.#headers.append('accept', 'application/jwk-set+json');
}
this.#customFetch = options?.[customFetch];
if (options?.[jwksCache] !== undefined) {
this.#cache = options?.[jwksCache];
if (isFreshJwksCache(options?.[jwksCache], this.#cacheMaxAge)) {
this.#jwksTimestamp = this.#cache.uat;
this.#local = createLocalJWKSet(this.#cache.jwks);
}
}
}
pendingFetch() {
return !!this.#pendingFetch;
}
coolingDown() {
return typeof this.#jwksTimestamp === 'number'
? Date.now() < this.#jwksTimestamp + this.#cooldownDuration
: false;
}
fresh() {
return typeof this.#jwksTimestamp === 'number'
? Date.now() < this.#jwksTimestamp + this.#cacheMaxAge
: false;
}
jwks() {
return this.#local?.jwks();
}
async getKey(protectedHeader, token) {
if (!this.#local || !this.fresh()) {
await this.reload();
}
try {
return await this.#local(protectedHeader, token);
}
catch (err) {
if (err instanceof JWKSNoMatchingKey) {
if (this.coolingDown() === false) {
await this.reload();
return this.#local(protectedHeader, token);
}
}
throw err;
}
}
async reload() {
if (this.#pendingFetch && isCloudflareWorkers()) {
this.#pendingFetch = undefined;
}
this.#pendingFetch ||= fetchJwks(this.#url.href, this.#headers, AbortSignal.timeout(this.#timeoutDuration), this.#customFetch)
.then((json) => {
this.#local = createLocalJWKSet(json);
if (this.#cache) {
this.#cache.uat = Date.now();
this.#cache.jwks = json;
}
this.#jwksTimestamp = Date.now();
this.#pendingFetch = undefined;
})
.catch((err) => {
this.#pendingFetch = undefined;
throw err;
});
await this.#pendingFetch;
}
}
export function createRemoteJWKSet(url, options) {
const set = new RemoteJWKSet(url, options);
const remoteJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);
Object.defineProperties(remoteJWKSet, {
coolingDown: {
get: () => set.coolingDown(),
enumerable: true,
configurable: false,
},
fresh: {
get: () => set.fresh(),
enumerable: true,
configurable: false,
},
reload: {
value: () => set.reload(),
enumerable: true,
configurable: false,
writable: false,
},
reloading: {
get: () => set.pendingFetch(),
enumerable: true,
configurable: false,
},
jwks: {
value: () => set.jwks(),
enumerable: true,
configurable: false,
writable: false,
},
});
return remoteJWKSet;
}
@@ -0,0 +1,50 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
type FileNode = {
name: SerovalNode;
options: SerovalNode;
buffer: SerovalNode;
};
const FilePlugin = /* @__PURE__ */ createPlugin<File, FileNode>({
tag: 'seroval-plugins/web/File',
test(value) {
if (typeof File === 'undefined') {
return false;
}
return value instanceof File;
},
parse: {
async async(value, ctx) {
return {
name: await ctx.parse(value.name),
options: await ctx.parse({
type: value.type,
lastModified: value.lastModified,
}),
buffer: await ctx.parse(await value.arrayBuffer()),
};
},
},
serialize(node, ctx) {
return (
'new File([' +
ctx.serialize(node.buffer) +
'],' +
ctx.serialize(node.name) +
',' +
ctx.serialize(node.options) +
')'
);
},
deserialize(node, ctx) {
return new File(
[ctx.deserialize(node.buffer) as ArrayBuffer],
ctx.deserialize(node.name) as string,
ctx.deserialize(node.options) as FilePropertyBag,
);
},
});
export default FilePlugin;
@@ -0,0 +1,220 @@
import utils from './utils.mjs';
import estimateGuesses from './estimate.mjs';
import { MIN_GUESSES_BEFORE_GROWING_SEQUENCE } from '../data/const.mjs';
class Scoring {
constructor(options) {
this.options = options;
this.password = '';
this.optimal = {};
this.excludeAdditive = false;
}
fillArray(size, valueType) {
const result = [];
for (let i = 0; i < size; i += 1) {
let value = [];
if (valueType === 'object') {
value = {};
}
result.push(value);
}
return result;
}
// helper: make bruteforce match objects spanning i to j, inclusive.
makeBruteforceMatch(i, j) {
return {
pattern: 'bruteforce',
token: this.password.slice(i, j + 1 || 9e9),
i,
j
};
}
// helper: considers whether a length-sequenceLength
// sequence ending at match bestMatches is better (fewer guesses)
// than previously encountered sequences, updating state if so.
// eslint-disable-next-line max-statements
update(match, sequenceLength) {
const k = match.j;
const estimatedMatch = estimateGuesses(this.options, match, this.password);
let pi = estimatedMatch.guesses;
if (sequenceLength > 1) {
// we're considering a length-sequenceLength sequence ending with match bestMatches:
// obtain the product term in the minimization function by multiplying bestMatches's guesses
// by the product of the length-(sequenceLength-1)
// sequence ending just before bestMatches, at bestMatches.i - 1.
pi *= this.optimal.guessesProduct[estimatedMatch.i - 1][sequenceLength - 1];
}
// calculate the minimization func
let g = utils.factorial(sequenceLength) * pi;
if (!this.excludeAdditive) {
g += MIN_GUESSES_BEFORE_GROWING_SEQUENCE ** (sequenceLength - 1);
}
// update state if new best.
// first see if any competing sequences covering this prefix,
// with sequenceLength or fewer matches,
// fare better than this sequence. if so, skip it and return.
let shouldSkip = false;
const competingG = this.optimal.totalGuesses[k];
Object.keys(competingG).forEach(competingPatternLengthStr => {
const competingPatternLength = parseInt(competingPatternLengthStr, 10);
const competingMetricMatch = competingG[competingPatternLength];
if (competingPatternLength <= sequenceLength) {
if (competingMetricMatch <= g) {
shouldSkip = true;
}
}
});
if (!shouldSkip) {
// this sequence might be part of the final optimal sequence.
this.optimal.totalGuesses[k][sequenceLength] = g;
this.optimal.bestMatches[k][sequenceLength] = estimatedMatch;
this.optimal.guessesProduct[k][sequenceLength] = pi;
}
}
// helper: evaluate bruteforce matches ending at passwordCharIndex.
bruteforceUpdate(passwordCharIndex) {
// see if a single bruteforce match spanning the passwordCharIndex-prefix is optimal.
let match = this.makeBruteforceMatch(0, passwordCharIndex);
this.update(match, 1);
for (let i = 1; i <= passwordCharIndex; i += 1) {
// generate passwordCharIndex bruteforce matches, spanning from (i=1, j=passwordCharIndex) up to (i=passwordCharIndex, j=passwordCharIndex).
// see if adding these new matches to any of the sequences in optimal[i-1]
// leads to new bests.
match = this.makeBruteforceMatch(i, passwordCharIndex);
const tmp = this.optimal.bestMatches[i - 1];
Object.keys(tmp).forEach(sequenceLengthStr => {
const sequenceLength = parseInt(sequenceLengthStr, 10);
const lastMatch = tmp[sequenceLength];
// corner: an optimal sequence will never have two adjacent bruteforce matches.
// it is strictly better to have a single bruteforce match spanning the same region:
// same contribution to the guess product with a lower length.
// --> safe to skip those cases.
if (lastMatch.pattern !== 'bruteforce') {
// try adding bestMatches to this length-sequenceLength sequence.
this.update(match, sequenceLength + 1);
}
});
}
}
// helper: step backwards through optimal.bestMatches starting at the end,
// constructing the final optimal match sequence.
unwind(passwordLength) {
const optimalMatchSequence = [];
let k = passwordLength - 1;
// find the final best sequence length and score
let sequenceLength = 0;
// eslint-disable-next-line no-loss-of-precision
let g = 2e308;
const temp = this.optimal.totalGuesses[k];
// safety check for empty passwords
if (temp) {
Object.keys(temp).forEach(candidateSequenceLengthStr => {
const candidateSequenceLength = parseInt(candidateSequenceLengthStr, 10);
const candidateMetricMatch = temp[candidateSequenceLength];
if (candidateMetricMatch < g) {
sequenceLength = candidateSequenceLength;
g = candidateMetricMatch;
}
});
}
while (k >= 0) {
const match = this.optimal.bestMatches[k][sequenceLength];
optimalMatchSequence.unshift(match);
k = match.i - 1;
sequenceLength -= 1;
}
return optimalMatchSequence;
}
// ------------------------------------------------------------------------------
// search --- most guessable match sequence -------------------------------------
// ------------------------------------------------------------------------------
//
// takes a sequence of overlapping matches, returns the non-overlapping sequence with
// minimum guesses. the following is a O(l_max * (n + m)) dynamic programming algorithm
// for a length-n password with m candidate matches. l_max is the maximum optimal
// sequence length spanning each prefix of the password. In practice it rarely exceeds 5 and the
// search terminates rapidly.
//
// the optimal "minimum guesses" sequence is here defined to be the sequence that
// minimizes the following function:
//
// totalGuesses = sequenceLength! * Product(m.guesses for m in sequence) + D^(sequenceLength - 1)
//
// where sequenceLength is the length of the sequence.
//
// the factorial term is the number of ways to order sequenceLength patterns.
//
// the D^(sequenceLength-1) term is another length penalty, roughly capturing the idea that an
// attacker will try lower-length sequences first before trying length-sequenceLength sequences.
//
// for example, consider a sequence that is date-repeat-dictionary.
// - an attacker would need to try other date-repeat-dictionary combinations,
// hence the product term.
// - an attacker would need to try repeat-date-dictionary, dictionary-repeat-date,
// ..., hence the factorial term.
// - an attacker would also likely try length-1 (dictionary) and length-2 (dictionary-date)
// sequences before length-3. assuming at minimum D guesses per pattern type,
// D^(sequenceLength-1) approximates Sum(D^i for i in [1..sequenceLength-1]
//
// ------------------------------------------------------------------------------
mostGuessableMatchSequence(password, matches, excludeAdditive = false) {
this.password = password;
this.excludeAdditive = excludeAdditive;
const passwordLength = password.length;
// partition matches into sublists according to ending index j
let matchesByCoordinateJ = this.fillArray(passwordLength, 'array');
matches.forEach(match => {
matchesByCoordinateJ[match.j].push(match);
});
// small detail: for deterministic output, sort each sublist by i.
matchesByCoordinateJ = matchesByCoordinateJ.map(match => match.sort((m1, m2) => m1.i - m2.i));
this.optimal = {
// optimal.bestMatches[k][sequenceLength] holds final match in the best length-sequenceLength
// match sequence covering the
// password prefix up to k, inclusive.
// if there is no length-sequenceLength sequence that scores better (fewer guesses) than
// a shorter match sequence spanning the same prefix,
// optimal.bestMatches[k][sequenceLength] is undefined.
bestMatches: this.fillArray(passwordLength, 'object'),
// same structure as optimal.bestMatches -- holds the product term Prod(bestMatches.guesses for bestMatches in sequence).
// optimal.guessesProduct allows for fast (non-looping) updates to the minimization function.
guessesProduct: this.fillArray(passwordLength, 'object'),
// same structure as optimal.bestMatches -- holds the overall metric.
totalGuesses: this.fillArray(passwordLength, 'object')
};
for (let k = 0; k < passwordLength; k += 1) {
matchesByCoordinateJ[k].forEach(match => {
if (match.i > 0) {
const prevM = this.optimal.bestMatches[match.i - 1];
Object.keys(prevM).forEach(sequenceLengthStr => {
const sequenceLength = parseInt(sequenceLengthStr, 10);
this.update(match, sequenceLength + 1);
});
} else {
this.update(match, 1);
}
});
this.bruteforceUpdate(k);
}
const optimalMatchSequence = this.unwind(passwordLength);
const optimalSequenceLength = optimalMatchSequence.length;
const guesses = this.getGuesses(password, optimalSequenceLength);
return {
password,
guesses,
guessesLog10: utils.log10(guesses),
sequence: optimalMatchSequence
};
}
getGuesses(password, optimalSequenceLength) {
const passwordLength = password.length;
if (password.length === 0) {
return 1;
} else {
return this.optimal.totalGuesses[passwordLength - 1][optimalSequenceLength];
}
}
}
export { Scoring as default };
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,199 @@
import { type CHash, type CHashXOF, type Hash, type HashXOF, type TArg, type TRet } from './utils.ts';
/**
* `keccakf1600` internal permutation, additionally allows adjusting the round count.
* @param s - 5x5 Keccak state encoded as 25 lanes split into 50 uint32 words
* in this file's local little-endian lane-word order
* @param rounds - number of rounds to execute
* @throws If `rounds` is outside the supported `1..24` range. {@link Error}
* @example
* Permute a Keccak state with the default 24 rounds.
* ```ts
* keccakP(new Uint32Array(50));
* ```
*/
export declare function keccakP(s: TArg<Uint32Array>, rounds?: number): void;
/**
* Keccak sponge function.
* @param blockLen - absorb/squeeze rate in bytes
* @param suffix - domain separation suffix byte
* @param outputLen - default digest length in bytes. This base sponge only
* requires a non-negative integer; wrappers that need positive output
* lengths must enforce that themselves.
* @param enableXOF - whether XOF output is allowed
* @param rounds - number of Keccak-f rounds
* @example
* Build a sponge state, absorb bytes, then finalize a digest.
* ```ts
* const hash = new Keccak(136, 0x06, 32);
* hash.update(new Uint8Array([1, 2, 3]));
* hash.digest();
* ```
*/
export declare class Keccak implements Hash<Keccak>, HashXOF<Keccak> {
protected state: Uint8Array;
protected pos: number;
protected posOut: number;
protected finished: boolean;
protected state32: Uint32Array;
protected destroyed: boolean;
blockLen: number;
suffix: number;
outputLen: number;
canXOF: boolean;
protected enableXOF: boolean;
protected rounds: number;
constructor(blockLen: number, suffix: number, outputLen: number, enableXOF?: boolean, rounds?: number);
clone(): Keccak;
protected keccak(): void;
update(data: TArg<Uint8Array>): this;
protected finish(): void;
protected writeInto(out: TArg<Uint8Array>): TRet<Uint8Array>;
xofInto(out: TArg<Uint8Array>): TRet<Uint8Array>;
xof(bytes: number): TRet<Uint8Array>;
digestInto(out: TArg<Uint8Array>): void;
digest(): TRet<Uint8Array>;
destroy(): void;
_cloneInto(to?: Keccak): Keccak;
}
/**
* SHA3-224 hash function.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with SHA3-224.
* ```ts
* sha3_224(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const sha3_224: TRet<CHash>;
/**
* SHA3-256 hash function. Different from keccak-256.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with SHA3-256.
* ```ts
* sha3_256(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const sha3_256: TRet<CHash>;
/**
* SHA3-384 hash function.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with SHA3-384.
* ```ts
* sha3_384(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const sha3_384: TRet<CHash>;
/**
* SHA3-512 hash function.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with SHA3-512.
* ```ts
* sha3_512(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const sha3_512: TRet<CHash>;
/**
* Keccak-224 hash function.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with Keccak-224.
* ```ts
* keccak_224(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const keccak_224: TRet<CHash>;
/**
* Keccak-256 hash function. Different from SHA3-256.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with Keccak-256.
* ```ts
* keccak_256(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const keccak_256: TRet<CHash>;
/**
* Keccak-384 hash function.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with Keccak-384.
* ```ts
* keccak_384(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const keccak_384: TRet<CHash>;
/**
* Keccak-512 hash function.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with Keccak-512.
* ```ts
* keccak_512(new Uint8Array([97, 98, 99]));
* ```
*/
export declare const keccak_512: TRet<CHash>;
/** Options for SHAKE XOF. */
export type ShakeOpts = {
/** Desired number of output bytes. */
dkLen?: number;
};
/**
* SHAKE128 XOF with 128-bit security and a 16-byte default output.
* @param msg - message bytes to hash
* @param opts - Optional output-length override. See {@link ShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with SHAKE128.
* ```ts
* shake128(new Uint8Array([97, 98, 99]), { dkLen: 32 });
* ```
*/
export declare const shake128: TRet<CHashXOF<Keccak, ShakeOpts>>;
/**
* SHAKE256 XOF with 256-bit security and a 32-byte default output.
* @param msg - message bytes to hash
* @param opts - Optional output-length override. See {@link ShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with SHAKE256.
* ```ts
* shake256(new Uint8Array([97, 98, 99]), { dkLen: 64 });
* ```
*/
export declare const shake256: TRet<CHashXOF<Keccak, ShakeOpts>>;
/**
* SHAKE128 XOF with 256-bit output (NIST version).
* @param msg - message bytes to hash
* @param opts - Optional output-length override. See {@link ShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with SHAKE128 using a 32-byte default output.
* ```ts
* shake128_32(new Uint8Array([97, 98, 99]), { dkLen: 32 });
* ```
*/
export declare const shake128_32: TRet<CHashXOF<Keccak, ShakeOpts>>;
/**
* SHAKE256 XOF with 512-bit output (NIST version).
* @param msg - message bytes to hash
* @param opts - Optional output-length override. See {@link ShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with SHAKE256 using a 64-byte default output.
* ```ts
* shake256_64(new Uint8Array([97, 98, 99]), { dkLen: 64 });
* ```
*/
export declare const shake256_64: TRet<CHashXOF<Keccak, ShakeOpts>>;
//# sourceMappingURL=sha3.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"panels-left-right.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,155 @@
'use strict';
const fs = require('fs');
const path = require('path');
const {promisify} = require('util');
const semverGte = require('semver/functions/gte');
const useNativeRecursiveOption = semverGte(process.version, '10.12.0');
// https://github.com/nodejs/node/issues/8987
// https://github.com/libuv/libuv/pull/1088
const checkPath = pth => {
if (process.platform === 'win32') {
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''));
if (pathHasInvalidWinCharacters) {
const error = new Error(`Path contains invalid characters: ${pth}`);
error.code = 'EINVAL';
throw error;
}
}
};
const processOptions = options => {
const defaults = {
mode: 0o777,
fs
};
return {
...defaults,
...options
};
};
const permissionError = pth => {
// This replicates the exception of `fs.mkdir` with native the
// `recusive` option when run on an invalid drive under Windows.
const error = new Error(`operation not permitted, mkdir '${pth}'`);
error.code = 'EPERM';
error.errno = -4048;
error.path = pth;
error.syscall = 'mkdir';
return error;
};
const makeDir = async (input, options) => {
checkPath(input);
options = processOptions(options);
const mkdir = promisify(options.fs.mkdir);
const stat = promisify(options.fs.stat);
if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) {
const pth = path.resolve(input);
await mkdir(pth, {
mode: options.mode,
recursive: true
});
return pth;
}
const make = async pth => {
try {
await mkdir(pth, options.mode);
return pth;
} catch (error) {
if (error.code === 'EPERM') {
throw error;
}
if (error.code === 'ENOENT') {
if (path.dirname(pth) === pth) {
throw permissionError(pth);
}
if (error.message.includes('null bytes')) {
throw error;
}
await make(path.dirname(pth));
return make(pth);
}
try {
const stats = await stat(pth);
if (!stats.isDirectory()) {
throw new Error('The path is not a directory');
}
} catch {
throw error;
}
return pth;
}
};
return make(path.resolve(input));
};
module.exports = makeDir;
module.exports.sync = (input, options) => {
checkPath(input);
options = processOptions(options);
if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) {
const pth = path.resolve(input);
fs.mkdirSync(pth, {
mode: options.mode,
recursive: true
});
return pth;
}
const make = pth => {
try {
options.fs.mkdirSync(pth, options.mode);
} catch (error) {
if (error.code === 'EPERM') {
throw error;
}
if (error.code === 'ENOENT') {
if (path.dirname(pth) === pth) {
throw permissionError(pth);
}
if (error.message.includes('null bytes')) {
throw error;
}
make(path.dirname(pth));
return make(pth);
}
try {
if (!options.fs.statSync(pth).isDirectory()) {
throw new Error('The path is not a directory');
}
} catch {
throw error;
}
}
return pth;
};
return make(path.resolve(input));
};
@@ -0,0 +1 @@
{"version":3,"file":"diff.js","sources":["../../../src/icons/diff.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Diff\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgM3YxNCIgLz4KICA8cGF0aCBkPSJNNSAxMGgxNCIgLz4KICA8cGF0aCBkPSJNNSAyMWgxNCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/diff\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 Diff = createLucideIcon('Diff', [\n ['path', { d: 'M12 3v14', key: '7cf3v8' }],\n ['path', { d: 'M5 10h14', key: 'elsbfy' }],\n ['path', { d: 'M5 21h14', key: '11awu3' }],\n]);\n\nexport default Diff;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,iBAAiB,MAAQ,CAAA,CAAA,CAAA;AAAA,CAAA,CACpC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,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,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,18 @@
import { isMotionComponent } from './is-motion-component.mjs';
import { motionComponentSymbol } from './symbol.mjs';
/**
* Unwraps a `motion` component and returns either a string for `motion.div` or
* the React component for `motion(Component)`.
*
* If the component is not a `motion` component it returns undefined.
*/
function unwrapMotionComponent(component) {
if (isMotionComponent(component)) {
return component[motionComponentSymbol];
}
return undefined;
}
export { unwrapMotionComponent };
//# sourceMappingURL=unwrap-motion-component.mjs.map
@@ -0,0 +1,13 @@
# `react-use-rect`
## Installation
```sh
$ yarn add @radix-ui/react-use-rect
# or
$ npm install @radix-ui/react-use-rect
```
## Usage
This is an internal utility, not intended for public usage.
@@ -0,0 +1,256 @@
import { cleanUrl, extractQueryWithoutFragment } from "../utils.js";
class And {
kind;
args;
constructor(...args) {
if (args.length === 0) {
throw new Error('`And` expects at least one operand');
}
this.args = args;
this.kind = 'and';
}
}
class Or {
kind;
args;
constructor(...args) {
if (args.length === 0) {
throw new Error('`Or` expects at least one operand');
}
this.args = args;
this.kind = 'or';
}
}
class Not {
kind;
expr;
constructor(expr) {
this.expr = expr;
this.kind = 'not';
}
}
class Id {
kind;
pattern;
params;
constructor(pattern, params) {
this.pattern = pattern;
this.kind = 'id';
this.params = params ?? {
cleanUrl: false,
};
}
}
class ImporterId {
kind;
pattern;
params;
constructor(pattern, params) {
this.pattern = pattern;
this.kind = 'importerId';
this.params = params ?? {
cleanUrl: false,
};
}
}
class ModuleType {
kind;
pattern;
constructor(pattern) {
this.pattern = pattern;
this.kind = 'moduleType';
}
}
class Code {
kind;
pattern;
constructor(expr) {
this.pattern = expr;
this.kind = 'code';
}
}
class Query {
kind;
key;
pattern;
constructor(key, pattern) {
this.pattern = pattern;
this.key = key;
this.kind = 'query';
}
}
class Include {
kind;
expr;
constructor(expr) {
this.expr = expr;
this.kind = 'include';
}
}
class Exclude {
kind;
expr;
constructor(expr) {
this.expr = expr;
this.kind = 'exclude';
}
}
export function and(...args) {
return new And(...args);
}
export function or(...args) {
return new Or(...args);
}
export function not(expr) {
return new Not(expr);
}
export function id(pattern, params) {
return new Id(pattern, params);
}
export function importerId(pattern, params) {
return new ImporterId(pattern, params);
}
export function moduleType(pattern) {
return new ModuleType(pattern);
}
export function code(pattern) {
return new Code(pattern);
}
/*
* There are three kinds of conditions are supported:
* 1. `boolean`: if the value is `true`, the key must exist and be truthy. if the value is `false`, the key must not exist or be falsy.
* 2. `string`: the key must exist and be equal to the value.
* 3. `RegExp`: the key must exist and match the value.
*/
export function query(key, pattern) {
return new Query(key, pattern);
}
export function include(expr) {
return new Include(expr);
}
export function exclude(expr) {
return new Exclude(expr);
}
/**
* convert a queryObject to FilterExpression like
* ```js
* and(query(k1, v1), query(k2, v2))
* ```
* @param queryFilterObject The query filter object needs to be matched.
* @returns a `And` FilterExpression
*/
export function queries(queryFilter) {
let arr = Object.entries(queryFilter).map(([key, value]) => {
return new Query(key, value);
});
return and(...arr);
}
export function interpreter(exprs, code, id, moduleType, importerId) {
let arr = [];
if (Array.isArray(exprs)) {
arr = exprs;
}
else {
arr = [exprs];
}
return interpreterImpl(arr, code, id, moduleType, importerId);
}
export function interpreterImpl(expr, code, id, moduleType, importerId, ctx = {}) {
let hasInclude = false;
for (const e of expr) {
switch (e.kind) {
case 'include': {
hasInclude = true;
if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) {
return true;
}
break;
}
case 'exclude': {
if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) {
return false;
}
break;
}
}
}
return !hasInclude;
}
export function exprInterpreter(expr, code, id, moduleType, importerId, ctx = {}) {
switch (expr.kind) {
case 'and': {
return expr.args.every((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
}
case 'or': {
return expr.args.some((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
}
case 'not': {
return !exprInterpreter(expr.expr, code, id, moduleType, importerId, ctx);
}
case 'id': {
if (id === undefined) {
throw new Error('`id` is required for `id` expression');
}
let idToMatch = id;
if (expr.params.cleanUrl) {
idToMatch = cleanUrl(idToMatch);
}
return typeof expr.pattern === 'string'
? idToMatch === expr.pattern
: expr.pattern.test(idToMatch);
}
case 'importerId': {
if (importerId === undefined) {
return false; // Entry files have no importer, so no match
}
let importerIdToMatch = importerId;
if (expr.params.cleanUrl) {
importerIdToMatch = cleanUrl(importerIdToMatch);
}
return typeof expr.pattern === 'string'
? importerIdToMatch === expr.pattern
: expr.pattern.test(importerIdToMatch);
}
case 'moduleType': {
if (moduleType === undefined) {
throw new Error('`moduleType` is required for `moduleType` expression');
}
return moduleType === expr.pattern;
}
case 'code': {
if (code === undefined) {
throw new Error('`code` is required for `code` expression');
}
return typeof expr.pattern === 'string'
? code.includes(expr.pattern)
: expr.pattern.test(code);
}
case 'query': {
if (id === undefined) {
throw new Error('`id` is required for `Query` expression');
}
if (!ctx.urlSearchParamsCache) {
let queryString = extractQueryWithoutFragment(id);
ctx.urlSearchParamsCache = new URLSearchParams(queryString);
}
let urlParams = ctx.urlSearchParamsCache;
if (typeof expr.pattern === 'boolean') {
if (expr.pattern) {
return urlParams.has(expr.key);
}
else {
return !urlParams.has(expr.key);
}
}
else if (typeof expr.pattern === 'string') {
return urlParams.get(expr.key) === expr.pattern;
}
else {
return expr.pattern.test(urlParams.get(expr.key) ?? '');
}
}
default: {
throw new Error(`Expression ${JSON.stringify(expr)} is not expected.`);
}
}
}
@@ -0,0 +1,100 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'consistent-type-definitions',
meta: {
type: 'suggestion',
docs: {
description: 'Enforce type definitions to consistently use either `interface` or `type`',
recommended: 'stylistic',
},
fixable: 'code',
messages: {
interfaceOverType: 'Use an `interface` instead of a `type`.',
typeOverInterface: 'Use a `type` instead of an `interface`.',
},
schema: [
{
type: 'string',
description: 'Which type definition syntax to prefer.',
enum: ['interface', 'type'],
},
],
},
defaultOptions: ['interface'],
create(context, [option]) {
/**
* Iterates from the highest parent to the currently traversed node
* to determine whether any node in tree is globally declared module declaration
*/
function isCurrentlyTraversedNodeWithinModuleDeclaration(node) {
return context.sourceCode
.getAncestors(node)
.some(node => node.type === utils_1.AST_NODE_TYPES.TSModuleDeclaration &&
node.declare &&
node.kind === 'global');
}
return {
...(option === 'interface' && {
"TSTypeAliasDeclaration[typeAnnotation.type='TSTypeLiteral']"(node) {
context.report({
node: node.id,
messageId: 'interfaceOverType',
fix(fixer) {
const typeToken = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(node.id, token => token.value === 'type'), util_1.NullThrowsReasons.MissingToken('type keyword', 'type alias'));
const equalsToken = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(node.typeAnnotation, token => token.value === '='), util_1.NullThrowsReasons.MissingToken('=', 'type alias'));
const beforeEqualsToken = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(equalsToken, {
includeComments: true,
}), util_1.NullThrowsReasons.MissingToken('before =', 'type alias'));
return [
// replace 'type' with 'interface'.
fixer.replaceText(typeToken, 'interface'),
// delete from the = to the { of the type, and put a space to be pretty.
fixer.replaceTextRange([beforeEqualsToken.range[1], node.typeAnnotation.range[0]], ' '),
// remove from the closing } through the end of the statement.
fixer.removeRange([
node.typeAnnotation.range[1],
node.range[1],
]),
];
},
});
},
}),
...(option === 'type' && {
TSInterfaceDeclaration(node) {
const fix = isCurrentlyTraversedNodeWithinModuleDeclaration(node)
? null
: (fixer) => {
const typeNode = node.typeParameters ?? node.id;
const fixes = [];
const firstToken = context.sourceCode.getTokenBefore(node.id);
if (firstToken) {
fixes.push(fixer.replaceText(firstToken, 'type'));
fixes.push(fixer.replaceTextRange([typeNode.range[1], node.body.range[0]], ' = '));
}
node.extends.forEach(heritage => {
const typeIdentifier = context.sourceCode.getText(heritage);
fixes.push(fixer.insertTextAfter(node.body, ` & ${typeIdentifier}`));
});
if (node.parent.type === utils_1.AST_NODE_TYPES.ExportDefaultDeclaration) {
fixes.push(fixer.removeRange([node.parent.range[0], node.range[0]]), fixer.insertTextAfter(node.body, `\nexport default ${node.id.name}`));
}
return fixes;
};
context.report({
node: node.id,
messageId: 'typeOverInterface',
/**
* remove automatically fix when the interface is within a declare global
* @see {@link https://github.com/typescript-eslint/typescript-eslint/issues/2707}
*/
fix,
});
},
}),
};
},
});
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const BatteryMedium = createLucideIcon("BatteryMedium", [
["rect", { width: "16", height: "10", x: "2", y: "7", rx: "2", ry: "2", key: "1w10f2" }],
["line", { x1: "22", x2: "22", y1: "11", y2: "13", key: "4dh1rd" }],
["line", { x1: "6", x2: "6", y1: "11", y2: "13", key: "1wd6dw" }],
["line", { x1: "10", x2: "10", y1: "11", y2: "13", key: "haxvl5" }]
]);
export { BatteryMedium as default };
//# sourceMappingURL=battery-medium.js.map
@@ -0,0 +1,53 @@
{
"name": "graceful-fs",
"description": "A drop-in replacement for fs, making various improvements.",
"version": "4.2.11",
"repository": {
"type": "git",
"url": "https://github.com/isaacs/node-graceful-fs"
},
"main": "graceful-fs.js",
"directories": {
"test": "test"
},
"scripts": {
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --follow-tags",
"test": "nyc --silent node test.js | tap -c -",
"posttest": "nyc report"
},
"keywords": [
"fs",
"module",
"reading",
"retry",
"retries",
"queue",
"error",
"errors",
"handling",
"EMFILE",
"EAGAIN",
"EINVAL",
"EPERM",
"EACCESS"
],
"license": "ISC",
"devDependencies": {
"import-fresh": "^2.0.0",
"mkdirp": "^0.5.0",
"rimraf": "^2.2.8",
"tap": "^16.3.4"
},
"files": [
"fs.js",
"graceful-fs.js",
"legacy-streams.js",
"polyfills.js",
"clone.js"
],
"tap": {
"reporter": "classic"
}
}
@@ -0,0 +1,349 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
const stringMap = z.map(z.string(), z.string());
type stringMap = z.infer<typeof stringMap>;
const minTwo = stringMap.min(2);
const maxTwo = stringMap.max(2);
const justTwo = stringMap.size(2);
const nonEmpty = stringMap.nonempty();
const nonEmptyMax = stringMap.nonempty().max(2);
test("type inference", () => {
expectTypeOf<stringMap>().toEqualTypeOf<Map<string, string>>();
});
test("valid parse", () => {
const result = stringMap.safeParse(
new Map([
["first", "foo"],
["second", "bar"],
])
);
expect(result.success).toEqual(true);
expect(result.data).toMatchInlineSnapshot(`
Map {
"first" => "foo",
"second" => "bar",
}
`);
});
test("valid parse: size-related methods", () => {
expect(() => {
minTwo.parse(
new Map([
["a", "b"],
["c", "d"],
])
);
minTwo.parse(
new Map([
["a", "b"],
["c", "d"],
["e", "f"],
])
);
maxTwo.parse(
new Map([
["a", "b"],
["c", "d"],
])
);
maxTwo.parse(new Map([["a", "b"]]));
justTwo.parse(
new Map([
["a", "b"],
["c", "d"],
])
);
nonEmpty.parse(new Map([["a", "b"]]));
nonEmptyMax.parse(
new Map([
["a", "b"],
["c", "d"],
])
);
}).not.toThrow();
const sizeZeroResult = stringMap.parse(new Map());
expect(sizeZeroResult.size).toBe(0);
const sizeTwoResult = minTwo.parse(
new Map([
["a", "b"],
["c", "d"],
])
);
expect(sizeTwoResult.size).toBe(2);
});
test("failing when parsing empty map in nonempty ", () => {
const result = nonEmpty.safeParse(new Map());
expect(result.success).toEqual(false);
expect(result.error!.issues.length).toEqual(1);
expect(result.error!.issues[0].code).toEqual("too_small");
});
test("failing when map is bigger than max() ", () => {
const result = maxTwo.safeParse(
new Map([
["a", "b"],
["c", "d"],
["e", "f"],
])
);
expect(result.success).toEqual(false);
expect(result.error!.issues.length).toEqual(1);
expect(result.error!.issues[0].code).toEqual("too_big");
const bad = new Map([
[1, 1],
[2, 2],
]);
const capped = z.map(z.string(), z.string()).max(1);
expect(capped.safeParse(bad).error!.issues).toMatchObject([{ code: "too_big" }]);
expect(capped.safeParse(new Set([1, 2])).error!.issues[0]).toMatchObject({ code: "invalid_type", expected: "map" });
});
test("failing when map does not match size() ", () => {
expect(justTwo.safeParse(new Map([["a", "b"]])).error!.issues[0].message).toEqual(
"Too small: expected map to have exactly 2 entries"
);
const tooBig = new Map([
["a", "b"],
["c", "d"],
["e", "f"],
]);
expect(justTwo.safeParse(tooBig).error!.issues[0].message).toEqual("Too big: expected map to have exactly 2 entries");
});
test("valid parse async", async () => {
const asyncMap = z.map(
z.string().refine(async () => false, "bad key"),
z.string().refine(async () => false, "bad value")
);
const result = await asyncMap.safeParseAsync(new Map([["first", "foo"]]));
expect(result.success).toEqual(false);
expect(result.error).toMatchInlineSnapshot(`
[ZodError: [
{
"code": "custom",
"path": [
"first"
],
"message": "bad key"
},
{
"code": "custom",
"path": [
"first"
],
"message": "bad value"
}
]]
`);
});
test("throws when a Set is given", () => {
const result = stringMap.safeParse(new Set([]));
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(1);
expect(result.error.issues[0].code).toEqual("invalid_type");
}
});
test("throws when the given map has invalid key and invalid input", () => {
const result = stringMap.safeParse(new Map([[42, Symbol()]]));
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(2);
expect(result.error).toMatchInlineSnapshot(`
[ZodError: [
{
"expected": "string",
"code": "invalid_type",
"path": [
42
],
"message": "Invalid input: expected string, received number"
},
{
"expected": "string",
"code": "invalid_type",
"path": [
42
],
"message": "Invalid input: expected string, received symbol"
}
]]
`);
}
});
test("throws when the given map has multiple invalid entries", () => {
// const result = stringMap.safeParse(new Map([[42, Symbol()]]));
const result = stringMap.safeParse(
new Map([
[1, "foo"],
["bar", 2],
] as [any, any][]) as Map<any, any>
);
// const result = stringMap.safeParse(new Map([[42, Symbol()]]));
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(2);
expect(result.error.issues).toMatchInlineSnapshot(`
[
{
"code": "invalid_type",
"expected": "string",
"message": "Invalid input: expected string, received number",
"path": [
1,
],
},
{
"code": "invalid_type",
"expected": "string",
"message": "Invalid input: expected string, received number",
"path": [
"bar",
],
},
]
`);
}
});
test("dirty", async () => {
const map = z.map(
z.string().refine((val) => val === val.toUpperCase(), {
message: "Keys must be uppercase",
}),
z.string()
);
const result = await map.spa(
new Map([
["first", "foo"],
["second", "bar"],
])
);
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues.length).toEqual(2);
expect(result.error).toMatchInlineSnapshot(`
[ZodError: [
{
"code": "custom",
"path": [
"first"
],
"message": "Keys must be uppercase"
},
{
"code": "custom",
"path": [
"second"
],
"message": "Keys must be uppercase"
}
]]
`);
}
});
test("map with object keys", () => {
const map = z.map(
z.object({
name: z.string(),
age: z.number(),
}),
z.string()
);
const data = new Map([
[{ name: "John", age: 30 }, "foo"],
[{ name: "Jane", age: 25 }, "bar"],
]);
const result = map.safeParse(data);
expect(result.success).toEqual(true);
expect(result.data!).toEqual(data);
const badData = new Map([["bad", "foo"]]);
const badResult = map.safeParse(badData);
expect(badResult.success).toEqual(false);
expect(badResult.error).toMatchInlineSnapshot(`
[ZodError: [
{
"expected": "object",
"code": "invalid_type",
"path": [
"bad"
],
"message": "Invalid input: expected object, received string"
}
]]
`);
});
test("min/max", async () => {
const schema = stringMap.min(4).max(5);
const r1 = schema.safeParse(
new Map([
["a", "a"],
["b", "b"],
["c", "c"],
["d", "d"],
])
);
expect(r1.success).toEqual(true);
const r2 = schema.safeParse(
new Map([
["a", "a"],
["b", "b"],
["c", "c"],
])
);
expect(r2.success).toEqual(false);
expect(r2.error!.issues).toMatchInlineSnapshot(`
[
{
"code": "too_small",
"inclusive": true,
"message": "Too small: expected map to have >=4 entries",
"minimum": 4,
"origin": "map",
"path": [],
},
]
`);
const r3 = schema.safeParse(
new Map([
["a", "a"],
["b", "b"],
["c", "c"],
["d", "d"],
["e", "e"],
["f", "f"],
])
);
expect(r3.success).toEqual(false);
expect(r3.error!.issues).toMatchInlineSnapshot(`
[
{
"code": "too_big",
"inclusive": true,
"maximum": 5,
"message": "Too big: expected map to have <=5 entries",
"origin": "map",
"path": [],
},
]
`);
});
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const BedDouble = createLucideIcon("BedDouble", [
["path", { d: "M2 20v-8a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v8", key: "1k78r4" }],
["path", { d: "M4 10V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4", key: "fb3tl2" }],
["path", { d: "M12 4v6", key: "1dcgq2" }],
["path", { d: "M2 18h20", key: "ajqnye" }]
]);
export { BedDouble as default };
//# sourceMappingURL=bed-double.js.map
@@ -0,0 +1,79 @@
{
"name": "@radix-ui/react-tooltip",
"version": "1.2.8",
"license": "MIT",
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"dependencies": {
"@radix-ui/primitive": "1.1.3",
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-context": "1.1.2",
"@radix-ui/react-dismissable-layer": "1.1.11",
"@radix-ui/react-id": "1.1.1",
"@radix-ui/react-popper": "1.2.8",
"@radix-ui/react-portal": "1.1.9",
"@radix-ui/react-presence": "1.1.5",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-slot": "1.2.3",
"@radix-ui/react-use-controllable-state": "1.2.2",
"@radix-ui/react-visually-hidden": "1.2.3"
},
"devDependencies": {
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
"eslint": "^9.18.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"typescript": "^5.7.3",
"@repo/builder": "0.0.0",
"@repo/eslint-config": "0.0.0",
"@repo/typescript-config": "0.0.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"scripts": {
"lint": "eslint --max-warnings 0 src",
"clean": "rm -rf dist",
"typecheck": "tsc --noEmit",
"build": "radix-build"
},
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
}
}
@@ -0,0 +1,4 @@
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"useNamespace", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
name: string;
};
export default _default;
@@ -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 Reply = createLucideIcon("Reply", [
["polyline", { points: "9 17 4 12 9 7", key: "hvgpf2" }],
["path", { d: "M20 18v-2a4 4 0 0 0-4-4H4", key: "5vmcpk" }]
]);
export { Reply as default };
//# sourceMappingURL=reply.js.map
@@ -0,0 +1 @@
{"version":3,"sources":["../src/decompress.ts"],"sourcesContent":["export default function decompress(encodedString: string) {\n const decompressedArray = encodedString.split(/([A-Z])/g)\n const decompressedData = []\n let last = ''\n let i\n for (i = 1; i < decompressedArray.length; i += 2) {\n last =\n last.slice(0, decompressedArray[i].charCodeAt(0) - 65) +\n decompressedArray[i + 1]\n decompressedData.push(last)\n }\n\n return decompressedData\n}\n"],"mappings":"AAAe,SAAR,WAA4B,eAAuB;AACxD,QAAM,oBAAoB,cAAc,MAAM,UAAU;AACxD,QAAM,mBAAmB,CAAC;AAC1B,MAAI,OAAO;AACX,MAAI;AACJ,OAAK,IAAI,GAAG,IAAI,kBAAkB,QAAQ,KAAK,GAAG;AAChD,WACE,KAAK,MAAM,GAAG,kBAAkB,CAAC,EAAE,WAAW,CAAC,IAAI,EAAE,IACrD,kBAAkB,IAAI,CAAC;AACzB,qBAAiB,KAAK,IAAI;AAAA,EAC5B;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,19 @@
import type { AnySchemaObject } from "./types";
import AjvCore, { Options } from "./core";
export declare class Ajv2019 extends AjvCore {
constructor(opts?: Options);
_addVocabularies(): void;
_addDefaultMetaSchema(): void;
defaultMeta(): string | AnySchemaObject | undefined;
}
export default Ajv2019;
export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types";
export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core";
export { SchemaCxt, SchemaObjCxt } from "./compile";
export { KeywordCxt } from "./compile/validate";
export { DefinedError } from "./vocabularies/errors";
export { JSONType } from "./compile/rules";
export { JSONSchemaType } from "./types/json-schema";
export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen";
export { default as ValidationError } from "./runtime/validation_error";
export { default as MissingRefError } from "./compile/ref_error";
@@ -0,0 +1,3 @@
# `@rollup/rollup-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `rollup`
@@ -0,0 +1,429 @@
flf2a$ 4 3 10 -1 20
Cyberfont - large
Figlet conversion by Kent Nassen, kentn@cyberspace.org, 8-10-94
From: stock@fwi.uva.nl (Lennert Stock)
Date: 15 Jul 1994 00:04:25 GMT
Here are some fonts. Non-figlet I'm afraid, if you wanna convert them, be
my guest. I posted the isometric fonts before.
------------------------------------------------------------------------------
.x%%%%%%x. .x%%%%%%x.
,%%%%%%%%%%. .%%%%%%%%%%.
,%%%' )' \) :( `( `%%%.
,%x%)________) --------- L e n n e r t S t o c k ( _ __ (%x%.
(%%%~^88P~88P| |~=> .=-~ %%%)
(%%::. .:,\ .' `. /,:. .::%%)
`;%:`\. `-' | | `-' ./':%:'
``x`. -===.' stock@fwi.uva.nl -------- `.===- .'x''
/ `:`.__.; :.__.':' \
.d8b. ..`. .'.. .d8b.
$ $@
$ $@
$ $@
$ $@@
/@
/ @
. @
$@@
..@
''@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
.@
'@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
$@
$@
.@
'@@
$$$@
___@
$$$@
$$$@@
$@
$@
.@
$@@
/@
/ @
/ @
/ @@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
$@
.@
.@
$@@
$@
.@
.@
'@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
____ @
___|@
\ @
` @@
@
@
@
@@
_______@
|_____|@
| |@
@@
______ @
|_____]@
|_____]@
@@
_______@
| $@
|_____$@
@@
______$@
| \@
|_____/@
@@
_______@
|______@
|______@
@@
_______@
|______@
| $@
@@
______@
| ____@
|_____|@
@@
_ _@
|_____|@
| |@
@@
_____@
| $@
__|__@
@@
_____@
| $@
__| $@
@@
_ _@
|____/$@
| \_@
@@
$ $@
| $@
|_____@
@@
_______@
| | |@
| | |@
@@
__ _@
| \ |@
| \_|@
@@
_____ @
| |@
|_____|@
@@
_____ @
|_____]@
| $@
@@
_____ @
| __|@
|____\|@
@@
______@
|_____/@
| \_@
@@
_______@
|______@
______|@
@@
_______@
| $@
| $@
@@
_ _@
| |@
|_____|@
@@
_ _@
\ /$@
\/ $@
@@
_ _ _@
| | |@
|__|__|@
@@
_ _@
\___/$@
_/ \_@
@@
__ __@
\_/ $@
| $@
@@
______@
____/@
/_____@
@@
@
@
@
@@
\ @
\ @
\ @
\@@
@
@
@
@@
@
@
@
@@
@
@
_____@
@@
.@
`@
@
@@
_______@
|_____|@
| |@
@@
______ @
|_____]@
|_____]@
@@
_______@
| $@
|_____$@
@@
______$@
| \@
|_____/@
@@
_______@
|______@
|______@
@@
_______@
|______@
| $@
@@
______@
| ____@
|_____|@
@@
_ _@
|_____|@
| |@
@@
_____@
| $@
__|__@
@@
_____@
| $@
__| $@
@@
_ _@
|____/$@
| \_@
@@
$ $@
| $@
|_____@
@@
_______@
| | |@
| | |@
@@
__ _@
| \ |@
| \_|@
@@
_____ @
| |@
|_____|@
@@
_____ @
|_____]@
| $@
@@
_____ @
| __|@
|____\|@
@@
______@
|_____/@
| \_@
@@
_______@
|______@
______|@
@@
_______@
| $@
| $@
@@
_ _@
| |@
|_____|@
@@
_ _@
\ /$@
\/ $@
@@
_ _ _@
| | |@
|__|__|@
@@
_ _@
\___/$@
_/ \_@
@@
__ __@
\_/ $@
| $@
@@
______@
____/@
/_____@
@@
@
@
@
@@
|@
|@
|@
|@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@