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

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

No files matched your search

@@ -0,0 +1,77 @@
/**
* @fileoverview Rule to flag use of function declaration identifiers as variables.
* @author Ian Christian Myers
*/
"use strict";
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "problem",
docs: {
description: "Disallow reassigning `function` declarations",
recommended: true,
url: "https://eslint.org/docs/latest/rules/no-func-assign",
},
schema: [],
messages: {
isAFunction: "'{{name}}' is a function.",
},
},
create(context) {
const sourceCode = context.sourceCode;
/**
* Reports a reference if is non initializer and writable.
* @param {References} references Collection of reference to check.
* @returns {void}
*/
function checkReference(references) {
astUtils.getModifyingReferences(references).forEach(reference => {
context.report({
node: reference.identifier,
messageId: "isAFunction",
data: {
name: reference.identifier.name,
},
});
});
}
/**
* Finds and reports references that are non initializer and writable.
* @param {Variable} variable A variable to check.
* @returns {void}
*/
function checkVariable(variable) {
if (variable.defs[0].type === "FunctionName") {
checkReference(variable.references);
}
}
/**
* Checks parameters of a given function node.
* @param {ASTNode} node A function node to check.
* @returns {void}
*/
function checkForFunction(node) {
sourceCode.getDeclaredVariables(node).forEach(checkVariable);
}
return {
FunctionDeclaration: checkForFunction,
FunctionExpression: checkForFunction,
};
},
};
@@ -0,0 +1,38 @@
import { DevEnvironment } from 'vite';
import { V as Vitest, T as TestProject, a as TestProjectConfiguration } from './reporters.d.DtoKVV2s.js';
/**
* Generate a unique cache identifier.
*
* Return `false` to disable caching of the file.
* @experimental
*/
interface CacheKeyIdGenerator {
(context: CacheKeyIdGeneratorContext): string | undefined | null | false;
}
/**
* @experimental
*/
interface CacheKeyIdGeneratorContext {
environment: DevEnvironment;
id: string;
sourceCode: string;
}
interface VitestPluginContext {
vitest: Vitest;
project: TestProject;
injectTestProjects: (config: TestProjectConfiguration | TestProjectConfiguration[]) => Promise<TestProject[]>;
/**
* Define a generator that will be applied before hashing the cache key.
*
* Use this to make sure Vitest generates correct hash. It is a good idea
* to define this function if your plugin can be registered with different options.
*
* This is called only if `experimental.fsModuleCache` is defined.
* @experimental
*/
experimental_defineCacheKeyGenerator: (callback: CacheKeyIdGenerator) => void;
}
export type { CacheKeyIdGenerator as C, VitestPluginContext as V, CacheKeyIdGeneratorContext as a };
@@ -0,0 +1,228 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
return ReactiveFlags2;
})(ReactiveFlags || {});
// @__NO_SIDE_EFFECTS__
function createReactiveSystem({
update,
notify,
unwatched
}) {
return {
link,
unlink,
propagate,
checkDirty,
shallowPropagate
};
function link(dep, sub, version) {
const prevDep = sub.depsTail;
if (prevDep !== void 0 && prevDep.dep === dep) {
return;
}
const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
if (nextDep !== void 0 && nextDep.dep === dep) {
nextDep.version = version;
sub.depsTail = nextDep;
return;
}
const prevSub = dep.subsTail;
if (prevSub !== void 0 && prevSub.version === version && prevSub.sub === sub) {
return;
}
const newLink = sub.depsTail = dep.subsTail = {
version,
dep,
sub,
prevDep,
nextDep,
prevSub,
nextSub: void 0
};
if (nextDep !== void 0) {
nextDep.prevDep = newLink;
}
if (prevDep !== void 0) {
prevDep.nextDep = newLink;
} else {
sub.deps = newLink;
}
if (prevSub !== void 0) {
prevSub.nextSub = newLink;
} else {
dep.subs = newLink;
}
}
function unlink(link2, sub = link2.sub) {
const dep = link2.dep;
const prevDep = link2.prevDep;
const nextDep = link2.nextDep;
const nextSub = link2.nextSub;
const prevSub = link2.prevSub;
if (nextDep !== void 0) {
nextDep.prevDep = prevDep;
} else {
sub.depsTail = prevDep;
}
if (prevDep !== void 0) {
prevDep.nextDep = nextDep;
} else {
sub.deps = nextDep;
}
if (nextSub !== void 0) {
nextSub.prevSub = prevSub;
} else {
dep.subsTail = prevSub;
}
if (prevSub !== void 0) {
prevSub.nextSub = nextSub;
} else if ((dep.subs = nextSub) === void 0) {
unwatched(dep);
}
return nextDep;
}
function propagate(link2) {
let next = link2.nextSub;
let stack;
top: do {
const sub = link2.sub;
let flags = sub.flags;
if (!(flags & (4 | 8 | 16 | 32))) {
sub.flags = flags | 32;
} else if (!(flags & (4 | 8))) {
flags = 0;
} else if (!(flags & 4)) {
sub.flags = flags & -9 | 32;
} else if (!(flags & (16 | 32)) && isValidLink(link2, sub)) {
sub.flags = flags | (8 | 32);
flags &= 1;
} else {
flags = 0;
}
if (flags & 2) {
notify(sub);
}
if (flags & 1) {
const subSubs = sub.subs;
if (subSubs !== void 0) {
const nextSub = (link2 = subSubs).nextSub;
if (nextSub !== void 0) {
stack = { value: next, prev: stack };
next = nextSub;
}
continue;
}
}
if ((link2 = next) !== void 0) {
next = link2.nextSub;
continue;
}
while (stack !== void 0) {
link2 = stack.value;
stack = stack.prev;
if (link2 !== void 0) {
next = link2.nextSub;
continue top;
}
}
break;
} while (true);
}
function checkDirty(link2, sub) {
let stack;
let checkDepth = 0;
let dirty = false;
top: do {
const dep = link2.dep;
const flags = dep.flags;
if (sub.flags & 16) {
dirty = true;
} else if ((flags & (1 | 16)) === (1 | 16)) {
if (update(dep)) {
const subs = dep.subs;
if (subs.nextSub !== void 0) {
shallowPropagate(subs);
}
dirty = true;
}
} else if ((flags & (1 | 32)) === (1 | 32)) {
if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
stack = { value: link2, prev: stack };
}
link2 = dep.deps;
sub = dep;
++checkDepth;
continue;
}
if (!dirty) {
const nextDep = link2.nextDep;
if (nextDep !== void 0) {
link2 = nextDep;
continue;
}
}
while (checkDepth--) {
const firstSub = sub.subs;
const hasMultipleSubs = firstSub.nextSub !== void 0;
if (hasMultipleSubs) {
link2 = stack.value;
stack = stack.prev;
} else {
link2 = firstSub;
}
if (dirty) {
if (update(sub)) {
if (hasMultipleSubs) {
shallowPropagate(firstSub);
}
sub = link2.sub;
continue;
}
dirty = false;
} else {
sub.flags &= -33;
}
sub = link2.sub;
const nextDep = link2.nextDep;
if (nextDep !== void 0) {
link2 = nextDep;
continue top;
}
}
return dirty;
} while (true);
}
function shallowPropagate(link2) {
do {
const sub = link2.sub;
const flags = sub.flags;
if ((flags & (32 | 16)) === 32) {
sub.flags = flags | 16;
if ((flags & (2 | 4)) === 2) {
notify(sub);
}
}
} while ((link2 = link2.nextSub) !== void 0);
}
function isValidLink(checkLink, sub) {
let link2 = sub.depsTail;
while (link2 !== void 0) {
if (link2 === checkLink) {
return true;
}
link2 = link2.prevDep;
}
return false;
}
}
exports.ReactiveFlags = ReactiveFlags;
exports.createReactiveSystem = createReactiveSystem;
//# sourceMappingURL=alien.cjs.map
@@ -0,0 +1,100 @@
import { getValueTransition } from '../utils/get-value-transition.mjs';
import { resolveTransition } from '../utils/resolve-transition.mjs';
import { positionalKeys } from '../../render/utils/keys-position.mjs';
import { setTarget } from '../../render/utils/setters.mjs';
import { addValueToWillChange } from '../../value/will-change/add-will-change.mjs';
import { getOptimisedAppearId } from '../optimized-appear/get-appear-id.mjs';
import { animateMotionValue } from './motion-value.mjs';
import { frame } from '../../frameloop/frame.mjs';
/**
* Decide whether we should block this animation. Previously, we achieved this
* just by checking whether the key was listed in protectedKeys, but this
* posed problems if an animation was triggered by afterChildren and protectedKeys
* had been set to true in the meantime.
*/
function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
needsAnimating[key] = false;
return shouldBlock;
}
function animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) {
let { transition, transitionEnd, ...target } = targetAndTransition;
const defaultTransition = visualElement.getDefaultTransition();
transition = transition
? resolveTransition(transition, defaultTransition)
: defaultTransition;
const reduceMotion = transition?.reduceMotion;
if (transitionOverride)
transition = transitionOverride;
const animations = [];
const animationTypeState = type &&
visualElement.animationState &&
visualElement.animationState.getState()[type];
for (const key in target) {
const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null);
const valueTarget = target[key];
if (valueTarget === undefined ||
(animationTypeState &&
shouldBlockAnimation(animationTypeState, key))) {
continue;
}
const valueTransition = {
delay,
...getValueTransition(transition || {}, key),
};
/**
* If the value is already at the defined target, skip the animation.
* We still re-assert the value via frame.update to take precedence
* over any stale transitionEnd callbacks from previous animations.
*/
const currentValue = value.get();
if (currentValue !== undefined &&
!value.isAnimating() &&
!Array.isArray(valueTarget) &&
valueTarget === currentValue &&
!valueTransition.velocity) {
frame.update(() => value.set(valueTarget));
continue;
}
/**
* If this is the first time a value is being animated, check
* to see if we're handling off from an existing animation.
*/
let isHandoff = false;
if (window.MotionHandoffAnimation) {
const appearId = getOptimisedAppearId(visualElement);
if (appearId) {
const startTime = window.MotionHandoffAnimation(appearId, key, frame);
if (startTime !== null) {
valueTransition.startTime = startTime;
isHandoff = true;
}
}
}
addValueToWillChange(visualElement, key);
const shouldReduceMotion = reduceMotion ?? visualElement.shouldReduceMotion;
value.start(animateMotionValue(key, value, valueTarget, shouldReduceMotion && positionalKeys.has(key)
? { type: false }
: valueTransition, visualElement, isHandoff));
const animation = value.animation;
if (animation) {
animations.push(animation);
}
}
if (transitionEnd) {
const applyTransitionEnd = () => frame.update(() => {
transitionEnd && setTarget(visualElement, transitionEnd);
});
if (animations.length) {
Promise.all(animations).then(applyTransitionEnd);
}
else {
applyTransitionEnd();
}
}
return animations;
}
export { animateTarget };
//# sourceMappingURL=visual-element-target.mjs.map
@@ -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 PersonStanding = createLucideIcon("PersonStanding", [
["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
["path", { d: "m9 20 3-6 3 6", key: "se2kox" }],
["path", { d: "m6 8 6 2 6-2", key: "4o3us4" }],
["path", { d: "M12 10v4", key: "1kjpxc" }]
]);
export { PersonStanding as default };
//# sourceMappingURL=person-standing.js.map
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const ZoomOut = createLucideIcon("ZoomOut", [
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
]);
export { ZoomOut as default };
//# sourceMappingURL=zoom-out.js.map
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/get-intrinsic
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,15 @@
/**
* @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 RectangleVertical = createLucideIcon("RectangleVertical", [
["rect", { width: "12", height: "20", x: "6", y: "2", rx: "2", key: "1oxtiu" }]
]);
export { RectangleVertical as default };
//# sourceMappingURL=rectangle-vertical.js.map
@@ -0,0 +1 @@
{"version":3,"file":"triangle.js","sources":["../../../src/icons/triangle.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Triangle\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTMuNzMgNGEyIDIgMCAwIDAtMy40NiAwbC04IDE0QTIgMiAwIDAgMCA0IDIxaDE2YTIgMiAwIDAgMCAxLjczLTNaIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/triangle\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 Triangle = createLucideIcon('Triangle', [\n [\n 'path',\n { d: 'M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z', key: '14u9p9' },\n ],\n]);\n\nexport default Triangle;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAC5C,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA,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,CAAuE,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAS,CAAA,CAAA;AAAA,CAC5F,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,28 @@
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
import { util } from "../helpers/util.js";
test("check any inference", () => {
const t1 = z.any();
t1.optional();
t1.nullable();
type t1 = z.infer<typeof t1>;
util.assertEqual<t1, any>(true);
});
test("check unknown inference", () => {
const t1 = z.unknown();
t1.optional();
t1.nullable();
type t1 = z.infer<typeof t1>;
util.assertEqual<t1, unknown>(true);
});
test("check never inference", () => {
const t1 = z.never();
expect(() => t1.parse(undefined)).toThrow();
expect(() => t1.parse("asdf")).toThrow();
expect(() => t1.parse(null)).toThrow();
});
@@ -0,0 +1 @@
{"version":3,"file":"use-animation-frame.mjs","sources":["../../../src/utils/use-animation-frame.ts"],"sourcesContent":["\"use client\"\n\nimport { cancelFrame, frame, FrameData } from \"motion-dom\"\nimport { useContext, useEffect, useRef } from \"react\"\nimport { MotionConfigContext } from \"../context/MotionConfigContext\"\n\nexport type FrameCallback = (timestamp: number, delta: number) => void\n\nexport function useAnimationFrame(callback: FrameCallback) {\n const initialTimestamp = useRef(0)\n const { isStatic } = useContext(MotionConfigContext)\n\n useEffect(() => {\n if (isStatic) return\n\n const provideTimeSinceStart = ({ timestamp, delta }: FrameData) => {\n if (!initialTimestamp.current) initialTimestamp.current = timestamp\n\n callback(timestamp - initialTimestamp.current, delta)\n }\n\n frame.update(provideTimeSinceStart, true)\n return () => cancelFrame(provideTimeSinceStart)\n }, [callback])\n}\n"],"names":[],"mappings":";;;;;AAQM;AACF;;;AAII;;;;AAGmC;;AAGnC;AAEA;AACA;AACJ;AACJ;;"}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_SJ _CD","2":"_I","164":"_rN _xQ"},C:{"1":"_YO","2":"_MP"},D:{"1":"_SJ _EF","2":"_cL","164":"_bG _uG _xQ"},E:{"2":"_4C","164":"_jB"},F:{"1":"_H _eE _h","2":"_qC","129":"_6 _uE","164":"_MC _VC"},G:{"2":"_r","164":"_2"},H:{"132":"1D"},I:{"1":"I","2":"_W","164":"_y"},J:{"2":"D","164":"A"},K:{"2":"A","129":"_bD","164":"H"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"164":"bC"},P:{"164":"_F"},Q:{"164":"JE"},R:{"164":"KE"},S:{"1":"_C"}},B:4,C:"CSS box-decoration-break",D:true};
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
function isValidDate(value) {
return value instanceof Date && value.toString() !== "Invalid Date";
}
exports.isValidDate = isValidDate;
@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const atom = require("./atom.cjs");
class Store {
constructor(valueOrFn) {
this.atom = atom.createAtom(
valueOrFn
);
}
setState(updater) {
this.atom.set(updater);
}
get state() {
return this.atom.get();
}
get() {
return this.state;
}
subscribe(observerOrFn) {
return this.atom.subscribe(atom.toObserver(observerOrFn));
}
}
class ReadonlyStore {
constructor(valueOrFn) {
this.atom = atom.createAtom(
valueOrFn
);
}
get state() {
return this.atom.get();
}
get() {
return this.state;
}
subscribe(observerOrFn) {
return this.atom.subscribe(atom.toObserver(observerOrFn));
}
}
function createStore(valueOrFn) {
if (typeof valueOrFn === "function") {
return new ReadonlyStore(valueOrFn);
}
return new Store(valueOrFn);
}
exports.ReadonlyStore = ReadonlyStore;
exports.Store = Store;
exports.createStore = createStore;
//# sourceMappingURL=store.cjs.map
@@ -0,0 +1,24 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
*/
'use strict';
import type {ESNode} from 'hermes-estree';
export function createSyntaxError(node: ESNode, err: string): SyntaxError {
const syntaxError = new SyntaxError(err);
// $FlowExpectedError[prop-missing]
syntaxError.loc = {
line: node.loc.start.line,
column: node.loc.start.column,
};
return syntaxError;
}
@@ -0,0 +1,16 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Section = createLucideIcon("Section", [
["path", { d: "M16 5a4 3 0 0 0-8 0c0 4 8 3 8 7a4 3 0 0 1-8 0", key: "vqan6v" }],
["path", { d: "M8 19a4 3 0 0 0 8 0c0-4-8-3-8-7a4 3 0 0 1 8 0", key: "wdjd8o" }]
]);
export { Section as default };
//# sourceMappingURL=section.js.map
@@ -0,0 +1,25 @@
BSD 2-Clause License
Copyright (c) Open JS Foundation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,125 @@
/**
* @fileoverview enforce the location of arrow function bodies
* @author Sharmila Jesupaul
* @deprecated in ESLint v8.53.0
*/
"use strict";
const { isCommentToken, isNotOpeningParenToken } = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "11.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin",
url: "https://eslint.style",
},
rule: {
name: "implicit-arrow-linebreak",
url: "https://eslint.style/rules/implicit-arrow-linebreak",
},
},
],
},
type: "layout",
docs: {
description: "Enforce the location of arrow function bodies",
recommended: false,
url: "https://eslint.org/docs/latest/rules/implicit-arrow-linebreak",
},
fixable: "whitespace",
schema: [
{
enum: ["beside", "below"],
},
],
messages: {
expected: "Expected a linebreak before this expression.",
unexpected: "Expected no linebreak before this expression.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const option = context.options[0] || "beside";
/**
* Validates the location of an arrow function body
* @param {ASTNode} node The arrow function body
* @returns {void}
*/
function validateExpression(node) {
if (node.body.type === "BlockStatement") {
return;
}
const arrowToken = sourceCode.getTokenBefore(
node.body,
isNotOpeningParenToken,
);
const firstTokenOfBody = sourceCode.getTokenAfter(arrowToken);
if (
arrowToken.loc.end.line === firstTokenOfBody.loc.start.line &&
option === "below"
) {
context.report({
node: firstTokenOfBody,
messageId: "expected",
fix: fixer =>
fixer.insertTextBefore(firstTokenOfBody, "\n"),
});
} else if (
arrowToken.loc.end.line !== firstTokenOfBody.loc.start.line &&
option === "beside"
) {
context.report({
node: firstTokenOfBody,
messageId: "unexpected",
fix(fixer) {
if (
sourceCode.getFirstTokenBetween(
arrowToken,
firstTokenOfBody,
{
includeComments: true,
filter: isCommentToken,
},
)
) {
return null;
}
return fixer.replaceTextRange(
[arrowToken.range[1], firstTokenOfBody.range[0]],
" ",
);
},
});
}
}
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------
return {
ArrowFunctionExpression: node => validateExpression(node),
};
},
};
@@ -0,0 +1,143 @@
import { util } from "./helpers/util.js";
export const ZodIssueCode = util.arrayToEnum([
"invalid_type",
"invalid_literal",
"custom",
"invalid_union",
"invalid_union_discriminator",
"invalid_enum_value",
"unrecognized_keys",
"invalid_arguments",
"invalid_return_type",
"invalid_date",
"invalid_string",
"too_small",
"too_big",
"invalid_intersection_types",
"not_multiple_of",
"not_finite",
]);
export const quotelessJson = (obj) => {
const json = JSON.stringify(obj, null, 2);
return json.replace(/"([^"]+)":/g, "$1:");
};
export class ZodError extends Error {
get errors() {
return this.issues;
}
constructor(issues) {
super();
this.issues = [];
this.addIssue = (sub) => {
this.issues = [...this.issues, sub];
};
this.addIssues = (subs = []) => {
this.issues = [...this.issues, ...subs];
};
const actualProto = new.target.prototype;
if (Object.setPrototypeOf) {
// eslint-disable-next-line ban/ban
Object.setPrototypeOf(this, actualProto);
}
else {
this.__proto__ = actualProto;
}
this.name = "ZodError";
this.issues = issues;
}
format(_mapper) {
const mapper = _mapper ||
function (issue) {
return issue.message;
};
const fieldErrors = { _errors: [] };
const processError = (error) => {
for (const issue of error.issues) {
if (issue.code === "invalid_union") {
issue.unionErrors.map(processError);
}
else if (issue.code === "invalid_return_type") {
processError(issue.returnTypeError);
}
else if (issue.code === "invalid_arguments") {
processError(issue.argumentsError);
}
else if (issue.path.length === 0) {
fieldErrors._errors.push(mapper(issue));
}
else {
let curr = fieldErrors;
let i = 0;
while (i < issue.path.length) {
const el = issue.path[i];
const terminal = i === issue.path.length - 1;
// `_errors` is reserved by this legacy format, so merge a matching path segment into the current node instead of treating its array as a child.
if (el === "_errors") {
if (terminal)
curr._errors.push(mapper(issue));
i++;
continue;
}
// Create `el` as an own data property. A segment naming an inherited member ("toString", "constructor") would otherwise read through to the prototype, and assigning "__proto__" would hit the setter and walk into Object.prototype.
if (!Object.prototype.hasOwnProperty.call(curr, el)) {
if (el === "__proto__") {
Object.defineProperty(curr, el, {
value: { _errors: [] },
writable: true,
enumerable: true,
configurable: true,
});
}
else {
curr[el] = { _errors: [] };
}
}
curr = curr[el];
if (terminal) {
curr._errors.push(mapper(issue));
}
i++;
}
}
}
};
processError(this);
return fieldErrors;
}
static assert(value) {
if (!(value instanceof ZodError)) {
throw new Error(`Not a ZodError: ${value}`);
}
}
toString() {
return this.message;
}
get message() {
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
}
get isEmpty() {
return this.issues.length === 0;
}
flatten(mapper = (issue) => issue.message) {
const fieldErrors = Object.create(null);
const formErrors = [];
for (const sub of this.issues) {
if (sub.path.length > 0) {
const firstEl = sub.path[0];
fieldErrors[firstEl] = fieldErrors[firstEl] || [];
fieldErrors[firstEl].push(mapper(sub));
}
else {
formErrors.push(mapper(sub));
}
}
return { formErrors, fieldErrors };
}
get formErrors() {
return this.flatten();
}
}
ZodError.create = (issues) => {
const error = new ZodError(issues);
return error;
};
@@ -0,0 +1,947 @@
flf2a$ 9 8 12 63 18 0 24511 0
Font : Fire Font-s
Author : MJP
Date : 2003/11/6 11:11:05
Version: 1.0
-------------------------------------------------
-------------------------------------------------
This font has been created using JavE's FIGlet font export assistant.
Have a look at: http://www.jave.de
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
Based on Small.flf by Glenn Chappell 4/93 -- based on Standard
---
Font modified May 26, 2012 by patorjk
- Added the 0xCA0 character.
$ #
$ #
$ #
$ #
$ #
$ #
$ #
$ #
$ ##
____ #
| / #
| / #
| / #
|/ #
( #
)\ #
((_) #
##
#
( ( #
)\ )\ #
((_)((_) #
#
#
#
#
##
#
_ _ #
_| | |_ #
|_ . _| #
|_ _| #
|_|_| #
#
#
##
#
#
||_ #
(_-< #
/ _/ #
|| #
#
#
##
#
#
#
_ __ #
(_)/ / #
/ /_ #
/_/(_) #
#
##
#
#
( #
__ )\ #
/ _|((_) #
> _|_ _| #
\_____| #
#
##
#
( #
)\ #
((_) #
#
#
#
#
##
#
#
#
__ #
/ / #
| | #
| | #
\_\ #
##
#
#
#
__ #
\ \ #
| | #
| | #
/_/ #
##
_/\_ #
> < #
\/ #
#
#
#
#
#
##
#
#
#
_ #
_| |_ #
|_ _| #
|_| #
#
##
#
#
#
#
#
) #
/( #
(_)) #
##
#
#
#
___ #
|___| #
#
#
#
##
#
#
#
#
#
#
_ #
(_) #
##
#
#
#
__ #
/ / #
/ / #
/_/ #
#
##
#
) #
( /( #
)\()) #
((_)\ #
/ (_) #
| () | #
\__/ #
##
#
) #
( /( #
)\()) #
((_)\ #
/ (_) #
| | #
|_| #
##
#
) #
( /( #
)(_)) #
((_) #
|_ ) #
/ / #
/___| #
##
#
) #
( /( #
)\()) #
((_)\ #
|__ (_) #
|_ \ #
|___/ #
##
#
) #
( /( #
)\()) #
((_)\ #
| | (_) #
|_ _| #
|_| #
##
#
( ( #
)\))( #
((_)()\ #
(()((_) #
| __| #
|__ \ #
|___/ #
##
#
( #
)\ ) #
(()/( #
/(_)) #
(_) / #
/ _ \ #
\___/ #
##
#
) #
( /( #
)\()) #
((_)\ #
|__ / #
/ / #
/_/ #
##
#
( #
)\ ( #
((_))\ #
_((_) #
( _ ) #
/ _ \ #
\___/ #
##
#
) #
( /( #
)\()) #
((_)\ #
/ _(_) #
\_, / #
/_/ #
##
#
#
#
#
_ #
(_) #
_ #
(_) #
##
#
#
#
#
_ #
(_) #
( #
)\ #
((_) ##
#
#
#
#
__ #
/ / #
< < #
\_\ #
##
#
#
#
#
#
___ #
|___| #
|___| #
##
#
#
#
#
__ #
\ \ #
> > #
/_/ #
##
#
#
( #
)\ #
((_) #
|__ \ #
/_/ #
(_) #
##
#
#
( #
)\ #
((_) #
/__ _\ #
// _` |\ #
\\__,_|/ #
\____/ ##
#
( #
)\ #
((((_)( #
)\ _ )\ #
(_)_\(_) #
/ _ \ #
/_/ \_\ #
##
#
( #
( )\ #
)((_) #
((_)_ #
| _ ) #
| _ \ #
|___/ #
##
#
( #
)\ #
(((_) #
)\___ #
((/ __| #
| (__ #
\___| #
##
( #
)\ ) #
(()/( #
/(_)) #
(_))_ #
| \ #
| |) | #
|___/ #
##
#
#
( #
)\ #
((_) #
| __| #
| _| #
|___| #
##
( #
)\ ) #
(()/( #
/(_)) #
(_))_| #
| |_ #
| __| #
|_| #
##
#
( #
)\ ) #
(()/( #
/(_))_ #
(_)) __| #
| (_ | #
\___| #
##
) #
( /( #
)\()) #
((_)\ #
_((_) #
| || | #
| __ | #
|_||_| #
##
( #
)\ ) #
(()/( #
/(_)) #
(_)) #
|_ _| #
| | #
|___| #
##
#
#
( #
)\ #
((_) #
_ | | #
| || | #
\__/ #
##
) #
( /( #
)\()) #
|((_)\ #
|_ ((_) #
| |/ / #
' < #
_|\_\ #
##
( #
)\ ) #
(()/( #
/(_)) #
(_)) #
| | #
| |__ #
|____| #
##
* #
( ` #
)\))( #
((_)()\ #
(_()((_) #
| \/ | #
| |\/| | #
|_| |_| #
##
) #
( /( #
)\()) #
((_)\ #
_((_) #
| \| | #
| .` | #
|_|\_| #
##
) #
( /( #
)\()) #
((_)\ #
((_) #
/ _ \ #
| (_) | #
\___/ #
##
( #
)\ ) #
(()/( #
/(_)) #
(_)) #
| _ \ #
| _/ #
|_| #
##
#
( #
( )\ #
)((_) #
((_)_ #
/ _ \ #
| (_) | #
\__\_\ #
##
( #
)\ ) #
(()/( #
/(_)) #
(_)) #
| _ \ #
| / #
|_|_\ #
##
( #
)\ ) #
(()/( #
/(_)) #
(_)) #
/ __| #
\__ \ #
|___/ #
##
#
* ) #
` ) /( #
( )(_)) #
(_(_()) #
|_ _| #
| | #
|_| #
##
#
#
( #
)\ #
_ ((_) #
| | | | #
| |_| | #
\___/ #
##
#
#
( ( #
)\ )\ #
((_)((_) #
\ \ / / #
\ V / #
\_/ #
##
#
( ( #
)\))( '#
((_)()\ ) #
_(())\_)()#
\ \((_)/ /#
\ \/\/ / #
\_/\_/ #
##
) #
( /( #
)\()) #
((_)\ #
__((_) #
\ \/ / #
> < #
/_/\_\ #
##
) #
( /( #
)\()) #
((_)\ #
__ ((_) #
\ \ / / #
\ V / #
|_| #
##
) #
( /( #
)\()) #
((_)\ #
_((_) #
|_ / #
/ / #
/___| #
##
#
#
#
#
__ #
| _| #
| | #
| | #
|__| ##
#
#
#
#
__ #
\ \ #
\ \ #
\_\ #
##
#
#
#
#
__ #
|_ | #
| | #
| | #
|__| ##
#
/\ #
|/\| #
#
#
#
#
#
##
#
#
#
#
#
#
#
_____ #
|_____| ##
`#
#
#
#
#
#
#
#
##
#
#
) #
( /( #
)(_)) #
((_)_ #
/ _` | #
\__,_| #
##
#
) #
( /( #
)\()) #
((_)\ #
| |(_) #
| '_ \ #
|_.__/ #
##
#
#
#
( #
)\ #
((_) #
/ _| #
\__| #
##
#
( #
)\ ) #
(()/( #
((_)) #
_| | #
/ _` | #
\__,_| #
##
#
#
( #
))\ #
/((_) #
(_)) #
/ -_) #
\___| #
##
#
( #
)\ ) #
(()/( #
/(_)) #
(_) _| #
| _| #
|_| #
##
#
#
( ( #
)\))( #
((_))\ #
(()(_) #
/ _` | #
\__, | #
|___/ ##
#
) #
( /( #
)\()) #
((_)\ #
| |(_) #
| ' \ #
|_||_| #
##
#
#
( #
)\ #
((_) #
(_) #
| | #
|_| #
##
#
#
( #
)\ #
((_) #
! #
| | #
_/ | #
|__/ ##
#
) #
( /( #
)\()) #
((_)\ #
| |(_) #
| / / #
|_\_\ #
##
#
( #
)\ #
((_) #
_ #
| | #
| | #
|_| #
##
#
#
) #
( #
)\ ' #
_((_)) #
| ' \() #
|_|_|_| #
##
#
#
#
( #
)\ ) #
_(_/( #
| ' \)) #
|_||_| #
##
#
#
#
( #
)\ #
((_) #
/ _ \ #
\___/ #
##
#
#
#
` ) #
/(/( #
((_)_\ #
| '_ \) #
| .__/ #
|_| ##
#
#
( #
( )\ #
)(( ) #
((_)_) #
/ _` | #
\__, | #
|_| ##
#
#
( #
)( #
(()\ #
((_) #
| '_| #
|_| #
##
#
#
#
( #
)\ #
((_) #
(_-< #
/__/ #
##
#
) #
( /( #
)\()) #
(_))/ #
| |_ #
| _| #
\__| #
##
#
#
( #
))\ #
/((_) #
(_))( #
| || | #
\_,_| #
##
#
#
) #
/(( #
(_))\ #
_)((_) #
\ V / #
\_/ #
##
#
#
( ( #
)\))( #
((_)()\ #
_(()((_) #
\ V V / #
\_/\_/ #
##
#
#
) #
( /( #
)\()) #
((_)\ #
\ \ / #
/_\_\ #
##
#
#
( #
)\ ) #
(()/( #
)(_)) #
| || | #
\_, | #
|__/ ##
#
#
#
( #
)\ #
((_) #
|_ / #
/__| #
##
#
#
#
#
__ #
/ / #
_| | #
| | #
\_\ ##
#
#
#
#
_ #
| | #
| | #
| | #
|_| ##
#
#
#
#
__ #
\ \ #
| |_ #
| | #
/_/ ##
#
/\/| #
|/\/ #
#
#
#
#
#
##
) #
/( ( #
(_)))\ #
(_)_(_) #
/_\ #
/ _ \ #
/_/ \_\ #
#
##
( #
) )\ #
/(((_) #
(_)_(_) #
/ _ \ #
| (_) | #
\___/ #
#
##
) #
/( ( #
(_)))\ #
(_)_(_) #
| | | | #
| |_| | #
\___/ #
#
##
#
#
( #
_ )\ #
(_((_) #
/ _` | #
\__,_| #
#
##
#
#
) #
/( _ #
(_))(_) #
/ _ \ #
\___/ #
#
##
#
#
( #
_ )\ #
(_)((_) #
| |_| | #
\___/ #
#
##
#
( #
( )\ #
)((_) #
(/__ \ #
| |< < #
| ||_/ #
|_| #
##
0xCA0 KANNADA LETTER TTHA
) #
( /( #
)\()) #
((_)\__)#
/____/ #
/ _ \ #
| (_) | #
$\___/$ #
##
@@ -0,0 +1,2 @@
export declare const getWriteFlag: (() => string) | ((size: number) => number | "w");
//# sourceMappingURL=get-write-flag.d.ts.map
@@ -0,0 +1,15 @@
import * as React from 'react';
type PossibleRef<T> = React.Ref<T> | undefined;
/**
* A utility to compose multiple refs together
* Accepts callback refs and RefObject(s)
*/
declare function composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T>;
/**
* A custom hook that composes multiple refs
* Accepts callback refs and RefObject(s)
*/
declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T>;
export { composeRefs, useComposedRefs };
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_b","8":"F","292":"_A"},B:{"1":"_ZE","292":"_5B"},C:{"1":"_IN _8I","2":"_pL","8":"_jC _kH _hD","584":"_3I _eJ","1025":"_cQ"},D:{"1":"_LM","2":"_qG","8":"_CG","200":"_rB _ME _5E","1025":"EC"},E:{"1":"_JB","2":"_u","8":"_3E _zB"},F:{"1":"_MF","2":"_SK","200":"_MG _2Q"},G:{"1":"_9","2":"_1","8":"_SD _FF"},H:{"2":"1D"},I:{"1":"I","2":"_BO 5D","8":"_mN"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"292":"_A"},O:{"1":"bC"},P:{"1":"_hB","2":"8D","8":"J"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:4,C:"CSS Grid Layout (level 1)",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"useRouter.js","names":[],"sources":["../../src/useRouter.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { routerContext } from './routerContext'\nimport type { AnyRouter, RegisteredRouter } from '@tanstack/router-core'\n\n/**\n * Access the current TanStack Router instance from React context.\n * Must be used within a `RouterProvider`.\n *\n * Options:\n * - `warn`: Log a warning if no router context is found (default: true).\n *\n * @returns The registered router instance.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterHook\n */\nexport function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {\n warn?: boolean\n}): TRouter {\n const value = React.useContext(routerContext)\n if (process.env.NODE_ENV !== 'production') {\n if ((opts?.warn ?? true) && !value) {\n console.warn(\n 'Warning: useRouter must be used inside a <RouterProvider> component!',\n )\n }\n }\n return value as any\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,SAAgB,UAAwD,MAE5D;CACV,MAAM,QAAQ,QAAM,WAAW,cAAc;AAC7C,KAAA,QAAA,IAAA,aAA6B;OACtB,MAAM,QAAQ,SAAS,CAAC,MAC3B,SAAQ,KACN,uEACD;;AAGL,QAAO"}
@@ -0,0 +1,90 @@
export type Transform = "jsx" | "typescript" | "flow" | "imports" | "react-hot-loader" | "jest";
export interface SourceMapOptions {
/**
* The name to use in the "file" field of the source map. This should be the name of the compiled
* file.
*/
compiledFilename: string;
}
export interface Options {
/**
* Unordered array of transform names describing both the allowed syntax
* (where applicable) and the transformation behavior.
*/
transforms: Array<Transform>;
/**
* Opts out of all ES syntax transformations: optional chaining, nullish
* coalescing, class fields, numeric separators, optional catch binding.
*/
disableESTransforms?: boolean;
/**
* Transformation mode for the JSX transform.
* - "classic" refers to the original behavior using `React.createElement`.
* - "automatic" refers to the transform behavior released with React 17,
* where the `jsx` function (or a variation) is automatically imported.
* - "preserve" leaves the JSX as-is.
*
* Default value: "classic".
*/
jsxRuntime?: "classic" | "automatic" | "preserve";
/**
* Compile code for production use. Currently only applies to the JSX
* transform.
*/
production?: boolean;
/**
* If specified, import path prefix to use in place of "react" when compiling
* JSX with the automatic runtime.
*/
jsxImportSource?: string;
/**
* If specified, function name to use in place of React.createClass when
* compiling JSX with the classic runtime.
*/
jsxPragma?: string;
/**
* If specified, function name to use in place of React.Fragment when
* compiling JSX with the classic runtime.
*/
jsxFragmentPragma?: string;
/**
* If specified, disable automatic removal of type-only import and export
* statements and names. Only statements and names that explicitly use the
* `type` keyword are removed.
*/
keepUnusedImports?: boolean;
/**
* If specified, the imports transform does not attempt to change dynamic
* import() expressions into require() calls.
*/
preserveDynamicImport?: boolean;
/**
* Only relevant when targeting ESM (i.e. when the imports transform is *not*
* specified). This flag changes the behavior of TS require imports:
*
* import Foo = require("foo");
*
* to import createRequire, create a require function, and use that function.
* This is the TS behavior with module: nodenext and makes it easier for the
* same code to target ESM and CJS.
*/
injectCreateRequireForImportRequire?: boolean;
/**
* If true, replicate the import behavior of TypeScript's esModuleInterop: false.
*/
enableLegacyTypeScriptModuleInterop?: boolean;
/**
* If true, replicate the import behavior Babel 5 and babel-plugin-add-module-exports.
*/
enableLegacyBabel5ModuleInterop?: boolean;
/**
* If specified, we also return a RawSourceMap object alongside the code.
* filePath must be specified if this option is enabled.
*/
sourceMapOptions?: SourceMapOptions;
/**
* File path to use in error messages, React display names, and source maps.
*/
filePath?: string;
}
export declare function validateOptions(options: Options): void;
@@ -0,0 +1,268 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'no-type-alias',
meta: {
type: 'suggestion',
deprecated: {
deprecatedSince: '6.0.0',
replacedBy: [
{
rule: {
name: '@typescript-eslint/consistent-type-definitions',
url: 'https://typescript-eslint.io/rules/consistent-type-definitions',
},
},
],
url: 'https://github.com/typescript-eslint/typescript-eslint/pull/6229',
},
docs: {
description: 'Disallow type aliases',
// too opinionated to be recommended
},
messages: {
noCompositionAlias: '{{typeName}} in {{compositionType}} types are not allowed.',
noTypeAlias: 'Type {{alias}} are not allowed.',
},
schema: [
{
type: 'object',
$defs: {
expandedOptions: {
type: 'string',
enum: [
'always',
'never',
'in-unions',
'in-intersections',
'in-unions-and-intersections',
],
},
simpleOptions: {
type: 'string',
enum: ['always', 'never'],
},
},
additionalProperties: false,
properties: {
allowAliases: {
$ref: '#/items/0/$defs/expandedOptions',
description: 'Whether to allow direct one-to-one type aliases.',
},
allowCallbacks: {
$ref: '#/items/0/$defs/simpleOptions',
description: 'Whether to allow type aliases for callbacks.',
},
allowConditionalTypes: {
$ref: '#/items/0/$defs/simpleOptions',
description: 'Whether to allow type aliases for conditional types.',
},
allowConstructors: {
$ref: '#/items/0/$defs/simpleOptions',
description: 'Whether to allow type aliases with constructors.',
},
allowGenerics: {
$ref: '#/items/0/$defs/simpleOptions',
description: 'Whether to allow type aliases with generic types.',
},
allowLiterals: {
$ref: '#/items/0/$defs/expandedOptions',
description: 'Whether to allow type aliases with object literal types.',
},
allowMappedTypes: {
$ref: '#/items/0/$defs/expandedOptions',
description: 'Whether to allow type aliases with mapped types.',
},
allowTupleTypes: {
$ref: '#/items/0/$defs/expandedOptions',
description: 'Whether to allow type aliases with tuple types.',
},
},
},
],
},
defaultOptions: [
{
allowAliases: 'never',
allowCallbacks: 'never',
allowConditionalTypes: 'never',
allowConstructors: 'never',
allowGenerics: 'never',
allowLiterals: 'never',
allowMappedTypes: 'never',
allowTupleTypes: 'never',
},
],
create(context, [{ allowAliases, allowCallbacks, allowConditionalTypes, allowConstructors, allowGenerics, allowLiterals, allowMappedTypes, allowTupleTypes, },]) {
const unions = ['always', 'in-unions', 'in-unions-and-intersections'];
const intersections = [
'always',
'in-intersections',
'in-unions-and-intersections',
];
const compositions = [
'in-unions',
'in-intersections',
'in-unions-and-intersections',
];
const aliasTypes = new Set([
utils_1.AST_NODE_TYPES.TSArrayType,
utils_1.AST_NODE_TYPES.TSImportType,
utils_1.AST_NODE_TYPES.TSIndexedAccessType,
utils_1.AST_NODE_TYPES.TSLiteralType,
utils_1.AST_NODE_TYPES.TSTemplateLiteralType,
utils_1.AST_NODE_TYPES.TSTypeQuery,
utils_1.AST_NODE_TYPES.TSTypeReference,
]);
/**
* Determines if the composition type is supported by the allowed flags.
* @param isTopLevel a flag indicating this is the top level node.
* @param compositionType the composition type (either TSUnionType or TSIntersectionType)
* @param allowed the currently allowed flags.
*/
function isSupportedComposition(isTopLevel, compositionType, allowed) {
return (!compositions.includes(allowed) ||
(!isTopLevel &&
((compositionType === utils_1.AST_NODE_TYPES.TSUnionType &&
unions.includes(allowed)) ||
(compositionType === utils_1.AST_NODE_TYPES.TSIntersectionType &&
intersections.includes(allowed)))));
}
/**
* Gets the message to be displayed based on the node type and whether the node is a top level declaration.
* @param node the location
* @param compositionType the type of composition this alias is part of (undefined if not
* part of a composition)
* @param isRoot a flag indicating we are dealing with the top level declaration.
* @param type the kind of type alias being validated.
*/
function reportError(node, compositionType, isRoot, type) {
if (isRoot) {
return context.report({
node,
messageId: 'noTypeAlias',
data: {
alias: type.toLowerCase(),
},
});
}
return context.report({
node,
messageId: 'noCompositionAlias',
data: {
compositionType: compositionType === utils_1.AST_NODE_TYPES.TSUnionType
? 'union'
: 'intersection',
typeName: type,
},
});
}
const isValidTupleType = (type) => {
if (type.node.type === utils_1.AST_NODE_TYPES.TSTupleType) {
return true;
}
if (type.node.type === utils_1.AST_NODE_TYPES.TSTypeOperator &&
['keyof', 'readonly'].includes(type.node.operator) &&
type.node.typeAnnotation?.type === utils_1.AST_NODE_TYPES.TSTupleType) {
return true;
}
return false;
};
const isValidGeneric = (type) => {
return (type.node.type === utils_1.AST_NODE_TYPES.TSTypeReference &&
type.node.typeArguments != null);
};
const checkAndReport = (optionValue, isTopLevel, type, label) => {
if (optionValue === 'never' ||
!isSupportedComposition(isTopLevel, type.compositionType, optionValue)) {
reportError(type.node, type.compositionType, isTopLevel, label);
}
};
/**
* Validates the node looking for aliases, callbacks and literals.
* @param type the type of composition this alias is part of (null if not
* part of a composition)
* @param isTopLevel a flag indicating this is the top level node.
*/
function validateTypeAliases(type, isTopLevel = false) {
// https://github.com/typescript-eslint/typescript-eslint/issues/5439
/* eslint-disable @typescript-eslint/no-non-null-assertion */
if (type.node.type === utils_1.AST_NODE_TYPES.TSFunctionType) {
// callback
if (allowCallbacks === 'never') {
reportError(type.node, type.compositionType, isTopLevel, 'Callbacks');
}
}
else if (type.node.type === utils_1.AST_NODE_TYPES.TSConditionalType) {
// conditional type
if (allowConditionalTypes === 'never') {
reportError(type.node, type.compositionType, isTopLevel, 'Conditional types');
}
}
else if (type.node.type === utils_1.AST_NODE_TYPES.TSConstructorType) {
if (allowConstructors === 'never') {
reportError(type.node, type.compositionType, isTopLevel, 'Constructors');
}
}
else if (type.node.type === utils_1.AST_NODE_TYPES.TSTypeLiteral) {
// literal object type
checkAndReport(allowLiterals, isTopLevel, type, 'Literals');
}
else if (type.node.type === utils_1.AST_NODE_TYPES.TSMappedType) {
// mapped type
checkAndReport(allowMappedTypes, isTopLevel, type, 'Mapped types');
}
else if (isValidTupleType(type)) {
// tuple types
checkAndReport(allowTupleTypes, isTopLevel, type, 'Tuple Types');
}
else if (isValidGeneric(type)) {
if (allowGenerics === 'never') {
reportError(type.node, type.compositionType, isTopLevel, 'Generics');
}
}
else if (type.node.type.endsWith(utils_1.AST_TOKEN_TYPES.Keyword) ||
aliasTypes.has(type.node.type) ||
(type.node.type === utils_1.AST_NODE_TYPES.TSTypeOperator &&
(type.node.operator === 'keyof' ||
(type.node.operator === 'readonly' &&
type.node.typeAnnotation &&
aliasTypes.has(type.node.typeAnnotation.type))))) {
// alias / keyword
checkAndReport(allowAliases, isTopLevel, type, 'Aliases');
}
else {
// unhandled type - shouldn't happen
reportError(type.node, type.compositionType, isTopLevel, 'Unhandled');
}
/* eslint-enable @typescript-eslint/no-non-null-assertion */
}
/**
* Flatten the given type into an array of its dependencies
*/
function getTypes(node, compositionType = null) {
if (node.type === utils_1.AST_NODE_TYPES.TSUnionType ||
node.type === utils_1.AST_NODE_TYPES.TSIntersectionType) {
return node.types.flatMap(type => getTypes(type, node.type));
}
return [{ node, compositionType }];
}
return {
TSTypeAliasDeclaration(node) {
const types = getTypes(node.typeAnnotation);
if (types.length === 1) {
// is a top level type annotation
validateTypeAliases(types[0], true);
}
else {
// is a composition type
types.forEach(type => {
validateTypeAliases(type);
});
}
},
};
},
});
@@ -0,0 +1 @@
module.exports={C:{"48":0.01429,"115":0.29427,"120":0.13999,"121":0.25713,"126":0.00286,"129":0.01143,"140":0.05714,"147":0.00571,"149":0.00571,"150":0.00286,"153":0.04857,"154":0.18856,"155":0.56283,"156":0.12857,"157":0.03143,_:"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 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 123 124 125 127 128 130 131 132 133 134 135 136 137 138 139 141 142 143 144 145 146 148 151 152 158 159 160 3.5","3.6":0.00286},D:{"34":0.00286,"63":0.00286,"67":0.02571,"69":0.04857,"70":0.00857,"71":0.00286,"72":0.00286,"76":0.00571,"79":0.00857,"83":0.01714,"88":0.01143,"91":0.01429,"92":0.00286,"97":0.00286,"98":0.01143,"101":0.04571,"103":0.01143,"104":0.02571,"105":0.00857,"106":0.01714,"107":0.00857,"108":0.01143,"109":0.60854,"110":0.02571,"111":0.03143,"112":0.01429,"113":0.10857,"114":0.00857,"116":0.06,"117":0.01714,"118":0.19999,"119":0.75996,"120":0.5714,"122":0.01714,"124":0.02,"126":0.01429,"128":0.02571,"131":0.07714,"132":0.00286,"133":0.09428,"134":0.08857,"135":0.04571,"136":0.05143,"137":0.10571,"138":0.30856,"139":0.09142,"140":0.09428,"141":0.07428,"142":0.29427,"143":0.01143,"144":0.15428,"145":0.01429,"146":0.05714,"147":0.03714,"148":0.12285,"149":0.09142,"150":0.33713,"151":0.83139,"152":4.44835,"153":2.54273,"154":0.40855,"155":0.01429,_:"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 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 64 65 66 68 73 74 75 77 78 80 81 84 85 86 87 89 90 93 94 95 96 99 100 102 115 121 123 125 127 129 130 156 157"},F:{"46":0.01429,"95":0.01143,"100":0.00286,"101":0.00286,"122":0.00286,"134":0.04,"135":0.15142,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 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:{"18":0.01714,"84":0.02286,"89":0.01714,"92":0.10571,"100":0.16285,"109":0.04571,"119":0.14285,"120":0.15142,"122":0.01429,"124":0.00571,"134":0.00857,"138":0.06571,"139":0.00571,"142":0.01143,"143":0.04286,"144":0.07143,"145":0.00571,"146":0.03428,"147":0.04857,"148":0.16285,"149":0.11714,"150":0.15714,"151":0.31141,"152":2.29703,"153":3.25127,"154":0.58569,_:"12 13 14 15 16 17 79 80 81 83 85 86 87 88 90 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 121 123 125 126 127 128 129 130 131 132 133 135 136 137 140 141"},E:{"27":0.01714,_:"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 12.1 13.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.2 16.3 16.4 17.0 17.1 17.2 17.4 17.5 18.0 18.1 18.2 18.3 18.4 26.0 26.1 26.2 27.1 27.2 TP","11.1":0.00857,"14.1":0.01429,"15.6":0.02,"16.5":0.00286,"16.6":0.00857,"17.3":0.01429,"17.6":0.03143,"18.5-18.7":0.00571,"26.3":0.01143,"26.4":0.01429,"26.5":0.02857,"26.6":0.12285},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00122,"5.0-5.1":0.00122,"6.0-6.1":0,"7.0-7.1":0.00244,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.01221,"11.0-11.2":0.00122,"11.3-11.4":0.00244,"12.0-12.1":0,"12.2-12.5":0.03174,"13.0-13.1":0,"13.2":0.0061,"13.3":0,"13.4-13.7":0.00122,"14.0-14.4":0.00488,"14.5-14.8":0.00732,"15.0-15.1":0.00732,"15.2-15.3":0.00488,"15.4":0.0061,"15.5":0.00732,"15.6-15.8":0.1587,"16.0":0.01221,"16.1":0.02197,"16.2":0.01221,"16.3":0.02686,"16.4":0.0061,"16.5":0.00977,"16.6-16.7":0.22095,"17.0":0.00855,"17.1":0.01221,"17.2":0.01221,"17.3":0.01831,"17.4":0.02564,"17.5":0.05005,"17.6-17.7":0.1294,"18.0":0.02686,"18.1":0.05371,"18.2":0.07324,"18.3":0.12696,"18.4":0.07935,"18.5-18.7":1.63945,"26.0":0.07935,"26.1":0.08057,"26.2":0.20997,"26.3":0.22706,"26.4":0.16602,"26.5":1.11209,"26.6":6.86177,"27.0":0.52614,"27.1":0,"27.2":0.01343},P:{"4":0.05696,"23":0.01899,"24":0.00949,"25":0.02848,"28":0.08543,"29":0.7784,"30":1.10115,_:"20 21 22 26 27 5.0-5.4 6.2-6.4 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","7.2-7.4":0.01899,"8.2":0.00949,"9.2":0.00949,"10.1":0.01899,"11.1-11.2":0.02848},I:{"0":0.02141,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.96431,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{"2.5":0.1,_:"3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0":58.70942},R:{_:"0"},M:{"0":0.22858},Q:{_:"14.9"},O:{"0":1.04288},H:{all:0}};
@@ -0,0 +1,21 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const CloudHail = createLucideIcon("CloudHail", [
["path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242", key: "1pljnt" }],
["path", { d: "M16 14v2", key: "a1is7l" }],
["path", { d: "M8 14v2", key: "1e9m6t" }],
["path", { d: "M16 20h.01", key: "xwek51" }],
["path", { d: "M8 20h.01", key: "1vjney" }],
["path", { d: "M12 16v2", key: "z66u1j" }],
["path", { d: "M12 22h.01", key: "1urd7a" }]
]);
export { CloudHail as default };
//# sourceMappingURL=cloud-hail.js.map
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2021_weakref: LibDefinition;
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/index.ts"],"names":[],"mappings":";;AACA,mEAA2D;AAC3D,yDAAiD;AAEjD,MAAM,WAAW,GAAe,CAAC,+BAAqB,EAAE,0BAAgB,CAAC,CAAA;AAEzE,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,33 @@
{
"name": "media-typer",
"description": "Simple RFC 6838 media type parser and formatter",
"version": "1.1.0",
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
"license": "MIT",
"repository": "jshttp/media-typer",
"devDependencies": {
"eslint": "5.16.0",
"eslint-config-standard": "12.0.0",
"eslint-plugin-import": "2.17.2",
"eslint-plugin-markdown": "1.0.0",
"eslint-plugin-node": "8.0.1",
"eslint-plugin-promise": "4.1.1",
"eslint-plugin-standard": "4.0.0",
"mocha": "6.1.4",
"nyc": "14.0.0"
},
"files": [
"LICENSE",
"HISTORY.md",
"index.js"
],
"engines": {
"node": ">= 0.8"
},
"scripts": {
"lint": "eslint --plugin markdown --ext js,md .",
"test": "mocha --reporter spec --check-leaks --bail test/",
"test-cov": "nyc --reporter=html --reporter=text npm test",
"test-travis": "nyc --reporter=text npm test"
}
}
@@ -0,0 +1,21 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Regex = createLucideIcon("Regex", [
["path", { d: "M17 3v10", key: "15fgeh" }],
["path", { d: "m12.67 5.5 8.66 5", key: "1gpheq" }],
["path", { d: "m12.67 10.5 8.66-5", key: "1dkfa6" }],
[
"path",
{ d: "M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z", key: "swwfx4" }
]
]);
export { Regex as default };
//# sourceMappingURL=regex.js.map
@@ -0,0 +1 @@
{"version":3,"file":"hop.js","sources":["../../../src/icons/hop.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Hop\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTAuODIgMTYuMTJjMS42OS42IDMuOTEuNzkgNS4xOC44NS41NS4wMyAxLS40Mi45Ny0uOTctLjA2LTEuMjctLjI2LTMuNS0uODUtNS4xOCIgLz4KICA8cGF0aCBkPSJNMTEuNSA2LjVjMS42NCAwIDUtLjM4IDYuNzEtMS4wNy41Mi0uMi41NS0uODIuMTItMS4xN0ExMCAxMCAwIDAgMCA0LjI2IDE4LjMzYy4zNS40My45Ni40IDEuMTctLjEyLjY5LTEuNzEgMS4wNy01LjA3IDEuMDctNi43MSAxLjM0LjQ1IDMuMS45IDQuODguNjJhLjg4Ljg4IDAgMCAwIC43My0uNzRjLjMtMi4xNC0uMTUtMy41LS42MS00Ljg4IiAvPgogIDxwYXRoIGQ9Ik0xNS42MiAxNi45NWMuMi44NS42MiAyLjc2LjUgNC4yOGEuNzcuNzcgMCAwIDEtLjkuNyAxNi42NCAxNi42NCAwIDAgMS00LjA4LTEuMzYiIC8+CiAgPHBhdGggZD0iTTE2LjEzIDIxLjA1YzEuNjUuNjMgMy42OC44NCA0Ljg3LjkxYS45LjkgMCAwIDAgLjk2LS45NiAxNy42OCAxNy42OCAwIDAgMC0uOS00Ljg3IiAvPgogIDxwYXRoIGQ9Ik0xNi45NCAxNS42MmMuODYuMiAyLjc3LjYyIDQuMjkuNWEuNzcuNzcgMCAwIDAgLjctLjkgMTYuNjQgMTYuNjQgMCAwIDAtMS4zNi00LjA4IiAvPgogIDxwYXRoIGQ9Ik0xNy45OSA1LjUyYTIwLjgyIDIwLjgyIDAgMCAxIDMuMTUgNC41LjguOCAwIDAgMS0uNjggMS4xM2MtMi4zMy4yLTUuMy0uMzItOC4yNy0xLjU3IiAvPgogIDxwYXRoIGQ9Ik00LjkzIDQuOTMgMyAzYS43LjcgMCAwIDEgMC0xIiAvPgogIDxwYXRoIGQ9Ik05LjU4IDEyLjE4YzEuMjQgMi45OCAxLjc3IDUuOTUgMS41NyA4LjI4YS44LjggMCAwIDEtMS4xMy42OCAyMC44MiAyMC44MiAwIDAgMS00LjUtMy4xNSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/hop\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 Hop = createLucideIcon('Hop', [\n [\n 'path',\n {\n d: 'M10.82 16.12c1.69.6 3.91.79 5.18.85.55.03 1-.42.97-.97-.06-1.27-.26-3.5-.85-5.18',\n key: '18lxf1',\n },\n ],\n [\n 'path',\n {\n d: 'M11.5 6.5c1.64 0 5-.38 6.71-1.07.52-.2.55-.82.12-1.17A10 10 0 0 0 4.26 18.33c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.88.88 0 0 0 .73-.74c.3-2.14-.15-3.5-.61-4.88',\n key: 'vtfxrw',\n },\n ],\n [\n 'path',\n {\n d: 'M15.62 16.95c.2.85.62 2.76.5 4.28a.77.77 0 0 1-.9.7 16.64 16.64 0 0 1-4.08-1.36',\n key: '13hl71',\n },\n ],\n [\n 'path',\n {\n d: 'M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .96-.96 17.68 17.68 0 0 0-.9-4.87',\n key: '1sl8oj',\n },\n ],\n [\n 'path',\n {\n d: 'M16.94 15.62c.86.2 2.77.62 4.29.5a.77.77 0 0 0 .7-.9 16.64 16.64 0 0 0-1.36-4.08',\n key: '19c6kt',\n },\n ],\n [\n 'path',\n {\n d: 'M17.99 5.52a20.82 20.82 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-2.33.2-5.3-.32-8.27-1.57',\n key: '85ghs3',\n },\n ],\n ['path', { d: 'M4.93 4.93 3 3a.7.7 0 0 1 0-1', key: 'x087yj' }],\n [\n 'path',\n {\n d: 'M9.58 12.18c1.24 2.98 1.77 5.95 1.57 8.28a.8.8 0 0 1-1.13.68 20.82 20.82 0 0 1-4.5-3.15',\n key: '11xdqo',\n },\n ],\n]);\n\nexport default Hop;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,iBAAiB,KAAO,CAAA,CAAA,CAAA;AAAA,CAClC,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;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,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,CAALine truncated
@@ -0,0 +1,63 @@
{
"name": "@eslint/plugin-kit",
"version": "0.7.1",
"description": "Utilities for building ESLint plugins.",
"author": "Nicholas C. Zakas",
"type": "module",
"main": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"exports": {
"require": {
"types": "./dist/cjs/index.d.cts",
"default": "./dist/cjs/index.cjs"
},
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
}
},
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/eslint/rewrite.git",
"directory": "packages/plugin-kit"
},
"bugs": {
"url": "https://github.com/eslint/rewrite/issues"
},
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/plugin-kit#readme",
"scripts": {
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
"lint:types": "attw --pack",
"pretest": "npm run build",
"test": "npm run test:types && npm run test:unit",
"test:coverage": "npm run build && c8 npm run test:unit",
"test:jsr": "npx -y jsr@latest publish --dry-run",
"test:types": "tsc -p tests/types/tsconfig.json",
"test:unit": "mocha \"tests/**/*.test.js\""
},
"keywords": [
"eslint",
"eslintplugin",
"eslint-plugin"
],
"license": "Apache-2.0",
"dependencies": {
"@eslint/core": "^1.2.1",
"levn": "^0.4.1"
},
"devDependencies": {
"@types/levn": "^0.4.0",
"rollup-plugin-copy": "^3.5.0"
},
"engines": {
"node": "^20.19.0 || ^22.13.0 || >=24"
}
}
@@ -0,0 +1,67 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
/**
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
*/
exports.encode = function (number) {
if (0 <= number && number < intToCharMap.length) {
return intToCharMap[number];
}
throw new TypeError("Must be between 0 and 63: " + number);
};
/**
* Decode a single base 64 character code digit to an integer. Returns -1 on
* failure.
*/
exports.decode = function (charCode) {
var bigA = 65; // 'A'
var bigZ = 90; // 'Z'
var littleA = 97; // 'a'
var littleZ = 122; // 'z'
var zero = 48; // '0'
var nine = 57; // '9'
var plus = 43; // '+'
var slash = 47; // '/'
var littleOffset = 26;
var numberOffset = 52;
// 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
if (bigA <= charCode && charCode <= bigZ) {
return (charCode - bigA);
}
// 26 - 51: abcdefghijklmnopqrstuvwxyz
if (littleA <= charCode && charCode <= littleZ) {
return (charCode - littleA + littleOffset);
}
// 52 - 61: 0123456789
if (zero <= charCode && charCode <= nine) {
return (charCode - zero + numberOffset);
}
// 62: +
if (charCode == plus) {
return 62;
}
// 63: /
if (charCode == slash) {
return 63;
}
// Invalid base64 digit.
return -1;
};
@@ -0,0 +1 @@
{"version":3,"names":["_index","require","_skip","Symbol","_stop","traverseFast","node","enter","opts","keys","VISITOR_KEYS","type","ret","undefined","key","subNode","Array","isArray","skip","stop"],"sources":["../../src/traverse/traverseFast.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions/index.ts\";\nimport type * as t from \"../index.ts\";\n\nconst _skip = Symbol();\nconst _stop = Symbol();\n\n/**\n * A prefix AST traversal implementation meant for simple searching and processing.\n * @param enter The callback can return `traverseFast.skip` to skip the subtree of the current node, or `traverseFast.stop` to stop the traversal.\n * @returns `true` if the traversal was stopped by callback, `false` otherwise.\n */\nexport default function traverseFast<Options = object>(\n node: t.Node | null | undefined,\n enter: (\n node: t.Node,\n opts?: Options,\n ) => void | typeof traverseFast.skip | typeof traverseFast.stop,\n opts?: Options,\n): boolean {\n if (!node) return false;\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys) return false;\n\n opts = opts || ({} as Options);\n const ret = enter(node, opts);\n if (ret !== undefined) {\n switch (ret) {\n case _skip:\n return false;\n case _stop:\n return true;\n }\n }\n\n for (const key of keys) {\n const subNode: t.Node | undefined | null =\n // @ts-expect-error key must present in node\n node[key];\n\n if (!subNode) continue;\n\n if (Array.isArray(subNode)) {\n for (const node of subNode) {\n if (traverseFast(node, enter, opts)) return true;\n }\n } else {\n if (traverseFast(subNode, enter, opts)) return true;\n }\n }\n return false;\n}\n\ntraverseFast.skip = _skip;\ntraverseFast.stop = _stop;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,MAAMC,KAAK,GAAGC,MAAM,CAAC,CAAC;AACtB,MAAMC,KAAK,GAAGD,MAAM,CAAC,CAAC;AAOP,SAASE,YAAYA,CAClCC,IAA+B,EAC/BC,KAG+D,EAC/DC,IAAc,EACL;EACT,IAAI,CAACF,IAAI,EAAE,OAAO,KAAK;EAEvB,MAAMG,IAAI,GAAGC,mBAAY,CAACJ,IAAI,CAACK,IAAI,CAAC;EACpC,IAAI,CAACF,IAAI,EAAE,OAAO,KAAK;EAEvBD,IAAI,GAAGA,IAAI,IAAK,CAAC,CAAa;EAC9B,MAAMI,GAAG,GAAGL,KAAK,CAACD,IAAI,EAAEE,IAAI,CAAC;EAC7B,IAAII,GAAG,KAAKC,SAAS,EAAE;IACrB,QAAQD,GAAG;MACT,KAAKV,KAAK;QACR,OAAO,KAAK;MACd,KAAKE,KAAK;QACR,OAAO,IAAI;IACf;EACF;EAEA,KAAK,MAAMU,GAAG,IAAIL,IAAI,EAAE;IACtB,MAAMM,OAAkC,GAEtCT,IAAI,CAACQ,GAAG,CAAC;IAEX,IAAI,CAACC,OAAO,EAAE;IAEd,IAAIC,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,EAAE;MAC1B,KAAK,MAAMT,IAAI,IAAIS,OAAO,EAAE;QAC1B,IAAIV,YAAY,CAACC,IAAI,EAAEC,KAAK,EAAEC,IAAI,CAAC,EAAE,OAAO,IAAI;MAClD;IACF,CAAC,MAAM;MACL,IAAIH,YAAY,CAACU,OAAO,EAAER,KAAK,EAAEC,IAAI,CAAC,EAAE,OAAO,IAAI;IACrD;EACF;EACA,OAAO,KAAK;AACd;AAEAH,YAAY,CAACa,IAAI,GAAGhB,KAAK;AACzBG,YAAY,CAACc,IAAI,GAAGf,KAAK","ignoreList":[]}
@@ -0,0 +1,430 @@
export default `flf2a$ 4 4 48 0 20 0 0
DANC4 by Richard Sabey <cryptic_fan@hotmail.com> 9.2003
This font is based on the "dancing men" cipher used in Sir Arthur Conan
Doyle's Sherlock Holmes story "The Adventure of the Dancing Men" (DANC),
which was later published in the collection "The Return of Sherlock Holmes".
The cipher ignores punctuation, and marks a space by a flag held by the
dancing man for the last letter before the space. The last figure of
an entire message carries no flag, as there is no need for one. In this
implementation of the cipher, figures with no flags represent lowercase
letters; those with flags, uppercase letters. Thus, when FIGletising, you
should type only the letters, and uppercase the *last* letter of every word
except the last. For example "Come, Elsie!" becomes comEelsie.
The messages in dancing-men cipher in DANC didn't use the letters
FJKQUWXZ. What's more, editions of DANC vary in what mistakes they make in
the cipher, though they are consistent in using the same figure for P & V.
To resolve this problem and supply the missing figures, I follow the TrueType
font designed in 1994 by Martin Bergman of Sweden.
The positions of the flags have been altered to keep this a 4-line FIGfont.
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O \\O/ \\O/ \\O \\O/ O/ '\\ /\`@
.___| Y Y___, | Y <| \\ / @
| / \\ | / \\ / \\ / \\ X @
|_ ./ \\, _| _\\ /_ ./ \\, _| |_ /O\\# @@
\\O/ O/ '\\ /\`@
Y_ <| \\ / @
/ | / \\ Y @
./ |_ _| |_ O\\# @@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O |_O \\O |_O_|#@
.___| _|> |_ _| @
| _| \\ / | _| \\ @
|_ |_ ./ |_ |_ @@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O @
|\\ @
/ \\ @
_\\ /_@@
O/ @
/| @
/ \\ @
./ \\,@@
O @
/| @
/ \\ @
_\\ /_@@
O @
/|\\ @
/ \\ @
./ \\,@@
O @
|\\ @
/ \\ @
_\\ /_@@
\\O @
|\\ @
/ \\ @
./ \\,@@
O/ @
/| @
/ \\ @
_\\ /_@@
O @
/| @
/ \\ @
./ \\,@@
O @
/|\\ @
/ \\ @
_\\ /_@@
O @
|\\ @
/ \\ @
./ \\,@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O/ '\\ /\`@
Y_ \\ / @
/ | X @
./ |_ /O\\# @@
\\O/# @
Y_ @
/ | @
./ |_@@
O @
|# @
/ \\ @
_\\ /_@@
\\O @
|# @
/ \\ @
_\\ /_@@
'\\ /\`@
\\ / @
Y @
O\\# @@
\\O/# @
Y @
/ \\ @
./ \\,@@
O/# @
|_ @
/ | @
./ |_@@
'\\ /\`@
\\ / @
Y @
/O# @@
\\O/#@
Y @
| @
_|_ @@
\\O/#@
.___Y @
| @
|_ @@
\\O @
_|#@
_| | @
|_@@
O/# @
| @
/ \\ @
./ \\,@@
|_O @
_#> @
_| \\ @
|_@@
\\O/#@
Y @
/ \\ @
_| |_@@
O/#@
<| @
/ \\ @
_| |_@@
\\O/#@
_Y @
_| | @
|_ @@
\\O @
.___|#@
| @
|_@@
\\O @
|#__,@
| @
_| @@
\\O/# @
Y___,@
| @
_| @@
|_O_|#@
_| @
_| \\ @
|_ @@
'\\ /\`@
\\ / @
X @
/O\\# @@
\\O# @
|_ @
/ | @
./ |_@@
O/#@
.___| @
| @
|_ @@
O/#@
_| @
_| | @
|_ @@
\\O @
|# @
/ \\ @
./ \\,@@
O/# @
_| @
_| \\ @
\\,@@
O/# @
|___,@
| @
_| @@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O/ @
Y_ @
/ | @
./ |_@@
O @
| @
/ \\ @
_\\ /_@@
\\O @
| @
/ \\ @
_\\ /_@@
'\\ /\`@
\\ / @
Y @
O\\ @@
\\O/ @
Y @
/ \\ @
./ \\,@@
O/ @
|_ @
/ | @
./ |_@@
'\\ /\`@
\\ / @
Y @
/O @@
\\O/@
Y @
| @
_|_@@
\\O/@
.___Y @
| @
|_@@
\\O @
_| @
_| | @
|_@@
O/ @
| @
/ \\ @
./ \\,@@
|_O @
_|> @
_| \\ @
|_@@
\\O/ @
Y @
/ \\ @
_| |_@@
O/ @
<| @
/ \\ @
_| |_@@
\\O/@
_Y @
_| | @
|_@@
\\O @
.___| @
| @
|_@@
\\O @
|___,@
| @
_| @@
\\O/ @
Y___,@
| @
_| @@
|_O_|@
_| @
_| \\ @
|_@@
'\\ /\`@
\\ / @
X @
/O\\ @@
\\O @
|_ @
/ | @
./ |_@@
O/@
.___| @
| @
|_@@
O/@
_| @
_| | @
|_@@
\\O @
| @
/ \\ @
./ \\,@@
O/ @
_| @
_| \\ @
\\,@@
O/ @
|___,@
| @
_| @@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
\\O/ \\O/# @
Y_ Y @
/ | / \\ @
./ |_ ./ \\,@@
\\O/ \\O/# @
_Y Y @
_| | / \\ @
|_ ./ \\,@@
\\O \\O/# @
|_ Y @
/ | / \\ @
./ |_ ./ \\,@@
\\O/ \\O/ @
Y_ Y @
/ | / \\ @
./ |_ ./ \\,@@
\\O/ \\O/ @
_Y Y @
_| | / \\ @
|_ ./ \\,@@
\\O \\O/ @
|_ Y @
/ | / \\ @
./ |_ ./ \\,@@
|_O_| |_O_|@
_| _| @
_| \\ _| \\ @
|_ |_@@
`
@@ -0,0 +1,74 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createProjectProgramError = createProjectProgramError;
const node_path_1 = __importDefault(require("node:path"));
const describeFilePath_1 = require("./describeFilePath");
const shared_1 = require("./shared");
function createProjectProgramError(parseSettings, programsForProjects) {
const describedFilePath = (0, describeFilePath_1.describeFilePath)(parseSettings.filePath, parseSettings.tsconfigRootDir);
return [
getErrorStart(describedFilePath, parseSettings),
...getErrorDetails(describedFilePath, parseSettings, programsForProjects),
];
}
function getErrorStart(describedFilePath, parseSettings) {
const relativeProjects = [...parseSettings.projects.values()].map(projectFile => (0, describeFilePath_1.describeFilePath)(projectFile, parseSettings.tsconfigRootDir));
const describedPrograms = relativeProjects.length === 1
? ` ${relativeProjects[0]}`
: `\n${relativeProjects.map(project => `- ${project}`).join('\n')}`;
return `ESLint was configured to run on \`${describedFilePath}\` using \`parserOptions.project\`:${describedPrograms}`;
}
function getErrorDetails(describedFilePath, parseSettings, programsForProjects) {
if (programsForProjects.length === 1 &&
programsForProjects[0].getProjectReferences()?.length) {
return [
`That TSConfig uses project "references" and doesn't include \`${describedFilePath}\` directly, which is not supported by \`parserOptions.project\`.`,
`Either:`,
`- Switch to \`parserOptions.projectService\``,
`- Use an ESLint-specific TSConfig`,
`See the typescript-eslint docs for more info: https://tseslint.com/are-project-references-supported`,
];
}
const { extraFileExtensions } = parseSettings;
const details = [];
for (const extraExtension of extraFileExtensions) {
if (!extraExtension.startsWith('.')) {
details.push(`Found unexpected extension \`${extraExtension}\` specified with the \`parserOptions.extraFileExtensions\` option. Did you mean \`.${extraExtension}\`?`);
}
if (shared_1.DEFAULT_EXTRA_FILE_EXTENSIONS.has(extraExtension)) {
details.push(`You unnecessarily included the extension \`${extraExtension}\` with the \`parserOptions.extraFileExtensions\` option. This extension is already handled by the parser by default.`);
}
}
const fileExtension = node_path_1.default.extname(parseSettings.filePath);
if (!shared_1.DEFAULT_EXTRA_FILE_EXTENSIONS.has(fileExtension)) {
const nonStandardExt = `The extension for the file (\`${fileExtension}\`) is non-standard`;
if (extraFileExtensions.length > 0) {
if (!extraFileExtensions.includes(fileExtension)) {
return [
...details,
`${nonStandardExt}. It should be added to your existing \`parserOptions.extraFileExtensions\`.`,
];
}
}
else {
return [
...details,
`${nonStandardExt}. You should add \`parserOptions.extraFileExtensions\` to your config.`,
];
}
}
const [describedInclusions, describedSpecifiers] = parseSettings.projects.size === 1
? ['that TSConfig does not', 'that TSConfig']
: ['none of those TSConfigs', 'one of those TSConfigs'];
return [
...details,
`However, ${describedInclusions} include this file. Either:`,
`- Change ESLint's list of included files to not include this file`,
`- Change ${describedSpecifiers} to include this file`,
`- Create a new TSConfig that includes this file and include it in your parserOptions.project`,
`See the typescript-eslint docs for more info: https://tseslint.com/none-of-those-tsconfigs-include-this-file`,
];
}
@@ -0,0 +1,305 @@
import {List} from 'immutable';
import {Value} from './index';
/**
* Sass's [number type](https://sass-lang.com/documentation/values/numbers).
*
* @category Custom Function
*/
export class SassNumber extends Value {
/**
* Creates a new number with more complex units than just a single numerator.
*
* Upon construction, any compatible numerator and denominator units are
* simplified away according to the conversion factor between them.
*
* @param value - The number's numeric value.
*
* @param unit - If this is a string, it's used as the single numerator unit
* for the number.
*
* @param unit.numeratorUnits - If passed, these are the numerator units to
* use for the number. This may be either a plain JavaScript array or an
* immutable {@link List} from the [`immutable`
* package](https://immutable-js.com/).
*
* @param unit.denominatorUnits - If passed, these are the denominator units
* to use for the number. This may be either a plain JavaScript array or an
* immutable {@link List} from the [`immutable`
* package](https://immutable-js.com/).
*/
constructor(
value: number,
unit?:
| string
| {
numeratorUnits?: string[] | List<string>;
denominatorUnits?: string[] | List<string>;
}
);
/** This number's numeric value. */
get value(): number;
/** Whether {@link value} is an integer according to Sass's equality logic. */
get isInt(): boolean;
/**
* If {@link value} is an integer according to {@link isInt}, returns {@link
* value} rounded to that integer. If it's not an integer, returns `null`.
*/
get asInt(): number | null;
/**
* This number's numerator units as an immutable {@link List} from the
* [`immutable` package](https://immutable-js.com/).
*/
get numeratorUnits(): List<string>;
/**
* This number's denominator units as an immutable {@link List} from the
* [`immutable` package](https://immutable-js.com/).
*/
get denominatorUnits(): List<string>;
/** Whether this number has any numerator or denominator units. */
get hasUnits(): boolean;
/**
* If {@link value} is an integer according to {@link isInt}, returns it
* rounded to that integer. Otherwise, throws an error.
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*/
assertInt(name?: string): number;
/**
* Returns {@link value} if it's within `min` and `max`. If {@link value} is
* equal to `min` or `max` according to Sass's equality, returns `min` or
* `max` respectively. Otherwise, throws an error.
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*/
assertInRange(min: number, max: number, name?: string): number;
/**
* If this number has no units, returns it. Otherwise, throws an error.
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*/
assertNoUnits(name?: string): SassNumber;
/**
* If this number has `unit` as its only unit (and as a numerator), returns
* this number. Otherwise, throws an error.
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*/
assertUnit(unit: string, name?: string): SassNumber;
/** Whether this number has `unit` as its only unit (and as a numerator). */
hasUnit(unit: string): boolean;
/**
* Whether this has exactly one numerator unit, and that unit is compatible
* with `unit`.
*/
compatibleWithUnit(unit: string): boolean;
/**
* Returns a copy of this number, converted to the units represented by
* `newNumerators` and `newDenominators`.
*
* @throws `Error` if this number's units are incompatible with
* `newNumerators` and `newDenominators`; or if this number is unitless and
* either `newNumerators` or `newDenominators` are not empty, or vice-versa.
*
* @param newNumerators - The numerator units to convert this number to. This
* may be either a plain JavaScript array or an immutable {@link List} from
* the [`immutable` package](https://immutable-js.com/).
*
* @param newDenominators - The denominator units to convert this number to.
* This may be either a plain JavaScript array or an immutable {@link List}
* from the [`immutable` package](https://immutable-js.com/).
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*/
convert(
newNumerators: string[] | List<string>,
newDenominators: string[] | List<string>,
name?: string
): SassNumber;
/**
* Returns a copy of this number, converted to the same units as `other`.
*
* @throws `Error` if this number's units are incompatible with `other`'s
* units, or if either number is unitless but the other is not.
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*
* @param otherName - The name of the function argument `other` came from
* (without the `$`) if it came from an argument. Used for error reporting.
*/
convertToMatch(
other: SassNumber,
name?: string,
otherName?: string
): SassNumber;
/**
* Returns {@link value}, converted to the units represented by
* `newNumerators` and `newDenominators`.
*
* @throws `Error` if this number's units are incompatible with
* `newNumerators` and `newDenominators`; or if this number is unitless and
* either `newNumerators` or `newDenominators` are not empty, or vice-versa.
*
* @param newNumerators - The numerator units to convert {@link value} to.
* This may be either a plain JavaScript array or an immutable {@link List}
* from the [`immutable` package](https://immutable-js.com/).
*
* @param newDenominators - The denominator units to convert {@link value} to.
* This may be either a plain JavaScript array or an immutable {@link List}
* from the [`immutable` package](https://immutable-js.com/).
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*/
convertValue(
newNumerators: string[] | List<string>,
newDenominators: string[] | List<string>,
name?: string
): number;
/**
* Returns {@link value}, converted to the same units as `other`.
*
* @throws `Error` if this number's units are incompatible with `other`'s
* units, or if either number is unitless but the other is not.
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*
* @param otherName - The name of the function argument `other` came from
* (without the `$`) if it came from an argument. Used for error reporting.
*/
convertValueToMatch(
other: SassNumber,
name?: string,
otherName?: string
): number;
/**
* Returns a copy of this number, converted to the units represented by
* `newNumerators` and `newDenominators`.
*
* Unlike {@link convert} this does *not* throw an error if this number is
* unitless and either `newNumerators` or `newDenominators` are not empty, or
* vice-versa. Instead, it treats all unitless numbers as convertible to and
* from all units without changing the value.
*
* @throws `Error` if this number's units are incompatible with
* `newNumerators` and `newDenominators`.
*
* @param newNumerators - The numerator units to convert this number to. This
* may be either a plain JavaScript array or an immutable {@link List} from
* the [`immutable` package](https://immutable-js.com/).
*
* @param newDenominators - The denominator units to convert this number to.
* This may be either a plain JavaScript array or an immutable {@link List}
* from the [`immutable` package](https://immutable-js.com/).
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*/
coerce(
newNumerators: string[] | List<string>,
newDenominators: string[] | List<string>,
name?: string
): SassNumber;
/**
* Returns a copy of this number, converted to the units represented by
* `newNumerators` and `newDenominators`.
*
* Unlike {@link convertToMatch} this does *not* throw an error if this number
* is unitless and either `newNumerators` or `newDenominators` are not empty,
* or vice-versa. Instead, it treats all unitless numbers as convertible to
* and from all units without changing the value.
*
* @throws `Error` if this number's units are incompatible with `other`'s
* units.
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*
* @param otherName - The name of the function argument `other` came from
* (without the `$`) if it came from an argument. Used for error reporting.
*/
coerceToMatch(
other: SassNumber,
name?: string,
otherName?: string
): SassNumber;
/**
* Returns {@link value}, converted to the units represented by
* `newNumerators` and `newDenominators`.
*
* Unlike {@link convertValue} this does *not* throw an error if this number
* is unitless and either `newNumerators` or `newDenominators` are not empty,
* or vice-versa. Instead, it treats all unitless numbers as convertible to
* and from all units without changing the value.
*
* @throws `Error` if this number's units are incompatible with
* `newNumerators` and `newDenominators`.
*
* @param newNumerators - The numerator units to convert {@link value} to.
* This may be either a plain JavaScript array or an immutable {@link List}
* from the [`immutable` package](https://immutable-js.com/).
*
* @param newDenominators - The denominator units to convert {@link value} to.
* This may be either a plain JavaScript array or an immutable {@link List}
* from the [`immutable` package](https://immutable-js.com/).
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*/
coerceValue(
newNumerators: string[] | List<string>,
newDenominators: string[] | List<string>,
name?: string
): number;
/**
* Returns {@link value}, converted to the units represented by
* `newNumerators` and `newDenominators`.
*
* Unlike {@link convertValueToMatch} this does *not* throw an error if this
* number is unitless and either `newNumerators` or `newDenominators` are not
* empty, or vice-versa. Instead, it treats all unitless numbers as
* convertible to and from all units without changing the value.
*
* @throws `Error` if this number's units are incompatible with `other`'s
* units.
*
* @param name - The name of the function argument `this` came from (without
* the `$`) if it came from an argument. Used for error reporting.
*
* @param otherName - The name of the function argument `other` came from
* (without the `$`) if it came from an argument. Used for error reporting.
*/
coerceValueToMatch(
other: SassNumber,
name?: string,
otherName?: string
): number;
}
@@ -0,0 +1,3 @@
var Y=Object.defineProperty;var k=(A,E)=>Y(A,"name",{value:E,configurable:!0});var L;(function(A){A[A.Static=1]="Static",A[A.Dynamic=2]="Dynamic",A[A.ImportMeta=3]="ImportMeta",A[A.StaticSourcePhase=4]="StaticSourcePhase",A[A.DynamicSourcePhase=5]="DynamicSourcePhase"})(L||(L={}));const R=new Uint8Array(new Uint16Array([1]).buffer)[0]===1;function F(A,E="@"){if(!Q)return G.then(()=>F(A));const g=A.length+1,B=(Q.__heap_base.value||Q.__heap_base)+4*g-Q.memory.buffer.byteLength;B>0&&Q.memory.grow(Math.ceil(B/65536));const s=Q.sa(g-1);if((R?c:r)(A,new Uint16Array(Q.memory.buffer,s,g)),!Q.parse())throw Object.assign(new Error(`Parse error ${E}:${A.slice(0,Q.e()).split(`
`).length}:${Q.e()-A.lastIndexOf(`
`,Q.e()-1)}`),{idx:Q.e()});const U=[],t=[];for(;Q.ri();){const C=Q.is(),I=Q.ie(),D=Q.it(),i=Q.ai(),w=Q.id(),J=Q.ss(),K=Q.se();let o;Q.ip()&&(o=N(A.slice(w===-1?C-1:C,w===-1?I+1:I))),U.push({n:o,t:D,s:C,e:I,ss:J,se:K,d:w,a:i})}for(;Q.re();){const C=Q.es(),I=Q.ee(),D=Q.els(),i=Q.ele(),w=A.slice(C,I),J=w[0],K=D<0?void 0:A.slice(D,i),o=K?K[0]:"";t.push({s:C,e:I,ls:D,le:i,n:J==='"'||J==="'"?N(w):w,ln:o==='"'||o==="'"?N(K):K})}function N(C){try{return(0,eval)(C)}catch{}}return k(N,"k"),[U,t,!!Q.f(),!!Q.ms()]}k(F,"parse");function r(A,E){const g=A.length;let B=0;for(;B<g;){const s=A.charCodeAt(B);E[B++]=(255&s)<<8|s>>>8}}k(r,"Q");function c(A,E){const g=A.length;let B=0;for(;B<g;)E[B]=A.charCodeAt(B++)}k(c,"B");let Q;const G=WebAssembly.compile((a="AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gA39/fwADMTAAAQECAgICAgICAgICAgICAgICAgIAAwMDBAQAAAUAAAAAAAMDAwAGAAAABwAGAgUEBQFwAQEBBQMBAAEGDwJ/AUHA8gALfwBBwPIACwd6FQZtZW1vcnkCAAJzYQAAAWUAAwJpcwAEAmllAAUCc3MABgJzZQAHAml0AAgCYWkACQJpZAAKAmlwAAsCZXMADAJlZQANA2VscwAOA2VsZQAPAnJpABACcmUAEQFmABICbXMAEwVwYXJzZQAUC19faGVhcF9iYXNlAwEKm0EwaAEBf0EAIAA2AoAKQQAoAtwJIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgKECkEAIAA2AogKQQBBADYC4AlBAEEANgLwCUEAQQA2AugJQQBBADYC5AlBAEEANgL4CUEAQQA2AuwJIAEL0wEBA39BACgC8AkhBEEAQQAoAogKIgU2AvAJQQAgBDYC9AlBACAFQSRqNgKICiAEQSBqQeAJIAQbIAU2AgBBACgC1AkhBEEAKALQCSEGIAUgATYCACAFIAA2AgggBSACIAJBAmpBACAGIANGIgAbIAQgA0YiBBs2AgwgBSADNgIUIAVBADYCECAFIAI2AgQgBUEANgIgIAVBA0EBQQIgABsgBBs2AhwgBUEAKALQCSADRiICOgAYAkACQCACDQBBACgC1AkgA0cNAQtBAEEBOgCMCgsLXgEBf0EAKAL4CSIEQRBqQeQJIAQbQQAoAogKIgQ2AgBBACAENgL4CUEAIARBFGo2AogKQQBBAToAjAogBEEANgIQIAQgAzYCDCAEIAI2AgggBCABNgIEIAQgADYCAAsIAEEAKAKQCgsVAEEAKALoCSgCAEEAKALcCWtBAXULHgEBf0EAKALoCSgCBCIAQQAoAtwJa0EBdUF/IAAbCxUAQQAoAugJKAIIQQAoAtwJa0EBdQseAQF/QQAoAugJKAIMIgBBACgC3AlrQQF1QX8gABsLCwBBACgC6AkoAhwLHgEBf0EAKALoCSgCECIAQQAoAtwJa0EBdUF/IAAbCzsBAX8CQEEAKALoCSgCFCIAQQAoAtAJRw0AQX8PCwJAIABBACgC1AlHDQBBfg8LIABBACgC3AlrQQF1CwsAQQAoAugJLQAYCxUAQQAoAuwJKAIAQQAoAtwJa0EBdQsVAEEAKALsCSgCBEEAKALcCWtBAXULHgEBf0EAKALsCSgCCCIAQQAoAtwJa0EBdUF/IAAbCx4BAX9BACgC7AkoAgwiAEEAKALcCWtBAXVBfyAAGwslAQF/QQBBACgC6AkiAEEgakHgCSAAGygCACIANgLoCSAAQQBHCyUBAX9BAEEAKALsCSIAQRBqQeQJIAAbKAIAIgA2AuwJIABBAEcLCABBAC0AlAoLCABBAC0AjAoL3Q0BBX8jAEGA0ABrIgAkAEEAQQE6AJQKQQBBACgC2Ak2ApwKQQBBACgC3AlBfmoiATYCsApBACABQQAoAoAKQQF0aiICNgK0CkEAQQA6AIwKQQBBADsBlgpBAEEAOwGYCkEAQQA6AKAKQQBBADYCkApBAEEAOgD8CUEAIABBgBBqNgKkCkEAIAA2AqgKQQBBADoArAoCQAJAAkACQANAQQAgAUECaiIDNgKwCiABIAJPDQECQCADLwEAIgJBd2pBBUkNAAJAAkACQAJAAkAgAkGbf2oOBQEICAgCAAsgAkEgRg0EIAJBL0YNAyACQTtGDQIMBwtBAC8BmAoNASADEBVFDQEgAUEEakGCCEEKEC8NARAWQQAtAJQKDQFBAEEAKAKwCiIBNgKcCgwHCyADEBVFDQAgAUEEakGMCEEKEC8NABAXC0EAQQAoArAKNgKcCgwBCwJAIAEvAQQiA0EqRg0AIANBL0cNBBAYDAELQQEQGQtBACgCtAohAkEAKAKwCiEBDAALC0EAIQIgAyEBQQAtAPwJDQIMAQtBACABNgKwCkEAQQA6AJQKCwNAQQAgAUECaiIDNgKwCgJAAkACQAJAAkACQAJAIAFBACgCtApPDQAgAy8BACICQXdqQQVJDQYCQAJAAkACQAJAAkACQAJAAkACQCACQWBqDgoQDwYPDw8PBQECAAsCQAJAAkACQCACQaB/ag4KCxISAxIBEhISAgALIAJBhX9qDgMFEQYJC0EALwGYCg0QIAMQFUUNECABQQRqQYIIQQoQLw0QEBYMEAsgAxAVRQ0PIAFBBGpBjAhBChAvDQ8QFwwPCyADEBVFDQ4gASkABELsgISDsI7AOVINDiABLwEMIgNBd2oiAUEXSw0MQQEgAXRBn4CABHFFDQwMDQtBAEEALwGYCiIBQQFqOwGYCkEAKAKkCiABQQN0aiIBQQE2AgAgAUEAKAKcCjYCBAwNC0EALwGYCiIDRQ0JQQAgA0F/aiIDOwGYCkEALwGWCiICRQ0MQQAoAqQKIANB//8DcUEDdGooAgBBBUcNDAJAIAJBAnRBACgCqApqQXxqKAIAIgMoAgQNACADQQAoApwKQQJqNgIEC0EAIAJBf2o7AZYKIAMgAUEEajYCDAwMCwJAQQAoApwKIgEvAQBBKUcNAEEAKALwCSIDRQ0AIAMoAgQgAUcNAEEAQQAoAvQJIgM2AvAJAkAgA0UNACADQQA2AiAMAQtBAEEANgLgCQtBAEEALwGYCiIDQQFqOwGYCkEAKAKkCiADQQN0aiIDQQZBAkEALQCsChs2AgAgAyABNgIEQQBBADoArAoMCwtBAC8BmAoiAUUNB0EAIAFBf2oiATsBmApBACgCpAogAUH//wNxQQN0aigCAEEERg0EDAoLQScQGgwJC0EiEBoMCAsgAkEvRw0HAkACQCABLwEEIgFBKkYNACABQS9HDQEQGAwKC0EBEBkMCQsCQAJAAkACQEEAKAKcCiIBLwEAIgMQG0UNAAJAAkAgA0FVag4EAAkBAwkLIAFBfmovAQBBK0YNAwwICyABQX5qLwEAQS1GDQIMBwsgA0EpRw0BQQAoAqQKQQAvAZgKIgJBA3RqKAIEEBxFDQIMBgsgAUF+ai8BAEFQakH//wNxQQpPDQULQQAvAZgKIQILAkACQCACQf//A3EiAkUNACADQeYARw0AQQAoAqQKIAJBf2pBA3RqIgQoAgBBAUcNACABQX5qLwEAQe8ARw0BIAQoAgRBlghBAxAdRQ0BDAULIANB/QBHDQBBACgCpAogAkEDdGoiAigCBBAeDQQgAigCAEEGRg0ECyABEB8NAyADRQ0DIANBL0ZBAC0AoApBAEdxDQMCQEEAKAL4CSICRQ0AIAEgAigCAEkNACABIAIoAgRNDQQLIAFBfmohAUEAKALcCSECAkADQCABQQJqIgQgAk0NAUEAIAE2ApwKIAEvAQAhAyABQX5qIgQhASADECBFDQALIARBAmohBAsCQCADQf//A3EQIUUNACAEQX5qIQECQANAIAFBAmoiAyACTQ0BQQAgATYCnAogAS8BACEDIAFBfmoiBCEBIAMQIQ0ACyAEQQJqIQMLIAMQIg0EC0EAQQE6AKAKDAcLQQAoAqQKQQAvAZgKIgFBA3QiA2pBACgCnAo2AgRBACABQQFqOwGYCkEAKAKkCiADakEDNgIACxAjDAULQQAtAPwJQQAvAZYKQQAvAZgKcnJFIQIMBwsQJEEAQQA6AKAKDAMLECVBACECDAULIANBoAFHDQELQQBBAToArAoLQQBBACgCsAo2ApwKC0EAKAKwCiEBDAALCyAAQYDQAGokACACCxoAAkBBACgC3AkgAEcNAEEBDwsgAEF+ahAmC/4KAQZ/QQBBACgCsAoiAEEMaiIBNgKwCkEAKAL4CSECQQEQKSEDAkACQAJAAkACQAJAAkACQAJAQQAoArAKIgQgAUcNACADEChFDQELAkACQAJAAkACQAJAAkAgA0EqRg0AIANB+wBHDQFBACAEQQJqNgKwCkEBECkhA0EAKAKwCiEEA0ACQAJAIANB//8DcSIDQSJGDQAgA0EnRg0AIAMQLBpBACgCsAohAwwBCyADEBpBAEEAKAKwCkECaiIDNgKwCgtBARApGgJAIAQgAxAtIgNBLEcNAEEAQQAoArAKQQJqNgKwCkEBECkhAwsgA0H9AEYNA0EAKAKwCiIFIARGDQ8gBSEEIAVBACgCtApNDQAMDwsLQQAgBEECajYCsApBARApGkELine truncated
@@ -0,0 +1,825 @@
# minipass
A _very_ minimal implementation of a [PassThrough
stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough)
[It's very
fast](https://docs.google.com/spreadsheets/d/1K_HR5oh3r80b8WVMWCPPjfuWXUgfkmhlX7FGI6JJ8tY/edit?usp=sharing)
for objects, strings, and buffers.
Supports `pipe()`ing (including multi-`pipe()` and backpressure
transmission), buffering data until either a `data` event handler
or `pipe()` is added (so you don't lose the first chunk), and
most other cases where PassThrough is a good idea.
There is a `read()` method, but it's much more efficient to
consume data from this stream via `'data'` events or by calling
`pipe()` into some other stream. Calling `read()` requires the
buffer to be flattened in some cases, which requires copying
memory.
If you set `objectMode: true` in the options, then whatever is
written will be emitted. Otherwise, it'll do a minimal amount of
Buffer copying to ensure proper Streams semantics when `read(n)`
is called.
`objectMode` can only be set at instantiation. Attempting to
write something other than a String or Buffer without having set
`objectMode` in the options will throw an error.
This is not a `through` or `through2` stream. It doesn't
transform the data, it just passes it right through. If you want
to transform the data, extend the class, and override the
`write()` method. Once you're done transforming the data however
you want, call `super.write()` with the transform output.
For some examples of streams that extend Minipass in various
ways, check out:
- [minizlib](http://npm.im/minizlib)
- [fs-minipass](http://npm.im/fs-minipass)
- [tar](http://npm.im/tar)
- [minipass-collect](http://npm.im/minipass-collect)
- [minipass-flush](http://npm.im/minipass-flush)
- [minipass-pipeline](http://npm.im/minipass-pipeline)
- [tap](http://npm.im/tap)
- [tap-parser](http://npm.im/tap-parser)
- [treport](http://npm.im/treport)
- [minipass-fetch](http://npm.im/minipass-fetch)
- [pacote](http://npm.im/pacote)
- [make-fetch-happen](http://npm.im/make-fetch-happen)
- [cacache](http://npm.im/cacache)
- [ssri](http://npm.im/ssri)
- [npm-registry-fetch](http://npm.im/npm-registry-fetch)
- [minipass-json-stream](http://npm.im/minipass-json-stream)
- [minipass-sized](http://npm.im/minipass-sized)
## Usage in TypeScript
The `Minipass` class takes three type template definitions:
- `RType` the type being read, which defaults to `Buffer`. If
`RType` is `string`, then the constructor _must_ get an options
object specifying either an `encoding` or `objectMode: true`.
If it's anything other than `string` or `Buffer`, then it
_must_ get an options object specifying `objectMode: true`.
- `WType` the type being written. If `RType` is `Buffer` or
`string`, then this defaults to `ContiguousData` (Buffer,
string, ArrayBuffer, or ArrayBufferView). Otherwise, it
defaults to `RType`.
- `Events` type mapping event names to the arguments emitted
with that event, which extends `Minipass.Events`.
To declare types for custom events in subclasses, extend the
third parameter with your own event signatures. For example:
```js
import { Minipass } from 'minipass'
// a NDJSON stream that emits 'jsonError' when it can't stringify
export interface Events extends Minipass.Events {
jsonError: [e: Error]
}
export class NDJSONStream extends Minipass<string, any, Events> {
constructor() {
super({ objectMode: true })
}
// data is type `any` because that's WType
write(data, encoding, cb) {
try {
const json = JSON.stringify(data)
return super.write(json + '\n', encoding, cb)
} catch (er) {
if (!er instanceof Error) {
er = Object.assign(new Error('json stringify failed'), {
cause: er,
})
}
// trying to emit with something OTHER than an error will
// fail, because we declared the event arguments type.
this.emit('jsonError', er)
}
}
}
const s = new NDJSONStream()
s.on('jsonError', e => {
// here, TS knows that e is an Error
})
```
Emitting/handling events that aren't declared in this way is
fine, but the arguments will be typed as `unknown`.
## Differences from Node.js Streams
There are several things that make Minipass streams different
from (and in some ways superior to) Node.js core streams.
Please read these caveats if you are familiar with node-core
streams and intend to use Minipass streams in your programs.
You can avoid most of these differences entirely (for a very
small performance penalty) by setting `{async: true}` in the
constructor options.
### Timing
Minipass streams are designed to support synchronous use-cases.
Thus, data is emitted as soon as it is available, always. It is
buffered until read, but no longer. Another way to look at it is
that Minipass streams are exactly as synchronous as the logic
that writes into them.
This can be surprising if your code relies on
`PassThrough.write()` always providing data on the next tick
rather than the current one, or being able to call `resume()` and
not have the entire buffer disappear immediately.
However, without this synchronicity guarantee, there would be no
way for Minipass to achieve the speeds it does, or support the
synchronous use cases that it does. Simply put, waiting takes
time.
This non-deferring approach makes Minipass streams much easier to
reason about, especially in the context of Promises and other
flow-control mechanisms.
Example:
```js
// hybrid module, either works
import { Minipass } from 'minipass'
// or:
const { Minipass } = require('minipass')
const stream = new Minipass()
stream.on('data', () => console.log('data event'))
console.log('before write')
stream.write('hello')
console.log('after write')
// output:
// before write
// data event
// after write
```
### Exception: Async Opt-In
If you wish to have a Minipass stream with behavior that more
closely mimics Node.js core streams, you can set the stream in
async mode either by setting `async: true` in the constructor
options, or by setting `stream.async = true` later on.
```js
// hybrid module, either works
import { Minipass } from 'minipass'
// or:
const { Minipass } = require('minipass')
const asyncStream = new Minipass({ async: true })
asyncStream.on('data', () => console.log('data event'))
console.log('before write')
asyncStream.write('hello')
console.log('after write')
// output:
// before write
// after write
// data event <-- this is deferred until the next tick
```
Switching _out_ of async mode is unsafe, as it could cause data
corruption, and so is not enabled. Example:
```js
import { Minipass } from 'minipass'
const stream = new Minipass({ encoding: 'utf8' })
stream.on('data', chunk => console.log(chunk))
stream.async = true
console.log('before writes')
stream.write('hello')
setStreamSyncAgainSomehow(stream) // <-- this doesn't actually exist!
stream.write('world')
console.log('after writes')
// hypothetical output would be:
// before writes
// world
// after writes
// hello
// NOT GOOD!
```
To avoid this problem, once set into async mode, any attempt to
make the stream sync again will be ignored.
```js
const { Minipass } = require('minipass')
const stream = new Minipass({ encoding: 'utf8' })
stream.on('data', chunk => console.log(chunk))
stream.async = true
console.log('before writes')
stream.write('hello')
stream.async = false // <-- no-op, stream already async
stream.write('world')
console.log('after writes')
// actual output:
// before writes
// after writes
// hello
// world
```
### No High/Low Water Marks
Node.js core streams will optimistically fill up a buffer,
returning `true` on all writes until the limit is hit, even if
the data has nowhere to go. Then, they will not attempt to draw
more data in until the buffer size dips below a minimum value.
Minipass streams are much simpler. The `write()` method will
return `true` if the data has somewhere to go (which is to say,
given the timing guarantees, that the data is already there by
the time `write()` returns).
If the data has nowhere to go, then `write()` returns false, and
the data sits in a buffer, to be drained out immediately as soon
as anyone consumes it.
Since nothing is ever buffered unnecessarily, there is much less
copying data, and less bookkeeping about buffer capacity levels.
### Hazards of Buffering (or: Why Minipass Is So Fast)
Since data written to a Minipass stream is immediately written
all the way through the pipeline, and `write()` always returns
true/false based on whether the data was fully flushed,
backpressure is communicated immediately to the upstream caller.
This minimizes buffering.
Consider this case:
```js
const { PassThrough } = require('stream')
const p1 = new PassThrough({ highWaterMark: 1024 })
const p2 = new PassThrough({ highWaterMark: 1024 })
const p3 = new PassThrough({ highWaterMark: 1024 })
const p4 = new PassThrough({ highWaterMark: 1024 })
p1.pipe(p2).pipe(p3).pipe(p4)
p4.on('data', () => console.log('made it through'))
// this returns false and buffers, then writes to p2 on next tick (1)
// p2 returns false and buffers, pausing p1, then writes to p3 on next tick (2)
// p3 returns false and buffers, pausing p2, then writes to p4 on next tick (3)
// p4 returns false and buffers, pausing p3, then emits 'data' and 'drain'
// on next tick (4)
// p3 sees p4's 'drain' event, and calls resume(), emitting 'resume' and
// 'drain' on next tick (5)
// p2 sees p3's 'drain', calls resume(), emits 'resume' and 'drain' on next tick (6)
// p1 sees p2's 'drain', calls resume(), emits 'resume' and 'drain' on next
// tick (7)
p1.write(Buffer.alloc(2048)) // returns false
```
Along the way, the data was buffered and deferred at each stage,
and multiple event deferrals happened, for an unblocked pipeline
where it was perfectly safe to write all the way through!
Furthermore, setting a `highWaterMark` of `1024` might lead
someone reading the code to think an advisory maximum of 1KiB is
being set for the pipeline. However, the actual advisory
buffering level is the _sum_ of `highWaterMark` values, since
each one has its own bucket.
Consider the Minipass case:
```js
const m1 = new Minipass()
const m2 = new Minipass()
const m3 = new Minipass()
const m4 = new Minipass()
m1.pipe(m2).pipe(m3).pipe(m4)
m4.on('data', () => console.log('made it through'))
// m1 is flowing, so it writes the data to m2 immediately
// m2 is flowing, so it writes the data to m3 immediately
// m3 is flowing, so it writes the data to m4 immediately
// m4 is flowing, so it fires the 'data' event immediately, returns true
// m4's write returned true, so m3 is still flowing, returns true
// m3's write returned true, so m2 is still flowing, returns true
// m2's write returned true, so m1 is still flowing, returns true
// No event deferrals or buffering along the way!
m1.write(Buffer.alloc(2048)) // returns true
```
It is extremely unlikely that you _don't_ want to buffer any data
written, or _ever_ buffer data that can be flushed all the way
through. Neither node-core streams nor Minipass ever fail to
buffer written data, but node-core streams do a lot of
unnecessary buffering and pausing.
As always, the faster implementation is the one that does less
stuff and waits less time to do it.
### Immediately emit `end` for empty streams (when not paused)
If a stream is not paused, and `end()` is called before writing
any data into it, then it will emit `end` immediately.
If you have logic that occurs on the `end` event which you don't
want to potentially happen immediately (for example, closing file
descriptors, moving on to the next entry in an archive parse
stream, etc.) then be sure to call `stream.pause()` on creation,
and then `stream.resume()` once you are ready to respond to the
`end` event.
However, this is _usually_ not a problem because:
### Emit `end` When Asked
One hazard of immediately emitting `'end'` is that you may not
yet have had a chance to add a listener. In order to avoid this
hazard, Minipass streams safely re-emit the `'end'` event if a
new listener is added after `'end'` has been emitted.
Ie, if you do `stream.on('end', someFunction)`, and the stream
has already emitted `end`, then it will call the handler right
away. (You can think of this somewhat like attaching a new
`.then(fn)` to a previously-resolved Promise.)
To prevent calling handlers multiple times who would not expect
multiple ends to occur, all listeners are removed from the
`'end'` event whenever it is emitted.
### Emit `error` When Asked
The most recent error object passed to the `'error'` event is
stored on the stream. If a new `'error'` event handler is added,
and an error was previously emitted, then the event handler will
be called immediately (or on `process.nextTick` in the case of
async streams).
This makes it much more difficult to end up trying to interact
with a broken stream, if the error handler is added after an
error was previously emitted.
### Impact of "immediate flow" on Tee-streams
A "tee stream" is a stream piping to multiple destinations:
```js
const tee = new Minipass()
t.pipe(dest1)
t.pipe(dest2)
t.write('foo') // goes to both destinations
```
Since Minipass streams _immediately_ process any pending data
through the pipeline when a new pipe destination is added, this
can have surprising effects, especially when a stream comes in
from some other function and may or may not have data in its
buffer.
```js
// WARNING! WILL LOSE DATA!
const src = new Minipass()
src.write('foo')
src.pipe(dest1) // 'foo' chunk flows to dest1 immediately, and is gone
src.pipe(dest2) // gets nothing!
```
One solution is to create a dedicated tee-stream junction that
pipes to both locations, and then pipe to _that_ instead.
```js
// Safe example: tee to both places
const src = new Minipass()
src.write('foo')
const tee = new Minipass()
tee.pipe(dest1)
tee.pipe(dest2)
src.pipe(tee) // tee gets 'foo', pipes to both locations
```
The same caveat applies to `on('data')` event listeners. The
first one added will _immediately_ receive all of the data,
leaving nothing for the second:
```js
// WARNING! WILL LOSE DATA!
const src = new Minipass()
src.write('foo')
src.on('data', handler1) // receives 'foo' right away
src.on('data', handler2) // nothing to see here!
```
Using a dedicated tee-stream can be used in this case as well:
```js
// Safe example: tee to both data handlers
const src = new Minipass()
src.write('foo')
const tee = new Minipass()
tee.on('data', handler1)
tee.on('data', handler2)
src.pipe(tee)
```
All of the hazards in this section are avoided by setting `{
async: true }` in the Minipass constructor, or by setting
`stream.async = true` afterwards. Note that this does add some
overhead, so should only be done in cases where you are willing
to lose a bit of performance in order to avoid having to refactor
program logic.
## USAGE
It's a stream! Use it like a stream and it'll most likely do what
you want.
```js
import { Minipass } from 'minipass'
const mp = new Minipass(options) // options is optional
mp.write('foo')
mp.pipe(someOtherStream)
mp.end('bar')
```
### OPTIONS
- `encoding` How would you like the data coming _out_ of the
stream to be encoded? Accepts any values that can be passed to
`Buffer.toString()`.
- `objectMode` Emit data exactly as it comes in. This will be
flipped on by default if you write() something other than a
string or Buffer at any point. Setting `objectMode: true` will
prevent setting any encoding value.
- `async` Defaults to `false`. Set to `true` to defer data
emission until next tick. This reduces performance slightly,
but makes Minipass streams use timing behavior closer to Node
core streams. See [Timing](#timing) for more details.
- `signal` An `AbortSignal` that will cause the stream to unhook
itself from everything and become as inert as possible. Note
that providing a `signal` parameter will make `'error'` events
no longer throw if they are unhandled, but they will still be
emitted to handlers if any are attached.
### API
Implements the user-facing portions of Node.js's `Readable` and
`Writable` streams.
### Methods
- `write(chunk, [encoding], [callback])` - Put data in. (Note
that, in the base Minipass class, the same data will come out.)
Returns `false` if the stream will buffer the next write, or
true if it's still in "flowing" mode.
- `end([chunk, [encoding]], [callback])` - Signal that you have
no more data to write. This will queue an `end` event to be
fired when all the data has been consumed.
- `pause()` - No more data for a while, please. This also
prevents `end` from being emitted for empty streams until the
stream is resumed.
- `resume()` - Resume the stream. If there's data in the buffer,
it is all discarded. Any buffered events are immediately
emitted.
- `pipe(dest)` - Send all output to the stream provided. When
data is emitted, it is immediately written to any and all pipe
destinations. (Or written on next tick in `async` mode.)
- `unpipe(dest)` - Stop piping to the destination stream. This is
immediate, meaning that any asynchronously queued data will
_not_ make it to the destination when running in `async` mode.
- `options.end` - Boolean, end the destination stream when the
source stream ends. Default `true`.
- `options.proxyErrors` - Boolean, proxy `error` events from
the source stream to the destination stream. Note that errors
are _not_ proxied after the pipeline terminates, either due
to the source emitting `'end'` or manually unpiping with
`src.unpipe(dest)`. Default `false`.
- `on(ev, fn)`, `emit(ev, fn)` - Minipass streams are
EventEmitters. Some events are given special treatment,
however. (See below under "events".)
- `promise()` - Returns a Promise that resolves when the stream
emits `end`, or rejects if the stream emits `error`.
- `collect()` - Return a Promise that resolves on `end` with an
array containing each chunk of data that was emitted, or
rejects if the stream emits `error`. Note that this consumes
the stream data.
- `concat()` - Same as `collect()`, but concatenates the data
into a single Buffer object. Will reject the returned promise
if the stream is in objectMode, or if it goes into objectMode
by the end of the data.
- `read(n)` - Consume `n` bytes of data out of the buffer. If `n`
is not provided, then consume all of it. If `n` bytes are not
available, then it returns null. **Note** consuming streams in
this way is less efficient, and can lead to unnecessary Buffer
copying.
- `destroy([er])` - Destroy the stream. If an error is provided,
then an `'error'` event is emitted. If the stream has a
`close()` method, and has not emitted a `'close'` event yet,
then `stream.close()` will be called. Any Promises returned by
`.promise()`, `.collect()` or `.concat()` will be rejected.
After being destroyed, writing to the stream will emit an
error. No more data will be emitted if the stream is destroyed,
even if it was previously buffered.
### Properties
- `bufferLength` Read-only. Total number of bytes buffered, or in
the case of objectMode, the total number of objects.
- `encoding` Read-only. The encoding that has been set.
- `flowing` Read-only. Boolean indicating whether a chunk written
to the stream will be immediately emitted.
- `emittedEnd` Read-only. Boolean indicating whether the end-ish
events (ie, `end`, `prefinish`, `finish`) have been emitted.
Note that listening on any end-ish event will immediateyl
re-emit it if it has already been emitted.
- `writable` Whether the stream is writable. Default `true`. Set
to `false` when `end()`
- `readable` Whether the stream is readable. Default `true`.
- `pipes` An array of Pipe objects referencing streams that this
stream is piping into.
- `destroyed` A getter that indicates whether the stream was
destroyed.
- `paused` True if the stream has been explicitly paused,
otherwise false.
- `objectMode` Indicates whether the stream is in `objectMode`.
- `aborted` Readonly property set when the `AbortSignal`
dispatches an `abort` event.
### Events
- `data` Emitted when there's data to read. Argument is the data
to read. This is never emitted while not flowing. If a listener
is attached, that will resume the stream.
- `end` Emitted when there's no more data to read. This will be
emitted immediately for empty streams when `end()` is called.
If a listener is attached, and `end` was already emitted, then
it will be emitted again. All listeners are removed when `end`
is emitted.
- `prefinish` An end-ish event that follows the same logic as
`end` and is emitted in the same conditions where `end` is
emitted. Emitted after `'end'`.
- `finish` An end-ish event that follows the same logic as `end`
and is emitted in the same conditions where `end` is emitted.
Emitted after `'prefinish'`.
- `close` An indication that an underlying resource has been
released. Minipass does not emit this event, but will defer it
until after `end` has been emitted, since it throws off some
stream libraries otherwise.
- `drain` Emitted when the internal buffer empties, and it is
again suitable to `write()` into the stream.
- `readable` Emitted when data is buffered and ready to be read
by a consumer.
- `resume` Emitted when stream changes state from buffering to
flowing mode. (Ie, when `resume` is called, `pipe` is called,
or a `data` event listener is added.)
### Static Methods
- `Minipass.isStream(stream)` Returns `true` if the argument is a
stream, and false otherwise. To be considered a stream, the
object must be either an instance of Minipass, or an
EventEmitter that has either a `pipe()` method, or both
`write()` and `end()` methods. (Pretty much any stream in
node-land will return `true` for this.)
## EXAMPLES
Here are some examples of things you can do with Minipass
streams.
### simple "are you done yet" promise
```js
mp.promise().then(
() => {
// stream is finished
},
er => {
// stream emitted an error
}
)
```
### collecting
```js
mp.collect().then(all => {
// all is an array of all the data emitted
// encoding is supported in this case, so
// so the result will be a collection of strings if
// an encoding is specified, or buffers/objects if not.
//
// In an async function, you may do
// const data = await stream.collect()
})
```
### collecting into a single blob
This is a bit slower because it concatenates the data into one
chunk for you, but if you're going to do it yourself anyway, it's
convenient this way:
```js
mp.concat().then(onebigchunk => {
// onebigchunk is a string if the stream
// had an encoding set, or a buffer otherwise.
})
```
### iteration
You can iterate over streams synchronously or asynchronously in
platforms that support it.
Synchronous iteration will end when the currently available data
is consumed, even if the `end` event has not been reached. In
string and buffer mode, the data is concatenated, so unless
multiple writes are occurring in the same tick as the `read()`,
sync iteration loops will generally only have a single iteration.
To consume chunks in this way exactly as they have been written,
with no flattening, create the stream with the `{ objectMode:
true }` option.
```js
const mp = new Minipass({ objectMode: true })
mp.write('a')
mp.write('b')
for (let letter of mp) {
console.log(letter) // a, b
}
mp.write('c')
mp.write('d')
for (let letter of mp) {
console.log(letter) // c, d
}
mp.write('e')
mp.end()
for (let letter of mp) {
console.log(letter) // e
}
for (let letter of mp) {
console.log(letter) // nothing
}
```
Asynchronous iteration will continue until the end event is reached,
consuming all of the data.
```js
const mp = new Minipass({ encoding: 'utf8' })
// some source of some data
let i = 5
const inter = setInterval(() => {
if (i-- > 0) mp.write(Buffer.from('foo\n', 'utf8'))
else {
mp.end()
clearInterval(inter)
}
}, 100)
// consume the data with asynchronous iteration
async function consume() {
for await (let chunk of mp) {
console.log(chunk)
}
return 'ok'
}
consume().then(res => console.log(res))
// logs `foo\n` 5 times, and then `ok`
```
### subclass that `console.log()`s everything written into it
```js
class Logger extends Minipass {
write(chunk, encoding, callback) {
console.log('WRITE', chunk, encoding)
return super.write(chunk, encoding, callback)
}
end(chunk, encoding, callback) {
console.log('END', chunk, encoding)
return super.end(chunk, encoding, callback)
}
}
someSource.pipe(new Logger()).pipe(someDest)
```
### same thing, but using an inline anonymous class
```js
// js classes are fun
someSource
.pipe(
new (class extends Minipass {
emit(ev, ...data) {
// let's also log events, because debugging some weird thing
console.log('EMIT', ev)
return super.emit(ev, ...data)
}
write(chunk, encoding, callback) {
console.log('WRITE', chunk, encoding)
return super.write(chunk, encoding, callback)
}
end(chunk, encoding, callback) {
console.log('END', chunk, encoding)
return super.end(chunk, encoding, callback)
}
})()
)
.pipe(someDest)
```
### subclass that defers 'end' for some reason
```js
class SlowEnd extends Minipass {
emit(ev, ...args) {
if (ev === 'end') {
console.log('going to end, hold on a sec')
setTimeout(() => {
console.log('ok, ready to end now')
super.emit('end', ...args)
}, 100)
return true
} else {
return super.emit(ev, ...args)
}
}
}
```
### transform that creates newline-delimited JSON
```js
class NDJSONEncode extends Minipass {
write(obj, cb) {
try {
// JSON.stringify can throw, emit an error on that
return super.write(JSON.stringify(obj) + '\n', 'utf8', cb)
} catch (er) {
this.emit('error', er)
}
}
end(obj, cb) {
if (typeof obj === 'function') {
cb = obj
obj = undefined
}
if (obj !== undefined) {
this.write(obj)
}
return super.end(cb)
}
}
```
### transform that parses newline-delimited JSON
```js
class NDJSONDecode extends Minipass {
constructor(options) {
// always be in object mode, as far as Minipass is concerned
super({ objectMode: true })
this._jsonBuffer = ''
}
write(chunk, encoding, cb) {
if (
typeof chunk === 'string' &&
typeof encoding === 'string' &&
encoding !== 'utf8'
) {
chunk = Buffer.from(chunk, encoding).toString()
} else if (Buffer.isBuffer(chunk)) {
chunk = chunk.toString()
}
if (typeof encoding === 'function') {
cb = encoding
}
const jsonData = (this._jsonBuffer + chunk).split('\n')
this._jsonBuffer = jsonData.pop()
for (let i = 0; i < jsonData.length; i++) {
try {
// JSON.parse can throw, emit an error on that
super.write(JSON.parse(jsonData[i]))
} catch (er) {
this.emit('error', er)
continue
}
}
if (cb) cb()
}
}
```
@@ -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 CalendarX = createLucideIcon("CalendarX", [
["path", { d: "M8 2v4", key: "1cmpym" }],
["path", { d: "M16 2v4", key: "4m81vk" }],
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
["path", { d: "M3 10h18", key: "8toen8" }],
["path", { d: "m14 14-4 4", key: "rymu2i" }],
["path", { d: "m10 14 4 4", key: "3sz06r" }]
]);
export { CalendarX as default };
//# sourceMappingURL=calendar-x.js.map
@@ -0,0 +1 @@
{"version":3,"file":"is-keyframes-target.mjs","sources":["../../../../src/render/utils/is-keyframes-target.ts"],"sourcesContent":["import type { UnresolvedValueKeyframe, ValueKeyframesDefinition } from \"../../animation/types\"\n\nexport const isKeyframesTarget = (\n v: ValueKeyframesDefinition\n): v is UnresolvedValueKeyframe[] => {\n return Array.isArray(v)\n}\n"],"names":[],"mappings":"AAEO,MAAM,iBAAiB,GAAG,CAC7B,CAA2B,KACK;AAChC,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAC3B;;;;"}
@@ -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 MapPin = createLucideIcon("MapPin", [
[
"path",
{
d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",
key: "1r0f0z"
}
],
["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }]
]);
export { MapPin as default };
//# sourceMappingURL=map-pin.js.map
@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = is;
var _shallowEqual = require("../utils/shallowEqual.js");
var _isType = require("./isType.js");
var _isPlaceholderType = require("./isPlaceholderType.js");
var _index = require("../definitions/index.js");
function is(type, node, opts) {
if (!node) return false;
const matches = (0, _isType.default)(node.type, type);
if (!matches) {
if (!opts && node.type === "Placeholder" && type in _index.FLIPPED_ALIAS_KEYS) {
return (0, _isPlaceholderType.default)(node.expectedNode, type);
}
return false;
}
if (opts === undefined) {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
//# sourceMappingURL=is.js.map
@@ -0,0 +1,88 @@
import { clamp } from 'motion-utils';
import { time } from '../frameloop/sync-time.mjs';
import { setStyle } from '../render/dom/style-set.mjs';
import { JSAnimation } from './JSAnimation.mjs';
import { NativeAnimation } from './NativeAnimation.mjs';
import { replaceTransitionType } from './utils/replace-transition-type.mjs';
import { replaceStringEasing } from './waapi/utils/unsupported-easing.mjs';
/**
* 10ms is chosen here as it strikes a balance between smooth
* results (more than one keyframe per frame at 60fps) and
* keyframe quantity.
*/
const sampleDelta = 10; //ms
class NativeAnimationExtended extends NativeAnimation {
constructor(options) {
/**
* The base NativeAnimation function only supports a subset
* of Motion easings, and WAAPI also only supports some
* easing functions via string/cubic-bezier definitions.
*
* This function replaces those unsupported easing functions
* with a JS easing function. This will later get compiled
* to a linear() easing function.
*/
replaceStringEasing(options);
/**
* Ensure we replace the transition type with a generator function
* before passing to WAAPI.
*
* TODO: Does this have a better home? It could be shared with
* JSAnimation.
*/
replaceTransitionType(options);
super(options);
/**
* Only set startTime when the animation should autoplay.
* Setting startTime on a paused WAAPI animation unpauses it
* (per the WAAPI spec), which breaks autoplay: false.
*/
if (options.startTime !== undefined && options.autoplay !== false) {
this.startTime = options.startTime;
}
this.options = options;
}
/**
* WAAPI doesn't natively have any interruption capabilities.
*
* Rather than read committed styles back out of the DOM, we can
* create a renderless JS animation and sample it twice to calculate
* its current value, "previous" value, and therefore allow
* Motion to calculate velocity for any subsequent animation.
*/
updateMotionValue(value) {
const { motionValue, onUpdate, onComplete, element, ...options } = this.options;
if (!motionValue)
return;
if (value !== undefined) {
motionValue.set(value);
return;
}
const sampleAnimation = new JSAnimation({
...options,
autoplay: false,
});
/**
* Use wall-clock elapsed time for sampling.
* Under CPU load, WAAPI's currentTime may not reflect actual
* elapsed time, causing incorrect sampling and visual jumps.
*/
const sampleTime = Math.max(sampleDelta, time.now() - this.startTime);
const delta = clamp(0, sampleDelta, sampleTime - sampleDelta);
const current = sampleAnimation.sample(sampleTime).value;
/**
* Write the estimated value to inline style so it persists
* after cancel(), covering the async gap before the next
* animation starts.
*/
const { name } = this.options;
if (element && name)
setStyle(element, name, current);
motionValue.setWithVelocity(sampleAnimation.sample(Math.max(0, sampleTime - delta)).value, current, delta);
sampleAnimation.stop();
}
}
export { NativeAnimationExtended };
//# sourceMappingURL=NativeAnimationExtended.mjs.map
@@ -0,0 +1,102 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeModifiers = exports.Modifiers = exports.MetaSelectors = exports.Selectors = exports.UnderscoreOptions = exports.PredefinedFormats = void 0;
var PredefinedFormats;
(function (PredefinedFormats) {
PredefinedFormats[PredefinedFormats["camelCase"] = 1] = "camelCase";
PredefinedFormats[PredefinedFormats["strictCamelCase"] = 2] = "strictCamelCase";
PredefinedFormats[PredefinedFormats["PascalCase"] = 3] = "PascalCase";
PredefinedFormats[PredefinedFormats["StrictPascalCase"] = 4] = "StrictPascalCase";
PredefinedFormats[PredefinedFormats["snake_case"] = 5] = "snake_case";
PredefinedFormats[PredefinedFormats["UPPER_CASE"] = 6] = "UPPER_CASE";
})(PredefinedFormats || (exports.PredefinedFormats = PredefinedFormats = {}));
var UnderscoreOptions;
(function (UnderscoreOptions) {
UnderscoreOptions[UnderscoreOptions["forbid"] = 1] = "forbid";
UnderscoreOptions[UnderscoreOptions["allow"] = 2] = "allow";
UnderscoreOptions[UnderscoreOptions["require"] = 3] = "require";
// special cases as it's common practice to use double underscore
UnderscoreOptions[UnderscoreOptions["requireDouble"] = 4] = "requireDouble";
UnderscoreOptions[UnderscoreOptions["allowDouble"] = 5] = "allowDouble";
UnderscoreOptions[UnderscoreOptions["allowSingleOrDouble"] = 6] = "allowSingleOrDouble";
})(UnderscoreOptions || (exports.UnderscoreOptions = UnderscoreOptions = {}));
var Selectors;
(function (Selectors) {
// variableLike
Selectors[Selectors["variable"] = 1] = "variable";
Selectors[Selectors["function"] = 2] = "function";
Selectors[Selectors["parameter"] = 4] = "parameter";
// memberLike
Selectors[Selectors["parameterProperty"] = 8] = "parameterProperty";
Selectors[Selectors["classicAccessor"] = 16] = "classicAccessor";
Selectors[Selectors["enumMember"] = 32] = "enumMember";
Selectors[Selectors["classMethod"] = 64] = "classMethod";
Selectors[Selectors["objectLiteralMethod"] = 128] = "objectLiteralMethod";
Selectors[Selectors["typeMethod"] = 256] = "typeMethod";
Selectors[Selectors["classProperty"] = 512] = "classProperty";
Selectors[Selectors["objectLiteralProperty"] = 1024] = "objectLiteralProperty";
Selectors[Selectors["typeProperty"] = 2048] = "typeProperty";
Selectors[Selectors["autoAccessor"] = 4096] = "autoAccessor";
// typeLike
Selectors[Selectors["class"] = 8192] = "class";
Selectors[Selectors["interface"] = 16384] = "interface";
Selectors[Selectors["typeAlias"] = 32768] = "typeAlias";
Selectors[Selectors["enum"] = 65536] = "enum";
Selectors[Selectors["typeParameter"] = 131072] = "typeParameter";
// other
Selectors[Selectors["import"] = 262144] = "import";
})(Selectors || (exports.Selectors = Selectors = {}));
var MetaSelectors;
(function (MetaSelectors) {
/* eslint-disable @typescript-eslint/prefer-literal-enum-member */
MetaSelectors[MetaSelectors["default"] = -1] = "default";
MetaSelectors[MetaSelectors["variableLike"] = 7] = "variableLike";
MetaSelectors[MetaSelectors["memberLike"] = 8184] = "memberLike";
MetaSelectors[MetaSelectors["typeLike"] = 253952] = "typeLike";
MetaSelectors[MetaSelectors["method"] = 448] = "method";
MetaSelectors[MetaSelectors["property"] = 3584] = "property";
MetaSelectors[MetaSelectors["accessor"] = 4112] = "accessor";
/* eslint-enable @typescript-eslint/prefer-literal-enum-member */
})(MetaSelectors || (exports.MetaSelectors = MetaSelectors = {}));
var Modifiers;
(function (Modifiers) {
// const variable
Modifiers[Modifiers["const"] = 1] = "const";
// readonly members
Modifiers[Modifiers["readonly"] = 2] = "readonly";
// static members
Modifiers[Modifiers["static"] = 4] = "static";
// member accessibility
Modifiers[Modifiers["public"] = 8] = "public";
Modifiers[Modifiers["protected"] = 16] = "protected";
Modifiers[Modifiers["private"] = 32] = "private";
Modifiers[Modifiers["#private"] = 64] = "#private";
Modifiers[Modifiers["abstract"] = 128] = "abstract";
// destructured variable
Modifiers[Modifiers["destructured"] = 256] = "destructured";
// variables declared in the top-level scope
Modifiers[Modifiers["global"] = 512] = "global";
// things that are exported
Modifiers[Modifiers["exported"] = 1024] = "exported";
// things that are unused
Modifiers[Modifiers["unused"] = 2048] = "unused";
// properties that require quoting
Modifiers[Modifiers["requiresQuotes"] = 4096] = "requiresQuotes";
// class members that are overridden
Modifiers[Modifiers["override"] = 8192] = "override";
// class methods, object function properties, or functions that are async via the `async` keyword
Modifiers[Modifiers["async"] = 16384] = "async";
// default imports
Modifiers[Modifiers["default"] = 32768] = "default";
// namespace imports
Modifiers[Modifiers["namespace"] = 65536] = "namespace";
// make sure TypeModifiers starts at Modifiers + 1 or else sorting won't work
})(Modifiers || (exports.Modifiers = Modifiers = {}));
var TypeModifiers;
(function (TypeModifiers) {
TypeModifiers[TypeModifiers["boolean"] = 131072] = "boolean";
TypeModifiers[TypeModifiers["string"] = 262144] = "string";
TypeModifiers[TypeModifiers["number"] = 524288] = "number";
TypeModifiers[TypeModifiers["function"] = 1048576] = "function";
TypeModifiers[TypeModifiers["array"] = 2097152] = "array";
})(TypeModifiers || (exports.TypeModifiers = TypeModifiers = {}));
@@ -0,0 +1,7 @@
"use strict";
const format = require("date-manip/dist/format");
const DEFAULT_FORMATTER = "HH:mm:ss.SSSZ";
function basicLogPrefix(event, dateFormat) {
return `[${format(event.timestamp, dateFormat || DEFAULT_FORMATTER)}] [${event.levelName}] [${event.loggerName}] -`;
}
module.exports = basicLogPrefix;
@@ -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 SquareArrowUpLeft = createLucideIcon("SquareArrowUpLeft", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "M8 16V8h8", key: "19xb1h" }],
["path", { d: "M16 16 8 8", key: "1qdy8n" }]
]);
export { SquareArrowUpLeft as default };
//# sourceMappingURL=square-arrow-up-left.js.map
@@ -0,0 +1,83 @@
const {transform} = require("../dist");
// Enum constants taken from the TypeScript codebase.
const ModuleKindCommonJS = 1;
const JsxEmitReactJSX = 4;
const JsxEmitReactJSXDev = 5;
/**
* ts-node transpiler plugin
*
* This plugin hooks into ts-node so that Sucrase can handle all TS-to-JS
* conversion while ts-node handles the ESM loader, require hook, REPL
* integration, etc. ts-node automatically discovers the relevant tsconfig file,
* so the main logic in this integration is translating tsconfig options to the
* corresponding Sucrase options.
*
* Any tsconfig options relevant to Sucrase are translated, but some config
* options outside the scope of Sucrase are ignored. For example, we assume the
* isolatedModules option, and we ignore target because Sucrase doesn't provide
* JS syntax downleveling (at least not in a way that is useful for Node).
*
* One notable caveat is that importsNotUsedAsValues and preserveValueImports
* are ignored right now, since they are deprecated and don't have exact Sucrase
* equivalents. To preserve imports and exports, use verbatimModuleSyntax.
*/
function create(createOptions) {
const {nodeModuleEmitKind} = createOptions;
const {
module,
jsx,
jsxFactory,
jsxFragmentFactory,
jsxImportSource,
esModuleInterop,
verbatimModuleSyntax,
} = createOptions.service.config.options;
return {
transpile(input, transpileOptions) {
const {fileName} = transpileOptions;
const transforms = [];
// Detect JS rather than TS so we bias toward including the typescript
// transform, since almost always it doesn't hurt to include.
const isJS =
fileName.endsWith(".js") ||
fileName.endsWith(".jsx") ||
fileName.endsWith(".mjs") ||
fileName.endsWith(".cjs");
if (!isJS) {
transforms.push("typescript");
}
if (module === ModuleKindCommonJS || nodeModuleEmitKind === "nodecjs") {
transforms.push("imports");
}
if (fileName.endsWith(".tsx") || fileName.endsWith(".jsx")) {
transforms.push("jsx");
}
const {code, sourceMap} = transform(input, {
transforms,
disableESTransforms: true,
jsxRuntime: jsx === JsxEmitReactJSX || jsx === JsxEmitReactJSXDev ? "automatic" : "classic",
production: jsx === JsxEmitReactJSX,
jsxImportSource,
jsxPragma: jsxFactory,
jsxFragmentPragma: jsxFragmentFactory,
keepUnusedImports: verbatimModuleSyntax,
preserveDynamicImport: nodeModuleEmitKind === "nodecjs",
injectCreateRequireForImportRequire: nodeModuleEmitKind === "nodeesm",
enableLegacyTypeScriptModuleInterop: !esModuleInterop,
sourceMapOptions: {compiledFilename: fileName},
filePath: fileName,
});
return {
outputText: code,
sourceMapText: JSON.stringify(sourceMap),
};
},
};
}
exports.create = create;
@@ -0,0 +1,170 @@
/**
* Experimental server task features for MCP SDK.
* WARNING: These APIs are experimental and may change without notice.
*
* @experimental
*/
import type { Server } from '../../server/index.js';
import type { RequestOptions } from '../../shared/protocol.js';
import type { ResponseMessage } from '../../shared/responseMessage.js';
import type { AnySchema, SchemaOutput } from '../../server/zod-compat.js';
import type { ServerRequest, Notification, Request, Result, GetTaskResult, ListTasksResult, CancelTaskResult, CreateMessageRequestParams, CreateMessageResult, ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult } from '../../types.js';
/**
* Experimental task features for low-level MCP servers.
*
* Access via `server.experimental.tasks`:
* ```typescript
* const stream = server.experimental.tasks.requestStream(request, schema, options);
* ```
*
* For high-level server usage with task-based tools, use `McpServer.experimental.tasks` instead.
*
* @experimental
*/
export declare class ExperimentalServerTasks<RequestT extends Request = Request, NotificationT extends Notification = Notification, ResultT extends Result = Result> {
private readonly _server;
constructor(_server: Server<RequestT, NotificationT, ResultT>);
/**
* Sends a request and returns an AsyncGenerator that yields response messages.
* The generator is guaranteed to end with either a 'result' or 'error' message.
*
* This method provides streaming access to request processing, allowing you to
* observe intermediate task status updates for task-augmented requests.
*
* @param request - The request to send
* @param resultSchema - Zod schema for validating the result
* @param options - Optional request options (timeout, signal, task creation params, etc.)
* @returns AsyncGenerator that yields ResponseMessage objects
*
* @experimental
*/
requestStream<T extends AnySchema>(request: ServerRequest | RequestT, resultSchema: T, options?: RequestOptions): AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>;
/**
* Sends a sampling request and returns an AsyncGenerator that yields response messages.
* The generator is guaranteed to end with either a 'result' or 'error' message.
*
* For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
* before the final result.
*
* @example
* ```typescript
* const stream = server.experimental.tasks.createMessageStream({
* messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
* maxTokens: 100
* }, {
* onprogress: (progress) => {
* // Handle streaming tokens via progress notifications
* console.log('Progress:', progress.message);
* }
* });
*
* for await (const message of stream) {
* switch (message.type) {
* case 'taskCreated':
* console.log('Task created:', message.task.taskId);
* break;
* case 'taskStatus':
* console.log('Task status:', message.task.status);
* break;
* case 'result':
* console.log('Final result:', message.result);
* break;
* case 'error':
* console.error('Error:', message.error);
* break;
* }
* }
* ```
*
* @param params - The sampling request parameters
* @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
* @returns AsyncGenerator that yields ResponseMessage objects
*
* @experimental
*/
createMessageStream(params: CreateMessageRequestParams, options?: RequestOptions): AsyncGenerator<ResponseMessage<CreateMessageResult>, void, void>;
/**
* Sends an elicitation request and returns an AsyncGenerator that yields response messages.
* The generator is guaranteed to end with either a 'result' or 'error' message.
*
* For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
* and 'taskStatus' messages before the final result.
*
* @example
* ```typescript
* const stream = server.experimental.tasks.elicitInputStream({
* mode: 'url',
* message: 'Please authenticate',
* elicitationId: 'auth-123',
* url: 'https://example.com/auth'
* }, {
* task: { ttl: 300000 } // Task-augmented for long-running auth flow
* });
*
* for await (const message of stream) {
* switch (message.type) {
* case 'taskCreated':
* console.log('Task created:', message.task.taskId);
* break;
* case 'taskStatus':
* console.log('Task status:', message.task.status);
* break;
* case 'result':
* console.log('User action:', message.result.action);
* break;
* case 'error':
* console.error('Error:', message.error);
* break;
* }
* }
* ```
*
* @param params - The elicitation request parameters
* @param options - Optional request options (timeout, signal, task creation params, etc.)
* @returns AsyncGenerator that yields ResponseMessage objects
*
* @experimental
*/
elicitInputStream(params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions): AsyncGenerator<ResponseMessage<ElicitResult>, void, void>;
/**
* Gets the current status of a task.
*
* @param taskId - The task identifier
* @param options - Optional request options
* @returns The task status
*
* @experimental
*/
getTask(taskId: string, options?: RequestOptions): Promise<GetTaskResult>;
/**
* Retrieves the result of a completed task.
*
* @param taskId - The task identifier
* @param resultSchema - Zod schema for validating the result
* @param options - Optional request options
* @returns The task result
*
* @experimental
*/
getTaskResult<T extends AnySchema>(taskId: string, resultSchema?: T, options?: RequestOptions): Promise<SchemaOutput<T>>;
/**
* Lists tasks with optional pagination.
*
* @param cursor - Optional pagination cursor
* @param options - Optional request options
* @returns List of tasks with optional next cursor
*
* @experimental
*/
listTasks(cursor?: string, options?: RequestOptions): Promise<ListTasksResult>;
/**
* Cancels a running task.
*
* @param taskId - The task identifier
* @param options - Optional request options
*
* @experimental
*/
cancelTask(taskId: string, options?: RequestOptions): Promise<CancelTaskResult>;
}
//# sourceMappingURL=server.d.ts.map
@@ -0,0 +1,26 @@
import ReactDOMServer from "react-dom/server";
//#region src/ssr/renderRouterToString.tsx
var renderRouterToString = async ({ router, responseHeaders, children }) => {
try {
let html = ReactDOMServer.renderToString(children);
router.serverSsr.setRenderFinished();
const injectedHtml = router.serverSsr.takeBufferedHtml();
if (injectedHtml) html = html.replace(`</body>`, () => `${injectedHtml}</body>`);
return new Response(`<!DOCTYPE html>${html}`, {
status: router.stores.statusCode.get(),
headers: responseHeaders
});
} catch (error) {
console.error("Render to string error:", error);
return new Response("Internal Server Error", {
status: 500,
headers: responseHeaders
});
} finally {
router.serverSsr?.cleanup();
}
};
//#endregion
export { renderRouterToString };
//# sourceMappingURL=renderRouterToString.js.map
@@ -0,0 +1,61 @@
"use strict";
"use client";
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, {
Label: () => Label,
Root: () => Root
});
module.exports = __toCommonJS(index_exports);
// src/label.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 = "Label";
var Label = React.forwardRef((props, forwardedRef) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.label,
{
...props,
ref: forwardedRef,
onMouseDown: (event) => {
const target = event.target;
if (target.closest("button, input, select, textarea")) return;
props.onMouseDown?.(event);
if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
}
}
);
});
Label.displayName = NAME;
var Root = Label;
//# sourceMappingURL=index.js.map
@@ -0,0 +1,309 @@
import * as core from "./core.js";
import * as errors from "./errors.js";
import type * as schemas from "./schemas.js";
import * as util from "./util.js";
export type $ZodErrorClass = { new (issues: errors.$ZodIssue[]): errors.$ZodError };
type $ParseParams = { callee?: util.AnyFunc; Err?: $ZodErrorClass | undefined };
// Always both keys, so the `_params` read site in `_parse` sees one object shape rather than two.
function finalizeParams(callee: util.AnyFunc, params: $ParseParams | undefined): $ParseParams {
return { callee: params?.callee ?? callee, Err: params?.Err };
}
/////////// METHODS ///////////
export type $Parse = <T extends schemas.$ZodType>(
schema: T,
value: unknown,
_ctx?: schemas.ParseContext<errors.$ZodIssue>,
_params?: $ParseParams
) => core.output<T>;
export const _parse: (_Err: $ZodErrorClass) => $Parse = (_Err) => {
const fn: $Parse = (schema, value, _ctx, _params) => {
const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: false } : { async: false };
const result = schema._zod.run({ value, issues: [] }, ctx);
if (result instanceof Promise) {
throw new core.$ZodAsyncError();
}
if (result.issues.length) {
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
util.captureStackTrace(e, _params?.callee ?? fn);
throw e;
}
return result.value as core.output<typeof schema>;
};
return fn;
};
export const parse: $Parse = /* @__PURE__*/ _parse(errors.$ZodRealError);
export type $ParseAsync = <T extends schemas.$ZodType>(
schema: T,
value: unknown,
_ctx?: schemas.ParseContext<errors.$ZodIssue>,
_params?: $ParseParams
) => Promise<core.output<T>>;
export const _parseAsync: (_Err: $ZodErrorClass) => $ParseAsync = (_Err) => {
const fn: $ParseAsync = async (schema, value, _ctx, params) => {
const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: true } : { async: true };
let result = schema._zod.run({ value, issues: [] }, ctx);
if (result instanceof Promise) result = await result;
if (result.issues.length) {
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
util.captureStackTrace(e, params?.callee ?? fn);
throw e;
}
return result.value as core.output<typeof schema>;
};
return fn;
};
export const parseAsync: $ParseAsync = /* @__PURE__*/ _parseAsync(errors.$ZodRealError);
export type $SafeParse = <T extends schemas.$ZodType>(
schema: T,
value: unknown,
_ctx?: schemas.ParseContext<errors.$ZodIssue>
) => util.SafeParseResult<core.output<T>>;
export const _safeParse: (_Err: $ZodErrorClass) => $SafeParse = (_Err) => (schema, value, _ctx) => {
const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: false } : { async: false };
const result = schema._zod.run({ value, issues: [] }, ctx);
if (result instanceof Promise) {
throw new core.$ZodAsyncError();
}
return result.issues.length ? failure(_Err, result.issues, ctx) : ({ success: true, data: result.value } as any);
};
export const safeParse: $SafeParse = /* @__PURE__*/ _safeParse(errors.$ZodRealError);
// the error is built on the first read of `error`: finalizing the issues and constructing the instance is most of a failing parse, and a caller that only branches on `success` never pays it. a getter in the literal keeps this small; the alternative, one shared accessor descriptor plus a hidden state slot, reads ~15% faster but costs ~75 B gzipped in every bundle
function failure(Err: $ZodErrorClass, issues: errors.$ZodRawIssue[], ctx: schemas.ParseContextInternal): any {
let error: errors.$ZodError | undefined;
return {
success: false,
get error() {
if (!error) {
error = new Err(issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
// finalizeIssue drops `input`, so the built error holds nothing; keeping the raw issues past this point pins the parsed value for the life of the result
issues = undefined as any;
ctx = undefined as any;
}
return error;
},
set error(e: errors.$ZodError) {
error = e;
// a replacement makes the getter's branch unreachable, so the captures have to go here too
issues = undefined as any;
ctx = undefined as any;
},
};
}
export type $SafeParseAsync = <T extends schemas.$ZodType>(
schema: T,
value: unknown,
_ctx?: schemas.ParseContext<errors.$ZodIssue>
) => Promise<util.SafeParseResult<core.output<T>>>;
export const _safeParseAsync: (_Err: $ZodErrorClass) => $SafeParseAsync = (_Err) => async (schema, value, _ctx) => {
const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: true } : { async: true };
let result = schema._zod.run({ value, issues: [] }, ctx);
if (result instanceof Promise) result = await result;
return result.issues.length ? failure(_Err, result.issues, ctx) : ({ success: true, data: result.value } as any);
};
export const safeParseAsync: $SafeParseAsync = /* @__PURE__*/ _safeParseAsync(errors.$ZodRealError);
// registry mirrors of the compiler's sentinels, so this module never imports the compiler
const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
interface CompiledBag {
validator?: ((input: unknown) => unknown) & { definite?: boolean | undefined };
fallbackRun?: (payload: schemas.ParsePayload, ctx: schemas.ParseContextInternal) => unknown;
}
export type $Validate = <T extends schemas.$ZodType>(
schema: T,
value: unknown,
_ctx?: schemas.ParseContext<errors.$ZodIssue>
) => value is core.input<T>;
// Deliberately tiny, because v8 will not inline a body carrying the fallback's object literals and throw. Everything that is not the compiled happy path lives in validateFallback, and that split is worth ~35% on a compiled schema.
export const validate: $Validate = ((
schema: schemas.$ZodType,
value: unknown,
_ctx?: schemas.ParseContext<errors.$ZodIssue>
): boolean => {
const validator = (schema._zod.bag as CompiledBag).validator;
if (validator !== undefined) {
if (validator(value) !== COMPILE_INVALID) return true;
// a definite sentinel means the runtime would reject, so skip the re-parse; a ctx can still change the answer
if (validator.definite === true && _ctx === undefined) return false;
}
return validateFallback(schema, value, _ctx);
}) as $Validate;
function validateFallback(
schema: schemas.$ZodType,
value: unknown,
_ctx?: schemas.ParseContext<errors.$ZodIssue>
): boolean {
const ctx: schemas.ParseContextInternal = _ctx
? { ..._ctx, async: false, abortEarly: true }
: { async: false, abortEarly: true };
const fallbackRun = (schema._zod.bag as CompiledBag).fallbackRun;
let result: unknown;
if (fallbackRun) {
// skip nested fast paths on the fallback, so user callbacks keep the at-most-twice bound
(ctx as Record<symbol, unknown>)[COMPILE_FALLBACK] = true;
result = fallbackRun({ value, issues: [] }, ctx);
} else {
result = schema._zod.run({ value, issues: [] }, ctx);
}
if (result instanceof Promise) {
throw new core.$ZodAsyncError();
}
return (result as schemas.ParsePayload).issues.length === 0;
}
export type $ValidateAsync = <T extends schemas.$ZodType>(
schema: T,
value: unknown,
_ctx?: schemas.ParseContext<errors.$ZodIssue>
) => Promise<boolean>;
// no fast path: the compiler keeps async parses on the runtime, because a promise-returning callback that is not declared async compiles to a throw
export const validateAsync: $ValidateAsync = async (schema, value, _ctx) => {
const ctx: schemas.ParseContextInternal = _ctx
? { ..._ctx, async: true, abortEarly: true }
: { async: true, abortEarly: true };
let result: unknown = schema._zod.run({ value, issues: [] }, ctx);
if (result instanceof Promise) result = await result;
return (result as schemas.ParsePayload).issues.length === 0;
};
// Codec functions
export type $Encode = <T extends schemas.$ZodType>(
schema: T,
value: core.output<T>,
_ctx?: schemas.ParseContext<errors.$ZodIssue>,
_params?: $ParseParams
) => core.input<T>;
export const _encode: (_Err: $ZodErrorClass) => $Encode = (_Err) => {
const parse = _parse(_Err);
const fn: $Encode = (schema, value, _ctx, _params) => {
const ctx = _ctx ? { ..._ctx, direction: "backward" as const } : { direction: "backward" as const };
return parse(schema, value, ctx as any, finalizeParams(fn, _params)) as any;
};
return fn;
};
export const encode: $Encode = /* @__PURE__*/ _encode(errors.$ZodRealError);
export type $Decode = <T extends schemas.$ZodType>(
schema: T,
value: core.input<T>,
_ctx?: schemas.ParseContext<errors.$ZodIssue>,
_params?: $ParseParams
) => core.output<T>;
export const _decode: (_Err: $ZodErrorClass) => $Decode = (_Err) => {
const parse = _parse(_Err);
const fn: $Decode = (schema, value, _ctx, _params) => {
return parse(schema, value, _ctx, finalizeParams(fn, _params));
};
return fn;
};
export const decode: $Decode = /* @__PURE__*/ _decode(errors.$ZodRealError);
export type $EncodeAsync = <T extends schemas.$ZodType>(
schema: T,
value: core.output<T>,
_ctx?: schemas.ParseContext<errors.$ZodIssue>,
_params?: $ParseParams
) => Promise<core.input<T>>;
export const _encodeAsync: (_Err: $ZodErrorClass) => $EncodeAsync = (_Err) => {
const parseAsync = _parseAsync(_Err);
const fn: $EncodeAsync = async (schema, value, _ctx, _params) => {
const ctx = _ctx ? { ..._ctx, direction: "backward" as const } : { direction: "backward" as const };
return (await parseAsync(schema, value, ctx as any, finalizeParams(fn, _params))) as any;
};
return fn;
};
export const encodeAsync: $EncodeAsync = /* @__PURE__*/ _encodeAsync(errors.$ZodRealError);
export type $DecodeAsync = <T extends schemas.$ZodType>(
schema: T,
value: core.input<T>,
_ctx?: schemas.ParseContext<errors.$ZodIssue>,
_params?: $ParseParams
) => Promise<core.output<T>>;
export const _decodeAsync: (_Err: $ZodErrorClass) => $DecodeAsync = (_Err) => {
const parseAsync = _parseAsync(_Err);
const fn: $DecodeAsync = async (schema, value, _ctx, _params) => {
return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
};
return fn;
};
export const decodeAsync: $DecodeAsync = /* @__PURE__*/ _decodeAsync(errors.$ZodRealError);
export type $SafeEncode = <T extends schemas.$ZodType>(
schema: T,
value: core.output<T>,
_ctx?: schemas.ParseContext<errors.$ZodIssue>
) => util.SafeParseResult<core.input<T>>;
export const _safeEncode: (_Err: $ZodErrorClass) => $SafeEncode = (_Err) => (schema, value, _ctx) => {
const ctx = _ctx ? { ..._ctx, direction: "backward" as const } : { direction: "backward" as const };
return _safeParse(_Err)(schema, value, ctx as any) as any;
};
export const safeEncode: $SafeEncode = /* @__PURE__*/ _safeEncode(errors.$ZodRealError);
export type $SafeDecode = <T extends schemas.$ZodType>(
schema: T,
value: core.input<T>,
_ctx?: schemas.ParseContext<errors.$ZodIssue>
) => util.SafeParseResult<core.output<T>>;
export const _safeDecode: (_Err: $ZodErrorClass) => $SafeDecode = (_Err) => (schema, value, _ctx) => {
return _safeParse(_Err)(schema, value, _ctx);
};
export const safeDecode: $SafeDecode = /* @__PURE__*/ _safeDecode(errors.$ZodRealError);
export type $SafeEncodeAsync = <T extends schemas.$ZodType>(
schema: T,
value: core.output<T>,
_ctx?: schemas.ParseContext<errors.$ZodIssue>
) => Promise<util.SafeParseResult<core.input<T>>>;
export const _safeEncodeAsync: (_Err: $ZodErrorClass) => $SafeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
const ctx = _ctx ? { ..._ctx, direction: "backward" as const } : { direction: "backward" as const };
return _safeParseAsync(_Err)(schema, value, ctx as any) as any;
};
export const safeEncodeAsync: $SafeEncodeAsync = /* @__PURE__*/ _safeEncodeAsync(errors.$ZodRealError);
export type $SafeDecodeAsync = <T extends schemas.$ZodType>(
schema: T,
value: core.input<T>,
_ctx?: schemas.ParseContext<errors.$ZodIssue>
) => Promise<util.SafeParseResult<core.output<T>>>;
export const _safeDecodeAsync: (_Err: $ZodErrorClass) => $SafeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
return _safeParseAsync(_Err)(schema, value, _ctx);
};
export const safeDecodeAsync: $SafeDecodeAsync = /* @__PURE__*/ _safeDecodeAsync(errors.$ZodRealError);
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Emil Kowalski
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,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 MonitorDot = createLucideIcon("MonitorDot", [
["circle", { cx: "19", cy: "6", r: "3", key: "108a5v" }],
["path", { d: "M22 12v3a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9", key: "1fet9y" }],
["path", { d: "M12 17v4", key: "1riwvh" }],
["path", { d: "M8 21h8", key: "1ev6f3" }]
]);
export { MonitorDot as default };
//# sourceMappingURL=monitor-dot.js.map
@@ -0,0 +1,34 @@
const keyboardAccessibleElements = new Set([
"BUTTON",
"INPUT",
"SELECT",
"TEXTAREA",
"A",
]);
/**
* Checks if an element is natively keyboard accessible (focusable).
* Used by the press gesture to determine if we need to add tabIndex.
*/
function isElementKeyboardAccessible(element) {
return (keyboardAccessibleElements.has(element.tagName) ||
element.isContentEditable === true);
}
const textInputElements = new Set(["INPUT", "SELECT", "TEXTAREA"]);
/**
* Checks if an element has text selection or direct interaction behavior
* that should block drag gestures from starting.
*
* This specifically targets form controls where the user might want to select
* text or interact with the control (e.g., sliders, dropdowns).
*
* Buttons and links are NOT included because they don't have click-and-move
* actions of their own - they only respond to click events, so dragging
* should still work when initiated from these elements.
*/
function isElementTextInput(element) {
return (textInputElements.has(element.tagName) ||
element.isContentEditable === true);
}
export { isElementKeyboardAccessible, isElementTextInput };
//# sourceMappingURL=is-keyboard-accessible.mjs.map
@@ -0,0 +1,21 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"func-name-matching": 0,
"indent": [2, 4],
"no-new-func": [1],
},
"overrides": [
{
"files": "test/**",
"rules": {
"max-lines-per-function": 0,
"strict": [0]
},
},
],
}