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,"names":["_remapping","data","require","mergeSourceMap","inputMap","map","sourceFileName","source","replace","found","result","remapping","rootless","s","ctx","sourceRoot","Object","assign"],"sources":["../../../src/transformation/file/merge-map.ts"],"sourcesContent":["type SourceMap = any;\nimport remapping from \"@jridgewell/remapping\";\n\nexport default function mergeSourceMap(\n inputMap: SourceMap,\n map: SourceMap,\n sourceFileName: string,\n): SourceMap {\n // On win32 machines, the sourceFileName uses backslash paths like\n // `C:\\foo\\bar.js`. But sourcemaps are always posix paths, so we need to\n // normalize to regular slashes before we can merge (else we won't find the\n // source associated with our input map).\n // This mirrors code done while generating the output map at\n // https://github.com/babel/babel/blob/5c2fcadc9ae34fd20dd72b1111d5cf50476d700d/packages/babel-generator/src/source-map.ts#L102\n const source = sourceFileName.replace(/\\\\/g, \"/\");\n\n // Prevent an infinite recursion if one of the input map's sources has the\n // same resolved path as the input map. In the case, it would keep find the\n // input map, then get it's sources which will include a path like the input\n // map, on and on.\n let found = false;\n const result = remapping(rootless(map), (s, ctx) => {\n if (s === source && !found) {\n found = true;\n // We empty the source location, which will prevent the sourcemap from\n // becoming relative to the input's location. Eg, if we're transforming a\n // file 'foo/bar.js', and it is a transformation of a `baz.js` file in the\n // same directory, the expected output is just `baz.js`. Without this step,\n // it would become `foo/baz.js`.\n ctx.source = \"\";\n\n return rootless(inputMap);\n }\n\n return null;\n });\n\n if (typeof inputMap.sourceRoot === \"string\") {\n result.sourceRoot = inputMap.sourceRoot;\n }\n\n // remapping returns a SourceMap class type, but this breaks code downstream in\n // @babel/traverse and @babel/types that relies on data being plain objects.\n // When it encounters the sourcemap type it outputs a \"don't know how to turn\n // this value into a node\" error. As a result, we are converting the merged\n // sourcemap to a plain js object.\n return { ...result };\n}\n\nfunction rootless(map: SourceMap): SourceMap {\n return {\n ...map,\n\n // This is a bit hack. Remapping will create absolute sources in our\n // sourcemap, but we want to maintain sources relative to the sourceRoot.\n // We'll re-add the sourceRoot after remapping.\n sourceRoot: null,\n };\n}\n"],"mappings":";;;;;;AACA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEe,SAASE,cAAcA,CACpCC,QAAmB,EACnBC,GAAc,EACdC,cAAsB,EACX;EAOX,MAAMC,MAAM,GAAGD,cAAc,CAACE,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;EAMjD,IAAIC,KAAK,GAAG,KAAK;EACjB,MAAMC,MAAM,GAAGC,WAAQA,CAAC,CAACC,QAAQ,CAACP,GAAG,CAAC,EAAE,CAACQ,CAAC,EAAEC,GAAG,KAAK;IAClD,IAAID,CAAC,KAAKN,MAAM,IAAI,CAACE,KAAK,EAAE;MAC1BA,KAAK,GAAG,IAAI;MAMZK,GAAG,CAACP,MAAM,GAAG,EAAE;MAEf,OAAOK,QAAQ,CAACR,QAAQ,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb,CAAC,CAAC;EAEF,IAAI,OAAOA,QAAQ,CAACW,UAAU,KAAK,QAAQ,EAAE;IAC3CL,MAAM,CAACK,UAAU,GAAGX,QAAQ,CAACW,UAAU;EACzC;EAOA,OAAAC,MAAA,CAAAC,MAAA,KAAYP,MAAM;AACpB;AAEA,SAASE,QAAQA,CAACP,GAAc,EAAa;EAC3C,OAAAW,MAAA,CAAAC,MAAA,KACKZ,GAAG;IAKNU,UAAU,EAAE;EAAI;AAEpB;AAAC","ignoreList":[]}
@@ -0,0 +1,53 @@
import type { EntryTypeCode, EntryTypeName } from './types.js';
export type HeaderData = {
path?: string;
mode?: number;
uid?: number;
gid?: number;
size?: number;
cksum?: number;
type?: EntryTypeName | 'Unsupported';
linkpath?: string;
uname?: string;
gname?: string;
devmaj?: number;
devmin?: number;
atime?: Date;
ctime?: Date;
mtime?: Date;
charset?: string;
comment?: string;
dev?: number;
ino?: number;
nlink?: number;
};
export declare class Header implements HeaderData {
#private;
cksumValid: boolean;
needPax: boolean;
nullBlock: boolean;
block?: Buffer;
path?: string;
mode?: number;
uid?: number;
gid?: number;
size?: number;
cksum?: number;
linkpath?: string;
uname?: string;
gname?: string;
devmaj: number;
devmin: number;
atime?: Date;
ctime?: Date;
mtime?: Date;
charset?: string;
comment?: string;
constructor(data?: Buffer | HeaderData, off?: number, ex?: HeaderData, gex?: HeaderData);
decode(buf: Buffer, off: number, ex?: HeaderData, gex?: HeaderData): void;
encode(buf?: Buffer, off?: number): boolean;
get type(): EntryTypeName;
get typeKey(): EntryTypeCode | 'Unsupported';
set type(type: EntryTypeCode | EntryTypeName | 'Unsupported');
}
//# sourceMappingURL=header.d.ts.map
@@ -0,0 +1,13 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_ssr_server = require("./ssr-server.cjs");
const require_createRequestHandler = require("./createRequestHandler.cjs");
const require_handlerCallback = require("./handlerCallback.cjs");
const require_transformStreamWithRouter = require("./transformStreamWithRouter.cjs");
exports.attachRouterServerSsrUtils = require_ssr_server.attachRouterServerSsrUtils;
exports.createRequestHandler = require_createRequestHandler.createRequestHandler;
exports.defineHandlerCallback = require_handlerCallback.defineHandlerCallback;
exports.getNormalizedURL = require_ssr_server.getNormalizedURL;
exports.getOrigin = require_ssr_server.getOrigin;
exports.transformPipeableStreamWithRouter = require_transformStreamWithRouter.transformPipeableStreamWithRouter;
exports.transformReadableStreamWithRouter = require_transformStreamWithRouter.transformReadableStreamWithRouter;
exports.transformStreamWithRouter = require_transformStreamWithRouter.transformStreamWithRouter;
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Anton Kastritskiy
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,311 @@
import * as util from "./util.js";
export class $ZodCyclicError extends Error {
constructor() {
super(`Cannot parse a reference cycle that closes through a transform`);
this.name = "ZodCyclicError";
}
}
/** Keyed off the context object every schema in one parse call already shares. */
const STATE = "~memo";
const NO_ISSUES = [];
// a value a cycle can close through
function isRef(value) {
return value !== null && typeof value === "object";
}
// Receivers prefix paths in place, so the cache and every hand-out need their own copies.
function cloneIssues(issues) {
return issues.map((iss) => (iss.path ? { ...iss, path: iss.path.slice() } : { ...iss }));
}
const recursive = /*@__PURE__*/ new WeakMap();
/** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
const NONE = 0;
const ASSUMED = 1;
const PROVEN = 2;
/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
function isRecursive(inst, stack, resolve) {
const cached = recursive.get(inst);
if (cached !== undefined)
return cached ? PROVEN : NONE;
// Relative to the walk in progress, so not cached.
if (stack.has(inst))
return PROVEN;
stack.add(inst);
let result = NONE;
const check = (child) => {
if (result !== PROVEN && child?._zod) {
const answer = isRecursive(child, stack, resolve);
if (answer > result)
result = answer;
}
};
// `Reflect.ownKeys` rather than `Object.keys`, so a cycle through a declared symbol key is still seen
const shape = (sh, spread) => {
let answer = NONE;
for (const key of Reflect.ownKeys(sh)) {
const desc = Object.getOwnPropertyDescriptor(sh, key);
// an object resolves its shape by spread, so a key it does not enumerate is never parsed; `z.properties` reads every own key and so keeps them all
if (spread && !desc.enumerable)
continue;
// resolving runs user code, and a factory mints a fresh subtree per read, so an edge the walk can't follow counts as a cycle
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
if (child > answer)
answer = child;
}
return answer;
};
const merge = (answer) => {
if (answer > result)
result = answer;
};
const def = inst._zod.def;
const kind = def.type;
switch (kind) {
case "object": {
const raw = util.rawShape(def);
// a def with no raw shape answers `shape` from an accessor of its own, and running that can mint a whole fresh subtree
merge(raw ? shape(raw, true) : ASSUMED);
check(def.catchall);
break;
}
case "array":
check(def.element);
break;
case "tuple":
for (const el of def.items)
check(el);
check(def.rest);
break;
case "record":
case "map":
check(def.keyType);
check(def.valueType);
break;
case "set":
check(def.valueType);
break;
case "union":
for (const el of def.options)
check(el);
break;
case "intersection":
check(def.left);
check(def.right);
break;
case "optional":
case "nullable":
case "default":
case "prefault":
case "catch":
case "readonly":
case "nonoptional":
case "promise":
case "success":
check(def.innerType);
break;
case "pipe":
check(def.in);
check(def.out);
break;
case "function":
check(def.input);
check(def.output);
break;
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
case "lazy": {
const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : undefined);
// walked with resolution off: one hop sees past the deferral, and a lazy that yields only another unresolved lazy is generative, so it stops there
merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
break;
}
// a leaf by choice: `parts` are regex fragments, not data positions
case "template_literal":
// leaves
case "string":
case "number":
case "int":
case "boolean":
case "bigint":
case "symbol":
case "undefined":
case "null":
case "void":
case "never":
case "any":
case "unknown":
case "date":
case "nan":
case "enum":
case "literal":
case "file":
case "transform":
case "custom":
break;
default: {
// a new built-in kind becomes a compile error here
kind;
// a user-defined kind can still hold children, and only its author knows where, so fall back to scanning the def — skipping accessors, since reading one can run user code
for (const key in def) {
const desc = Object.getOwnPropertyDescriptor(def, key);
if (!desc || desc.get)
continue;
const value = desc.value;
if (!value || typeof value !== "object")
continue;
if (value._zod)
check(value);
else if (Array.isArray(value))
for (const el of value)
check(el);
}
}
}
stack.delete(inst);
return settle(inst, result);
}
/** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
function settle(inst, answer) {
if (answer !== ASSUMED)
recursive.set(inst, answer === PROVEN);
return answer;
}
/**
* Whether one parse can re-enter this schema, i.e. its subtree contains a cycle.
* Exported for `z.compile`, which refuses to compile such a schema: cycle
* breaking is driven from here off state keyed on the parse context, and a
* generated fast path has no context to key on.
*/
export function isRecursiveSchema(inst) {
// z.compile never parses, so nothing would ever resolve a lazy for it; it runs once and already treats a throw here as recursive
return isRecursive(inst, new Set(), true) !== NONE;
}
function bucketFor(state, inst) {
let bucket = state.buckets.get(inst);
if (!bucket) {
bucket = new WeakMap();
state.buckets.set(inst, bucket);
}
return bucket;
}
// Set immediately before delegating to core and cleared immediately after, so `alloc` registers only for a visit this module is driving.
let handoff;
// Allocated but unfinished entries. `alloc` and the matching pop both happen in the synchronous part of a parse, so they nest even when children are async, and one stack serves every schema.
const open = [];
const memo = {
alloc(_inst, payload, empty) {
const bucket = handoff;
if (!bucket)
return empty;
handoff = undefined;
const entry = { value: empty, issues: null };
bucket.set(payload.value, entry);
open.push(entry);
return empty;
},
guard(inst) {
var _a;
(_a = inst._zod).deferred ?? (_a.deferred = []);
inst._zod.deferred.push(() => {
const base = inst._zod.parse;
const wrapped = (payload, ctx) => {
// The value is a placeholder a back-edge is still waiting on, so the cycle closes through this transform. Its output can't exist in time to bind.
if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value))
throw new $ZodCyclicError();
return base(payload, ctx);
};
inst._zod.parse = wrapped;
if (inst._zod.run === base)
inst._zod.run = wrapped;
});
},
attach(inst) {
var _a;
let isRecursiveInst;
let rechecked = false;
// a recursive schema is re-entered many times per parse and its bucket never changes
let lastCtx;
let lastBucket;
// Wraps `parse` in a deferred so it sees the container's final parse. Core's own deferred copies `parse` into `run` when there are no checks, and it ran first, so `run` is patched to match; with checks, `run` reads `parse` dynamically.
(_a = inst._zod).deferred ?? (_a.deferred = []);
inst._zod.deferred.push(() => {
const base = inst._zod.parse;
const wrapped = (payload, ctx) => {
if (isRecursiveInst === undefined) {
const walked = isRecursive(inst, new Set(), false);
if (walked === NONE) {
// Nothing here can ever fire, so take it back out.
inst._zod.parse = base;
if (inst._zod.run === wrapped)
inst._zod.run = base;
return base(payload, ctx);
}
// this parse resolves the deferred edges on its own path, so ask once more before latching
if (walked === PROVEN || rechecked)
isRecursiveInst = true;
else
rechecked = true;
}
const input = payload.value;
if (!isRef(input))
return base(payload, ctx);
let state = ctx[STATE];
if (!state) {
state = { buckets: new WeakMap(), backEdges: undefined };
ctx[STATE] = state;
}
let bucket;
if (lastCtx === ctx) {
bucket = lastBucket;
}
else {
bucket = bucketFor(state, inst);
lastCtx = ctx;
lastBucket = bucket;
}
const hit = bucket.get(input);
if (hit) {
payload.value = hit.value;
if (hit.issues) {
if (hit.issues.length)
payload.issues.push(...cloneIssues(hit.issues));
}
else {
// Still being parsed: its own checks cover it, so skip them here.
payload.memo = true;
state.backEdges ?? (state.backEdges = new WeakSet());
state.backEdges.add(hit.value);
}
return payload;
}
handoff = bucket;
const depth = open.length;
const result = base(payload, ctx);
handoff = undefined;
// A container that rejected its input outright allocated nothing.
const entry = open.length > depth ? open.pop() : undefined;
// Both paths written out so the sync one allocates no closure. It runs once per node, and capturing here cost more than everything else combined.
if (result instanceof Promise) {
return result.then((r) => {
if (entry)
entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
return r;
});
}
if (entry)
entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
return result;
};
inst._zod.parse = wrapped;
if (inst._zod.run === base)
inst._zod.run = wrapped;
});
},
};
/** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
export function memoizer() {
return memo;
}
/** Whether this value is a node a back-edge resolved to before it finished. */
export function isBackEdge(ctx, value) {
const backEdges = ctx[STATE]?.backEdges;
return backEdges !== undefined && isRef(value) && backEdges.has(value);
}
@@ -0,0 +1 @@
{"version":3,"file":"badge-pound-sterling.js","sources":["../../../src/icons/badge-pound-sterling.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BadgePoundSterling\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMy44NSA4LjYyYTQgNCAwIDAgMSA0Ljc4LTQuNzcgNCA0IDAgMCAxIDYuNzQgMCA0IDQgMCAwIDEgNC43OCA0Ljc4IDQgNCAwIDAgMSAwIDYuNzQgNCA0IDAgMCAxLTQuNzcgNC43OCA0IDQgMCAwIDEtNi43NSAwIDQgNCAwIDAgMS00Ljc4LTQuNzcgNCA0IDAgMCAxIDAtNi43NloiIC8+CiAgPHBhdGggZD0iTTggMTJoNCIgLz4KICA8cGF0aCBkPSJNMTAgMTZWOS41YTIuNSAyLjUgMCAwIDEgNSAwIiAvPgogIDxwYXRoIGQ9Ik04IDE2aDciIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/badge-pound-sterling\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 BadgePoundSterling = createLucideIcon('BadgePoundSterling', [\n [\n 'path',\n {\n d: 'M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z',\n key: '3c2336',\n },\n ],\n ['path', { d: 'M8 12h4', key: 'qz6y1c' }],\n ['path', { d: 'M10 16V9.5a2.5 2.5 0 0 1 5 0', key: '3mlbjk' }],\n ['path', { d: 'M8 16h7', key: 'sbedsn' }],\n]);\n\nexport default BadgePoundSterling;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,iBAAiB,oBAAsB,CAAA,CAAA,CAAA;AAAA,CAChE,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,C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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC7D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,16 @@
/**
* Adds a specified number of minutes to a date.
* 向日期添加指定数量的分钟。
*
* @param date - The date to add minutes to. (要添加分钟的日期。)
* @param minutes - The number of minutes to add. (要添加的分钟数。)
* @returns A new date with the added minutes. (添加分钟后的新日期。)
* @example
* ```ts
* // Adding 30 minutes to a date (向日期添加30分钟)
* const originalDate = new Date('2023-10-01T12:00:00');
* addMinutes(originalDate, 30);
* console.log(originalDate.toISOString()); // Outputs: '2023-10-01T12:30:00.000Z' (输出: '2023-10-01T12:30:00.000Z')
* ```
*/
export default function addMinutes(date: Date, minutes: number): Date;
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/direction.tsx"],
"sourcesContent": ["import * as React from 'react';\n\ntype Direction = 'ltr' | 'rtl';\nconst DirectionContext = React.createContext<Direction | undefined>(undefined);\n\n/* -------------------------------------------------------------------------------------------------\n * Direction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DirectionProviderProps {\n children?: React.ReactNode;\n dir: Direction;\n}\nconst DirectionProvider: React.FC<DirectionProviderProps> = (props) => {\n const { dir, children } = props;\n return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>;\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction useDirection(localDir?: Direction) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || 'ltr';\n}\n\nconst Provider = DirectionProvider;\n\nexport {\n useDirection,\n //\n Provider,\n //\n DirectionProvider,\n};\n"],
"mappings": ";AAAA,YAAY,WAAW;AAed;AAZT,IAAM,mBAAyB,oBAAqC,MAAS;AAU7E,IAAM,oBAAsD,CAAC,UAAU;AACrE,QAAM,EAAE,KAAK,SAAS,IAAI;AAC1B,SAAO,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,KAAM,UAAS;AAC1D;AAIA,SAAS,aAAa,UAAsB;AAC1C,QAAM,YAAkB,iBAAW,gBAAgB;AACnD,SAAO,YAAY,aAAa;AAClC;AAEA,IAAM,WAAW;",
"names": []
}
@@ -0,0 +1,8 @@
// src/use-layout-effect.tsx
import * as React from "react";
var useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {
};
export {
useLayoutEffect2 as useLayoutEffect
};
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,824 @@
flf2a$ 8 7 20 -1 7
TUBULAR by Ron Fritz 8/94
Figlet Release 2.0
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
O~~@
O~~@
O~~@
O~ @
O~ @
@
O~~@
@@
O~ O~@
O~ O~@
@
@
@
@
@
@@
@
O~~ O~~ @
O~~~~~~ O~~~~@
O~~ O~~ @
O~~ O~~ @
O~~~~~~ O~~~~@
O~~ O~~ @
@@
O~~ @
O~ O~~ @
O~~ @
O~~ @
O~~@
O~~ O~~ @
O~~ @
@@
@
O~~ O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~ O~~ @
@@
O~ @
O~~ O~~@
O~~ @
O~~~ @
O~~ @
O~~ O~~@
O~ @
@@
O~~@
O~@
@
@
@
@
@
@@
O~~@
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~@
@@
O~~ @
O~~ @
O~~@
O~~@
O~~@
O~~ @
O~~ @
@@
O~~ @
O~~ O~~ O~~@
O~ O~ O~~ @
O~~~~ O~~~~~~~@
O~ O~ O~~ @
O~~ O~~ O~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
O~~ @
O~~ @
O~~ @
O~~ @
O~~ @
O~~@
@@
O~@
O~@
O~@
@
O~@
O~@
O~@
@@
O~~ @
O~~ @
O~~ @
O~~@
O~~ @
O~~ @
O~~ @
@@
O~~ O~ @
O~ O~~@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@@ -0,0 +1,29 @@
import type { TSESTree } from '@typescript-eslint/utils';
import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule } from '../util';
declare const baseRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMagic", [{
detectObjects?: boolean;
enforceConst?: boolean;
ignore?: (number | string)[];
ignoreArrayIndexes?: boolean;
ignoreEnums?: boolean;
ignoreNumericLiteralTypes?: boolean;
ignoreReadonlyClassProperties?: boolean;
ignoreTypeIndexes?: boolean;
}], unknown, {
Literal(node: TSESTree.Literal): void;
}>;
export type Options = InferOptionsTypeFromRule<typeof baseRule>;
export type MessageIds = InferMessageIdsTypeFromRule<typeof baseRule>;
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMagic", [{
detectObjects?: boolean;
enforceConst?: boolean;
ignore?: (number | string)[];
ignoreArrayIndexes?: boolean;
ignoreEnums?: boolean;
ignoreNumericLiteralTypes?: boolean;
ignoreReadonlyClassProperties?: boolean;
ignoreTypeIndexes?: boolean;
}], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1,42 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABILITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference lib="es2015.iterable" />
/// <reference lib="es2020.intl" />
/// <reference lib="es2020.symbol.wellknown" />
interface String {
/**
* Matches a string with a regular expression, and returns an iterable of matches
* containing the results of that search.
* @param regexp A regular expression
*/
matchAll(regexp: RegExp): RegExpStringIterator<RegExpExecArray>;
/** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */
toLocaleLowerCase(locales?: Intl.LocalesArgument): string;
/** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */
toLocaleUpperCase(locales?: Intl.LocalesArgument): string;
/**
* Determines whether two strings are equivalent in the current or specified locale.
* @param that String to compare to target string
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
*/
localeCompare(that: string, locales?: Intl.LocalesArgument, options?: Intl.CollatorOptions): number;
}
@@ -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 FlashlightOff = createLucideIcon("FlashlightOff", [
["path", { d: "M16 16v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4", key: "1r120k" }],
["path", { d: "M7 2h11v4c0 2-2 2-2 4v1", key: "dz1920" }],
["line", { x1: "11", x2: "18", y1: "6", y2: "6", key: "bi1vpe" }],
["line", { x1: "2", x2: "22", y1: "2", y2: "22", key: "a6p6uj" }]
]);
export { FlashlightOff as default };
//# sourceMappingURL=flashlight-off.js.map
@@ -0,0 +1,57 @@
// 'mime-score' back-ported to CommonJS
// Score RFC facets (see https://tools.ietf.org/html/rfc6838#section-3)
var FACET_SCORES = {
'prs.': 100,
'x-': 200,
'x.': 300,
'vnd.': 400,
default: 900
}
// Score mime source (Logic originally from `jshttp/mime-types` module)
var SOURCE_SCORES = {
nginx: 10,
apache: 20,
iana: 40,
default: 30 // definitions added by `jshttp/mime-db` project?
}
var TYPE_SCORES = {
// prefer application/xml over text/xml
// prefer application/rtf over text/rtf
application: 1,
// prefer font/woff over application/font-woff
font: 2,
// prefer video/mp4 over audio/mp4 over application/mp4
// See https://www.rfc-editor.org/rfc/rfc4337.html#section-2
audio: 2,
video: 3,
default: 0
}
/**
* Get each component of the score for a mime type. The sum of these is the
* total score. The higher the score, the more "official" the type.
*/
module.exports = function mimeScore (mimeType, source = 'default') {
if (mimeType === 'application/octet-stream') {
return 0
}
const [type, subtype] = mimeType.split('/')
const facet = subtype.replace(/(\.|x-).*/, '$1')
const facetScore = FACET_SCORES[facet] || FACET_SCORES.default
const sourceScore = SOURCE_SCORES[source] || SOURCE_SCORES.default
const typeScore = TYPE_SCORES[type] || TYPE_SCORES.default
// All else being equal prefer shorter types
const lengthScore = 1 - mimeType.length / 100
return facetScore + sourceScore + typeScore + lengthScore
}
@@ -0,0 +1,236 @@
#include <memory>
#include <poll.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include "InotifyBackend.hh"
#define INOTIFY_MASK \
IN_ATTRIB | IN_CREATE | IN_DELETE | \
IN_DELETE_SELF | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM | \
IN_MOVED_TO | IN_DONT_FOLLOW | IN_ONLYDIR | IN_EXCL_UNLINK
#define BUFFER_SIZE 8192
#define CONVERT_TIME(ts) ((uint64_t)ts.tv_sec * 1000000000 + ts.tv_nsec)
void InotifyBackend::start() {
// Create a pipe that we will write to when we want to end the thread.
int err = pipe2(mPipe, O_CLOEXEC | O_NONBLOCK);
if (err == -1) {
throw std::runtime_error(std::string("Unable to open pipe: ") + strerror(errno));
}
// Init inotify file descriptor.
mInotify = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
if (mInotify == -1) {
throw std::runtime_error(std::string("Unable to initialize inotify: ") + strerror(errno));
}
pollfd pollfds[2];
pollfds[0].fd = mPipe[0];
pollfds[0].events = POLLIN;
pollfds[0].revents = 0;
pollfds[1].fd = mInotify;
pollfds[1].events = POLLIN;
pollfds[1].revents = 0;
notifyStarted();
// Loop until we get an event from the pipe.
while (true) {
int result = poll(pollfds, 2, 500);
if (result < 0) {
throw std::runtime_error(std::string("Unable to poll: ") + strerror(errno));
}
if (pollfds[0].revents) {
break;
}
if (pollfds[1].revents) {
handleEvents();
}
}
close(mPipe[0]);
close(mPipe[1]);
close(mInotify);
mEndedSignal.notify();
}
InotifyBackend::~InotifyBackend() {
write(mPipe[1], "X", 1);
mEndedSignal.wait();
}
// This function is called by Backend::watch which takes a lock on mMutex
void InotifyBackend::subscribe(WatcherRef watcher) {
// Build a full directory tree recursively, and watch each directory.
std::shared_ptr<DirTree> tree = getTree(watcher);
for (auto it = tree->entries.begin(); it != tree->entries.end(); it++) {
if (it->second.isDir) {
bool success = watchDir(watcher, it->second.path, tree);
if (!success) {
throw WatcherError(std::string("inotify_add_watch on '") + it->second.path + std::string("' failed: ") + strerror(errno), watcher);
}
}
}
}
bool InotifyBackend::watchDir(WatcherRef watcher, std::string path, std::shared_ptr<DirTree> tree) {
int wd = inotify_add_watch(mInotify, path.c_str(), INOTIFY_MASK);
if (wd == -1) {
return false;
}
std::shared_ptr<InotifySubscription> sub = std::make_shared<InotifySubscription>();
sub->tree = tree;
sub->path = path;
sub->watcher = watcher;
mSubscriptions.emplace(wd, sub);
return true;
}
void InotifyBackend::handleEvents() {
char buf[BUFFER_SIZE] __attribute__ ((aligned(__alignof__(struct inotify_event))));;
struct inotify_event *event;
// Track all of the watchers that are touched so we can notify them at the end of the events.
std::unordered_set<WatcherRef> watchers;
while (true) {
int n = read(mInotify, &buf, BUFFER_SIZE);
if (n < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
break;
}
throw std::runtime_error(std::string("Error reading from inotify: ") + strerror(errno));
}
if (n == 0) {
break;
}
for (char *ptr = buf; ptr < buf + n; ptr += sizeof(*event) + event->len) {
event = (struct inotify_event *)ptr;
if ((event->mask & IN_Q_OVERFLOW) == IN_Q_OVERFLOW) {
// overflow
continue;
}
handleEvent(event, watchers);
}
}
for (auto it = watchers.begin(); it != watchers.end(); it++) {
(*it)->notify();
}
}
void InotifyBackend::handleEvent(struct inotify_event *event, std::unordered_set<WatcherRef> &watchers) {
std::unique_lock<std::mutex> lock(mMutex);
// Find the subscriptions for this watch descriptor
auto range = mSubscriptions.equal_range(event->wd);
std::unordered_set<std::shared_ptr<InotifySubscription>> set;
for (auto it = range.first; it != range.second; it++) {
set.insert(it->second);
}
for (auto it = set.begin(); it != set.end(); it++) {
if (handleSubscription(event, *it)) {
watchers.insert((*it)->watcher);
}
}
}
bool InotifyBackend::handleSubscription(struct inotify_event *event, std::shared_ptr<InotifySubscription> sub) {
// Build full path and check if its in our ignore list.
std::shared_ptr<Watcher> watcher = sub->watcher;
std::string path = std::string(sub->path);
bool isDir = event->mask & IN_ISDIR;
if (event->len > 0) {
path += "/" + std::string(event->name);
}
if (watcher->isIgnored(path)) {
return false;
}
// If this is a create, check if it's a directory and start watching if it is.
// In any case, keep the directory tree up to date.
if (event->mask & (IN_CREATE | IN_MOVED_TO)) {
watcher->mEvents.create(path);
struct stat st;
// Use lstat to avoid resolving symbolic links that we cannot watch anyway
// https://github.com/parcel-bundler/watcher/issues/76
if (lstat(path.c_str(), &st) != 0) {
return false;
}
DirEntry *entry = sub->tree->add(path, CONVERT_TIME(st.st_mtim), S_ISDIR(st.st_mode));
if (entry->isDir) {
bool success = watchDir(watcher, path, sub->tree);
if (!success) {
sub->tree->remove(path);
return false;
}
}
} else if (event->mask & (IN_MODIFY | IN_ATTRIB)) {
watcher->mEvents.update(path);
struct stat st;
if (stat(path.c_str(), &st) != 0) {
return false;
}
sub->tree->update(path, CONVERT_TIME(st.st_mtim));
} else if (event->mask & (IN_DELETE | IN_DELETE_SELF | IN_MOVED_FROM | IN_MOVE_SELF)) {
bool isSelfEvent = (event->mask & (IN_DELETE_SELF | IN_MOVE_SELF));
// Ignore delete/move self events unless this is the recursive watch root
if (isSelfEvent && path != watcher->mDir) {
return false;
}
// If the entry being deleted/moved is a directory, remove it from the list of subscriptions
// XXX: self events don't have the IN_ISDIR mask
if (isSelfEvent || isDir) {
for (auto it = mSubscriptions.begin(); it != mSubscriptions.end();) {
if (it->second->path == path) {
it = mSubscriptions.erase(it);
} else {
++it;
}
}
}
watcher->mEvents.remove(path);
sub->tree->remove(path);
}
return true;
}
// This function is called by Backend::unwatch which takes a lock on mMutex
void InotifyBackend::unsubscribe(WatcherRef watcher) {
// Find any subscriptions pointing to this watcher, and remove them.
for (auto it = mSubscriptions.begin(); it != mSubscriptions.end();) {
if (it->second->watcher.get() == watcher.get()) {
if (mSubscriptions.count(it->first) == 1) {
int err = inotify_rm_watch(mInotify, it->first);
if (err == -1) {
throw WatcherError(std::string("Unable to remove watcher: ") + strerror(errno), watcher);
}
}
it = mSubscriptions.erase(it);
} else {
it++;
}
}
}
@@ -0,0 +1,13 @@
export declare type SourceLocation = {
line: number;
column: number;
};
export declare class LinesAndColumns {
private string;
private offsets;
constructor(string: string);
locationForIndex(index: number): SourceLocation | null;
indexForLocation(location: SourceLocation): number | null;
private lengthOfLine;
}
export default LinesAndColumns;
@@ -0,0 +1 @@
{"version":3,"file":"house-plug.js","sources":["../../../src/icons/house-plug.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name HousePlug\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTAgMTJWOC45NjQiIC8+CiAgPHBhdGggZD0iTTE0IDEyVjguOTY0IiAvPgogIDxwYXRoIGQ9Ik0xNSAxMmExIDEgMCAwIDEgMSAxdjJhMiAyIDAgMCAxLTIgMmgtNGEyIDIgMCAwIDEtMi0ydi0yYTEgMSAwIDAgMSAxLTF6IiAvPgogIDxwYXRoIGQ9Ik04LjUgMjFINWEyIDIgMCAwIDEtMi0ydi05YTIgMiAwIDAgMSAuNzA5LTEuNTI4bDctNS45OTlhMiAyIDAgMCAxIDIuNTgyIDBsNyA1Ljk5OUEyIDIgMCAwIDEgMjEgMTB2OWEyIDIgMCAwIDEtMiAyaC01YTIgMiAwIDAgMS0yLTJ2LTIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/house-plug\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 HousePlug = createLucideIcon('HousePlug', [\n ['path', { d: 'M10 12V8.964', key: '1vll13' }],\n ['path', { d: 'M14 12V8.964', key: '1x3qvg' }],\n [\n 'path',\n { d: 'M15 12a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-2a1 1 0 0 1 1-1z', key: 'ppykja' },\n ],\n [\n 'path',\n {\n d: 'M8.5 21H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.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,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,16 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"eqeqeq": ["error", "allow-null"],
"id-length": "off",
"new-cap": ["error", {
"capIsNewExceptions": [
"RequireObjectCoercible",
"ToObject",
],
}],
},
}
@@ -0,0 +1 @@
module.exports={C:{"115":0.01646,"120":0.00823,"121":0.02058,"125":0.02058,"128":0.00412,"140":0.00412,"142":0.00412,"144":0.01235,"148":0.02058,"149":0.00823,"150":0.00412,"151":0.00412,"152":0.01235,"153":0.0247,"154":0.41572,"155":1.69579,"156":1.07839,"157":0.02058,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 122 123 124 126 127 129 130 131 132 133 134 135 136 137 138 139 141 143 145 146 147 158 159 160 3.5 3.6"},D:{"75":0.00412,"79":0.00412,"103":0.03704,"104":0.01235,"105":0.01235,"106":0.01235,"107":0.00823,"108":0.04116,"109":0.06997,"110":0.01235,"111":0.01235,"112":0.01646,"115":0.00412,"116":0.04528,"117":0.01235,"118":0.0782,"119":0.02881,"120":0.1029,"121":0.0247,"122":0.0782,"123":0.00412,"124":0.07409,"126":0.07409,"128":0.05762,"129":0.00823,"130":0.00823,"131":0.08232,"133":0.08232,"134":0.04939,"135":0.04116,"136":0.05351,"137":0.06174,"138":0.11525,"139":0.06174,"140":0.04528,"141":0.06997,"142":0.24696,"143":0.0247,"144":0.04528,"145":0.11113,"146":0.02058,"147":0.51862,"148":0.11936,"149":0.13583,"150":0.36632,"151":2.01684,"152":7.948,"153":4.59346,"154":1.19776,"155":0.06174,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 76 77 78 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 113 114 125 127 132 156 157"},F:{"101":0.01646,"134":0.09878,"135":0.37456,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 131 132 133 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"109":0.00412,"119":0.01646,"120":0.01646,"121":0.00412,"131":0.00412,"133":0.00412,"141":0.02058,"143":0.00412,"144":0.00412,"146":0.00412,"147":0.00412,"148":0.03293,"149":0.01235,"150":0.03293,"151":0.14406,"152":2.12797,"153":2.30908,"154":0.48569,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 122 123 124 125 126 127 128 129 130 132 134 135 136 137 138 139 140 142 145"},E:{"14":0.00412,"27":0.1276,_:"4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.2-15.3 27.1 TP","13.1":0.00412,"14.1":0.00823,"15.1":0.00823,"15.4":0.01646,"15.5":0.00412,"15.6":0.07409,"16.0":0.00412,"16.1":0.36221,"16.2":0.00412,"16.3":0.11525,"16.4":0.09878,"16.5":0.01235,"16.6":0.61328,"17.0":0.00412,"17.1":0.45688,"17.2":0.04116,"17.3":0.02881,"17.4":0.09467,"17.5":0.05762,"17.6":1.69579,"18.0":0.09878,"18.1":0.01235,"18.2":0.00823,"18.3":0.14406,"18.4":0.00412,"18.5-18.7":0.04528,"26.0":0.00412,"26.1":0.01646,"26.2":0.14406,"26.3":0.05762,"26.4":0.15229,"26.5":0.69149,"26.6":2.64659,"27.2":0.00412},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00241,"5.0-5.1":0.00241,"6.0-6.1":0,"7.0-7.1":0.00483,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.02414,"11.0-11.2":0.00241,"11.3-11.4":0.00483,"12.0-12.1":0,"12.2-12.5":0.06276,"13.0-13.1":0,"13.2":0.01207,"13.3":0,"13.4-13.7":0.00241,"14.0-14.4":0.00966,"14.5-14.8":0.01448,"15.0-15.1":0.01448,"15.2-15.3":0.00966,"15.4":0.01207,"15.5":0.01448,"15.6-15.8":0.31382,"16.0":0.02414,"16.1":0.04345,"16.2":0.02414,"16.3":0.05311,"16.4":0.01207,"16.5":0.01931,"16.6-16.7":0.43694,"17.0":0.0169,"17.1":0.02414,"17.2":0.02414,"17.3":0.03621,"17.4":0.05069,"17.5":0.09898,"17.6-17.7":0.25589,"18.0":0.05311,"18.1":0.10622,"18.2":0.14484,"18.3":0.25106,"18.4":0.15691,"18.5-18.7":3.24204,"26.0":0.15691,"26.1":0.15933,"26.2":0.41521,"26.3":0.44901,"26.4":0.32831,"26.5":2.19918,"26.6":13.56925,"27.0":1.04045,"27.1":0,"27.2":0.02655},P:{"23":0.0076,"28":0.04562,"29":0.01521,"30":2.86647,_:"4 20 21 22 24 25 26 27 5.0-5.4 6.2-6.4 7.2-7.4 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","8.2":0.0076},I:{"0":0.15878,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00006},K:{"0":0.08828,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0":32.18561},R:{_:"0"},M:{"0":0.22363},Q:{_:"14.9"},O:{"0":0.01177},H:{all:0}};
@@ -0,0 +1 @@
{"version":3,"file":"columns-4.js","sources":["../../../src/icons/columns-4.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Columns4\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHg9IjMiIHk9IjMiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Ik03LjUgM3YxOCIgLz4KICA8cGF0aCBkPSJNMTIgM3YxOCIgLz4KICA8cGF0aCBkPSJNMTYuNSAzdjE4IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/columns-4\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 Columns4 = createLucideIcon('Columns4', [\n ['rect', { width: '18', height: '18', x: '3', y: '3', rx: '2', key: 'afitv7' }],\n ['path', { d: 'M7.5 3v18', key: 'w0wo6v' }],\n ['path', { d: 'M12 3v18', key: '108xh3' }],\n ['path', { d: 'M16.5 3v18', key: '10tjh1' }],\n]);\n\nexport default Columns4;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,MAAM,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,53 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "https://json-schema.org/draft/2019-09/meta/applicator",
"$vocabulary": {
"https://json-schema.org/draft/2019-09/vocab/applicator": true
},
"$recursiveAnchor": true,
"title": "Applicator vocabulary meta-schema",
"type": ["object", "boolean"],
"properties": {
"additionalItems": {"$recursiveRef": "#"},
"unevaluatedItems": {"$recursiveRef": "#"},
"items": {
"anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}]
},
"contains": {"$recursiveRef": "#"},
"additionalProperties": {"$recursiveRef": "#"},
"unevaluatedProperties": {"$recursiveRef": "#"},
"properties": {
"type": "object",
"additionalProperties": {"$recursiveRef": "#"},
"default": {}
},
"patternProperties": {
"type": "object",
"additionalProperties": {"$recursiveRef": "#"},
"propertyNames": {"format": "regex"},
"default": {}
},
"dependentSchemas": {
"type": "object",
"additionalProperties": {
"$recursiveRef": "#"
}
},
"propertyNames": {"$recursiveRef": "#"},
"if": {"$recursiveRef": "#"},
"then": {"$recursiveRef": "#"},
"else": {"$recursiveRef": "#"},
"allOf": {"$ref": "#/$defs/schemaArray"},
"anyOf": {"$ref": "#/$defs/schemaArray"},
"oneOf": {"$ref": "#/$defs/schemaArray"},
"not": {"$recursiveRef": "#"}
},
"$defs": {
"schemaArray": {
"type": "array",
"minItems": 1,
"items": {"$recursiveRef": "#"}
}
}
}
@@ -0,0 +1,897 @@
import type { StrictEqualUsingBranding } from './branding';
import type { ExpectAny, ExpectArray, ExpectBigInt, ExpectBoolean, ExpectFunction, ExpectNever, ExpectNull, ExpectNullable, ExpectNumber, ExpectObject, ExpectString, ExpectSymbol, ExpectUndefined, ExpectUnknown, ExpectVoid, MismatchInfo, Scolder } from './messages';
import type { ConstructorOverloadParameters, OverloadParameters, OverloadReturnTypes, OverloadsNarrowedByParameters } from './overloads';
import type { AValue, DeepPickMatchingProps, Extends, IsUnion, MismatchArgs, Not, StrictEqualUsingTSInternalIdenticalToOperator } from './utils';
export * from './branding';
export * from './messages';
export * from './overloads';
export * from './utils';
/**
* Represents the positive assertion methods available for type checking in the
* {@linkcode expectTypeOf()} utility.
*/
export interface PositiveExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
positive: true;
branded: false;
}> {
/**
* Similar to jest's `expect(...).toMatchObject(...)` but for types.
* Deeply "picks" the properties of the actual type based on the expected type, then performs a strict check to make sure the types match `Expected`.
*
* **Note**: optional properties on the {@linkcode Expected | expected type} are not allowed to be missing on the {@linkcode Actual | actual type}.
*
* @example
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toMatchObjectType<{ a: number }>()
*
* expectTypeOf({ a: 1, b: 1 }).not.toMatchObjectType<{ a: number; c?: number }>()
* ```
*
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
toMatchObjectType: <Expected extends IsUnion<Expected> extends true ? 'toMatchObject does not support union types' : Not<Extends<Expected, Record<string, unknown>>> extends true ? 'toMatchObject only supports object types' : StrictEqualUsingTSInternalIdenticalToOperator<DeepPickMatchingProps<Actual, Expected>, Expected> extends true ? unknown : MismatchInfo<DeepPickMatchingProps<Actual, Expected>, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<DeepPickMatchingProps<Actual, Expected>, Expected>, true>) => true;
/**
* Check if your type extends the expected type
*
* A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()} that allows for extra properties.
* This is roughly equivalent to an `extends` constraint in a function type argument.
*
* @example
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toExtend<{ a: number }>()
*
* expectTypeOf({ a: 1 }).not.toExtend<{ b: number }>()
* ```
*
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
toExtend: <Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>) => true;
toEqualTypeOf: {
/**
* Uses TypeScript's internal technique to check for type "identicalness".
*
* It will check if the types are fully equal to each other.
* It will not fail if two objects have different values, but the same type.
* It will fail however if an object is missing a property.
*
* **_Unexpected failure_**? For a more permissive but less performant
* check that accommodates for equivalent intersection types,
* use {@linkcode branded | .branded.toEqualTypeOf()}.
* @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
*
* @example
* <caption>Using generic type argument syntax</caption>
* ```ts
* expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
*
* expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
* ```
*
* @example
* <caption>Using inferred type syntax by passing a value</caption>
* ```ts
* expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
*
* expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
* ```
*
* @param value - The value to compare against the expected type.
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
<Expected extends StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
/**
* Uses TypeScript's internal technique to check for type "identicalness".
*
* It will check if the types are fully equal to each other.
* It will not fail if two objects have different values, but the same type.
* It will fail however if an object is missing a property.
*
* **_Unexpected failure_**? For a more permissive but less performant
* check that accommodates for equivalent intersection types,
* use {@linkcode branded | .branded.toEqualTypeOf()}.
* @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
*
* @example
* <caption>Using generic type argument syntax</caption>
* ```ts
* expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
*
* expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
* ```
*
* @example
* <caption>Using inferred type syntax by passing a value</caption>
* ```ts
* expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
*
* expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
* ```
*
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
<Expected extends StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
};
/**
* @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
*
* - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
* - Use {@linkcode toExtend} to check if your type extends the expected type
*/
toMatchTypeOf: {
/**
* @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
*
* - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
* - Use {@linkcode toExtend} to check if your type extends the expected type
*
* A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()}
* that allows for extra properties.
* This is roughly equivalent to an `extends` constraint
* in a function type argument.
*
* @example
* <caption>Using generic type argument syntax</caption>
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
* ```
*
* @example
* <caption>Using inferred type syntax by passing a value</caption>
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
* ```
*
* @param value - The value to compare against the expected type.
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
<Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
/**
* @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
*
* - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
* - Use {@linkcode toExtend} to check if your type extends the expected type
*
* A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()}
* that allows for extra properties.
* This is roughly equivalent to an `extends` constraint
* in a function type argument.
*
* @example
* <caption>Using generic type argument syntax</caption>
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
* ```
*
* @example
* <caption>Using inferred type syntax by passing a value</caption>
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
* ```
*
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
<Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
};
/**
* Checks whether an object has a given property.
*
* @example
* <caption>check that properties exist</caption>
* ```ts
* const obj = { a: 1, b: '' }
*
* expectTypeOf(obj).toHaveProperty('a')
*
* expectTypeOf(obj).not.toHaveProperty('c')
* ```
*
* @param key - The property key to check for.
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
toHaveProperty: <KeyType extends keyof Actual>(key: KeyType, ...MISMATCH: MismatchArgs<Extends<KeyType, keyof Actual>, true>) => KeyType extends keyof Actual ? PositiveExpectTypeOf<Actual[KeyType]> : true;
/**
* Inverts the result of the following assertions.
*
* @example
* ```ts
* expectTypeOf({ a: 1 }).not.toMatchTypeOf({ b: 1 })
* ```
*/
not: NegativeExpectTypeOf<Actual>;
/**
* Intersection types can cause issues with
* {@linkcode toEqualTypeOf | .toEqualTypeOf()}:
* ```ts
* // ❌ The following line doesn't compile, even though the types are arguably the same.
* expectTypeOf<{ a: 1 } & { b: 2 }>().toEqualTypeOf<{ a: 1; b: 2 }>()
* ```
* This helper works around this problem by using
* a more permissive but less performant check.
*
* __Note__: This comes at a performance cost, and can cause the compiler
* to 'give up' if used with excessively deep types, so use sparingly.
*
* @see {@link https://github.com/mmkal/expect-type/pull/21 | Reference}
*/
branded: {
/**
* Uses TypeScript's internal technique to check for type "identicalness".
*
* It will check if the types are fully equal to each other.
* It will not fail if two objects have different values, but the same type.
* It will fail however if an object is missing a property.
*
* **_Unexpected failure_**? For a more permissive but less performant
* check that accommodates for equivalent intersection types,
* use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}.
* @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
*
* @example
* <caption>Using generic type argument syntax</caption>
* ```ts
* expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
*
* expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
* ```
*
* @example
* <caption>Using inferred type syntax by passing a value</caption>
* ```ts
* expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
*
* expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
* ```
*
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
toEqualTypeOf: <Expected extends StrictEqualUsingBranding<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingBranding<Actual, Expected>, true>) => true;
};
}
/**
* Represents the negative expectation type for the {@linkcode Actual} type.
*/
export interface NegativeExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
positive: false;
}> {
/**
* Similar to jest's `expect(...).toMatchObject(...)` but for types.
* Deeply "picks" the properties of the actual type based on the expected type, then performs a strict check to make sure the types match `Expected`.
*
* **Note**: optional properties on the {@linkcode Expected | expected type} are not allowed to be missing on the {@linkcode Actual | actual type}.
*
* @example
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toMatchObjectType<{ a: number }>()
*
* expectTypeOf({ a: 1, b: 1 }).not.toMatchObjectType<{ a: number; c?: number }>()
* ```
*
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
toMatchObjectType: <Expected>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Pick<Actual, keyof Actual & keyof Expected>, Expected>, false>) => true;
/**
* Check if your type extends the expected type
*
* A less strict version of {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} that allows for extra properties.
* This is roughly equivalent to an `extends` constraint in a function type argument.
*
* @example
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toExtend<{ a: number }>()]
*
* expectTypeOf({ a: 1 }).not.toExtend<{ b: number }>()
* ```
*
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
toExtend<Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
toEqualTypeOf: {
/**
* Uses TypeScript's internal technique to check for type "identicalness".
*
* It will check if the types are fully equal to each other.
* It will not fail if two objects have different values, but the same type.
* It will fail however if an object is missing a property.
*
* **_Unexpected failure_**? For a more permissive but less performant
* check that accommodates for equivalent intersection types,
* use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}.
* @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
*
* @example
* <caption>Using generic type argument syntax</caption>
* ```ts
* expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
*
* expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
* ```
*
* @example
* <caption>Using inferred type syntax by passing a value</caption>
* ```ts
* expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
*
* expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
* ```
*
* @param value - The value to compare against the expected type.
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
<Expected>(value: Expected & AValue, ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
/**
* Uses TypeScript's internal technique to check for type "identicalness".
*
* It will check if the types are fully equal to each other.
* It will not fail if two objects have different values, but the same type.
* It will fail however if an object is missing a property.
*
* **_Unexpected failure_**? For a more permissive but less performant
* check that accommodates for equivalent intersection types,
* use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}.
* @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
*
* @example
* <caption>Using generic type argument syntax</caption>
* ```ts
* expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
*
* expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
* ```
*
* @example
* <caption>Using inferred type syntax by passing a value</caption>
* ```ts
* expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
*
* expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
* ```
*
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
<Expected>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
};
/**
* @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
*
* - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
* - Use {@linkcode toExtend} to check if your type extends the expected type
*/
toMatchTypeOf: {
/**
* @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
*
* - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
* - Use {@linkcode toExtend} to check if your type extends the expected type
*
* A less strict version of
* {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()}
* that allows for extra properties.
* This is roughly equivalent to an `extends` constraint
* in a function type argument.
*
* @example
* <caption>Using generic type argument syntax</caption>
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
* ```
*
* @example
* <caption>Using inferred type syntax by passing a value</caption>
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
* ```
*
* @param value - The value to compare against the expected type.
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
<Expected>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
/**
* @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
*
* - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
* - Use {@linkcode toExtend} to check if your type extends the expected type
*
* A less strict version of
* {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()}
* that allows for extra properties.
* This is roughly equivalent to an `extends` constraint
* in a function type argument.
*
* @example
* <caption>Using generic type argument syntax</caption>
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
* ```
*
* @example
* <caption>Using inferred type syntax by passing a value</caption>
* ```ts
* expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
* ```
*
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
<Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
};
/**
* Checks whether an object has a given property.
*
* @example
* <caption>check that properties exist</caption>
* ```ts
* const obj = { a: 1, b: '' }
*
* expectTypeOf(obj).toHaveProperty('a')
*
* expectTypeOf(obj).not.toHaveProperty('c')
* ```
*
* @param key - The property key to check for.
* @param MISMATCH - The mismatch arguments.
* @returns `true`.
*/
toHaveProperty: <KeyType extends string | number | symbol>(key: KeyType, ...MISMATCH: MismatchArgs<Extends<KeyType, keyof Actual>, false>) => true;
}
/**
* Represents a conditional type that selects either
* {@linkcode PositiveExpectTypeOf} or {@linkcode NegativeExpectTypeOf} based
* on the value of the `positive` property in the {@linkcode Options} type.
*/
export type ExpectTypeOf<Actual, Options extends {
positive: boolean;
}> = Options['positive'] extends true ? PositiveExpectTypeOf<Actual> : NegativeExpectTypeOf<Actual>;
/**
* Represents the base interface for the
* {@linkcode expectTypeOf()} function.
* Provides a set of assertion methods to perform type checks on a value.
*/
export interface BaseExpectTypeOf<Actual, Options extends {
positive: boolean;
}> {
/**
* Checks whether the type of the value is `any`.
*/
toBeAny: Scolder<ExpectAny<Actual>, Options>;
/**
* Checks whether the type of the value is `unknown`.
*/
toBeUnknown: Scolder<ExpectUnknown<Actual>, Options>;
/**
* Checks whether the type of the value is `never`.
*/
toBeNever: Scolder<ExpectNever<Actual>, Options>;
/**
* Checks whether the type of the value is `function`.
*/
toBeFunction: Scolder<ExpectFunction<Actual>, Options>;
/**
* Checks whether the type of the value is `object`.
*/
toBeObject: Scolder<ExpectObject<Actual>, Options>;
/**
* Checks whether the type of the value is an {@linkcode Array}.
*/
toBeArray: Scolder<ExpectArray<Actual>, Options>;
/**
* Checks whether the type of the value is `number`.
*/
toBeNumber: Scolder<ExpectNumber<Actual>, Options>;
/**
* Checks whether the type of the value is `string`.
*/
toBeString: Scolder<ExpectString<Actual>, Options>;
/**
* Checks whether the type of the value is `boolean`.
*/
toBeBoolean: Scolder<ExpectBoolean<Actual>, Options>;
/**
* Checks whether the type of the value is `void`.
*/
toBeVoid: Scolder<ExpectVoid<Actual>, Options>;
/**
* Checks whether the type of the value is `symbol`.
*/
toBeSymbol: Scolder<ExpectSymbol<Actual>, Options>;
/**
* Checks whether the type of the value is `null`.
*/
toBeNull: Scolder<ExpectNull<Actual>, Options>;
/**
* Checks whether the type of the value is `undefined`.
*/
toBeUndefined: Scolder<ExpectUndefined<Actual>, Options>;
/**
* Checks whether the type of the value is `null` or `undefined`.
*/
toBeNullable: Scolder<ExpectNullable<Actual>, Options>;
/**
* Transform that type of the value via a callback.
*
* @param fn - A callback that transforms the input value. Note that this function is not actually called - it's only used for type inference.
* @returns A new type which can be used for further assertions.
*/
map: <T>(fn: (value: Actual) => T) => ExpectTypeOf<T, Options>;
/**
* Checks whether the type of the value is **`bigint`**.
*
* @example
* <caption>#### Distinguish between **`number`** and **`bigint`**</caption>
*
* ```ts
* import { expectTypeOf } from 'expect-type'
*
* const aVeryBigInteger = 10n ** 100n
*
* expectTypeOf(aVeryBigInteger).not.toBeNumber()
*
* expectTypeOf(aVeryBigInteger).toBeBigInt()
* ```
*
* @since 1.1.0
*/
toBeBigInt: Scolder<ExpectBigInt<Actual>, Options>;
/**
* Checks whether a function is callable with the given parameters.
*
* __Note__: You cannot negate this assertion with
* {@linkcode PositiveExpectTypeOf.not | .not}, you need to use
* `ts-expect-error` instead.
*
* @example
* ```ts
* const f = (a: number) => [a, a]
*
* expectTypeOf(f).toBeCallableWith(1)
* ```
*
* __Known Limitation__: This assertion will likely fail if you try to use it
* with a generic function or an overload.
* @see {@link https://github.com/mmkal/expect-type/issues/50 | This issue} for an example and a workaround.
*
* @param args - The arguments to check for callability.
* @returns `true`.
*/
toBeCallableWith: Options['positive'] extends true ? <Args extends OverloadParameters<Actual>>(...args: Args) => ExpectTypeOf<OverloadsNarrowedByParameters<Actual, Args>, Options> : never;
/**
* Checks whether a class is constructible with the given parameters.
*
* @example
* ```ts
* expectTypeOf(Date).toBeConstructibleWith('1970')
*
* expectTypeOf(Date).toBeConstructibleWith(0)
*
* expectTypeOf(Date).toBeConstructibleWith(new Date())
*
* expectTypeOf(Date).toBeConstructibleWith()
* ```
*
* @param args - The arguments to check for constructibility.
* @returns `true`.
*/
toBeConstructibleWith: Options['positive'] extends true ? <Args extends ConstructorOverloadParameters<Actual>>(...args: Args) => true : never;
/**
* Equivalent to the {@linkcode Extract} utility type.
* Helps narrow down complex union types.
*
* @example
* ```ts
* type ResponsiveProp<T> = T | T[] | { xs?: T; sm?: T; md?: T }
*
* interface CSSProperties {
* margin?: string
* padding?: string
* }
*
* function getResponsiveProp<T>(_props: T): ResponsiveProp<T> {
* return {}
* }
*
* const cssProperties: CSSProperties = { margin: '1px', padding: '2px' }
*
* expectTypeOf(getResponsiveProp(cssProperties))
* .extract<{ xs?: any }>() // extracts the last type from a union
* .toEqualTypeOf<{
* xs?: CSSProperties
* sm?: CSSProperties
* md?: CSSProperties
* }>()
*
* expectTypeOf(getResponsiveProp(cssProperties))
* .extract<unknown[]>() // extracts an array from a union
* .toEqualTypeOf<CSSProperties[]>()
* ```
*
* __Note__: If no type is found in the union, it will return `never`.
*
* @param v - The type to extract from the union.
* @returns The type after extracting the type from the union.
*/
extract: <V>(v?: V) => ExpectTypeOf<Extract<Actual, V>, Options>;
/**
* Equivalent to the {@linkcode Exclude} utility type.
* Removes types from a union.
*
* @example
* ```ts
* type ResponsiveProp<T> = T | T[] | { xs?: T; sm?: T; md?: T }
*
* interface CSSProperties {
* margin?: string
* padding?: string
* }
*
* function getResponsiveProp<T>(_props: T): ResponsiveProp<T> {
* return {}
* }
*
* const cssProperties: CSSProperties = { margin: '1px', padding: '2px' }
*
* expectTypeOf(getResponsiveProp(cssProperties))
* .exclude<unknown[]>()
* .exclude<{ xs?: unknown }>() // or just `.exclude<unknown[] | { xs?: unknown }>()`
* .toEqualTypeOf<CSSProperties>()
* ```
*/
exclude: <V>(v?: V) => ExpectTypeOf<Exclude<Actual, V>, Options>;
/**
* Equivalent to the {@linkcode Pick} utility type.
* Helps select a subset of properties from an object type.
*
* @example
* ```ts
* interface Person {
* name: string
* age: number
* }
*
* expectTypeOf<Person>()
* .pick<'name'>()
* .toEqualTypeOf<{ name: string }>()
* ```
*
* @param keyToPick - The property key to pick.
* @returns The type after picking the property.
*/
pick: <KeyToPick extends keyof Actual>(keyToPick?: KeyToPick) => ExpectTypeOf<Pick<Actual, KeyToPick>, Options>;
/**
* Equivalent to the {@linkcode Omit} utility type.
* Helps remove a subset of properties from an object type.
*
* @example
* ```ts
* interface Person {
* name: string
* age: number
* }
*
* expectTypeOf<Person>().omit<'name'>().toEqualTypeOf<{ age: number }>()
* ```
*
* @param keyToOmit - The property key to omit.
* @returns The type after omitting the property.
*/
omit: <KeyToOmit extends keyof Actual | (PropertyKey & Record<never, never>)>(keyToOmit?: KeyToOmit) => ExpectTypeOf<Omit<Actual, KeyToOmit>, Options>;
/**
* Extracts a certain function argument with `.parameter(number)` call to
* perform other assertions on it.
*
* @example
* ```ts
* function foo(a: number, b: string) {
* return [a, b]
* }
*
* expectTypeOf(foo).parameter(0).toBeNumber()
*
* expectTypeOf(foo).parameter(1).toBeString()
* ```
*
* @param index - The index of the parameter to extract.
* @returns The extracted parameter type.
*/
parameter: <Index extends number>(index: Index) => ExpectTypeOf<OverloadParameters<Actual>[Index], Options>;
/**
* Equivalent to the {@linkcode Parameters} utility type.
* Extracts function parameters to perform assertions on its value.
* Parameters are returned as an array.
*
* @example
* ```ts
* function noParam() {}
*
* function hasParam(s: string) {}
*
* expectTypeOf(noParam).parameters.toEqualTypeOf<[]>()
*
* expectTypeOf(hasParam).parameters.toEqualTypeOf<[string]>()
* ```
*/
parameters: ExpectTypeOf<OverloadParameters<Actual>, Options>;
/**
* Equivalent to the {@linkcode ConstructorParameters} utility type.
* Extracts constructor parameters as an array of values and
* perform assertions on them with this method.
*
* For overloaded constructors it will return a union of all possible parameter-tuples.
*
* @example
* ```ts
* expectTypeOf(Date).constructorParameters.toEqualTypeOf<
* [] | [string | number | Date]
* >()
* ```
*/
constructorParameters: ExpectTypeOf<ConstructorOverloadParameters<Actual>, Options>;
/**
* Equivalent to the {@linkcode ThisParameterType} utility type.
* Extracts the `this` parameter of a function to
* perform assertions on its value.
*
* @example
* ```ts
* function greet(this: { name: string }, message: string) {
* return `Hello ${this.name}, here's your message: ${message}`
* }
*
* expectTypeOf(greet).thisParameter.toEqualTypeOf<{ name: string }>()
* ```
*/
thisParameter: ExpectTypeOf<ThisParameterType<Actual>, Options>;
/**
* Equivalent to the {@linkcode InstanceType} utility type.
* Extracts the instance type of a class to perform assertions on.
*
* @example
* ```ts
* expectTypeOf(Date).instance.toHaveProperty('toISOString')
* ```
*/
instance: Actual extends new (...args: any[]) => infer I ? ExpectTypeOf<I, Options> : never;
/**
* Equivalent to the {@linkcode ReturnType} utility type.
* Extracts the return type of a function.
*
* @example
* ```ts
* expectTypeOf(() => {}).returns.toBeVoid()
*
* expectTypeOf((a: number) => [a, a]).returns.toEqualTypeOf([1, 2])
* ```
*/
returns: Actual extends Function ? ExpectTypeOf<OverloadReturnTypes<Actual>, Options> : never;
/**
* Extracts resolved value of a Promise,
* so you can perform other assertions on it.
*
* @example
* ```ts
* async function asyncFunc() {
* return 123
* }
*
* expectTypeOf(asyncFunc).returns.resolves.toBeNumber()
*
* expectTypeOf(Promise.resolve('string')).resolves.toBeString()
* ```
*
* Type Equivalent:
* ```ts
* type Resolves<PromiseType> = PromiseType extends PromiseLike<infer ResolvedType>
* ? ResolvedType
* : never
* ```
*/
resolves: Actual extends PromiseLike<infer ResolvedType> ? ExpectTypeOf<ResolvedType, Options> : never;
/**
* Extracts array item type to perform assertions on.
*
* @example
* ```ts
* expectTypeOf([1, 2, 3]).items.toEqualTypeOf<number>()
*
* expectTypeOf([1, 2, 3]).items.not.toEqualTypeOf<string>()
* ```
*
* __Type Equivalent__:
* ```ts
* type Items<ArrayType> = ArrayType extends ArrayLike<infer ItemType>
* ? ItemType
* : never
* ```
*/
items: Actual extends ArrayLike<infer ItemType> ? ExpectTypeOf<ItemType, Options> : never;
/**
* Extracts the type guarded by a function to perform assertions on.
*
* @example
* ```ts
* function isString(v: any): v is string {
* return typeof v === 'string'
* }
*
* expectTypeOf(isString).guards.toBeString()
* ```
*/
guards: Actual extends (v: any, ...args: any[]) => v is infer T ? ExpectTypeOf<T, Options> : never;
/**
* Extracts the type asserted by a function to perform assertions on.
*
* @example
* ```ts
* function assertNumber(v: any): asserts v is number {
* if (typeof v !== 'number')
* throw new TypeError('Nope !')
* }
*
* expectTypeOf(assertNumber).asserts.toBeNumber()
* ```
*/
asserts: Actual extends (v: any, ...args: any[]) => asserts v is infer T ? unknown extends T ? never : ExpectTypeOf<T, Options> : never;
}
/**
* Represents a function that allows asserting the expected type of a value.
*/
export type _ExpectTypeOf = {
/**
* Asserts the expected type of a value.
*
* @param actual - The actual value being asserted.
* @returns An object representing the expected type assertion.
*/
<Actual>(actual: Actual): ExpectTypeOf<Actual, {
positive: true;
branded: false;
}>;
/**
* Asserts the expected type of a value without providing an actual value.
*
* @returns An object representing the expected type assertion.
*/
<Actual>(): ExpectTypeOf<Actual, {
positive: true;
branded: false;
}>;
};
/**
* Similar to Jest's `expect`, but with type-awareness.
* Gives you access to a number of type-matchers that let you make assertions about the
* form of a reference or generic type parameter.
*
* @example
* ```ts
* import { foo, bar } from '../foo'
* import { expectTypeOf } from 'expect-type'
*
* test('foo types', () => {
* // make sure `foo` has type { a: number }
* expectTypeOf(foo).toMatchTypeOf({ a: 1 })
* expectTypeOf(foo).toHaveProperty('a').toBeNumber()
*
* // make sure `bar` is a function taking a string:
* expectTypeOf(bar).parameter(0).toBeString()
* expectTypeOf(bar).returns.not.toBeAny()
* })
* ```
*
* @description
* See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples.
*/
export declare const expectTypeOf: _ExpectTypeOf;
@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toUpperCase = exports.toLowerCase = exports.trim = exports.normalize = exports.overwrite = exports.mime = exports.properties = exports.property = exports.endsWith = exports.startsWith = exports.includes = exports.uppercase = exports.lowercase = exports.regex = exports.length = exports.minLength = exports.maxLength = exports.size = exports.minSize = exports.maxSize = exports.multipleOf = exports.nonnegative = exports.nonpositive = exports.negative = exports.positive = exports.minimum = exports.gte = exports.gt = exports.maximum = exports.lte = exports.lt = void 0;
var index_js_1 = require("../core/index.cjs");
Object.defineProperty(exports, "lt", { enumerable: true, get: function () { return index_js_1._lt; } });
Object.defineProperty(exports, "lte", { enumerable: true, get: function () { return index_js_1._lte; } });
Object.defineProperty(exports, "maximum", { enumerable: true, get: function () { return index_js_1._lte; } });
Object.defineProperty(exports, "gt", { enumerable: true, get: function () { return index_js_1._gt; } });
Object.defineProperty(exports, "gte", { enumerable: true, get: function () { return index_js_1._gte; } });
Object.defineProperty(exports, "minimum", { enumerable: true, get: function () { return index_js_1._gte; } });
Object.defineProperty(exports, "positive", { enumerable: true, get: function () { return index_js_1._positive; } });
Object.defineProperty(exports, "negative", { enumerable: true, get: function () { return index_js_1._negative; } });
Object.defineProperty(exports, "nonpositive", { enumerable: true, get: function () { return index_js_1._nonpositive; } });
Object.defineProperty(exports, "nonnegative", { enumerable: true, get: function () { return index_js_1._nonnegative; } });
Object.defineProperty(exports, "multipleOf", { enumerable: true, get: function () { return index_js_1._multipleOf; } });
Object.defineProperty(exports, "maxSize", { enumerable: true, get: function () { return index_js_1._maxSize; } });
Object.defineProperty(exports, "minSize", { enumerable: true, get: function () { return index_js_1._minSize; } });
Object.defineProperty(exports, "size", { enumerable: true, get: function () { return index_js_1._size; } });
Object.defineProperty(exports, "maxLength", { enumerable: true, get: function () { return index_js_1._maxLength; } });
Object.defineProperty(exports, "minLength", { enumerable: true, get: function () { return index_js_1._minLength; } });
Object.defineProperty(exports, "length", { enumerable: true, get: function () { return index_js_1._length; } });
Object.defineProperty(exports, "regex", { enumerable: true, get: function () { return index_js_1._regex; } });
Object.defineProperty(exports, "lowercase", { enumerable: true, get: function () { return index_js_1._lowercase; } });
Object.defineProperty(exports, "uppercase", { enumerable: true, get: function () { return index_js_1._uppercase; } });
Object.defineProperty(exports, "includes", { enumerable: true, get: function () { return index_js_1._includes; } });
Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return index_js_1._startsWith; } });
Object.defineProperty(exports, "endsWith", { enumerable: true, get: function () { return index_js_1._endsWith; } });
Object.defineProperty(exports, "property", { enumerable: true, get: function () { return index_js_1._property; } });
Object.defineProperty(exports, "properties", { enumerable: true, get: function () { return index_js_1._properties; } });
Object.defineProperty(exports, "mime", { enumerable: true, get: function () { return index_js_1._mime; } });
Object.defineProperty(exports, "overwrite", { enumerable: true, get: function () { return index_js_1._overwrite; } });
Object.defineProperty(exports, "normalize", { enumerable: true, get: function () { return index_js_1._normalize; } });
Object.defineProperty(exports, "trim", { enumerable: true, get: function () { return index_js_1._trim; } });
Object.defineProperty(exports, "toLowerCase", { enumerable: true, get: function () { return index_js_1._toLowerCase; } });
Object.defineProperty(exports, "toUpperCase", { enumerable: true, get: function () { return index_js_1._toUpperCase; } });
// seal-cjs-exports
(function () {
var keys = Object.getOwnPropertyNames(exports);
for (var i = 0; i < keys.length; i++) {
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
if (!desc || !desc.get || !desc.configurable) continue;
var value;
try {
value = desc.get();
} catch (e) {
continue;
}
// a circular require may not have settled this one yet, so leave it live
if (value === undefined) continue;
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
}
Object.freeze(exports);
})();
@@ -0,0 +1,177 @@
import { IncomingHttpHeaders } from './header'
import Client from './client'
export default Errors
declare namespace Errors {
export class UndiciError extends Error {
name: string
code: string
}
/** Connect timeout error. */
export class ConnectTimeoutError extends UndiciError {
name: 'ConnectTimeoutError'
code: 'UND_ERR_CONNECT_TIMEOUT'
}
/** A header exceeds the `headersTimeout` option. */
export class HeadersTimeoutError extends UndiciError {
name: 'HeadersTimeoutError'
code: 'UND_ERR_HEADERS_TIMEOUT'
}
/** Headers overflow error. */
export class HeadersOverflowError extends UndiciError {
name: 'HeadersOverflowError'
code: 'UND_ERR_HEADERS_OVERFLOW'
}
/** A body exceeds the `bodyTimeout` option. */
export class BodyTimeoutError extends UndiciError {
name: 'BodyTimeoutError'
code: 'UND_ERR_BODY_TIMEOUT'
}
export class ResponseError extends UndiciError {
constructor (
message: string,
code: number,
options: {
headers?: IncomingHttpHeaders | string[] | null,
body?: null | Record<string, any> | string
}
)
name: 'ResponseError'
code: 'UND_ERR_RESPONSE'
statusCode: number
body: null | Record<string, any> | string
headers: IncomingHttpHeaders | string[] | null
}
/** Passed an invalid argument. */
export class InvalidArgumentError extends UndiciError {
name: 'InvalidArgumentError'
code: 'UND_ERR_INVALID_ARG'
}
/** Returned an invalid value. */
export class InvalidReturnValueError extends UndiciError {
name: 'InvalidReturnValueError'
code: 'UND_ERR_INVALID_RETURN_VALUE'
}
/** The request has been aborted by the user. */
export class RequestAbortedError extends UndiciError {
name: 'AbortError'
code: 'UND_ERR_ABORTED'
}
/** Expected error with reason. */
export class InformationalError extends UndiciError {
name: 'InformationalError'
code: 'UND_ERR_INFO'
}
/** Request body length does not match content-length header. */
export class RequestContentLengthMismatchError extends UndiciError {
name: 'RequestContentLengthMismatchError'
code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'
}
/** Response body length does not match content-length header. */
export class ResponseContentLengthMismatchError extends UndiciError {
name: 'ResponseContentLengthMismatchError'
code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH'
}
/** Trying to use a destroyed client. */
export class ClientDestroyedError extends UndiciError {
name: 'ClientDestroyedError'
code: 'UND_ERR_DESTROYED'
}
/** Trying to use a closed client. */
export class ClientClosedError extends UndiciError {
name: 'ClientClosedError'
code: 'UND_ERR_CLOSED'
}
/** There is an error with the socket. */
export class SocketError extends UndiciError {
name: 'SocketError'
code: 'UND_ERR_SOCKET'
socket: Client.SocketInfo | null
}
/** Encountered unsupported functionality. */
export class NotSupportedError extends UndiciError {
name: 'NotSupportedError'
code: 'UND_ERR_NOT_SUPPORTED'
}
/** No upstream has been added to the BalancedPool. */
export class BalancedPoolMissingUpstreamError extends UndiciError {
name: 'MissingUpstreamError'
code: 'UND_ERR_BPL_MISSING_UPSTREAM'
}
export class HTTPParserError extends UndiciError {
name: 'HTTPParserError'
code: string
}
/** The response exceed the length allowed. */
export class ResponseExceededMaxSizeError extends UndiciError {
name: 'ResponseExceededMaxSizeError'
code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE'
}
export class RequestRetryError extends UndiciError {
constructor (
message: string,
statusCode: number,
headers?: IncomingHttpHeaders | string[] | null,
body?: null | Record<string, any> | string
)
name: 'RequestRetryError'
code: 'UND_ERR_REQ_RETRY'
statusCode: number
data: {
count: number;
}
headers: Record<string, string | string[]>
}
export class SecureProxyConnectionError extends UndiciError {
constructor (
cause?: Error,
message?: string,
options?: Record<any, any>
)
name: 'SecureProxyConnectionError'
code: 'UND_ERR_PRX_TLS'
}
export class MaxOriginsReachedError extends UndiciError {
name: 'MaxOriginsReachedError'
code: 'UND_ERR_MAX_ORIGINS_REACHED'
}
/** SOCKS5 proxy related error. */
export class Socks5ProxyError extends UndiciError {
constructor (
message?: string,
code?: string
)
name: 'Socks5ProxyError'
code: string
}
/** WebSocket decompressed message exceeded maximum size. */
export class MessageSizeExceededError extends UndiciError {
name: 'MessageSizeExceededError'
code: 'UND_ERR_WS_MESSAGE_SIZE_EXCEEDED'
}
}
@@ -0,0 +1,53 @@
import { deepEqual } from "./utils.js";
//#region src/searchMiddleware.ts
/**
* Retain specified search params across navigations.
*
* If `keys` is `true`, retain all current params. Otherwise, copy only the
* listed keys from the current search into the next search.
*
* @param keys `true` to retain all, or a list of keys to retain.
* @returns A search middleware suitable for route `search.middlewares`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/retainSearchParamsFunction
*/
function retainSearchParams(keys) {
return ({ search, next }) => {
const result = next(search);
if (keys === true) return {
...search,
...result
};
const copy = { ...result };
keys.forEach((key) => {
if (!(key in copy)) copy[key] = search[key];
});
return copy;
};
}
/**
* Remove optional or default-valued search params from navigations.
*
* - Pass `true` (only if there are no required search params) to strip all.
* - Pass an array to always remove those optional keys.
* - Pass an object of default values; keys equal (deeply) to the defaults are removed.
*
* @returns A search middleware suitable for route `search.middlewares`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/stripSearchParamsFunction
*/
function stripSearchParams(input) {
return ({ search, next }) => {
if (input === true) return {};
const result = { ...next(search) };
if (Array.isArray(input)) input.forEach((key) => {
delete result[key];
});
else Object.entries(input).forEach(([key, value]) => {
if (deepEqual(result[key], value)) delete result[key];
});
return result;
};
}
//#endregion
export { retainSearchParams, stripSearchParams };
//# sourceMappingURL=searchMiddleware.js.map
@@ -0,0 +1 @@
{"version":3,"file":"cloud-alert.js","sources":["../../../src/icons/cloud-alert.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CloudAlert\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMTJ2NCIgLz4KICA8cGF0aCBkPSJNMTIgMjBoLjAxIiAvPgogIDxwYXRoIGQ9Ik0xNyAxOGguNWExIDEgMCAwIDAgMC05aC0xLjc5QTcgNyAwIDEgMCA3IDE3LjcwOCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/cloud-alert\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 CloudAlert = createLucideIcon('CloudAlert', [\n ['path', { d: 'M12 12v4', key: 'tww15h' }],\n ['path', { d: 'M12 20h.01', key: 'zekei9' }],\n ['path', { d: 'M17 18h.5a1 1 0 0 0 0-9h-1.79A7 7 0 1 0 7 17.708', key: 'xsb5ju' }],\n]);\n\nexport default CloudAlert;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,iBAAiB,YAAc,CAAA,CAAA,CAAA;AAAA,CAAA,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC3C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAoD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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;AACnF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 typescript-eslint and other contributors
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,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 Diameter = createLucideIcon("Diameter", [
["circle", { cx: "19", cy: "19", r: "2", key: "17f5cg" }],
["circle", { cx: "5", cy: "5", r: "2", key: "1gwv83" }],
["path", { d: "M6.48 3.66a10 10 0 0 1 13.86 13.86", key: "xr8kdq" }],
["path", { d: "m6.41 6.41 11.18 11.18", key: "uhpjw7" }],
["path", { d: "M3.66 6.48a10 10 0 0 0 13.86 13.86", key: "cldpwv" }]
]);
export { Diameter as default };
//# sourceMappingURL=diameter.js.map
@@ -0,0 +1,46 @@
{
"name": "@vitest/spy",
"type": "module",
"version": "4.1.12",
"description": "Lightweight Jest compatible spy implementation",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
"homepage": "https://vitest.dev/api/mock",
"repository": {
"type": "git",
"url": "git+https://github.com/vitest-dev/vitest.git",
"directory": "packages/spy"
},
"bugs": {
"url": "https://github.com/vitest-dev/vitest/issues"
},
"keywords": [
"vitest",
"test",
"mock",
"spy",
"intercept"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./optional-types.js": {
"types": "./optional-types.d.ts"
},
"./*": "./*"
},
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist",
"optional-types.d.ts"
],
"scripts": {
"build": "premove dist && rollup -c",
"dev": "rollup -c --watch"
}
}
@@ -0,0 +1 @@
{"version":3,"file":"resolve-uri.umd.js","sources":["../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n query: string;\n hash: string;\n type: UrlType;\n};\n\nconst enum UrlType {\n Empty = 1,\n Hash = 2,\n Query = 3,\n RelativePath = 4,\n AbsolutePath = 5,\n SchemeRelative = 6,\n Absolute = 7,\n}\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction isRelative(input: string): boolean {\n return /^[.?#]/.test(input);\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(\n match[1],\n match[2] || '',\n match[3],\n match[4] || '',\n match[5] || '/',\n match[6] || '',\n match[7] || '',\n );\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl(\n 'file:',\n '',\n match[1] || '',\n '',\n isAbsolutePath(path) ? path : '/' + path,\n match[3] || '',\n match[4] || '',\n );\n}\n\nfunction makeUrl(\n scheme: string,\n user: string,\n host: string,\n port: string,\n path: string,\n query: string,\n hash: string,\n): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: UrlType.Absolute,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = UrlType.SchemeRelative;\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = UrlType.AbsolutePath;\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? UrlType.Query\n : input.startsWith('#')\n ? UrlType.Hash\n : UrlType.RelativePath\n : UrlType.Empty;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n normalizePath(base, base.type);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url, type: UrlType) {\n const rel = type <= UrlType.RelativePath;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" willLine truncated
@@ -0,0 +1,112 @@
import * as util from "../core/util.js";
const error = () => {
const Sizable = {
string: { unit: "caractères", verb: "avoir" },
file: { unit: "octets", verb: "avoir" },
array: { unit: "éléments", verb: "avoir" },
set: { unit: "éléments", verb: "avoir" },
map: { unit: "éléments", verb: "avoir" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "entrée",
email: "adresse courriel",
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: "date-heure ISO",
date: "date ISO",
time: "heure ISO",
duration: "durée ISO",
ipv4: "adresse IPv4",
ipv6: "adresse IPv6",
mac: "adresse MAC",
cidrv4: "plage IPv4",
cidrv6: "plage IPv6",
base64: "chaîne encodée en base64",
base64url: "chaîne encodée en base64url",
json_string: "chaîne JSON",
e164: "numéro E.164",
credit_card: "numéro de carte de crédit",
currency_code: "code de devise",
iban: "IBAN",
jwt: "JWT",
template_literal: "entrée",
};
const TypeDictionary = {
nan: "NaN",
};
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = TypeDictionary[issue.expected] ?? issue.expected;
const receivedType = util.parsedType(issue.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue.expected)) {
return `Entrée invalide : attendu instanceof ${issue.expected}, reçu ${received}`;
}
return `Entrée invalide : attendu ${expected}, reçu ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `Entrée invalide : attendu ${util.stringifyPrimitive(issue.values[0])}`;
return `Option invalide : attendu l'une des valeurs suivantes ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "≤" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Trop grand : attendu que ${issue.origin ?? "la valeur"} ait ${adj}${issue.maximum.toString()} ${sizing.unit}`;
return `Trop grand : attendu que ${issue.origin ?? "la valeur"} soit ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? "≥" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Trop petit : attendu que ${issue.origin} ait ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `Trop petit : attendu que ${issue.origin} soit ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with") {
return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Chaîne invalide : doit inclure "${_issue.includes}"`;
if (_issue.format === "regex")
return `Chaîne invalide : doit correspondre au motif ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue.format} invalide`;
}
case "not_multiple_of":
return `Nombre invalide : doit être un multiple de ${issue.divisor}`;
case "unrecognized_keys":
return `Clé${issue.keys.length > 1 ? "s" : ""} non reconnue${issue.keys.length > 1 ? "s" : ""} : ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Clé invalide dans ${issue.origin}`;
case "invalid_union":
return "Entrée invalide";
case "invalid_element":
return `Valeur invalide dans ${issue.origin}`;
default:
return `Entrée invalide`;
}
};
};
export default function () {
return {
localeError: error(),
};
}
@@ -0,0 +1,147 @@
/**
* Encode a string into another string.
*/
export type Encode = (value: string) => string;
/**
* Decode a string into another string.
*/
export type Decode = (value: string) => string;
export interface ParseOptions {
/**
* A function for encoding input strings.
*/
encodePath?: Encode;
}
export interface PathToRegexpOptions {
/**
* Matches the path completely without trailing characters. (default: `true`)
*/
end?: boolean;
/**
* Allows optional trailing delimiter to match. (default: `true`)
*/
trailing?: boolean;
/**
* Match will be case sensitive. (default: `false`)
*/
sensitive?: boolean;
/**
* The default delimiter for segments. (default: `'/'`)
*/
delimiter?: string;
}
export interface MatchOptions extends PathToRegexpOptions {
/**
* Function for decoding strings for params, or `false` to disable entirely. (default: `decodeURIComponent`)
*/
decode?: Decode | false;
}
export interface CompileOptions {
/**
* Function for encoding input strings for output into the path, or `false` to disable entirely. (default: `encodeURIComponent`)
*/
encode?: Encode | false;
/**
* The default delimiter for segments. (default: `'/'`)
*/
delimiter?: string;
}
/**
* Plain text.
*/
export interface Text {
type: "text";
value: string;
}
/**
* A parameter designed to match arbitrary text within a segment.
*/
export interface Parameter {
type: "param";
name: string;
}
/**
* A wildcard parameter designed to match multiple segments.
*/
export interface Wildcard {
type: "wildcard";
name: string;
}
/**
* A set of possible tokens to expand when matching.
*/
export interface Group {
type: "group";
tokens: Token[];
}
/**
* A token that corresponds with a regexp capture.
*/
export type Key = Parameter | Wildcard;
/**
* A sequence of `path-to-regexp` keys that match capturing groups.
*/
export type Keys = Array<Key>;
/**
* A sequence of path match characters.
*/
export type Token = Text | Parameter | Wildcard | Group;
/**
* Tokenized path instance.
*/
export declare class TokenData {
readonly tokens: Token[];
readonly originalPath?: string | undefined;
constructor(tokens: Token[], originalPath?: string | undefined);
}
/**
* ParseError is thrown when there is an error processing the path.
*/
export declare class PathError extends TypeError {
readonly originalPath: string | undefined;
constructor(message: string, originalPath: string | undefined);
}
/**
* Parse a string for the raw tokens.
*/
export declare function parse(str: string, options?: ParseOptions): TokenData;
/**
* Compile a string to a template function for the path.
*/
export declare function compile<P extends ParamData = ParamData>(path: Path, options?: CompileOptions & ParseOptions): (params?: P) => string;
export type ParamData = Partial<Record<string, string | string[]>>;
export type PathFunction<P extends ParamData> = (data?: P) => string;
/**
* A match result contains data about the path match.
*/
export interface MatchResult<P extends ParamData> {
path: string;
params: P;
}
/**
* A match is either `false` (no match) or a match result.
*/
export type Match<P extends ParamData> = false | MatchResult<P>;
/**
* The match function takes a string and returns whether it matched the path.
*/
export type MatchFunction<P extends ParamData> = (path: string) => Match<P>;
/**
* Supported path types.
*/
export type Path = string | TokenData;
/**
* Transform a path into a match function.
*/
export declare function match<P extends ParamData>(path: Path | Path[], options?: MatchOptions & ParseOptions): MatchFunction<P>;
/**
* Transform a path into a regular expression and capture keys.
*/
export declare function pathToRegexp(path: Path | Path[], options?: PathToRegexpOptions & ParseOptions): {
regexp: RegExp;
keys: Keys;
};
/**
* Stringify token data into a path string.
*/
export declare function stringify(data: TokenData): string;
@@ -0,0 +1,41 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
useLayoutEffect: () => useLayoutEffect2
});
module.exports = __toCommonJS(index_exports);
// src/use-layout-effect.tsx
var React = __toESM(require("react"));
var useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {
};
//# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
{
"private": true,
"types": "../dist/m.d.ts",
"main": "../dist/cjs/m.js",
"module": "../dist/es/m.mjs"
}
@@ -0,0 +1 @@
{"version":3,"file":"refresh-ccw.js","sources":["../../../src/icons/refresh-ccw.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name RefreshCcw\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjEgMTJhOSA5IDAgMCAwLTktOSA5Ljc1IDkuNzUgMCAwIDAtNi43NCAyLjc0TDMgOCIgLz4KICA8cGF0aCBkPSJNMyAzdjVoNSIgLz4KICA8cGF0aCBkPSJNMyAxMmE5IDkgMCAwIDAgOSA5IDkuNzUgOS43NSAwIDAgMCA2Ljc0LTIuNzRMMjEgMTYiIC8+CiAgPHBhdGggZD0iTTE2IDE2aDV2NSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/refresh-ccw\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 RefreshCcw = createLucideIcon('RefreshCcw', [\n ['path', { d: 'M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8', key: '14sxne' }],\n ['path', { d: 'M3 3v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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACpF,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,843 @@
import * as regexes from "./regexes.js";
import { base64Charset, base64urlCharset } from "./schemas.js";
import { extractDefs, finalize, handleUnrepresentable, initializeContext, processSchema, } from "./to-json-schema.js";
import { BIGINT_FORMAT_RANGES, NUMBER_FORMAT_RANGES, assignProp, getEnumValues } from "./util.js";
const narrowMin = (agg, key, value) => {
if (agg[key] === undefined || value > agg[key])
agg[key] = value;
};
const narrowMax = (agg, key, value) => {
if (agg[key] === undefined || value < agg[key])
agg[key] = value;
};
const narrowBoth = (agg, value) => {
narrowMin(agg, "minimum", value);
narrowMax(agg, "maximum", value);
};
const addDivisor = (agg, value) => {
agg.multipleOf ?? (agg.multipleOf = []);
if (!agg.multipleOf.includes(value))
agg.multipleOf.push(value);
};
const addPattern = (agg, pattern) => {
agg.patterns ?? (agg.patterns = new Set());
agg.patterns.add(pattern);
};
const intersectMime = (agg, mime) => {
agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
};
// last-wins, matching the bag's historical write order; the flag keeps an integer format from being lost to a later float one
const setFormat = (agg, format) => {
agg.format = format;
if (format.includes("int"))
agg.isInt = true;
};
const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
const formatContributor = (ranges) => (agg, def) => {
setFormat(agg, def.format);
const [minimum, maximum] = ranges[def.format];
narrowMin(agg, "minimum", minimum);
narrowMax(agg, "maximum", maximum);
};
const contributors = {
greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
multiple_of: (agg, def) => addDivisor(agg, def.value),
number_format: formatContributor(NUMBER_FORMAT_RANGES),
bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
min_length: minContributor,
max_length: maxContributor,
length_equals: (agg, def) => narrowBoth(agg, def.length),
min_size: minContributor,
max_size: maxContributor,
size_equals: (agg, def) => narrowBoth(agg, def.size),
string_format: (agg, def) => {
setFormat(agg, def.format);
if (def.pattern)
addPattern(agg, def.pattern);
if (def.format === "base64" || def.format === "base64url")
agg.contentEncoding = def.format;
if (def.local || def.precision === -1)
agg.laxFormat = true;
},
mime_type: (agg, def) => intersectMime(agg, def.mime),
};
export function aggregateChecks(schema) {
const agg = {};
const def = schema._zod.def;
// a format schema is its own first check, same rule as $ZodType init
const list = schema._zod.traits.has("$ZodCheck")
? [schema, ...(def.checks ?? [])]
: (def.checks ?? []);
for (const ch of list)
contributors[ch._zod.def.check]?.(agg, ch._zod.def);
// reconcile with the bag so third-party onattach contributions still land; first-party residue is never tighter than the fold, so merging it back is idempotent for one and additive for the other
const bag = schema._zod.bag;
if (bag.minimum !== undefined)
narrowMin(agg, "minimum", bag.minimum);
if (bag.exclusiveMinimum !== undefined)
narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
if (bag.maximum !== undefined)
narrowMax(agg, "maximum", bag.maximum);
if (bag.exclusiveMaximum !== undefined)
narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
if (bag.multipleOf !== undefined)
addDivisor(agg, bag.multipleOf);
if (bag.format !== undefined) {
agg.format ?? (agg.format = bag.format);
if (bag.format.includes("int"))
agg.isInt = true;
}
if (bag.mime)
intersectMime(agg, bag.mime);
for (const pattern of bag.patterns ?? [])
addPattern(agg, pattern);
return agg;
}
const formatMap = {
guid: "uuid",
url: "uri",
datetime: "date-time",
json_string: "json-string",
regex: "", // do not set
};
// ==================== SIMPLE TYPE PROCESSORS ====================
// the runtime patterns are lax so parse paths never overflow the regex stack; the emitted schema swaps in the exact block forms, which zod itself never executes
const exactPatterns = new Map([
[base64Charset, regexes.base64],
[base64urlCharset, regexes.base64url],
]);
const exactPattern = (p) => exactPatterns.get(p) ?? p;
export const stringProcessor = (schema, ctx, _json, _params) => {
const json = _json;
json.type = "string";
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
if (typeof minimum === "number")
json.minLength = minimum;
if (typeof maximum === "number")
json.maxLength = maximum;
// custom pattern overrides format
if (format) {
json.format = formatMap[format] ?? format;
if (json.format === "")
delete json.format; // empty format is not valid
// `z.iso.time()` is never full-time, and `laxFormat` carries the datetime shapes that also accept what their keyword forbids
if (format === "time" || laxFormat) {
delete json.format;
}
}
if (contentEncoding)
json.contentEncoding = contentEncoding;
if (patterns && patterns.size > 0) {
const patternList = [...patterns].map(exactPattern);
if (patternList.length === 1)
json.pattern = patternList[0].source;
else if (patternList.length > 1) {
json.allOf = [
...patternList.map((regex) => ({
...(ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0"
? { type: "string" }
: {}),
pattern: regex.source,
})),
];
}
}
};
export const numberProcessor = (schema, ctx, _json, params) => {
const json = _json;
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
json.type = isInt ? "integer" : "number";
// when both minimum and exclusiveMinimum exist, pick the more restrictive one
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
if (exMin) {
if (legacy) {
json.minimum = exclusiveMinimum;
json.exclusiveMinimum = true;
}
else {
json.exclusiveMinimum = exclusiveMinimum;
}
}
else if (typeof minimum === "number") {
json.minimum = minimum;
}
if (exMax) {
if (legacy) {
json.maximum = exclusiveMaximum;
json.exclusiveMaximum = true;
}
else {
json.exclusiveMaximum = exclusiveMaximum;
}
}
else if (typeof maximum === "number") {
json.maximum = maximum;
}
if (multipleOf) {
// JSON Schema requires a divisor strictly greater than zero, and a non-finite one does not survive JSON at all. A negative divisor accepts exactly what its absolute value accepts, so it still maps; zero, NaN and Infinity have no keyword form.
const divisors = new Set();
for (const divisor of multipleOf) {
if (Number.isFinite(divisor) && divisor !== 0)
divisors.add(Math.abs(divisor));
else
handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
}
// chained divisors are a conjunction the keyword cannot carry alone, so extras ride an allOf, same as stacked patterns
const [first, ...rest] = divisors;
if (first !== undefined)
json.multipleOf = first;
if (rest.length)
json.allOf = [...(json.allOf ?? []), ...rest.map((m) => ({ multipleOf: m }))];
}
};
export const booleanProcessor = (_schema, _ctx, json, _params) => {
json.type = "boolean";
};
export const bigintProcessor = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "BigInt cannot be represented in JSON Schema");
};
export const symbolProcessor = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Symbols cannot be represented in JSON Schema");
};
export const nullProcessor = (_schema, ctx, json, _params) => {
if (ctx.target === "openapi-3.0") {
json.type = "string";
json.nullable = true;
json.enum = [null];
}
else {
json.type = "null";
}
};
export const undefinedProcessor = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Undefined cannot be represented in JSON Schema");
};
export const voidProcessor = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Void cannot be represented in JSON Schema");
};
export const neverProcessor = (_schema, _ctx, json, _params) => {
json.not = {};
};
export const anyProcessor = (_schema, _ctx, _json, _params) => {
// empty schema accepts anything
};
export const unknownProcessor = (_schema, _ctx, _json, _params) => {
// empty schema accepts anything
};
export const dateProcessor = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Date cannot be represented in JSON Schema");
};
export const enumProcessor = (schema, _ctx, json, _params) => {
const def = schema._zod.def;
const values = getEnumValues(def.entries);
// an empty enum accepts nothing, same as z.never()
if (values.length === 0) {
json.not = {};
return;
}
// Number enums can have both string and number values
if (values.every((v) => typeof v === "number"))
json.type = "number";
if (values.every((v) => typeof v === "string"))
json.type = "string";
json.enum = values;
};
export const literalProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
// a literal with no values accepts nothing, same as z.never()
if (def.values.length === 0) {
json.not = {};
return;
}
const vals = [];
for (const val of def.values) {
if (val === undefined) {
// a custom schema replaces the whole literal, so there is nothing left to accumulate
if (handleUnrepresentable(schema, ctx, json, params, "Literal `undefined` cannot be represented in JSON Schema"))
return;
// otherwise do not add to vals
}
else if (typeof val === "bigint") {
if (handleUnrepresentable(schema, ctx, json, params, "BigInt literals cannot be represented in JSON Schema"))
return;
vals.push(Number(val));
}
else {
vals.push(val);
}
}
if (vals.length === 0) {
// do nothing (an undefined literal was stripped)
}
else if (vals.length === 1) {
const val = vals[0];
json.type = val === null ? "null" : typeof val;
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
json.enum = [val];
}
else {
json.const = val;
}
}
else {
if (vals.every((v) => typeof v === "number"))
json.type = "number";
if (vals.every((v) => typeof v === "string"))
json.type = "string";
if (vals.every((v) => typeof v === "boolean"))
json.type = "boolean";
if (vals.every((v) => v === null))
json.type = "null";
json.enum = vals;
}
};
export const nanProcessor = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "NaN cannot be represented in JSON Schema");
};
export const templateLiteralProcessor = (schema, _ctx, json, _params) => {
const _json = json;
const pattern = schema._zod.pattern;
if (!pattern)
throw new Error("Pattern not found in template literal");
_json.type = "string";
_json.pattern = pattern.source;
};
export const fileProcessor = (schema, _ctx, json, _params) => {
const _json = json;
_json.type = "string";
_json.format = "binary";
_json.contentEncoding = "binary";
const { minimum, maximum, mime } = aggregateChecks(schema);
if (minimum !== undefined)
_json.minLength = minimum;
if (maximum !== undefined)
_json.maxLength = maximum;
if (!mime)
return;
// an empty intersection means the mime checks share no value, so nothing passes at runtime; `anyOf` must be non-empty, so the false schema is `not: {}`
if (mime.length === 0)
_json.not = {};
else if (mime.length === 1)
_json.contentMediaType = mime[0];
// only contentMediaType differs, so the shared props stay at the root
else
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
};
export const successProcessor = (_schema, _ctx, json, _params) => {
json.type = "boolean";
};
export const customProcessor = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
};
export const functionProcessor = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Function types cannot be represented in JSON Schema");
};
export const transformProcessor = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
};
export const mapProcessor = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Map cannot be represented in JSON Schema");
};
export const setProcessor = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Set cannot be represented in JSON Schema");
};
// ==================== COMPOSITE TYPE PROCESSORS ====================
export const arrayProcessor = (schema, ctx, _json, params) => {
const json = _json;
const def = schema._zod.def;
const { minimum, maximum } = aggregateChecks(schema);
if (typeof minimum === "number")
json.minItems = minimum;
if (typeof maximum === "number")
json.maxItems = maximum;
json.type = "array";
json.items = processSchema(def.element, ctx, {
...params,
path: [...params.path, "items"],
});
};
// Transform and catch set `optin = "optional"` at runtime so the parser lets them observe an
// absent key, but their declared input type stays required. An input JSON Schema describes the
// declared type, so resolve past them to the schema that actually carries the optionality.
// Used by both `objectProcessor` (for `required`) and `tupleProcessor` (for `minItems`); see
// wiki/optionality.md, "The JSON Schema emitter reads the *static* value".
function inputOptin(schema) {
const def = schema._zod.def;
if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) {
return inputOptin(def.out);
}
if (def.type === "catch") {
return inputOptin(def.innerType);
}
return schema._zod.optin;
}
export const objectProcessor = (schema, ctx, _json, params) => {
const json = _json;
const def = schema._zod.def;
const shape = def.shape;
// dropping it while still emitting `additionalProperties: false` would emit a schema that rejects data this one requires
const symbolKeys = Object.getOwnPropertySymbols(shape);
if (symbolKeys.length &&
handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) {
return;
}
json.type = "object";
json.properties = {};
for (const key in shape) {
// assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter on the plain {} we build into
assignProp(json.properties, key, processSchema(shape[key], ctx, {
...params,
path: [...params.path, "properties", key],
}));
}
// required keys
const requiredKeys = [];
for (const key of Object.keys(shape)) {
const field = def.shape[key];
if (ctx.io === "input" ? inputOptin(field) === undefined : field._zod.optout === undefined) {
requiredKeys.push(key);
}
}
if (requiredKeys.length > 0) {
json.required = requiredKeys;
}
// catchall
if (def.catchall?._zod.def.type === "never") {
// strict
json.additionalProperties = false;
}
else if (!def.catchall) {
// regular
if (ctx.io === "output")
json.additionalProperties = false;
}
else if (def.catchall) {
json.additionalProperties = processSchema(def.catchall, ctx, {
...params,
path: [...params.path, "additionalProperties"],
});
}
};
export const unionProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
// Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions
const isExclusive = def.inclusive === false;
const options = def.options.map((x, i) => processSchema(x, ctx, {
...params,
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i],
}));
if (isExclusive) {
json.oneOf = options;
}
else {
json.anyOf = options;
}
};
export const intersectionProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
const a = processSchema(def.left, ctx, {
...params,
path: [...params.path, "allOf", 0],
});
const b = processSchema(def.right, ctx, {
...params,
path: [...params.path, "allOf", 1],
});
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
const allOf = [
...(isSimpleIntersection(a) ? a.allOf : [a]),
...(isSimpleIntersection(b) ? b.allOf : [b]),
];
json.allOf = allOf;
// Recorded innermost first, so a nested intersection has already folded by the time this one is considered. The array is the handle rather than the schema, because a wrapper that inherits this schema shares the same array; `finalize` folds every object holding it. See `foldIntersection`.
ctx.intersections.push(allOf);
};
export const tupleProcessor = (schema, ctx, _json, params) => {
const json = _json;
const def = schema._zod.def;
json.type = "array";
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
...params,
path: [...params.path, prefixPath, i],
}));
const rest = def.rest
? processSchema(def.rest, ctx, {
...params,
path: [...params.path, restPath, ...(ctx.target === "openapi-3.0" ? [def.items.length] : [])],
})
: null;
let minItems = def.items.length;
while (minItems > 0) {
const item = def.items[minItems - 1];
const optional = ctx.io === "input" ? inputOptin(item) !== undefined : item._zod.optout === "optional";
if (!optional)
break;
minItems--;
}
const maxItems = def.items.length;
const isClosed = !def.rest;
if (ctx.target === "draft-2020-12") {
json.prefixItems = prefixItems;
if (isClosed) {
json.items = false;
}
else if (rest) {
json.items = rest;
}
if (minItems > 0)
json.minItems = minItems;
if (isClosed)
json.maxItems = maxItems;
}
else if (ctx.target === "openapi-3.0") {
json.items = {
anyOf: prefixItems,
};
if (rest) {
json.items.anyOf.push(rest);
}
if (minItems > 0)
json.minItems = minItems;
if (isClosed)
json.maxItems = maxItems;
}
else {
json.items = prefixItems;
if (isClosed) {
json.additionalItems = false;
}
else if (rest) {
json.additionalItems = rest;
}
if (minItems > 0)
json.minItems = minItems;
if (isClosed)
json.maxItems = maxItems;
}
// explicit user-defined length checks take precedence
const { minimum, maximum } = aggregateChecks(schema);
if (typeof minimum === "number")
json.minItems = minimum;
if (typeof maximum === "number")
json.maxItems = maximum;
};
/** JSON object keys are always strings, so a numeric record key schema is re-expressed over the
* numeric-string form the record parser matches. Deferred to `finalize`, after the flatten: a key
* behind a wrapper only carries its own `type` before then, and a union key only has its branches.
*
* A numeric bound cannot apply to a property name, so `minimum` and its siblings are dropped rather
* than carried over: keeping them beside `type: "string"` reproduces the match-nothing schema this
* exists to fix. A key that carries one therefore emits wider than the record parses — `z.record(z.number().min(5), V)`
* accepts `"3"` — which is the deliberate trade, since throwing on it would reject an ordinary schema
* outright. */
function stringifyKeyNames(bySchema, json, visited) {
// an extracted key that rewrites cannot go on sharing its definition — the string form a key position needs is not the number form every other reference wants — so it inlines. One that does not rewrite keeps the `$ref`.
if (json.$ref) {
// a recursive key holds its own reference inside its definition, so a node already on the path is left alone rather than resolved again
if (visited.has(json))
return json;
visited.add(json);
const def = bySchema.get(json)?.def;
if (!def)
return json;
const inlined = stringifyKeyNames(bySchema, def, visited);
return inlined === def ? json : inlined;
}
for (const keyword of ["anyOf", "oneOf"]) {
const branches = json[keyword];
if (!Array.isArray(branches))
continue;
const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
// rebuilding regardless would detach a key that had nothing to re-express, dropping its `$ref` and leaking the internal `id`
if (mapped.some((branch, i) => branch !== branches[i]))
json = { ...json, [keyword]: mapped };
}
// a member that already admits a string leaves the key unconstrained, so the node's own type re-expresses only when every member is numeric
const types = Array.isArray(json.type) ? json.type : [json.type];
const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
// a heterogeneous key carries no type at all, so its numeric members are caught here instead
const values = json.enum ?? (json.const !== undefined ? [json.const] : undefined);
if (!numericType && !values?.some((v) => typeof v === "number"))
return json;
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json;
if (rest.enum)
rest.enum = rest.enum.map((v) => (typeof v === "number" ? String(v) : v));
else if (typeof rest.const === "number")
rest.const = String(rest.const);
// a heterogeneous key keeps its absent type: the stringified members already say what a key may be
if (!numericType)
return rest;
rest.type = "string";
if (!values)
rest.pattern = (types.includes("number") ? regexes.number : regexes.integer).source;
return rest;
}
/** Every record of one conversion, so the carriers are found in a single pass rather than once per record. */
const pendingRecords = new WeakMap();
function rewriteKeyNames(ctx) {
// an extracted key is resolved by the object `extractToDef` left in its place, so the map is built once rather than searched per reference. `_zod.toJSONSchema` can hand the same object to two schemas, so the first entry carrying a body wins, as a search would have found it.
const bySchema = new Map();
for (const entry of ctx.seen.values()) {
if (entry.def && !bySchema.has(entry.schema))
bySchema.set(entry.schema, entry);
}
const rewrites = new Map();
for (const record of pendingRecords.get(ctx) ?? []) {
const seen = ctx.seen.get(record);
const names = (seen?.def ?? seen?.schema)?.propertyNames;
if (!names || names === true || rewrites.has(names))
continue;
const rewritten = stringifyKeyNames(bySchema, names, new Set());
if (rewritten !== names)
rewrites.set(names, rewritten);
}
if (!rewrites.size)
return;
// the flatten has already copied each record's own properties onto every wrapper by reference, and an extracted body is another such copy, so every carrier holding a rewritten key is updated together
for (const entry of ctx.seen.values()) {
for (const carrier of [entry.schema, entry.def]) {
const rewritten = carrier && rewrites.get(carrier.propertyNames);
if (rewritten)
carrier.propertyNames = rewritten;
}
}
}
export const recordProcessor = (schema, ctx, _json, params) => {
const json = _json;
const def = schema._zod.def;
json.type = "object";
// For looseRecord with regex patterns, use patternProperties. This correctly represents "only validate keys matching the pattern" semantics and composes well with allOf (intersections)
const keyType = def.keyType;
const patterns = aggregateChecks(keyType).patterns;
if (def.mode === "loose" && patterns && patterns.size > 0) {
// Use patternProperties for looseRecord with regex patterns
const valueSchema = processSchema(def.valueType, ctx, {
...params,
path: [...params.path, "patternProperties", "*"],
});
json.patternProperties = {};
for (const pattern of patterns) {
assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
}
}
else {
// Default behavior: use propertyNames + additionalProperties
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
json.propertyNames = processSchema(def.keyType, ctx, {
...params,
path: [...params.path, "propertyNames"],
});
let pending = pendingRecords.get(ctx);
if (!pending) {
pending = [];
pendingRecords.set(ctx, pending);
ctx.deferred.push(() => rewriteKeyNames(ctx));
}
pending.push(schema);
}
json.additionalProperties = processSchema(def.valueType, ctx, {
...params,
path: [...params.path, "additionalProperties"],
});
}
// Add required for keys with discrete values (enum, literal, etc.)
const keyValues = keyType._zod.values;
// Every key shares one value schema, so an optional-in value makes the whole key set omittable on input. Output keeps them: the exhaustive branch assigns every key, even one whose value came back undefined.
const omittableOnInput = ctx.io === "input" && inputOptin(def.valueType) !== undefined;
if (keyValues && !def.partial && !omittableOnInput) {
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
if (validKeyValues.length > 0) {
json.required = validKeyValues.map(String);
}
}
};
export const nullableProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
const inner = processSchema(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
if (ctx.target === "openapi-3.0") {
seen.ref = def.innerType;
json.nullable = true;
}
else {
json.anyOf = [inner, { type: "null" }];
}
};
export const nonoptionalProcessor = (schema, ctx, _json, params) => {
const def = schema._zod.def;
processSchema(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
};
/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
* A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
* unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
const UNREPRESENTABLE_DEFAULT = Symbol();
function serializeDefaultValue(value, schema, ctx, json, params) {
let unrepresentable = false;
const serialized = JSON.stringify(value, (_, val) => {
if (typeof val !== "bigint")
return val;
unrepresentable = true;
return null;
});
if (!unrepresentable)
return JSON.parse(serialized);
handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
return UNREPRESENTABLE_DEFAULT;
}
export const defaultProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
processSchema(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
if (value !== UNREPRESENTABLE_DEFAULT)
json.default = value;
};
export const prefaultProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
processSchema(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
if (ctx.io !== "input")
return;
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
if (value !== UNREPRESENTABLE_DEFAULT)
json._prefault = value;
};
export const catchProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
processSchema(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
let catchValue;
try {
catchValue = def.catchValue(undefined);
}
catch {
handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
return;
}
json.default = catchValue;
};
export const pipeProcessor = (schema, ctx, _json, params) => {
const def = schema._zod.def;
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
processSchema(innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = innerType;
};
export const readonlyProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
processSchema(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
json.readOnly = true;
};
export const promiseProcessor = (schema, ctx, _json, params) => {
const def = schema._zod.def;
processSchema(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
};
export const optionalProcessor = (schema, ctx, _json, params) => {
const def = schema._zod.def;
processSchema(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
};
export const lazyProcessor = (schema, ctx, _json, params) => {
const innerType = schema._zod.innerType;
processSchema(innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = innerType;
};
// ==================== ALL PROCESSORS ====================
export const allProcessors = {
string: stringProcessor,
number: numberProcessor,
boolean: booleanProcessor,
bigint: bigintProcessor,
symbol: symbolProcessor,
null: nullProcessor,
undefined: undefinedProcessor,
void: voidProcessor,
never: neverProcessor,
any: anyProcessor,
unknown: unknownProcessor,
date: dateProcessor,
enum: enumProcessor,
literal: literalProcessor,
nan: nanProcessor,
template_literal: templateLiteralProcessor,
file: fileProcessor,
success: successProcessor,
custom: customProcessor,
function: functionProcessor,
transform: transformProcessor,
map: mapProcessor,
set: setProcessor,
array: arrayProcessor,
object: objectProcessor,
union: unionProcessor,
intersection: intersectionProcessor,
tuple: tupleProcessor,
record: recordProcessor,
nullable: nullableProcessor,
nonoptional: nonoptionalProcessor,
default: defaultProcessor,
prefault: prefaultProcessor,
catch: catchProcessor,
pipe: pipeProcessor,
readonly: readonlyProcessor,
promise: promiseProcessor,
optional: optionalProcessor,
lazy: lazyProcessor,
};
export function toJSONSchema(input, params) {
if ("_idmap" in input) {
// Registry case
const registry = input;
const ctx = initializeContext({ ...params, processors: allProcessors });
const defs = {};
// First pass: process all schemas to build the seen map
for (const entry of registry._idmap.entries()) {
const [_, schema] = entry;
processSchema(schema, ctx);
}
const schemas = {};
const external = {
registry,
uri: params?.uri,
defs,
};
// Update the context with external configuration
ctx.external = external;
// Second pass: emit each schema
for (const entry of registry._idmap.entries()) {
const [key, schema] = entry;
extractDefs(ctx, schema);
assignProp(schemas, key, finalize(ctx, schema));
}
if (Object.keys(defs).length > 0) {
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
schemas.__shared = {
[defsSegment]: defs,
};
}
return { schemas };
}
// Single schema case
const ctx = initializeContext({ ...params, processors: allProcessors });
processSchema(input, ctx);
extractDefs(ctx, input);
return finalize(ctx, input);
}
@@ -0,0 +1 @@
{"version":3,"names":["Binding","constructor","identifier","scope","path","kind","constantViolations","constant","referencePaths","referenced","references","isInitInLoop","reassign","clearValue","deoptValue","hasDeoptedValue","setValue","value","hasValue","includes","push","reference","dereference","exports","default","isFunctionDeclarationOrHasInit","isVariableDeclarator","node","init","parentPath","key","isFunctionParent","isForXStatement","isLoop"],"sources":["../../src/scope/binding.ts"],"sourcesContent":["import type NodePath from \"../path/index.ts\";\nimport type * as t from \"@babel/types\";\nimport type Scope from \"./index.ts\";\n\nexport type BindingKind =\n | \"var\" /* var declarator */\n | \"let\" /* let declarator, class declaration id, catch clause parameters */\n | \"const\" /* const/using/await using declarator */\n | \"module\" /* import specifiers */\n | \"hoisted\" /* function declaration id */\n | \"param\" /* function declaration parameters */\n | \"local\" /* function expression id, class expression id */\n | \"unknown\"; /* export specifiers */\n/**\n * This class is responsible for a binding inside of a scope.\n *\n * It tracks the following:\n *\n * * Node path.\n * * Amount of times referenced by other nodes.\n * * Paths to nodes that reassign or modify this binding.\n * * The kind of binding. (Is it a parameter, declaration etc)\n */\n\nexport default class Binding {\n identifier: t.Identifier;\n scope: Scope;\n path: NodePath;\n kind: BindingKind;\n\n constructor({\n identifier,\n scope,\n path,\n kind,\n }: {\n identifier: t.Identifier;\n scope: Scope;\n path: NodePath;\n kind: BindingKind;\n }) {\n this.identifier = identifier;\n this.scope = scope;\n this.path = path;\n this.kind = kind;\n\n if ((kind === \"var\" || kind === \"hoisted\") && isInitInLoop(path)) {\n this.reassign(path);\n }\n\n this.clearValue();\n }\n\n constantViolations: NodePath[] = [];\n constant: boolean = true;\n\n referencePaths: NodePath[] = [];\n referenced: boolean = false;\n references: number = 0;\n\n declare hasDeoptedValue: boolean;\n declare hasValue: boolean;\n declare value: any;\n\n deoptValue() {\n this.clearValue();\n this.hasDeoptedValue = true;\n }\n\n setValue(value: any) {\n if (this.hasDeoptedValue) return;\n this.hasValue = true;\n this.value = value;\n }\n\n clearValue() {\n this.hasDeoptedValue = false;\n this.hasValue = false;\n this.value = null;\n }\n\n /**\n * Register a constant violation with the provided `path`.\n */\n\n reassign(path: NodePath) {\n this.constant = false;\n if (this.constantViolations.includes(path)) {\n return;\n }\n this.constantViolations.push(path);\n }\n\n /**\n * Increment the amount of references to this binding.\n */\n\n reference(path: NodePath) {\n if (this.referencePaths.includes(path)) {\n return;\n }\n this.referenced = true;\n this.references++;\n this.referencePaths.push(path);\n }\n\n /**\n * Decrement the amount of references to this binding.\n */\n\n dereference() {\n this.references--;\n this.referenced = !!this.references;\n }\n}\n\nfunction isInitInLoop(path: NodePath) {\n const isFunctionDeclarationOrHasInit =\n !path.isVariableDeclarator() || path.node.init;\n for (\n let { parentPath, key } = path;\n parentPath;\n { parentPath, key } = parentPath\n ) {\n if (parentPath.isFunctionParent()) return false;\n if (\n (key === \"left\" && parentPath.isForXStatement()) ||\n (isFunctionDeclarationOrHasInit && key === \"body\" && parentPath.isLoop())\n ) {\n return true;\n }\n }\n return false;\n}\n"],"mappings":";;;;;;AAwBe,MAAMA,OAAO,CAAC;EAM3BC,WAAWA,CAAC;IACVC,UAAU;IACVC,KAAK;IACLC,IAAI;IACJC;EAMF,CAAC,EAAE;IAAA,KAfHH,UAAU;IAAA,KACVC,KAAK;IAAA,KACLC,IAAI;IAAA,KACJC,IAAI;IAAA,KAyBJC,kBAAkB,GAAe,EAAE;IAAA,KACnCC,QAAQ,GAAY,IAAI;IAAA,KAExBC,cAAc,GAAe,EAAE;IAAA,KAC/BC,UAAU,GAAY,KAAK;IAAA,KAC3BC,UAAU,GAAW,CAAC;IAjBpB,IAAI,CAACR,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAEhB,IAAI,CAACA,IAAI,KAAK,KAAK,IAAIA,IAAI,KAAK,SAAS,KAAKM,YAAY,CAACP,IAAI,CAAC,EAAE;MAChE,IAAI,CAACQ,QAAQ,CAACR,IAAI,CAAC;IACrB;IAEA,IAAI,CAACS,UAAU,CAAC,CAAC;EACnB;EAaAC,UAAUA,CAAA,EAAG;IACX,IAAI,CAACD,UAAU,CAAC,CAAC;IACjB,IAAI,CAACE,eAAe,GAAG,IAAI;EAC7B;EAEAC,QAAQA,CAACC,KAAU,EAAE;IACnB,IAAI,IAAI,CAACF,eAAe,EAAE;IAC1B,IAAI,CAACG,QAAQ,GAAG,IAAI;IACpB,IAAI,CAACD,KAAK,GAAGA,KAAK;EACpB;EAEAJ,UAAUA,CAAA,EAAG;IACX,IAAI,CAACE,eAAe,GAAG,KAAK;IAC5B,IAAI,CAACG,QAAQ,GAAG,KAAK;IACrB,IAAI,CAACD,KAAK,GAAG,IAAI;EACnB;EAMAL,QAAQA,CAACR,IAAc,EAAE;IACvB,IAAI,CAACG,QAAQ,GAAG,KAAK;IACrB,IAAI,IAAI,CAACD,kBAAkB,CAACa,QAAQ,CAACf,IAAI,CAAC,EAAE;MAC1C;IACF;IACA,IAAI,CAACE,kBAAkB,CAACc,IAAI,CAAChB,IAAI,CAAC;EACpC;EAMAiB,SAASA,CAACjB,IAAc,EAAE;IACxB,IAAI,IAAI,CAACI,cAAc,CAACW,QAAQ,CAACf,IAAI,CAAC,EAAE;MACtC;IACF;IACA,IAALine truncated
@@ -0,0 +1,91 @@
'use strict'
// just pre-load all the stuff that index.js lazily exports
const internalRe = require('./internal/re')
const constants = require('./internal/constants')
const SemVer = require('./classes/semver')
const identifiers = require('./internal/identifiers')
const parse = require('./functions/parse')
const valid = require('./functions/valid')
const clean = require('./functions/clean')
const inc = require('./functions/inc')
const diff = require('./functions/diff')
const major = require('./functions/major')
const minor = require('./functions/minor')
const patch = require('./functions/patch')
const prerelease = require('./functions/prerelease')
const compare = require('./functions/compare')
const rcompare = require('./functions/rcompare')
const compareLoose = require('./functions/compare-loose')
const compareBuild = require('./functions/compare-build')
const sort = require('./functions/sort')
const rsort = require('./functions/rsort')
const gt = require('./functions/gt')
const lt = require('./functions/lt')
const eq = require('./functions/eq')
const neq = require('./functions/neq')
const gte = require('./functions/gte')
const lte = require('./functions/lte')
const cmp = require('./functions/cmp')
const coerce = require('./functions/coerce')
const Comparator = require('./classes/comparator')
const Range = require('./classes/range')
const satisfies = require('./functions/satisfies')
const toComparators = require('./ranges/to-comparators')
const maxSatisfying = require('./ranges/max-satisfying')
const minSatisfying = require('./ranges/min-satisfying')
const minVersion = require('./ranges/min-version')
const validRange = require('./ranges/valid')
const outside = require('./ranges/outside')
const gtr = require('./ranges/gtr')
const ltr = require('./ranges/ltr')
const intersects = require('./ranges/intersects')
const simplifyRange = require('./ranges/simplify')
const subset = require('./ranges/subset')
module.exports = {
parse,
valid,
clean,
inc,
diff,
major,
minor,
patch,
prerelease,
compare,
rcompare,
compareLoose,
compareBuild,
sort,
rsort,
gt,
lt,
eq,
neq,
gte,
lte,
cmp,
coerce,
Comparator,
Range,
satisfies,
toComparators,
maxSatisfying,
minSatisfying,
minVersion,
validRange,
outside,
gtr,
ltr,
intersects,
simplifyRange,
subset,
SemVer,
re: internalRe.re,
src: internalRe.src,
tokens: internalRe.t,
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
RELEASE_TYPES: constants.RELEASE_TYPES,
compareIdentifiers: identifiers.compareIdentifiers,
rcompareIdentifiers: identifiers.rcompareIdentifiers,
}
@@ -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 Fullscreen = createLucideIcon("Fullscreen", [
["path", { d: "M3 7V5a2 2 0 0 1 2-2h2", key: "aa7l1z" }],
["path", { d: "M17 3h2a2 2 0 0 1 2 2v2", key: "4qcy5o" }],
["path", { d: "M21 17v2a2 2 0 0 1-2 2h-2", key: "6vwrx8" }],
["path", { d: "M7 21H5a2 2 0 0 1-2-2v-2", key: "ioqczr" }],
["rect", { width: "10", height: "8", x: "7", y: "8", rx: "1", key: "vys8me" }]
]);
export { Fullscreen as default };
//# sourceMappingURL=fullscreen.js.map
@@ -0,0 +1 @@
module.exports={C:{"59":0.00218,"63":0.00218,"72":0.00436,"99":0.00218,"115":0.0545,"120":0.05232,"121":0.07194,"127":0.00436,"140":0.00872,"142":0.00218,"144":0.00218,"146":0.00436,"147":0.00218,"149":0.00218,"150":0.00654,"151":0.00872,"152":0.06104,"153":0.01744,"154":0.11554,"155":0.2071,"156":0.28558,"157":0.00872,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 61 62 64 65 66 67 68 69 70 71 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 122 123 124 125 126 128 129 130 131 132 133 134 135 136 137 138 139 141 143 145 148 158 159 160 3.5 3.6"},D:{"49":0.00218,"50":0.00218,"55":0.00218,"62":0.00218,"64":0.00436,"66":0.00436,"67":0.00218,"68":0.06758,"69":0.01962,"70":0.01308,"73":0.00436,"74":0.00436,"75":0.00218,"77":0.00218,"78":0.00218,"79":0.01962,"80":0.00654,"81":0.00654,"83":0.00654,"84":0.00218,"86":0.0109,"87":0.00436,"88":0.00218,"90":0.00218,"92":0.00218,"93":0.00218,"95":0.00872,"97":0.00218,"98":0.00872,"99":0.00654,"101":0.05668,"103":0.01744,"104":0.00654,"105":0.00872,"106":0.15478,"107":0.00872,"108":0.00654,"109":0.16568,"110":0.00872,"111":0.0218,"112":0.00654,"113":0.00436,"114":0.01744,"116":0.0218,"117":0.00654,"118":0.2943,"119":0.09156,"120":0.09374,"121":0.00436,"122":0.0109,"123":0.00654,"124":0.01526,"125":0.0218,"126":0.01526,"127":0.00436,"128":0.01962,"129":0.00436,"130":0.01526,"131":0.03488,"132":0.00218,"133":0.06976,"134":0.07412,"135":0.06758,"136":0.07412,"137":0.10464,"138":0.12208,"139":0.0763,"140":0.0763,"141":0.0872,"142":0.25942,"143":0.03052,"144":0.03052,"145":0.01962,"146":0.09156,"147":0.03488,"148":0.06104,"149":0.0545,"150":0.23108,"151":0.6758,"152":3.16318,"153":2.50918,"154":0.62348,"155":0.01526,"156":0.00218,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 51 52 53 54 56 57 58 59 60 61 63 65 71 72 76 85 89 91 94 96 100 102 115 157"},F:{"38":0.00218,"46":0.00654,"79":0.0109,"92":0.01308,"93":0.00218,"95":0.01526,"96":0.00218,"98":0.00654,"99":0.00436,"100":0.0109,"101":0.01308,"105":0.00436,"114":0.00654,"117":0.00218,"120":0.00218,"126":0.00436,"127":0.00218,"131":0.00654,"132":0.00436,"133":0.03706,"134":0.10464,"135":1.16412,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 85 86 87 88 89 90 91 94 97 102 103 104 106 107 108 109 110 111 112 113 115 116 118 119 121 122 123 124 125 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"14":0.00654,"16":0.00218,"17":0.00654,"18":0.0436,"84":0.00436,"89":0.00218,"90":0.01526,"92":0.04796,"100":0.00654,"109":0.00436,"119":0.0327,"120":0.04142,"122":0.00654,"129":0.00872,"131":0.01526,"136":0.00218,"137":0.00218,"139":0.00218,"140":0.01526,"141":0.00218,"142":0.00218,"143":0.02398,"144":0.00654,"145":0.00872,"146":0.0109,"147":0.01962,"148":0.0218,"149":0.0218,"150":0.03488,"151":0.15478,"152":1.10962,"153":1.0028,"154":0.25288,_:"12 13 15 79 80 81 83 85 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 121 123 124 125 126 127 128 130 132 133 134 135 138"},E:{"27":0.0218,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.2 16.3 16.4 16.5 17.0 17.2 17.3 17.5 18.0 18.1 18.2 18.3 18.4 27.1 27.2 TP","11.1":0.00436,"12.1":0.00218,"13.1":0.00872,"14.1":0.00218,"15.6":0.01744,"16.6":0.01744,"17.1":0.00436,"17.4":0.00218,"17.6":0.01962,"18.5-18.7":0.00654,"26.0":0.00218,"26.1":0.00218,"26.2":0.00654,"26.3":0.00872,"26.4":0.00218,"26.5":0.02398,"26.6":0.0872},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.0008,"5.0-5.1":0.0008,"6.0-6.1":0,"7.0-7.1":0.00159,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00796,"11.0-11.2":0.0008,"11.3-11.4":0.00159,"12.0-12.1":0,"12.2-12.5":0.0207,"13.0-13.1":0,"13.2":0.00398,"13.3":0,"13.4-13.7":0.0008,"14.0-14.4":0.00318,"14.5-14.8":0.00478,"15.0-15.1":0.00478,"15.2-15.3":0.00318,"15.4":0.00398,"15.5":0.00478,"15.6-15.8":0.10349,"16.0":0.00796,"16.1":0.01433,"16.2":0.00796,"16.3":0.01751,"16.4":0.00398,"16.5":0.00637,"16.6-16.7":0.14409,"17.0":0.00557,"17.1":0.00796,"17.2":0.00796,"17.3":0.01194,"17.4":0.01672,"17.5":0.03264,"17.6-17.7":0.08438,"18.0":0.01751,"18.1":0.03503,"18.2":0.04776,"18.3":0.08279,"18.4":0.05174,"18.5-18.7":1.06913,"26.0":0.05174,"26.1":0.05254,"26.2":0.13693,"26.3":0.14807,"26.4":0.10827,"26.5":0.72523,"26.6":4.47474,"27.0":0.34311,"27.1":0,"27.2":0.00876},P:{"21":0.00928,"24":0.00928,"25":0.00928,"26":0.01857,"27":0.03713,"28":0.16709,"29":0.08354,"30":0.87258,_:"4 20 22 23 5.0-5.4 6.2-6.4 8.2 10.1 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","7.2-7.4":0.02785,"9.2":0.04641,"11.1-11.2":0.00928},I:{"0":0.01Line truncated
@@ -0,0 +1,6 @@
import { Env, ErrorHandler, Handler, Input, MiddlewareHandler, Next, NotFoundHandler, NotFoundResponse, Schema, ToSchema, TypedResponse, ValidationTargets } from "./types.js";
import { HonoRequest } from "./request.js";
import { Context, ContextRenderer, ContextVariableMap, ExecutionContext } from "./context.js";
import { Hono } from "./hono.js";
import { ClientRequestOptions, InferRequestType, InferResponseType } from "./client/types.js";
export { type ClientRequestOptions, Context, type ContextRenderer, type ContextVariableMap, type Env, type ErrorHandler, type ExecutionContext, type Handler, Hono, type HonoRequest, type InferRequestType, type InferResponseType, type Input, type MiddlewareHandler, type Next, type NotFoundHandler, type NotFoundResponse, type Schema, type ToSchema, type TypedResponse, type ValidationTargets };
@@ -0,0 +1,7 @@
'use strict'
const u = require('universalify').fromPromise
module.exports = {
copy: u(require('./copy')),
copySync: require('./copy-sync')
}
@@ -0,0 +1,119 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const type_utils_1 = require("@typescript-eslint/type-utils");
const utils_1 = require("@typescript-eslint/utils");
const typescript_1 = require("typescript");
const util_1 = require("../util");
const testTypeFlag = (flagsToCheck) => type => (0, util_1.isTypeFlagSet)(type, flagsToCheck);
const optionTesters = [
['Any', util_1.isTypeAnyType],
[
'Array',
(type, checker, recursivelyCheckType) => (checker.isArrayType(type) || checker.isTupleType(type)) &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
recursivelyCheckType(type.getNumberIndexType()),
],
// eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum
['Boolean', testTypeFlag(typescript_1.TypeFlags.BooleanLike)],
['Nullish', testTypeFlag(typescript_1.TypeFlags.Null | typescript_1.TypeFlags.Undefined)],
['Number', testTypeFlag(typescript_1.TypeFlags.NumberLike | typescript_1.TypeFlags.BigIntLike)],
[
'RegExp',
(type, checker) => (0, util_1.getTypeName)(checker, type) === 'RegExp',
],
['Never', util_1.isTypeNeverType],
].map(([type, tester]) => ({
type,
option: `allow${type}`,
tester,
}));
exports.default = (0, util_1.createRule)({
name: 'restrict-template-expressions',
meta: {
type: 'problem',
docs: {
description: 'Enforce template literal expressions to be of `string` type',
recommended: {
recommended: true,
strict: [
{
allowAny: false,
allowBoolean: false,
allowNever: false,
allowNullish: false,
allowNumber: false,
allowRegExp: false,
},
],
},
requiresTypeChecking: true,
},
messages: {
invalidType: 'Invalid type "{{type}}" of template literal expression.',
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
...Object.fromEntries(optionTesters.map(({ type, option }) => [
option,
{
type: 'boolean',
description: `Whether to allow \`${type.toLowerCase()}\` typed values in template expressions.`,
},
])),
allow: {
description: `Types to allow in template expressions.`,
...type_utils_1.typeOrValueSpecifiersSchema,
},
},
},
],
},
defaultOptions: [
{
allow: [{ name: ['Error', 'URL', 'URLSearchParams'], from: 'lib' }],
allowAny: true,
allowBoolean: true,
allowNullish: true,
allowNumber: true,
allowRegExp: true,
},
],
create(context, [{ allow, ...options }]) {
const services = (0, util_1.getParserServices)(context);
const { program } = services;
const checker = program.getTypeChecker();
const enabledOptionTesters = optionTesters.filter(({ option }) => options[option]);
return {
TemplateLiteral(node) {
// don't check tagged template literals
if (node.parent.type === utils_1.AST_NODE_TYPES.TaggedTemplateExpression) {
return;
}
for (const expression of node.expressions) {
const expressionType = (0, util_1.getConstrainedTypeAtLocation)(services, expression);
if (!recursivelyCheckType(expressionType)) {
context.report({
node: expression,
messageId: 'invalidType',
data: { type: checker.typeToString(expressionType) },
});
}
}
},
};
function recursivelyCheckType(innerType) {
if (innerType.isUnion()) {
return innerType.types.every(recursivelyCheckType);
}
if (innerType.isIntersection()) {
return innerType.types.some(recursivelyCheckType);
}
return ((0, util_1.isTypeFlagSet)(innerType, typescript_1.TypeFlags.StringLike) ||
(0, util_1.matchesTypeOrBaseType)(services, type => (0, type_utils_1.typeMatchesSomeSpecifier)(type, allow, program), innerType) ||
enabledOptionTesters.some(({ tester }) => tester(innerType, checker, recursivelyCheckType)));
}
},
});
@@ -0,0 +1 @@
{"version":3,"file":"square-dashed-mouse-pointer.js","sources":["../../../src/icons/square-dashed-mouse-pointer.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name SquareDashedMousePointer\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIuMDM0IDEyLjY4MWEuNDk4LjQ5OCAwIDAgMSAuNjQ3LS42NDdsOSAzLjVhLjUuNSAwIDAgMS0uMDMzLjk0M2wtMy40NDQgMS4wNjhhMSAxIDAgMCAwLS42Ni42NmwtMS4wNjcgMy40NDNhLjUuNSAwIDAgMS0uOTQzLjAzM3oiIC8+CiAgPHBhdGggZD0iTTUgM2EyIDIgMCAwIDAtMiAyIiAvPgogIDxwYXRoIGQ9Ik0xOSAzYTIgMiAwIDAgMSAyIDIiIC8+CiAgPHBhdGggZD0iTTUgMjFhMiAyIDAgMCAxLTItMiIgLz4KICA8cGF0aCBkPSJNOSAzaDEiIC8+CiAgPHBhdGggZD0iTTkgMjFoMiIgLz4KICA8cGF0aCBkPSJNMTQgM2gxIiAvPgogIDxwYXRoIGQ9Ik0zIDl2MSIgLz4KICA8cGF0aCBkPSJNMjEgOXYyIiAvPgogIDxwYXRoIGQ9Ik0zIDE0djEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/square-dashed-mouse-pointer\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 SquareDashedMousePointer = createLucideIcon('SquareDashedMousePointer', [\n [\n 'path',\n {\n d: 'M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z',\n key: 'xwnzip',\n },\n ],\n ['path', { d: 'M5 3a2 2 0 0 0-2 2', key: 'y57alp' }],\n ['path', { d: 'M19 3a2 2 0 0 1 2 2', key: '18rm91' }],\n ['path', { d: 'M5 21a2 2 0 0 1-2-2', key: 'sbafld' }],\n ['path', { d: 'M9 3h1', key: '1yesri' }],\n ['path', { d: 'M9 21h2', key: '1qve2z' }],\n ['path', { d: 'M14 3h1', key: '1ec4yj' }],\n ['path', { d: 'M3 9v1', key: '1r0deq' }],\n ['path', { d: 'M21 9v2', key: 'p14lih' }],\n ['path', { d: 'M3 14v1', key: 'vnatye' }],\n]);\n\nexport default SquareDashedMousePointer;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2B,iBAAiB,0BAA4B,CAAA,CAAA,CAAA;AAAA,CAC5E,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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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACvC,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,CALine truncated
@@ -0,0 +1,113 @@
#include "Debounce.hh"
#ifdef __wasm32__
extern "C" void on_timeout(void *ctx) {
Debounce *debounce = (Debounce *)ctx;
debounce->notify();
}
#endif
std::shared_ptr<Debounce> Debounce::getShared() {
static std::weak_ptr<Debounce> sharedInstance;
std::shared_ptr<Debounce> shared = sharedInstance.lock();
if (!shared) {
shared = std::make_shared<Debounce>();
sharedInstance = shared;
}
return shared;
}
Debounce::Debounce() {
mRunning = true;
#ifndef __wasm32__
mThread = std::thread([this] () {
loop();
});
#endif
}
Debounce::~Debounce() {
mRunning = false;
#ifndef __wasm32__
mWaitSignal.notify();
mThread.join();
#endif
}
void Debounce::add(void *key, std::function<void()> cb) {
std::unique_lock<std::mutex> lock(mMutex);
mCallbacks.emplace(key, cb);
}
void Debounce::remove(void *key) {
std::unique_lock<std::mutex> lock(mMutex);
mCallbacks.erase(key);
}
void Debounce::trigger() {
std::unique_lock<std::mutex> lock(mMutex);
#ifdef __wasm32__
notifyIfReady();
#else
mWaitSignal.notify();
#endif
}
#ifndef __wasm32__
void Debounce::loop() {
while (mRunning) {
mWaitSignal.wait();
if (!mRunning) {
break;
}
notifyIfReady();
}
}
#endif
void Debounce::notifyIfReady() {
if (!mRunning) {
return;
}
// If we haven't seen an event in more than the maximum wait time, notify callbacks immediately
// to ensure that we don't wait forever. Otherwise, wait for the minimum wait time and batch
// subsequent fast changes. This also means the first file change in a batch is notified immediately,
// separately from the rest of the batch. This seems like an acceptable tradeoff if the common case
// is that only a single file was updated at a time.
auto time = std::chrono::steady_clock::now();
if ((time - mLastTime) > std::chrono::milliseconds(MAX_WAIT_TIME)) {
mLastTime = time;
notify();
} else {
wait();
}
}
void Debounce::wait() {
#ifdef __wasm32__
clear_timeout(mTimeout);
mTimeout = set_timeout(MIN_WAIT_TIME, this);
#else
auto status = mWaitSignal.waitFor(std::chrono::milliseconds(MIN_WAIT_TIME));
if (mRunning && (status == std::cv_status::timeout)) {
notify();
}
#endif
}
void Debounce::notify() {
std::unique_lock<std::mutex> lock(mMutex);
mLastTime = std::chrono::steady_clock::now();
for (auto it = mCallbacks.begin(); it != mCallbacks.end(); it++) {
auto cb = it->second;
cb();
}
#ifndef __wasm32__
mWaitSignal.reset();
#endif
}
@@ -0,0 +1,16 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Ban = createLucideIcon("Ban", [
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
["path", { d: "m4.9 4.9 14.2 14.2", key: "1m5liu" }]
]);
export { Ban as default };
//# sourceMappingURL=ban.js.map
@@ -0,0 +1,3 @@
"use strict";
/* eslint-disable @typescript-eslint/no-namespace */
Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,111 @@
'use strict';
var inspect = require('object-inspect');
var $TypeError = require('es-errors/type');
/*
* This function traverses the list returning the node corresponding to the given key.
*
* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list.
* By doing so, all the recently used nodes can be accessed relatively quickly.
*/
/** @type {import('./list.d.ts').listGetNode} */
// eslint-disable-next-line consistent-return
var listGetNode = function (list, key, isDelete) {
/** @type {typeof list | NonNullable<(typeof list)['next']>} */
var prev = list;
/** @type {(typeof list)['next']} */
var curr;
// eslint-disable-next-line eqeqeq
for (; (curr = prev.next) != null; prev = curr) {
if (curr.key === key) {
prev.next = curr.next;
if (!isDelete) {
// eslint-disable-next-line no-extra-parens
curr.next = /** @type {NonNullable<typeof list.next>} */ (list.next);
list.next = curr; // eslint-disable-line no-param-reassign
}
return curr;
}
}
};
/** @type {import('./list.d.ts').listGet} */
var listGet = function (objects, key) {
if (!objects) {
return void undefined;
}
var node = listGetNode(objects, key);
return node && node.value;
};
/** @type {import('./list.d.ts').listSet} */
var listSet = function (objects, key, value) {
var node = listGetNode(objects, key);
if (node) {
node.value = value;
} else {
// Prepend the new node to the beginning of the list
objects.next = /** @type {import('./list.d.ts').ListNode<typeof value, typeof key>} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens
key: key,
next: objects.next,
value: value
});
}
};
/** @type {import('./list.d.ts').listHas} */
var listHas = function (objects, key) {
if (!objects) {
return false;
}
return !!listGetNode(objects, key);
};
/** @type {import('./list.d.ts').listDelete} */
// eslint-disable-next-line consistent-return
var listDelete = function (objects, key) {
if (objects) {
return listGetNode(objects, key, true);
}
};
/** @type {import('.')} */
module.exports = function getSideChannelList() {
/** @typedef {ReturnType<typeof getSideChannelList>} Channel */
/** @typedef {Parameters<Channel['get']>[0]} K */
/** @typedef {Parameters<Channel['set']>[1]} V */
/** @type {import('./list.d.ts').RootNode<V, K> | undefined} */ var $o;
/** @type {Channel} */
var channel = {
assert: function (key) {
if (!channel.has(key)) {
throw new $TypeError('Side channel does not contain ' + inspect(key));
}
},
'delete': function (key) {
var deletedNode = listDelete($o, key);
if (deletedNode && $o && !$o.next) {
$o = void undefined;
}
return !!deletedNode;
},
get: function (key) {
return listGet($o, key);
},
has: function (key) {
return listHas($o, key);
},
set: function (key, value) {
if (!$o) {
// Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
$o = {
next: void undefined
};
}
// eslint-disable-next-line no-extra-parens
listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value);
}
};
return channel;
};
@@ -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 MessageSquare = createLucideIcon("MessageSquare", [
["path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z", key: "1lielz" }]
]);
export { MessageSquare as default };
//# sourceMappingURL=message-square.js.map
@@ -0,0 +1,11 @@
import { Context } from "../../context.js";
//#region src/adapter/bun/server.d.ts
/**
* Get Bun Server Object from Context
* @template T - The type of Bun Server
* @param c Context
* @returns Bun Server
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
export declare const getBunServer: <T>(c: Context) => T | undefined;
//#endregion
@@ -0,0 +1 @@
{"version":3,"file":"matching.mjs","sources":["../../../src/matcher/spatial/matching.ts"],"sourcesContent":[null],"names":["MatchSpatial","MatcherBaseClass","constructor","SHIFTED_RX","match","password","matches","Object","keys","options","graphs","forEach","graphName","graph","extend","helper","sorted","checkIfShifted","index","includes","test","charAt","shiftedCount","i","passwordLength","length","j","lastDirection","turns","prevChar","adjacents","found","curDirection","curChar","adjacentsLength","k","adjacent","adjacentIndex","indexOf","foundDirection","push","pattern","token","slice"],"mappings":";;;AASA;;;;AAIG;AACH,MAAMA,YAAa,SAAQC,gBAAgB,CAAA;AAA3CC,EAAAA,WAAAA,GAAA;;IACE,IAAA,CAAAC,UAAU,GAAG,mDAAmD;AAmGlE,EAAA;AAjGEC,EAAAA,KAAKA,CAAC;AAAEC,IAAAA;AAAQ,GAAuB,EAAA;IACrC,MAAMC,OAAO,GAAmB,EAAE;AAClCC,IAAAA,MAAM,CAACC,IAAI,CAAC,IAAI,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,OAAO,CAAEC,SAAS,IAAI;MACrD,MAAMC,KAAK,GAAG,IAAI,CAACJ,OAAO,CAACC,MAAM,CAACE,SAAS,CAAC;AAC5CE,MAAAA,MAAM,CAACR,OAAO,EAAE,IAAI,CAACS,MAAM,CAACV,QAAQ,EAAEQ,KAAK,EAAED,SAAS,CAAC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ACL,UAAA;AACF,QAAA;AACF,MAAA;AACF,IAAA;AACA,IAAA,OAAOpB,OAAO;AAChB,EAAA;AACD;;;;"}
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getESLintCoreRule = void 0;
exports.maybeGetESLintCoreRule = maybeGetESLintCoreRule;
const utils_1 = require("@typescript-eslint/utils");
const use_at_your_own_risk_1 = require("eslint/use-at-your-own-risk");
const getESLintCoreRule = (ruleId) => utils_1.ESLintUtils.nullThrows(use_at_your_own_risk_1.builtinRules.get(ruleId), `ESLint's core rule '${ruleId}' not found.`);
exports.getESLintCoreRule = getESLintCoreRule;
function maybeGetESLintCoreRule(ruleId) {
try {
return (0, exports.getESLintCoreRule)(ruleId);
}
catch {
return null;
}
}
@@ -0,0 +1 @@
{"version":3,"file":"chart-column.js","sources":["../../../src/icons/chart-column.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ChartColumn\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMyAzdjE2YTIgMiAwIDAgMCAyIDJoMTYiIC8+CiAgPHBhdGggZD0iTTE4IDE3VjkiIC8+CiAgPHBhdGggZD0iTTEzIDE3VjUiIC8+CiAgPHBhdGggZD0iTTggMTd2LTMiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/chart-column\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 ChartColumn = createLucideIcon('ChartColumn', [\n ['path', { d: 'M3 3v16a2 2 0 0 0 2 2h16', key: 'c24i48' }],\n ['path', { d: 'M18 17V9', key: '2bz60n' }],\n ['path', { d: 'M13 17V5', key: '1frdt8' }],\n ['path', { d: 'M8 17v-3', key: '17ska0' }],\n]);\n\nexport default ChartColumn;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAAA,CAClD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,92 @@
import { EventEmitter as EE } from 'events';
import { BrotliDecompress, Unzip, ZstdDecompress } from 'minizlib';
import type { TarOptions } from './options.js';
import { Pax } from './pax.js';
import { ReadEntry } from './read-entry.js';
import { type WarnData, type Warner } from './warn-method.js';
declare const STATE: unique symbol;
declare const WRITEENTRY: unique symbol;
declare const READENTRY: unique symbol;
declare const NEXTENTRY: unique symbol;
declare const PROCESSENTRY: unique symbol;
declare const EX: unique symbol;
declare const GEX: unique symbol;
declare const META: unique symbol;
declare const EMITMETA: unique symbol;
declare const BUFFER: unique symbol;
declare const QUEUE: unique symbol;
declare const ENDED: unique symbol;
declare const EMITTEDEND: unique symbol;
declare const EMIT: unique symbol;
declare const UNZIP: unique symbol;
declare const CONSUMECHUNK: unique symbol;
declare const CONSUMECHUNKSUB: unique symbol;
declare const CONSUMEBODY: unique symbol;
declare const CONSUMEMETA: unique symbol;
declare const CONSUMEHEADER: unique symbol;
declare const CONSUMING: unique symbol;
declare const BUFFERCONCAT: unique symbol;
declare const MAYBEEND: unique symbol;
declare const WRITING: unique symbol;
declare const ABORTED: unique symbol;
declare const SAW_VALID_ENTRY: unique symbol;
declare const SAW_NULL_BLOCK: unique symbol;
declare const SAW_EOF: unique symbol;
declare const CLOSESTREAM: unique symbol;
declare const COMPRESSEDBYTESREAD: unique symbol;
declare const DECOMPRESSEDBYTESREAD: unique symbol;
declare const CHECKDECOMPRESSIONRATIO: unique symbol;
export type State = 'begin' | 'header' | 'ignore' | 'meta' | 'body';
export declare class Parser extends EE implements Warner {
file: string;
strict: boolean;
maxMetaEntrySize: number;
filter: Exclude<TarOptions['filter'], undefined>;
brotli?: TarOptions['brotli'];
zstd?: TarOptions['zstd'];
maxDecompressionRatio: number;
writable: true;
readable: false;
[QUEUE]: (ReadEntry | [string | symbol, unknown, unknown])[];
[BUFFER]?: Buffer;
[READENTRY]?: ReadEntry;
[WRITEENTRY]?: ReadEntry;
[STATE]: State;
[META]: string;
[EX]?: Pax;
[GEX]?: Pax;
[ENDED]: boolean;
[UNZIP]?: false | Unzip | BrotliDecompress | ZstdDecompress;
[ABORTED]: boolean;
[SAW_VALID_ENTRY]?: boolean;
[SAW_NULL_BLOCK]: boolean;
[SAW_EOF]: boolean;
[WRITING]: boolean;
[CONSUMING]: boolean;
[EMITTEDEND]: boolean;
[COMPRESSEDBYTESREAD]: number;
[DECOMPRESSEDBYTESREAD]: number;
constructor(opt?: TarOptions);
warn(code: string, message: string | Error, data?: WarnData): void;
[CONSUMEHEADER](chunk: Buffer, position: number): void;
[CLOSESTREAM](): void;
[PROCESSENTRY](entry?: ReadEntry | [string | symbol, unknown, unknown]): boolean;
[NEXTENTRY](): void;
[CONSUMEBODY](chunk: Buffer, position: number): number;
[CONSUMEMETA](chunk: Buffer, position: number): number;
[EMIT](ev: string | symbol, data?: unknown, extra?: unknown): void;
[EMITMETA](entry: ReadEntry): void;
abort(error: Error): void;
[CHECKDECOMPRESSIONRATIO](chunk: Buffer): boolean;
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
[BUFFERCONCAT](c: Buffer): void;
[MAYBEEND](): void;
[CONSUMECHUNK](chunk?: Buffer): void;
[CONSUMECHUNKSUB](chunk: Buffer): void;
end(cb?: () => void): this;
end(data: string | Buffer, cb?: () => void): this;
end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
}
export {};
//# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1,80 @@
# ModuleImporter
by [Nicholas C. Zakas](https://humanwhocodes.com)
If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate).
## Description
A utility for seamlessly importing modules in Node.js regardless if they are CommonJS or ESM format. Under the hood, this uses `import()` and relies on Node.js's CommonJS compatibility to work correctly. This ensures that the correct locations and formats are used for CommonJS so you can call one method and not worry about any compatibility issues.
The problem with the default `import()` is that it always resolves relative to the file location in which it is called. If you want to resolve from a different location, you need to jump through a few hoops to achieve that. This package makes it easy to both resolve and import modules from any directory.
## Usage
### Node.js
Install using [npm][npm] or [yarn][yarn]:
```
npm install @humanwhocodes/module-importer
# or
yarn add @humanwhocodes/module-importer
```
Import into your Node.js project:
```js
// CommonJS
const { ModuleImporter } = require("@humanwhocodes/module-importer");
// ESM
import { ModuleImporter } from "@humanwhocodes/module-importer";
```
### Bun
Install using this command:
```
bun add @humanwhocodes/module-importer
```
Import into your Bun project:
```js
import { ModuleImporter } from "@humanwhocodes/module-importer";
```
## API
After importing, create a new instance of `ModuleImporter` to start emitting events:
```js
// cwd can be omitted to use process.cwd()
const importer = new ModuleImporter(cwd);
// you can resolve the location of any package
const location = importer.resolve("./some-file.cjs");
// you can also import directly
const module = importer.import("./some-file.cjs");
```
For both `resolve()` and `import()`, you can pass in package names and filenames.
## Developer Setup
1. Fork the repository
2. Clone your fork
3. Run `npm install` to setup dependencies
4. Run `npm test` to run tests
## License
Apache 2.0
[npm]: https://npmjs.com/
[yarn]: https://yarnpkg.com/
@@ -0,0 +1 @@
{"version":3,"file":"rectangle-horizontal.js","sources":["../../../src/icons/rectangle-horizontal.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name RectangleHorizontal\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMjAiIGhlaWdodD0iMTIiIHg9IjIiIHk9IjYiIHJ4PSIyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/rectangle-horizontal\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 RectangleHorizontal = createLucideIcon('RectangleHorizontal', [\n ['rect', { width: '20', height: '12', x: '2', y: '6', rx: '2', key: '9lu3g6' }],\n]);\n\nexport default RectangleHorizontal;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB,iBAAiB,qBAAuB,CAAA,CAAA,CAAA;AAAA,CAAA,CAClE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,MAAM,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,26 @@
"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.es2023_array = void 0;
const base_config_1 = require("./base-config");
exports.es2023_array = {
libs: [],
variables: [
['Array', base_config_1.TYPE],
['ReadonlyArray', base_config_1.TYPE],
['Int8Array', base_config_1.TYPE],
['Uint8Array', base_config_1.TYPE],
['Uint8ClampedArray', base_config_1.TYPE],
['Int16Array', base_config_1.TYPE],
['Uint16Array', base_config_1.TYPE],
['Int32Array', base_config_1.TYPE],
['Uint32Array', base_config_1.TYPE],
['Float32Array', base_config_1.TYPE],
['Float64Array', base_config_1.TYPE],
['BigInt64Array', base_config_1.TYPE],
['BigUint64Array', base_config_1.TYPE],
],
};
@@ -0,0 +1 @@
module.exports={C:{"110":0.00507,"113":0.00507,"114":0.03042,"115":0.03549,"120":0.17745,"121":0.37011,"123":0.01014,"124":0.02028,"125":0.00507,"128":0.00507,"131":0.00507,"135":0.00507,"136":0.00507,"140":0.01014,"142":0.00507,"143":0.00507,"146":0.00507,"147":0.02028,"150":0.06591,"152":0.05577,"153":0.01014,"154":0.19773,"155":0.37011,"156":0.35997,"157":0.00507,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 111 112 116 117 118 119 122 126 127 129 130 132 133 134 137 138 139 141 144 145 148 149 151 158 159 160 3.5 3.6"},D:{"68":0.00507,"70":0.00507,"77":0.01014,"79":0.00507,"81":0.00507,"87":0.00507,"98":0.00507,"101":0.00507,"103":0.1014,"104":0.05577,"105":0.06084,"106":0.05577,"107":0.07098,"108":0.06084,"109":0.43602,"110":0.05577,"111":0.06084,"112":0.06591,"115":0.00507,"116":0.16224,"117":0.06084,"118":0.34476,"119":0.31941,"120":0.37011,"121":0.00507,"122":0.16224,"123":0.51714,"124":0.06591,"128":0.03042,"130":0.02028,"131":0.16224,"132":0.00507,"133":0.13689,"134":0.03549,"135":0.04056,"136":0.03549,"137":0.12675,"138":0.1014,"139":0.03549,"140":0.0507,"141":0.05577,"142":0.14703,"143":0.02535,"144":0.14703,"145":0.3549,"146":0.12168,"147":0.03549,"148":0.10647,"149":0.32955,"150":0.46137,"151":2.10912,"152":9.34401,"153":13.35945,"154":3.64026,"155":0.01521,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 69 71 72 73 74 75 76 78 80 83 84 85 86 88 89 90 91 92 93 94 95 96 97 99 100 102 113 114 125 126 127 129 156 157"},F:{"28":0.00507,"90":0.00507,"101":0.02535,"106":0.01014,"107":0.01014,"111":0.00507,"113":0.00507,"115":0.00507,"120":0.01014,"122":0.00507,"133":0.00507,"134":0.08619,"135":0.71994,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 97 98 99 100 102 103 104 105 108 109 110 112 114 116 117 118 119 121 123 124 125 126 127 131 132 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1","9.5-9.6":0.00507},B:{"109":0.01014,"112":0.03549,"119":0.17238,"120":0.14703,"122":0.01014,"124":0.00507,"138":0.00507,"139":0.01014,"140":0.00507,"141":0.01521,"142":0.00507,"144":0.00507,"145":0.00507,"146":0.00507,"147":0.04056,"148":0.01014,"149":0.1014,"150":0.05577,"151":0.29913,"152":2.19531,"153":3.81771,"154":1.10019,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 113 114 115 116 117 118 121 123 125 126 127 128 129 130 131 132 133 134 135 136 137 143"},E:{"27":0.18252,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.4 27.1 TP","14.1":0.01014,"15.6":0.12168,"16.2":0.00507,"16.3":0.00507,"16.5":0.01521,"16.6":0.07605,"17.0":0.01014,"17.1":0.12675,"17.2":0.00507,"17.3":0.01014,"17.4":0.02028,"17.5":0.04056,"17.6":0.09126,"18.0":0.01014,"18.1":0.00507,"18.2":0.00507,"18.3":0.02535,"18.4":0.00507,"18.5-18.7":0.09126,"26.0":0.02028,"26.1":0.00507,"26.2":0.1014,"26.3":0.06591,"26.4":0.06084,"26.5":0.88218,"26.6":1.62747,"27.2":0.00507},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00185,"5.0-5.1":0.00185,"6.0-6.1":0,"7.0-7.1":0.0037,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.0185,"11.0-11.2":0.00185,"11.3-11.4":0.0037,"12.0-12.1":0,"12.2-12.5":0.04811,"13.0-13.1":0,"13.2":0.00925,"13.3":0,"13.4-13.7":0.00185,"14.0-14.4":0.0074,"14.5-14.8":0.0111,"15.0-15.1":0.0111,"15.2-15.3":0.0074,"15.4":0.00925,"15.5":0.0111,"15.6-15.8":0.24053,"16.0":0.0185,"16.1":0.0333,"16.2":0.0185,"16.3":0.04071,"16.4":0.00925,"16.5":0.0148,"16.6-16.7":0.33489,"17.0":0.01295,"17.1":0.0185,"17.2":0.0185,"17.3":0.02775,"17.4":0.03885,"17.5":0.07586,"17.6-17.7":0.19612,"18.0":0.04071,"18.1":0.08141,"18.2":0.11101,"18.3":0.19242,"18.4":0.12026,"18.5-18.7":2.48486,"26.0":0.12026,"26.1":0.12212,"26.2":0.31824,"26.3":0.34414,"26.4":0.25163,"26.5":1.68556,"26.6":10.40014,"27.0":0.79745,"27.1":0,"27.2":0.02035},P:{"4":0.00933,"20":0.00933,"25":0.00933,"26":0.00933,"27":0.00933,"28":0.00933,"29":0.04666,"30":2.50092,_:"21 22 23 24 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 19.0","18.0":0.00933},I:{"0":0.02956,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.12325,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0":27.91606},R:{_:"0"},M:{"0":0.35989},Q:{_:"14.9"},O:{"0":0.17255},H:{all:0}};
@@ -0,0 +1,58 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("./Resolver")} Resolver */
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
module.exports = class LogInfoPlugin {
/**
* @param {string | ResolveStepHook} source source
*/
constructor(source) {
this.source = source;
}
/**
* @param {Resolver} resolver the resolver
* @returns {void}
*/
apply(resolver) {
const { source } = this;
resolver
.getHook(this.source)
.tapAsync("LogInfoPlugin", (request, resolveContext, callback) => {
if (!resolveContext.log) return callback();
const { log } = resolveContext;
const prefix = `[${source}] `;
if (request.path) {
log(`${prefix}Resolving in directory: ${request.path}`);
}
if (request.request) {
log(`${prefix}Resolving request: ${request.request}`);
}
if (request.module) log(`${prefix}Request is an module request.`);
if (request.directory) log(`${prefix}Request is a directory request.`);
if (request.query) {
log(`${prefix}Resolving request query: ${request.query}`);
}
if (request.fragment) {
log(`${prefix}Resolving request fragment: ${request.fragment}`);
}
if (request.descriptionFilePath) {
log(
`${prefix}Has description data from ${request.descriptionFilePath}`,
);
}
if (request.relativePath) {
log(
`${prefix}Relative path from description file is: ${request.relativePath}`,
);
}
callback();
});
}
};
@@ -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 Nfc = createLucideIcon("Nfc", [
["path", { d: "M6 8.32a7.43 7.43 0 0 1 0 7.36", key: "9iaqei" }],
["path", { d: "M9.46 6.21a11.76 11.76 0 0 1 0 11.58", key: "1yha7l" }],
["path", { d: "M12.91 4.1a15.91 15.91 0 0 1 .01 15.8", key: "4iu2gk" }],
["path", { d: "M16.37 2a20.16 20.16 0 0 1 0 20", key: "sap9u2" }]
]);
export { Nfc as default };
//# sourceMappingURL=nfc.js.map
@@ -0,0 +1,16 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const CircleCheckBig = createLucideIcon("CircleCheckBig", [
["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
]);
export { CircleCheckBig as default };
//# sourceMappingURL=circle-check-big.js.map
@@ -0,0 +1,9 @@
export declare class SymlinkError extends Error {
path: string;
symlink: string;
syscall: "symlink";
code: "TAR_SYMLINK_ERROR";
constructor(symlink: string, path: string);
get name(): string;
}
//# sourceMappingURL=symlink-error.d.ts.map
@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.safeDecodeAsync = exports.safeEncodeAsync = exports.safeDecode = exports.safeEncode = exports.decodeAsync = exports.encodeAsync = exports.decode = exports.encode = exports.safeParseAsync = exports.parseAsync = exports.safeParse = exports.parse = exports.validateAsync = exports.validate = void 0;
var index_js_1 = require("../core/index.cjs");
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return index_js_1.validate; } });
Object.defineProperty(exports, "validateAsync", { enumerable: true, get: function () { return index_js_1.validateAsync; } });
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return index_js_1.parse; } });
Object.defineProperty(exports, "safeParse", { enumerable: true, get: function () { return index_js_1.safeParse; } });
Object.defineProperty(exports, "parseAsync", { enumerable: true, get: function () { return index_js_1.parseAsync; } });
Object.defineProperty(exports, "safeParseAsync", { enumerable: true, get: function () { return index_js_1.safeParseAsync; } });
Object.defineProperty(exports, "encode", { enumerable: true, get: function () { return index_js_1.encode; } });
Object.defineProperty(exports, "decode", { enumerable: true, get: function () { return index_js_1.decode; } });
Object.defineProperty(exports, "encodeAsync", { enumerable: true, get: function () { return index_js_1.encodeAsync; } });
Object.defineProperty(exports, "decodeAsync", { enumerable: true, get: function () { return index_js_1.decodeAsync; } });
Object.defineProperty(exports, "safeEncode", { enumerable: true, get: function () { return index_js_1.safeEncode; } });
Object.defineProperty(exports, "safeDecode", { enumerable: true, get: function () { return index_js_1.safeDecode; } });
Object.defineProperty(exports, "safeEncodeAsync", { enumerable: true, get: function () { return index_js_1.safeEncodeAsync; } });
Object.defineProperty(exports, "safeDecodeAsync", { enumerable: true, get: function () { return index_js_1.safeDecodeAsync; } });
// seal-cjs-exports
(function () {
var keys = Object.getOwnPropertyNames(exports);
for (var i = 0; i < keys.length; i++) {
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
if (!desc || !desc.get || !desc.configurable) continue;
var value;
try {
value = desc.get();
} catch (e) {
continue;
}
// a circular require may not have settled this one yet, so leave it live
if (value === undefined) continue;
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
}
Object.freeze(exports);
})();
@@ -0,0 +1,627 @@
export default `flf2a$ 6 5 10 0 13
weird.flf (version 2)
by: Bas Meijer meijer@info.win.tue.nl bas@damek.kth.se
fixed by: Ryan Youck youck@cs.uregina.ca
some special characters '#%*' etc. are not matching, they are from other fonts.
Explanation of first line:
flf2 - "magic number" for file identification
a - should always be \`a', for now
$ - the "hardblank" -- prints as a blank, but can't be smushed
6 - height of a character
5 - height of a character, not including descenders
20 - max line length (excluding comment lines) + a fudge factor
15 - default smushmode for this font (like "-m 15" on command line)
13 - number of comment lines
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
@
$ / $@
$( $@
$| $@
$_ $@
@@
@
$//$@
$ $@
$ $@
$ @
@@
@
. . @
-+-+-@
-+-+-@
\` \` @
@@
$ ,_$@
$/| |@
(_|_$@
| )@
|_|/$@
$ \` $@@
@
o /@
$ /$@
$/ $@
/ o@
@@
_ @
$/ |$@
(__/$@
$/ \\)@
|__/\\@
@@
@
$/$@
$ $@
$ $@
$ @
@@
@
/@
| @
| @
| @
\\@@
@
\\ @
|@
|@
|@
/ @@
@
@
.|.@
-*-@
'|\`@
@@
@
@
| @
-+- @
| @
@@
@
$ $@
$ $@
$ $@
$ $@
/ $@@
@
$ $@
$___$@
$ $@
$ $@
@@
@
$ $@
$ $@
$ $@
$ $@
- $@@
@
/@
/ @
/ @
/ @
@@
__ @
$/ |@
( |@
| )@
|__/$@
@@
_ @
$/| $@
( | $@
$ | )@
$_|/$@
@@
__ @
$/ )@
( /$@
$ / )@
$/_/$@
@@
__ @
$ |@
$___|@
$ )@
$__/$@
@@
@
$/ |@
(___|@
$ )@
$ /$@
@@
__ @
$/ $@
|___$@
$ )@
$__/$@
@@
__ @
$/ $@
(___$@
| )@
|__/$@
@@
__ @
$/ |@
( |@
$ )@
$ /$@
@@
__ @
$/ |@
(___|@
| )@
|__/$@
@@
__ @
$/ |@
(___|@
$ )@
$__/$@
@@
@
$ $@
$_ $@
$ $@
$- $@
@@
@
$ $@
$_ $@
$ $@
$/ $@
@@
@
$/@
/$@
\\$@
$\\@
@@
$@
$@
___$@
___$@
$@
$@@
@
\\$@
$\\@
$/@
/$@
@@
__ @
$/ |@
( _|@
$ / $@
$_ $@
@@
__ @
$/ |@
( O_/@
| $@
|__/$@
@@
__ @
$/ |@
(___|@
| )@
| /$@
@@
__ @
|/ |@
|___|@
| )@
|__/$@
@@
__ @
$/ $@
( $@
| )@
|__/$@
@@
__ @
|/ |@
| |@
| )@
|__/$@
@@
__ @
$/ $@
(___$@
| $@
|__ $@
@@
___@
$/ $@
(___$@
| $@
| $@
@@
__ @
$/ $@
( __$@
| )@
|__/$@
@@
@
$/ |@
(___|@
| )@
| /$@
@@
@
$/@
($@
|$@
|$@
@@
@
$|@
$|@
$)@
_/$@
@@
@
$/ |@
(___|@
|\\ $@
| \\ $@
@@
@
$/ $@
( $@
| )@
|__/$@
@@
@
$/|/|@
( / |@
| )@
| /$@
@@
@
$/| |@
( | |@
| | )@
| |/$@
@@
__ @
$/ |@
( |@
| )@
|__/$@
@@
__ @
$/ |@
(___|@
| $@
| $@
@@
__ @
$/ |@
( |@
| \\)@
|__/\\@
@@
__ @
$/ |@
(___|@
|\\ $@
| \\ $@
@@
__ @
$/ $@
(___$@
$ )@
$__/$@
@@
__@
$/|$@
( |$@
$ |$@
$ |$@
@@
@
$/ |@
( |@
| )@
|__/$@
@@
@
$/ |@
( |@
$\\ )@
$ \\/$@
@@
@
$/ |@
( |@
| / )@
|/|/$@
@@
@
$/ /$@
(_/_$@
$/ )@
/ /$@
@@
@
$/ |@
(___|@
$ )@
$__/$@
@@
__ @
$/ /$@
( / $@
$/ )@
/__/$@
@@
_@
| @
| @
: @
| @
\`-@@
@
\\ @
\\ @
\\ @
\\@
@@
_ @
|@
|@
:@
|@
-'@@
_ @
/ \\@
$ $@
$ $@
@
@@
@
@
$ $@
$ $@
$ $@
$---$@@
@
$\\$@
$ $@
$ $@
$ @
@@
@
@
$___$@
| )@
|__/|@
@@
@
$/ @
(___$@
| )@
|__/$@
@@
@
@
$___$@
| $@
|__ $@
@@
@
|@
$___|@
| )@
|__/$@
@@
@
@
$___$@
|___)@
|__ $@
@@
__ @
$/ $@
( $@
|___$@
| $@
@@
@
@
$___$@
| )@
|__/$@
__/ @@
@
$/ @
(___$@
| )@
| /$@
@@
@
$/@
$$@
|$@
|$@
@@
@
$ |@
$ $@
$ )@
$/$@
__/ @@
@
$/ @
( $@
|___)@
| \\ $@
@@
@
$/@
($@
|$@
|$@
@@
@
@
$_ _$@
| | )@
| /$@
@@
@
@
$___$@
| )@
| /$@
@@
@
@
$___$@
| )@
|__/$@
@@
@
@
$___$@
| )@
|__/$@
| @@
@
@
$___$@
| )@
|__/|@
|@@
@
@
$___$@
| )@
| $@
@@
@
@
$___$@
|___$@
$__/$@
@@
@
$/ @
(___$@
| $@
|__ $@
@@
@
@
$ $@
| )@
|__/$@
@@
@
@
$ $@
$\\ )@
$ \\/$@
@@
@
@
$ $@
| )@
|/\\/$@
@@
@
@
$ $@
(_/_$@
$/ /$@
@@
@
@
$ $@
\\ )@
$\\_/$@
/ @@
@
@
$___$@
$__/$@
/__ $@
@@
_@
$| @
_| @
: @
$| @
\`-@@
$@
|$@
($@
|$@
|$@
$@@
_ @
|$@
|_@
: @
|$@
-' @@
_ @
/ \\_/@
$ $@
$ $@
@
@@
$-__-@
$/ |@
(___|@
| )@
| /$@
@@
$-__-@
$/ |@
( |@
| )@
|__/$@
@@
$- -@
$/ |@
( |@
| )@
|__/$@
@@
@
$ $@
-___-@
| )@
|__/|@
@@
@
$ $@
-___-@
| )@
|__/$@
@@
@
$ $@
- -$@
| )@
|__/$@
@@
__ @
|/ |@
|___|@
| )@
|__/$@
| $@@
`
@@ -0,0 +1 @@
{"version":3,"names":["_assertThisInitialized","require","_possibleConstructorReturn","self","value","TypeError","assertThisInitialized"],"sources":["../../src/helpers/possibleConstructorReturn.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nimport assertThisInitialized from \"./assertThisInitialized.ts\";\n\nexport default function _possibleConstructorReturn(\n self: object | undefined,\n value: unknown,\n) {\n if (value && (typeof value === \"object\" || typeof value === \"function\")) {\n return value;\n } else if (value !== void 0) {\n throw new TypeError(\n \"Derived constructors may only return object or undefined\",\n );\n }\n\n return assertThisInitialized(self);\n}\n"],"mappings":";;;;;;AAEA,IAAAA,sBAAA,GAAAC,OAAA;AAEe,SAASC,0BAA0BA,CAChDC,IAAwB,EACxBC,KAAc,EACd;EACA,IAAIA,KAAK,KAAK,OAAOA,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,UAAU,CAAC,EAAE;IACvE,OAAOA,KAAK;EACd,CAAC,MAAM,IAAIA,KAAK,KAAK,KAAK,CAAC,EAAE;IAC3B,MAAM,IAAIC,SAAS,CACjB,0DACF,CAAC;EACH;EAEA,OAAO,IAAAC,8BAAqB,EAACH,IAAI,CAAC;AACpC","ignoreList":[]}
@@ -0,0 +1 @@
{"version":3,"file":"sidebar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,3 @@
# `react-use-size`
This is an internal utility, not intended for public usage.
@@ -0,0 +1 @@
{"version":3,"file":"boolSchema.js","sourceRoot":"","sources":["../../../lib/compile/validate/boolSchema.ts"],"names":[],"mappings":";;;AAEA,sCAAqC;AACrC,wCAAkC;AAClC,oCAAwB;AAExB,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,yBAAyB;CACnC,CAAA;AAED,SAAgB,oBAAoB,CAAC,EAAa;IAChD,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAC,GAAG,EAAE,CAAA;IACtC,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,gBAAgB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;IAC7B,CAAC;SAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QAC/D,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,IAAI,CAAC,CAAA;IACpB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,YAAY,SAAS,EAAE,IAAI,CAAC,CAAA;QAC3C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC;AACH,CAAC;AAVD,oDAUC;AAED,SAAgB,iBAAiB,CAAC,EAAa,EAAE,KAAW;IAC1D,MAAM,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,EAAE,CAAA;IACxB,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA,CAAC,WAAW;QACjC,gBAAgB,CAAC,EAAE,CAAC,CAAA;IACtB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA,CAAC,WAAW;IAClC,CAAC;AACH,CAAC;AARD,8CAQC;AAED,SAAS,gBAAgB,CAAC,EAAa,EAAE,iBAA2B;IAClE,MAAM,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IACtB,sFAAsF;IACtF,MAAM,GAAG,GAAoB;QAC3B,GAAG;QACH,OAAO,EAAE,cAAc;QACvB,IAAI;QACJ,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,EAAE;QACV,EAAE;KACH,CAAA;IACD,IAAA,oBAAW,EAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAA;AAC3D,CAAC"}
@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const validate_1 = require("../../compile/validate");
const code_1 = require("../code");
const util_1 = require("../../compile/util");
const additionalProperties_1 = require("./additionalProperties");
const def = {
keyword: "properties",
type: "object",
schemaType: "object",
code(cxt) {
const { gen, schema, parentSchema, data, it } = cxt;
if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === undefined) {
additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties"));
}
const allProps = (0, code_1.allSchemaProperties)(schema);
for (const prop of allProps) {
it.definedProperties.add(prop);
}
if (it.opts.unevaluated && allProps.length && it.props !== true) {
it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);
}
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p]));
if (properties.length === 0)
return;
const valid = gen.name("valid");
for (const prop of properties) {
if (hasDefault(prop)) {
applyPropertySchema(prop);
}
else {
gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties));
applyPropertySchema(prop);
if (!it.allErrors)
gen.else().var(valid, true);
gen.endIf();
}
cxt.it.definedProperties.add(prop);
cxt.ok(valid);
}
function hasDefault(prop) {
return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined;
}
function applyPropertySchema(prop) {
cxt.subschema({
keyword: "properties",
schemaProp: prop,
dataProp: prop,
}, valid);
}
},
};
exports.default = def;
//# sourceMappingURL=properties.js.map
@@ -0,0 +1,113 @@
#ifndef NODE_SQLITE3_SRC_VTAB_H
#define NODE_SQLITE3_SRC_VTAB_H
// JavaScript virtual tables (Phase 4): `db.table(name, definition)`.
//
// The better-sqlite3-proven shape, read-only in v1: a JS generator
// function produces rows, described by a column list; entries of
// `parameters` are declared HIDDEN, which turns the module into a
// table-valued function (`SELECT * FROM name(arg)` passes `arg` to the
// generator through an equality constraint — see xBestIndex). A factory
// function instead of a definition registers a named module instantiated
// per `CREATE VIRTUAL TABLE ... USING name(args)`.
//
// Threading:
//
// - xBestIndex/xEof/xColumn/xRowid are pure C++ over the rows buffered on
// the cursor, so the query planner (prepare path) never calls
// JavaScript — the same design principle as the C++ authorizer.
// - xFilter invokes the generator and buffers its first batch of rows;
// xNext pulls another batch only when the cursor has consumed the last
// one (64 rows, doubling to 1024). Batching is what makes `LIMIT 3`
// over an unbounded generator terminate, and what keeps a table larger
// than memory streamable, while a full scan still pays only one round
// trip per 1024 rows. On a worker each pull is one blocking round trip
// to the JS thread; on the synchronous path (sync_sqlite_depth > 0) it
// is a direct re-entrant call, like Phase 2's user functions.
// - A scan abandoned early (LIMIT, or an error) drops the iterator
// without resuming it: the generator is left suspended, so a `finally`
// inside it does not run. Generator cleanup is not a place to release
// resources.
// - Registration/removal are scheduled exclusively and refuse from
// inside a sync-invoked callback (a stepping VM holds the module).
//
// Instances keep a raw VtabModule*. The registry on Database owns the
// holders, and sqlite decides when one may die: it calls the
// sqlite3_create_module_v2 destructor (VtabOps::ModuleDestroy) once the
// registration has been replaced or dropped *and* every instance created
// against it has been disconnected. That destructor can fire on a worker
// (sqlite3_close), where napi calls are illegal, so it hands the holder to
// Database::QueueVtabModule and the JS thread frees it (Process /
// ~Database). RemoveVtabs only mops up holders sqlite never took.
#include <string>
#include <vector>
#include <sqlite3.h>
#include <napi.h>
#include <uv.h>
#include "convert.h"
#include "database.h"
namespace node_sqlite3 {
// One registered module. Columns/params are captured here so xConnect can
// build the declare_vtab DDL without JavaScript.
struct VtabModule {
Database* db;
std::string name;
std::vector<std::string> columns; // visible result columns
std::vector<std::string> params; // HIDDEN table-function parameters
bool has_factory = false;
Napi::FunctionReference factory; // has_factory: (args...) => definition
Napi::FunctionReference rows; // otherwise: the generator itself
sqlite3_module* module = NULL; // the registration handed to sqlite
bool dead = false; // dropped; instances may still hold it
};
// Per-instance state (eponymous: one per connection; factory: one per
// CREATE VIRTUAL TABLE). Carries the factory-produced definition when the
// module was registered through a factory.
struct VtabInstance {
sqlite3_vtab base;
VtabModule* module;
// A factory instantiation's own rows generator (NULL for eponymous
// instances, which use the module's). A raw napi_ref because
// xDisconnect — which must hand it back — can run on a worker thread
// (sqlite3_close), where napi calls are not allowed; it queues onto
// Database::pending_vtab_refs instead and the JS thread deletes it.
napi_ref rows_ref = NULL;
};
struct VtabCursor {
sqlite3_vtab_cursor base;
VtabInstance* instance;
Rows rows; // the current batch
size_t pos = 0; // position within the batch
// The live iterator (a raw napi_ref: xClose can run on a worker, so
// the reference is queued for the JS thread like rows_ref), the next
// batch size, and whether the generator is done.
napi_ref iterator = NULL;
size_t batch = 0;
bool exhausted = false;
// Rows delivered by earlier batches, so xRowid stays monotonic across
// batch boundaries (it is `produced + pos + 1`).
size_t produced = 0;
// The hidden-parameter values xFilter received, indexed by parameter
// position, and which of them were supplied: a row that leaves a
// HIDDEN column NULL reports the argument the table-valued function
// was called with, so `SELECT count FROM seq(3)` and a second
// equality constraint on the same parameter both behave.
std::vector<Cell> args;
std::vector<bool> has_arg;
};
// JS-visible entry points on Database (wrapped by lib/sqlite3.js, which
// validates the definition and flushes the statement cache). Declarations
// live in database.h alongside the other registration surface; this file
// declares the module/instance/cursor types above.
} // namespace node_sqlite3
#endif
@@ -0,0 +1,18 @@
import { assignRef } from './assignRef';
import { useCallbackRef } from './useRef';
/**
* Create a _lense_ on Ref, making it possible to transform ref value
* @param {ReactRef} ref
* @param {Function} transformer. 👉 Ref would be __NOT updated__ on `transformer` update.
* @returns {RefObject}
*
* @see https://github.com/theKashey/use-callback-ref#usetransformref-to-replace-reactuseimperativehandle
* @example
*
* const ResizableWithRef = forwardRef((props, ref) =>
* <Resizable {...props} ref={useTransformRef(ref, i => i ? i.resizable : null)}/>
* );
*/
export function useTransformRef(ref, transformer) {
return useCallbackRef(null, function (value) { return assignRef(ref, transformer(value)); });
}
@@ -0,0 +1 @@
{"version":3,"file":"ticket-percent.js","sources":["../../../src/icons/ticket-percent.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name TicketPercent\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMiA5YTMgMyAwIDEgMSAwIDZ2MmEyIDIgMCAwIDAgMiAyaDE2YTIgMiAwIDAgMCAyLTJ2LTJhMyAzIDAgMSAxIDAtNlY3YTIgMiAwIDAgMC0yLTJINGEyIDIgMCAwIDAtMiAyWiIgLz4KICA8cGF0aCBkPSJNOSA5aC4wMSIgLz4KICA8cGF0aCBkPSJtMTUgOS02IDYiIC8+CiAgPHBhdGggZD0iTTE1IDE1aC4wMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/ticket-percent\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst TicketPercent = createLucideIcon('TicketPercent', [\n [\n 'path',\n {\n d: 'M2 9a3 3 0 1 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z',\n key: '1l48ns',\n },\n ],\n ['path', { d: 'M9 9h.01', key: '1q5me6' }],\n ['path', { d: 'm15 9-6 6', key: '1uzhvr' }],\n ['path', { d: 'M15 15h.01', key: 'lqbp3k' }],\n]);\n\nexport default TicketPercent;\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,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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A,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,75 @@
'use strict';
const node_util = require('node:util');
const node_path = require('node:path');
function parseStack(stack, message) {
const cwd = process.cwd() + node_path.sep;
const lines = stack.split("\n").splice(message.split("\n").length).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
return lines;
}
function writeStream(data, stream) {
const write = stream.__write || stream.write;
return write.call(stream, data);
}
const bracket = (x) => x ? `[${x}]` : "";
class BasicReporter {
formatStack(stack, message, opts) {
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
return indent + parseStack(stack, message).join(`
${indent}`);
}
formatError(err, opts) {
const message = err.message ?? node_util.formatWithOptions(opts, err);
const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
const level = opts?.errorLevel || 0;
const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
return causedPrefix + message + "\n" + stack + causedError;
}
formatArgs(args, opts) {
const _args = args.map((arg) => {
if (arg && typeof arg.stack === "string") {
return this.formatError(arg, opts);
}
return arg;
});
return node_util.formatWithOptions(opts, ..._args);
}
formatDate(date, opts) {
return opts.date ? date.toLocaleTimeString() : "";
}
filterAndJoin(arr) {
return arr.filter(Boolean).join(" ");
}
formatLogObj(logObj, opts) {
const message = this.formatArgs(logObj.args, opts);
if (logObj.type === "box") {
return "\n" + [
bracket(logObj.tag),
logObj.title && logObj.title,
...message.split("\n")
].filter(Boolean).map((l) => " > " + l).join("\n") + "\n";
}
return this.filterAndJoin([
bracket(logObj.type),
bracket(logObj.tag),
message
]);
}
log(logObj, ctx) {
const line = this.formatLogObj(logObj, {
columns: ctx.options.stdout.columns || 0,
...ctx.options.formatOptions
});
return writeStream(
line + "\n",
logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
);
}
}
exports.BasicReporter = BasicReporter;
exports.parseStack = parseStack;
@@ -0,0 +1,12 @@
export { assignRef } from './assignRef';
// callback ref
export { useCallbackRef } from './useRef';
export { createCallbackRef } from './createRef';
// merge ref
export { mergeRefs } from './mergeRef';
export { useMergeRefs } from './useMergeRef';
// transform ref
export { useTransformRef } from './useTransformRef';
export { transformRef } from './transformRef';
// refToCallback
export { refToCallback, useRefToCallback } from './refToCallback';
@@ -0,0 +1,19 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlatESLint = void 0;
/* eslint-disable @typescript-eslint/no-namespace */
const eslint_1 = require("eslint");
const use_at_your_own_risk_1 = __importDefault(require("eslint/use-at-your-own-risk"));
/**
* The ESLint class is the primary class to use in Node.js applications.
* This class depends on the Node.js fs module and the file system, so you cannot use it in browsers.
*
* If you want to lint code on browsers, use the Linter class instead.
*/
class FlatESLint extends (use_at_your_own_risk_1.default.FlatESLint ??
eslint_1.ESLint) {
}
exports.FlatESLint = FlatESLint;
@@ -0,0 +1 @@
{"version":3,"file":"hash.js","sources":["../../../src/icons/hash.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Hash\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8bGluZSB4MT0iNCIgeDI9IjIwIiB5MT0iOSIgeTI9IjkiIC8+CiAgPGxpbmUgeDE9IjQiIHgyPSIyMCIgeTE9IjE1IiB5Mj0iMTUiIC8+CiAgPGxpbmUgeDE9IjEwIiB4Mj0iOCIgeTE9IjMiIHkyPSIyMSIgLz4KICA8bGluZSB4MT0iMTYiIHgyPSIxNCIgeTE9IjMiIHkyPSIyMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/hash\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 Hash = createLucideIcon('Hash', [\n ['line', { x1: '4', x2: '20', y1: '9', y2: '9', key: '4lhtct' }],\n ['line', { x1: '4', x2: '20', y1: '15', y2: '15', key: 'vyu0kd' }],\n ['line', { x1: '10', x2: '8', y1: '3', y2: '21', key: '1ggp8o' }],\n ['line', { x1: '16', x2: '14', y1: '3', y2: '21', key: 'weycgp' }],\n]);\n\nexport default Hash;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,iBAAiB,MAAQ,CAAA,CAAA,CAAA;AAAA,CACpC,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI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019-04-24
==================
* Add `test(string)` function
1.0.2 / 2019-04-19
==================
* Fix JSDoc comment for `parse` function
1.0.1 / 2018-10-20
==================
* Remove left over `parameters` property from class
1.0.0 / 2018-10-20
==================
This major release brings the module back to it's RFC 6838 roots. If you want
a module to parse the `Content-Type` or similar HTTP headers, use the
`content-type` module instead.
* Drop support for Node.js below 0.8
* Remove parameter handling, which is outside RFC 6838 scope
* Remove `parse(req)` and `parse(res)` signatures
* perf: enable strict mode
* perf: use a class for object creation
0.3.0 / 2014-09-07
==================
* Support Node.js 0.6
* Throw error when parameter format invalid on parse
0.2.0 / 2014-06-18
==================
* Add `typer.format()` to format media types
0.1.0 / 2014-06-17
==================
* Accept `req` as argument to `parse`
* Accept `res` as argument to `parse`
* Parse media type with extra LWS between type and first parameter
0.0.0 / 2014-06-13
==================
* Initial implementation
@@ -0,0 +1,112 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
*/
'use strict';
import type {Program as ESTreeProgram} from 'hermes-estree';
import type {ParserOptions} from './ParserOptions';
import type {BabelFile} from './babel/TransformESTreeToBabel';
import * as HermesParser from './HermesParser';
import HermesToESTreeAdapter from './HermesToESTreeAdapter';
import FlowVisitorKeys from './generated/ESTreeVisitorKeys';
import * as StripComponentSyntax from './estree/StripComponentSyntax';
import * as StripFlowTypesForBabel from './estree/StripFlowTypesForBabel';
import * as TransformESTreeToBabel from './babel/TransformESTreeToBabel';
import * as StripFlowTypes from './estree/StripFlowTypes';
const DEFAULTS = {
flow: 'detect',
};
function getOptions(options?: ParserOptions = {...DEFAULTS}) {
// Default to detecting whether to parse Flow syntax by the presence
// of an @flow pragma.
if (options.flow == null) {
options.flow = DEFAULTS.flow;
} else if (options.flow !== 'all' && options.flow !== 'detect') {
throw new Error('flow option must be "all" or "detect"');
}
if (options.sourceType === 'unambiguous') {
// Clear source type so that it will be detected from the contents of the file
delete options.sourceType;
} else if (
options.sourceType != null &&
options.sourceType !== 'script' &&
options.sourceType !== 'module'
) {
throw new Error(
'sourceType option must be "script", "module", or "unambiguous" if set',
);
}
if (options.enableExperimentalComponentSyntax == null) {
options.enableExperimentalComponentSyntax = true; // Enable by default
}
options.tokens = options.tokens === true;
options.allowReturnOutsideFunction =
options.allowReturnOutsideFunction === true;
return options;
}
declare function parse(
code: string,
opts: {...ParserOptions, babel: true},
): BabelFile;
// eslint-disable-next-line no-redeclare
declare function parse(
code: string,
opts?:
| {...ParserOptions, babel?: false | void}
| {...ParserOptions, babel: false},
): ESTreeProgram;
// eslint-disable-next-line no-redeclare
export function parse(
code: string,
opts?: ParserOptions,
): BabelFile | ESTreeProgram {
const options = getOptions(opts);
const ast = HermesParser.parse(code, options);
const estreeAdapter = new HermesToESTreeAdapter(options, code);
const estreeAST = estreeAdapter.transform(ast);
if (options.babel !== true) {
return estreeAST;
}
const loweredESTreeAST = [
StripComponentSyntax.transformProgram,
StripFlowTypesForBabel.transformProgram,
].reduce((ast, transform) => transform(ast, options), estreeAST);
return TransformESTreeToBabel.transformProgram(loweredESTreeAST, options);
}
export type {ParserOptions} from './ParserOptions';
export * from './ParserOptions';
export * from './traverse/SimpleTraverser';
export * from './transform/SimpleTransform';
export * from './traverse/getVisitorKeys';
export {FlowVisitorKeys};
export * as astArrayMutationHelpers from './transform/astArrayMutationHelpers';
export * as astNodeMutationHelpers from './transform/astNodeMutationHelpers';
export {default as mutateESTreeASTForPrettier} from './utils/mutateESTreeASTForPrettier';
const Transforms = {
stripComponentSyntax: StripComponentSyntax.transformProgram,
stripFlowTypesForBabel: StripFlowTypesForBabel.transformProgram,
stripFlowTypes: StripFlowTypes.transformProgram,
};
export {Transforms};
@@ -0,0 +1,596 @@
'use strict'
const assert = require('node:assert')
const { asciiLowercase, forgivingBase64, collectASequenceOfCodePoints, collectASequenceOfCodePointsFast, isomorphicDecode, removeASCIIWhitespace, removeChars } = require('../infra')
const encoder = new TextEncoder()
/**
* @see https://mimesniff.spec.whatwg.org/#http-token-code-point
*/
const HTTP_TOKEN_CODEPOINTS = /^[-!#$%&'*+.^_`|~A-Za-z0-9]+$/u
const HTTP_WHITESPACE_REGEX = /[\u000A\u000D\u0009\u0020]/u // eslint-disable-line
/**
* @see https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point
*/
const HTTP_QUOTED_STRING_TOKENS = /^[\u0009\u0020-\u007E\u0080-\u00FF]+$/u // eslint-disable-line
// https://fetch.spec.whatwg.org/#data-url-processor
/** @param {URL} dataURL */
function dataURLProcessor (dataURL) {
// 1. Assert: dataURL’s scheme is "data".
assert(dataURL.protocol === 'data:')
// 2. Let input be the result of running the URL
// serializer on dataURL with exclude fragment
// set to true.
let input = URLSerializer(dataURL, true)
// 3. Remove the leading "data:" string from input.
input = input.slice(5)
// 4. Let position point at the start of input.
const position = { position: 0 }
// 5. Let mimeType be the result of collecting a
// sequence of code points that are not equal
// to U+002C (,), given position.
let mimeType = collectASequenceOfCodePointsFast(
',',
input,
position
)
// 6. Strip leading and trailing ASCII whitespace
// from mimeType.
// Undici implementation note: we need to store the
// length because if the mimetype has spaces removed,
// the wrong amount will be sliced from the input in
// step #9
const mimeTypeLength = mimeType.length
mimeType = removeASCIIWhitespace(mimeType, true, true)
// 7. If position is past the end of input, then
// return failure
if (position.position >= input.length) {
return 'failure'
}
// 8. Advance position by 1.
position.position++
// 9. Let encodedBody be the remainder of input.
const encodedBody = input.slice(mimeTypeLength + 1)
// 10. Let body be the percent-decoding of encodedBody.
let body = stringPercentDecode(encodedBody)
// 11. If mimeType ends with U+003B (;), followed by
// zero or more U+0020 SPACE, followed by an ASCII
// case-insensitive match for "base64", then:
if (/;\u0020*[Bb][Aa][Ss][Ee]64$/u.test(mimeType)) {
// 1. Let stringBody be the isomorphic decode of body.
const stringBody = isomorphicDecode(body)
// 2. Set body to the forgiving-base64 decode of
// stringBody.
body = forgivingBase64(stringBody)
// 3. If body is failure, then return failure.
if (body === 'failure') {
return 'failure'
}
// 4. Remove the last 6 code points from mimeType.
mimeType = mimeType.slice(0, -6)
// 5. Remove trailing U+0020 SPACE code points from mimeType,
// if any.
mimeType = mimeType.replace(/(\u0020+)$/u, '')
// 6. Remove the last U+003B (;) code point from mimeType.
mimeType = mimeType.slice(0, -1)
}
// 12. If mimeType starts with U+003B (;), then prepend
// "text/plain" to mimeType.
if (mimeType.startsWith(';')) {
mimeType = 'text/plain' + mimeType
}
// 13. Let mimeTypeRecord be the result of parsing
// mimeType.
let mimeTypeRecord = parseMIMEType(mimeType)
// 14. If mimeTypeRecord is failure, then set
// mimeTypeRecord to text/plain;charset=US-ASCII.
if (mimeTypeRecord === 'failure') {
mimeTypeRecord = parseMIMEType('text/plain;charset=US-ASCII')
}
// 15. Return a new data: URL struct whose MIME
// type is mimeTypeRecord and body is body.
// https://fetch.spec.whatwg.org/#data-url-struct
return { mimeType: mimeTypeRecord, body }
}
// https://url.spec.whatwg.org/#concept-url-serializer
/**
* @param {URL} url
* @param {boolean} excludeFragment
*/
function URLSerializer (url, excludeFragment = false) {
if (!excludeFragment) {
return url.href
}
const href = url.href
const hashLength = url.hash.length
const serialized = hashLength === 0 ? href : href.substring(0, href.length - hashLength)
if (!hashLength && href.endsWith('#')) {
return serialized.slice(0, -1)
}
return serialized
}
// https://url.spec.whatwg.org/#string-percent-decode
/** @param {string} input */
function stringPercentDecode (input) {
// 1. Let bytes be the UTF-8 encoding of input.
const bytes = encoder.encode(input)
// 2. Return the percent-decoding of bytes.
return percentDecode(bytes)
}
/**
* @param {number} byte
*/
function isHexCharByte (byte) {
// 0-9 A-F a-f
return (byte >= 0x30 && byte <= 0x39) || (byte >= 0x41 && byte <= 0x46) || (byte >= 0x61 && byte <= 0x66)
}
/**
* @param {number} byte
*/
function hexByteToNumber (byte) {
return (
// 0-9
byte >= 0x30 && byte <= 0x39
? (byte - 48)
// Convert to uppercase
// ((byte & 0xDF) - 65) + 10
: ((byte & 0xDF) - 55)
)
}
// https://url.spec.whatwg.org/#percent-decode
/** @param {Uint8Array} input */
function percentDecode (input) {
const length = input.length
// 1. Let output be an empty byte sequence.
/** @type {Uint8Array} */
const output = new Uint8Array(length)
let j = 0
let i = 0
// 2. For each byte byte in input:
while (i < length) {
const byte = input[i]
// 1. If byte is not 0x25 (%), then append byte to output.
if (byte !== 0x25) {
output[j++] = byte
// 2. Otherwise, if byte is 0x25 (%) and the next two bytes
// after byte in input are not in the ranges
// 0x30 (0) to 0x39 (9), 0x41 (A) to 0x46 (F),
// and 0x61 (a) to 0x66 (f), all inclusive, append byte
// to output.
} else if (
byte === 0x25 &&
!(isHexCharByte(input[i + 1]) && isHexCharByte(input[i + 2]))
) {
output[j++] = 0x25
// 3. Otherwise:
} else {
// 1. Let bytePoint be the two bytes after byte in input,
// decoded, and then interpreted as hexadecimal number.
// 2. Append a byte whose value is bytePoint to output.
output[j++] = (hexByteToNumber(input[i + 1]) << 4) | hexByteToNumber(input[i + 2])
// 3. Skip the next two bytes in input.
i += 2
}
++i
}
// 3. Return output.
return length === j ? output : output.subarray(0, j)
}
// https://mimesniff.spec.whatwg.org/#parse-a-mime-type
/** @param {string} input */
function parseMIMEType (input) {
// 1. Remove any leading and trailing HTTP whitespace
// from input.
input = removeHTTPWhitespace(input, true, true)
// 2. Let position be a position variable for input,
// initially pointing at the start of input.
const position = { position: 0 }
// 3. Let type be the result of collecting a sequence
// of code points that are not U+002F (/) from
// input, given position.
const type = collectASequenceOfCodePointsFast(
'/',
input,
position
)
// 4. If type is the empty string or does not solely
// contain HTTP token code points, then return failure.
// https://mimesniff.spec.whatwg.org/#http-token-code-point
if (type.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(type)) {
return 'failure'
}
// 5. If position is past the end of input, then return
// failure
if (position.position >= input.length) {
return 'failure'
}
// 6. Advance position by 1. (This skips past U+002F (/).)
position.position++
// 7. Let subtype be the result of collecting a sequence of
// code points that are not U+003B (;) from input, given
// position.
let subtype = collectASequenceOfCodePointsFast(
';',
input,
position
)
// 8. Remove any trailing HTTP whitespace from subtype.
subtype = removeHTTPWhitespace(subtype, false, true)
// 9. If subtype is the empty string or does not solely
// contain HTTP token code points, then return failure.
if (subtype.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(subtype)) {
return 'failure'
}
const typeLowercase = asciiLowercase(type)
const subtypeLowercase = asciiLowercase(subtype)
// 10. Let mimeType be a new MIME type record whose type
// is type, in ASCII lowercase, and subtype is subtype,
// in ASCII lowercase.
// https://mimesniff.spec.whatwg.org/#mime-type
const mimeType = {
type: typeLowercase,
subtype: subtypeLowercase,
/** @type {Map<string, string>} */
parameters: new Map(),
// https://mimesniff.spec.whatwg.org/#mime-type-essence
essence: `${typeLowercase}/${subtypeLowercase}`
}
// 11. While position is not past the end of input:
while (position.position < input.length) {
// 1. Advance position by 1. (This skips past U+003B (;).)
position.position++
// 2. Collect a sequence of code points that are HTTP
// whitespace from input given position.
collectASequenceOfCodePoints(
// https://fetch.spec.whatwg.org/#http-whitespace
char => HTTP_WHITESPACE_REGEX.test(char),
input,
position
)
// 3. Let parameterName be the result of collecting a
// sequence of code points that are not U+003B (;)
// or U+003D (=) from input, given position.
let parameterName = collectASequenceOfCodePoints(
(char) => char !== ';' && char !== '=',
input,
position
)
// 4. Set parameterName to parameterName, in ASCII
// lowercase.
parameterName = asciiLowercase(parameterName)
// 5. If position is not past the end of input, then:
if (position.position < input.length) {
// 1. If the code point at position within input is
// U+003B (;), then continue.
if (input[position.position] === ';') {
continue
}
// 2. Advance position by 1. (This skips past U+003D (=).)
position.position++
}
// 6. If position is past the end of input, then break.
if (position.position >= input.length) {
break
}
// 7. Let parameterValue be null.
let parameterValue = null
// 8. If the code point at position within input is
// U+0022 ("), then:
if (input[position.position] === '"') {
// 1. Set parameterValue to the result of collecting
// an HTTP quoted string from input, given position
// and the extract-value flag.
parameterValue = collectAnHTTPQuotedString(input, position, true)
// 2. Collect a sequence of code points that are not
// U+003B (;) from input, given position.
collectASequenceOfCodePointsFast(
';',
input,
position
)
// 9. Otherwise:
} else {
// 1. Set parameterValue to the result of collecting
// a sequence of code points that are not U+003B (;)
// from input, given position.
parameterValue = collectASequenceOfCodePointsFast(
';',
input,
position
)
// 2. Remove any trailing HTTP whitespace from parameterValue.
parameterValue = removeHTTPWhitespace(parameterValue, false, true)
// 3. If parameterValue is the empty string, then continue.
if (parameterValue.length === 0) {
continue
}
}
// 10. If all of the following are true
// - parameterName is not the empty string
// - parameterName solely contains HTTP token code points
// - parameterValue solely contains HTTP quoted-string token code points
// - mimeType’s parameters[parameterName] does not exist
// then set mimeType’s parameters[parameterName] to parameterValue.
if (
parameterName.length !== 0 &&
HTTP_TOKEN_CODEPOINTS.test(parameterName) &&
(parameterValue.length === 0 || HTTP_QUOTED_STRING_TOKENS.test(parameterValue)) &&
!mimeType.parameters.has(parameterName)
) {
mimeType.parameters.set(parameterName, parameterValue)
}
}
// 12. Return mimeType.
return mimeType
}
// https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
// tests: https://fetch.spec.whatwg.org/#example-http-quoted-string
/**
* @param {string} input
* @param {{ position: number }} position
* @param {boolean} [extractValue=false]
*/
function collectAnHTTPQuotedString (input, position, extractValue = false) {
// 1. Let positionStart be position.
const positionStart = position.position
// 2. Let value be the empty string.
let value = ''
// 3. Assert: the code point at position within input
// is U+0022 (").
assert(input[position.position] === '"')
// 4. Advance position by 1.
position.position++
// 5. While true:
while (true) {
// 1. Append the result of collecting a sequence of code points
// that are not U+0022 (") or U+005C (\) from input, given
// position, to value.
value += collectASequenceOfCodePoints(
(char) => char !== '"' && char !== '\\',
input,
position
)
// 2. If position is past the end of input, then break.
if (position.position >= input.length) {
break
}
// 3. Let quoteOrBackslash be the code point at position within
// input.
const quoteOrBackslash = input[position.position]
// 4. Advance position by 1.
position.position++
// 5. If quoteOrBackslash is U+005C (\), then:
if (quoteOrBackslash === '\\') {
// 1. If position is past the end of input, then append
// U+005C (\) to value and break.
if (position.position >= input.length) {
value += '\\'
break
}
// 2. Append the code point at position within input to value.
value += input[position.position]
// 3. Advance position by 1.
position.position++
// 6. Otherwise:
} else {
// 1. Assert: quoteOrBackslash is U+0022 (").
assert(quoteOrBackslash === '"')
// 2. Break.
break
}
}
// 6. If the extract-value flag is set, then return value.
if (extractValue) {
return value
}
// 7. Return the code points from positionStart to position,
// inclusive, within input.
return input.slice(positionStart, position.position)
}
/**
* @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type
*/
function serializeAMimeType (mimeType) {
assert(mimeType !== 'failure')
const { parameters, essence } = mimeType
// 1. Let serialization be the concatenation of mimeType’s
// type, U+002F (/), and mimeType’s subtype.
let serialization = essence
// 2. For each name → value of mimeType’s parameters:
for (let [name, value] of parameters.entries()) {
// 1. Append U+003B (;) to serialization.
serialization += ';'
// 2. Append name to serialization.
serialization += name
// 3. Append U+003D (=) to serialization.
serialization += '='
// 4. If value does not solely contain HTTP token code
// points or value is the empty string, then:
if (!HTTP_TOKEN_CODEPOINTS.test(value)) {
// 1. Precede each occurrence of U+0022 (") or
// U+005C (\) in value with U+005C (\).
value = value.replace(/[\\"]/ug, '\\$&')
// 2. Prepend U+0022 (") to value.
value = '"' + value
// 3. Append U+0022 (") to value.
value += '"'
}
// 5. Append value to serialization.
serialization += value
}
// 3. Return serialization.
return serialization
}
/**
* @see https://fetch.spec.whatwg.org/#http-whitespace
* @param {number} char
*/
function isHTTPWhiteSpace (char) {
// "\r\n\t "
return char === 0x00d || char === 0x00a || char === 0x009 || char === 0x020
}
/**
* @see https://fetch.spec.whatwg.org/#http-whitespace
* @param {string} str
* @param {boolean} [leading=true]
* @param {boolean} [trailing=true]
*/
function removeHTTPWhitespace (str, leading = true, trailing = true) {
return removeChars(str, leading, trailing, isHTTPWhiteSpace)
}
/**
* @see https://mimesniff.spec.whatwg.org/#minimize-a-supported-mime-type
* @param {Exclude<ReturnType<typeof parseMIMEType>, 'failure'>} mimeType
*/
function minimizeSupportedMimeType (mimeType) {
switch (mimeType.essence) {
case 'application/ecmascript':
case 'application/javascript':
case 'application/x-ecmascript':
case 'application/x-javascript':
case 'text/ecmascript':
case 'text/javascript':
case 'text/javascript1.0':
case 'text/javascript1.1':
case 'text/javascript1.2':
case 'text/javascript1.3':
case 'text/javascript1.4':
case 'text/javascript1.5':
case 'text/jscript':
case 'text/livescript':
case 'text/x-ecmascript':
case 'text/x-javascript':
// 1. If mimeType is a JavaScript MIME type, then return "text/javascript".
return 'text/javascript'
case 'application/json':
case 'text/json':
// 2. If mimeType is a JSON MIME type, then return "application/json".
return 'application/json'
case 'image/svg+xml':
// 3. If mimeType’s essence is "image/svg+xml", then return "image/svg+xml".
return 'image/svg+xml'
case 'text/xml':
case 'application/xml':
// 4. If mimeType is an XML MIME type, then return "application/xml".
return 'application/xml'
}
// 2. If mimeType is a JSON MIME type, then return "application/json".
if (mimeType.subtype.endsWith('+json')) {
return 'application/json'
}
// 4. If mimeType is an XML MIME type, then return "application/xml".
if (mimeType.subtype.endsWith('+xml')) {
return 'application/xml'
}
// 5. If mimeType is supported by the user agent, then return mimeType’s essence.
// Technically, node doesn't support any mimetypes.
// 6. Return the empty string.
return ''
}
module.exports = {
dataURLProcessor,
URLSerializer,
stringPercentDecode,
parseMIMEType,
collectAnHTTPQuotedString,
serializeAMimeType,
removeHTTPWhitespace,
minimizeSupportedMimeType,
HTTP_TOKEN_CODEPOINTS
}
@@ -0,0 +1 @@
{"version":3,"file":"config.cjs","names":[],"sources":["../../src/config.ts"],"sourcesContent":["import type { SSROption } from './router'\nimport type { AnySerializationAdapter } from './ssr/serializer/transformer'\n\nexport interface RouterConfigOptions<\n in out TSerializationAdapters,\n in out TDefaultSsr,\n> {\n serializationAdapters?: TSerializationAdapters\n defaultSsr?: TDefaultSsr\n}\n\nexport interface RouterConfig<\n in out TSerializationAdapters,\n in out TDefaultSsr,\n> {\n '~types': RouterConfigTypes<TSerializationAdapters, TDefaultSsr>\n serializationAdapters: TSerializationAdapters\n defaultSsr: TDefaultSsr | undefined\n}\n\nexport interface RouterConfigTypes<\n in out TSerializationAdapters,\n in out TDefaultSsr,\n> {\n serializationAdapters: TSerializationAdapters\n defaultSsr: TDefaultSsr\n}\n\nexport const createRouterConfig = <\n const TSerializationAdapters extends ReadonlyArray<AnySerializationAdapter> =\n [],\n TDefaultSsr extends SSROption = SSROption,\n>(\n options: RouterConfigOptions<TSerializationAdapters, TDefaultSsr>,\n): RouterConfig<TSerializationAdapters, TDefaultSsr> => {\n return {\n serializationAdapters: options.serializationAdapters,\n defaultSsr: options.defaultSsr,\n } as RouterConfig<TSerializationAdapters, TDefaultSsr>\n}\n\nexport type AnyRouterConfig = RouterConfig<any, any>\n"],"mappings":";AA4BA,MAAa,sBAKX,YACsD;AACtD,QAAO;EACL,uBAAuB,QAAQ;EAC/B,YAAY,QAAQ;EACrB"}
@@ -0,0 +1,62 @@
'use strict'
const SemVer = require('../classes/semver')
const parse = require('./parse')
const { safeRe: re, t } = require('../internal/re')
const coerce = (version, options) => {
if (version instanceof SemVer) {
return version
}
if (typeof version === 'number') {
version = String(version)
}
if (typeof version !== 'string') {
return null
}
options = options || {}
let match = null
if (!options.rtl) {
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])
} else {
// Find the right-most coercible string that does not share
// a terminus with a more left-ward coercible string.
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
// With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
//
// Walk through the string checking with a /g regexp
// Manually set the index so as to pick up overlapping matches.
// Stop when we get a match that ends at the string end, since no
// coercible string can be more right-ward without the same terminus.
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]
let next
while ((next = coerceRtlRegex.exec(version)) &&
(!match || match.index + match[0].length !== version.length)
) {
if (!match ||
next.index + next[0].length !== match.index + match[0].length) {
match = next
}
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length
}
// leave it in a clean state
coerceRtlRegex.lastIndex = -1
}
if (match === null) {
return null
}
const major = match[2]
const minor = match[3] || '0'
const patch = match[4] || '0'
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''
const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)
}
module.exports = coerce
@@ -0,0 +1,6 @@
export * from "./errors.cjs";
export * from "./helpers/parseUtil.cjs";
export * from "./helpers/typeAliases.cjs";
export * from "./helpers/util.cjs";
export * from "./types.cjs";
export * from "./ZodError.cjs";
@@ -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 SquarePercent = createLucideIcon("SquarePercent", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
["path", { d: "M9 9h.01", key: "1q5me6" }],
["path", { d: "M15 15h.01", key: "lqbp3k" }]
]);
export { SquarePercent as default };
//# sourceMappingURL=square-percent.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{L:0,D:0,E:0,F:0,A:0,B:0.211788,FD:0},B:"ms",C:["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","FD","L","D","E","F","A","B","","",""],E:"IE",F:{FD:962323200,L:998870400,D:1161129600,E:1237420800,F:1300060800,A:1346716800,B:1381968000}},B:{A:{"0":0,"1":0,"2":0,"3":0.125504,"4":0.133348,"5":0,"6":0.011766,"7":0.003922,"8":0,"9":0,C:0,M:0,N:0,G:0,O:0,P:0,Q:0,R:0,H:0,S:0,T:0,U:0,V:0,W:0,X:0,Y:0,Z:0,a:0,b:0,c:0.007844,d:0,e:0,f:0,g:0,h:0,i:0,j:0,k:0,l:0,m:0,n:0,o:0,p:0,q:0,r:0,s:0,t:0.031376,u:0,v:0,w:0,x:0,y:0.003922,z:0,AB:0,BB:0,RB:0,SB:0,TB:0,CB:0.007844,DB:0.003922,EB:0.003922,FB:0.003922,GB:0.003922,UB:0.003922,VB:0.003922,WB:0.007844,XB:0.007844,YB:0.011766,ZB:0.007844,aB:0.011766,bB:0.011766,cB:0.007844,dB:0.011766,eB:0.015688,fB:0.015688,gB:0.01961,hB:0.027454,iB:0.090206,jB:0.23532,kB:1.90609,lB:2.36497,I:0.60791},B:"webkit",C:["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","C","M","N","G","O","P","Q","R","H","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","AB","BB","RB","SB","TB","CB","DB","EB","FB","GB","UB","VB","WB","XB","YB","ZB","aB","bB","cB","dB","eB","fB","gB","hB","iB","jB","kB","lB","I","","",""],E:"Edge",F:{"0":1692576000,"1":1694649600,"2":1697155200,"3":1698969600,"4":1701993600,"5":1706227200,"6":1708732800,"7":1711152000,"8":1713398400,"9":1715990400,C:1438128000,M:1447286400,N:1470096000,G:1491868800,O:1508198400,P:1525046400,Q:1542067200,R:1579046400,H:1581033600,S:1586736000,T:1590019200,U:1594857600,V:1598486400,W:1602201600,X:1605830400,Y:1611360000,Z:1614816000,a:1618358400,b:1622073600,c:1626912000,d:1630627200,e:1632441600,f:1634774400,g:1637539200,h:1641427200,i:1643932800,j:1646265600,k:1649635200,l:1651190400,m:1653955200,n:1655942400,o:1659657600,p:1661990400,q:1664755200,r:1666915200,s:1670198400,t:1673481600,u:1675900800,v:1678665600,w:1680825600,x:1683158400,y:1685664000,z:1689897600,AB:1718841600,BB:1721865600,RB:1724371200,SB:1726704000,TB:1729123200,CB:1731542400,DB:1737417600,EB:1740614400,FB:1741219200,GB:1743984000,UB:1746316800,VB:1748476800,WB:1750896000,XB:1754611200,YB:1756944000,ZB:1759363200,aB:1761868800,bB:1764806400,cB:1768780800,dB:1770854400,eB:1773446400,fB:1775692800,gB:1778112000,hB:1780531200,iB:1782950400,jB:1785369600,kB:1787788800,lB:1788998400,I:1790208000},D:{C:"ms",M:"ms",N:"ms",G:"ms",O:"ms",P:"ms",Q:"ms"}},C:{A:{"0":0,"1":0,"2":0,"3":0,"4":0.129426,"5":0.25493,"6":0,"7":0.007844,"8":0.011766,"9":0.003922,GD:0,fC:0,J:0,mB:0,L:0,D:0,E:0,F:0,A:0,B:0,C:0,M:0,N:0,G:0,O:0,P:0,Q:0,nB:0,HB:0,IB:0,JB:0,KB:0,LB:0,MB:0,NB:0,K:0,OB:0,PB:0,QB:0,oB:0,pB:0,qB:0,rB:0,sB:0,tB:0,uB:0,vB:0,wB:0,xB:0,yB:0,zB:0,"0B":0,"1B":0,"2B":0,"3B":0,"4B":0,"5B":0,"6B":0,"7B":0,"8B":0,"9B":0.007844,AC:0,BC:0,CC:0,DC:0,EC:0,FC:0,gC:0,GC:0,hC:0,HC:0,IC:0,JC:0,KC:0,LC:0,MC:0,NC:0,OC:0,PC:0,QC:0,RC:0,SC:0,TC:0,UC:0,VC:0,WC:0,XC:0.003922,R:0,H:0,S:0,iC:0,T:0,U:0,V:0,W:0,X:0,Y:0,Z:0,a:0,b:0,c:0,d:0,e:0,f:0,g:0,h:0,i:0,j:0,k:0,l:0,m:0,n:0,o:0,p:0,q:0,r:0,s:0,t:0,u:0,v:0,w:0,x:0,y:0,z:0.13727,AB:0,BB:0,RB:0.003922,SB:0,TB:0,CB:0,DB:0,EB:0.007844,FB:0,GB:0.003922,UB:0.007844,VB:0,WB:0,XB:0,YB:0.086284,ZB:0,aB:0.003922,bB:0.003922,cB:0,dB:0,eB:0.003922,fB:0.007844,gB:0.007844,hB:0.007844,iB:0.015688,jB:0.011766,kB:0.027454,lB:0.047064,I:0.200022,jC:0.643208,kC:0.635364,YC:0.023532,HD:0,ID:0,JD:0,KD:0,LD:0},B:"moz",C:["GD","fC","KD","LD","J","mB","L","D","E","F","A","B","C","M","N","G","O","P","Q","nB","HB","IB","JB","KB","LB","MB","NB","K","OB","PB","QB","oB","pB","qB","rB","sB","tB","uB","vB","wB","xB","yB","zB","0B","1B","2B","3B","4B","5B","6B","7B","8B","9B","AC","BC","CC","DC","EC","FC","gC","GC","hC","HC","IC","JC","KC","LC","MC","NC","OC","PC","QC","RC","SC","TC","UC","VC","WC","XC","R","H","S","iC","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","AB","BB","RB","SB","TB","CB","DB","EB","FB","GB","UB","VB","WB","XB","YB","ZB","aB","bB","cB","dB","eB","fB","gB","hB","iB","jB","kB","lB","I","jC","kC","YC","HD","ID","JD"],E:"Firefox",F:{"0":1690848000,"1":1693267200,"2":1695686400,"3":1698105600,"4":1700524800,"5":1702944000,"6":1705968000,"7":1708387200,"8":1710806400,"9":1713225600,GD:1161648000,fC:1213660800,KD:1246320000,LD:1264032000Line truncated
@@ -0,0 +1,80 @@
"use strict";
// Zod 3 compat layer
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.ZodFirstPartyTypeKind = exports.config = exports.$brand = exports.ZodIssueCode = void 0;
exports.setErrorMap = setErrorMap;
exports.getErrorMap = getErrorMap;
const core = __importStar(require("../core/index.cjs"));
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
exports.ZodIssueCode = {
invalid_type: "invalid_type",
too_big: "too_big",
too_small: "too_small",
invalid_format: "invalid_format",
not_multiple_of: "not_multiple_of",
unrecognized_keys: "unrecognized_keys",
invalid_union: "invalid_union",
invalid_key: "invalid_key",
invalid_element: "invalid_element",
invalid_value: "invalid_value",
custom: "custom",
};
var index_js_1 = require("../core/index.cjs");
Object.defineProperty(exports, "$brand", { enumerable: true, get: function () { return index_js_1.$brand; } });
Object.defineProperty(exports, "config", { enumerable: true, get: function () { return index_js_1.config; } });
/** @deprecated Use `z.config(params)` instead. */
function setErrorMap(map) {
core.config({
customError: map,
});
}
/** @deprecated Use `z.config()` instead. */
function getErrorMap() {
return core.config().customError;
}
/** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
var ZodFirstPartyTypeKind;
(function (ZodFirstPartyTypeKind) {
})(ZodFirstPartyTypeKind || (exports.ZodFirstPartyTypeKind = ZodFirstPartyTypeKind = {}));
// seal-cjs-exports
(function () {
var keys = Object.getOwnPropertyNames(exports);
for (var i = 0; i < keys.length; i++) {
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
if (!desc || !desc.get || !desc.configurable) continue;
var value;
try {
value = desc.get();
} catch (e) {
continue;
}
// a circular require may not have settled this one yet, so leave it live
if (value === undefined) continue;
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
}
Object.freeze(exports);
})();
@@ -0,0 +1,54 @@
function getRandomInt(max: number) {
return Math.floor(Math.random() * Math.floor(max));
}
const testSymbol = Symbol("test");
export class Mocker {
pick = (...args: any[]): any => {
return args[getRandomInt(args.length)];
};
get string(): string {
return Math.random().toString(36).substring(7);
}
get number(): number {
return Math.random() * 100;
}
get bigint(): bigint {
return BigInt(Math.floor(Math.random() * 10000));
}
get boolean(): boolean {
return Math.random() < 0.5;
}
get date(): Date {
return new Date(Math.floor(Date.now() * Math.random()));
}
get symbol(): symbol {
return testSymbol;
}
get null(): null {
return null;
}
get undefined(): undefined {
return undefined;
}
get stringOptional(): string | undefined {
return this.pick(this.string, this.undefined);
}
get stringNullable(): string | null {
return this.pick(this.string, this.null);
}
get numberOptional(): number | undefined {
return this.pick(this.number, this.undefined);
}
get numberNullable(): number | null {
return this.pick(this.number, this.null);
}
get booleanOptional(): boolean | undefined {
return this.pick(this.boolean, this.undefined);
}
get booleanNullable(): boolean | null {
return this.pick(this.boolean, this.null);
}
}