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,54 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_utils_accept = require("../../utils/accept.js");
//#region src/helper/accepts/accepts.ts
const matchType = (acceptType, supportedType) => {
const accept = acceptType.toLowerCase();
const supported = supportedType.toLowerCase();
if (accept === supported) return true;
if (accept === "*/*" || accept === "*") return false;
if (accept.endsWith("/*")) {
const [acceptMain] = accept.split("/");
const [supportedMain] = supported.split("/");
return acceptMain === supportedMain;
}
return false;
};
const getSpecificity = (type) => {
if (type === "*/*" || type === "*") return 1;
if (type.endsWith("/*")) return 2;
return 3;
};
const defaultMatch = (accepts, config) => {
const { supports, default: defaultSupport } = config;
const sortedAccepts = accepts.filter((accept) => accept.q > 0).sort((a, b) => {
if (b.q !== a.q) return b.q - a.q;
return getSpecificity(b.type) - getSpecificity(a.type);
});
for (const accept of sortedAccepts) {
const matched = supports.find((supported) => matchType(accept.type, supported));
if (matched) return matched;
}
return defaultSupport;
};
/**
* Match the accept header with the given options.
* @example
* ```ts
* app.get('/users', (c) => {
* const lang = accepts(c, {
* header: 'Accept-Language',
* supports: ['en', 'zh'],
* default: 'en',
* })
* })
* ```
*/
const accepts = (c, options) => {
const acceptHeader = c.req.header(options.header);
if (!acceptHeader) return options.default;
const accepts = require_utils_accept.parseAccept(acceptHeader);
return (options.match || defaultMatch)(accepts, options);
};
//#endregion
exports.accepts = accepts;
exports.defaultMatch = defaultMatch;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_K","2":"_I"},C:{"1":"_tO","2":"_o _0Q"},D:{"1":"_KK","2":"_IC _SE"},E:{"1":"XD","2":"_FO"},F:{"1":"_QL","2":"_jR"},G:{"2":"_M"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_U","2":"J"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"ME","2":"LE"}},B:5,C:"CSS overflow-anchor (Scroll Anchoring)",D:true};
@@ -0,0 +1,693 @@
import { describe, expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
describe("basic refinement functionality", () => {
test("should create a new schema instance when refining", () => {
const obj1 = z.object({
first: z.string(),
second: z.string(),
});
const obj2 = obj1.partial().strict();
const obj3 = obj2.refine((data) => data.first || data.second, "Either first or second should be filled in.");
expect(obj1 === (obj2 as any)).toEqual(false);
expect(obj2 === (obj3 as any)).toEqual(false);
});
test("should validate according to refinement logic", () => {
const schema = z
.object({
first: z.string(),
second: z.string(),
})
.partial()
.strict()
.refine((data) => data.first || data.second, "Either first or second should be filled in.");
// Should fail on empty object
expect(() => schema.parse({})).toThrow();
// Should pass with first property
expect(schema.parse({ first: "a" })).toEqual({ first: "a" });
// Should pass with second property
expect(schema.parse({ second: "a" })).toEqual({ second: "a" });
// Should pass with both properties
expect(schema.parse({ first: "a", second: "a" })).toEqual({ first: "a", second: "a" });
});
test("should validate strict mode correctly", () => {
const schema = z
.object({
first: z.string(),
second: z.string(),
})
.partial()
.strict();
// Should throw on extra properties
expect(() => schema.parse({ third: "adsf" })).toThrow();
});
});
describe("refinement with custom error messages", () => {
test("should use custom error message when validation fails", () => {
const validationSchema = z
.object({
email: z.string().email(),
password: z.string(),
confirmPassword: z.string(),
})
.refine((data) => data.password === data.confirmPassword, "Both password and confirmation must match");
const result = validationSchema.safeParse({
email: "aaaa@gmail.com",
password: "aaaaaaaa",
confirmPassword: "bbbbbbbb",
});
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues[0].message).toEqual("Both password and confirmation must match");
}
});
});
describe("async refinements", () => {
test("should support async refinement functions", async () => {
const validationSchema = z
.object({
email: z.string().email(),
password: z.string(),
confirmPassword: z.string(),
})
.refine(
(data) => Promise.resolve().then(() => data.password === data.confirmPassword),
"Both password and confirmation must match"
);
// Should pass with matching passwords
const validData = {
email: "aaaa@gmail.com",
password: "password",
confirmPassword: "password",
};
await expect(validationSchema.parseAsync(validData)).resolves.toEqual(validData);
// Should fail with non-matching passwords
await expect(
validationSchema.parseAsync({
email: "aaaa@gmail.com",
password: "password",
confirmPassword: "different",
})
).rejects.toThrow();
});
});
describe("early termination options", () => {
test("should abort early with continue: false", () => {
const schema = z
.string()
.superRefine((val, ctx) => {
if (val.length < 2) {
ctx.addIssue({
code: "custom",
message: "BAD",
continue: false,
});
}
})
.refine((_) => false);
const result = schema.safeParse("");
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues.length).toEqual(1);
expect(result.error.issues[0].message).toEqual("BAD");
}
});
test("should abort early with fatal: true", () => {
const schema = z
.string()
.superRefine((val, ctx) => {
if (val.length < 2) {
ctx.addIssue({
code: "custom",
fatal: true,
message: "BAD",
});
}
})
.refine((_) => false);
const result = schema.safeParse("");
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues.length).toEqual(1);
expect(result.error.issues[0].message).toEqual("BAD");
}
});
test("should abort early with abort flag", () => {
const schema = z
.string()
.refine((_) => false, { abort: true })
.refine((_) => false);
const result = schema.safeParse("");
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues.length).toEqual(1);
}
});
});
describe("custom error paths", () => {
test("should use custom path in error message", () => {
const result = z
.object({ password: z.string(), confirm: z.string() })
.refine((data) => data.confirm === data.password, { path: ["confirm"] })
.safeParse({ password: "asdf", confirm: "qewr" });
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues[0].path).toEqual(["confirm"]);
}
});
});
describe("superRefine functionality", () => {
test("should support multiple validation rules", () => {
const Strings = z.array(z.string()).superRefine((val, ctx) => {
if (val.length > 3) {
ctx.addIssue({
input: val,
code: "too_big",
origin: "array",
maximum: 3,
inclusive: true,
exact: true,
message: "Too many items 😡",
});
}
if (val.length !== new Set(val).size) {
ctx.addIssue({
input: val,
code: "custom",
message: `No duplicates allowed.`,
});
}
});
// Should fail with too many items and duplicates
const result = Strings.safeParse(["asfd", "asfd", "asfd", "asfd"]);
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues.length).toEqual(2);
expect(result.error.issues[0].message).toEqual("Too many items 😡");
expect(result.error.issues[1].message).toEqual("No duplicates allowed.");
}
// Should pass with valid input
const validArray = ["asfd", "qwer"];
expect(Strings.parse(validArray)).toEqual(validArray);
});
test("should support async superRefine", async () => {
const Strings = z.array(z.string()).superRefine(async (val, ctx) => {
if (val.length > 3) {
ctx.addIssue({
input: val,
code: "too_big",
origin: "array",
maximum: 3,
inclusive: true,
message: "Too many items 😡",
});
}
if (val.length !== new Set(val).size) {
ctx.addIssue({
input: val,
code: "custom",
message: `No duplicates allowed.`,
});
}
});
// Should fail with too many items and duplicates
const result = await Strings.safeParseAsync(["asfd", "asfd", "asfd", "asfd"]);
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues.length).toEqual(2);
}
// Should pass with valid input
const validArray = ["asfd", "qwer"];
await expect(Strings.parseAsync(validArray)).resolves.toEqual(validArray);
});
test("should test continuability of custom issues", () => {
// Default continue behavior - allows subsequent refinements
const defaultContinue = z
.string()
.superRefine((_, ctx) => {
ctx.addIssue({ code: "custom", message: "First issue" });
})
.refine(() => false, "Second issue");
expect(defaultContinue.safeParse("test")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"message": "First issue",
"path": []
},
{
"code": "custom",
"path": [],
"message": "Second issue"
}
]],
"success": false,
}
`);
// Explicit continue: false - prevents subsequent refinements
const explicitContinueFalse = z
.string()
.superRefine((_, ctx) => {
ctx.addIssue({ code: "custom", message: "First issue", continue: false });
})
.refine(() => false, "Second issue");
expect(explicitContinueFalse.safeParse("test")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"message": "First issue",
"path": []
}
]],
"success": false,
}
`);
// Multiple issues in same refinement - both always added regardless of continue
const multipleInSame = z.string().superRefine((_, ctx) => {
ctx.addIssue({ code: "custom", message: "First", continue: false });
ctx.addIssue({ code: "custom", message: "Second" });
});
expect(multipleInSame.safeParse("test")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"message": "First",
"path": []
},
{
"code": "custom",
"message": "Second",
"path": []
}
]],
"success": false,
}
`);
});
test("should accept string as shorthand for custom error message", () => {
const schema = z.string().superRefine((_, ctx) => {
ctx.addIssue("bad stuff");
});
const result = schema.safeParse("asdf");
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues).toHaveLength(1);
expect(result.error.issues[0].message).toEqual("bad stuff");
}
});
test("should preserve explicit nullish issue input", () => {
const schema = z.string().superRefine((_, ctx) => {
ctx.addIssue({ code: "custom", message: "default" });
ctx.addIssue({ code: "custom", message: "null", input: null });
ctx.addIssue({ code: "custom", message: "undefined", input: undefined });
});
const result = schema.safeParse("sensitive", { reportInput: true });
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues).toHaveLength(3);
expect(result.error.issues[0].input).toEqual("sensitive");
expect(result.error.issues[1].input).toEqual(null);
expect(result.error.issues[2]).toHaveProperty("input");
expect(result.error.issues[2].input).toEqual(undefined);
}
});
test("should keep issue input aligned with the issue path", () => {
const nested = z.object({ a: z.string().nullable() }).superRefine((val, ctx) => {
if (val.a === null) ctx.addIssue({ code: "custom", path: ["a"], input: val.a, message: "no null" });
});
const direct = nested.safeParse({ a: null }, { reportInput: true });
expect(direct.success).toEqual(false);
if (!direct.success) {
expect(direct.error.issues[0].path).toEqual(["a"]);
expect(direct.error.issues[0].input).toEqual(null);
}
// Forwarding a nested parse's issues must not overwrite their input with the outer payload.
const inner = z.object({ x: z.string() });
const forwarding = z.unknown().superRefine((val, ctx) => {
const result = inner.safeParse(val, { reportInput: true });
if (!result.success) {
for (const iss of result.error.issues) {
ctx.addIssue({ code: "custom", path: iss.path, input: iss.input, message: iss.message });
}
}
});
const forwarded = forwarding.safeParse({}, { reportInput: true });
expect(forwarded.success).toEqual(false);
if (!forwarded.success) {
expect(forwarded.error.issues[0].path).toEqual(["x"]);
expect(forwarded.error.issues[0]).toHaveProperty("input");
expect(forwarded.error.issues[0].input).toEqual(undefined);
}
});
test("should surface an explicit undefined input to the error map", () => {
const schema = z.object({ a: z.string().optional() }).superRefine((val, ctx) => {
if (!val.a) ctx.addIssue({ code: "custom", path: ["a"], input: val.a });
});
const result = schema.safeParse({}, { error: (iss) => (iss.input === undefined ? "Required" : "Invalid") });
expect(result.success).toEqual(false);
if (!result.success) expect(result.error.issues[0].message).toEqual("Required");
});
test("should respect fatal flag in superRefine", () => {
const schema = z
.string()
.superRefine((val, ctx) => {
if (val === "") {
ctx.addIssue({
input: val,
code: "custom",
message: "foo",
fatal: true,
});
}
})
.superRefine((val, ctx) => {
if (val !== " ") {
ctx.addIssue({
input: val,
code: "custom",
message: "bar",
});
}
});
const result = schema.safeParse("");
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues.length).toEqual(1);
expect(result.error.issues[0].message).toEqual("foo");
}
});
});
describe("chained refinements", () => {
test("should collect all validation errors when appropriate", () => {
const objectSchema = z
.object({
length: z.number(),
size: z.number(),
})
.refine(({ length }) => length > 5, {
path: ["length"],
message: "length greater than 5",
})
.refine(({ size }) => size > 7, {
path: ["size"],
message: "size greater than 7",
});
// Should fail with one error
const r1 = objectSchema.safeParse({
length: 4,
size: 9,
});
expect(r1.success).toEqual(false);
if (!r1.success) {
expect(r1.error.issues.length).toEqual(1);
expect(r1.error.issues[0].path).toEqual(["length"]);
}
// Should fail with two errors
const r2 = objectSchema.safeParse({
length: 4,
size: 3,
});
expect(r2.success).toEqual(false);
if (!r2.success) {
expect(r2.error.issues.length).toEqual(2);
}
// Should pass with valid input
const validData = {
length: 6,
size: 8,
};
expect(objectSchema.parse(validData)).toEqual(validData);
});
test("should run superRefine validation even when base schema validation fails when 'when' is defined and returns true", () => {
const baseSchema = z.object({
foo: z.number(),
bar: z.number(),
});
const schema = baseSchema.superRefine(
(data, ctx) => {
if (data.foo > 10) {
ctx.addIssue({
code: "custom",
message: "foo must be less than 10",
});
}
},
{
when: ({ value }) => baseSchema.pick({ foo: true }).safeParse(value).success,
}
);
const result = schema.safeParse({
foo: 11,
});
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues.length).toEqual(2);
expect(result.error.issues[0].message).toEqual("Invalid input: expected number, received undefined");
expect(result.error.issues[1].message).toEqual("foo must be less than 10");
}
});
test("should not run superRefine validation when 'when' is defined and returns false", () => {
const baseSchema = z.object({
foo: z.number(),
bar: z.number(),
});
const schema = baseSchema.superRefine(
(data, ctx) => {
if (data.foo > 10) {
ctx.addIssue({
code: "custom",
message: "foo must be less than 10",
});
}
},
{
when: ({ value }) => baseSchema.safeParse(value).success,
}
);
const result = schema.safeParse({
foo: 11,
});
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues.length).toEqual(1);
expect(result.error.issues[0].message).toEqual("Invalid input: expected number, received undefined");
}
});
});
describe("type refinement with type guards", () => {
test("type guard narrows output type", () => {
const schema = z.string().refine((s): s is "a" => s === "a");
expectTypeOf<z.input<typeof schema>>().toEqualTypeOf<string>();
expectTypeOf<z.output<typeof schema>>().toEqualTypeOf<"a">();
});
test("non-type-guard refine does not narrow", () => {
const schema = z.string().refine((s) => s.length > 0);
expectTypeOf<z.input<typeof schema>>().toEqualTypeOf<string>();
expectTypeOf<z.output<typeof schema>>().toEqualTypeOf<string>();
});
// TODO: Implement type narrowing for superRefine
// test("superRefine - type narrowing", () => {
// type NarrowType = { type: string; age: number };
// const schema = z
// .object({
// type: z.string(),
// age: z.number(),
// })
// .nullable()
// .superRefine((arg, ctx): arg is NarrowType => {
// if (!arg) {
// ctx.addIssue({
// input: arg,
// code: "custom",
// message: "cannot be null",
// fatal: true,
// });
// return false;
// }
// return true;
// });
//
// expectTypeOf<z.infer<typeof schema>>().toEqualTypeOf<NarrowType>();
//
// expect(schema.safeParse({ type: "test", age: 0 }).success).toEqual(true);
// expect(schema.safeParse(null).success).toEqual(false);
// });
});
test("when", () => {
const schema = z
.strictObject({
password: z.string().min(8),
confirmPassword: z.string(),
other: z.string(),
})
.refine(
(data) => {
// console.log("running check...");
// console.log(data);
// console.log(data.password);
return data.password === data.confirmPassword;
},
{
message: "Passwords do not match",
path: ["confirmPassword"],
when(payload) {
if (payload.value === undefined) return false;
if (payload.value === null) return false;
// no issues with confirmPassword or password
return payload.issues.every((iss) => iss.path?.[0] !== "confirmPassword" && iss.path?.[0] !== "password");
},
}
);
expect(schema.safeParse(undefined)).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "object",
"code": "invalid_type",
"path": [],
"message": "Invalid input: expected object, received undefined"
}
]],
"success": false,
}
`);
expect(schema.safeParse(null)).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "object",
"code": "invalid_type",
"path": [],
"message": "Invalid input: expected object, received null"
}
]],
"success": false,
}
`);
expect(
schema.safeParse({
password: "asdf",
confirmPassword: "asdfg",
other: "qwer",
})
).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"origin": "string",
"code": "too_small",
"minimum": 8,
"inclusive": true,
"path": [
"password"
],
"message": "Too small: expected string to have >=8 characters"
}
]],
"success": false,
}
`);
expect(
schema.safeParse({
password: "asdf",
confirmPassword: "asdfg",
other: 1234,
})
).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"origin": "string",
"code": "too_small",
"minimum": 8,
"inclusive": true,
"path": [
"password"
],
"message": "Too small: expected string to have >=8 characters"
},
{
"expected": "string",
"code": "invalid_type",
"path": [
"other"
],
"message": "Invalid input: expected string, received number"
}
]],
"success": false,
}
`);
});
@@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InMemoryTransport = void 0;
/**
* In-memory transport for creating clients and servers that talk to each other within the same process.
*/
class InMemoryTransport {
constructor() {
this._messageQueue = [];
}
/**
* Creates a pair of linked in-memory transports that can communicate with each other. One should be passed to a Client and one to a Server.
*/
static createLinkedPair() {
const clientTransport = new InMemoryTransport();
const serverTransport = new InMemoryTransport();
clientTransport._otherTransport = serverTransport;
serverTransport._otherTransport = clientTransport;
return [clientTransport, serverTransport];
}
async start() {
// Process any messages that were queued before start was called
while (this._messageQueue.length > 0) {
const queuedMessage = this._messageQueue.shift();
this.onmessage?.(queuedMessage.message, queuedMessage.extra);
}
}
async close() {
const other = this._otherTransport;
this._otherTransport = undefined;
await other?.close();
this.onclose?.();
}
/**
* Sends a message with optional auth info.
* This is useful for testing authentication scenarios.
*/
async send(message, options) {
if (!this._otherTransport) {
throw new Error('Not connected');
}
if (this._otherTransport.onmessage) {
this._otherTransport.onmessage(message, { authInfo: options?.authInfo });
}
else {
this._otherTransport._messageQueue.push({ message, extra: { authInfo: options?.authInfo } });
}
}
}
exports.InMemoryTransport = InMemoryTransport;
//# sourceMappingURL=inMemory.js.map
@@ -0,0 +1,540 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
Arrow: () => Arrow2,
Content: () => Content2,
Portal: () => Portal,
Provider: () => Provider,
Root: () => Root3,
Tooltip: () => Tooltip,
TooltipArrow: () => TooltipArrow,
TooltipContent: () => TooltipContent,
TooltipPortal: () => TooltipPortal,
TooltipProvider: () => TooltipProvider,
TooltipTrigger: () => TooltipTrigger,
Trigger: () => Trigger,
createTooltipScope: () => createTooltipScope
});
module.exports = __toCommonJS(index_exports);
// src/tooltip.tsx
var React = __toESM(require("react"));
var import_primitive = require("@radix-ui/primitive");
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
var import_react_context = require("@radix-ui/react-context");
var import_react_dismissable_layer = require("@radix-ui/react-dismissable-layer");
var import_react_id = require("@radix-ui/react-id");
var PopperPrimitive = __toESM(require("@radix-ui/react-popper"));
var import_react_popper = require("@radix-ui/react-popper");
var import_react_portal = require("@radix-ui/react-portal");
var import_react_presence = require("@radix-ui/react-presence");
var import_react_primitive = require("@radix-ui/react-primitive");
var import_react_slot = require("@radix-ui/react-slot");
var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
var VisuallyHiddenPrimitive = __toESM(require("@radix-ui/react-visually-hidden"));
var import_jsx_runtime = require("react/jsx-runtime");
var [createTooltipContext, createTooltipScope] = (0, import_react_context.createContextScope)("Tooltip", [
import_react_popper.createPopperScope
]);
var usePopperScope = (0, import_react_popper.createPopperScope)();
var PROVIDER_NAME = "TooltipProvider";
var DEFAULT_DELAY_DURATION = 700;
var TOOLTIP_OPEN = "tooltip.open";
var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
var TooltipProvider = (props) => {
const {
__scopeTooltip,
delayDuration = DEFAULT_DELAY_DURATION,
skipDelayDuration = 300,
disableHoverableContent = false,
children
} = props;
const isOpenDelayedRef = React.useRef(true);
const isPointerInTransitRef = React.useRef(false);
const skipDelayTimerRef = React.useRef(0);
React.useEffect(() => {
const skipDelayTimer = skipDelayTimerRef.current;
return () => window.clearTimeout(skipDelayTimer);
}, []);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
TooltipProviderContextProvider,
{
scope: __scopeTooltip,
isOpenDelayedRef,
delayDuration,
onOpen: React.useCallback(() => {
window.clearTimeout(skipDelayTimerRef.current);
isOpenDelayedRef.current = false;
}, []),
onClose: React.useCallback(() => {
window.clearTimeout(skipDelayTimerRef.current);
skipDelayTimerRef.current = window.setTimeout(
() => isOpenDelayedRef.current = true,
skipDelayDuration
);
}, [skipDelayDuration]),
isPointerInTransitRef,
onPointerInTransitChange: React.useCallback((inTransit) => {
isPointerInTransitRef.current = inTransit;
}, []),
disableHoverableContent,
children
}
);
};
TooltipProvider.displayName = PROVIDER_NAME;
var TOOLTIP_NAME = "Tooltip";
var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
var Tooltip = (props) => {
const {
__scopeTooltip,
children,
open: openProp,
defaultOpen,
onOpenChange,
disableHoverableContent: disableHoverableContentProp,
delayDuration: delayDurationProp
} = props;
const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
const popperScope = usePopperScope(__scopeTooltip);
const [trigger, setTrigger] = React.useState(null);
const contentId = (0, import_react_id.useId)();
const openTimerRef = React.useRef(0);
const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
const delayDuration = delayDurationProp ?? providerContext.delayDuration;
const wasOpenDelayedRef = React.useRef(false);
const [open, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
prop: openProp,
defaultProp: defaultOpen ?? false,
onChange: (open2) => {
if (open2) {
providerContext.onOpen();
document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
} else {
providerContext.onClose();
}
onOpenChange?.(open2);
},
caller: TOOLTIP_NAME
});
const stateAttribute = React.useMemo(() => {
return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
}, [open]);
const handleOpen = React.useCallback(() => {
window.clearTimeout(openTimerRef.current);
openTimerRef.current = 0;
wasOpenDelayedRef.current = false;
setOpen(true);
}, [setOpen]);
const handleClose = React.useCallback(() => {
window.clearTimeout(openTimerRef.current);
openTimerRef.current = 0;
setOpen(false);
}, [setOpen]);
const handleDelayedOpen = React.useCallback(() => {
window.clearTimeout(openTimerRef.current);
openTimerRef.current = window.setTimeout(() => {
wasOpenDelayedRef.current = true;
setOpen(true);
openTimerRef.current = 0;
}, delayDuration);
}, [delayDuration, setOpen]);
React.useEffect(() => {
return () => {
if (openTimerRef.current) {
window.clearTimeout(openTimerRef.current);
openTimerRef.current = 0;
}
};
}, []);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
TooltipContextProvider,
{
scope: __scopeTooltip,
contentId,
open,
stateAttribute,
trigger,
onTriggerChange: setTrigger,
onTriggerEnter: React.useCallback(() => {
if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
else handleOpen();
}, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
onTriggerLeave: React.useCallback(() => {
if (disableHoverableContent) {
handleClose();
} else {
window.clearTimeout(openTimerRef.current);
openTimerRef.current = 0;
}
}, [handleClose, disableHoverableContent]),
onOpen: handleOpen,
onClose: handleClose,
disableHoverableContent,
children
}
) });
};
Tooltip.displayName = TOOLTIP_NAME;
var TRIGGER_NAME = "TooltipTrigger";
var TooltipTrigger = React.forwardRef(
(props, forwardedRef) => {
const { __scopeTooltip, ...triggerProps } = props;
const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
const popperScope = usePopperScope(__scopeTooltip);
const ref = React.useRef(null);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref, context.onTriggerChange);
const isPointerDownRef = React.useRef(false);
const hasPointerMoveOpenedRef = React.useRef(false);
const handlePointerUp = React.useCallback(() => isPointerDownRef.current = false, []);
React.useEffect(() => {
return () => document.removeEventListener("pointerup", handlePointerUp);
}, [handlePointerUp]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.button,
{
"aria-describedby": context.open ? context.contentId : void 0,
"data-state": context.stateAttribute,
...triggerProps,
ref: composedRefs,
onPointerMove: (0, import_primitive.composeEventHandlers)(props.onPointerMove, (event) => {
if (event.pointerType === "touch") return;
if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
context.onTriggerEnter();
hasPointerMoveOpenedRef.current = true;
}
}),
onPointerLeave: (0, import_primitive.composeEventHandlers)(props.onPointerLeave, () => {
context.onTriggerLeave();
hasPointerMoveOpenedRef.current = false;
}),
onPointerDown: (0, import_primitive.composeEventHandlers)(props.onPointerDown, () => {
if (context.open) {
context.onClose();
}
isPointerDownRef.current = true;
document.addEventListener("pointerup", handlePointerUp, { once: true });
}),
onFocus: (0, import_primitive.composeEventHandlers)(props.onFocus, () => {
if (!isPointerDownRef.current) context.onOpen();
}),
onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, context.onClose),
onClick: (0, import_primitive.composeEventHandlers)(props.onClick, context.onClose)
}
) });
}
);
TooltipTrigger.displayName = TRIGGER_NAME;
var PORTAL_NAME = "TooltipPortal";
var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
forceMount: void 0
});
var TooltipPortal = (props) => {
const { __scopeTooltip, forceMount, children, container } = props;
const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_portal.Portal, { asChild: true, container, children }) }) });
};
TooltipPortal.displayName = PORTAL_NAME;
var CONTENT_NAME = "TooltipContent";
var TooltipContent = React.forwardRef(
(props, forwardedRef) => {
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
}
);
var TooltipContentHoverable = React.forwardRef((props, forwardedRef) => {
const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
const ref = React.useRef(null);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
const [pointerGraceArea, setPointerGraceArea] = React.useState(null);
const { trigger, onClose } = context;
const content = ref.current;
const { onPointerInTransitChange } = providerContext;
const handleRemoveGraceArea = React.useCallback(() => {
setPointerGraceArea(null);
onPointerInTransitChange(false);
}, [onPointerInTransitChange]);
const handleCreateGraceArea = React.useCallback(
(event, hoverTarget) => {
const currentTarget = event.currentTarget;
const exitPoint = { x: event.clientX, y: event.clientY };
const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
setPointerGraceArea(graceArea);
onPointerInTransitChange(true);
},
[onPointerInTransitChange]
);
React.useEffect(() => {
return () => handleRemoveGraceArea();
}, [handleRemoveGraceArea]);
React.useEffect(() => {
if (trigger && content) {
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
trigger.addEventListener("pointerleave", handleTriggerLeave);
content.addEventListener("pointerleave", handleContentLeave);
return () => {
trigger.removeEventListener("pointerleave", handleTriggerLeave);
content.removeEventListener("pointerleave", handleContentLeave);
};
}
}, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
React.useEffect(() => {
if (pointerGraceArea) {
const handleTrackPointerGrace = (event) => {
const target = event.target;
const pointerPosition = { x: event.clientX, y: event.clientY };
const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
if (hasEnteredTarget) {
handleRemoveGraceArea();
} else if (isPointerOutsideGraceArea) {
handleRemoveGraceArea();
onClose();
}
};
document.addEventListener("pointermove", handleTrackPointerGrace);
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
}
}, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContentImpl, { ...props, ref: composedRefs });
});
var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
var Slottable = (0, import_react_slot.createSlottable)("TooltipContent");
var TooltipContentImpl = React.forwardRef(
(props, forwardedRef) => {
const {
__scopeTooltip,
children,
"aria-label": ariaLabel,
onEscapeKeyDown,
onPointerDownOutside,
...contentProps
} = props;
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
const popperScope = usePopperScope(__scopeTooltip);
const { onClose } = context;
React.useEffect(() => {
document.addEventListener(TOOLTIP_OPEN, onClose);
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
}, [onClose]);
React.useEffect(() => {
if (context.trigger) {
const handleScroll = (event) => {
const target = event.target;
if (target?.contains(context.trigger)) onClose();
};
window.addEventListener("scroll", handleScroll, { capture: true });
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
}
}, [context.trigger, onClose]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_dismissable_layer.DismissableLayer,
{
asChild: true,
disableOutsidePointerEvents: false,
onEscapeKeyDown,
onPointerDownOutside,
onFocusOutside: (event) => event.preventDefault(),
onDismiss: onClose,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
PopperPrimitive.Content,
{
"data-state": context.stateAttribute,
...popperScope,
...contentProps,
ref: forwardedRef,
style: {
...contentProps.style,
// re-namespace exposed content custom properties
...{
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
}
},
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slottable, { children }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VisuallyHiddenPrimitive.Root, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
]
}
)
}
);
}
);
TooltipContent.displayName = CONTENT_NAME;
var ARROW_NAME = "TooltipArrow";
var TooltipArrow = React.forwardRef(
(props, forwardedRef) => {
const { __scopeTooltip, ...arrowProps } = props;
const popperScope = usePopperScope(__scopeTooltip);
const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
ARROW_NAME,
__scopeTooltip
);
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
}
);
TooltipArrow.displayName = ARROW_NAME;
function getExitSideFromRect(point, rect) {
const top = Math.abs(rect.top - point.y);
const bottom = Math.abs(rect.bottom - point.y);
const right = Math.abs(rect.right - point.x);
const left = Math.abs(rect.left - point.x);
switch (Math.min(top, bottom, right, left)) {
case left:
return "left";
case right:
return "right";
case top:
return "top";
case bottom:
return "bottom";
default:
throw new Error("unreachable");
}
}
function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
const paddedExitPoints = [];
switch (exitSide) {
case "top":
paddedExitPoints.push(
{ x: exitPoint.x - padding, y: exitPoint.y + padding },
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
);
break;
case "bottom":
paddedExitPoints.push(
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
{ x: exitPoint.x + padding, y: exitPoint.y - padding }
);
break;
case "left":
paddedExitPoints.push(
{ x: exitPoint.x + padding, y: exitPoint.y - padding },
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
);
break;
case "right":
paddedExitPoints.push(
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
{ x: exitPoint.x - padding, y: exitPoint.y + padding }
);
break;
}
return paddedExitPoints;
}
function getPointsFromRect(rect) {
const { top, right, bottom, left } = rect;
return [
{ x: left, y: top },
{ x: right, y: top },
{ x: right, y: bottom },
{ x: left, y: bottom }
];
}
function isPointInPolygon(point, polygon) {
const { x, y } = point;
let inside = false;
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
const ii = polygon[i];
const jj = polygon[j];
const xi = ii.x;
const yi = ii.y;
const xj = jj.x;
const yj = jj.y;
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
if (intersect) inside = !inside;
}
return inside;
}
function getHull(points) {
const newPoints = points.slice();
newPoints.sort((a, b) => {
if (a.x < b.x) return -1;
else if (a.x > b.x) return 1;
else if (a.y < b.y) return -1;
else if (a.y > b.y) return 1;
else return 0;
});
return getHullPresorted(newPoints);
}
function getHullPresorted(points) {
if (points.length <= 1) return points.slice();
const upperHull = [];
for (let i = 0; i < points.length; i++) {
const p = points[i];
while (upperHull.length >= 2) {
const q = upperHull[upperHull.length - 1];
const r = upperHull[upperHull.length - 2];
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
else break;
}
upperHull.push(p);
}
upperHull.pop();
const lowerHull = [];
for (let i = points.length - 1; i >= 0; i--) {
const p = points[i];
while (lowerHull.length >= 2) {
const q = lowerHull[lowerHull.length - 1];
const r = lowerHull[lowerHull.length - 2];
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
else break;
}
lowerHull.push(p);
}
lowerHull.pop();
if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
return upperHull;
} else {
return upperHull.concat(lowerHull);
}
}
var Provider = TooltipProvider;
var Root3 = Tooltip;
var Trigger = TooltipTrigger;
var Portal = TooltipPortal;
var Content2 = TooltipContent;
var Arrow2 = TooltipArrow;
//# sourceMappingURL=index.js.map
@@ -0,0 +1,290 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ExportAllDeclaration = ExportAllDeclaration;
exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
exports.ExportDefaultSpecifier = ExportDefaultSpecifier;
exports.ExportNamedDeclaration = ExportNamedDeclaration;
exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier;
exports.ExportSpecifier = ExportSpecifier;
exports.ImportAttribute = ImportAttribute;
exports.ImportDeclaration = ImportDeclaration;
exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
exports.ImportExpression = ImportExpression;
exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
exports.ImportSpecifier = ImportSpecifier;
exports._printAttributes = _printAttributes;
var _t = require("@babel/types");
var _index = require("../node/index.js");
var _expressions = require("./expressions.js");
const {
isClassDeclaration,
isExportDefaultSpecifier,
isExportNamespaceSpecifier,
isImportDefaultSpecifier,
isImportNamespaceSpecifier,
isStatement
} = _t;
function ImportSpecifier(node) {
if (node.importKind === "type" || node.importKind === "typeof") {
this.word(node.importKind);
this.space();
}
this.print(node.imported);
if (node.local && node.local.name !== node.imported.name) {
this.space();
this.word("as");
this.space();
this.print(node.local);
}
}
function ImportDefaultSpecifier(node) {
this.print(node.local);
}
function ExportDefaultSpecifier(node) {
this.print(node.exported);
}
function ExportSpecifier(node) {
if (node.exportKind === "type") {
this.word("type");
this.space();
}
this.print(node.local);
if (node.exported && node.local.name !== node.exported.name) {
this.space();
this.word("as");
this.space();
this.print(node.exported);
}
}
function ExportNamespaceSpecifier(node) {
this.tokenChar(42);
this.space();
this.word("as");
this.space();
this.print(node.exported);
}
let warningShown = false;
function _printAttributes(node, hasPreviousBrace) {
var _node$extra;
const {
attributes
} = node;
var {
assertions
} = node;
const {
importAttributesKeyword
} = this.format;
if (attributes && !importAttributesKeyword && node.extra && (node.extra.deprecatedAssertSyntax || node.extra.deprecatedWithLegacySyntax) && !warningShown) {
warningShown = true;
console.warn(`\
You are using import attributes, without specifying the desired output syntax.
Please specify the "importAttributesKeyword" generator option, whose value can be one of:
- "with" : \`import { a } from "b" with { type: "json" };\`
- "assert" : \`import { a } from "b" assert { type: "json" };\`
- "with-legacy" : \`import { a } from "b" with type: "json";\`
`);
}
const useAssertKeyword = importAttributesKeyword === "assert" || !importAttributesKeyword && assertions;
this.word(useAssertKeyword ? "assert" : "with");
this.space();
if (!useAssertKeyword && (importAttributesKeyword === "with-legacy" || !importAttributesKeyword && (_node$extra = node.extra) != null && _node$extra.deprecatedWithLegacySyntax)) {
this.printList(attributes || assertions);
return;
}
const occurrenceCount = hasPreviousBrace ? 1 : 0;
this.token("{", undefined, occurrenceCount);
this.space();
this.printList(attributes || assertions, this.shouldPrintTrailingComma("}"));
this.space();
this.token("}", undefined, occurrenceCount);
}
function ExportAllDeclaration(node) {
var _node$attributes, _node$assertions;
this.word("export");
this.space();
if (node.exportKind === "type") {
this.word("type");
this.space();
}
this.tokenChar(42);
this.space();
this.word("from");
this.space();
if ((_node$attributes = node.attributes) != null && _node$attributes.length || (_node$assertions = node.assertions) != null && _node$assertions.length) {
this.print(node.source, true);
this.space();
_printAttributes.call(this, node, false);
} else {
this.print(node.source);
}
this.semicolon();
}
function maybePrintDecoratorsBeforeExport(printer, node) {
if (isClassDeclaration(node.declaration) && _expressions._shouldPrintDecoratorsBeforeExport.call(printer, node)) {
printer.printJoin(node.declaration.decorators);
}
}
function ExportNamedDeclaration(node) {
maybePrintDecoratorsBeforeExport(this, node);
this.word("export");
this.space();
if (node.declaration) {
const declar = node.declaration;
this.print(declar);
if (!isStatement(declar)) this.semicolon();
} else {
if (node.exportKind === "type") {
this.word("type");
this.space();
}
const specifiers = node.specifiers.slice(0);
let hasSpecial = false;
for (;;) {
const first = specifiers[0];
if (isExportDefaultSpecifier(first) || isExportNamespaceSpecifier(first)) {
hasSpecial = true;
this.print(specifiers.shift());
if (specifiers.length) {
this.tokenChar(44);
this.space();
}
} else {
break;
}
}
let hasBrace = false;
if (specifiers.length || !specifiers.length && !hasSpecial) {
hasBrace = true;
this.tokenChar(123);
if (specifiers.length) {
this.space();
this.printList(specifiers, this.shouldPrintTrailingComma("}"));
this.space();
}
this.tokenChar(125);
}
if (node.source) {
var _node$attributes2, _node$assertions2;
this.space();
this.word("from");
this.space();
if ((_node$attributes2 = node.attributes) != null && _node$attributes2.length || (_node$assertions2 = node.assertions) != null && _node$assertions2.length) {
this.print(node.source, true);
this.space();
_printAttributes.call(this, node, hasBrace);
} else {
this.print(node.source);
}
}
this.semicolon();
}
}
function ExportDefaultDeclaration(node) {
maybePrintDecoratorsBeforeExport(this, node);
this.word("export");
this.noIndentInnerCommentsHere();
this.space();
this.word("default");
this.space();
this.tokenContext |= _index.TokenContext.exportDefault;
const declar = node.declaration;
this.print(declar);
if (!isStatement(declar)) this.semicolon();
}
function ImportDeclaration(node) {
var _node$attributes3, _node$assertions3;
this.word("import");
this.space();
const isTypeKind = node.importKind === "type" || node.importKind === "typeof";
if (isTypeKind) {
this.noIndentInnerCommentsHere();
this.word(node.importKind);
this.space();
} else if (node.module) {
this.noIndentInnerCommentsHere();
this.word("module");
this.space();
} else if (node.phase) {
this.noIndentInnerCommentsHere();
this.word(node.phase);
this.space();
}
const specifiers = node.specifiers.slice(0);
const hasSpecifiers = !!specifiers.length;
while (hasSpecifiers) {
const first = specifiers[0];
if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) {
this.print(specifiers.shift());
if (specifiers.length) {
this.tokenChar(44);
this.space();
}
} else {
break;
}
}
let hasBrace = false;
if (specifiers.length) {
hasBrace = true;
this.tokenChar(123);
this.space();
this.printList(specifiers, this.shouldPrintTrailingComma("}"));
this.space();
this.tokenChar(125);
} else if (isTypeKind && !hasSpecifiers) {
hasBrace = true;
this.tokenChar(123);
this.tokenChar(125);
}
if (hasSpecifiers || isTypeKind) {
this.space();
this.word("from");
this.space();
}
if ((_node$attributes3 = node.attributes) != null && _node$attributes3.length || (_node$assertions3 = node.assertions) != null && _node$assertions3.length) {
this.print(node.source, true);
this.space();
_printAttributes.call(this, node, hasBrace);
} else {
this.print(node.source);
}
this.semicolon();
}
function ImportAttribute(node) {
this.print(node.key);
this.tokenChar(58);
this.space();
this.print(node.value);
}
function ImportNamespaceSpecifier(node) {
this.tokenChar(42);
this.space();
this.word("as");
this.space();
this.print(node.local);
}
function ImportExpression(node) {
this.word("import");
if (node.phase) {
this.tokenChar(46);
this.word(node.phase);
}
this.tokenChar(40);
const shouldPrintTrailingComma = this.shouldPrintTrailingComma(")");
this.print(node.source);
if (node.options != null) {
this.tokenChar(44);
this.space();
this.print(node.options);
}
if (shouldPrintTrailingComma) {
this.tokenChar(44);
}
this.rightParens(node);
}
//# sourceMappingURL=modules.js.map
@@ -0,0 +1,25 @@
"use client";
import { routerContext } from "./routerContext.js";
import * as React$1 from "react";
//#region src/useRouter.tsx
/**
* Access the current TanStack Router instance from React context.
* Must be used within a `RouterProvider`.
*
* Options:
* - `warn`: Log a warning if no router context is found (default: true).
*
* @returns The registered router instance.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterHook
*/
function useRouter(opts) {
const value = React$1.useContext(routerContext);
if (process.env.NODE_ENV !== "production") {
if ((opts?.warn ?? true) && !value) console.warn("Warning: useRouter must be used inside a <RouterProvider> component!");
}
return value;
}
//#endregion
export { useRouter };
//# sourceMappingURL=useRouter.js.map
@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./Reflect.getPrototypeOf')} */
module.exports = (typeof Reflect !== 'undefined' && Reflect.getPrototypeOf) || null;
@@ -0,0 +1 @@
{"version":3,"file":"bar-chart-horizontal-big.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,11 @@
import type { VisitorKeys } from '@typescript-eslint/visitor-keys';
import type { TSESTree } from './ts-estree';
type SimpleTraverseOptions = Readonly<{
enter: (node: TSESTree.Node, parent: TSESTree.Node | undefined) => void;
visitorKeys?: Readonly<VisitorKeys>;
} | {
visitorKeys?: Readonly<VisitorKeys>;
visitors: Record<string, (node: TSESTree.Node, parent: TSESTree.Node | undefined) => void>;
}>;
export declare function simpleTraverse(startingNode: TSESTree.Node, options: SimpleTraverseOptions, setParentPointers?: boolean): void;
export {};
@@ -0,0 +1,203 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = loadCodeDefault;
exports.supportsESM = void 0;
var _async = require("../../gensync-utils/async.js");
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _url() {
const data = require("url");
_url = function () {
return data;
};
return data;
}
require("module");
function _semver() {
const data = require("semver");
_semver = function () {
return data;
};
return data;
}
function _debug() {
const data = require("debug");
_debug = function () {
return data;
};
return data;
}
var _rewriteStackTrace = require("../../errors/rewrite-stack-trace.js");
var _configError = require("../../errors/config-error.js");
var _transformFile = require("../../transform-file.js");
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
const debug = _debug()("babel:config:loading:files:module-types");
try {
var import_ = require("./import.cjs");
} catch (_unused) {}
const supportsESM = exports.supportsESM = _semver().satisfies(process.versions.node, "^12.17 || >=13.2");
const LOADING_CJS_FILES = new Set();
function loadCjsDefault(filepath) {
if (LOADING_CJS_FILES.has(filepath)) {
debug("Auto-ignoring usage of config %o.", filepath);
return {};
}
let module;
try {
LOADING_CJS_FILES.add(filepath);
module = (0, _rewriteStackTrace.endHiddenCallStack)(require)(filepath);
} finally {
LOADING_CJS_FILES.delete(filepath);
}
return module != null && (module.__esModule || module[Symbol.toStringTag] === "Module") ? module.default || (arguments[1] ? module : undefined) : module;
}
const loadMjsFromPath = (0, _rewriteStackTrace.endHiddenCallStack)(function () {
var _loadMjsFromPath = _asyncToGenerator(function* (filepath) {
const url = (0, _url().pathToFileURL)(filepath).toString() + "?import";
if (!import_) {
throw new _configError.default("Internal error: Native ECMAScript modules aren't supported by this platform.\n", filepath);
}
return yield import_(url);
});
function loadMjsFromPath(_x) {
return _loadMjsFromPath.apply(this, arguments);
}
return loadMjsFromPath;
}());
const tsNotSupportedError = ext => `\
You are using a ${ext} config file, but Babel only supports transpiling .cts configs. Either:
- Use a .cts config file
- Update to Node.js 23.6.0, which has native TypeScript support
- Install tsx to transpile ${ext} files on the fly\
`;
const SUPPORTED_EXTENSIONS = {
".js": "unknown",
".mjs": "esm",
".cjs": "cjs",
".ts": "unknown",
".mts": "esm",
".cts": "cjs"
};
const asyncModules = new Set();
function* loadCodeDefault(filepath, loader, esmError, tlaError) {
let async;
const ext = _path().extname(filepath);
const isTS = ext === ".ts" || ext === ".cts" || ext === ".mts";
const type = SUPPORTED_EXTENSIONS[hasOwnProperty.call(SUPPORTED_EXTENSIONS, ext) ? ext : ".js"];
const pattern = `${loader} ${type}`;
switch (pattern) {
case "require cjs":
case "auto cjs":
if (isTS) {
return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath));
} else {
return loadCjsDefault(filepath, arguments[2]);
}
case "auto unknown":
case "require unknown":
case "require esm":
try {
if (isTS) {
return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath));
} else {
return loadCjsDefault(filepath, arguments[2]);
}
} catch (e) {
if (e.code === "ERR_REQUIRE_ASYNC_MODULE" || e.code === "ERR_REQUIRE_CYCLE_MODULE" && asyncModules.has(filepath)) {
asyncModules.add(filepath);
if (!(async != null ? async : async = yield* (0, _async.isAsync)())) {
throw new _configError.default(tlaError, filepath);
}
} else if (e.code === "ERR_REQUIRE_ESM" || type === "esm") {} else {
throw e;
}
}
case "auto esm":
if (async != null ? async : async = yield* (0, _async.isAsync)()) {
const promise = isTS ? ensureTsSupport(filepath, ext, () => loadMjsFromPath(filepath)) : loadMjsFromPath(filepath);
return (yield* (0, _async.waitFor)(promise)).default;
}
if (isTS) {
throw new _configError.default(tsNotSupportedError(ext), filepath);
} else {
throw new _configError.default(esmError, filepath);
}
default:
throw new Error("Internal Babel error: unreachable code.");
}
}
function ensureTsSupport(filepath, ext, callback) {
if (process.features.typescript || require.extensions[".ts"] || require.extensions[".cts"] || require.extensions[".mts"]) {
return callback();
}
if (ext !== ".cts") {
throw new _configError.default(tsNotSupportedError(ext), filepath);
}
const opts = {
babelrc: false,
configFile: false,
sourceType: "unambiguous",
sourceMaps: "inline",
sourceFileName: _path().basename(filepath),
presets: [[getTSPreset(filepath), Object.assign({
onlyRemoveTypeImports: true,
optimizeConstEnums: true
}, {
allowDeclareFields: true
})]]
};
let handler = function (m, filename) {
if (handler && filename.endsWith(".cts")) {
try {
return m._compile((0, _transformFile.transformFileSync)(filename, Object.assign({}, opts, {
filename
})).code, filename);
} catch (error) {
const packageJson = require("@babel/preset-typescript/package.json");
if (_semver().lt(packageJson.version, "7.21.4")) {
console.error("`.cts` configuration file failed to load, please try to update `@babel/preset-typescript`.");
}
throw error;
}
}
return require.extensions[".js"](m, filename);
};
require.extensions[ext] = handler;
try {
return callback();
} finally {
if (require.extensions[ext] === handler) delete require.extensions[ext];
handler = undefined;
}
}
function getTSPreset(filepath) {
try {
return require("@babel/preset-typescript");
} catch (error) {
if (error.code !== "MODULE_NOT_FOUND") throw error;
let message = "You appear to be using a .cts file as Babel configuration, but the `@babel/preset-typescript` package was not found: please install it!";
if (process.versions.pnp) {
message += `
If you are using Yarn Plug'n'Play, you may also need to add the following configuration to your .yarnrc.yml file:
packageExtensions:
\t"@babel/core@*":
\t\tpeerDependencies:
\t\t\t"@babel/preset-typescript": "*"
`;
}
throw new _configError.default(message, filepath);
}
}
0 && 0;
//# sourceMappingURL=module-types.js.map
@@ -0,0 +1,844 @@
/**
* @since v0.3.7
*/
declare module "module" {
import { URL } from "node:url";
class Module {
constructor(id: string, parent?: Module);
}
interface Module extends NodeJS.Module {}
namespace Module {
export { Module };
}
namespace Module {
/**
* A list of the names of all modules provided by Node.js. Can be used to verify
* if a module is maintained by a third party or not.
*
* Note: the list doesn't contain prefix-only modules like `node:test`.
* @since v9.3.0, v8.10.0, v6.13.0
*/
const builtinModules: readonly string[];
/**
* @since v12.2.0
* @param path Filename to be used to construct the require
* function. Must be a file URL object, file URL string, or absolute path
* string.
*/
function createRequire(path: string | URL): NodeJS.Require;
namespace constants {
/**
* The following constants are returned as the `status` field in the object returned by
* {@link enableCompileCache} to indicate the result of the attempt to enable the
* [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache).
* @since v22.8.0
*/
namespace compileCacheStatus {
/**
* Node.js has enabled the compile cache successfully. The directory used to store the
* compile cache will be returned in the `directory` field in the
* returned object.
*/
const ENABLED: number;
/**
* The compile cache has already been enabled before, either by a previous call to
* {@link enableCompileCache}, or by the `NODE_COMPILE_CACHE=dir`
* environment variable. The directory used to store the
* compile cache will be returned in the `directory` field in the
* returned object.
*/
const ALREADY_ENABLED: number;
/**
* Node.js fails to enable the compile cache. This can be caused by the lack of
* permission to use the specified directory, or various kinds of file system errors.
* The detail of the failure will be returned in the `message` field in the
* returned object.
*/
const FAILED: number;
/**
* Node.js cannot enable the compile cache because the environment variable
* `NODE_DISABLE_COMPILE_CACHE=1` has been set.
*/
const DISABLED: number;
}
}
interface EnableCompileCacheResult {
/**
* One of the {@link constants.compileCacheStatus}
*/
status: number;
/**
* If Node.js cannot enable the compile cache, this contains
* the error message. Only set if `status` is `module.constants.compileCacheStatus.FAILED`.
*/
message?: string;
/**
* If the compile cache is enabled, this contains the directory
* where the compile cache is stored. Only set if `status` is
* `module.constants.compileCacheStatus.ENABLED` or
* `module.constants.compileCacheStatus.ALREADY_ENABLED`.
*/
directory?: string;
}
interface EnableCompileCacheOptions {
/**
* Optional. Directory to store the compile cache. If not specified, the directory specified by
* the [`NODE_COMPILE_CACHE=dir`](https://nodejs.org/docs/latest-v24.x/api/cli.html#node_compile_cachedir)
* environment variable will be used if it's set, or `path.join(os.tmpdir(), 'node-compile-cache')` otherwise.
* @since v24.12.0
*/
directory?: string | undefined;
/**
* Optional. If `true`, enables portable compile cache so that the cache can be reused even if the project directory
* is moved. This is a best-effort feature. If not specified, it will depend on whether the environment variable
* [NODE_COMPILE_CACHE_PORTABLE=1](https://nodejs.org/docs/latest-v24.x/api/cli.html#node_compile_cache_portable1) is set.
* @since v24.12.0
*/
portable?: boolean | undefined;
}
/**
* Enable [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
* in the current Node.js instance.
*
* For general use cases, it's recommended to call `module.enableCompileCache()` without specifying the
* `options.directory`, so that the directory can be overridden by the `NODE_COMPILE_CACHE` environment
* variable when necessary.
*
* Since compile cache is supposed to be a optimization that is not mission critical, this method is
* designed to not throw any exception when the compile cache cannot be enabled. Instead, it will return
* an object containing an error message in the `message` field to aid debugging. If compile cache is
* enabled successfully, the `directory` field in the returned object contains the path to the directory
* where the compile cache is stored. The `status` field in the returned object would be one of the
* `module.constants.compileCacheStatus` values to indicate the result of the attempt to enable the
* [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache).
*
* This method only affects the current Node.js instance. To enable it in child worker threads,
* either call this method in child worker threads too, or set the
* `process.env.NODE_COMPILE_CACHE` value to compile cache directory so the behavior can
* be inherited into the child workers. The directory can be obtained either from the
* `directory` field returned by this method, or with {@link getCompileCacheDir `module.getCompileCacheDir()`}.
* @since v22.8.0
* @param options Optional. If a string is passed, it is considered to be `options.directory`.
* will be stored/retrieved.
*/
function enableCompileCache(options?: string | EnableCompileCacheOptions): EnableCompileCacheResult;
/**
* Flush the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
* accumulated from modules already loaded
* in the current Node.js instance to disk. This returns after all the flushing
* file system operations come to an end, no matter they succeed or not. If there
* are any errors, this will fail silently, since compile cache misses should not
* interfere with the actual operation of the application.
* @since v22.10.0
*/
function flushCompileCache(): void;
/**
* @since v22.8.0
* @return Path to the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
* directory if it is enabled, or `undefined` otherwise.
*/
function getCompileCacheDir(): string | undefined;
/**
* ```text
* /path/to/project
* ├ packages/
* ├ bar/
* ├ bar.js
* └ package.json // name = '@foo/bar'
* └ qux/
* ├ node_modules/
* └ some-package/
* └ package.json // name = 'some-package'
* ├ qux.js
* └ package.json // name = '@foo/qux'
* ├ main.js
* └ package.json // name = '@foo'
* ```
* ```js
* // /path/to/project/packages/bar/bar.js
* import { findPackageJSON } from 'node:module';
*
* findPackageJSON('..', import.meta.url);
* // '/path/to/project/package.json'
* // Same result when passing an absolute specifier instead:
* findPackageJSON(new URL('../', import.meta.url));
* findPackageJSON(import.meta.resolve('../'));
*
* findPackageJSON('some-package', import.meta.url);
* // '/path/to/project/packages/bar/node_modules/some-package/package.json'
* // When passing an absolute specifier, you might get a different result if the
* // resolved module is inside a subfolder that has nested `package.json`.
* findPackageJSON(import.meta.resolve('some-package'));
* // '/path/to/project/packages/bar/node_modules/some-package/some-subfolder/package.json'
*
* findPackageJSON('@foo/qux', import.meta.url);
* // '/path/to/project/packages/qux/package.json'
* ```
* @since v22.14.0
* @param specifier The specifier for the module whose `package.json` to
* retrieve. When passing a _bare specifier_, the `package.json` at the root of
* the package is returned. When passing a _relative specifier_ or an _absolute specifier_,
* the closest parent `package.json` is returned.
* @param base The absolute location (`file:` URL string or FS path) of the
* containing module. For CJS, use `__filename` (not `__dirname`!); for ESM, use
* `import.meta.url`. You do not need to pass it if `specifier` is an _absolute specifier_.
* @returns A path if the `package.json` is found. When `startLocation`
* is a package, the package's root `package.json`; when a relative or unresolved, the closest
* `package.json` to the `startLocation`.
*/
function findPackageJSON(specifier: string | URL, base?: string | URL): string | undefined;
/**
* @since v18.6.0, v16.17.0
*/
function isBuiltin(moduleName: string): boolean;
interface RegisterOptions<Data> {
/**
* If you want to resolve `specifier` relative to a
* base URL, such as `import.meta.url`, you can pass that URL here. This
* property is ignored if the `parentURL` is supplied as the second argument.
* @default 'data:'
*/
parentURL?: string | URL | undefined;
/**
* Any arbitrary, cloneable JavaScript value to pass into the
* {@link initialize} hook.
*/
data?: Data | undefined;
/**
* [Transferable objects](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html#portpostmessagevalue-transferlist)
* to be passed into the `initialize` hook.
*/
transferList?: any[] | undefined;
}
/* eslint-disable @definitelytyped/no-unnecessary-generics */
/**
* Register a module that exports hooks that customize Node.js module
* resolution and loading behavior. See
* [Customization hooks](https://nodejs.org/docs/latest-v24.x/api/module.html#customization-hooks).
*
* This feature requires `--allow-worker` if used with the
* [Permission Model](https://nodejs.org/docs/latest-v24.x/api/permissions.html#permission-model).
* @since v20.6.0, v18.19.0
* @deprecated Use `module.registerHooks()` instead.
* @param specifier Customization hooks to be registered; this should be
* the same string that would be passed to `import()`, except that if it is
* relative, it is resolved relative to `parentURL`.
* @param parentURL f you want to resolve `specifier` relative to a base
* URL, such as `import.meta.url`, you can pass that URL here.
*/
function register<Data = any>(
specifier: string | URL,
parentURL?: string | URL,
options?: RegisterOptions<Data>,
): void;
function register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
interface RegisterHooksOptions {
/**
* See [load hook](https://nodejs.org/docs/latest-v24.x/api/module.html#loadurl-context-nextload).
* @default undefined
*/
load?: LoadHookSync | undefined;
/**
* See [resolve hook](https://nodejs.org/docs/latest-v24.x/api/module.html#resolvespecifier-context-nextresolve).
* @default undefined
*/
resolve?: ResolveHookSync | undefined;
}
interface ModuleHooks {
/**
* Deregister the hook instance.
*/
deregister(): void;
}
/**
* Register [hooks](https://nodejs.org/docs/latest-v24.x/api/module.html#customization-hooks)
* that customize Node.js module resolution and loading behavior.
* @since v22.15.0
* @experimental
*/
function registerHooks(options: RegisterHooksOptions): ModuleHooks;
interface StripTypeScriptTypesOptions {
/**
* Possible values are:
* * `'strip'` Only strip type annotations without performing the transformation of TypeScript features.
* * `'transform'` Strip type annotations and transform TypeScript features to JavaScript.
* @default 'strip'
*/
mode?: "strip" | "transform" | undefined;
/**
* Only when `mode` is `'transform'`, if `true`, a source map
* will be generated for the transformed code.
* @default false
*/
sourceMap?: boolean | undefined;
/**
* Specifies the source url used in the source map.
*/
sourceUrl?: string | undefined;
}
/**
* `module.stripTypeScriptTypes()` removes type annotations from TypeScript code. It
* can be used to strip type annotations from TypeScript code before running it
* with `vm.runInContext()` or `vm.compileFunction()`.
* By default, it will throw an error if the code contains TypeScript features
* that require transformation such as `Enums`,
* see [type-stripping](https://nodejs.org/docs/latest-v24.x/api/typescript.md#type-stripping) for more information.
* When mode is `'transform'`, it also transforms TypeScript features to JavaScript,
* see [transform TypeScript features](https://nodejs.org/docs/latest-v24.x/api/typescript.md#typescript-features) for more information.
* When mode is `'strip'`, source maps are not generated, because locations are preserved.
* If `sourceMap` is provided, when mode is `'strip'`, an error will be thrown.
*
* _WARNING_: The output of this function should not be considered stable across Node.js versions,
* due to changes in the TypeScript parser.
*
* ```js
* import { stripTypeScriptTypes } from 'node:module';
* const code = 'const a: number = 1;';
* const strippedCode = stripTypeScriptTypes(code);
* console.log(strippedCode);
* // Prints: const a = 1;
* ```
*
* If `sourceUrl` is provided, it will be used appended as a comment at the end of the output:
*
* ```js
* import { stripTypeScriptTypes } from 'node:module';
* const code = 'const a: number = 1;';
* const strippedCode = stripTypeScriptTypes(code, { mode: 'strip', sourceUrl: 'source.ts' });
* console.log(strippedCode);
* // Prints: const a = 1\n\n//# sourceURL=source.ts;
* ```
*
* When `mode` is `'transform'`, the code is transformed to JavaScript:
*
* ```js
* import { stripTypeScriptTypes } from 'node:module';
* const code = `
* namespace MathUtil {
* export const add = (a: number, b: number) => a + b;
* }`;
* const strippedCode = stripTypeScriptTypes(code, { mode: 'transform', sourceMap: true });
* console.log(strippedCode);
* // Prints:
* // var MathUtil;
* // (function(MathUtil) {
* // MathUtil.add = (a, b)=>a + b;
* // })(MathUtil || (MathUtil = {}));
* // # sourceMappingURL=data:application/json;base64, ...
* ```
* @since v22.13.0
* @param code The code to strip type annotations from.
* @returns The code with type annotations stripped.
*/
function stripTypeScriptTypes(code: string, options?: StripTypeScriptTypesOptions): string;
/* eslint-enable @definitelytyped/no-unnecessary-generics */
/**
* The `module.syncBuiltinESMExports()` method updates all the live bindings for
* builtin `ES Modules` to match the properties of the `CommonJS` exports. It
* does not add or remove exported names from the `ES Modules`.
*
* ```js
* import fs from 'node:fs';
* import assert from 'node:assert';
* import { syncBuiltinESMExports } from 'node:module';
*
* fs.readFile = newAPI;
*
* delete fs.readFileSync;
*
* function newAPI() {
* // ...
* }
*
* fs.newAPI = newAPI;
*
* syncBuiltinESMExports();
*
* import('node:fs').then((esmFS) => {
* // It syncs the existing readFile property with the new value
* assert.strictEqual(esmFS.readFile, newAPI);
* // readFileSync has been deleted from the required fs
* assert.strictEqual('readFileSync' in fs, false);
* // syncBuiltinESMExports() does not remove readFileSync from esmFS
* assert.strictEqual('readFileSync' in esmFS, true);
* // syncBuiltinESMExports() does not add names
* assert.strictEqual(esmFS.newAPI, undefined);
* });
* ```
* @since v12.12.0
*/
function syncBuiltinESMExports(): void;
interface ImportAttributes extends NodeJS.Dict<string> {
type?: string | undefined;
}
type ImportPhase = "source" | "evaluation";
type ModuleFormat =
| "addon"
| "builtin"
| "commonjs"
| "commonjs-typescript"
| "json"
| "module"
| "module-typescript"
| "wasm";
type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
interface ResolveHookContext {
conditions: string[];
importAttributes: ImportAttributes;
parentURL: string | undefined;
}
interface ResolveFnOutput {
format?: string | null | undefined;
importAttributes?: ImportAttributes | undefined;
shortCircuit?: boolean | undefined;
url: string;
}
type ResolveHook = (
specifier: string,
context: ResolveHookContext,
nextResolve: (
specifier: string,
context?: Partial<ResolveHookContext>,
) => ResolveFnOutput | Promise<ResolveFnOutput>,
) => ResolveFnOutput | Promise<ResolveFnOutput>;
type ResolveHookSync = (
specifier: string,
context: ResolveHookContext,
nextResolve: (
specifier: string,
context?: Partial<ResolveHookContext>,
) => ResolveFnOutput,
) => ResolveFnOutput;
interface LoadHookContext {
conditions: string[];
format: string | null | undefined;
importAttributes: ImportAttributes;
}
interface LoadFnOutput {
format: string | null | undefined;
shortCircuit?: boolean | undefined;
source?: ModuleSource | undefined;
}
type LoadHook = (
url: string,
context: LoadHookContext,
nextLoad: (
url: string,
context?: Partial<LoadHookContext>,
) => LoadFnOutput | Promise<LoadFnOutput>,
) => LoadFnOutput | Promise<LoadFnOutput>;
type LoadHookSync = (
url: string,
context: LoadHookContext,
nextLoad: (
url: string,
context?: Partial<LoadHookContext>,
) => LoadFnOutput,
) => LoadFnOutput;
interface SourceMapsSupport {
/**
* If the source maps support is enabled
*/
enabled: boolean;
/**
* If the support is enabled for files in `node_modules`.
*/
nodeModules: boolean;
/**
* If the support is enabled for generated code from `eval` or `new Function`.
*/
generatedCode: boolean;
}
/**
* This method returns whether the [Source Map v3](https://tc39.es/ecma426/) support for stack
* traces is enabled.
* @since v23.7.0, v22.14.0
*/
function getSourceMapsSupport(): SourceMapsSupport;
/**
* `path` is the resolved path for the file for which a corresponding source map
* should be fetched.
* @since v13.7.0, v12.17.0
* @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
*/
function findSourceMap(path: string): SourceMap | undefined;
interface SetSourceMapsSupportOptions {
/**
* If enabling the support for files in `node_modules`.
* @default false
*/
nodeModules?: boolean | undefined;
/**
* If enabling the support for generated code from `eval` or `new Function`.
* @default false
*/
generatedCode?: boolean | undefined;
}
/**
* This function enables or disables the [Source Map v3](https://tc39.es/ecma426/) support for
* stack traces.
*
* It provides same features as launching Node.js process with commandline options
* `--enable-source-maps`, with additional options to alter the support for files
* in `node_modules` or generated codes.
*
* Only source maps in JavaScript files that are loaded after source maps has been
* enabled will be parsed and loaded. Preferably, use the commandline options
* `--enable-source-maps` to avoid losing track of source maps of modules loaded
* before this API call.
* @since v23.7.0, v22.14.0
*/
function setSourceMapsSupport(enabled: boolean, options?: SetSourceMapsSupportOptions): void;
interface SourceMapConstructorOptions {
/**
* @since v21.0.0, v20.5.0
*/
lineLengths?: readonly number[] | undefined;
}
interface SourceMapPayload {
file: string;
version: number;
sources: string[];
sourcesContent: string[];
names: string[];
mappings: string;
sourceRoot: string;
}
interface SourceMapping {
generatedLine: number;
generatedColumn: number;
originalSource: string;
originalLine: number;
originalColumn: number;
}
interface SourceOrigin {
/**
* The name of the range in the source map, if one was provided
*/
name: string | undefined;
/**
* The file name of the original source, as reported in the SourceMap
*/
fileName: string;
/**
* The 1-indexed lineNumber of the corresponding call site in the original source
*/
lineNumber: number;
/**
* The 1-indexed columnNumber of the corresponding call site in the original source
*/
columnNumber: number;
}
/**
* @since v13.7.0, v12.17.0
*/
class SourceMap {
constructor(payload: SourceMapPayload, options?: SourceMapConstructorOptions);
/**
* Getter for the payload used to construct the `SourceMap` instance.
*/
readonly payload: SourceMapPayload;
/**
* Given a line offset and column offset in the generated source
* file, returns an object representing the SourceMap range in the
* original file if found, or an empty object if not.
*
* The object returned contains the following keys:
*
* The returned value represents the raw range as it appears in the
* SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and
* column numbers as they appear in Error messages and CallSite
* objects.
*
* To get the corresponding 1-indexed line and column numbers from a
* lineNumber and columnNumber as they are reported by Error stacks
* and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)`
* @param lineOffset The zero-indexed line number offset in the generated source
* @param columnOffset The zero-indexed column number offset in the generated source
*/
findEntry(lineOffset: number, columnOffset: number): SourceMapping | {};
/**
* Given a 1-indexed `lineNumber` and `columnNumber` from a call site in the generated source,
* find the corresponding call site location in the original source.
*
* If the `lineNumber` and `columnNumber` provided are not found in any source map,
* then an empty object is returned.
* @param lineNumber The 1-indexed line number of the call site in the generated source
* @param columnNumber The 1-indexed column number of the call site in the generated source
*/
findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {};
}
function runMain(main?: string): void;
function wrap(script: string): string;
}
global {
interface ImportMeta {
/**
* The directory name of the current module.
*
* This is the same as the `path.dirname()` of the `import.meta.filename`.
*
* > **Caveat**: only present on `file:` modules.
* @since v21.2.0, v20.11.0
*/
dirname: string;
/**
* The full absolute path and filename of the current module, with
* symlinks resolved.
*
* This is the same as the `url.fileURLToPath()` of the `import.meta.url`.
*
* > **Caveat** only local modules support this property. Modules not using the
* > `file:` protocol will not provide it.
* @since v21.2.0, v20.11.0
*/
filename: string;
/**
* The absolute `file:` URL of the module.
*
* This is defined exactly the same as it is in browsers providing the URL of the
* current module file.
*
* This enables useful patterns such as relative file loading:
*
* ```js
* import { readFileSync } from 'node:fs';
* const buffer = readFileSync(new URL('./data.proto', import.meta.url));
* ```
*/
url: string;
/**
* `import.meta.resolve` is a module-relative resolution function scoped to
* each module, returning the URL string.
*
* ```js
* const dependencyAsset = import.meta.resolve('component-lib/asset.css');
* // file:///app/node_modules/component-lib/asset.css
* import.meta.resolve('./dep.js');
* // file:///app/dep.js
* ```
*
* All features of the Node.js module resolution are supported. Dependency
* resolutions are subject to the permitted exports resolutions within the package.
*
* **Caveats**:
*
* * This can result in synchronous file-system operations, which
* can impact performance similarly to `require.resolve`.
* * This feature is not available within custom loaders (it would
* create a deadlock).
* @since v13.9.0, v12.16.0
* @param specifier The module specifier to resolve relative to the
* current module.
* @param parent An optional absolute parent module URL to resolve from.
* **Default:** `import.meta.url`
* @returns The absolute URL string that the specifier would resolve to.
*/
resolve(specifier: string, parent?: string | URL): string;
/**
* `true` when the current module is the entry point of the current process; `false` otherwise.
*
* Equivalent to `require.main === module` in CommonJS.
*
* Analogous to Python's `__name__ == "__main__"`.
*
* ```js
* export function foo() {
* return 'Hello, world';
* }
*
* function main() {
* const message = foo();
* console.log(message);
* }
*
* if (import.meta.main) main();
* // `foo` can be imported from another module without possible side-effects from `main`
* ```
* @since v24.2.0
* @experimental
*/
main: boolean;
}
namespace NodeJS {
interface Module {
/**
* The module objects required for the first time by this one.
* @since v0.1.16
*/
children: Module[];
/**
* The `module.exports` object is created by the `Module` system. Sometimes this is
* not acceptable; many want their module to be an instance of some class. To do
* this, assign the desired export object to `module.exports`.
* @since v0.1.16
*/
exports: any;
/**
* The fully resolved filename of the module.
* @since v0.1.16
*/
filename: string;
/**
* The identifier for the module. Typically this is the fully resolved
* filename.
* @since v0.1.16
*/
id: string;
/**
* `true` if the module is running during the Node.js preload
* phase.
* @since v15.4.0, v14.17.0
*/
isPreloading: boolean;
/**
* Whether or not the module is done loading, or is in the process of
* loading.
* @since v0.1.16
*/
loaded: boolean;
/**
* The module that first required this one, or `null` if the current module is the
* entry point of the current process, or `undefined` if the module was loaded by
* something that is not a CommonJS module (e.g. REPL or `import`).
* @since v0.1.16
* @deprecated Please use `require.main` and `module.children` instead.
*/
parent: Module | null | undefined;
/**
* The directory name of the module. This is usually the same as the
* `path.dirname()` of the `module.id`.
* @since v11.14.0
*/
path: string;
/**
* The search paths for the module.
* @since v0.4.0
*/
paths: string[];
/**
* The `module.require()` method provides a way to load a module as if
* `require()` was called from the original module.
* @since v0.5.1
*/
require(id: string): any;
}
interface Require {
/**
* Used to import modules, `JSON`, and local files.
* @since v0.1.13
*/
(id: string): any;
/**
* Modules are cached in this object when they are required. By deleting a key
* value from this object, the next `require` will reload the module.
* This does not apply to
* [native addons](https://nodejs.org/docs/latest-v24.x/api/addons.html),
* for which reloading will result in an error.
* @since v0.3.0
*/
cache: Dict<Module>;
/**
* Instruct `require` on how to handle certain file extensions.
* @since v0.3.0
* @deprecated
*/
extensions: RequireExtensions;
/**
* The `Module` object representing the entry script loaded when the Node.js
* process launched, or `undefined` if the entry point of the program is not a
* CommonJS module.
* @since v0.1.17
*/
main: Module | undefined;
/**
* @since v0.3.0
*/
resolve: RequireResolve;
}
/** @deprecated */
interface RequireExtensions extends Dict<(module: Module, filename: string) => any> {
".js": (module: Module, filename: string) => any;
".json": (module: Module, filename: string) => any;
".node": (module: Module, filename: string) => any;
}
interface RequireResolveOptions {
/**
* Paths to resolve module location from. If present, these
* paths are used instead of the default resolution paths, with the exception
* of
* [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v24.x/api/modules.html#loading-from-the-global-folders)
* like `$HOME/.node_modules`, which are
* always included. Each of these paths is used as a starting point for
* the module resolution algorithm, meaning that the `node_modules` hierarchy
* is checked from this location.
* @since v8.9.0
*/
paths?: string[] | undefined;
}
interface RequireResolve {
/**
* Use the internal `require()` machinery to look up the location of a module,
* but rather than loading the module, just return the resolved filename.
*
* If the module can not be found, a `MODULE_NOT_FOUND` error is thrown.
* @since v0.3.0
* @param request The module path to resolve.
*/
(request: string, options?: RequireResolveOptions): string;
/**
* Returns an array containing the paths searched during resolution of `request` or
* `null` if the `request` string references a core module, for example `http` or
* `fs`.
* @since v8.9.0
* @param request The module path whose lookup paths are being retrieved.
*/
paths(request: string): string[] | null;
}
}
/**
* The directory name of the current module. This is the same as the
* `path.dirname()` of the `__filename`.
* @since v0.1.27
*/
var __dirname: string;
/**
* The file name of the current module. This is the current module file's absolute
* path with symlinks resolved.
*
* For a main program this is not necessarily the same as the file name used in the
* command line.
* @since v0.0.1
*/
var __filename: string;
/**
* The `exports` variable is available within a module's file-level scope, and is
* assigned the value of `module.exports` before the module is evaluated.
* @since v0.1.16
*/
var exports: NodeJS.Module["exports"];
/**
* A reference to the current module.
* @since v0.1.16
*/
var module: NodeJS.Module;
/**
* @since v0.1.13
*/
var require: NodeJS.Require;
// Global-scope aliases for backwards compatibility with @types/node <13.0.x
// TODO: consider removing in a future major version update
/** @deprecated Use `NodeJS.Module` instead. */
interface NodeModule extends NodeJS.Module {}
/** @deprecated Use `NodeJS.Require` instead. */
interface NodeRequire extends NodeJS.Require {}
/** @deprecated Use `NodeJS.RequireResolve` instead. */
interface RequireResolve extends NodeJS.RequireResolve {}
}
export = Module;
}
declare module "node:module" {
import module = require("module");
export = module;
}
@@ -0,0 +1,829 @@
export default `flf2a$ 8 7 17 0 11 0 24447 0
Author : bpg
Date : 2004/6/17 9:16:55
Version: 1.0
-------------------------------------------------
made for fun (ty myflix and LGB for help)
-------------------------------------------------
This font has been created using JavE's FIGlet font export assistant.
Have a look at: http://www.jave.de
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
$ #
$ #
$ #
$ #
$ #
$ #
$ #
$ ##
__ #
/__/\\ #
\\.:\\ \\ #
\\::\\ \\ #
\\__\\/_ #
/__/\\ #
\\__\\/ #
##
___ ___ #
/__/\\/__/\\ #
\\::\\ \\::\\ \\ #
\\:_\\/\\:_\\/ #
#
#
#
##
##
#
#
#
#
#
#
##
$#
#
#
#
#
#
#
##
%#
#
#
#
#
#
#
##
&#
#
#
#
#
#
#
##
___ #
/__/\\ #
\\::\\ \\ #
\\:_\\/ #
#
#
#
##
(#
#
#
#
#
#
#
##
)#
#
#
#
#
#
#
##
*#
#
#
#
#
#
#
##
+#
#
#
#
#
#
#
##
#
#
#
____ #
/___/\\ #
\\:::\\ \\ #
\\::\\/ #
##
#
#
_______ #
/______/\\ #
\\__::::\\/ #
#
#
##
#
#
#
___ #
/__/\\ #
\\::\\ \\ #
\\:_\\/ #
##
/#
#
#
#
#
#
#
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\_\\ \\ \\ #
\\_____\\/ #
##
____ #
/___/\\ #
\\_::\\ \\ #
\\::\\ \\ #
_\\: \\ \\__ #
/__\\: \\__/\\ #
\\________\\/ #
##
_____ #
/_____/\\ #
\\:::_:\\ \\ #
_\\:\\| #
/::_/__ #
\\:\\____/\\ #
\\_____\\/ #
##
______ #
/_____/\\ #
\\:::_:\\ \\ #
/_\\:\\ \\ #
\\::_:\\ \\ #
/___\\:\\ ' #
\\______/ #
##
__ __ #
/__/\\/__/\\ #
\\ \\ \\: \\ \\__ #
\\::\\_\\::\\/_/\\ #
\\_::: __\\/ #
\\::\\ \\ #
\\__\\/ #
##
______ #
/_____/\\ #
\\::::_\\/_ #
\\:\\/___/\\ #
\\_::._\\:\\ #
/_____\\/ #
\\_____/ #
##
______ #
/_____/\\ #
\\:::__\\/ #
\\:\\ \\____ #
\\::__::/\\ #
\\:\\_\\:\\ \\ #
\\_____\\/ #
##
_______ #
/______/\\ #
\\__::::\\ \\ #
\\::\\ \\ #
\\::\\ \\ #
\\: \\ \\ #
\\:_\\/ #
##
______ #
/_____/\\ #
\\:::_:\\ \\ #
\\:\\_\\:\\ \\ #
\\::__:\\ \\ #
\\:\\_\\:\\ \\ #
\\_____\\/ #
##
______ #
/_____/\\ #
\\:::_:\\ \\ #
\\:\\_\\:\\ \\ #
\\::__:\\ \\ #
\\ \\ \\ #
\\_\\/ #
##
___ #
/__/\\ #
\\::\\/ #
___ #
/__/\\ #
\\::\\/ #
#
##
;#
#
#
#
#
#
#
##
<#
#
#
#
#
#
#
##
=#
#
#
#
#
#
#
##
>#
#
#
#
#
#
#
##
______ #
/_____/\\ #
\\__:::\\ \\ #
/::/ / #
\\::\\/_ #
/__/\\ #
\\__\\/ #
##
@#
#
#
#
#
#
#
##
________ #
/_______/\\ #
\\::: _ \\ \\ #
\\::(_) \\ \\ #
\\:: __ \\ \\ #
\\:.\\ \\ \\ \\ #
\\__\\/\\__\\/ #
##
_______ #
/_______/\\ #
\\::: _ \\ \\ #
\\::(_) \\/_ #
\\:: _ \\ \\ #
\\::(_) \\ \\ #
\\_______\\/ #
##
______ #
/_____/\\ #
\\:::__\\/ #
\\:\\ \\ __ #
\\:\\ \\/_/\\ #
\\:\\_\\ \\ \\ #
\\_____\\/ #
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\/.:| | #
\\____/_/ #
##
______ #
/_____/\\ #
\\::::_\\/_ #
\\:\\/___/\\ #
\\::___\\/_ #
\\:\\____/\\ #
\\_____\\/ #
##
______ #
/_____/\\ #
\\::::_\\/_ #
\\:\\/___/\\ #
\\:::._\\/ #
\\:\\ \\ #
\\_\\/ #
##
_______ #
/______/\\ #
\\::::__\\/__ #
\\:\\ /____/\\ #
\\:\\\\_ _\\/ #
\\:\\_\\ \\ \\ #
\\_____\\/ #
##
___ ___ #
/__/\\ /__/\\ #
\\::\\ \\\\ \\ \\ #
\\::\\/_\\ .\\ \\ #
\\:: ___::\\ \\ #
\\: \\ \\\\::\\ \\#
\\__\\/ \\::\\/#
##
________ #
/_______/\\ #
\\__.::._\\/ #
\\::\\ \\ #
_\\::\\ \\__ #
/__\\::\\__/\\ #
\\________\\/ #
##
_________ #
/________/\\ #
\\__.::.__\\/ #
/_\\::\\ \\ #
\\:.\\::\\ \\ #
\\: \\ \\ \\ #
\\_____\\/ #
##
___ ___ #
/___/\\/__/\\ #
\\::.\\ \\\\ \\ \\ #
\\:: \\/_) \\ \\ #
\\:. __ ( ( #
\\: \\ ) \\ \\ #
\\__\\/\\__\\/ #
##
__ #
/_/\\ #
\\:\\ \\ #
\\:\\ \\ #
\\:\\ \\____ #
\\:\\/___/\\ #
\\_____\\/ #
##
___ __ __ #
/__//_//_/\\ #
\\::\\| \\| \\ \\ #
\\:. \\ \\ #
\\:.\\-/\\ \\ \\ #
\\. \\ \\ \\ \\#
\\__\\/ \\__\\/#
##
___ __ #
/__/\\ /__/\\ #
\\::\\_\\\\ \\ \\ #
\\:. \`-\\ \\ \\ #
\\:. _ \\ \\ #
\\. \\\`-\\ \\ \\#
\\__\\/ \\__\\/#
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\_\\ \\ \\ #
\\_____\\/ #
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:(_) \\ \\ #
\\: ___\\/ #
\\ \\ \\ #
\\_\\/ #
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:\\ \\ \\ \\_ #
\\:\\ \\ /_ \\ #
\\:\\_- \\ \\ #
\\___|\\_\\_/ #
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:(_) ) )_ #
\\: __ \`\\ \\ #
\\ \\ \`\\ \\ \\ #
\\_\\/ \\_\\/ #
##
______ #
/_____/\\ #
\\::::_\\/_ #
\\:\\/___/\\ #
\\_::._\\:\\ #
/____\\:\\ #
\\_____\\/ #
##
_________ #
/________/\\ #
\\__.::.__\\/ #
\\::\\ \\ #
\\::\\ \\ #
\\::\\ \\ #
\\__\\/ #
##
__ __ #
/_/\\/_/\\ #
\\:\\ \\:\\ \\ #
\\:\\ \\:\\ \\ #
\\:\\ \\:\\ \\ #
\\:\\_\\:\\ \\ #
\\_____\\/ #
##
__ __ #
/_/\\ /_/\\ #
\\:\\ \\\\ \\ \\ #
\\:\\ \\\\ \\ \\ #
\\:\\_/.:\\ \\ #
\\ ..::/ / #
\\___/_( #
##
__ __ __ #
/_//_//_/\\ #
\\:\\\\:\\\\:\\ \\ #
\\:\\\\:\\\\:\\ \\ #
\\:\\\\:\\\\:\\ \\ #
\\:\\\\:\\\\:\\ \\ #
\\_______\\/ #
##
__ __ #
/__/\\ /__/\\ #
\\ \\::\\\\:.\\ \\ #
\\_\\::_\\:_\\/ #
_\\/__\\_\\_/\\ #
\\ \\ \\ \\::\\ \\#
\\_\\/ \\__\\/#
##
__ __ #
/_/\\/_/\\ #
\\ \\ \\ \\ \\ #
\\:\\_\\ \\ \\ #
\\::::_\\/ #
\\::\\ \\ #
\\__\\/ #
##
______ #
/_____/\\ #
\\:::__\\/ #
/: / #
/::/___ #
/_:/____/\\ #
\\_______\\/ #
##
[#
#
#
#
#
#
#
##
\\#
#
#
#
#
#
#
##
]#
#
#
#
#
#
#
##
__ #
/\\ \\ #
/::\\ \\ #
/:/\\_\\/ #
#
#
#
##
#
#
#
#
_______ #
/______/\\ #
\\__::::\\/ #
##
_____ #
/____/\\ #
\\_:::\\ \\ #
\\ :\\ \\ #
\\__\\/ #
#
#
##
________ #
/_______/\\ #
\\::: _ \\ \\ #
\\::(_) \\ \\ #
\\:: __ \\ \\ #
\\:.\\ \\ \\ \\ #
\\__\\/\\__\\/ #
##
_______ #
/_______/\\ #
\\::: _ \\ \\ #
\\::(_) \\/_ #
\\:: _ \\ \\ #
\\::(_) \\ \\ #
\\_______\\/ #
##
______ #
/_____/\\ #
\\:::__\\/ #
\\:\\ \\ __ #
\\:\\ \\/_/\\ #
\\:\\_\\ \\ \\ #
\\_____\\/ #
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\/.:| | #
\\____/_/ #
##
______ #
/_____/\\ #
\\::::_\\/_ #
\\:\\/___/\\ #
\\::___\\/_ #
\\:\\____/\\ #
\\_____\\/ #
##
______ #
/_____/\\ #
\\::::_\\/_ #
\\:\\/___/\\ #
\\:::._\\/ #
\\:\\ \\ #
\\_\\/ #
##
_______ #
/______/\\ #
\\::::__\\/__ #
\\:\\ /____/\\ #
\\:\\\\_ _\\/ #
\\:\\_\\ \\ \\ #
\\_____\\/ #
##
___ ___ #
/__/\\ /__/\\ #
\\::\\ \\\\ \\ \\ #
\\::\\/_\\ .\\ \\ #
\\:: ___::\\ \\ #
\\: \\ \\\\::\\ \\#
\\__\\/ \\::\\/#
##
________ #
/_______/\\ #
\\__.::._\\/ #
\\::\\ \\ #
_\\::\\ \\__ #
/__\\::\\__/\\ #
\\________\\/ #
##
_________ #
/________/\\ #
\\__.::.__\\/ #
/_\\::\\ \\ #
\\:.\\::\\ \\ #
\\: \\ \\ \\ #
\\_____\\/ #
##
___ ___ #
/___/\\/__/\\ #
\\::.\\ \\\\ \\ \\ #
\\:: \\/_) \\ \\ #
\\:. __ ( ( #
\\: \\ ) \\ \\ #
\\__\\/\\__\\/ #
##
__ #
/_/\\ #
\\:\\ \\ #
\\:\\ \\ #
\\:\\ \\____ #
\\:\\/___/\\ #
\\_____\\/ #
##
___ __ __ #
/__//_//_/\\ #
\\::\\| \\| \\ \\ #
\\:. \\ \\ #
\\:.\\-/\\ \\ \\ #
\\. \\ \\ \\ \\#
\\__\\/ \\__\\/#
##
___ __ #
/__/\\ /__/\\ #
\\::\\_\\\\ \\ \\ #
\\:. \`-\\ \\ \\ #
\\:. _ \\ \\ #
\\. \\\`-\\ \\ \\#
\\__\\/ \\__\\/#
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\_\\ \\ \\ #
\\_____\\/ #
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:(_) \\ \\ #
\\: ___\\/ #
\\ \\ \\ #
\\_\\/ #
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:\\ \\ \\ \\_ #
\\:\\ \\ /_ \\ #
\\:\\_- \\ \\ #
\\___|\\_\\_/ #
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:(_) ) )_ #
\\: __ \`\\ \\ #
\\ \\ \`\\ \\ \\ #
\\_\\/ \\_\\/ #
##
______ #
/_____/\\ #
\\::::_\\/_ #
\\:\\/___/\\ #
\\_::._\\:\\ #
/____\\:\\ #
\\_____\\/ #
##
_________ #
/________/\\ #
\\__.::.__\\/ #
\\::\\ \\ #
\\::\\ \\ #
\\::\\ \\ #
\\__\\/ #
##
__ __ #
/_/\\/_/\\ #
\\:\\ \\:\\ \\ #
\\:\\ \\:\\ \\ #
\\:\\ \\:\\ \\ #
\\:\\_\\:\\ \\ #
\\_____\\/ #
##
__ __ #
/_/\\ /_/\\ #
\\:\\ \\\\ \\ \\ #
\\:\\ \\\\ \\ \\ #
\\:\\_/.:\\ \\ #
\\ ..::/ / #
\\___/_( #
##
__ __ __ #
/_//_//_/\\ #
\\:\\\\:\\\\:\\ \\ #
\\:\\\\:\\\\:\\ \\ #
\\:\\\\:\\\\:\\ \\ #
\\:\\\\:\\\\:\\ \\ #
\\_______\\/ #
##
__ __ #
/__/\\ /__/\\ #
\\ \\::\\\\:.\\ \\ #
\\_\\::_\\:_\\/ #
_\\/__\\_\\_/\\ #
\\ \\ \\ \\::\\ \\#
\\_\\/ \\__\\/#
##
__ __ #
/_/\\/_/\\ #
\\ \\ \\ \\ \\ #
\\:\\_\\ \\ \\ #
\\::::_\\/ #
\\::\\ \\ #
\\__\\/ #
##
______ #
/_____/\\ #
\\:::__\\/ #
/: / #
/::/___ #
/_:/____/\\ #
\\_______\\/ #
##
_____ #
/____/\\ #
_\\:::_\\/ #
/____/\\ #
\\::__\\/_ #
| ___/\\ #
\\::_\\/ #
##
|#
#
#
#
#
#
#
##
_____ #
/____/\\ #
\\_:::\\ \\__ #
/____/\\ #
_\\__::\\/ #
/___/ | #
\\_::\\/ #
##
/""--__ #
\\"::-__/\\ #
\\ ::: \\ \\ #
""-::_\\/ #
#
#
#
##
________ #
/_______/\\ #
\\::: _ \\ \\ #
\\::(_) \\ \\ #
\\:: __ \\ \\ #
\\:.\\ \\ \\ \\ #
\\__\\/\\__\\/ #
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\_\\ \\ \\ #
\\_____\\/ #
##
__ __ #
/_/\\/_/\\ #
\\:\\ \\:\\ \\ #
\\:\\ \\:\\ \\ #
\\:\\ \\:\\ \\ #
\\:\\_\\:\\ \\ #
\\_____\\/ #
##
________ #
/_______/\\ #
\\::: _ \\ \\ #
\\::(_) \\ \\ #
\\:: __ \\ \\ #
\\:.\\ \\ \\ \\ #
\\__\\/\\__\\/ #
##
______ #
/_____/\\ #
\\:::_ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\ \\ \\ \\ #
\\:\\_\\ \\ \\ #
\\_____\\/ #
##
__ __ #
/_/\\/_/\\ #
\\:\\ \\:\\ \\ #
\\:\\ \\:\\ \\ #
\\:\\ \\:\\ \\ #
\\:\\_\\:\\ \\ #
\\_____\\/ #
##
�#
#
#
#
#
#
#
##
`
@@ -0,0 +1,71 @@
# content-type
[![NPM version][npm-image]][npm-url]
[![NPM downloads][downloads-image]][downloads-url]
[![Build status][build-image]][build-url]
[![Build coverage][coverage-image]][coverage-url]
[![License][license-image]][license-url]
Create and parse HTTP `Content-Type` header.
## Installation
```sh
npm install content-type
```
## API
```js
const contentType = require("content-type");
```
### contentType.parse(string, options?)
```js
const obj = contentType.parse("image/svg+xml; charset=utf-8");
```
Parse a `Content-Type` header. This will return an object with the following properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`):
- `type`: The media type. Example: `'image/svg+xml'`.
- `parameters`: An object of the parameters in the media type (parameter name is always lower case). Example: `{charset: 'utf-8'}`.
The parser is lenient and does not error. You should validate `type` and `parameters` before trusting them.
#### Options
- `parameters` (default: `true`): Set to `false` to skip parameters.
- `comma` (default: `false`): Set to `true` to stop on a comma. This can be used to parse the media range in an `Accept` header.
- `start` (default: `0`): Set index to start parsing from.
### contentType.format(obj)
```js
const str = contentType.format({
type: "image/svg+xml",
parameters: { charset: "utf-8" },
});
```
Format an object into a `Content-Type` header. This will return a string of the content type for the given object with the following properties (examples are shown that produce the string `'image/svg+xml; charset=utf-8'`):
- `type`: The media type. Example: `'image/svg+xml'`.
- `parameters`: An optional object of the parameters in the media type. Example: `{charset: 'utf-8'}`.
Throws a `TypeError` if the object contains an invalid type or parameter names.
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/content-type
[npm-url]: https://npmjs.org/package/content-type
[downloads-image]: https://img.shields.io/npm/dm/content-type
[downloads-url]: https://npmjs.org/package/content-type
[build-image]: https://img.shields.io/github/actions/workflow/status/jshttp/content-type/ci.yml?branch=master
[build-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml?query=branch%3Amaster
[coverage-image]: https://img.shields.io/codecov/c/gh/jshttp/content-type
[coverage-url]: https://codecov.io/gh/jshttp/content-type
[license-image]: http://img.shields.io/npm/l/content-type.svg?style=flat
[license-url]: LICENSE
@@ -0,0 +1,32 @@
import type { RuleContext, RuleListener, RuleMetaData, RuleMetaDataDocs, RuleModule } from '../ts-eslint/Rule';
export type NamedCreateRuleMetaDocs = Omit<RuleMetaDataDocs, 'url'>;
export type NamedCreateRuleMeta<MessageIds extends string, PluginDocs = unknown, Options extends readonly unknown[] = []> = {
docs: PluginDocs & RuleMetaDataDocs;
} & Omit<RuleMetaData<MessageIds, PluginDocs, Options>, 'docs'>;
export interface RuleCreateAndOptions<Options extends readonly unknown[], MessageIds extends string> {
create: (context: Readonly<RuleContext<MessageIds, Options>>, optionsWithDefault: Readonly<Options>) => RuleListener;
/** @deprecated Use meta.defaultOptions instead */
defaultOptions?: Readonly<Options>;
}
export interface RuleWithMeta<Options extends readonly unknown[], MessageIds extends string, Docs = unknown> extends RuleCreateAndOptions<Options, MessageIds> {
meta: RuleMetaData<MessageIds, Docs, Options>;
name?: string;
}
export interface RuleWithMetaAndName<Options extends readonly unknown[], MessageIds extends string, Docs = unknown> extends RuleCreateAndOptions<Options, MessageIds> {
meta: NamedCreateRuleMeta<MessageIds, Docs, Options>;
name: string;
}
type RuleModuleWithName<MessageIds extends string, Options extends readonly unknown[] = [], Docs = unknown, ExtendedRuleListener extends RuleListener = RuleListener> = RuleModule<MessageIds, Options, Docs, ExtendedRuleListener> & {
name: string;
};
/**
* Creates reusable function to create rules with default options and docs URLs.
*
* @param urlCreator Creates a documentation URL for a given rule name.
* @returns Function to create a rule with the docs URL format.
*/
export declare function RuleCreator<PluginDocs = unknown>(urlCreator: (ruleName: string) => string): <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<RuleWithMetaAndName<Options, MessageIds, PluginDocs>>) => RuleModuleWithName<MessageIds, Options, PluginDocs>;
export declare namespace RuleCreator {
var withoutDocs: <Options extends readonly unknown[], MessageIds extends string>(args: Readonly<RuleWithMeta<Options, MessageIds>>) => RuleModule<MessageIds, Options>;
}
export { type RuleListener, type RuleModule } from '../ts-eslint/Rule';
@@ -0,0 +1,167 @@
# eventsource
[![npm version](https://img.shields.io/npm/v/eventsource.svg?style=flat-square)](https://www.npmjs.com/package/eventsource)[![npm bundle size](https://img.shields.io/bundlephobia/minzip/eventsource?style=flat-square)](https://bundlephobia.com/result?p=eventsource)[![npm weekly downloads](https://img.shields.io/npm/dw/eventsource.svg?style=flat-square)](https://www.npmjs.com/package/eventsource)
WhatWG/W3C-compatible [server-sent events/eventsource](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) client. The module attempts to implement an absolute minimal amount of features/changes beyond the specification.
If you're looking for a modern alternative with a less constrained API, check out the [`eventsource-client` package](https://www.npmjs.com/package/eventsource-client).
## Installation
```bash
npm install --save eventsource
```
## Supported engines
- Node.js >= 18
- Chrome >= 63
- Safari >= 11.3
- Firefox >= 65
- Edge >= 79
- Deno >= 1.30
- Bun >= 1.1.23
Basically, any environment that supports:
- [fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch)
- [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)
- [TextDecoderStream](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream)
- [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL)
- [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event), [MessageEvent](https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent), [EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget)
If you need to support older runtimes, try the `2.x` branch/version range (note: 2.x branch is primarily targetted at Node.js, not browsers).
## Usage
```ts
import {EventSource} from 'eventsource'
const es = new EventSource('https://my-server.com/sse')
/*
* This will listen for events with the field `event: notice`.
*/
es.addEventListener('notice', (event) => {
console.log(event.data)
})
/*
* This will listen for events with the field `event: update`.
*/
es.addEventListener('update', (event) => {
console.log(event.data)
})
/*
* The event "message" is a special case, as it will capture events _without_ an
* event field, as well as events that have the specific type `event: message`.
* It will not trigger on any other event type.
*/
es.addEventListener('message', (event) => {
console.log(event.data)
})
/**
* To explicitly close the connection, call the `close` method.
* This will prevent any reconnection from happening.
*/
setTimeout(() => {
es.close()
}, 10_000)
```
### TypeScript
Make sure you have configured your TSConfig so it matches the environment you are targetting. If you are targetting browsers, this would be `dom`:
```jsonc
{
"compilerOptions": {
"lib": ["dom"],
},
}
```
If you're using Node.js, ensure you have `@types/node` installed (and it is version 18 or higher). Cloudflare workers have `@cloudflare/workers-types` etc.
The following errors are caused by targetting an environment that does not have the necessary types available:
```
error TS2304: Cannot find name 'Event'.
error TS2304: Cannot find name 'EventTarget'.
error TS2304: Cannot find name 'MessageEvent'.
```
## Migrating from v1 / v2
See [MIGRATION.md](MIGRATION.md#v2-to-v3) for a detailed migration guide.
## Extensions to the WhatWG/W3C API
### Message and code properties on errors
The `error` event has a `message` and `code` property that can be used to get more information about the error. In the specification, the Event
```ts
es.addEventListener('error', (err) => {
if (err.code === 401 || err.code === 403) {
console.log('not authorized')
}
})
```
### Specify `fetch` implementation
The `EventSource` constructor accepts an optional `fetch` property in the second argument that can be used to specify the `fetch` implementation to use.
This can be useful in environments where the global `fetch` function is not available - but it can also be used to alter the request/response behaviour.
#### Setting HTTP request headers
```ts
const es = new EventSource('https://my-server.com/sse', {
fetch: (input, init) =>
fetch(input, {
...init,
headers: {
...init.headers,
Authorization: 'Bearer myToken',
},
}),
})
```
#### HTTP/HTTPS proxy
Use a package like [`node-fetch-native`](https://github.com/unjs/node-fetch-native) to add proxy support, either through environment variables or explicit configuration.
```ts
// npm install node-fetch-native --save
import {fetch} from 'node-fetch-native/proxy'
const es = new EventSource('https://my-server.com/sse', {
fetch: (input, init) => fetch(input, init),
})
```
#### Allow unauthorized HTTPS requests
Use a package like [`undici`](https://github.com/nodejs/undici) for more control of fetch options through the use of an [`Agent`](https://undici.nodejs.org/#/docs/api/Agent.md).
```ts
// npm install undici --save
import {fetch, Agent} from 'undici'
await fetch('https://my-server.com/sse', {
dispatcher: new Agent({
connect: {
rejectUnauthorized: false,
},
}),
})
```
## License
MIT-licensed. See [LICENSE](LICENSE).
@@ -0,0 +1,18 @@
import { SVGVisualElement, HTMLVisualElement } from 'motion-dom';
import { Fragment } from 'react';
import { isSVGComponent } from './utils/is-svg-component.mjs';
const createDomVisualElement = (Component, options) => {
/**
* Use explicit isSVG override if provided, otherwise auto-detect
*/
const isSVG = options.isSVG ?? isSVGComponent(Component);
return isSVG
? new SVGVisualElement(options)
: new HTMLVisualElement(options, {
allowProjection: Component !== Fragment,
});
};
export { createDomVisualElement };
//# sourceMappingURL=create-visual-element.mjs.map
@@ -0,0 +1,10 @@
"use strict";
const absFloor = require("./absFloor-CImRXpov.js");
const constants = require("./constants-DR3SPJ7u.js");
const parse = require("./parse.js");
function diffInDays(date, input, asFloat) {
const parsed = parse(input);
const output = (+date - +parsed) / constants.MS_IN_DAY;
return asFloat ? output : absFloor.absFloor(output);
}
module.exports = diffInDays;
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,QAAQ,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAA;AAExB,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AACzB,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;AACrC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;AAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;AACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;AAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AAcnC,MAAM,OAAO,UAAW,SAAQ,QAI/B;IACC,CAAC,QAAQ,CAAC,GAAY,KAAK,CAAC;IAC5B,CAAC,GAAG,CAAC,CAAU;IACf,CAAC,KAAK,CAAC,CAAS;IAChB,CAAC,SAAS,CAAC,CAAS;IACpB,CAAC,QAAQ,CAAC,GAAY,KAAK,CAAC;IAC5B,CAAC,KAAK,CAAC,CAAS;IAChB,CAAC,OAAO,CAAC,CAAS;IAClB,CAAC,UAAU,CAAC,CAAS;IAErB,YAAY,IAAY,EAAE,GAAsB;QAC9C,GAAG,GAAG,GAAG,IAAI,EAAE,CAAA;QACf,KAAK,CAAC,GAAG,CAAC,CAAA;QAEV,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACpB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;QAErB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAA;QAC9C,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAA;QACtB,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QAC3D,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;QAClB,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;QAClD,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAA;QACtB,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAA;QAChE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;QAC3B,IAAI,CAAC,UAAU,CAAC;YACd,OAAO,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA;QAE3D,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;YAClC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;QACf,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;QACf,CAAC;IACH,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;IAClB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;IAED,YAAY;IACZ,KAAK;QACH,MAAM,IAAI,SAAS,CAAC,2BAA2B,CAAC,CAAA;IAClD,CAAC;IAED,YAAY;IACZ,GAAG;QACD,MAAM,IAAI,SAAS,CAAC,2BAA2B,CAAC,CAAA;IAClD,CAAC;IAED,CAAC,KAAK,CAAC;QACL,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,CAAC,OAAO,CAAC,CAAC,EAAiC,EAAE,EAAW;QACtD,IAAI,EAAE,EAAE,CAAC;YACP,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAA;QACpB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;YACd,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAY,CAAC,CAAA;YAC/B,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;QACf,CAAC;IACH,CAAC;IAED,CAAC,QAAQ,CAAC;QACR,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACrE,CAAC;IAED,CAAC,KAAK,CAAC;QACL,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;YACrB,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAA;YAC5B,qBAAqB;YACrB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACrB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;YAC5D,CAAC;YACD,oBAAoB;YACpB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAW,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CACnE,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CACzB,CAAA;QACH,CAAC;IACH,CAAC;IAED,CAAC,OAAO,CAAC,CAAC,EAAiC,EAAE,EAAW,EAAE,GAAY;QACpE,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAA;QACtB,IAAI,EAAE,EAAE,CAAC;YACP,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAA;QACpB,CAAC;aAAM,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,EAAY,EAAE,GAAa,CAAC,EAAE,CAAC;YAC3D,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;QACf,CAAC;IACH,CAAC;IAED,CAAC,MAAM,CAAC;QACN,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;YACpB,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA;YACrB,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAChB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CACjD,CAAA;QACH,CAAC;IACH,CAAC;IAED,CAAC,QAAQ,CAAC,CAAC,EAAyB;QAClC,IAAI,CAACLine truncated
@@ -0,0 +1,186 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'method-signature-style',
meta: {
type: 'suggestion',
docs: {
description: 'Enforce using a particular method signature syntax',
},
fixable: 'code',
messages: {
errorMethod: 'Shorthand method signature is forbidden. Use a function property instead.',
errorProperty: 'Function property signature is forbidden. Use a method shorthand instead.',
},
schema: [
{
type: 'string',
description: 'The method signature style to enforce using.',
enum: ['property', 'method'],
},
],
},
defaultOptions: ['property'],
create(context, [mode]) {
function getMethodKey(node) {
let key = context.sourceCode.getText(node.key);
if (node.computed) {
key = `[${key}]`;
}
if (node.optional) {
key = `${key}?`;
}
if (node.readonly) {
key = `readonly ${key}`;
}
return key;
}
function getMethodParams(node) {
let params = '()';
if (node.params.length > 0) {
const openingParen = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(node.params[0], util_1.isOpeningParenToken), 'Missing opening paren before first parameter');
const closingParen = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(node.params[node.params.length - 1], util_1.isClosingParenToken), 'Missing closing paren after last parameter');
params = context.sourceCode.text.substring(openingParen.range[0], closingParen.range[1]);
}
if (node.typeParameters != null) {
const typeParams = context.sourceCode.getText(node.typeParameters);
params = `${typeParams}${params}`;
}
return params;
}
function getMethodReturnType(node) {
return node.returnType == null
? // if the method has no return type, it implicitly has an `any` return type
// we just make it explicit here so we can do the fix
'any'
: context.sourceCode.getText(node.returnType.typeAnnotation);
}
function getDelimiter(node) {
const lastToken = context.sourceCode.getLastToken(node);
if (lastToken &&
((0, util_1.isSemicolonToken)(lastToken) || (0, util_1.isCommaToken)(lastToken))) {
return lastToken.value;
}
return '';
}
function isNodeParentModuleDeclaration(node) {
if (!node.parent) {
return false;
}
if (node.parent.type === utils_1.AST_NODE_TYPES.TSModuleDeclaration) {
return true;
}
if (node.parent.type === utils_1.AST_NODE_TYPES.Program) {
return false;
}
return isNodeParentModuleDeclaration(node.parent);
}
return {
...(mode === 'property' && {
TSMethodSignature(methodNode) {
if (methodNode.kind !== 'method') {
return;
}
const skipFix = returnTypeReferencesThisType(methodNode.returnType);
const parent = methodNode.parent;
const members = parent.type === utils_1.AST_NODE_TYPES.TSInterfaceBody
? parent.body
: parent.members;
const duplicatedKeyMethodNodes = members.filter((element) => element.type === utils_1.AST_NODE_TYPES.TSMethodSignature &&
element !== methodNode &&
getMethodKey(element) === getMethodKey(methodNode));
const isParentModule = isNodeParentModuleDeclaration(methodNode);
if (duplicatedKeyMethodNodes.length > 0) {
if (isParentModule) {
context.report({
node: methodNode,
messageId: 'errorMethod',
});
}
else {
context.report({
node: methodNode,
messageId: 'errorMethod',
fix: skipFix
? undefined
: function* fix(fixer) {
const methodNodes = [
methodNode,
...duplicatedKeyMethodNodes,
].sort((a, b) => (a.range[0] < b.range[0] ? -1 : 1));
const typeString = methodNodes
.map(node => {
const params = getMethodParams(node);
const returnType = getMethodReturnType(node);
return `(${params} => ${returnType})`;
})
.join(' & ');
const key = getMethodKey(methodNode);
const delimiter = getDelimiter(methodNode);
yield fixer.replaceText(methodNode, `${key}: ${typeString}${delimiter}`);
for (const node of duplicatedKeyMethodNodes) {
const lastToken = context.sourceCode.getLastToken(node);
if (lastToken) {
const nextToken = context.sourceCode.getTokenAfter(lastToken);
if (nextToken) {
yield fixer.remove(node);
yield fixer.replaceTextRange([lastToken.range[1], nextToken.range[0]], '');
}
}
}
},
});
}
return;
}
if (isParentModule) {
context.report({
node: methodNode,
messageId: 'errorMethod',
});
}
else {
context.report({
node: methodNode,
messageId: 'errorMethod',
fix: skipFix
? undefined
: fixer => {
const key = getMethodKey(methodNode);
const params = getMethodParams(methodNode);
const returnType = getMethodReturnType(methodNode);
const delimiter = getDelimiter(methodNode);
return fixer.replaceText(methodNode, `${key}: ${params} => ${returnType}${delimiter}`);
},
});
}
},
}),
...(mode === 'method' && {
TSPropertySignature(propertyNode) {
const typeNode = propertyNode.typeAnnotation?.typeAnnotation;
if (typeNode?.type !== utils_1.AST_NODE_TYPES.TSFunctionType) {
return;
}
context.report({
node: propertyNode,
messageId: 'errorProperty',
fix: fixer => {
const key = getMethodKey(propertyNode);
const params = getMethodParams(typeNode);
const returnType = getMethodReturnType(typeNode);
const delimiter = getDelimiter(propertyNode);
return fixer.replaceText(propertyNode, `${key}${params}: ${returnType}${delimiter}`);
},
});
},
}),
};
},
});
function returnTypeReferencesThisType(node) {
return (node &&
(0, util_1.forEachChildESTree)(node.typeAnnotation, child => child.type === utils_1.AST_NODE_TYPES.TSThisType));
}
@@ -0,0 +1,746 @@
flf2a$ 7 6 100 15 31 1
Jerusalem by Gedaliah Friedenberg - based on Standard by G. Chappell & Ian Chai
Questions and comments regarding jerusalem.flf to gfrieden@nyx.cs.du.edu
Modified for figlet 2.1 by Glenn Chappell 16 Dec 1993
Date: 13 Feb 1994
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
7 - height of a character
6 - height of a character, not including descenders
100 - max line length (excluding comment lines) + a fudge factor
15 - default smushmode for this font
31 - number of comment lines
1 - print right-to-left (figlet 2.1 or later only)
Hebrew keyboard maps:
All capital letters print the english character for that key. All numbers
and symbols are the same in in Hebrew/English except for those shown here.
The * symbol prints as a Jewish star (Star of David).
While in figlet, type ~ on a line by itself to see this list:
aleph = t | zayin = z | lamed = k | ayin = g | shin/sin = a
bet/vet = c | chet = j | mem = n | pey/fey = p | taf/saf = ,
gimmel = d | tet = y | final " = o | final " = ; | ,(comma) = '
daled = s | yud = h | nun = b | tzaadi = m | .(period) = /
hay = v | kaf/chaf = f | final " = i | final " = . | ; = `
vav = u | final " = l | samekh = x | kuf = e | / = q
The asterisk (*) is a Star of David | resh = r | '(apost.) = w
$@
$@
$@
$@
$@
$@
$@@
@
_ @
| |@
| |@
|_|@
(_)@
@@
@
_ _ @
( | )@
V V @
$ @
$ @
@@
@
_ _ @
_| || |_ @
|_ .. _|@
|_ _|@
|_||_| @
@@
@
_ @
| | @
/ __)@
\__ \@
( /@
|_| @@
@
_ __@
(_)/ /@
/ / @
/ /_ @
/_/(_)@
@@
@
___ @
( _ ) @
/ _ \/\@
| (_> <@
\___/\/@
@@
@
@
@
@
_ @
( )@
|/ @@
@
__@
/ /@
| | @
| | @
| | @
\_\@@
@
__ @
\ \ @
| |@
| |@
| |@
/_/ @@
@
@
__/\__@
\ /@
/_ _\@
\/ @
@@
@
@
_ @
_| |_ @
|_ _|@
|_| @
@@
@
______ @
| __ |@
| | | |@
_| | | |@
|___| |_|@
@@
@
@
@
_____ @
|_____|@
$ @
@@
@
__ _ @
|. | | |@
| | // @
| |// @
| | @
|_| @@
@
@
@
@
_ @
(_)@
@@
@
___ @
/ _ \ @
| | | |@
| |_| |@
\___/ @
@@
@
_ @
/ |@
| |@
| |@
|_|@
@@
@
____ @
|___ \ @
__) |@
/ __/ @
|_____|@
@@
@
_____ @
|___ / @
|_ \ @
___) |@
|____/ @
@@
@
_ _ @
| || | @
| || |_ @
|__ _|@
|_| @
@@
@
____ @
| ___| @
|___ \ @
___) |@
|____/ @
@@
@
__ @
/ /_ @
| '_ \ @
| (_) |@
\___/ @
@@
@
_____ @
|___ |@
/ / @
/ / @
/_/ @
@@
@
___ @
( _ ) @
/ _ \ @
| (_) |@
\___/ @
@@
@
___ @
/ _ \ @
| (_) |@
\__, |@
/_/ @
@@
@
@
_ @
(_)@
_ @
(_)@
@@
@
______ @
| __ |@
| |_ | |@
|___|| |@
| |@
|_|@@
@
__@
/ /@
/ / @
\ \ @
\_\@
@@
@
@
_____ @
|_____|@
|_____|@
$ @
@@
@
__ @
\ \ @
\ \@
/ /@
/_/ @
@@
@
___ @
|__ \@
/ /@
|_| @
(_) @
@@
@
____ @
/ __ \ @
/ / _` |@
| | (_| |@
\ \__,_|@
\____/ @@
@
_ @
/ \ @
/ _ \ @
/ ___ \ @
/_/ \_\@
@@
@
____ @
| __ ) @
| _ \ @
| |_) |@
|____/ @
@@
@
____ @
/ ___|@
| | @
| |___ @
\____|@
@@
@
____ @
| _ \ @
| | | |@
| |_| |@
|____/ @
@@
@
_____ @
| ____|@
| _| @
| |___ @
|_____|@
@@
@
_____ @
| ___|@
| |_ @
| _| @
|_| @
@@
@
____ @
/ ___|@
| | _ @
| |_| |@
\____|@
@@
@
_ _ @
| | | |@
| |_| |@
| _ |@
|_| |_|@
@@
@
___ @
|_ _|@
| | @
| | @
|___|@
@@
@
_ @
| |@
_ | |@
| |_| |@
\___/ @
@@
@
_ __@
| |/ /@
| ' / @
| . \ @
|_|\_\@
@@
@
_ @
| | @
| | @
| |___ @
|_____|@
@@
@
__ __ @
| \/ |@
| |\/| |@
| | | |@
|_| |_|@
@@
@
_ _ @
| \ | |@
| \| |@
| |\ |@
|_| \_|@
@@
@
___ @
/ _ \ @
| | | |@
| |_| |@
\___/ @
@@
@
____ @
| _ \ @
| |_) |@
| __/ @
|_| @
@@
@
___ @
/ _ \ @
| | | |@
| |_| |@
\__\_\@
@@
@
____ @
| _ \ @
| |_) |@
| _ < @
|_| \_\@
@@
@
____ @
/ ___| @
\___ \ @
___) |@
|____/ @
@@
@
_____ @
|_ _|@
| | @
| | @
|_| @
@@
@
_ _ @
| | | |@
| | | |@
| |_| |@
\___/ @
@@
@
__ __@
\ \ / /@
\ \ / / @
\ V / @
\_/ @
@@
@
__ __@
\ \ / /@
\ \ /\ / / @
\ V V / @
\_/\_/ @
@@
@
__ __@
\ \/ /@
\ / @
/ \ @
/_/\_\@
@@
@
__ __@
\ \ / /@
\ V / @
| | @
|_| @
@@
@
_____@
|__ /@
/ / @
/ /_ @
/____|@
@@
@
__ @
| _|@
| | @
| | @
| | @
|__|@@
@
__ @
\ \ @
\ \ @
\ \ @
\_\@
@@
@
__ @
|_ |@
| |@
| |@
| |@
|__|@@
@
/\ @
|/\|@
$ @
$ @
$ @
@@
@
@
@
@
@
_____ @
|_____|@@
@
@
_ @
(_)@
_ @
( )@
|/ @@
@
_ _ _ @
| | | | | |@
| | | | | |@
| |/ /_/ / @
|_______/ @
@@
@
___ @
|_ |@
| |@
__| |@
|____|@
@@
@
______ @
|____ | @
| | @
_____| |_@
/________/@
@@
@
____ @
|__ | @
| | @
____| | @
/____/\_\@
@@
@
______ @
|____ |@
_ | |@
| | |_|@
| | @
|_| @@
@
_____ @
|____ \ @
| |@
____| |@
|_____/ @
@@
@
__ _ @
\ \ | |@
\ \| |@
__\ ` |@
|______|@
@@
@
___ @
|_ |@
|_|@
$ @
$ @
@@
@
___ @
|_ |@
| |@
| |@
| |@
|_|@@
@
_______ @
|. __ |@
| | | |@
| | | |@
|_| |_|@
@@
_ @
| |____ @
|____ |@
/ / @
/ / @
/_/ @
@@
@
_______ @
|____ .|@
| | @
| | @
| | @
|_| @@
@
__ __.@
\ \ / / @
\ V / @
___\ \ @
|______| @
@@
@
_______ @
|. __ |@
| | | |@
| | _| |@
|_||___|@
@@
@
________ @
|. ___ |@
| | | |@
| |___| |@
|_______|@
@@
@
_______ @
| ___ |@
\_\ | |@
_____| |@
|_______|@
@@
@
__@
/ /@
/ / @
/ / @
/_/ @
@@
@
______ @
|____ |@
| |@
| |@
|_|@
@@
@
_______ @
|____ |@
| | @
| | @
|_| @
@@
@
__ __@
\ \ / /@
| V / @
| |\ \ @
|_| \_\@
@@
@
___ @
|_ |@
| |@
| |@
|_|@
@@
@
_______ @
|_____ |@
_ | |@
| | | |@
|_| |_|@
@@
@
_ @
( )@
|/ @
$ @
$ @
@@
@
_______ @
|. __ |@
| | | |@
| |__/ |@
|_____/ @
@@
@
__ ___ @
|. | /_ |@
| | | |@
| |___| |@
|_______|@
@@
@
________ @
\__ __\@
| | @
| | @
|_| @
@@
@
__@
/ /@
| | @
< < @
| | @
\_\@@
@
_ @
| |@
| |@
| |@
| |@
|_|@@
@
__ @
\ \ @
| | @
> >@
| | @
/_/ @@
aleph = t | zayin = z | lamed = k | ayin = g | shin/sin = a@
bet/vet = c | chet = j | mem = n | pey/fey = p | taf/saf = ,@
gimmel = d | tet = y | final " = o | final " = ; | ,(comma) = '@
daled = s | yud = h | nun = b | tzaadi = m | .(period) = /@
hay = v | kaf/chaf = f | final " = i | final " = . | ; = `@
vav = u | final " = l | samekh = x | kuf = e | / = q@
The asterisk (*) is a Star of David | resh = r | '(apost.) = w@@
@
_ _ @
(_)_(_)@
/_\ @
/ _ \ @
/_/ \_\@
@@
@
_ _ @
(_)_(_)@
/ _ \ @
| |_| |@
\___/ @
@@
@
_ _ @
(_) (_)@
| | | |@
| |_| |@
\___/ @
@@
@
_ _ @
(_)_(_)@
/ _` |@
| (_| |@
\__,_|@
@@
@
_ _ @
(_)_(_)@
/ _ \ @
| (_) |@
\___/ @
@@
@
_ _ @
(_) (_)@
| | | |@
| |_| |@
\__,_|@
@@
@
___ @
/ _ \@
| |/ /@
| |\ \@
| ||_/@
|_| @@
@@ -0,0 +1,24 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.1.0](https://github.com/es-shims/math-intrinsics/compare/v1.0.0...v1.1.0) - 2024-12-18
### Commits
- [New] add `round` [`7cfb044`](https://github.com/es-shims/math-intrinsics/commit/7cfb04460c0fbdf1ca101eecbac3f59d11994130)
- [Tests] add attw [`e96be8f`](https://github.com/es-shims/math-intrinsics/commit/e96be8fbf58449eafe976446a0470e6ea561ad8d)
- [Dev Deps] update `@types/tape` [`30d0023`](https://github.com/es-shims/math-intrinsics/commit/30d00234ce8a3fa0094a61cd55d6686eb91e36ec)
## v1.0.0 - 2024-12-11
### Commits
- Initial implementation, tests, readme, types [`b898caa`](https://github.com/es-shims/math-intrinsics/commit/b898caae94e9994a94a42b8740f7bbcfd0a868fe)
- Initial commit [`02745b0`](https://github.com/es-shims/math-intrinsics/commit/02745b03a62255af8a332771987b55d127538d9c)
- [New] add `constants/maxArrayLength`, `mod` [`b978178`](https://github.com/es-shims/math-intrinsics/commit/b978178a57685bd23ed1c7efe2137f3784f5fcc5)
- npm init [`a39fc57`](https://github.com/es-shims/math-intrinsics/commit/a39fc57e5639a645d0bd52a0dc56202480223be2)
- Only apps should have lockfiles [`9451580`](https://github.com/es-shims/math-intrinsics/commit/94515800fb34db4f3cc7e99290042d45609ac7bd)
@@ -0,0 +1,461 @@
/**
* SHA3 (keccak) addons.
*
* * cSHAKE, KMAC, TupleHash, ParallelHash + XOF variants from
* {@link https://csrc.nist.gov/pubs/sp/800/185/final | NIST SP 800-185}
* * KangarooTwelve 🦘 and TurboSHAKE - reduced-round keccak from
* {@link https://datatracker.ietf.org/doc/rfc9861/ | RFC 9861}
* * KeccakPRG: Pseudo-random generator based on Keccak
* ({@link https://keccak.team/files/CSF-0.1.pdf | pdf})
* @module
*/
import { Keccak, type ShakeOpts } from './sha3.ts';
import { type CHash, type CHashXOF, type Hash, type HashXOF, type KDFInput, type PRG, type TArg, type TRet } from './utils.ts';
/** Options for cSHAKE and related SP 800-185 functions. */
export type cShakeOpts = ShakeOpts & {
/** Optional personalization string mixed into domain separation. */
personalization?: Uint8Array;
/**
* Optional NIST function-name string used for domain separation.
* SP 800-185 reserves this for standardized function names; applications
* should generally stick to `personalization`.
*/
NISTfn?: KDFInput;
};
/** TupleHash callable interface. */
export type ITupleHash = {
/**
* Hashes an ordered tuple of byte arrays.
* @param messages - Ordered byte-array tuple to hash.
* @param opts - TupleHash output and personalization options. See {@link cShakeOpts}.
* @returns Digest bytes.
*/
(messages: TArg<Uint8Array[]>, opts?: TArg<cShakeOpts>): TRet<Uint8Array>;
/**
* Creates an incremental TupleHash state.
* @param opts - TupleHash output and personalization options. See {@link cShakeOpts}.
* @returns Stateful TupleHash instance.
*/
create(opts?: cShakeOpts): _TupleHash;
};
/**
* 128-bit NIST cSHAKE XOF.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and NIST function-name
* settings. When both `NISTfn` and `personalization` are empty,
* SP 800-185 defines this as plain SHAKE128. Defaults to 16 output bytes
* when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with cSHAKE128.
* ```ts
* cshake128(new Uint8Array([1, 2, 3]), { dkLen: 32 });
* ```
*/
export declare const cshake128: TRet<CHashXOF<Keccak, cShakeOpts>>;
/**
* 256-bit NIST cSHAKE XOF.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and NIST function-name
* settings. When both `NISTfn` and `personalization` are empty,
* SP 800-185 defines this as plain SHAKE256. Defaults to 32 output bytes
* when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with cSHAKE256.
* ```ts
* cshake256(new Uint8Array([1, 2, 3]), { dkLen: 64 });
* ```
*/
export declare const cshake256: TRet<CHashXOF<Keccak, cShakeOpts>>;
/**
* Internal KMAC class.
* SP 800-185 §8.4.1 still recommends keys at least as long as the target
* security strength.
*/
export declare class _KMAC extends Keccak implements HashXOF<_KMAC> {
constructor(blockLen: number, outputLen: number, enableXOF: boolean, key: TArg<Uint8Array>, opts?: TArg<cShakeOpts>);
protected finish(): void;
_cloneInto(to?: _KMAC): _KMAC;
clone(): _KMAC;
}
/** KMAC callable interface. */
export type IKMAC = {
/**
* Computes a keyed KMAC digest for one message.
* @param key - Secret key bytes.
* @param message - Message bytes to authenticate.
* @param opts - KMAC output and personalization options. See {@link KangarooOpts}.
* @returns Authentication tag bytes.
*/
(key: TArg<Uint8Array>, message: TArg<Uint8Array>, opts?: TArg<KangarooOpts>): TRet<Uint8Array>;
/**
* Creates an incremental KMAC state.
* @param key - Secret key bytes.
* @param opts - KMAC output and personalization options. See {@link cShakeOpts}.
* @returns Stateful KMAC instance.
*/
create(key: TArg<Uint8Array>, opts?: TArg<cShakeOpts>): _KMAC;
};
/**
* 128-bit Keccak MAC.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param opts - Optional output and personalization settings. Defaults to
* 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Authentication tag bytes.
* @example
* Authenticate a message with KMAC128.
* ```ts
* kmac128(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]));
* ```
*/
export declare const kmac128: TRet<IKMAC>;
/**
* 256-bit Keccak MAC.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param opts - Optional output and personalization settings. Defaults to
* 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Authentication tag bytes.
* @example
* Authenticate a message with KMAC256.
* ```ts
* kmac256(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]));
* ```
*/
export declare const kmac256: TRet<IKMAC>;
/**
* 128-bit Keccak-MAC XOF.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param opts - Optional output and personalization settings. Defaults to
* 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Authentication tag bytes.
* @example
* Authenticate a message with KMAC128 XOF output.
* ```ts
* kmac128xof(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]), { dkLen: 32 });
* ```
*/
export declare const kmac128xof: TRet<IKMAC>;
/**
* 256-bit Keccak-MAC XOF.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param opts - Optional output and personalization settings. Defaults to
* 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Authentication tag bytes.
* @example
* Authenticate a message with KMAC256 XOF output.
* ```ts
* kmac256xof(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]), { dkLen: 64 });
* ```
*/
export declare const kmac256xof: TRet<IKMAC>;
/**
* Internal TupleHash class for byte-array tuple elements.
* This implementation relies on SP 800-185's byte-oriented encoding form
* rather than arbitrary bit strings.
*/
export declare class _TupleHash extends Keccak implements HashXOF<_TupleHash> {
constructor(blockLen: number, outputLen: number, enableXOF: boolean, opts?: TArg<cShakeOpts>);
protected finish(): void;
_cloneInto(to?: _TupleHash): _TupleHash;
clone(): _TupleHash;
}
/**
* 128-bit TupleHASH. `tuple(['ab', 'cd']) != tuple(['a', 'bcd'])`.
* @param messages - ordered byte-array tuple
* @param opts - Optional output and personalization settings. Defaults to
* 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a tuple of byte arrays with TupleHash128.
* ```ts
* tuplehash128([new Uint8Array([1]), new Uint8Array([2])]);
* ```
*/
export declare const tuplehash128: TRet<ITupleHash>;
/**
* 256-bit TupleHASH. `tuple(['ab', 'cd']) != tuple(['a', 'bcd'])`.
* @param messages - ordered byte-array tuple
* @param opts - Optional output and personalization settings. Defaults to
* 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a tuple of byte arrays with TupleHash256.
* ```ts
* tuplehash256([new Uint8Array([1]), new Uint8Array([2])]);
* ```
*/
export declare const tuplehash256: TRet<ITupleHash>;
/**
* 128-bit TupleHASH XOF.
* @param messages - ordered byte-array tuple
* @param opts - Optional output and personalization settings. Defaults to
* 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a tuple of byte arrays with TupleHash128 XOF output.
* ```ts
* tuplehash128xof([new Uint8Array([1]), new Uint8Array([2])], { dkLen: 32 });
* ```
*/
export declare const tuplehash128xof: TRet<ITupleHash>;
/**
* 256-bit TupleHASH XOF.
* @param messages - ordered byte-array tuple
* @param opts - Optional output and personalization settings. Defaults to
* 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a tuple of byte arrays with TupleHash256 XOF output.
* ```ts
* tuplehash256xof([new Uint8Array([1]), new Uint8Array([2])], { dkLen: 64 });
* ```
*/
export declare const tuplehash256xof: TRet<ITupleHash>;
type ParallelOpts = KangarooOpts & {
blockLen?: number;
};
/** Internal Parallel Keccak Hash class. */
export declare class _ParallelHash extends Keccak implements HashXOF<_ParallelHash> {
private leafHash?;
protected leafCons: () => Hash<Keccak>;
private chunkPos;
private chunksDone;
private chunkLen;
constructor(blockLen: number, outputLen: number, leafCons: () => Hash<Keccak>, enableXOF: boolean, opts?: TArg<ParallelOpts>);
protected finish(): void;
_cloneInto(to?: _ParallelHash): _ParallelHash;
destroy(): void;
clone(): _ParallelHash;
}
/**
* 128-bit ParallelHash. In JS, it is not parallel.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and chunking settings.
* Defaults to 16 output bytes when `dkLen` is omitted.
* See {@link ParallelOpts}.
* @returns Digest bytes.
* @example
* Hash a message with ParallelHash128.
* ```ts
* parallelhash128(new Uint8Array([1, 2, 3]));
* ```
*/
export declare const parallelhash128: TRet<CHash<Keccak, ParallelOpts>>;
/**
* 256-bit ParallelHash. In JS, it is not parallel.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and chunking settings.
* Defaults to 32 output bytes when `dkLen` is omitted.
* See {@link ParallelOpts}.
* @returns Digest bytes.
* @example
* Hash a message with ParallelHash256.
* ```ts
* parallelhash256(new Uint8Array([1, 2, 3]));
* ```
*/
export declare const parallelhash256: TRet<CHash<Keccak, ParallelOpts>>;
/**
* 128-bit ParallelHash XOF. In JS, it is not parallel.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and chunking settings.
* Defaults to 16 output bytes when `dkLen` is omitted.
* See {@link ParallelOpts}.
* @returns Digest bytes.
* @example
* Hash a message with ParallelHash128 XOF output.
* ```ts
* parallelhash128xof(new Uint8Array([1, 2, 3]), { dkLen: 32 });
* ```
*/
export declare const parallelhash128xof: TRet<CHashXOF<Keccak, ParallelOpts>>;
/**
* 256-bit ParallelHash XOF. In JS, it is not parallel.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and chunking settings.
* Defaults to 32 output bytes when `dkLen` is omitted.
* See {@link ParallelOpts}.
* @returns Digest bytes.
* @example
* Hash a message with ParallelHash256 XOF output.
* ```ts
* parallelhash256xof(new Uint8Array([1, 2, 3]), { dkLen: 64 });
* ```
*/
export declare const parallelhash256xof: TRet<CHashXOF<Keccak, ParallelOpts>>;
/**
* TurboSHAKE options.
* `D` is the domain separation byte; RFC 9861 defines output length `L`
* as a positive integer.
*/
export type TurboshakeOpts = ShakeOpts & {
/** Optional domain separation byte in the `0x01..0x7f` range. */
D?: number;
};
/**
* TurboSHAKE 128-bit: reduced 12-round keccak.
* Should've been a simple "shake with 12 rounds", but we got a whole new
* spec about Turbo SHAKE Pro MAX.
* @param msg - message bytes to hash
* @param opts - Optional output-length and domain-separation settings.
* RFC 9861 §2.1 defaults `D` to `0x1f`. Defaults to 32 output bytes when
* `dkLen` is omitted. See {@link TurboshakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with TurboSHAKE128.
* ```ts
* turboshake128(new Uint8Array([1, 2, 3]), { dkLen: 32 });
* ```
*/
export declare const turboshake128: TRet<CHashXOF<Keccak, TurboshakeOpts>>;
/**
* TurboSHAKE 256-bit: reduced 12-round keccak.
* @param msg - message bytes to hash
* @param opts - Optional output-length and domain-separation settings.
* RFC 9861 §2.1 defaults `D` to `0x1f`. Defaults to 64 output bytes when
* `dkLen` is omitted. See {@link TurboshakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with TurboSHAKE256.
* ```ts
* turboshake256(new Uint8Array([1, 2, 3]), { dkLen: 64 });
* ```
*/
export declare const turboshake256: TRet<CHashXOF<Keccak, TurboshakeOpts>>;
/** K12 options. */
export type KangarooOpts = {
/**
* Desired digest length in bytes.
* RFC 9861 §3 defines output length `L` as a positive integer.
*/
dkLen?: number;
/**
* Optional personalization string mixed into the sponge state.
* Stateful K12 instances keep an internal copy so caller buffers can be
* wiped independently.
*/
personalization?: Uint8Array;
};
/** Internal K12 hash class. */
export declare class _KangarooTwelve extends Keccak implements HashXOF<_KangarooTwelve> {
readonly chunkLen = 8192;
private leafHash?;
protected leafLen: number;
private personalization;
private chunkPos;
private chunksDone;
constructor(blockLen: number, leafLen: number, outputLen: number, rounds: number, opts: TArg<KangarooOpts>);
update(data: TArg<Uint8Array>): this;
protected finish(): void;
destroy(): void;
_cloneInto(to?: _KangarooTwelve): _KangarooTwelve;
clone(): _KangarooTwelve;
}
/**
* 128-bit KangarooTwelve (k12): reduced 12-round keccak.
* @param msg - message bytes to hash
* @param opts - Optional output and personalization settings. Defaults to
* 32 output bytes when `dkLen` is omitted. See {@link KangarooOpts}.
* @returns Digest bytes.
* @example
* Hash a message with KangarooTwelve-128.
* ```ts
* kt128(new Uint8Array([1, 2, 3]));
* ```
*/
export declare const kt128: TRet<CHash<_KangarooTwelve, KangarooOpts>>;
/**
* 256-bit KangarooTwelve (k12): reduced 12-round keccak.
* @param msg - message bytes to hash
* @param opts - Optional output and personalization settings. Defaults to
* 64 output bytes when `dkLen` is omitted. See {@link KangarooOpts}.
* @returns Digest bytes.
* @example
* Hash a message with KangarooTwelve-256.
* ```ts
* kt256(new Uint8Array([1, 2, 3]));
* ```
*/
export declare const kt256: TRet<CHash<_KangarooTwelve, KangarooOpts>>;
/** KangarooTwelve-based MAC function type. */
export type HopMAC = (key: TArg<Uint8Array>, message: TArg<Uint8Array>, personalization: TArg<Uint8Array>, dkLen?: number) => TRet<Uint8Array>;
/**
* 128-bit KangarooTwelve-based MAC.
*
* These untested (there is no test vectors or implementation available). Use at your own risk.
* HopMAC128(Key, M, C, L) = KT128(Key, KT128(M, C, 32), L)
* HopMAC256(Key, M, C, L) = KT256(Key, KT256(M, C, 64), L)
* The inner KangarooTwelve call always uses a fixed 32-byte digest here,
* regardless of the outer `dkLen`.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param personalization - personalization bytes mixed into the inner hash
* @param dkLen - optional output length in bytes
* @returns Authentication tag bytes.
* @example
* Authenticate a message with HopMAC128.
* ```ts
* HopMAC128(new Uint8Array([1]), new Uint8Array([2]), new Uint8Array([3]), 32);
* ```
*/
export declare const HopMAC128: TRet<HopMAC>;
/**
* 256-bit KangarooTwelve-based MAC.
* Like `HopMAC128`, there are no test vectors or known independent
* implementations available for cross-checking.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param personalization - personalization bytes mixed into the inner hash
* @param dkLen - optional output length in bytes. The inner KangarooTwelve
* call still uses a fixed 64-byte digest here, regardless of the outer
* `dkLen`.
* @returns Authentication tag bytes.
* @example
* Authenticate a message with HopMAC256.
* ```ts
* HopMAC256(new Uint8Array([1]), new Uint8Array([2]), new Uint8Array([3]), 64);
* ```
*/
export declare const HopMAC256: TRet<HopMAC>;
/**
* More at
* {@link https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG}.
* Accepted capacities must keep `rho = 1598 - capacity` byte-aligned, and
* `.clean()` later also requires `rate > 801`.
*/
export declare class _KeccakPRG extends Keccak implements PRG {
protected rate: number;
constructor(capacity: number);
protected keccak(): void;
update(data: TArg<Uint8Array>): this;
protected finish(): void;
digestInto(_out: TArg<Uint8Array>): void;
addEntropy(seed: TArg<Uint8Array>): void;
randomBytes(length: number): TRet<Uint8Array>;
clean(): void;
_cloneInto(to?: _KeccakPRG): _KeccakPRG;
clone(): _KeccakPRG;
}
/**
* KeccakPRG: pseudo-random generator based on Keccak.
* See {@link https://keccak.team/files/CSF-0.1.pdf}.
* @param capacity - sponge capacity in bits. Accepted values are those that
* keep `rho = 1598 - capacity` byte-aligned; the default `254` is chosen
* because it satisfies that duplex layout while leaving a wide byte-aligned
* rate.
* @returns PRG instance backed by a Keccak sponge.
* @example
* Create a Keccak-based pseudorandom generator and read bytes from it.
* ```ts
* const prg = keccakprg(254);
* prg.randomBytes(8);
* ```
*/
export declare const keccakprg: (capacity?: number) => TRet<_KeccakPRG>;
export {};
//# sourceMappingURL=sha3-addons.d.ts.map
@@ -0,0 +1,15 @@
export type NoInfer<A extends any> = [A][A extends any ? 0 : never];
export type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
export declare function memo<TDeps extends ReadonlyArray<any>, TResult>(getDeps: () => [...TDeps], fn: (...args: NoInfer<[...TDeps]>) => TResult, opts: {
key: false | string;
debug?: () => boolean;
onChange?: (result: TResult) => void;
initialDeps?: TDeps;
skipInitialOnChange?: boolean;
}): {
(): TResult;
updateDeps(newDeps: [...TDeps]): void;
};
export declare function notUndefined<T>(value: T | undefined, msg?: string): T;
export declare const approxEqual: (a: number, b: number) => boolean;
export declare const debounce: (targetWindow: Window & typeof globalThis, fn: Function, ms: number) => (this: any, ...args: Array<any>) => void;
@@ -0,0 +1 @@
{"version":3,"file":"ScrollRestoration.cjs","names":[],"sources":["../../src/ScrollRestoration.tsx"],"sourcesContent":["import {\n getElementScrollRestorationEntry,\n setupScrollRestoration,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport type {\n ParsedLocation,\n ScrollRestorationEntry,\n ScrollRestorationOptions,\n} from '@tanstack/router-core'\n\nfunction useScrollRestoration() {\n const router = useRouter()\n setupScrollRestoration(router, true)\n}\n\n/**\n * @deprecated Use the `scrollRestoration` router option instead.\n */\nexport function ScrollRestoration(_props: ScrollRestorationOptions) {\n useScrollRestoration()\n\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n \"The ScrollRestoration component is deprecated. Use createRouter's `scrollRestoration` option instead.\",\n )\n }\n\n return null\n}\n\nexport function useElementScrollRestoration(\n options: (\n | {\n id: string\n getElement?: () => Window | Element | undefined | null\n }\n | {\n id?: string\n getElement: () => Window | Element | undefined | null\n }\n ) & {\n getKey?: (location: ParsedLocation) => string\n },\n): ScrollRestorationEntry | undefined {\n useScrollRestoration()\n\n return getElementScrollRestorationEntry(useRouter(), options)\n}\n"],"mappings":";;;;AAWA,SAAS,uBAAuB;AAE9B,EAAA,GAAA,sBAAA,wBADe,kBAAA,WAAW,EACK,KAAK;;;;;AAMtC,SAAgB,kBAAkB,QAAkC;AAClE,uBAAsB;AAEtB,KAAA,QAAA,IAAA,aAA6B,cAC3B,SAAQ,KACN,wGACD;AAGH,QAAO;;AAGT,SAAgB,4BACd,SAYoC;AACpC,uBAAsB;AAEtB,SAAA,GAAA,sBAAA,kCAAwC,kBAAA,WAAW,EAAE,QAAQ"}
@@ -0,0 +1,3 @@
This software is made available under the terms of *either* of the licenses
found in LICENSE.APACHE or LICENSE.BSD. Contributions to this software is made
under the terms of *both* these licenses.
@@ -0,0 +1,8 @@
export { c as createManualModuleSource, h as hoistMocks } from './hoistMocks.d-w2ILr1dG.js';
export { automockModule } from './automock.js';
import 'magic-string';
declare function initSyntaxLexers(): Promise<void>;
declare function collectModuleExports(filename: string, code: string, format: "module" | "commonjs", exports?: string[]): string[];
export { collectModuleExports, initSyntaxLexers };
@@ -0,0 +1,23 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Lasso = createLucideIcon("Lasso", [
["path", { d: "M7 22a5 5 0 0 1-2-4", key: "umushi" }],
[
"path",
{
d: "M3.3 14A6.8 6.8 0 0 1 2 10c0-4.4 4.5-8 10-8s10 3.6 10 8-4.5 8-10 8a12 12 0 0 1-5-1",
key: "146dds"
}
],
["path", { d: "M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z", key: "bq3ynw" }]
]);
export { Lasso as default };
//# sourceMappingURL=lasso.js.map
@@ -0,0 +1,297 @@
import { existsSync, promises } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { mergeProcessCovs } from '@bcoe/v8-coverage';
import astV8ToIstanbul from 'ast-v8-to-istanbul';
import libCoverage from 'istanbul-lib-coverage';
import libReport from 'istanbul-lib-report';
import reports from 'istanbul-reports';
import { parseModule } from 'magicast';
import { createDebug } from 'obug';
import { provider } from 'std-env';
import c from 'tinyrainbow';
import { BaseCoverageProvider, parseAstAsync } from 'vitest/node';
import { n as normalize } from './pathe.M-eThtNZ-BTaAGrLg.js';
var version = "4.1.12";
const FILE_PROTOCOL = "file://";
const debug = createDebug("vitest:coverage");
class V8CoverageProvider extends BaseCoverageProvider {
name = "v8";
version = version;
initialize(ctx) {
this._initialize(ctx);
}
createCoverageMap() {
return libCoverage.createCoverageMap({});
}
async generateCoverage({ allTestsRun }) {
const start = debug.enabled ? performance.now() : 0;
const coverageMap = this.createCoverageMap();
let merged = { result: [] };
await this.readCoverageFiles({
onFileRead(coverage) {
merged = mergeProcessCovs([merged, coverage]);
// mergeProcessCovs sometimes loses startOffset, e.g. in vue
merged.result.forEach((result) => {
if (!result.startOffset) {
const original = coverage.result.find((r) => r.url === result.url);
result.startOffset = original?.startOffset || 0;
}
});
},
onFinished: async (project, environment) => {
// Source maps can change based on projectName and transform mode.
// Coverage transform re-uses source maps so we need to separate transforms from each other.
const converted = await this.convertCoverage(merged, project, environment);
coverageMap.merge(converted);
merged = { result: [] };
},
onDebug: debug
});
// Include untested files when all tests were run (not a single file re-run)
// or if previous results are preserved by "cleanOnRerun: false"
if (this.options.include != null && (allTestsRun || !this.options.cleanOnRerun)) {
const coveredFiles = coverageMap.files();
const untestedCoverage = await this.getCoverageMapForUncoveredFiles(coveredFiles);
coverageMap.merge(untestedCoverage);
}
coverageMap.filter((filename) => {
const exists = existsSync(filename);
if (this.options.excludeAfterRemap) {
return exists && this.isIncluded(filename);
}
return exists;
});
if (debug.enabled) {
debug(`Generate coverage total time ${(performance.now() - start).toFixed()} ms`);
}
return coverageMap;
}
async generateReports(coverageMap, allTestsRun) {
if (provider === "stackblitz") {
this.ctx.logger.log(c.blue(" % ") + c.yellow("@vitest/coverage-v8 does not work on Stackblitz. Report will be empty."));
}
const context = libReport.createContext({
dir: this.options.reportsDirectory,
coverageMap,
watermarks: this.options.watermarks
});
if (this.hasTerminalReporter(this.options.reporter)) {
this.ctx.logger.log(c.blue(" % ") + c.dim("Coverage report from ") + c.yellow(this.name));
}
for (const reporter of this.options.reporter) {
// Type assertion required for custom reporters
reports.create(reporter[0], {
skipFull: this.options.skipFull,
projectRoot: this.ctx.config.root,
...reporter[1]
}).execute(context);
}
if (this.options.thresholds) {
await this.reportThresholds(coverageMap, allTestsRun);
}
}
async parseConfigModule(configFilePath) {
const contents = await promises.readFile(configFilePath, "utf8");
return parseModule(`${contents}${this.autoUpdateMarker}`);
}
async getCoverageMapForUncoveredFiles(testedFiles) {
const transform = this.createUncoveredFileTransformer(this.ctx);
const uncoveredFiles = await this.getUntestedFiles(testedFiles);
let index = 0;
const coverageMap = this.createCoverageMap();
for (const chunk of this.toSlices(uncoveredFiles, this.options.processingConcurrency)) {
if (debug.enabled) {
index += chunk.length;
debug("Uncovered files %d/%d", index, uncoveredFiles.length);
}
await Promise.all(chunk.map(async (filename) => {
let timeout;
let start;
if (debug.enabled) {
start = performance.now();
timeout = setTimeout(() => debug(c.bgRed(`File "${filename}" is taking longer than 3s`)), 3e3);
}
// Do not use pathToFileURL to avoid encoding filename parts
const url = `file://${filename[0] === "/" ? "" : "/"}${filename}`;
const sources = await this.getSources(url, transform);
coverageMap.merge(await this.remapCoverage(url, 0, sources, []));
if (debug.enabled) {
clearTimeout(timeout);
const diff = performance.now() - start;
const color = diff > 500 ? c.bgRed : c.bgGreen;
debug(`${color(` ${diff.toFixed()} ms `)} ${filename}`);
}
}));
}
return coverageMap;
}
async remapCoverage(filename, wrapperLength, result, functions) {
let ast;
try {
ast = await parseAstAsync(result.code);
} catch (error) {
this.ctx.logger.error(`Failed to parse ${filename}. Excluding it from coverage.\n`, error);
return {};
}
return await astV8ToIstanbul({
code: result.code,
sourceMap: result.map,
ast,
coverage: {
functions,
url: filename
},
ignoreClassMethods: this.options.ignoreClassMethods,
wrapperLength,
ignoreNode: (node, type) => {
// SSR transformed imports
if (type === "statement" && node.type === "VariableDeclarator" && node.id.type === "Identifier" && node.id.name.startsWith("__vite_ssr_import_")) {
return true;
}
// SSR transformed exports vite@>6.3.5
if (type === "statement" && node.type === "ExpressionStatement" && node.expression.type === "AssignmentExpression" && node.expression.left.type === "MemberExpression" && node.expression.left.object.type === "Identifier" && node.expression.left.object.name === "__vite_ssr_exports__") {
return true;
}
// SSR transformed exports vite@^6.3.5
if (type === "statement" && node.type === "VariableDeclarator" && node.id.type === "Identifier" && node.id.name === "__vite_ssr_export_default__") {
return true;
}
// CJS imports as ternaries - e.g.
// const React = __vite__cjsImport0_react.__esModule ? __vite__cjsImport0_react.default : __vite__cjsImport0_react;
if (type === "branch" && node.type === "ConditionalExpression" && node.test.type === "MemberExpression" && node.test.object.type === "Identifier" && node.test.object.name.startsWith("__vite__cjsImport") && node.test.property.type === "Identifier" && node.test.property.name === "__esModule") {
return true;
}
// in-source test with "if (import.meta.vitest)"
if ((type === "branch" || type === "statement") && node.type === "IfStatement" && node.test.type === "MemberExpression" && node.test.property.type === "Identifier" && node.test.property.name === "vitest") {
// SSR
if (node.test.object.type === "Identifier" && node.test.object.name === "__vite_ssr_import_meta__") {
return "ignore-this-and-nested-nodes";
}
// Web
if (node.test.object.type === "MetaProperty" && node.test.object.meta.name === "import" && node.test.object.property.name === "meta") {
return "ignore-this-and-nested-nodes";
}
}
// Browser mode's "import.meta.env ="
if (type === "statement" && node.type === "ExpressionStatement" && node.expression.type === "AssignmentExpression" && node.expression.left.type === "MemberExpression" && node.expression.left.object.type === "MetaProperty" && node.expression.left.object.meta.name === "import" && node.expression.left.object.property.name === "meta" && node.expression.left.property.type === "Identifier" && node.expression.left.property.name === "env") {
return true;
}
// SSR mode's "import.meta.env ="
if (type === "statement" && node.type === "ExpressionStatement" && node.expression.type === "AssignmentExpression" && node.expression.left.type === "MemberExpression" && node.expression.left.object.type === "Identifier" && node.expression.left.object.name === "__vite_ssr_import_meta__") {
return true;
}
// SWC's decorators
if (type === "statement" && node.type === "ExpressionStatement" && node.expression.type === "CallExpression" && node.expression.callee.type === "Identifier" && node.expression.callee.name === "_ts_decorate") {
return "ignore-this-and-nested-nodes";
}
}
});
}
async getSources(url, onTransform, functions = []) {
// TODO: need to standardize file urls before this call somehow, this is messy
const filepath = url.match(/^file:\/\/\/\w:\//) ? url.slice(8) : removeStartsWith(url, FILE_PROTOCOL);
// TODO: do we still need to "catch" here? why would it fail?
const transformResult = await onTransform(filepath).catch(() => null);
const map = transformResult?.map;
const code = transformResult?.code;
if (code == null) {
const filePath = normalize(fileURLToPath(url));
const original = await promises.readFile(filePath, "utf-8").catch(() => {
// If file does not exist construct a dummy source for it.
// These can be files that were generated dynamically during the test run and were removed after it.
const length = findLongestFunctionLength(functions);
return "/".repeat(length);
});
return { code: original };
}
// Vue needs special handling for "map.sources"
if (map) {
map.sources ||= [];
map.sources = map.sources.filter((source) => source != null).map((source) => new URL(source, url).href);
if (map.sources.length === 0) {
map.sources.push(url);
}
}
return {
code,
map
};
}
async convertCoverage(coverage, project = this.ctx.getRootProject(), environment) {
if (environment === "__browser__" && !project.browser) {
throw new Error(`Cannot access browser module graph because it was torn down.`);
}
const onTransform = async (filepath) => {
const result = await this.transformFile(filepath, project, environment);
if (result && environment === "__browser__" && project.browser) {
return {
...result,
code: `${result.code}// <inline-source-map>`
};
}
return result;
};
const scriptCoverages = [];
for (const result of coverage.result) {
if (environment === "__browser__") {
if (result.url.startsWith("/@fs")) {
result.url = `${FILE_PROTOCOL}${removeStartsWith(result.url, "/@fs")}`;
} else if (result.url.startsWith(project.config.root)) {
result.url = `${FILE_PROTOCOL}${result.url}`;
} else {
result.url = `${FILE_PROTOCOL}${project.config.root}${result.url}`;
}
}
if (this.isIncluded(fileURLToPath(result.url))) {
scriptCoverages.push({
...result,
url: decodeURIComponent(result.url)
});
}
}
const coverageMap = this.createCoverageMap();
let index = 0;
for (const chunk of this.toSlices(scriptCoverages, this.options.processingConcurrency)) {
if (debug.enabled) {
index += chunk.length;
debug("Converting %d/%d", index, scriptCoverages.length);
}
await Promise.all(chunk.map(async ({ url, functions, startOffset }) => {
let timeout;
let start;
if (debug.enabled) {
start = performance.now();
timeout = setTimeout(() => debug(c.bgRed(`File "${fileURLToPath(url)}" is taking longer than 3s`)), 3e3);
}
const sources = await this.getSources(url, onTransform, functions);
coverageMap.merge(await this.remapCoverage(url, startOffset, sources, functions));
if (debug.enabled) {
clearTimeout(timeout);
const diff = performance.now() - start;
const color = diff > 500 ? c.bgRed : c.bgGreen;
debug(`${color(` ${diff.toFixed()} ms `)} ${fileURLToPath(url)}`);
}
}));
}
return coverageMap;
}
}
/**
* Find the function with highest `endOffset` to determine the length of the file
*/
function findLongestFunctionLength(functions) {
return functions.reduce((previous, current) => {
const maxEndOffset = current.ranges.reduce((endOffset, range) => Math.max(endOffset, range.endOffset), 0);
return Math.max(previous, maxEndOffset);
}, 0);
}
function removeStartsWith(filepath, start) {
if (filepath.startsWith(start)) {
return filepath.slice(start.length);
}
return filepath;
}
export { V8CoverageProvider };
@@ -0,0 +1,155 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _types = require('../parser/tokenizer/types');
var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer);
/**
* Transformer supporting the optional chaining and nullish coalescing operators.
*
* Tech plan here:
* https://github.com/alangpierce/sucrase/wiki/Sucrase-Optional-Chaining-and-Nullish-Coalescing-Technical-Plan
*
* The prefix and suffix code snippets are handled by TokenProcessor, and this transformer handles
* the operators themselves.
*/
class OptionalChainingNullishTransformer extends _Transformer2.default {
constructor( tokens, nameManager) {
super();this.tokens = tokens;this.nameManager = nameManager;;
}
process() {
if (this.tokens.matches1(_types.TokenType.nullishCoalescing)) {
const token = this.tokens.currentToken();
if (this.tokens.tokens[token.nullishStartIndex].isAsyncOperation) {
this.tokens.replaceTokenTrimmingLeftWhitespace(", async () => (");
} else {
this.tokens.replaceTokenTrimmingLeftWhitespace(", () => (");
}
return true;
}
if (this.tokens.matches1(_types.TokenType._delete)) {
const nextToken = this.tokens.tokenAtRelativeIndex(1);
if (nextToken.isOptionalChainStart) {
this.tokens.removeInitialToken();
return true;
}
}
const token = this.tokens.currentToken();
const chainStart = token.subscriptStartIndex;
if (
chainStart != null &&
this.tokens.tokens[chainStart].isOptionalChainStart &&
// Super subscripts can't be optional (since super is never null/undefined), and the syntax
// relies on the subscript being intact, so leave this token alone.
this.tokens.tokenAtRelativeIndex(-1).type !== _types.TokenType._super
) {
const param = this.nameManager.claimFreeName("_");
let arrowStartSnippet;
if (
chainStart > 0 &&
this.tokens.matches1AtIndex(chainStart - 1, _types.TokenType._delete) &&
this.isLastSubscriptInChain()
) {
// Delete operations are special: we already removed the delete keyword, and to still
// perform a delete, we need to insert a delete in the very last part of the chain, which
// in correct code will always be a property access.
arrowStartSnippet = `${param} => delete ${param}`;
} else {
arrowStartSnippet = `${param} => ${param}`;
}
if (this.tokens.tokens[chainStart].isAsyncOperation) {
arrowStartSnippet = `async ${arrowStartSnippet}`;
}
if (
this.tokens.matches2(_types.TokenType.questionDot, _types.TokenType.parenL) ||
this.tokens.matches2(_types.TokenType.questionDot, _types.TokenType.lessThan)
) {
if (this.justSkippedSuper()) {
this.tokens.appendCode(".bind(this)");
}
this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${arrowStartSnippet}`);
} else if (this.tokens.matches2(_types.TokenType.questionDot, _types.TokenType.bracketL)) {
this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${arrowStartSnippet}`);
} else if (this.tokens.matches1(_types.TokenType.questionDot)) {
this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${arrowStartSnippet}.`);
} else if (this.tokens.matches1(_types.TokenType.dot)) {
this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${arrowStartSnippet}.`);
} else if (this.tokens.matches1(_types.TokenType.bracketL)) {
this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${arrowStartSnippet}[`);
} else if (this.tokens.matches1(_types.TokenType.parenL)) {
if (this.justSkippedSuper()) {
this.tokens.appendCode(".bind(this)");
}
this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${arrowStartSnippet}(`);
} else {
throw new Error("Unexpected subscript operator in optional chain.");
}
return true;
}
return false;
}
/**
* Determine if the current token is the last of its chain, so that we know whether it's eligible
* to have a delete op inserted.
*
* We can do this by walking forward until we determine one way or another. Each
* isOptionalChainStart token must be paired with exactly one isOptionalChainEnd token after it in
* a nesting way, so we can track depth and walk to the end of the chain (the point where the
* depth goes negative) and see if any other subscript token is after us in the chain.
*/
isLastSubscriptInChain() {
let depth = 0;
for (let i = this.tokens.currentIndex() + 1; ; i++) {
if (i >= this.tokens.tokens.length) {
throw new Error("Reached the end of the code while finding the end of the access chain.");
}
if (this.tokens.tokens[i].isOptionalChainStart) {
depth++;
} else if (this.tokens.tokens[i].isOptionalChainEnd) {
depth--;
}
if (depth < 0) {
return true;
}
// This subscript token is a later one in the same chain.
if (depth === 0 && this.tokens.tokens[i].subscriptStartIndex != null) {
return false;
}
}
}
/**
* Determine if we are the open-paren in an expression like super.a()?.b.
*
* We can do this by walking backward to find the previous subscript. If that subscript was
* preceded by a super, then we must be the subscript after it, so if this is a call expression,
* we'll need to attach the right context.
*/
justSkippedSuper() {
let depth = 0;
let index = this.tokens.currentIndex() - 1;
while (true) {
if (index < 0) {
throw new Error(
"Reached the start of the code while finding the start of the access chain.",
);
}
if (this.tokens.tokens[index].isOptionalChainStart) {
depth--;
} else if (this.tokens.tokens[index].isOptionalChainEnd) {
depth++;
}
if (depth < 0) {
return false;
}
// This subscript token is a later one in the same chain.
if (depth === 0 && this.tokens.tokens[index].subscriptStartIndex != null) {
return this.tokens.tokens[index - 1].type === _types.TokenType._super;
}
index--;
}
}
} exports.default = OptionalChainingNullishTransformer;
@@ -0,0 +1,25 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Ruler = createLucideIcon("Ruler", [
[
"path",
{
d: "M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",
key: "icamh8"
}
],
["path", { d: "m14.5 12.5 2-2", key: "inckbg" }],
["path", { d: "m11.5 9.5 2-2", key: "fmmyf7" }],
["path", { d: "m8.5 6.5 2-2", key: "vc6u1g" }],
["path", { d: "m17.5 15.5 2-2", key: "wo5hmg" }]
]);
export { Ruler as default };
//# sourceMappingURL=ruler.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_2D","2":"C"},C:{"1":"_8R","2":"_WS"},D:{"1":"_6J","2":"_aD"},E:{"1":"_PD","2":"_CI"},F:{"1":"_nO","2":"_SK"},G:{"1":"_kG","2":"_AI"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:2,C:"CSS unset value",D:true};
@@ -0,0 +1,131 @@
'use strict'
/**
* @see https://developer.mozilla.org/docs/Web/HTTP/Headers
*/
const wellknownHeaderNames = /** @type {const} */ ([
'Accept',
'Accept-Encoding',
'Accept-Language',
'Accept-Ranges',
'Access-Control-Allow-Credentials',
'Access-Control-Allow-Headers',
'Access-Control-Allow-Methods',
'Access-Control-Allow-Origin',
'Access-Control-Expose-Headers',
'Access-Control-Max-Age',
'Access-Control-Request-Headers',
'Access-Control-Request-Method',
'Age',
'Allow',
'Alt-Svc',
'Alt-Used',
'Authorization',
'Cache-Control',
'Clear-Site-Data',
'Connection',
'Content-Disposition',
'Content-Encoding',
'Content-Language',
'Content-Length',
'Content-Location',
'Content-Range',
'Content-Security-Policy',
'Content-Security-Policy-Report-Only',
'Content-Type',
'Cookie',
'Cross-Origin-Embedder-Policy',
'Cross-Origin-Opener-Policy',
'Cross-Origin-Resource-Policy',
'Date',
'Device-Memory',
'Downlink',
'ECT',
'ETag',
'Expect',
'Expect-CT',
'Expires',
'Forwarded',
'From',
'Host',
'If-Match',
'If-Modified-Since',
'If-None-Match',
'If-Range',
'If-Unmodified-Since',
'Keep-Alive',
'Last-Modified',
'Link',
'Location',
'Max-Forwards',
'Origin',
'Permissions-Policy',
'Pragma',
'Proxy-Authenticate',
'Proxy-Authorization',
'RTT',
'Range',
'Referer',
'Referrer-Policy',
'Refresh',
'Retry-After',
'Sec-WebSocket-Accept',
'Sec-WebSocket-Extensions',
'Sec-WebSocket-Key',
'Sec-WebSocket-Protocol',
'Sec-WebSocket-Version',
'Server',
'Server-Timing',
'Service-Worker-Allowed',
'Service-Worker-Navigation-Preload',
'Set-Cookie',
'SourceMap',
'Strict-Transport-Security',
'Supports-Loading-Mode',
'TE',
'Timing-Allow-Origin',
'Trailer',
'Transfer-Encoding',
'Upgrade',
'Upgrade-Insecure-Requests',
'User-Agent',
'Vary',
'Via',
'WWW-Authenticate',
'X-Content-Type-Options',
'X-DNS-Prefetch-Control',
'X-Frame-Options',
'X-Permitted-Cross-Domain-Policies',
'X-Powered-By',
'X-Requested-With',
'X-XSS-Protection'
])
/** @type {Record<typeof wellknownHeaderNames[number]|Lowercase<typeof wellknownHeaderNames[number]>, string>} */
const headerNameLowerCasedRecord = {}
// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
Object.setPrototypeOf(headerNameLowerCasedRecord, null)
for (let i = 0; i < wellknownHeaderNames.length; ++i) {
const key = wellknownHeaderNames[i]
const lowerCasedKey = key.toLowerCase()
headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] =
lowerCasedKey
}
/**
* Default WebSocket receive limits (see `webSocket` in Client.md). Used by
* DispatcherBase#webSocketOptions and by the WebSocket parser when the
* dispatcher doesn't provide a value, so a dispatcher without
* `webSocketOptions` (a custom one, or a wrapper) doesn't remove the limits.
*/
const defaultWebSocketMaxFragments = 131072
const defaultWebSocketMaxPayloadSize = 128 * 1024 * 1024 // 128 MB
module.exports = {
wellknownHeaderNames,
headerNameLowerCasedRecord,
defaultWebSocketMaxFragments,
defaultWebSocketMaxPayloadSize
}
@@ -0,0 +1,23 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Cake = createLucideIcon("Cake", [
["path", { d: "M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8", key: "1w3rig" }],
["path", { d: "M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1", key: "n2jgmb" }],
["path", { d: "M2 21h20", key: "1nyx9w" }],
["path", { d: "M7 8v3", key: "1qtyvj" }],
["path", { d: "M12 8v3", key: "hwp4zt" }],
["path", { d: "M17 8v3", key: "1i6e5u" }],
["path", { d: "M7 4h.01", key: "1bh4kh" }],
["path", { d: "M12 4h.01", key: "1ujb9j" }],
["path", { d: "M17 4h.01", key: "1upcoc" }]
]);
export { Cake as default };
//# sourceMappingURL=cake.js.map
@@ -0,0 +1,25 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const TableColumnsSplit = createLucideIcon("TableColumnsSplit", [
["path", { d: "M14 14v2", key: "w2a1xv" }],
["path", { d: "M14 20v2", key: "1lq872" }],
["path", { d: "M14 2v2", key: "6buw04" }],
["path", { d: "M14 8v2", key: "i67w9a" }],
["path", { d: "M2 15h8", key: "82wtch" }],
["path", { d: "M2 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2", key: "up0l64" }],
["path", { d: "M2 9h8", key: "yelfik" }],
["path", { d: "M22 15h-4", key: "1es58f" }],
["path", { d: "M22 3h-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h2", key: "pdjoqf" }],
["path", { d: "M22 9h-4", key: "1luja7" }],
["path", { d: "M5 3v18", key: "14hmio" }]
]);
export { TableColumnsSplit as default };
//# sourceMappingURL=table-columns-split.js.map
@@ -0,0 +1,70 @@
{
"name": "eslint-visitor-keys",
"version": "4.2.1",
"description": "Constants and utilities about visitor keys to traverse AST.",
"type": "module",
"main": "dist/eslint-visitor-keys.cjs",
"types": "./dist/index.d.ts",
"exports": {
".": [
{
"import": "./lib/index.js",
"require": "./dist/eslint-visitor-keys.cjs"
},
"./dist/eslint-visitor-keys.cjs"
],
"./package.json": "./package.json"
},
"files": [
"dist/index.d.ts",
"dist/visitor-keys.d.ts",
"dist/eslint-visitor-keys.cjs",
"dist/eslint-visitor-keys.d.cts",
"lib"
],
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"devDependencies": {
"@types/estree": "^0.0.51",
"@types/estree-jsx": "^0.0.1",
"@typescript-eslint/parser": "^8.7.0",
"eslint-release": "^3.2.0",
"esquery": "^1.4.0",
"json-diff": "^0.7.3",
"opener": "^1.5.2",
"rollup": "^4.22.4",
"rollup-plugin-dts": "^6.1.1",
"tsd": "^0.31.2",
"typescript": "^5.6.2"
},
"scripts": {
"build": "npm run build:cjs && npm run build:types",
"build:cjs": "rollup -c",
"build:debug": "npm run build:cjs -- -m && npm run build:types",
"build:types": "tsc -v && tsc",
"release:generate:latest": "eslint-generate-release",
"release:generate:alpha": "eslint-generate-prerelease alpha",
"release:generate:beta": "eslint-generate-prerelease beta",
"release:generate:rc": "eslint-generate-prerelease rc",
"release:publish": "eslint-publish-release",
"test": "mocha tests/lib/**/*.cjs && c8 mocha tests/lib/**/*.js && npm run test:types",
"test:open-coverage": "c8 report --reporter lcov && opener coverage/lcov-report/index.html",
"test:types": "tsd"
},
"repository": {
"type": "git",
"url": "https://github.com/eslint/js.git",
"directory": "packages/eslint-visitor-keys"
},
"funding": "https://opencollective.com/eslint",
"keywords": [
"eslint"
],
"author": "Toru Nagashima (https://github.com/mysticatea)",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/eslint/js/issues"
},
"homepage": "https://github.com/eslint/js/blob/main/packages/eslint-visitor-keys/README.md"
}
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImportBindingDefinition = void 0;
const DefinitionBase_1 = require("./DefinitionBase");
const DefinitionType_1 = require("./DefinitionType");
class ImportBindingDefinition extends DefinitionBase_1.DefinitionBase {
isTypeDefinition = true;
isVariableDefinition = true;
constructor(name, node, decl) {
super(DefinitionType_1.DefinitionType.ImportBinding, name, node, decl);
}
}
exports.ImportBindingDefinition = ImportBindingDefinition;
@@ -0,0 +1,6 @@
import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types";
export type IfKeywordError = ErrorObject<"if", {
failingKeyword: string;
}, AnySchema>;
declare const def: CodeKeywordDefinition;
export default def;
@@ -0,0 +1,15 @@
"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 = void 0;
const es2022_1 = require("./es2022");
const es2023_array_1 = require("./es2023.array");
const es2023_collection_1 = require("./es2023.collection");
const es2023_intl_1 = require("./es2023.intl");
exports.es2023 = {
libs: [es2022_1.es2022, es2023_array_1.es2023_array, es2023_collection_1.es2023_collection, es2023_intl_1.es2023_intl],
variables: [],
};
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = validateNode;
var _validate = require("../validators/validate.js");
var _index = require("../index.js");
function validateNode(node) {
if (node == null || typeof node !== "object") return;
const fields = _index.NODE_FIELDS[node.type];
if (!fields) return;
const keys = _index.BUILDER_KEYS[node.type];
for (const key of keys) {
const field = fields[key];
if (field != null) (0, _validate.validateInternal)(field, node, key, node[key]);
}
return node;
}
//# sourceMappingURL=validateNode.js.map
@@ -0,0 +1,81 @@
'use strict'
const statuses = require('../lib/statuses')
const supported = require('../lib/supported')
const browsers = require('./browsers').browsers
const versions = require('./browserVersions').browserVersions
const versionGroups = require('./versionGroups.js').versionGroups
const MATH2LOG = Math.log(2)
const groupCache = {}
function expandKey(key) {
let cached = groupCache[key]
if (cached === undefined) {
cached = groupCache[key] = expandGroups(versionGroups[key], [])
}
return cached
}
function expandGroups(value, out) {
let start = 0
for (let i = 0, len = value.length; i <= len; i++) {
if (i === len || value.charCodeAt(i) === 32) {
if (i > start) {
if (value.charCodeAt(start) === 95) {
let group = expandKey(value.slice(start + 1, i))
for (let j = 0; j < group.length; j++) out.push(group[j])
} else {
out.push(value.slice(start, i))
}
}
start = i + 1
}
}
return out
}
function unpackSupport(cipher) {
// bit flags
let stats = Object.keys(supported).reduce((list, support) => {
if (cipher & supported[support]) list.push(support)
return list
}, [])
// notes
let notes = cipher >> 7
let notesArray = []
while (notes) {
let note = Math.floor(Math.log(notes) / MATH2LOG) + 1
notesArray.unshift(`#${note}`)
notes -= Math.pow(2, note - 1)
}
return stats.concat(notesArray).join(' ')
}
function unpackFeature(packed) {
let unpacked = {
status: statuses[packed.B],
title: packed.C,
shown: packed.D
}
unpacked.stats = Object.keys(packed.A).reduce((browserStats, key) => {
let browser = packed.A[key]
browserStats[browsers[key]] = Object.keys(browser).reduce(
(stats, support) => {
let packedVersions = expandGroups(browser[support], [])
let unpacked2 = unpackSupport(support)
packedVersions.forEach(v => (stats[versions[v]] = unpacked2))
return stats
},
{}
)
return browserStats
}, {})
return unpacked
}
module.exports = unpackFeature
module.exports.default = unpackFeature
@@ -0,0 +1 @@
{"version":3,"file":"is-dom-keyframes.mjs","sources":["../../../../src/animation/utils/is-dom-keyframes.ts"],"sourcesContent":["import { DOMKeyframesDefinition } from \"motion-dom\"\n\nexport function isDOMKeyframes(\n keyframes: unknown\n): keyframes is DOMKeyframesDefinition {\n return typeof keyframes === \"object\" && !Array.isArray(keyframes)\n}\n"],"names":[],"mappings":"AAEM,SAAU,cAAc,CAC1B,SAAkB,EAAA;AAElB,IAAA,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AACrE;;;;"}
@@ -0,0 +1 @@
"use strict";var m=new Uint8Array(256);function u(e,c){let t=0,g=[],k=0,d=e.length,w=c.charCodeAt(0);for(let n=0;n<d;n++){let h=e.charCodeAt(n);if(t===0&&h===w){g.push(e.slice(k,n)),k=n+1;continue}switch(h){case 92:n+=1;break;case 39:case 34:for(;++n<d;){let x=e.charCodeAt(n);if(x===92){n+=1;continue}if(x===h)break}break;case 40:m[t]=41,t++;break;case 91:m[t]=93,t++;break;case 123:m[t]=125,t++;break;case 93:case 125:case 41:t>0&&h===m[t-1]&&t--;break}}return g.push(e.slice(k)),g}var l=/[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?/,z=new RegExp(`^${l.source}$`);var T=new RegExp(`^${l.source}%$`);var D=new RegExp(`^${l.source}\\s*/\\s*${l.source}$`);var A=["cm","mm","Q","in","pc","pt","px","em","ex","ch","rem","lh","rlh","vw","vh","vmin","vmax","vb","vi","svw","svh","lvw","lvh","dvw","dvh","cqw","cqh","cqi","cqb","cqmin","cqmax"],I=new RegExp(`^${l.source}(${A.join("|")})$`);var C=["deg","rad","grad","turn"],F=new RegExp(`^${l.source}(${C.join("|")})$`);var H=new RegExp(`^${l.source} +${l.source} +${l.source}$`);function i(e){let c=Number(e);return Number.isInteger(c)&&c>=0&&String(c)===String(e)}var f={inherit:"inherit",current:"currentcolor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(98.4% 0.003 247.858)",100:"oklch(96.8% 0.007 247.896)",200:"oklch(92.9% 0.013 255.508)",300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",600:"oklch(44.6% 0.043 257.281)",700:"oklch(37.2% 0.044 257.287)",800:"oklch(27.9% 0.041 260.031)",900:"oklch(20.8% 0.042 265.755)",950:"oklch(12.9% 0.042 264.695)"},gray:{50:"oklch(98.5% 0.002 247.839)",100:"oklch(96.7% 0.003 264.542)",200:"oklch(92.8% 0.006 264.531)",300:"oklch(87.2% 0.01 258.338)",400:"oklch(70.7% 0.022 261.325)",500:"oklch(55.1% 0.027 264.364)",600:"oklch(44.6% 0.03 256.802)",700:"oklch(37.3% 0.034 259.733)",800:"oklch(27.8% 0.033 256.848)",900:"oklch(21% 0.034 264.665)",950:"oklch(13% 0.028 261.692)"},zinc:{50:"oklch(98.5% 0 0)",100:"oklch(96.7% 0.001 286.375)",200:"oklch(92% 0.004 286.32)",300:"oklch(87.1% 0.006 286.286)",400:"oklch(70.5% 0.015 286.067)",500:"oklch(55.2% 0.016 285.938)",600:"oklch(44.2% 0.017 285.786)",700:"oklch(37% 0.013 285.805)",800:"oklch(27.4% 0.006 286.033)",900:"oklch(21% 0.006 285.885)",950:"oklch(14.1% 0.005 285.823)"},neutral:{50:"oklch(98.5% 0 0)",100:"oklch(97% 0 0)",200:"oklch(92.2% 0 0)",300:"oklch(87% 0 0)",400:"oklch(70.8% 0 0)",500:"oklch(55.6% 0 0)",600:"oklch(43.9% 0 0)",700:"oklch(37.1% 0 0)",800:"oklch(26.9% 0 0)",900:"oklch(20.5% 0 0)",950:"oklch(14.5% 0 0)"},stone:{50:"oklch(98.5% 0.001 106.423)",100:"oklch(97% 0.001 106.424)",200:"oklch(92.3% 0.003 48.717)",300:"oklch(86.9% 0.005 56.366)",400:"oklch(70.9% 0.01 56.259)",500:"oklch(55.3% 0.013 58.071)",600:"oklch(44.4% 0.011 73.639)",700:"oklch(37.4% 0.01 67.558)",800:"oklch(26.8% 0.007 34.298)",900:"oklch(21.6% 0.006 56.043)",950:"oklch(14.7% 0.004 49.25)"},mauve:{50:"oklch(98.5% 0 0)",100:"oklch(96% 0.003 325.6)",200:"oklch(92.2% 0.005 325.62)",300:"oklch(86.5% 0.012 325.68)",400:"oklch(71.1% 0.019 323.02)",500:"oklch(54.2% 0.034 322.5)",600:"oklch(43.5% 0.029 321.78)",700:"oklch(36.4% 0.029 323.89)",800:"oklch(26.3% 0.024 320.12)",900:"oklch(21.2% 0.019 322.12)",950:"oklch(14.5% 0.008 326)"},olive:{50:"oklch(98.8% 0.003 106.5)",100:"oklch(96.6% 0.005 106.5)",200:"oklch(93% 0.007 106.5)",300:"oklch(88% 0.011 106.6)",400:"oklch(73.7% 0.021 106.9)",500:"oklch(58% 0.031 107.3)",600:"oklch(46.6% 0.025 107.3)",700:"oklch(39.4% 0.023 107.4)",800:"oklch(28.6% 0.016 107.4)",900:"oklch(22.8% 0.013 107.4)",950:"oklch(15.3% 0.006 107.1)"},mist:{50:"oklch(98.7% 0.002 197.1)",100:"oklch(96.3% 0.002 197.1)",200:"oklch(92.5% 0.005 214.3)",300:"oklch(87.2% 0.007 219.6)",400:"oklch(72.3% 0.014 214.4)",500:"oklch(56% 0.021 213.5)",600:"oklch(45% 0.017 213.2)",700:"oklch(37.8% 0.015 216)",800:"oklch(27.5% 0.011 216.9)",900:"oklch(21.8% 0.008 223.9)",950:"oklch(14.8% 0.004 228.8)"},taupe:{50:"oklch(98.6% 0.002 67.8)",100:"oklch(96% 0.002 17.2)",200:"oklch(92.2% 0.005 34.3)",300:"oklch(86.8% 0.007 39.5)",400:"oklch(71.4% 0.014 41.2)",500:"oklch(54.7% 0.021 43.1)",600:"oklch(43.8% 0.017 39.3)",700:"oklch(36.7% 0.016 35.7)",800:"oklch(26.8% 0.011 36.5)",900:"oklch(21.4% 0.009 43.1)",950:"oklch(14.7% 0.004 49.3)"},red:{50:"oklch(97.1% 0.013 17.38)",100:"oklch(93.6% 0.032 17.717)",200:"oklch(88.5% 0.062 18.334)",300:"oklch(80.8% 0.114 19.571)",400:"oklch(70.4% 0.191 22.216)",500:"oklch(63.7% 0.237 25.331)",600:"oklch(57.7% 0.245 27.325)",700:"oklch(50.5% 0.213 27.518)",800:"oklch(44.4% 0.177 26.899)",900:"oklch(39.6% 0.141 25.723)",950:"oklch(25.8% 0.092 26.042)"},orange:{50:"oklch(98% 0.016 73.684)",100:"oklch(95.4% 0.038 75.164)",200:"oklch(90.1% 0.076 70.697)",300:"oklch(83.7% 0.128 66.29)",400:"oklch(75% 0.183 55.934)",500:"oklch(70.5% 0.213 47.604)",600:"oklch(64.6% 0.222 41.116)",700:"oklch(55.3% 0.195 38.402)",800:"oklch(47% 0.157 37.304)",900:"oklch(40.8% 0.123 38.172)",950:"oklch(26.6% 0.079 36.259)"},amber:{50:"oklch(98.7% 0.022 95.Line truncated
@@ -0,0 +1,25 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const HandCoins = createLucideIcon("HandCoins", [
["path", { d: "M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17", key: "geh8rc" }],
[
"path",
{
d: "m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",
key: "1fto5m"
}
],
["path", { d: "m2 16 6 6", key: "1pfhp9" }],
["circle", { cx: "16", cy: "9", r: "2.9", key: "1n0dlu" }],
["circle", { cx: "6", cy: "5", r: "3", key: "151irh" }]
]);
export { HandCoins as default };
//# sourceMappingURL=hand-coins.js.map
@@ -0,0 +1,31 @@
import { isCSSVariableName } from '../../animation/utils/is-css-variable.mjs';
import { correctBorderRadius } from './scale-border-radius.mjs';
import { correctBoxShadow } from './scale-box-shadow.mjs';
const scaleCorrectors = {
borderRadius: {
...correctBorderRadius,
applyTo: [
"borderTopLeftRadius",
"borderTopRightRadius",
"borderBottomLeftRadius",
"borderBottomRightRadius",
],
},
borderTopLeftRadius: correctBorderRadius,
borderTopRightRadius: correctBorderRadius,
borderBottomLeftRadius: correctBorderRadius,
borderBottomRightRadius: correctBorderRadius,
boxShadow: correctBoxShadow,
};
function addScaleCorrector(correctors) {
for (const key in correctors) {
scaleCorrectors[key] = correctors[key];
if (isCSSVariableName(key)) {
scaleCorrectors[key].isCSSVariable = true;
}
}
}
export { addScaleCorrector, scaleCorrectors };
//# sourceMappingURL=scale-correction.mjs.map
@@ -0,0 +1,68 @@
import { expect, test } from "vitest";
import * as z from "zod/v4";
test("async refine .parse()", async () => {
// throws ZodAsyncError
const s1 = z.string().refine(async (_val) => true);
expect(() => s1.safeParse("asdf")).toThrow();
});
test("async refine", async () => {
const s1 = z.string().refine(async (_val) => true);
const r1 = await s1.parseAsync("asdf");
expect(r1).toEqual("asdf");
const s2 = z.string().refine(async (_val) => false);
const r2 = await s2.safeParseAsync("asdf");
expect(r2.success).toBe(false);
expect(r2).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "custom",
"path": [],
"message": "Invalid input"
}
]],
"success": false,
}
`);
});
test("async refine with Promises", async () => {
// expect.assertions(2);
const schema1 = z.string().refine((_val) => Promise.resolve(true));
const v1 = await schema1.parseAsync("asdf");
expect(v1).toEqual("asdf");
const schema2 = z.string().refine((_val) => Promise.resolve(false));
await expect(schema2.parseAsync("asdf")).rejects.toBeDefined();
const schema3 = z.string().refine((_val) => Promise.resolve(true));
await expect(schema3.parseAsync("asdf")).resolves.toEqual("asdf");
return await expect(schema3.parseAsync("qwer")).resolves.toEqual("qwer");
});
test("async refine that uses value", async () => {
const schema1 = z.string().refine(async (val) => {
return val.length > 5;
});
const r1 = await schema1.safeParseAsync("asdf");
expect(r1.success).toBe(false);
expect(r1.error).toMatchInlineSnapshot(`
[ZodError: [
{
"code": "custom",
"path": [],
"message": "Invalid input"
}
]]
`);
const r2 = await schema1.safeParseAsync("asdf123");
expect(r2.success).toBe(true);
expect(r2.data).toEqual("asdf123");
});
@@ -0,0 +1 @@
{"version":3,"file":"fold-horizontal.js","sources":["../../../src/icons/fold-horizontal.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name FoldHorizontal\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMiAxMmg2IiAvPgogIDxwYXRoIGQ9Ik0yMiAxMmgtNiIgLz4KICA8cGF0aCBkPSJNMTIgMnYyIiAvPgogIDxwYXRoIGQ9Ik0xMiA4djIiIC8+CiAgPHBhdGggZD0iTTEyIDE0djIiIC8+CiAgPHBhdGggZD0iTTEyIDIwdjIiIC8+CiAgPHBhdGggZD0ibTE5IDktMyAzIDMgMyIgLz4KICA8cGF0aCBkPSJtNSAxNSAzLTMtMy0zIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/fold-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 FoldHorizontal = createLucideIcon('FoldHorizontal', [\n ['path', { d: 'M2 12h6', key: '1wqiqv' }],\n ['path', { d: 'M22 12h-6', key: '1eg9hc' }],\n ['path', { d: 'M12 2v2', key: 'tus03m' }],\n ['path', { d: 'M12 8v2', key: '1woqiv' }],\n ['path', { d: 'M12 14v2', key: '8jcxud' }],\n ['path', { d: 'M12 20v2', key: '1lh1kg' }],\n ['path', { d: 'm19 9-3 3 3 3', key: '12ol22' }],\n ['path', { d: 'm5 15 3-3-3-3', key: '1kdhjc' }],\n]);\n\nexport default FoldHorizontal;\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,CAAiB,iBAAiB,gBAAkB,CAAA,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,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,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,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,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,29 @@
import type CJSImportProcessor from "../CJSImportProcessor";
import type { Options } from "../index";
import type TokenProcessor from "../TokenProcessor";
import type RootTransformer from "./RootTransformer";
import Transformer from "./Transformer";
/**
* Implementation of babel-plugin-transform-react-display-name, which adds a
* display name to usages of React.createClass and createReactClass.
*/
export default class ReactDisplayNameTransformer extends Transformer {
readonly rootTransformer: RootTransformer;
readonly tokens: TokenProcessor;
readonly importProcessor: CJSImportProcessor | null;
readonly options: Options;
constructor(rootTransformer: RootTransformer, tokens: TokenProcessor, importProcessor: CJSImportProcessor | null, options: Options);
process(): boolean;
/**
* This is called with the token position at the open-paren.
*/
private tryProcessCreateClassCall;
private findDisplayName;
private getDisplayNameFromFilename;
/**
* We only want to add a display name when this is a function call containing
* one argument, which is an object literal without `displayName` as an
* existing key.
*/
private classNeedsDisplayName;
}
@@ -0,0 +1,16 @@
/**
* Adds a specified number of milliseconds to a date.
* 向日期添加指定数量的毫秒。
*
* @param date - The date to add milliseconds to. (要添加毫秒的日期。)
* @param ms - The number of milliseconds to add. (要添加的毫秒数。)
* @returns A new date with the added milliseconds. (添加毫秒后的新日期。)
* @example
* ```ts
* // Adding 5000 milliseconds to a date (向日期添加5000毫秒)
* const originalDate = new Date('2023-10-01T12:00:00');
* addMilliseconds(originalDate, 5000);
* console.log(originalDate.toISOString()); // Outputs: '2023-10-01T12:00:05.000Z' (输出: '2023-10-01T12:00:05.000Z')
* ```
*/
export default function addMilliseconds(date: Date, ms: number): Date;
@@ -0,0 +1,291 @@
# CSSType
[![npm](https://img.shields.io/npm/v/csstype.svg)](https://www.npmjs.com/package/csstype)
TypeScript and Flow definitions for CSS, generated by [data from MDN](https://github.com/mdn/data). It provides autocompletion and type checking for CSS properties and values.
**TypeScript**
```ts
import type * as CSS from 'csstype';
const style: CSS.Properties = {
colour: 'white', // Type error on property
textAlign: 'middle', // Type error on value
};
```
**Flow**
```js
// @flow strict
import * as CSS from 'csstype';
const style: CSS.Properties<> = {
colour: 'white', // Type error on property
textAlign: 'middle', // Type error on value
};
```
_Further examples below will be in TypeScript!_
## Getting started
```sh
$ npm install csstype
```
## Table of content
- [Style types](#style-types)
- [At-rule types](#at-rule-types)
- [Pseudo types](#pseudo-types)
- [Generics](#generics)
- [Usage](#usage)
- [What should I do when I get type errors?](#what-should-i-do-when-i-get-type-errors)
- [Version 3.0](#version-30)
- [Contributing](#contributing)
## Style types
Properties are categorized in different uses and in several technical variations to provide typings that suits as many as possible.
| | Default | `Hyphen` | `Fallback` | `HyphenFallback` |
| -------------- | -------------------- | -------------------------- | ---------------------------- | ---------------------------------- |
| **All** | `Properties` | `PropertiesHyphen` | `PropertiesFallback` | `PropertiesHyphenFallback` |
| **`Standard`** | `StandardProperties` | `StandardPropertiesHyphen` | `StandardPropertiesFallback` | `StandardPropertiesHyphenFallback` |
| **`Vendor`** | `VendorProperties` | `VendorPropertiesHyphen` | `VendorPropertiesFallback` | `VendorPropertiesHyphenFallback` |
| **`Obsolete`** | `ObsoleteProperties` | `ObsoletePropertiesHyphen` | `ObsoletePropertiesFallback` | `ObsoletePropertiesHyphenFallback` |
| **`Svg`** | `SvgProperties` | `SvgPropertiesHyphen` | `SvgPropertiesFallback` | `SvgPropertiesHyphenFallback` |
Categories:
- **All** - Includes `Standard`, `Vendor`, `Obsolete` and `Svg`
- **`Standard`** - Current properties and extends subcategories `StandardLonghand` and `StandardShorthand` _(e.g. `StandardShorthandProperties`)_
- **`Vendor`** - Vendor prefixed properties and extends subcategories `VendorLonghand` and `VendorShorthand` _(e.g. `VendorShorthandProperties`)_
- **`Obsolete`** - Removed or deprecated properties
- **`Svg`** - SVG-specific properties
Variations:
- **Default** - JavaScript (camel) cased property names
- **`Hyphen`** - CSS (kebab) cased property names
- **`Fallback`** - Also accepts array of values e.g. `string | string[]`
## At-rule types
At-rule interfaces with descriptors.
**TypeScript**: These will be found in the `AtRule` namespace, e.g. `AtRule.Viewport`.
**Flow**: These will be prefixed with `AtRule$`, e.g. `AtRule$Viewport`.
| | Default | `Hyphen` | `Fallback` | `HyphenFallback` |
| -------------------- | -------------- | -------------------- | ---------------------- | ---------------------------- |
| **`@counter-style`** | `CounterStyle` | `CounterStyleHyphen` | `CounterStyleFallback` | `CounterStyleHyphenFallback` |
| **`@font-face`** | `FontFace` | `FontFaceHyphen` | `FontFaceFallback` | `FontFaceHyphenFallback` |
| **`@viewport`** | `Viewport` | `ViewportHyphen` | `ViewportFallback` | `ViewportHyphenFallback` |
## Pseudo types
String literals of pseudo classes and pseudo elements
- `Pseudos`
Extends:
- `AdvancedPseudos`
Function-like pseudos e.g. `:not(:first-child)`. The string literal contains the value excluding the parenthesis: `:not`. These are separated because they require an argument that results in infinite number of variations.
- `SimplePseudos`
Plain pseudos e.g. `:hover` that can only be **one** variation.
## Generics
All interfaces has two optional generic argument to define length and time: `CSS.Properties<TLength = string | 0, TTime = string>`
- **Length** is the first generic parameter and defaults to `string | 0` because `0` is the only [length where the unit identifier is optional](https://drafts.csswg.org/css-values-3/#lengths). You can specify this, e.g. `string | number`, for platforms and libraries that accepts any numeric value as length with a specific unit.
```tsx
const style: CSS.Properties<string | number> = {
width: 100,
};
```
- **Time** is the second generic argument and defaults to `string`. You can specify this, e.g. `string | number`, for platforms and libraries that accepts any numeric value as length with a specific unit.
```tsx
const style: CSS.Properties<string | number, number> = {
transitionDuration: 1000,
};
```
## Usage
```ts
import type * as CSS from 'csstype';
const style: CSS.Properties = {
width: '10px',
margin: '1em',
};
```
In some cases, like for CSS-in-JS libraries, an array of values is a way to provide fallback values in CSS. Using `CSS.PropertiesFallback` instead of `CSS.Properties` will add the possibility to use any property value as an array of values.
```ts
import type * as CSS from 'csstype';
const style: CSS.PropertiesFallback = {
display: ['-webkit-flex', 'flex'],
color: 'white',
};
```
There's even string literals for pseudo selectors and elements.
```ts
import type * as CSS from 'csstype';
const pseudos: { [P in CSS.SimplePseudos]?: CSS.Properties } = {
':hover': {
display: 'flex',
},
};
```
Hyphen cased (kebab cased) properties are provided in `CSS.PropertiesHyphen` and `CSS.PropertiesHyphenFallback`. It's not **not** added by default in `CSS.Properties`. To allow both of them, you can simply extend with `CSS.PropertiesHyphen` or/and `CSS.PropertiesHyphenFallback`.
```ts
import type * as CSS from 'csstype';
interface Style extends CSS.Properties, CSS.PropertiesHyphen {}
const style: Style = {
'flex-grow': 1,
'flex-shrink': 0,
'font-weight': 'normal',
backgroundColor: 'white',
};
```
Adding type checked CSS properties to a `HTMLElement`.
```ts
import type * as CSS from 'csstype';
const style: CSS.Properties = {
color: 'red',
margin: '1em',
};
let button = document.createElement('button');
Object.assign(button.style, style);
```
## What should I do when I get type errors?
The goal is to have as perfect types as possible and we're trying to do our best. But with CSS Custom Properties, the CSS specification changing frequently and vendors implementing their own specifications with new releases sometimes causes type errors even if it should work. Here's some steps you could take to get it fixed:
_If you're using CSS Custom Properties you can step directly to step 3._
1. **First of all, make sure you're doing it right.** A type error could also indicate that you're not :wink:
- Some CSS specs that some vendors has implemented could have been officially rejected or haven't yet received any official acceptance and are therefor not included
- If you're using TypeScript, [type widening](https://blog.mariusschulz.com/2017/02/04/TypeScript-2-1-literal-type-widening) could be the reason you get `Type 'string' is not assignable to...` errors
2. **Have a look in [issues](https://github.com/frenic/csstype/issues) to see if an issue already has been filed. If not, create a new one.** To help us out, please refer to any information you have found.
3. Fix the issue locally with **TypeScript** (Flow further down):
- The recommended way is to use **module augmentation**. Here's a few examples:
```ts
// My css.d.ts file
import type * as CSS from 'csstype';
declare module 'csstype' {
interface Properties {
// Add a missing property
WebkitRocketLauncher?: string;
// Add a CSS Custom Property
'--theme-color'?: 'black' | 'white';
// Allow namespaced CSS Custom Properties
[index: `--theme-${string}`]: any;
// Allow any CSS Custom Properties
[index: `--${string}`]: any;
// ...or allow any other property
[index: string]: any;
}
}
```
- The alternative way is to use **type assertion**. Here's a few examples:
```ts
const style: CSS.Properties = {
// Add a missing property
['WebkitRocketLauncher' as any]: 'launching',
// Add a CSS Custom Property
['--theme-color' as any]: 'black',
};
```
Fix the issue locally with **Flow**:
- Use **type assertion**. Here's a few examples:
```js
const style: $Exact<CSS.Properties<*>> = {
// Add a missing property
[('WebkitRocketLauncher': any)]: 'launching',
// Add a CSS Custom Property
[('--theme-color': any)]: 'black',
};
```
## Version 3.2
- **No longer compatible with version 2**
Conflicts may occur when both version ^3.2.0 and ^2.0.0 are installed. Potential fix for Npm would be to force resolution in `package.json`:
```json
{
"overrides": {
"csstype": "^3.2.0"
}
}
```
## Version 3.1
- **Data types are exposed**
TypeScript: `DataType.Color`
Flow: `DataType$Color`
## Version 3.0
- **All property types are exposed with namespace**
TypeScript: `Property.AlignContent` (was `AlignContentProperty` before)
Flow: `Property$AlignContent`
- **All at-rules are exposed with namespace**
TypeScript: `AtRule.FontFace` (was `FontFace` before)
Flow: `AtRule$FontFace`
- **Data types are NOT exposed**
E.g. `Color` and `Box`. Because the generation of data types may suddenly be removed or renamed.
- **TypeScript hack for autocompletion**
Uses `(string & {})` for literal string unions and `(number & {})` for literal number unions ([related issue](https://github.com/microsoft/TypeScript/issues/29729)). Utilize `PropertyValue<T>` to unpack types from e.g. `(string & {})` to `string`.
- **New generic for time**
Read more on the ["Generics"](#generics) section.
- **Flow types improvements**
Flow Strict enabled and exact types are used.
## Contributing
**Never modify `index.d.ts` and `index.js.flow` directly. They are generated automatically and committed so that we can easily follow any change it results in.** Therefor it's important that you run `$ git config merge.ours.driver true` after you've forked and cloned. That setting prevents merge conflicts when doing rebase.
### Commands
- `npm run build` Generates typings and type checks them
- `npm run watch` Runs build on each save
- `npm run test` Runs the tests
- `npm run lazy` Type checks, lints and formats everything
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2019_string: LibDefinition;
@@ -0,0 +1 @@
module.exports={C:{"52":0.02068,"78":0.01551,"115":0.38251,"120":0.00517,"121":0.00517,"123":0.00517,"128":0.00517,"132":0.00517,"134":0.00517,"135":0.01551,"136":0.02068,"138":0.00517,"140":0.54275,"141":0.00517,"143":0.00517,"144":0.01551,"145":0.00517,"146":0.02068,"147":0.01034,"148":0.02068,"149":0.01551,"150":0.01551,"151":0.02585,"152":0.06203,"153":0.12406,"154":0.57893,"155":1.88152,"156":1.96422,"157":0.0672,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 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 124 125 126 127 129 130 131 133 137 139 142 158 159 160 3.5 3.6"},D:{"15":0.01034,"49":0.00517,"70":0.01034,"80":0.02585,"87":0.00517,"99":0.00517,"101":0.00517,"103":0.03618,"104":0.02068,"105":0.02068,"106":0.02068,"107":0.02068,"108":0.02585,"109":0.24294,"110":0.02585,"111":0.02585,"112":0.02068,"114":0.00517,"116":0.11889,"117":0.02585,"118":0.04135,"119":0.01034,"120":0.11372,"121":0.01034,"122":0.02585,"123":0.01034,"124":0.04652,"125":0.01034,"126":0.00517,"127":0.00517,"128":0.04135,"129":0.00517,"130":0.00517,"131":0.0672,"132":0.01034,"133":0.10338,"134":0.04135,"135":0.05169,"136":0.05169,"137":0.03618,"138":0.10855,"139":0.04652,"140":0.0672,"141":0.13439,"142":0.12923,"143":0.05686,"144":0.04135,"145":0.03618,"146":0.14473,"147":0.05686,"148":0.13439,"149":0.1499,"150":0.47555,"151":1.38529,"152":6.43541,"153":7.21076,"154":1.73162,"155":0.02585,_:"4 5 6 7 8 9 10 11 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 71 72 73 74 75 76 77 78 79 81 83 84 85 86 88 89 90 91 92 93 94 95 96 97 98 100 102 113 115 156 157"},F:{"95":0.03101,"100":0.03618,"101":0.01551,"102":0.00517,"106":0.00517,"113":0.00517,"131":0.00517,"133":0.01551,"134":0.11889,"135":1.12167,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 103 104 105 107 108 109 110 111 112 114 115 116 117 118 119 120 121 122 123 124 125 126 127 132 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"92":0.00517,"107":0.00517,"109":0.0827,"119":0.00517,"120":0.01034,"122":0.00517,"129":0.00517,"130":0.00517,"131":0.00517,"132":0.00517,"133":0.01034,"134":0.00517,"135":0.00517,"136":0.00517,"138":0.00517,"140":0.00517,"141":0.01034,"142":0.01034,"143":0.01034,"144":0.01551,"145":0.01034,"146":0.01551,"147":0.05169,"148":0.03618,"149":0.05169,"150":0.15507,"151":0.4342,"152":3.87675,"153":6.34753,"154":1.49901,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 108 110 111 112 113 114 115 116 117 118 121 123 124 125 126 127 128 137 139"},E:{"14":0.00517,"27":0.44453,_:"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 15.1 15.2-15.3 27.1 TP","11.1":0.01551,"12.1":0.00517,"13.1":0.02585,"14.1":0.01551,"15.4":0.00517,"15.5":0.00517,"15.6":0.13956,"16.0":0.01034,"16.1":0.01034,"16.2":0.00517,"16.3":0.02068,"16.4":0.00517,"16.5":0.02068,"16.6":0.23777,"17.0":0.01034,"17.1":0.17058,"17.2":0.02585,"17.3":0.01551,"17.4":0.05169,"17.5":0.05169,"17.6":0.2998,"18.0":0.01551,"18.1":0.0672,"18.2":0.02585,"18.3":0.05686,"18.4":0.03618,"18.5-18.7":0.09821,"26.0":0.02585,"26.1":0.05169,"26.2":0.15507,"26.3":0.14473,"26.4":0.18092,"26.5":0.82187,"26.6":4.04216,"27.2":0.00517},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00225,"5.0-5.1":0.00225,"6.0-6.1":0,"7.0-7.1":0.0045,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.02251,"11.0-11.2":0.00225,"11.3-11.4":0.0045,"12.0-12.1":0,"12.2-12.5":0.05853,"13.0-13.1":0,"13.2":0.01126,"13.3":0,"13.4-13.7":0.00225,"14.0-14.4":0.009,"14.5-14.8":0.01351,"15.0-15.1":0.01351,"15.2-15.3":0.009,"15.4":0.01126,"15.5":0.01351,"15.6-15.8":0.29266,"16.0":0.02251,"16.1":0.04052,"16.2":0.02251,"16.3":0.04953,"16.4":0.01126,"16.5":0.01801,"16.6-16.7":0.40748,"17.0":0.01576,"17.1":0.02251,"17.2":0.02251,"17.3":0.03377,"17.4":0.04728,"17.5":0.0923,"17.6-17.7":0.23863,"18.0":0.04953,"18.1":0.09905,"18.2":0.13507,"18.3":0.23413,"18.4":0.14633,"18.5-18.7":3.02342,"26.0":0.14633,"26.1":0.14858,"26.2":0.38721,"26.3":0.41873,"26.4":0.30617,"26.5":2.05089,"26.6":12.65425,"27.0":0.97029,"27.1":0,"27.2":0.02476},P:{"4":0.00925,"21":0.02774,"22":0.00925,"23":0.00925,"24":0.00925,"25":0.0185,"26":0.0185,"27":0.00925,"28":0.04624,"29":0.12022,"30":3.28301,_:"20 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0"},I:{"0":0.00966,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0},K:{"0":0.87924,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0Line truncated
@@ -0,0 +1,48 @@
'use strict'
const Dispatcher = require('./dispatcher')
const RetryHandler = require('../handler/retry-handler')
const { kOriginless, kUrl } = require('../core/symbols')
class RetryAgent extends Dispatcher {
#agent = null
#options = null
constructor (agent, options = {}) {
super(options)
this.#agent = agent
this.#options = options
this[kUrl] = agent[kUrl]
this[kOriginless] = agent[kOriginless]
}
dispatch (opts, handler) {
const retry = new RetryHandler({
...opts,
retryOptions: this.#options
}, {
dispatch: this.#agent.dispatch.bind(this.#agent),
handler
})
return this.#agent.dispatch(opts, retry)
}
// WebSocket and EventSource read their receive limits from the dispatcher
// they are given, so report the wrapped agent's settings rather than none.
get webSocketOptions () {
return this.#agent.webSocketOptions
}
get eventSourceOptions () {
return this.#agent.eventSourceOptions
}
close () {
return this.#agent.close()
}
destroy () {
return this.#agent.destroy()
}
}
module.exports = RetryAgent
@@ -0,0 +1,11 @@
// to not bundle the provider
const name = "./provider.js";
async function loadProvider() {
const { V8CoverageProvider } = await import(
/* @vite-ignore */
name
);
return new V8CoverageProvider();
}
export { loadProvider as l };
@@ -0,0 +1 @@
{"version":3,"file":"chart-bar-stacked.js","sources":["../../../src/icons/chart-bar-stacked.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ChartBarStacked\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTEgMTN2NCIgLz4KICA8cGF0aCBkPSJNMTUgNXY0IiAvPgogIDxwYXRoIGQ9Ik0zIDN2MTZhMiAyIDAgMCAwIDIgMmgxNiIgLz4KICA8cmVjdCB4PSI3IiB5PSIxMyIgd2lkdGg9IjkiIGhlaWdodD0iNCIgcng9IjEiIC8+CiAgPHJlY3QgeD0iNyIgeT0iNSIgd2lkdGg9IjEyIiBoZWlnaHQ9IjQiIHJ4PSIxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/chart-bar-stacked\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 ChartBarStacked = createLucideIcon('ChartBarStacked', [\n ['path', { d: 'M11 13v4', key: 'vyy2rb' }],\n ['path', { d: 'M15 5v4', key: '1gx88a' }],\n ['path', { d: 'M3 3v16a2 2 0 0 0 2 2h16', key: 'c24i48' }],\n ['rect', { x: '7', y: '13', width: '9', height: '4', rx: '1', key: '1iip1u' }],\n ['rect', { x: '7', y: '5', width: '12', height: '4', rx: '1', key: '1anskk' }],\n]);\n\nexport default ChartBarStacked;\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,CAAkB,iBAAiB,iBAAmB,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,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,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAG,KAAK,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAQ,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC7E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAG,KAAK,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,QAAQ,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC/E,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"move-3-d.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,625 @@
export default `flf2a$ 6 4 20 0 11
Based on cursive(6) by Jan Wolter <janc@crim.eecs.umich.edu> on 24 Jul 1985
Figlet-ized and by Wendell Hicken <whicken@parasoft.com> on 5 Mar 1994
Added missing punctuation and numbers
Ammended by Jerrad Pierce <jpierce@cpan.org> on 8 Aug 2002
Underscore and dash have been updated to more closely match cursive(6)
The '_' character is treated in a special way. It may be
inserted in the text anywhere you wish to lengthen a con-
necting line between two letters.
$$@
$$@
$$@
$$@
$$@
$$@@
@
/@
/ @
' @
o @
@@
@
o o@
' '@
@
@
@@
/ /@
-/-/-@
-/-/- @
/ / @
@
@@
,-/-@
(_/ @
/ ) @
-/-' @
@
@@
() /@
/ @
/ @
/ ()@
@
@@
() @
/\\ @
( X @
\\/ \\@
@
@@
@
o@
'@
@
@
@@
_/@
/ @
/ @
/ @
@
@@
/@
/@
_/ @
/ @
@
@@
@
\\ / @
--X--@
/ \\ @
@
@@
@
/ @
--/--@
/ @
@
@@
@
@
@
o@
'@
@@
$$$@
$$$@
---@
$$$@
$$$@
$$@@
@
@
@
o@
@
@@
/@
/ @
/ @
/ @
@
@@
__ @
/ )@
/ / @
(__/ @
@
@@
_@
/@
/ @
/ @
@
@@
__ @
)@
.--' @
(__ @
@
@@
__ @
)@
-/ @
___/ @
@
@@
@
/ /@
'--/ @
/ @
@
@@
___@
/ @
'--. @
___) @
@
@@
@
/ @
/_ @
(__)@
@
@@
___@
/@
-/-@
/ @
@
@@
__ @
( )@
./' @
(__) @
@
@@
__ @
(__)@
/ @
/ @
@
@@
@
@
o@
@
o @
@@
@
@
o@
@
o @
' @@
/@
/ @
\\ @
\\@
@
@@
@
@
---@
---@
@
@@
\\ @
\\@
/@
/ @
@
@@
__ @
__)@
/ @
o @
@
@@
@
_ @
/o\\ @
(____@
@
@@
__ @
/ )@
/--/ @
/ (_ @
@
@@
__ @
/ )@
/--< @
/___/_@
@
@@
__ @
/ )@
/ @
(__/ @
@
@@
__ @
/ )@
/ / @
/__/_ @
@
@@
__ @
/ \`@
/-- @
(___, @
@
@@
_____@
/ '@
,-/-, @
(_/ @
@
@@
() ,@
/\`-'|@
/ / @
/__-<_ @
@
@@
_ ,@
' ) / @
/--/ @
/ (_ @
@
@@
_ @
| )@
,---|/ @
\\_/ \\_@
@
@@
___ @
( >@
__/_@
/ / @
<_/ @
@@
_ ,@
' ) / @
/-< @
/ ) @
@
@@
_@
_//@
/ @
/___@
@
@@
_ _ _ @
' ) ) )@
/ / / @
/ ' (_ @
@
@@
_ __ @
' ) )@
/ / @
/ (_ @
@
@@
__ @
/ ')@
/ / @
(__/ @
@
@@
_ __ @
' ) )@
/--' @
/ @
@
@@
__ @
/ )@
/ / @
(_\\/ @
\` @
@@
_ __ @
' ) )@
/--' @
/ \\_ @
@
@@
() @
/\\ @
/ ) @
/__/__@
@
@@
______@
/ @
--/ @
(_/ @
@
@@
_ __@
' ) / @
/ / @
(__/ @
@
@@
_ _@
' ) / @
( / @
\\/ @
@
@@
_ _@
' ) / @
/ / / @
(_(_/ @
@
@@
_ ,@
' \\ / @
X @
/ \\_@
@
@@
_ ,@
' ) / @
/ / @
(__/_ @
// @
(/ @@
___@
/@
/ @
/__@
@
@@
_@
/ @
/ @
/_ @
@
@@
\\ @
\\ @
\\ @
\\@
@
@@
_@
/@
/ @
_/ @
@
@@
/\\@
@
@
@
@
@@
@
@
@
_@
@
@@
@
o@
\`@
@
@
@@
@
@
__. @
(_/|_@
@
@@
@
/ @
/__@
/_) @
@
@@
@
@
_.@
(__@
@
@@
@
/@
__/ @
(_/_ @
@
@@
@
@
_ @
</_@
@
@@
@
/)@
// @
//_ @
/> @
</ @@
@
@
_, @
(_)_@
/| @
|/ @@
@
/ @
/_ @
/ /_@
@
@@
@
@
o@
<_@
@
@@
@
@
o@
/_@
/ @
-' @@
@
/ @
/_ @
/ <_@
@
@@
_@
//@
// @
</_ @
@
@@
@
@
______ @
/ / / <_@
@
@@
@
@
____ @
/ / <_@
@
@@
@
@
__@
(_)@
@
@@
@
@
_ @
/_)_@
/ @
' @@
@
@
_, @
(_)_@
/> @
|/ @@
@
@
__ @
/ (_@
@
@@
@
@
_ @
/_)_@
@
@@
@
_/_@
/ @
<__ @
@
@@
@
@
. .@
(_/_@
@
@@
@
@
, _@
\\/ @
@
@@
@
@
, , ,@
(_(_/_@
@
@@
@
@
_., @
/ /\\_@
@
@@
@
@
__ ,@
/ (_/_@
/ @
' @@
@
@
__. @
/ |_@
(| @
@@
_/@
_/ @
/ @
/ @
@
@@
/@
/ @
/ @
/ @
@
@@
/ @
/_@
_/ @
/ @
@
@@
_ @
/ \\_/@
@
@
@
@@
o__o@
/ )@
/--/ @
/ (_ @
@
@@
o__o@
/ ')@
/ / @
(__/ @
@
@@
_o o__@
' ) / @
/ / @
(__/ @
@
@@
@
o o @
__. @
(_/|_@
@
@@
@
o o@
__@
(_)@
@
@@
@
o o@
. .@
(_/_@
@
@@
__ @
/ )@
/--< @
_/___/_@
/ @
@@
`
@@ -0,0 +1 @@
{"version":3,"file":"wrap-text.js","sources":["../../../src/icons/wrap-text.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name WrapText\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8bGluZSB4MT0iMyIgeDI9IjIxIiB5MT0iNiIgeTI9IjYiIC8+CiAgPHBhdGggZD0iTTMgMTJoMTVhMyAzIDAgMSAxIDAgNmgtNCIgLz4KICA8cG9seWxpbmUgcG9pbnRzPSIxNiAxNiAxNCAxOCAxNiAyMCIgLz4KICA8bGluZSB4MT0iMyIgeDI9IjEwIiB5MT0iMTgiIHkyPSIxOCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/wrap-text\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 WrapText = createLucideIcon('WrapText', [\n ['line', { x1: '3', x2: '21', y1: '6', y2: '6', key: '4m8b97' }],\n ['path', { d: 'M3 12h15a3 3 0 1 1 0 6h-4', key: '1cl7v7' }],\n ['polyline', { points: '16 16 14 18 16 20', key: '1jznyi' }],\n ['line', { x1: '3', x2: '10', y1: '18', y2: '18', key: '1h33wv' }],\n]);\n\nexport default WrapText;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAC5C,CAAA,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,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC/D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA6B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAE,QAAQ,CAAqB,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,CAC3D,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,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACnE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"ticket-x.js","sources":["../../../src/icons/ticket-x.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name TicketX\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMiA5YTMgMyAwIDAgMSAwIDZ2MmEyIDIgMCAwIDAgMiAyaDE2YTIgMiAwIDAgMCAyLTJ2LTJhMyAzIDAgMCAxIDAtNlY3YTIgMiAwIDAgMC0yLTJINGEyIDIgMCAwIDAtMiAyWiIgLz4KICA8cGF0aCBkPSJtOS41IDE0LjUgNS01IiAvPgogIDxwYXRoIGQ9Im05LjUgOS41IDUgNSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/ticket-x\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 TicketX = createLucideIcon('TicketX', [\n [\n 'path',\n {\n d: 'M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z',\n key: 'qn84l0',\n },\n ],\n ['path', { d: 'm9.5 14.5 5-5', key: 'qviqfa' }],\n ['path', { d: 'm9.5 9.5 5 5', key: '18nt4w' }],\n]);\n\nexport default TicketX;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAC1C,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC/C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"arrow-up-square.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,23 @@
const UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
const UUID_PARSE = /^[0-9A-Fa-f\-]{36}/;
//RFC 4122
const handler = {
scheme: "urn:uuid",
parse: function (urnComponents, options) {
const uuidComponents = urnComponents;
uuidComponents.uuid = uuidComponents.nss;
uuidComponents.nss = undefined;
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
uuidComponents.error = uuidComponents.error || "UUID is not valid.";
}
return uuidComponents;
},
serialize: function (uuidComponents, options) {
const urnComponents = uuidComponents;
//normalize UUID
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
return urnComponents;
},
};
export default handler;
//# sourceMappingURL=urn-uuid.js.map
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Hash = createLucideIcon("Hash", [
["line", { x1: "4", x2: "20", y1: "9", y2: "9", key: "4lhtct" }],
["line", { x1: "4", x2: "20", y1: "15", y2: "15", key: "vyu0kd" }],
["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
["line", { x1: "16", x2: "14", y1: "3", y2: "21", key: "weycgp" }]
]);
export { Hash as default };
//# sourceMappingURL=hash.js.map
@@ -0,0 +1,24 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const ClipboardX = createLucideIcon("ClipboardX", [
["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
[
"path",
{
d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
key: "116196"
}
],
["path", { d: "m15 11-6 6", key: "1toa9n" }],
["path", { d: "m9 11 6 6", key: "wlibny" }]
]);
export { ClipboardX as default };
//# sourceMappingURL=clipboard-x.js.map
@@ -0,0 +1,680 @@
"use strict";
// Run with: npx tsx src/examples/client/elicitationUrlExample.ts
//
// This example demonstrates how to use URL elicitation to securely
// collect user input in a remote (HTTP) server.
// URL elicitation allows servers to prompt the end-user to open a URL in their browser
// to collect sensitive information.
Object.defineProperty(exports, "__esModule", { value: true });
const index_js_1 = require("../../client/index.js");
const streamableHttp_js_1 = require("../../client/streamableHttp.js");
const node_readline_1 = require("node:readline");
const types_js_1 = require("../../types.js");
const metadataUtils_js_1 = require("../../shared/metadataUtils.js");
const simpleOAuthClientProvider_js_1 = require("./simpleOAuthClientProvider.js");
const auth_js_1 = require("../../client/auth.js");
const node_http_1 = require("node:http");
// Set up OAuth (required for this example)
const OAUTH_CALLBACK_PORT = 8090; // Use different port than auth server (3001)
const OAUTH_CALLBACK_URL = `http://localhost:${OAUTH_CALLBACK_PORT}/callback`;
let oauthProvider = undefined;
console.log('Getting OAuth token...');
const clientMetadata = {
client_name: 'Elicitation MCP Client',
redirect_uris: [OAUTH_CALLBACK_URL],
grant_types: ['authorization_code', 'refresh_token'],
response_types: ['code'],
token_endpoint_auth_method: 'client_secret_post',
scope: 'mcp:tools'
};
oauthProvider = new simpleOAuthClientProvider_js_1.InMemoryOAuthClientProvider(OAUTH_CALLBACK_URL, clientMetadata, (redirectUrl) => {
console.log(`\n🔗 Please open this URL in your browser to authorize:\n ${redirectUrl.toString()}`);
});
// Create readline interface for user input
const readline = (0, node_readline_1.createInterface)({
input: process.stdin,
output: process.stdout
});
let abortCommand = new AbortController();
// Global client and transport for interactive commands
let client = null;
let transport = null;
let serverUrl = 'http://localhost:3000/mcp';
let sessionId = undefined;
let isProcessingCommand = false;
let isProcessingElicitations = false;
const elicitationQueue = [];
let elicitationQueueSignal = null;
let elicitationsCompleteSignal = null;
// Map to track pending URL elicitations waiting for completion notifications
const pendingURLElicitations = new Map();
async function main() {
console.log('MCP Interactive Client');
console.log('=====================');
// Connect to server immediately with default settings
await connect();
// Start the elicitation loop in the background
elicitationLoop().catch(error => {
console.error('Unexpected error in elicitation loop:', error);
process.exit(1);
});
// Short delay allowing the server to send any SSE elicitations on connection
await new Promise(resolve => setTimeout(resolve, 200));
// Wait until we are done processing any initial elicitations
await waitForElicitationsToComplete();
// Print help and start the command loop
printHelp();
await commandLoop();
}
async function waitForElicitationsToComplete() {
// Wait until the queue is empty and nothing is being processed
while (elicitationQueue.length > 0 || isProcessingElicitations) {
await new Promise(resolve => setTimeout(resolve, 100));
}
}
function printHelp() {
console.log('\nAvailable commands:');
console.log(' connect [url] - Connect to MCP server (default: http://localhost:3000/mcp)');
console.log(' disconnect - Disconnect from server');
console.log(' terminate-session - Terminate the current session');
console.log(' reconnect - Reconnect to the server');
console.log(' list-tools - List available tools');
console.log(' call-tool <name> [args] - Call a tool with optional JSON arguments');
console.log(' payment-confirm - Test URL elicitation via error response with payment-confirm tool');
console.log(' third-party-auth - Test tool that requires third-party OAuth credentials');
console.log(' help - Show this help');
console.log(' quit - Exit the program');
}
async function commandLoop() {
await new Promise(resolve => {
if (!isProcessingElicitations) {
resolve();
}
else {
elicitationsCompleteSignal = resolve;
}
});
readline.question('\n> ', { signal: abortCommand.signal }, async (input) => {
isProcessingCommand = true;
const args = input.trim().split(/\s+/);
const command = args[0]?.toLowerCase();
try {
switch (command) {
case 'connect':
await connect(args[1]);
break;
case 'disconnect':
await disconnect();
break;
case 'terminate-session':
await terminateSession();
break;
case 'reconnect':
await reconnect();
break;
case 'list-tools':
await listTools();
break;
case 'call-tool':
if (args.length < 2) {
console.log('Usage: call-tool <name> [args]');
}
else {
const toolName = args[1];
let toolArgs = {};
if (args.length > 2) {
try {
toolArgs = JSON.parse(args.slice(2).join(' '));
}
catch {
console.log('Invalid JSON arguments. Using empty args.');
}
}
await callTool(toolName, toolArgs);
}
break;
case 'payment-confirm':
await callPaymentConfirmTool();
break;
case 'third-party-auth':
await callThirdPartyAuthTool();
break;
case 'help':
printHelp();
break;
case 'quit':
case 'exit':
await cleanup();
return;
default:
if (command) {
console.log(`Unknown command: ${command}`);
}
break;
}
}
catch (error) {
console.error(`Error executing command: ${error}`);
}
finally {
isProcessingCommand = false;
}
// Process another command after we've processed the this one
await commandLoop();
});
}
async function elicitationLoop() {
while (true) {
// Wait until we have elicitations to process
await new Promise(resolve => {
if (elicitationQueue.length > 0) {
resolve();
}
else {
elicitationQueueSignal = resolve;
}
});
isProcessingElicitations = true;
abortCommand.abort(); // Abort the command loop if it's running
// Process all queued elicitations
while (elicitationQueue.length > 0) {
const queued = elicitationQueue.shift();
console.log(`📤 Processing queued elicitation (${elicitationQueue.length} remaining)`);
try {
const result = await handleElicitationRequest(queued.request);
queued.resolve(result);
}
catch (error) {
queued.reject(error instanceof Error ? error : new Error(String(error)));
}
}
console.log('✅ All queued elicitations processed. Resuming command loop...\n');
isProcessingElicitations = false;
// Reset the abort controller for the next command loop
abortCommand = new AbortController();
// Resume the command loop
if (elicitationsCompleteSignal) {
elicitationsCompleteSignal();
elicitationsCompleteSignal = null;
}
}
}
/**
* Enqueues an elicitation request and returns the result.
*
* This function is used so that our CLI (which can only handle one input request at a time)
* can handle elicitation requests and the command loop.
*
* @param request - The elicitation request to be handled
* @returns The elicitation result
*/
async function elicitationRequestHandler(request) {
// If we are processing a command, handle this elicitation immediately
if (isProcessingCommand) {
console.log('📋 Processing elicitation immediately (during command execution)');
return await handleElicitationRequest(request);
}
// Otherwise, queue the request to be handled by the elicitation loop
console.log(`📥 Queueing elicitation request (queue size will be: ${elicitationQueue.length + 1})`);
return new Promise((resolve, reject) => {
elicitationQueue.push({
request,
resolve,
reject
});
// Signal the elicitation loop that there's work to do
if (elicitationQueueSignal) {
elicitationQueueSignal();
elicitationQueueSignal = null;
}
});
}
/**
* Handles an elicitation request.
*
* This function is used to handle the elicitation request and return the result.
*
* @param request - The elicitation request to be handled
* @returns The elicitation result
*/
async function handleElicitationRequest(request) {
const mode = request.params.mode;
console.log('\n🔔 Elicitation Request Received:');
console.log(`Mode: ${mode}`);
if (mode === 'url') {
return {
action: await handleURLElicitation(request.params)
};
}
else {
// Should not happen because the client declares its capabilities to the server,
// but being defensive is a good practice:
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Unsupported elicitation mode: ${mode}`);
}
}
/**
* Handles a URL elicitation by opening the URL in the browser.
*
* Note: This is a shared code for both request handlers and error handlers.
* As a result of sharing schema, there is no big forking of logic for the client.
*
* @param params - The URL elicitation request parameters
* @returns The action to take (accept, cancel, or decline)
*/
async function handleURLElicitation(params) {
const url = params.url;
const elicitationId = params.elicitationId;
const message = params.message;
console.log(`🆔 Elicitation ID: ${elicitationId}`); // Print for illustration
// Parse URL to show domain for security
let domain = 'unknown domain';
try {
const parsedUrl = new URL(url);
domain = parsedUrl.hostname;
}
catch {
console.error('Invalid URL provided by server');
return 'decline';
}
// Example security warning to help prevent phishing attacks
console.log('\n⚠️ \x1b[33mSECURITY WARNING\x1b[0m ⚠️');
console.log('\x1b[33mThe server is requesting you to open an external URL.\x1b[0m');
console.log('\x1b[33mOnly proceed if you trust this server and understand why it needs this.\x1b[0m\n');
console.log(`🌐 Target domain: \x1b[36m${domain}\x1b[0m`);
console.log(`🔗 Full URL: \x1b[36m${url}\x1b[0m`);
console.log(`\nℹ️ Server's reason:\n\n\x1b[36m${message}\x1b[0m\n`);
// 1. Ask for user consent to open the URL
const consent = await new Promise(resolve => {
readline.question('\nDo you want to open this URL in your browser? (y/n): ', input => {
resolve(input.trim().toLowerCase());
});
});
// 2. If user did not consent, return appropriate result
if (consent === 'no' || consent === 'n') {
console.log('❌ URL navigation declined.');
return 'decline';
}
else if (consent !== 'yes' && consent !== 'y') {
console.log('🚫 Invalid response. Cancelling elicitation.');
return 'cancel';
}
// 3. Wait for completion notification in the background
const completionPromise = new Promise((resolve, reject) => {
const timeout = setTimeout(() => {
pendingURLElicitations.delete(elicitationId);
console.log(`\x1b[31m❌ Elicitation ${elicitationId} timed out waiting for completion.\x1b[0m`);
reject(new Error('Elicitation completion timeout'));
}, 5 * 60 * 1000); // 5 minute timeout
pendingURLElicitations.set(elicitationId, {
resolve: () => {
clearTimeout(timeout);
resolve();
},
reject,
timeout
});
});
completionPromise.catch(error => {
console.error('Background completion wait failed:', error);
});
// 4. Direct user to open the URL in their browser
console.log(`\n🔗 Please open this URL in your browser:\n ${url}`);
console.log('\n⏳ Waiting for you to complete the interaction in your browser...');
console.log(' The server will send a notification once you complete the action.');
// 5. Acknowledge the user accepted the elicitation
return 'accept';
}
/**
* Example OAuth callback handler - in production, use a more robust approach
* for handling callbacks and storing tokens
*/
/**
* Starts a temporary HTTP server to receive the OAuth callback
*/
async function waitForOAuthCallback() {
return new Promise((resolve, reject) => {
const server = (0, node_http_1.createServer)((req, res) => {
// Ignore favicon requests
if (req.url === '/favicon.ico') {
res.writeHead(404);
res.end();
return;
}
console.log(`📥 Received callback: ${req.url}`);
const parsedUrl = new URL(req.url || '', 'http://localhost');
const code = parsedUrl.searchParams.get('code');
const error = parsedUrl.searchParams.get('error');
if (code) {
console.log(`✅ Authorization code received: ${code?.substring(0, 10)}...`);
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(`
<html>
<body>
<h1>Authorization Successful!</h1>
<p>This simulates successful authorization of the MCP client, which now has an access token for the MCP server.</p>
<p>This window will close automatically in 10 seconds.</p>
<script>setTimeout(() => window.close(), 10000);</script>
</body>
</html>
`);
resolve(code);
setTimeout(() => server.close(), 15000);
}
else if (error) {
console.log(`❌ Authorization error: ${error}`);
res.writeHead(400, { 'Content-Type': 'text/html' });
res.end(`
<html>
<body>
<h1>Authorization Failed</h1>
<p>Error: ${error}</p>
</body>
</html>
`);
reject(new Error(`OAuth authorization failed: ${error}`));
}
else {
console.log(`❌ No authorization code or error in callback`);
res.writeHead(400);
res.end('Bad request');
reject(new Error('No authorization code provided'));
}
});
server.listen(OAUTH_CALLBACK_PORT, () => {
console.log(`OAuth callback server started on http://localhost:${OAUTH_CALLBACK_PORT}`);
});
});
}
/**
* Attempts to connect to the MCP server with OAuth authentication.
* Handles OAuth flow recursively if authorization is required.
*/
async function attemptConnection(oauthProvider) {
console.log('🚢 Creating transport with OAuth provider...');
const baseUrl = new URL(serverUrl);
transport = new streamableHttp_js_1.StreamableHTTPClientTransport(baseUrl, {
sessionId: sessionId,
authProvider: oauthProvider
});
console.log('🚢 Transport created');
try {
console.log('🔌 Attempting connection (this will trigger OAuth redirect if needed)...');
await client.connect(transport);
sessionId = transport.sessionId;
console.log('Transport created with session ID:', sessionId);
console.log('✅ Connected successfully');
}
catch (error) {
if (error instanceof auth_js_1.UnauthorizedError) {
console.log('🔐 OAuth required - waiting for authorization...');
const callbackPromise = waitForOAuthCallback();
const authCode = await callbackPromise;
await transport.finishAuth(authCode);
console.log('🔐 Authorization code received:', authCode);
console.log('🔌 Reconnecting with authenticated transport...');
// Recursively retry connection after OAuth completion
await attemptConnection(oauthProvider);
}
else {
console.error('❌ Connection failed with non-auth error:', error);
throw error;
}
}
}
async function connect(url) {
if (client) {
console.log('Already connected. Disconnect first.');
return;
}
if (url) {
serverUrl = url;
}
console.log(`🔗 Attempting to connect to ${serverUrl}...`);
// Create a new client with elicitation capability
console.log('👤 Creating MCP client...');
client = new index_js_1.Client({
name: 'example-client',
version: '1.0.0'
}, {
capabilities: {
elicitation: {
// Only URL elicitation is supported in this demo
// (see server/elicitationExample.ts for a demo of form mode elicitation)
url: {}
}
}
});
console.log('👤 Client created');
// Set up elicitation request handler with proper validation
client.setRequestHandler(types_js_1.ElicitRequestSchema, elicitationRequestHandler);
// Set up notification handler for elicitation completion
client.setNotificationHandler(types_js_1.ElicitationCompleteNotificationSchema, notification => {
const { elicitationId } = notification.params;
const pending = pendingURLElicitations.get(elicitationId);
if (pending) {
clearTimeout(pending.timeout);
pendingURLElicitations.delete(elicitationId);
console.log(`\x1b[32m✅ Elicitation ${elicitationId} completed!\x1b[0m`);
pending.resolve();
}
else {
// Shouldn't happen - discard it!
console.warn(`Received completion notification for unknown elicitation: ${elicitationId}`);
}
});
try {
console.log('🔐 Starting OAuth flow...');
await attemptConnection(oauthProvider);
console.log('Connected to MCP server');
// Set up error handler after connection is established so we don't double log errors
client.onerror = error => {
console.error('\x1b[31mClient error:', error, '\x1b[0m');
};
}
catch (error) {
console.error('Failed to connect:', error);
client = null;
transport = null;
return;
}
}
async function disconnect() {
if (!client || !transport) {
console.log('Not connected.');
return;
}
try {
await transport.close();
console.log('Disconnected from MCP server');
client = null;
transport = null;
}
catch (error) {
console.error('Error disconnecting:', error);
}
}
async function terminateSession() {
if (!client || !transport) {
console.log('Not connected.');
return;
}
try {
console.log('Terminating session with ID:', transport.sessionId);
await transport.terminateSession();
console.log('Session terminated successfully');
// Check if sessionId was cleared after termination
if (!transport.sessionId) {
console.log('Session ID has been cleared');
sessionId = undefined;
// Also close the transport and clear client objects
await transport.close();
console.log('Transport closed after session termination');
client = null;
transport = null;
}
else {
console.log('Server responded with 405 Method Not Allowed (session termination not supported)');
console.log('Session ID is still active:', transport.sessionId);
}
}
catch (error) {
console.error('Error terminating session:', error);
}
}
async function reconnect() {
if (client) {
await disconnect();
}
await connect();
}
async function listTools() {
if (!client) {
console.log('Not connected to server.');
return;
}
try {
const toolsRequest = {
method: 'tools/list',
params: {}
};
const toolsResult = await client.request(toolsRequest, types_js_1.ListToolsResultSchema);
console.log('Available tools:');
if (toolsResult.tools.length === 0) {
console.log(' No tools available');
}
else {
for (const tool of toolsResult.tools) {
console.log(` - id: ${tool.name}, name: ${(0, metadataUtils_js_1.getDisplayName)(tool)}, description: ${tool.description}`);
}
}
}
catch (error) {
console.log(`Tools not supported by this server (${error})`);
}
}
async function callTool(name, args) {
if (!client) {
console.log('Not connected to server.');
return;
}
try {
const request = {
method: 'tools/call',
params: {
name,
arguments: args
}
};
console.log(`Calling tool '${name}' with args:`, args);
const result = await client.request(request, types_js_1.CallToolResultSchema);
console.log('Tool result:');
const resourceLinks = [];
result.content.forEach(item => {
if (item.type === 'text') {
console.log(` ${item.text}`);
}
else if (item.type === 'resource_link') {
const resourceLink = item;
resourceLinks.push(resourceLink);
console.log(` 📁 Resource Link: ${resourceLink.name}`);
console.log(` URI: ${resourceLink.uri}`);
if (resourceLink.mimeType) {
console.log(` Type: ${resourceLink.mimeType}`);
}
if (resourceLink.description) {
console.log(` Description: ${resourceLink.description}`);
}
}
else if (item.type === 'resource') {
console.log(` [Embedded Resource: ${item.resource.uri}]`);
}
else if (item.type === 'image') {
console.log(` [Image: ${item.mimeType}]`);
}
else if (item.type === 'audio') {
console.log(` [Audio: ${item.mimeType}]`);
}
else {
console.log(` [Unknown content type]:`, item);
}
});
// Offer to read resource links
if (resourceLinks.length > 0) {
console.log(`\nFound ${resourceLinks.length} resource link(s). Use 'read-resource <uri>' to read their content.`);
}
}
catch (error) {
if (error instanceof types_js_1.UrlElicitationRequiredError) {
console.log('\n🔔 Elicitation Required Error Received:');
console.log(`Message: ${error.message}`);
for (const e of error.elicitations) {
await handleURLElicitation(e); // For the error handler, we discard the action result because we don't respond to an error response
}
return;
}
console.log(`Error calling tool ${name}: ${error}`);
}
}
async function cleanup() {
if (client && transport) {
try {
// First try to terminate the session gracefully
if (transport.sessionId) {
try {
console.log('Terminating session before exit...');
await transport.terminateSession();
console.log('Session terminated successfully');
}
catch (error) {
console.error('Error terminating session:', error);
}
}
// Then close the transport
await transport.close();
}
catch (error) {
console.error('Error closing transport:', error);
}
}
process.stdin.setRawMode(false);
readline.close();
console.log('\nGoodbye!');
process.exit(0);
}
async function callPaymentConfirmTool() {
console.log('Calling payment-confirm tool...');
await callTool('payment-confirm', { cartId: 'cart_123' });
}
async function callThirdPartyAuthTool() {
console.log('Calling third-party-auth tool...');
await callTool('third-party-auth', { param1: 'test' });
}
// Set up raw mode for keyboard input to capture Escape key
process.stdin.setRawMode(true);
process.stdin.on('data', async (data) => {
// Check for Escape key (27)
if (data.length === 1 && data[0] === 27) {
console.log('\nESC key pressed. Disconnecting from server...');
// Abort current operation and disconnect from server
if (client && transport) {
await disconnect();
console.log('Disconnected. Press Enter to continue.');
}
else {
console.log('Not connected to server.');
}
// Re-display the prompt
process.stdout.write('> ');
}
});
// Handle Ctrl+C
process.on('SIGINT', async () => {
console.log('\nReceived SIGINT. Cleaning up...');
await cleanup();
});
// Start the interactive client
main().catch((error) => {
console.error('Error running MCP client:', error);
process.exit(1);
});
//# sourceMappingURL=elicitationUrlExample.js.map
@@ -0,0 +1 @@
{"version":3,"file":"validation_error.js","sourceRoot":"","sources":["../../lib/runtime/validation_error.ts"],"names":[],"mappings":";;AAEA,MAAqB,eAAgB,SAAQ,KAAK;IAKhD,YAAY,MAA8B;QACxC,KAAK,CAAC,mBAAmB,CAAC,CAAA;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;IACnC,CAAC;CACF;AAVD,kCAUC"}
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iCAAiC,CAAA;AAKpE,MAAM,MAAM,QAAQ,GAChB,KAAK,GACL,SAAS,GACT,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,SAAS,GACT,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iCAAiC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,4CAA4C;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,8DAA8D;IAC9D,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,qEAAqE;IACrE,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,kBAAkB;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,4CAA4C;IAC5C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IAC1B,kEAAkE;IAClE,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,qDAAqD;IACrD,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,gCAAgC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,eAAO,MAAM,SAAS;QACjB,MAAM,WACA,MAAM,YACN,gBAAgB;;;sBAuDf,MAAM,YAAW,gBAAgB,MAC1C,GAAG,MAAM;oBAOkB,gBAAgB,KAAG,OAAO,SAAS;2BAoEtD,MAAM,YACN,gBAAgB;kBAgBnB,MAAM,EAAE,WACL,MAAM,YACN,gBAAgB;;;;CA5I1B,CAAA;AA6BD,MAAM,MAAM,GAAG,GAAG,IAAI,GAAG,GAAG,CAAA;AAQ5B,eAAO,MAAM,GAAG,KAC+C,CAAA;AAG/D,eAAO,MAAM,QAAQ,eAAwB,CAAA;AAG7C,eAAO,MAAM,MAAM,GAChB,SAAS,MAAM,EAAE,UAAS,gBAAqB,MAC/C,GAAG,MAAM,YACsB,CAAA;AAMlC,eAAO,MAAM,QAAQ,GAAI,KAAK,gBAAgB,KAAG,OAAO,SAsDvD,CAAA;AAaD,eAAO,MAAM,WAAW,GACtB,SAAS,MAAM,EACf,UAAS,gBAAqB,aAY/B,CAAA;AAGD,eAAO,MAAM,KAAK,GAChB,MAAM,MAAM,EAAE,EACd,SAAS,MAAM,EACf,UAAS,gBAAqB,aAQ/B,CAAA;AAqGD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,EAAE,MAAM,CAAA;IACT,SAAS,EAAE,OAAO,CAAA;IAClB,uBAAuB,EAAE,OAAO,CAAA;IAChC,SAAS,EAAE,IAAI,GAAG,SAAS,CAAA;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB,CAAA;AAOD,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,QAAQ,CAAA;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAA;AAuFvD;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,GAAG,GAAG,IAAI,GAAG,MAAM,CAAA;AAyB1C;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,WAAW,EAAE,CAAA;IACnB,IAAI,EAAE,WAAW,EAAE,CAAA;IACnB,IAAI,EAAE,WAAW,EAAE,CAAA;IACnB,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,CAAA;CACnD,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,KAAK,CAAA;AAOrD,qBAAa,SAAS;;IACpB,OAAO,EAAE,gBAAgB,CAAA;IACzB,GAAG,EAAE,mBAAmB,EAAE,EAAE,CAAA;IAC5B,OAAO,EAAE,MAAM,CAAA;IAEf,oBAAoB,EAAE,OAAO,CAAA;IAC7B,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,OAAO,CAAA;IACd,uBAAuB,EAAE,OAAO,CAAA;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,EAAE,MAAM,EAAE,EAAE,CAAA;IACrB,MAAM,EAAE,OAAO,CAAA;IAEf,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;IAClB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;gBAuBhB,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAoH3D,QAAQ,IAAI,OAAO;IAYnB,IAAI;IAmGJ,SAAS;IA8CT,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IA8BhC,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IAiB/C,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IA4StC,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IA+F1C,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE;IAqBxD,UAAU,CACR,CAAC,EAAE,MAAM,EAAE,EACX,CAAC,EAAE,MAAM,EAAE,EACX,YAAY,GAAE,OAAe,GAC5B,KAAK,GAAG,MAAM,EAAE;IA+CnB,WAAW;IAubX,WAAW;IAIX,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;IAsDnC,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,UAAe;IAqFvC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,gBAAgB;CAGtC;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,YAAY,EAAE,IAAI,EAAE,CAAA"}
@@ -0,0 +1,13 @@
import { ZodSetDef } from "zod/v3";
import { ErrorMessages } from "../errorMessages.js";
import { JsonSchema7Type } from "../parseTypes.js";
import { Refs } from "../Refs.js";
export type JsonSchema7SetType = {
type: "array";
uniqueItems: true;
items?: JsonSchema7Type;
minItems?: number;
maxItems?: number;
errorMessage?: ErrorMessages<JsonSchema7SetType>;
};
export declare function parseSetDef(def: ZodSetDef, refs: Refs): JsonSchema7SetType;