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,71 @@
// Interface declaration for Float16Array, required in @types/node v24+.
// These definitions are specific to TS <=5.6.
// This needs all of the "common" properties/methods of the TypedArrays,
// otherwise the type unions `TypedArray` and `ArrayBufferView` will be
// empty objects.
interface Float16Array extends Pick<Float32Array, typeof Symbol.iterator | "entries" | "keys" | "values"> {
readonly BYTES_PER_ELEMENT: number;
readonly buffer: ArrayBufferLike;
readonly byteLength: number;
readonly byteOffset: number;
readonly length: number;
readonly [Symbol.toStringTag]: "Float16Array";
at(index: number): number | undefined;
copyWithin(target: number, start: number, end?: number): this;
every(predicate: (value: number, index: number, array: Float16Array) => unknown, thisArg?: any): boolean;
fill(value: number, start?: number, end?: number): this;
filter(predicate: (value: number, index: number, array: Float16Array) => any, thisArg?: any): Float16Array;
find(predicate: (value: number, index: number, obj: Float16Array) => boolean, thisArg?: any): number | undefined;
findIndex(predicate: (value: number, index: number, obj: Float16Array) => boolean, thisArg?: any): number;
findLast<S extends number>(
predicate: (value: number, index: number, array: Float16Array) => value is S,
thisArg?: any,
): S | undefined;
findLast(
predicate: (value: number, index: number, array: Float16Array) => unknown,
thisArg?: any,
): number | undefined;
findLastIndex(predicate: (value: number, index: number, array: Float16Array) => unknown, thisArg?: any): number;
forEach(callbackfn: (value: number, index: number, array: Float16Array) => void, thisArg?: any): void;
includes(searchElement: number, fromIndex?: number): boolean;
indexOf(searchElement: number, fromIndex?: number): number;
join(separator?: string): string;
lastIndexOf(searchElement: number, fromIndex?: number): number;
map(callbackfn: (value: number, index: number, array: Float16Array) => number, thisArg?: any): Float16Array;
reduce(
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number,
): number;
reduce(
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number,
initialValue: number,
): number;
reduce<U>(
callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float16Array) => U,
initialValue: U,
): U;
reduceRight(
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number,
): number;
reduceRight(
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number,
initialValue: number,
): number;
reduceRight<U>(
callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float16Array) => U,
initialValue: U,
): U;
reverse(): Float16Array;
set(array: ArrayLike<number>, offset?: number): void;
slice(start?: number, end?: number): Float16Array;
some(predicate: (value: number, index: number, array: Float16Array) => unknown, thisArg?: any): boolean;
sort(compareFn?: (a: number, b: number) => number): this;
subarray(begin?: number, end?: number): Float16Array;
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
toReversed(): Float16Array;
toSorted(compareFn?: (a: number, b: number) => number): Float16Array;
toString(): string;
valueOf(): Float16Array;
with(index: number, value: number): Float16Array;
[index: number]: number;
}
@@ -0,0 +1,37 @@
/**
* @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 CandyOff = createLucideIcon("CandyOff", [
["path", { d: "m8.5 8.5-1 1a4.95 4.95 0 0 0 7 7l1-1", key: "1ff4ui" }],
[
"path",
{ d: "M11.843 6.187A4.947 4.947 0 0 1 16.5 7.5a4.947 4.947 0 0 1 1.313 4.657", key: "1sbrv4" }
],
["path", { d: "M14 16.5V14", key: "1maf8j" }],
["path", { d: "M14 6.5v1.843", key: "1a6u6t" }],
["path", { d: "M10 10v7.5", key: "80pj65" }],
[
"path",
{
d: "m16 7 1-5 1.367.683A3 3 0 0 0 19.708 3H21v1.292a3 3 0 0 0 .317 1.341L22 7l-5 1",
key: "11a9mt"
}
],
[
"path",
{
d: "m8 17-1 5-1.367-.683A3 3 0 0 0 4.292 21H3v-1.292a3 3 0 0 0-.317-1.341L2 17l5-1",
key: "3mjmon"
}
],
["line", { x1: "2", x2: "22", y1: "2", y2: "22", key: "a6p6uj" }]
]);
export { CandyOff as default };
//# sourceMappingURL=candy-off.js.map
@@ -0,0 +1 @@
{"version":3,"file":"stringify.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/src/","sources":["stringify.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EACL,OAAO,EACP,MAAM,EACN,WAAW,EAEX,SAAS,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,UAAoC,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CACxB,IAAkC,EAClC,OAA8B;IAE9B,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CACxB,IAAa,EACb,OAA8B;IAE9B,OAAO,WAAW,CAAC,IAAI,CAAC;QACpB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QACnE,CAAC,CAAC,EAAE,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,IAAyB;IAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3D,IAAI,KAAK,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3E,IAAI,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IACnC,OAAO,EAAE,CAAC;AACd,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,IAAyB;IACjD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/D,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,OAAO,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IACnC,OAAO,EAAE,CAAC;AACd,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,IAAyB;IAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7D,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACxE,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IACnC,OAAO,EAAE,CAAC;AACd,CAAC"}
@@ -0,0 +1,61 @@
'use strict';
var test = require('tape');
var callBound = require('../');
/** @template {true} T @template U @typedef {T extends U ? T : never} AssertType */
test('callBound', function (t) {
// static primitive
t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself');
t.equal(callBound('%Array.length%'), Array.length, '%Array.length% yields itself');
// static non-function object
t.equal(callBound('Array.prototype'), Array.prototype, 'Array.prototype yields itself');
t.equal(callBound('%Array.prototype%'), Array.prototype, '%Array.prototype% yields itself');
t.equal(callBound('Array.constructor'), Array.constructor, 'Array.constructor yields itself');
t.equal(callBound('%Array.constructor%'), Array.constructor, '%Array.constructor% yields itself');
// static function
t.equal(callBound('Date.parse'), Date.parse, 'Date.parse yields itself');
t.equal(callBound('%Date.parse%'), Date.parse, '%Date.parse% yields itself');
// prototype primitive
t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself');
t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself');
var x = callBound('Object.prototype.toString');
var y = callBound('%Object.prototype.toString%');
// prototype function
t.notEqual(x, Object.prototype.toString, 'Object.prototype.toString does not yield itself');
t.notEqual(y, Object.prototype.toString, '%Object.prototype.toString% does not yield itself');
t.equal(x(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original');
t.equal(y(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original');
t['throws'](
// @ts-expect-error
function () { callBound('does not exist'); },
SyntaxError,
'nonexistent intrinsic throws'
);
t['throws'](
// @ts-expect-error
function () { callBound('does not exist', true); },
SyntaxError,
'allowMissing arg still throws for unknown intrinsic'
);
t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) {
st['throws'](
function () { callBound('WeakRef'); },
TypeError,
'real but absent intrinsic throws'
);
st.equal(callBound('WeakRef', true), undefined, 'allowMissing arg avoids exception');
st.end();
});
t.end();
});
@@ -0,0 +1,190 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFeed = getFeed;
var stringify_js_1 = require("./stringify.js");
var legacy_js_1 = require("./legacy.js");
/**
* Get the feed object from the root of a DOM tree.
*
* @category Feeds
* @param doc - The DOM to to extract the feed from.
* @returns The feed.
*/
function getFeed(doc) {
var feedRoot = getOneElement(isValidFeed, doc);
return !feedRoot
? null
: feedRoot.name === "feed"
? getAtomFeed(feedRoot)
: getRssFeed(feedRoot);
}
/**
* Parse an Atom feed.
*
* @param feedRoot The root of the feed.
* @returns The parsed feed.
*/
function getAtomFeed(feedRoot) {
var _a;
var childs = feedRoot.children;
var feed = {
type: "atom",
items: (0, legacy_js_1.getElementsByTagName)("entry", childs).map(function (item) {
var _a;
var children = item.children;
var entry = { media: getMediaElements(children) };
addConditionally(entry, "id", "id", children);
addConditionally(entry, "title", "title", children);
var href = (_a = getOneElement("link", children)) === null || _a === void 0 ? void 0 : _a.attribs["href"];
if (href) {
entry.link = href;
}
var description = fetch("summary", children) || fetch("content", children);
if (description) {
entry.description = description;
}
var pubDate = fetch("updated", children);
if (pubDate) {
entry.pubDate = new Date(pubDate);
}
return entry;
}),
};
addConditionally(feed, "id", "id", childs);
addConditionally(feed, "title", "title", childs);
var href = (_a = getOneElement("link", childs)) === null || _a === void 0 ? void 0 : _a.attribs["href"];
if (href) {
feed.link = href;
}
addConditionally(feed, "description", "subtitle", childs);
var updated = fetch("updated", childs);
if (updated) {
feed.updated = new Date(updated);
}
addConditionally(feed, "author", "email", childs, true);
return feed;
}
/**
* Parse a RSS feed.
*
* @param feedRoot The root of the feed.
* @returns The parsed feed.
*/
function getRssFeed(feedRoot) {
var _a, _b;
var childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [];
var feed = {
type: feedRoot.name.substr(0, 3),
id: "",
items: (0, legacy_js_1.getElementsByTagName)("item", feedRoot.children).map(function (item) {
var children = item.children;
var entry = { media: getMediaElements(children) };
addConditionally(entry, "id", "guid", children);
addConditionally(entry, "title", "title", children);
addConditionally(entry, "link", "link", children);
addConditionally(entry, "description", "description", children);
var pubDate = fetch("pubDate", children) || fetch("dc:date", children);
if (pubDate)
entry.pubDate = new Date(pubDate);
return entry;
}),
};
addConditionally(feed, "title", "title", childs);
addConditionally(feed, "link", "link", childs);
addConditionally(feed, "description", "description", childs);
var updated = fetch("lastBuildDate", childs);
if (updated) {
feed.updated = new Date(updated);
}
addConditionally(feed, "author", "managingEditor", childs, true);
return feed;
}
var MEDIA_KEYS_STRING = ["url", "type", "lang"];
var MEDIA_KEYS_INT = [
"fileSize",
"bitrate",
"framerate",
"samplingrate",
"channels",
"duration",
"height",
"width",
];
/**
* Get all media elements of a feed item.
*
* @param where Nodes to search in.
* @returns Media elements.
*/
function getMediaElements(where) {
return (0, legacy_js_1.getElementsByTagName)("media:content", where).map(function (elem) {
var attribs = elem.attribs;
var media = {
medium: attribs["medium"],
isDefault: !!attribs["isDefault"],
};
for (var _i = 0, MEDIA_KEYS_STRING_1 = MEDIA_KEYS_STRING; _i < MEDIA_KEYS_STRING_1.length; _i++) {
var attrib = MEDIA_KEYS_STRING_1[_i];
if (attribs[attrib]) {
media[attrib] = attribs[attrib];
}
}
for (var _a = 0, MEDIA_KEYS_INT_1 = MEDIA_KEYS_INT; _a < MEDIA_KEYS_INT_1.length; _a++) {
var attrib = MEDIA_KEYS_INT_1[_a];
if (attribs[attrib]) {
media[attrib] = parseInt(attribs[attrib], 10);
}
}
if (attribs["expression"]) {
media.expression = attribs["expression"];
}
return media;
});
}
/**
* Get one element by tag name.
*
* @param tagName Tag name to look for
* @param node Node to search in
* @returns The element or null
*/
function getOneElement(tagName, node) {
return (0, legacy_js_1.getElementsByTagName)(tagName, node, true, 1)[0];
}
/**
* Get the text content of an element with a certain tag name.
*
* @param tagName Tag name to look for.
* @param where Node to search in.
* @param recurse Whether to recurse into child nodes.
* @returns The text content of the element.
*/
function fetch(tagName, where, recurse) {
if (recurse === void 0) { recurse = false; }
return (0, stringify_js_1.textContent)((0, legacy_js_1.getElementsByTagName)(tagName, where, recurse, 1)).trim();
}
/**
* Adds a property to an object if it has a value.
*
* @param obj Object to be extended
* @param prop Property name
* @param tagName Tag name that contains the conditionally added property
* @param where Element to search for the property
* @param recurse Whether to recurse into child nodes.
*/
function addConditionally(obj, prop, tagName, where, recurse) {
if (recurse === void 0) { recurse = false; }
var val = fetch(tagName, where, recurse);
if (val)
obj[prop] = val;
}
/**
* Checks if an element is a feed root node.
*
* @param value The name of the element to check.
* @returns Whether an element is a feed root node.
*/
function isValidFeed(value) {
return value === "rss" || value === "feed" || value === "rdf:RDF";
}
//# sourceMappingURL=feeds.js.map
@@ -0,0 +1 @@
{"version":3,"file":"pen-box.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"utils.js","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// Safe version of React.use() that will not cause compilation errors against\n// React 18 with Webpack, which statically analyzes imports and fails when it\n// sees React.use referenced (since 'use' is not exported from React 18).\n// This uses a dynamic string lookup to avoid the static analysis.\n// eslint-disable-next-line prefer-const -- Must be `let` to prevent bundler constant-folding\nlet REACT_USE = 'use'\n\n/**\n * React.use if available (React 19+), undefined otherwise.\n * Use dynamic lookup to avoid Webpack compilation errors with React 18.\n */\nexport const reactUse:\n | (<T>(usable: Promise<T> | React.Context<T>) => T)\n | undefined = (React as any)[REACT_USE]\n\nexport function useStableCallback<T extends (...args: Array<any>) => any>(\n fn: T,\n): T {\n const fnRef = React.useRef(fn)\n fnRef.current = fn\n\n const ref = React.useRef((...args: Array<any>) => fnRef.current(...args))\n return ref.current as T\n}\n\nexport const useLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\n/**\n * Taken from https://www.developerway.com/posts/implementing-advanced-use-previous-hook#part3\n */\nexport function usePrevious<T>(value: T): T | null {\n // initialise the ref with previous and current values\n const ref = React.useRef<{ value: T; prev: T | null }>({\n value: value,\n prev: null,\n })\n\n const current = ref.current.value\n\n // if the value passed into hook doesn't match what we store as \"current\"\n // move the \"current\" to the \"previous\"\n // and store the passed value as \"current\"\n if (value !== current) {\n ref.current = {\n value: value,\n prev: current,\n }\n }\n\n // return the previous value only\n return ref.current.prev\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param intersectionObserverOptions - The options to pass to the IntersectionObserver\n * @param options - The options to pass to the hook\n * @param callback - The callback to call when the intersection changes\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n * ref,\n * (entry) => { doSomething(entry) },\n * { rootMargin: '10px' },\n * { disabled: false }\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n ref: React.RefObject<T | null>,\n callback: (entry: IntersectionObserverEntry | undefined) => void,\n intersectionObserverOptions: IntersectionObserverInit = {},\n options: { disabled?: boolean } = {},\n) {\n React.useEffect(() => {\n if (\n !ref.current ||\n options.disabled ||\n typeof IntersectionObserver !== 'function'\n ) {\n return\n }\n\n const observer = new IntersectionObserver(([entry]) => {\n callback(entry)\n }, intersectionObserverOptions)\n\n observer.observe(ref.current)\n\n return () => {\n observer.disconnect()\n }\n }, [callback, intersectionObserverOptions, options.disabled, ref])\n}\n\n/**\n * React hook to take a `React.ForwardedRef` and returns a `ref` that can be used on a DOM element.\n *\n * @param ref - The forwarded ref\n * @returns The inner ref returned by `useRef`\n * @example\n * ```tsx\n * const MyComponent = React.forwardRef((props, ref) => {\n * const innerRef = useForwardedRef(ref)\n * return <div ref={innerRef} />\n * })\n * ```\n */\nexport function useForwardedRef<T>(ref?: React.ForwardedRef<T>) {\n const innerRef = React.useRef<T>(null)\n React.useImperativeHandle(ref, () => innerRef.current!, [])\n return innerRef\n}\n"],"mappings":";;;;;;AAcA,IAAa,WAEI,QARD;AAoBhB,IAAa,kBACX,OAAO,WAAW,cAAc,QAAM,kBAAkB,QAAM;;;;AAKhE,SAAgB,YAAe,OAAoB;CAEjD,MAAM,MAAM,QAAM,OAAqC;EAC9C;EACP,MAAM;EACP,CAAC;CAEF,MAAM,UAAU,IAAI,QAAQ;AAK5B,KAAI,UAAU,QACZ,KAAI,UAAU;EACL;EACP,MAAM;EACP;AAIH,QAAO,IAAI,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BrB,SAAgB,wBACd,KACA,UACA,8BAAwD,EAAE,EAC1D,UAAkC,EAAE,EACpC;AACA,SAAM,gBAAgB;AACpB,MACE,CAAC,IAAI,WACL,QAAQ,YACR,OAAO,yBAAyB,WAEhC;EAGF,MAAM,WAAW,IAAI,sBAAsB,CAAC,WAAW;AACrD,YAAS,MAAM;KACd,4BAA4B;AAE/B,WAAS,QAAQ,IAAI,QAAQ;AAE7B,eAAa;AACX,YAAS,YAAY;;IAEtB;EAAC;EAAU;EAA6B,QAAQ;EAAU;EAAI,CAAC;;;;;;;;;;;;;;;AAgBpE,SAAgB,gBAAmB,KAA6B;CAC9D,MAAM,WAAW,QAAM,OAAU,KAAK;AACtC,SAAM,oBAAoB,WAAW,SAAS,SAAU,EAAE,CAAC;AAC3D,QAAO"}
@@ -0,0 +1,14 @@
import { StructuralSharingOption, ValidateSelected } from './structuralSharing.cjs';
import { AnyRouter, MakeRouteMatch, MakeRouteMatchUnion, RegisteredRouter, StrictOrFrom, ThrowConstraint, ThrowOrOptional } from '@tanstack/router-core';
export interface UseMatchBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TThrow extends boolean, TSelected, TStructuralSharing extends boolean> {
select?: (match: MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
shouldThrow?: TThrow;
}
export type UseMatchRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseMatchBaseOptions<TRouter, TFrom, true, true, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>) => UseMatchResult<TRouter, TFrom, true, TSelected>;
export type UseMatchOptions<TRouter extends AnyRouter, TFrom extends string | undefined, TStrict extends boolean, TThrow extends boolean, TSelected, TStructuralSharing extends boolean> = StrictOrFrom<TRouter, TFrom, TStrict> & UseMatchBaseOptions<TRouter, TFrom, TStrict, TThrow, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>;
export type UseMatchResult<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected> = unknown extends TSelected ? TStrict extends true ? MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict> : MakeRouteMatchUnion<TRouter> : TSelected;
/**
* Read and select the nearest or targeted route match.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchHook
*/
export declare function useMatch<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TThrow extends boolean = true, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts: UseMatchOptions<TRouter, TFrom, TStrict, ThrowConstraint<TStrict, TThrow>, TSelected, TStructuralSharing>): ThrowOrOptional<UseMatchResult<TRouter, TFrom, TStrict, TSelected>, TThrow>;
@@ -0,0 +1 @@
{"version":3,"names":["_traverseFast","require","_removeProperties","removePropertiesDeep","tree","opts","traverseFast","removeProperties"],"sources":["../../src/modifications/removePropertiesDeep.ts"],"sourcesContent":["import traverseFast from \"../traverse/traverseFast.ts\";\nimport removeProperties from \"./removeProperties.ts\";\nimport type * as t from \"../index.ts\";\n\nexport default function removePropertiesDeep<T extends t.Node>(\n tree: T,\n opts?: { preserveComments: boolean } | null,\n): T {\n traverseFast(tree, removeProperties, opts);\n\n return tree;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAGe,SAASE,oBAAoBA,CAC1CC,IAAO,EACPC,IAA2C,EACxC;EACH,IAAAC,qBAAY,EAACF,IAAI,EAAEG,yBAAgB,EAAEF,IAAI,CAAC;EAE1C,OAAOD,IAAI;AACb","ignoreList":[]}
@@ -0,0 +1,31 @@
/**
* Decrypting JSON Web Encryption (JWE) in Compact Serialization
*
* @module
*/
import type * as types from '../../types.d.ts';
/**
* Interface for Compact JWE Decryption dynamic key resolution. No token components have been
* verified at the time of this function call.
*/
export interface CompactDecryptGetKey extends types.GetKeyFunction<types.CompactJWEHeaderParameters, types.FlattenedJWE> {
}
/**
* Decrypts a Compact JWE.
*
* This function is exported (as a named export) from the main `'jose'` module entry point as well
* as from its subpath export `'jose/jwe/compact/decrypt'`.
*
* @param jwe Compact JWE.
* @param key Private Key or Secret to decrypt the JWE with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Decryption options.
*/
export declare function compactDecrypt(jwe: string | Uint8Array, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.DecryptOptions): Promise<types.CompactDecryptResult>;
/**
* @param jwe Compact JWE.
* @param getKey Function resolving Private Key or Secret to decrypt the JWE with. See
* {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
* @param options JWE Decryption options.
*/
export declare function compactDecrypt(jwe: string | Uint8Array, getKey: CompactDecryptGetKey, options?: types.DecryptOptions): Promise<types.CompactDecryptResult & types.ResolvedKey>;
@@ -0,0 +1,21 @@
MIT License
Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,154 @@
import type * as core from "../core/index.js";
import type * as JSONSchema from "./json-schema.js";
import { type $ZodRegistry } from "./registries.js";
import type * as schemas from "./schemas.js";
import type { StandardJSONSchemaV1, StandardSchemaWithJSONProps } from "./standard-schema.js";
export type Processor<T extends schemas.$ZodType = schemas.$ZodType> = (schema: T, ctx: ToJSONSchemaContext, json: JSONSchema.BaseSchema, params: ProcessParams) => void;
/**
* Called for each schema that has no JSON Schema equivalent. Return a JSON Schema to use in its
* place, `"any"` to fall back to the `unrepresentable: "any"` behavior, or `"throw"`/`undefined` to
* throw the default error. Throwing from the handler propagates, so custom errors work too.
*/
export type UnrepresentableHandler<T extends schemas.$ZodType = schemas.$ZodType> = (ctx: {
zodSchema: T;
path: (string | number)[];
/** The error Zod would throw. Distinguishes sites that share a `zodSchema`, e.g. an `undefined`
* vs a `bigint` member of the same literal. */
message: string;
}) => JSONSchema.BaseSchema | "throw" | "any" | undefined;
export interface JSONSchemaGeneratorParams {
processors: Record<string, Processor>;
/** A registry used to look up metadata for each schema. Any schema with an `id` property will be extracted as a $def.
* @default globalRegistry */
metadata?: $ZodRegistry<Record<string, any>>;
/** The JSON Schema version to target.
* - `"draft-2020-12"` — Default. JSON Schema Draft 2020-12
* - `"draft-07"` — JSON Schema Draft 7
* - `"draft-04"` — JSON Schema Draft 4
* - `"openapi-3.0"` — OpenAPI 3.0 Schema Object */
target?: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string) | undefined;
/** How to handle unrepresentable types.
* - `"throw"` — Default. Unrepresentable types throw an error
* - `"any"` — Unrepresentable types become `{}`
* - A function — called once per unrepresentable schema; see {@link UnrepresentableHandler}. */
unrepresentable?: "throw" | "any" | UnrepresentableHandler<schemas.$ZodTypes>;
/** Arbitrary custom logic that can be used to modify the generated JSON Schema. */
override?: (ctx: {
zodSchema: schemas.$ZodTypes;
jsonSchema: JSONSchema.BaseSchema;
path: (string | number)[];
}) => void;
/** Whether to extract the `"input"` or `"output"` type. Relevant to transforms, defaults, coerced primitives, etc.
* - `"output"` — Default. Convert the output schema.
* - `"input"` — Convert the input schema. */
io?: "input" | "output";
cycles?: "ref" | "throw";
reused?: "ref" | "inline";
external?: {
registry: $ZodRegistry<{
id?: string | undefined;
}>;
uri?: ((id: string) => string) | undefined;
defs: Record<string, JSONSchema.BaseSchema>;
} | undefined;
}
/**
* Parameters for the toJSONSchema function.
*/
export type ToJSONSchemaParams = Omit<JSONSchemaGeneratorParams, "processors" | "external">;
/**
* Parameters for the toJSONSchema function when passing a registry.
*/
export interface RegistryToJSONSchemaParams extends ToJSONSchemaParams {
uri?: (id: string) => string;
}
export interface ProcessParams {
schemaPath: schemas.$ZodType[];
path: (string | number)[];
}
export interface Seen {
/** JSON Schema result for this Zod schema */
schema: JSONSchema.BaseSchema;
/** A cached version of the schema that doesn't get overwritten during ref resolution */
def?: JSONSchema.BaseSchema;
defId?: string | undefined;
/** Number of times this schema was encountered during traversal */
count: number;
/** Cycle path */
cycle?: (string | number)[] | undefined;
isParent?: boolean | undefined;
/** Schema to inherit JSON Schema properties from (set by processor for wrappers) */
ref?: schemas.$ZodType | null;
/** JSON Schema property path for this schema */
path?: (string | number)[] | undefined;
}
export interface ToJSONSchemaContext {
processors: Record<string, Processor>;
metadataRegistry: $ZodRegistry<Record<string, any>>;
target: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string);
unrepresentable: "throw" | "any" | UnrepresentableHandler;
override: (ctx: {
zodSchema: schemas.$ZodType;
jsonSchema: JSONSchema.BaseSchema;
path: (string | number)[];
}) => void;
io: "input" | "output";
counter: number;
seen: Map<schemas.$ZodType, Seen>;
/** Registry conversions share one `seen` map across every emitted schema. These hold the
* `external` the whole-map passes below last ran for, so the passes are not repeated once per
* schema — and still re-run if the map grows or `external` is swapped. `sharedEmitDoneFor`
* covers both passes in `finalize`: the ref flattening and the `$defs` build.
*
* The passes are valid only while nothing they read has changed, so both are cleared in
* `processSchema()` when the map grows, and in `JSONSchemaGenerator.emit()`, which can also change
* the `cycles` and `reused` they branch on.
*
* One case is deliberately not covered: an `override` callback that writes to
* `metadataRegistry` mid-conversion. It runs inside `finalize`, so a registry conversion has
* nowhere left to clear the guards, and later schemas keep the ids the first pass saw. That
* output was never coherent — before this, whether a shared subschema was inlined or extracted
* depended on which registry entry happened to be emitted when the callback fired. */
sharedDefsExtractedFor?: ToJSONSchemaContext["external"];
sharedEmitDoneFor?: ToJSONSchemaContext["external"];
cycles: "ref" | "throw";
reused: "ref" | "inline";
/** The `allOf` array of each intersection encountered during traversal, innermost first. `finalize` folds every emitted object holding one; see `foldIntersection`. */
intersections: JSONSchema.BaseSchema[][];
/** Rewrites a processor deferred to `finalize`, where the flatten has resolved every ref and the union branches are in place. */
deferred: (() => void)[];
external?: {
registry: $ZodRegistry<{
id?: string | undefined;
}>;
uri?: ((id: string) => string) | undefined;
defs: Record<string, JSONSchema.BaseSchema>;
} | undefined;
}
export declare function initializeContext(params: JSONSchemaGeneratorParams): ToJSONSchemaContext;
/**
* Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
* `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
* custom JSON Schema was written into `json`, in which case the caller must not write its own.
*/
export declare function handleUnrepresentable(schema: schemas.$ZodType, ctx: ToJSONSchemaContext, json: JSONSchema.BaseSchema, params: ProcessParams, message: string): boolean;
export declare function processSchema<T extends schemas.$ZodType>(schema: T, ctx: ToJSONSchemaContext, _params?: ProcessParams): JSONSchema.BaseSchema;
/** @deprecated Renamed to `processSchema`. An export alias declares no binding, so it is safe to keep. */
export { processSchema as process };
export declare function extractDefs<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): void;
export declare function finalize<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): ZodStandardJSONSchemaPayload<T>;
export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
export interface ZodStandardJSONSchemaPayload<T> extends JSONSchema.BaseSchema {
"~standard": ZodStandardSchemaWithJSON<T>;
}
/**
* Creates a toJSONSchema method for a schema instance.
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
*/
export declare const createToJSONSchemaMethod: <T extends schemas.$ZodType>(schema: T, processors?: Record<string, Processor>) => (params?: ToJSONSchemaParams) => ZodStandardJSONSchemaPayload<T>;
/**
* Creates a toJSONSchema method for a schema instance.
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
*/
type StandardJSONSchemaMethodParams = Parameters<StandardJSONSchemaV1["~standard"]["jsonSchema"]["input"]>[0];
export declare const createStandardJSONSchemaMethod: <T extends schemas.$ZodType>(schema: T, io: "input" | "output", processors?: Record<string, Processor>) => (params?: StandardJSONSchemaMethodParams) => JSONSchema.BaseSchema;
@@ -0,0 +1,62 @@
# side-channel-weakmap <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
Store information about any JS value in a side channel. Uses WeakMap if available.
Warning: this implementation will leak memory until you `delete` the `key`.
Use [`side-channel`](https://npmjs.com/side-channel) for the best available strategy.
## Getting started
```sh
npm install --save side-channel-weakmap
```
## Usage/Examples
```js
const assert = require('assert');
const getSideChannelList = require('side-channel-weakmap');
const channel = getSideChannelList();
const key = {};
assert.equal(channel.has(key), false);
assert.throws(() => channel.assert(key), TypeError);
channel.set(key, 42);
channel.assert(key); // does not throw
assert.equal(channel.has(key), true);
assert.equal(channel.get(key), 42);
channel.delete(key);
assert.equal(channel.has(key), false);
assert.throws(() => channel.assert(key), TypeError);
```
## Tests
Clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/side-channel-weakmap
[npm-version-svg]: https://versionbadg.es/ljharb/side-channel-weakmap.svg
[deps-svg]: https://david-dm.org/ljharb/side-channel-weakmap.svg
[deps-url]: https://david-dm.org/ljharb/side-channel-weakmap
[dev-deps-svg]: https://david-dm.org/ljharb/side-channel-weakmap/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/side-channel-weakmap#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/side-channel-weakmap.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/side-channel-weakmap.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/side-channel-weakmap.svg
[downloads-url]: https://npm-stat.com/charts.html?package=side-channel-weakmap
[codecov-image]: https://codecov.io/gh/ljharb/side-channel-weakmap/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/side-channel-weakmap/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/side-channel-weakmap
[actions-url]: https://github.com/ljharb/side-channel-weakmap/actions
@@ -0,0 +1,180 @@
"use strict"
// Manually added data to be used by sbcs codec in addition to generated one.
module.exports = {
// Not supported by iconv, not sure why.
10029: "maccenteuro",
maccenteuro: {
type: "_sbcs",
chars: "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ"
},
808: "cp808",
ibm808: "cp808",
cp808: {
type: "_sbcs",
chars: "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ "
},
mik: {
type: "_sbcs",
chars: "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя└┴┬├─┼╣║╚╔╩╦╠═╬┐░▒▓│┤№§╗╝┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
},
cp720: {
type: "_sbcs",
chars: "\x80\x81éâ\x84à\x86çêëèïî\x8d\x8e\x8f\x90\u0651\u0652ô¤ـûùءآأؤ£إئابةتثجحخدذرزسشص«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ضطظعغفµقكلمنهوىي≡\u064b\u064c\u064d\u064e\u064f\u0650≈°∙·√ⁿ²■\u00a0"
},
// Aliases of generated encodings.
ascii8bit: "ascii",
usascii: "ascii",
ansix34: "ascii",
ansix341968: "ascii",
ansix341986: "ascii",
csascii: "ascii",
cp367: "ascii",
ibm367: "ascii",
isoir6: "ascii",
iso646us: "ascii",
iso646irv: "ascii",
us: "ascii",
latin1: "iso88591",
latin2: "iso88592",
latin3: "iso88593",
latin4: "iso88594",
latin5: "iso88599",
latin6: "iso885910",
latin7: "iso885913",
latin8: "iso885914",
latin9: "iso885915",
latin10: "iso885916",
csisolatin1: "iso88591",
csisolatin2: "iso88592",
csisolatin3: "iso88593",
csisolatin4: "iso88594",
csisolatincyrillic: "iso88595",
csisolatinarabic: "iso88596",
csisolatingreek: "iso88597",
csisolatinhebrew: "iso88598",
csisolatin5: "iso88599",
csisolatin6: "iso885910",
l1: "iso88591",
l2: "iso88592",
l3: "iso88593",
l4: "iso88594",
l5: "iso88599",
l6: "iso885910",
l7: "iso885913",
l8: "iso885914",
l9: "iso885915",
l10: "iso885916",
isoir14: "iso646jp",
isoir57: "iso646cn",
isoir100: "iso88591",
isoir101: "iso88592",
isoir109: "iso88593",
isoir110: "iso88594",
isoir144: "iso88595",
isoir127: "iso88596",
isoir126: "iso88597",
isoir138: "iso88598",
isoir148: "iso88599",
isoir157: "iso885910",
isoir166: "tis620",
isoir179: "iso885913",
isoir199: "iso885914",
isoir203: "iso885915",
isoir226: "iso885916",
cp819: "iso88591",
ibm819: "iso88591",
cyrillic: "iso88595",
arabic: "iso88596",
arabic8: "iso88596",
ecma114: "iso88596",
asmo708: "iso88596",
greek: "iso88597",
greek8: "iso88597",
ecma118: "iso88597",
elot928: "iso88597",
hebrew: "iso88598",
hebrew8: "iso88598",
iso88598i: "iso88598",
iso88598e: "iso88598",
turkish: "iso88599",
turkish8: "iso88599",
thai: "iso885911",
thai8: "iso885911",
celtic: "iso885914",
celtic8: "iso885914",
isoceltic: "iso885914",
tis6200: "tis620",
tis62025291: "tis620",
tis62025330: "tis620",
10000: "macroman",
10006: "macgreek",
10007: "maccyrillic",
10079: "maciceland",
10081: "macturkish",
cspc8codepage437: "cp437",
cspc775baltic: "cp775",
cspc850multilingual: "cp850",
cspcp852: "cp852",
cspc862latinhebrew: "cp862",
cpgr: "cp869",
msee: "cp1250",
mscyrl: "cp1251",
msansi: "cp1252",
msgreek: "cp1253",
msturk: "cp1254",
mshebr: "cp1255",
msarab: "cp1256",
winbaltrim: "cp1257",
cp20866: "koi8r",
20866: "koi8r",
ibm878: "koi8r",
cskoi8r: "koi8r",
cp21866: "koi8u",
21866: "koi8u",
ibm1168: "koi8u",
strk10482002: "rk1048",
tcvn5712: "tcvn",
tcvn57121: "tcvn",
gb198880: "iso646cn",
cn: "iso646cn",
csiso14jisc6220ro: "iso646jp",
jisc62201969ro: "iso646jp",
jp: "iso646jp",
cshproman8: "hproman8",
r8: "hproman8",
roman8: "hproman8",
xroman8: "hproman8",
ibm1051: "hproman8",
mac: "macintosh",
csmacintosh: "macintosh"
}
@@ -0,0 +1 @@
{"version":3,"file":"simpleOAuthClient.d.ts","sourceRoot":"","sources":["../../../../src/examples/client/simpleOAuthClient.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
module.exports={C:{"115":0.02615,"120":0.00374,"121":0.00747,"137":0.00374,"154":0.07098,"155":0.57534,"156":0.36613,"157":0.00374,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 158 159 160 3.5 3.6"},D:{"49":0.02615,"101":0.00747,"103":0.02242,"104":0.01494,"105":0.01868,"106":0.01121,"107":0.01121,"108":0.01494,"109":1.22914,"110":0.01868,"111":0.01494,"112":0.01868,"116":0.0934,"117":0.01494,"118":0.02989,"119":0.00747,"120":0.02615,"122":0.01121,"124":0.01494,"128":0.01494,"129":0.00374,"131":0.03362,"133":0.04857,"134":0.03362,"135":0.02989,"136":0.04483,"137":0.02242,"138":0.06351,"139":0.02242,"140":0.02989,"141":0.02989,"142":0.11955,"143":0.00374,"144":0.01868,"145":0.01494,"146":0.05978,"147":0.00374,"148":0.06351,"149":0.09714,"150":0.68742,"151":0.77709,"152":4.18058,"153":2.99627,"154":0.90038,"155":0.00374,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 102 113 114 115 121 123 125 126 127 130 132 156 157"},F:{"134":0.1457,"135":0.32503,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 131 132 133 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"119":0.00747,"120":0.00374,"139":0.00747,"147":0.01121,"150":0.08593,"151":0.44458,"152":3.3624,"153":4.20674,"154":1.20299,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 140 141 142 143 144 145 146 148 149"},E:{"14":0.00374,"27":0.04857,_:"4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.1 15.2-15.3 16.0 16.1 16.4 17.0 17.3 17.4 18.0 27.1 27.2 TP","13.1":0.01121,"14.1":0.12329,"15.4":0.20922,"15.5":0.00374,"15.6":0.23163,"16.2":0.00747,"16.3":0.00374,"16.5":0.00374,"16.6":0.88543,"17.1":0.46326,"17.2":0.0523,"17.5":0.00374,"17.6":0.45206,"18.1":0.00374,"18.2":0.00374,"18.3":0.08593,"18.4":0.00374,"18.5-18.7":0.02989,"26.0":0.00374,"26.1":0.01121,"26.2":0.14197,"26.3":0.07098,"26.4":0.18306,"26.5":0.88543,"26.6":8.406},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00366,"5.0-5.1":0.00366,"6.0-6.1":0,"7.0-7.1":0.00732,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.03661,"11.0-11.2":0.00366,"11.3-11.4":0.00732,"12.0-12.1":0,"12.2-12.5":0.09519,"13.0-13.1":0,"13.2":0.01831,"13.3":0,"13.4-13.7":0.00366,"14.0-14.4":0.01465,"14.5-14.8":0.02197,"15.0-15.1":0.02197,"15.2-15.3":0.01465,"15.4":0.01831,"15.5":0.02197,"15.6-15.8":0.47597,"16.0":0.03661,"16.1":0.0659,"16.2":0.03661,"16.3":0.08055,"16.4":0.01831,"16.5":0.02929,"16.6-16.7":0.6627,"17.0":0.02563,"17.1":0.03661,"17.2":0.03661,"17.3":0.05492,"17.4":0.07689,"17.5":0.15011,"17.6-17.7":0.3881,"18.0":0.08055,"18.1":0.1611,"18.2":0.21968,"18.3":0.38078,"18.4":0.23799,"18.5-18.7":4.91714,"26.0":0.23799,"26.1":0.24165,"26.2":0.62974,"26.3":0.681,"26.4":0.49794,"26.5":3.33545,"26.6":20.58021,"27.0":1.57802,"27.1":0,"27.2":0.04027},P:{"21":0.00983,"27":0.00983,"28":0.08851,"29":0.12785,"30":2.84228,_:"4 20 22 23 24 25 26 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 18.0 19.0","17.0":0.00983},I:{"0":0.0626,"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.00003},K:{"0":0.0689,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.01494,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0":20.80697},R:{_:"0"},M:{"0":1.92931},Q:{_:"14.9"},O:{_:"0"},H:{all:0}};
@@ -0,0 +1,558 @@
# fflate
High performance (de)compression in an 8kB package
## Why fflate?
`fflate` (short for fast flate) is the **fastest, smallest, and most versatile** pure JavaScript compression and decompression library in existence, handily beating [`pako`](https://npmjs.com/package/pako), [`tiny-inflate`](https://npmjs.com/package/tiny-inflate), and [`UZIP.js`](https://github.com/photopea/UZIP.js) in performance benchmarks while being multiple times more lightweight. Its compression ratios are often better than even the original Zlib C library. It includes support for DEFLATE, GZIP, and Zlib data. Data compressed by `fflate` can be decompressed by other tools, and vice versa.
In addition to the base decompression and compression APIs, `fflate` supports high-speed ZIP file archiving for an extra 3 kB. In fact, the compressor, in synchronous mode, compresses both more quickly and with a higher compression ratio than most compression software (even Info-ZIP, a C program), and in asynchronous mode it can utilize multiple threads to achieve over 3x the performance of virtually any other utility.
| | `pako` | `tiny-inflate` | `UZIP.js` | `fflate` |
|-----------------------------|--------|------------------------|-----------------------|--------------------------------|
| Decompression performance | 1x | Up to 40% slower | **Up to 25% faster** | **Up to 25% faster** |
| Compression performance | 1x | N/A | Up to 25% faster | **Up to 50% faster** |
| Base bundle size (minified) | 45.6kB | **3kB (inflate only)** | 14.2kB | 8kB **(3kB for inflate only)** |
| Decompression support | ✅ | ✅ | ✅ | ✅ |
| Compression support | ✅ | ❌ | ✅ | ✅ |
| ZIP support | ❌ | ❌ | ✅ | ✅ |
| Streaming support | ✅ | ❌ | ❌ | ✅ |
| GZIP support | ✅ | ❌ | ❌ | ✅ |
| Supports files up to 4GB | ✅ | ❌ | ❌ | ✅ |
| Doesn't hang on error | ✅ | ❌ | ❌ | ✅ |
| Dictionary support | ✅ | ❌ | ❌ | ✅ |
| Multi-thread/Asynchronous | ❌ | ❌ | ❌ | ✅ |
| Streaming ZIP support | ❌ | ❌ | ❌ | ✅ |
| Uses ES Modules | ❌ | ❌ | ❌ | ✅ |
## Demo
If you'd like to try `fflate` for yourself without installing it, you can take a look at the [browser demo](https://101arrowz.github.io/fflate). Since `fflate` is a pure JavaScript library, it works in both the browser and Node.js (see [Browser support](https://github.com/101arrowz/fflate/#browser-support) for more info).
## Usage
Install `fflate`:
```sh
npm i fflate # or yarn add fflate, or pnpm add fflate
```
Import:
```js
// I will assume that you use the following for the rest of this guide
import * as fflate from 'fflate';
// However, you should import ONLY what you need to minimize bloat.
// So, if you just need GZIP compression support:
import { gzipSync } from 'fflate';
// Woo! You just saved 20 kB off your bundle with one line.
```
If your environment doesn't support ES Modules (e.g. Node.js):
```js
// Try to avoid this when using fflate in the browser, as it will import
// all of fflate's components, even those that you aren't using.
const fflate = require('fflate');
```
If you want to load from a CDN in the browser:
```html
<!--
You should use either UNPKG or jsDelivr (i.e. only one of the following)
Note that tree shaking is completely unsupported from the CDN. If you want
a small build without build tools, please ask me and I will make one manually
with only the features you need. This build is about 33kB, or 12.5kB gzipped.
-->
<script src="https://unpkg.com/fflate@0.8.3"></script>
<script src="https://cdn.jsdelivr.net/npm/fflate@0.8.3/umd/index.js"></script>
<!-- Now, the global variable fflate contains the library -->
<!-- If you're going buildless but want ESM, import from Skypack -->
<script type="module">
import * as fflate from 'https://cdn.skypack.dev/fflate@0.8.3?min';
</script>
```
If you are using Deno:
```js
// Don't use the ?dts Skypack flag; it isn't necessary for Deno support
// The @deno-types comment adds TypeScript typings
// @deno-types="https://cdn.skypack.dev/fflate@0.8.3/lib/index.d.ts"
import * as fflate from 'https://cdn.skypack.dev/fflate@0.8.3?min';
```
If your environment doesn't support bundling:
```js
// Again, try to import just what you need
// For the browser:
import * as fflate from 'fflate/esm/browser.js';
// If the standard ESM import fails on Node (i.e. older version):
import * as fflate from 'fflate/esm';
```
And use:
```js
// This is an ArrayBuffer of data
const massiveFileBuf = await fetch('/aMassiveFile').then(
res => res.arrayBuffer()
);
// To use fflate, you need a Uint8Array
const massiveFile = new Uint8Array(massiveFileBuf);
// Note that Node.js Buffers work just fine as well:
// const massiveFile = require('fs').readFileSync('aMassiveFile.txt');
// Higher level means lower performance but better compression
// The level ranges from 0 (no compression) to 9 (max compression)
// The default level is 6
const notSoMassive = fflate.zlibSync(massiveFile, { level: 9 });
const massiveAgain = fflate.unzlibSync(notSoMassive);
const gzipped = fflate.gzipSync(massiveFile, {
// GZIP-specific: the filename to use when decompressed
filename: 'aMassiveFile.txt',
// GZIP-specific: the modification time. Can be a Date, date string,
// or Unix timestamp
mtime: '9/1/16 2:00 PM'
});
```
`fflate` can autodetect a compressed file's format as well:
```js
const compressed = new Uint8Array(
await fetch('/GZIPorZLIBorDEFLATE').then(res => res.arrayBuffer())
);
// Above example with Node.js Buffers:
// Buffer.from('H4sIAAAAAAAAE8tIzcnJBwCGphA2BQAAAA==', 'base64');
const decompressed = fflate.decompressSync(compressed);
```
Using strings is easy with `fflate`'s string conversion API:
```js
const buf = fflate.strToU8('Hello world!');
// The default compression method is gzip
// Increasing mem may increase performance at the cost of memory
// The mem ranges from 0 to 12, where 4 is the default
const compressed = fflate.compressSync(buf, { level: 6, mem: 8 });
// When you need to decompress:
const decompressed = fflate.decompressSync(compressed);
const origText = fflate.strFromU8(decompressed);
console.log(origText); // Hello world!
```
If you need to use an (albeit inefficient) binary string, you can set the second argument to `true`.
```js
const buf = fflate.strToU8('Hello world!');
// The second argument, latin1, is a boolean that indicates that the data
// is not Unicode but rather should be encoded and decoded as Latin-1.
// This is useful for creating a string from binary data that isn't
// necessarily valid UTF-8. However, binary strings are incredibly
// inefficient and tend to double file size, so they're not recommended.
const compressedString = fflate.strFromU8(
fflate.compressSync(buf),
true
);
const decompressed = fflate.decompressSync(
fflate.strToU8(compressedString, true)
);
const origText = fflate.strFromU8(decompressed);
console.log(origText); // Hello world!
```
You can use streams as well to incrementally add data to be compressed or decompressed:
```js
// This example uses synchronous streams, but for the best experience
// you'll definitely want to use asynchronous streams.
let outStr = '';
const gzipStream = new fflate.Gzip({ level: 9 }, (chunk, isLast) => {
// accumulate in an inefficient binary string (just an example)
outStr += fflate.strFromU8(chunk, true);
});
// You can also attach the data handler separately if you don't want to
// do so in the constructor.
gzipStream.ondata = (chunk, final) => { ... }
// Since this is synchronous, all errors will be thrown by stream.push()
gzipStream.push(chunk1);
gzipStream.push(chunk2);
...
// You should mark the last chunk by using true in the second argument
// In addition to being necessary for the stream to work properly, this
// will also set the isLast parameter in the handler to true.
gzipStream.push(lastChunk, true);
console.log(outStr); // The compressed binary string is now available
// The options parameter for compression streams is optional; you can
// provide one parameter (the handler) or none at all if you set
// deflateStream.ondata later.
const deflateStream = new fflate.Deflate((chunk, final) => {
console.log(chunk, final);
});
// If you want to create a stream from strings, use EncodeUTF8
const utfEncode = new fflate.EncodeUTF8((data, final) => {
// Chaining streams together is done by pushing to the
// next stream in the handler for the previous stream
deflateStream.push(data, final);
});
utfEncode.push('Hello'.repeat(1000));
utfEncode.push(' '.repeat(100));
utfEncode.push('world!'.repeat(10), true);
// The deflateStream has logged the compressed data
const inflateStream = new fflate.Inflate();
inflateStream.ondata = (decompressedChunk, final) => { ... };
let stringData = '';
// Streaming UTF-8 decode is available too
const utfDecode = new fflate.DecodeUTF8((data, final) => {
stringData += data;
});
// Decompress streams auto-detect the compression method, as the
// non-streaming decompress() method does.
const dcmpStrm = new fflate.Decompress((chunk, final) => {
console.log(chunk, 'was encoded with GZIP, Zlib, or DEFLATE');
utfDecode.push(chunk, final);
});
dcmpStrm.push(zlibJSONData1);
dcmpStrm.push(zlibJSONData2, true);
// This succeeds; the UTF-8 decoder chained with the unknown compression format
// stream to reach a string as a sink.
console.log(JSON.parse(stringData));
```
You can create multi-file ZIP archives easily as well. Note that by default, compression is enabled for all files, which is not useful when ZIPping many PNGs, JPEGs, PDFs, etc. because those formats are already compressed. You should either override the level on a per-file basis or globally to avoid wasting resources.
```js
// Note that the asynchronous version (see below) runs in parallel and
// is *much* (up to 3x) faster for larger archives.
const zipped = fflate.zipSync({
// Directories can be nested structures, as in an actual filesystem
'dir1': {
'nested': {
// You can use Unicode in filenames
'你好.txt': fflate.strToU8('Hey there!')
},
// You can also manually write out a directory path
'other/tmp.txt': new Uint8Array([97, 98, 99, 100])
},
// You can also provide compression options
'massiveImage.bmp': [aMassiveFile, {
level: 9,
mem: 12
}],
// PNG is pre-compressed; no need to waste time
'superTinyFile.png': [aPNGFile, { level: 0 }],
// Directories take options too
'exec': [{
'hello.sh': [fflate.strToU8('echo hello world'), {
// ZIP only: Set the operating system to Unix
os: 3,
// ZIP only: Make this file executable on Unix
attrs: 0o755 << 16
}]
}, {
// ZIP and GZIP support mtime (defaults to current time)
mtime: new Date('10/20/2020')
}]
}, {
// These options are the defaults for all files, but file-specific
// options take precedence.
level: 1,
// Obfuscate last modified time by default
mtime: new Date('1/1/1980')
});
// If you write the zipped data to myzip.zip and unzip, the folder
// structure will be outputted as:
// myzip.zip (original file)
// dir1
// |-> nested
// | |-> 你好.txt
// |-> other
// | |-> tmp.txt
// massiveImage.bmp
// superTinyFile.png
// When decompressing, folders are not nested; all filepaths are fully
// written out in the keys. For example, the return value may be:
// { 'nested/directory/structure.txt': Uint8Array(2) [97, 97] }
const decompressed = fflate.unzipSync(zipped, {
// You may optionally supply a filter for files. By default, all files in a
// ZIP archive are extracted, but a filter can save resources by telling
// the library not to decompress certain files
filter(file) {
// Don't decompress the massive image or any files larger than 10 MiB
return file.name != 'massiveImage.bmp' && file.originalSize <= 10_000_000;
}
});
```
If you need extremely high performance or custom ZIP compression formats, you can use the highly-extensible ZIP streams. They take streams as both input and output. You can even use custom compression/decompression algorithms from other libraries, as long as they [are defined in the ZIP spec](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) (see section 4.4.5). If you'd like more info on using custom compressors, [feel free to ask](https://github.com/101arrowz/fflate/discussions).
```js
// ZIP object
// Can also specify zip.ondata outside of the constructor
const zip = new fflate.Zip((err, dat, final) => {
if (!err) {
// output of the streams
console.log(dat, final);
}
});
const helloTxt = new fflate.ZipDeflate('hello.txt', {
level: 9
});
// Always add streams to ZIP archives before pushing to those streams
zip.add(helloTxt);
helloTxt.push(chunk1);
// Last chunk
helloTxt.push(chunk2, true);
// ZipPassThrough is like ZipDeflate with level 0, but allows for tree shaking
const nonStreamingFile = new fflate.ZipPassThrough('test.png');
zip.add(nonStreamingFile);
// If you have data already loaded, just .push(data, true)
nonStreamingFile.push(pngData, true);
// You need to call .end() after finishing
// This ensures the ZIP is valid
zip.end();
// Unzip object
const unzipper = new fflate.Unzip();
// This function will almost always have to be called. It is used to support
// compression algorithms such as BZIP2 or LZMA in ZIP files if just DEFLATE
// is not enough (though it almost always is).
// If your ZIP files are not compressed, this line is not needed.
unzipper.register(fflate.UnzipInflate);
const neededFiles = ['file1.txt', 'example.json'];
// Can specify handler in constructor too
unzipper.onfile = file => {
// file.name is a string, file is a stream
if (neededFiles.includes(file.name)) {
file.ondata = (err, dat, final) => {
// Stream output here
console.log(dat, final);
};
console.log('Reading:', file.name);
// File sizes are sometimes not set if the ZIP file did not encode
// them, so you may want to check that file.size != undefined
console.log('Compressed size', file.size);
console.log('Decompressed size', file.originalSize);
// You should only start the stream if you plan to use it to improve
// performance. Only after starting the stream will ondata be called.
// This method will throw if the compression method hasn't been registered
file.start();
}
};
// Try to keep under 5,000 files per chunk to avoid stack limit errors
// For example, if all files are a few kB, multi-megabyte chunks are OK
// If files are mostly under 100 bytes, 64kB chunks are the limit
unzipper.push(zipChunk1);
unzipper.push(zipChunk2);
unzipper.push(zipChunk3, true);
```
As you may have guessed, there is an asynchronous version of every method as well. Unlike most libraries, this will cause the compression or decompression run in a separate thread entirely and automatically by using Web (or Node) Workers. This means that the processing will not block the main thread at all.
Note that there is a significant initial overhead to using workers of about 50ms for each asynchronous function. For instance, if you call `unzip` ten times, the overhead only applies for the first call, but if you call `unzip` and `zlib`, they will each cause the 50ms delay. For small (under about 50kB) payloads, the asynchronous APIs will be much slower. However, if you're compressing larger files/multiple files at once, or if the synchronous API causes the main thread to hang for too long, the callback APIs are an order of magnitude better.
```js
import {
gzip, zlib, AsyncGzip, zip, unzip, strFromU8,
Zip, AsyncZipDeflate, Unzip, AsyncUnzipInflate
} from 'fflate';
// Workers will work in almost any browser (even IE11!)
// All of the async APIs use a node-style callback as so:
const terminate = gzip(aMassiveFile, (err, data) => {
if (err) {
// The compressed data was likely corrupt, so we have to handle
// the error.
return;
}
// Use data however you like
console.log(data.length);
});
if (needToCancel) {
// The return value of any of the asynchronous APIs is a function that,
// when called, will immediately cancel the operation. The callback
// will not be called.
terminate();
}
// If you wish to provide options, use the second argument.
// The consume option will render the data inside aMassiveFile unusable,
// but can improve performance and dramatically reduce memory usage.
zlib(aMassiveFile, { consume: true, level: 9 }, (err, data) => {
// Use the data
});
// Asynchronous streams are similar to synchronous streams, but the
// handler has the error that occurred (if any) as the first parameter,
// and they don't block the main thread.
// Additionally, any buffers that are pushed in will be consumed and
// rendered unusable; if you need to use a buffer you push in, you
// should clone it first.
const gzs = new AsyncGzip({ level: 9, mem: 12, filename: 'hello.txt' });
let wasCallbackCalled = false;
gzs.ondata = (err, chunk, final) => {
// Note the new err parameter
if (err) {
// Note that after this occurs, the stream becomes corrupt and must
// be discarded. You can't continue pushing chunks and expect it to
// work.
console.error(err);
return;
}
wasCallbackCalled = true;
}
gzs.push(chunk);
// Since the stream is asynchronous, the callback will not be called
// immediately. If such behavior is absolutely necessary (it shouldn't
// be), use synchronous streams.
console.log(wasCallbackCalled) // false
// To terminate an asynchronous stream's internal worker, call
// stream.terminate().
gzs.terminate();
// This is way faster than zipSync because the compression of multiple
// files runs in parallel. In fact, the fact that it's parallelized
// makes it faster than most standalone ZIP CLIs. The effect is most
// significant for multiple large files; less so for many small ones.
zip({ f1: aMassiveFile, 'f2.txt': anotherMassiveFile }, {
// The options object is still optional, you can still do just
// zip(archive, callback)
level: 6
}, (err, data) => {
// Save the ZIP file
});
// unzip is the only async function without support for consume option
// It is parallelized, so unzip is also often much faster than unzipSync
unzip(aMassiveZIPFile, (err, unzipped) => {
// If the archive has data.xml, log it here
console.log(unzipped['data.xml']);
// Conversion to string
console.log(strFromU8(unzipped['data.xml']))
});
// Streaming ZIP archives can accept asynchronous streams. This automatically
// uses multicore compression.
const zip = new Zip();
zip.ondata = (err, chunk, final) => { ... };
// The JSON and BMP are compressed in parallel
const exampleFile = new AsyncZipDeflate('example.json');
zip.add(exampleFile);
exampleFile.push(JSON.stringify({ large: 'object' }), true);
const exampleFile2 = new AsyncZipDeflate('example2.bmp', { level: 9 });
zip.add(exampleFile2);
exampleFile2.push(ec2a);
exampleFile2.push(ec2b);
exampleFile2.push(ec2c);
...
exampleFile2.push(ec2Final, true);
zip.end();
// Streaming Unzip should register the asynchronous inflation algorithm
// for parallel processing.
const unzip = new Unzip(stream => {
if (stream.name.endsWith('.json')) {
stream.ondata = (err, chunk, final) => { ... };
stream.start();
if (needToCancel) {
// To cancel these streams, call .terminate()
stream.terminate();
}
}
});
unzip.register(AsyncUnzipInflate);
unzip.push(data, true);
```
See the [documentation](https://github.com/101arrowz/fflate/blob/master/docs/README.md) for more detailed information about the API.
## Bundle size estimates
The bundle size measurements for `fflate` on sites like Bundlephobia include every feature of the library and should be seen as an upper bound. As long as you are using tree shaking or dead code elimination, this table should give you a general idea of `fflate`'s bundle size for the features you need.
The maximum bundle size that is possible with `fflate` is about 33kB (12.5kB gzipped) if you use every single feature, but feature parity with `pako` is only around 10kB (as opposed to 45kB from `pako`). If your bundle size increases dramatically after adding `fflate`, please [create an issue](https://github.com/101arrowz/fflate/issues/new).
| Feature | Bundle size (minified) | Nearest competitor |
|-------------------------|--------------------------------|-------------------------|
| Decompression | 3kB | `tiny-inflate` |
| Compression | 5kB | `UZIP.js`, 2.84x larger |
| Async decompression | 4kB (1kB + raw decompression) | N/A |
| Async compression | 6kB (1kB + raw compression) | N/A |
| ZIP decompression | 5kB (2kB + raw decompression) | `UZIP.js`, 2.84x larger |
| ZIP compression | 7kB (2kB + raw compression) | `UZIP.js`, 2.03x larger |
| GZIP/Zlib decompression | 4kB (1kB + raw decompression) | `pako`, 11.4x larger |
| GZIP/Zlib compression | 5kB (1kB + raw compression) | `pako`, 9.12x larger |
| Streaming decompression | 4kB (1kB + raw decompression) | `pako`, 11.4x larger |
| Streaming compression | 5kB (1kB + raw compression) | `pako`, 9.12x larger |
## What makes `fflate` so fast?
Many JavaScript compression/decompression libraries exist. However, the most popular one, [`pako`](https://npmjs.com/package/pako), is merely a clone of Zlib rewritten nearly line-for-line in JavaScript. Although it is by no means poorly made, `pako` doesn't recognize the many differences between JavaScript and C, and therefore is suboptimal for performance. Moreover, even when minified, the library is 45 kB; it may not seem like much, but for anyone concerned with optimizing bundle size (especially library authors), it's more weight than necessary.
Note that there exist some small libraries like [`tiny-inflate`](https://npmjs.com/package/tiny-inflate) for solely decompression, and with a minified size of 3 kB, it can be appealing; however, its performance is lackluster, typically 40% worse than `pako` in my tests.
[`UZIP.js`](https://github.com/photopea/UZIP.js) is both faster (by up to 25%) and smaller (14 kB minified) than `pako`, and it contains a variety of innovations that make it excellent for both performance and compression ratio. However, the developer made a variety of tiny mistakes and inefficient design choices that make it imperfect. Moreover, it does not support GZIP or Zlib data directly; one must remove the headers manually to use `UZIP.js`.
So what makes `fflate` different? It takes the brilliant innovations of `UZIP.js` and optimizes them while adding direct support for GZIP and Zlib data. And unlike all of the above libraries, it uses ES Modules to allow for partial builds through tree shaking, meaning that it can rival even `tiny-inflate` in size while maintaining excellent performance. The end result is a library that, in total, weighs 8kB minified for the core build (3kB for decompression only and 5kB for compression only), is about 25% faster than `UZIP.js` or up to 50% faster than `pako`, and achieves the same or better compression ratio than the rest.
Before you decide that `fflate` is the end-all compression library, you should note that JavaScript simply cannot rival the performance of a native program. If you're only using Node.js, it's probably better to use the [native Zlib bindings](https://nodejs.org/api/zlib.html), which tend to offer the best performance. Though note that even against Zlib, `fflate` is only around 30% slower in decompression and 10% slower in compression, and can still achieve better compression ratios!
## What about `CompressionStream`?
Like `fflate`, the [Compression Streams API](https://developer.mozilla.org/en-US/docs/Web/API/Compression_Streams_API) provides DEFLATE, GZIP, and Zlib compression and decompression support. It's a good option if you'd like to compress or decompress data without installing any third-party libraries, and it wraps native Zlib bindings to achieve better performance than what most JavaScript programs can achieve.
However, browsers do not offer any native non-streaming compression API, and `CompressionStream` has surprisingly poor performance on data already loaded into memory; `fflate` tends to be faster even for files that are dozens of megabytes large. Similarly, `fflate` is much faster for files under a megabyte because it avoids marshalling overheads. Even when streaming hundreds of megabytes of data, the native API usually performs between 30% faster and 10% slower than `fflate`. And Compression Streams have many other disadvantages - no ability to control compression level, poor support for older browsers, no ZIP support, etc.
If you'd still prefer to depend upon a native browser API but want to support older browsers, you can use an `fflate`-based [Compression Streams ponyfill](https://github.com/101arrowz/compression-streams-polyfill).
## Browser support
`fflate` makes heavy use of typed arrays (`Uint8Array`, `Uint16Array`, etc.). Typed arrays can be polyfilled at the cost of performance, but the most recent browser that doesn't support them [is from 2011](https://caniuse.com/typedarrays), so I wouldn't bother.
The asynchronous APIs also use `Worker`, which is not supported in a few browsers (however, the vast majority of browsers that support typed arrays support `Worker`).
Other than that, `fflate` is completely ES3, meaning you probably won't even need a bundler to use it.
## Testing
You can validate the performance of `fflate` with `npm test`. It validates that the module is working as expected, ensures the outputs are no more than 5% larger than competitors at max compression, and outputs performance metrics to `test/results`.
Note that the time it takes for the CLI to show the completion of each test is not representative of the time each package took, so please check the JSON output if you want accurate measurements.
## License
This software is [MIT Licensed](./LICENSE), with special exemptions for projects
and organizations as noted below:
- [SheetJS](https://github.com/SheetJS/) is exempt from MIT licensing and may
license any source code from this software under the BSD Zero Clause License
@@ -0,0 +1,704 @@
import { existsSync, writeFileSync, readFileSync } from 'node:fs';
import { mkdir, writeFile } from 'node:fs/promises';
import { resolve, dirname, relative } from 'node:path';
import { detectPackageManager, installPackage } from './index.CMESou6r.js';
import { p as prompt, a as any } from './index.og1WyBLx.js';
import { x } from 'tinyexec';
import c from 'tinyrainbow';
import { c as configFiles } from './constants.CPYnjOGj.js';
import 'node:process';
import 'node:module';
import 'node:url';
import './_commonjsHelpers.D26ty3Ew.js';
import 'readline';
import 'events';
const jsxExample = {
name: "HelloWorld.jsx",
js: `
export default function HelloWorld({ name }) {
return (
<div>
<h1>Hello {name}!</h1>
</div>
)
}
`,
ts: `
export default function HelloWorld({ name }: { name: string }) {
return (
<div>
<h1>Hello {name}!</h1>
</div>
)
}
`,
test: `
import { expect, test } from 'vitest'
import { render } from '@testing-library/jsx'
import HelloWorld from './HelloWorld.<EXT>x'
test('renders name', async () => {
const { getByText } = await render(<HelloWorld name="Vitest" />)
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
})
`
};
const vueExample = {
name: "HelloWorld.vue",
js: `
<script setup>
defineProps({
name: String
})
<\/script>
<template>
<div>
<h1>Hello {{ name }}!</h1>
</div>
</template>
`,
ts: `
<script setup lang="ts">
defineProps<{
name: string
}>()
<\/script>
<template>
<div>
<h1>Hello {{ name }}!</h1>
</div>
</template>
`,
test: `
import { expect, test } from 'vitest'
import { render } from 'vitest-browser-vue'
import HelloWorld from './HelloWorld.vue'
test('renders name', async () => {
const { getByText } = render(HelloWorld, {
props: { name: 'Vitest' },
})
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
})
`
};
const svelteExample = {
name: "HelloWorld.svelte",
js: `
<script>
export let name
<\/script>
<h1>Hello {name}!</h1>
`,
ts: `
<script lang="ts">
export let name: string
<\/script>
<h1>Hello {name}!</h1>
`,
test: `
import { expect, test } from 'vitest'
import { render } from 'vitest-browser-svelte'
import HelloWorld from './HelloWorld.svelte'
test('renders name', async () => {
const { getByText } = render(HelloWorld, { name: 'Vitest' })
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
})
`
};
const markoExample = {
name: "HelloWorld.marko",
js: `
class {
onCreate() {
this.state = { name: null }
}
}
<h1>Hello \${state.name}!</h1>
`,
ts: `
export interface Input {
name: string
}
<h1>Hello \${input.name}!</h1>
`,
test: `
import { expect, test } from 'vitest'
import { render } from '@marko/testing-library'
import HelloWorld from './HelloWorld.svelte'
test('renders name', async () => {
const { getByText } = await render(HelloWorld, { name: 'Vitest' })
const element = getByText('Hello Vitest!')
expect(element).toBeInTheDocument()
})
`
};
const litExample = {
name: "HelloWorld.js",
js: `
import { html, LitElement } from 'lit'
export class HelloWorld extends LitElement {
static properties = {
name: { type: String },
}
constructor() {
super()
this.name = 'World'
}
render() {
return html\`<h1>Hello \${this.name}!</h1>\`
}
}
customElements.define('hello-world', HelloWorld)
`,
ts: `
import { html, LitElement } from 'lit'
import { customElement, property } from 'lit/decorators.js'
@customElement('hello-world')
export class HelloWorld extends LitElement {
@property({ type: String })
name = 'World'
render() {
return html\`<h1>Hello \${this.name}!</h1>\`
}
}
declare global {
interface HTMLElementTagNameMap {
'hello-world': HelloWorld
}
}
`,
test: `
import { expect, test } from 'vitest'
import { render } from 'vitest-browser-lit'
import { html } from 'lit'
import './HelloWorld.js'
test('renders name', async () => {
const screen = render(html\`<hello-world name="Vitest"></hello-world>\`)
const element = screen.getByText('Hello Vitest!')
await expect.element(element).toBeInTheDocument()
})
`
};
const qwikExample = {
name: "HelloWorld.jsx",
js: `
import { component$ } from '@builder.io/qwik'
export default component$(({ name }) => {
return (
<div>
<h1>Hello {name}!</h1>
</div>
)
})
`,
ts: `
import { component$ } from '@builder.io/qwik'
export default component$(({ name }: { name: string }) => {
return (
<div>
<h1>Hello {name}!</h1>
</div>
)
})
`,
test: `
import { expect, test } from 'vitest'
import { render } from 'vitest-browser-qwik'
import HelloWorld from './HelloWorld.tsx'
test('renders name', async () => {
const { getByText } = render(<HelloWorld name="Vitest" />)
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
})
`
};
const preactExample = {
name: "HelloWorld.jsx",
js: `
export default function HelloWorld({ name }) {
return (
<div>
<h1>Hello {name}!</h1>
</div>
)
}
`,
ts: `
export default function HelloWorld({ name }: { name: string }) {
return (
<div>
<h1>Hello {name}!</h1>
</div>
)
}
`,
test: `
import { expect, test } from 'vitest'
import { render } from 'vitest-browser-preact'
import HelloWorld from './HelloWorld.<EXT>x'
test('renders name', async () => {
const { getByText } = render(<HelloWorld name="Vitest" />)
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
})
`
};
const vanillaExample = {
name: "HelloWorld.js",
js: `
export default function HelloWorld({ name }) {
const parent = document.createElement('div')
const h1 = document.createElement('h1')
h1.textContent = 'Hello ' + name + '!'
parent.appendChild(h1)
return parent
}
`,
ts: `
export default function HelloWorld({ name }: { name: string }): HTMLDivElement {
const parent = document.createElement('div')
const h1 = document.createElement('h1')
h1.textContent = 'Hello ' + name + '!'
parent.appendChild(h1)
return parent
}
`,
test: `
import { expect, test } from 'vitest'
import { getByText } from '@testing-library/dom'
import HelloWorld from './HelloWorld.js'
test('renders name', () => {
const parent = HelloWorld({ name: 'Vitest' })
document.body.appendChild(parent)
const element = getByText(parent, 'Hello Vitest!')
expect(element).toBeInTheDocument()
})
`
};
function getExampleTest(framework) {
switch (framework) {
case "solid": return {
...jsxExample,
test: jsxExample.test.replace("@testing-library/jsx", `@testing-library/${framework}`)
};
case "preact": return preactExample;
case "react": return {
...jsxExample,
test: jsxExample.test.replace("@testing-library/jsx", `vitest-browser-${framework}`)
};
case "vue": return vueExample;
case "svelte": return svelteExample;
case "lit": return litExample;
case "marko": return markoExample;
case "qwik": return qwikExample;
default: return vanillaExample;
}
}
async function generateExampleFiles(framework, lang) {
const example = getExampleTest(framework);
let fileName = example.name;
const folder = resolve(process.cwd(), "vitest-example");
const fileContent = example[lang];
if (!existsSync(folder)) await mkdir(folder, { recursive: true });
const isJSX = fileName.endsWith(".jsx");
if (isJSX && lang === "ts") fileName = fileName.replace(".jsx", ".tsx");
else if (fileName.endsWith(".js") && lang === "ts") fileName = fileName.replace(".js", ".ts");
example.test = example.test.replace("<EXT>", lang);
const filePath = resolve(folder, fileName);
const testPath = resolve(folder, `HelloWorld.test.${isJSX ? `${lang}x` : lang}`);
writeFileSync(filePath, fileContent.trimStart(), "utf-8");
writeFileSync(testPath, example.test.trimStart(), "utf-8");
return testPath;
}
// eslint-disable-next-line no-console
const log = console.log;
function getProviderOptions() {
return Object.entries({
playwright: "Playwright relies on Chrome DevTools protocol. Read more: https://playwright.dev",
webdriverio: "WebdriverIO uses WebDriver protocol. Read more: https://webdriver.io",
preview: "Preview is useful to quickly run your tests in the browser, but not suitable for CI."
}).map(([provider, description]) => {
return {
title: provider,
description,
value: provider
};
});
}
function getBrowserNames(provider) {
switch (provider) {
case "webdriverio": return [
"chrome",
"firefox",
"edge",
"safari"
];
case "playwright": return [
"chromium",
"firefox",
"webkit"
];
case "preview": return [
"chrome",
"firefox",
"safari"
];
}
}
function getFramework() {
return [
{
title: "vanilla",
value: "vanilla",
description: "No framework, just plain JavaScript or TypeScript."
},
{
title: "vue",
value: "vue",
description: "\"The Progressive JavaScript Framework\""
},
{
title: "svelte",
value: "svelte",
description: "\"Svelte: cybernetically enhanced web apps\""
},
{
title: "react",
value: "react",
description: "\"The library for web and native user interfaces\""
},
{
title: "lit",
value: "lit",
description: "\"A simple library for building fast, lightweight web components.\""
},
{
title: "preact",
value: "preact",
description: "\"Fast 3kB alternative to React with the same modern API\""
},
{
title: "solid",
value: "solid",
description: "\"Simple and performant reactivity for building user interfaces\""
},
{
title: "marko",
value: "marko",
description: "\"A declarative, HTML-based language that makes building web apps fun\""
},
{
title: "qwik",
value: "qwik",
description: "\"Instantly interactive web apps at scale\""
}
];
}
function getFrameworkTestPackage(framework) {
switch (framework) {
case "vanilla": return null;
case "vue": return "vitest-browser-vue";
case "svelte": return "vitest-browser-svelte";
case "react": return "vitest-browser-react";
case "lit": return "vitest-browser-lit";
case "preact": return "vitest-browser-preact";
case "solid": return "@solidjs/testing-library";
case "marko": return "@marko/testing-library";
case "qwik": return "vitest-browser-qwik";
}
throw new Error(`Unsupported framework: ${framework}`);
}
function getFrameworkPluginPackage(framework) {
switch (framework) {
case "vue": return "@vitejs/plugin-vue";
case "svelte": return "@sveltejs/vite-plugin-svelte";
case "react": return "@vitejs/plugin-react";
case "preact": return "@preact/preset-vite";
case "solid": return "vite-plugin-solid";
case "marko": return "@marko/vite";
case "qwik": return "@builder.io/qwik/optimizer";
}
return null;
}
function getLanguageOptions() {
return [{
title: "TypeScript",
description: "Use TypeScript.",
value: "ts"
}, {
title: "JavaScript",
description: "Use plain JavaScript.",
value: "js"
}];
}
async function installPackages(pkgManager, packages) {
if (!packages.length) {
log(c.green("✔"), c.bold("All packages are already installed."));
return;
}
log(c.cyan("◼"), c.bold("Installing packages..."));
log(c.cyan("◼"), packages.join(", "));
log();
await installPackage(packages, {
dev: true,
packageManager: pkgManager ?? void 0
});
}
function readPkgJson(path) {
if (!existsSync(path)) return null;
const content = readFileSync(path, "utf-8");
return JSON.parse(content);
}
function getPossibleDefaults(dependencies) {
return {
lang: "ts",
provider: getPossibleProvider(dependencies),
framework: getPossibleFramework(dependencies)
};
}
function getPossibleFramework(dependencies) {
if (dependencies.vue || dependencies["vue-tsc"] || dependencies["@vue/reactivity"]) return "vue";
if (dependencies.react || dependencies["react-dom"]) return "react";
if (dependencies.svelte || dependencies["@sveltejs/kit"]) return "svelte";
if (dependencies.lit || dependencies["lit-html"]) return "lit";
if (dependencies.preact) return "preact";
if (dependencies["solid-js"] || dependencies["@solidjs/start"]) return "solid";
if (dependencies.marko) return "marko";
if (dependencies["@builder.io/qwik"] || dependencies["@qwik.dev/core"]) return "qwik";
return "vanilla";
}
function getPossibleProvider(dependencies) {
if (dependencies.webdriverio || dependencies["@wdio/cli"] || dependencies["@wdio/config"]) return "webdriverio";
// playwright is the default recommendation
return "playwright";
}
function getProviderDocsLink(provider) {
switch (provider) {
case "playwright": return "https://vitest.dev/config/browser/playwright";
case "webdriverio": return "https://vitest.dev/config/browser/webdriverio";
}
}
function sort(choices, value) {
const index = choices.findIndex((i) => i.value === value);
if (index === -1) return choices;
return [choices.splice(index, 1)[0], ...choices];
}
function fail() {
process.exitCode = 1;
}
function getFrameworkImportInfo(framework) {
switch (framework) {
case "svelte": return {
importName: "svelte",
isNamedExport: true
};
case "qwik": return {
importName: "qwikVite",
isNamedExport: true
};
default: return {
importName: framework,
isNamedExport: false
};
}
}
async function generateFrameworkConfigFile(options) {
const { importName, isNamedExport } = getFrameworkImportInfo(options.framework);
const frameworkImport = isNamedExport ? `import { ${importName} } from '${options.frameworkPlugin}'` : `import ${importName} from '${options.frameworkPlugin}'`;
const configContent = [
`import { defineConfig } from 'vitest/config'`,
`import { ${options.provider} } from '@vitest/browser-${options.provider}'`,
options.frameworkPlugin ? frameworkImport : null,
``,
"export default defineConfig({",
options.frameworkPlugin ? ` plugins: [${importName}()],` : null,
` test: {`,
` browser: {`,
` enabled: true,`,
` provider: ${options.provider}(),`,
options.provider !== "preview" && ` // ${getProviderDocsLink(options.provider)}`,
` instances: [`,
...options.browsers.map((browser) => ` { browser: '${browser}' },`),
` ],`,
` },`,
` },`,
`})`,
""
].filter((t) => typeof t === "string").join("\n");
await writeFile(options.configPath, configContent);
}
async function updatePkgJsonScripts(pkgJsonPath, vitestScript) {
if (!existsSync(pkgJsonPath)) {
const pkg = { scripts: { "test:browser": vitestScript } };
await writeFile(pkgJsonPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf-8");
} else {
const pkg = JSON.parse(readFileSync(pkgJsonPath, "utf-8"));
pkg.scripts = pkg.scripts || {};
pkg.scripts["test:browser"] = vitestScript;
await writeFile(pkgJsonPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf-8");
}
log(c.green("✔"), "Added \"test:browser\" script to your package.json.");
}
function getRunScript(pkgManager) {
switch (pkgManager) {
case "yarn@berry":
case "yarn": return "yarn test:browser";
case "pnpm@6":
case "pnpm": return "pnpm test:browser";
case "bun": return "bun test:browser";
default: return "npm run test:browser";
}
}
function getPlaywrightRunArgs(pkgManager) {
switch (pkgManager) {
case "yarn@berry":
case "yarn": return ["yarn", "exec"];
case "pnpm@6":
case "pnpm": return ["pnpx"];
case "bun": return ["bunx"];
default: return ["npx"];
}
}
async function create() {
log(c.cyan("◼"), "This utility will help you set up a browser testing environment.\n");
const pkgJsonPath = resolve(process.cwd(), "package.json");
const pkg = readPkgJson(pkgJsonPath) || {};
const dependencies = {
...pkg.dependencies,
...pkg.devDependencies
};
const defaults = getPossibleDefaults(dependencies);
const { lang } = await prompt({
type: "select",
name: "lang",
message: "Choose a language for your tests",
choices: sort(getLanguageOptions(), defaults?.lang)
});
if (!lang) return fail();
const { provider } = await prompt({
type: "select",
name: "provider",
message: "Choose a browser provider. Vitest will use its API to control the testing environment",
choices: sort(getProviderOptions(), defaults?.provider)
});
if (!provider) return fail();
const { browsers } = await prompt({
type: "multiselect",
name: "browsers",
message: "Choose a browser",
choices: getBrowserNames(provider).map((browser) => ({
title: browser,
value: browser
}))
});
if (!provider) return fail();
const { framework } = await prompt({
type: "select",
name: "framework",
message: "Choose your framework",
choices: sort(getFramework(), defaults?.framework)
});
if (!framework) return fail();
let installPlaywright = false;
if (provider === "playwright") ({installPlaywright} = await prompt({
type: "confirm",
name: "installPlaywright",
message: `Install Playwright browsers (can be done manually via 'pnpm exec playwright install')?`
}));
if (installPlaywright == null) return fail();
const dependenciesToInstall = [`@vitest/browser-${provider}`];
const frameworkPackage = getFrameworkTestPackage(framework);
if (frameworkPackage) dependenciesToInstall.push(frameworkPackage);
const frameworkPlugin = getFrameworkPluginPackage(framework);
if (frameworkPlugin) dependenciesToInstall.push(frameworkPlugin);
const pkgManager = await detectPackageManager();
log();
await installPackages(pkgManager, dependenciesToInstall.filter((pkg) => !dependencies[pkg]));
const rootConfig = any(configFiles, { cwd: process.cwd() });
let scriptCommand = "vitest";
log();
if (rootConfig) {
const configPath = resolve(dirname(rootConfig), `vitest.browser.config.${lang}`);
scriptCommand = `vitest --config=${relative(process.cwd(), configPath)}`;
await generateFrameworkConfigFile({
configPath,
framework,
frameworkPlugin,
provider,
browsers
});
log(
c.green("✔"),
"Created a new config file for browser tests:",
c.bold(relative(process.cwd(), configPath)),
// TODO: Can we modify the config ourselves?
"\nSince you already have a Vitest config file, it is recommended to copy the contents of the new file ",
"into your existing config located at ",
c.bold(relative(process.cwd(), rootConfig))
);
} else {
const configPath = resolve(process.cwd(), `vitest.config.${lang}`);
await generateFrameworkConfigFile({
configPath,
framework,
frameworkPlugin,
provider,
browsers
});
log(c.green("✔"), "Created a config file for browser tests:", c.bold(relative(process.cwd(), configPath)));
}
log();
await updatePkgJsonScripts(pkgJsonPath, scriptCommand);
if (installPlaywright) {
log();
const [command, ...args] = getPlaywrightRunArgs(pkgManager);
const allArgs = [
...args,
"playwright",
"install",
"--with-deps"
];
log(c.cyan("◼"), `Installing Playwright dependencies with \`${c.bold(command)} ${c.bold(allArgs.join(" "))}\`...`);
log();
await x(command, allArgs, { nodeOptions: { stdio: [
"pipe",
"inherit",
"inherit"
] } });
}
log();
const exampleTestFile = await generateExampleFiles(framework, lang);
log(c.green("✔"), "Created example test file in", c.bold(relative(process.cwd(), exampleTestFile)));
log(c.dim(" You can safely delete this file once you have written your own tests."));
log();
log(c.cyan("◼"), "All done! Run your tests with", c.bold(getRunScript(pkgManager)));
}
export { create };
@@ -0,0 +1,25 @@
/**
* Check if the value is a Promise-like object.
*
* 校验是否是一个 Promise-like 对象
*
* @example
* ```js
* import { isPromiseLike } from 'is-what-type';
*
* isPromiseLike(null); // false
* isPromiseLike(undefined); // false
* isPromiseLike({}); // false
* isPromiseLike(new Promise(() => { })); // true
* isPromiseLike({ then: () => { }, catch: () => { } }); // true
* isPromiseLike({ then: () => { } }); // true
* isPromiseLike({ catch: () => { } }); // false
* isPromiseLike('string'); // false
* isPromiseLike(123); // false
* isPromiseLike(function() {}); // false
* ```
*
* @param value - The value to check
* @returns `true` if the value is a Promise-like object, `false` otherwise
*/
export declare function isPromiseLike<T = unknown>(value: T): value is T;
@@ -0,0 +1,195 @@
import { chai } from '@vitest/expect';
import { createHook } from 'node:async_hooks';
import { l as loadDiffConfig, a as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.DYx3LtFI.js';
import { r as rpc } from './rpc.MzXet3jl.js';
import { g as getWorkerState } from './utils.BX5Fg8C4.js';
import { T as TestRunner, N as NodeBenchmarkRunner } from './test.DNmyFkvJ.js';
function setupChaiConfig(config) {
Object.assign(chai.config, config);
}
async function resolveSnapshotEnvironment(config, moduleRunner) {
if (!config.snapshotEnvironment) {
const { VitestNodeSnapshotEnvironment } = await import('./node.COQbm6gK.js');
return new VitestNodeSnapshotEnvironment();
}
const mod = await moduleRunner.import(config.snapshotEnvironment);
if (typeof mod.default !== "object" || !mod.default) throw new Error("Snapshot environment module must have a default export object with a shape of `SnapshotEnvironment`");
return mod.default;
}
const IGNORED_TYPES = new Set([
"DNSCHANNEL",
"ELDHISTOGRAM",
"PerformanceObserver",
"RANDOMBYTESREQUEST",
"SIGNREQUEST",
"STREAM_END_OF_STREAM",
"TCPWRAP",
"TIMERWRAP",
"TLSWRAP",
"ZLIB"
]);
function detectAsyncLeaks(testFile, projectName) {
const resources = /* @__PURE__ */ new Map();
const hook = createHook({
init(asyncId, type, triggerAsyncId, resource) {
if (IGNORED_TYPES.has(type)) return;
let stack = "";
const limit = Error.stackTraceLimit;
// VitestModuleEvaluator's async wrapper of node:vm causes out-of-bound stack traces, simply skip it.
// Crash fixed in https://github.com/vitejs/vite/pull/21585
try {
Error.stackTraceLimit = 100;
stack = (/* @__PURE__ */ new Error("VITEST_DETECT_ASYNC_LEAKS")).stack || "";
} catch {
return;
} finally {
Error.stackTraceLimit = limit;
}
if (!stack.includes(testFile)) {
const trigger = resources.get(triggerAsyncId);
if (!trigger) return;
stack = trigger.stack;
}
let isActive = isActiveDefault;
if ("hasRef" in resource) {
const ref = new WeakRef(resource);
isActive = () => ref.deref()?.hasRef() ?? false;
}
resources.set(asyncId, {
type,
stack,
projectName,
filename: testFile,
isActive
});
},
destroy(asyncId) {
if (resources.get(asyncId)?.type !== "PROMISE") resources.delete(asyncId);
},
promiseResolve(asyncId) {
resources.delete(asyncId);
}
});
hook.enable();
return async function collect() {
await Promise.resolve(setImmediate);
hook.disable();
const leaks = [];
for (const resource of resources.values()) if (resource.isActive()) leaks.push({
stack: resource.stack,
type: resource.type,
filename: resource.filename,
projectName: resource.projectName
});
resources.clear();
return leaks;
};
}
function isActiveDefault() {
return true;
}
async function getTestRunnerConstructor(config, moduleRunner) {
if (!config.runner) return config.mode === "test" ? TestRunner : NodeBenchmarkRunner;
const mod = await moduleRunner.import(config.runner);
if (!mod.default && typeof mod.default !== "function") throw new Error(`Runner must export a default function, but got ${typeof mod.default} imported from ${config.runner}`);
return mod.default;
}
async function resolveTestRunner(config, moduleRunner, traces) {
const testRunner = new (await (getTestRunnerConstructor(config, moduleRunner)))(config);
// inject private executor to every runner
Object.defineProperty(testRunner, "moduleRunner", {
value: moduleRunner,
enumerable: false,
configurable: false
});
if (!testRunner.config) testRunner.config = config;
if (!testRunner.importFile) throw new Error("Runner must implement \"importFile\" method.");
if ("__setTraces" in testRunner) testRunner.__setTraces(traces);
const [diffOptions] = await Promise.all([loadDiffConfig(config, moduleRunner), loadSnapshotSerializers(config, moduleRunner)]);
testRunner.config.diffOptions = diffOptions;
// patch some methods, so custom runners don't need to call RPC
const originalOnTaskUpdate = testRunner.onTaskUpdate;
testRunner.onTaskUpdate = async (task, events) => {
const p = rpc().onTaskUpdate(task, events);
await originalOnTaskUpdate?.call(testRunner, task, events);
return p;
};
// patch some methods, so custom runners don't need to call RPC
const originalOnTestAnnotate = testRunner.onTestAnnotate;
testRunner.onTestAnnotate = async (test, annotation) => {
const p = rpc().onTaskArtifactRecord(test.id, {
type: "internal:annotation",
location: annotation.location,
annotation
});
const overriddenResult = await originalOnTestAnnotate?.call(testRunner, test, annotation);
const vitestResult = await p;
return overriddenResult || vitestResult.annotation;
};
const originalOnTestArtifactRecord = testRunner.onTestArtifactRecord;
testRunner.onTestArtifactRecord = async (test, artifact) => {
const p = rpc().onTaskArtifactRecord(test.id, artifact);
const overriddenResult = await originalOnTestArtifactRecord?.call(testRunner, test, artifact);
const vitestResult = await p;
return overriddenResult || vitestResult;
};
const originalOnCollectStart = testRunner.onCollectStart;
testRunner.onCollectStart = async (file) => {
await rpc().onQueued(file);
await originalOnCollectStart?.call(testRunner, file);
};
const originalOnCollected = testRunner.onCollected;
testRunner.onCollected = async (files) => {
const state = getWorkerState();
files.forEach((file) => {
file.prepareDuration = state.durations.prepare;
file.environmentLoad = state.durations.environment;
// should be collected only for a single test file in a batch
state.durations.prepare = 0;
state.durations.environment = 0;
});
// Strip function conditions from retry config before sending via RPC
// Functions cannot be cloned by structured clone algorithm
const sanitizeRetryConditions = (task) => {
if (task.retry && typeof task.retry === "object" && typeof task.retry.condition === "function")
// Remove function condition - it can't be serialized
task.retry = {
...task.retry,
condition: void 0
};
if (task.tasks) task.tasks.forEach(sanitizeRetryConditions);
};
files.forEach(sanitizeRetryConditions);
rpc().onCollected(files);
await originalOnCollected?.call(testRunner, files);
};
const originalOnAfterRun = testRunner.onAfterRunFiles;
testRunner.onAfterRunFiles = async (files) => {
const state = getWorkerState();
const coverage = await takeCoverageInsideWorker(config.coverage, moduleRunner);
if (coverage) rpc().onAfterSuiteRun({
coverage,
testFiles: files.map((file) => file.name).sort(),
environment: state.environment.viteEnvironment || state.environment.name,
projectName: state.ctx.projectName
});
await originalOnAfterRun?.call(testRunner, files);
};
const originalOnAfterRunTask = testRunner.onAfterRunTask;
testRunner.onAfterRunTask = async (test) => {
if (config.bail && test.result?.state === "fail") {
if (1 + await rpc().getCountOfFailedTests() >= config.bail) {
rpc().onCancel("test-failure");
testRunner.cancel?.("test-failure");
}
}
await originalOnAfterRunTask?.call(testRunner, test);
};
return testRunner;
}
export { resolveSnapshotEnvironment as a, detectAsyncLeaks as d, resolveTestRunner as r, setupChaiConfig as s };
@@ -0,0 +1 @@
{"version":3,"file":"assert-valid-pattern.js","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAA;AAC7B,MAAM,kBAAkB,GAA+B,CAC5D,OAAgB,EACW,EAAE;IAC7B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAA;IACxC,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB,EAAE,CAAC;QACxC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAA;IAC5C,CAAC;AACH,CAAC,CAAA;AAVY,QAAA,kBAAkB,sBAU9B","sourcesContent":["const MAX_PATTERN_LENGTH = 1024 * 64\nexport const assertValidPattern: (pattern: unknown) => void = (\n pattern: unknown,\n): asserts pattern is string => {\n if (typeof pattern !== 'string') {\n throw new TypeError('invalid pattern')\n }\n\n if (pattern.length > MAX_PATTERN_LENGTH) {\n throw new TypeError('pattern is too long')\n }\n}\n"]}
@@ -0,0 +1,39 @@
{
"name": "type-check",
"version": "0.4.0",
"author": "George Zahariev <z@georgezahariev.com>",
"description": "type-check allows you to check the types of JavaScript values at runtime with a Haskell like type syntax.",
"homepage": "https://github.com/gkz/type-check",
"keywords": [
"type",
"check",
"checking",
"library"
],
"files": [
"lib",
"README.md",
"LICENSE"
],
"main": "./lib/",
"bugs": "https://github.com/gkz/type-check/issues",
"license": "MIT",
"engines": {
"node": ">= 0.8.0"
},
"repository": {
"type": "git",
"url": "git://github.com/gkz/type-check.git"
},
"scripts": {
"test": "make test"
},
"dependencies": {
"prelude-ls": "^1.2.1"
},
"devDependencies": {
"livescript": "^1.6.0",
"mocha": "^7.1.1",
"browserify": "^16.5.1"
}
}
@@ -0,0 +1,3 @@
export declare function objectForEachKey<T extends Record<string, unknown>>(obj: T, callback: (key: keyof T) => void): void;
export declare function objectMapKey<T extends Record<string, unknown>, Return>(obj: T, callback: (key: keyof T) => Return): Return[];
export declare function objectReduceKey<T extends Record<string, unknown>, Accumulator>(obj: T, callback: (acc: Accumulator, key: keyof T) => Accumulator, initial: Accumulator): Accumulator;
@@ -0,0 +1 @@
{"version":3,"file":"passwords.json.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -0,0 +1 @@
{"version":3,"names":["_sourceMap","require","_printer","normalizeOptions","code","opts","ast","_opts$recordAndTupleS","experimental_preserveFormat","Error","retainLines","compact","minified","jsescOption","Array","isArray","tokens","format","auxiliaryCommentBefore","auxiliaryCommentAfter","shouldPrintComment","preserveFormat","retainFunctionParens","comments","concise","indent","adjustMultilineComment","style","Object","assign","quotes","wrap","minimal","topicToken","decoratorsBeforeExport","json","jsonCompatibleStrings","recordAndTupleSyntaxType","importAttributesKeyword","value","includes","length","console","error","filename","undefined","exports","CodeGenerator","constructor","_ast","_format","_map","sourceMaps","SourceMap","generate","printer","Printer","map","_default","default"],"sources":["../src/index.ts"],"sourcesContent":["import SourceMap from \"./source-map.ts\";\nimport Printer from \"./printer.ts\";\nimport type * as t from \"@babel/types\";\nimport type { Opts as jsescOptions } from \"jsesc\";\nimport type { Format } from \"./printer.ts\";\nimport type {\n EncodedSourceMap,\n DecodedSourceMap,\n Mapping,\n} from \"@jridgewell/gen-mapping\";\n\n/**\n * Normalize generator options, setting defaults.\n *\n * - Detects code indentation.\n * - If `opts.compact = \"auto\"` and the code is over 500KB, `compact` will be set to `true`.\n */\n\nfunction normalizeOptions(\n code: string | Record<string, string> | undefined,\n opts: GeneratorOptions,\n ast: t.Node,\n): Format {\n if (opts.experimental_preserveFormat) {\n if (typeof code !== \"string\") {\n throw new Error(\n \"`experimental_preserveFormat` requires the original `code` to be passed to @babel/generator as a string\",\n );\n }\n if (!opts.retainLines) {\n throw new Error(\n \"`experimental_preserveFormat` requires `retainLines` to be set to `true`\",\n );\n }\n if (opts.compact && opts.compact !== \"auto\") {\n throw new Error(\n \"`experimental_preserveFormat` is not compatible with the `compact` option\",\n );\n }\n if (opts.minified) {\n throw new Error(\n \"`experimental_preserveFormat` is not compatible with the `minified` option\",\n );\n }\n if (opts.jsescOption) {\n throw new Error(\n \"`experimental_preserveFormat` is not compatible with the `jsescOption` option\",\n );\n }\n if (!Array.isArray((ast as any).tokens)) {\n throw new Error(\n \"`experimental_preserveFormat` requires the AST to have attached the token of the input code. Make sure to enable the `tokens: true` parser option.\",\n );\n }\n }\n\n const format: Format = {\n auxiliaryCommentBefore: opts.auxiliaryCommentBefore,\n auxiliaryCommentAfter: opts.auxiliaryCommentAfter,\n // @ts-expect-error define it later\n shouldPrintComment: opts.shouldPrintComment,\n preserveFormat: opts.experimental_preserveFormat,\n retainLines: opts.retainLines,\n retainFunctionParens: opts.retainFunctionParens,\n comments: opts.comments == null || opts.comments,\n compact: opts.compact,\n minified: opts.minified,\n concise: opts.concise,\n indent: {\n adjustMultilineComment: true,\n style: \" \",\n },\n jsescOption: {\n quotes: \"double\",\n wrap: true,\n minimal: process.env.BABEL_8_BREAKING ? true : false,\n ...opts.jsescOption,\n },\n topicToken: opts.topicToken,\n };\n\n if (!process.env.BABEL_8_BREAKING) {\n format.decoratorsBeforeExport = opts.decoratorsBeforeExport;\n format.jsescOption.json = opts.jsonCompatibleStrings;\n format.recordAndTupleSyntaxType = opts.recordAndTupleSyntaxType ?? \"hash\";\n format.importAttributesKeyword = opts.importAttributesKeyword;\n }\n\n if (format.minified) {\n format.compact = true;\n\n format.shouldPrintComment =\n format.shouldPrintComment || (() => format.comments);\n } else {\n format.shouldPrintComment =\n format.shouldPrintComment ||\n (value =>\n format.comments ||\n value.includes(\"@license\") ||\n value.includes(\"@preserve\"));\n }\n\n if (format.compact === \"auto\") {\n format.compact = typeof code === \"string\" && code.length > 500_000; // 500KB\n\n if (format.compact) {\n console.error(\n \"[BABEL] Note: The code generator has deoptimised the styling of \" +\n `${opts.filename} as it exceeds the max of ${\"500KB\"}.`,\n );\n }\n }\n\n if (format.compact || format.preserveFormat) {\n format.indent.adjustMultilineComment = false;\n }\n\n const { auxiliaryCommentBefore, auxiliaryCommentAfter, shouldPrintComment } =\n format;\n\n if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) {\n format.auxiliaryCommentBefore = undefined;\n }\n if (auxiliaryCommentAfter && !shouldPrintComment(auxiliaryCommentAfter)) {\n format.auxiliaryCommentAfter = undefined;\n }\n\n return format;\nLine truncated
@@ -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 SquareEqual = createLucideIcon("SquareEqual", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "M7 10h10", key: "1101jm" }],
["path", { d: "M7 14h10", key: "1mhdw3" }]
]);
export { SquareEqual as default };
//# sourceMappingURL=square-equal.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"8":"_E"},B:{"1":"_J"},C:{"1":"_7F","4":"K OB","8":"_WS"},D:{"1":"_vO","4":"pB","8":"_bL"},E:{"1":"_VI","8":"_5C"},F:{"1":"_uR","4":"nB","8":"_HR"},G:{"1":"_9B","8":"_EB"},H:{"8":"1D"},I:{"1":"_YD","8":"_wG"},J:{"8":"_B"},K:{"1":"H","8":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"8":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:6,C:"Promises",D:true};
@@ -0,0 +1,187 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('no-loop-func');
exports.default = (0, util_1.createRule)({
name: 'no-loop-func',
meta: {
type: 'suggestion',
// defaultOptions, -- base rule does not use defaultOptions
docs: {
description: 'Disallow function declarations that contain unsafe references inside loop statements',
extendsBaseRule: true,
},
hasSuggestions: baseRule.meta.hasSuggestions,
messages: baseRule.meta.messages,
schema: [],
},
defaultOptions: [],
create(context) {
const SKIPPED_IIFE_NODES = new Set();
/**
* Gets the containing loop node of a specified node.
*
* We don't need to check nested functions, so this ignores those.
* `Scope.through` contains references of nested functions.
*
* @param node An AST node to get.
* @returns The containing loop node of the specified node, or `null`.
*/
function getContainingLoopNode(node) {
for (let currentNode = node; currentNode.parent; currentNode = currentNode.parent) {
const parent = currentNode.parent;
switch (parent.type) {
case utils_1.AST_NODE_TYPES.WhileStatement:
case utils_1.AST_NODE_TYPES.DoWhileStatement:
return parent;
case utils_1.AST_NODE_TYPES.ForStatement:
// `init` is outside of the loop.
if (parent.init !== currentNode) {
return parent;
}
break;
case utils_1.AST_NODE_TYPES.ForInStatement:
case utils_1.AST_NODE_TYPES.ForOfStatement:
// `right` is outside of the loop.
if (parent.right !== currentNode) {
return parent;
}
break;
case utils_1.AST_NODE_TYPES.ArrowFunctionExpression:
case utils_1.AST_NODE_TYPES.FunctionExpression:
case utils_1.AST_NODE_TYPES.FunctionDeclaration:
// We don't need to check nested functions.
// We need to check nested functions only in case of IIFE.
if (SKIPPED_IIFE_NODES.has(parent)) {
break;
}
return null;
default:
break;
}
}
return null;
}
/**
* Gets the containing loop node of a given node.
* If the loop was nested, this returns the most outer loop.
* @param node A node to get. This is a loop node.
* @param excludedNode A node that the result node should not include.
* @returns The most outer loop node.
*/
function getTopLoopNode(node, excludedNode) {
const border = excludedNode ? excludedNode.range[1] : 0;
let retv = node;
let containingLoopNode = node;
while (containingLoopNode && containingLoopNode.range[0] >= border) {
retv = containingLoopNode;
containingLoopNode = getContainingLoopNode(containingLoopNode);
}
return retv;
}
/**
* Checks whether a given reference which refers to an upper scope's variable is
* safe or not.
* @param loopNode A containing loop node.
* @param reference A reference to check.
* @returns `true` if the reference is safe or not.
*/
function isSafe(loopNode, reference) {
const variable = reference.resolved;
const definition = variable?.defs[0];
const declaration = definition?.parent;
const kind = declaration?.type === utils_1.AST_NODE_TYPES.VariableDeclaration
? declaration.kind
: '';
// type references are all safe
// this only really matters for global types that haven't been configured
if (reference.isTypeReference) {
return true;
}
// Variables which are declared by `const` is safe.
if (kind === 'const') {
return true;
}
/*
* Variables which are declared by `let` in the loop is safe.
* It's a different instance from the next loop step's.
*/
if (kind === 'let' &&
declaration &&
declaration.range[0] > loopNode.range[0] &&
declaration.range[1] < loopNode.range[1]) {
return true;
}
/*
* WriteReferences which exist after this border are unsafe because those
* can modify the variable.
*/
const border = getTopLoopNode(loopNode, kind === 'let' ? declaration : null).range[0];
/**
* Checks whether a given reference is safe or not.
* The reference is every reference of the upper scope's variable we are
* looking now.
*
* It's safe if the reference matches one of the following condition.
* - is readonly.
* - doesn't exist inside a local function and after the border.
*
* @param upperRef A reference to check.
* @returns `true` if the reference is safe.
*/
function isSafeReference(upperRef) {
const id = upperRef.identifier;
return (!upperRef.isWrite() ||
(variable?.scope.variableScope === upperRef.from.variableScope &&
id.range[0] < border));
}
return variable?.references.every(isSafeReference) ?? false;
}
/**
* Reports functions which match the following condition:
* - has a loop node in ancestors.
* - has any references which refers to an unsafe variable.
*
* @param node The AST node to check.
*/
function checkForLoops(node) {
const loopNode = getContainingLoopNode(node);
if (!loopNode) {
return;
}
const references = context.sourceCode.getScope(node).through;
if (!(node.async || node.generator) && isIIFE(node)) {
const isFunctionExpression = node.type === utils_1.AST_NODE_TYPES.FunctionExpression;
// Check if the function is referenced elsewhere in the code
const isFunctionReferenced = isFunctionExpression && node.id
? references.some(r => r.identifier.name === node.id?.name)
: false;
if (!isFunctionReferenced) {
SKIPPED_IIFE_NODES.add(node);
return;
}
}
const unsafeRefs = references
.filter(r => r.resolved && !isSafe(loopNode, r))
.map(r => r.identifier.name);
if (unsafeRefs.length > 0) {
context.report({
node,
messageId: 'unsafeRefs',
data: { varNames: `'${unsafeRefs.join("', '")}'` },
});
}
}
return {
ArrowFunctionExpression: checkForLoops,
FunctionDeclaration: checkForLoops,
FunctionExpression: checkForLoops,
};
},
});
function isIIFE(node) {
return (node.parent.type === utils_1.AST_NODE_TYPES.CallExpression &&
node.parent.callee === node);
}
@@ -0,0 +1,71 @@
"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: 'prefer-ts-expect-error',
meta: {
type: 'problem',
deprecated: {
deprecatedSince: '7.11.0',
replacedBy: [
{
rule: {
name: '@typescript-eslint/ban-ts-comment',
url: 'https://typescript-eslint.io/rules/ban-ts-comment',
},
},
],
url: 'https://github.com/typescript-eslint/typescript-eslint/pull/9081',
},
docs: {
description: 'Enforce using `@ts-expect-error` over `@ts-ignore`',
},
fixable: 'code',
messages: {
preferExpectErrorComment: 'Use "@ts-expect-error" to ensure an error is actually being suppressed.',
},
replacedBy: ['@typescript-eslint/ban-ts-comment'],
schema: [],
},
defaultOptions: [],
create(context) {
const tsIgnoreRegExpSingleLine = /^\s*\/?\s*@ts-ignore/;
const tsIgnoreRegExpMultiLine = /^\s*(?:\/|\*)*\s*@ts-ignore/;
function isLineComment(comment) {
return comment.type === utils_1.AST_TOKEN_TYPES.Line;
}
function getLastCommentLine(comment) {
if (isLineComment(comment)) {
return comment.value;
}
// For multiline comments - we look at only the last line.
const commentlines = comment.value.split('\n');
return commentlines[commentlines.length - 1];
}
function isValidTsIgnorePresent(comment) {
const line = getLastCommentLine(comment);
return isLineComment(comment)
? tsIgnoreRegExpSingleLine.test(line)
: tsIgnoreRegExpMultiLine.test(line);
}
return {
Program() {
const comments = context.sourceCode.getAllComments();
comments.forEach(comment => {
if (isValidTsIgnorePresent(comment)) {
const lineCommentRuleFixer = (fixer) => fixer.replaceText(comment, `//${comment.value.replace('@ts-ignore', '@ts-expect-error')}`);
const blockCommentRuleFixer = (fixer) => fixer.replaceText(comment, `/*${comment.value.replace('@ts-ignore', '@ts-expect-error')}*/`);
context.report({
node: comment,
messageId: 'preferExpectErrorComment',
fix: isLineComment(comment)
? lineCommentRuleFixer
: blockCommentRuleFixer,
});
}
});
},
};
},
});
@@ -0,0 +1,23 @@
/**
* @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 Magnet = createLucideIcon("Magnet", [
[
"path",
{
d: "m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15",
key: "1i3lhw"
}
],
["path", { d: "m5 8 4 4", key: "j6kj7e" }],
["path", { d: "m12 15 4 4", key: "lnac28" }]
]);
export { Magnet as default };
//# sourceMappingURL=magnet.js.map
@@ -0,0 +1,19 @@
/**
* @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 Cigarette = createLucideIcon("Cigarette", [
["path", { d: "M17 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h14", key: "1mb5g1" }],
["path", { d: "M18 8c0-2.5-2-2.5-2-5", key: "1il607" }],
["path", { d: "M21 16a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1", key: "1yl5r7" }],
["path", { d: "M22 8c0-2.5-2-2.5-2-5", key: "1gah44" }],
["path", { d: "M7 12v4", key: "jqww69" }]
]);
export { Cigarette as default };
//# sourceMappingURL=cigarette.js.map
@@ -0,0 +1,42 @@
import { createMockInstance } from '@vitest/spy';
import { M as ModuleMocker, r as rpc, c as createCompilerHints, h as hot } from './chunk-mocker.js';
import './chunk-helpers.js';
import './index.js';
import './chunk-registry.js';
import './chunk-pathe.M-eThtNZ.js';
function registerModuleMocker(interceptor) {
const mocker = new ModuleMocker(interceptor(__VITEST_GLOBAL_THIS_ACCESSOR__), {
resolveId(id, importer) {
return rpc("vitest:mocks:resolveId", {
id,
importer
});
},
resolveMock(id, importer, options) {
return rpc("vitest:mocks:resolveMock", {
id,
importer,
options
});
},
async invalidate(ids) {
return rpc("vitest:mocks:invalidate", { ids });
}
}, createMockInstance, { root: __VITEST_MOCKER_ROOT__ });
globalThis[__VITEST_GLOBAL_THIS_ACCESSOR__] = mocker;
registerNativeFactoryResolver(mocker);
return createCompilerHints({ globalThisKey: __VITEST_GLOBAL_THIS_ACCESSOR__ });
}
function registerNativeFactoryResolver(mocker) {
hot.on("vitest:interceptor:resolve", async (url) => {
const exports$1 = await mocker.resolveFactoryModule(url);
const keys = Object.keys(exports$1);
hot.send("vitest:interceptor:resolved", {
url,
keys
});
});
}
export { registerModuleMocker, registerNativeFactoryResolver };
@@ -0,0 +1 @@
{"version":3,"file":"decode-data-html.js","sourceRoot":"https://raw.githubusercontent.com/fb55/entities/61afd4701eaa736978b13c7351cd3de9a96b04bc/src/","sources":["generated/decode-data-html.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAE9C,eAAe,IAAI,WAAW;AAC1B,kBAAkB;AAClB,268CAA268C;KACt68C,KAAK,CAAC,EAAE,CAAC;KACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CACnC,CAAC"}
@@ -0,0 +1 @@
{"version":3,"file":"metadataUtils.js","sourceRoot":"","sources":["../../../src/shared/metadataUtils.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,QAA8E;IACzG,6DAA6D;IAC7D,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,KAAK,KAAK,EAAE,EAAE,CAAC;QACxD,OAAO,QAAQ,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,kEAAkE;IAClE,IAAI,aAAa,IAAI,QAAQ,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC;QAC3D,OAAO,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC;IACtC,CAAC;IAED,4BAA4B;IAC5B,OAAO,QAAQ,CAAC,IAAI,CAAC;AACzB,CAAC"}
@@ -0,0 +1 @@
module.exports={C:{"52":0.02539,"61":0.00423,"67":0.00423,"78":0.0127,"87":0.00423,"115":0.32586,"120":0.02116,"121":0.04655,"124":0.00423,"127":0.00423,"128":0.00423,"133":0.00846,"135":0.05078,"136":0.00846,"138":0.00423,"139":0.00423,"140":0.16928,"142":0.00423,"143":0.00846,"144":0.00423,"145":0.00423,"146":0.0127,"147":0.0127,"148":0.00846,"149":0.00846,"150":0.02116,"151":0.01693,"152":0.06771,"153":0.06771,"154":0.46552,"155":1.77321,"156":1.77321,"157":0.05925,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 62 63 64 65 66 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 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 125 126 129 130 131 132 134 137 141 158 159 160 3.5 3.6"},D:{"49":0.00423,"70":0.0127,"87":0.0127,"100":0.00423,"103":0.01693,"104":0.0127,"105":0.00846,"106":0.01693,"107":0.0127,"108":0.00846,"109":0.91411,"110":0.0127,"111":0.0127,"112":0.0127,"114":0.00846,"116":0.04232,"117":0.0127,"118":0.04232,"119":0.04655,"120":0.06348,"121":0.02116,"122":0.02539,"123":0.00423,"124":0.01693,"125":0.00846,"126":0.00846,"127":0.00423,"128":0.01693,"129":0.00423,"130":0.00846,"131":0.03386,"132":0.00846,"133":0.07618,"134":0.08887,"135":0.07618,"136":0.08464,"137":0.08041,"138":0.11426,"139":0.07618,"140":0.12273,"141":0.08887,"142":0.28354,"143":0.02116,"144":0.05078,"145":0.04655,"146":0.03809,"147":0.04655,"148":0.17774,"149":0.12273,"150":0.32163,"151":1.41349,"152":10.2626,"153":9.10726,"154":2.15409,"155":0.02539,"156":0.00423,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 88 89 90 91 92 93 94 95 96 97 98 99 101 102 113 115 157"},F:{"95":0.07618,"98":0.00423,"100":0.00423,"101":0.02962,"106":0.00423,"118":0.00423,"131":0.00423,"133":0.00423,"134":0.10157,"135":0.99452,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 99 102 103 104 105 107 108 109 110 111 112 113 114 115 116 117 119 120 121 122 123 124 125 126 127 132 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"92":0.00423,"109":0.02962,"119":0.02116,"120":0.02116,"122":0.00423,"141":0.00423,"142":0.00423,"143":0.00423,"144":0.00423,"145":0.00423,"146":0.00423,"147":0.00423,"148":0.01693,"149":0.0127,"150":0.06348,"151":0.14812,"152":1.57854,"153":1.98058,"154":0.55016,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 121 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140"},E:{"27":0.1185,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.2 16.4 27.1 TP","13.1":0.00846,"14.1":0.00423,"15.6":0.03809,"16.3":0.00423,"16.5":0.00846,"16.6":0.05502,"17.0":0.00423,"17.1":0.08464,"17.2":0.00423,"17.3":0.00423,"17.4":0.00846,"17.5":0.0127,"17.6":0.07618,"18.0":0.00423,"18.1":0.00846,"18.2":0.00846,"18.3":0.01693,"18.4":0.00846,"18.5-18.7":0.02539,"26.0":0.04232,"26.1":0.04655,"26.2":0.06348,"26.3":0.03809,"26.4":0.02962,"26.5":0.15658,"26.6":0.68558,"27.2":0.00423},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00118,"5.0-5.1":0.00118,"6.0-6.1":0,"7.0-7.1":0.00235,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.01176,"11.0-11.2":0.00118,"11.3-11.4":0.00235,"12.0-12.1":0,"12.2-12.5":0.03059,"13.0-13.1":0,"13.2":0.00588,"13.3":0,"13.4-13.7":0.00118,"14.0-14.4":0.00471,"14.5-14.8":0.00706,"15.0-15.1":0.00706,"15.2-15.3":0.00471,"15.4":0.00588,"15.5":0.00706,"15.6-15.8":0.15294,"16.0":0.01176,"16.1":0.02118,"16.2":0.01176,"16.3":0.02588,"16.4":0.00588,"16.5":0.00941,"16.6-16.7":0.21294,"17.0":0.00824,"17.1":0.01176,"17.2":0.01176,"17.3":0.01765,"17.4":0.02471,"17.5":0.04824,"17.6-17.7":0.12471,"18.0":0.02588,"18.1":0.05176,"18.2":0.07059,"18.3":0.12235,"18.4":0.07647,"18.5-18.7":1.58,"26.0":0.07647,"26.1":0.07765,"26.2":0.20235,"26.3":0.21882,"26.4":0.16,"26.5":1.07176,"26.6":6.61293,"27.0":0.50706,"27.1":0,"27.2":0.01294},P:{"4":0.00938,"22":0.00938,"23":0.00938,"24":0.00938,"26":0.01877,"27":0.00938,"28":0.04691,"29":0.07506,"30":2.15805,_:"20 21 25 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 14.0 15.0 16.0 17.0 18.0 19.0","5.0-5.4":0.00938,"13.0":0.00938},I:{"0":0.05763,"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.00002},K:{"0":0.50173,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.00423,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0":43.90724},R:{_:"0"},M:{"0":0.46713},Q:{_:"14.9"},O:{"0":0.0173},H:{all:0}};
@@ -0,0 +1 @@
{"version":3,"file":"check-circle-2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -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 SignalMedium = createLucideIcon("SignalMedium", [
["path", { d: "M2 20h.01", key: "4haj6o" }],
["path", { d: "M7 20v-4", key: "j294jx" }],
["path", { d: "M12 20v-8", key: "i3yub9" }]
]);
export { SignalMedium as default };
//# sourceMappingURL=signal-medium.js.map
@@ -0,0 +1,9 @@
/**
* This module was automatically generated by `ts-interface-builder`
*/
import * as t from "ts-interface-checker";
export declare const Transform: t.TUnion;
export declare const SourceMapOptions: t.TIface;
export declare const Options: t.TIface;
declare const exportedTypeSuite: t.ITypeSuite;
export default exportedTypeSuite;
@@ -0,0 +1,34 @@
function createLazyMeasurementsView(count, flat, getItemKey) {
const cache = new Array(count);
return new Proxy(cache, {
get(target, prop, receiver) {
if (typeof prop === "string") {
const c = prop.charCodeAt(0);
if (c >= 48 && c <= 57) {
const i = +prop;
if (Number.isInteger(i) && i >= 0 && i < count) {
let v = target[i];
if (!v) {
const s = flat[i * 2];
v = target[i] = {
index: i,
key: getItemKey(i),
start: s,
size: flat[i * 2 + 1],
end: s + flat[i * 2 + 1],
lane: 0
};
}
return v;
}
}
if (prop === "length") return count;
}
return Reflect.get(target, prop, receiver);
}
});
}
export {
createLazyMeasurementsView
};
//# sourceMappingURL=lazy-measurements.js.map
@@ -0,0 +1,18 @@
#!/usr/bin/env node
require('./sass.dart.js');
var library = globalThis._cliPkgExports.pop();
if (globalThis._cliPkgExports.length === 0) delete globalThis._cliPkgExports;
library.load({
readline: require("readline"),
chokidar: require("chokidar"),
parcel_watcher: (function(i){let r;return function parcel_watcher(){if(void 0!==r)return r;try{r=require(i)}catch(e){if('MODULE_NOT_FOUND'!==e.code)console.error(e);r=null}return r}})("@parcel/watcher"),
util: require("util"),
stream: require("stream"),
nodeModule: require("module"),
fs: require("fs"),
immutable: require("immutable"),
});
library.cli_pkg_main_0_(process.argv.slice(2));
@@ -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 LocateFixed = createLucideIcon("LocateFixed", [
["line", { x1: "2", x2: "5", y1: "12", y2: "12", key: "bvdh0s" }],
["line", { x1: "19", x2: "22", y1: "12", y2: "12", key: "1tbv5k" }],
["line", { x1: "12", x2: "12", y1: "2", y2: "5", key: "11lu5j" }],
["line", { x1: "12", x2: "12", y1: "19", y2: "22", key: "x3vr5v" }],
["circle", { cx: "12", cy: "12", r: "7", key: "fim9np" }],
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
]);
export { LocateFixed as default };
//# sourceMappingURL=locate-fixed.js.map
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = inheritTrailingComments;
var _inherit = require("../utils/inherit.js");
function inheritTrailingComments(child, parent) {
(0, _inherit.default)("trailingComments", child, parent);
}
//# sourceMappingURL=inheritTrailingComments.js.map
@@ -0,0 +1,19 @@
/**
* Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
*/
export declare const fromCodePoint: (...codePoints: number[]) => string;
/**
* Replace the given code point with a replacement character if it is a
* surrogate or is outside the valid range. Otherwise return the code
* point unchanged.
*/
export declare function replaceCodePoint(codePoint: number): number;
/**
* Replace the code point if relevant, then convert it to a string.
*
* @deprecated Use `fromCodePoint(replaceCodePoint(codePoint))` instead.
* @param codePoint The code point to decode.
* @returns The decoded code point.
*/
export default function decodeCodePoint(codePoint: number): string;
//# sourceMappingURL=decode_codepoint.d.ts.map
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"_V","132":"_b"},B:{"1":"_J"},C:{"1":"_tC","2":"_g"},D:{"1":"_Q"},E:{"1":"_R"},F:{"1":"_zG","2":"_mB"},G:{"1":"_1O","260":"_sC"},H:{"2":"1D"},I:{"1":"_PE","2":"2D","4":"fC _fQ"},J:{"1":"A","4":"D"},K:{"1":"_N"},L:{"1":"I"},M:{"1":"YC"},N:{"1":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:2,C:"@font-face Web fonts",D:true};
@@ -0,0 +1,31 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/core/number/src/index.ts
var index_exports = {};
__export(index_exports, {
clamp: () => clamp
});
module.exports = __toCommonJS(index_exports);
// packages/core/number/src/number.ts
function clamp(value, [min, max]) {
return Math.min(max, Math.max(min, value));
}
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"wifi-off.js","sources":["../../../src/icons/wifi-off.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name WifiOff\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMjBoLjAxIiAvPgogIDxwYXRoIGQ9Ik04LjUgMTYuNDI5YTUgNSAwIDAgMSA3IDAiIC8+CiAgPHBhdGggZD0iTTUgMTIuODU5YTEwIDEwIDAgMCAxIDUuMTctMi42OSIgLz4KICA8cGF0aCBkPSJNMTkgMTIuODU5YTEwIDEwIDAgMCAwLTIuMDA3LTEuNTIzIiAvPgogIDxwYXRoIGQ9Ik0yIDguODJhMTUgMTUgMCAwIDEgNC4xNzctMi42NDMiIC8+CiAgPHBhdGggZD0iTTIyIDguODJhMTUgMTUgMCAwIDAtMTEuMjg4LTMuNzY0IiAvPgogIDxwYXRoIGQ9Im0yIDIgMjAgMjAiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/wifi-off\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 WifiOff = createLucideIcon('WifiOff', [\n ['path', { d: 'M12 20h.01', key: 'zekei9' }],\n ['path', { d: 'M8.5 16.429a5 5 0 0 1 7 0', key: '1bycff' }],\n ['path', { d: 'M5 12.859a10 10 0 0 1 5.17-2.69', key: '1dl1wf' }],\n ['path', { d: 'M19 12.859a10 10 0 0 0-2.007-1.523', key: '4k23kn' }],\n ['path', { d: 'M2 8.82a15 15 0 0 1 4.177-2.643', key: '1grhjp' }],\n ['path', { d: 'M22 8.82a15 15 0 0 0-11.288-3.764', key: 'z3jwby' }],\n ['path', { d: 'm2 2 20 20', key: '1ooewy' }],\n]);\n\nexport default WifiOff;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC3C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA6B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAChE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAsC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACnE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAChE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAqC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAClE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,31 @@
import { lowercaseSVGElements } from '../../svg/lowercase-elements.mjs';
function isSVGComponent(Component) {
if (
/**
* If it's not a string, it's a custom React component. Currently we only support
* HTML custom React components.
*/
typeof Component !== "string" ||
/**
* If it contains a dash, the element is a custom HTML webcomponent.
*/
Component.includes("-")) {
return false;
}
else if (
/**
* If it's in our list of lowercase SVG tags, it's an SVG component
*/
lowercaseSVGElements.indexOf(Component) > -1 ||
/**
* If it contains a capital letter, it's an SVG component
*/
/[A-Z]/u.test(Component)) {
return true;
}
return false;
}
export { isSVGComponent };
//# sourceMappingURL=is-svg-component.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"venetian-mask.js","sources":["../../../src/icons/venetian-mask.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name VenetianMask\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTggMTFjLTEuNSAwLTIuNS41LTMgMiIgLz4KICA8cGF0aCBkPSJNNCA2YTIgMiAwIDAgMC0yIDJ2NGE1IDUgMCAwIDAgNSA1IDggOCAwIDAgMSA1IDIgOCA4IDAgMCAxIDUtMiA1IDUgMCAwIDAgNS01VjhhMiAyIDAgMCAwLTItMmgtM2E4IDggMCAwIDAtNSAyIDggOCAwIDAgMC01LTJ6IiAvPgogIDxwYXRoIGQ9Ik02IDExYzEuNSAwIDIuNS41IDMgMiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/venetian-mask\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 VenetianMask = createLucideIcon('VenetianMask', [\n ['path', { d: 'M18 11c-1.5 0-2.5.5-3 2', key: '1fod00' }],\n [\n 'path',\n {\n d: 'M4 6a2 2 0 0 0-2 2v4a5 5 0 0 0 5 5 8 8 0 0 1 5 2 8 8 0 0 1 5-2 5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3a8 8 0 0 0-5 2 8 8 0 0 0-5-2z',\n key: 'd70hit',\n },\n ],\n ['path', { d: 'M6 11c1.5 0 2.5.5 3 2', key: '136fht' }],\n]);\n\nexport default VenetianMask;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,iBAAiB,cAAgB,CAAA,CAAA,CAAA;AAAA,CAAA,CACpD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACxD,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;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAyB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACxD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,328 @@
// @generated
// This code is automatically generated. Manual editing is not recommended.
/*
* BSD-2-Clause License
*
* Original source code is copyright (c) 2019-2025 Remy Rylan
* <https://github.com/RemyRylan>
*
* Documentation and keyword descriptions are copyright (c) 2018 IETF Trust
* <https://www.ietf.org/>, Austin Wright <aaa@bzfx.net>, Henry Andrews
* <henry@cloudflare.com>, Geraint Luff <luffgd@gmail.com>, and Cloudflare,
* Inc. <https://www.cloudflare.com/>. 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.
*/
export const draft = "7";
export const $schema = "https://json-schema.org/draft-07/schema";
// -----------------------------------------------------------------------------
/**
* Content encoding strategy enum.
*
* - [Content-Transfer-Encoding Syntax](https://datatracker.ietf.org/doc/html/rfc2045#section-6.1)
* - [7bit vs 8bit encoding](https://stackoverflow.com/questions/25710599/content-transfer-encoding-7bit-or-8-bit/28531705#28531705)
*/
export var ContentEncoding;
(function (ContentEncoding) {
/**
* Only US-ASCII characters, which use the lower 7 bits for each character.
*
* Each line must be less than 1,000 characters.
*/
ContentEncoding["7bit"] = "7bit";
/**
* Allow extended ASCII characters which can use the 8th (highest) bit to
* indicate special characters not available in 7bit.
*
* Each line must be less than 1,000 characters.
*/
ContentEncoding["8bit"] = "8bit";
/**
* Useful for data that is mostly non-text.
*/
ContentEncoding["Base64"] = "base64";
/**
* Same character set as 8bit, with no line length restriction.
*/
ContentEncoding["Binary"] = "binary";
/**
* An extension token defined by a standards-track RFC and registered with
* IANA.
*/
ContentEncoding["IETFToken"] = "ietf-token";
/**
* Lines are limited to 76 characters, and line breaks are represented using
* special characters that are escaped.
*/
ContentEncoding["QuotedPrintable"] = "quoted-printable";
/**
* The two characters "X-" or "x-" followed, with no intervening white space,
* by any token.
*/
ContentEncoding["XToken"] = "x-token";
})(ContentEncoding || (ContentEncoding = {}));
/**
* This enum provides well-known formats that apply to strings.
*/
export var Format;
(function (Format) {
/**
* A string instance is valid against this attribute if it is a valid
* representation according to the "full-date" production in
* [RFC 3339][RFC3339].
*
* [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339
*/
Format["Date"] = "date";
/**
* A string instance is valid against this attribute if it is a valid
* representation according to the "date-time" production in
* [RFC 3339][RFC3339].
*
* [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339
*/
Format["DateTime"] = "date-time";
/**
* A string instance is valid against this attribute if it is a valid Internet
* email address as defined by [RFC 5322, section 3.4.1][RFC5322].
*
* [RFC5322]: https://datatracker.ietf.org/doc/html/rfc5322
*/
Format["Email"] = "email";
/**
* As defined by [RFC 1034, section 3.1][RFC1034], including host names
* produced using the Punycode algorithm specified in
* [RFC 5891, section 4.4][RFC5891].
*
* [RFC1034]: https://datatracker.ietf.org/doc/html/rfc1034
* [RFC5891]: https://datatracker.ietf.org/doc/html/rfc5891
*/
Format["Hostname"] = "hostname";
/**
* A string instance is valid against this attribute if it is a valid Internet
* email address as defined by [RFC 6531][RFC6531].
*
* [RFC6531]: https://datatracker.ietf.org/doc/html/rfc6531
*/
Format["IDNEmail"] = "idn-email";
/**
* As defined by either [RFC 1034, section 3.1][RFC1034] as for hostname, or
* an internationalized hostname as defined by
* [RFC 5890, section 2.3.2.3][RFC5890].
*
* [RFC1034]: https://datatracker.ietf.org/doc/html/rfc1034
* [RFC5890]: https://datatracker.ietf.org/doc/html/rfc5890
*/
Format["IDNHostname"] = "idn-hostname";
/**
* An IPv4 address according to the "dotted-quad" ABNF syntax as defined in
* [RFC 2673, section 3.2][RFC2673].
*
* [RFC2673]: https://datatracker.ietf.org/doc/html/rfc2673
*/
Format["IPv4"] = "ipv4";
/**
* An IPv6 address as defined in [RFC 4291, section 2.2][RFC4291].
*
* [RFC4291]: https://datatracker.ietf.org/doc/html/rfc4291
*/
Format["IPv6"] = "ipv6";
/**
* A string instance is valid against this attribute if it is a valid IRI,
* according to [RFC 3987][RFC3987].
*
* [RFC3987]: https://datatracker.ietf.org/doc/html/rfc3987
*/
Format["IRI"] = "iri";
/**
* A string instance is valid against this attribute if it is a valid IRI
* Reference (either an IRI or a relative-reference), according to
* [RFC 3987][RFC3987].
*
* [RFC3987]: https://datatracker.ietf.org/doc/html/rfc3987
*/
Format["IRIReference"] = "iri-reference";
/**
* A string instance is valid against this attribute if it is a valid JSON
* string representation of a JSON Pointer, according to
* [RFC 6901, section 5][RFC6901].
*
* [RFC6901]: https://datatracker.ietf.org/doc/html/rfc6901
*/
Format["JSONPointer"] = "json-pointer";
/**
* A string instance is valid against this attribute if it is a valid JSON
* string representation of a JSON Pointer fragment, according to
* [RFC 6901, section 5][RFC6901].
*
* [RFC6901]: https://datatracker.ietf.org/doc/html/rfc6901
*/
Format["JSONPointerURIFragment"] = "json-pointer-uri-fragment";
/**
* This attribute applies to string instances.
*
* A regular expression, which SHOULD be valid according to the
* [ECMA-262][ecma262] regular expression dialect.
*
* Implementations that validate formats MUST accept at least the subset of
* [ECMA-262][ecma262] defined in the [Regular Expressions][regexInterop]
* section of this specification, and SHOULD accept all valid
* [ECMA-262][ecma262] expressions.
*
* [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/
* [regexInterop]: https://json-schema.org/draft-07/json-schema-validation.html#regexInterop
*/
Format["RegEx"] = "regex";
/**
* A string instance is valid against this attribute if it is a valid
* [Relative JSON Pointer][relative-json-pointer].
*
* [relative-json-pointer]: https://datatracker.ietf.org/doc/html/draft-handrews-relative-json-pointer-01
*/
Format["RelativeJSONPointer"] = "relative-json-pointer";
/**
* A string instance is valid against this attribute if it is a valid
* representation according to the "time" production in [RFC 3339][RFC3339].
*
* [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339
*/
Format["Time"] = "time";
/**
* A string instance is valid against this attribute if it is a valid URI,
* according to [RFC3986][RFC3986].
*
* [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986
*/
Format["URI"] = "uri";
/**
* A string instance is valid against this attribute if it is a valid URI
* Reference (either a URI or a relative-reference), according to
* [RFC3986][RFC3986].
*
* [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986
*/
Format["URIReference"] = "uri-reference";
/**
* A string instance is valid against this attribute if it is a valid URI
* Template (of any level), according to [RFC6570][RFC6570].
*
* Note that URI Templates may be used for IRIs; there is no separate IRI
* Template specification.
*
* [RFC6570]: https://datatracker.ietf.org/doc/html/rfc6570
*/
Format["URITemplate"] = "uri-template";
/**
* UUID
*/
Format["UUID"] = "uuid";
})(Format || (Format = {}));
/**
* Enum consisting of simple type names for the `type` keyword
*/
export var TypeName;
(function (TypeName) {
/**
* Value MUST be an array.
*/
TypeName["Array"] = "array";
/**
* Value MUST be a boolean.
*/
TypeName["Boolean"] = "boolean";
/**
* Value MUST be an integer, no floating point numbers are allowed. This is a
* subset of the number type.
*/
TypeName["Integer"] = "integer";
/**
* Value MUST be null. Note this is mainly for purpose of being able use union
* types to define nullability. If this type is not included in a union, null
* values are not allowed (the primitives listed above do not allow nulls on
* their own).
*/
TypeName["Null"] = "null";
/**
* Value MUST be a number, floating point numbers are allowed.
*/
TypeName["Number"] = "number";
/**
* Value MUST be an object.
*/
TypeName["Object"] = "object";
/**
* Value MUST be a string.
*/
TypeName["String"] = "string";
})(TypeName || (TypeName = {}));
// -----------------------------------------------------------------------------
// Keywords
// -----------------------------------------------------------------------------
export const keywords = [
"$comment",
"$id",
"$ref",
"$schema",
"additionalItems",
"additionalProperties",
"allOf",
"anyOf",
"const",
"contains",
"contentEncoding",
"contentMediaType",
"default",
"definitions",
"dependencies",
"description",
"else",
"enum",
"examples",
"exclusiveMaximum",
"exclusiveMinimum",
"format",
"if",
"items",
"maximum",
"maxItems",
"maxLength",
"maxProperties",
"minimum",
"minItems",
"minLength",
"minProperties",
"multipleOf",
"not",
"oneOf",
"pattern",
"patternProperties",
"properties",
"propertyNames",
"readOnly",
"required",
"then",
"title",
"type",
"uniqueItems",
"writeOnly",
];
@@ -0,0 +1 @@
module.exports={C:{"52":0.03794,"78":0.00474,"88":0.00474,"115":0.19921,"118":0.00474,"120":0.28932,"121":0.55493,"123":0.03794,"124":0.01423,"125":0.04743,"127":0.00474,"132":0.00474,"135":0.00474,"136":0.00949,"137":0.00474,"138":0.00949,"140":0.01423,"141":0.00474,"146":0.01423,"147":0.00474,"149":0.00949,"150":0.00949,"151":0.01423,"152":0.01897,"153":0.03794,"154":0.85848,"155":0.85848,"156":1.18575,"157":0.01423,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 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 79 80 81 82 83 84 85 86 87 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 119 122 126 128 129 130 131 133 134 139 142 143 144 145 148 158 159 160 3.5 3.6"},D:{"53":0.00474,"62":0.00474,"63":0.00474,"64":0.00474,"65":0.00474,"68":0.00474,"70":0.00474,"76":0.00949,"78":0.01423,"79":0.00949,"84":0.00474,"86":0.00474,"87":0.01423,"88":0.01423,"90":0.00474,"91":0.00474,"92":0.00474,"95":0.00474,"100":0.00474,"101":0.00949,"103":0.25612,"104":0.21818,"105":0.21818,"106":0.23241,"107":0.21818,"108":0.23241,"109":1.78811,"110":0.22292,"111":0.25138,"112":0.21818,"114":0.01897,"115":0.00474,"116":0.46481,"117":0.22766,"118":0.71619,"119":0.61659,"120":0.85374,"121":0.01897,"122":0.09486,"123":0.01423,"124":0.23241,"125":0.08537,"126":0.01423,"127":0.00949,"128":0.01423,"129":0.00474,"130":0.04743,"131":0.44584,"132":0.00949,"133":0.56442,"134":0.15178,"135":0.16126,"136":0.14703,"137":0.14703,"138":0.38418,"139":0.17075,"140":0.18498,"141":0.17549,"142":0.56442,"143":0.02372,"144":0.15178,"145":0.14229,"146":0.15652,"147":0.03794,"148":0.15178,"149":0.32252,"150":0.31304,"151":3.05449,"152":9.02593,"153":7.86864,"154":1.94463,"155":0.01897,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 54 55 56 57 58 59 60 61 66 67 69 71 72 73 74 75 77 80 81 83 85 89 93 94 96 97 98 99 102 113 156 157"},F:{"46":0.02372,"54":0.00474,"55":0.00474,"56":0.00474,"74":0.00474,"95":0.07115,"101":0.01423,"105":0.00474,"106":0.00949,"107":0.00474,"115":0.00474,"116":0.00474,"118":0.00474,"119":0.00474,"121":0.00474,"122":0.00474,"133":0.00474,"134":0.11383,"135":0.84425,_:"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 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 100 102 103 104 108 109 110 111 112 113 114 117 120 123 124 125 126 127 131 132 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.00474,"92":0.00474,"109":0.00949,"114":0.00474,"119":0.28932,"120":0.26561,"122":0.01897,"123":0.00474,"124":0.00474,"129":0.00474,"137":0.00474,"138":0.00474,"139":0.00949,"140":0.00474,"142":0.00474,"143":0.00474,"145":0.00474,"146":0.01423,"147":0.00949,"148":0.01897,"149":0.01423,"150":0.02372,"151":0.20869,"152":1.20472,"153":1.33278,"154":0.36995,_:"12 13 14 15 16 17 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 115 116 117 118 121 125 126 127 128 130 131 132 133 134 135 136 141 144"},E:{"27":0.0332,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 14.1 15.1 15.2-15.3 15.4 15.5 16.0 16.2 16.4 16.5 17.0 17.2 18.2 18.4 27.1 27.2 TP","13.1":0.00474,"15.6":0.05217,"16.1":0.00474,"16.3":0.00474,"16.6":0.05217,"17.1":0.04269,"17.3":0.00474,"17.4":0.00949,"17.5":0.00474,"17.6":0.05217,"18.0":0.01423,"18.1":0.00474,"18.3":0.00949,"18.5-18.7":0.00949,"26.0":0.00474,"26.1":0.00474,"26.2":0.00474,"26.3":0.21818,"26.4":0.01897,"26.5":0.10909,"26.6":0.35573},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00099,"5.0-5.1":0.00099,"6.0-6.1":0,"7.0-7.1":0.00198,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00989,"11.0-11.2":0.00099,"11.3-11.4":0.00198,"12.0-12.1":0,"12.2-12.5":0.0257,"13.0-13.1":0,"13.2":0.00494,"13.3":0,"13.4-13.7":0.00099,"14.0-14.4":0.00395,"14.5-14.8":0.00593,"15.0-15.1":0.00593,"15.2-15.3":0.00395,"15.4":0.00494,"15.5":0.00593,"15.6-15.8":0.12852,"16.0":0.00989,"16.1":0.0178,"16.2":0.00989,"16.3":0.02175,"16.4":0.00494,"16.5":0.00791,"16.6-16.7":0.17895,"17.0":0.00692,"17.1":0.00989,"17.2":0.00989,"17.3":0.01483,"17.4":0.02076,"17.5":0.04053,"17.6-17.7":0.1048,"18.0":0.02175,"18.1":0.0435,"18.2":0.05932,"18.3":0.10282,"18.4":0.06426,"18.5-18.7":1.32776,"26.0":0.06426,"26.1":0.06525,"26.2":0.17005,"26.3":0.18389,"26.4":0.13446,"26.5":0.90066,"26.6":5.55722,"27.0":0.42611,"27.1":0,"27.2":0.01088},P:{"4":0.11381,"21":0.01751,"22":0.00875,"23":0.00875,"24":0.02626,"25":0.01751,"26":0.02626,"27":0.04377,"28":0.0963,"29":0.07879,"30":2.23236,_:"20 5.0-5.4 6.2-6.4 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0","7.2-7.4":0.01751,"8.2":0.02626,"19.0":0.00875},I:{"0":0.03677,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":Line truncated
@@ -0,0 +1 @@
{"version":3,"file":"build-transform.mjs","sources":["../../../../../src/render/html/utils/build-transform.ts"],"sourcesContent":["import { getValueAsType } from \"../../../value/types/utils/get-as-type\"\nimport { numberValueTypes } from \"../../../value/types/maps/number\"\nimport { transformPropOrder } from \"../../utils/keys-transform\"\nimport { ResolvedValues } from \"../../types\"\nimport { HTMLRenderState } from \"../types\"\nimport type { MotionNodeOptions } from \"../../../node/types\"\n\nconst translateAlias = {\n x: \"translateX\",\n y: \"translateY\",\n z: \"translateZ\",\n transformPerspective: \"perspective\",\n}\n\nconst numTransforms = transformPropOrder.length\n\n/**\n * Build a CSS transform style from individual x/y/scale etc properties.\n *\n * This outputs with a default order of transforms/scales/rotations, this can be customised by\n * providing a transformTemplate function.\n */\nexport function buildTransform(\n latestValues: ResolvedValues,\n transform: HTMLRenderState[\"transform\"],\n transformTemplate?: MotionNodeOptions[\"transformTemplate\"]\n) {\n // The transform string we're going to build into.\n let transformString = \"\"\n let transformIsDefault = true\n\n /**\n * Loop over all possible transforms in order, adding the ones that\n * are present to the transform string.\n */\n for (let i = 0; i < numTransforms; i++) {\n const key = transformPropOrder[i] as keyof typeof translateAlias\n const value = latestValues[key]\n\n if (value === undefined) continue\n\n let valueIsDefault = true\n if (typeof value === \"number\") {\n valueIsDefault = value === (key.startsWith(\"scale\") ? 1 : 0)\n } else {\n const parsed = parseFloat(value)\n valueIsDefault = key.startsWith(\"scale\") ? parsed === 1 : parsed === 0\n }\n\n if (!valueIsDefault || transformTemplate) {\n const valueAsType = getValueAsType(value, numberValueTypes[key])\n\n if (!valueIsDefault) {\n transformIsDefault = false\n const transformName = translateAlias[key] || key\n transformString += `${transformName}(${valueAsType}) `\n }\n\n if (transformTemplate) {\n transform[key] = valueAsType\n }\n }\n }\n\n transformString = transformString.trim()\n\n // If we have a custom `transform` template, pass our transform values and\n // generated transformString to that before returning\n if (transformTemplate) {\n transformString = transformTemplate(\n transform,\n transformIsDefault ? \"\" : transformString\n )\n } else if (transformIsDefault) {\n transformString = \"none\"\n }\n\n return transformString\n}\n"],"names":[],"mappings":";;;;AAOA,MAAM,cAAc,GAAG;AACnB,IAAA,CAAC,EAAE,YAAY;AACf,IAAA,CAAC,EAAE,YAAY;AACf,IAAA,CAAC,EAAE,YAAY;AACf,IAAA,oBAAoB,EAAE,aAAa;CACtC;AAED,MAAM,aAAa,GAAG,kBAAkB,CAAC,MAAM;AAE/C;;;;;AAKG;SACa,cAAc,CAC1B,YAA4B,EAC5B,SAAuC,EACvC,iBAA0D,EAAA;;IAG1D,IAAI,eAAe,GAAG,EAAE;IACxB,IAAI,kBAAkB,GAAG,IAAI;AAE7B;;;AAGG;AACH,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE;AACpC,QAAA,MAAM,GAAG,GAAG,kBAAkB,CAAC,CAAC,CAAgC;AAChE,QAAA,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC;QAE/B,IAAI,KAAK,KAAK,SAAS;YAAE;QAEzB,IAAI,cAAc,GAAG,IAAI;AACzB,QAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC3B,YAAA,cAAc,GAAG,KAAK,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChE;aAAO;AACH,YAAA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC;AAChC,YAAA,cAAc,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,KAAK,CAAC;QAC1E;AAEA,QAAA,IAAI,CAAC,cAAc,IAAI,iBAAiB,EAAE;YACtC,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC;YAEhE,IAAI,CAAC,cAAc,EAAE;gBACjB,kBAAkB,GAAG,KAAK;gBAC1B,MAAM,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,GAAG;AAChD,gBAAA,eAAe,IAAI,CAAA,EAAG,aAAa,CAAA,CAAA,EAAI,WAAW,IAAI;YAC1D;YAEA,IAAI,iBAAiB,EAAE;AACnB,gBAAA,SAAS,CAAC,GAAG,CAAC,GAAG,WAAW;YAChC;QACJ;IACJ;AAEA,IAAA,eAAe,GAAG,eAAe,CAAC,IAAI,EAAE;;;IAIxC,IAAI,iBAAiB,EAAE;AACnB,QAAA,eAAe,GAAG,iBAAiB,CAC/B,SAAS,EACT,kBAAkB,GAAG,EAAE,GAAG,eAAe,CAC5C;IACL;SAAO,IAAI,kBAAkB,EAAE;QAC3B,eAAe,GAAG,MAAM;IAC5B;AAEA,IAAA,OAAO,eAAe;AAC1B;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"wallet-minimal.js","sources":["../../../src/icons/wallet-minimal.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name WalletMinimal\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTcgMTRoLjAxIiAvPgogIDxwYXRoIGQ9Ik03IDdoMTJhMiAyIDAgMCAxIDIgMnYxMGEyIDIgMCAwIDEtMiAySDVhMiAyIDAgMCAxLTItMlY1YTIgMiAwIDAgMSAyLTJoMTQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/wallet-minimal\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 WalletMinimal = createLucideIcon('WalletMinimal', [\n ['path', { d: 'M17 14h.01', key: '7oqj8z' }],\n [\n 'path',\n {\n d: 'M7 7h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14',\n key: 'u1rqew',\n },\n ],\n]);\n\nexport default WalletMinimal;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,iBAAiB,eAAiB,CAAA,CAAA,CAAA;AAAA,CAAA,CACtD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAC3C,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;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,22 @@
import { MotionValueState } from '../MotionValueState.mjs';
function createEffect(addValue) {
const stateCache = new WeakMap();
return (subject, values) => {
const state = stateCache.get(subject) ?? new MotionValueState();
stateCache.set(subject, state);
const subscriptions = [];
for (const key in values) {
const value = values[key];
const remove = addValue(subject, state, key, value);
subscriptions.push(remove);
}
return () => {
for (const cancel of subscriptions)
cancel();
};
};
}
export { createEffect };
//# sourceMappingURL=create-effect.mjs.map
@@ -0,0 +1,44 @@
import type { SourceMapSegment } from './sourcemap-segment.mts';
export interface SourceMapV3 {
file?: string | null;
names: readonly string[];
sourceRoot?: string;
sources: readonly (string | null)[];
sourcesContent?: readonly (string | null)[];
version: 3;
ignoreList?: readonly number[];
}
export interface EncodedSourceMap extends SourceMapV3 {
mappings: string;
}
export interface DecodedSourceMap extends SourceMapV3 {
mappings: readonly SourceMapSegment[][];
}
export interface Pos {
line: number;
column: number;
}
export interface OriginalPos extends Pos {
source: string;
}
export interface BindingExpressionRange {
start: Pos;
expression: string;
}
export type Mapping = {
generated: Pos;
source: undefined;
original: undefined;
name: undefined;
} | {
generated: Pos;
source: string;
original: Pos;
name: string;
} | {
generated: Pos;
source: string;
original: Pos;
name: undefined;
};
//# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
module.exports={C:{"113":0.00238,"115":0.08327,"120":0.05948,"121":0.10943,"126":0.00238,"130":0.02379,"137":0.00238,"140":0.0119,"142":0.10468,"144":0.00238,"149":0.0119,"150":0.00476,"152":0.01427,"153":0.00714,"154":0.08564,"155":0.19984,"156":0.3402,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 114 116 117 118 119 122 123 124 125 127 128 129 131 132 133 134 135 136 138 139 141 143 145 146 147 148 151 157 158 159 160 3.5 3.6"},D:{"51":0.00238,"58":0.00714,"67":0.00238,"69":0.00238,"70":0.01903,"81":0.00476,"86":0.00476,"93":0.00476,"94":0.00238,"95":0.00476,"97":0.00238,"99":0.01427,"101":0.00952,"103":0.00714,"104":0.00714,"105":0.00714,"106":0.00714,"107":0.00714,"108":0.00714,"109":0.44249,"110":0.00714,"111":0.02379,"112":0.00476,"114":0.00714,"115":0.00238,"116":0.01665,"117":0.00476,"118":0.36637,"119":0.13322,"120":0.11895,"122":0.0119,"123":0.00476,"124":0.02617,"125":0.00238,"126":0.00238,"127":0.00238,"128":0.00714,"131":0.02141,"133":0.07851,"134":0.04282,"135":0.03569,"136":0.03806,"137":0.06661,"138":0.09992,"139":0.05948,"140":0.0571,"141":0.05472,"142":0.14036,"143":0.00476,"144":0.00952,"145":0.0119,"146":0.07851,"147":0.03806,"148":0.04996,"149":0.0452,"150":0.1356,"151":0.68277,"152":3.02847,"153":2.55505,"154":0.74701,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 52 53 54 55 56 57 59 60 61 62 63 64 65 66 68 71 72 73 74 75 76 77 78 79 80 83 84 85 87 88 89 90 91 92 96 98 100 102 113 121 129 130 132 155 156 157"},F:{"37":0.00952,"79":0.00238,"90":0.0119,"93":0.00714,"95":0.00476,"97":0.01903,"98":0.00476,"100":0.00714,"101":0.01427,"133":0.00714,"134":0.02617,"135":0.2831,_:"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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 85 86 87 88 89 91 92 94 96 99 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 131 132 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"15":0.00238,"17":0.00238,"18":0.01427,"84":0.00476,"89":0.00238,"92":0.00952,"100":0.00714,"103":0.00238,"109":0.04996,"111":0.00476,"114":0.00476,"116":0.00238,"119":0.06423,"120":0.06661,"122":0.00714,"123":0.00238,"128":0.00476,"129":0.00238,"130":0.00714,"135":0.00238,"136":0.00238,"138":0.01427,"139":0.00476,"140":0.00714,"141":0.0119,"142":0.00476,"144":0.00476,"145":0.00238,"146":0.01427,"147":0.01665,"148":0.08327,"149":0.09278,"150":0.06423,"151":0.19508,"152":1.57966,"153":1.39409,"154":0.25931,_:"12 13 14 16 79 80 81 83 85 86 87 88 90 91 93 94 95 96 97 98 99 101 102 104 105 106 107 108 110 112 113 115 117 118 121 124 125 126 127 131 132 133 134 137 143"},E:{"27":0.00476,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 15.1 15.4 15.5 16.0 16.1 16.2 16.3 16.4 16.5 16.6 17.0 17.2 17.3 17.5 18.0 18.1 18.5-18.7 26.0 26.4 27.1 27.2 TP","14.1":0.00238,"15.2-15.3":0.00238,"15.6":0.00714,"17.1":0.00476,"17.4":0.00238,"17.6":0.00238,"18.2":0.00476,"18.3":0.00476,"18.4":0.00476,"26.1":0.07137,"26.2":0.02855,"26.3":0.01427,"26.5":0.05948,"26.6":0.24028},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00062,"5.0-5.1":0.00062,"6.0-6.1":0,"7.0-7.1":0.00124,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00619,"11.0-11.2":0.00062,"11.3-11.4":0.00124,"12.0-12.1":0,"12.2-12.5":0.01609,"13.0-13.1":0,"13.2":0.00309,"13.3":0,"13.4-13.7":0.00062,"14.0-14.4":0.00248,"14.5-14.8":0.00371,"15.0-15.1":0.00371,"15.2-15.3":0.00248,"15.4":0.00309,"15.5":0.00371,"15.6-15.8":0.08045,"16.0":0.00619,"16.1":0.01114,"16.2":0.00619,"16.3":0.01361,"16.4":0.00309,"16.5":0.00495,"16.6-16.7":0.11201,"17.0":0.00433,"17.1":0.00619,"17.2":0.00619,"17.3":0.00928,"17.4":0.013,"17.5":0.02537,"17.6-17.7":0.0656,"18.0":0.01361,"18.1":0.02723,"18.2":0.03713,"18.3":0.06436,"18.4":0.04022,"18.5-18.7":0.83108,"26.0":0.04022,"26.1":0.04084,"26.2":0.10644,"26.3":0.1151,"26.4":0.08416,"26.5":0.56375,"26.6":3.47842,"27.0":0.26671,"27.1":0,"27.2":0.00681},P:{"4":0.00702,"21":0.00702,"22":0.00702,"24":0.01404,"26":0.01404,"27":0.0351,"28":0.2176,"29":0.14039,"30":1.42493,_:"20 23 25 5.0-5.4 6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0","7.2-7.4":0.52645,"19.0":0.00702},I:{"0":0.00762,"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},K:{"0":9.03089,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{"2.5":0.00762,_:"3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0":64.77737},R:{_:"0"},M:{"0":0.12956},Q:{_:"14.9"},O:{"0":0.22863},H:{all:0}};
@@ -0,0 +1 @@
{"version":3,"file":"memo.mjs","sources":["../../../../src/utils/supports/memo.ts"],"sourcesContent":["import { memo } from \"motion-utils\"\nimport { supportsFlags } from \"./flags\"\n\nexport function memoSupports<T extends any>(\n callback: () => T,\n supportsFlag: keyof typeof supportsFlags\n) {\n const memoized = memo(callback)\n return () => supportsFlags[supportsFlag] ?? memoized()\n}\n"],"names":[],"mappings":";;;AAGM,SAAU,YAAY,CACxB,QAAiB,EACjB,YAAwC,EAAA;AAExC,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC/B,OAAO,MAAM,aAAa,CAAC,YAAY,CAAC,IAAI,QAAQ,EAAE;AAC1D;;;;"}
@@ -0,0 +1,2 @@
import { createSidecarMedium } from 'use-sidecar';
export var effectCar = createSidecarMedium();
@@ -0,0 +1,35 @@
import { HonoOptions } from "../../hono-base.js";
import { Env, H, HandlerResponse, Input, IntersectNonAnyTypes, MiddlewareHandler } from "../../types.js";
import { Hono } from "../../hono.js";
//#region src/helper/factory/index.d.ts
type InitApp<E extends Env = Env> = (app: Hono<E>) => void;
export interface CreateHandlersInterface<E extends Env, P extends string> {
<I extends Input = {}, R extends HandlerResponse<any> = any, E2 extends Env = E>(handler1: H<E2, P, I, R>): [H<E2, P, I, R>];
<I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any, R2 extends HandlerResponse<any> = any, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>>(handler1: H<E2, P, I, R>, handler2: H<E3, P, I2, R2>): [H<E2, P, I, R>, H<E3, P, I2, R2>];
<I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any, R2 extends HandlerResponse<any> = any, R3 extends HandlerResponse<any> = any, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>>(handler1: H<E2, P, I, R>, handler2: H<E3, P, I2, R2>, handler3: H<E4, P, I3, R3>): [H<E2, P, I, R>, H<E3, P, I2, R2>, H<E4, P, I3, R3>];
<I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any, R2 extends HandlerResponse<any> = any, R3 extends HandlerResponse<any> = any, R4 extends HandlerResponse<any> = any, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>>(handler1: H<E2, P, I, R>, handler2: H<E3, P, I2, R2>, handler3: H<E4, P, I3, R3>, handler4: H<E5, P, I4, R4>): [H<E2, P, I, R>, H<E3, P, I2, R2>, H<E4, P, I3, R3>, H<E5, P, I4, R4>];
<I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any, R2 extends HandlerResponse<any> = any, R3 extends HandlerResponse<any> = any, R4 extends HandlerResponse<any> = any, R5 extends HandlerResponse<any> = any, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>>(handler1: H<E2, P, I, R>, handler2: H<E3, P, I2, R2>, handler3: H<E4, P, I3, R3>, handler4: H<E5, P, I4, R4>, handler5: H<E6, P, I5, R5>): [H<E2, P, I, R>, H<E3, P, I2, R2>, H<E4, P, I3, R3>, H<E5, P, I4, R4>, H<E6, P, I5, R5>];
<I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any, R2 extends HandlerResponse<any> = any, R3 extends HandlerResponse<any> = any, R4 extends HandlerResponse<any> = any, R5 extends HandlerResponse<any> = any, R6 extends HandlerResponse<any> = any, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>>(handler1: H<E2, P, I, R>, handler2: H<E3, P, I2, R2>, handler3: H<E4, P, I3, R3>, handler4: H<E5, P, I4, R4>, handler5: H<E6, P, I5, R5>, handler6: H<E7, P, I6, R6>): [H<E2, P, I, R>, H<E3, P, I2, R2>, H<E4, P, I3, R3>, H<E5, P, I4, R4>, H<E6, P, I5, R5>, H<E7, P, I6, R6>];
<I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, R extends HandlerResponse<any> = any, R2 extends HandlerResponse<any> = any, R3 extends HandlerResponse<any> = any, R4 extends HandlerResponse<any> = any, R5 extends HandlerResponse<any> = any, R6 extends HandlerResponse<any> = any, R7 extends HandlerResponse<any> = any, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>>(handler1: H<E2, P, I, R>, handler2: H<E3, P, I2, R2>, handler3: H<E4, P, I3, R3>, handler4: H<E5, P, I4, R4>, handler5: H<E6, P, I5, R5>, handler6: H<E7, P, I6, R6>, handler7: H<E8, P, I7, R7>): [H<E2, P, I, R>, H<E3, P, I2, R2>, H<E4, P, I3, R3>, H<E5, P, I4, R4>, H<E6, P, I5, R5>, H<E7, P, I6, R6>, H<E8, P, I7, R7>];
<I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, R extends HandlerResponse<any> = any, R2 extends HandlerResponse<any> = any, R3 extends HandlerResponse<any> = any, R4 extends HandlerResponse<any> = any, R5 extends HandlerResponse<any> = any, R6 extends HandlerResponse<any> = any, R7 extends HandlerResponse<any> = any, R8 extends HandlerResponse<any> = any, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>>(handler1: H<E2, P, I, R>, handler2: H<E3, P, I2, R2>, handler3: H<E4, P, I3, R3>, handler4: H<E5, P, I4, R4>, handler5: H<E6, P, I5, R5>, handler6: H<E7, P, I6, R6>, handler7: H<E8, P, I7, R7>, handler8: H<E9, P, I8, R8>): [H<E2, P, I, R>, H<E3, P, I2, R2>, H<E4, P, I3, R3>, H<E5, P, I4, R4>, H<E6, P, I5, R5>, H<E7, P, I6, R6>, H<E8, P, I7, R7>, H<E9, P, I8, R8>];
<I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, R extends HandlerResponse<any> = any, R2 extends HandlerResponse<any> = any, R3 extends HandlerResponse<any> = any, R4 extends HandlerResponse<any> = any, R5 extends HandlerResponse<any> = any, R6 extends HandlerResponse<any> = any, R7 extends HandlerResponse<any> = any, R8 extends HandlerResponse<any> = any, R9 extends HandlerResponse<any> = any, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>>(handler1: H<E2, P, I, R>, handler2: H<E3, P, I2, R2>, handler3: H<E4, P, I3, R3>, handler4: H<E5, P, I4, R4>, handler5: H<E6, P, I5, R5>, handler6: H<E7, P, I6, R6>, handler7: H<E8, P, I7, R7>, handler8: H<E9, P, I8, R8>, handler9: H<E10, P, I9, R9>): [H<E2, P, I, R>, H<E3, P, I2, R>, H<E4, P, I3, R>, H<E5, P, I4, R>, H<E6, P, I5, R>, H<E7, P, I6, R>, H<E8, P, I7, R>, H<E9, P, I8, R>, H<E10, P, I9, R>];
<I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, R extends HandlerResponse<any> = any, R2 extends HandlerResponse<any> = any, R3 extends HandlerResponse<any> = any, R4 extends HandlerResponse<any> = any, R5 extends HandlerResponse<any> = any, R6 extends HandlerResponse<any> = any, R7 extends HandlerResponse<any> = any, R8 extends HandlerResponse<any> = any, R9 extends HandlerResponse<any> = any, R10 extends HandlerResponse<any> = any, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>>(handler1: H<E2, P, I, R>, handler2: H<E3, P, I2, R2>, handler3: H<E4, P, I3, R3>, handler4: H<E5, P, I4, R4>, handler5: H<E6, P, I5, R5>, handler6: H<E7, P, I6, R6>, handler7: H<E8, P, I7, R7>, handler8: H<E9, P, I8, R8>, handler9: H<E10, P, I9, R9>, handler10: H<E11, P, I10, R10>): [H<E2, P, I, R>, H<E3, P, I2, R2>, H<E4, P, I3, R3>, H<E5, P, I4, R4>, H<E6, P, I5, R5>, H<E7, P, I6, R6>, H<E8, P, I7, R7>, H<E9, P, I8, R8>, H<E10, P, I9, R9>, H<E11, P, I10, R10>];
}
export declare class Factory<E extends Env = Env, P extends string = string> {
private initApp?;
constructor(init?: {
initApp?: InitApp<E>;
defaultAppOptions?: HonoOptions<E>;
});
createApp: (options?: HonoOptions<E>) => Hono<E>;
createMiddleware: <I extends Input = {}, R extends HandlerResponse<any> | void = void>(middleware: MiddlewareHandler<E, P, I, R extends void ? Response : R>) => MiddlewareHandler<E, P, I, R extends void ? Response : R>;
createHandlers: CreateHandlersInterface<E, P>;
}
export declare const createFactory: <E extends Env = Env, P extends string = string>(init?: {
initApp?: InitApp<E>;
defaultAppOptions?: HonoOptions<E>;
}) => Factory<E, P>;
export declare const createMiddleware: <E extends Env = any, P extends string = string, I extends Input = {}, R extends HandlerResponse<any> | void = void>(middleware: MiddlewareHandler<E, P, I, R extends void ? Response : R>) => MiddlewareHandler<E, P, I, R extends void ? Response : R>;
//#endregion
export {};
@@ -0,0 +1,126 @@
/**
* HMAC: RFC2104 message authentication code.
* @module
*/
import {
abytes,
aexists,
ahash,
aoutput,
clean,
type CHash,
type Hash,
type TArg,
type TRet,
} from './utils.ts';
/**
* Internal class for HMAC.
* Accepts any byte key, although RFC 2104 §3 recommends keys at least
* `HashLen` bytes long.
*/
export class _HMAC<T extends Hash<T>> implements Hash<_HMAC<T>> {
oHash: T;
iHash: T;
blockLen: number;
outputLen: number;
canXOF = false;
private finished = false;
private destroyed = false;
constructor(hash: TArg<CHash>, key: TArg<Uint8Array>) {
ahash(hash);
abytes(key, undefined, 'key');
this.iHash = hash.create() as T;
if (typeof this.iHash.update !== 'function')
throw new Error('Expected instance of class which extends utils.Hash');
this.blockLen = this.iHash.blockLen;
this.outputLen = this.iHash.outputLen;
const blockLen = this.blockLen;
const pad = new Uint8Array(blockLen);
// blockLen can be bigger than outputLen
pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
for (let i = 0; i < pad.length; i++) pad[i] ^= 0x36;
this.iHash.update(pad);
// By doing update (processing of the first block) of the outer hash here,
// we can re-use it between multiple calls via clone.
this.oHash = hash.create() as T;
// Undo internal XOR && apply outer XOR
for (let i = 0; i < pad.length; i++) pad[i] ^= 0x36 ^ 0x5c;
this.oHash.update(pad);
clean(pad);
}
update(buf: TArg<Uint8Array>): this {
aexists(this);
this.iHash.update(buf);
return this;
}
digestInto(out: TArg<Uint8Array>): void {
aexists(this);
aoutput(out, this);
this.finished = true;
const buf = out.subarray(0, this.outputLen);
// Reuse the first outputLen bytes for the inner digest; the outer hash consumes them before
// overwriting that same prefix with the final tag, leaving any oversized tail untouched.
this.iHash.digestInto(buf);
this.oHash.update(buf);
this.oHash.digestInto(buf);
this.destroy();
}
digest(): TRet<Uint8Array> {
const out = new Uint8Array(this.oHash.outputLen);
this.digestInto(out);
return out as TRet<Uint8Array>;
}
_cloneInto(to?: _HMAC<T>): _HMAC<T> {
// Create new instance without calling constructor since the key
// is already in state and we don't know it.
to ||= Object.create(Object.getPrototypeOf(this), {});
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
to = to as this;
to.finished = finished;
to.destroyed = destroyed;
to.blockLen = blockLen;
to.outputLen = outputLen;
to.oHash = oHash._cloneInto(to.oHash);
to.iHash = iHash._cloneInto(to.iHash);
return to;
}
clone(): _HMAC<T> {
return this._cloneInto();
}
destroy(): void {
this.destroyed = true;
this.oHash.destroy();
this.iHash.destroy();
}
}
/**
* HMAC: RFC2104 message authentication code.
* @param hash - function that would be used e.g. sha256
* @param key - authentication key bytes
* @param message - message bytes to authenticate
* @returns Authentication tag bytes.
* @example
* Compute an RFC 2104 HMAC.
* ```ts
* import { hmac } from '@noble/hashes/hmac.js';
* import { sha256 } from '@noble/hashes/sha2.js';
* const mac = hmac(sha256, new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]));
* ```
*/
type HmacFn = {
(hash: TArg<CHash>, key: TArg<Uint8Array>, message: TArg<Uint8Array>): TRet<Uint8Array>;
create(hash: TArg<CHash>, key: TArg<Uint8Array>): TRet<_HMAC<any>>;
};
export const hmac: TRet<HmacFn> = /* @__PURE__ */ (() => {
const hmac_ = ((
hash: TArg<CHash>,
key: TArg<Uint8Array>,
message: TArg<Uint8Array>
): TRet<Uint8Array> => new _HMAC<any>(hash, key).update(message).digest()) as TRet<HmacFn>;
hmac_.create = (hash: TArg<CHash>, key: TArg<Uint8Array>): TRet<_HMAC<any>> =>
new _HMAC<any>(hash, key) as TRet<_HMAC<any>>;
return hmac_;
})();
@@ -0,0 +1,211 @@
// based on https://github.com/Ethan-Arrowood/undici-fetch/blob/249269714db874351589d2d364a0645d5160ae71/index.d.ts (MIT license)
// and https://github.com/node-fetch/node-fetch/blob/914ce6be5ec67a8bab63d68510aabf07cb818b6d/index.d.ts (MIT license)
/// <reference types="node" />
import { Blob } from 'node:buffer'
import { URL, URLSearchParams } from 'node:url'
import { ReadableStream } from 'node:stream/web'
import { FormData } from './formdata'
import { HeaderRecord } from './header'
import Dispatcher from './dispatcher'
export type RequestInfo = string | URL | Request
export declare function fetch (
input: RequestInfo,
init?: RequestInit
): Promise<Response>
export type BodyInit =
| ArrayBuffer
| AsyncIterable<Uint8Array>
| Blob
| FormData
| Iterable<Uint8Array>
| NodeJS.ArrayBufferView
| URLSearchParams
| null
| string
export class BodyMixin {
readonly body: ReadableStream | null
readonly bodyUsed: boolean
readonly arrayBuffer: () => Promise<ArrayBuffer>
readonly blob: () => Promise<Blob>
readonly bytes: () => Promise<Uint8Array>
/**
* @deprecated This method is not recommended for parsing multipart/form-data bodies in server environments.
* It is recommended to use a library such as [@fastify/busboy](https://www.npmjs.com/package/@fastify/busboy) as follows:
*
* @example
* ```js
* import { Busboy } from '@fastify/busboy'
* import { Readable } from 'node:stream'
*
* const response = await fetch('...')
* const busboy = new Busboy({ headers: { 'content-type': response.headers.get('content-type') } })
*
* // handle events emitted from `busboy`
*
* Readable.fromWeb(response.body).pipe(busboy)
* ```
*/
readonly formData: () => Promise<FormData>
readonly json: () => Promise<unknown>
readonly text: () => Promise<string>
}
export interface SpecIterator<T, TReturn = any, TNext = undefined> {
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
}
export interface SpecIterableIterator<T> extends SpecIterator<T> {
[Symbol.iterator](): SpecIterableIterator<T>;
}
export interface SpecIterable<T> {
[Symbol.iterator](): SpecIterator<T>;
}
export type HeadersInit = [string, string][] | HeaderRecord | Headers
export declare class Headers implements SpecIterable<[string, string]> {
constructor (init?: HeadersInit)
readonly append: (name: string, value: string) => void
readonly delete: (name: string) => void
readonly get: (name: string) => string | null
readonly has: (name: string) => boolean
readonly set: (name: string, value: string) => void
readonly getSetCookie: () => string[]
readonly forEach: (
callbackfn: (value: string, key: string, iterable: Headers) => void,
thisArg?: unknown
) => void
readonly keys: () => SpecIterableIterator<string>
readonly values: () => SpecIterableIterator<string>
readonly entries: () => SpecIterableIterator<[string, string]>
readonly [Symbol.iterator]: () => SpecIterableIterator<[string, string]>
}
export type RequestCache =
| 'default'
| 'force-cache'
| 'no-cache'
| 'no-store'
| 'only-if-cached'
| 'reload'
export type RequestCredentials = 'omit' | 'include' | 'same-origin'
type RequestDestination =
| ''
| 'audio'
| 'audioworklet'
| 'document'
| 'embed'
| 'font'
| 'image'
| 'manifest'
| 'object'
| 'paintworklet'
| 'report'
| 'script'
| 'sharedworker'
| 'style'
| 'track'
| 'video'
| 'worker'
| 'xslt'
export interface RequestInit {
body?: BodyInit | null
cache?: RequestCache
credentials?: RequestCredentials
dispatcher?: Dispatcher
duplex?: RequestDuplex
headers?: HeadersInit
integrity?: string
keepalive?: boolean
method?: string
mode?: RequestMode
redirect?: RequestRedirect
referrer?: string
referrerPolicy?: ReferrerPolicy
signal?: AbortSignal | null
window?: null
}
export type ReferrerPolicy =
| ''
| 'no-referrer'
| 'no-referrer-when-downgrade'
| 'origin'
| 'origin-when-cross-origin'
| 'same-origin'
| 'strict-origin'
| 'strict-origin-when-cross-origin'
| 'unsafe-url'
export type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
export type RequestRedirect = 'error' | 'follow' | 'manual'
export type RequestDuplex = 'half'
export declare class Request extends BodyMixin {
constructor (input: RequestInfo, init?: RequestInit)
readonly cache: RequestCache
readonly credentials: RequestCredentials
readonly destination: RequestDestination
readonly headers: Headers
readonly integrity: string
readonly method: string
readonly mode: RequestMode
readonly redirect: RequestRedirect
readonly referrer: string
readonly referrerPolicy: ReferrerPolicy
readonly url: string
readonly keepalive: boolean
readonly signal: AbortSignal
readonly duplex: RequestDuplex
readonly clone: () => Request
}
export interface ResponseInit {
readonly status?: number
readonly statusText?: string
readonly headers?: HeadersInit
}
export type ResponseType =
| 'basic'
| 'cors'
| 'default'
| 'error'
| 'opaque'
| 'opaqueredirect'
export type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
export declare class Response extends BodyMixin {
constructor (body?: BodyInit, init?: ResponseInit)
readonly headers: Headers
readonly ok: boolean
readonly status: number
readonly statusText: string
readonly type: ResponseType
readonly url: string
readonly redirected: boolean
readonly clone: () => Response
static error (): Response
static json (data: any, init?: ResponseInit): Response
static redirect (url: string | URL, status?: ResponseRedirectStatus): Response
}
@@ -0,0 +1,4 @@
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"unsafeMerging", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1,71 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExportVisitor = void 0;
const types_1 = require("@typescript-eslint/types");
const Visitor_1 = require("./Visitor");
class ExportVisitor extends Visitor_1.Visitor {
#exportNode;
#referencer;
constructor(node, referencer) {
super(referencer);
this.#exportNode = node;
this.#referencer = referencer;
}
static visit(referencer, node) {
const exportReferencer = new ExportVisitor(node, referencer);
exportReferencer.visit(node);
}
ExportDefaultDeclaration(node) {
if (node.declaration.type === types_1.AST_NODE_TYPES.Identifier) {
// export default A;
// this could be a type or a variable
this.visit(node.declaration);
}
else {
// export const a = 1;
// export something();
// etc
// these not included in the scope of this visitor as they are all guaranteed to be values or declare variables
}
}
ExportNamedDeclaration(node) {
if (node.source) {
// export ... from 'foo';
// these are external identifiers so there shouldn't be references or defs
return;
}
if (!node.declaration) {
// export { x };
this.visitChildren(node);
}
else {
// export const x = 1;
// this is not included in the scope of this visitor as it creates a variable
}
}
ExportSpecifier(node) {
if (node.exportKind === 'type' &&
node.local.type === types_1.AST_NODE_TYPES.Identifier) {
// export { type T };
// type exports can only reference types
//
// we can't let this fall through to the Identifier selector because the exportKind is on this node
// and we don't have access to the `.parent` during scope analysis
this.#referencer.currentScope().referenceType(node.local);
}
else {
this.visit(node.local);
}
}
Identifier(node) {
if (this.#exportNode.exportKind === 'type') {
// export type { T };
// type exports can only reference types
this.#referencer.currentScope().referenceType(node);
}
else {
this.#referencer.currentScope().referenceDualValueType(node);
}
}
}
exports.ExportVisitor = ExportVisitor;
@@ -0,0 +1,89 @@
Tree Kill
=========
Kill all processes in the process tree, including the root process.
Examples
=======
Kill all the descendent processes of the process with pid `1`, including the process with pid `1` itself:
```js
var kill = require('tree-kill');
kill(1);
```
Send a signal other than SIGTERM.:
```js
var kill = require('tree-kill');
kill(1, 'SIGKILL');
```
Run a callback when done killing the processes. Passes an error argument if there was an error.
```js
var kill = require('tree-kill');
kill(1, 'SIGKILL', function(err) {
// Do things
});
```
You can also install tree-kill globally and use it as a command:
```sh
tree-kill 1 # sends SIGTERM to process 1 and its descendents
tree-kill 1 SIGTERM # same
tree-kill 1 SIGKILL # sends KILL instead of TERMINATE
```
Methods
=======
## require('tree-kill')(pid, [signal], [callback]);
Sends signal `signal` to all children processes of the process with pid `pid`, including `pid`. Signal defaults to `SIGTERM`.
For Linux, this uses `ps -o pid --no-headers --ppid PID` to find the parent pids of `PID`.
For Darwin/OSX, this uses `pgrep -P PID` to find the parent pids of `PID`.
For Windows, this uses `'taskkill /pid PID /T /F'` to kill the process tree. Note that on Windows, sending the different kinds of POSIX signals is not possible.
Install
=======
With [npm](https://npmjs.org) do:
```
npm install tree-kill
```
License
=======
MIT
Changelog
=========
## [1.2.2] - 2019-12-11
### Changed
- security fix: sanitize `pid` parameter to fix arbitrary code execution vulnerability
## [1.2.1] - 2018-11-05
### Changed
- added missing LICENSE file
- updated TypeScript definitions
## [1.2.0] - 2017-09-19
### Added
- TypeScript definitions
### Changed
- `kill(pid, callback)` works. Before you had to use `kill(pid, signal, callback)`
## [1.1.0] - 2016-05-13
### Added
- A `tree-kill` CLI
## [1.0.0] - 2015-09-17
### Added
- optional callback
- Darwin support
@@ -0,0 +1,69 @@
/**
* @fileoverview Rule to disallow use of void operator.
* @author Mike Sidorov
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: [
{
allowAsStatement: false,
},
],
docs: {
description: "Disallow `void` operators",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/no-void",
},
messages: {
noVoid: "Expected 'undefined' and instead saw 'void'.",
},
schema: [
{
type: "object",
properties: {
allowAsStatement: {
type: "boolean",
},
},
additionalProperties: false,
},
],
},
create(context) {
const [{ allowAsStatement }] = context.options;
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
'UnaryExpression[operator="void"]'(node) {
if (
allowAsStatement &&
node.parent &&
node.parent.type === "ExpressionStatement"
) {
return;
}
context.report({
node,
messageId: "noVoid",
});
},
};
},
};
@@ -0,0 +1,12 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
Object.defineProperty(exports, "__esModule", { value: true });
exports.es2015_promise = void 0;
const base_config_1 = require("./base-config");
exports.es2015_promise = {
libs: [],
variables: [['PromiseConstructor', base_config_1.TYPE]],
};
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_0H _i","2":"_uL","194":"_EH"},C:{"1":"_H _LL _bH _p","2":"_bB _II _L"},D:{"1":"_0H _l","2":"_v _dH","194":"_TP _EH"},E:{"1":"_uC","2":"_BH"},F:{"1":"_ES","2":"_UR","194":"_QP d"},G:{"1":"_7B","2":"_XE"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"2":"bC"},P:{"1":"_6B","2":"_IL"},Q:{"2":"JE"},R:{"2":"KE"},S:{"2":"_C"}},B:5,C:"Small, Large, and Dynamic viewport units",D:true};