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,88 @@
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""gypd output module
This module produces gyp input as its output. Output files are given the
.gypd extension to avoid overwriting the .gyp files that they are generated
from. Internal references to .gyp files (such as those found in
"dependencies" sections) are not adjusted to point to .gypd files instead;
unlike other paths, which are relative to the .gyp or .gypd file, such paths
are relative to the directory from which gyp was run to create the .gypd file.
This generator module is intended to be a sample and a debugging aid, hence
the "d" for "debug" in .gypd. It is useful to inspect the results of the
various merges, expansions, and conditional evaluations performed by gyp
and to see a representation of what would be fed to a generator module.
It's not advisable to rename .gypd files produced by this module to .gyp,
because they will have all merges, expansions, and evaluations already
performed and the relevant constructs not present in the output; paths to
dependencies may be wrong; and various sections that do not belong in .gyp
files such as such as "included_files" and "*_excluded" will be present.
Output will also be stripped of comments. This is not intended to be a
general-purpose gyp pretty-printer; for that, you probably just want to
run "pprint.pprint(eval(open('source.gyp').read()))", which will still strip
comments but won't do all of the other things done to this module's output.
The specific formatting of the output generated by this module is subject
to change.
"""
import pprint
import gyp.common
# These variables should just be spit back out as variable references.
_generator_identity_variables = [
"CONFIGURATION_NAME",
"EXECUTABLE_PREFIX",
"EXECUTABLE_SUFFIX",
"INTERMEDIATE_DIR",
"LIB_DIR",
"PRODUCT_DIR",
"RULE_INPUT_ROOT",
"RULE_INPUT_DIRNAME",
"RULE_INPUT_EXT",
"RULE_INPUT_NAME",
"RULE_INPUT_PATH",
"SHARED_INTERMEDIATE_DIR",
"SHARED_LIB_DIR",
"SHARED_LIB_PREFIX",
"SHARED_LIB_SUFFIX",
"STATIC_LIB_PREFIX",
"STATIC_LIB_SUFFIX",
]
# gypd doesn't define a default value for OS like many other generator
# modules. Specify "-D OS=whatever" on the command line to provide a value.
generator_default_variables = {}
# gypd supports multiple toolsets
generator_supports_multiple_toolsets = True
# TODO(mark): This always uses <, which isn't right. The input module should
# notify the generator to tell it which phase it is operating in, and this
# module should use < for the early phase and then switch to > for the late
# phase. Bonus points for carrying @ back into the output too.
for v in _generator_identity_variables:
generator_default_variables[v] = "<(%s)" % v
def GenerateOutput(target_list, target_dicts, data, params):
output_files = {}
for qualified_target in target_list:
[input_file, _target] = gyp.common.ParseQualifiedTarget(qualified_target)[0:2]
if input_file[-4:] != ".gyp":
continue
input_file_stem = input_file[:-4]
output_file = input_file_stem + params["options"].suffix + ".gypd"
output_files[output_file] = output_files.get(output_file, input_file)
for output_file, input_file in output_files.items():
output = open(output_file, "w")
pprint.pprint(data[input_file], output)
output.close()
@@ -0,0 +1 @@
{"version":3,"file":"folder-git-2.js","sources":["../../../src/icons/folder-git-2.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name FolderGit2\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNOSAyMEg0YTIgMiAwIDAgMS0yLTJWNWEyIDIgMCAwIDEgMi0yaDMuOWEyIDIgMCAwIDEgMS42OS45bC44MSAxLjJhMiAyIDAgMCAwIDEuNjcuOUgyMGEyIDIgMCAwIDEgMiAydjUiIC8+CiAgPGNpcmNsZSBjeD0iMTMiIGN5PSIxMiIgcj0iMiIgLz4KICA8cGF0aCBkPSJNMTggMTljLTIuOCAwLTUtMi4yLTUtNXY4IiAvPgogIDxjaXJjbGUgY3g9IjIwIiBjeT0iMTkiIHI9IjIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/folder-git-2\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst FolderGit2 = createLucideIcon('FolderGit2', [\n [\n 'path',\n {\n d: 'M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5',\n key: '1w6njk',\n },\n ],\n ['circle', { cx: '13', cy: '12', r: '2', key: '1j92g6' }],\n ['path', { d: 'M18 19c-2.8 0-5-2.2-5-5v8', key: 'pkpw2h' }],\n ['circle', { cx: '20', cy: '19', r: '2', key: '1obnsp' }],\n]);\n\nexport default FolderGit2;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,iBAAiB,YAAc,CAAA,CAAA,CAAA;AAAA,CAChD,CAAA,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;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,CACA,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA6B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAC1D,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,111 @@
import * as util from "../core/util.js";
const error = () => {
const Sizable = {
string: { unit: "حرف", verb: "أن يحوي" },
file: { unit: "بايت", verb: "أن يحوي" },
array: { unit: "عنصر", verb: "أن يحوي" },
set: { unit: "عنصر", verb: "أن يحوي" },
map: { unit: "عنصر", verb: "أن يحوي" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "مدخل",
email: "بريد إلكتروني",
url: "رابط",
emoji: "إيموجي",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "تاريخ ووقت بمعيار ISO",
date: "تاريخ بمعيار ISO",
time: "وقت بمعيار ISO",
duration: "مدة بمعيار ISO",
ipv4: "عنوان IPv4",
ipv6: "عنوان IPv6",
mac: "عنوان MAC",
cidrv4: "مدى عناوين بصيغة IPv4",
cidrv6: "مدى عناوين بصيغة IPv6",
base64: "نَص بترميز base64-encoded",
base64url: "نَص بترميز base64url-encoded",
json_string: "نَص على هيئة JSON",
e164: "رقم هاتف بمعيار E.164",
credit_card: "رقم بطاقة الائتمان",
currency_code: "رمز العملة",
iban: "IBAN",
jwt: "JWT",
template_literal: "مدخل",
};
const TypeDictionary = {
nan: "NaN",
};
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = TypeDictionary[issue.expected] ?? issue.expected;
const receivedType = util.parsedType(issue.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue.expected)) {
return `مدخلات غير مقبولة: يفترض إدخال instanceof ${issue.expected}، ولكن تم إدخال ${received}`;
}
return `مدخلات غير مقبولة: يفترض إدخال ${expected}، ولكن تم إدخال ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `مدخلات غير مقبولة: يفترض إدخال ${util.stringifyPrimitive(issue.values[0])}`;
return `اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return ` أكبر من اللازم: يفترض أن تكون ${issue.origin ?? "القيمة"} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "عنصر"}`;
return `أكبر من اللازم: يفترض أن تكون ${issue.origin ?? "القيمة"} ${adj} ${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `أصغر من اللازم: يفترض لـ ${issue.origin} أن يكون ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
}
return `أصغر من اللازم: يفترض لـ ${issue.origin} أن يكون ${adj} ${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `نَص غير مقبول: يجب أن يبدأ بـ "${issue.prefix}"`;
if (_issue.format === "ends_with")
return `نَص غير مقبول: يجب أن ينتهي بـ "${_issue.suffix}"`;
if (_issue.format === "includes")
return `نَص غير مقبول: يجب أن يتضمَّن "${_issue.includes}"`;
if (_issue.format === "regex")
return `نَص غير مقبول: يجب أن يطابق النمط ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue.format} غير مقبول`;
}
case "not_multiple_of":
return `رقم غير مقبول: يجب أن يكون من مضاعفات ${issue.divisor}`;
case "unrecognized_keys":
return `معرف${issue.keys.length > 1 ? "ات" : ""} غريب${issue.keys.length > 1 ? "ة" : ""}: ${util.joinValues(issue.keys, "، ")}`;
case "invalid_key":
return `معرف غير مقبول في ${issue.origin}`;
case "invalid_union":
return "مدخل غير مقبول";
case "invalid_element":
return `مدخل غير مقبول في ${issue.origin}`;
default:
return "مدخل غير مقبول";
}
};
};
export default function () {
return {
localeError: error(),
};
}
@@ -0,0 +1,5 @@
Copyright 2018 Kilian Valkhof
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,152 @@
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Visual Studio user preferences file writer."""
import os
import re
import socket # for gethostname
from gyp import easy_xml
# ------------------------------------------------------------------------------
def _FindCommandInPath(command):
"""If there are no slashes in the command given, this function
searches the PATH env to find the given command, and converts it
to an absolute path. We have to do this because MSVS is looking
for an actual file to launch a debugger on, not just a command
line. Note that this happens at GYP time, so anything needing to
be built needs to have a full path."""
if "/" in command or "\\" in command:
# If the command already has path elements (either relative or
# absolute), then assume it is constructed properly.
return command
else:
# Search through the path list and find an existing file that
# we can access.
paths = os.environ.get("PATH", "").split(os.pathsep)
for path in paths:
item = os.path.join(path, command)
if os.path.isfile(item) and os.access(item, os.X_OK):
return item
return command
def _QuoteWin32CommandLineArgs(args):
new_args = []
for arg in args:
# Replace all double-quotes with double-double-quotes to escape
# them for cmd shell, and then quote the whole thing if there
# are any.
if arg.find('"') != -1:
arg = '""'.join(arg.split('"'))
arg = '"%s"' % arg
# Otherwise, if there are any spaces, quote the whole arg.
elif re.search(r"[ \t\n]", arg):
arg = '"%s"' % arg
new_args.append(arg)
return new_args
class Writer:
"""Visual Studio XML user user file writer."""
def __init__(self, user_file_path, version, name):
"""Initializes the user file.
Args:
user_file_path: Path to the user file.
version: Version info.
name: Name of the user file.
"""
self.user_file_path = user_file_path
self.version = version
self.name = name
self.configurations = {}
def AddConfig(self, name):
"""Adds a configuration to the project.
Args:
name: Configuration name.
"""
self.configurations[name] = ["Configuration", {"Name": name}]
def AddDebugSettings(
self, config_name, command, environment={}, working_directory=""
):
"""Adds a DebugSettings node to the user file for a particular config.
Args:
command: command line to run. First element in the list is the
executable. All elements of the command will be quoted if
necessary.
working_directory: other files which may trigger the rule. (optional)
"""
command = _QuoteWin32CommandLineArgs(command)
abs_command = _FindCommandInPath(command[0])
if environment and isinstance(environment, dict):
env_list = [f'{key}="{val}"' for (key, val) in environment.items()]
environment = " ".join(env_list)
else:
environment = ""
n_cmd = [
"DebugSettings",
{
"Command": abs_command,
"WorkingDirectory": working_directory,
"CommandArguments": " ".join(command[1:]),
"RemoteMachine": socket.gethostname(),
"Environment": environment,
"EnvironmentMerge": "true",
# Currently these are all "dummy" values that we're just setting
# in the default manner that MSVS does it. We could use some of
# these to add additional capabilities, I suppose, but they might
# not have parity with other platforms then.
"Attach": "false",
"DebuggerType": "3", # 'auto' debugger
"Remote": "1",
"RemoteCommand": "",
"HttpUrl": "",
"PDBPath": "",
"SQLDebugging": "",
"DebuggerFlavor": "0",
"MPIRunCommand": "",
"MPIRunArguments": "",
"MPIRunWorkingDirectory": "",
"ApplicationCommand": "",
"ApplicationArguments": "",
"ShimCommand": "",
"MPIAcceptMode": "",
"MPIAcceptFilter": "",
},
]
# Find the config, and add it if it doesn't exist.
if config_name not in self.configurations:
self.AddConfig(config_name)
# Add the DebugSettings onto the appropriate config.
self.configurations[config_name].append(n_cmd)
def WriteIfChanged(self):
"""Writes the user file."""
configs = ["Configurations"]
for config, spec in sorted(self.configurations.items()):
configs.append(spec)
content = [
"VisualStudioUserFile",
{"Version": self.version.ProjectVersion(), "Name": self.name},
configs,
]
easy_xml.WriteXmlIfChanged(
content, self.user_file_path, encoding="Windows-1252"
)
@@ -0,0 +1,7 @@
export function dehydrateSsrMatchId(id: string): string {
return id.replaceAll('/', '\0')
}
export function hydrateSsrMatchId(id: string): string {
return id.replaceAll('\0', '/').replaceAll('\uFFFD', '/')
}
@@ -0,0 +1,20 @@
import { parseDef } from "../parseDef.js";
export const parsePipelineDef = (def, refs) => {
if (refs.pipeStrategy === "input") {
return parseDef(def.in._def, refs);
}
else if (refs.pipeStrategy === "output") {
return parseDef(def.out._def, refs);
}
const a = parseDef(def.in._def, {
...refs,
currentPath: [...refs.currentPath, "allOf", "0"],
});
const b = parseDef(def.out._def, {
...refs,
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"],
});
return {
allOf: [a, b].filter((x) => x !== undefined),
};
};
@@ -0,0 +1,259 @@
/**
* Experimental KDF for AES.
* @module
*/
import { hkdf } from './hkdf.ts';
import { pbkdf2 as _pbkdf2 } from './pbkdf2.ts';
import { scrypt as _scrypt } from './scrypt.ts';
import { sha256 } from './sha2.ts';
import {
abytes,
bytesToHex,
clean,
createView,
hexToBytes,
kdfInputToBytes,
type TArg,
type TRet,
} from './utils.ts';
// A tiny KDF for various applications like AES key-gen.
// Uses HKDF in a non-standard way, so it's not "KDF-secure", only "PRF-secure".
// Which is good enough: assume sha2-256 retained preimage resistance.
// Fixed ESKDF scrypt work factor: interactive-latency target with about 512 MiB RAM per derivation.
const SCRYPT_FACTOR = /* @__PURE__ */ (() => 2 ** 19)();
// Fixed ESKDF PBKDF2 work factor: CPU-only companion branch in the same rough
// interactive-latency range.
const PBKDF2_FACTOR = /* @__PURE__ */ (() => 2 ** 17)();
/**
* Scrypt KDF with the fixed ESKDF policy tuple `{ N: 2^19, r: 8, p: 1, dkLen: 32 }`.
* @param password - user password string, UTF-8 encoded before entering RFC 7914
* @param salt - unique salt string, UTF-8 encoded before entering RFC 7914
* @returns Derived 32-byte key.
* @example
* Derive the 32-byte scrypt key used by ESKDF.
* ```ts
* scrypt('password123', 'user@example.com');
* ```
*/
export function scrypt(password: string, salt: string): TRet<Uint8Array> {
return _scrypt(password, salt, { N: SCRYPT_FACTOR, r: 8, p: 1, dkLen: 32 });
}
/**
* PBKDF2-HMAC-SHA256 with the fixed ESKDF policy tuple `{ sha256, c: 2^17, dkLen: 32 }`.
* @param password - user password string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256
* @param salt - unique salt string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256
* @returns Derived 32-byte key.
* @example
* Derive the 32-byte PBKDF2 key used by ESKDF.
* ```ts
* pbkdf2('password123', 'user@example.com');
* ```
*/
export function pbkdf2(password: string, salt: string): TRet<Uint8Array> {
return _pbkdf2(sha256, password, salt, { c: PBKDF2_FACTOR, dkLen: 32 });
}
// Combines two 32-byte byte arrays into a fresh 32-byte result without aliasing either input.
function xor32(a: TArg<Uint8Array>, b: TArg<Uint8Array>): TRet<Uint8Array> {
abytes(a, 32);
abytes(b, 32);
const arr = new Uint8Array(32);
for (let i = 0; i < 32; i++) {
arr[i] = a[i] ^ b[i];
}
return arr as TRet<Uint8Array>;
}
// All local string length checks are in JS UTF-16 code units, not UTF-8 bytes.
function strHasLength(str: string, min: number, max: number): boolean {
return typeof str === 'string' && str.length >= min && str.length <= max;
}
/**
* Derives main seed. Takes a lot of time; prefer the higher-level `eskdf(...)`
* flow unless you specifically need the raw main seed.
* Derives the main seed by xor'ing two branches:
* the scrypt branch uses a `0x01` separator byte on username/password,
* and the PBKDF2 branch uses `0x02`.
* Username and password strings are encoded by the underlying KDFs after the
* local separator bytes are appended.
* @param username - account identifier used as public salt
* @param password - user password string
* @returns Main 32-byte seed for the account.
* @throws If the username or password length is invalid. {@link Error}
* @example
* Derive the main ESKDF seed from username and password.
* ```ts
* deriveMainSeed('example-user', 'example-password');
* ```
*/
export function deriveMainSeed(username: string, password: string): TRet<Uint8Array> {
if (!strHasLength(username, 8, 255)) throw new Error('invalid username');
if (!strHasLength(password, 8, 255)) throw new Error('invalid password');
// Keep the protocol separators as the literal bytes 0x01 / 0x02 even after minification.
// Embedding them as non-printable characters directly can be awkward across
// JS tooling and environments.
const codes = { _1: 1, _2: 2 };
const sep = { s: String.fromCharCode(codes._1), p: String.fromCharCode(codes._2) };
const scr = scrypt(password + sep.s, username + sep.s);
const pbk = pbkdf2(password + sep.p, username + sep.p);
const res = xor32(scr, pbk);
clean(scr, pbk);
return res;
}
type AccountID = number | string;
/**
* Converts protocol & accountId pair to HKDF params:
* `info` is UTF-8 protocol bytes, numeric ids become 4-byte BE `salt`,
* and string ids become UTF-8 `salt` bytes.
*/
function getSaltInfo(protocol: string, accountId: AccountID = 0) {
// Note that length here also repeats two lines below
// We do an additional length check here to reduce the scope of DoS attacks
if (!(strHasLength(protocol, 3, 15) && /^[a-z0-9]{3,15}$/.test(protocol))) {
throw new Error('invalid protocol');
}
// Exact-match only: substring matches like `assh` / `mentor` must not widen the public whitelist.
const allowsStr = /^(password\d{0,3}|ssh|tor|file)$/.test(protocol);
let salt: Uint8Array; // Assigned below: either 4-byte BE account bytes or UTF-8 account bytes.
if (typeof accountId === 'string') {
if (!allowsStr) throw new Error('accountId must be a number');
if (!strHasLength(accountId, 1, 255))
throw new Error('accountId must be string of length 1..255');
salt = kdfInputToBytes(accountId);
} else if (Number.isSafeInteger(accountId)) {
if (accountId < 0 || accountId > Math.pow(2, 32) - 1) throw new Error('invalid accountId');
// Convert to Big Endian Uint32
salt = new Uint8Array(4);
createView(salt).setUint32(0, accountId, false);
} else {
throw new Error('accountId must be a number' + (allowsStr ? ' or string' : ''));
}
const info = kdfInputToBytes(protocol);
return { salt, info };
}
type OptsLength = { keyLength: number };
type OptsMod = { modulus: bigint };
type KeyOpts = undefined | OptsLength | OptsMod;
// Local modulus-size helper, not a general bigint-byte-length primitive:
// `<= 128n` is rejected by ESKDF policy.
function countBytes(num: bigint): number {
if (typeof num !== 'bigint' || num <= BigInt(128)) throw new Error('invalid number');
return Math.ceil(num.toString(2).length / 8);
}
/**
* Parses keyLength and modulus options to extract length of result key.
* If modulus is used, adds 64 bits to it per the FIPS 186-5 Appendix A.3.1 /
* A.4.1 extra-bits guidance.
*/
function getKeyLength(options: KeyOpts): number {
if (!options || typeof options !== 'object') return 32;
const hasLen = 'keyLength' in options;
const hasMod = 'modulus' in options;
if (hasLen && hasMod) throw new Error('cannot combine keyLength and modulus options');
if (!hasLen && !hasMod) throw new Error('must have either keyLength or modulus option');
// FIPS 186-5 Appendix A.3.1 / A.4.1 calls for at least 64 extra bits.
const l = hasMod ? countBytes(options.modulus) + 8 : options.keyLength;
if (!(typeof l === 'number' && l >= 16 && l <= 8192)) throw new Error('invalid keyLength');
return l;
}
/**
* Converts key to bigint and divides it by modulus. Big Endian.
* Adapts FIPS 186-5 Appendix A.4.1: `getKeyLength()` already requested the
* extra 64-bit margin, and this step maps the result into `1..modulus-1`.
*/
function modReduceKey(key: TArg<Uint8Array>, modulus: bigint): TRet<Uint8Array> {
const _1 = BigInt(1);
const num = BigInt('0x' + bytesToHex(key)); // check for ui8a, then bytesToNumber()
const res = (num % (modulus - _1)) + _1; // Remove 0 from output
if (res < _1) throw new Error('expected positive number'); // Guard against bad values
// Strip the extra 64-bit margin that `getKeyLength()` requested
// for bias reduction.
const len = key.length - 8;
const hex = res.toString(16).padStart(len * 2, '0'); // numberToHex()
const bytes = hexToBytes(hex);
if (bytes.length !== len) throw new Error('invalid length of result key');
return bytes;
}
/** Not using classes because constructor cannot be async. */
export interface ESKDF {
/**
* Derives a child key. Child key will not be associated with any
* other child key because of properties of underlying KDF.
*
* @param protocol - 3-15 character protocol name
* @param accountId - numeric account identifier, or a string id for
* `password\d{0,3}`, `ssh`, `tor`, or `file`
* @param options - Optional child-key shaping parameters. See {@link KeyOpts}.
* @returns Derived child key bytes.
*/
deriveChildKey: (protocol: string, accountId: AccountID, options?: KeyOpts) => TRet<Uint8Array>;
/** Deletes the main seed from the ESKDF instance. */
expire: () => void;
/**
* Human-readable fingerprint: first 6 bytes of
* `deriveChildKey('fingerprint', 0)`, formatted as uppercase
* colon-separated hex.
*/
fingerprint: string;
}
/**
* ESKDF
* @param username - username, email, or identifier, min: 8 characters, should have enough entropy
* @param password - password, min: 8 characters, should have enough entropy
* @returns Frozen API that derives child keys and exposes the account fingerprint.
* @throws If the username or password length is invalid. {@link Error}
* @example
* Derive account-specific child keys from the main ESKDF seed.
* ```ts
* const kdf = await eskdf('example-university', 'beginning-new-example');
* const key = kdf.deriveChildKey('aes', 0);
* const fingerprint = kdf.fingerprint;
* kdf.expire();
* ```
*/
export async function eskdf(username: string, password: string): Promise<TRet<ESKDF>> {
// We are using closure + object instead of class because
// we want to make `seed` non-accessible for any external function.
let seed: Uint8Array | undefined = deriveMainSeed(username, password);
function deriveCK(
protocol: string,
accountId: AccountID = 0,
options?: KeyOpts
): TRet<Uint8Array> {
// Reject expired instances before deriving any HKDF inputs from the closure-held seed.
abytes(seed!, 32);
const { salt, info } = getSaltInfo(protocol, accountId); // validate protocol & accountId
// Validate option shape and coarse length bounds;
// `hkdf()` still rejects non-integer lengths.
const keyLength = getKeyLength(options);
const key = hkdf(sha256, seed!, salt, info, keyLength);
// Modulus has already been validated
return options && 'modulus' in options ? modReduceKey(key, options.modulus) : key;
}
function expire() {
// Overwrite the closure-held seed before dropping the reference.
if (seed) seed.fill(1);
seed = undefined;
}
// prettier-ignore
const fingerprint = Array.from(deriveCK('fingerprint', 0))
.slice(0, 6)
.map((char) => char.toString(16).padStart(2, '0').toUpperCase())
.join(':');
return Object.freeze({ deriveChildKey: deriveCK, expire, fingerprint });
}
@@ -0,0 +1,13 @@
# `react-id`
## Installation
```sh
$ yarn add @radix-ui/react-id
# or
$ npm install @radix-ui/react-id
```
## Usage
View docs [here](https://radix-ui.com/primitives/docs/utilities/id-provider).
@@ -0,0 +1,29 @@
/**
* JSON Schema validation
*
* This module provides configurable JSON Schema validation for the MCP SDK.
* Choose a validator based on your runtime environment:
*
* - AjvJsonSchemaValidator: Best for Node.js (default, fastest)
* Import from: @modelcontextprotocol/sdk/validation/ajv
* Requires peer dependencies: ajv, ajv-formats
*
* - CfWorkerJsonSchemaValidator: Best for edge runtimes
* Import from: @modelcontextprotocol/sdk/validation/cfworker
* Requires peer dependency: @cfworker/json-schema
*
* @example
* ```typescript
* // For Node.js with AJV
* import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv';
* const validator = new AjvJsonSchemaValidator();
*
* // For Cloudflare Workers
* import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/cfworker';
* const validator = new CfWorkerJsonSchemaValidator();
* ```
*
* @module validation
*/
export type { JsonSchemaType, JsonSchemaValidator, JsonSchemaValidatorResult, jsonSchemaValidator } from './types.js';
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"noop.mjs","sources":["../../src/noop.ts"],"sourcesContent":["/*#__NO_SIDE_EFFECTS__*/\nexport const noop = <T>(any: T): T => any\n"],"names":[],"mappings":"AAAA;AACO,MAAM,IAAI,GAAG,CAAI,GAAM,KAAQ;;;;"}
@@ -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 MegaphoneOff = createLucideIcon("MegaphoneOff", [
["path", { d: "M9.26 9.26 3 11v3l14.14 3.14", key: "3429n" }],
["path", { d: "M21 15.34V6l-7.31 2.03", key: "4o1dh8" }],
["path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6", key: "1yl0tm" }],
["line", { x1: "2", x2: "22", y1: "2", y2: "22", key: "a6p6uj" }]
]);
export { MegaphoneOff as default };
//# sourceMappingURL=megaphone-off.js.map
@@ -0,0 +1,84 @@
import { beforeEach, expect, test } from "vitest";
import * as z from "zod/mini";
// the config object lives on globalThis, so only file isolation protects it; pin the unset precondition explicitly
beforeEach(() => {
delete z.config().memoizer;
});
const cyclic = (): any => {
const input: any = { id: 1 };
input.self = input;
return input;
};
test("cyclic input needs the memoizer opt-in", () => {
const Before: any = z.object({
id: z.number(),
get self() {
return Before;
},
});
expect(() => Before.parse(cyclic())).toThrow(RangeError);
z.config({ memoizer: z.memoizer() });
const After: any = z.object({
id: z.number(),
get self() {
return After;
},
});
const out = After.parse(cyclic());
expect(out.self).toBe(out);
expect(out).not.toBe(cyclic());
// read at construction, so a schema built before the opt-in keeps none
expect(() => Before.parse(cyclic())).toThrow(RangeError);
});
test("the opt-in reaches every core container", () => {
z.config({ memoizer: z.memoizer() });
const Arr: any = z.array(z.lazy(() => Arr));
const input: any = [];
input.push(input);
const out = Arr.parse(input);
expect(out[0]).toBe(out);
});
test("rejects a cycle that closes through a transform", () => {
z.config({ memoizer: z.memoizer() });
const Inner: any = z.object({
name: z.string(),
get self() {
return Wrapped;
},
});
const Wrapped: any = z.pipe(
Inner,
z.transform((value: any) => ({ wrapped: value }))
);
const input: any = { name: "x" };
input.self = input;
expect(() => Wrapped.parse(input)).toThrow(/reference cycle/);
});
test("leaves a transform that is not on the cycle alone", () => {
z.config({ memoizer: z.memoizer() });
const Node: any = z.object({
n: z.pipe(
z.number(),
z.transform((value: number) => value * 2)
),
get self() {
return Node;
},
});
const input: any = { n: 21 };
input.self = input;
const result = Node.parse(input);
expect(result.n).toBe(42);
expect(result.self).toBe(result);
});
@@ -0,0 +1 @@
{"version":3,"file":"is-primary-pointer.mjs","sources":["../../../../src/gestures/utils/is-primary-pointer.ts"],"sourcesContent":["export const isPrimaryPointer = (event: PointerEvent) => {\n if (event.pointerType === \"mouse\") {\n return typeof event.button !== \"number\" || event.button <= 0\n } else {\n /**\n * isPrimary is true for all mice buttons, whereas every touch point\n * is regarded as its own input. So subsequent concurrent touch points\n * will be false.\n *\n * Specifically match against false here as incomplete versions of\n * PointerEvents in very old browser might have it set as undefined.\n */\n return event.isPrimary !== false\n }\n}\n"],"names":[],"mappings":"AAAO,MAAM,gBAAgB,GAAG,CAAC,KAAmB,KAAI;AACpD,IAAA,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO,EAAE;AAC/B,QAAA,OAAO,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;IAChE;SAAO;AACH;;;;;;;AAOG;AACH,QAAA,OAAO,KAAK,CAAC,SAAS,KAAK,KAAK;IACpC;AACJ;;;;"}
@@ -0,0 +1,15 @@
import { ZodDateDef } from "zod/v3";
import { Refs } from "../Refs.js";
import { ErrorMessages } from "../errorMessages.js";
import { JsonSchema7NumberType } from "./number.js";
import { DateStrategy } from "../Options.js";
export type JsonSchema7DateType = {
type: "integer" | "string";
format: "unix-time" | "date-time" | "date";
minimum?: number;
maximum?: number;
errorMessage?: ErrorMessages<JsonSchema7NumberType>;
} | {
anyOf: JsonSchema7DateType[];
};
export declare function parseDateDef(def: ZodDateDef, refs: Refs, overrideDateStrategy?: DateStrategy): JsonSchema7DateType;
@@ -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 Scale3d = createLucideIcon("Scale3d", [
["path", { d: "M5 7v11a1 1 0 0 0 1 1h11", key: "13dt1j" }],
["path", { d: "M5.293 18.707 11 13", key: "ezgbsx" }],
["circle", { cx: "19", cy: "19", r: "2", key: "17f5cg" }],
["circle", { cx: "5", cy: "5", r: "2", key: "1gwv83" }]
]);
export { Scale3d as default };
//# sourceMappingURL=scale-3d.js.map
@@ -0,0 +1 @@
{"version":3,"names":["_setFunctionName","require","_toPropertyKey","applyDecs2203RFactory","createAddInitializerMethod","initializers","decoratorFinishedRef","addInitializer","initializer","assertNotFinished","assertCallable","push","memberDec","dec","name","desc","kind","isStatic","isPrivate","value","kindStr","ctx","toPropertyKey","static","private","v","get","set","call","access","fnName","Error","fn","hint","TypeError","assertValidReturnValue","type","undefined","init","applyMemberDec","ret","base","decInfo","decs","prefix","setFunctionName","Object","getOwnPropertyDescriptor","newValue","i","length","newInit","instance","ownInitializers","originalInitializer","args","defineProperty","applyMemberDecs","Class","decInfos","protoInitializers","staticInitializers","existingProtoNonFields","Map","existingStaticNonFields","Array","isArray","prototype","existingNonFields","existingKind","pushInitializers","applyClassDecs","targetClass","classDecs","newClass","nextNewClass","applyDecs2203R","memberDecs","e","c","exports","default"],"sources":["../../src/helpers/applyDecs2203R.js"],"sourcesContent":["/* @minVersion 7.20.0 */\n/* @onlyBabel7 */\n\nimport setFunctionName from \"setFunctionName\";\nimport toPropertyKey from \"toPropertyKey\";\n\n/**\n Enums are used in this file, but not assigned to vars to avoid non-hoistable values\n\n CONSTRUCTOR = 0;\n PUBLIC = 1;\n PRIVATE = 2;\n\n FIELD = 0;\n ACCESSOR = 1;\n METHOD = 2;\n GETTER = 3;\n SETTER = 4;\n\n STATIC = 5;\n\n CLASS = 10; // only used in assertValidReturnValue\n*/\n\nfunction applyDecs2203RFactory() {\n function createAddInitializerMethod(initializers, decoratorFinishedRef) {\n return function addInitializer(initializer) {\n assertNotFinished(decoratorFinishedRef, \"addInitializer\");\n assertCallable(initializer, \"An initializer\");\n initializers.push(initializer);\n };\n }\n\n function memberDec(\n dec,\n name,\n desc,\n initializers,\n kind,\n isStatic,\n isPrivate,\n value,\n ) {\n var kindStr;\n\n switch (kind) {\n case 1 /* ACCESSOR */:\n kindStr = \"accessor\";\n break;\n case 2 /* METHOD */:\n kindStr = \"method\";\n break;\n case 3 /* GETTER */:\n kindStr = \"getter\";\n break;\n case 4 /* SETTER */:\n kindStr = \"setter\";\n break;\n default:\n kindStr = \"field\";\n }\n\n var ctx = {\n kind: kindStr,\n name: isPrivate ? \"#\" + name : toPropertyKey(name),\n static: isStatic,\n private: isPrivate,\n };\n\n var decoratorFinishedRef = { v: false };\n\n if (kind !== 0 /* FIELD */) {\n ctx.addInitializer = createAddInitializerMethod(\n initializers,\n decoratorFinishedRef,\n );\n }\n\n var get, set;\n if (kind === 0 /* FIELD */) {\n if (isPrivate) {\n get = desc.get;\n set = desc.set;\n } else {\n get = function () {\n return this[name];\n };\n set = function (v) {\n this[name] = v;\n };\n }\n } else if (kind === 2 /* METHOD */) {\n get = function () {\n return desc.value;\n };\n } else {\n // replace with values that will go through the final getter and setter\n if (kind === 1 /* ACCESSOR */ || kind === 3 /* GETTER */) {\n get = function () {\n return desc.get.call(this);\n };\n }\n\n if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) {\n set = function (v) {\n desc.set.call(this, v);\n };\n }\n }\n ctx.access =\n get && set ? { get: get, set: set } : get ? { get: get } : { set: set };\n\n try {\n return dec(value, ctx);\n } finally {\n decoratorFinishedRef.v = true;\n }\n }\n\n function assertNotFinished(decoratorFinishedRef, fnName) {\n if (decoratorFinishedRef.v) {\n throw new Error(\n \"attempted to call \" + fnName + \" after decoration was finished\",\n );\n }\n }\n\n function assertCallable(fn, hint) {\n if (typeof fn !== \"function\") {\n throw new TypeError(hint + \" must be a function\");\n }\n }\n\n function assertValidReturnValue(kind, value) {\n var type = typeof value;\n\n if (kind === 1 /* ACCESSOR */) {\n if (type !== \"object\" || value === null) {\n throw new TypeError(\n \"accessor decorators must return an object with get, set, or init properties or void 0\",\n );\n }\n if (value.get !== undefined) {\n assertCallable(value.get, \"accessor.get\");\n }\n if (value.set !== undefined) {\n assertCallable(value.set, \"accessor.set\");\n }\n if (value.init !== undefined) {\n assertCallable(value.init, \"accessor.init\");\n }\n } else if (type !== \"function\") {\n var hint;\n if (kind === 0 /* FIELD */) {\n hint = \"field\";\n } else if (kind === 10 /* CLALine truncated
@@ -0,0 +1,835 @@
import { E as createBuilder, J as createLogger, dt as require_picocolors, lt as VERSION, mt as __toESM } from "./chunks/node.js";
import fs from "node:fs";
import path from "node:path";
import { inspect } from "node:util";
import { performance } from "node:perf_hooks";
//#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
function toArr(any) {
return any == null ? [] : Array.isArray(any) ? any : [any];
}
function toVal(out, key, val, opts) {
var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
}
function lib_default(args, opts) {
args = args || [];
opts = opts || {};
var k, arr, arg, name, val, out = { _: [] };
var i = 0, j = 0, idx = 0, len = args.length;
const alibi = opts.alias !== void 0;
const strict = opts.unknown !== void 0;
const defaults = opts.default !== void 0;
opts.alias = opts.alias || {};
opts.string = toArr(opts.string);
opts.boolean = toArr(opts.boolean);
if (alibi) for (k in opts.alias) {
arr = opts.alias[k] = toArr(opts.alias[k]);
for (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
}
for (i = opts.boolean.length; i-- > 0;) {
arr = opts.alias[opts.boolean[i]] || [];
for (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);
}
for (i = opts.string.length; i-- > 0;) {
arr = opts.alias[opts.string[i]] || [];
for (j = arr.length; j-- > 0;) opts.string.push(arr[j]);
}
if (defaults) for (k in opts.default) {
name = typeof opts.default[k];
arr = opts.alias[k] = opts.alias[k] || [];
if (opts[name] !== void 0) {
opts[name].push(k);
for (i = 0; i < arr.length; i++) opts[name].push(arr[i]);
}
}
const keys = strict ? Object.keys(opts.alias) : [];
for (i = 0; i < len; i++) {
arg = args[i];
if (arg === "--") {
out._ = out._.concat(args.slice(++i));
break;
}
for (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;
if (j === 0) out._.push(arg);
else if (arg.substring(j, j + 3) === "no-") {
name = arg.substring(j + 3);
if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
out[name] = false;
} else {
for (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
name = arg.substring(j, idx);
val = arg.substring(++idx) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
arr = j === 2 ? [name] : name;
for (idx = 0; idx < arr.length; idx++) {
name = arr[idx];
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
toVal(out, name, idx + 1 < arr.length || val, opts);
}
}
}
if (defaults) {
for (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];
}
if (alibi) for (k in out) {
arr = opts.alias[k] || [];
while (arr.length > 0) out[arr.shift()] = out[k];
}
return out;
}
function removeBrackets(v) {
return v.replace(/[<[].+/, "").trim();
}
function findAllBrackets(v) {
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
const res = [];
const parse = (match) => {
let variadic = false;
let value = match[1];
if (value.startsWith("...")) {
value = value.slice(3);
variadic = true;
}
return {
required: match[0].startsWith("<"),
value,
variadic
};
};
let angledMatch;
while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(angledMatch));
let squareMatch;
while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));
return res;
}
function getMriOptions(options) {
const result = {
alias: {},
boolean: []
};
for (const [index, option] of options.entries()) {
if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
if (option.isBoolean) if (option.negated) {
if (!options.some((o, i) => {
return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
})) result.boolean.push(option.names[0]);
} else result.boolean.push(option.names[0]);
}
return result;
}
function findLongest(arr) {
return arr.sort((a, b) => {
return a.length > b.length ? -1 : 1;
})[0];
}
function padRight(str, length) {
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
}
function camelcase(input) {
return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2) => {
return p1 + p2.toUpperCase();
});
}
function setDotProp(obj, keys, val) {
let current = obj;
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (i === keys.length - 1) {
current[key] = val;
return;
}
if (current[key] == null) {
const nextKeyIsArrayIndex = +keys[i + 1] > -1;
current[key] = nextKeyIsArrayIndex ? [] : {};
}
current = current[key];
}
}
function setByType(obj, transforms) {
for (const key of Object.keys(transforms)) {
const transform = transforms[key];
if (transform.shouldTransform) {
obj[key] = [obj[key]].flat();
if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
}
}
}
function getFileName(input) {
const m = /([^\\/]+)$/.exec(input);
return m ? m[1] : "";
}
function camelcaseOptionName(name) {
return name.split(".").map((v, i) => {
return i === 0 ? camelcase(v) : v;
}).join(".");
}
var CACError = class extends Error {
constructor(message) {
super(message);
this.name = "CACError";
if (typeof Error.captureStackTrace !== "function") this.stack = new Error(message).stack;
}
};
var Option = class {
rawName;
description;
/** Option name */
name;
/** Option name and aliases */
names;
isBoolean;
required;
config;
negated;
constructor(rawName, description, config) {
this.rawName = rawName;
this.description = description;
this.config = Object.assign({}, config);
rawName = rawName.replaceAll(".*", "");
this.negated = false;
this.names = removeBrackets(rawName).split(",").map((v) => {
let name = v.trim().replace(/^-{1,2}/, "");
if (name.startsWith("no-")) {
this.negated = true;
name = name.replace(/^no-/, "");
}
return camelcaseOptionName(name);
}).sort((a, b) => a.length > b.length ? 1 : -1);
this.name = this.names.at(-1);
if (this.negated && this.config.default == null) this.config.default = true;
if (rawName.includes("<")) this.required = true;
else if (rawName.includes("[")) this.required = false;
else this.isBoolean = true;
}
};
let runtimeProcessArgs;
let runtimeInfo;
if (typeof process !== "undefined") {
let runtimeName;
if (typeof Deno !== "undefined" && typeof Deno.version?.deno === "string") runtimeName = "deno";
else if (typeof Bun !== "undefined" && typeof Bun.version === "string") runtimeName = "bun";
else runtimeName = "node";
runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
runtimeProcessArgs = process.argv;
} else if (typeof navigator === "undefined") runtimeInfo = `unknown`;
else runtimeInfo = `${navigator.platform} ${navigator.userAgent}`;
var Command = class {
rawName;
description;
config;
cli;
options;
aliasNames;
name;
args;
commandAction;
usageText;
versionNumber;
examples;
helpCallback;
globalCommand;
constructor(rawName, description, config = {}, cli) {
this.rawName = rawName;
this.description = description;
this.config = config;
this.cli = cli;
this.options = [];
this.aliasNames = [];
this.name = removeBrackets(rawName);
this.args = findAllBrackets(rawName);
this.examples = [];
}
usage(text) {
this.usageText = text;
return this;
}
allowUnknownOptions() {
this.config.allowUnknownOptions = true;
return this;
}
ignoreOptionDefaultValue() {
this.config.ignoreOptionDefaultValue = true;
return this;
}
version(version, customFlags = "-v, --version") {
this.versionNumber = version;
this.option(customFlags, "Display version number");
return this;
}
example(example) {
this.examples.push(example);
return this;
}
/**
* Add a option for this command
* @param rawName Raw option name(s)
* @param description Option description
* @param config Option config
*/
option(rawName, description, config) {
const option = new Option(rawName, description, config);
this.options.push(option);
return this;
}
alias(name) {
this.aliasNames.push(name);
return this;
}
action(callback) {
this.commandAction = callback;
return this;
}
/**
* Check if a command name is matched by this command
* @param name Command name
*/
isMatched(name) {
return this.name === name || this.aliasNames.includes(name);
}
get isDefaultCommand() {
return this.name === "" || this.aliasNames.includes("!");
}
get isGlobalCommand() {
return this instanceof GlobalCommand;
}
/**
* Check if an option is registered in this command
* @param name Option name
*/
hasOption(name) {
name = name.split(".")[0];
return this.options.find((option) => {
return option.names.includes(name);
});
}
outputHelp() {
const { name, commands } = this.cli;
const { versionNumber, options: globalOptions, helpCallback } = this.cli.globalCommand;
let sections = [{ body: `${name}${versionNumber ? `/${versionNumber}` : ""}` }];
sections.push({
title: "Usage",
body: ` $ ${name} ${this.usageText || this.rawName}`
});
if ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {
const longestCommandName = findLongest(commands.map((command) => command.rawName));
sections.push({
title: "Commands",
body: commands.map((command) => {
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
}).join("\n")
}, {
title: `For more info, run any command with the \`--help\` flag`,
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
});
}
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
if (!this.isGlobalCommand && !this.isDefaultCommand) options = options.filter((option) => option.name !== "version");
if (options.length > 0) {
const longestOptionName = findLongest(options.map((option) => option.rawName));
sections.push({
title: "Options",
body: options.map((option) => {
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
}).join("\n")
});
}
if (this.examples.length > 0) sections.push({
title: "Examples",
body: this.examples.map((example) => {
if (typeof example === "function") return example(name);
return example;
}).join("\n")
});
if (helpCallback) sections = helpCallback(sections) || sections;
console.info(sections.map((section) => {
return section.title ? `${section.title}:\n${section.body}` : section.body;
}).join("\n\n"));
}
outputVersion() {
const { name } = this.cli;
const { versionNumber } = this.cli.globalCommand;
if (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);
}
checkRequiredArgs() {
const minimalArgsCount = this.args.filter((arg) => arg.required).length;
if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
}
/**
* Check if the parsed options contain any unknown options
*
* Exit and output error when true
*/
checkUnknownOptions() {
const { options, globalCommand } = this.cli;
if (!this.config.allowUnknownOptions) {
for (const name of Object.keys(options)) if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
}
}
/**
* Check if the required string-type options exist
*/
checkOptionValue() {
const { options: parsedOptions, globalCommand } = this.cli;
const options = [...globalCommand.options, ...this.options];
for (const option of options) {
const value = parsedOptions[option.name.split(".")[0]];
if (option.required) {
const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
if (value === true || value === false && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
}
}
}
/**
* Check if the number of args is more than expected
*/
checkUnusedArgs() {
const maximumArgsCount = this.args.some((arg) => arg.variadic) ? Infinity : this.args.length;
if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg) => `\`${arg}\``).join(", ")}`);
}
};
var GlobalCommand = class extends Command {
constructor(cli) {
super("@@global@@", "", {}, cli);
}
};
var CAC = class extends EventTarget {
/** The program name to display in help and version message */
name;
commands;
globalCommand;
matchedCommand;
matchedCommandName;
/**
* Raw CLI arguments
*/
rawArgs;
/**
* Parsed CLI arguments
*/
args;
/**
* Parsed CLI options, camelCased
*/
options;
showHelpOnExit;
showVersionOnExit;
/**
* @param name The program name to display in help and version message
*/
constructor(name = "") {
super();
this.name = name;
this.commands = [];
this.rawArgs = [];
this.args = [];
this.options = {};
this.globalCommand = new GlobalCommand(this);
this.globalCommand.usage("<command> [options]");
}
/**
* Add a global usage text.
*
* This is not used by sub-commands.
*/
usage(text) {
this.globalCommand.usage(text);
return this;
}
/**
* Add a sub-command
*/
command(rawName, description, config) {
const command = new Command(rawName, description || "", config, this);
command.globalCommand = this.globalCommand;
this.commands.push(command);
return command;
}
/**
* Add a global CLI option.
*
* Which is also applied to sub-commands.
*/
option(rawName, description, config) {
this.globalCommand.option(rawName, description, config);
return this;
}
/**
* Show help message when `-h, --help` flags appear.
*
*/
help(callback) {
this.globalCommand.option("-h, --help", "Display this message");
this.globalCommand.helpCallback = callback;
this.showHelpOnExit = true;
return this;
}
/**
* Show version number when `-v, --version` flags appear.
*
*/
version(version, customFlags = "-v, --version") {
this.globalCommand.version(version, customFlags);
this.showVersionOnExit = true;
return this;
}
/**
* Add a global example.
*
* This example added here will not be used by sub-commands.
*/
example(example) {
this.globalCommand.example(example);
return this;
}
/**
* Output the corresponding help message
* When a sub-command is matched, output the help message for the command
* Otherwise output the global one.
*
*/
outputHelp() {
if (this.matchedCommand) this.matchedCommand.outputHelp();
else this.globalCommand.outputHelp();
}
/**
* Output the version number.
*
*/
outputVersion() {
this.globalCommand.outputVersion();
}
setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
this.args = args;
this.options = options;
if (matchedCommand) this.matchedCommand = matchedCommand;
if (matchedCommandName) this.matchedCommandName = matchedCommandName;
return this;
}
unsetMatchedCommand() {
this.matchedCommand = void 0;
this.matchedCommandName = void 0;
}
/**
* Parse argv
*/
parse(argv, { run = true } = {}) {
if (!argv) {
if (!runtimeProcessArgs) throw new Error("No argv provided and runtime process argv is not available.");
argv = runtimeProcessArgs;
}
this.rawArgs = argv;
if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
let shouldParse = true;
for (const command of this.commands) {
const parsed = this.mri(argv.slice(2), command);
const commandName = parsed.args[0];
if (command.isMatched(commandName)) {
shouldParse = false;
const parsedInfo = {
...parsed,
args: parsed.args.slice(1)
};
this.setParsedInfo(parsedInfo, command, commandName);
this.dispatchEvent(new CustomEvent(`command:${commandName}`, { detail: command }));
}
}
if (shouldParse) {
for (const command of this.commands) if (command.isDefaultCommand) {
shouldParse = false;
const parsed = this.mri(argv.slice(2), command);
this.setParsedInfo(parsed, command);
this.dispatchEvent(new CustomEvent("command:!", { detail: command }));
}
}
if (shouldParse) {
const parsed = this.mri(argv.slice(2));
this.setParsedInfo(parsed);
}
if (this.options.help && this.showHelpOnExit) {
this.outputHelp();
run = false;
this.unsetMatchedCommand();
}
if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
this.outputVersion();
run = false;
this.unsetMatchedCommand();
}
const parsedArgv = {
args: this.args,
options: this.options
};
if (run) this.runMatchedCommand();
if (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent("command:*", { detail: this.args[0] }));
return parsedArgv;
}
mri(argv, command) {
const cliOptions = [...this.globalCommand.options, ...command ? command.options : []];
const mriOptions = getMriOptions(cliOptions);
let argsAfterDoubleDashes = [];
const doubleDashesIndex = argv.indexOf("--");
if (doubleDashesIndex !== -1) {
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
argv = argv.slice(0, doubleDashesIndex);
}
let parsed = lib_default(argv, mriOptions);
parsed = Object.keys(parsed).reduce((res, name) => {
return {
...res,
[camelcaseOptionName(name)]: parsed[name]
};
}, { _: [] });
const args = parsed._;
const options = { "--": argsAfterDoubleDashes };
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
const transforms = Object.create(null);
for (const cliOption of cliOptions) {
if (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;
if (Array.isArray(cliOption.config.type) && transforms[cliOption.name] === void 0) {
transforms[cliOption.name] = Object.create(null);
transforms[cliOption.name].shouldTransform = true;
transforms[cliOption.name].transformFunction = cliOption.config.type[0];
}
}
for (const key of Object.keys(parsed)) if (key !== "_") {
setDotProp(options, key.split("."), parsed[key]);
setByType(options, transforms);
}
return {
args,
options
};
}
runMatchedCommand() {
const { args, options, matchedCommand: command } = this;
if (!command || !command.commandAction) return;
command.checkUnknownOptions();
command.checkOptionValue();
command.checkRequiredArgs();
command.checkUnusedArgs();
const actionArgs = [];
command.args.forEach((arg, index) => {
if (arg.variadic) actionArgs.push(args.slice(index));
else actionArgs.push(args[index]);
});
actionArgs.push(options);
return command.commandAction.apply(this, actionArgs);
}
};
/**
* @param name The program name to display in help and version message
*/
const cac = (name = "") => new CAC(name);
//#endregion
//#region src/node/cli.ts
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
function checkNodeVersion(nodeVersion) {
const currentVersion = nodeVersion.split(".");
const major = parseInt(currentVersion[0], 10);
const minor = parseInt(currentVersion[1], 10);
return major === 20 && minor >= 19 || major === 22 && minor >= 12 || major > 22;
}
if (!checkNodeVersion(process.versions.node)) console.warn(import_picocolors.default.yellow(`You are using Node.js ${process.versions.node}. Vite requires Node.js version 20.19+ or 22.12+. Please upgrade your Node.js version.`));
const cli = cac("vite");
let profileSession = global.__vite_profile_session;
let profileCount = 0;
const stopProfiler = (log) => {
if (!profileSession) return;
return new Promise((res, rej) => {
profileSession.post("Profiler.stop", (err, { profile }) => {
if (!err) {
const outPath = path.resolve(`./vite-profile-${profileCount++}.cpuprofile`);
fs.writeFileSync(outPath, JSON.stringify(profile));
log(import_picocolors.default.yellow(`CPU profile written to ${import_picocolors.default.white(import_picocolors.default.dim(outPath))}`));
profileSession = void 0;
res();
} else rej(err);
});
});
};
const filterDuplicateOptions = (options) => {
for (const [key, value] of Object.entries(options)) if (Array.isArray(value)) options[key] = value[value.length - 1];
};
/**
* removing global flags before passing as command specific sub-configs
*/
function cleanGlobalCLIOptions(options) {
const ret = { ...options };
delete ret["--"];
delete ret.c;
delete ret.config;
delete ret.base;
delete ret.l;
delete ret.logLevel;
delete ret.clearScreen;
delete ret.configLoader;
delete ret.d;
delete ret.debug;
delete ret.f;
delete ret.filter;
delete ret.m;
delete ret.mode;
delete ret.force;
delete ret.w;
if ("sourcemap" in ret) {
const sourcemap = ret.sourcemap;
ret.sourcemap = sourcemap === "true" ? true : sourcemap === "false" ? false : ret.sourcemap;
}
if ("watch" in ret) ret.watch = ret.watch ? {} : void 0;
return ret;
}
/**
* removing builder flags before passing as command specific sub-configs
*/
function cleanBuilderCLIOptions(options) {
const ret = { ...options };
delete ret.app;
return ret;
}
/**
* host may be a number (like 0), should convert to string
*/
const convertHost = (v) => {
if (typeof v === "number") return String(v);
return v;
};
/**
* base may be a number (like 0), should convert to empty string
*/
const convertBase = (v) => {
if (v === 0) return "";
return v;
};
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, { type: [convertBase] }).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("--configLoader <loader>", `[string] use 'bundle' to bundle the config with Rolldown, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--open [path]", `[boolean | string] open browser on startup`).option("--cors", `[boolean] enable CORS`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).option("--experimentalBundle", `[boolean] use experimental full bundle mode (this is highly experimental)`).action(async (root, options) => {
filterDuplicateOptions(options);
const { createServer } = await import("./chunks/node.js").then((n) => n.j);
try {
const server = await createServer({
root,
base: options.base,
mode: options.mode,
configFile: options.config,
configLoader: options.configLoader,
logLevel: options.logLevel,
clearScreen: options.clearScreen,
server: cleanGlobalCLIOptions(options),
forceOptimizeDeps: options.force,
experimental: { bundledDev: options.experimentalBundle }
});
if (!server.httpServer) throw new Error("HTTP server not available");
await server.listen();
const info = server.config.logger.info;
const modeString = options.mode && options.mode !== "development" ? ` ${import_picocolors.default.bgGreen(` ${import_picocolors.default.bold(options.mode)} `)}` : "";
const viteStartTime = global.__vite_start_time ?? false;
const startupDurationString = viteStartTime ? import_picocolors.default.dim(`ready in ${import_picocolors.default.reset(import_picocolors.default.bold(Math.ceil(performance.now() - viteStartTime)))} ms`) : "";
const hasExistingLogs = process.stdout.bytesWritten > 0 || process.stderr.bytesWritten > 0;
info(`\n ${import_picocolors.default.green(`${import_picocolors.default.bold("VITE")} v${VERSION}`)}${modeString} ${startupDurationString}\n`, { clear: !hasExistingLogs });
server.printUrls();
const customShortcuts = [];
if (profileSession) customShortcuts.push({
key: "p",
description: "start/stop the profiler",
async action(server) {
if (profileSession) await stopProfiler(server.config.logger.info);
else {
const inspector = await import("node:inspector").then((r) => r.default);
await new Promise((res) => {
profileSession = new inspector.Session();
profileSession.connect();
profileSession.post("Profiler.enable", () => {
profileSession.post("Profiler.start", () => {
server.config.logger.info("Profiler started");
res();
});
});
});
}
}
});
server.bindCLIShortcuts({
print: true,
customShortcuts
});
} catch (e) {
const logger = createLogger(options.logLevel);
logger.error(import_picocolors.default.red(`error when starting dev server:\n${inspect(e)}`), { error: e });
await stopProfiler(logger.info);
process.exit(1);
}
});
cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'baseline-widely-available')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option("--assetsDir <dir>", `[string] directory under outDir to place assets in (default: assets)`).option("--assetsInlineLimit <number>", `[number] static asset base64 inline threshold in bytes (default: 4096)`).option("--ssr [entry]", `[string] build specified entry for server-side rendering`).option("--sourcemap [output]", `[boolean | "inline" | "hidden"] output source maps for build (default: false)`).option("--minify [minifier]", "[boolean | \"oxc\" | \"terser\" | \"esbuild\"] enable/disable minification, or specify minifier to use (default: oxc)").option("--manifest [name]", `[boolean | string] emit build manifest json`).option("--ssrManifest [name]", `[boolean | string] emit ssr manifest json`).option("--emptyOutDir", `[boolean] force empty outDir when it's outside of root`).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(async (root, options) => {
filterDuplicateOptions(options);
const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
try {
const builder = await createBuilder({
root,
base: options.base,
mode: options.mode,
configFile: options.config,
configLoader: options.configLoader,
logLevel: options.logLevel,
clearScreen: options.clearScreen,
build: buildOptions,
...options.app ? { builder: {} } : {}
}, null);
await builder.buildApp();
await builder.runDevTools();
} catch (e) {
createLogger(options.logLevel).error(import_picocolors.default.red(`error during build:\n${inspect(e)}`), { error: e });
process.exit(1);
} finally {
await stopProfiler((message) => createLogger(options.logLevel).info(message));
}
});
cli.command("optimize [root]", "pre-bundle dependencies (deprecated, the pre-bundle process runs automatically and does not need to be called)").option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).action(async (root, options) => {
filterDuplicateOptions(options);
const { resolveConfig } = await import("./chunks/node.js").then((n) => n.f);
const { optimizeDeps } = await import("./chunks/node.js").then((n) => n.O);
try {
await optimizeDeps(await resolveConfig({
root,
base: options.base,
configFile: options.config,
configLoader: options.configLoader,
logLevel: options.logLevel,
mode: options.mode
}, "serve"), options.force, true);
} catch (e) {
createLogger(options.logLevel).error(import_picocolors.default.red(`error when optimizing deps:\n${inspect(e)}`), { error: e });
process.exit(1);
}
});
cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(async (root, options) => {
filterDuplicateOptions(options);
const { preview } = await import("./chunks/node.js").then((n) => n.y);
try {
const server = await preview({
root,
base: options.base,
configFile: options.config,
configLoader: options.configLoader,
logLevel: options.logLevel,
mode: options.mode,
build: { outDir: options.outDir },
preview: {
port: options.port,
strictPort: options.strictPort,
host: options.host,
open: options.open
}
});
server.printUrls();
server.bindCLIShortcuts({ print: true });
} catch (e) {
createLogger(options.logLevel).error(import_picocolors.default.red(`error when starting preview server:\n${inspect(e)}`), { error: e });
process.exit(1);
} finally {
await stopProfiler((message) => createLogger(options.logLevel).info(message));
}
});
cli.help();
cli.version(VERSION);
cli.parse();
//#endregion
export { stopProfiler };
@@ -0,0 +1,58 @@
import type {CodeKeywordDefinition, SchemaObject} from "../../types"
import type {KeywordCxt} from "../../compile/validate"
import {alwaysValidSchema, Type} from "../../compile/util"
import {not, or, Name} from "../../compile/codegen"
import {checkMetadata} from "./metadata"
import {checkNullableObject} from "./nullable"
import {typeError, _JTDTypeError} from "./error"
export type JTDValuesError = _JTDTypeError<"values", "object", SchemaObject>
const def: CodeKeywordDefinition = {
keyword: "values",
schemaType: "object",
error: typeError("object"),
code(cxt: KeywordCxt) {
checkMetadata(cxt)
const {gen, data, schema, it} = cxt
const [valid, cond] = checkNullableObject(cxt, data)
if (alwaysValidSchema(it, schema)) {
gen.if(not(or(cond, valid)), () => cxt.error())
} else {
gen.if(cond)
gen.assign(valid, validateMap())
gen.elseIf(not(valid))
cxt.error()
gen.endIf()
}
cxt.ok(valid)
function validateMap(): Name | boolean {
const _valid = gen.name("valid")
if (it.allErrors) {
const validMap = gen.let("valid", true)
validateValues(() => gen.assign(validMap, false))
return validMap
}
gen.var(_valid, true)
validateValues(() => gen.break())
return _valid
function validateValues(notValid: () => void): void {
gen.forIn("key", data, (key) => {
cxt.subschema(
{
keyword: "values",
dataProp: key,
dataPropType: Type.Str,
},
_valid
)
gen.if(not(_valid), notValid)
})
}
}
},
}
export default def
@@ -0,0 +1,177 @@
/**
* @fileoverview Utility to get information about the execution environment.
* @author Kai Cataldo
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const path = require("node:path");
const spawn = require("cross-spawn");
const os = require("node:os");
const log = require("../shared/logging");
const packageJson = require("../../package.json");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Generates and returns execution environment information.
* @returns {string} A string that contains execution environment information.
*/
function environment() {
const cache = new Map();
/**
* Checks if a path is a child of a directory.
* @param {string} parentPath The parent path to check.
* @param {string} childPath The path to check.
* @returns {boolean} Whether or not the given path is a child of a directory.
*/
function isChildOfDirectory(parentPath, childPath) {
return !path.relative(parentPath, childPath).startsWith("..");
}
/**
* Synchronously executes a shell command and formats the result.
* @param {string} cmd The command to execute.
* @param {Array} args The arguments to be executed with the command.
* @throws {Error} As may be collected by `cross-spawn.sync`.
* @returns {string} The version returned by the command.
*/
function execCommand(cmd, args) {
const key = [cmd, ...args].join(" ");
if (cache.has(key)) {
return cache.get(key);
}
const process = spawn.sync(cmd, args, { encoding: "utf8" });
if (process.error) {
throw process.error;
}
const result = process.stdout.trim();
cache.set(key, result);
return result;
}
/**
* Normalizes a version number.
* @param {string} versionStr The string to normalize.
* @returns {string} The normalized version number.
*/
function normalizeVersionStr(versionStr) {
return versionStr.startsWith("v") ? versionStr : `v${versionStr}`;
}
/**
* Gets bin version.
* @param {string} bin The bin to check.
* @throws {Error} As may be collected by `cross-spawn.sync`.
* @returns {string} The normalized version returned by the command.
*/
function getBinVersion(bin) {
const binArgs = ["--version"];
try {
return normalizeVersionStr(execCommand(bin, binArgs));
} catch (e) {
log.error(
`Error finding ${bin} version running the command \`${bin} ${binArgs.join(" ")}\``,
);
throw e;
}
}
/**
* Gets installed npm package version.
* @param {string} pkg The package to check.
* @param {boolean} global Whether to check globally or not.
* @throws {Error} As may be collected by `cross-spawn.sync`.
* @returns {string} The normalized version returned by the command.
*/
function getNpmPackageVersion(pkg, { global = false } = {}) {
const npmBinArgs = ["bin", "-g"];
const npmLsArgs = ["ls", "--depth=0", "--json", pkg];
if (global) {
npmLsArgs.push("-g");
}
try {
const parsedStdout = JSON.parse(execCommand("npm", npmLsArgs));
/*
* Checking globally returns an empty JSON object, while local checks
* include the name and version of the local project.
*/
if (
Object.keys(parsedStdout).length === 0 ||
!(parsedStdout.dependencies && parsedStdout.dependencies.eslint)
) {
return "Not found";
}
const [, processBinPath] = process.argv;
let npmBinPath;
try {
npmBinPath = execCommand("npm", npmBinArgs);
} catch (e) {
log.error(
`Error finding npm binary path when running command \`npm ${npmBinArgs.join(" ")}\``,
);
throw e;
}
const isGlobal = isChildOfDirectory(npmBinPath, processBinPath);
let pkgVersion = parsedStdout.dependencies.eslint.version;
if ((global && isGlobal) || (!global && !isGlobal)) {
pkgVersion += " (Currently used)";
}
return normalizeVersionStr(pkgVersion);
} catch (e) {
log.error(
`Error finding ${pkg} version running the command \`npm ${npmLsArgs.join(" ")}\``,
);
throw e;
}
}
return [
"Environment Info:",
"",
`Node version: ${process.version}`,
`npm version: ${getBinVersion("npm")}`,
`Local ESLint version: ${getNpmPackageVersion("eslint", { global: false })}`,
`Global ESLint version: ${getNpmPackageVersion("eslint", { global: true })}`,
`Operating System: ${os.platform()} ${os.release()}`,
].join("\n");
}
/**
* Returns version of currently executing ESLint.
* @returns {string} The version from the currently executing ESLint's package.json.
*/
function version() {
return `v${packageJson.version}`;
}
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
module.exports = {
__esModule: true, // Indicate intent for imports, remove ambiguity for Knip (see: https://github.com/eslint/eslint/pull/18005#discussion_r1484422616)
environment,
version,
};
@@ -0,0 +1 @@
export const isServer = process.env.NODE_ENV === 'test' ? undefined : true
@@ -0,0 +1,7 @@
ISC License
Copyright (c) 2023, and above Paolo Insogna, NearForm and other contributors
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,211 @@
/*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies.
* @private
*/
var db = require('mime-db')
var extname = require('path').extname
var mimeScore = require('./mimeScore')
/**
* Module variables.
* @private
*/
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/
var TEXT_TYPE_REGEXP = /^text\//i
/**
* Module exports.
* @public
*/
exports.charset = charset
exports.charsets = { lookup: charset }
exports.contentType = contentType
exports.extension = extension
exports.extensions = Object.create(null)
exports.lookup = lookup
exports.types = Object.create(null)
exports._extensionConflicts = []
// Populate the extensions/types maps
populateMaps(exports.extensions, exports.types)
/**
* Get the default charset for a MIME type.
*
* @param {string} type
* @return {false|string}
*/
function charset (type) {
if (!type || typeof type !== 'string') {
return false
}
// TODO: use media-typer
var match = EXTRACT_TYPE_REGEXP.exec(type)
var mime = match && db[match[1].toLowerCase()]
if (mime && mime.charset) {
return mime.charset
}
// default text/* to utf-8
if (match && TEXT_TYPE_REGEXP.test(match[1])) {
return 'UTF-8'
}
return false
}
/**
* Create a full Content-Type header given a MIME type or extension.
*
* @param {string} str
* @return {false|string}
*/
function contentType (str) {
// TODO: should this even be in this module?
if (!str || typeof str !== 'string') {
return false
}
var mime = str.indexOf('/') === -1 ? exports.lookup(str) : str
if (!mime) {
return false
}
// TODO: use content-type or other module
if (mime.indexOf('charset') === -1) {
var charset = exports.charset(mime)
if (charset) mime += '; charset=' + charset.toLowerCase()
}
return mime
}
/**
* Get the default extension for a MIME type.
*
* @param {string} type
* @return {false|string}
*/
function extension (type) {
if (!type || typeof type !== 'string') {
return false
}
// TODO: use media-typer
var match = EXTRACT_TYPE_REGEXP.exec(type)
// get extensions
var exts = match && exports.extensions[match[1].toLowerCase()]
if (!exts || !exts.length) {
return false
}
return exts[0]
}
/**
* Lookup the MIME type for a file path/extension.
*
* @param {string} path
* @return {false|string}
*/
function lookup (path) {
if (!path || typeof path !== 'string') {
return false
}
// get the extension ("ext" or ".ext" or full path)
var extension = extname('x.' + path)
.toLowerCase()
.slice(1)
if (!extension) {
return false
}
return exports.types[extension] || false
}
/**
* Populate the extensions and types maps.
* @private
*/
function populateMaps (extensions, types) {
Object.keys(db).forEach(function forEachMimeType (type) {
var mime = db[type]
var exts = mime.extensions
if (!exts || !exts.length) {
return
}
// mime -> extensions
extensions[type] = exts
// extension -> mime
for (var i = 0; i < exts.length; i++) {
var extension = exts[i]
types[extension] = _preferredType(extension, types[extension], type)
// DELETE (eventually): Capture extension->type maps that change as a
// result of switching to mime-score. This is just to help make reviewing
// PR #119 easier, and can be removed once that PR is approved.
const legacyType = _preferredTypeLegacy(
extension,
types[extension],
type
)
if (legacyType !== types[extension]) {
exports._extensionConflicts.push([extension, legacyType, types[extension]])
}
}
})
}
// Resolve type conflict using mime-score
function _preferredType (ext, type0, type1) {
var score0 = type0 ? mimeScore(type0, db[type0].source) : 0
var score1 = type1 ? mimeScore(type1, db[type1].source) : 0
return score0 > score1 ? type0 : type1
}
// Resolve type conflict using pre-mime-score logic
function _preferredTypeLegacy (ext, type0, type1) {
var SOURCE_RANK = ['nginx', 'apache', undefined, 'iana']
var score0 = type0 ? SOURCE_RANK.indexOf(db[type0].source) : 0
var score1 = type1 ? SOURCE_RANK.indexOf(db[type1].source) : 0
if (
exports.types[extension] !== 'application/octet-stream' &&
(score0 > score1 ||
(score0 === score1 &&
exports.types[extension]?.slice(0, 12) === 'application/'))
) {
return type0
}
return score0 > score1 ? type0 : type1
}
@@ -0,0 +1 @@
{"version":3,"file":"wrench.js","sources":["../../../src/icons/wrench.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Wrench\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTQuNyA2LjNhMSAxIDAgMCAwIDAgMS40bDEuNiAxLjZhMSAxIDAgMCAwIDEuNCAwbDMuNzctMy43N2E2IDYgMCAwIDEtNy45NCA3Ljk0bC02LjkxIDYuOTFhMi4xMiAyLjEyIDAgMCAxLTMtM2w2LjkxLTYuOTFhNiA2IDAgMCAxIDcuOTQtNy45NGwtMy43NiAzLjc2eiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/wrench\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 Wrench = createLucideIcon('Wrench', [\n [\n 'path',\n {\n d: 'M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z',\n key: 'cbrjhi',\n },\n ],\n]);\n\nexport default Wrench;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,iBAAiB,QAAU,CAAA,CAAA,CAAA;AAAA,CACxC,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;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,13 @@
# `number`
## Installation
```sh
$ yarn add @radix-ui/number
# or
$ npm install @radix-ui/number
```
## Usage
This is an internal utility, not intended for public usage.
@@ -0,0 +1,24 @@
# json-buffer
JSON functions that can convert buffers!
[![build status](https://secure.travis-ci.org/dominictarr/json-buffer.png)](http://travis-ci.org/dominictarr/json-buffer)
[![testling badge](https://ci.testling.com/dominictarr/json-buffer.png)](https://ci.testling.com/dominictarr/json-buffer)
JSON mangles buffers by converting to an array...
which isn't helpful. json-buffers converts to base64 instead,
and deconverts base64 to a buffer.
``` js
var JSONB = require('json-buffer')
var Buffer = require('buffer').Buffer
var str = JSONB.stringify(Buffer.from('hello there!'))
console.log(JSONB.parse(str)) //GET a BUFFER back
```
## License
MIT
@@ -0,0 +1,22 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Spade = createLucideIcon("Spade", [
[
"path",
{
d: "M5 9c-1.5 1.5-3 3.2-3 5.5A5.5 5.5 0 0 0 7.5 20c1.8 0 3-.5 4.5-2 1.5 1.5 2.7 2 4.5 2a5.5 5.5 0 0 0 5.5-5.5c0-2.3-1.5-4-3-5.5l-7-7-7 7Z",
key: "40bo9n"
}
],
["path", { d: "M12 18v4", key: "jadmvz" }]
]);
export { Spade as default };
//# sourceMappingURL=spade.js.map
@@ -0,0 +1,733 @@
flf2a$ 7 6 15 -1 18
Thin font by LESTER
======================
-> Conversion to FigLet font by MEPH. (Part of ASCII Editor Service Pack I)
(http://studenten.freepage.de/meph/ascii/ascii/editor/_index.htm)
-> Defined: ASCII code alphanumeric + most used symbols
-> Uppercase characters only.
.-~~-.
(_^..^_)
Lester||||AMC - Anthony Cucchiara
*Mythos Online : Internet Magazine of Lovecraftian Horror - Dead Alice*
http://www.fortunecity.com/victorian/redlion/157/deadal.htm
*Visit my web page ANSI/ASCII/Fonts*
http://members.aol.com/lester5374/
$@
$@
$@
$@
$@
$@
$@@
.-. @
| | @
| | @
`-' @
_ @
`-' @
@@
_ _ @
`|'|' @
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
_ _ @
`-' _`-' @
_`-' @
_`-' @
_`-' _ @
`-' `-' @
@@
@
@
@
@
@
@
@@
_ @
`/' @
@
@
@
@
@@
.---. @
.-.~~~ @
| | @
| | @
~.---. @
~~~ @
@@
.---. @
~~~.-. @
| | @
| | @
.---.~ @
~~~ @
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
_ @
`/' @
@@
@
@
@
@
@
@
@@
@
@
@
@
_ @
`-' @
@@
_ @
_`-' @
_`-' @
_`-' @
_`-' @
`-' @
@@
.-----. @
_~~~~~_ @
| |\ | | @
| | \ | | @
~___\_~ @
`-----' @
@@
.-..-. @
~ | | @
| | @
| | @
| | @
`-' @
@@
.-..-. @
~ | | @
_ | | @
| |`-' @
| | _ @
`-'`-' @
@@
.--..-. @
~~ | | @
_ | | @
`-'| | @
__ | | @
`--'`-' @
@@
.-. .-. @
| | _ | | @
`-'`-'| | @
| | @
| | @
`-' @
@@
.-..-. @
| | ~ @
| | _ @
`-'| | @
_ | | @
`-'`-' @
@@
.-..--. @
| | ~~ @
| | _ @
| |`-'_ @
| | _`-' @
`-'`-' @
@@
.-..-. @
~ | | @
|/ @
/| @
| | @
`-' @
@@
.---. @
.-.~~~.-. @
~.---.~ @
.-.~~~.-. @
~.---.~ @
~~~ @
@@
.-..-. @
.-.~ | | @
~.-.| | @
~ | | @
__ | | @
`--'`-' @
@@
_ @
`-' @
@
_ @
`-' @
@
@@
_ @
`-' @
@
_ @
`-/ @
@
@@
_ @
_`-' @
_`-' @
`-'_ @
`-'_ @
`-' @
@@
@
@
@
@
@
@
@@
_ @
`-'_ @
`-'_ @
_`-' @
_`-' @
`-' @
@@
.---. @
.-.~~~.-. @
~ .--.~ @
|_| @
_ @
`-' @
@@
@
@
@
@
@
@
@@
.-..-..-. @
| | ~ | | @
| |.-.| | @
| | ~ | | @
| | | | @
`-' `-' @
@@
.-..--. @
| | ~~.-. @
| |.--.~ @
| | ~~.-. @
| |.--.~ @
`-' ~~ @
@@
.-..--. @
| | ~~ @
| | @
| | @
| | __ @
`-'`--' @
@@
.-..-. @
| | ~.-. @
| | | | @
| | | | @
| | _`-' @
`-'`-' @
@@
.-..--. @
| | ~~ @
| | _ @
| |`-' @
| | __ @
`-'`--' @
@@
.-..--. @
| | ~~ @
| | _ @
| |`-' @
| | @
`-' @
@@
.-..--. @
| | ~~ @
| | __ @
| | `. | @
| | _| | @
`-'`---' @
@@
.-. .-. @
| | _ | | @
| |`-'| | @
| | | | @
| | | | @
`-' `-' @
@@
.-. @
| | @
| | @
| | @
| | @
`-' @
@@
.-. @
| | @
| | @
| | @
__ | | @
`--'`-' @
@@
.-. .-. @
| | _`-' @
| |`-'.-. @
| | | | @
| | | | @
`-' `-' @
@@
.-. @
| | @
| | @
| | @
| | __ @
`-'`--' @
@@
.-.-. .-.-. @
| |~.-.~| | @
| | ~ | | @
| | | | @
| | | | @
`-' `-' @
@@
.-..-. .-. @
| | ~.-.| | @
| | ~ | | @
| | | | @
| | | | @
`-' `-' @
@@
.-..-..-. @
| | ~ | | @
| | | | @
| | | | @
| | _ | | @
`-'`-'`-' @
@@
.-..--. @
| | ~~.-. @
| |.--.~ @
| | ~~ @
| | @
`-' @
@@
.-..-..-. @
| | ~ | | @
| | | | @
| | | | @
| | _\| | @
`-'`-'`-' @
@@
.-..-. @
| | ~.-. @
| |.-.~ @
| | ~.-. @
| | | | @
`-' `-' @
@@
.-..-. @
| | ~ @
\| @
|\ @
_ | | @
`-'`-' @
@@
.-..-..-. @
~ | | ~ @
| | @
| | @
| | @
`-' @
@@
.-. .-. @
| | | | @
| | | | @
| | | | @
| | _ | | @
`-'`-'`-' @
@@
.-. .-. @
| | | | @
| | | | @
| | | | @
`-' _ `-' @
`-' @
@@
.-. .-. .-. @
| | | | | | @
| | | | | | @
| | | | | | @
`-'_`-'_`-' @
`-' `-' @
@@
.-. .-. @
| | | | @
`-'..`-' @
.-.`'.-. @
| | | | @
`-' `-' @
@@
.-. .-. @
| | | | @
`-'.-.`-' @
| | @
| | @
`-' @
@@
.-..-. @
~ | | @
|/ @
/| @
| | _ @
`-'`-' @
@@
.-..-. @
| | ~ @
| | @
| | @
| | _ @
`-'`-' @
@@
_ @
`-'_ @
`-'_ @
`-'_ @
`-'_ @
`-' @
@@
.-..-. @
~ | | @
| | @
| | @
_ | | @
`-'`-' @
@@
_ @
_`-'_ @
`-' `-' @
@
@
@
@@
@
@
@
@
@
@
@@
_ @
`\' @
@
@
@
@
@@
.-..-..-. @
| | ~ | | @
| |.-.| | @
| | ~ | | @
| | | | @
`-' `-' @
@@
.-..--. @
| | ~~.-. @
| |.--.~ @
| | ~~.-. @
| |.--.~ @
`-' ~~ @
@@
.-..--. @
| | ~~ @
| | @
| | @
| | __ @
`-'`--' @
@@
.-..-. @
| | ~.-. @
| | | | @
| | | | @
| | _`-' @
`-'`-' @
@@
.-..--. @
| | ~~ @
| | _ @
| |`-' @
| | __ @
`-'`--' @
@@
.-..--. @
| | ~~ @
| | _ @
| |`-' @
| | @
`-' @
@@
.-..--. @
| | ~~ @
| | __ @
| | `. | @
| | _| | @
`-'`---' @
@@
.-. .-. @
| | _ | | @
| |`-'| | @
| | | | @
| | | | @
`-' `-' @
@@
.-. @
| | @
| | @
| | @
| | @
`-' @
@@
.-. @
| | @
| | @
| | @
__ | | @
`--'`-' @
@@
.-. .-. @
| | _`-' @
| |`-'.-. @
| | | | @
| | | | @
`-' `-' @
@@
.-. @
| | @
| | @
| | @
| | __ @
`-'`--' @
@@
.-.-. .-.-. @
| |~.-.~| | @
| | ~ | | @
| | | | @
| | | | @
`-' `-' @
@@
.-..-. .-. @
| | ~.-.| | @
| | ~ | | @
| | | | @
| | | | @
`-' `-' @
@@
.-..-..-. @
| | ~ | | @
| | | | @
| | | | @
| | _ | | @
`-'`-'`-' @
@@
.-..--. @
| | ~~.-. @
| |.--.~ @
| | ~~ @
| | @
`-' @
@@
.-..-..-. @
| | ~ | | @
| | | | @
| | | | @
| | _\| | @
`-'`-'`-' @
@@
.-..-. @
| | ~.-. @
| |.-.~ @
| | ~.-. @
| | | | @
`-' `-' @
@@
.-..-. @
| | ~ @
\| @
|\ @
_ | | @
`-'`-' @
@@
.-..-..-. @
~ | | ~ @
| | @
| | @
| | @
`-' @
@@
.-. .-. @
| | | | @
| | | | @
| | | | @
| | _ | | @
`-'`-'`-' @
@@
.-. .-. @
| | | | @
| | | | @
| | | | @
`-' _ `-' @
`-' @
@@
.-. .-. .-. @
| | | | | | @
| | | | | | @
| | | | | | @
`-'_`-'_`-' @
`-' `-' @
@@
.-. .-. @
| | | | @
`-'..`-' @
.-.`'.-. @
| | | | @
`-' `-' @
@@
.-. .-. @
| | | | @
`-'.-.`-' @
| | @
| | @
`-' @
@@
.-..-. @
~ | | @
|/ @
/| @
| | _ @
`-'`-' @
@@
@
@
@
@
@
@
@@
.-. @
| | @
`-' @
.-. @
| | @
`-' @
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@@ -0,0 +1,721 @@
export default `flf2a$ 7 5 16 0 5 0 64 0
Font Author: ?
Font based on TheDraw's "THIS!.TDF"
FIGFont created with: http://patorjk.com/figfont-editor
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
▄$@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
▄▀▀█▄$ @
▐ ▄▀ ▀▄$@
█▄▄▄█$@
▄▀ █$@
█ ▄▀$ @
▐ ▐$ @
@@
▄▀▀█▄▄$ @
▐ ▄▀ █$@
█▄▄▄▀$ @
█ █$ @
▄▀▄▄▄▀$ @
█ ▐$ @
▐ @@
▄▀▄▄▄▄$ @
█ █ ▌$@
▐ █ @
█ @
▄▀▄▄▄▄▀$@
█ ▐$ @
▐ @@
▄▀▀█▄▄$ @
█ ▄▀ █$@
▐ █ █$@
█ █$@
▄▀▄▄▄▄▀$@
█ ▐$ @
▐ @@
▄▀▀█▄▄▄▄$@
▐ ▄▀ ▐$@
█▄▄▄▄▄$ @
█ ▌$ @
▄▀▄▄▄▄$ @
█ ▐$ @
▐ @@
▄▀▀▀█▄$ @
█ ▄▀ ▀▄$@
▐ █▄▄▄▄$ @
█ ▐$ @
█ @
█ @
▐ @@
▄▀▀▀▀▄$ @
█ @
█ ▀▄▄$ @
█ █ █$@
▐▀▄▄▄▄▀ ▐$@
▐ @
@@
▄▀▀▄ ▄▄$ @
█ █ ▄▀$@
▐ █▄▄▄█$ @
█ █$ @
▄▀ ▄▀$ @
█ █$ @
▐ ▐$ @@
▄▀▀█▀▄$ @
█ █ █$ @
▐ █ ▐$ @
█ @
▄▀▀▀▀▀▄$ @
█ █$@
▐ ▐$@@
▄█$@
▄▀▀▀█▀ ▐$@
█ █$ @
▐ █$ @
▄ ▀▄$ @
▀▀▀▀$ @
@@
▄▀▀▄ █$@
█ █ ▄▀$@
▐ █▀▄$ @
█ █$@
▄▀ █$ @
█ ▐$ @
▐ @@
▄▀▀▀▀▄ @
█ █ @
▐ █ @
█ @
▄▀▄▄▄▄▄▄▀$@
█ @
▐ @@
▄▀▀▄ ▄▀▄$@
█ █ ▀ █$@
▐ █ █$@
█ █$ @
▄▀ ▄▀$ @
█ █$ @
▐ ▐$ @@
▄▀▀▄ ▀▄$@
█ █ █ █$@
▐ █ ▀█$@
█ █$ @
▄▀ █$ @
█ ▐$ @
▐ @@
▄▀▀▀▀▄$ @
█ █$@
█ █$@
▀▄ ▄▀$@
▀▀▀▀ $ @
@
@@
▄▀▀▄▀▀▀▄$@
█ █ █$@
▐ █▀▀▀▀$ @
█$ @
▄▀$ @
█$ @
▐$ @@
▄▀▀▀▀▄$ @
█ █$ @
█ █$ @
▀▄▄▄▄▀▄$ @
█$@
▐$@
@@
▄▀▀▄▀▀▀▄$@
█ █ █$@
▐ █▀▀█▀$ @
▄▀ █$ @
█ █$ @
▐ ▐$ @
@@
▄▀▀▀▀▄$@
█ █ ▐$@
▀▄$ @
▀▄ █$ @
█▀▀▀$ @
▐ @
@@
▄▀▀▀█▀▀▄$@
█ █ ▐$@
▐ █$ @
█$ @
▄▀$ @
█ @
▐ @@
▄▀▀▄ ▄▀▀▄$@
█ █ █$@
▐ █ █$ @
█ █$ @
▀▄▄▄▄▀$ @
@
@@
▄▀▀▄ ▄▀▀▄$@
█ █ █$@
▐ █ █$ @
█ ▄▀$ @
▀▄▀$ @
@
@@
▄▀▀▄ ▄▀▀▄$@
█ █ ▐ █$@
▐ █ █$@
█ ▄ █$ @
▀▄▀ ▀▄ ▄▀$ @
▀$ @
@@
▄▀▀▄ ▄▀▄$@
█ █ █$@
▐ ▀▄▀$ @
▄▀ █$ @
█ ▄▀$ @
▄▀ ▄▀$ @
█ ▐$ @@
▄▀▀▄ ▀▀▄$@
█ ▀▄ ▄▀$@
▐ █$ @
█$ @
▄▀$ @
█$ @
▐$ @@
▄▀▀▀▀▄$ @
█ ▄▀$ @
▐ ▄▄▀▀$ @
█$ @
▀▄▄▄▄▀$@
▐$ @
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
▄▀▀█▄$ @
▐ ▄▀ ▀▄$@
█▄▄▄█$@
▄▀ █$@
█ ▄▀$ @
▐ ▐$ @
@@
▄▀▀█▄▄$ @
▐ ▄▀ █$@
█▄▄▄▀$ @
█ █$ @
▄▀▄▄▄▀$ @
█ ▐$ @
▐ @@
▄▀▄▄▄▄$ @
█ █ ▌$@
▐ █ @
█ @
▄▀▄▄▄▄▀$@
█ ▐$ @
▐ @@
▄▀▀█▄▄$ @
█ ▄▀ █$@
▐ █ █$@
█ █$@
▄▀▄▄▄▄▀$@
█ ▐$ @
▐ @@
▄▀▀█▄▄▄▄$@
▐ ▄▀ ▐$@
█▄▄▄▄▄$ @
█ ▌$ @
▄▀▄▄▄▄$ @
█ ▐$ @
▐ @@
▄▀▀▀█▄$ @
█ ▄▀ ▀▄$@
▐ █▄▄▄▄$ @
█ ▐$ @
█ @
█ @
▐ @@
▄▀▀▀▀▄$ @
█ @
█ ▀▄▄$ @
█ █ █$@
▐▀▄▄▄▄▀ ▐$@
▐ @
@@
▄▀▀▄ ▄▄$ @
█ █ ▄▀$@
▐ █▄▄▄█$ @
█ █$ @
▄▀ ▄▀$ @
█ █$ @
▐ ▐$ @@
▄▀▀█▀▄$ @
█ █ █$ @
▐ █ ▐$ @
█ @
▄▀▀▀▀▀▄$ @
█ █$@
▐ ▐$@@
▄█$@
▄▀▀▀█▀ ▐$@
█ █$ @
▐ █$ @
▄ ▀▄$ @
▀▀▀▀$ @
@@
▄▀▀▄ █$@
█ █ ▄▀$@
▐ █▀▄$ @
█ █$@
▄▀ █$ @
█ ▐$ @
▐ @@
▄▀▀▀▀▄ @
█ █ @
▐ █ @
█ @
▄▀▄▄▄▄▄▄▀$@
█ @
▐ @@
▄▀▀▄ ▄▀▄$@
█ █ ▀ █$@
▐ █ █$@
█ █$ @
▄▀ ▄▀$ @
█ █$ @
▐ ▐$ @@
▄▀▀▄ ▀▄$@
█ █ █ █$@
▐ █ ▀█$@
█ █$ @
▄▀ █$ @
█ ▐$ @
▐ @@
▄▀▀▀▀▄$ @
█ █$@
█ █$@
▀▄ ▄▀$@
▀▀▀▀ $ @
@
@@
▄▀▀▄▀▀▀▄$@
█ █ █$@
▐ █▀▀▀▀$ @
█$ @
▄▀$ @
█$ @
▐$ @@
▄▀▀▀▀▄$ @
█ █$ @
█ █$ @
▀▄▄▄▄▀▄$ @
█$@
▐$@
@@
▄▀▀▄▀▀▀▄$@
█ █ █$@
▐ █▀▀█▀$ @
▄▀ █$ @
█ █$ @
▐ ▐$ @
@@
▄▀▀▀▀▄$@
█ █ ▐$@
▀▄$ @
▀▄ █$ @
█▀▀▀$ @
▐ @
@@
▄▀▀▀█▀▀▄$@
█ █ ▐$@
▐ █$ @
█$ @
▄▀$ @
█ @
▐ @@
▄▀▀▄ ▄▀▀▄$@
█ █ █$@
▐ █ █$ @
█ █$ @
▀▄▄▄▄▀$ @
@
@@
▄▀▀▄ ▄▀▀▄$@
█ █ █$@
▐ █ █$ @
█ ▄▀$ @
▀▄▀$ @
@
@@
▄▀▀▄ ▄▀▀▄$@
█ █ ▐ █$@
▐ █ █$@
█ ▄ █$ @
▀▄▀ ▀▄ ▄▀$ @
▀$ @
@@
▄▀▀▄ ▄▀▄$@
█ █ █$@
▐ ▀▄▀$ @
▄▀ █$ @
█ ▄▀$ @
▄▀ ▄▀$ @
█ ▐$ @@
▄▀▀▄ ▀▀▄$@
█ ▀▄ ▄▀$@
▐ █$ @
█$ @
▄▀$ @
█$ @
▐$ @@
▄▀▀▀▀▄$ @
█ ▄▀$ @
▐ ▄▄▀▀$ @
█$ @
▀▄▄▄▄▀$@
▐$ @
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
`
@@ -0,0 +1,23 @@
The MIT License (MIT)
Copyright © 2025-PRESENT Kevin Deng (https://github.com/sxzz)
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
Copyright (c) 2018-2021 Josh Junon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,9 @@
import { HtmlEscapedString } from "../utils/html.js";
import { html } from "../helper/html/index.js";
import { Fragment, JSX } from "./base.js";
import { jsxDEV } from "./jsx-dev-runtime.js";
//#region src/jsx/jsx-runtime.d.ts
export declare const jsxAttr: (key: string, v: string | Promise<string> | Record<string, string | number | null | undefined | boolean>) => HtmlEscapedString | Promise<HtmlEscapedString>;
export declare const jsxEscape: (value: string) => string;
//#endregion
export { Fragment, type JSX, jsxDEV as jsx, html as jsxTemplate, jsxDEV as jsxs };
@@ -0,0 +1,192 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const tsutils = __importStar(require("ts-api-utils"));
const ts = __importStar(require("typescript"));
const util_1 = require("../util");
const shared_1 = require("./enum-utils/shared");
/**
* @returns Whether the right type is an unsafe comparison against any left type.
*/
function typeViolates(leftTypeParts, rightType) {
const leftEnumValueTypes = new Set(leftTypeParts.map(getEnumValueType));
return ((leftEnumValueTypes.has(ts.TypeFlags.Number) && isNumberLike(rightType)) ||
(leftEnumValueTypes.has(ts.TypeFlags.String) && isStringLike(rightType)));
}
function isNumberLike(type) {
return tsutils
.unionConstituents(type)
.every(unionPart => tsutils
.intersectionConstituents(unionPart)
.some(intersectionPart => tsutils.isTypeFlagSet(intersectionPart, ts.TypeFlags.Number | ts.TypeFlags.NumberLike)));
}
function isStringLike(type) {
return tsutils
.unionConstituents(type)
.every(unionPart => tsutils
.intersectionConstituents(unionPart)
.some(intersectionPart => tsutils.isTypeFlagSet(intersectionPart, ts.TypeFlags.String | ts.TypeFlags.StringLike)));
}
/**
* @returns What type a type's enum value is (number or string), if either.
*/
function getEnumValueType(type) {
return tsutils.isTypeFlagSet(type, ts.TypeFlags.EnumLike)
? tsutils.isTypeFlagSet(type, ts.TypeFlags.NumberLiteral)
? ts.TypeFlags.Number
: ts.TypeFlags.String
: undefined;
}
exports.default = (0, util_1.createRule)({
name: 'no-unsafe-enum-comparison',
meta: {
type: 'suggestion',
docs: {
description: 'Disallow comparing an enum value with a non-enum value',
recommended: 'recommended',
requiresTypeChecking: true,
},
hasSuggestions: true,
messages: {
mismatchedCase: 'The case statement does not have a shared enum type with the switch predicate.',
mismatchedCondition: 'The two values in this comparison do not have a shared enum type.',
replaceValueWithEnum: 'Replace with an enum value comparison.',
},
schema: [],
},
defaultOptions: [],
create(context) {
const parserServices = (0, util_1.getParserServices)(context);
const typeChecker = parserServices.program.getTypeChecker();
function isMismatchedComparison(leftType, rightType) {
// Allow comparisons that don't have anything to do with enums:
//
// ```ts
// 1 === 2;
// ```
const leftEnumTypes = (0, shared_1.getEnumTypes)(typeChecker, leftType);
const rightEnumTypes = new Set((0, shared_1.getEnumTypes)(typeChecker, rightType));
if (leftEnumTypes.length === 0 && rightEnumTypes.size === 0) {
return false;
}
// Allow comparisons that share an enum type:
//
// ```ts
// Fruit.Apple === Fruit.Banana;
// ```
for (const leftEnumType of leftEnumTypes) {
if (rightEnumTypes.has(leftEnumType)) {
return false;
}
}
// We need to split the type into the union type parts in order to find
// valid enum comparisons like:
//
// ```ts
// declare const something: Fruit | Vegetable;
// something === Fruit.Apple;
// ```
const leftTypeParts = tsutils.unionConstituents(leftType);
const rightTypeParts = tsutils.unionConstituents(rightType);
// If a type exists in both sides, we consider this comparison safe:
//
// ```ts
// declare const fruit: Fruit.Apple | 0;
// fruit === 0;
// ```
for (const leftTypePart of leftTypeParts) {
if (rightTypeParts.includes(leftTypePart)) {
return false;
}
}
return (typeViolates(leftTypeParts, rightType) ||
typeViolates(rightTypeParts, leftType));
}
return {
'BinaryExpression[operator=/^[<>!=]?={0,2}$/]'(node) {
const leftType = parserServices.getTypeAtLocation(node.left);
const rightType = parserServices.getTypeAtLocation(node.right);
if (isMismatchedComparison(leftType, rightType)) {
context.report({
node,
messageId: 'mismatchedCondition',
suggest: [
{
messageId: 'replaceValueWithEnum',
fix(fixer) {
// Replace the right side with an enum key if possible:
//
// ```ts
// Fruit.Apple === 'apple'; // Fruit.Apple === Fruit.Apple
// ```
const leftEnumKey = (0, shared_1.getEnumKeyForLiteral)((0, shared_1.getEnumLiterals)(leftType), (0, util_1.getStaticValue)(node.right)?.value);
if (leftEnumKey) {
return fixer.replaceText(node.right, leftEnumKey);
}
// Replace the left side with an enum key if possible:
//
// ```ts
// declare const fruit: Fruit;
// 'apple' === Fruit.Apple; // Fruit.Apple === Fruit.Apple
// ```
const rightEnumKey = (0, shared_1.getEnumKeyForLiteral)((0, shared_1.getEnumLiterals)(rightType), (0, util_1.getStaticValue)(node.left)?.value);
if (rightEnumKey) {
return fixer.replaceText(node.left, rightEnumKey);
}
return null;
},
},
],
});
}
},
SwitchCase(node) {
// Ignore `default` cases.
if (node.test == null) {
return;
}
const { parent } = node;
const leftType = parserServices.getTypeAtLocation(parent.discriminant);
const rightType = parserServices.getTypeAtLocation(node.test);
if (isMismatchedComparison(leftType, rightType)) {
context.report({
node,
messageId: 'mismatchedCase',
});
}
},
};
},
});
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Madeline Gurriarán
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1 @@
{"version":3,"file":"animate-sequence.mjs","sources":["../../../../../src/animation/animators/waapi/animate-sequence.ts"],"sourcesContent":["import { AnimationPlaybackControls, GroupAnimationWithThen } from \"motion-dom\"\nimport { createAnimationsFromSequence } from \"../../sequence/create\"\nimport { AnimationSequence, SequenceOptions } from \"../../sequence/types\"\nimport { animateElements } from \"./animate-elements\"\n\nexport function animateSequence(\n definition: AnimationSequence,\n options?: SequenceOptions\n) {\n const animations: AnimationPlaybackControls[] = []\n\n createAnimationsFromSequence(definition, options).forEach(\n ({ keyframes, transition }, element: Element) => {\n animations.push(...animateElements(element, keyframes, transition))\n }\n )\n\n return new GroupAnimationWithThen(animations)\n}\n"],"names":[],"mappings":";;;;AAKM,SAAU,eAAe,CAC3B,UAA6B,EAC7B,OAAyB,EAAA;IAEzB,MAAM,UAAU,GAAgC,EAAE;AAElD,IAAA,4BAA4B,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,OAAO,CACrD,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,OAAgB,KAAI;AAC5C,QAAA,UAAU,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACvE,IAAA,CAAC,CACJ;AAED,IAAA,OAAO,IAAI,sBAAsB,CAAC,UAAU,CAAC;AACjD;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"dices.js","sources":["../../../src/icons/dices.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Dices\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHg9IjIiIHk9IjEwIiByeD0iMiIgcnk9IjIiIC8+CiAgPHBhdGggZD0ibTE3LjkyIDE0IDMuNS0zLjVhMi4yNCAyLjI0IDAgMCAwIDAtM2wtNS00LjkyYTIuMjQgMi4yNCAwIDAgMC0zIDBMMTAgNiIgLz4KICA8cGF0aCBkPSJNNiAxOGguMDEiIC8+CiAgPHBhdGggZD0iTTEwIDE0aC4wMSIgLz4KICA8cGF0aCBkPSJNMTUgNmguMDEiIC8+CiAgPHBhdGggZD0iTTE4IDloLjAxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/dices\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 Dices = createLucideIcon('Dices', [\n ['rect', { width: '12', height: '12', x: '2', y: '10', rx: '2', ry: '2', key: '6agr2n' }],\n [\n 'path',\n { d: 'm17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6', key: '1o487t' },\n ],\n ['path', { d: 'M6 18h.01', key: 'uhywen' }],\n ['path', { d: 'M10 14h.01', key: 'ssrbsk' }],\n ['path', { d: 'M15 6h.01', key: 'cblpky' }],\n ['path', { d: 'M18 9h.01', key: '2061c0' }],\n]);\n\nexport default Dices;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,iBAAiB,OAAS,CAAA,CAAA,CAAA;AAAA,CAAA,CACtC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,KAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAQ,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,EAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,MAAM,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAA,EAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAU,CAAA,CAAA;AAAA,CACxF,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0E,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAS,CAAA,CAAA;AAAA,CAC/F,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,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC3C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC5C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNodeEqual = isNodeEqual;
const utils_1 = require("@typescript-eslint/utils");
function isNodeEqual(a, b) {
if (a.type !== b.type) {
return false;
}
if (a.type === utils_1.AST_NODE_TYPES.ThisExpression &&
b.type === utils_1.AST_NODE_TYPES.ThisExpression) {
return true;
}
if (a.type === utils_1.AST_NODE_TYPES.Literal && b.type === utils_1.AST_NODE_TYPES.Literal) {
return a.value === b.value;
}
if (a.type === utils_1.AST_NODE_TYPES.Identifier &&
b.type === utils_1.AST_NODE_TYPES.Identifier) {
return a.name === b.name;
}
if (a.type === utils_1.AST_NODE_TYPES.MemberExpression &&
b.type === utils_1.AST_NODE_TYPES.MemberExpression) {
return (isNodeEqual(a.property, b.property) && isNodeEqual(a.object, b.object));
}
return false;
}
@@ -0,0 +1,90 @@
'use client'
import { useStore } from '@tanstack/react-store'
import { useRef } from 'react'
import { replaceEqualDeep } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'
import type {
AnyRouter,
RegisteredRouter,
RouterState,
} from '@tanstack/router-core'
import type {
StructuralSharingOption,
ValidateSelected,
} from './structuralSharing'
export type UseRouterStateOptions<
TRouter extends AnyRouter,
TSelected,
TStructuralSharing,
> = {
router?: TRouter
select?: (
state: RouterState<TRouter['routeTree']>,
) => ValidateSelected<TRouter, TSelected, TStructuralSharing>
} & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>
export type UseRouterStateResult<
TRouter extends AnyRouter,
TSelected,
> = unknown extends TSelected ? RouterState<TRouter['routeTree']> : TSelected
/**
* Subscribe to the router's state store with optional selection and
* structural sharing for render optimization.
*
* Options:
* - `select`: Project the full router state to a derived slice
* - `structuralSharing`: Replace-equal semantics for stable references
* - `router`: Read state from a specific router instance instead of context
*
* @returns The selected router state (or the full state by default).
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterStateHook
*/
export function useRouterState<
TRouter extends AnyRouter = RegisteredRouter,
TSelected = unknown,
TStructuralSharing extends boolean = boolean,
>(
opts?: UseRouterStateOptions<TRouter, TSelected, TStructuralSharing>,
): UseRouterStateResult<TRouter, TSelected> {
const contextRouter = useRouter<TRouter>({
warn: opts?.router === undefined,
})
const router = opts?.router || contextRouter
// During SSR we render exactly once and do not need reactivity.
// Avoid subscribing to the store (and any structural sharing work) on the server.
const _isServer = isServer ?? router.isServer
if (_isServer) {
const state = router.stores.__store.get() as RouterState<
TRouter['routeTree']
>
return (opts?.select ? opts.select(state) : state) as UseRouterStateResult<
TRouter,
TSelected
>
}
const previousResult =
// eslint-disable-next-line react-hooks/rules-of-hooks
useRef<ValidateSelected<TRouter, TSelected, TStructuralSharing>>(undefined)
// eslint-disable-next-line react-hooks/rules-of-hooks
return useStore(router.stores.__store, (state) => {
if (opts?.select) {
if (opts.structuralSharing ?? router.options.defaultStructuralSharing) {
const newSlice = replaceEqualDeep(
previousResult.current,
opts.select(state),
)
previousResult.current = newSlice
return newSlice
}
return opts.select(state)
}
return state
}) as UseRouterStateResult<TRouter, TSelected>
}
@@ -0,0 +1 @@
{"version":3,"file":"align-center.js","sources":["../../../src/icons/align-center.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name AlignCenter\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTcgMTJINyIgLz4KICA8cGF0aCBkPSJNMTkgMThINSIgLz4KICA8cGF0aCBkPSJNMjEgNkgzIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/align-center\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 AlignCenter = createLucideIcon('AlignCenter', [\n ['path', { d: 'M17 12H7', key: '16if0g' }],\n ['path', { d: 'M19 18H5', key: '18s9l3' }],\n ['path', { d: 'M21 6H3', key: '1jwq7v' }],\n]);\n\nexport default AlignCenter;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAAA,CAClD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,20 @@
import { n as preloadSchemas } from "./src-WCy6ifGf.mjs";
import { t as CfWorkerJsonSchemaValidator } from "./cfWorkerProvider-BylNJ1R5.mjs";
//#region src/shimsWorkerd.ts
/**
* Cloudflare Workers runtime shims for client package
*
* This file is selected via package.json export conditions when running in workerd.
*/
preloadSchemas();
/**
* 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.
*/
const CORS_IS_POSSIBLE = false;
//#endregion
export { CORS_IS_POSSIBLE, CfWorkerJsonSchemaValidator as DefaultJsonSchemaValidator };
//# sourceMappingURL=shimsWorkerd.mjs.map
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const ChartColumnBig = createLucideIcon("ChartColumnBig", [
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
["rect", { x: "15", y: "5", width: "4", height: "12", rx: "1", key: "q8uenq" }],
["rect", { x: "7", y: "8", width: "4", height: "9", rx: "1", key: "sr5ea" }]
]);
export { ChartColumnBig as default };
//# sourceMappingURL=chart-column-big.js.map
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,239 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OptionKeys = void 0;
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
var OptionKeys;
(function (OptionKeys) {
OptionKeys["ArrayDestructuring"] = "arrayDestructuring";
OptionKeys["ArrowParameter"] = "arrowParameter";
OptionKeys["MemberVariableDeclaration"] = "memberVariableDeclaration";
OptionKeys["ObjectDestructuring"] = "objectDestructuring";
OptionKeys["Parameter"] = "parameter";
OptionKeys["PropertyDeclaration"] = "propertyDeclaration";
OptionKeys["VariableDeclaration"] = "variableDeclaration";
OptionKeys["VariableDeclarationIgnoreFunction"] = "variableDeclarationIgnoreFunction";
})(OptionKeys || (exports.OptionKeys = OptionKeys = {}));
exports.default = (0, util_1.createRule)({
name: 'typedef',
meta: {
type: 'suggestion',
deprecated: {
deprecatedSince: '8.33.0',
message: 'This is an old rule that is no longer recommended for use.',
},
docs: {
description: 'Require type annotations in certain places',
},
messages: {
expectedTypedef: 'Expected a type annotation.',
expectedTypedefNamed: 'Expected {{name}} to have a type annotation.',
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
[OptionKeys.ArrayDestructuring]: {
type: 'boolean',
description: 'Whether to enforce type annotations on variables declared using array destructuring.',
},
[OptionKeys.ArrowParameter]: {
type: 'boolean',
description: 'Whether to enforce type annotations for parameters of arrow functions.',
},
[OptionKeys.MemberVariableDeclaration]: {
type: 'boolean',
description: 'Whether to enforce type annotations on member variables of classes.',
},
[OptionKeys.ObjectDestructuring]: {
type: 'boolean',
description: 'Whether to enforce type annotations on variables declared using object destructuring.',
},
[OptionKeys.Parameter]: {
type: 'boolean',
description: 'Whether to enforce type annotations for parameters of functions and methods.',
},
[OptionKeys.PropertyDeclaration]: {
type: 'boolean',
description: 'Whether to enforce type annotations for properties of interfaces and types.',
},
[OptionKeys.VariableDeclaration]: {
type: 'boolean',
description: 'Whether to enforce type annotations for variable declarations, excluding array and object destructuring.',
},
[OptionKeys.VariableDeclarationIgnoreFunction]: {
type: 'boolean',
description: 'Whether to ignore variable declarations for non-arrow and arrow functions.',
},
},
},
],
},
defaultOptions: [
{
[OptionKeys.ArrayDestructuring]: false,
[OptionKeys.ArrowParameter]: false,
[OptionKeys.MemberVariableDeclaration]: false,
[OptionKeys.ObjectDestructuring]: false,
[OptionKeys.Parameter]: false,
[OptionKeys.PropertyDeclaration]: false,
[OptionKeys.VariableDeclaration]: false,
[OptionKeys.VariableDeclarationIgnoreFunction]: false,
},
],
create(context, [{ arrayDestructuring, arrowParameter, memberVariableDeclaration, objectDestructuring, parameter, propertyDeclaration, variableDeclaration, variableDeclarationIgnoreFunction, },]) {
function report(location, name) {
context.report({
node: location,
messageId: name ? 'expectedTypedefNamed' : 'expectedTypedef',
data: { name },
});
}
function getNodeName(node) {
return node.type === utils_1.AST_NODE_TYPES.Identifier ? node.name : undefined;
}
function isForOfStatementContext(node) {
let current = node.parent;
while (current) {
switch (current.type) {
case utils_1.AST_NODE_TYPES.VariableDeclarator:
case utils_1.AST_NODE_TYPES.VariableDeclaration:
case utils_1.AST_NODE_TYPES.ObjectPattern:
case utils_1.AST_NODE_TYPES.ArrayPattern:
case utils_1.AST_NODE_TYPES.Property:
current = current.parent;
break;
case utils_1.AST_NODE_TYPES.ForOfStatement:
return true;
default:
current = undefined;
}
}
return false;
}
function checkParameters(params) {
for (const param of params) {
let annotationNode;
switch (param.type) {
case utils_1.AST_NODE_TYPES.AssignmentPattern:
annotationNode = param.left;
break;
case utils_1.AST_NODE_TYPES.TSParameterProperty:
annotationNode = param.parameter;
// Check TS parameter property with default value like `constructor(private param: string = 'something') {}`
if (annotationNode.type === utils_1.AST_NODE_TYPES.AssignmentPattern) {
annotationNode = annotationNode.left;
}
break;
default:
annotationNode = param;
break;
}
if (!annotationNode.typeAnnotation) {
report(param, getNodeName(param));
}
}
}
function isVariableDeclarationIgnoreFunction(node) {
return (variableDeclarationIgnoreFunction === true &&
(node.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression ||
node.type === utils_1.AST_NODE_TYPES.FunctionExpression));
}
function isAncestorHasTypeAnnotation(node) {
let ancestor = node.parent;
while (ancestor) {
if ((ancestor.type === utils_1.AST_NODE_TYPES.ObjectPattern ||
ancestor.type === utils_1.AST_NODE_TYPES.ArrayPattern) &&
ancestor.typeAnnotation) {
return true;
}
ancestor = ancestor.parent;
}
return false;
}
return {
...(arrayDestructuring && {
ArrayPattern(node) {
if (node.parent.type === utils_1.AST_NODE_TYPES.RestElement &&
node.parent.typeAnnotation) {
return;
}
if (!node.typeAnnotation &&
!isForOfStatementContext(node) &&
!isAncestorHasTypeAnnotation(node) &&
node.parent.type !== utils_1.AST_NODE_TYPES.AssignmentExpression) {
report(node);
}
},
}),
...(arrowParameter && {
ArrowFunctionExpression(node) {
checkParameters(node.params);
},
}),
...(memberVariableDeclaration && {
PropertyDefinition(node) {
if (!(node.value && isVariableDeclarationIgnoreFunction(node.value)) &&
!node.typeAnnotation) {
report(node, node.key.type === utils_1.AST_NODE_TYPES.Identifier
? node.key.name
: undefined);
}
},
}),
...(parameter && {
'FunctionDeclaration, FunctionExpression'(node) {
checkParameters(node.params);
},
}),
...(objectDestructuring && {
ObjectPattern(node) {
if (!node.typeAnnotation &&
!isForOfStatementContext(node) &&
!isAncestorHasTypeAnnotation(node)) {
report(node);
}
},
}),
...(propertyDeclaration && {
'TSIndexSignature, TSPropertySignature'(node) {
if (!node.typeAnnotation) {
report(node, node.type === utils_1.AST_NODE_TYPES.TSPropertySignature
? getNodeName(node.key)
: undefined);
}
},
}),
VariableDeclarator(node) {
if (!variableDeclaration ||
node.id.typeAnnotation ||
(node.id.type === utils_1.AST_NODE_TYPES.ArrayPattern &&
!arrayDestructuring) ||
(node.id.type === utils_1.AST_NODE_TYPES.ObjectPattern &&
!objectDestructuring) ||
(node.init && isVariableDeclarationIgnoreFunction(node.init))) {
return;
}
let current = node.parent;
while (current) {
switch (current.type) {
case utils_1.AST_NODE_TYPES.VariableDeclaration:
// Keep looking upwards
current = current.parent;
break;
case utils_1.AST_NODE_TYPES.ForOfStatement:
case utils_1.AST_NODE_TYPES.ForInStatement:
// Stop traversing and don't report an error
return;
default:
// Stop traversing
current = undefined;
break;
}
}
report(node, getNodeName(node.id));
},
};
},
});
@@ -0,0 +1,18 @@
import { time } from '../../frameloop/sync-time.mjs';
import { frameData, cancelFrame, frame } from '../../frameloop/frame.mjs';
const frameloopDriver = (update) => {
const passTimestamp = ({ timestamp }) => update(timestamp);
return {
start: (keepAlive = true) => frame.update(passTimestamp, keepAlive),
stop: () => cancelFrame(passTimestamp),
/**
* If we're processing this frame we can use the
* framelocked timestamp to keep things in sync.
*/
now: () => (frameData.isProcessing ? frameData.timestamp : time.now()),
};
};
export { frameloopDriver };
//# sourceMappingURL=frame.mjs.map
@@ -0,0 +1,38 @@
{
"name": "setprototypeof",
"version": "1.2.0",
"description": "A small polyfill for Object.setprototypeof",
"main": "index.js",
"typings": "index.d.ts",
"scripts": {
"test": "standard && mocha",
"testallversions": "npm run node010 && npm run node4 && npm run node6 && npm run node9 && npm run node11",
"testversion": "docker run -it --rm -v $(PWD):/usr/src/app -w /usr/src/app node:${NODE_VER} npm install mocha@${MOCHA_VER:-latest} && npm t",
"node010": "NODE_VER=0.10 MOCHA_VER=3 npm run testversion",
"node4": "NODE_VER=4 npm run testversion",
"node6": "NODE_VER=6 npm run testversion",
"node9": "NODE_VER=9 npm run testversion",
"node11": "NODE_VER=11 npm run testversion",
"prepublishOnly": "npm t",
"postpublish": "git push origin && git push origin --tags"
},
"repository": {
"type": "git",
"url": "https://github.com/wesleytodd/setprototypeof.git"
},
"keywords": [
"polyfill",
"object",
"setprototypeof"
],
"author": "Wes Todd",
"license": "ISC",
"bugs": {
"url": "https://github.com/wesleytodd/setprototypeof/issues"
},
"homepage": "https://github.com/wesleytodd/setprototypeof",
"devDependencies": {
"mocha": "^6.1.4",
"standard": "^13.0.2"
}
}
@@ -0,0 +1 @@
{"version":3,"file":"between-vertical-end.js","sources":["../../../src/icons/between-vertical-end.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BetweenVerticalEnd\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIxMyIgeD0iMyIgeT0iMyIgcng9IjEiIC8+CiAgPHBhdGggZD0ibTkgMjIgMy0zIDMgMyIgLz4KICA8cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIxMyIgeD0iMTQiIHk9IjMiIHJ4PSIxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/between-vertical-end\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 BetweenVerticalEnd = createLucideIcon('BetweenVerticalEnd', [\n ['rect', { width: '7', height: '13', x: '3', y: '3', rx: '1', key: '1fdu0f' }],\n ['path', { d: 'm9 22 3-3 3 3', key: '17z65a' }],\n ['rect', { width: '7', height: '13', x: '14', y: '3', rx: '1', key: '1squn4' }],\n]);\n\nexport default BetweenVerticalEnd;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,iBAAiB,oBAAsB,CAAA,CAAA,CAAA;AAAA,CAAA,CAChE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,KAAK,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC7E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,KAAK,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,4 @@
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
export { motionComponentSymbol };
//# sourceMappingURL=symbol.mjs.map
@@ -0,0 +1,45 @@
import { MotionValue } from '../../value/index.mjs';
import { addAttrValue } from '../attr/index.mjs';
import { addStyleValue } from '../style/index.mjs';
import { createSelectorEffect } from '../utils/create-dom-effect.mjs';
import { createEffect } from '../utils/create-effect.mjs';
import { frame } from '../../frameloop/frame.mjs';
function addSVGPathValue(element, state, key, value) {
frame.render(() => element.setAttribute("pathLength", "1"));
if (key === "pathOffset") {
return state.set(key, value, () => {
// Use unitless value to avoid Safari zoom bug
const offset = state.latest[key];
element.setAttribute("stroke-dashoffset", `${-offset}`);
});
}
else {
if (!state.get("stroke-dasharray")) {
state.set("stroke-dasharray", new MotionValue("1 1"), () => {
const { pathLength = 1, pathSpacing } = state.latest;
// Use unitless values to avoid Safari zoom bug
element.setAttribute("stroke-dasharray", `${pathLength} ${pathSpacing ?? 1 - Number(pathLength)}`);
});
}
return state.set(key, value, undefined, state.get("stroke-dasharray"));
}
}
const addSVGValue = (element, state, key, value) => {
if (key.startsWith("path")) {
return addSVGPathValue(element, state, key, value);
}
else if (key.startsWith("attr")) {
return addAttrValue(element, state, convertAttrKey(key), value);
}
const handler = key in element.style ? addStyleValue : addAttrValue;
return handler(element, state, key, value);
};
const svgEffect = /*@__PURE__*/ createSelectorEffect(
/*@__PURE__*/ createEffect(addSVGValue));
function convertAttrKey(key) {
return key.replace(/^attr([A-Z])/, (_, firstChar) => firstChar.toLowerCase());
}
export { svgEffect };
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,9 @@
import { RequestHandler } from 'express';
/**
* Middleware to handle unsupported HTTP methods with a 405 Method Not Allowed response.
*
* @param allowedMethods Array of allowed HTTP methods for this endpoint (e.g., ['GET', 'POST'])
* @returns Express middleware that returns a 405 error if method not in allowed list
*/
export declare function allowedMethods(allowedMethods: string[]): RequestHandler;
//# sourceMappingURL=allowedMethods.d.ts.map
@@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('../cjs/use-sync-external-store-shim.production.js');
} else {
module.exports = require('../cjs/use-sync-external-store-shim.development.js');
}
@@ -0,0 +1,2 @@
import type { IntDict } from './constants';
export declare function enumToMap(obj: IntDict, filter?: readonly number[], exceptions?: readonly number[]): IntDict;
@@ -0,0 +1,357 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const tsutils = __importStar(require("ts-api-utils"));
const ts = __importStar(require("typescript"));
const util_1 = require("../util");
const getParentFunctionNode_1 = require("../util/getParentFunctionNode");
exports.default = (0, util_1.createRule)({
name: 'no-confusing-void-expression',
meta: {
type: 'problem',
docs: {
description: 'Require expressions of type void to appear in statement position',
recommended: 'strict',
requiresTypeChecking: true,
},
fixable: 'code',
hasSuggestions: true,
messages: {
invalidVoidExpr: 'Placing a void expression inside another expression is forbidden. ' +
'Move it to its own statement instead.',
invalidVoidExprArrow: 'Returning a void expression from an arrow function shorthand is forbidden. ' +
'Please add braces to the arrow function.',
invalidVoidExprArrowWrapVoid: 'Void expressions returned from an arrow function shorthand ' +
'must be marked explicitly with the `void` operator.',
invalidVoidExprReturn: 'Returning a void expression from a function is forbidden. ' +
'Please move it before the `return` statement.',
invalidVoidExprReturnLast: 'Returning a void expression from a function is forbidden. ' +
'Please remove the `return` statement.',
invalidVoidExprReturnWrapVoid: 'Void expressions returned from a function ' +
'must be marked explicitly with the `void` operator.',
invalidVoidExprWrapVoid: 'Void expressions used inside another expression ' +
'must be moved to its own statement ' +
'or marked explicitly with the `void` operator.',
voidExprWrapVoid: 'Mark with an explicit `void` operator.',
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
ignoreArrowShorthand: {
type: 'boolean',
description: 'Whether to ignore "shorthand" `() =>` arrow functions: those without `{ ... }` braces.',
},
ignoreVoidOperator: {
type: 'boolean',
description: 'Whether to ignore returns that start with the `void` operator.',
},
ignoreVoidReturningFunctions: {
type: 'boolean',
description: 'Whether to ignore returns from functions with explicit `void` return types and functions with contextual `void` return types.',
},
},
},
],
},
defaultOptions: [
{
ignoreArrowShorthand: false,
ignoreVoidOperator: false,
ignoreVoidReturningFunctions: false,
},
],
create(context, [options]) {
const services = (0, util_1.getParserServices)(context);
return {
'AwaitExpression, CallExpression, TaggedTemplateExpression'(node) {
const type = (0, util_1.getConstrainedTypeAtLocation)(services, node);
if (!tsutils.isTypeFlagSet(type, ts.TypeFlags.VoidLike)) {
// not a void expression
return;
}
const invalidAncestor = findInvalidAncestor(node);
if (invalidAncestor == null) {
// void expression is in valid position
return;
}
const wrapVoidFix = (fixer) => {
const nodeText = context.sourceCode.getText(node);
const newNodeText = `void ${nodeText}`;
return fixer.replaceText(node, newNodeText);
};
if (invalidAncestor.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression) {
// handle arrow function shorthand
if (options.ignoreVoidReturningFunctions) {
const returnsVoid = isVoidReturningFunctionNode(invalidAncestor);
if (returnsVoid) {
return;
}
}
if (options.ignoreVoidOperator) {
// handle wrapping with `void`
return context.report({
node,
messageId: 'invalidVoidExprArrowWrapVoid',
fix: wrapVoidFix,
});
}
// handle wrapping with braces
const arrowFunction = invalidAncestor;
return context.report({
node,
messageId: 'invalidVoidExprArrow',
fix(fixer) {
if (!canFix(arrowFunction)) {
return null;
}
const arrowBody = arrowFunction.body;
const arrowBodyText = context.sourceCode.getText(arrowBody);
const newArrowBodyText = `{ ${arrowBodyText}; }`;
if ((0, util_1.isParenthesized)(arrowBody, context.sourceCode)) {
const bodyOpeningParen = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(arrowBody, util_1.isOpeningParenToken), util_1.NullThrowsReasons.MissingToken('opening parenthesis', 'arrow body'));
const bodyClosingParen = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(arrowBody, util_1.isClosingParenToken), util_1.NullThrowsReasons.MissingToken('closing parenthesis', 'arrow body'));
return fixer.replaceTextRange([bodyOpeningParen.range[0], bodyClosingParen.range[1]], newArrowBodyText);
}
return fixer.replaceText(arrowBody, newArrowBodyText);
},
});
}
if (invalidAncestor.type === utils_1.AST_NODE_TYPES.ReturnStatement) {
// handle return statement
if (options.ignoreVoidReturningFunctions) {
const functionNode = (0, getParentFunctionNode_1.getParentFunctionNode)(invalidAncestor);
if (functionNode) {
const returnsVoid = isVoidReturningFunctionNode(functionNode);
if (returnsVoid) {
return;
}
}
}
if (options.ignoreVoidOperator) {
// handle wrapping with `void`
return context.report({
node,
messageId: 'invalidVoidExprReturnWrapVoid',
fix: wrapVoidFix,
});
}
if (isFinalReturn(invalidAncestor)) {
// remove the `return` keyword
return context.report({
node,
messageId: 'invalidVoidExprReturnLast',
fix(fixer) {
if (!canFix(invalidAncestor)) {
return null;
}
const returnValue = invalidAncestor.argument;
const returnValueText = context.sourceCode.getText(returnValue);
let newReturnStmtText = `${returnValueText};`;
if (isPreventingASI(returnValue)) {
// put a semicolon at the beginning of the line
newReturnStmtText = `;${newReturnStmtText}`;
}
return fixer.replaceText(invalidAncestor, newReturnStmtText);
},
});
}
// move before the `return` keyword
return context.report({
node,
messageId: 'invalidVoidExprReturn',
fix(fixer) {
const returnValue = invalidAncestor.argument;
const returnValueText = context.sourceCode.getText(returnValue);
let newReturnStmtText = `${returnValueText}; return;`;
if (isPreventingASI(returnValue)) {
// put a semicolon at the beginning of the line
newReturnStmtText = `;${newReturnStmtText}`;
}
if (invalidAncestor.parent.type !== utils_1.AST_NODE_TYPES.BlockStatement) {
// e.g. `if (cond) return console.error();`
// add braces if not inside a block
newReturnStmtText = `{ ${newReturnStmtText} }`;
}
return fixer.replaceText(invalidAncestor, newReturnStmtText);
},
});
}
// handle generic case
if (options.ignoreVoidOperator) {
// this would be reported by this rule btw. such irony
return context.report({
node,
messageId: 'invalidVoidExprWrapVoid',
suggest: [{ messageId: 'voidExprWrapVoid', fix: wrapVoidFix }],
});
}
context.report({
node,
messageId: 'invalidVoidExpr',
});
},
};
/**
* Inspects the void expression's ancestors and finds closest invalid one.
* By default anything other than an ExpressionStatement is invalid.
* Parent expressions which can be used for their short-circuiting behavior
* are ignored and their parents are checked instead.
* @param node The void expression node to check.
* @returns Invalid ancestor node if it was found. `null` otherwise.
*/
function findInvalidAncestor(node) {
const parent = node.parent;
if (parent.type === utils_1.AST_NODE_TYPES.SequenceExpression &&
node !== parent.expressions[parent.expressions.length - 1]) {
return null;
}
if (parent.type === utils_1.AST_NODE_TYPES.ExpressionStatement) {
// e.g. `{ console.log("foo"); }`
// this is always valid
return null;
}
if (parent.type === utils_1.AST_NODE_TYPES.LogicalExpression &&
parent.right === node) {
// e.g. `x && console.log(x)`
// this is valid only if the next ancestor is valid
return findInvalidAncestor(parent);
}
if (parent.type === utils_1.AST_NODE_TYPES.ConditionalExpression &&
(parent.consequent === node || parent.alternate === node)) {
// e.g. `cond ? console.log(true) : console.log(false)`
// this is valid only if the next ancestor is valid
return findInvalidAncestor(parent);
}
if (parent.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression &&
// e.g. `() => console.log("foo")`
// this is valid with an appropriate option
options.ignoreArrowShorthand) {
return null;
}
if (parent.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
parent.operator === 'void' &&
// e.g. `void console.log("foo")`
// this is valid with an appropriate option
options.ignoreVoidOperator) {
return null;
}
if (parent.type === utils_1.AST_NODE_TYPES.ChainExpression) {
// e.g. `console?.log('foo')`
return findInvalidAncestor(parent);
}
// Any other parent is invalid.
// We can assume a return statement will have an argument.
return parent;
}
/** Checks whether the return statement is the last statement in a function body. */
function isFinalReturn(node) {
// the parent must be a block
const block = node.parent;
if (block.type !== utils_1.AST_NODE_TYPES.BlockStatement) {
// e.g. `if (cond) return;` (not in a block)
return false;
}
// the block's parent must be a function
const blockParent = block.parent;
if (![
utils_1.AST_NODE_TYPES.ArrowFunctionExpression,
utils_1.AST_NODE_TYPES.FunctionDeclaration,
utils_1.AST_NODE_TYPES.FunctionExpression,
].includes(blockParent.type)) {
// e.g. `if (cond) { return; }`
// not in a top-level function block
return false;
}
// must be the last child of the block
if (block.body.indexOf(node) < block.body.length - 1) {
// not the last statement in the block
return false;
}
return true;
}
/**
* Checks whether the given node, if placed on its own line,
* would prevent automatic semicolon insertion on the line before.
*
* This happens if the line begins with `(`, `[` or `` ` ``
*/
function isPreventingASI(node) {
const startToken = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(node), util_1.NullThrowsReasons.MissingToken('first token', node.type));
return ['(', '[', '`'].includes(startToken.value);
}
function canFix(node) {
const targetNode = node.type === utils_1.AST_NODE_TYPES.ReturnStatement
? node.argument
: node.body;
const type = (0, util_1.getConstrainedTypeAtLocation)(services, targetNode);
return tsutils.isTypeFlagSet(type, ts.TypeFlags.VoidLike);
}
function isFunctionReturnTypeIncludesVoid(functionType) {
const callSignatures = tsutils.getCallSignaturesOfType(functionType);
return callSignatures.some(signature => {
const returnType = signature.getReturnType();
return tsutils
.unionConstituents(returnType)
.some(tsutils.isIntrinsicVoidType);
});
}
function isVoidReturningFunctionNode(functionNode) {
// Game plan:
// - If the function node has a type annotation, check if it includes `void`.
// - If it does then the function is safe to return `void` expressions in.
// - Otherwise, check if the function is a function-expression or an arrow-function.
// - If it is, get its contextual type and bail if we cannot.
// - Return based on whether the contextual type includes `void` or not
if (functionNode.returnType) {
const returnType = services.getTypeFromTypeNode(functionNode.returnType.typeAnnotation);
return tsutils
.unionConstituents(returnType)
.some(tsutils.isIntrinsicVoidType);
}
if (functionNode.type !== utils_1.AST_NODE_TYPES.FunctionDeclaration) {
const functionType = services.getContextualType(functionNode);
if (functionType) {
return tsutils
.unionConstituents(functionType)
.some(isFunctionReturnTypeIncludesVoid);
}
}
return false;
}
},
});
@@ -0,0 +1,60 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
Arrow: () => Arrow,
Root: () => Root
});
module.exports = __toCommonJS(index_exports);
// src/arrow.tsx
var React = __toESM(require("react"));
var import_react_primitive = require("@radix-ui/react-primitive");
var import_jsx_runtime = require("react/jsx-runtime");
var NAME = "Arrow";
var Arrow = React.forwardRef((props, forwardedRef) => {
const { children, width = 10, height = 5, ...arrowProps } = props;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.svg,
{
...arrowProps,
ref: forwardedRef,
width,
height,
viewBox: "0 0 30 10",
preserveAspectRatio: "none",
children: props.asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polygon", { points: "0,0 30,0 15,10" })
}
);
});
Arrow.displayName = NAME;
var Root = Arrow;
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"names":["_assertClassBrand","require","_classPrivateSetter","privateMap","setter","receiver","value","assertClassBrand"],"sources":["../../src/helpers/classPrivateSetter.ts"],"sourcesContent":["/* @minVersion 7.24.0 */\n\nimport assertClassBrand from \"./assertClassBrand.ts\";\n\nexport default function _classPrivateSetter(\n privateMap: WeakMap<any, any> | WeakSet<any>,\n setter: Function,\n receiver: any,\n value: any,\n) {\n setter(assertClassBrand(privateMap, receiver), value);\n return value;\n}\n"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAEe,SAASC,mBAAmBA,CACzCC,UAA4C,EAC5CC,MAAgB,EAChBC,QAAa,EACbC,KAAU,EACV;EACAF,MAAM,CAAC,IAAAG,yBAAgB,EAACJ,UAAU,EAAEE,QAAQ,CAAC,EAAEC,KAAK,CAAC;EACrD,OAAOA,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _defaults;
function _defaults(obj, defaults) {
for (var keys = Object.getOwnPropertyNames(defaults), i = 0; i < keys.length; i++) {
var key = keys[i],
value = Object.getOwnPropertyDescriptor(defaults, key);
if (value && value.configurable && obj[key] === undefined) {
Object.defineProperty(obj, key, value);
}
}
return obj;
}
//# sourceMappingURL=defaults.js.map
@@ -0,0 +1,16 @@
type Measurable = {
getBoundingClientRect(): DOMRect;
};
/**
* Observes an element's rectangle on screen (getBoundingClientRect)
* This is useful to track elements on the screen and attach other elements
* that might be in different layers, etc.
*/
declare function observeElementRect(
/** The element whose rect to observe */
elementToObserve: Measurable,
/** The callback which will be called when the rect changes */
callback: CallbackFn): () => void;
type CallbackFn = (rect: DOMRect) => void;
export { type Measurable, observeElementRect };
@@ -0,0 +1,24 @@
/**
* @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 PaintbrushVertical = createLucideIcon("PaintbrushVertical", [
["path", { d: "M10 2v2", key: "7u0qdc" }],
["path", { d: "M14 2v4", key: "qmzblu" }],
["path", { d: "M17 2a1 1 0 0 1 1 1v9H6V3a1 1 0 0 1 1-1z", key: "ycvu00" }],
[
"path",
{
d: "M6 12a1 1 0 0 0-1 1v1a2 2 0 0 0 2 2h2a1 1 0 0 1 1 1v2.9a2 2 0 1 0 4 0V17a1 1 0 0 1 1-1h2a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1",
key: "iw4wnp"
}
]
]);
export { PaintbrushVertical as default };
//# sourceMappingURL=paintbrush-vertical.js.map
@@ -0,0 +1,548 @@
# ws: a Node.js WebSocket library
[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws)
[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws)
ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and
server implementation.
Passes the quite extensive Autobahn test suite: [server][server-report],
[client][client-report].
**Note**: This module does not work in the browser. The client in the docs is a
reference to a backend with the role of a client in the WebSocket communication.
Browser clients must use the native
[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
object. To make the same code work seamlessly on Node.js and the browser, you
can use one of the many wrappers available on npm, like
[isomorphic-ws](https://github.com/heineiuo/isomorphic-ws).
## Table of Contents
- [Protocol support](#protocol-support)
- [Installing](#installing)
- [Opt-in for performance](#opt-in-for-performance)
- [Legacy opt-in for performance](#legacy-opt-in-for-performance)
- [API docs](#api-docs)
- [WebSocket compression](#websocket-compression)
- [Usage examples](#usage-examples)
- [Sending and receiving text data](#sending-and-receiving-text-data)
- [Sending binary data](#sending-binary-data)
- [Simple server](#simple-server)
- [External HTTP/S server](#external-https-server)
- [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server)
- [Client authentication](#client-authentication)
- [Server broadcast](#server-broadcast)
- [Round-trip time](#round-trip-time)
- [Use the Node.js streams API](#use-the-nodejs-streams-api)
- [Other examples](#other-examples)
- [FAQ](#faq)
- [How to get the IP address of the client?](#how-to-get-the-ip-address-of-the-client)
- [How to detect and close broken connections?](#how-to-detect-and-close-broken-connections)
- [How to connect via a proxy?](#how-to-connect-via-a-proxy)
- [Changelog](#changelog)
- [License](#license)
## Protocol support
- **HyBi drafts 07-12** (Use the option `protocolVersion: 8`)
- **HyBi drafts 13-17** (Current default, alternatively option
`protocolVersion: 13`)
## Installing
```
npm install ws
```
### Opt-in for performance
[bufferutil][] is an optional module that can be installed alongside the ws
module:
```
npm install --save-optional bufferutil
```
This is a binary addon that improves the performance of certain operations such
as masking and unmasking the data payload of the WebSocket frames. Prebuilt
binaries are available for the most popular platforms, so you don't necessarily
need to have a C++ compiler installed on your machine.
To force ws to not use bufferutil, use the
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This
can be useful to enhance security in systems where a user can put a package in
the package search path of an application of another user, due to how the
Node.js resolver algorithm works.
#### Legacy opt-in for performance
If you are running on an old version of Node.js (prior to v18.14.0), ws also
supports the [utf-8-validate][] module:
```
npm install --save-optional utf-8-validate
```
This contains a binary polyfill for [`buffer.isUtf8()`][].
To force ws not to use utf-8-validate, use the
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
## API docs
See [`/doc/ws.md`](./doc/ws.md) for Node.js-like documentation of ws classes and
utility functions.
## WebSocket compression
ws supports the [permessage-deflate extension][permessage-deflate] which enables
the client and server to negotiate a compression algorithm and its parameters,
and then selectively apply it to the data payloads of each WebSocket message.
The extension is disabled by default on the server and enabled by default on the
client. It adds a significant overhead in terms of performance and memory
consumption so we suggest to enable it only if it is really needed.
Note that Node.js has a variety of issues with high-performance compression,
where increased concurrency, especially on Linux, can lead to [catastrophic
memory fragmentation][node-zlib-bug] and slow performance. If you intend to use
permessage-deflate in production, it is worthwhile to set up a test
representative of your workload and ensure Node.js/zlib will handle it with
acceptable performance and memory usage.
Tuning of permessage-deflate can be done via the options defined below. You can
also use `zlibDeflateOptions` and `zlibInflateOptions`, which is passed directly
into the creation of [raw deflate/inflate streams][node-zlib-deflaterawdocs].
See [the docs][ws-server-options] for more options.
```js
import WebSocket, { WebSocketServer } from 'ws';
const wss = new WebSocketServer({
port: 8080,
perMessageDeflate: {
zlibDeflateOptions: {
// See zlib defaults.
chunkSize: 1024,
memLevel: 7,
level: 3
},
zlibInflateOptions: {
chunkSize: 10 * 1024
},
// Other options settable:
clientNoContextTakeover: true, // Defaults to negotiated value.
serverNoContextTakeover: true, // Defaults to negotiated value.
serverMaxWindowBits: 10, // Defaults to negotiated value.
// Below options specified as default values.
concurrencyLimit: 10, // Limits zlib concurrency for perf.
threshold: 1024 // Size (in bytes) below which messages
// should not be compressed if context takeover is disabled.
}
});
```
The client will only use the extension if it is supported and enabled on the
server. To always disable the extension on the client, set the
`perMessageDeflate` option to `false`.
```js
import WebSocket from 'ws';
const ws = new WebSocket('ws://www.host.com/path', {
perMessageDeflate: false
});
```
## Usage examples
### Sending and receiving text data
```js
import WebSocket from 'ws';
const ws = new WebSocket('ws://www.host.com/path');
ws.on('error', console.error);
ws.on('open', function open() {
ws.send('something');
});
ws.on('message', function message(data) {
console.log('received: %s', data);
});
```
### Sending binary data
```js
import WebSocket from 'ws';
const ws = new WebSocket('ws://www.host.com/path');
ws.on('error', console.error);
ws.on('open', function open() {
const array = new Float32Array(5);
for (var i = 0; i < array.length; ++i) {
array[i] = i / 2;
}
ws.send(array);
});
```
### Simple server
```js
import { WebSocketServer } from 'ws';
const wss = new WebSocketServer({ port: 8080 });
wss.on('connection', function connection(ws) {
ws.on('error', console.error);
ws.on('message', function message(data) {
console.log('received: %s', data);
});
ws.send('something');
});
```
### External HTTP/S server
```js
import { createServer } from 'https';
import { readFileSync } from 'fs';
import { WebSocketServer } from 'ws';
const server = createServer({
cert: readFileSync('/path/to/cert.pem'),
key: readFileSync('/path/to/key.pem')
});
const wss = new WebSocketServer({ server });
wss.on('connection', function connection(ws) {
ws.on('error', console.error);
ws.on('message', function message(data) {
console.log('received: %s', data);
});
ws.send('something');
});
server.listen(8080);
```
### Multiple servers sharing a single HTTP/S server
```js
import { createServer } from 'http';
import { WebSocketServer } from 'ws';
const server = createServer();
const wss1 = new WebSocketServer({ noServer: true });
const wss2 = new WebSocketServer({ noServer: true });
wss1.on('connection', function connection(ws) {
ws.on('error', console.error);
// ...
});
wss2.on('connection', function connection(ws) {
ws.on('error', console.error);
// ...
});
server.on('upgrade', function upgrade(request, socket, head) {
const { pathname } = new URL(request.url, 'wss://base.url');
if (pathname === '/foo') {
wss1.handleUpgrade(request, socket, head, function done(ws) {
wss1.emit('connection', ws, request);
});
} else if (pathname === '/bar') {
wss2.handleUpgrade(request, socket, head, function done(ws) {
wss2.emit('connection', ws, request);
});
} else {
socket.destroy();
}
});
server.listen(8080);
```
### Client authentication
```js
import { createServer } from 'http';
import { WebSocketServer } from 'ws';
function onSocketError(err) {
console.error(err);
}
const server = createServer();
const wss = new WebSocketServer({ noServer: true });
wss.on('connection', function connection(ws, request, client) {
ws.on('error', console.error);
ws.on('message', function message(data) {
console.log(`Received message ${data} from user ${client}`);
});
});
server.on('upgrade', function upgrade(request, socket, head) {
socket.on('error', onSocketError);
// This function is not defined on purpose. Implement it with your own logic.
authenticate(request, function next(err, client) {
if (err || !client) {
socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n');
socket.destroy();
return;
}
socket.removeListener('error', onSocketError);
wss.handleUpgrade(request, socket, head, function done(ws) {
wss.emit('connection', ws, request, client);
});
});
});
server.listen(8080);
```
Also see the provided [example][session-parse-example] using `express-session`.
### Server broadcast
A client WebSocket broadcasting to all connected WebSocket clients, including
itself.
```js
import WebSocket, { WebSocketServer } from 'ws';
const wss = new WebSocketServer({ port: 8080 });
wss.on('connection', function connection(ws) {
ws.on('error', console.error);
ws.on('message', function message(data, isBinary) {
wss.clients.forEach(function each(client) {
if (client.readyState === WebSocket.OPEN) {
client.send(data, { binary: isBinary });
}
});
});
});
```
A client WebSocket broadcasting to every other connected WebSocket clients,
excluding itself.
```js
import WebSocket, { WebSocketServer } from 'ws';
const wss = new WebSocketServer({ port: 8080 });
wss.on('connection', function connection(ws) {
ws.on('error', console.error);
ws.on('message', function message(data, isBinary) {
wss.clients.forEach(function each(client) {
if (client !== ws && client.readyState === WebSocket.OPEN) {
client.send(data, { binary: isBinary });
}
});
});
});
```
### Round-trip time
```js
import WebSocket from 'ws';
const ws = new WebSocket('wss://websocket-echo.com/');
ws.on('error', console.error);
ws.on('open', function open() {
console.log('connected');
ws.send(Date.now());
});
ws.on('close', function close() {
console.log('disconnected');
});
ws.on('message', function message(data) {
console.log(`Round-trip time: ${Date.now() - data} ms`);
setTimeout(function timeout() {
ws.send(Date.now());
}, 500);
});
```
### Use the Node.js streams API
```js
import WebSocket, { createWebSocketStream } from 'ws';
const ws = new WebSocket('wss://websocket-echo.com/');
const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
duplex.on('error', console.error);
duplex.pipe(process.stdout);
process.stdin.pipe(duplex);
```
### Other examples
For a full example with a browser client communicating with a ws server, see the
examples folder.
Otherwise, see the test cases.
## FAQ
### How to get the IP address of the client?
The remote IP address can be obtained from the raw socket.
```js
import { WebSocketServer } from 'ws';
const wss = new WebSocketServer({ port: 8080 });
wss.on('connection', function connection(ws, req) {
const ip = req.socket.remoteAddress;
ws.on('error', console.error);
});
```
When the server runs behind a proxy like NGINX, the de-facto standard is to use
the `X-Forwarded-For` header.
```js
wss.on('connection', function connection(ws, req) {
const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
ws.on('error', console.error);
});
```
### How to detect and close broken connections?
Sometimes, the link between the server and the client can be interrupted in a
way that keeps both the server and the client unaware of the broken state of the
connection (e.g. when pulling the cord).
In these cases, ping messages can be used as a means to verify that the remote
endpoint is still responsive.
```js
import { WebSocketServer } from 'ws';
function heartbeat() {
this.isAlive = true;
}
const wss = new WebSocketServer({ port: 8080 });
wss.on('connection', function connection(ws) {
ws.isAlive = true;
ws.on('error', console.error);
ws.on('pong', heartbeat);
});
const interval = setInterval(function ping() {
wss.clients.forEach(function each(ws) {
if (ws.isAlive === false) return ws.terminate();
ws.isAlive = false;
ws.ping();
});
}, 30000);
wss.on('close', function close() {
clearInterval(interval);
});
```
Pong messages are automatically sent in response to ping messages as required by
the spec.
Just like the server example above, your clients might as well lose connection
without knowing it. You might want to add a ping listener on your clients to
prevent that. A simple implementation would be:
```js
import WebSocket from 'ws';
function heartbeat() {
clearTimeout(this.pingTimeout);
// Use `WebSocket#terminate()`, which immediately destroys the connection,
// instead of `WebSocket#close()`, which waits for the close timer.
// Delay should be equal to the interval at which your server
// sends out pings plus a conservative assumption of the latency.
this.pingTimeout = setTimeout(() => {
this.terminate();
}, 30000 + 1000);
}
const client = new WebSocket('wss://websocket-echo.com/');
client.on('error', console.error);
client.on('open', heartbeat);
client.on('ping', heartbeat);
client.on('close', function clear() {
clearTimeout(this.pingTimeout);
});
```
### How to connect via a proxy?
Use a custom `http.Agent` implementation like [https-proxy-agent][] or
[socks-proxy-agent][].
## Changelog
We're using the GitHub [releases][changelog] for changelog entries.
## License
[MIT](LICENSE)
[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input
[bufferutil]: https://github.com/websockets/bufferutil
[changelog]: https://github.com/websockets/ws/releases
[client-report]: http://websockets.github.io/ws/autobahn/clients/
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
[node-zlib-bug]: https://github.com/nodejs/node/issues/8871
[node-zlib-deflaterawdocs]:
https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options
[permessage-deflate]: https://tools.ietf.org/html/rfc7692
[server-report]: http://websockets.github.io/ws/autobahn/servers/
[session-parse-example]: ./examples/express-session-parse
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
[utf-8-validate]: https://github.com/websockets/utf-8-validate
[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback
@@ -0,0 +1,723 @@
export default `flf2a$ 6 4 16 0 4
Autore: Marco Bodrato <bodrato@genio.sns.it>
Data: 12 Novembre 1994
Stile: stampatello minuscolo e maiuscole varie.
File: stampatello.flf
$$@
$$@
$$@
$ @
$ @
$ @@
/\\$@
\\/$@
,.$@
\`'$@
@
@@
;;$@
$ @
@
@
@
@@
. .$ @
-|-|-$@
-|-|-$@
' \`$ @
@
@@
@
,|.$@
\`+.$@
\`|'$@
@
@@
@
,. , $@
\`'/,.$@
' \`'$@
@
@@
@
,. $@
>-:,$@
\`-'\`$@
@
@@
@
,'$@
$ @
@
@
@@
,-$@
/$ @
|$ @
\\$ @
\`-$@
@@
-.$ @
\\$@
|$@
/$@
-'$ @
@@
@
. ,$@
-X-$@
' \`$@
@
@@
@
. $@
-|-$@
' $@
@
@@
$ @
$ @
,.$@
|/$@
@
@@
@
@
--$@
@
@
@@
$ @
$ @
,.$@
\`'$@
@
@@
@
,$@
/$ @
'$ @
@
@@
,--.$@
| |$@
| |$@
\`--'$@
@
@@
, $@
/| $@
' | $@
$-^-$@
@
@@
,--.$@
$ /$@
,-' $@
\`---$@
@
@@
,--.$@
$__|$@
$ |$@
\`--'$@
@
@@
$ , $@
$/| $@
'-+-$@
$ \` $@
@
@@
,---$@
|__ $@
$ \\$@
\`--'$@
@
@@
,--.$@
|__ $@
| \\$@
\`--'$@
@
@@
,--,$@
$ / $@
$/ $@
' $@
@
@@
,--.$@
\\__/$@
/ \\$@
\`--'$@
@
@@
,--.$@
\\__|$@
$ |$@
\`--'$@
@
@@
,.$@
\`'$@
,.$@
\`'$@
@
@@
,.$@
\`'$@
,.$@
|/$@
@
@@
,$@
/ $@
\\ $@
\`$@
@
@@
@
--$@
--$@
@
@
@@
. $@
\\$@
/$@
' $@
@
@@
,--.$@
/$ @
,.$ @
\`'$ @
@
@@
,-.$ @
/,-.\\$@
|,-||$@
\\\`-^/$@
\`-'$ @
@@
,.$ @
/ |$$ @
/~~|-.$@
,' \`-'$@
@
@@
,-,---.$@
'|___/$@
,| \\$@
\`-^---'$@
@
@@
,---.$@
| -'$@
| -.$@
\`---'$@
@
@@
.-,--.$ @
' | \\$@
, | /$@
\`-^--'$ @
@
@@
\`.---$@
|__$ @
,| $ @
\`^---$@
@
@@
\`.---$@
|__$ @
,|$ @
\`'$ @
@
@@
,---.$ @
| -'$ @
| ,-'$@
\`---|$ @
,-.|$ @
\`-+'$ @@
,-_/,.$@
' |_|/$@
/| |$ @
\`' \`'$@
@
@@
,-_/$@
' |$@
.- |$@
\`--'$@
@
@@
,-_/$@
' |$@
|$@
|$@
/ |$@
\`--'$@@
,-, ,$@
'|/$ @
|\\$ @
,' \`$@
@
@@
.$ @
|$ @
| $ @
\`--'$@
@
@@
,-,-,-. $ @
\`,| | | $ @
| ; | .$@
' \`-'$@
@
@@
,-,-. $ @
\` | | $ @
| |-.$@
,' \`-'$@
@
@@
,---.$@
| |$@
| |$@
\`---'$@
@
@@
.-,--.$@
'|__/$@
.| $ @
\`' $ @
@
@@
,--.$@
| |$@
| \\|$@
\`--\\$@
@
@@
.-,--.$@
\`|__/$@
| \\ $@
\`-' \`$@
@
@@
.---.$@
\\___$ @
\\$@
\`---'$@
@
@@
,--,--'@
\`- |$ @
, |$ @
\`-'$ @
@
@@
,-. .$ @
| |$ @
| | .$@
\`--^-'$@
@
@@
,. ,.$@
\`| /$ @
| /$ @
\`'$ @
@
@@
,. , ,.$@
\`| /| /$ @
| / | /$ @
\`' \`'$ @
@
@@
,. ,.$@
\` \\/$ @
/\\$ @
\`' \`'$@
@
@@
. .$@
| |$@
| |$@
\`--|$@
.- |$@
\`--'$@@
,-_/$@
/$ @
/$ @
/--,$@
@
@@
.-$@
|$ @
|$ @
|$ @
\`-$@
@@
@
.$ @
\\$ @
\`$@
@
@@
-.$@
|$@
|$@
|$@
-'$@
@@
@
/\\$@
$ $@
$ @
@
@@
$$@
$$@
$$@
$$@
~~@
@@
. $@
\`$@
$@
@
@
@@
@
,-.$@
,-|$@
\`-^$@
@
@@
.$ @
|-.$@
| |$@
\`-'$@
@
@@
@
,-.$@
| $@
\`-'$@
@
@@
.$@
,-|$@
| |$@
\`-'$@
@
@@
@
,-.$@
|-'$@
\`-'$@
@
@@
,_$@
|_$@
|$ @
|$ @
'$ @
@@
@
,-.$@
| |$@
\`-|$@
,|$@
\`'$@@
.$ @
|-.$@
| |$@
' '$@
@
@@
@
.$@
|$@
'$@
@
@@
@
.$@
|$@
|$@
|$@
\`'$@@
@
. ,$@
|/$ @
|\\$ @
' \`$@
@@
.$ @
|$ @
|$ @
\`'$@
@
@@
@
,-,-.$@
| | |$@
' ' '$@
@
@@
@
,-.$@
| |$@
' '$@
@
@@
@
,-.$@
| |$@
\`-'$@
@
@@
@
,-.$@
| |$@
|-'$@
|$ @
'$ @@
@
,-.$@
| |$@
\`-|$@
|$@
\`$@@
@
,-.$@
| $ @
' $ @
@
@@
@
,-.$@
\`-.$@
\`-'$@
@
@@
.$ @
|-$@
|$ @
\`'$@
@
@@
@
. .$@
| |$@
\`-'$@
@
@@
@
. ,$@
| /$ @
\`'$ @
@
@@
@
. , ,$@
|/|/$ @
' ' $ @
@
@@
@
. ,$@
X $@
' \`$@
@
@@
@
. .$@
| |$@
\`-|$@
/|$@
\`-'$@@
@
,_,$@
/ $@
'"'$@
@
@@
.-$@
)$@
<$ @
)$@
'-$@
@@
|$@
|$@
|$@
|$@
|$@
@@
-,$@
( $@
>$@
( $@
-\`$@
@@
,','$@
$ $ @
$ $ @
$$ @
@
@@
o, o$ @
/ \\ $ @
/~~|-.$@
,' \`-'$@
@
@@
,o-o.$@
| |$@
| |$@
\`---'$@
@
@@
. o o$ @
'\\ |$ @
| | .$@
\`--^-'$@
@
@@
o o$@
,-.$@
,-|$@
\`-^$@
@
@@
o o$@
,-.$@
| |$@
\`-'$@
@
@@
o o$@
. .$@
| |$@
\`-'$@
@
@@
,-.$ @
|_/$ @
,| .\\$@
\`-' \`'$@
@
@@
161
,.$@
\`'$@
/\\$@
\\/$@
@
@@
162
@
,+.$@
|| $@
\`+'$@
@
@@
166
|$@
|$@
$$@
|$@
|$@
$$@@
167
@
,-.@
|-.@
\`-|@
\`-'@
@@
168
~ ~$@
$ $ @
$ @
@
@
@@
169
,-.$ @
/,-.\\$@
|| |$@
\\\`-'/$@
\`-'$ @
@@
170
_.@
(_|@
~~~@
$$@
@
@@
171
, ,$@
/ /$ @
\\ \\$ @
\` \`$@
@
@@
172
@
---.$@
|$@
@
@
@@
174
,-.$ @
/,-.\\$@
|| |$@
\\' /$@
\`-'$ @
@@
176
,.$@
\`'$@
$ @
@
@
@@
178
,.$@
/$@
""$@
$ @
@
@@
179
,.$@
+$@
\`'$@
$ @
@
@@
180
,.$@
$ @
$ @
@
@
@@
181
,.$@
$ @
$ @
@
@
@@
`
@@ -0,0 +1,127 @@
'use strict'
const Dispatcher = require('./dispatcher')
const { InvalidArgumentError } = require('../core/errors')
const { toRawHeaders } = require('../core/util')
const { kOriginless, kUrl } = require('../core/symbols')
class LegacyHandlerWrapper {
#handler
constructor (handler) {
this.#handler = handler
}
onRequestStart (controller, context) {
this.#handler.onConnect?.((reason) => controller.abort(reason), context)
}
onRequestUpgrade (controller, statusCode, headers, socket) {
const rawHeaders = Array.isArray(controller?.rawHeaders)
? controller.rawHeaders
: toRawHeaders(controller?.rawHeaders ?? headers ?? {})
this.#handler.onUpgrade?.(statusCode, rawHeaders, socket)
}
onResponseStart (controller, statusCode, headers, statusMessage) {
const rawHeaders = Array.isArray(controller?.rawHeaders)
? controller.rawHeaders
: toRawHeaders(controller?.rawHeaders ?? headers ?? {})
if (this.#handler.onHeaders?.(statusCode, rawHeaders, () => controller.resume(), statusMessage) === false) {
controller.pause()
}
}
onResponseData (controller, chunk) {
if (this.#handler.onData?.(chunk) === false) {
controller.pause()
}
}
onResponseEnd (controller, trailers) {
const rawTrailers = Array.isArray(controller?.rawTrailers)
? controller.rawTrailers
: toRawHeaders(controller?.rawTrailers ?? trailers ?? {})
this.#handler.onComplete?.(rawTrailers)
}
onResponseError (_controller, err) {
if (!this.#handler.onError) {
throw err
}
this.#handler.onError(err)
}
onBodySent (chunk) {
this.#handler.onBodySent?.(chunk)
}
onRequestSent () {
this.#handler.onRequestSent?.()
}
onResponseStarted () {
this.#handler.onResponseStarted?.()
}
}
class Dispatcher1Wrapper extends Dispatcher {
#dispatcher
constructor (dispatcher) {
super()
if (!dispatcher || typeof dispatcher.dispatch !== 'function') {
throw new InvalidArgumentError('Argument dispatcher must implement dispatch')
}
this.#dispatcher = dispatcher
this[kUrl] = dispatcher[kUrl]
this[kOriginless] = dispatcher[kOriginless]
}
static wrapHandler (handler) {
if (!handler || typeof handler !== 'object') {
throw new InvalidArgumentError('handler must be an object')
}
if (typeof handler.onRequestStart === 'function') {
return handler
}
return new LegacyHandlerWrapper(handler)
}
dispatch (opts, handler) {
// Legacy (v1) consumers do not support HTTP/2, so force HTTP/1.1.
// See https://github.com/nodejs/undici/issues/4989
if (opts.allowH2 !== false) {
opts = { ...opts, allowH2: false }
}
return this.#dispatcher.dispatch(opts, Dispatcher1Wrapper.wrapHandler(handler))
}
// Older undici versions read WebSocket and EventSource receive limits from
// the (legacy) global dispatcher, which is this wrapper, so report the
// wrapped dispatcher's settings.
get webSocketOptions () {
return this.#dispatcher.webSocketOptions
}
get eventSourceOptions () {
return this.#dispatcher.eventSourceOptions
}
close (...args) {
return this.#dispatcher.close(...args)
}
destroy (...args) {
return this.#dispatcher.destroy(...args)
}
}
module.exports = Dispatcher1Wrapper
@@ -0,0 +1,202 @@
/**
* Internal Merkle-Damgard hash utils.
* @module
*/
import { abytes, aexists, aoutput, clean, createView, } from "./utils.js";
/**
* Shared 32-bit conditional boolean primitive reused by SHA-256, SHA-1, and MD5 `F`.
* Returns bits from `b` when `a` is set, otherwise from `c`.
* The XOR form is equivalent to MD5's `F(X,Y,Z) = XY v not(X)Z` because the masked terms never
* set the same bit.
* @param a - selector word
* @param b - word chosen when selector bit is set
* @param c - word chosen when selector bit is clear
* @returns Mixed 32-bit word.
* @example
* Combine three words with the shared 32-bit choice primitive.
* ```ts
* Chi(0xffffffff, 0x12345678, 0x87654321);
* ```
*/
export function Chi(a, b, c) {
return (a & b) ^ (~a & c);
}
/**
* Shared 32-bit majority primitive reused by SHA-256 and SHA-1.
* Returns bits shared by at least two inputs.
* @param a - first input word
* @param b - second input word
* @param c - third input word
* @returns Mixed 32-bit word.
* @example
* Combine three words with the shared 32-bit majority primitive.
* ```ts
* Maj(0xffffffff, 0x12345678, 0x87654321);
* ```
*/
export function Maj(a, b, c) {
return (a & b) ^ (a & c) ^ (b & c);
}
/**
* Merkle-Damgard hash construction base class.
* Could be used to create MD5, RIPEMD, SHA1, SHA2.
* Accepts only byte-aligned `Uint8Array` input, even when the underlying spec describes bit
* strings with partial-byte tails.
* @param blockLen - internal block size in bytes
* @param outputLen - digest size in bytes
* @param padOffset - trailing length field size in bytes
* @param isLE - whether length and state words are encoded in little-endian
* @example
* Use a concrete subclass to get the shared Merkle-Damgard update/digest flow.
* ```ts
* import { _SHA1 } from '@noble/hashes/legacy.js';
* const hash = new _SHA1();
* hash.update(new Uint8Array([97, 98, 99]));
* hash.digest();
* ```
*/
export class HashMD {
blockLen;
outputLen;
canXOF = false;
padOffset;
isLE;
// For partial updates less than block size
buffer;
view;
finished = false;
length = 0;
pos = 0;
destroyed = false;
constructor(blockLen, outputLen, padOffset, isLE) {
this.blockLen = blockLen;
this.outputLen = outputLen;
this.padOffset = padOffset;
this.isLE = isLE;
this.buffer = new Uint8Array(blockLen);
this.view = createView(this.buffer);
}
update(data) {
aexists(this);
abytes(data);
const { view, buffer, blockLen } = this;
const len = data.length;
for (let pos = 0; pos < len;) {
const take = Math.min(blockLen - this.pos, len - pos);
// Fast path only when there is no buffered partial block: `take === blockLen` implies
// `this.pos === 0`, so we can process full blocks directly from the input view.
if (take === blockLen) {
const dataView = createView(data);
for (; blockLen <= len - pos; pos += blockLen)
this.process(dataView, pos);
continue;
}
buffer.set(data.subarray(pos, pos + take), this.pos);
this.pos += take;
pos += take;
if (this.pos === blockLen) {
this.process(view, 0);
this.pos = 0;
}
}
this.length += data.length;
this.roundClean();
return this;
}
digestInto(out) {
aexists(this);
aoutput(out, this);
this.finished = true;
// Padding
// We can avoid allocation of buffer for padding completely if it
// was previously not allocated here. But it won't change performance.
const { buffer, view, blockLen, isLE } = this;
let { pos } = this;
// append the bit '1' to the message
buffer[pos++] = 0b10000000;
clean(this.buffer.subarray(pos));
// we have less than padOffset left in buffer, so we cannot put length in
// current block, need process it and pad again
if (this.padOffset > blockLen - pos) {
this.process(view, 0);
pos = 0;
}
// Pad until full block byte with zeros
for (let i = pos; i < blockLen; i++)
buffer[i] = 0;
// `padOffset` reserves the whole length field. For SHA-384/512 the high 64 bits stay zero from
// the padding fill above, and JS will overflow before user input can make that half non-zero.
// So we only need to write the low 64 bits here.
view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);
this.process(view, 0);
const oview = createView(out);
const len = this.outputLen;
// NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT
if (len % 4)
throw new Error('_sha2: outputLen must be aligned to 32bit');
const outLen = len / 4;
const state = this.get();
if (outLen > state.length)
throw new Error('_sha2: outputLen bigger than state');
for (let i = 0; i < outLen; i++)
oview.setUint32(4 * i, state[i], isLE);
}
digest() {
const { buffer, outputLen } = this;
this.digestInto(buffer);
// Copy before destroy(): subclasses wipe `buffer` during cleanup, but `digest()` must return
// fresh bytes to the caller.
const res = buffer.slice(0, outputLen);
this.destroy();
return res;
}
_cloneInto(to) {
to ||= new this.constructor();
to.set(...this.get());
const { blockLen, buffer, length, finished, destroyed, pos } = this;
to.destroyed = destroyed;
to.finished = finished;
to.length = length;
to.pos = pos;
// Only partial-block bytes need copying: when `length % blockLen === 0`, `pos === 0` and
// later `update()` / `digestInto()` overwrite `to.buffer` from the start before reading it.
if (length % blockLen)
to.buffer.set(buffer);
return to;
}
clone() {
return this._cloneInto();
}
}
/**
* Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
* Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
*/
/** Initial SHA256 state from RFC 6234 §6.1: the first 32 bits of the fractional parts of the
* square roots of the first eight prime numbers. Exported as a shared table; callers must treat
* it as read-only because constructors copy words from it by index. */
export const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
]);
/** Initial SHA224 state `H(0)` from RFC 6234 §6.1. Exported as a shared table; callers must
* treat it as read-only because constructors copy words from it by index. */
export const SHA224_IV = /* @__PURE__ */ Uint32Array.from([
0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,
]);
/** Initial SHA384 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen
* big-endian 32-bit halves. Derived from the fractional parts of the square roots of the ninth
* through sixteenth prime numbers. Exported as a shared table; callers must treat it as read-only
* because constructors copy halves from it by index. */
export const SHA384_IV = /* @__PURE__ */ Uint32Array.from([
0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,
0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,
]);
/** Initial SHA512 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen
* big-endian 32-bit halves. Derived from the fractional parts of the square roots of the first
* eight prime numbers. Exported as a shared table; callers must treat it as read-only because
* constructors copy halves from it by index. */
export const SHA512_IV = /* @__PURE__ */ Uint32Array.from([
0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,
0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,
]);
//# sourceMappingURL=_md.js.map
@@ -0,0 +1 @@
module.exports={C:{"115":0.01529,"120":0.0051,"121":0.01529,"123":0.01019,"124":0.01529,"125":0.0051,"130":0.0051,"133":0.0051,"134":0.0051,"135":0.0051,"136":0.0051,"140":0.02548,"142":0.0051,"143":0.0051,"144":0.0051,"146":0.0051,"147":0.0051,"148":0.0051,"149":0.0051,"150":0.0051,"151":0.0051,"152":0.01019,"153":0.0051,"154":0.07134,"155":0.2599,"156":0.23951,"157":0.01019,"158":0.0051,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 122 126 127 128 129 131 132 137 138 139 141 145 159 160 3.5 3.6"},D:{"61":0.02548,"70":0.0051,"103":0.0051,"104":0.0051,"105":0.0051,"106":0.0051,"107":0.0051,"108":0.0051,"109":0.34143,"110":0.0051,"111":0.01529,"112":0.0051,"113":0.0051,"116":0.01529,"117":0.0051,"118":0.03058,"119":0.01529,"120":0.21403,"121":0.01529,"122":0.02548,"123":0.01529,"124":0.02548,"125":0.0051,"126":0.01019,"127":0.0051,"128":0.02548,"129":0.0051,"130":0.02548,"131":0.09682,"132":0.02038,"133":0.03058,"134":0.08663,"135":0.02548,"136":0.05096,"137":0.03567,"138":0.06625,"139":0.04586,"140":0.03567,"141":0.2497,"142":0.13759,"143":0.11211,"144":0.04077,"145":0.03058,"146":0.04077,"147":0.06115,"148":0.08663,"149":0.1274,"150":0.23442,"151":1.35044,"152":14.03438,"153":11.88897,"154":2.43589,"155":0.05606,"156":0.0051,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 62 63 64 65 66 67 68 69 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 114 115 157"},F:{"95":0.01019,"101":0.01019,"105":0.0051,"106":0.01019,"107":0.0051,"114":0.0051,"115":0.0051,"116":0.0051,"118":0.0051,"120":0.0051,"121":0.0051,"122":0.0051,"134":0.01529,"135":0.29047,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 100 102 103 104 108 109 110 111 112 113 117 119 123 124 125 126 127 131 132 133 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"92":0.0051,"109":0.03567,"111":0.0051,"114":0.0051,"119":0.01529,"120":0.01019,"122":0.01529,"123":0.0051,"124":0.0051,"125":0.0051,"126":0.0051,"127":0.0051,"128":0.0051,"129":0.0051,"130":0.0051,"131":0.01019,"132":0.01019,"133":0.0051,"134":0.01529,"135":0.01019,"136":0.01019,"137":0.01529,"138":0.02038,"139":0.01019,"140":0.01529,"141":0.02038,"142":0.02038,"143":0.03058,"144":0.01529,"145":0.02038,"146":0.02548,"147":0.04077,"148":0.03058,"149":0.04586,"150":0.09682,"151":0.22422,"152":3.5723,"153":4.04113,"154":0.98862,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 112 113 115 116 117 118 121"},E:{"27":0.14269,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 15.2-15.3 15.4 17.0 27.1 TP","15.5":0.01019,"15.6":0.07134,"16.0":0.0051,"16.1":0.01019,"16.2":0.01019,"16.3":0.01019,"16.4":0.0051,"16.5":0.0051,"16.6":0.09682,"17.1":0.10192,"17.2":0.0051,"17.3":0.0051,"17.4":0.01529,"17.5":0.01529,"17.6":0.05096,"18.0":0.0051,"18.1":0.01019,"18.2":0.01019,"18.3":0.01529,"18.4":0.01019,"18.5-18.7":0.02548,"26.0":0.01019,"26.1":0.01019,"26.2":0.03567,"26.3":0.04586,"26.4":0.03058,"26.5":0.2497,"26.6":1.17718,"27.2":0.0051},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.0016,"5.0-5.1":0.0016,"6.0-6.1":0,"7.0-7.1":0.0032,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.01601,"11.0-11.2":0.0016,"11.3-11.4":0.0032,"12.0-12.1":0,"12.2-12.5":0.04162,"13.0-13.1":0,"13.2":0.008,"13.3":0,"13.4-13.7":0.0016,"14.0-14.4":0.0064,"14.5-14.8":0.0096,"15.0-15.1":0.0096,"15.2-15.3":0.0064,"15.4":0.008,"15.5":0.0096,"15.6-15.8":0.20811,"16.0":0.01601,"16.1":0.02881,"16.2":0.01601,"16.3":0.03522,"16.4":0.008,"16.5":0.01281,"16.6-16.7":0.28975,"17.0":0.01121,"17.1":0.01601,"17.2":0.01601,"17.3":0.02401,"17.4":0.03362,"17.5":0.06563,"17.6-17.7":0.16969,"18.0":0.03522,"18.1":0.07044,"18.2":0.09605,"18.3":0.16649,"18.4":0.10405,"18.5-18.7":2.14991,"26.0":0.10405,"26.1":0.10565,"26.2":0.27534,"26.3":0.29775,"26.4":0.21771,"26.5":1.45836,"26.6":8.99826,"27.0":0.68996,"27.1":0,"27.2":0.01761},P:{"22":0.00894,"24":0.00894,"25":0.00894,"26":0.01789,"27":0.01789,"28":0.07156,"29":0.18783,"30":8.89074,_:"4 20 21 23 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0"},I:{"0":0.10289,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00004},K:{"0":0.07355,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.04077,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0Line truncated
@@ -0,0 +1,9 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
export { default } from './cloud-download.js';
//# sourceMappingURL=download-cloud.js.map
@@ -0,0 +1,566 @@
"use strict";
/**
* This module defines nodes used to define types and validations for objects and interfaces.
*/
// tslint:disable:no-shadowed-variable prefer-for-of
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.basicTypes = exports.BasicType = exports.TParamList = exports.TParam = exports.param = exports.TFunc = exports.func = exports.TProp = exports.TOptional = exports.opt = exports.TIface = exports.iface = exports.TEnumLiteral = exports.enumlit = exports.TEnumType = exports.enumtype = exports.TIntersection = exports.intersection = exports.TUnion = exports.union = exports.TTuple = exports.tuple = exports.TArray = exports.array = exports.TLiteral = exports.lit = exports.TName = exports.name = exports.TType = void 0;
var util_1 = require("./util");
/** Node that represents a type. */
var TType = /** @class */ (function () {
function TType() {
}
return TType;
}());
exports.TType = TType;
/** Parses a type spec into a TType node. */
function parseSpec(typeSpec) {
return typeof typeSpec === "string" ? name(typeSpec) : typeSpec;
}
function getNamedType(suite, name) {
var ttype = suite[name];
if (!ttype) {
throw new Error("Unknown type " + name);
}
return ttype;
}
/**
* Defines a type name, either built-in, or defined in this suite. It can typically be included in
* the specs as just a plain string.
*/
function name(value) { return new TName(value); }
exports.name = name;
var TName = /** @class */ (function (_super) {
__extends(TName, _super);
function TName(name) {
var _this = _super.call(this) || this;
_this.name = name;
_this._failMsg = "is not a " + name;
return _this;
}
TName.prototype.getChecker = function (suite, strict, allowedProps) {
var _this = this;
var ttype = getNamedType(suite, this.name);
var checker = ttype.getChecker(suite, strict, allowedProps);
if (ttype instanceof BasicType || ttype instanceof TName) {
return checker;
}
// For complex types, add an additional "is not a <Type>" message on failure.
return function (value, ctx) { return checker(value, ctx) ? true : ctx.fail(null, _this._failMsg, 0); };
};
return TName;
}(TType));
exports.TName = TName;
/**
* Defines a literal value, e.g. lit('hello') or lit(123).
*/
function lit(value) { return new TLiteral(value); }
exports.lit = lit;
var TLiteral = /** @class */ (function (_super) {
__extends(TLiteral, _super);
function TLiteral(value) {
var _this = _super.call(this) || this;
_this.value = value;
_this.name = JSON.stringify(value);
_this._failMsg = "is not " + _this.name;
return _this;
}
TLiteral.prototype.getChecker = function (suite, strict) {
var _this = this;
return function (value, ctx) { return (value === _this.value) ? true : ctx.fail(null, _this._failMsg, -1); };
};
return TLiteral;
}(TType));
exports.TLiteral = TLiteral;
/**
* Defines an array type, e.g. array('number').
*/
function array(typeSpec) { return new TArray(parseSpec(typeSpec)); }
exports.array = array;
var TArray = /** @class */ (function (_super) {
__extends(TArray, _super);
function TArray(ttype) {
var _this = _super.call(this) || this;
_this.ttype = ttype;
return _this;
}
TArray.prototype.getChecker = function (suite, strict) {
var itemChecker = this.ttype.getChecker(suite, strict);
return function (value, ctx) {
if (!Array.isArray(value)) {
return ctx.fail(null, "is not an array", 0);
}
for (var i = 0; i < value.length; i++) {
var ok = itemChecker(value[i], ctx);
if (!ok) {
return ctx.fail(i, null, 1);
}
}
return true;
};
};
return TArray;
}(TType));
exports.TArray = TArray;
/**
* Defines a tuple type, e.g. tuple('string', 'number').
*/
function tuple() {
var typeSpec = [];
for (var _i = 0; _i < arguments.length; _i++) {
typeSpec[_i] = arguments[_i];
}
return new TTuple(typeSpec.map(function (t) { return parseSpec(t); }));
}
exports.tuple = tuple;
var TTuple = /** @class */ (function (_super) {
__extends(TTuple, _super);
function TTuple(ttypes) {
var _this = _super.call(this) || this;
_this.ttypes = ttypes;
return _this;
}
TTuple.prototype.getChecker = function (suite, strict) {
var itemCheckers = this.ttypes.map(function (t) { return t.getChecker(suite, strict); });
var checker = function (value, ctx) {
if (!Array.isArray(value)) {
return ctx.fail(null, "is not an array", 0);
}
for (var i = 0; i < itemCheckers.length; i++) {
var ok = itemCheckers[i](value[i], ctx);
if (!ok) {
return ctx.fail(i, null, 1);
}
}
return true;
};
if (!strict) {
return checker;
}
return function (value, ctx) {
if (!checker(value, ctx)) {
return false;
}
return value.length <= itemCheckers.length ? true :
ctx.fail(itemCheckers.length, "is extraneous", 2);
};
};
return TTuple;
}(TType));
exports.TTuple = TTuple;
/**
* Defines a union type, e.g. union('number', 'null').
*/
function union() {
var typeSpec = [];
for (var _i = 0; _i < arguments.length; _i++) {
typeSpec[_i] = arguments[_i];
}
return new TUnion(typeSpec.map(function (t) { return parseSpec(t); }));
}
exports.union = union;
var TUnion = /** @class */ (function (_super) {
__extends(TUnion, _super);
function TUnion(ttypes) {
var _this = _super.call(this) || this;
_this.ttypes = ttypes;
var names = ttypes.map(function (t) { return t instanceof TName || t instanceof TLiteral ? t.name : null; })
.filter(function (n) { return n; });
var otherTypes = ttypes.length - names.length;
if (names.length) {
if (otherTypes > 0) {
names.push(otherTypes + " more");
}
_this._failMsg = "is none of " + names.join(", ");
}
else {
_this._failMsg = "is none of " + otherTypes + " types";
}
return _this;
}
TUnion.prototype.getChecker = function (suite, strict) {
var _this = this;
var itemCheckers = this.ttypes.map(function (t) { return t.getChecker(suite, strict); });
return function (value, ctx) {
var ur = ctx.unionResolver();
for (var i = 0; i < itemCheckers.length; i++) {
var ok = itemCheckers[i](value, ur.createContext());
if (ok) {
return true;
}
}
ctx.resolveUnion(ur);
return ctx.fail(null, _this._failMsg, 0);
};
};
return TUnion;
}(TType));
exports.TUnion = TUnion;
/**
* Defines an intersection type, e.g. intersection('number', 'null').
*/
function intersection() {
var typeSpec = [];
for (var _i = 0; _i < arguments.length; _i++) {
typeSpec[_i] = arguments[_i];
}
return new TIntersection(typeSpec.map(function (t) { return parseSpec(t); }));
}
exports.intersection = intersection;
var TIntersection = /** @class */ (function (_super) {
__extends(TIntersection, _super);
function TIntersection(ttypes) {
var _this = _super.call(this) || this;
_this.ttypes = ttypes;
return _this;
}
TIntersection.prototype.getChecker = function (suite, strict) {
var allowedProps = new Set();
var itemCheckers = this.ttypes.map(function (t) { return t.getChecker(suite, strict, allowedProps); });
return function (value, ctx) {
var ok = itemCheckers.every(function (checker) { return checker(value, ctx); });
if (ok) {
return true;
}
return ctx.fail(null, null, 0);
};
};
return TIntersection;
}(TType));
exports.TIntersection = TIntersection;
/**
* Defines an enum type, e.g. enum({'A': 1, 'B': 2}).
*/
function enumtype(values) {
return new TEnumType(values);
}
exports.enumtype = enumtype;
var TEnumType = /** @class */ (function (_super) {
__extends(TEnumType, _super);
function TEnumType(members) {
var _this = _super.call(this) || this;
_this.members = members;
_this.validValues = new Set();
_this._failMsg = "is not a valid enum value";
_this.validValues = new Set(Object.keys(members).map(function (name) { return members[name]; }));
return _this;
}
TEnumType.prototype.getChecker = function (suite, strict) {
var _this = this;
return function (value, ctx) {
return (_this.validValues.has(value) ? true : ctx.fail(null, _this._failMsg, 0));
};
};
return TEnumType;
}(TType));
exports.TEnumType = TEnumType;
/**
* Defines a literal enum value, such as Direction.Up, specified as enumlit("Direction", "Up").
*/
function enumlit(name, prop) {
return new TEnumLiteral(name, prop);
}
exports.enumlit = enumlit;
var TEnumLiteral = /** @class */ (function (_super) {
__extends(TEnumLiteral, _super);
function TEnumLiteral(enumName, prop) {
var _this = _super.call(this) || this;
_this.enumName = enumName;
_this.prop = prop;
_this._failMsg = "is not " + enumName + "." + prop;
return _this;
}
TEnumLiteral.prototype.getChecker = function (suite, strict) {
var _this = this;
var ttype = getNamedType(suite, this.enumName);
if (!(ttype instanceof TEnumType)) {
throw new Error("Type " + this.enumName + " used in enumlit is not an enum type");
}
var val = ttype.members[this.prop];
if (!ttype.members.hasOwnProperty(this.prop)) {
throw new Error("Unknown value " + this.enumName + "." + this.prop + " used in enumlit");
}
return function (value, ctx) { return (value === val) ? true : ctx.fail(null, _this._failMsg, -1); };
};
return TEnumLiteral;
}(TType));
exports.TEnumLiteral = TEnumLiteral;
function makeIfaceProps(props) {
return Object.keys(props).map(function (name) { return makeIfaceProp(name, props[name]); });
}
function makeIfaceProp(name, prop) {
return prop instanceof TOptional ?
new TProp(name, prop.ttype, true) :
new TProp(name, parseSpec(prop), false);
}
/**
* Defines an interface. The first argument is an array of interfaces that it extends, and the
* second is an array of properties.
*/
function iface(bases, props) {
return new TIface(bases, makeIfaceProps(props));
}
exports.iface = iface;
var TIface = /** @class */ (function (_super) {
__extends(TIface, _super);
function TIface(bases, props) {
var _this = _super.call(this) || this;
_this.bases = bases;
_this.props = props;
_this.propSet = new Set(props.map(function (p) { return p.name; }));
return _this;
}
TIface.prototype.getChecker = function (suite, strict, allowedProps) {
var _this = this;
var baseCheckers = this.bases.map(function (b) { return getNamedType(suite, b).getChecker(suite, strict); });
var propCheckers = this.props.map(function (prop) { return prop.ttype.getChecker(suite, strict); });
var testCtx = new util_1.NoopContext();
// Consider a prop required if it's not optional AND does not allow for undefined as a value.
var isPropRequired = this.props.map(function (prop, i) {
return !prop.isOpt && !propCheckers[i](undefined, testCtx);
});
var checker = function (value, ctx) {
if (typeof value !== "object" || value === null) {
return ctx.fail(null, "is not an object", 0);
}
for (var i = 0; i < baseCheckers.length; i++) {
if (!baseCheckers[i](value, ctx)) {
return false;
}
}
for (var i = 0; i < propCheckers.length; i++) {
var name_1 = _this.props[i].name;
var v = value[name_1];
if (v === undefined) {
if (isPropRequired[i]) {
return ctx.fail(name_1, "is missing", 1);
}
}
else {
var ok = propCheckers[i](v, ctx);
if (!ok) {
return ctx.fail(name_1, null, 1);
}
}
}
return true;
};
if (!strict) {
return checker;
}
var propSet = this.propSet;
if (allowedProps) {
this.propSet.forEach(function (prop) { return allowedProps.add(prop); });
propSet = allowedProps;
}
// In strict mode, check also for unknown enumerable properties.
return function (value, ctx) {
if (!checker(value, ctx)) {
return false;
}
for (var prop in value) {
if (!propSet.has(prop)) {
return ctx.fail(prop, "is extraneous", 2);
}
}
return true;
};
};
return TIface;
}(TType));
exports.TIface = TIface;
/**
* Defines an optional property on an interface.
*/
function opt(typeSpec) { return new TOptional(parseSpec(typeSpec)); }
exports.opt = opt;
var TOptional = /** @class */ (function (_super) {
__extends(TOptional, _super);
function TOptional(ttype) {
var _this = _super.call(this) || this;
_this.ttype = ttype;
return _this;
}
TOptional.prototype.getChecker = function (suite, strict) {
var itemChecker = this.ttype.getChecker(suite, strict);
return function (value, ctx) {
return value === undefined || itemChecker(value, ctx);
};
};
return TOptional;
}(TType));
exports.TOptional = TOptional;
/**
* Defines a property in an interface.
*/
var TProp = /** @class */ (function () {
function TProp(name, ttype, isOpt) {
this.name = name;
this.ttype = ttype;
this.isOpt = isOpt;
}
return TProp;
}());
exports.TProp = TProp;
/**
* Defines a function. The first argument declares the function's return type, the rest declare
* its parameters.
*/
function func(resultSpec) {
var params = [];
for (var _i = 1; _i < arguments.length; _i++) {
params[_i - 1] = arguments[_i];
}
return new TFunc(new TParamList(params), parseSpec(resultSpec));
}
exports.func = func;
var TFunc = /** @class */ (function (_super) {
__extends(TFunc, _super);
function TFunc(paramList, result) {
var _this = _super.call(this) || this;
_this.paramList = paramList;
_this.result = result;
return _this;
}
TFunc.prototype.getChecker = function (suite, strict) {
return function (value, ctx) {
return typeof value === "function" ? true : ctx.fail(null, "is not a function", 0);
};
};
return TFunc;
}(TType));
exports.TFunc = TFunc;
/**
* Defines a function parameter.
*/
function param(name, typeSpec, isOpt) {
return new TParam(name, parseSpec(typeSpec), Boolean(isOpt));
}
exports.param = param;
var TParam = /** @class */ (function () {
function TParam(name, ttype, isOpt) {
this.name = name;
this.ttype = ttype;
this.isOpt = isOpt;
}
return TParam;
}());
exports.TParam = TParam;
/**
* Defines a function parameter list.
*/
var TParamList = /** @class */ (function (_super) {
__extends(TParamList, _super);
function TParamList(params) {
var _this = _super.call(this) || this;
_this.params = params;
return _this;
}
TParamList.prototype.getChecker = function (suite, strict) {
var _this = this;
var itemCheckers = this.params.map(function (t) { return t.ttype.getChecker(suite, strict); });
var testCtx = new util_1.NoopContext();
var isParamRequired = this.params.map(function (param, i) {
return !param.isOpt && !itemCheckers[i](undefined, testCtx);
});
var checker = function (value, ctx) {
if (!Array.isArray(value)) {
return ctx.fail(null, "is not an array", 0);
}
for (var i = 0; i < itemCheckers.length; i++) {
var p = _this.params[i];
if (value[i] === undefined) {
if (isParamRequired[i]) {
return ctx.fail(p.name, "is missing", 1);
}
}
else {
var ok = itemCheckers[i](value[i], ctx);
if (!ok) {
return ctx.fail(p.name, null, 1);
}
}
}
return true;
};
if (!strict) {
return checker;
}
return function (value, ctx) {
if (!checker(value, ctx)) {
return false;
}
return value.length <= itemCheckers.length ? true :
ctx.fail(itemCheckers.length, "is extraneous", 2);
};
};
return TParamList;
}(TType));
exports.TParamList = TParamList;
/**
* Single TType implementation for all basic built-in types.
*/
var BasicType = /** @class */ (function (_super) {
__extends(BasicType, _super);
function BasicType(validator, message) {
var _this = _super.call(this) || this;
_this.validator = validator;
_this.message = message;
return _this;
}
BasicType.prototype.getChecker = function (suite, strict) {
var _this = this;
return function (value, ctx) { return _this.validator(value) ? true : ctx.fail(null, _this.message, 0); };
};
return BasicType;
}(TType));
exports.BasicType = BasicType;
/**
* Defines the suite of basic types.
*/
exports.basicTypes = {
any: new BasicType(function (v) { return true; }, "is invalid"),
number: new BasicType(function (v) { return (typeof v === "number"); }, "is not a number"),
object: new BasicType(function (v) { return (typeof v === "object" && v); }, "is not an object"),
boolean: new BasicType(function (v) { return (typeof v === "boolean"); }, "is not a boolean"),
string: new BasicType(function (v) { return (typeof v === "string"); }, "is not a string"),
symbol: new BasicType(function (v) { return (typeof v === "symbol"); }, "is not a symbol"),
void: new BasicType(function (v) { return (v == null); }, "is not void"),
undefined: new BasicType(function (v) { return (v === undefined); }, "is not undefined"),
null: new BasicType(function (v) { return (v === null); }, "is not null"),
never: new BasicType(function (v) { return false; }, "is unexpected"),
Date: new BasicType(getIsNativeChecker("[object Date]"), "is not a Date"),
RegExp: new BasicType(getIsNativeChecker("[object RegExp]"), "is not a RegExp"),
};
// This approach for checking native object types mirrors that of lodash. Its advantage over
// `isinstance` is that it can still return true for native objects created in different JS
// execution environments.
var nativeToString = Object.prototype.toString;
function getIsNativeChecker(tag) {
return function (v) { return typeof v === "object" && v && nativeToString.call(v) === tag; };
}
if (typeof Buffer !== "undefined") {
exports.basicTypes.Buffer = new BasicType(function (v) { return Buffer.isBuffer(v); }, "is not a Buffer");
}
var _loop_1 = function (array_1) {
exports.basicTypes[array_1.name] = new BasicType(function (v) { return (v instanceof array_1); }, "is not a " + array_1.name);
};
// Support typed arrays of various flavors
for (var _i = 0, _a = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array,
Int32Array, Uint32Array, Float32Array, Float64Array, ArrayBuffer]; _i < _a.length; _i++) {
var array_1 = _a[_i];
_loop_1(array_1);
}
@@ -0,0 +1,77 @@
{
"name": "espree",
"description": "An Esprima-compatible JavaScript parser built on Acorn",
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
"homepage": "https://github.com/eslint/js/blob/main/packages/espree/README.md",
"main": "dist/espree.cjs",
"type": "module",
"exports": {
".": [
{
"import": "./espree.js",
"require": "./dist/espree.cjs",
"default": "./dist/espree.cjs"
},
"./dist/espree.cjs"
],
"./package.json": "./package.json"
},
"version": "10.4.0",
"files": [
"lib",
"dist/espree.cjs",
"espree.js"
],
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"repository": {
"type": "git",
"url": "https://github.com/eslint/js.git",
"directory": "packages/espree"
},
"bugs": {
"url": "https://github.com/eslint/js/issues"
},
"funding": "https://opencollective.com/eslint",
"license": "BSD-2-Clause",
"dependencies": {
"acorn": "^8.15.0",
"acorn-jsx": "^5.3.2",
"eslint-visitor-keys": "^4.2.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"eslint-release": "^3.2.0",
"esprima-fb": "^8001.2001.0-dev-harmony-fb",
"npm-run-all2": "^6.2.2",
"rollup": "^2.79.1",
"shelljs": "^0.8.5"
},
"keywords": [
"ast",
"ecmascript",
"javascript",
"parser",
"syntax",
"acorn"
],
"scripts": {
"build": "rollup -c rollup.config.js",
"build:debug": "npm run build -- -m",
"build:docs": "node tools/sync-docs.js",
"build:update-version": "node tools/update-version.js",
"prepublishOnly": "npm run build:update-version && npm run build",
"pretest": "npm run build",
"release:generate:latest": "eslint-generate-release",
"release:generate:alpha": "eslint-generate-prerelease alpha",
"release:generate:beta": "eslint-generate-prerelease beta",
"release:generate:rc": "eslint-generate-prerelease rc",
"release:publish": "eslint-publish-release",
"test": "npm-run-all -s test:*",
"test:cjs": "mocha --color --reporter progress --timeout 30000 tests/lib/commonjs.cjs",
"test:esm": "c8 mocha --color --reporter progress --timeout 30000 tests/lib/**/*.js"
}
}
@@ -0,0 +1,923 @@
flf2a$ 9 6 15 1 4
pawp.flf by Curtis Wanner (cwanner@acs.bu.edu)
(my first figlet font. It is based on puffy.flf by Juan Car)
lastest revision - sometime in 1994
$$$@
$$$@
$$$@
$$$@
$$$@
$$$@
$$$@
$$$@
$$$@@
_ @
(_)@
(_)@
(_)@
(_)@
_ @
(_)@
@
@@
$ $@
$ _ _ $@
$(_) (_)$@
$(_) (_)$@
$ $@
$ $@
$ $@
$ $@
$ $@@
@
_ _ @
__(_)_(_)__ @
(___________)@
__(_)_(_)__ @
(___________)@
(_) (_) @
@
@@
_ @
_( ) @
(_)(_) @
(_)_ (_)@
_(_) _ @
( ) ( )@
(_)(_) @
(_) @
@@
@
_ _ @
(_) _(_)@
_(_) @
_(_) @
_(_) _ @
(_) (_)@
@
@@
@
_____ @
(_____) @
(_)_(_) _ @
(____)(_)@
( _)__(_) @
(____)(_)@
@
@@
$ $@
$_$@
( )@
()$@
$ $@
$ $@
$ $@
$ $@
$ $@@
@
__ @
(__)@
(__) @
(_) @
(__) @
(__)@
@
@@
@
__ @
(__) @
(__)@
(_)@
(__)@
(__) @
@
@@
@
_ _ @
(_)_ _(_) @
__(_)_(_)__ @
(___________)@
_(_) (_)_ @
(_) (_) @
@
@@
@
@
_ @
__(_)__ @
(_______)@
(_) @
@
@
@@
$ $@
$ $@
$ $@
$ $@
$ $@
$_$@
( )@
()$@
$ $@@
@
@
@
______ @
(______)@
@
@
@
@@
$ $@
$ $@
$ $@
$ $@
$ $@
$_$@
(_)@
$ $@
$ $@@
@
_ @
_(_)@
_(_) @
_(_) @
_(_) @
(_) @
@
@@
@
____ @
(____) @
(_) (_)@
(_) (_)@
(_)__(_)@
(____) @
@
@@
@
___ @
(___)@
(_)(_)@
(_)@
(_)@
(_)@
@
@@
@
____ @
_(____) @
(_) _(_) @
_(_) @
(_)___ @
(______) @
@
@@
@
____ @
(____) @
(_) _(_)@
_ (__) @
(_)__(_)@
(____) @
@
@@
@
_ _ @
(_) (_) @
(_)__(_)_ @
(________)@
(_) @
(_) @
@
@@
@
_____ @
(_____) @
(_)___ @
(_____) @
____(_)@
(_____) @
@
@@
@
_____ @
(_____) @
(_)___ @
(_____)_ @
(_)___(_)@
(_____) @
@
@@
@
_______ @
(_______)@
_(_) @
_(_) @
(_) @
(_) @
@
@@
@
_____ @
(_____) @
(_)___(_)@
(_____) @
(_)___(_)@
(_____) @
@
@@
@
_____ @
(_____) @
(_)___(_)@
(_____) @
(_) @
(_) @
@
@@
$ $@
$ $@
$ $@
$_$@
(_)@
$_$@
(_)@
$ $@
$ $@@
$ $@
$ $@
$ $@
$_$@
(_)@
$_$@
( )@
()$@
$ $@@
@
_ @
_(_)@
_(_) @
(_)_ @
(_)_ @
(_)@
@
@@
@
@
_______ @
(_______)@
_______ @
(_______)@
@
@
@@
@
_ @
(_)_ @
(_)_ @
_(_)@
_(_) @
(_) @
@
@@
__ @
_(__)_ @
(_) (_)@
(_) @
(_) @
_ @
(_) @
@
@@
@
__ @
_(__)_ @
(_) _(_) @
(_) (___) @
(_)____ @
(____) @
@
@@
@
_____ @
(_____) @
(_)___(_)@
(_______)@
(_) (_)@
(_) (_)@
@
@@
@
_____ @
(_____) @
(_)__(_)@
(_____) @
(_)__(_)@
(_____) @
@
@@
@
___ @
_(___)_ @
(_) (_)@
(_) _ @
(_)___(_)@
(___) @
@
@@
@
_____ @
(_____) @
(_) (_)@
(_) (_)@
(_)__(_)@
(_____) @
@
@@
@
______ @
(______)@
(_)__ @
(____) @
(_)____ @
(______)@
@
@@
@
______ @
(______)@
(_)__ @
(____) @
(_) @
(_) @
@
@@
@
_____ @
(_____) @
(_) ___ @
(_) (___)@
(_)___(_)@
(_____) @
@
@@
@
_ _ @
(_) (_)@
(_)___(_)@
(_______)@
(_) (_)@
(_) (_)@
@
@@
@
_______ @
(_______)@
(_) @
(_) @
__(_)__ @
(_______)@
@
@@
@
______ @
(______) @
(_) @
_ (_) @
( )__(_) @
(____) @
@
@@
@
_ _ @
(_) (_) @
(_)_(_) @
(____) @
(_) (_) @
(_) (_) @
@
@@
@
_ @
(_) @
(_) @
(_) @
(_)____ @
(______) @
@
@@
@
__ __ @
(__)_(__) @
(_) (_) (_)@
(_) (_) (_)@
(_) (_)@
(_) (_)@
@
@@
@
_ _ @
(_) (_)@
(__)_ (_)@
(_)(_)(_)@
(_) (__)@
(_) (_)@
@
@@
@
_____ @
(_____) @
(_) (_) @
(_) (_) @
(_)___(_) @
(_____) @
@
@@
@
_____ @
(_____) @
(_)__(_) @
(_____) @
(_) @
(_) @
@
@@
@
_____ @
(_____) @
(_) (_) @
(_) (_) @
(_)___(_) @
(___(__) @
(_)@
@@
@
_____ @
(_____) @
(_)__(_)@
(_____) @
( ) ( ) @
(_) (_)@
@
@@
@
_____ @
(_____) @
(_)___ @
(___)_ @
____(_)@
(_____) @
@
@@
@
_______ @
(__ _ __)@
(_) @
(_) @
(_) @
(_) @
@
@@
@
_ _ @
(_) (_)@
(_) (_)@
(_) (_)@
(_)___(_)@
(_____) @
@
@@
@
_ _ @
(_) (_)@
(_) (_)@
(_) (_)@
(_)_(_) @
(___) @
@
@@
@
_ _ @
(_) _ (_)@
(_) (_) (_)@
(_) (_) (_)@
(_)_(_)_(_)@
(__) (__) @
@
@@
@
_ _ @
( ) ( )@
(_)_(_) @
(___) @
(_) (_) @
(_) (_)@
@
@@
@
_ _ @
(_) (_)@
(_)_(_) @
(_) @
(_) @
(_) @
@
@@
@
_______ @
(_______)@
_(_) @
_(_) @
(_)____ @
(_______)@
@
@@
@
___ @
(___)@
(_) @
(_) @
(_)_ @
(___)@
@
@@
@
_ @
(_)_ @
(_)_ @
(_)_ @
(_)_ @
(_) @
@
@@
@
___ @
(___)@
(_)@
(_)@
_(_)@
(___)@
@
@@
$ _ $@
$ (_) $@
$(___)$@
(_) (_)@
$ $@
$ $@
$ $@
$ $@
$ $@@
$ $ @
$ $ @
$ $ @
$ $ @
$ $ @
$ $ @
$ $ @
_______ @
(_______)@@
$ $@
$_$@
( )@
$()@
$ $@
$ $@
$ $@
$ $@
$ $@@
@
@
@
____ @
(____)@
( )_( )@
(__)_)@
@
@@
@
_ @
(_) @
(_)_ @
(___)_ @
(_)_(_)@
(____) @
@
@@
@
@
@
___ @
_(___)@
(_)___ @
(____)@
@
@@
@
_ @
(_)@
__(_)@
(____)@
(_)_(_)@
(____)@
@
@@
@
@
____ @
(____)@
(_)_(_)@
(__)__ @
(____)@
@
@@
@
____ @
(____)@
(_)__ @
(____) @
(_) @
(_) @
@
@@
@
@
@
____ @
(____)@
( )_(_)@
(____)@
(_)_(_)@
(___) @@
@
_ @
(_) @
(_)__ @
(____) @
(_) (_)@
(_) (_)@
@
@@
@
_ @
(_)@
_ @
(_)@
(_)@
(_)@
@
@@
@
@
_ @
(_)@
_ @
(_)@
_ (_)@
( )_(_)@
(___) @@
@
_ @
(_) _ @
(_)(_) @
(___) @
(_)(_) @
(_) (_)@
@
@@
@
__ @
(__) @
(_) @
(_) @
(_) @
(___)@
@
@@
@
@
@
__ __ @
(__)_(__) @
(_) (_) (_)@
(_) (_) (_)@
@
@@
@
@
_ @
(_)__ @
(____) @
(_) (_)@
(_) (_)@
@
@@
@
@
@
___ @
(___) @
(_)_(_)@
(___) @
@
@@
@
@
@
____ @
(____) @
(_)_(_)@
(____) @
(_) @
(_) @@
@
@
@
____ @
(____)@
( )_(_)@
(____)@
(_)@
(_)@@
@
@
_ @
(_)__ @
(____)@
(_) @
(_) @
@
@@
@
@
____ @
(____)@
(_)__ @
_(__)@
(____)@
@
@@
@
_ @
(_)_ @
(___)@
(_) @
(_)_ @
(__)@
@
@@
@
@
@
_ _ @
(_) (_)@
(_)_(_)@
(___) @
@
@@
@
@
@
_ _ @
(_) (_)@
(_)_(_)@
(_) @
@
@@
@
@
@
_ _ _ @
(_) ( ) (_)@
(_)_(_)_(_)@
(__) (__) @
@
@@
@
@
@
_ _ @
(_)_(_) @
(_) @
(_) (_) @
@
@@
@
@
@
_ _ @
(_) (_)@
(_)_(_)@
(____)@
__(_)@
(___) @@
@
@
_____ @
(_____)@
_(_) @
(_)__ @
(_____)@
@
@@
@
__ @
(__)@
_(_) @
(__) @
(_) @
(__)@
@
@@
_ @
(_)@
(_)@
(_)@
_ @
(_)@
(_)@
(_)@
@@
@
__ @
(__) @
(_)_ @
(__)@
_(_) @
(__) @
@
@@
@
__ _ @
( _)_(_)@
(_) (__) @
@
@
@
@
@@
_ _ @
(_)_(_)@
(_____)@
(_)_(_)@
(_____)@
(_) (_)@
(_) (_)@
@
@@
_ _ @
(_)_(_)@
(_____)@
(_) (_)@
(_) (_)@
(_)_(_)@
(_____)@
@
@@
_ _ @
(_) (_)@
_ _ @
(_) (_)@
(_) (_)@
(_)_(_)@
(_____)@
@
@@
@
_ _ @
(_) (_)@
____ @
(____)@
(_)_(_)@
(__(_)@
@
@@
@
_ _ @
(_) (_)@
___ @
(___) @
(_)_(_)@
(___) @
@
@@
@
_ _ @
(_) (_)@
_ _ @
(_) (_)@
(_)_(_)@
(___) @
@
@@
@
@
@
_____ @
(_____)@
(_)(_) @
(_)(__)@
(_)(_) @
(_) @@
@@ -0,0 +1 @@
{"version":3,"file":"library-square.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,87 @@
//#region src/middleware/trailing-slash/index.ts
/**
* Trailing Slash Middleware for Hono.
*
* @see {@link https://hono.dev/docs/middleware/builtin/trailing-slash}
*
* @param {TrimTrailingSlashOptions} options - The options for the middleware.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* const app = new Hono()
*
* app.use(trimTrailingSlash())
* app.get('/about/me/', (c) => c.text('With Trailing Slash'))
* ```
*
* @example
* ```ts
* // With alwaysRedirect option for wildcard routes
* const app = new Hono()
*
* app.use(trimTrailingSlash({ alwaysRedirect: true }))
* app.get('/my-path/*', (c) => c.text('Wildcard route'))
* ```
*/
const trimTrailingSlash = (options) => {
return async function trimTrailingSlash(c, next) {
if (options?.alwaysRedirect) {
if ((c.req.method === "GET" || c.req.method === "HEAD") && c.req.path !== "/" && c.req.path.at(-1) === "/") {
const url = new URL(c.req.url);
url.pathname = url.pathname.substring(0, url.pathname.length - 1);
return c.redirect(url.toString(), 301);
}
}
await next();
if (!options?.alwaysRedirect && c.res.status === 404 && (c.req.method === "GET" || c.req.method === "HEAD") && c.req.path !== "/" && c.req.path.at(-1) === "/") {
const url = new URL(c.req.url);
url.pathname = url.pathname.substring(0, url.pathname.length - 1);
c.res = c.redirect(url.toString(), 301);
}
};
};
/**
* Append trailing slash middleware for Hono.
* Append a trailing slash to the URL if it doesn't have one. For example, `/path/to/page` will be redirected to `/path/to/page/`.
*
* @see {@link https://hono.dev/docs/middleware/builtin/trailing-slash}
*
* @param {AppendTrailingSlashOptions} options - The options for the middleware.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* const app = new Hono()
*
* app.use(appendTrailingSlash())
* ```
*
* @example
* ```ts
* // With alwaysRedirect option for wildcard routes
* const app = new Hono()
*
* app.use(appendTrailingSlash({ alwaysRedirect: true }))
* app.get('/my-path/*', (c) => c.text('Wildcard route'))
* ```
*/
const appendTrailingSlash = (options) => {
return async function appendTrailingSlash(c, next) {
if (options?.alwaysRedirect) {
if ((c.req.method === "GET" || c.req.method === "HEAD") && c.req.path.at(-1) !== "/" && !options.skip?.(c.req.path)) {
const url = new URL(c.req.url);
url.pathname += "/";
return c.redirect(url.toString(), 301);
}
}
await next();
if (!options?.alwaysRedirect && c.res.status === 404 && (c.req.method === "GET" || c.req.method === "HEAD") && c.req.path.at(-1) !== "/" && !options?.skip?.(c.req.path)) {
const url = new URL(c.req.url);
url.pathname += "/";
c.res = c.redirect(url.toString(), 301);
}
};
};
//#endregion
export { appendTrailingSlash, trimTrailingSlash };
@@ -0,0 +1 @@
module.exports={C:{"50":0.00411,"56":0.00206,"57":0.00411,"59":0.00206,"60":0.00617,"62":0.00411,"63":0.00617,"66":0.00411,"68":0.00206,"72":0.00206,"81":0.00617,"84":0.00617,"97":0.00206,"115":0.00411,"120":0.0699,"121":0.1357,"127":0.00411,"138":0.00617,"140":0.00617,"144":0.01234,"145":0.00617,"147":0.00411,"149":0.00206,"150":0.01439,"151":0.00411,"152":0.00822,"153":0.05346,"154":0.11925,"155":0.34746,"156":0.29812,"157":0.00617,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 51 52 53 54 55 58 61 64 65 67 69 70 71 73 74 75 76 77 78 79 80 82 83 85 86 87 88 89 90 91 92 93 94 95 96 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 122 123 124 125 126 128 129 130 131 132 133 134 135 136 137 139 141 142 143 146 148 158 159 160 3.5 3.6"},D:{"58":0.00206,"60":0.00411,"64":0.00411,"65":0.00206,"68":0.00411,"69":0.01234,"70":0.00411,"71":0.01028,"72":0.00411,"74":0.00822,"76":0.01234,"77":0.02056,"78":0.00411,"79":0.00411,"80":0.00411,"81":0.03495,"86":0.00617,"87":0.00206,"90":0.00822,"91":0.00617,"93":0.00206,"94":0.00206,"95":0.01028,"96":0.00206,"97":0.00206,"98":0.00206,"101":0.05757,"103":0.02673,"104":0.01645,"105":0.02467,"106":0.01439,"107":0.08635,"108":0.03906,"109":0.0699,"110":0.0185,"111":0.04729,"112":0.0185,"113":0.00411,"114":0.0185,"115":0.06374,"116":0.03495,"117":0.01645,"118":0.31868,"119":0.13775,"120":0.19532,"121":0.01234,"122":0.00617,"123":0.00617,"124":0.01439,"125":0.01028,"126":0.01028,"127":0.00617,"128":0.00206,"129":0.00411,"131":0.06168,"132":0.01234,"133":0.05962,"134":0.14392,"135":0.06168,"136":0.08841,"137":0.26934,"138":0.1542,"139":0.0699,"140":0.05757,"141":0.14186,"142":0.17065,"143":0.00822,"144":0.03701,"145":0.02467,"146":0.08841,"147":0.01028,"148":0.06168,"149":0.09869,"150":0.23438,"151":0.73399,"152":3.09428,"153":2.53916,"154":0.50989,"155":0.00822,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 59 61 62 63 66 67 73 75 83 84 85 88 89 92 99 100 102 130 156 157"},F:{"47":0.00206,"48":0.00206,"64":0.00411,"79":0.00206,"100":0.00822,"101":0.00822,"113":0.00411,"118":0.00206,"131":0.00206,"133":0.01028,"134":0.03906,"135":0.70521,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 49 50 51 52 53 54 55 56 57 58 60 62 63 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 102 103 104 105 106 107 108 109 110 111 112 114 115 116 117 119 120 121 122 123 124 125 126 127 132 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"16":0.00411,"17":0.01439,"18":0.06374,"84":0.00617,"89":0.0329,"90":0.03495,"91":0.00206,"92":0.0699,"100":0.01645,"107":0.00411,"109":0.00206,"112":0.00206,"113":0.01645,"114":0.00206,"119":0.0699,"120":0.07607,"122":0.02878,"124":0.00206,"128":0.00617,"131":0.00206,"132":0.00206,"137":0.00206,"138":0.00206,"140":0.02673,"141":0.00411,"142":0.00206,"143":0.00617,"144":0.00822,"145":0.01645,"146":0.00822,"147":0.01439,"148":0.02878,"149":0.02262,"150":0.0514,"151":0.16448,"152":1.07734,"153":1.04239,"154":0.21999,_:"12 13 14 15 79 80 81 83 85 86 87 88 93 94 95 96 97 98 99 101 102 103 104 105 106 108 110 111 115 116 117 118 121 123 125 126 127 129 130 133 134 135 136 139"},E:{"11":0.00206,"27":0.02878,_:"4 5 6 7 8 9 10 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 14.1 15.1 15.2-15.3 15.5 16.0 16.2 16.3 16.4 16.5 17.2 17.4 17.5 18.0 18.1 18.4 18.5-18.7 27.1 TP","11.1":0.00617,"12.1":0.00206,"13.1":0.01028,"15.4":0.00411,"15.6":0.00206,"16.1":0.00822,"16.6":0.00206,"17.0":0.00411,"17.1":0.01028,"17.3":0.00617,"17.6":0.02673,"18.2":0.00206,"18.3":0.00411,"26.0":0.00411,"26.1":0.00411,"26.2":0.00617,"26.3":0.00411,"26.4":0.01028,"26.5":0.04523,"26.6":0.09663,"27.2":0.00411},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00085,"5.0-5.1":0.00085,"6.0-6.1":0,"7.0-7.1":0.0017,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.0085,"11.0-11.2":0.00085,"11.3-11.4":0.0017,"12.0-12.1":0,"12.2-12.5":0.0221,"13.0-13.1":0,"13.2":0.00425,"13.3":0,"13.4-13.7":0.00085,"14.0-14.4":0.0034,"14.5-14.8":0.0051,"15.0-15.1":0.0051,"15.2-15.3":0.0034,"15.4":0.00425,"15.5":0.0051,"15.6-15.8":0.1105,"16.0":0.0085,"16.1":0.0153,"16.2":0.0085,"16.3":0.0187,"16.4":0.00425,"16.5":0.0068,"16.6-16.7":0.15385,"17.0":0.00595,"17.1":0.0085,"17.2":0.0085,"17.3":0.01275,"17.4":0.01785,"17.5":0.03485,"17.6-17.7":0.0901,"18.0":0.0187,"18.1":0.0374,"18.2":0.051,"18.3":0.0884,"18.4":0.05525,"18.5-18.7":1.14156,"26.0":0.05525,"26.1":0.0561,"26.2":0.1462,"26.3":0.1581,"26.4":0.1156,"26.5":0.77436,"26.6":4.77789,"27.0":0.36635,"27.1":0,"27.2":0.00935},P:{"21":0.02679,"22":0.00893,"23":0.05357,"24":0.02679,"25":0.02679,"26":0.05357,"27":0.04464,"28":0.41072,"29":0.23215,"30":2.24113,_:"4 20 6.2-6.4 8.2 10.1 12.0 13.0 14.0 15.0 17.0","5.0-5.4":0.00893,"7.2-7.4":0.03572,"9Line truncated
@@ -0,0 +1,41 @@
// packages/react/compose-refs/src/compose-refs.tsx
import * as React from "react";
function setRef(ref, value) {
if (typeof ref === "function") {
return ref(value);
} else if (ref !== null && ref !== void 0) {
ref.current = value;
}
}
function composeRefs(...refs) {
return (node) => {
let hasCleanup = false;
const cleanups = refs.map((ref) => {
const cleanup = setRef(ref, node);
if (!hasCleanup && typeof cleanup == "function") {
hasCleanup = true;
}
return cleanup;
});
if (hasCleanup) {
return () => {
for (let i = 0; i < cleanups.length; i++) {
const cleanup = cleanups[i];
if (typeof cleanup == "function") {
cleanup();
} else {
setRef(refs[i], null);
}
}
};
}
};
}
function useComposedRefs(...refs) {
return React.useCallback(composeRefs(...refs), refs);
}
export {
composeRefs,
useComposedRefs
};
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,20 @@
/**
* @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 FlipVertical = createLucideIcon("FlipVertical", [
["path", { d: "M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3", key: "14bfxa" }],
["path", { d: "M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3", key: "14rx03" }],
["path", { d: "M4 12H2", key: "rhcxmi" }],
["path", { d: "M10 12H8", key: "s88cx1" }],
["path", { d: "M16 12h-2", key: "10asgb" }],
["path", { d: "M22 12h-2", key: "14jgyd" }]
]);
export { FlipVertical as default };
//# sourceMappingURL=flip-vertical.js.map
@@ -0,0 +1,55 @@
var translationKeys = {
warnings: {
straightRow: 'straightRow',
keyPattern: 'keyPattern',
simpleRepeat: 'simpleRepeat',
extendedRepeat: 'extendedRepeat',
sequences: 'sequences',
recentYears: 'recentYears',
dates: 'dates',
topTen: 'topTen',
topHundred: 'topHundred',
common: 'common',
similarToCommon: 'similarToCommon',
wordByItself: 'wordByItself',
namesByThemselves: 'namesByThemselves',
commonNames: 'commonNames',
userInputs: 'userInputs',
pwned: 'pwned'
},
suggestions: {
l33t: 'l33t',
reverseWords: 'reverseWords',
allUppercase: 'allUppercase',
capitalization: 'capitalization',
dates: 'dates',
recentYears: 'recentYears',
associatedYears: 'associatedYears',
sequences: 'sequences',
repeated: 'repeated',
longerKeyboardPattern: 'longerKeyboardPattern',
anotherWord: 'anotherWord',
useWords: 'useWords',
noNeed: 'noNeed',
pwned: 'pwned'
},
timeEstimation: {
ltSecond: 'ltSecond',
second: 'second',
seconds: 'seconds',
minute: 'minute',
minutes: 'minutes',
hour: 'hour',
hours: 'hours',
day: 'day',
days: 'days',
month: 'month',
months: 'months',
year: 'year',
years: 'years',
centuries: 'centuries'
}
};
export { translationKeys as default };
//# sourceMappingURL=translationKeys.mjs.map
@@ -0,0 +1,126 @@
/**
* @fileoverview Rule to disallow if as the only statement in an else block
* @author Brandon Mills
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"Disallow `if` statements as the only statement in `else` blocks",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/no-lonely-if",
},
schema: [],
fixable: "code",
messages: {
unexpectedLonelyIf:
"Unexpected if as the only statement in an else block.",
},
},
create(context) {
const sourceCode = context.sourceCode;
return {
IfStatement(node) {
const parent = node.parent,
grandparent = parent.parent;
if (
parent &&
parent.type === "BlockStatement" &&
parent.body.length === 1 &&
!astUtils.areBracesNecessary(parent, sourceCode) &&
grandparent &&
grandparent.type === "IfStatement" &&
parent === grandparent.alternate
) {
context.report({
node,
messageId: "unexpectedLonelyIf",
fix(fixer) {
const openingElseCurly =
sourceCode.getFirstToken(parent);
const closingElseCurly =
sourceCode.getLastToken(parent);
const elseKeyword =
sourceCode.getTokenBefore(openingElseCurly);
const tokenAfterElseBlock =
sourceCode.getTokenAfter(closingElseCurly);
const lastIfToken = sourceCode.getLastToken(
node.consequent,
);
const sourceText = sourceCode.getText();
if (
sourceText
.slice(
openingElseCurly.range[1],
node.range[0],
)
.trim() ||
sourceText
.slice(
node.range[1],
closingElseCurly.range[0],
)
.trim()
) {
// Don't fix if there are any non-whitespace characters interfering (e.g. comments)
return null;
}
if (
node.consequent.type !== "BlockStatement" &&
lastIfToken.value !== ";" &&
tokenAfterElseBlock &&
(node.consequent.loc.end.line ===
tokenAfterElseBlock.loc.start.line ||
/^[([/+`-]/u.test(
tokenAfterElseBlock.value,
) ||
lastIfToken.value === "++" ||
lastIfToken.value === "--")
) {
/*
* If the `if` statement has no block, and is not followed by a semicolon, make sure that fixing
* the issue would not change semantics due to ASI. If this would happen, don't do a fix.
*/
return null;
}
return fixer.replaceTextRange(
[
openingElseCurly.range[0],
closingElseCurly.range[1],
],
(elseKeyword.range[1] ===
openingElseCurly.range[0]
? " "
: "") + sourceCode.getText(node),
);
},
});
}
},
};
},
};
@@ -0,0 +1 @@
var D="ui/resourceUri",L="text/html;profile=mcp-app";function j(B,Q,F,V){let q=F._meta,J=q.ui,Z=q[D],$=q;if(J?.resourceUri&&!Z)$={...q,[D]:J.resourceUri};else if(Z&&!J?.resourceUri)$={...q,ui:{...J,resourceUri:Z}};return B.registerTool(Q,{...F,_meta:$},V)}function G(B,Q,F,V,q){return B.registerResource(Q,F,{mimeType:L,...V},q)}var W="io.modelcontextprotocol/ui";function H(B){if(!B)return;return B.extensions?.[W]}export{j as registerAppTool,G as registerAppResource,H as getUiCapability,D as RESOURCE_URI_META_KEY,L as RESOURCE_MIME_TYPE,W as EXTENSION_ID};
@@ -0,0 +1,344 @@
let _tanstack_router_core_isServer = require("@tanstack/router-core/isServer");
//#region src/utils.ts
/**
* Return the last element of an array.
* Intended for non-empty arrays used within router internals.
*/
function last(arr) {
return arr[arr.length - 1];
}
function isFunction(d) {
return typeof d === "function";
}
/**
* Apply a value-or-updater to a previous value.
* Accepts either a literal value or a function of the previous value.
*/
function functionalUpdate(updater, previous) {
if (isFunction(updater)) return updater(previous);
return updater;
}
const hasOwn = Object.prototype.hasOwnProperty;
const isEnumerable = Object.prototype.propertyIsEnumerable;
function hasKeys(obj) {
for (const key in obj) if (hasOwn.call(obj, key)) return true;
return false;
}
const createNull = () => Object.create(null);
const nullReplaceEqualDeep = (prev, next) => replaceEqualDeep(prev, next, createNull);
/**
* This function returns `prev` if `_next` is deeply equal.
* If not, it will replace any deeply equal children of `b` with those of `a`.
* This can be used for structural sharing between immutable JSON values for example.
* Do not use this with signals
*/
function replaceEqualDeep(prev, _next, _makeObj = () => ({}), _depth = 0) {
if (_tanstack_router_core_isServer.isServer) return _next;
if (prev === _next) return prev;
if (_depth > 500) return _next;
const next = _next;
const array = isPlainArray(prev) && isPlainArray(next);
if (!array && !(isPlainObject(prev) && isPlainObject(next))) return next;
const prevItems = array ? prev : getEnumerableOwnKeys(prev);
if (!prevItems) return next;
const nextItems = array ? next : getEnumerableOwnKeys(next);
if (!nextItems) return next;
const prevSize = prevItems.length;
const nextSize = nextItems.length;
const copy = array ? new Array(nextSize) : _makeObj();
let equalItems = 0;
for (let i = 0; i < nextSize; i++) {
const key = array ? i : nextItems[i];
const p = prev[key];
const n = next[key];
if (p === n) {
copy[key] = p;
if (array ? i < prevSize : hasOwn.call(prev, key)) equalItems++;
continue;
}
if (p === null || n === null || typeof p !== "object" || typeof n !== "object") {
copy[key] = n;
continue;
}
const v = replaceEqualDeep(p, n, _makeObj, _depth + 1);
copy[key] = v;
if (v === p) equalItems++;
}
return prevSize === nextSize && equalItems === prevSize ? prev : copy;
}
/**
* Equivalent to `Reflect.ownKeys`, but ensures that objects are "clone-friendly":
* will return false if object has any non-enumerable properties.
*
* Optimized for the common case where objects have no symbol properties.
*/
function getEnumerableOwnKeys(o) {
const names = Object.getOwnPropertyNames(o);
for (const name of names) if (!isEnumerable.call(o, name)) return false;
const symbols = Object.getOwnPropertySymbols(o);
if (symbols.length === 0) return names;
const keys = names;
for (const symbol of symbols) {
if (!isEnumerable.call(o, symbol)) return false;
keys.push(symbol);
}
return keys;
}
function isPlainObject(o) {
if (!hasObjectPrototype(o)) return false;
const ctor = o.constructor;
if (typeof ctor === "undefined") return true;
const prot = ctor.prototype;
if (!hasObjectPrototype(prot)) return false;
if (!prot.hasOwnProperty("isPrototypeOf")) return false;
return true;
}
function hasObjectPrototype(o) {
return Object.prototype.toString.call(o) === "[object Object]";
}
/**
* Check if a value is a "plain" array (no extra enumerable keys).
*/
function isPlainArray(value) {
return Array.isArray(value) && value.length === Object.keys(value).length;
}
/**
* Perform a deep equality check with options for partial comparison and
* ignoring `undefined` values. Optimized for router state comparisons.
*/
function deepEqual(a, b, opts) {
if (a === b) return true;
if (typeof a !== typeof b) return false;
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length) return false;
for (let i = 0, l = a.length; i < l; i++) if (!deepEqual(a[i], b[i], opts)) return false;
return true;
}
if (isPlainObject(a) && isPlainObject(b)) {
const ignoreUndefined = opts?.ignoreUndefined ?? true;
if (opts?.partial) {
for (const k in b) if (!ignoreUndefined || b[k] !== void 0) {
if (!deepEqual(a[k], b[k], opts)) return false;
}
return true;
}
let aCount = 0;
if (!ignoreUndefined) aCount = Object.keys(a).length;
else for (const k in a) if (a[k] !== void 0) aCount++;
let bCount = 0;
for (const k in b) if (!ignoreUndefined || b[k] !== void 0) {
bCount++;
if (bCount > aCount || !deepEqual(a[k], b[k], opts)) return false;
}
return aCount === bCount;
}
return false;
}
/**
* Create a promise with exposed resolve/reject and status fields.
* Useful for coordinating async router lifecycle operations.
*/
function createControlledPromise(onResolve) {
let resolveLoadPromise;
let rejectLoadPromise;
const controlledPromise = new Promise((resolve, reject) => {
resolveLoadPromise = resolve;
rejectLoadPromise = reject;
});
controlledPromise.status = "pending";
controlledPromise.resolve = (value) => {
controlledPromise.status = "resolved";
controlledPromise.value = value;
resolveLoadPromise(value);
onResolve?.(value);
};
controlledPromise.reject = (e) => {
controlledPromise.status = "rejected";
rejectLoadPromise(e);
};
return controlledPromise;
}
/**
* Heuristically detect dynamic import "module not found" errors
* across major browsers for lazy route component handling.
*/
function isModuleNotFoundError(error) {
if (typeof error?.message !== "string") return false;
return error.message.startsWith("Failed to fetch dynamically imported module") || error.message.startsWith("error loading dynamically imported module") || error.message.startsWith("Importing a module script failed");
}
function isPromise(value) {
return Boolean(value && typeof value === "object" && typeof value.then === "function");
}
function findLast(array, predicate) {
for (let i = array.length - 1; i >= 0; i--) {
const item = array[i];
if (predicate(item)) return item;
}
}
/**
* Remove control characters that can cause open redirect vulnerabilities.
* Characters like \r (CR) and \n (LF) can trick URL parsers into interpreting
* paths like "/\r/evil.com" as "http://evil.com".
*/
function sanitizePathSegment(segment) {
return segment.replace(/[\x00-\x1f\x7f]/g, "");
}
function decodeSegment(segment) {
let decoded;
try {
decoded = decodeURI(segment);
} catch {
decoded = segment.replaceAll(/%[0-9A-F]{2}/gi, (match) => {
try {
return decodeURI(match);
} catch {
return match;
}
});
}
return sanitizePathSegment(decoded);
}
/**
* Default list of URL protocols to allow in links, redirects, and navigation.
* Any absolute URL protocol not in this list is treated as dangerous by default.
*/
const DEFAULT_PROTOCOL_ALLOWLIST = [
"http:",
"https:",
"mailto:",
"tel:"
];
/**
* Check if a URL string uses a protocol that is not in the allowlist.
* Returns true for blocked protocols like javascript:, blob:, data:, etc.
*
* The URL constructor correctly normalizes:
* - Mixed case (JavaScript: → javascript:)
* - Whitespace/control characters (java\nscript: → javascript:)
* - Leading whitespace
*
* For relative URLs (no protocol), returns false (safe).
*
* @param url - The URL string to check
* @param allowlist - Set of protocols to allow
* @returns true if the URL uses a protocol that is not allowed
*/
function isDangerousProtocol(url, allowlist) {
if (!url) return false;
try {
const parsed = new URL(url);
return !allowlist.has(parsed.protocol);
} catch {
return false;
}
}
const HTML_ESCAPE_LOOKUP = {
"&": "\\u0026",
">": "\\u003e",
"<": "\\u003c",
"\u2028": "\\u2028",
"\u2029": "\\u2029"
};
const HTML_ESCAPE_REGEX = /[&><\u2028\u2029]/g;
/**
* Escape HTML special characters in a string to prevent XSS attacks
* when embedding strings in script tags during SSR.
*
* This is essential for preventing XSS vulnerabilities when user-controlled
* content is embedded in inline scripts.
*/
function escapeHtml(str) {
return str.replace(HTML_ESCAPE_REGEX, (match) => HTML_ESCAPE_LOOKUP[match]);
}
function decodePath(path) {
if (!path) return {
path,
handledProtocolRelativeURL: false
};
if (!/[%\\\x00-\x1f\x7f]/.test(path) && !path.startsWith("//")) return {
path,
handledProtocolRelativeURL: false
};
const re = /%25|%5C/gi;
let cursor = 0;
let result = "";
let match;
while (null !== (match = re.exec(path))) {
result += decodeSegment(path.slice(cursor, match.index)) + match[0];
cursor = re.lastIndex;
}
result = result + decodeSegment(cursor ? path.slice(cursor) : path);
let handledProtocolRelativeURL = false;
if (result.startsWith("//")) {
handledProtocolRelativeURL = true;
result = "/" + result.replace(/^\/+/, "");
}
return {
path: result,
handledProtocolRelativeURL
};
}
/**
* Encodes a path the same way `new URL()` would, but without the overhead of full URL parsing.
*
* This function encodes:
* - Whitespace characters (spaces → %20, tabs → %09, etc.)
* - Non-ASCII/Unicode characters (emojis, accented characters, etc.)
*
* It preserves:
* - Already percent-encoded sequences (won't double-encode %2F, %25, etc.)
* - ASCII special characters valid in URL paths (@, $, &, +, etc.)
* - Forward slashes as path separators
*
* Used to generate proper href values for SSR without constructing URL objects.
*
* @example
* encodePathLikeUrl('/path/file name.pdf') // '/path/file%20name.pdf'
* encodePathLikeUrl('/path/日本語') // '/path/%E6%97%A5%E6%9C%AC%E8%AA%9E'
* encodePathLikeUrl('/path/already%20encoded') // '/path/already%20encoded' (preserved)
*/
function encodePathLikeUrl(path) {
if (!/\s|[^\u0000-\u007F]/.test(path)) return path;
return path.replace(/\s|[^\u0000-\u007F]/gu, encodeURIComponent);
}
/**
* Builds the dev-mode CSS styles URL for route-scoped CSS collection.
* Used by HeadContent components in all framework implementations to construct
* the URL for the `/@tanstack-start/styles.css` endpoint.
*
* @param basepath - The router's basepath (may or may not have leading slash)
* @param routeIds - Array of matched route IDs to include in the CSS collection
* @returns The full URL path for the dev styles CSS endpoint
*/
function buildDevStylesUrl(basepath, routeIds) {
const trimmedBasepath = basepath.replace(/^\/+|\/+$/g, "");
return `${trimmedBasepath === "" ? "" : `/${trimmedBasepath}`}/@tanstack-start/styles.css?routes=${encodeURIComponent(routeIds.join(","))}`;
}
function arraysEqual(a, b) {
if (a === b) return true;
if (a.length !== b.length) return false;
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
return true;
}
//#endregion
exports.DEFAULT_PROTOCOL_ALLOWLIST = DEFAULT_PROTOCOL_ALLOWLIST;
exports.arraysEqual = arraysEqual;
exports.buildDevStylesUrl = buildDevStylesUrl;
exports.createControlledPromise = createControlledPromise;
exports.decodePath = decodePath;
exports.deepEqual = deepEqual;
exports.encodePathLikeUrl = encodePathLikeUrl;
exports.escapeHtml = escapeHtml;
exports.findLast = findLast;
exports.functionalUpdate = functionalUpdate;
exports.hasKeys = hasKeys;
exports.isDangerousProtocol = isDangerousProtocol;
exports.isModuleNotFoundError = isModuleNotFoundError;
exports.isPlainArray = isPlainArray;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.last = last;
exports.nullReplaceEqualDeep = nullReplaceEqualDeep;
exports.replaceEqualDeep = replaceEqualDeep;
//# sourceMappingURL=utils.cjs.map
@@ -0,0 +1,129 @@
import { type Stats } from 'fs';
import { Minipass } from 'minipass';
import { Header } from './header.js';
import type { TarOptions, TarOptionsWithAliases } from './options.js';
import type { ReadEntry } from './read-entry.js';
import type { EntryTypeName } from './types.js';
import type { WarnData, Warner, WarnEvent } from './warn-method.js';
declare const PROCESS: unique symbol;
declare const FILE: unique symbol;
declare const DIRECTORY: unique symbol;
declare const SYMLINK: unique symbol;
declare const HARDLINK: unique symbol;
declare const HEADER: unique symbol;
declare const READ: unique symbol;
declare const LSTAT: unique symbol;
declare const ONLSTAT: unique symbol;
declare const ONREAD: unique symbol;
declare const ONREADLINK: unique symbol;
declare const OPENFILE: unique symbol;
declare const ONOPENFILE: unique symbol;
declare const CLOSE: unique symbol;
declare const MODE: unique symbol;
declare const AWAITDRAIN: unique symbol;
declare const ONDRAIN: unique symbol;
declare const PREFIX: unique symbol;
export declare class WriteEntry extends Minipass<Buffer, Minipass.ContiguousData, WarnEvent> implements Warner {
#private;
path: string;
portable: boolean;
myuid: number;
myuser: string;
maxReadSize: number;
linkCache: Exclude<TarOptions['linkCache'], undefined>;
statCache: Exclude<TarOptions['statCache'], undefined>;
preservePaths: boolean;
cwd: string;
strict: boolean;
mtime?: Date;
noPax: boolean;
noMtime: boolean;
prefix?: string;
fd?: number;
blockLen: number;
blockRemain: number;
buf?: Buffer;
pos: number;
remain: number;
length: number;
offset: number;
win32: boolean;
absolute: string;
header?: Header;
type?: EntryTypeName | 'Unsupported';
linkpath?: string;
stat?: Stats;
onWriteEntry?: (entry: WriteEntry) => unknown;
constructor(p: string, opt_?: TarOptionsWithAliases);
warn(code: string, message: string | Error, data?: WarnData): void;
emit(ev: keyof WarnEvent, ...data: unknown[]): boolean;
[LSTAT](): void;
[ONLSTAT](stat: Stats): void;
[PROCESS](): void | this;
[MODE](mode: number): number;
[PREFIX](path: string): string;
[HEADER](): void;
[DIRECTORY](): void;
[SYMLINK](): void;
[ONREADLINK](linkpath: string): void;
[HARDLINK](linkpath: string): void;
[FILE](): void | this;
[OPENFILE](): void;
[ONOPENFILE](fd: number): void;
[READ](): void;
[CLOSE](cb?: (er?: null | Error | NodeJS.ErrnoException) => unknown): void;
[ONREAD](bytesRead: number): void;
[AWAITDRAIN](cb: () => unknown): void;
write(buffer: Buffer | string, cb?: () => void): boolean;
write(str: Buffer | string, encoding?: BufferEncoding | null, cb?: () => void): boolean;
[ONDRAIN](): void;
}
export declare class WriteEntrySync extends WriteEntry implements Warner {
sync: true;
[LSTAT](): void;
[SYMLINK](): void;
[OPENFILE](): void;
[READ](): void;
[AWAITDRAIN](cb: () => unknown): void;
[CLOSE](cb?: (er?: null | Error | NodeJS.ErrnoException) => unknown): void;
}
export declare class WriteEntryTar extends Minipass<Buffer, Buffer | string, WarnEvent> implements Warner {
blockLen: number;
blockRemain: number;
buf: number;
pos: number;
remain: number;
length: number;
preservePaths: boolean;
portable: boolean;
strict: boolean;
noPax: boolean;
noMtime: boolean;
readEntry: ReadEntry;
type: EntryTypeName;
prefix?: string;
path: string;
mode?: number;
uid?: number;
gid?: number;
uname?: string;
gname?: string;
header?: Header;
mtime?: Date;
atime?: Date;
ctime?: Date;
linkpath?: string;
size: number;
onWriteEntry?: (entry: WriteEntry) => unknown;
warn(code: string, message: string | Error, data?: WarnData): void;
constructor(readEntry: ReadEntry, opt_?: TarOptionsWithAliases);
[PREFIX](path: string): string;
[MODE](mode: number): number;
write(buffer: Buffer | string, cb?: () => void): boolean;
write(str: Buffer | string, encoding?: BufferEncoding | null, cb?: () => void): boolean;
end(cb?: () => void): this;
end(chunk: Buffer | string, cb?: () => void): this;
end(chunk: Buffer | string, encoding?: BufferEncoding, cb?: () => void): this;
}
export {};
//# sourceMappingURL=write-entry.d.ts.map