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 @@
{"version":3,"file":"file-cog-2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,10 @@
import { ZodNullableDef } from "zod/v3";
import { JsonSchema7Type } from "../parseTypes.js";
import { Refs } from "../Refs.js";
import { JsonSchema7NullType } from "./null.js";
export type JsonSchema7NullableType = {
anyOf: [JsonSchema7Type, JsonSchema7NullType];
} | {
type: [string, "null"];
};
export declare function parseNullableDef(def: ZodNullableDef, refs: Refs): JsonSchema7NullableType | undefined;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_K","2":"_I"},C:{"2":"_S"},D:{"1":"_GK","2":"_MI","194":"_HJ _oC"},E:{"2":"_R"},F:{"1":"_8L","2":"_VK"},G:{"2":"_M"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"2":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"2":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"2":"_C"}},B:4,C:"Orientation Sensor",D:true};
@@ -0,0 +1,13 @@
"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.es2025_intl = void 0;
const base_config_1 = require("./base-config");
const es2018_intl_1 = require("./es2018.intl");
exports.es2025_intl = {
libs: [es2018_intl_1.es2018_intl],
variables: [['Intl', base_config_1.TYPE_VALUE]],
};
@@ -0,0 +1,21 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const TentTree = createLucideIcon("TentTree", [
["circle", { cx: "4", cy: "4", r: "2", key: "bt5ra8" }],
["path", { d: "m14 5 3-3 3 3", key: "1sorif" }],
["path", { d: "m14 10 3-3 3 3", key: "1jyi9h" }],
["path", { d: "M17 14V2", key: "8ymqnk" }],
["path", { d: "M17 14H7l-5 8h20Z", key: "13ar7p" }],
["path", { d: "M8 14v8", key: "1ghmqk" }],
["path", { d: "m9 14 5 8", key: "13pgi6" }]
]);
export { TentTree as default };
//# sourceMappingURL=tent-tree.js.map
@@ -0,0 +1,14 @@
import * as React from 'react';
export type AwaitOptions<T> = {
promise: Promise<T>;
};
/** Suspend until a deferred promise resolves or rejects and return its data. */
export declare function useAwaited<T>({ promise: _promise }: AwaitOptions<T>): T;
/**
* Component that suspends on a deferred promise and renders its child with
* the resolved value. Optionally provides a Suspense fallback.
*/
export declare function Await<T>(props: AwaitOptions<T> & {
fallback?: React.ReactNode;
children: (result: T) => React.ReactNode;
}): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_K","2":"_I"},C:{"2":"_S"},D:{"1":"_H SC _kC","2":"_7 _rD","132":"_bP"},E:{"2":"_R"},F:{"1":"_8F","2":"_4B _sB _O"},G:{"2":"_M"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"2":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_9F","2":"_nF"},Q:{"1":"JE"},R:{"1":"KE"},S:{"2":"_C"}},B:6,C:"Signed HTTP Exchanges (SXG)",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"lightbulb.js","sources":["../../../src/icons/lightbulb.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Lightbulb\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTUgMTRjLjItMSAuNy0xLjcgMS41LTIuNSAxLS45IDEuNS0yLjIgMS41LTMuNUE2IDYgMCAwIDAgNiA4YzAgMSAuMiAyLjIgMS41IDMuNS43LjcgMS4zIDEuNSAxLjUgMi41IiAvPgogIDxwYXRoIGQ9Ik05IDE4aDYiIC8+CiAgPHBhdGggZD0iTTEwIDIyaDQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/lightbulb\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 Lightbulb = createLucideIcon('Lightbulb', [\n [\n 'path',\n {\n d: 'M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5',\n key: '1gvzjb',\n },\n ],\n ['path', { d: 'M9 18h6', key: 'x1upvd' }],\n ['path', { d: 'M10 22h4', key: 'ceow96' }],\n]);\n\nexport default Lightbulb;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,iBAAiB,WAAa,CAAA,CAAA,CAAA;AAAA,CAC9C,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;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,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,92 @@
import { default as Level } from './Level';
import { IAppender, ILogger, LogEvent, LogLevel, LogOptions, TLevel } from './typings';
/**
* Logger instance (日志实例)
*/
export default class Logger implements ILogger {
name: string;
readonly appenders: Map<string, IAppender>;
protected context: Record<string, any>;
protected _level: Level;
/**
* Create a logger instance (创建日志实例)
* @param name Logger name (日志名称)
* @param options Logging options (日志选项)
*/
constructor(name: string, { level, appenders }?: LogOptions);
/**
* Log level name (日志级别名称)
*/
get levelName(): TLevel;
/**
* Log level (日志级别)
*/
get level(): Level;
/**
* Set log level (设置日志级别)
* @param level Log level (日志级别)
*/
set level(level: LogLevel);
/**
* Add context (添加上下文)
* @param key Context key (上下文键)
* @param value Context value (上下文值)
*/
addContext(key: any, value: any): void;
/**
* Remove context (移除上下文)
* @param key Context key (上下文键)
*/
removeContext(key: any): void;
/**
* Clear context (清除上下文)
*/
clearContext(): void;
/**
* Dispose all appenders (关闭所有appenders)
*/
dispose(): Promise<PromiseSettledResult<void>[]>;
/**
* Log a message of level TRACE (记录TRACE级别的日志)
* @param args Message arguments (消息参数)
*/
trace(...args: any[]): void;
/**
* Log a message of level DEBUG (记录DEBUG级别的日志)
* @param args Message arguments (消息参数)
*/
debug(...args: any[]): void;
/**
* Log a message of level INFO (记录INFO级别的日志)
* @param args Message arguments (消息参数)
*/
info(...args: any[]): void;
/**
* Log a message of level WARN (记录WARN级别的日志)
* @param args Message arguments (消息参数)
*/
warn(...args: any[]): void;
/**
* Log a message of level ERROR (记录ERROR级别的日志)
* @param args Message arguments (消息参数)
*/
error(...args: any[]): void;
/**
* Log a message of level FATAL (记录FATAL级别的日志)
* @param args Message arguments (消息参数)
*/
fatal(...args: any[]): void;
/**
* Create a log event (创建日志事件)
* @param level Log level (日志级别)
* @param message Message (消息)
* @returns Log event (日志事件)
*/
protected createEvent(level: Level, message: any[]): LogEvent;
/**
* Log a message (记录日志)
* @param level Log level (日志级别)
* @param message Content (内容)
*/
protected log(level: Level, message: any[]): void;
}
@@ -0,0 +1,22 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Paperclip = createLucideIcon("Paperclip", [
["path", { d: "M13.234 20.252 21 12.3", key: "1cbrk9" }],
[
"path",
{
d: "m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",
key: "1pkts6"
}
]
]);
export { Paperclip as default };
//# sourceMappingURL=paperclip.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../src/components/AnimatePresence/index.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { useContext, useMemo, useRef, useState } from \"react\"\nimport { LayoutGroupContext } from \"../../context/LayoutGroupContext\"\nimport { useConstant } from \"../../utils/use-constant\"\nimport { useIsomorphicLayoutEffect } from \"../../utils/use-isomorphic-effect\"\nimport { PresenceChild } from \"./PresenceChild\"\nimport { AnimatePresenceProps } from \"./types\"\nimport { usePresence } from \"./use-presence\"\nimport { ComponentKey, getChildKey, onlyElements } from \"./utils\"\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nexport const AnimatePresence = ({\n children,\n custom,\n initial = true,\n onExitComplete,\n presenceAffectsLayout = true,\n mode = \"sync\",\n propagate = false,\n anchorX = \"left\",\n anchorY = \"top\",\n root\n}: React.PropsWithChildren<AnimatePresenceProps>) => {\n const [isParentPresent, safeToRemove] = usePresence(propagate)\n\n /**\n * Filter any children that aren't ReactElements. We can only track components\n * between renders with a props.key.\n */\n const presentChildren = useMemo(() => onlyElements(children), [children])\n\n /**\n * Track the keys of the currently rendered children. This is used to\n * determine which children are exiting.\n */\n const presentKeys =\n propagate && !isParentPresent ? [] : presentChildren.map(getChildKey)\n\n /**\n * If `initial={false}` we only want to pass this to components in the first render.\n */\n const isInitialRender = useRef(true)\n\n /**\n * A ref containing the currently present children. When all exit animations\n * are complete, we use this to re-render the component with the latest children\n * *committed* rather than the latest children *rendered*.\n */\n const pendingPresentChildren = useRef(presentChildren)\n\n /**\n * Track which exiting children have finished animating out.\n */\n const exitComplete = useConstant(() => new Map<ComponentKey, boolean>())\n\n /**\n * Track which components are currently processing exit to prevent duplicate processing.\n */\n const exitingComponents = useRef(new Set<ComponentKey>())\n\n /**\n * Save children to render as React state. To ensure this component is concurrent-safe,\n * we check for exiting children via an effect.\n */\n const [diffedChildren, setDiffedChildren] = useState(presentChildren)\n const [renderedChildren, setRenderedChildren] = useState(presentChildren)\n\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false\n pendingPresentChildren.current = presentChildren\n\n /**\n * Update complete status of exiting children.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const key = getChildKey(renderedChildren[i])\n\n if (!presentKeys.includes(key)) {\n if (exitComplete.get(key) !== true) {\n exitComplete.set(key, false)\n }\n } else {\n exitComplete.delete(key)\n exitingComponents.current.delete(key)\n }\n }\n }, [renderedChildren, presentKeys.length, presentKeys.join(\"-\")])\n\n const exitingChildren: any[] = []\n\n if (presentChildren !== diffedChildren) {\n let nextChildren = [...presentChildren]\n\n /**\n * Loop through all the currently rendered components and decide which\n * are exiting.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const child = renderedChildren[i]\n const key = getChildKey(child)\n\n if (!presentKeys.includes(key)) {\n nextChildren.splice(i, 0, child)\n exitingChildren.push(child)\nLine truncated
@@ -0,0 +1,49 @@
import { Virtualizer, PartialKeys, VirtualizerOptions } from '@tanstack/virtual-core';
export * from '@tanstack/virtual-core';
export type ReactVirtualizer<TScrollElement extends Element | Window, TItemElement extends Element> = Virtualizer<TScrollElement, TItemElement> & {
/**
* Ref callback for the inner size container element. Only meaningful when
* `directDomUpdates: true` — the virtualizer writes the container's
* main-axis size (`height` or `width`) directly to skip React re-renders.
*/
containerRef: (node: HTMLElement | null) => void;
};
export type ReactVirtualizerOptions<TScrollElement extends Element | Window, TItemElement extends Element> = VirtualizerOptions<TScrollElement, TItemElement> & {
useFlushSync?: boolean;
/**
* Skip React re-renders for scroll-only updates. The virtualizer writes
* item positions (`top`/`left`) and the container size (`height`/`width`)
* directly to the DOM, and only re-renders when the visible index range
* or `isScrolling` changes.
*
* Requirements when enabled:
* - Item elements must be `position: absolute`; in `'transform'` mode they
* must also be anchored with `top: 0` / `left: 0`.
* - Item elements must NOT set the main-axis position in their style — the
* virtualizer owns `top` / `left` in `'position'` mode and `transform` in
* `'transform'` mode.
* - The inner size container must receive `virtualizer.containerRef` and
* must NOT set `height` / `width` in its style.
* - For multi-lane layouts (grids / masonry), the cross-axis position
* (e.g. `left: ${(item.lane * 100) / lanes}%`) is stable per item and
* must still be set in your JSX — only the main axis is automated.
*
* This flag is intended to be set once at mount. Toggling it (or
* `directDomUpdatesMode`) at runtime can leave stale inline styles on
* items and the container.
*/
directDomUpdates?: boolean;
/**
* How `directDomUpdates` positions item elements.
* - `'transform'` (default): writes `transform: translate3d(...)`.
* Promotes items to their own compositor layer — usually smoother on long
* lists, but creates a stacking context and can interfere with
* `position: fixed` descendants. Item elements must still be anchored with
* `position: absolute`, `top: 0`, and `left: 0`.
* - `'position'`: writes `top` / `left`. Item elements must be
* `position: absolute`.
*/
directDomUpdatesMode?: 'position' | 'transform';
};
export declare function useVirtualizer<TScrollElement extends Element, TItemElement extends Element>(options: PartialKeys<ReactVirtualizerOptions<TScrollElement, TItemElement>, 'observeElementRect' | 'observeElementOffset' | 'scrollToFn'>): ReactVirtualizer<TScrollElement, TItemElement>;
export declare function useWindowVirtualizer<TItemElement extends Element>(options: PartialKeys<ReactVirtualizerOptions<Window, TItemElement>, 'getScrollElement' | 'observeElementRect' | 'observeElementOffset' | 'scrollToFn'>): ReactVirtualizer<Window, TItemElement>;
@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _dispose;
function dispose_SuppressedError(error, suppressed) {
if (typeof SuppressedError !== "undefined") {
dispose_SuppressedError = SuppressedError;
} else {
dispose_SuppressedError = function SuppressedError(error, suppressed) {
this.suppressed = suppressed;
this.error = error;
this.stack = new Error().stack;
};
dispose_SuppressedError.prototype = Object.create(Error.prototype, {
constructor: {
value: dispose_SuppressedError,
writable: true,
configurable: true
}
});
}
return new dispose_SuppressedError(error, suppressed);
}
function _dispose(stack, error, hasError) {
function next() {
while (stack.length > 0) {
try {
var r = stack.pop();
var p = r.d.call(r.v);
if (r.a) return Promise.resolve(p).then(next, err);
} catch (e) {
return err(e);
}
}
if (hasError) throw error;
}
function err(e) {
error = hasError ? new dispose_SuppressedError(error, e) : e;
hasError = true;
return next();
}
return next();
}
//# sourceMappingURL=dispose.js.map
@@ -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.es2025_regexp = void 0;
const base_config_1 = require("./base-config");
exports.es2025_regexp = {
libs: [],
variables: [['RegExpConstructor', base_config_1.TYPE]],
};
@@ -0,0 +1,28 @@
/**
* Filters out Vite plugins that have `apply: 'serve'` set.
*
* Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
* are intended only for Vite's dev server and should be excluded from the build process.
*
* @param plugins - Array of plugins (can include nested arrays)
* @returns Filtered array with serve-only plugins removed
*
* @example
* ```ts
* import { defineConfig } from 'rolldown';
* import { filterVitePlugins } from '@rolldown/pluginutils';
* import viteReact from '@vitejs/plugin-react';
*
* export default defineConfig({
* plugins: filterVitePlugins([
* viteReact(),
* {
* name: 'dev-only',
* apply: 'serve', // This will be filtered out
* // ...
* }
* ])
* });
* ```
*/
export declare function filterVitePlugins<T = any>(plugins: T | T[] | null | undefined | false): T[];
@@ -0,0 +1,9 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
export { default } from './square-activity.js';
//# sourceMappingURL=activity-square.js.map
@@ -0,0 +1,143 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const util = __importStar(require("../core/util.cjs"));
const error = () => {
const Sizable = {
string: { unit: "ಅಕ್ಷರಗಳು", verb: "ಹೊಂದಲು" },
file: { unit: "ಬೈಟ್‌ಗಳು", verb: "ಹೊಂದಲು" },
array: { unit: "ವಸ್ತುಗಳು", verb: "ಹೊಂದಲು" },
set: { unit: "ವಸ್ತುಗಳು", verb: "ಹೊಂದಲು" },
map: { unit: "entries", verb: "ಹೊಂದಲು" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "ಇನ್ಪುಟ್",
email: "email ವಿಳಾಸ",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO ದಿನಾಂಕದ ಸಮಯ",
date: "ISO ದಿನಾಂಕ",
time: "ISO ಸಮಯ",
duration: "ISO ಅವಧಿ",
ipv4: "IPv4 ವಿಳಾಸ",
ipv6: "IPv6 ವಿಳಾಸ",
mac: "MAC ವಿಳಾಸ",
cidrv4: "IPv4 ವ್ಯಾಪ್ತಿಯ",
cidrv6: "IPv6 ವ್ಯಾಪ್ತಿಯ",
base64: "base64-encodedಸ್ಟ್ರಿಂಗ್",
base64url: "base64url-encodedಸ್ಟ್ರಿಂಗ್",
json_string: "JSONಸ್ಟ್ರಿಂಗ್",
e164: "E.164 ಸಂಖ್ಯೆ",
credit_card: "ಕ್ರೆಡಿಟ್ ಕಾರ್ಡ್ ಸಂಖ್ಯೆ",
currency_code: "ಕರೆನ್ಸಿ ಕೋಡ್",
iban: "IBAN",
jwt: "JWT",
template_literal: "ಇನ್ಪುಟ್",
};
// type names: missing keys = do not translate (use raw value via ?? fallback)
const TypeDictionary = {
// Compatibility: "nan" -> "NaN" for display
nan: "NaN",
// All other type names omitted - they fall back to raw values via ?? operator
};
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = TypeDictionary[issue.expected] ?? issue.expected;
const receivedType = util.parsedType(issue.input);
const received = TypeDictionary[receivedType] ?? receivedType;
return `ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${expected}, ಸ್ವೀಕರಿಸಿದನು ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${util.stringifyPrimitive(issue.values[0])}`;
return `ಅಮಾನ್ಯ ಆಯ್ಕೆ: ಇವುಗಳಲ್ಲಿ ಒಂದನ್ನು ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `ತುಂಬಾ ದೊಡ್ಡದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${issue.origin ?? "value"} ಹೊಂದಲು ${adj}${issue.maximum.toString()} ${sizing.unit ?? "ಅಂಶಗಳು"}`;
return `ತುಂಬಾ ದೊಡ್ಡದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${issue.origin ?? "value"} ಎಂದು ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `ತುಂಬಾ ಚಿಕ್ಕದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${issue.origin} ಹೊಂದಲು ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `ತುಂಬಾ ಚಿಕ್ಕದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${issue.origin} ಎಂದು ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with") {
return `ಅಮಾನ್ಯವಾದ ಸ್ಟ್ರಿಂಗ್: ಇದರೊಂದಿಗೆ ಪ್ರಾರಂಭಿಸಬೇಕು "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `ಅಮಾನ್ಯವಾದ ಸ್ಟ್ರಿಂಗ್: ಇದರೊಂದಿಗೆ ಕೊನೆಗೊಳ್ಳಬೇಕು "${_issue.suffix}"`;
if (_issue.format === "includes")
return `ಅಮಾನ್ಯ ಸ್ಟ್ರಿಂಗ್: ಒಳಗೊಂಡಿರಬೇಕು "${_issue.includes}"`;
if (_issue.format === "regex")
return `ಅಮಾನ್ಯವಾದ ಸ್ಟ್ರಿಂಗ್: ಮಾದರಿಗೆ ಹೊಂದಿಕೆಯಾಗಬೇಕು ${_issue.pattern}`;
return `ಅಮಾನ್ಯ ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `ಅಮಾನ್ಯ ಸಂಖ್ಯೆ: ಬಹುಸಂಖ್ಯೆಯಾಗಿರಬೇಕು ${issue.divisor}`;
case "unrecognized_keys":
return `ಗುರುತಿಸಲಾಗದ ಕೀ ${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `ಅಮಾನ್ಯವಾದ ಕೀ ಇನ್ ${issue.origin}`;
case "invalid_union":
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
return `ಅಮಾನ್ಯ ತಾರತಮ್ಯ ಮೌಲ್ಯ. ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${opts}`;
}
return "ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್";
case "invalid_element":
return `ರಲ್ಲಿ ಅಮಾನ್ಯ ಮೌಲ್ಯ ${issue.origin}`;
default:
return `ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್`;
}
};
};
function default_1() {
return {
localeError: error(),
};
}
module.exports = exports.default;
@@ -0,0 +1,143 @@
import * as util from "../core/util.js";
const error = () => {
const Sizable = {
string: { unit: "caracteres" },
file: { unit: "bytes" },
array: { unit: "elementos" },
set: { unit: "elementos" },
map: { unit: "entradas" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "a entrada",
email: "o endereço de e-mail",
url: "o URL",
emoji: "o emoji",
uuid: "o UUID",
uuidv4: "o UUIDv4",
uuidv6: "o UUIDv6",
nanoid: "o nanoid",
guid: "o GUID",
cuid: "o cuid",
cuid2: "o cuid2",
ulid: "o ULID",
xid: "o XID",
ksuid: "o KSUID",
datetime: "a data e hora ISO",
date: "a data ISO",
time: "a hora ISO",
duration: "a duração ISO",
ipv4: "o endereço IPv4",
ipv6: "o endereço IPv6",
mac: "o endereço MAC",
cidrv4: "a faixa de endereços IPv4",
cidrv6: "a faixa de endereços IPv6",
base64: "o texto codificado em base64",
base64url: "o texto codificado em base64url",
json_string: "o texto JSON",
e164: "o número E.164",
credit_card: "o número de cartão de crédito",
currency_code: "o código de moeda",
iban: "o IBAN",
jwt: "o JWT",
template_literal: "a entrada",
};
const Gender = {
masculine: { definite: "o", indefinite: "um" },
feminine: { definite: "a", indefinite: "uma" },
};
const TypeDictionary = {
string: { name: "texto", articles: Gender.masculine },
number: { name: "número", articles: Gender.masculine },
int: { name: "número inteiro", articles: Gender.masculine },
boolean: { name: "valor booleano", articles: Gender.masculine },
bigint: { name: "número bigint", articles: Gender.masculine },
symbol: { name: "símbolo", articles: Gender.masculine },
undefined: { name: 'valor "undefined"', articles: Gender.masculine },
null: { name: 'valor "nulo"', articles: Gender.masculine },
never: { name: 'valor "never"', articles: Gender.masculine },
void: { name: 'valor "void"', articles: Gender.masculine },
date: { name: "data", articles: Gender.feminine },
array: { name: "vetor", articles: Gender.masculine },
object: { name: "objeto", articles: Gender.masculine },
tuple: { name: "tupla", articles: Gender.feminine },
record: { name: "registro", articles: Gender.masculine },
map: { name: "mapa", articles: Gender.masculine },
set: { name: "conjunto", articles: Gender.masculine },
file: { name: "arquivo", articles: Gender.masculine },
nonoptional: { name: "valor não opcional", articles: Gender.masculine },
nan: { name: 'valor "NaN"', articles: Gender.masculine }, // Compatibility: "nan" -> "NaN" for display
function: { name: "função", articles: Gender.feminine },
};
function translateOriginWithArticle(type, articleType) {
const translatedValue = TypeDictionary[type] ?? { name: `valor "${type}"`, articles: Gender.masculine };
return `${translatedValue.articles[articleType]} ${translatedValue.name}`;
}
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = translateOriginWithArticle(issue.expected, "indefinite");
const receivedType = util.parsedType(issue.input);
const received = translateOriginWithArticle(receivedType, "indefinite");
return `Entrada inválida: esperava ${expected}, recebeu ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `Entrada inválida: esperava ${util.stringifyPrimitive(issue.values[0])}`;
return `Opção inválida: esperava uma das seguintes opções: ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Grande demais: esperava que ${translateOriginWithArticle(issue.origin, "definite")} tivesse ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "elementos"}`;
return `Grande demais: esperava que ${translateOriginWithArticle(issue.origin, "definite")} fosse ${adj} ${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Pequeno demais: esperava que ${translateOriginWithArticle(issue.origin, "definite")} tivesse ${adj} ${issue.minimum.toString()} ${sizing.unit ?? "elementos"}`;
}
return `Pequeno demais: esperava que ${translateOriginWithArticle(issue.origin, "definite")} fosse ${adj} ${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with") {
return `Texto inválido: deve começar com "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Texto inválido: deve terminar com "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Texto inválido: deve incluir "${_issue.includes}"`;
if (_issue.format === "regex")
return `Texto inválido: deve corresponder ao padrão ${_issue.pattern}`;
return `Formato d${FormatDictionary[_issue.format] ?? issue.format} inválido`;
}
case "not_multiple_of":
return `Número inválido: deve ser múltiplo de ${issue.divisor}`;
case "unrecognized_keys": {
const plural = issue.keys.length > 1 ? "s" : "";
return `Chave${plural} inválida${plural}: ${util.joinValues(issue.keys, ", ")}`;
}
case "invalid_key":
return `Entrada inválida n${translateOriginWithArticle(issue.origin, "definite")}`;
case "invalid_union":
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
return `Valor de discriminação inválido. Esperava ${opts}`;
}
return "Entrada inválida";
case "invalid_element":
return `Entrada inválida n${translateOriginWithArticle(issue.origin, "definite")}`;
default:
return `Entrada inválida`;
}
};
};
export default function () {
return {
localeError: error(),
};
}
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"_E"},B:{"1":"_J"},C:{"1":"_1D","2":"_RM"},D:{"1":"_Q"},E:{"1":"_R"},F:{"1":"_a","2":"_T"},G:{"1":"_M"},H:{"2":"1D"},I:{"1":"_P"},J:{"1":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"1":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"ME","2":"LE"}},B:7,C:"background-position-x & background-position-y",D:true};
@@ -0,0 +1,81 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _identifier = require('../parser/util/identifier');
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar
// Hard-code a list of reserved words rather than trying to use keywords or contextual keywords
// from the parser, since currently there are various exceptions, like `package` being reserved
// but unused and various contextual keywords being reserved. Note that we assume that all code
// compiled by Sucrase is in a module, so strict mode words and await are all considered reserved
// here.
const RESERVED_WORDS = new Set([
// Reserved keywords as of ECMAScript 2015
"break",
"case",
"catch",
"class",
"const",
"continue",
"debugger",
"default",
"delete",
"do",
"else",
"export",
"extends",
"finally",
"for",
"function",
"if",
"import",
"in",
"instanceof",
"new",
"return",
"super",
"switch",
"this",
"throw",
"try",
"typeof",
"var",
"void",
"while",
"with",
"yield",
// Future reserved keywords
"enum",
"implements",
"interface",
"let",
"package",
"private",
"protected",
"public",
"static",
"await",
// Literals that cannot be used as identifiers
"false",
"null",
"true",
]);
/**
* Determine if the given name is a legal variable name.
*
* This is needed when transforming TypeScript enums; if an enum key is a valid
* variable name, it might be referenced later in the enum, so we need to
* declare a variable.
*/
function isIdentifier(name) {
if (name.length === 0) {
return false;
}
if (!_identifier.IS_IDENTIFIER_START[name.charCodeAt(0)]) {
return false;
}
for (let i = 1; i < name.length; i++) {
if (!_identifier.IS_IDENTIFIER_CHAR[name.charCodeAt(i)]) {
return false;
}
}
return !RESERVED_WORDS.has(name);
} exports.default = isIdentifier;
@@ -0,0 +1,24 @@
'use strict'
/* eslint-env mocha */
/* eslint no-proto: 0 */
var assert = require('assert')
var setPrototypeOf = require('..')
describe('setProtoOf(obj, proto)', function () {
it('should merge objects', function () {
var obj = { a: 1, b: 2 }
var proto = { b: 3, c: 4 }
var mergeObj = setPrototypeOf(obj, proto)
if (Object.getPrototypeOf) {
assert.strictEqual(Object.getPrototypeOf(obj), proto)
} else if ({ __proto__: [] } instanceof Array) {
assert.strictEqual(obj.__proto__, proto)
} else {
assert.strictEqual(obj.a, 1)
assert.strictEqual(obj.b, 2)
assert.strictEqual(obj.c, 4)
}
assert.strictEqual(mergeObj, obj)
})
})
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isStartOfExpressionStatement = isStartOfExpressionStatement;
const utils_1 = require("@typescript-eslint/utils");
// The following is copied from `eslint`'s source code.
// https://github.com/eslint/eslint/blob/3a4eaf921543b1cd5d1df4ea9dec02fab396af2a/lib/rules/utils/ast-utils.js#L1026-L1041
// Could be export { isStartOfExpressionStatement } from 'eslint/lib/rules/utils/ast-utils'
/**
* Tests if a node appears at the beginning of an ancestor ExpressionStatement node.
* @param node The node to check.
* @returns Whether the node appears at the beginning of an ancestor ExpressionStatement node.
*/
function isStartOfExpressionStatement(node) {
const start = node.range[0];
let ancestor = node;
while ((ancestor = ancestor.parent) && ancestor.range[0] === start) {
if (ancestor.type === utils_1.AST_NODE_TYPES.ExpressionStatement) {
return true;
}
}
return false;
}
@@ -0,0 +1,13 @@
import MagicString from 'magic-string';
interface AutomockOptions {
/**
* @default "__vitest_mocker__"
*/
globalThisAccessor?: string;
id?: string;
}
declare function automockModule(code: string, mockType: "automock" | "autospy", parse: (code: string) => any, options?: AutomockOptions): MagicString;
export { automockModule };
export type { AutomockOptions };
@@ -0,0 +1,33 @@
let pendingRules = {};
let style = null;
const css = {
set: (selector, values) => {
pendingRules[selector] = values;
},
commit: () => {
if (!style) {
style = document.createElement("style");
style.id = "motion-view";
}
let cssText = "";
for (const selector in pendingRules) {
const rule = pendingRules[selector];
cssText += `${selector} {\n`;
for (const [property, value] of Object.entries(rule)) {
cssText += ` ${property}: ${value};\n`;
}
cssText += "}\n";
}
style.textContent = cssText;
document.head.appendChild(style);
pendingRules = {};
},
remove: () => {
if (style && style.parentElement) {
style.parentElement.removeChild(style);
}
},
};
export { css };
//# sourceMappingURL=css.mjs.map
@@ -0,0 +1,768 @@
/**
* The `node:zlib` module provides compression functionality implemented using
* Gzip, Deflate/Inflate, and Brotli.
*
* To access it:
*
* ```js
* import zlib from 'node:zlib';
* ```
*
* Compression and decompression are built around the Node.js
* [Streams API](https://nodejs.org/docs/latest-v24.x/api/stream.html).
*
* Compressing or decompressing a stream (such as a file) can be accomplished by
* piping the source stream through a `zlib` `Transform` stream into a destination
* stream:
*
* ```js
* import { createGzip } from 'node:zlib';
* import { pipeline } from 'node:stream';
* import {
* createReadStream,
* createWriteStream,
* } from 'node:fs';
*
* const gzip = createGzip();
* const source = createReadStream('input.txt');
* const destination = createWriteStream('input.txt.gz');
*
* pipeline(source, gzip, destination, (err) => {
* if (err) {
* console.error('An error occurred:', err);
* process.exitCode = 1;
* }
* });
*
* // Or, Promisified
*
* import { promisify } from 'node:util';
* const pipe = promisify(pipeline);
*
* async function do_gzip(input, output) {
* const gzip = createGzip();
* const source = createReadStream(input);
* const destination = createWriteStream(output);
* await pipe(source, gzip, destination);
* }
*
* do_gzip('input.txt', 'input.txt.gz')
* .catch((err) => {
* console.error('An error occurred:', err);
* process.exitCode = 1;
* });
* ```
*
* It is also possible to compress or decompress data in a single step:
*
* ```js
* import { deflate, unzip } from 'node:zlib';
*
* const input = '.................................';
* deflate(input, (err, buffer) => {
* if (err) {
* console.error('An error occurred:', err);
* process.exitCode = 1;
* }
* console.log(buffer.toString('base64'));
* });
*
* const buffer = Buffer.from('eJzT0yMAAGTvBe8=', 'base64');
* unzip(buffer, (err, buffer) => {
* if (err) {
* console.error('An error occurred:', err);
* process.exitCode = 1;
* }
* console.log(buffer.toString());
* });
*
* // Or, Promisified
*
* import { promisify } from 'node:util';
* const do_unzip = promisify(unzip);
*
* do_unzip(buffer)
* .then((buf) => console.log(buf.toString()))
* .catch((err) => {
* console.error('An error occurred:', err);
* process.exitCode = 1;
* });
* ```
* @since v0.5.8
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/zlib.js)
*/
declare module "zlib" {
import { NonSharedBuffer } from "node:buffer";
import * as stream from "node:stream";
interface ZlibOptions {
/**
* @default constants.Z_NO_FLUSH
*/
flush?: number | undefined;
/**
* @default constants.Z_FINISH
*/
finishFlush?: number | undefined;
/**
* @default 16*1024
*/
chunkSize?: number | undefined;
windowBits?: number | undefined;
/** compression only */
level?: number | undefined;
/** compression only */
memLevel?: number | undefined;
/** compression only */
strategy?: number | undefined;
/** deflate/inflate only, empty dictionary by default */
dictionary?: NodeJS.ArrayBufferView | ArrayBuffer | undefined;
/**
* If `true`, returns an object with `buffer` and `engine`.
*/
info?: boolean | undefined;
/**
* Limits output size when using convenience methods.
* @default buffer.kMaxLength
*/
maxOutputLength?: number | undefined;
/**
* If `true`, decompression fails when
* trailing input is detected after the end of the compressed stream. This
* includes unreadable bytes and, when decompressing gzip, additional gzip
* members following the first member. **Default:** `false`
*/
rejectGarbageAfterEnd?: boolean | undefined;
}
interface BrotliOptions {
/**
* @default constants.BROTLI_OPERATION_PROCESS
*/
flush?: number | undefined;
/**
* @default constants.BROTLI_OPERATION_FINISH
*/
finishFlush?: number | undefined;
/**
* @default 16*1024
*/
chunkSize?: number | undefined;
params?:
| {
/**
* Each key is a `constants.BROTLI_*` constant.
*/
[key: number]: boolean | number;
}
| undefined;
/**
* Limits output size when using [convenience methods](https://nodejs.org/docs/latest-v24.x/api/zlib.html#convenience-methods).
* @default buffer.kMaxLength
*/
maxOutputLength?: number | undefined;
/**
* If `true`, returns an object with `buffer` and `engine`.
*/
info?: boolean | undefined;
/**
* If `true`, decompression fails when
* input remains after the first complete compressed stream. **Default:** `false`
*/
rejectGarbageAfterEnd?: boolean | undefined;
}
interface ZstdOptions {
/**
* @default constants.ZSTD_e_continue
*/
flush?: number | undefined;
/**
* @default constants.ZSTD_e_end
*/
finishFlush?: number | undefined;
/**
* @default 16 * 1024
*/
chunkSize?: number | undefined;
/**
* Key-value object containing indexed
* [Zstd parameters](https://nodejs.org/docs/latest-v24.x/api/zlib.html#zstd-constants).
*/
params?: { [key: number]: number | boolean } | undefined;
/**
* Expected total size of the uncompressed input. Must match the input size
* when compression finishes. Only applicable to Zstd compressors.
* @since v22.15.0
*/
pledgedSrcSize?: number | undefined;
/**
* Limits output size when using
* [convenience methods](https://nodejs.org/docs/latest-v24.x/api/zlib.html#convenience-methods).
* @default buffer.kMaxLength
*/
maxOutputLength?: number | undefined;
/**
* If `true`, returns an object with `buffer` and `engine`.
*/
info?: boolean | undefined;
/**
* Optional dictionary used to improve compression efficiency when compressing or decompressing data that
* shares common patterns with the dictionary.
* @since v24.6.0
*/
dictionary?: NodeJS.ArrayBufferView | undefined;
/**
* If `true`, decompression fails when
* input remains after the first complete compressed stream. **Default:** `false`
*/
rejectGarbageAfterEnd?: boolean | undefined;
}
interface Zlib {
readonly bytesWritten: number;
shell?: boolean | string | undefined;
close(callback?: () => void): void;
flush(kind?: number, callback?: () => void): void;
flush(callback?: () => void): void;
}
interface ZlibParams {
params(level: number, strategy: number, callback: () => void): void;
}
interface ZlibReset {
reset(): void;
}
/**
* @since v10.16.0
*/
class BrotliCompress extends stream.Transform {
constructor(options?: BrotliOptions);
}
interface BrotliCompress extends stream.Transform, Zlib {}
/**
* @since v10.16.0
*/
class BrotliDecompress extends stream.Transform {
constructor(options?: BrotliOptions);
}
interface BrotliDecompress extends stream.Transform, Zlib {}
/**
* @since v0.5.8
*/
class Gzip extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface Gzip extends stream.Transform, Zlib {}
/**
* @since v0.5.8
*/
class Gunzip extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface Gunzip extends stream.Transform, Zlib {}
/**
* @since v0.5.8
*/
class Deflate extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
/**
* @since v0.5.8
*/
class Inflate extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface Inflate extends stream.Transform, Zlib, ZlibReset {}
/**
* @since v0.5.8
*/
class DeflateRaw extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
/**
* @since v0.5.8
*/
class InflateRaw extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface InflateRaw extends stream.Transform, Zlib, ZlibReset {}
/**
* @since v0.5.8
*/
class Unzip extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface Unzip extends stream.Transform, Zlib {}
/**
* @since v22.15.0
* @experimental
*/
class ZstdCompress extends stream.Transform {
constructor(options?: ZstdOptions);
}
interface ZstdCompress extends stream.Transform, Zlib {}
/**
* @since v22.15.0
* @experimental
*/
class ZstdDecompress extends stream.Transform {
constructor(options?: ZstdOptions);
}
interface ZstdDecompress extends stream.Transform, Zlib {}
/**
* Computes a 32-bit [Cyclic Redundancy Check](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) checksum of `data`.
* If `value` is specified, it is used as the starting value of the checksum, otherwise, 0 is used as the starting value.
* @param data When `data` is a string, it will be encoded as UTF-8 before being used for computation.
* @param value An optional starting value. It must be a 32-bit unsigned integer. @default 0
* @returns A 32-bit unsigned integer containing the checksum.
* @since v22.2.0
*/
function crc32(data: string | NodeJS.ArrayBufferView, value?: number): number;
/**
* Creates and returns a new `BrotliCompress` object.
* @since v11.7.0, v10.16.0
*/
function createBrotliCompress(options?: BrotliOptions): BrotliCompress;
/**
* Creates and returns a new `BrotliDecompress` object.
* @since v11.7.0, v10.16.0
*/
function createBrotliDecompress(options?: BrotliOptions): BrotliDecompress;
/**
* Creates and returns a new `Gzip` object.
* See `example`.
* @since v0.5.8
*/
function createGzip(options?: ZlibOptions): Gzip;
/**
* Creates and returns a new `Gunzip` object.
* @since v0.5.8
*/
function createGunzip(options?: ZlibOptions): Gunzip;
/**
* Creates and returns a new `Deflate` object.
* @since v0.5.8
*/
function createDeflate(options?: ZlibOptions): Deflate;
/**
* Creates and returns a new `Inflate` object.
* @since v0.5.8
*/
function createInflate(options?: ZlibOptions): Inflate;
/**
* Creates and returns a new `DeflateRaw` object.
*
* An upgrade of zlib from 1.2.8 to 1.2.11 changed behavior when `windowBits` is set to 8 for raw deflate streams. zlib would automatically set `windowBits` to 9 if was initially set to 8. Newer
* versions of zlib will throw an exception,
* so Node.js restored the original behavior of upgrading a value of 8 to 9,
* since passing `windowBits = 9` to zlib actually results in a compressed stream
* that effectively uses an 8-bit window only.
* @since v0.5.8
*/
function createDeflateRaw(options?: ZlibOptions): DeflateRaw;
/**
* Creates and returns a new `InflateRaw` object.
* @since v0.5.8
*/
function createInflateRaw(options?: ZlibOptions): InflateRaw;
/**
* Creates and returns a new `Unzip` object.
* @since v0.5.8
*/
function createUnzip(options?: ZlibOptions): Unzip;
/**
* Creates and returns a new `ZstdCompress` object.
* @since v22.15.0
*/
function createZstdCompress(options?: ZstdOptions): ZstdCompress;
/**
* Creates and returns a new `ZstdDecompress` object.
* @since v22.15.0
*/
function createZstdDecompress(options?: ZstdOptions): ZstdDecompress;
type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView;
type CompressCallback = (error: Error | null, result: NonSharedBuffer) => void;
/**
* @since v11.7.0, v10.16.0
*/
function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
function brotliCompress(buf: InputType, callback: CompressCallback): void;
namespace brotliCompress {
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
}
/**
* Compress a chunk of data with `BrotliCompress`.
* @since v11.7.0, v10.16.0
*/
function brotliCompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
/**
* @since v11.7.0, v10.16.0
*/
function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
function brotliDecompress(buf: InputType, callback: CompressCallback): void;
namespace brotliDecompress {
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
}
/**
* Decompress a chunk of data with `BrotliDecompress`.
* @since v11.7.0, v10.16.0
*/
function brotliDecompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
/**
* @since v0.6.0
*/
function deflate(buf: InputType, callback: CompressCallback): void;
function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace deflate {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
}
/**
* Compress a chunk of data with `Deflate`.
* @since v0.11.12
*/
function deflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
/**
* @since v0.6.0
*/
function deflateRaw(buf: InputType, callback: CompressCallback): void;
function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace deflateRaw {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
}
/**
* Compress a chunk of data with `DeflateRaw`.
* @since v0.11.12
*/
function deflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
/**
* @since v0.6.0
*/
function gzip(buf: InputType, callback: CompressCallback): void;
function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace gzip {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
}
/**
* Compress a chunk of data with `Gzip`.
* @since v0.11.12
*/
function gzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
/**
* @since v0.6.0
*/
function gunzip(buf: InputType, callback: CompressCallback): void;
function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace gunzip {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
}
/**
* Decompress a chunk of data with `Gunzip`.
* @since v0.11.12
*/
function gunzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
/**
* @since v0.6.0
*/
function inflate(buf: InputType, callback: CompressCallback): void;
function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace inflate {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
}
/**
* Decompress a chunk of data with `Inflate`.
* @since v0.11.12
*/
function inflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
/**
* @since v0.6.0
*/
function inflateRaw(buf: InputType, callback: CompressCallback): void;
function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace inflateRaw {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
}
/**
* Decompress a chunk of data with `InflateRaw`.
* @since v0.11.12
*/
function inflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
/**
* @since v0.6.0
*/
function unzip(buf: InputType, callback: CompressCallback): void;
function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace unzip {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
}
/**
* Decompress a chunk of data with `Unzip`.
* @since v0.11.12
*/
function unzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
/**
* @since v22.15.0
* @experimental
*/
function zstdCompress(buf: InputType, callback: CompressCallback): void;
function zstdCompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
namespace zstdCompress {
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
}
/**
* Compress a chunk of data with `ZstdCompress`.
* @since v22.15.0
* @experimental
*/
function zstdCompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
/**
* @since v22.15.0
* @experimental
*/
function zstdDecompress(buf: InputType, callback: CompressCallback): void;
function zstdDecompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
namespace zstdDecompress {
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
}
/**
* Decompress a chunk of data with `ZstdDecompress`.
* @since v22.15.0
* @experimental
*/
function zstdDecompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
namespace constants {
const BROTLI_DECODE: number;
const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number;
const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: number;
const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: number;
const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: number;
const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: number;
const BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: number;
const BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: number;
const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: number;
const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: number;
const BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: number;
const BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: number;
const BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: number;
const BROTLI_DECODER_ERROR_FORMAT_DISTANCE: number;
const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: number;
const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: number;
const BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: number;
const BROTLI_DECODER_ERROR_FORMAT_PADDING_1: number;
const BROTLI_DECODER_ERROR_FORMAT_PADDING_2: number;
const BROTLI_DECODER_ERROR_FORMAT_RESERVED: number;
const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: number;
const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: number;
const BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: number;
const BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: number;
const BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: number;
const BROTLI_DECODER_ERROR_UNREACHABLE: number;
const BROTLI_DECODER_NEEDS_MORE_INPUT: number;
const BROTLI_DECODER_NEEDS_MORE_OUTPUT: number;
const BROTLI_DECODER_NO_ERROR: number;
const BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: number;
const BROTLI_DECODER_PARAM_LARGE_WINDOW: number;
const BROTLI_DECODER_RESULT_ERROR: number;
const BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: number;
const BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: number;
const BROTLI_DECODER_RESULT_SUCCESS: number;
const BROTLI_DECODER_SUCCESS: number;
const BROTLI_DEFAULT_MODE: number;
const BROTLI_DEFAULT_QUALITY: number;
const BROTLI_DEFAULT_WINDOW: number;
const BROTLI_ENCODE: number;
const BROTLI_LARGE_MAX_WINDOW_BITS: number;
const BROTLI_MAX_INPUT_BLOCK_BITS: number;
const BROTLI_MAX_QUALITY: number;
const BROTLI_MAX_WINDOW_BITS: number;
const BROTLI_MIN_INPUT_BLOCK_BITS: number;
const BROTLI_MIN_QUALITY: number;
const BROTLI_MIN_WINDOW_BITS: number;
const BROTLI_MODE_FONT: number;
const BROTLI_MODE_GENERIC: number;
const BROTLI_MODE_TEXT: number;
const BROTLI_OPERATION_EMIT_METADATA: number;
const BROTLI_OPERATION_FINISH: number;
const BROTLI_OPERATION_FLUSH: number;
const BROTLI_OPERATION_PROCESS: number;
const BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: number;
const BROTLI_PARAM_LARGE_WINDOW: number;
const BROTLI_PARAM_LGBLOCK: number;
const BROTLI_PARAM_LGWIN: number;
const BROTLI_PARAM_MODE: number;
const BROTLI_PARAM_NDIRECT: number;
const BROTLI_PARAM_NPOSTFIX: number;
const BROTLI_PARAM_QUALITY: number;
const BROTLI_PARAM_SIZE_HINT: number;
const DEFLATE: number;
const DEFLATERAW: number;
const GUNZIP: number;
const GZIP: number;
const INFLATE: number;
const INFLATERAW: number;
const UNZIP: number;
const ZLIB_VERNUM: number;
const ZSTD_CLEVEL_DEFAULT: number;
const ZSTD_COMPRESS: number;
const ZSTD_DECOMPRESS: number;
const ZSTD_btlazy2: number;
const ZSTD_btopt: number;
const ZSTD_btultra: number;
const ZSTD_btultra2: number;
const ZSTD_c_chainLog: number;
const ZSTD_c_checksumFlag: number;
const ZSTD_c_compressionLevel: number;
const ZSTD_c_contentSizeFlag: number;
const ZSTD_c_dictIDFlag: number;
const ZSTD_c_enableLongDistanceMatching: number;
const ZSTD_c_hashLog: number;
const ZSTD_c_jobSize: number;
const ZSTD_c_ldmBucketSizeLog: number;
const ZSTD_c_ldmHashLog: number;
const ZSTD_c_ldmHashRateLog: number;
const ZSTD_c_ldmMinMatch: number;
const ZSTD_c_minMatch: number;
const ZSTD_c_nbWorkers: number;
const ZSTD_c_overlapLog: number;
const ZSTD_c_searchLog: number;
const ZSTD_c_strategy: number;
const ZSTD_c_targetLength: number;
const ZSTD_c_windowLog: number;
const ZSTD_d_windowLogMax: number;
const ZSTD_dfast: number;
const ZSTD_e_continue: number;
const ZSTD_e_end: number;
const ZSTD_e_flush: number;
const ZSTD_error_GENERIC: number;
const ZSTD_error_checksum_wrong: number;
const ZSTD_error_corruption_detected: number;
const ZSTD_error_dictionaryCreation_failed: number;
const ZSTD_error_dictionary_corrupted: number;
const ZSTD_error_dictionary_wrong: number;
const ZSTD_error_dstBuffer_null: number;
const ZSTD_error_dstSize_tooSmall: number;
const ZSTD_error_frameParameter_unsupported: number;
const ZSTD_error_frameParameter_windowTooLarge: number;
const ZSTD_error_init_missing: number;
const ZSTD_error_literals_headerWrong: number;
const ZSTD_error_maxSymbolValue_tooLarge: number;
const ZSTD_error_maxSymbolValue_tooSmall: number;
const ZSTD_error_memory_allocation: number;
const ZSTD_error_noForwardProgress_destFull: number;
const ZSTD_error_noForwardProgress_inputEmpty: number;
const ZSTD_error_no_error: number;
const ZSTD_error_parameter_combination_unsupported: number;
const ZSTD_error_parameter_outOfBound: number;
const ZSTD_error_parameter_unsupported: number;
const ZSTD_error_prefix_unknown: number;
const ZSTD_error_srcSize_wrong: number;
const ZSTD_error_stabilityCondition_notRespected: number;
const ZSTD_error_stage_wrong: number;
const ZSTD_error_tableLog_tooLarge: number;
const ZSTD_error_version_unsupported: number;
const ZSTD_error_workSpace_tooSmall: number;
const ZSTD_fast: number;
const ZSTD_greedy: number;
const ZSTD_lazy: number;
const ZSTD_lazy2: number;
const Z_BEST_COMPRESSION: number;
const Z_BEST_SPEED: number;
const Z_BLOCK: number;
const Z_BUF_ERROR: number;
const Z_DATA_ERROR: number;
const Z_DEFAULT_CHUNK: number;
const Z_DEFAULT_COMPRESSION: number;
const Z_DEFAULT_LEVEL: number;
const Z_DEFAULT_MEMLEVEL: number;
const Z_DEFAULT_STRATEGY: number;
const Z_DEFAULT_WINDOWBITS: number;
const Z_ERRNO: number;
const Z_FILTERED: number;
const Z_FINISH: number;
const Z_FIXED: number;
const Z_FULL_FLUSH: number;
const Z_HUFFMAN_ONLY: number;
const Z_MAX_CHUNK: number;
const Z_MAX_LEVEL: number;
const Z_MAX_MEMLEVEL: number;
const Z_MAX_WINDOWBITS: number;
const Z_MEM_ERROR: number;
const Z_MIN_CHUNK: number;
const Z_MIN_LEVEL: number;
const Z_MIN_MEMLEVEL: number;
const Z_MIN_WINDOWBITS: number;
const Z_NEED_DICT: number;
const Z_NO_COMPRESSION: number;
const Z_NO_FLUSH: number;
const Z_OK: number;
const Z_PARTIAL_FLUSH: number;
const Z_RLE: number;
const Z_STREAM_END: number;
const Z_STREAM_ERROR: number;
const Z_SYNC_FLUSH: number;
const Z_VERSION_ERROR: number;
}
// Allowed flush values.
/** @deprecated Use `constants.Z_NO_FLUSH` */
const Z_NO_FLUSH: number;
/** @deprecated Use `constants.Z_PARTIAL_FLUSH` */
const Z_PARTIAL_FLUSH: number;
/** @deprecated Use `constants.Z_SYNC_FLUSH` */
const Z_SYNC_FLUSH: number;
/** @deprecated Use `constants.Z_FULL_FLUSH` */
const Z_FULL_FLUSH: number;
/** @deprecated Use `constants.Z_FINISH` */
const Z_FINISH: number;
/** @deprecated Use `constants.Z_BLOCK` */
const Z_BLOCK: number;
// Return codes for the compression/decompression functions.
// Negative values are errors, positive values are used for special but normal events.
/** @deprecated Use `constants.Z_OK` */
const Z_OK: number;
/** @deprecated Use `constants.Z_STREAM_END` */
const Z_STREAM_END: number;
/** @deprecated Use `constants.Z_NEED_DICT` */
const Z_NEED_DICT: number;
/** @deprecated Use `constants.Z_ERRNO` */
const Z_ERRNO: number;
/** @deprecated Use `constants.Z_STREAM_ERROR` */
const Z_STREAM_ERROR: number;
/** @deprecated Use `constants.Z_DATA_ERROR` */
const Z_DATA_ERROR: number;
/** @deprecated Use `constants.Z_MEM_ERROR` */
const Z_MEM_ERROR: number;
/** @deprecated Use `constants.Z_BUF_ERROR` */
const Z_BUF_ERROR: number;
/** @deprecated Use `constants.Z_VERSION_ERROR` */
const Z_VERSION_ERROR: number;
// Compression levels.
/** @deprecated Use `constants.Z_NO_COMPRESSION` */
const Z_NO_COMPRESSION: number;
/** @deprecated Use `constants.Z_BEST_SPEED` */
const Z_BEST_SPEED: number;
/** @deprecated Use `constants.Z_BEST_COMPRESSION` */
const Z_BEST_COMPRESSION: number;
/** @deprecated Use `constants.Z_DEFAULT_COMPRESSION` */
const Z_DEFAULT_COMPRESSION: number;
// Compression strategy.
/** @deprecated Use `constants.Z_FILTERED` */
const Z_FILTERED: number;
/** @deprecated Use `constants.Z_HUFFMAN_ONLY` */
const Z_HUFFMAN_ONLY: number;
/** @deprecated Use `constants.Z_RLE` */
const Z_RLE: number;
/** @deprecated Use `constants.Z_FIXED` */
const Z_FIXED: number;
/** @deprecated Use `constants.Z_DEFAULT_STRATEGY` */
const Z_DEFAULT_STRATEGY: number;
/** @deprecated */
const Z_BINARY: number;
/** @deprecated */
const Z_TEXT: number;
/** @deprecated */
const Z_ASCII: number;
/** @deprecated */
const Z_UNKNOWN: number;
/** @deprecated */
const Z_DEFLATED: number;
}
declare module "node:zlib" {
export * from "zlib";
}
@@ -0,0 +1 @@
{"version":3,"names":["_index","require","_removeTypeDuplicates","createFlowUnionType","types","flattened","removeTypeDuplicates","length","unionTypeAnnotation"],"sources":["../../../src/builders/flow/createFlowUnionType.ts"],"sourcesContent":["import { unionTypeAnnotation } from \"../generated/index.ts\";\nimport removeTypeDuplicates from \"../../modifications/flow/removeTypeDuplicates.ts\";\nimport type * as t from \"../../index.ts\";\n\n/**\n * Takes an array of `types` and flattens them, removing duplicates and\n * returns a `UnionTypeAnnotation` node containing them.\n */\nexport default function createFlowUnionType<T extends t.FlowType>(\n types: [T] | T[],\n): T | t.UnionTypeAnnotation {\n const flattened = removeTypeDuplicates(types);\n\n if (flattened.length === 1) {\n return flattened[0] as T;\n } else {\n return unionTypeAnnotation(flattened);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAOe,SAASE,mBAAmBA,CACzCC,KAAgB,EACW;EAC3B,MAAMC,SAAS,GAAG,IAAAC,6BAAoB,EAACF,KAAK,CAAC;EAE7C,IAAIC,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;IAC1B,OAAOF,SAAS,CAAC,CAAC,CAAC;EACrB,CAAC,MAAM;IACL,OAAO,IAAAG,0BAAmB,EAACH,SAAS,CAAC;EACvC;AACF","ignoreList":[]}
@@ -0,0 +1,15 @@
function compareByTime(a, b) {
if (a.at === b.at) {
if (a.value === null)
return 1;
if (b.value === null)
return -1;
return 0;
}
else {
return a.at - b.at;
}
}
export { compareByTime };
//# sourceMappingURL=sort.mjs.map
@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sidecar = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var hook_1 = require("./hook");
// eslint-disable-next-line @typescript-eslint/ban-types
function sidecar(importer, errorComponent) {
var ErrorCase = function () { return errorComponent; };
return function Sidecar(props) {
var _a = (0, hook_1.useSidecar)(importer, props.sideCar), Car = _a[0], error = _a[1];
if (error && errorComponent) {
return ErrorCase;
}
// @ts-expect-error type shenanigans
return Car ? React.createElement(Car, tslib_1.__assign({}, props)) : null;
};
}
exports.sidecar = sidecar;
@@ -0,0 +1,202 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
Action: () => Action,
AlertDialog: () => AlertDialog,
AlertDialogAction: () => AlertDialogAction,
AlertDialogCancel: () => AlertDialogCancel,
AlertDialogContent: () => AlertDialogContent,
AlertDialogDescription: () => AlertDialogDescription,
AlertDialogOverlay: () => AlertDialogOverlay,
AlertDialogPortal: () => AlertDialogPortal,
AlertDialogTitle: () => AlertDialogTitle,
AlertDialogTrigger: () => AlertDialogTrigger,
Cancel: () => Cancel,
Content: () => Content2,
Description: () => Description2,
Overlay: () => Overlay2,
Portal: () => Portal2,
Root: () => Root2,
Title: () => Title2,
Trigger: () => Trigger2,
createAlertDialogScope: () => createAlertDialogScope
});
module.exports = __toCommonJS(index_exports);
// src/alert-dialog.tsx
var React = __toESM(require("react"));
var import_react_context = require("@radix-ui/react-context");
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
var import_react_dialog = require("@radix-ui/react-dialog");
var import_primitive = require("@radix-ui/primitive");
var import_react_slot = require("@radix-ui/react-slot");
var import_jsx_runtime = require("react/jsx-runtime");
var ROOT_NAME = "AlertDialog";
var [createAlertDialogContext, createAlertDialogScope] = (0, import_react_context.createContextScope)(ROOT_NAME, [
import_react_dialog.createDialogScope
]);
var useDialogScope = (0, import_react_dialog.createDialogScope)();
var AlertDialog = (props) => {
const { __scopeAlertDialog, ...alertDialogProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Root, { ...dialogScope, ...alertDialogProps, modal: true });
};
AlertDialog.displayName = ROOT_NAME;
var TRIGGER_NAME = "AlertDialogTrigger";
var AlertDialogTrigger = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...triggerProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Trigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });
}
);
AlertDialogTrigger.displayName = TRIGGER_NAME;
var PORTAL_NAME = "AlertDialogPortal";
var AlertDialogPortal = (props) => {
const { __scopeAlertDialog, ...portalProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Portal, { ...dialogScope, ...portalProps });
};
AlertDialogPortal.displayName = PORTAL_NAME;
var OVERLAY_NAME = "AlertDialogOverlay";
var AlertDialogOverlay = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...overlayProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Overlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
}
);
AlertDialogOverlay.displayName = OVERLAY_NAME;
var CONTENT_NAME = "AlertDialogContent";
var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
var Slottable = (0, import_react_slot.createSlottable)("AlertDialogContent");
var AlertDialogContent = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, children, ...contentProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
const contentRef = React.useRef(null);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, contentRef);
const cancelRef = React.useRef(null);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
DialogPrimitive.WarningProvider,
{
contentName: CONTENT_NAME,
titleName: TITLE_NAME,
docsSlug: "alert-dialog",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
DialogPrimitive.Content,
{
role: "alertdialog",
...dialogScope,
...contentProps,
ref: composedRefs,
onOpenAutoFocus: (0, import_primitive.composeEventHandlers)(contentProps.onOpenAutoFocus, (event) => {
event.preventDefault();
cancelRef.current?.focus({ preventScroll: true });
}),
onPointerDownOutside: (event) => event.preventDefault(),
onInteractOutside: (event) => event.preventDefault(),
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slottable, { children }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionWarning, { contentRef })
]
}
) })
}
);
}
);
AlertDialogContent.displayName = CONTENT_NAME;
var TITLE_NAME = "AlertDialogTitle";
var AlertDialogTitle = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...titleProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Title, { ...dialogScope, ...titleProps, ref: forwardedRef });
}
);
AlertDialogTitle.displayName = TITLE_NAME;
var DESCRIPTION_NAME = "AlertDialogDescription";
var AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
const { __scopeAlertDialog, ...descriptionProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Description, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
});
AlertDialogDescription.displayName = DESCRIPTION_NAME;
var ACTION_NAME = "AlertDialogAction";
var AlertDialogAction = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...actionProps } = props;
const dialogScope = useDialogScope(__scopeAlertDialog);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Close, { ...dialogScope, ...actionProps, ref: forwardedRef });
}
);
AlertDialogAction.displayName = ACTION_NAME;
var CANCEL_NAME = "AlertDialogCancel";
var AlertDialogCancel = React.forwardRef(
(props, forwardedRef) => {
const { __scopeAlertDialog, ...cancelProps } = props;
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
const dialogScope = useDialogScope(__scopeAlertDialog);
const ref = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, cancelRef);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Close, { ...dialogScope, ...cancelProps, ref });
}
);
AlertDialogCancel.displayName = CANCEL_NAME;
var DescriptionWarning = ({ contentRef }) => {
const MESSAGE = `\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${CONTENT_NAME}\` by passing a \`${DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
React.useEffect(() => {
const hasDescription = document.getElementById(
contentRef.current?.getAttribute("aria-describedby")
);
if (!hasDescription) console.warn(MESSAGE);
}, [MESSAGE, contentRef]);
return null;
};
var Root2 = AlertDialog;
var Trigger2 = AlertDialogTrigger;
var Portal2 = AlertDialogPortal;
var Overlay2 = AlertDialogOverlay;
var Content2 = AlertDialogContent;
var Action = AlertDialogAction;
var Cancel = AlertDialogCancel;
var Title2 = AlertDialogTitle;
var Description2 = AlertDialogDescription;
//# sourceMappingURL=index.js.map
@@ -0,0 +1,5 @@
import type { TSESLint } from '@typescript-eslint/utils';
declare const _default: TSESLint.RuleModule<"preferForOf", [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1,732 @@
export default `flf2a$ 7 7 14 0 16 0 8004 0
Author : MJP (AKA MikeChat)
Date : 2003/9/27 12:58:29
Version: 1.0
-------------------------------------------------
-------------------------------------------------
This font has been created using JavE's FIGlet font export assistant.
Have a look at: http://www.jave.de
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $#
$ $#
$ $#
$ $#
$ $#
$ $#
$ $##
.--. #
(O)(O) #
| o / #
|\`-/ #
|_/ #
_ #
(_) ##
"#
#
#
#
#
#
##
##
#
#
#
#
#
##
$#
#
#
#
#
#
##
%#
#
#
#
#
#
##
&#
#
#
#
#
#
##
#
__ #
( ) #
)/ #
/ #
#
##
(#
#
#
#
#
#
##
)#
#
#
#
#
#
##
*#
#
#
#
#
#
##
+#
#
#
#
#
#
##
#
#
#
#
__ #
( ) #
)/ ##
#
#
#
_____ #
[_____] #
#
##
#
#
#
#
#
_ #
(_) ##
/#
#
#
#
#
#
##
.-. #
(O)_(O) #
/ .-. \\ #
/ /_|_\\ \\ #
| \\___/ | #
'. \`-' .\` #
\`-.-' ##
__ #
/' \\ #
" || #
|| #
|| #
_||_ #
(_/\\_) ##
#
(O)-. #
(_.-. \\ #
)/ #
// #
/(____; #
(____.-' ##
wWw #
_(O) #
(__ \\ #
) \\ #
(_ ) #
_/ / #
(__/ ##
\\\\ // #
(o)(o) #
/ /\\ \\ #
|(__)| #
\\___ | #
| |_ #
\\___) ##
#
oo_ #
.' __) #
| |__ #
|___ \\ #
____) ) #
(_____/ ##
;(O) #
"/ __) #
| |__ #
| __ \\ #
|(__)| #
\\ / #
\`--' ##
(O)-. #
(_.-. \\ #
) ) #
/ / #
/ / #
/ | #
/_|_\\ ##
wWwWw #
(O)o) #
/ _ \\ #
/ (_) \\ #
( /"\\ ) #
\\ \\_/ / #
\\___/ ##
,--. #
(O)(O) #
|(__)| #
| __/ #
| /|\\ #
\\ \`-. #
\`--' ##
#
#
_ #
(_) #
#
_ #
(_) ##
;#
#
#
#
#
#
##
<#
#
#
#
#
#
##
=#
#
#
#
#
#
##
>#
#
#
#
#
#
##
(O)-. #
(_.-. \\ #
)/ #
// #
(/ #
_ #
(_) ##
@#
#
#
#
#
#
##
#
/) #
(o)(O) #
//\\\\ #
|(__)| #
/,-. | #
-' '' ##
___ #
(___)__ #
(O)(O) #
/ _\\ #
| |_)) #
| |_)) #
(.'-' ##
c c #
(OO) #
,'.--.) #
/ //_|_\\ #
| \\___ #
'. ) #
\`-.' ##
_ #
/||_ #
/o_) #
/ |(\\ #
| | )) #
| |// #
\\__/ ##
wWw #
(O)_ #
/ __) #
/ ( #
( _) #
\\ \\_ #
\\__) ##
wWw #
(O)_ #
/ __) #
/ ( #
( _) #
/ / #
)/ ##
\\/ #
(OO) #
,'.--.) #
/ /|_|_\\ #
| \\_.--. #
'. \\) \\ #
\`-.(_.' ##
\\\\ // #
(o)(o) #
|| || #
|(__)| #
/.--.\\ #
-' \`- #
##
wW Ww #
(O)(O) #
(..) #
|| #
_||_ #
(_/\\_) #
##
_ #
_||\\ #
(_'\\ #
( | #
\\ | #
(\\__)| #
\`--.) ##
_ #
(OO) .' ) #
||_/ .' #
| / #
||\\ \\ #
(/\\)\\ \`. #
\`._) ##
W W #
(O)(O) #
|| #
| \\ #
| \`. #
(.-.__) #
\`-' ##
\\\\\\ /// #
((O) (O)) #
| \\ / | #
||\\\\//|| #
|| \\/ || #
|| || #
(_/ \\_) ##
\\\\\\ /// #
((O)(O)) #
| \\ || #
||\\\\|| #
|| \\ | #
|| || #
(_/ \\_) ##
.-. #
c(O_O)c #
,'.---.\`, #
/ /|_|_|\\ \\ #
| \\_____/ | #
'. \`---' .\` #
\`-...-' ##
)) #
(o0)-. #
| (_)) #
| .-' #
|( #
\\) #
( ##
.-. #
c(O_O)c #
,'.---.\`, #
/ /|_|_|\\ \\ #
| \\___.--.| #
'. \`---\\) \\ #
\`-...(_.' ##
()_() #
(O o) #
|^_\\ #
|(_)) #
| / #
)|\\\\ #
(/ \\) ##
oo_ #
/ _)-< #
\\__ \`. #
\`. | #
_| | #
,-' | #
(_..--' ##
(o)__(o) #
(__ __) #
( ) #
)( #
( ) #
)/ #
( ##
wWw wWw #
(O) (O) #
/ ) ( \\ #
/ / \\ \\ #
| \\____/ | #
'. \`--' .\` #
\`-..-' ##
wWw wWw #
(O) (O) #
( \\ / ) #
\\ \\ / / #
/ \\/ \\ #
\\ \`--' / #
\`-..-' ##
(O)) ((O) #
|| || #
|| /\\ || #
||//\\\\|| #
/ / \\ \\ #
( / \\ ) #
) ( ##
wW Ww #
(O)\\ /(O) #
\`. \\/ .' #
\\ / #
/ \\ #
.' /\\ \`. #
(_.' \`._) ##
wWw wWw #
(O) (O) #
( \\ / ) #
\\ \\/ / #
\\o / #
_/ / #
(_.' ##
_oo #
>-(_ \\ #
/ _/ #
/ / #
/ ( #
( \`-. #
\`--.._) ##
[#
#
#
#
#
#
##
\\#
#
#
#
#
#
##
]#
#
#
#
#
#
##
#
/\\ #
/ \\ #
/ /\\ \\ #
\\( )/ #
#
##
#
#
#
#
#
_____ #
[_____] ##
#
__ #
( ) #
\\( #
\\ #
#
##
#
/) #
(o)(O) #
//\\\\ #
|(__)| #
/,-. | #
-' '' ##
___ #
(___)__ #
(O)(O) #
/ _\\ #
| |_)) #
| |_)) #
(.'-' ##
c c #
(OO) #
,'.--.) #
/ //_|_\\ #
| \\___ #
'. ) #
\`-.' ##
_ #
/||_ #
/o_) #
/ |(\\ #
| | )) #
| |// #
\\__/ ##
wWw #
(O)_ #
/ __) #
/ ( #
( _) #
\\ \\_ #
\\__) ##
wWw #
(O)_ #
/ __) #
/ ( #
( _) #
/ / #
)/ ##
\\/ #
(OO) #
,'.--.) #
/ /|_|_\\ #
| \\_.--. #
'. \\) \\ #
\`-.(_.' ##
\\\\ // #
(o)(o) #
|| || #
|(__)| #
/.--.\\ #
-' \`- #
##
wW Ww #
(O)(O) #
(..) #
|| #
_||_ #
(_/\\_) #
##
_ #
_||\\ #
(_'\\ #
( | #
\\ | #
(\\__)| #
\`--.) ##
_ #
(OO) .' ) #
||_/ .' #
| / #
||\\ \\ #
(/\\)\\ \`. #
\`._) ##
W W #
(O)(O) #
|| #
| \\ #
| \`. #
(.-.__) #
\`-' ##
\\\\\\ /// #
((O) (O)) #
| \\ / | #
||\\\\//|| #
|| \\/ || #
|| || #
(_/ \\_) ##
\\\\\\ /// #
((O)(O)) #
| \\ || #
||\\\\|| #
|| \\ | #
|| || #
(_/ \\_) ##
.-. #
c(O_O)c #
,'.---.\`, #
/ /|_|_|\\ \\ #
| \\_____/ | #
'. \`---' .\` #
\`-...-' ##
)) #
(o0)-. #
| (_)) #
| .-' #
|( #
\\) #
( ##
.-. #
c(O_O)c #
,'.---.\`, #
/ /|_|_|\\ \\ #
| \\___.--.| #
'. \`---\\) \\ #
\`-...(_.' ##
()_() #
(O o) #
|^_\\ #
|(_)) #
| / #
)|\\\\ #
(/ \\) ##
oo_ #
/ _)-< #
\\__ \`. #
\`. | #
_| | #
,-' | #
(_..--' ##
(o)__(o) #
(__ __) #
( ) #
)( #
( ) #
)/ #
( ##
wWw wWw #
(O) (O) #
/ ) ( \\ #
/ / \\ \\ #
| \\____/ | #
'. \`--' .\` #
\`-..-' ##
wWw wWw #
(O) (O) #
( \\ / ) #
\\ \\ / / #
/ \\/ \\ #
\\ \`--' / #
\`-..-' ##
(O)) ((O) #
|| || #
|| /\\ || #
||//\\\\|| #
/ / \\ \\ #
( / \\ ) #
) ( ##
wW Ww #
(O)\\ /(O) #
\`. \\/ .' #
\\ / #
/ \\ #
.' /\\ \`. #
(_.' \`._) ##
wWw wWw #
(O) (O) #
( \\ / ) #
\\ \\/ / #
\\o / #
_/ / #
(_.' ##
_oo #
>-(_ \\ #
/ _/ #
/ / #
/ ( #
( \`-. #
\`--.._) ##
{#
#
#
#
#
#
##
|#
#
#
#
#
#
##
}#
#
#
#
#
#
##
~#
#
#
#
#
#
##
#
/) #
(o)(O) #
//\\\\ #
|(__)| #
/,-. | #
-' '' ##
.-. #
c(O_O)c #
,'.---.\`, #
/ /|_|_|\\ \\ #
| \\_____/ | #
'. \`---' .\` #
\`-...-' ##
wWw wWw #
(O) (O) #
/ ) ( \\ #
/ / \\ \\ #
| \\____/ | #
'. \`--' .\` #
\`-..-' ##
#
/) #
(o)(O) #
//\\\\ #
|(__)| #
/,-. | #
-' '' ##
.-. #
c(O_O)c #
,'.---.\`, #
/ /|_|_|\\ \\ #
| \\_____/ | #
'. \`---' .\` #
\`-...-' ##
wWw wWw #
(O) (O) #
/ ) ( \\ #
/ / \\ \\ #
| \\____/ | #
'. \`--' .\` #
\`-..-' ##
�#
#
#
#
#
#
##
`
@@ -0,0 +1,79 @@
/**
* @fileoverview Disallow string concatenation when using __dirname and __filename
* @author Nicholas C. Zakas
* @deprecated in ESLint v7.0.0
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
deprecated: {
message: "Node.js rules were moved out of ESLint core.",
url: "https://eslint.org/docs/latest/use/migrating-to-7.0.0#deprecate-node-rules",
deprecatedSince: "7.0.0",
availableUntil: "11.0.0",
replacedBy: [
{
message:
"eslint-plugin-n now maintains deprecated Node.js-related rules.",
plugin: {
name: "eslint-plugin-n",
url: "https://github.com/eslint-community/eslint-plugin-n",
},
rule: {
name: "no-path-concat",
url: "https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules/no-path-concat.md",
},
},
],
},
type: "suggestion",
docs: {
description:
"Disallow string concatenation with `__dirname` and `__filename`",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-path-concat",
},
schema: [],
messages: {
usePathFunctions:
"Use path.join() or path.resolve() instead of + to create paths.",
},
},
create(context) {
const MATCHER = /^__(?:dir|file)name$/u;
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
BinaryExpression(node) {
const left = node.left,
right = node.right;
if (
node.operator === "+" &&
((left.type === "Identifier" && MATCHER.test(left.name)) ||
(right.type === "Identifier" &&
MATCHER.test(right.name)))
) {
context.report({
node,
messageId: "usePathFunctions",
});
}
},
};
},
};
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _createForOfIteratorHelperLoose;
var _unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = (0, _unsupportedIterableToArray.default)(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) {
return {
done: true
};
}
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
//# sourceMappingURL=createForOfIteratorHelperLoose.js.map
@@ -0,0 +1 @@
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/mcp-server.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAyBH;;;;;;;;;GASG;AACH,MAAa,0BAA0B;IACnC,YAA6B,UAAqB;QAArB,eAAU,GAAV,UAAU,CAAW;IAAG,CAAC;IAgEtD,gBAAgB,CAIZ,IAAY,EACZ,MAQC,EACD,OAAmC;QAEnC,oEAAoE;QACpE,MAAM,SAAS,GAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QAClF,IAAI,SAAS,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,6DAA6D,CAAC,CAAC;QAC3H,CAAC;QAED,2DAA2D;QAC3D,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAA0C,CAAC;QAC1E,OAAO,iBAAiB,CAAC,qBAAqB,CAC1C,IAAI,EACJ,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,YAAY,EACnB,MAAM,CAAC,WAAW,EAClB,SAAS,EACT,MAAM,CAAC,KAAK,EACZ,OAAwD,CAC3D,CAAC;IACN,CAAC;CACJ;AArGD,gEAqGC"}
@@ -0,0 +1,35 @@
/**
* Audited & minimal JS implementation of hash functions, MACs, and KDFs.
* Check out individual modules.
* @module
* @example
```js
import {
sha256, sha384, sha512, sha224, sha512_224, sha512_256
} from '@noble/hashes/sha2.js';
import {
sha3_224, sha3_256, sha3_384, sha3_512,
keccak_224, keccak_256, keccak_384, keccak_512,
shake128, shake256
} from '@noble/hashes/sha3.js';
import {
cshake128, cshake256,
turboshake128, turboshake256,
kt128, kt256,
kmac128, kmac256,
tuplehash256, parallelhash256,
keccakprg
} from '@noble/hashes/sha3-addons.js';
import { blake3 } from '@noble/hashes/blake3.js';
import { blake2b, blake2s } from '@noble/hashes/blake2.js';
import { hmac } from '@noble/hashes/hmac.js';
import { hkdf } from '@noble/hashes/hkdf.js';
import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2.js';
import { scrypt, scryptAsync } from '@noble/hashes/scrypt.js';
import { md5, ripemd160, sha1 } from '@noble/hashes/legacy.js';
import * as utils from '@noble/hashes/utils.js';
```
*/
throw new Error('root module cannot be imported: import submodules instead. Check out README');
export {};
//# sourceMappingURL=index.js.map
@@ -0,0 +1,374 @@
/**
* @fileoverview A class to operate forking.
*
* This is state of forking.
* This has a fork list and manages it.
*
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const assert = require("../../shared/assert"),
CodePathSegment = require("./code-path-segment");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Determines whether or not a given segment is reachable.
* @param {CodePathSegment} segment The segment to check.
* @returns {boolean} `true` if the segment is reachable.
*/
function isReachable(segment) {
return segment.reachable;
}
/**
* Creates a new segment for each fork in the given context and appends it
* to the end of the specified range of segments. Ultimately, this ends up calling
* `new CodePathSegment()` for each of the forks using the `create` argument
* as a wrapper around special behavior.
*
* The `startIndex` and `endIndex` arguments specify a range of segments in
* `context` that should become `allPrevSegments` for the newly created
* `CodePathSegment` objects.
*
* When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and
* `end` is `-1`, this creates two new segments, `[g, h]`. This `g` is appended to
* the end of the path from `a`, `c`, and `e`. This `h` is appended to the end of
* `b`, `d`, and `f`.
* @param {ForkContext} context An instance from which the previous segments
* will be obtained.
* @param {number} startIndex The index of the first segment in the context
* that should be specified as previous segments for the newly created segments.
* @param {number} endIndex The index of the last segment in the context
* that should be specified as previous segments for the newly created segments.
* @param {Function} create A function that creates new `CodePathSegment`
* instances in a particular way. See the `CodePathSegment.new*` methods.
* @returns {Array<CodePathSegment>} An array of the newly-created segments.
*/
function createSegments(context, startIndex, endIndex, create) {
/** @type {Array<Array<CodePathSegment>>} */
const list = context.segmentsList;
/*
* Both `startIndex` and `endIndex` work the same way: if the number is zero
* or more, then the number is used as-is. If the number is negative,
* then that number is added to the length of the segments list to
* determine the index to use. That means -1 for either argument
* is the last element, -2 is the second to last, and so on.
*
* So if `startIndex` is 0, `endIndex` is -1, and `list.length` is 3, the
* effective `startIndex` is 0 and the effective `endIndex` is 2, so this function
* will include items at indices 0, 1, and 2.
*
* Therefore, if `startIndex` is -1 and `endIndex` is -1, that means we'll only
* be using the last segment in `list`.
*/
const normalizedBegin =
startIndex >= 0 ? startIndex : list.length + startIndex;
const normalizedEnd = endIndex >= 0 ? endIndex : list.length + endIndex;
/** @type {Array<CodePathSegment>} */
const segments = [];
for (let i = 0; i < context.count; ++i) {
// this is passed into `new CodePathSegment` to add to code path.
const allPrevSegments = [];
for (let j = normalizedBegin; j <= normalizedEnd; ++j) {
allPrevSegments.push(list[j][i]);
}
// note: `create` is just a wrapper that augments `new CodePathSegment`.
segments.push(create(context.idGenerator.next(), allPrevSegments));
}
return segments;
}
/**
* Inside of a `finally` block we end up with two parallel paths. If the code path
* exits by a control statement (such as `break` or `continue`) from the `finally`
* block, then we need to merge the remaining parallel paths back into one.
* @param {ForkContext} context The fork context to work on.
* @param {Array<CodePathSegment>} segments Segments to merge.
* @returns {Array<CodePathSegment>} The merged segments.
*/
function mergeExtraSegments(context, segments) {
let currentSegments = segments;
/*
* We need to ensure that the array returned from this function contains no more
* than the number of segments that the context allows. `context.count` indicates
* how many items should be in the returned array to ensure that the new segment
* entries will line up with the already existing segment entries.
*/
while (currentSegments.length > context.count) {
const merged = [];
/*
* Because `context.count` is a factor of 2 inside of a `finally` block,
* we can divide the segment count by 2 to merge the paths together.
* This loops through each segment in the list and creates a new `CodePathSegment`
* that has the segment and the segment two slots away as previous segments.
*
* If `currentSegments` is [a,b,c,d], this will create new segments e and f, such
* that:
*
* When `i` is 0:
* a->e
* c->e
*
* When `i` is 1:
* b->f
* d->f
*/
for (
let i = 0, length = Math.floor(currentSegments.length / 2);
i < length;
++i
) {
merged.push(
CodePathSegment.newNext(context.idGenerator.next(), [
currentSegments[i],
currentSegments[i + length],
]),
);
}
/*
* Go through the loop condition one more time to see if we have the
* number of segments for the context. If not, we'll keep merging paths
* of the merged segments until we get there.
*/
currentSegments = merged;
}
return currentSegments;
}
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
/**
* Manages the forking of code paths.
*/
class ForkContext {
/**
* Creates a new instance.
* @param {IdGenerator} idGenerator An identifier generator for segments.
* @param {ForkContext|null} upper The preceding fork context.
* @param {number} count The number of parallel segments in each element
* of `segmentsList`.
*/
constructor(idGenerator, upper, count) {
/**
* The ID generator that will generate segment IDs for any new
* segments that are created.
* @type {IdGenerator}
*/
this.idGenerator = idGenerator;
/**
* The preceding fork context.
* @type {ForkContext|null}
*/
this.upper = upper;
/**
* The number of elements in each element of `segmentsList`. In most
* cases, this is 1 but can be 2 when there is a `finally` present,
* which forks the code path outside of normal flow. In the case of nested
* `finally` blocks, this can be a multiple of 2.
* @type {number}
*/
this.count = count;
/**
* The segments within this context. Each element in this array has
* `count` elements that represent one step in each fork. For example,
* when `segmentsList` is `[[a, b], [c, d], [e, f]]`, there is one path
* a->c->e and one path b->d->f, and `count` is 2 because each element
* is an array with two elements.
* @type {Array<Array<CodePathSegment>>}
*/
this.segmentsList = [];
}
/**
* The segments that begin this fork context.
* @type {Array<CodePathSegment>}
*/
get head() {
const list = this.segmentsList;
return list.length === 0 ? [] : list.at(-1);
}
/**
* Indicates if the context contains no segments.
* @type {boolean}
*/
get empty() {
return this.segmentsList.length === 0;
}
/**
* Indicates if there are any segments that are reachable.
* @type {boolean}
*/
get reachable() {
const segments = this.head;
return segments.length > 0 && segments.some(isReachable);
}
/**
* Creates new segments in this context and appends them to the end of the
* already existing `CodePathSegment`s specified by `startIndex` and
* `endIndex`.
* @param {number} startIndex The index of the first segment in the context
* that should be specified as previous segments for the newly created segments.
* @param {number} endIndex The index of the last segment in the context
* that should be specified as previous segments for the newly created segments.
* @returns {Array<CodePathSegment>} An array of the newly created segments.
*/
makeNext(startIndex, endIndex) {
return createSegments(
this,
startIndex,
endIndex,
CodePathSegment.newNext,
);
}
/**
* Creates new unreachable segments in this context and appends them to the end of the
* already existing `CodePathSegment`s specified by `startIndex` and
* `endIndex`.
* @param {number} startIndex The index of the first segment in the context
* that should be specified as previous segments for the newly created segments.
* @param {number} endIndex The index of the last segment in the context
* that should be specified as previous segments for the newly created segments.
* @returns {Array<CodePathSegment>} An array of the newly created segments.
*/
makeUnreachable(startIndex, endIndex) {
return createSegments(
this,
startIndex,
endIndex,
CodePathSegment.newUnreachable,
);
}
/**
* Creates new segments in this context and does not append them to the end
* of the already existing `CodePathSegment`s specified by `startIndex` and
* `endIndex`. The `startIndex` and `endIndex` are only used to determine if
* the new segments should be reachable. If any of the segments in this range
* are reachable then the new segments are also reachable; otherwise, the new
* segments are unreachable.
* @param {number} startIndex The index of the first segment in the context
* that should be considered for reachability.
* @param {number} endIndex The index of the last segment in the context
* that should be considered for reachability.
* @returns {Array<CodePathSegment>} An array of the newly created segments.
*/
makeDisconnected(startIndex, endIndex) {
return createSegments(
this,
startIndex,
endIndex,
CodePathSegment.newDisconnected,
);
}
/**
* Adds segments to the head of this context.
* @param {Array<CodePathSegment>} segments The segments to add.
* @returns {void}
*/
add(segments) {
assert(
segments.length >= this.count,
`${segments.length} >= ${this.count}`,
);
this.segmentsList.push(mergeExtraSegments(this, segments));
}
/**
* Replaces the head segments with the given segments.
* The current head segments are removed.
* @param {Array<CodePathSegment>} replacementHeadSegments The new head segments.
* @returns {void}
*/
replaceHead(replacementHeadSegments) {
assert(
replacementHeadSegments.length >= this.count,
`${replacementHeadSegments.length} >= ${this.count}`,
);
this.segmentsList.splice(
-1,
1,
mergeExtraSegments(this, replacementHeadSegments),
);
}
/**
* Adds all segments of a given fork context into this context.
* @param {ForkContext} otherForkContext The fork context to add from.
* @returns {void}
*/
addAll(otherForkContext) {
assert(otherForkContext.count === this.count);
this.segmentsList.push(...otherForkContext.segmentsList);
}
/**
* Clears all segments in this context.
* @returns {void}
*/
clear() {
this.segmentsList = [];
}
/**
* Creates a new root context, meaning that there are no parent
* fork contexts.
* @param {IdGenerator} idGenerator An identifier generator for segments.
* @returns {ForkContext} New fork context.
*/
static newRoot(idGenerator) {
const context = new ForkContext(idGenerator, null, 1);
context.add([CodePathSegment.newRoot(idGenerator.next())]);
return context;
}
/**
* Creates an empty fork context preceded by a given context.
* @param {ForkContext} parentContext The parent fork context.
* @param {boolean} shouldForkLeavingPath Indicates that we are inside of
* a `finally` block and should therefore fork the path that leaves
* `finally`.
* @returns {ForkContext} New fork context.
*/
static newEmpty(parentContext, shouldForkLeavingPath) {
return new ForkContext(
parentContext.idGenerator,
parentContext,
(shouldForkLeavingPath ? 2 : 1) * parentContext.count,
);
}
}
module.exports = ForkContext;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"2":"_XH R _hH","450":"_8D _tD"},C:{"2":"_S"},D:{"2":"_xI _3D _gH","450":"_8D _tD"},E:{"2":"_R"},F:{"2":"_0B _QJ _oC _XT _O","450":"_8M _DG"},G:{"2":"_M"},H:{"2":"1D"},I:{"2":"_P"},J:{"2":"_B"},K:{"2":"_N"},L:{"257":"I"},M:{"2":"YC"},N:{"2":"_A"},O:{"2":"bC"},P:{"2":"_F"},Q:{"2":"JE"},R:{"1":"KE"},S:{"2":"_C"}},B:7,C:"Web NFC",D:true};
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const AArrowDown = createLucideIcon("AArrowDown", [
["path", { d: "M3.5 13h6", key: "p1my2r" }],
["path", { d: "m2 16 4.5-9 4.5 9", key: "ndf0b3" }],
["path", { d: "M18 7v9", key: "pknjwm" }],
["path", { d: "m14 12 4 4 4-4", key: "buelq4" }]
]);
export { AArrowDown as default };
//# sourceMappingURL=a-arrow-down.js.map
@@ -0,0 +1 @@
{"version":3,"file":"signal.js","sources":["../../../src/icons/signal.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Signal\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMiAyMGguMDEiIC8+CiAgPHBhdGggZD0iTTcgMjB2LTQiIC8+CiAgPHBhdGggZD0iTTEyIDIwdi04IiAvPgogIDxwYXRoIGQ9Ik0xNyAyMFY4IiAvPgogIDxwYXRoIGQ9Ik0yMiA0djE2IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/signal\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 Signal = createLucideIcon('Signal', [\n ['path', { d: 'M2 20h.01', key: '4haj6o' }],\n ['path', { d: 'M7 20v-4', key: 'j294jx' }],\n ['path', { d: 'M12 20v-8', key: 'i3yub9' }],\n ['path', { d: 'M17 20V8', key: '1tkaf5' }],\n ['path', { d: 'M22 4v16', key: 'sih9yq' }],\n]);\n\nexport default Signal;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,iBAAiB,QAAU,CAAA,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,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 FileScan = createLucideIcon("FileScan", [
["path", { d: "M20 10V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h4", key: "1rdf37" }],
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
["path", { d: "M16 14a2 2 0 0 0-2 2", key: "ceaadl" }],
["path", { d: "M20 14a2 2 0 0 1 2 2", key: "1ny6zw" }],
["path", { d: "M20 22a2 2 0 0 0 2-2", key: "1l9q4k" }],
["path", { d: "M16 22a2 2 0 0 1-2-2", key: "1wqh5n" }]
]);
export { FileScan as default };
//# sourceMappingURL=file-scan.js.map
@@ -0,0 +1,9 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
export { default } from './utensils-crossed.js';
//# sourceMappingURL=fork-knife-crossed.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 ClipboardCopy = createLucideIcon("ClipboardCopy", [
["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
["path", { d: "M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2", key: "4jdomd" }],
["path", { d: "M16 4h2a2 2 0 0 1 2 2v4", key: "3hqy98" }],
["path", { d: "M21 14H11", key: "1bme5i" }],
["path", { d: "m15 10-4 4 4 4", key: "5dvupr" }]
]);
export { ClipboardCopy as default };
//# sourceMappingURL=clipboard-copy.js.map
@@ -0,0 +1,25 @@
import { time } from '../frameloop/sync-time.mjs';
import { secondsToMilliseconds } from 'motion-utils';
import { frame, cancelFrame } from '../frameloop/frame.mjs';
/**
* Timeout defined in ms
*/
function delay(callback, timeout) {
const start = time.now();
const checkElapsed = ({ timestamp }) => {
const elapsed = timestamp - start;
if (elapsed >= timeout) {
cancelFrame(checkElapsed);
callback(elapsed - timeout);
}
};
frame.setup(checkElapsed, true);
return () => cancelFrame(checkElapsed);
}
function delayInSeconds(callback, timeout) {
return delay(callback, secondsToMilliseconds(timeout));
}
export { delay, delayInSeconds };
//# sourceMappingURL=delay.mjs.map
@@ -0,0 +1,142 @@
<h1 align="center"> <img width="35" height="35" alt="Motion logo" src="https://github.com/user-attachments/assets/00d6d1c3-72c4-4c2f-a664-69da13182ffc" /><br />Motion</h1>
<h3 align="center">
An open source animation library<br />for JavaScript, React and Vue
</h3>
<p align="center">
<a href="https://www.npmjs.com/package/motion" rel="noopener noreferrer nofollow" ><img src="https://img.shields.io/npm/v/motion?color=0368FF&label=version" alt="npm version"></a>
<a href="https://www.npmjs.com/package/motion" rel="noopener noreferrer nofollow" ><img src="https://img.shields.io/npm/dm/framer-motion?color=8D30FF&label=npm" alt="npm downloads per month"></a>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://www.jsdelivr.com/package/npm/motion"><img alt="jsDelivr hits (npm)" src="https://img.shields.io/jsdelivr/npm/hm/framer-motion?logo=jsdeliver&color=FF4FBA"></a>
<img alt="NPM License" src="https://img.shields.io/npm/l/motion?color=FF2B6E">
</p>
```bash
# React / JavaScript
npm install motion
# Vue
npm install motion-v
```
## Table of Contents
1. [Why Motion?](#why-motion)
2. [🍦 Platforms](#-platforms)
3. [🎓 Examples](#-examples)
4. [⚡️ Motion+](#-motion)
5. [👩🏻‍⚖️ License](#-license)
6. [💎 Contribute](#-contribute)
7. [✨ Sponsors](#-sponsors)
## Why Motion?
- **Simple API:** First-class React, JavaScript, and Vue packages.
- **Hybrid engine:** Power of JavaScript combined with native browser APIs for 120fps, GPU-accelerated animations.
- **Production-ready:** TypeScript, extensive test suite, tree-shakable, tiny footprint.
**Batteries included:** Gestures, springs, layout transitions, scroll-linked effects, timelines.
## 🍦 Platforms
Motion is available for [React](https://motion.dev/docs/react), [JavaScript](https://motion.dev/docs/quick-start) and [Vue](https://motion.dev/docs/vue).
### React
```jsx
import { motion } from "motion/react"
function Component() {
return <motion.div animate={{ x: 100 }} />
}
```
Get started with [Motion for React](https://motion.dev/docs/react).
**Note:** Framer Motion is now Motion. Import from `motion/react` instead of `framer-motion`.
### JS
```javascript
import { animate } from "motion"
animate("#box", { x: 100 })
```
Get started with [JavaScript](https://motion.dev/docs/quick-start).
### Vue
```html
<script>
import { motion } from "motion-v"
</script>
<template> <motion.div :animate={{ x: 100 }} /> </template>
```
Get started with [Motion for Vue](https://motion.dev/docs/vue).
## 🎓 Examples & tutorials
Browse 330+ [official examples](https://motion.dev/examples), with copy-paste code that'll level-up your animations whether you're a beginner or an expert.
Over 100 examples come with a full step-by-step [tutorial](https://motion.dev/tutorials).
## ⚡️ Motion+
A one-time payment, lifetime-updates membership:
- **330+ examples**
- **100+ tutorials**
- **Premium APIs** like [Cursor](https://motion.dev/docs/cursor) and [Ticker](https://motion.dev/docs/react-ticker)
- **Transition editor** for Cursor and VS Code
- **AI skills**
- **Private Discord**
- **Early access content**
[Get Motion+](https://motion.dev/plus)
## 👩🏻‍⚖️ License
- Motion is MIT licensed.
## 💎 Contribute
- Want to contribute to Motion? Our [contributing guide](https://github.com/motiondivision/motion/blob/master/CONTRIBUTING.md) has you covered.
## ✨ Sponsors
Motion is sustainable thanks to the kind support of its sponsors.
[Become a sponsor](https://motion.dev/sponsor)
### Partners
Motion powers the animations for all websites built with Framer, the web builder for creative pros. The Motion website itself is built on Framer, for its delightful canvas-based editing and powerful CMS features.
<a href="https://framer.link/FlnUbQY">
<img alt="Framer" src="https://github.com/user-attachments/assets/22a79be7-672e-4336-bfb7-5d55d1deb917" width="250px" height="150px">
</a>
Motion drives the animations on the Cursor homepage, and is working with Cursor to bring powerful AI workflows to the Motion examples and docs.
<a href="https://cursor.com">
<img alt="Cursor" src="https://github.com/user-attachments/assets/81c482d3-c2c2-4b35-bbcf-933b28d5b448" width="250px" height="150px" />
</a>
### Platinum
<a href="https://linear.app"><img alt="Linear" src="https://github.com/user-attachments/assets/f9ce44b4-af28-4770-bb6e-9515b474bfb2" width="250px" height="150px"></a> <a href="https://figma.com"><img alt="Figma" src="https://github.com/user-attachments/assets/1077d0ab-4305-4a1f-81c8-d5be8c4c6717" width="250px" height="150px"></a> <a href="https://sanity.io"><img alt="Sanity" src="https://github.com/user-attachments/assets/80134088-f456-483f-8edd-940593c120ce" width="250px" height="150px"></a> <a href="https://animations.dev"><img alt="Sanity" src="https://github.com/user-attachments/assets/7c5ab87d-c7d9-44b4-9c7e-f9e6a9f3ba3b" width="250px" height="150px"></a> <a href="https://clerk.com?utm_campaign=motion"><img alt="Clerk" src="https://github.com/user-attachments/assets/16789f85-eaf4-46fb-9961-b3e66d33afbc" width="250px" height="150px"></a> <a href="https://www.greptile.com/?utm_source=motion&utm_medium=sponsorship"><img alt="Greptile" src="https://github.com/user-attachments/assets/6d1d7100-46b0-420b-8ce5-a18026c6297f" width="250px" height="150px"></a>
### Gold
<a href="https://mintlify.com"><img alt="Mintlify" src="https://github.com/user-attachments/assets/2740db2f-1877-49ae-ae80-ba5d19ef1587" width="200px" height="120px"></a>
### Silver
<a href="https://liveblocks.io"><img alt="Liveblocks" src="https://github.com/user-attachments/assets/28eddbe5-1617-4e74-969d-2eb6fcd481af" width="150px" height="100px"></a> <a href="https://www.frontend.fyi/?utm_source=motion"><img alt="Frontend.fyi" src="https://github.com/user-attachments/assets/f16e3eb9-f0bd-4ad1-8049-f079a3d65c69" width="150px" height="100px"></a> <a href="https://firecrawl.dev"><img alt="Firecrawl" src="https://github.com/user-attachments/assets/2c44e7f4-5c2a-4714-9050-1570538665ff" width="150px" height="100px"></a> <a href="https://puzzmo.com"><img alt="Puzzmo" src="https://github.com/user-attachments/assets/e32205a7-3ab1-41ec-8729-a794058fd655" width="150px" height="100px"></a> <a href="https://bolt.new"><img alt="Bolt.new" src="https://github.com/user-attachments/assets/7932d4b2-bb6c-422e-82b9-6ad78a7e3090" width="150px" height="100px"></a>
### Personal
- [OlegWock](https://sinja.io)
- [Lambert Weller](https://github.com/l-mbert)
- [Jake LeBoeuf](https://jklb.wf)
@@ -0,0 +1 @@
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/extract.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEhD,MAAM,eAAe,GAAG,CAAC,GAAuB,EAAE,EAAE;IAClD,MAAM,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAA;IAC7B,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;IACrB,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC9B,oDAAoD;IACpD,4DAA4D;IAC5D,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;IACpD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE;QAC1C,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,GAAmB,EAAE,CAAY,EAAE,EAAE;IACxD,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAA;IACzB,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;IAEpD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;IACrB,MAAM,CAAC,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9C,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QACrB,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAEtB,oDAAoD;QACpD,4DAA4D;QAC5D,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE;YACzB,IAAI,EAAE,EAAE,CAAC;gBACP,MAAM,CAAC,EAAE,CAAC,CAAA;YACZ,CAAC;iBAAM,CAAC;gBACN,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE;oBACtC,QAAQ,EAAE,QAAQ;oBAClB,IAAI,EAAE,IAAI,CAAC,IAAI;iBAChB,CAAC,CAAA;gBACF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;gBAC1B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YAChB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAChC,eAAe,EACf,WAAW,EACX,GAAG,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,EAC1B,GAAG,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,EACtB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;IACb,IAAI,KAAK,EAAE,MAAM;QAAE,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AAC5C,CAAC,CACF,CAAA","sourcesContent":["// tar -x\nimport * as fsm from '@isaacs/fs-minipass'\nimport fs from 'node:fs'\nimport { filesFilter } from './list.js'\nimport { makeCommand } from './make-command.js'\nimport type { TarOptionsFile, TarOptionsSyncFile } from './options.js'\nimport { Unpack, UnpackSync } from './unpack.js'\n\nconst extractFileSync = (opt: TarOptionsSyncFile) => {\n const u = new UnpackSync(opt)\n const file = opt.file\n const stat = fs.statSync(file)\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n const stream = new fsm.ReadStreamSync(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.pipe(u)\n}\n\nconst extractFile = (opt: TarOptionsFile, _?: string[]) => {\n const u = new Unpack(opt)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n\n const file = opt.file\n const p = new Promise<void>((resolve, reject) => {\n u.on('error', reject)\n u.on('close', resolve)\n\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n fs.stat(file, (er, stat) => {\n if (er) {\n reject(er)\n } else {\n const stream = new fsm.ReadStream(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.on('error', reject)\n stream.pipe(u)\n }\n })\n })\n return p\n}\n\nexport const extract = makeCommand<Unpack, UnpackSync>(\n extractFileSync,\n extractFile,\n opt => new UnpackSync(opt),\n opt => new Unpack(opt),\n (opt, files) => {\n if (files?.length) filesFilter(opt, files)\n },\n)\n"]}
@@ -0,0 +1,14 @@
import Range = require("../classes/range");
import SemVer = require("../classes/semver");
import semver = require("../index");
/**
* Return true if the version satisfies the range.
*/
declare function satisfies(
version: string | SemVer,
range: string | Range,
optionsOrLoose?: boolean | semver.RangeOptions,
): boolean;
export = satisfies;
@@ -0,0 +1,79 @@
import type {
ErrorPayload,
FullReloadPayload,
PrunePayload,
UpdatePayload,
} from './hmrPayload.js'
export interface CustomEventMap {
// client events
'vite:beforeUpdate': UpdatePayload
'vite:afterUpdate': UpdatePayload
'vite:beforePrune': PrunePayload
'vite:beforeFullReload': FullReloadPayload
'vite:error': ErrorPayload
'vite:invalidate': InvalidatePayload
'vite:ws:connect': WebSocketConnectionPayload
'vite:ws:disconnect': WebSocketConnectionPayload
/** @internal */
'vite:forward-console': ForwardConsolePayload
/** @internal */
'vite:module-loaded': { modules: string[]; clientId: string }
// server events
'vite:client:connect': undefined
'vite:client:disconnect': undefined
}
export interface WebSocketConnectionPayload {
/**
* @experimental
* We expose this instance experimentally to see potential usage.
* This might be removed in the future if we didn't find reasonable use cases.
* If you find this useful, please open an issue with details so we can discuss and make it stable API.
*/
// eslint-disable-next-line n/no-unsupported-features/node-builtins
webSocket: WebSocket
}
export interface InvalidatePayload {
path: string
message: string | undefined
firstInvalidatedBy: string
}
export type ForwardConsolePayload =
| {
type: 'error'
data: {
name: string
message: string
stack?: string
}
}
| {
type: 'unhandled-rejection'
data: {
name: string
message: string
stack?: string
}
}
| {
type: 'log'
data: {
level: string
message: string
}
}
/**
* provides types for payloads of built-in Vite events
*/
export type InferCustomEventPayload<T extends string> =
T extends keyof CustomEventMap ? CustomEventMap[T] : any
/**
* provides types for names of built-in Vite events
*/
export type CustomEventName = keyof CustomEventMap | (string & {})
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const MouseOff = createLucideIcon("MouseOff", [
["path", { d: "M12 6v.343", key: "1gyhex" }],
["path", { d: "M18.218 18.218A7 7 0 0 1 5 15V9a7 7 0 0 1 .782-3.218", key: "ukzz01" }],
["path", { d: "M19 13.343V9A7 7 0 0 0 8.56 2.902", key: "104jy9" }],
["path", { d: "M22 22 2 2", key: "1r8tn9" }]
]);
export { MouseOff as default };
//# sourceMappingURL=mouse-off.js.map
@@ -0,0 +1,21 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Badge = createLucideIcon("Badge", [
[
"path",
{
d: "M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",
key: "3c2336"
}
]
]);
export { Badge as default };
//# sourceMappingURL=badge.js.map
@@ -0,0 +1 @@
{"version":3,"file":"warn-method.js","sourceRoot":"","sources":["../../src/warn-method.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAY,EACZ,IAAY,EACZ,OAAuB,EACvB,OAAiB,EAAE,EACnB,EAAE;IACF,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;IACvB,CAAC;IACD,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;IACrB,CAAC;IACD,IAAI,CAAC,IAAI;QACP,CAAC,OAAO,YAAY,KAAK;YACtB,OAAiC,CAAC,IAAI,CAAC;YAC1C,IAAI,CAAA;IACN,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;IACnB,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;QAC/C,IAAI,OAAO,YAAY,KAAK,EAAE,CAAC;YAC7B,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;YACnC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC3B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;IACxC,CAAC;SAAM,IAAI,OAAO,YAAY,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;IAClD,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,IAAI,CACP,OAAO,EACP,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,CACtD,CAAA;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { type Minipass } from 'minipass'\n\n/** has a warn method */\nexport type Warner = {\n warn(code: string, message: string | Error, data: unknown): void\n file?: string\n cwd?: string\n strict?: boolean\n\n emit(event: 'warn', code: string, message: string, data?: WarnData): void\n emit(event: 'error', error: TarError): void\n}\n\nexport type WarnEvent<T = Buffer> = Minipass.Events<T> & {\n warn: [code: string, message: string, data: WarnData]\n}\n\nexport type WarnData = {\n file?: string\n cwd?: string\n code?: string\n tarCode?: string\n recoverable?: boolean\n [k: string]: unknown\n}\n\nexport type TarError = Error & WarnData\n\nexport const warnMethod = (\n self: Warner,\n code: string,\n message: string | Error,\n data: WarnData = {},\n) => {\n if (self.file) {\n data.file = self.file\n }\n if (self.cwd) {\n data.cwd = self.cwd\n }\n data.code =\n (message instanceof Error &&\n (message as NodeJS.ErrnoException).code) ||\n code\n data.tarCode = code\n if (!self.strict && data.recoverable !== false) {\n if (message instanceof Error) {\n data = Object.assign(message, data)\n message = message.message\n }\n self.emit('warn', code, message, data)\n } else if (message instanceof Error) {\n self.emit('error', Object.assign(message, data))\n } else {\n self.emit(\n 'error',\n Object.assign(new Error(`${code}: ${message}`), data),\n )\n }\n}\n"]}
@@ -0,0 +1,25 @@
/**
* @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 Sofa = createLucideIcon("Sofa", [
["path", { d: "M20 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v3", key: "1dgpiv" }],
[
"path",
{
d: "M2 16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",
key: "xacw8m"
}
],
["path", { d: "M4 18v2", key: "jwo5n2" }],
["path", { d: "M20 18v2", key: "1ar1qi" }],
["path", { d: "M12 4v9", key: "oqhhn3" }]
]);
export { Sofa as default };
//# sourceMappingURL=sofa.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_IB","132":"E","260":"_V"},B:{"1":"_K","260":"_KB _VB","772":"N"},C:{"1":"_S"},D:{"1":"_Q"},E:{"1":"_R"},F:{"1":"_c"},G:{"1":"_M"},H:{"1":"1D"},I:{"1":"_P"},J:{"1":"_B"},K:{"1":"_N"},L:{"1":"I"},M:{"1":"YC"},N:{"260":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:6,C:"Data URIs",D:true};
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2018_asynciterable: LibDefinition;
@@ -0,0 +1 @@
{"version":3,"file":"not-found.cjs","names":[],"sources":["../../src/not-found.ts"],"sourcesContent":["import type { RouteIds } from './routeInfo'\nimport type { RegisteredRouter } from './router'\n\nexport type NotFoundError = {\n /**\n @deprecated\n Use `routeId: rootRouteId` instead\n */\n global?: boolean\n /**\n @private\n Do not use this. It's used internally to indicate a path matching error\n */\n _global?: boolean\n data?: any\n throw?: boolean\n routeId?: RouteIds<RegisteredRouter['routeTree']>\n headers?: HeadersInit\n}\n\n/**\n * Create a not-found error object recognized by TanStack Router.\n *\n * Throw this from loaders/actions to trigger the nearest `notFoundComponent`.\n * Use `routeId` to target a specific route's not-found boundary. If `throw`\n * is true, the error is thrown instead of returned.\n *\n * @param options Optional settings including `routeId`, `headers`, and `throw`.\n * @returns A not-found error object that can be thrown or returned.\n * @link https://tanstack.com/router/latest/docs/router/framework/react/api/router/notFoundFunction\n */\nexport function notFound(options: NotFoundError = {}) {\n ;(options as any).isNotFound = true\n if (options.throw) throw options\n return options\n}\n\n/** Determine if a value is a TanStack Router not-found error. */\nexport function isNotFound(obj: any): obj is NotFoundError {\n return obj?.isNotFound === true\n}\n"],"mappings":";;;;;;;;;;;;AA+BA,SAAgB,SAAS,UAAyB,EAAE,EAAE;AAClD,SAAgB,aAAa;AAC/B,KAAI,QAAQ,MAAO,OAAM;AACzB,QAAO;;;AAIT,SAAgB,WAAW,KAAgC;AACzD,QAAO,KAAK,eAAe"}
@@ -0,0 +1,24 @@
(The MIT License)
Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.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,63 @@
All packages under `src/` are licensed according to the terms in
their respective `LICENSE` or `LICENSE.md` files.
The remainder of this project is licensed under the Blue Oak
Model License, as follows:
-----
# Blue Oak Model License
Version 1.0.0
## Purpose
This license gives everyone as much permission to work with
this software as possible, while protecting contributors
from liability.
## Acceptance
In order to receive this license, you must agree to its
rules. The rules of this license are both obligations
under that agreement and conditions to your license.
You must not do anything with this software that triggers
a rule that you cannot or will not follow.
## Copyright
Each contributor licenses you to do everything with this
software that would otherwise infringe that contributor's
copyright in it.
## Notices
You must ensure that everyone who gets a copy of
any part of this software from you, with or without
changes, also gets the text of this license or a link to
<https://blueoakcouncil.org/license/1.0.0>.
## Excuse
If anyone notifies you in writing that you have not
complied with [Notices](#notices), you can keep your
license by taking all practical steps to comply within 30
days after the notice. If you do not do so, your license
ends immediately.
## Patent
Each contributor licenses you to do everything with this
software that would otherwise infringe any patent claims
they can license or become able to license.
## Reliability
No contributor can revoke this license.
## No Liability
***As far as the law allows, this software comes as is,
without any warranty or condition, and no contributor
will be liable to anyone for any damages related to this
software or this license, under any kind of legal claim.***
@@ -0,0 +1,39 @@
import { isPressing } from './state.mjs';
/**
* Filter out events that are not "Enter" keys.
*/
function filterEvents(callback) {
return (event) => {
if (event.key !== "Enter")
return;
callback(event);
};
}
function firePointerEvent(target, type) {
target.dispatchEvent(new PointerEvent("pointer" + type, { isPrimary: true, bubbles: true }));
}
const enableKeyboardPress = (focusEvent, eventOptions) => {
const element = focusEvent.currentTarget;
if (!element)
return;
const handleKeydown = filterEvents(() => {
if (isPressing.has(element))
return;
firePointerEvent(element, "down");
const handleKeyup = filterEvents(() => {
firePointerEvent(element, "up");
});
const handleBlur = () => firePointerEvent(element, "cancel");
element.addEventListener("keyup", handleKeyup, eventOptions);
element.addEventListener("blur", handleBlur, eventOptions);
});
element.addEventListener("keydown", handleKeydown, eventOptions);
/**
* Add an event listener that fires on blur to remove the keydown events.
*/
element.addEventListener("blur", () => element.removeEventListener("keydown", handleKeydown), eventOptions);
};
export { enableKeyboardPress };
//# sourceMappingURL=keyboard.mjs.map
@@ -0,0 +1,15 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Twitch = createLucideIcon("Twitch", [
["path", { d: "M21 2H3v16h5v4l4-4h5l4-4V2zm-10 9V7m5 4V7", key: "c0yzno" }]
]);
export { Twitch as default };
//# sourceMappingURL=twitch.js.map
@@ -0,0 +1 @@
{"version":3,"file":"circle-parking.js","sources":["../../../src/icons/circle-parking.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CircleParking\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8cGF0aCBkPSJNOSAxN1Y3aDRhMyAzIDAgMCAxIDAgNkg5IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/circle-parking\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 CircleParking = createLucideIcon('CircleParking', [\n ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],\n ['path', { d: 'M9 17V7h4a3 3 0 0 1 0 6H9', key: '1dfk2c' }],\n]);\n\nexport default CircleParking;\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,CACtD,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACzD,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;AAC5D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,410 @@
import { isServer } from '@tanstack/router-core/isServer'
import { last } from './utils'
import {
SEGMENT_TYPE_OPTIONAL_PARAM,
SEGMENT_TYPE_PARAM,
SEGMENT_TYPE_PATHNAME,
SEGMENT_TYPE_WILDCARD,
parseSegment,
} from './new-process-route-tree'
import type { LRUCache } from './lru-cache'
/** Join path segments, cleaning duplicate slashes between parts. */
export function joinPaths(paths: Array<string | undefined>) {
return cleanPath(
paths
.filter((val) => {
return val !== undefined
})
.join('/'),
)
}
/** Remove repeated slashes from a path string. */
export function cleanPath(path: string) {
// remove double slashes
return path.replace(/\/{2,}/g, '/')
}
/** Trim leading slashes (except preserving root '/'). */
export function trimPathLeft(path: string) {
return path === '/' ? path : path.replace(/^\/{1,}/, '')
}
/** Trim trailing slashes (except preserving root '/'). */
export function trimPathRight(path: string) {
const len = path.length
return len > 1 && path[len - 1] === '/' ? path.replace(/\/{1,}$/, '') : path
}
/** Trim both leading and trailing slashes. */
export function trimPath(path: string) {
return trimPathRight(trimPathLeft(path))
}
/** Remove a trailing slash from value when appropriate for comparisons. */
export function removeTrailingSlash(value: string, basepath: string): string {
if (value?.endsWith('/') && value !== '/' && value !== `${basepath}/`) {
return value.slice(0, -1)
}
return value
}
// intended to only compare path name
// see the usage in the isActive under useLinkProps
// /sample/path1 = /sample/path1/
// /sample/path1/some <> /sample/path1
/**
* Compare two pathnames for exact equality after normalizing trailing slashes
* relative to the provided `basepath`.
*/
export function exactPathTest(
pathName1: string,
pathName2: string,
basepath: string,
): boolean {
return (
removeTrailingSlash(pathName1, basepath) ===
removeTrailingSlash(pathName2, basepath)
)
}
// When resolving relative paths, we treat all paths as if they are trailing slash
// documents. All trailing slashes are removed after the path is resolved.
// Here are a few examples:
//
// /a/b/c + ./d = /a/b/c/d
// /a/b/c + ../d = /a/b/d
// /a/b/c + ./d/ = /a/b/c/d
// /a/b/c + ../d/ = /a/b/d
// /a/b/c + ./ = /a/b/c
//
// Absolute paths that start with `/` short circuit the resolution process to the root
// path.
//
// Here are some examples:
//
// /a/b/c + /d = /d
// /a/b/c + /d/ = /d
// /a/b/c + / = /
//
// Non-.-prefixed paths are still treated as relative paths, resolved like `./`
//
// Here are some examples:
//
// /a/b/c + d = /a/b/c/d
// /a/b/c + d/ = /a/b/c/d
// /a/b/c + d/e = /a/b/c/d/e
interface ResolvePathOptions {
base: string
to: string
trailingSlash?: 'always' | 'never' | 'preserve'
cache?: LRUCache<string, string>
}
/**
* Resolve a destination path against a base, honoring trailing-slash policy
* and supporting relative segments (`.`/`..`) and absolute `to` values.
*/
export function resolvePath({
base,
to,
trailingSlash = 'never',
cache,
}: ResolvePathOptions) {
const isAbsolute = to.startsWith('/')
const isBase = !isAbsolute && to === '.'
let key
if (cache) {
// `trailingSlash` is static per router, so it doesn't need to be part of the cache key
key = isAbsolute ? to : isBase ? base : base + '\0' + to
const cached = cache.get(key)
if (cached) return cached
}
let baseSegments: Array<string>
if (isBase) {
baseSegments = base.split('/')
} else if (isAbsolute) {
baseSegments = to.split('/')
} else {
baseSegments = base.split('/')
while (baseSegments.length > 1 && last(baseSegments) === '') {
baseSegments.pop()
}
const toSegments = to.split('/')
for (let index = 0, length = toSegments.length; index < length; index++) {
const value = toSegments[index]!
if (value === '') {
if (!index) {
// Leading slash
baseSegments = [value]
} else if (index === length - 1) {
// Trailing Slash
baseSegments.push(value)
} else {
// ignore inter-slashes
}
} else if (value === '..') {
baseSegments.pop()
} else if (value === '.') {
// ignore
} else {
baseSegments.push(value)
}
}
}
if (baseSegments.length > 1) {
if (last(baseSegments) === '') {
if (trailingSlash === 'never') {
baseSegments.pop()
}
} else if (trailingSlash === 'always') {
baseSegments.push('')
}
}
const result = cleanPath(baseSegments.join('/')) || '/'
if (key && cache) cache.set(key, result)
return result
}
/**
* Create a pre-compiled decode config from allowed characters.
* This should be called once at router initialization.
*/
export function compileDecodeCharMap(
pathParamsAllowedCharacters: ReadonlyArray<string>,
) {
const charMap = new Map(
pathParamsAllowedCharacters.map((char) => [encodeURIComponent(char), char]),
)
// Escape special regex characters and join with |
const pattern = Array.from(charMap.keys())
.map((key) => key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
.join('|')
const regex = new RegExp(pattern, 'g')
return (encoded: string) =>
encoded.replace(regex, (match) => charMap.get(match) ?? match)
}
interface InterpolatePathOptions {
path?: string
params: Record<string, unknown>
/**
* A function that decodes a path parameter value.
* Obtained from `compileDecodeCharMap(pathParamsAllowedCharacters)`.
*/
decoder?: (encoded: string) => string
/**
* @internal
* For testing only, in development mode we use the router.isServer value
*/
server?: boolean
}
type InterPolatePathResult = {
interpolatedPath: string
usedParams: Record<string, unknown>
isMissingParams: boolean // true if any params were not available when being looked up in the params object
}
function encodeParam(
key: string,
params: InterpolatePathOptions['params'],
decoder: InterpolatePathOptions['decoder'],
): any {
const value = params[key]
if (typeof value !== 'string') return value
if (key === '_splat') {
// Early return if value only contains URL-safe characters (performance optimization)
if (/^[a-zA-Z0-9\-._~!/]*$/.test(value)) return value
// the splat/catch-all routes shouldn't have the '/' encoded out
// Use encodeURIComponent for each segment to properly encode spaces,
// plus signs, and other special characters that encodeURI leaves unencoded
return value
.split('/')
.map((segment) => encodePathParam(segment, decoder))
.join('/')
} else {
return encodePathParam(value, decoder)
}
}
/**
* Interpolate params and wildcards into a route path template.
*
* - Encodes params safely (configurable allowed characters)
* - Supports `{-$optional}` segments, `{prefix{$id}suffix}` and `{$}` wildcards
*/
export function interpolatePath({
path,
params,
decoder,
// `server` is marked @internal and stripped from .d.ts by `stripInternal`.
// We avoid destructuring it in the function signature so the emitted
// declaration doesn't reference a property that no longer exists.
...rest
}: InterpolatePathOptions): InterPolatePathResult {
// Tracking if any params are missing in the `params` object
// when interpolating the path
let isMissingParams = false
const usedParams: Record<string, unknown> = Object.create(null)
if (!path || path === '/')
return { interpolatedPath: '/', usedParams, isMissingParams }
if (!path.includes('$'))
return { interpolatedPath: path, usedParams, isMissingParams }
if (isServer ?? rest.server) {
// Fast path for common templates like `/posts/$id` or `/files/$`.
// Braced segments (`{...}`) are more complex (prefix/suffix/optional) and are
// handled by the general parser below.
if (path.indexOf('{') === -1) {
const length = path.length
let cursor = 0
let joined = ''
while (cursor < length) {
// Skip slashes between segments. '/' code is 47
while (cursor < length && path.charCodeAt(cursor) === 47) cursor++
if (cursor >= length) break
const start = cursor
let end = path.indexOf('/', cursor)
if (end === -1) end = length
cursor = end
const part = path.substring(start, end)
if (!part) continue
// `$id` or `$` (splat). '$' code is 36
if (part.charCodeAt(0) === 36) {
if (part.length === 1) {
const splat = params._splat
usedParams._splat = splat
// TODO: Deprecate *
usedParams['*'] = splat
if (!splat) {
isMissingParams = true
continue
}
const value = encodeParam('_splat', params, decoder)
joined += '/' + value
} else {
const key = part.substring(1)
if (!isMissingParams && !(key in params)) {
isMissingParams = true
}
usedParams[key] = params[key]
const value = encodeParam(key, params, decoder) ?? 'undefined'
joined += '/' + value
}
} else {
joined += '/' + part
}
}
if (path.endsWith('/')) joined += '/'
const interpolatedPath = joined || '/'
return { usedParams, interpolatedPath, isMissingParams }
}
}
const length = path.length
let cursor = 0
let segment
let joined = ''
while (cursor < length) {
const start = cursor
segment = parseSegment(path, start, segment)
const end = segment[5]
cursor = end + 1
if (start === end) continue
const kind = segment[0]
if (kind === SEGMENT_TYPE_PATHNAME) {
joined += '/' + path.substring(start, end)
continue
}
if (kind === SEGMENT_TYPE_WILDCARD) {
const splat = params._splat
usedParams._splat = splat
// TODO: Deprecate *
usedParams['*'] = splat
const prefix = path.substring(start, segment[1])
const suffix = path.substring(segment[4], end)
// Check if _splat parameter is missing. _splat could be missing if undefined or an empty string or some other falsy value.
if (!splat) {
isMissingParams = true
// For missing splat parameters, just return the prefix and suffix without the wildcard
// If there is a prefix or suffix, return them joined, otherwise omit the segment
if (prefix || suffix) {
joined += '/' + prefix + suffix
}
continue
}
const value = encodeParam('_splat', params, decoder)
joined += '/' + prefix + value + suffix
continue
}
if (kind === SEGMENT_TYPE_PARAM) {
const key = path.substring(segment[2], segment[3])
if (!isMissingParams && !(key in params)) {
isMissingParams = true
}
usedParams[key] = params[key]
const prefix = path.substring(start, segment[1])
const suffix = path.substring(segment[4], end)
const value = encodeParam(key, params, decoder) ?? 'undefined'
joined += '/' + prefix + value + suffix
continue
}
if (kind === SEGMENT_TYPE_OPTIONAL_PARAM) {
const key = path.substring(segment[2], segment[3])
const valueRaw = params[key]
// Check if optional parameter is missing or undefined
if (valueRaw == null) continue
usedParams[key] = valueRaw
const prefix = path.substring(start, segment[1])
const suffix = path.substring(segment[4], end)
const value = encodeParam(key, params, decoder) ?? ''
joined += '/' + prefix + value + suffix
continue
}
}
if (path.endsWith('/')) joined += '/'
const interpolatedPath = joined || '/'
return { usedParams, interpolatedPath, isMissingParams }
}
function encodePathParam(
value: string,
decoder?: InterpolatePathOptions['decoder'],
) {
const encoded = encodeURIComponent(value)
return decoder?.(encoded) ?? encoded
}
@@ -0,0 +1,3 @@
var stringify = require('../');
var obj = { c: 6, b: [4,5], a: 3 };
console.log(stringify(obj));
@@ -0,0 +1 @@
{"version":3,"file":"encode.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/entities/61afd4701eaa736978b13c7351cd3de9a96b04bc/src/","sources":["encode.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AACD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD"}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"2":"_2F","260":"_K","3138":"Q"},C:{"1":"_IN _8I","2":"_g","132":"_Y _lT","644":"_TC _UG"},D:{"2":"_uF","260":"_RL","292":"_YF _VO"},E:{"2":"_ZC","260":"_bE","292":"_iC _oJ _mF _kL"},F:{"2":"_T","260":"_SI","292":"_aH yB"},G:{"2":"_r","260":"_TE","292":"_JC _EJ pD"},H:{"2":"1D"},I:{"2":"_W","260":"I","292":"_y"},J:{"2":"_B"},K:{"2":"_D","260":"H"},L:{"260":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"260":"bC"},P:{"260":"_hB","292":"_rC"},Q:{"260":"JE"},R:{"260":"KE"},S:{"1":"ME","644":"LE"}},B:4,C:"CSS clip-path property (for HTML)",D:true};
@@ -0,0 +1,894 @@
/**
* The `node:worker_threads` module enables the use of threads that execute
* JavaScript in parallel. To access it:
*
* ```js
* import worker_threads from 'node:worker_threads';
* ```
*
* Workers (threads) are useful for performing CPU-intensive JavaScript operations.
* They do not help much with I/O-intensive work. The Node.js built-in
* asynchronous I/O operations are more efficient than Workers can be.
*
* Unlike `child_process` or `cluster`, `worker_threads` can share memory. They do
* so by transferring `ArrayBuffer` instances or sharing `SharedArrayBuffer` instances.
*
* ```js
* import {
* Worker,
* isMainThread,
* parentPort,
* workerData,
* } from 'node:worker_threads';
*
* if (!isMainThread) {
* const { parse } = await import('some-js-parsing-library');
* const script = workerData;
* parentPort.postMessage(parse(script));
* }
*
* export default function parseJSAsync(script) {
* return new Promise((resolve, reject) => {
* const worker = new Worker(new URL(import.meta.url), {
* workerData: script,
* });
* worker.on('message', resolve);
* worker.once('error', reject);
* worker.once('exit', (code) => {
* if (code !== 0)
* reject(new Error(`Worker stopped with exit code ${code}`));
* });
* });
* };
* ```
*
* The above example spawns a Worker thread for each `parseJSAsync()` call. In
* practice, use a pool of Workers for these kinds of tasks. Otherwise, the
* overhead of creating Workers would likely exceed their benefit.
*
* When implementing a worker pool, use the `AsyncResource` API to inform
* diagnostic tools (e.g. to provide asynchronous stack traces) about the
* correlation between tasks and their outcomes. See `"Using AsyncResource for a Worker thread pool"` in the `async_hooks` documentation for an example implementation.
*
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
* specifically `argv` and `execArgv` options.
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/worker_threads.js)
*/
declare module "worker_threads" {
import { Context } from "node:vm";
import { EventEmitter, NodeEventTarget } from "node:events";
import { FileHandle } from "node:fs/promises";
import { Performance } from "node:perf_hooks";
import { Readable, Writable } from "node:stream";
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
import { URL } from "node:url";
import { CPUProfileHandle, HeapInfo, HeapProfileHandle } from "node:v8";
import { MessageEvent } from "undici-types";
const isInternalThread: boolean;
const isMainThread: boolean;
const parentPort: null | MessagePort;
const resourceLimits: ResourceLimits;
const SHARE_ENV: unique symbol;
const threadId: number;
const threadName: string | null;
const workerData: any;
/**
* Instances of the `worker.MessageChannel` class represent an asynchronous,
* two-way communications channel.
* The `MessageChannel` has no methods of its own. `new MessageChannel()` yields an object with `port1` and `port2` properties, which refer to linked `MessagePort` instances.
*
* ```js
* import { MessageChannel } from 'node:worker_threads';
*
* const { port1, port2 } = new MessageChannel();
* port1.on('message', (message) => console.log('received', message));
* port2.postMessage({ foo: 'bar' });
* // Prints: received { foo: 'bar' } from the `port1.on('message')` listener
* ```
* @since v10.5.0
*/
class MessageChannel {
readonly port1: MessagePort;
readonly port2: MessagePort;
}
interface WorkerPerformance extends Pick<Performance, "eventLoopUtilization"> {}
type Transferable =
| ArrayBuffer
| MessagePort
| AbortSignal
| FileHandle
| ReadableStream
| WritableStream
| TransformStream;
/** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
// TODO: remove in a future major @types/node version.
type TransferListItem = Transferable;
/**
* Instances of the `worker.MessagePort` class represent one end of an
* asynchronous, two-way communications channel. It can be used to transfer
* structured data, memory regions and other `MessagePort`s between different `Worker`s.
*
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
* @since v10.5.0
*/
class MessagePort implements EventTarget {
/**
* Disables further sending of messages on either side of the connection.
* This method can be called when no further communication will happen over this `MessagePort`.
*
* The `'close' event` is emitted on both `MessagePort` instances that
* are part of the channel.
* @since v10.5.0
*/
close(): void;
/**
* Sends a JavaScript value to the receiving side of this channel. `value` is transferred in a way which is compatible with
* the [HTML structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm).
*
* In particular, the significant differences to `JSON` are:
*
* * `value` may contain circular references.
* * `value` may contain instances of builtin JS types such as `RegExp`s, `BigInt`s, `Map`s, `Set`s, etc.
* * `value` may contain typed arrays, both using `ArrayBuffer`s
* and `SharedArrayBuffer`s.
* * `value` may contain [`WebAssembly.Module`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module) instances.
* * `value` may not contain native (C++-backed) objects other than:
*
* ```js
* import { MessageChannel } from 'node:worker_threads';
* const { port1, port2 } = new MessageChannel();
*
* port1.on('message', (message) => console.log(message));
*
* const circularData = {};
* circularData.foo = circularData;
* // Prints: { foo: [Circular] }
* port2.postMessage(circularData);
* ```
*
* `transferList` may be a list of [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), `MessagePort`, and `FileHandle` objects.
* After transferring, they are not usable on the sending side of the channel
* anymore (even if they are not contained in `value`). Unlike with `child processes`, transferring handles such as network sockets is currently
* not supported.
*
* If `value` contains [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances, those are accessible
* from either thread. They cannot be listed in `transferList`.
*
* `value` may still contain `ArrayBuffer` instances that are not in `transferList`; in that case, the underlying memory is copied rather than moved.
*
* ```js
* import { MessageChannel } from 'node:worker_threads';
* const { port1, port2 } = new MessageChannel();
*
* port1.on('message', (message) => console.log(message));
*
* const uint8Array = new Uint8Array([ 1, 2, 3, 4 ]);
* // This posts a copy of `uint8Array`:
* port2.postMessage(uint8Array);
* // This does not copy data, but renders `uint8Array` unusable:
* port2.postMessage(uint8Array, [ uint8Array.buffer ]);
*
* // The memory for the `sharedUint8Array` is accessible from both the
* // original and the copy received by `.on('message')`:
* const sharedUint8Array = new Uint8Array(new SharedArrayBuffer(4));
* port2.postMessage(sharedUint8Array);
*
* // This transfers a freshly created message port to the receiver.
* // This can be used, for example, to create communication channels between
* // multiple `Worker` threads that are children of the same parent thread.
* const otherChannel = new MessageChannel();
* port2.postMessage({ port: otherChannel.port1 }, [ otherChannel.port1 ]);
* ```
*
* The message object is cloned immediately, and can be modified after
* posting without having side effects.
*
* For more information on the serialization and deserialization mechanisms
* behind this API, see the `serialization API of the node:v8 module`.
* @since v10.5.0
*/
postMessage(value: any, transferList?: readonly Transferable[]): void;
/**
* If true, the `MessagePort` object will keep the Node.js event loop active.
* @since v18.1.0, v16.17.0
*/
hasRef(): boolean;
/**
* Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does _not_ let the program exit if it's the only active handle left (the default
* behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
*
* If listeners are attached or removed using `.on('message')`, the port
* is `ref()`ed and `unref()`ed automatically depending on whether
* listeners for the event exist.
* @since v10.5.0
*/
ref(): void;
/**
* Calling `unref()` on a port allows the thread to exit if this is the only
* active handle in the event system. If the port is already `unref()`ed calling `unref()` again has no effect.
*
* If listeners are attached or removed using `.on('message')`, the port is `ref()`ed and `unref()`ed automatically depending on whether
* listeners for the event exist.
* @since v10.5.0
*/
unref(): void;
/**
* Starts receiving messages on this `MessagePort`. When using this port
* as an event emitter, this is called automatically once `'message'` listeners are attached.
*
* This method exists for parity with the Web `MessagePort` API. In Node.js,
* it is only useful for ignoring messages when no event listener is present.
* Node.js also diverges in its handling of `.onmessage`. Setting it
* automatically calls `.start()`, but unsetting it lets messages queue up
* until a new handler is set or the port is discarded.
* @since v10.5.0
*/
start(): void;
addListener(event: "close", listener: (ev: Event) => void): this;
addListener(event: "message", listener: (value: any) => void): this;
addListener(event: "messageerror", listener: (error: Error) => void): this;
addListener(event: string, listener: (arg: any) => void): this;
emit(event: "close", ev: Event): boolean;
emit(event: "message", value: any): boolean;
emit(event: "messageerror", error: Error): boolean;
emit(event: string, arg: any): boolean;
off(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
off(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
off(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
off(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
on(event: "close", listener: (ev: Event) => void): this;
on(event: "message", listener: (value: any) => void): this;
on(event: "messageerror", listener: (error: Error) => void): this;
on(event: string, listener: (arg: any) => void): this;
once(event: "close", listener: (ev: Event) => void): this;
once(event: "message", listener: (value: any) => void): this;
once(event: "messageerror", listener: (error: Error) => void): this;
once(event: string, listener: (arg: any) => void): this;
removeListener(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
removeListener(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
removeListener(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
removeListener(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
}
interface MessagePort extends NodeEventTarget {}
interface WorkerOptions {
/**
* List of arguments which would be stringified and appended to
* `process.argv` in the worker. This is mostly similar to the `workerData`
* but the values will be available on the global `process.argv` as if they
* were passed as CLI options to the script.
*/
argv?: any[] | undefined;
env?: NodeJS.Dict<string> | typeof SHARE_ENV | undefined;
eval?: boolean | undefined;
workerData?: any;
stdin?: boolean | undefined;
stdout?: boolean | undefined;
stderr?: boolean | undefined;
execArgv?: string[] | undefined;
resourceLimits?: ResourceLimits | undefined;
/**
* Additional data to send in the first worker message.
*/
transferList?: Transferable[] | undefined;
/**
* @default true
*/
trackUnmanagedFds?: boolean | undefined;
/**
* An optional `name` to be appended to the worker title
* for debugging/identification purposes, making the final title as
* `[worker ${id}] ${name}`.
*/
name?: string | undefined;
}
interface ResourceLimits {
/**
* The maximum size of a heap space for recently created objects.
*/
maxYoungGenerationSizeMb?: number | undefined;
/**
* The maximum size of the main heap in MB.
*/
maxOldGenerationSizeMb?: number | undefined;
/**
* The size of a pre-allocated memory range used for generated code.
*/
codeRangeSizeMb?: number | undefined;
/**
* The default maximum stack size for the thread. Small values may lead to unusable Worker instances.
* @default 4
*/
stackSizeMb?: number | undefined;
}
/**
* The `Worker` class represents an independent JavaScript execution thread.
* Most Node.js APIs are available inside of it.
*
* Notable differences inside a Worker environment are:
*
* * The `process.stdin`, `process.stdout`, and `process.stderr` streams may be redirected by the parent thread.
* * The `import { isMainThread } from 'node:worker_threads'` variable is set to `false`.
* * The `import { parentPort } from 'node:worker_threads'` message port is available.
* * `process.exit()` does not stop the whole program, just the single thread,
* and `process.abort()` is not available.
* * `process.chdir()` and `process` methods that set group or user ids
* are not available.
* * `process.env` is a copy of the parent thread's environment variables,
* unless otherwise specified. Changes to one copy are not visible in other
* threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor). On Windows, unlike the main thread, a copy of the
* environment variables operates in a case-sensitive manner.
* * `process.title` cannot be modified.
* * Signals are not delivered through `process.on('...')`.
* * Execution may stop at any point as a result of `worker.terminate()` being invoked.
* * IPC channels from parent processes are not accessible.
* * The `trace_events` module is not supported.
* * Native add-ons can only be loaded from multiple threads if they fulfill `certain conditions`.
*
* Creating `Worker` instances inside of other `Worker`s is possible.
*
* Like [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) and the `node:cluster module`, two-way communication
* can be achieved through inter-thread message passing. Internally, a `Worker` has
* a built-in pair of `MessagePort` s that are already associated with each
* other when the `Worker` is created. While the `MessagePort` object on the parent
* side is not directly exposed, its functionalities are exposed through `worker.postMessage()` and the `worker.on('message')` event
* on the `Worker` object for the parent thread.
*
* To create custom messaging channels (which is encouraged over using the default
* global channel because it facilitates separation of concerns), users can create
* a `MessageChannel` object on either thread and pass one of the`MessagePort`s on that `MessageChannel` to the other thread through a
* pre-existing channel, such as the global one.
*
* See `port.postMessage()` for more information on how messages are passed,
* and what kind of JavaScript values can be successfully transported through
* the thread barrier.
*
* ```js
* import assert from 'node:assert';
* import {
* Worker, MessageChannel, MessagePort, isMainThread, parentPort,
* } from 'node:worker_threads';
* if (isMainThread) {
* const worker = new Worker(__filename);
* const subChannel = new MessageChannel();
* worker.postMessage({ hereIsYourPort: subChannel.port1 }, [subChannel.port1]);
* subChannel.port2.on('message', (value) => {
* console.log('received:', value);
* });
* } else {
* parentPort.once('message', (value) => {
* assert(value.hereIsYourPort instanceof MessagePort);
* value.hereIsYourPort.postMessage('the worker is sending this');
* value.hereIsYourPort.close();
* });
* }
* ```
* @since v10.5.0
*/
class Worker extends EventEmitter {
/**
* If `stdin: true` was passed to the `Worker` constructor, this is a
* writable stream. The data written to this stream will be made available in
* the worker thread as `process.stdin`.
* @since v10.5.0
*/
readonly stdin: Writable | null;
/**
* This is a readable stream which contains data written to `process.stdout` inside the worker thread. If `stdout: true` was not passed to the `Worker` constructor, then data is piped to the
* parent thread's `process.stdout` stream.
* @since v10.5.0
*/
readonly stdout: Readable;
/**
* This is a readable stream which contains data written to `process.stderr` inside the worker thread. If `stderr: true` was not passed to the `Worker` constructor, then data is piped to the
* parent thread's `process.stderr` stream.
* @since v10.5.0
*/
readonly stderr: Readable;
/**
* An integer identifier for the referenced thread. Inside the worker thread,
* it is available as `import { threadId } from 'node:worker_threads'`.
* This value is unique for each `Worker` instance inside a single process.
* @since v10.5.0
*/
readonly threadId: number;
/**
* A string identifier for the referenced thread or null if the thread is not running.
* Inside the worker thread, it is available as `require('node:worker_threads').threadName`.
* @since v24.6.0
*/
readonly threadName: string | null;
/**
* Provides the set of JS engine resource constraints for this Worker thread.
* If the `resourceLimits` option was passed to the `Worker` constructor,
* this matches its values.
*
* If the worker has stopped, the return value is an empty object.
* @since v13.2.0, v12.16.0
*/
readonly resourceLimits?: ResourceLimits | undefined;
/**
* An object that can be used to query performance information from a worker
* instance.
* @since v15.1.0, v14.17.0, v12.22.0
*/
readonly performance: WorkerPerformance;
/**
* @param filename The path to the Worker’s main script or module.
* Must be either an absolute path or a relative path (i.e. relative to the current working directory) starting with ./ or ../,
* or a WHATWG URL object using file: protocol. If options.eval is true, this is a string containing JavaScript code rather than a path.
*/
constructor(filename: string | URL, options?: WorkerOptions);
/**
* Send a message to the worker that is received via `require('node:worker_threads').parentPort.on('message')`.
* See `port.postMessage()` for more details.
* @since v10.5.0
*/
postMessage(value: any, transferList?: readonly Transferable[]): void;
/**
* Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
* behavior). If the worker is `ref()`ed, calling `ref()` again has
* no effect.
* @since v10.5.0
*/
ref(): void;
/**
* Calling `unref()` on a worker allows the thread to exit if this is the only
* active handle in the event system. If the worker is already `unref()`ed calling `unref()` again has no effect.
* @since v10.5.0
*/
unref(): void;
/**
* Stop all JavaScript execution in the worker thread as soon as possible.
* Returns a Promise for the exit code that is fulfilled when the `'exit' event` is emitted.
* @since v10.5.0
*/
terminate(): Promise<number>;
/**
* This method returns a `Promise` that will resolve to an object identical to {@link process.threadCpuUsage()},
* or reject with an [`ERR_WORKER_NOT_RUNNING`](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_worker_not_running) error if the worker is no longer running.
* This methods allows the statistics to be observed from outside the actual thread.
* @since v24.6.0
*/
cpuUsage(prev?: NodeJS.CpuUsage): Promise<NodeJS.CpuUsage>;
/**
* Returns a readable stream for a V8 snapshot of the current state of the Worker.
* See `v8.getHeapSnapshot()` for more details.
*
* If the Worker thread is no longer running, which may occur before the `'exit' event` is emitted, the returned `Promise` is rejected
* immediately with an `ERR_WORKER_NOT_RUNNING` error.
* @since v13.9.0, v12.17.0
* @return A promise for a Readable Stream containing a V8 heap snapshot
*/
getHeapSnapshot(): Promise<Readable>;
/**
* This method returns a `Promise` that will resolve to an object identical to `v8.getHeapStatistics()`,
* or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
* This methods allows the statistics to be observed from outside the actual thread.
* @since v24.0.0
*/
getHeapStatistics(): Promise<HeapInfo>;
/**
* Starting a CPU profile then return a Promise that fulfills with an error
* or an `CPUProfileHandle` object. This API supports `await using` syntax.
*
* ```js
* const { Worker } = require('node:worker_threads');
*
* const worker = new Worker(`
* const { parentPort } = require('worker_threads');
* parentPort.on('message', () => {});
* `, { eval: true });
*
* worker.on('online', async () => {
* const handle = await worker.startCpuProfile();
* const profile = await handle.stop();
* console.log(profile);
* worker.terminate();
* });
* ```
*
* `await using` example.
*
* ```js
* const { Worker } = require('node:worker_threads');
*
* const w = new Worker(`
* const { parentPort } = require('node:worker_threads');
* parentPort.on('message', () => {});
* `, { eval: true });
*
* w.on('online', async () => {
* // Stop profile automatically when return and profile will be discarded
* await using handle = await w.startCpuProfile();
* });
* ```
* @since v24.8.0
*/
startCpuProfile(): Promise<CPUProfileHandle>;
/**
* Starting a Heap profile then return a Promise that fulfills with an error
* or an `HeapProfileHandle` object. This API supports `await using` syntax.
*
* ```js
* const { Worker } = require('node:worker_threads');
*
* const worker = new Worker(`
* const { parentPort } = require('worker_threads');
* parentPort.on('message', () => {});
* `, { eval: true });
*
* worker.on('online', async () => {
* const handle = await worker.startHeapProfile();
* const profile = await handle.stop();
* console.log(profile);
* worker.terminate();
* });
* ```
*
* `await using` example.
*
* ```js
* const { Worker } = require('node:worker_threads');
*
* const w = new Worker(`
* const { parentPort } = require('node:worker_threads');
* parentPort.on('message', () => {});
* `, { eval: true });
*
* w.on('online', async () => {
* // Stop profile automatically when return and profile will be discarded
* await using handle = await w.startHeapProfile();
* });
* ```
*/
startHeapProfile(): Promise<HeapProfileHandle>;
/**
* Calls `worker.terminate()` when the dispose scope is exited.
*
* ```js
* async function example() {
* await using worker = new Worker('for (;;) {}', { eval: true });
* // Worker is automatically terminate when the scope is exited.
* }
* ```
* @since v24.2.0
*/
[Symbol.asyncDispose](): Promise<void>;
addListener(event: "error", listener: (err: any) => void): this;
addListener(event: "exit", listener: (exitCode: number) => void): this;
addListener(event: "message", listener: (value: any) => void): this;
addListener(event: "messageerror", listener: (error: Error) => void): this;
addListener(event: "online", listener: () => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "error", err: any): boolean;
emit(event: "exit", exitCode: number): boolean;
emit(event: "message", value: any): boolean;
emit(event: "messageerror", error: Error): boolean;
emit(event: "online"): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "error", listener: (err: any) => void): this;
on(event: "exit", listener: (exitCode: number) => void): this;
on(event: "message", listener: (value: any) => void): this;
on(event: "messageerror", listener: (error: Error) => void): this;
on(event: "online", listener: () => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "error", listener: (err: any) => void): this;
once(event: "exit", listener: (exitCode: number) => void): this;
once(event: "message", listener: (value: any) => void): this;
once(event: "messageerror", listener: (error: Error) => void): this;
once(event: "online", listener: () => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "error", listener: (err: any) => void): this;
prependListener(event: "exit", listener: (exitCode: number) => void): this;
prependListener(event: "message", listener: (value: any) => void): this;
prependListener(event: "messageerror", listener: (error: Error) => void): this;
prependListener(event: "online", listener: () => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "error", listener: (err: any) => void): this;
prependOnceListener(event: "exit", listener: (exitCode: number) => void): this;
prependOnceListener(event: "message", listener: (value: any) => void): this;
prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
prependOnceListener(event: "online", listener: () => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: "error", listener: (err: any) => void): this;
removeListener(event: "exit", listener: (exitCode: number) => void): this;
removeListener(event: "message", listener: (value: any) => void): this;
removeListener(event: "messageerror", listener: (error: Error) => void): this;
removeListener(event: "online", listener: () => void): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
off(event: "error", listener: (err: any) => void): this;
off(event: "exit", listener: (exitCode: number) => void): this;
off(event: "message", listener: (value: any) => void): this;
off(event: "messageerror", listener: (error: Error) => void): this;
off(event: "online", listener: () => void): this;
off(event: string | symbol, listener: (...args: any[]) => void): this;
}
interface BroadcastChannel extends NodeJS.RefCounted {}
/**
* Instances of `BroadcastChannel` allow asynchronous one-to-many communication
* with all other `BroadcastChannel` instances bound to the same channel name.
*
* ```js
* 'use strict';
*
* import {
* isMainThread,
* BroadcastChannel,
* Worker,
* } from 'node:worker_threads';
*
* const bc = new BroadcastChannel('hello');
*
* if (isMainThread) {
* let c = 0;
* bc.onmessage = (event) => {
* console.log(event.data);
* if (++c === 10) bc.close();
* };
* for (let n = 0; n < 10; n++)
* new Worker(__filename);
* } else {
* bc.postMessage('hello from every worker');
* bc.close();
* }
* ```
* @since v15.4.0
*/
class BroadcastChannel extends EventTarget {
readonly name: string;
/**
* Invoked with a single \`MessageEvent\` argument when a message is received.
* @since v15.4.0
*/
onmessage: (message: MessageEvent) => void;
/**
* Invoked with a received message cannot be deserialized.
* @since v15.4.0
*/
onmessageerror: (message: MessageEvent) => void;
constructor(name: string);
/**
* Closes the `BroadcastChannel` connection.
* @since v15.4.0
*/
close(): void;
/**
* @since v15.4.0
* @param message Any cloneable JavaScript value.
*/
postMessage(message: unknown): void;
}
interface Lock {
readonly mode: LockMode;
readonly name: string;
}
interface LockGrantedCallback<T> {
(lock: Lock | null): T;
}
interface LockInfo {
clientId: string;
mode: LockMode;
name: string;
}
interface LockManager {
query(): Promise<LockManagerSnapshot>;
request<T>(name: string, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
request<T>(name: string, options: LockOptions, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
}
interface LockManagerSnapshot {
held: LockInfo[];
pending: LockInfo[];
}
type LockMode = "exclusive" | "shared";
interface LockOptions {
ifAvailable?: boolean;
mode?: LockMode;
signal?: AbortSignal;
steal?: boolean;
}
var locks: LockManager;
/**
* Mark an object as not transferable. If `object` occurs in the transfer list of
* a {@link MessagePort.postMessage port.postMessage()} call, it is ignored.
*
* In particular, this makes sense for objects that can be cloned, rather than
* transferred, and which are used by other objects on the sending side.
* For example, Node.js marks the `ArrayBuffer`s it uses for its `Buffer pool` with this.
*
* This operation cannot be undone.
*
* ```js
* import { MessageChannel, markAsUntransferable } from 'node:worker_threads';
*
* const pooledBuffer = new ArrayBuffer(8);
* const typedArray1 = new Uint8Array(pooledBuffer);
* const typedArray2 = new Float64Array(pooledBuffer);
*
* markAsUntransferable(pooledBuffer);
*
* const { port1 } = new MessageChannel();
* port1.postMessage(typedArray1, [ typedArray1.buffer ]);
*
* // The following line prints the contents of typedArray1 -- it still owns
* // its memory and has been cloned, not transferred. Without
* // `markAsUntransferable()`, this would print an empty Uint8Array.
* // typedArray2 is intact as well.
* console.log(typedArray1);
* console.log(typedArray2);
* ```
*
* There is no equivalent to this API in browsers.
* @since v14.5.0, v12.19.0
*/
function markAsUntransferable(object: object): void;
/**
* Check if an object is marked as not transferable with
* {@link markAsUntransferable}.
* @since v21.0.0
*/
function isMarkedAsUntransferable(object: object): boolean;
/**
* Mark an object as not cloneable. If `object` is used as `message` in
* a `port.postMessage()` call, an error is thrown. This is a no-op if `object` is a
* primitive value.
*
* This has no effect on `ArrayBuffer`, or any `Buffer` like objects.
*
* This operation cannot be undone.
*
* ```js
* const { markAsUncloneable } = require('node:worker_threads');
*
* const anyObject = { foo: 'bar' };
* markAsUncloneable(anyObject);
* const { port1 } = new MessageChannel();
* try {
* // This will throw an error, because anyObject is not cloneable.
* port1.postMessage(anyObject)
* } catch (error) {
* // error.name === 'DataCloneError'
* }
* ```
*
* There is no equivalent to this API in browsers.
* @since v22.10.0
*/
function markAsUncloneable(object: object): void;
/**
* Transfer a `MessagePort` to a different `vm` Context. The original `port` object is rendered unusable, and the returned `MessagePort` instance
* takes its place.
*
* The returned `MessagePort` is an object in the target context and
* inherits from its global `Object` class. Objects passed to the [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) listener are also created in the
* target context
* and inherit from its global `Object` class.
*
* However, the created `MessagePort` no longer inherits from [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget), and only
* [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) can be used to receive
* events using it.
* @since v11.13.0
* @param port The message port to transfer.
* @param contextifiedSandbox A `contextified` object as returned by the `vm.createContext()` method.
*/
function moveMessagePortToContext(port: MessagePort, contextifiedSandbox: Context): MessagePort;
/**
* Receive a single message from a given `MessagePort`. If no message is available,`undefined` is returned, otherwise an object with a single `message` property
* that contains the message payload, corresponding to the oldest message in the `MessagePort`'s queue.
*
* ```js
* import { MessageChannel, receiveMessageOnPort } from 'node:worker_threads';
* const { port1, port2 } = new MessageChannel();
* port1.postMessage({ hello: 'world' });
*
* console.log(receiveMessageOnPort(port2));
* // Prints: { message: { hello: 'world' } }
* console.log(receiveMessageOnPort(port2));
* // Prints: undefined
* ```
*
* When this function is used, no `'message'` event is emitted and the `onmessage` listener is not invoked.
* @since v12.3.0
*/
function receiveMessageOnPort(port: MessagePort):
| {
message: any;
}
| undefined;
type Serializable = string | object | number | boolean | bigint;
/**
* Within a worker thread, `worker.getEnvironmentData()` returns a clone
* of data passed to the spawning thread's `worker.setEnvironmentData()`.
* Every new `Worker` receives its own copy of the environment data
* automatically.
*
* ```js
* import {
* Worker,
* isMainThread,
* setEnvironmentData,
* getEnvironmentData,
* } from 'node:worker_threads';
*
* if (isMainThread) {
* setEnvironmentData('Hello', 'World!');
* const worker = new Worker(new URL(import.meta.url));
* } else {
* console.log(getEnvironmentData('Hello')); // Prints 'World!'.
* }
* ```
* @since v15.12.0, v14.18.0
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map Map} key.
*/
function getEnvironmentData(key: Serializable): Serializable;
/**
* The `worker.setEnvironmentData()` API sets the content of `worker.getEnvironmentData()` in the current thread and all new `Worker` instances spawned from the current context.
* @since v15.12.0, v14.18.0
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
* @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value
* for the `key` will be deleted.
*/
function setEnvironmentData(key: Serializable, value?: Serializable): void;
/**
* Sends a value to another worker, identified by its thread ID.
* @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
* If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
* @param value The value to send.
* @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
* or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
* @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
* If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
* @since v22.5.0
*/
function postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
function postMessageToThread(
threadId: number,
value: any,
transferList: readonly Transferable[],
timeout?: number,
): Promise<void>;
import {
BroadcastChannel as _BroadcastChannel,
MessageChannel as _MessageChannel,
MessagePort as _MessagePort,
} from "worker_threads";
global {
function structuredClone<T>(
value: T,
options?: { transfer?: Transferable[] },
): T;
/**
* `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'worker_threads'`
* https://nodejs.org/api/globals.html#broadcastchannel
* @since v18.0.0
*/
var BroadcastChannel: typeof globalThis extends {
onmessage: any;
BroadcastChannel: infer T;
} ? T
: typeof _BroadcastChannel;
/**
* `MessageChannel` class is a global reference for `import { MessageChannel } from 'worker_threads'`
* https://nodejs.org/api/globals.html#messagechannel
* @since v15.0.0
*/
var MessageChannel: typeof globalThis extends {
onmessage: any;
MessageChannel: infer T;
} ? T
: typeof _MessageChannel;
/**
* `MessagePort` class is a global reference for `import { MessagePort } from 'worker_threads'`
* https://nodejs.org/api/globals.html#messageport
* @since v15.0.0
*/
var MessagePort: typeof globalThis extends {
onmessage: any;
MessagePort: infer T;
} ? T
: typeof _MessagePort;
}
}
declare module "node:worker_threads" {
export * from "worker_threads";
}
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Cherry = createLucideIcon("Cherry", [
["path", { d: "M2 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z", key: "cvxqlc" }],
["path", { d: "M12 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z", key: "1ostrc" }],
["path", { d: "M7 14c3.22-2.91 4.29-8.75 5-12 1.66 2.38 4.94 9 5 12", key: "hqx58h" }],
["path", { d: "M22 9c-4.29 0-7.14-2.33-10-7 5.71 0 10 4.67 10 7Z", key: "eykp1o" }]
]);
export { Cherry as default };
//# sourceMappingURL=cherry.js.map
@@ -0,0 +1,138 @@
/**
* @fileoverview Validates newlines before and after dots
* @author Greg Cochard
* @deprecated in ESLint v8.53.0
*/
"use strict";
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "11.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin",
url: "https://eslint.style",
},
rule: {
name: "dot-location",
url: "https://eslint.style/rules/dot-location",
},
},
],
},
type: "layout",
docs: {
description: "Enforce consistent newlines before and after dots",
recommended: false,
url: "https://eslint.org/docs/latest/rules/dot-location",
},
schema: [
{
enum: ["object", "property"],
},
],
fixable: "code",
messages: {
expectedDotAfterObject:
"Expected dot to be on same line as object.",
expectedDotBeforeProperty:
"Expected dot to be on same line as property.",
},
},
create(context) {
const config = context.options[0];
// default to onObject if no preference is passed
const onObject = config === "object" || !config;
const sourceCode = context.sourceCode;
/**
* Reports if the dot between object and property is on the correct location.
* @param {ASTNode} node The `MemberExpression` node.
* @returns {void}
*/
function checkDotLocation(node) {
const property = node.property;
const dotToken = sourceCode.getTokenBefore(property);
if (onObject) {
// `obj` expression can be parenthesized, but those paren tokens are not a part of the `obj` node.
const tokenBeforeDot = sourceCode.getTokenBefore(dotToken);
if (!astUtils.isTokenOnSameLine(tokenBeforeDot, dotToken)) {
context.report({
node,
loc: dotToken.loc,
messageId: "expectedDotAfterObject",
*fix(fixer) {
if (
dotToken.value.startsWith(".") &&
astUtils.isDecimalIntegerNumericToken(
tokenBeforeDot,
)
) {
yield fixer.insertTextAfter(
tokenBeforeDot,
` ${dotToken.value}`,
);
} else {
yield fixer.insertTextAfter(
tokenBeforeDot,
dotToken.value,
);
}
yield fixer.remove(dotToken);
},
});
}
} else if (!astUtils.isTokenOnSameLine(dotToken, property)) {
context.report({
node,
loc: dotToken.loc,
messageId: "expectedDotBeforeProperty",
*fix(fixer) {
yield fixer.remove(dotToken);
yield fixer.insertTextBefore(property, dotToken.value);
},
});
}
}
/**
* Checks the spacing of the dot within a member expression.
* @param {ASTNode} node The node to check.
* @returns {void}
*/
function checkNode(node) {
if (!node.computed) {
checkDotLocation(node);
}
}
return {
MemberExpression: checkNode,
};
},
};
@@ -0,0 +1,198 @@
'use strict'
const buffer = require('node:buffer')
const Dispatcher = require('./dispatcher')
const {
ClientDestroyedError,
ClientClosedError,
InvalidArgumentError
} = require('../core/errors')
const { kDestroy, kClose, kClosed, kDestroyed, kDispatch } = require('../core/symbols')
const { defaultWebSocketMaxFragments, defaultWebSocketMaxPayloadSize } = require('../core/constants')
const kOnDestroyed = Symbol('onDestroyed')
const kOnClosed = Symbol('onClosed')
const kWebSocketOptions = Symbol('webSocketOptions')
const kEventSourceOptions = Symbol('eventSourceOptions')
class DispatcherBase extends Dispatcher {
/** @type {boolean} */
[kDestroyed] = false;
/** @type {Array<Function|null} */
[kOnDestroyed] = null;
/** @type {boolean} */
[kClosed] = false;
/** @type {Array<Function>|null} */
[kOnClosed] = null
/**
* @param {import('../../types/dispatcher').DispatcherOptions} [opts]
*/
constructor (opts) {
super()
this[kWebSocketOptions] = opts?.webSocket ?? {}
this[kEventSourceOptions] = opts?.eventSource ?? {}
}
/**
* @returns {import('../../types/client').Client.WebSocketOptions}
*/
get webSocketOptions () {
return {
maxFragments: this[kWebSocketOptions].maxFragments ?? defaultWebSocketMaxFragments,
maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? defaultWebSocketMaxPayloadSize
}
}
/**
* @returns {import('../../types/client').Client.EventSourceOptions}
*/
get eventSourceOptions () {
return {
maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer.kStringMaxLength
}
}
/** @returns {boolean} */
get destroyed () {
return this[kDestroyed]
}
/** @returns {boolean} */
get closed () {
return this[kClosed]
}
close (callback) {
if (callback === undefined) {
return new Promise((resolve, reject) => {
this.close((err, data) => {
return err ? reject(err) : resolve(data)
})
})
}
if (typeof callback !== 'function') {
throw new InvalidArgumentError('invalid callback')
}
if (this[kDestroyed]) {
const err = new ClientDestroyedError()
queueMicrotask(() => callback(err, null))
return
}
if (this[kClosed]) {
if (this[kOnClosed]) {
this[kOnClosed].push(callback)
} else {
queueMicrotask(() => callback(null, null))
}
return
}
this[kClosed] = true
this[kOnClosed] ??= []
this[kOnClosed].push(callback)
const onClosed = () => {
const callbacks = this[kOnClosed]
this[kOnClosed] = null
for (let i = 0; i < callbacks.length; i++) {
callbacks[i](null, null)
}
}
// Should not error.
this[kClose]()
.then(() => this.destroy())
.then(() => queueMicrotask(onClosed))
}
destroy (err, callback) {
if (typeof err === 'function') {
callback = err
err = null
}
if (callback === undefined) {
return new Promise((resolve, reject) => {
this.destroy(err, (err, data) => {
return err ? reject(err) : resolve(data)
})
})
}
if (typeof callback !== 'function') {
throw new InvalidArgumentError('invalid callback')
}
if (this[kDestroyed]) {
if (this[kOnDestroyed]) {
this[kOnDestroyed].push(callback)
} else {
queueMicrotask(() => callback(null, null))
}
return
}
if (!err) {
err = new ClientDestroyedError()
}
this[kDestroyed] = true
this[kOnDestroyed] ??= []
this[kOnDestroyed].push(callback)
const onDestroyed = () => {
const callbacks = this[kOnDestroyed]
this[kOnDestroyed] = null
for (let i = 0; i < callbacks.length; i++) {
callbacks[i](null, null)
}
}
// Should not error.
this[kDestroy](err)
.then(() => queueMicrotask(onDestroyed))
}
dispatch (opts, handler) {
if (!handler || typeof handler !== 'object') {
throw new InvalidArgumentError('handler must be an object')
}
try {
if (!opts || typeof opts !== 'object') {
throw new InvalidArgumentError('opts must be an object.')
}
if (opts.dispatcher) {
throw new InvalidArgumentError('opts.dispatcher is not supported by instance methods. Pass opts.dispatcher to the top-level undici functions or call the dispatcher instance method directly.')
}
if (this[kDestroyed] || this[kOnDestroyed]) {
throw new ClientDestroyedError()
}
if (this[kClosed]) {
throw new ClientClosedError()
}
return this[kDispatch](opts, handler)
} catch (err) {
if (typeof handler.onResponseError !== 'function') {
throw err
}
handler.onResponseError(null, err)
return false
}
}
}
module.exports = DispatcherBase
@@ -0,0 +1,177 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Natsu @xiaoxiaojx
This file contains code ported from strip-json-comments:
https://github.com/sindresorhus/strip-json-comments
Original license: MIT
Original author: Sindre Sorhus
*/
"use strict";
/**
* @typedef {object} StripJsonCommentsOptions
* @property {boolean=} whitespace Replace comments with whitespace
* @property {boolean=} trailingCommas Strip trailing commas
*/
const singleComment = Symbol("singleComment");
const multiComment = Symbol("multiComment");
/**
* Strip without whitespace (returns empty string)
* @param {string} _string Unused
* @param {number} _start Unused
* @param {number} _end Unused
* @returns {string} Empty string for all input
*/
const stripWithoutWhitespace = (_string, _start, _end) => "";
/**
* Replace all characters except ASCII spaces, tabs and line endings with regular spaces to ensure valid JSON output.
* @param {string} string String to process
* @param {number} start Start index
* @param {number} end End index
* @returns {string} Processed string with comments replaced by whitespace
*/
const stripWithWhitespace = (string, start, end) =>
string.slice(start, end).replace(/[^ \t\r\n]/g, " ");
/**
* Check if a quote is escaped
* @param {string} jsonString JSON string
* @param {number} quotePosition Position of the quote
* @returns {boolean} True if the quote at the given position is escaped
*/
const isEscaped = (jsonString, quotePosition) => {
let index = quotePosition - 1;
let backslashCount = 0;
while (jsonString[index] === "\\") {
index -= 1;
backslashCount += 1;
}
return Boolean(backslashCount % 2);
};
/**
* Strip comments from JSON string
* @param {string} jsonString JSON string with potential comments
* @param {StripJsonCommentsOptions} options Options
* @returns {string} JSON string without comments
*/
function stripJsonComments(
jsonString,
{ whitespace = true, trailingCommas = false } = {},
) {
if (typeof jsonString !== "string") {
throw new TypeError(
`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``,
);
}
const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
let isInsideString = false;
/** @type {false | typeof singleComment | typeof multiComment} */
let isInsideComment = false;
let offset = 0;
let buffer = "";
let result = "";
let commaIndex = -1;
for (let index = 0; index < jsonString.length; index++) {
const currentCharacter = jsonString[index];
const nextCharacter = jsonString[index + 1];
if (!isInsideComment && currentCharacter === '"') {
// Enter or exit string
const escaped = isEscaped(jsonString, index);
if (!escaped) {
isInsideString = !isInsideString;
}
}
if (isInsideString) {
continue;
}
if (!isInsideComment && currentCharacter + nextCharacter === "//") {
// Enter single-line comment
buffer += jsonString.slice(offset, index);
offset = index;
isInsideComment = singleComment;
index++;
} else if (
isInsideComment === singleComment &&
currentCharacter + nextCharacter === "\r\n"
) {
// Exit single-line comment via \r\n
index++;
isInsideComment = false;
buffer += strip(jsonString, offset, index);
offset = index;
continue;
} else if (isInsideComment === singleComment && currentCharacter === "\n") {
// Exit single-line comment via \n
isInsideComment = false;
buffer += strip(jsonString, offset, index);
offset = index;
} else if (!isInsideComment && currentCharacter + nextCharacter === "/*") {
// Enter multiline comment
buffer += jsonString.slice(offset, index);
offset = index;
isInsideComment = multiComment;
index++;
continue;
} else if (
isInsideComment === multiComment &&
currentCharacter + nextCharacter === "*/"
) {
// Exit multiline comment
index++;
isInsideComment = false;
buffer += strip(jsonString, offset, index + 1);
offset = index + 1;
continue;
} else if (trailingCommas && !isInsideComment) {
if (commaIndex !== -1) {
if (currentCharacter === "}" || currentCharacter === "]") {
// Strip trailing comma
buffer += jsonString.slice(offset, index);
result += strip(buffer, 0, 1) + buffer.slice(1);
buffer = "";
offset = index;
commaIndex = -1;
} else if (
currentCharacter !== " " &&
currentCharacter !== "\t" &&
currentCharacter !== "\r" &&
currentCharacter !== "\n"
) {
// Hit non-whitespace following a comma; comma is not trailing
buffer += jsonString.slice(offset, index);
offset = index;
commaIndex = -1;
}
} else if (currentCharacter === ",") {
// Flush buffer prior to this point, and save new comma index
result += buffer + jsonString.slice(offset, index);
buffer = "";
offset = index;
commaIndex = index;
}
}
}
const remaining =
isInsideComment === singleComment
? strip(jsonString, offset, jsonString.length)
: jsonString.slice(offset);
return result + buffer + remaining;
}
module.exports = stripJsonComments;
@@ -0,0 +1,4 @@
declare const distance: (a: string, b: string) => number;
declare const closest: (str: string, arr: readonly string[]) => string;
export { closest, distance };
//# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1,138 @@
/* eslint-disable @typescript-eslint/unified-signatures */
import {Options as LocatePathOptions} from 'locate-path';
declare const stop: unique symbol;
declare namespace findUp {
interface Options extends LocatePathOptions {}
type StopSymbol = typeof stop;
type Match = string | StopSymbol | undefined;
}
declare const findUp: {
sync: {
/**
Synchronously check if a path exists.
@param path - Path to the file or directory.
@returns Whether the path exists.
@example
```
import findUp = require('find-up');
console.log(findUp.sync.exists('/Users/sindresorhus/unicorn.png'));
//=> true
```
*/
exists: (path: string) => boolean;
/**
Synchronously find a file or directory by walking up parent directories.
@param name - Name of the file or directory to find. Can be multiple.
@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
*/
(name: string | readonly string[], options?: findUp.Options): string | undefined;
/**
Synchronously find a file or directory by walking up parent directories.
@param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.
@returns The first path found or `undefined` if none could be found.
@example
```
import path = require('path');
import findUp = require('find-up');
console.log(findUp.sync(directory => {
const hasUnicorns = findUp.sync.exists(path.join(directory, 'unicorn.png'));
return hasUnicorns && directory;
}, {type: 'directory'}));
//=> '/Users/sindresorhus'
```
*/
(matcher: (directory: string) => findUp.Match, options?: findUp.Options): string | undefined;
};
/**
Check if a path exists.
@param path - Path to a file or directory.
@returns Whether the path exists.
@example
```
import findUp = require('find-up');
(async () => {
console.log(await findUp.exists('/Users/sindresorhus/unicorn.png'));
//=> true
})();
```
*/
exists: (path: string) => Promise<boolean>;
/**
Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`.
*/
readonly stop: findUp.StopSymbol;
/**
Find a file or directory by walking up parent directories.
@param name - Name of the file or directory to find. Can be multiple.
@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.
@example
```
// /
// └── Users
// └── sindresorhus
// ├── unicorn.png
// └── foo
// └── bar
// ├── baz
// └── example.js
// example.js
import findUp = require('find-up');
(async () => {
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
})();
```
*/
(name: string | readonly string[], options?: findUp.Options): Promise<string | undefined>;
/**
Find a file or directory by walking up parent directories.
@param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.
@returns The first path found or `undefined` if none could be found.
@example
```
import path = require('path');
import findUp = require('find-up');
(async () => {
console.log(await findUp(async directory => {
const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png'));
return hasUnicorns && directory;
}, {type: 'directory'}));
//=> '/Users/sindresorhus'
})();
```
*/
(matcher: (directory: string) => (findUp.Match | Promise<findUp.Match>), options?: findUp.Options): Promise<string | undefined>;
};
export = findUp;