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,885 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
test("type inference", () => {
const booleanRecord = z.record(z.string(), z.boolean());
type booleanRecord = typeof booleanRecord._output;
const recordWithEnumKeys = z.record(z.enum(["Tuna", "Salmon"]), z.string());
type recordWithEnumKeys = z.infer<typeof recordWithEnumKeys>;
const recordWithLiteralKey = z.record(z.literal(["Tuna", "Salmon", 21]), z.string());
type recordWithLiteralKey = z.infer<typeof recordWithLiteralKey>;
const recordWithLiteralUnionKeys = z.record(
z.union([z.literal("Tuna"), z.literal("Salmon"), z.literal(21)]),
z.string()
);
type recordWithLiteralUnionKeys = z.infer<typeof recordWithLiteralUnionKeys>;
enum Enum {
Tuna = 0,
Salmon = "Shark",
}
const recordWithTypescriptEnum = z.record(z.enum(Enum), z.string());
type recordWithTypescriptEnum = z.infer<typeof recordWithTypescriptEnum>;
expectTypeOf<booleanRecord>().toEqualTypeOf<Record<string, boolean>>();
expectTypeOf<recordWithEnumKeys>().toEqualTypeOf<Record<"Tuna" | "Salmon", string>>();
expectTypeOf<recordWithLiteralKey>().toEqualTypeOf<Record<"Tuna" | "Salmon" | 21, string>>();
expectTypeOf<recordWithLiteralUnionKeys>().toEqualTypeOf<Record<"Tuna" | "Salmon" | 21, string>>();
expectTypeOf<recordWithTypescriptEnum>().toEqualTypeOf<Record<Enum, string>>();
});
test("enum exhaustiveness", () => {
const schema = z.record(z.enum(["Tuna", "Salmon"]), z.string());
expect(
schema.parse({
Tuna: "asdf",
Salmon: "asdf",
})
).toEqual({
Tuna: "asdf",
Salmon: "asdf",
});
expect(schema.safeParse({ Tuna: "asdf", Salmon: "asdf", Trout: "asdf" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "unrecognized_keys",
"keys": [
"Trout"
],
"path": [],
"message": "Unrecognized key: \\"Trout\\""
}
]],
"success": false,
}
`);
expect(schema.safeParse({ Tuna: "asdf" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"Salmon"
],
"message": "Invalid input: expected string, received undefined"
}
]],
"success": false,
}
`);
});
test("optional-in value type", () => {
const defaulted = z.record(z.enum(["Tuna", "Salmon"]), z.string().default("unknown"));
expectTypeOf<z.input<typeof defaulted>>().toEqualTypeOf<Partial<Record<"Tuna" | "Salmon", string | undefined>>>();
expectTypeOf<z.output<typeof defaulted>>().toEqualTypeOf<Record<"Tuna" | "Salmon", string>>();
expect(defaulted.parse({ Tuna: "asdf" })).toEqual({ Tuna: "asdf", Salmon: "unknown" });
const prefaulted = z.record(z.enum(["Tuna", "Salmon"]), z.string().prefault("unknown"));
expectTypeOf<z.input<typeof prefaulted>>().toEqualTypeOf<Partial<Record<"Tuna" | "Salmon", string | undefined>>>();
expect(prefaulted.parse({ Tuna: "asdf" })).toEqual({ Tuna: "asdf", Salmon: "unknown" });
const optional = z.record(z.enum(["Tuna", "Salmon"]), z.string().optional());
expectTypeOf<z.input<typeof optional>>().toEqualTypeOf<Partial<Record<"Tuna" | "Salmon", string | undefined>>>();
// toStrictEqual, not toEqual: an exhaustive record assigns every key, and toEqual cannot tell an absent key from one holding undefined.
expect(optional.parse({ Tuna: "asdf" })).toStrictEqual({ Tuna: "asdf", Salmon: undefined });
// A value that needs a slot keeps the key required, and a non-enumerable key stays an index signature either way.
const required = z.record(z.enum(["Tuna", "Salmon"]), z.string());
expectTypeOf<z.input<typeof required>>().toEqualTypeOf<Record<"Tuna" | "Salmon", string>>();
const indexed = z.record(z.string(), z.string().default("unknown"));
expectTypeOf<z.input<typeof indexed>>().toEqualTypeOf<Record<string, string | undefined>>();
// A catch and a preprocess pipe declare no static optin, so the key stays required even where the parser can fill it. The static predicate and the one the JSON Schema emitter uses resolve these differently, and the two have to keep agreeing.
const caught = z.record(z.enum(["Tuna", "Salmon"]), z.string().catch("unknown"));
expectTypeOf<z.input<typeof caught>>().toEqualTypeOf<Record<"Tuna" | "Salmon", string>>();
const preprocessed = z.record(
z.enum(["Tuna", "Salmon"]),
z.preprocess((v) => v, z.string())
);
expectTypeOf<z.input<typeof preprocessed>>().toEqualTypeOf<Record<"Tuna" | "Salmon", unknown>>();
});
test("typescript enum exhaustiveness", () => {
enum BigFish {
Tuna = 0,
Salmon = "Shark",
}
const schema = z.record(z.enum(BigFish), z.string());
const value = {
[BigFish.Tuna]: "asdf",
[BigFish.Salmon]: "asdf",
};
expect(schema.parse(value)).toEqual(value);
expect(schema.safeParse({ [BigFish.Tuna]: "asdf", [BigFish.Salmon]: "asdf", Trout: "asdf" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "unrecognized_keys",
"keys": [
"Trout"
],
"path": [],
"message": "Unrecognized key: \\"Trout\\""
}
]],
"success": false,
}
`);
expect(schema.safeParse({ [BigFish.Tuna]: "asdf" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"Shark"
],
"message": "Invalid input: expected string, received undefined"
}
]],
"success": false,
}
`);
expect(schema.safeParse({ [BigFish.Salmon]: "asdf" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "string",
"code": "invalid_type",
"path": [
0
],
"message": "Invalid input: expected string, received undefined"
}
]],
"success": false,
}
`);
});
test("literal exhaustiveness", () => {
const schema = z.record(z.literal(["Tuna", "Salmon", 21]), z.string());
schema.parse({
Tuna: "asdf",
Salmon: "asdf",
21: "asdf",
});
expect(schema.safeParse({ Tuna: "asdf", Salmon: "asdf", 21: "asdf", Trout: "asdf" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "unrecognized_keys",
"keys": [
"Trout"
],
"path": [],
"message": "Unrecognized key: \\"Trout\\""
}
]],
"success": false,
}
`);
expect(schema.safeParse({ Tuna: "asdf" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"Salmon"
],
"message": "Invalid input: expected string, received undefined"
},
{
"expected": "string",
"code": "invalid_type",
"path": [
21
],
"message": "Invalid input: expected string, received undefined"
}
]],
"success": false,
}
`);
});
test("pipe exhaustiveness", () => {
const schema = z.record(z.enum(["Tuna", "Salmon"]).pipe(z.any()), z.string());
expect(schema.parse({ Tuna: "asdf", Salmon: "asdf" })).toEqual({
Tuna: "asdf",
Salmon: "asdf",
});
expect(schema.safeParse({ Tuna: "asdf", Salmon: "asdf", Trout: "asdf" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "unrecognized_keys",
"keys": [
"Trout"
],
"path": [],
"message": "Unrecognized key: \\"Trout\\""
}
]],
"success": false,
}
`);
expect(schema.safeParse({ Tuna: "asdf" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"Salmon"
],
"message": "Invalid input: expected string, received undefined"
}
]],
"success": false,
}
`);
});
test("union exhaustiveness", () => {
const schema = z.record(z.union([z.literal("Tuna"), z.literal("Salmon"), z.literal(21)]), z.string());
expect(schema.parse({ Tuna: "asdf", Salmon: "asdf", 21: "asdf" })).toEqual({
Tuna: "asdf",
Salmon: "asdf",
21: "asdf",
});
expect(schema.safeParse({ Tuna: "asdf", Salmon: "asdf", 21: "asdf", Trout: "asdf" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "unrecognized_keys",
"keys": [
"Trout"
],
"path": [],
"message": "Unrecognized key: \\"Trout\\""
}
]],
"success": false,
}
`);
expect(schema.safeParse({ Tuna: "asdf" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"Salmon"
],
"message": "Invalid input: expected string, received undefined"
},
{
"expected": "string",
"code": "invalid_type",
"path": [
21
],
"message": "Invalid input: expected string, received undefined"
}
]],
"success": false,
}
`);
});
test("applies transforms on the key schema (#5296)", () => {
const single = z.record(
z.literal("a").transform(() => "b" as const),
z.string()
);
expect(single.parse({ a: "John" })).toEqual({ b: "John" });
const multi = z.record(
z.literal(["a", "b"]).transform((k) => k.toUpperCase()),
z.number()
);
expect(multi.parse({ a: 1, b: 2 })).toEqual({ A: 1, B: 2 });
// required-key semantics still hold when the keyType has a known value set
expect(multi.safeParse({ a: 1 }).success).toBe(false);
const en = z.record(
z.enum(["a", "b"]).transform((k) => k.toUpperCase()),
z.number()
);
expect(en.parse({ a: 1, b: 2 })).toEqual({ A: 1, B: 2 });
// matches partialRecord, which already applied transforms
const part = z.partialRecord(
z.literal("a").transform(() => "b" as const),
z.string()
);
expect(part.parse({ a: "John" })).toEqual({ b: "John" });
});
test("surfaces key schema refinement failures as invalid_key", () => {
// refine rejects "b" but it's still in the literal's value set
const schema = z.record(
z.literal(["a", "b"]).refine((k) => k === "a", { message: "only 'a' is allowed" }),
z.string()
);
expect(schema.safeParse({ a: "ok", b: "nope" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "invalid_key",
"origin": "record",
"issues": [
{
"code": "custom",
"path": [],
"message": "only 'a' is allowed"
}
],
"path": [
"b"
],
"message": "Invalid key in record"
}
]],
"success": false,
}
`);
});
test("string record parse - pass", () => {
const schema = z.record(z.string(), z.boolean());
schema.parse({
k1: true,
k2: false,
1234: false,
});
expect(schema.safeParse({ asdf: 1234 }).success).toEqual(false);
expect(schema.safeParse("asdf")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "record",
"code": "invalid_type",
"path": [],
"message": "Invalid input: expected record, received string"
}
]],
"success": false,
}
`);
});
test("key and value getters", () => {
const rec = z.record(z.string(), z.number());
rec.keyType.parse("asdf");
rec.valueType.parse(1234);
});
test("is not vulnerable to prototype pollution", async () => {
const rec = z.record(
z.string(),
z.object({
a: z.string(),
})
);
const data = JSON.parse(`
{
"__proto__": {
"a": "evil"
},
"b": {
"a": "good"
}
}
`);
const obj1 = rec.parse(data);
expect(obj1.a).toBeUndefined();
const obj2 = rec.safeParse(data);
expect(obj2.success).toBe(true);
if (obj2.success) {
expect(obj2.data.a).toBeUndefined();
}
const obj3 = await rec.parseAsync(data);
expect(obj3.a).toBeUndefined();
const obj4 = await rec.safeParseAsync(data);
expect(obj4.success).toBe(true);
if (obj4.success) {
expect(obj4.data.a).toBeUndefined();
}
});
test("key schema cannot normalize an input key into __proto__", async () => {
const value = z.object({ a: z.string() });
const payload = { a: "evil" };
const wire = (key: string) => JSON.parse(JSON.stringify({ [key]: payload }));
const cases = [
[z.record(z.string().toLowerCase(), value), wire("__PROTO__")],
[z.record(z.string().trim(), value), wire(" __proto__ ")],
[z.record(z.string().normalize("NFKC"), value), wire("__proto__")],
[
z.record(
z.string().transform((s) => s.slice(2)),
value
),
wire("x:__proto__"),
],
] as const;
for (const [schema, data] of cases) {
const result = schema.parse(data);
expect(Object.getPrototypeOf(result)).toBe(Object.prototype);
expect(Object.keys(result)).toEqual([]);
expect((result as any).a).toBeUndefined();
expect(Object.getPrototypeOf(await schema.parseAsync(data))).toBe(Object.prototype);
}
// an async value schema takes the promise write path
const asyncValue = z.record(
z.string().toLowerCase(),
value.refine(async () => true)
);
expect(Object.getPrototypeOf(await asyncValue.parseAsync(wire("__PROTO__")))).toBe(Object.prototype);
// ordinary normalization still lands as an own key
expect(z.record(z.string().toLowerCase(), value).parse({ KEY: payload })).toEqual({ key: payload });
});
test("dont remove undefined values", () => {
const result1 = z.record(z.string(), z.any()).parse({ foo: undefined });
expect(result1).toEqual({
foo: undefined,
});
});
test("allow undefined values", () => {
const schema = z.record(z.string(), z.undefined());
expect(
Object.keys(
schema.parse({
_test: undefined,
})
)
).toEqual(["_test"]);
});
test("async parsing", async () => {
const schema = z
.record(
z.string(),
z
.string()
.optional()
.refine(async () => true)
)
.refine(async () => true);
const data = {
foo: "bar",
baz: "qux",
};
const result = await schema.safeParseAsync(data);
expect(result.data).toEqual(data);
});
test("async parsing", async () => {
const schema = z
.record(
z.string(),
z
.string()
.optional()
.refine(async () => false)
)
.refine(async () => false);
const data = {
foo: "bar",
baz: "qux",
};
const result = await schema.safeParseAsync(data);
expect(result.success).toEqual(false);
expect(result.error).toMatchInlineSnapshot(`
[ZodError: [
{
"code": "custom",
"path": [
"foo"
],
"message": "Invalid input"
},
{
"code": "custom",
"path": [
"baz"
],
"message": "Invalid input"
},
{
"code": "custom",
"path": [],
"message": "Invalid input"
}
]]
`);
});
test("partial record", () => {
const schema = z.partialRecord(z.string(), z.string());
type schema = z.infer<typeof schema>;
expectTypeOf<schema>().toEqualTypeOf<Partial<Record<string, string>>>();
const Keys = z.enum(["id", "name", "email"]); //.or(z.never());
const Person = z.partialRecord(Keys, z.string());
expectTypeOf<z.infer<typeof Person>>().toEqualTypeOf<Partial<Record<"id" | "name" | "email", string>>>();
Person.parse({
id: "123",
// name: "John",
// email: "john@example.com",
});
Person.parse({
// id: "123",
// name: "John",
email: "john@example.com",
});
expect(Person.def.keyType._zod.def.type).toEqual("enum");
});
test("partialRecord with z.literal([key, ...])", () => {
const Keys = z.literal(["id", "name", "email"]);
const schema = z.partialRecord(Keys, z.string());
type Schema = z.infer<typeof schema>;
expectTypeOf<Schema>().toEqualTypeOf<Partial<Record<"id" | "name" | "email", string>>>();
// Should parse valid partials
expect(schema.parse({})).toEqual({});
expect(schema.parse({ id: "1" })).toEqual({ id: "1" });
expect(schema.parse({ name: "n", email: "e@example.com" })).toEqual({ name: "n", email: "e@example.com" });
// Should fail with unrecognized key, error checked via inline snapshot
expect(schema.safeParse({ foo: "bar" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "unrecognized_keys",
"keys": [
"foo"
],
"path": [],
"message": "Unrecognized key: \\"foo\\""
}
]],
"success": false,
}
`);
});
test("partialRecord with numeric literal keys", () => {
const Keys = z.literal([1, 2, 3]);
const schema = z.partialRecord(Keys, z.string());
type Schema = z.infer<typeof schema>;
expectTypeOf<Schema>().toEqualTypeOf<Partial<Record<1 | 2 | 3, string>>>();
// Should parse valid partials with numeric keys (as strings in JS objects)
expect(schema.parse({})).toEqual({});
expect(schema.parse({ 1: "one" })).toEqual({ 1: "one" });
expect(schema.parse({ 2: "two", 3: "three" })).toEqual({ 2: "two", 3: "three" });
// Should fail with unrecognized key
expect(schema.safeParse({ 4: "four" }).success).toBe(false);
});
test("partialRecord with union of string and numeric literal keys", () => {
const StringKeys = z.literal(["a", "b", "c"]);
const NumericKeys = z.literal([1, 2, 3]);
const schema = z.partialRecord(z.union([StringKeys, NumericKeys]), z.string());
type Schema = z.infer<typeof schema>;
expectTypeOf<Schema>().toEqualTypeOf<Partial<Record<"a" | "b" | "c" | 1 | 2 | 3, string>>>();
// Should parse valid partials with mixed keys
expect(schema.parse({})).toEqual({});
expect(schema.parse({ a: "1", 2: "4" })).toEqual({ a: "1", 2: "4" });
expect(schema.parse({ a: "a", b: "b", 1: "1", 2: "2" })).toEqual({ a: "a", b: "b", 1: "1", 2: "2" });
// Should fail with unrecognized key
expect(schema.safeParse({ d: "d" }).success).toBe(false);
expect(schema.safeParse({ 4: "4" }).success).toBe(false);
});
test("looseRecord passes through non-matching keys", () => {
const schema = z.looseRecord(z.string().regex(/^S_/), z.string());
// Keys matching pattern are validated
expect(schema.parse({ S_name: "John" })).toEqual({ S_name: "John" });
expect(() => schema.parse({ S_name: 123 })).toThrow(); // wrong value type
// Keys not matching pattern pass through unchanged
expect(schema.parse({ S_name: "John", other: "value" })).toEqual({ S_name: "John", other: "value" });
expect(schema.parse({ S_name: "John", count: 123 })).toEqual({ S_name: "John", count: 123 });
expect(schema.parse({ other: "value" })).toEqual({ other: "value" });
});
test("looseRecord with closed key schema passes through unrecognized keys", () => {
const enumSchema = z.looseRecord(z.enum(["foo", "bar"]), z.any());
expect(enumSchema.parse({ foo: 123, bar: {}, baz: null })).toEqual({
foo: 123,
bar: {},
baz: null,
});
const literalSchema = z.looseRecord(z.literal(["foo", "bar"]), z.any());
expect(literalSchema.parse({ foo: 123, bar: {}, baz: null })).toEqual({
foo: 123,
bar: {},
baz: null,
});
// Recognized keys are still validated
const validated = z.looseRecord(z.enum(["foo", "bar"]), z.string());
expect(validated.parse({ foo: "ok", bar: "ok", baz: 123 })).toEqual({
foo: "ok",
bar: "ok",
baz: 123,
});
expect(() => validated.parse({ foo: 123 })).toThrow();
});
test("record with closed key schema still rejects unrecognized keys", () => {
const schema = z.record(z.enum(["foo", "bar"]), z.any());
expect(schema.safeParse({ foo: 123, bar: {}, baz: null }).success).toBe(false);
});
// __proto__ in input must not replace the prototype of the parsed object via the assignment setter on the result {}. https://github.com/colinhacks/zod/security/advisories/GHSA-r34p-xfmx-58wv
test("looseRecord with closed key schema drops __proto__", () => {
const schema = z.looseRecord(z.enum(["foo", "bar"]), z.any());
const parsed = schema.parse(JSON.parse('{"foo":1,"bar":2,"__proto__":{"isAdmin":true}}'));
expect(Object.keys(parsed)).toEqual(["foo", "bar"]);
expect((parsed as any).isAdmin).toBeUndefined();
expect(Object.getPrototypeOf(parsed)).toBe(Object.prototype);
});
test("intersection of loose records", () => {
const schema = z.intersection(
z.object({ name: z.string() }).passthrough(),
z.intersection(
z.looseRecord(z.string().regex(/^S_/), z.string()),
z.looseRecord(z.string().regex(/^N_/), z.number())
)
);
// Each pattern validates its matching keys
const result = schema.parse({ name: "John", S_foo: "bar", N_count: 123 });
expect(result.name).toBe("John");
expect(result.S_foo).toBe("bar");
expect(result.N_count).toBe(123);
// Keys not matching any pattern pass through
const result2 = schema.parse({ name: "John", S_foo: "bar", N_count: 123, other: "value" });
expect(result2.other).toBe("value");
// Validation errors still occur for matching keys
expect(() => schema.parse({ name: "John", S_foo: 123 })).toThrow(); // S_foo should be string
expect(() => schema.parse({ name: "John", N_count: "abc" })).toThrow(); // N_count should be number
});
test("object with looseRecord index signature", () => {
// Simulates TypeScript index signature: { label: string; [key: `label:${string}`]: string }
const schema = z.object({ label: z.string() }).and(z.looseRecord(z.string().regex(/^label:[a-z]{2}$/), z.string()));
type Schema = z.infer<typeof schema>;
expectTypeOf<Schema>().toEqualTypeOf<{ label: string } & Record<string, string>>();
// Valid: has required property and matching pattern keys
expect(schema.parse({ label: "Purple", "label:en": "Purple", "label:ru": "Пурпурный" })).toEqual({
label: "Purple",
"label:en": "Purple",
"label:ru": "Пурпурный",
});
// Valid: just required property
expect(schema.parse({ label: "Purple" })).toEqual({ label: "Purple" });
// Invalid: missing required property
expect(schema.safeParse({ "label:en": "Purple" })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"label"
],
"message": "Invalid input: expected string, received undefined"
}
]],
"success": false,
}
`);
// Invalid: pattern key with wrong value type
expect(schema.safeParse({ label: "Purple", "label:en": 123 })).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"label:en"
],
"message": "Invalid input: expected string, received number"
}
]],
"success": false,
}
`);
});
test("numeric string keys", () => {
const schema = z.record(z.number(), z.number());
// Numeric string keys work
expect(schema.parse({ 1: 100, 2: 200 })).toEqual({ 1: 100, 2: 200 });
expect(schema.parse({ "1.5": 100, "-3": 200 })).toEqual({ "1.5": 100, "-3": 200 });
// Non-numeric keys fail
expect(schema.safeParse({ abc: 100 }).success).toBe(false);
// Integer constraint is respected
const intSchema = z.record(z.number().int(), z.number());
expect(intSchema.parse({ 1: 100 })).toEqual({ 1: 100 });
expect(intSchema.safeParse({ "1.5": 100 }).success).toBe(false);
// Transforms on numeric keys work
const transformedSchema = z.record(
z.number().overwrite((n) => n * 2),
z.string()
);
expect(transformedSchema.parse({ 5: "five", 10: "ten" })).toEqual({ 10: "five", 20: "ten" });
});
test("v3-compat single-arg form: z.record(valueType)", () => {
// single arg should default keyType to z.string() and use the arg as valueType
const schema = (z.record as any)(z.number());
expect(schema.keyType._zod.def.type).toEqual("string");
expect(schema.valueType._zod.def.type).toEqual("number");
expect(schema.parse({ a: 1, b: 2 })).toEqual({ a: 1, b: 2 });
expect(schema.safeParse({ a: "x" }).success).toBe(false);
// params still flow through in the single-arg form
const withMessage = (z.record as any)(z.number(), "must be a number record");
expect(withMessage.keyType._zod.def.type).toEqual("string");
expect(withMessage.valueType._zod.def.type).toEqual("number");
// toJSONSchema should produce a well-formed schema (regression: previously produced additionalProperties from undefined valueType, crashing process())
const json = z.toJSONSchema(schema);
expect(json).toMatchObject({
type: "object",
propertyNames: { type: "string" },
additionalProperties: { type: "number" },
});
});
test("__proto__ in a finite key set is stripped", () => {
const data = JSON.parse('{"__proto__":{"a":"declared"},"b":{"a":"good"}}');
for (const schema of [
z.record(z.enum(["__proto__", "b"]), z.object({ a: z.string() })),
z.record(z.literal(["__proto__", "b"]), z.object({ a: z.string() })),
]) {
const parsed: any = schema.parse(data);
expect(Object.getPrototypeOf(parsed)).toBe(Object.prototype);
expect(Object.prototype.hasOwnProperty.call(parsed, "__proto__")).toBe(false);
expect(Object.keys(parsed)).toEqual(["b"]);
expect(parsed.a).toBeUndefined();
}
expect(({} as any).a).toBeUndefined();
});
test("a raw __proto__ input key stays skipped in loose mode", () => {
const parsed: any = z.looseRecord(z.iso.datetime(), z.unknown()).parse(JSON.parse('{"__proto__":{"a":1}}'));
expect(Object.getPrototypeOf(parsed)).toBe(Object.prototype);
expect(Object.prototype.hasOwnProperty.call(parsed, "__proto__")).toBe(false);
});
test("partialRecord strips a declared __proto__ key", () => {
const schema = z.partialRecord(z.enum(["__proto__", "b"]), z.string());
const parsed: any = schema.parse(Object.fromEntries([["__proto__", "declared"]]));
expect(Object.getPrototypeOf(parsed)).toBe(Object.prototype);
expect(Object.prototype.hasOwnProperty.call(parsed, "__proto__")).toBe(false);
expect(parsed).toEqual({});
expect(schema.parse({})).toEqual({});
expect(schema.safeParse({ other: "x" }).success).toBe(false);
});
test("partialRecord strips a declared __proto__ key in loose mode", () => {
const key = z.enum(["__proto__"]).refine(() => false);
const schema = z.partialRecord(key, z.unknown(), { mode: "loose" });
const value = { marker: true };
const parsed: any = schema.parse(Object.fromEntries([["__proto__", value]]));
expect(Object.getPrototypeOf(parsed)).toBe(Object.prototype);
expect(Object.prototype.hasOwnProperty.call(parsed, "__proto__")).toBe(false);
expect(parsed).toEqual({});
expect(parsed.marker).toBeUndefined();
});
test("partial is internal to partialRecord", () => {
// @ts-expect-error partial is not a public record parameter
z.record(z.enum(["a"]), z.string(), { partial: true });
const schema = z.partialRecord(z.enum(["a"]), z.string(), { partial: false } as any);
expect(schema.parse({})).toEqual({});
});
test("partialRecord strips a declared __proto__ key before transforms", () => {
const schema = z.partialRecord(
z.literal("__proto__").transform(() => "safe" as const),
z.string()
);
expect(schema.parse(Object.fromEntries([["__proto__", "value"]]))).toEqual({});
});
test("a finite __proto__ key is ignored whether present or missing", () => {
const schema = z.record(z.enum(["__proto__"]), z.string());
const parsed: any = schema.parse({});
expect(Object.getPrototypeOf(parsed)).toBe(Object.prototype);
expect(Object.prototype.hasOwnProperty.call(parsed, "__proto__")).toBe(false);
expect(schema.parse(Object.fromEntries([["__proto__", 123]]))).toEqual({});
});
@@ -0,0 +1,9 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
export { default } from './indent-decrease.js';
//# sourceMappingURL=outdent.js.map
@@ -0,0 +1,602 @@
"use strict";
/* eslint-disable no-param-reassign */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Address4 = void 0;
const common = __importStar(require("./common"));
const constants = __importStar(require("./v4/constants"));
const address_error_1 = require("./address-error");
const isCorrect4 = common.isCorrect(constants.BITS);
/**
* Represents an IPv4 address
* @param {string} address - An IPv4 address string
*/
class Address4 {
constructor(address) {
this.addressMinusSuffix = '';
this.groups = constants.GROUPS;
this.parsedAddress = [];
this.parsedSubnet = '';
this.subnet = '/32';
this.subnetMask = 32;
this.v4 = true;
/**
* Returns true if the address is correct, false otherwise
* @returns {Boolean}
*/
this.isCorrect = isCorrect4;
/**
* Returns true if the given address is in the subnet of the current address.
* An `Address6` is never in the subnet of an `Address4`; convert with
* `to4()` or `Address6.fromAddress4()` to compare across families.
* @returns {boolean}
*/
this.isInSubnet = common.isInSubnet;
/**
* Returns true if this address's host bits fall inside the given subnet,
* ignoring this address's own subnet mask. Prefer this over `isInSubnet`
* when classifying a single address, so the answer doesn't change with the
* CIDR suffix the caller happened to write — notably when the address came
* from untrusted input and the result backs a trust-boundary decision.
* An `Address6` is never in the subnet of an `Address4`; convert with
* `to4()` or `Address6.fromAddress4()` to compare across families.
* @returns {boolean}
*/
this.isHostInSubnet = common.isHostInSubnet;
this.address = address;
const subnet = constants.RE_SUBNET_STRING.exec(address);
if (subnet) {
this.parsedSubnet = subnet[0].replace('/', '');
this.subnetMask = parseInt(this.parsedSubnet, 10);
this.subnet = `/${this.subnetMask}`;
if (this.subnetMask < 0 || this.subnetMask > constants.BITS) {
throw new address_error_1.AddressError('Invalid subnet mask.');
}
address = address.replace(constants.RE_SUBNET_STRING, '');
}
// Four three-digit octets and three dots: the longest well-formed address
// is 15 characters. Longer input is rejected before parsing, as Address6
// does at its own limit.
const longest = constants.GROUPS * 4 - 1;
if (address.length > longest) {
throw new address_error_1.AddressError(`IPv4 addresses are at most ${longest} characters.`);
}
this.addressMinusSuffix = address;
this.parsedAddress = this.parse(address);
}
/**
* Returns true if the given string is a valid IPv4 address (with optional
* CIDR subnet), false otherwise. Host bits in the subnet portion are
* allowed (e.g. `192.168.1.5/24` is valid); for strict network-address
* validation compare `correctForm()` to `startAddress().correctForm()`,
* or use `networkForm()`.
*/
static isValid(address) {
try {
// eslint-disable-next-line no-new
new Address4(address);
return true;
}
catch {
return false;
}
}
/**
* Parses an IPv4 address string into its four octet groups and stores the
* result on `this.parsedAddress`. Called automatically by the constructor;
* you typically don't need to call it directly. Throws `AddressError` if
* the input is not a valid IPv4 address.
*/
parse(address) {
const groups = address.split('.');
// Checked before the general match so the error names the actual problem.
// Address6 rejects the same notation on its v4-in-v6 path.
if (groups.some((group) => /^0\d/.test(group))) {
throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.");
}
if (!address.match(constants.RE_ADDRESS)) {
throw new address_error_1.AddressError('Invalid IPv4 address.');
}
return groups;
}
/**
* Returns the address in correct form: octets joined with `.` and any
* leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the
* canonical dotted-decimal representation.
*/
correctForm() {
return this.parsedAddress.map((part) => parseInt(part, 10)).join('.');
}
/**
* Construct an `Address4` from an address and a dotted-decimal subnet
* mask given as separate strings (e.g. as returned by Node's
* `os.networkInterfaces()`). Throws `AddressError` if the mask is
* non-contiguous (e.g. `255.0.255.0`).
* @example
* var address = Address4.fromAddressAndMask('192.168.1.1', '255.255.255.0');
* address.subnetMask; // 24
*/
static fromAddressAndMask(address, mask) {
const bits = common.prefixLengthFromMask(new Address4(mask).bigInt(), constants.BITS);
return new Address4(`${address}/${bits}`);
}
/**
* Construct an `Address4` from an address and a Cisco-style wildcard mask
* given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard
* mask is the bitwise inverse of the subnet mask. Throws `AddressError`
* if the mask is non-contiguous (e.g. `0.255.0.255`).
* @example
* var address = Address4.fromAddressAndWildcardMask('10.0.0.1', '0.0.0.255');
* address.subnetMask; // 24
*/
static fromAddressAndWildcardMask(address, wildcardMask) {
const wildcard = new Address4(wildcardMask).bigInt();
const allOnes = (BigInt(1) << BigInt(constants.BITS)) - BigInt(1);
const mask = wildcard ^ allOnes;
const bits = common.prefixLengthFromMask(mask, constants.BITS);
return new Address4(`${address}/${bits}`);
}
/**
* Construct an `Address4` from a wildcard pattern with trailing `*`
* octets. The number of trailing wildcards determines the prefix
* length: each `*` represents 8 bits.
*
* Only trailing whole-octet wildcards are supported. Partial-octet
* wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g.
* `192.*.0.1`) throw `AddressError`.
* @example
* Address4.fromWildcard('192.168.0.*').subnet; // '/24'
* Address4.fromWildcard('192.168.*.*').subnet; // '/16'
* Address4.fromWildcard('*.*.*.*').subnet; // '/0'
*/
static fromWildcard(input) {
const groups = input.split('.');
if (groups.length !== constants.GROUPS) {
throw new address_error_1.AddressError('Wildcard pattern must have 4 octets');
}
let firstWildcard = -1;
for (let i = 0; i < groups.length; i++) {
if (groups[i] === '*') {
if (firstWildcard === -1) {
firstWildcard = i;
}
}
else if (firstWildcard !== -1) {
throw new address_error_1.AddressError('Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)');
}
}
const trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard;
const replaced = groups.map((g) => (g === '*' ? '0' : g));
const subnetBits = constants.BITS - trailing * 8;
return new Address4(`${replaced.join('.')}/${subnetBits}`);
}
/**
* Converts a hex string to an IPv4 address object. Accepts 8 hex digits
* with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`).
* Throws `AddressError` for any other length or for non-hex characters.
* @param {string} hex - a hex string to convert
* @returns {Address4}
*/
static fromHex(hex) {
const stripped = hex.replace(/:/g, '');
if (!/^[0-9a-fA-F]{8}$/.test(stripped)) {
throw new address_error_1.AddressError('IPv4 hex must be exactly 8 hex digits');
}
const groups = [];
for (let i = 0; i < 8; i += 2) {
groups.push(parseInt(stripped.slice(i, i + 2), 16));
}
return new Address4(groups.join('.'));
}
/**
* Converts an integer into a IPv4 address object. The integer must be a
* non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise
* `AddressError` is thrown.
* @param {integer} integer - a number to convert
* @returns {Address4}
*/
static fromInteger(integer) {
if (!Number.isInteger(integer) || integer < 0 || integer > 0xffffffff) {
throw new address_error_1.AddressError('IPv4 integer must be in the range 0 to 2**32 - 1');
}
return Address4.fromHex(integer.toString(16).padStart(8, '0'));
}
/**
* Return an address from in-addr.arpa form: the four octets reversed, with
* or without the `.in-addr.arpa` suffix and root dot, in any case. Throws
* `AddressError` unless the reversed labels form a valid IPv4 address, so
* `fromArpa(x.reverseForm())` round-trips {@link reverseForm}.
* @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address
* @returns {Adress4}
* @example
* var address = Address4.fromArpa('42.2.0.192.in-addr.arpa.')
* address.correctForm(); // '192.0.2.42'
*/
static fromArpa(arpaFormAddress) {
// A 15-character address, a "/32" prefix length and ".in-addr.arpa.": the
// longest name is 32 characters. Longer input is rejected before its
// labels are split, as the constructor does at its own limit.
const longest = constants.GROUPS * 4 - 1 + '/32'.length + '.in-addr.arpa.'.length;
if (arpaFormAddress.length > longest) {
throw new address_error_1.AddressError(`in-addr.arpa names are at most ${longest} characters.`);
}
// remove an ending ".in-addr.arpa", in any case and with or without the
// root dot, as Address6.fromArpa does for ".ip6.arpa"
const leader = arpaFormAddress.replace(/(\.in-addr\.arpa)?\.?$/i, '');
const address = leader.split('.').reverse().join('.');
return new Address4(address);
}
/**
* Converts an IPv4 address object to a hex string
* @returns {String}
*/
toHex() {
return this.parsedAddress.map((part) => common.stringToPaddedHex(part)).join(':');
}
/**
* Converts an IPv4 address object to an array of bytes.
*
* To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`.
* @returns {Array}
*/
toArray() {
return this.parsedAddress.map((part) => parseInt(part, 10));
}
/**
* Converts an IPv4 address object to an IPv6 address group
* @returns {String}
*/
toGroup6() {
const output = [];
let i;
for (i = 0; i < constants.GROUPS; i += 2) {
output.push(`${common.stringToPaddedHex(this.parsedAddress[i])}${common.stringToPaddedHex(this.parsedAddress[i + 1])}`);
}
return output.join(':');
}
/**
* Returns the address as a `bigint`
* @returns {bigint}
*/
bigInt() {
return BigInt(`0x${this.parsedAddress.map((n) => common.stringToPaddedHex(n)).join('')}`);
}
/**
* Helper function getting start address.
* @returns {bigint}
*/
_startAddress() {
return BigInt(`0b${this.mask() + '0'.repeat(constants.BITS - this.subnetMask)}`);
}
/**
* The first address in the range given by this address' subnet.
* Often referred to as the Network Address.
* @returns {Address4}
*/
startAddress() {
return Address4.fromBigInt(this._startAddress());
}
/**
* The first host address in the range given by this address's subnet ie
* the first address after the Network Address
* @returns {Address4}
*/
startAddressExclusive() {
const adjust = BigInt('1');
return Address4.fromBigInt(this._startAddress() + adjust);
}
/**
* Returns the address `n` addresses after this one (or before, when `n` is
* negative), keeping this address's subnet mask. Throws `AddressError` when
* the result would fall outside the IPv4 address space or `n` is not an
* integer.
* @param {number | bigint} n
* @returns {Address4}
* @example
* new Address4('10.0.0.0/24').offset(1).correctForm(); // '10.0.0.1'
*/
offset(n) {
return Address4.fromBigInt(common.offsetBigInt(this.bigInt(), n, constants.BITS, 'IPv4')).withSubnetMask(this.subnetMask);
}
/**
* Returns the network that follows this address's network: the address after
* {@link endAddress}, with the same subnet mask. Throws `AddressError` when
* this network is the last one in the address space.
* @returns {Address4}
* @example
* new Address4('10.0.0.0/24').nextNetwork().networkForm(); // '10.0.1.0/24'
*/
nextNetwork() {
return Address4.fromBigInt(common.offsetBigInt(this._endAddress(), 1, constants.BITS, 'IPv4')).withSubnetMask(this.subnetMask);
}
withSubnetMask(subnetMask) {
return new Address4(`${this.correctForm()}/${subnetMask}`);
}
/**
* Helper function getting end address.
* @returns {bigint}
*/
_endAddress() {
return BigInt(`0b${this.mask() + '1'.repeat(constants.BITS - this.subnetMask)}`);
}
/**
* The last address in the range given by this address' subnet
* Often referred to as the Broadcast
* @returns {Address4}
*/
endAddress() {
return Address4.fromBigInt(this._endAddress());
}
/**
* The last host address in the range given by this address's subnet ie
* the last address prior to the Broadcast Address
* @returns {Address4}
*/
endAddressExclusive() {
const adjust = BigInt('1');
return Address4.fromBigInt(this._endAddress() - adjust);
}
/**
* The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for
* a `/20`. Returns an `Address4`; call `.correctForm()` for the string.
* @returns {Address4}
*/
subnetMaskAddress() {
return Address4.fromBigInt(BigInt(`0b${'1'.repeat(this.subnetMask)}${'0'.repeat(constants.BITS - this.subnetMask)}`));
}
/**
* The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is
* the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`;
* call `.correctForm()` for the string.
* @returns {Address4}
*/
wildcardMask() {
return Address4.fromBigInt(BigInt(`0b${'0'.repeat(this.subnetMask)}${'1'.repeat(constants.BITS - this.subnetMask)}`));
}
/**
* The network address in CIDR string form, e.g. `192.168.1.0/24` for
* `192.168.1.5/24`. For an address with no explicit subnet the prefix is
* `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`.
* @returns {string}
*/
networkForm() {
return `${this.startAddress().correctForm()}/${this.subnetMask}`;
}
/**
* Converts a BigInt to a v4 address object. The value must be in the
* range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown.
* @param {bigint} bigInt - a BigInt to convert
* @returns {Address4}
*/
static fromBigInt(bigInt) {
if (bigInt < BigInt(0) || bigInt > BigInt(0xffffffff)) {
throw new address_error_1.AddressError('IPv4 BigInt must be in the range 0 to 2**32 - 1');
}
return Address4.fromHex(bigInt.toString(16).padStart(8, '0'));
}
/**
* Convert a byte array to an Address4 object. Throws `AddressError` unless
* given exactly 4 integers from 0 to 255. Signed bytes are rejected, so
* this differs from `Address6.fromByteArray`, which folds them; the two
* contracts converge on this stricter form in the next major version.
*
* To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`.
* @param {Array<number>} bytes - an array of 4 bytes (0-255)
* @returns {Address4}
*/
static fromByteArray(bytes) {
common.assertByteArray(bytes, 4, 'IPv4', 0);
return this.fromUnsignedByteArray(bytes);
}
/**
* Convert an unsigned byte array to an Address4 object. Throws
* `AddressError` unless given exactly 4 bytes, and rejects values outside
* 0 to 255 when parsing the resulting address.
*
* To convert from a Node.js `Buffer`, spread it:
* `Address4.fromUnsignedByteArray([...buf])`.
* @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255)
* @returns {Address4}
*/
static fromUnsignedByteArray(bytes) {
if (bytes.length !== 4) {
throw new address_error_1.AddressError('IPv4 addresses require exactly 4 bytes');
}
const address = bytes.join('.');
return new Address4(address);
}
/**
* Returns the first n bits of the address, defaulting to the
* subnet mask
* @returns {String}
*/
mask(mask) {
if (mask === undefined) {
mask = this.subnetMask;
}
return this.getBitsBase2(0, mask);
}
/**
* Returns the bits in the given range as a base-2 string
* @returns {string}
*/
getBitsBase2(start, end) {
return this.binaryZeroPad().slice(start, end);
}
/**
* Return the reversed in-addr.arpa form of the address, e.g.
* `42.2.0.192.in-addr.arpa.` for `192.0.2.42`.
* @param {Object} options
* @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
* @returns {String}
*/
reverseForm(options) {
if (!options) {
options = {};
}
const reversed = this.correctForm().split('.').reverse().join('.');
if (options.omitSuffix) {
return reversed;
}
return `${reversed}.in-addr.arpa.`;
}
/**
* Returns true if the given address is a multicast address
* @returns {boolean}
*/
isMulticast() {
return this.isHostInSubnet(MULTICAST_V4);
}
/**
* Returns true if the address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private address ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`).
* @returns {boolean}
*/
isPrivate() {
return PRIVATE_V4.some((subnet) => this.isHostInSubnet(subnet));
}
/**
* Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)).
* @returns {boolean}
*/
isLoopback() {
return this.isHostInSubnet(LOOPBACK_V4);
}
/**
* Returns true if the address is in the link-local range `169.254.0.0/16` ([RFC 3927](https://datatracker.ietf.org/doc/html/rfc3927)).
* @returns {boolean}
*/
isLinkLocal() {
return this.isHostInSubnet(LINK_LOCAL_V4);
}
/**
* Returns true if the address is the unspecified address `0.0.0.0`.
* @returns {boolean}
*/
isUnspecified() {
return this.isHostInSubnet(UNSPECIFIED_V4);
}
/**
* Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)).
* @returns {boolean}
*/
isBroadcast() {
return this.isHostInSubnet(BROADCAST_V4);
}
/**
* Returns true if the address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)).
* @returns {boolean}
*/
isCGNAT() {
return this.isHostInSubnet(CGNAT_V4);
}
/**
* Returns true if the address is in one of the documentation ranges
* `192.0.2.0/24`, `198.51.100.0/24`, or `203.0.113.0/24` ([RFC 5737](https://datatracker.ietf.org/doc/html/rfc5737)).
* @returns {boolean}
*/
isDocumentation() {
return DOCUMENTATION_V4.some((subnet) => this.isHostInSubnet(subnet));
}
/**
* Returns true if the address is in the benchmarking range `198.18.0.0/15` ([RFC 2544](https://datatracker.ietf.org/doc/html/rfc2544)).
* @returns {boolean}
*/
isBenchmarking() {
return this.isHostInSubnet(BENCHMARKING_V4);
}
/**
* Returns true if the address is in the reserved range `240.0.0.0/4` ([RFC 1112](https://datatracker.ietf.org/doc/html/rfc1112)),
* which includes the limited broadcast address.
* @returns {boolean}
*/
isReserved() {
return this.isHostInSubnet(RESERVED_V4);
}
/**
* Returns true if the address is globally reachable: not multicast, and not
* in any block the [IANA IPv4 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv4-special-registry/)
* marks as not globally reachable. That covers everything the individual
* classifiers name (private, loopback, link-local, CGNAT, unspecified,
* broadcast, documentation, benchmarking, reserved) and the blocks they do
* not, such as `0.0.0.0/8` and the IETF protocol assignments in
* `192.0.0.0/24`. This is the single predicate to use where a request must
* not reach an internal or special-purpose destination; see SECURITY.md.
* @returns {boolean}
*/
isGlobal() {
return !this.isMulticast() && common.isGloballyReachable.call(this, SPECIAL_PURPOSE_V4);
}
/**
* Returns a zero-padded base-2 string representation of the address
* @returns {string}
*/
binaryZeroPad() {
if (this._binaryZeroPad === undefined) {
this._binaryZeroPad = this.bigInt().toString(2).padStart(constants.BITS, '0');
}
return this._binaryZeroPad;
}
/**
* Groups an IPv4 address for inclusion at the end of an IPv6 address.
*
* Returns an HTML fragment: each half of the address is wrapped in a
* `<span>` carrying the group classes an address-inspector UI hovers on.
* The address content is HTML-escaped; anything you concatenate around it
* is your responsibility.
* @returns {String}
*/
groupForV6() {
const segments = this.parsedAddress;
return this.correctForm().replace(constants.RE_ADDRESS, `<span class="hover-group group-v4 group-6">${segments
.slice(0, 2)
.join('.')}</span>.<span class="hover-group group-v4 group-7">${segments
.slice(2, 4)
.join('.')}</span>`);
}
}
exports.Address4 = Address4;
const MULTICAST_V4 = new Address4('224.0.0.0/4');
const PRIVATE_V4 = [
new Address4('10.0.0.0/8'),
new Address4('172.16.0.0/12'),
new Address4('192.168.0.0/16'),
];
const LOOPBACK_V4 = new Address4('127.0.0.0/8');
const LINK_LOCAL_V4 = new Address4('169.254.0.0/16');
const UNSPECIFIED_V4 = new Address4('0.0.0.0/32');
const BROADCAST_V4 = new Address4('255.255.255.255/32');
const CGNAT_V4 = new Address4('100.64.0.0/10');
const DOCUMENTATION_V4 = [
new Address4('192.0.2.0/24'),
new Address4('198.51.100.0/24'),
new Address4('203.0.113.0/24'),
];
const BENCHMARKING_V4 = new Address4('198.18.0.0/15');
const RESERVED_V4 = new Address4('240.0.0.0/4');
const SPECIAL_PURPOSE_V4 = constants.SPECIAL_PURPOSE.map(([cidr, , reachable]) => ({
subnet: new Address4(cidr),
reachable,
}));
//# sourceMappingURL=ipv4.js.map
@@ -0,0 +1,56 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./Options.js"), exports);
__exportStar(require("./Refs.js"), exports);
__exportStar(require("./errorMessages.js"), exports);
__exportStar(require("./getRelativePath.js"), exports);
__exportStar(require("./parseDef.js"), exports);
__exportStar(require("./parseTypes.js"), exports);
__exportStar(require("./parsers/any.js"), exports);
__exportStar(require("./parsers/array.js"), exports);
__exportStar(require("./parsers/bigint.js"), exports);
__exportStar(require("./parsers/boolean.js"), exports);
__exportStar(require("./parsers/branded.js"), exports);
__exportStar(require("./parsers/catch.js"), exports);
__exportStar(require("./parsers/date.js"), exports);
__exportStar(require("./parsers/default.js"), exports);
__exportStar(require("./parsers/effects.js"), exports);
__exportStar(require("./parsers/enum.js"), exports);
__exportStar(require("./parsers/intersection.js"), exports);
__exportStar(require("./parsers/literal.js"), exports);
__exportStar(require("./parsers/map.js"), exports);
__exportStar(require("./parsers/nativeEnum.js"), exports);
__exportStar(require("./parsers/never.js"), exports);
__exportStar(require("./parsers/null.js"), exports);
__exportStar(require("./parsers/nullable.js"), exports);
__exportStar(require("./parsers/number.js"), exports);
__exportStar(require("./parsers/object.js"), exports);
__exportStar(require("./parsers/optional.js"), exports);
__exportStar(require("./parsers/pipeline.js"), exports);
__exportStar(require("./parsers/promise.js"), exports);
__exportStar(require("./parsers/readonly.js"), exports);
__exportStar(require("./parsers/record.js"), exports);
__exportStar(require("./parsers/set.js"), exports);
__exportStar(require("./parsers/string.js"), exports);
__exportStar(require("./parsers/tuple.js"), exports);
__exportStar(require("./parsers/undefined.js"), exports);
__exportStar(require("./parsers/union.js"), exports);
__exportStar(require("./parsers/unknown.js"), exports);
__exportStar(require("./selectParser.js"), exports);
__exportStar(require("./zodToJsonSchema.js"), exports);
const zodToJsonSchema_js_1 = require("./zodToJsonSchema.js");
exports.default = zodToJsonSchema_js_1.zodToJsonSchema;
@@ -0,0 +1,320 @@
"use strict";
/**
* OAuth provider extensions for specialized authentication flows.
*
* This module provides ready-to-use OAuthClientProvider implementations
* for common machine-to-machine authentication scenarios.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StaticPrivateKeyJwtProvider = exports.PrivateKeyJwtProvider = exports.ClientCredentialsProvider = void 0;
exports.createPrivateKeyJwtAuth = createPrivateKeyJwtAuth;
/**
* Helper to produce a private_key_jwt client authentication function.
*
* Usage:
* const addClientAuth = createPrivateKeyJwtAuth({ issuer, subject, privateKey, alg, audience? });
* // pass addClientAuth as provider.addClientAuthentication implementation
*/
function createPrivateKeyJwtAuth(options) {
return async (_headers, params, url, metadata) => {
// Lazy import to avoid heavy dependency unless used
if (typeof globalThis.crypto === 'undefined') {
throw new TypeError('crypto is not available, please ensure you add have Web Crypto API support for older Node.js versions (see https://github.com/modelcontextprotocol/typescript-sdk#nodejs-web-crypto-globalthiscrypto-compatibility)');
}
const jose = await Promise.resolve().then(() => __importStar(require('jose')));
const audience = String(options.audience ?? metadata?.issuer ?? url);
const lifetimeSeconds = options.lifetimeSeconds ?? 300;
const now = Math.floor(Date.now() / 1000);
const jti = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
const baseClaims = {
iss: options.issuer,
sub: options.subject,
aud: audience,
exp: now + lifetimeSeconds,
iat: now,
jti
};
const claims = options.claims ? { ...baseClaims, ...options.claims } : baseClaims;
// Import key for the requested algorithm
const alg = options.alg;
let key;
if (typeof options.privateKey === 'string') {
if (alg.startsWith('RS') || alg.startsWith('ES') || alg.startsWith('PS')) {
key = await jose.importPKCS8(options.privateKey, alg);
}
else if (alg.startsWith('HS')) {
key = new TextEncoder().encode(options.privateKey);
}
else {
throw new Error(`Unsupported algorithm ${alg}`);
}
}
else if (options.privateKey instanceof Uint8Array) {
if (alg.startsWith('HS')) {
key = options.privateKey;
}
else {
// Assume PKCS#8 DER in Uint8Array for asymmetric algorithms
key = await jose.importPKCS8(new TextDecoder().decode(options.privateKey), alg);
}
}
else {
// Treat as JWK
key = await jose.importJWK(options.privateKey, alg);
}
// Sign JWT
const assertion = await new jose.SignJWT(claims)
.setProtectedHeader({ alg, typ: 'JWT' })
.setIssuer(options.issuer)
.setSubject(options.subject)
.setAudience(audience)
.setIssuedAt(now)
.setExpirationTime(now + lifetimeSeconds)
.setJti(jti)
.sign(key);
params.set('client_assertion', assertion);
params.set('client_assertion_type', 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer');
};
}
/**
* The `issuer` stamp for constructor-supplied client information. Omitting `expectedIssuer` is
* deprecated: nothing else says which authorization server such credentials belong to.
*/
function checkedExpectedIssuer(expectedIssuer) {
if (expectedIssuer === undefined) {
// eslint-disable-next-line no-console
console.warn('[mcp-sdk] Omitting `expectedIssuer` is deprecated. Without it, the MCP server decides which authorization ' +
"server receives this client's credentials; pass your authorization server's issuer URL as " +
'`expectedIssuer` so they are only sent there.');
}
else if (typeof expectedIssuer !== 'string' || !expectedIssuer) {
throw new Error("expectedIssuer must be the authorization server's issuer URL");
}
return expectedIssuer;
}
/**
* OAuth provider for client_credentials grant with client_secret_basic authentication.
*
* This provider is designed for machine-to-machine authentication where
* the client authenticates using a client_id and client_secret.
*
* @example
* const provider = new ClientCredentialsProvider({
* clientId: 'my-client',
* clientSecret: 'my-secret',
* expectedIssuer: 'https://auth.example.com'
* });
*
* const transport = new StreamableHTTPClientTransport(serverUrl, {
* authProvider: provider
* });
*/
class ClientCredentialsProvider {
constructor(options) {
this._clientInfo = {
client_id: options.clientId,
client_secret: options.clientSecret,
issuer: checkedExpectedIssuer(options.expectedIssuer)
};
this._clientMetadata = {
client_name: options.clientName ?? 'client-credentials-client',
redirect_uris: [],
grant_types: ['client_credentials'],
token_endpoint_auth_method: 'client_secret_basic',
scope: options.scope
};
}
get redirectUrl() {
return undefined;
}
get clientMetadata() {
return this._clientMetadata;
}
clientInformation() {
return this._clientInfo;
}
saveClientInformation(info) {
this._clientInfo = info;
}
tokens() {
return this._tokens;
}
saveTokens(tokens) {
this._tokens = tokens;
}
redirectToAuthorization() {
throw new Error('redirectToAuthorization is not used for client_credentials flow');
}
saveCodeVerifier() {
// Not used for client_credentials
}
codeVerifier() {
throw new Error('codeVerifier is not used for client_credentials flow');
}
prepareTokenRequest(scope) {
const params = new URLSearchParams({ grant_type: 'client_credentials' });
if (scope)
params.set('scope', scope);
return params;
}
}
exports.ClientCredentialsProvider = ClientCredentialsProvider;
/**
* OAuth provider for client_credentials grant with private_key_jwt authentication.
*
* This provider is designed for machine-to-machine authentication where
* the client authenticates using a signed JWT assertion (RFC 7523 Section 2.2).
*
* @example
* const provider = new PrivateKeyJwtProvider({
* clientId: 'my-client',
* privateKey: pemEncodedPrivateKey,
* algorithm: 'RS256',
* expectedIssuer: 'https://auth.example.com'
* });
*
* const transport = new StreamableHTTPClientTransport(serverUrl, {
* authProvider: provider
* });
*/
class PrivateKeyJwtProvider {
constructor(options) {
this._clientInfo = {
client_id: options.clientId,
issuer: checkedExpectedIssuer(options.expectedIssuer)
};
this._clientMetadata = {
client_name: options.clientName ?? 'private-key-jwt-client',
redirect_uris: [],
grant_types: ['client_credentials'],
token_endpoint_auth_method: 'private_key_jwt',
scope: options.scope
};
this.addClientAuthentication = createPrivateKeyJwtAuth({
issuer: options.clientId,
subject: options.clientId,
privateKey: options.privateKey,
alg: options.algorithm,
lifetimeSeconds: options.jwtLifetimeSeconds
});
}
get redirectUrl() {
return undefined;
}
get clientMetadata() {
return this._clientMetadata;
}
clientInformation() {
return this._clientInfo;
}
saveClientInformation(info) {
this._clientInfo = info;
}
tokens() {
return this._tokens;
}
saveTokens(tokens) {
this._tokens = tokens;
}
redirectToAuthorization() {
throw new Error('redirectToAuthorization is not used for client_credentials flow');
}
saveCodeVerifier() {
// Not used for client_credentials
}
codeVerifier() {
throw new Error('codeVerifier is not used for client_credentials flow');
}
prepareTokenRequest(scope) {
const params = new URLSearchParams({ grant_type: 'client_credentials' });
if (scope)
params.set('scope', scope);
return params;
}
}
exports.PrivateKeyJwtProvider = PrivateKeyJwtProvider;
/**
* OAuth provider for client_credentials grant with a static private_key_jwt assertion.
*
* This provider mirrors {@link PrivateKeyJwtProvider} but instead of constructing and
* signing a JWT on each request, it accepts a pre-built JWT assertion string and
* uses it directly for authentication.
*/
class StaticPrivateKeyJwtProvider {
constructor(options) {
this._clientInfo = {
client_id: options.clientId,
issuer: checkedExpectedIssuer(options.expectedIssuer)
};
this._clientMetadata = {
client_name: options.clientName ?? 'static-private-key-jwt-client',
redirect_uris: [],
grant_types: ['client_credentials'],
token_endpoint_auth_method: 'private_key_jwt',
scope: options.scope
};
const assertion = options.jwtBearerAssertion;
this.addClientAuthentication = async (_headers, params) => {
params.set('client_assertion', assertion);
params.set('client_assertion_type', 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer');
};
}
get redirectUrl() {
return undefined;
}
get clientMetadata() {
return this._clientMetadata;
}
clientInformation() {
return this._clientInfo;
}
saveClientInformation(info) {
this._clientInfo = info;
}
tokens() {
return this._tokens;
}
saveTokens(tokens) {
this._tokens = tokens;
}
redirectToAuthorization() {
throw new Error('redirectToAuthorization is not used for client_credentials flow');
}
saveCodeVerifier() {
// Not used for client_credentials
}
codeVerifier() {
throw new Error('codeVerifier is not used for client_credentials flow');
}
prepareTokenRequest(scope) {
const params = new URLSearchParams({ grant_type: 'client_credentials' });
if (scope)
params.set('scope', scope);
return params;
}
}
exports.StaticPrivateKeyJwtProvider = StaticPrivateKeyJwtProvider;
//# sourceMappingURL=auth-extensions.js.map
@@ -0,0 +1,60 @@
const pxValues = new Set([
// Border props
"borderWidth",
"borderTopWidth",
"borderRightWidth",
"borderBottomWidth",
"borderLeftWidth",
"borderRadius",
"borderTopLeftRadius",
"borderTopRightRadius",
"borderBottomRightRadius",
"borderBottomLeftRadius",
// Positioning props
"width",
"maxWidth",
"height",
"maxHeight",
"top",
"right",
"bottom",
"left",
"inset",
"insetBlock",
"insetBlockStart",
"insetBlockEnd",
"insetInline",
"insetInlineStart",
"insetInlineEnd",
// Spacing props
"padding",
"paddingTop",
"paddingRight",
"paddingBottom",
"paddingLeft",
"paddingBlock",
"paddingBlockStart",
"paddingBlockEnd",
"paddingInline",
"paddingInlineStart",
"paddingInlineEnd",
"margin",
"marginTop",
"marginRight",
"marginBottom",
"marginLeft",
"marginBlock",
"marginBlockStart",
"marginBlockEnd",
"marginInline",
"marginInlineStart",
"marginInlineEnd",
// Typography
"fontSize",
// Misc
"backgroundPositionX",
"backgroundPositionY",
]);
export { pxValues };
//# sourceMappingURL=px-values.mjs.map
@@ -0,0 +1,9 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
export { default } from './file-axis-3d.js';
//# sourceMappingURL=file-axis-3-d.js.map
@@ -0,0 +1,234 @@
/*!
* on-finished
* Copyright(c) 2013 Jonathan Ong
* Copyright(c) 2014 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module exports.
* @public
*/
module.exports = onFinished
module.exports.isFinished = isFinished
/**
* Module dependencies.
* @private
*/
var asyncHooks = tryRequireAsyncHooks()
var first = require('ee-first')
/**
* Variables.
* @private
*/
/* istanbul ignore next */
var defer = typeof setImmediate === 'function'
? setImmediate
: function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) }
/**
* Invoke callback when the response has finished, useful for
* cleaning up resources afterwards.
*
* @param {object} msg
* @param {function} listener
* @return {object}
* @public
*/
function onFinished (msg, listener) {
if (isFinished(msg) !== false) {
defer(listener, null, msg)
return msg
}
// attach the listener to the message
attachListener(msg, wrap(listener))
return msg
}
/**
* Determine if message is already finished.
*
* @param {object} msg
* @return {boolean}
* @public
*/
function isFinished (msg) {
var socket = msg.socket
if (typeof msg.finished === 'boolean') {
// OutgoingMessage
return Boolean(msg.finished || (socket && !socket.writable))
}
if (typeof msg.complete === 'boolean') {
// IncomingMessage
return Boolean(msg.upgrade || !socket || !socket.readable || (msg.complete && !msg.readable))
}
// don't know
return undefined
}
/**
* Attach a finished listener to the message.
*
* @param {object} msg
* @param {function} callback
* @private
*/
function attachFinishedListener (msg, callback) {
var eeMsg
var eeSocket
var finished = false
function onFinish (error) {
eeMsg.cancel()
eeSocket.cancel()
finished = true
callback(error)
}
// finished on first message event
eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish)
function onSocket (socket) {
// remove listener
msg.removeListener('socket', onSocket)
if (finished) return
if (eeMsg !== eeSocket) return
// finished on first socket event
eeSocket = first([[socket, 'error', 'close']], onFinish)
}
if (msg.socket) {
// socket already assigned
onSocket(msg.socket)
return
}
// wait for socket to be assigned
msg.on('socket', onSocket)
if (msg.socket === undefined) {
// istanbul ignore next: node.js 0.8 patch
patchAssignSocket(msg, onSocket)
}
}
/**
* Attach the listener to the message.
*
* @param {object} msg
* @return {function}
* @private
*/
function attachListener (msg, listener) {
var attached = msg.__onFinished
// create a private single listener with queue
if (!attached || !attached.queue) {
attached = msg.__onFinished = createListener(msg)
attachFinishedListener(msg, attached)
}
attached.queue.push(listener)
}
/**
* Create listener on message.
*
* @param {object} msg
* @return {function}
* @private
*/
function createListener (msg) {
function listener (err) {
if (msg.__onFinished === listener) msg.__onFinished = null
if (!listener.queue) return
var queue = listener.queue
listener.queue = null
for (var i = 0; i < queue.length; i++) {
queue[i](err, msg)
}
}
listener.queue = []
return listener
}
/**
* Patch ServerResponse.prototype.assignSocket for node.js 0.8.
*
* @param {ServerResponse} res
* @param {function} callback
* @private
*/
// istanbul ignore next: node.js 0.8 patch
function patchAssignSocket (res, callback) {
var assignSocket = res.assignSocket
if (typeof assignSocket !== 'function') return
// res.on('socket', callback) is broken in 0.8
res.assignSocket = function _assignSocket (socket) {
assignSocket.call(this, socket)
callback(socket)
}
}
/**
* Try to require async_hooks
* @private
*/
function tryRequireAsyncHooks () {
try {
return require('async_hooks')
} catch (e) {
return {}
}
}
/**
* Wrap function with async resource, if possible.
* AsyncResource.bind static method backported.
* @private
*/
function wrap (fn) {
var res
// create anonymous resource
if (asyncHooks.AsyncResource) {
res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')
}
// incompatible node.js
if (!res || !res.runInAsyncScope) {
return fn
}
// return bound function
return res.runInAsyncScope.bind(res, fn, null)
}
@@ -0,0 +1 @@
{"version":3,"names":["_t","require","_index","_expressions","isClassDeclaration","isExportDefaultSpecifier","isExportNamespaceSpecifier","isImportDefaultSpecifier","isImportNamespaceSpecifier","isStatement","ImportSpecifier","node","importKind","word","space","print","imported","local","name","ImportDefaultSpecifier","ExportDefaultSpecifier","exported","ExportSpecifier","exportKind","ExportNamespaceSpecifier","token","warningShown","_printAttributes","hasPreviousBrace","_node$extra","attributes","assertions","importAttributesKeyword","format","extra","deprecatedAssertSyntax","deprecatedWithLegacySyntax","console","warn","useAssertKeyword","printList","occurrenceCount","undefined","shouldPrintTrailingComma","ExportAllDeclaration","_node$attributes","_node$assertions","length","source","call","semicolon","maybePrintDecoratorsBeforeExport","printer","declaration","_shouldPrintDecoratorsBeforeExport","printJoin","decorators","ExportNamedDeclaration","declar","specifiers","slice","hasSpecial","first","shift","hasBrace","_node$attributes2","_node$assertions2","ExportDefaultDeclaration","noIndentInnerCommentsHere","tokenContext","TokenContext","exportDefault","ImportDeclaration","_node$attributes3","_node$assertions3","isTypeKind","module","phase","hasSpecifiers","ImportAttribute","key","value","ImportNamespaceSpecifier","ImportExpression","options","rightParens"],"sources":["../../src/generators/modules.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport {\n isClassDeclaration,\n isExportDefaultSpecifier,\n isExportNamespaceSpecifier,\n isImportDefaultSpecifier,\n isImportNamespaceSpecifier,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { TokenContext } from \"../node/index.ts\";\nimport { _shouldPrintDecoratorsBeforeExport } from \"./expressions.ts\";\n\nexport function ImportSpecifier(this: Printer, node: t.ImportSpecifier) {\n if (node.importKind === \"type\" || node.importKind === \"typeof\") {\n this.word(node.importKind);\n this.space();\n }\n\n this.print(node.imported);\n // @ts-expect-error todo(flow-ts) maybe check node type instead of relying on name to be undefined on t.StringLiteral\n if (node.local && node.local.name !== node.imported.name) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.local);\n }\n}\n\nexport function ImportDefaultSpecifier(\n this: Printer,\n node: t.ImportDefaultSpecifier,\n) {\n this.print(node.local);\n}\n\nexport function ExportDefaultSpecifier(\n this: Printer,\n node: t.ExportDefaultSpecifier,\n) {\n this.print(node.exported);\n}\n\nexport function ExportSpecifier(this: Printer, node: t.ExportSpecifier) {\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n\n this.print(node.local);\n // @ts-expect-error todo(flow-ts) maybe check node type instead of relying on name to be undefined on t.StringLiteral\n if (node.exported && node.local.name !== node.exported.name) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.exported);\n }\n}\n\nexport function ExportNamespaceSpecifier(\n this: Printer,\n node: t.ExportNamespaceSpecifier,\n) {\n this.token(\"*\");\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.exported);\n}\n\nlet warningShown = false;\n\nexport function _printAttributes(\n this: Printer,\n node: Extract<t.Node, { attributes?: t.ImportAttribute[] | null }>,\n hasPreviousBrace: boolean,\n) {\n const { attributes } = node;\n\n if (!process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n // eslint-disable-next-line no-var\n var { assertions } = node;\n const { importAttributesKeyword } = this.format;\n\n if (\n attributes &&\n !importAttributesKeyword &&\n node.extra &&\n (node.extra.deprecatedAssertSyntax ||\n node.extra.deprecatedWithLegacySyntax) &&\n // In the production build only show the warning once.\n // We want to show it per-usage locally for tests.\n (!process.env.IS_PUBLISH || !warningShown)\n ) {\n warningShown = true;\n console.warn(`\\\nYou are using import attributes, without specifying the desired output syntax.\nPlease specify the \"importAttributesKeyword\" generator option, whose value can be one of:\n - \"with\" : \\`import { a } from \"b\" with { type: \"json\" };\\`\n - \"assert\" : \\`import { a } from \"b\" assert { type: \"json\" };\\`\n - \"with-legacy\" : \\`import { a } from \"b\" with type: \"json\";\\`\n`);\n }\n\n const useAssertKeyword =\n importAttributesKeyword === \"assert\" ||\n (!importAttributesKeyword && assertions);\n\n this.word(useAssertKeyword ? \"assert\" : \"with\");\n this.space();\n\n if (\n !useAssertKeyword &&\n (importAttributesKeyword === \"with-legacy\" ||\n (!importAttributesKeyword && node.extra?.deprecatedWithLegacySyntaxLine truncated
@@ -0,0 +1 @@
{"version":3,"file":"parse-class.js","sourceRoot":"","sources":["../../src/parse-class.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,wCAAwC;;;AAExC,4CAA4C;AAC5C,MAAM,YAAY,GAA8C;IAC9D,WAAW,EAAE,CAAC,sBAAsB,CAAC;IACrC,WAAW,EAAE,CAAC,eAAe,CAAC;IAC9B,WAAW,EAAE,CAAC,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC;IACtC,WAAW,EAAE,CAAC,YAAY,CAAC;IAC3B,WAAW,EAAE,CAAC,SAAS,CAAC;IACxB,WAAW,EAAE,CAAC,SAAS,CAAC;IACxB,WAAW,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC;IACnC,WAAW,EAAE,CAAC,SAAS,CAAC;IACxB,WAAW,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC;IAC7B,WAAW,EAAE,CAAC,cAAc,CAAC;IAC7B,WAAW,EAAE,CAAC,uBAAuB,CAAC;IACtC,WAAW,EAAE,CAAC,SAAS,CAAC;IACxB,UAAU,EAAE,CAAC,6BAA6B,CAAC;IAC3C,YAAY,EAAE,CAAC,WAAW,CAAC;CAC5B,CAAA;AAED,+DAA+D;AAC/D,mBAAmB;AACnB,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;AAMjE,MAAM,OAAO,GAAG,IAAI,CAAA;AAEpB,oEAAoE;AACpE,mEAAmE;AACnE,iEAAiE;AACjE,kCAAkC;AAClC,kEAAkE;AAClE,+DAA+D;AAC/D,2BAA2B;AACpB,MAAM,UAAU,GAAG,CACxB,IAAY,EACZ,QAAgB,EAChB,SAAkB,KAAK,EACvB,IAAW,EACO,EAAE;IACpB,yDAAyD;IACzD,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE;QACzB,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACtC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACpC,CAAC,CAAA;IACD,MAAM,GAAG,GAAG,QAAQ,CAAA;IACpB,qBAAqB;IACrB,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;IAC9C,CAAC;IACD,oBAAoB;IACpB,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,MAAM,IAAI,GAAa,EAAE,CAAA;IAEzB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,CAAA;IACf,IAAI,QAAQ,GAAG,KAAK,CAAA;IACpB,IAAI,QAAQ,GAAG,KAAK,CAAA;IACpB,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,IAAI,MAAM,GAAG,GAAG,CAAA;IAChB,IAAI,UAAU,GAAG,EAAE,CAAA;IACnB,KAAK,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC9B,MAAM,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAE,CAAC,CAAA;QACpD,IAAI,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,EAAE,CAAC;YAC9C,MAAM,GAAG,IAAI,CAAA;YACb,CAAC,EAAE,CAAA;YACH,SAAQ;QACV,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;YACvC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAA;YACd,MAAK;QACP,CAAC;QAED,QAAQ,GAAG,IAAI,CAAA;QACf,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACf,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,QAAQ,GAAG,IAAI,CAAA;gBACf,CAAC,EAAE,CAAA;gBACH,SAAQ;YACV,CAAC;YACD,0DAA0D;QAC5D,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC3B,4DAA4D;YAC5D,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC9D,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;oBAC5B,+CAA+C;oBAC/C,IAAI,UAAU,EAAE,CAAC;wBACf,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAA;oBACrC,CAAC;oBACD,CAAC,IAAI,GAAG,CAAC,MAAM,CAAA;oBACf,IAAI,GAAG;wBAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;;wBACnB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;oBACtB,SAAS,KAAK,CAAA;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;QAED,gDAAgD;QAChD,QAAQ,GAAG,KAAK,CAAA;QAChB,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,IAAI,UAAU,EAAE,CAAC;YACf,sDAAsD;YACtD,mBAAmB;YACnB,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,CAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAE,EAAE,CAAC;gBACnD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;YAC7D,CAAC;iBAAM,IAAI,CAAC,KAAK,UAAU,EAAE,CAAC;gBAC5B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;YAC7B,CAAC;YACD,UAAU,GAAG,EAAE,CAAA;YACf,CAAC,IAAI,CAAC,CAAC,MAAM,CAAA;YACb,SAAQ;QACV,CAAC;QAED,qCAAqC;QACrC,8DAA8D;QAC9D,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;YACjC,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;YACjB,SAAQ;QACV,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YACvC,UAAU,GAAG,CAAC,CAAA;YACd,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;YACjB,SAAQ;QACV,CAAC;QAED,oDAAoD;QACpD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;QAC3B,CAAC,IAAI,CAAC,CAAC,MAAM,CAAA;IACf,CAAC;IAED,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QACf,sDAAsD;QACtD,+CAA+C;QAC/C,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;IACrB,CAAC;IAED,gEAAgE;IAChE,kEAAkE;IAClE,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACnC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAA;IACrC,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;IACjE,MAAM,KAAK,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;IAC7D,MAAM,IAAI,GACR,GAAG;QACH,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG;YACjE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;gBACzB,CAAC,CAAC,KAAK,CAAC,CAAA;IAEV,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,CAAA;AAC9D,CAAC,CAAA;AAvHY,QAAA,UAAU,cAuHtB","sourcesContent":["// translate the various posix character classes into unicode properties\n// this works across all unicode locales\n\n// { <posix class>: [<translation>, negated]\nconst posixClasses: { [k: string]: [e: string, n?: boolLine truncated
@@ -0,0 +1,25 @@
export const modeFix = (mode, isDir, portable) => {
mode &= 0o7777;
// in portable mode, use the minimum reasonable umask
// if this system creates files with 0o664 by default
// (as some linux distros do), then we'll write the
// archive with 0o644 instead. Also, don't ever create
// a file that is not readable/writable by the owner.
if (portable) {
mode = (mode | 0o600) & ~0o22;
}
// if dirs are readable, then they should be listable
if (isDir) {
if (mode & 0o400) {
mode |= 0o100;
}
if (mode & 0o40) {
mode |= 0o10;
}
if (mode & 0o4) {
mode |= 0o1;
}
}
return mode;
};
//# sourceMappingURL=mode-fix.js.map
@@ -0,0 +1,105 @@
import { type Stats } from 'fs';
import { WriteEntry, WriteEntrySync, WriteEntryTar } from './write-entry.js';
export declare class PackJob {
path: string;
absolute: string;
entry?: WriteEntry | WriteEntryTar;
stat?: Stats;
readdir?: string[];
pending: boolean;
pendingLink: boolean;
ignore: boolean;
piped: boolean;
constructor(path: string, absolute: string);
}
import { Minipass } from 'minipass';
import * as zlib from 'minizlib';
import { Yallist } from 'yallist';
import type { ReadEntry } from './read-entry.js';
import type { WarnEvent } from './warn-method.js';
import { type WarnData, type Warner } from './warn-method.js';
declare const ONSTAT: unique symbol;
declare const ENDED: unique symbol;
declare const QUEUE: unique symbol;
declare const PENDINGLINKS: unique symbol;
declare const CURRENT: unique symbol;
declare const PROCESS: unique symbol;
declare const PROCESSING: unique symbol;
declare const PROCESSJOB: unique symbol;
declare const JOBS: unique symbol;
declare const JOBDONE: unique symbol;
declare const ADDFSENTRY: unique symbol;
declare const ADDTARENTRY: unique symbol;
declare const STAT: unique symbol;
declare const READDIR: unique symbol;
declare const ONREADDIR: unique symbol;
declare const PIPE: unique symbol;
declare const ENTRY: unique symbol;
declare const ENTRYOPT: unique symbol;
declare const WRITEENTRYCLASS: unique symbol;
declare const WRITE: unique symbol;
declare const ONDRAIN: unique symbol;
import type { TarOptions } from './options.js';
export declare class Pack extends Minipass<Buffer, ReadEntry | string, WarnEvent<Buffer>> implements Warner {
sync: boolean;
opt: TarOptions;
cwd: string;
maxReadSize?: number;
preservePaths: boolean;
strict: boolean;
noPax: boolean;
prefix: string;
linkCache: Exclude<TarOptions['linkCache'], undefined>;
statCache: Exclude<TarOptions['statCache'], undefined>;
file: string;
portable: boolean;
zip?: zlib.BrotliCompress | zlib.Gzip | zlib.ZstdCompress;
readdirCache: Exclude<TarOptions['readdirCache'], undefined>;
noDirRecurse: boolean;
follow: boolean;
noMtime: boolean;
mtime?: Date;
filter: Exclude<TarOptions['filter'], undefined>;
jobs: number;
[WRITEENTRYCLASS]: typeof WriteEntry | typeof WriteEntrySync;
onWriteEntry?: (entry: WriteEntry) => void;
[QUEUE]: Yallist<PackJob>;
[PENDINGLINKS]: Map<`${number}:${number}`, PackJob[]>;
[JOBS]: number;
[PROCESSING]: boolean;
[ENDED]: boolean;
constructor(opt?: TarOptions);
[WRITE](chunk: Buffer): boolean;
add(path: string | ReadEntry): this;
end(cb?: () => void): this;
end(path: string | ReadEntry, cb?: () => void): this;
end(path: string | ReadEntry, encoding?: Minipass.Encoding, cb?: () => void): this;
write(path: string | ReadEntry): boolean;
[ADDTARENTRY](p: ReadEntry): void;
[ADDFSENTRY](p: string): void;
[STAT](job: PackJob): void;
[ONSTAT](job: PackJob, stat: Stats): void;
[READDIR](job: PackJob): void;
[ONREADDIR](job: PackJob, entries: string[]): void;
[PROCESS](): void;
get [CURRENT](): PackJob | undefined;
[JOBDONE](job: PackJob): void;
[PROCESSJOB](job: PackJob): void;
[ENTRYOPT](job: PackJob): TarOptions;
[ENTRY](job: PackJob): WriteEntry | undefined;
[ONDRAIN](): void;
[PIPE](job: PackJob): void;
pause(): void;
warn(code: string, message: string | Error, data?: WarnData): void;
}
export declare class PackSync extends Pack {
sync: true;
constructor(opt: TarOptions);
pause(): void;
resume(): void;
[STAT](job: PackJob): void;
[READDIR](job: PackJob): void;
[PIPE](job: PackJob): void;
}
export {};
//# sourceMappingURL=pack.d.ts.map
@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _objectSpread2;
var _defineProperty = require("./defineProperty.js");
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
(0, _defineProperty.default)(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
//# sourceMappingURL=objectSpread2.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_K","2":"_I"},C:{"1":"_ZP _uD","2":"_o _oC _L","132":"_H _GS _PJ _aK _1T","1090":"MC","1412":"QC","1668":"NC _bM"},D:{"1":"_MS","2":"_BR","2114":"OC"},E:{"1":"_bE","2":"_TB","4100":"_oJ _kL"},F:{"1":"_bJ","2":"_qO","8196":"_AJ _5N _8K"},G:{"1":"_sH","2":"_3","4100":"_iR"},H:{"2":"1D"},I:{"2":"_P"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"16388":"I"},M:{"16388":"YC"},N:{"2":"_A"},O:{"2":"bC"},P:{"2":"_F"},Q:{"2":"JE"},R:{"2":"KE"},S:{"2":"_C"}},B:5,C:"Picture-in-Picture",D:true};
@@ -0,0 +1,126 @@
{
"name": "ajv",
"version": "8.20.0",
"description": "Another JSON Schema Validator",
"main": "dist/ajv.js",
"types": "dist/ajv.d.ts",
"files": [
"lib/",
"dist/",
".runkit_example.js"
],
"sideEffects": false,
"scripts": {
"eslint": "eslint \"lib/**/*.ts\" \"spec/**/*.*s\" --ignore-pattern spec/JSON-Schema-Test-Suite",
"prettier:write": "prettier --write \"./**/*.{json,yaml,js,ts}\"",
"prettier:check": "prettier --list-different \"./**/*.{json,yaml,js,ts}\"",
"test-spec": "cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register \"spec/**/*.spec.{ts,js}\" -R dot",
"test-codegen": "nyc cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register 'spec/codegen.spec.ts' -R spec",
"test-debug": "npm run test-spec -- --inspect-brk",
"test-cov": "nyc npm run test-spec",
"rollup": "rm -rf bundle && rollup -c",
"bundle": "rm -rf bundle && node ./scripts/bundle.js ajv ajv7 ajv7 && node ./scripts/bundle.js 2019 ajv2019 ajv2019 && node ./scripts/bundle.js 2020 ajv2020 ajv2020 && node ./scripts/bundle.js jtd ajvJTD ajvJTD",
"build": "rm -rf dist && tsc && cp -r lib/refs dist && rm dist/refs/json-schema-2019-09/index.ts && rm dist/refs/json-schema-2020-12/index.ts && rm dist/refs/jtd-schema.ts",
"json-tests": "rm -rf spec/_json/*.js && node scripts/jsontests",
"test-karma": "karma start",
"test-browser": "rm -rf .browser && npm run bundle && scripts/prepare-tests && karma start",
"test-all": "npm run test-cov",
"test": "npm run json-tests && npm run prettier:check && npm run eslint && npm link && npm link --legacy-peer-deps ajv && npm run test-cov",
"test-ci": "AJV_FULL_TEST=true npm test",
"prepublish": "npm run build",
"benchmark": "npm i && npm run build && npm link && cd ./benchmark && npm link --legacy-peer-deps ajv && npm i && node ./jtd",
"docs:dev": "./scripts/prepare-site && vuepress dev docs",
"docs:build": "./scripts/prepare-site && vuepress build docs"
},
"nyc": {
"exclude": [
"**/spec/**",
"node_modules"
],
"reporter": [
"lcov",
"text-summary"
]
},
"repository": "ajv-validator/ajv",
"keywords": [
"JSON",
"schema",
"validator",
"validation",
"jsonschema",
"json-schema",
"json-schema-validator",
"json-schema-validation"
],
"author": "Evgeny Poberezkin",
"license": "MIT",
"bugs": "https://github.com/ajv-validator/ajv/issues",
"homepage": "https://ajv.js.org",
"runkitExampleFilename": ".runkit_example.js",
"dependencies": {
"fast-deep-equal": "^3.1.3",
"fast-uri": "^3.0.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2"
},
"devDependencies": {
"@ajv-validator/config": "^0.5.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.30",
"@types/require-from-string": "^1.2.3",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"ajv-formats": "^3.0.1",
"browserify": "^17.0.0",
"chai": "^4.4.1",
"cross-env": "^7.0.3",
"dayjs": "^1.11.10",
"dayjs-plugin-utc": "^0.1.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"glob": "^10.3.10",
"husky": "^9.0.11",
"jimp": "^0.22.10",
"js-beautify": "^1.15.1",
"json-schema-test": "^2.0.0",
"karma": "^6.4.2",
"karma-chrome-launcher": "^3.2.0",
"karma-mocha": "^2.0.1",
"lint-staged": "^15.2.2",
"mocha": "^10.3.0",
"module-from-string": "^3.3.0",
"node-fetch": "^3.3.2",
"nyc": "^15.1.0",
"prettier": "3.0.3",
"re2": "^1.20.9",
"rollup": "^2.79.1",
"rollup-plugin-terser": "^7.0.2",
"ts-node": "^10.9.2",
"tsify": "^5.0.4",
"typescript": "5.3.3",
"uri-js": "^4.4.1"
},
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/ajv"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
},
"prettier": "@ajv-validator/config/prettierrc.json",
"husky": {
"hooks": {
"pre-commit": "lint-staged && npm test"
}
},
"lint-staged": {
"*.{json,yaml,js,ts}": "prettier --write"
}
}
@@ -0,0 +1,12 @@
export declare const EXPANSION_MAX = 100000;
export declare const EXPANSION_MAX_LENGTH = 4000000;
export declare const EXPANSION_MAX_DEPTH = 1000;
export declare const EXPANSION_MAX_REWRITES = 1000;
export type BraceExpansionOptions = {
max?: number;
maxLength?: number;
maxDepth?: number;
maxRewrites?: number;
};
export declare function expand(str: string, options?: BraceExpansionOptions): string[];
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"completable.js","sourceRoot":"","sources":["../../../src/server/completable.ts"],"names":[],"mappings":";;;AAuBA,kCAQC;AAKD,sCAEC;AAKD,oCAGC;AAMD,8CAEC;AApDY,QAAA,kBAAkB,GAAkB,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAiB/E;;;GAGG;AACH,SAAgB,WAAW,CAAsB,MAAS,EAAE,QAA6B;IACrF,MAAM,CAAC,cAAc,CAAC,MAAgB,EAAE,0BAAkB,EAAE;QACxD,KAAK,EAAE,EAAE,QAAQ,EAAwB;QACzC,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,KAAK;KACtB,CAAC,CAAC;IACH,OAAO,MAA8B,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,MAAe;IACzC,OAAO,CAAC,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,0BAAkB,IAAK,MAAiB,CAAC;AAC9F,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAsB,MAAS;IACvD,MAAM,IAAI,GAAI,MAAmE,CAAC,0BAAkB,CAAC,CAAC;IACtG,OAAO,IAAI,EAAE,QAA2C,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAsB,MAA4B;IAC/E,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,4CAA4C;AAC5C,wDAAwD;AACxD,IAAY,cAEX;AAFD,WAAY,cAAc;IACtB,gDAA8B,CAAA;AAClC,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB"}
@@ -0,0 +1,109 @@
# dom-serializer [![Build Status](https://travis-ci.com/cheeriojs/dom-serializer.svg?branch=master)](https://travis-ci.com/cheeriojs/dom-serializer)
Renders a [domhandler](https://github.com/fb55/domhandler) DOM node or an array of domhandler DOM nodes to a string.
```js
import render from "dom-serializer";
// OR
const render = require("dom-serializer").default;
```
# API
## `render`
▸ **render**(`node`: Node \| Node[], `options?`: [_Options_](#Options)): _string_
Renders a DOM node or an array of DOM nodes to a string.
Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
#### Parameters:
| Name | Type | Default value | Description |
| :-------- | :--------------------------------- | :------------ | :----------------------------- |
| `node` | Node \| Node[] | - | Node to be rendered. |
| `options` | [_DomSerializerOptions_](#Options) | {} | Changes serialization behavior |
**Returns:** _string_
## Options
### `encodeEntities`
• `Optional` **decodeEntities**: _boolean | "utf8"_
Encode characters that are either reserved in HTML or XML.
If `xmlMode` is `true` or the value not `'utf8'`, characters outside of the utf8 range will be encoded as well.
**`default`** `decodeEntities`
---
### `decodeEntities`
• `Optional` **decodeEntities**: _boolean_
Option inherited from parsing; will be used as the default value for `encodeEntities`.
**`default`** true
---
### `emptyAttrs`
• `Optional` **emptyAttrs**: _boolean_
Print an empty attribute's value.
**`default`** xmlMode
**`example`** With <code>emptyAttrs: false</code>: <code>&lt;input checked&gt;</code>
**`example`** With <code>emptyAttrs: true</code>: <code>&lt;input checked=""&gt;</code>
---
### `selfClosingTags`
• `Optional` **selfClosingTags**: _boolean_
Print self-closing tags for tags without contents.
**`default`** xmlMode
**`example`** With <code>selfClosingTags: false</code>: <code>&lt;foo&gt;&lt;/foo&gt;</code>
**`example`** With <code>selfClosingTags: true</code>: <code>&lt;foo /&gt;</code>
---
### `xmlMode`
• `Optional` **xmlMode**: _boolean_ \| _"foreign"_
Treat the input as an XML document; enables the `emptyAttrs` and `selfClosingTags` options.
If the value is `"foreign"`, it will try to correct mixed-case attribute names.
**`default`** false
---
## Ecosystem
| Name | Description |
| ------------------------------------------------------------- | ------------------------------------------------------- |
| [htmlparser2](https://github.com/fb55/htmlparser2) | Fast & forgiving HTML/XML parser |
| [domhandler](https://github.com/fb55/domhandler) | Handler for htmlparser2 that turns documents into a DOM |
| [domutils](https://github.com/fb55/domutils) | Utilities for working with domhandler's DOM |
| [css-select](https://github.com/fb55/css-select) | CSS selector engine, compatible with domhandler's DOM |
| [cheerio](https://github.com/cheeriojs/cheerio) | The jQuery API for domhandler's DOM |
| [dom-serializer](https://github.com/cheeriojs/dom-serializer) | Serializer for domhandler's DOM |
---
LICENSE: MIT
@@ -0,0 +1,8 @@
import type { TSESTree } from '@typescript-eslint/types';
import type { ScopeManager } from '../ScopeManager';
import type { Scope } from './Scope';
import { ScopeBase } from './ScopeBase';
import { ScopeType } from './ScopeType';
export declare class ForScope extends ScopeBase<ScopeType.for, TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement, Scope> {
constructor(scopeManager: ScopeManager, upperScope: ForScope['upper'], block: ForScope['block']);
}
@@ -0,0 +1,663 @@
import Tokenizer, { type Callbacks, QuoteType } from "./Tokenizer.js";
import { fromCodePoint } from "entities/decode";
const formTags = new Set([
"input",
"option",
"optgroup",
"select",
"button",
"datalist",
"textarea",
]);
const pTag = new Set(["p"]);
const tableSectionTags = new Set(["thead", "tbody"]);
const ddtTags = new Set(["dd", "dt"]);
const rtpTags = new Set(["rt", "rp"]);
const openImpliesClose = new Map<string, Set<string>>([
["tr", new Set(["tr", "th", "td"])],
["th", new Set(["th"])],
["td", new Set(["thead", "th", "td"])],
["body", new Set(["head", "link", "script"])],
["li", new Set(["li"])],
["p", pTag],
["h1", pTag],
["h2", pTag],
["h3", pTag],
["h4", pTag],
["h5", pTag],
["h6", pTag],
["select", formTags],
["input", formTags],
["output", formTags],
["button", formTags],
["datalist", formTags],
["textarea", formTags],
["option", new Set(["option"])],
["optgroup", new Set(["optgroup", "option"])],
["dd", ddtTags],
["dt", ddtTags],
["address", pTag],
["article", pTag],
["aside", pTag],
["blockquote", pTag],
["details", pTag],
["div", pTag],
["dl", pTag],
["fieldset", pTag],
["figcaption", pTag],
["figure", pTag],
["footer", pTag],
["form", pTag],
["header", pTag],
["hr", pTag],
["main", pTag],
["nav", pTag],
["ol", pTag],
["pre", pTag],
["section", pTag],
["table", pTag],
["ul", pTag],
["rt", rtpTags],
["rp", rtpTags],
["tbody", tableSectionTags],
["tfoot", tableSectionTags],
]);
const voidElements = new Set([
"area",
"base",
"basefont",
"br",
"col",
"command",
"embed",
"frame",
"hr",
"img",
"input",
"isindex",
"keygen",
"link",
"meta",
"param",
"source",
"track",
"wbr",
]);
const foreignContextElements = new Set(["math", "svg"]);
const htmlIntegrationElements = new Set([
"mi",
"mo",
"mn",
"ms",
"mtext",
"annotation-xml",
"foreignobject",
"desc",
"title",
]);
export interface ParserOptions {
/**
* Indicates whether special tags (`<script>`, `<style>`, and `<title>`) should get special treatment
* and if "empty" tags (eg. `<br>`) can have children. If `false`, the content of special tags
* will be text only. For feeds and other XML content (documents that don't consist of HTML),
* set this to `true`.
*
* @default false
*/
xmlMode?: boolean;
/**
* Decode entities within the document.
*
* @default true
*/
decodeEntities?: boolean;
/**
* If set to true, all tags will be lowercased.
*
* @default !xmlMode
*/
lowerCaseTags?: boolean;
/**
* If set to `true`, all attribute names will be lowercased. This has noticeable impact on speed.
*
* @default !xmlMode
*/
lowerCaseAttributeNames?: boolean;
/**
* If set to true, CDATA sections will be recognized as text even if the xmlMode option is not enabled.
* NOTE: If xmlMode is set to `true` then CDATA sections will always be recognized as text.
*
* @default xmlMode
*/
recognizeCDATA?: boolean;
/**
* If set to `true`, self-closing tags will trigger the onclosetag event even if xmlMode is not set to `true`.
* NOTE: If xmlMode is set to `true` then self-closing tags will always be recognized.
*
* @default xmlMode
*/
recognizeSelfClosing?: boolean;
/**
* Allows the default tokenizer to be overwritten.
*/
Tokenizer?: typeof Tokenizer;
}
export interface Handler {
onparserinit(parser: Parser): void;
/**
* Resets the handler back to starting state
*/
onreset(): void;
/**
* Signals the handler that parsing is done
*/
onend(): void;
onerror(error: Error): void;
onclosetag(name: string, isImplied: boolean): void;
onopentagname(name: string): void;
/**
*
* @param name Name of the attribute
* @param value Value of the attribute.
* @param quote Quotes used around the attribute. `null` if the attribute has no quotes around the value, `undefined` if the attribute has no value.
*/
onattribute(
name: string,
value: string,
quote?: string | undefined | null,
): void;
onopentag(
name: string,
attribs: { [s: string]: string },
isImplied: boolean,
): void;
ontext(data: string): void;
oncomment(data: string): void;
oncdatastart(): void;
oncdataend(): void;
oncommentend(): void;
onprocessinginstruction(name: string, data: string): void;
}
const reNameEnd = /\s|\//;
export class Parser implements Callbacks {
/** The start index of the last event. */
public startIndex = 0;
/** The end index of the last event. */
public endIndex = 0;
/**
* Store the start index of the current open tag,
* so we can update the start index for attributes.
*/
private openTagStart = 0;
private tagname = "";
private attribname = "";
private attribvalue = "";
private attribs: null | { [key: string]: string } = null;
private readonly stack: string[] = [];
/** Determines whether self-closing tags are recognized. */
private readonly foreignContext: boolean[];
private readonly cbs: Partial<Handler>;
private readonly lowerCaseTagNames: boolean;
private readonly lowerCaseAttributeNames: boolean;
private readonly recognizeSelfClosing: boolean;
/** We are parsing HTML. Inverse of the `xmlMode` option. */
private readonly htmlMode: boolean;
private readonly tokenizer: Tokenizer;
private readonly buffers: string[] = [];
private bufferOffset = 0;
/** The index of the last written buffer. Used when resuming after a `pause()`. */
private writeIndex = 0;
/** Indicates whether the parser has finished running / `.end` has been called. */
private ended = false;
constructor(
cbs?: Partial<Handler> | null,
private readonly options: ParserOptions = {},
) {
this.cbs = cbs ?? {};
this.htmlMode = !this.options.xmlMode;
this.lowerCaseTagNames = options.lowerCaseTags ?? this.htmlMode;
this.lowerCaseAttributeNames =
options.lowerCaseAttributeNames ?? this.htmlMode;
this.recognizeSelfClosing =
options.recognizeSelfClosing ?? !this.htmlMode;
this.tokenizer = new (options.Tokenizer ?? Tokenizer)(
this.options,
this,
);
this.foreignContext = [!this.htmlMode];
this.cbs.onparserinit?.(this);
}
// Tokenizer event handlers
/** @internal */
ontext(start: number, endIndex: number): void {
const data = this.getSlice(start, endIndex);
this.endIndex = endIndex - 1;
this.cbs.ontext?.(data);
this.startIndex = endIndex;
}
/** @internal */
ontextentity(cp: number, endIndex: number): void {
this.endIndex = endIndex - 1;
this.cbs.ontext?.(fromCodePoint(cp));
this.startIndex = endIndex;
}
/**
* Checks if the current tag is a void element. Override this if you want
* to specify your own additional void elements.
*/
protected isVoidElement(name: string): boolean {
return this.htmlMode && voidElements.has(name);
}
/** @internal */
onopentagname(start: number, endIndex: number): void {
this.endIndex = endIndex;
let name = this.getSlice(start, endIndex);
if (this.lowerCaseTagNames) {
name = name.toLowerCase();
}
this.emitOpenTag(name);
}
private emitOpenTag(name: string) {
this.openTagStart = this.startIndex;
this.tagname = name;
const impliesClose = this.htmlMode && openImpliesClose.get(name);
if (impliesClose) {
while (this.stack.length > 0 && impliesClose.has(this.stack[0])) {
const element = this.stack.shift()!;
this.cbs.onclosetag?.(element, true);
}
}
if (!this.isVoidElement(name)) {
this.stack.unshift(name);
if (this.htmlMode) {
if (foreignContextElements.has(name)) {
this.foreignContext.unshift(true);
} else if (htmlIntegrationElements.has(name)) {
this.foreignContext.unshift(false);
}
}
}
this.cbs.onopentagname?.(name);
if (this.cbs.onopentag) this.attribs = {};
}
private endOpenTag(isImplied: boolean) {
this.startIndex = this.openTagStart;
if (this.attribs) {
this.cbs.onopentag?.(this.tagname, this.attribs, isImplied);
this.attribs = null;
}
if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) {
this.cbs.onclosetag(this.tagname, true);
}
this.tagname = "";
}
/** @internal */
onopentagend(endIndex: number): void {
this.endIndex = endIndex;
this.endOpenTag(false);
// Set `startIndex` for next node
this.startIndex = endIndex + 1;
}
/** @internal */
onclosetag(start: number, endIndex: number): void {
this.endIndex = endIndex;
let name = this.getSlice(start, endIndex);
if (this.lowerCaseTagNames) {
name = name.toLowerCase();
}
if (
this.htmlMode &&
(foreignContextElements.has(name) ||
htmlIntegrationElements.has(name))
) {
this.foreignContext.shift();
}
if (!this.isVoidElement(name)) {
const pos = this.stack.indexOf(name);
if (pos !== -1) {
for (let index = 0; index <= pos; index++) {
const element = this.stack.shift()!;
// We know the stack has sufficient elements.
this.cbs.onclosetag?.(element, index !== pos);
}
} else if (this.htmlMode && name === "p") {
// Implicit open before close
this.emitOpenTag("p");
this.closeCurrentTag(true);
}
} else if (this.htmlMode && name === "br") {
// We can't use `emitOpenTag` for implicit open, as `br` would be implicitly closed.
this.cbs.onopentagname?.("br");
this.cbs.onopentag?.("br", {}, true);
this.cbs.onclosetag?.("br", false);
}
// Set `startIndex` for next node
this.startIndex = endIndex + 1;
}
/** @internal */
onselfclosingtag(endIndex: number): void {
this.endIndex = endIndex;
if (this.recognizeSelfClosing || this.foreignContext[0]) {
this.closeCurrentTag(false);
// Set `startIndex` for next node
this.startIndex = endIndex + 1;
} else {
// Ignore the fact that the tag is self-closing.
this.onopentagend(endIndex);
}
}
private closeCurrentTag(isOpenImplied: boolean) {
const name = this.tagname;
this.endOpenTag(isOpenImplied);
// Self-closing tags will be on the top of the stack
if (this.stack[0] === name) {
// If the opening tag isn't implied, the closing tag has to be implied.
this.cbs.onclosetag?.(name, !isOpenImplied);
this.stack.shift();
}
}
/** @internal */
onattribname(start: number, endIndex: number): void {
this.startIndex = start;
const name = this.getSlice(start, endIndex);
this.attribname = this.lowerCaseAttributeNames
? name.toLowerCase()
: name;
}
/** @internal */
onattribdata(start: number, endIndex: number): void {
this.attribvalue += this.getSlice(start, endIndex);
}
/** @internal */
onattribentity(cp: number): void {
this.attribvalue += fromCodePoint(cp);
}
/** @internal */
onattribend(quote: QuoteType, endIndex: number): void {
this.endIndex = endIndex;
this.cbs.onattribute?.(
this.attribname,
this.attribvalue,
quote === QuoteType.Double
? '"'
: quote === QuoteType.Single
? "'"
: quote === QuoteType.NoValue
? undefined
: null,
);
if (
this.attribs &&
!Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)
) {
this.attribs[this.attribname] = this.attribvalue;
}
this.attribvalue = "";
}
private getInstructionName(value: string) {
const index = value.search(reNameEnd);
let name = index < 0 ? value : value.substr(0, index);
if (this.lowerCaseTagNames) {
name = name.toLowerCase();
}
return name;
}
/** @internal */
ondeclaration(start: number, endIndex: number): void {
this.endIndex = endIndex;
const value = this.getSlice(start, endIndex);
if (this.cbs.onprocessinginstruction) {
const name = this.getInstructionName(value);
this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);
}
// Set `startIndex` for next node
this.startIndex = endIndex + 1;
}
/** @internal */
onprocessinginstruction(start: number, endIndex: number): void {
this.endIndex = endIndex;
const value = this.getSlice(start, endIndex);
if (this.cbs.onprocessinginstruction) {
const name = this.getInstructionName(value);
this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);
}
// Set `startIndex` for next node
this.startIndex = endIndex + 1;
}
/** @internal */
oncomment(start: number, endIndex: number, offset: number): void {
this.endIndex = endIndex;
this.cbs.oncomment?.(this.getSlice(start, endIndex - offset));
this.cbs.oncommentend?.();
// Set `startIndex` for next node
this.startIndex = endIndex + 1;
}
/** @internal */
oncdata(start: number, endIndex: number, offset: number): void {
this.endIndex = endIndex;
const value = this.getSlice(start, endIndex - offset);
if (!this.htmlMode || this.options.recognizeCDATA) {
this.cbs.oncdatastart?.();
this.cbs.ontext?.(value);
this.cbs.oncdataend?.();
} else {
this.cbs.oncomment?.(`[CDATA[${value}]]`);
this.cbs.oncommentend?.();
}
// Set `startIndex` for next node
this.startIndex = endIndex + 1;
}
/** @internal */
onend(): void {
if (this.cbs.onclosetag) {
// Set the end index for all remaining tags
this.endIndex = this.startIndex;
for (let index = 0; index < this.stack.length; index++) {
this.cbs.onclosetag(this.stack[index], true);
}
}
this.cbs.onend?.();
}
/**
* Resets the parser to a blank state, ready to parse a new HTML document
*/
public reset(): void {
this.cbs.onreset?.();
this.tokenizer.reset();
this.tagname = "";
this.attribname = "";
this.attribs = null;
this.stack.length = 0;
this.startIndex = 0;
this.endIndex = 0;
this.cbs.onparserinit?.(this);
this.buffers.length = 0;
this.foreignContext.length = 0;
this.foreignContext.unshift(!this.htmlMode);
this.bufferOffset = 0;
this.writeIndex = 0;
this.ended = false;
}
/**
* Resets the parser, then parses a complete document and
* pushes it to the handler.
*
* @param data Document to parse.
*/
public parseComplete(data: string): void {
this.reset();
this.end(data);
}
private getSlice(start: number, end: number) {
while (start - this.bufferOffset >= this.buffers[0].length) {
this.shiftBuffer();
}
let slice = this.buffers[0].slice(
start - this.bufferOffset,
end - this.bufferOffset,
);
while (end - this.bufferOffset > this.buffers[0].length) {
this.shiftBuffer();
slice += this.buffers[0].slice(0, end - this.bufferOffset);
}
return slice;
}
private shiftBuffer(): void {
this.bufferOffset += this.buffers[0].length;
this.writeIndex--;
this.buffers.shift();
}
/**
* Parses a chunk of data and calls the corresponding callbacks.
*
* @param chunk Chunk to parse.
*/
public write(chunk: string): void {
if (this.ended) {
this.cbs.onerror?.(new Error(".write() after done!"));
return;
}
this.buffers.push(chunk);
if (this.tokenizer.running) {
this.tokenizer.write(chunk);
this.writeIndex++;
}
}
/**
* Parses the end of the buffer and clears the stack, calls onend.
*
* @param chunk Optional final chunk to parse.
*/
public end(chunk?: string): void {
if (this.ended) {
this.cbs.onerror?.(new Error(".end() after done!"));
return;
}
if (chunk) this.write(chunk);
this.ended = true;
this.tokenizer.end();
}
/**
* Pauses parsing. The parser won't emit events until `resume` is called.
*/
public pause(): void {
this.tokenizer.pause();
}
/**
* Resumes parsing after `pause` was called.
*/
public resume(): void {
this.tokenizer.resume();
while (
this.tokenizer.running &&
this.writeIndex < this.buffers.length
) {
this.tokenizer.write(this.buffers[this.writeIndex++]);
}
if (this.ended) this.tokenizer.end();
}
/**
* Alias of `write`, for backwards compatibility.
*
* @param chunk Chunk to parse.
* @deprecated
*/
public parseChunk(chunk: string): void {
this.write(chunk);
}
/**
* Alias of `end`, for backwards compatibility.
*
* @param chunk Optional final chunk to parse.
* @deprecated
*/
public done(chunk?: string): void {
this.end(chunk);
}
}
@@ -0,0 +1 @@
{"version":3,"file":"chart-no-axes-column-decreasing.js","sources":["../../../src/icons/chart-no-axes-column-decreasing.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ChartNoAxesColumnDecreasing\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMjBWMTAiIC8+CiAgPHBhdGggZD0iTTE4IDIwdi00IiAvPgogIDxwYXRoIGQ9Ik02IDIwVjQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/chart-no-axes-column-decreasing\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 ChartNoAxesColumnDecreasing = createLucideIcon('ChartNoAxesColumnDecreasing', [\n ['path', { d: 'M12 20V10', key: 'g8npz5' }],\n ['path', { d: 'M18 20v-4', key: '8uic4z' }],\n ['path', { d: 'M6 20V4', key: '1w1bmo' }],\n]);\n\nexport default ChartNoAxesColumnDecreasing;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B,iBAAiB,6BAA+B,CAAA,CAAA,CAAA;AAAA,CAAA,CAClF,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,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;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,45 @@
react-style-singleton
====
__300b__ with all dependencies, minified and gzipped
Creates a style component with internal _tracker_.
- Adds styles to the browser on the __first__ instance mount.
- Removes after the __last__ instance unmount.
- Thus helps you deliver styles you need to the customer, and clean up later.
- Is not server-side rendering compatible!
# API
## Component
```js
import {styleSingleton} from 'react-style-singleton'
const Style = styleSingleton();
export const App = () => (
<Style styles={'body {color:red}'} />
);
```
## Hook
```js
import {styleHookSingleton} from 'react-style-singleton';
const useStyle = styleHookSingleton();
const useAnotherStyle = styleHookSingleton();
export const App = () => {
useStyle('div {color:red}');
useAnotherStyle('body { background-color:red }');
return (<div />);
}
```
# License
MIT
@@ -0,0 +1,714 @@
{
"name": "hono",
"version": "4.13.13",
"description": "Web framework built on Web Standards",
"main": "dist/cjs/index.js",
"type": "module",
"module": "dist/index.js",
"types": "dist/types/index.d.ts",
"files": [
"dist",
"!dist/**/*.tsbuildinfo"
],
"scripts": {
"test": "tsc -p tsconfig.spec.json && vp test --run",
"test:watch": "vp test --watch",
"test:deno": "deno test --allow-read --allow-env --allow-write --allow-net -c runtime-tests/deno/deno.json runtime-tests/deno && deno test --no-lock -c runtime-tests/deno-jsx/deno.precompile.json runtime-tests/deno-jsx && deno test --no-lock -c runtime-tests/deno-jsx/deno.react-jsx.json runtime-tests/deno-jsx",
"test:bun": "bun test --jsx-import-source ../../src/jsx runtime-tests/bun",
"test:fastly": "vp test --run --project fastly",
"test:node": "vp test --run --project node",
"test:workerd": "vp test --run --project workerd",
"test:all": "pnpm run test && pnpm run test:deno && pnpm run test:bun",
"check": "vp check",
"check:fix": "vp check --fix",
"lint": "vp lint src runtime-tests build perf-measures benchmarks adapters",
"lint:fix": "vp lint --fix src runtime-tests build perf-measures benchmarks adapters",
"format": "vp fmt --check \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\" \"perf-measures/**/*.{js,ts,tsx}\" \"benchmarks/**/*.{js,ts,tsx}\" \"adapters/**/*.{js,ts,tsx}\"",
"format:fix": "vp fmt \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\" \"perf-measures/**/*.{js,ts,tsx}\" \"benchmarks/**/*.{js,ts,tsx}\" \"adapters/**/*.{js,ts,tsx}\"",
"editorconfig-checker": "editorconfig-checker",
"copy:package.cjs.json": "cp ./package.cjs.json ./dist/cjs/package.json && cp ./package.cjs.json ./dist/types/package.json",
"build": "pnpm run remove-dist && vp pack && pnpm run copy:package.cjs.json && publint",
"watch": "pnpm run remove-dist && vp pack --watch && pnpm run copy:package.cjs.json",
"coverage": "vp test --run --coverage",
"prerelease": "pnpm run test:deno && pnpm run build",
"release": "np --no-publish",
"remove-dist": "rm -rf dist",
"build:adapters": "pnpm -r --filter \"./adapters/*\" run build",
"test:adapters": "pnpm -r --filter \"./adapters/*\" run test",
"release:adapter": "node ./build/release-adapter.ts"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/cjs/index.js"
},
"./request": {
"types": "./dist/types/request.d.ts",
"import": "./dist/request.js",
"require": "./dist/cjs/request.js"
},
"./types": {
"types": "./dist/types/types.d.ts",
"import": "./dist/types.js",
"require": "./dist/cjs/types.js"
},
"./hono-base": {
"types": "./dist/types/hono-base.d.ts",
"import": "./dist/hono-base.js",
"require": "./dist/cjs/hono-base.js"
},
"./tiny": {
"types": "./dist/types/preset/tiny.d.ts",
"import": "./dist/preset/tiny.js",
"require": "./dist/cjs/preset/tiny.js"
},
"./quick": {
"types": "./dist/types/preset/quick.d.ts",
"import": "./dist/preset/quick.js",
"require": "./dist/cjs/preset/quick.js"
},
"./http-exception": {
"types": "./dist/types/http-exception.d.ts",
"import": "./dist/http-exception.js",
"require": "./dist/cjs/http-exception.js"
},
"./basic-auth": {
"types": "./dist/types/middleware/basic-auth/index.d.ts",
"import": "./dist/middleware/basic-auth/index.js",
"require": "./dist/cjs/middleware/basic-auth/index.js"
},
"./bearer-auth": {
"types": "./dist/types/middleware/bearer-auth/index.d.ts",
"import": "./dist/middleware/bearer-auth/index.js",
"require": "./dist/cjs/middleware/bearer-auth/index.js"
},
"./body-limit": {
"types": "./dist/types/middleware/body-limit/index.d.ts",
"import": "./dist/middleware/body-limit/index.js",
"require": "./dist/cjs/middleware/body-limit/index.js"
},
"./ip-restriction": {
"types": "./dist/types/middleware/ip-restriction/index.d.ts",
"import": "./dist/middleware/ip-restriction/index.js",
"require": "./dist/cjs/middleware/ip-restriction/index.js"
},
"./cache": {
"types": "./dist/types/middleware/cache/index.d.ts",
"import": "./dist/middleware/cache/index.js",
"require": "./dist/cjs/middleware/cache/index.js"
},
"./route": {
"types": "./dist/types/helper/route/index.d.ts",
"import": "./dist/helper/route/index.js",
"require": "./dist/cjs/helper/route/index.js"
},
"./mount": {
"types": "./dist/types/middleware/mount/index.d.ts",
"import": "./dist/middleware/mount/index.js",
"require": "./dist/cjs/middleware/mount/index.js"
},
"./cookie": {
"types": "./dist/types/helper/cookie/index.d.ts",
"import": "./dist/helper/cookie/index.js",
"require": "./dist/cjs/helper/cookie/index.js"
},
"./accepts": {
"types": "./dist/types/helper/accepts/index.d.ts",
"import": "./dist/helper/accepts/index.js",
"require": "./dist/cjs/helper/accepts/index.js"
},
"./compress": {
"types": "./dist/types/middleware/compress/index.d.ts",
"import": "./dist/middleware/compress/index.js",
"require": "./dist/cjs/middleware/compress/index.js"
},
"./context-storage": {
"types": "./dist/types/middleware/context-storage/index.d.ts",
"import": "./dist/middleware/context-storage/index.js",
"require": "./dist/cjs/middleware/context-storage/index.js"
},
"./cors": {
"types": "./dist/types/middleware/cors/index.d.ts",
"import": "./dist/middleware/cors/index.js",
"require": "./dist/cjs/middleware/cors/index.js"
},
"./csrf": {
"types": "./dist/types/middleware/csrf/index.d.ts",
"import": "./dist/middleware/csrf/index.js",
"require": "./dist/cjs/middleware/csrf/index.js"
},
"./etag": {
"types": "./dist/types/middleware/etag/index.d.ts",
"import": "./dist/middleware/etag/index.js",
"require": "./dist/cjs/middleware/etag/index.js"
},
"./trailing-slash": {
"types": "./dist/types/middleware/trailing-slash/index.d.ts",
"import": "./dist/middleware/trailing-slash/index.js",
"require": "./dist/cjs/middleware/trailing-slash/index.js"
},
"./html": {
"types": "./dist/types/helper/html/index.d.ts",
"import": "./dist/helper/html/index.js",
"require": "./dist/cjs/helper/html/index.js"
},
"./css": {
"types": "./dist/types/helper/css/index.d.ts",
"import": "./dist/helper/css/index.js",
"require": "./dist/cjs/helper/css/index.js"
},
"./jsx": {
"types": "./dist/types/jsx/index.d.ts",
"import": "./dist/jsx/index.js",
"require": "./dist/cjs/jsx/index.js"
},
"./jsx/jsx-dev-runtime": {
"types": "./dist/types/jsx/jsx-dev-runtime.d.ts",
"import": "./dist/jsx/jsx-dev-runtime.js",
"require": "./dist/cjs/jsx/jsx-dev-runtime.js"
},
"./jsx/jsx-runtime": {
"types": "./dist/types/jsx/jsx-runtime.d.ts",
"import": "./dist/jsx/jsx-runtime.js",
"require": "./dist/cjs/jsx/jsx-runtime.js"
},
"./jsx/streaming": {
"types": "./dist/types/jsx/streaming.d.ts",
"import": "./dist/jsx/streaming.js",
"require": "./dist/cjs/jsx/streaming.js"
},
"./jsx-renderer": {
"types": "./dist/types/middleware/jsx-renderer/index.d.ts",
"import": "./dist/middleware/jsx-renderer/index.js",
"require": "./dist/cjs/middleware/jsx-renderer/index.js"
},
"./jsx/dom": {
"types": "./dist/types/jsx/dom/index.d.ts",
"import": "./dist/jsx/dom/index.js",
"require": "./dist/cjs/jsx/dom/index.js"
},
"./jsx/dom/jsx-dev-runtime": {
"types": "./dist/types/jsx/dom/jsx-dev-runtime.d.ts",
"import": "./dist/jsx/dom/jsx-dev-runtime.js",
"require": "./dist/cjs/jsx/dom/jsx-dev-runtime.js"
},
"./jsx/dom/jsx-runtime": {
"types": "./dist/types/jsx/dom/jsx-runtime.d.ts",
"import": "./dist/jsx/dom/jsx-runtime.js",
"require": "./dist/cjs/jsx/dom/jsx-runtime.js"
},
"./jsx/dom/client": {
"types": "./dist/types/jsx/dom/client.d.ts",
"import": "./dist/jsx/dom/client.js",
"require": "./dist/cjs/jsx/dom/client.js"
},
"./jsx/dom/css": {
"types": "./dist/types/jsx/dom/css.d.ts",
"import": "./dist/jsx/dom/css.js",
"require": "./dist/cjs/jsx/dom/css.js"
},
"./jsx/dom/server": {
"types": "./dist/types/jsx/dom/server.d.ts",
"import": "./dist/jsx/dom/server.js",
"require": "./dist/cjs/jsx/dom/server.js"
},
"./jwt": {
"types": "./dist/types/middleware/jwt/index.d.ts",
"import": "./dist/middleware/jwt/index.js",
"require": "./dist/cjs/middleware/jwt/index.js"
},
"./jwk": {
"types": "./dist/types/middleware/jwk/index.d.ts",
"import": "./dist/middleware/jwk/index.js",
"require": "./dist/cjs/middleware/jwk/index.js"
},
"./timeout": {
"types": "./dist/types/middleware/timeout/index.d.ts",
"import": "./dist/middleware/timeout/index.js",
"require": "./dist/cjs/middleware/timeout/index.js"
},
"./timing": {
"types": "./dist/types/middleware/timing/index.d.ts",
"import": "./dist/middleware/timing/index.js",
"require": "./dist/cjs/middleware/timing/index.js"
},
"./logger": {
"types": "./dist/types/middleware/logger/index.d.ts",
"import": "./dist/middleware/logger/index.js",
"require": "./dist/cjs/middleware/logger/index.js"
},
"./method-not-allowed": {
"types": "./dist/types/middleware/method-not-allowed/index.d.ts",
"import": "./dist/middleware/method-not-allowed/index.js",
"require": "./dist/cjs/middleware/method-not-allowed/index.js"
},
"./method-override": {
"types": "./dist/types/middleware/method-override/index.d.ts",
"import": "./dist/middleware/method-override/index.js",
"require": "./dist/cjs/middleware/method-override/index.js"
},
"./powered-by": {
"types": "./dist/types/middleware/powered-by/index.d.ts",
"import": "./dist/middleware/powered-by/index.js",
"require": "./dist/cjs/middleware/powered-by/index.js"
},
"./pretty-json": {
"types": "./dist/types/middleware/pretty-json/index.d.ts",
"import": "./dist/middleware/pretty-json/index.js",
"require": "./dist/cjs/middleware/pretty-json/index.js"
},
"./request-id": {
"types": "./dist/types/middleware/request-id/index.d.ts",
"import": "./dist/middleware/request-id/index.js",
"require": "./dist/cjs/middleware/request-id/index.js"
},
"./language": {
"types": "./dist/types/middleware/language/index.d.ts",
"import": "./dist/middleware/language/index.js",
"require": "./dist/cjs/middleware/language/index.js"
},
"./secure-headers": {
"types": "./dist/types/middleware/secure-headers/index.d.ts",
"import": "./dist/middleware/secure-headers/index.js",
"require": "./dist/cjs/middleware/secure-headers/index.js"
},
"./combine": {
"types": "./dist/types/middleware/combine/index.d.ts",
"import": "./dist/middleware/combine/index.js",
"require": "./dist/cjs/middleware/combine/index.js"
},
"./ssg": {
"types": "./dist/types/helper/ssg/index.d.ts",
"import": "./dist/helper/ssg/index.js",
"require": "./dist/cjs/helper/ssg/index.js"
},
"./streaming": {
"types": "./dist/types/helper/streaming/index.d.ts",
"import": "./dist/helper/streaming/index.js",
"require": "./dist/cjs/helper/streaming/index.js"
},
"./validator": {
"types": "./dist/types/validator/index.d.ts",
"import": "./dist/validator/index.js",
"require": "./dist/cjs/validator/index.js"
},
"./router": {
"types": "./dist/types/router.d.ts",
"import": "./dist/router.js",
"require": "./dist/cjs/router.js"
},
"./router/reg-exp-router": {
"types": "./dist/types/router/reg-exp-router/index.d.ts",
"import": "./dist/router/reg-exp-router/index.js",
"require": "./dist/cjs/router/reg-exp-router/index.js"
},
"./router/smart-router": {
"types": "./dist/types/router/smart-router/index.d.ts",
"import": "./dist/router/smart-router/index.js",
"require": "./dist/cjs/router/smart-router/index.js"
},
"./router/trie-router": {
"types": "./dist/types/router/trie-router/index.d.ts",
"import": "./dist/router/trie-router/index.js",
"require": "./dist/cjs/router/trie-router/index.js"
},
"./router/pattern-router": {
"types": "./dist/types/router/pattern-router/index.d.ts",
"import": "./dist/router/pattern-router/index.js",
"require": "./dist/cjs/router/pattern-router/index.js"
},
"./router/linear-router": {
"types": "./dist/types/router/linear-router/index.d.ts",
"import": "./dist/router/linear-router/index.js",
"require": "./dist/cjs/router/linear-router/index.js"
},
"./utils/jwt": {
"types": "./dist/types/utils/jwt/index.d.ts",
"import": "./dist/utils/jwt/index.js",
"require": "./dist/cjs/utils/jwt/index.js"
},
"./utils/*": {
"types": "./dist/types/utils/*.d.ts",
"import": "./dist/utils/*.js",
"require": "./dist/cjs/utils/*.js"
},
"./client": {
"types": "./dist/types/client/index.d.ts",
"import": "./dist/client/index.js",
"require": "./dist/cjs/client/index.js"
},
"./adapter": {
"types": "./dist/types/helper/adapter/index.d.ts",
"import": "./dist/helper/adapter/index.js",
"require": "./dist/cjs/helper/adapter/index.js"
},
"./factory": {
"types": "./dist/types/helper/factory/index.d.ts",
"import": "./dist/helper/factory/index.js",
"require": "./dist/cjs/helper/factory/index.js"
},
"./serve-static": {
"types": "./dist/types/middleware/serve-static/index.d.ts",
"import": "./dist/middleware/serve-static/index.js",
"require": "./dist/cjs/middleware/serve-static/index.js"
},
"./cloudflare-workers": {
"types": "./dist/types/adapter/cloudflare-workers/index.d.ts",
"import": "./dist/adapter/cloudflare-workers/index.js",
"require": "./dist/cjs/adapter/cloudflare-workers/index.js"
},
"./cloudflare-pages": {
"types": "./dist/types/adapter/cloudflare-pages/index.d.ts",
"import": "./dist/adapter/cloudflare-pages/index.js",
"require": "./dist/cjs/adapter/cloudflare-pages/index.js"
},
"./deno": {
"types": "./dist/types/adapter/deno/index.d.ts",
"import": "./dist/adapter/deno/index.js",
"require": "./dist/cjs/adapter/deno/index.js"
},
"./bun": {
"types": "./dist/types/adapter/bun/index.d.ts",
"import": "./dist/adapter/bun/index.js",
"require": "./dist/cjs/adapter/bun/index.js"
},
"./aws-lambda": {
"types": "./dist/types/adapter/aws-lambda/index.d.ts",
"import": "./dist/adapter/aws-lambda/index.js",
"require": "./dist/cjs/adapter/aws-lambda/index.js"
},
"./vercel": {
"types": "./dist/types/adapter/vercel/index.d.ts",
"import": "./dist/adapter/vercel/index.js",
"require": "./dist/cjs/adapter/vercel/index.js"
},
"./netlify": {
"types": "./dist/types/adapter/netlify/index.d.ts",
"import": "./dist/adapter/netlify/index.js",
"require": "./dist/cjs/adapter/netlify/index.js"
},
"./lambda-edge": {
"types": "./dist/types/adapter/lambda-edge/index.d.ts",
"import": "./dist/adapter/lambda-edge/index.js",
"require": "./dist/cjs/adapter/lambda-edge/index.js"
},
"./service-worker": {
"types": "./dist/types/adapter/service-worker/index.d.ts",
"import": "./dist/adapter/service-worker/index.js",
"require": "./dist/cjs/adapter/service-worker/index.js"
},
"./testing": {
"types": "./dist/types/helper/testing/index.d.ts",
"import": "./dist/helper/testing/index.js",
"require": "./dist/cjs/helper/testing/index.js"
},
"./dev": {
"types": "./dist/types/helper/dev/index.d.ts",
"import": "./dist/helper/dev/index.js",
"require": "./dist/cjs/helper/dev/index.js"
},
"./ws": {
"types": "./dist/types/helper/websocket/index.d.ts",
"import": "./dist/helper/websocket/index.js",
"require": "./dist/cjs/helper/websocket/index.js"
},
"./conninfo": {
"types": "./dist/types/helper/conninfo/index.d.ts",
"import": "./dist/helper/conninfo/index.js",
"require": "./dist/cjs/helper/conninfo/index.js"
},
"./proxy": {
"types": "./dist/types/helper/proxy/index.d.ts",
"import": "./dist/helper/proxy/index.js",
"require": "./dist/cjs/helper/proxy/index.js"
}
},
"typesVersions": {
"*": {
"request": [
"./dist/types/request"
],
"types": [
"./dist/types/types"
],
"hono-base": [
"./dist/types/hono-base"
],
"tiny": [
"./dist/types/preset/tiny"
],
"quick": [
"./dist/types/preset/quick"
],
"http-exception": [
"./dist/types/http-exception"
],
"basic-auth": [
"./dist/types/middleware/basic-auth"
],
"bearer-auth": [
"./dist/types/middleware/bearer-auth"
],
"body-limit": [
"./dist/types/middleware/body-limit"
],
"ip-restriction": [
"./dist/types/middleware/ip-restriction"
],
"cache": [
"./dist/types/middleware/cache"
],
"route": [
"./dist/types/helper/route"
],
"mount": [
"./dist/types/middleware/mount"
],
"cookie": [
"./dist/types/helper/cookie"
],
"accepts": [
"./dist/types/helper/accepts"
],
"compress": [
"./dist/types/middleware/compress"
],
"context-storage": [
"./dist/types/middleware/context-storage"
],
"cors": [
"./dist/types/middleware/cors"
],
"csrf": [
"./dist/types/middleware/csrf"
],
"etag": [
"./dist/types/middleware/etag"
],
"trailing-slash": [
"./dist/types/middleware/trailing-slash"
],
"html": [
"./dist/types/helper/html"
],
"css": [
"./dist/types/helper/css"
],
"jsx": [
"./dist/types/jsx"
],
"jsx/jsx-runtime": [
"./dist/types/jsx/jsx-runtime.d.ts"
],
"jsx/jsx-dev-runtime": [
"./dist/types/jsx/jsx-dev-runtime.d.ts"
],
"jsx/streaming": [
"./dist/types/jsx/streaming.d.ts"
],
"jsx-renderer": [
"./dist/types/middleware/jsx-renderer"
],
"jsx/dom": [
"./dist/types/jsx/dom"
],
"jsx/dom/client": [
"./dist/types/jsx/dom/client.d.ts"
],
"jsx/dom/css": [
"./dist/types/jsx/dom/css.d.ts"
],
"jsx/dom/server": [
"./dist/types/jsx/dom/server.d.ts"
],
"jsx/dom/jsx-dev-runtime": [
"./dist/types/jsx/dom/jsx-dev-runtime.d.ts"
],
"jsx/dom/jsx-runtime": [
"./dist/types/jsx/dom/jsx-runtime.d.ts"
],
"jwt": [
"./dist/types/middleware/jwt"
],
"jwk": [
"./dist/types/middleware/jwk"
],
"timeout": [
"./dist/types/middleware/timeout"
],
"timing": [
"./dist/types/middleware/timing"
],
"logger": [
"./dist/types/middleware/logger"
],
"method-not-allowed": [
"./dist/types/middleware/method-not-allowed"
],
"method-override": [
"./dist/types/middleware/method-override"
],
"powered-by": [
"./dist/types/middleware/powered-by"
],
"pretty-json": [
"./dist/types/middleware/pretty-json"
],
"request-id": [
"./dist/types/middleware/request-id"
],
"language": [
"./dist/types/middleware/language"
],
"streaming": [
"./dist/types/helper/streaming"
],
"ssg": [
"./dist/types/helper/ssg"
],
"secure-headers": [
"./dist/types/middleware/secure-headers"
],
"combine": [
"./dist/types/middleware/combine"
],
"validator": [
"./dist/types/validator/index.d.ts"
],
"router": [
"./dist/types/router.d.ts"
],
"router/reg-exp-router": [
"./dist/types/router/reg-exp-router"
],
"router/smart-router": [
"./dist/types/router/smart-router"
],
"router/trie-router": [
"./dist/types/router/trie-router"
],
"router/pattern-router": [
"./dist/types/router/pattern-router"
],
"router/linear-router": [
"./dist/types/router/linear-router"
],
"utils/jwt": [
"./dist/types/utils/jwt/index.d.ts"
],
"utils/*": [
"./dist/types/utils/*"
],
"client": [
"./dist/types/client/index.d.ts"
],
"adapter": [
"./dist/types/helper/adapter/index.d.ts"
],
"factory": [
"./dist/types/helper/factory/index.d.ts"
],
"serve-static": [
"./dist/types/middleware/serve-static"
],
"cloudflare-workers": [
"./dist/types/adapter/cloudflare-workers"
],
"cloudflare-pages": [
"./dist/types/adapter/cloudflare-pages"
],
"deno": [
"./dist/types/adapter/deno"
],
"bun": [
"./dist/types/adapter/bun"
],
"aws-lambda": [
"./dist/types/adapter/aws-lambda"
],
"vercel": [
"./dist/types/adapter/vercel"
],
"netlify": [
"./dist/types/adapter/netlify"
],
"lambda-edge": [
"./dist/types/adapter/lambda-edge"
],
"service-worker": [
"./dist/types/adapter/service-worker"
],
"testing": [
"./dist/types/helper/testing"
],
"dev": [
"./dist/types/helper/dev"
],
"ws": [
"./dist/types/helper/websocket"
],
"conninfo": [
"./dist/types/helper/conninfo"
],
"proxy": [
"./dist/types/helper/proxy"
]
}
},
"author": "Yusuke Wada <yusuke@kamawada.com> (https://github.com/yusukebe)",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/honojs/hono.git"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"homepage": "https://hono.dev",
"keywords": [
"hono",
"web",
"app",
"http",
"application",
"framework",
"router",
"cloudflare",
"workers",
"fastly",
"compute",
"deno",
"bun",
"lambda",
"nodejs"
],
"devDependencies": {
"@hono/node-server": "^2.0.12",
"@types/jsdom": "^21.1.7",
"@types/node": "^24.3.0",
"@types/ws": "^8.18.1",
"@typescript/native-preview": "7.0.0-dev.20260210.1",
"@vitest/coverage-v8": "5.0.1",
"bun-types": "^1.2.20",
"editorconfig-checker": "6.2.0",
"esbuild": "^0.27.1",
"jsdom": "22.1.0",
"msw": "^2.6.0",
"np": "11.2.1",
"pkg-pr-new": "^0.0.53",
"publint": "0.3.15",
"rolldown": "^1.2.10",
"typescript": "^6.0.3",
"vite-plugin-fastly-js-compute": "^0.4.2",
"vite-plus": "1.0.0",
"vitest": "5.0.1",
"wrangler": "4.107.0",
"ws": "^8.21.0",
"zod": "^3.23.8"
},
"packageManager": "pnpm@12.6.0",
"engines": {
"node": ">=16.9.0"
}
}
@@ -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 FileChartPie = createLucideIcon("FileChartPie", [
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
["path", { d: "M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3.5", key: "13ddob" }],
["path", { d: "M4.017 11.512a6 6 0 1 0 8.466 8.475", key: "s6vs5t" }],
[
"path",
{
d: "M9 16a1 1 0 0 1-1-1v-4c0-.552.45-1.008.995-.917a6 6 0 0 1 4.922 4.922c.091.544-.365.995-.917.995z",
key: "1dl6s6"
}
]
]);
export { FileChartPie as default };
//# sourceMappingURL=file-chart-pie.js.map
@@ -0,0 +1,39 @@
import type { TSESTree } from '@typescript-eslint/utils';
import { SyntaxKind } from 'typescript';
import type { ValueOf } from './types';
export declare enum OperatorPrecedence {
Comma = 0,
Spread = 1,
Yield = 2,
Assignment = 3,
Conditional = 4,
Coalesce = 4,// NOTE: This is wrong
LogicalOR = 5,
LogicalAND = 6,
BitwiseOR = 7,
BitwiseXOR = 8,
BitwiseAND = 9,
Equality = 10,
Relational = 11,
Shift = 12,
Additive = 13,
Multiplicative = 14,
Exponentiation = 15,
Unary = 16,
Update = 17,
LeftHandSide = 18,
Member = 19,
Primary = 20,
Highest = 20,
Lowest = 0,
Invalid = -1
}
/**
* Note that this does not take into account parenthesization. You should check
* for parenthesization separately if it's relevant to your usage.
*/
export declare function getOperatorPrecedenceForNode(node: TSESTree.Node): OperatorPrecedence;
type TSESTreeOperatorKind = ValueOf<TSESTree.BinaryOperatorToText> | ValueOf<TSESTree.PunctuatorTokenToText>;
export declare function getOperatorPrecedence(nodeKind: SyntaxKind, operatorKind: SyntaxKind, hasArguments?: boolean): OperatorPrecedence;
export declare function getBinaryOperatorPrecedence(kind: SyntaxKind | TSESTreeOperatorKind): OperatorPrecedence;
export {};
@@ -0,0 +1,20 @@
import { AnyRouter, RegisteredRouter, RouterState } from '@tanstack/router-core';
import { StructuralSharingOption, ValidateSelected } from './structuralSharing.cjs';
export type UseRouterStateOptions<TRouter extends AnyRouter, TSelected, TStructuralSharing> = {
router?: TRouter;
select?: (state: RouterState<TRouter['routeTree']>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
} & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>;
export type UseRouterStateResult<TRouter extends AnyRouter, TSelected> = unknown extends TSelected ? RouterState<TRouter['routeTree']> : TSelected;
/**
* Subscribe to the router's state store with optional selection and
* structural sharing for render optimization.
*
* Options:
* - `select`: Project the full router state to a derived slice
* - `structuralSharing`: Replace-equal semantics for stable references
* - `router`: Read state from a specific router instance instead of context
*
* @returns The selected router state (or the full state by default).
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterStateHook
*/
export declare function useRouterState<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseRouterStateOptions<TRouter, TSelected, TStructuralSharing>): UseRouterStateResult<TRouter, TSelected>;
@@ -0,0 +1,368 @@
export default `flf2a 1 1 10 -1 8
rot13.flf (C) 1994 by Victor Parada (vparada@inf.utfsm.cl) 94/12/28.
Based on Terminal by Glenn Chappell 4/93
Includes characters 128-255
figlet release 2.1 -- 12 Aug 1994
@
!@
"@
#@
$@
%@
&@
'@
(@
)@
*@
+@
,@
-@
.@
/@
0@
1@
2@
3@
4@
5@
6@
7@
8@
9@
:@
;@
<@
=@
>@
?@
@#
N@
O@
P@
Q@
R@
S@
T@
U@
V@
W@
X@
Y@
Z@
A@
B@
C@
D@
E@
F@
G@
H@
I@
J@
K@
L@
M@
[@
\\@
]@
^@
_@
\`@
n@
o@
p@
q@
r@
s@
t@
u@
v@
w@
x@
y@
z@
a@
b@
c@
d@
e@
f@
g@
h@
i@
j@
k@
l@
m@
{@
|@
}@
~@
�@
�@
�@
�@
�@
�@
�@
128
�@
129
�@
130
�@
131
�@
132
�@
133
�@
134
�@
135
�@
136
�@
137
�@
138
�@
139
�@
140
�@
141
�@
142
�@
143
�@
144
�@
145
�@
146
�@
147
�@
148
�@
149
�@
150
�@
151
�@
152
�@
153
�@
154
�@
155
�@
156
�@
157
�@
158
�@
159
�@
160
�@
161
�@
162
�@
163
�@
164
�@
165
�@
166
�@
167
�@
168
�@
169
�@
170
�@
171
�@
172
�@
173
�@
174
�@
175
�@
176
�@
177
�@
178
�@
179
�@
180
�@
181
�@
182
�@
183
�@
184
�@
185
�@
186
�@
187
�@
188
�@
189
�@
190
�@
191
�@
192
�@
193
�@
194
�@
195
�@
196
�@
197
�@
198
�@
199
�@
200
�@
201
�@
202
�@
203
�@
204
�@
205
�@
206
�@
207
�@
208
�@
209
�@
210
�@
211
�@
212
�@
213
�@
214
�@
215
�@
216
�@
217
�@
218
�@
219
�@
220
�@
221
�@
222
�@
223
�@
224
�@
225
�@
226
�@
227
�@
228
�@
229
�@
230
�@
231
�@
232
�@
233
�@
234
�@
235
�@
236
�@
237
�@
238
�@
239
�@
240
�@
241
�@
242
�@
243
�@
244
�@
245
�@
246
�@
247
�@
248
�@
249
�@
250
�@
251
�@
252
�@
253
�@
254
�@
255
�@
`
@@ -0,0 +1,21 @@
'use strict'
const RedirectHandler = require('../handler/redirect-handler')
function createRedirectInterceptor ({ maxRedirections: defaultMaxRedirections, throwOnMaxRedirect: defaultThrowOnMaxRedirect, stripHeadersOnRedirect: defaultStripHeadersOnRedirect, stripHeadersOnCrossOriginRedirect: defaultStripHeadersOnCrossOriginRedirect } = {}) {
return (dispatch) => {
return function Intercept (opts, handler) {
const { maxRedirections = defaultMaxRedirections, throwOnMaxRedirect = defaultThrowOnMaxRedirect, stripHeadersOnRedirect = defaultStripHeadersOnRedirect, stripHeadersOnCrossOriginRedirect = defaultStripHeadersOnCrossOriginRedirect, ...rest } = opts
if (maxRedirections == null || maxRedirections === 0) {
return dispatch(opts, handler)
}
const dispatchOpts = { ...rest, throwOnMaxRedirect, stripHeadersOnRedirect, stripHeadersOnCrossOriginRedirect } // Stop sub dispatcher from also redirecting.
const redirectHandler = new RedirectHandler(dispatch, maxRedirections, dispatchOpts, handler)
return dispatch(dispatchOpts, redirectHandler)
}
}
}
module.exports = createRedirectInterceptor
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_LR","8":"_HB"},B:{"1":"_K","2":"_I"},C:{"1":"_1D","2":"GD","8":"fC _Y _lT","194":"_cK"},D:{"1":"_1H","8":"_KG","257":"_jC _9D","769":"_I"},E:{"1":"_BI","8":"_u","257":"_3E _zB","1025":"B _ID"},F:{"1":"_a","2":"_PQ","8":"_QD"},G:{"1":"_SD _gC _NC","8":"_1","1025":"_jD mD"},H:{"8":"1D"},I:{"1":"_PE","8":"_LB"},J:{"1":"A","8":"D"},K:{"1":"H","8":"_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:1,C:"Details & Summary elements",D:true};
@@ -0,0 +1,93 @@
import { Env, Schema } from "../../types.js";
import { Hono } from "../../hono.js";
//#region src/helper/ssg/ssg.d.ts
export declare const DEFAULT_OUTPUT_DIR = "./static";
/**
* @experimental
* `FileSystemModule` is an experimental feature.
* The API might be changed.
*/
export interface FileSystemModule {
writeFile(path: string, data: string | Uint8Array): Promise<void>;
mkdir(path: string, options: {
recursive: boolean;
}): Promise<void | string>;
}
/**
* @experimental
* `ToSSGResult` is an experimental feature.
* The API might be changed.
*/
export interface ToSSGResult {
success: boolean;
files: string[];
error?: Error;
}
export declare const defaultExtensionMap: Record<string, string>;
export type BeforeRequestHook = (req: Request) => Request | false | Promise<Request | false>;
export type AfterResponseHook = (res: Response) => Response | false | Promise<Response | false>;
export type AfterGenerateHook = (result: ToSSGResult, fsModule: FileSystemModule, options?: ToSSGOptions) => void | Promise<void>;
export declare const combineBeforeRequestHooks: (hooks: BeforeRequestHook | BeforeRequestHook[]) => BeforeRequestHook;
export declare const combineAfterResponseHooks: (hooks: AfterResponseHook | AfterResponseHook[]) => AfterResponseHook;
export declare const combineAfterGenerateHooks: (hooks: AfterGenerateHook | AfterGenerateHook[], fsModule: FileSystemModule, options?: ToSSGOptions) => AfterGenerateHook;
export interface SSGPlugin {
beforeRequestHook?: BeforeRequestHook | BeforeRequestHook[];
afterResponseHook?: AfterResponseHook | AfterResponseHook[];
afterGenerateHook?: AfterGenerateHook | AfterGenerateHook[];
}
export interface ToSSGOptions {
dir?: string;
/**
* @deprecated Use plugins[].beforeRequestHook instead.
*/
beforeRequestHook?: BeforeRequestHook | BeforeRequestHook[];
/**
* @deprecated Use plugins[].afterResponseHook instead.
*/
afterResponseHook?: AfterResponseHook | AfterResponseHook[];
/**
* @deprecated Use plugins[].afterGenerateHook instead.
*/
afterGenerateHook?: AfterGenerateHook | AfterGenerateHook[];
concurrency?: number;
extensionMap?: Record<string, string>;
plugins?: SSGPlugin[];
}
/**
* @experimental
* `fetchRoutesContent` is an experimental feature.
* The API might be changed.
*/
export declare const fetchRoutesContent: <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>, beforeRequestHook?: BeforeRequestHook, afterResponseHook?: AfterResponseHook, concurrency?: number) => Generator<Promise<Generator<Promise<{
routePath: string;
mimeType: string;
content: string | ArrayBuffer;
} | undefined>> | undefined>>;
export declare const saveContentToFile: (data: Promise<{
routePath: string;
content: string | ArrayBuffer;
mimeType: string;
} | undefined>, fsModule: FileSystemModule, outDir: string, extensionMap?: Record<string, string>) => Promise<string | undefined>;
/**
* @experimental
* `ToSSGInterface` is an experimental feature.
* The API might be changed.
*/
export interface ToSSGInterface {
(app: Hono<any, any, any>, fsModule: FileSystemModule, options?: ToSSGOptions): Promise<ToSSGResult>;
}
/**
* @experimental
* `ToSSGAdaptorInterface` is an experimental feature.
* The API might be changed.
*/
export interface ToSSGAdaptorInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> {
(app: Hono<E, S, BasePath>, options?: ToSSGOptions): Promise<ToSSGResult>;
}
/**
* @experimental
* `toSSG` is an experimental feature.
* The API might be changed.
*/
export declare const toSSG: ToSSGInterface;
//#endregion
@@ -0,0 +1,8 @@
import { isMotionValue } from '../utils/is-motion-value.mjs';
function isWillChangeMotionValue(value) {
return Boolean(isMotionValue(value) && value.add);
}
export { isWillChangeMotionValue };
//# sourceMappingURL=is.mjs.map
@@ -0,0 +1,26 @@
var mergeUserInputDictionary = (optionsRankedDictionaries, optionsRankedDictionariesMaxWordSize, userInputsOptions) => {
if (!userInputsOptions) {
return {
rankedDictionaries: optionsRankedDictionaries,
rankedDictionariesMaxWordSize: optionsRankedDictionariesMaxWordSize
};
}
const rankedDictionaries = {
...optionsRankedDictionaries
};
const rankedDictionariesMaxWordSize = {
...optionsRankedDictionariesMaxWordSize
};
rankedDictionaries.userInputs = {
...(rankedDictionaries.userInputs || {}),
...userInputsOptions.rankedDictionary
};
rankedDictionariesMaxWordSize.userInputs = Math.max(userInputsOptions.rankedDictionaryMaxWordSize, rankedDictionariesMaxWordSize.userInputs || 0);
return {
rankedDictionaries,
rankedDictionariesMaxWordSize
};
};
export { mergeUserInputDictionary as default };
//# sourceMappingURL=mergeUserInputDictionary.mjs.map
@@ -0,0 +1,74 @@
{
"name": "@radix-ui/react-switch",
"version": "1.2.6",
"license": "MIT",
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"dependencies": {
"@radix-ui/primitive": "1.1.3",
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-context": "1.1.2",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-use-previous": "1.1.1",
"@radix-ui/react-use-size": "1.1.1",
"@radix-ui/react-use-controllable-state": "1.2.2"
},
"devDependencies": {
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
"eslint": "^9.18.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"typescript": "^5.7.3",
"@repo/builder": "0.0.0",
"@repo/eslint-config": "0.0.0",
"@repo/typescript-config": "0.0.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"scripts": {
"lint": "eslint --max-warnings 0 src",
"clean": "rm -rf dist",
"typecheck": "tsc --noEmit",
"build": "radix-build"
},
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
}
}
@@ -0,0 +1 @@
{"version":3,"names":["REACT_ELEMENT_TYPE","_createRawReactElement","type","props","key","children","Symbol","defaultProps","childrenLength","arguments","length","childArray","Array","i","propName","$$typeof","undefined","ref","_owner"],"sources":["../../src/helpers/jsx.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nvar REACT_ELEMENT_TYPE: symbol | 0xeac7;\n\ninterface Props {\n children?: any;\n [propName: string]: any;\n}\n\ninterface ReactElement {\n $$typeof: typeof REACT_ELEMENT_TYPE;\n type: any;\n key: string | null;\n ref: null;\n props: Props;\n _owner: null;\n}\n\ntype ReactElementType = any;\ntype ReactKey = string | number | bigint;\ntype ReactNode =\n | ReactElement\n | string\n | number\n | Iterable<ReactNode>\n | boolean\n | null\n | undefined;\n\nexport default function _createRawReactElement(\n type: ReactElementType,\n props: Props,\n key?: ReactKey,\n children?: ReactNode[],\n): ReactElement {\n if (!REACT_ELEMENT_TYPE) {\n REACT_ELEMENT_TYPE =\n (typeof Symbol === \"function\" &&\n // \"for\" is a reserved keyword in ES3 so escaping it here for backward compatibility\n Symbol[\"for\"] &&\n Symbol[\"for\"](\"react.element\")) ||\n 0xeac7;\n }\n\n var defaultProps: Props = type && type.defaultProps;\n var childrenLength = arguments.length - 3;\n\n if (!props && childrenLength !== 0) {\n // If we're going to assign props.children, we create a new object now\n // to avoid mutating defaultProps.\n props = { children: void 0 };\n }\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = new Array(childrenLength);\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 3];\n }\n props.children = childArray;\n }\n\n if (props && defaultProps) {\n for (var propName in defaultProps) {\n if (props[propName] === void 0) {\n props[propName] = defaultProps[propName];\n }\n }\n } else if (!props) {\n props = defaultProps || {};\n }\n\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key === undefined ? null : \"\" + key,\n ref: null,\n props: props,\n _owner: null,\n };\n}\n"],"mappings":";;;;;;AAEA,IAAIA,kBAAmC;AA2BxB,SAASC,sBAAsBA,CAC5CC,IAAsB,EACtBC,KAAY,EACZC,GAAc,EACdC,QAAsB,EACR;EACd,IAAI,CAACL,kBAAkB,EAAE;IACvBA,kBAAkB,GACf,OAAOM,MAAM,KAAK,UAAU,IAE3BA,MAAM,CAAC,KAAK,CAAC,IACbA,MAAM,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,IAChC,MAAM;EACV;EAEA,IAAIC,YAAmB,GAAGL,IAAI,IAAIA,IAAI,CAACK,YAAY;EACnD,IAAIC,cAAc,GAAGC,SAAS,CAACC,MAAM,GAAG,CAAC;EAEzC,IAAI,CAACP,KAAK,IAAIK,cAAc,KAAK,CAAC,EAAE;IAGlCL,KAAK,GAAG;MAAEE,QAAQ,EAAE,KAAK;IAAE,CAAC;EAC9B;EAEA,IAAIG,cAAc,KAAK,CAAC,EAAE;IACxBL,KAAK,CAACE,QAAQ,GAAGA,QAAQ;EAC3B,CAAC,MAAM,IAAIG,cAAc,GAAG,CAAC,EAAE;IAC7B,IAAIG,UAAU,GAAG,IAAIC,KAAK,CAACJ,cAAc,CAAC;IAC1C,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,cAAc,EAAEK,CAAC,EAAE,EAAE;MACvCF,UAAU,CAACE,CAAC,CAAC,GAAGJ,SAAS,CAACI,CAAC,GAAG,CAAC,CAAC;IAClC;IACAV,KAAK,CAACE,QAAQ,GAAGM,UAAU;EAC7B;EAEA,IAAIR,KAAK,IAAII,YAAY,EAAE;IACzB,KAAK,IAAIO,QAAQ,IAAIP,YAAY,EAAE;MACjC,IAAIJ,KAAK,CAACW,QAAQ,CAAC,KAAK,KAAK,CAAC,EAAE;QAC9BX,KAAK,CAACW,QAAQ,CAAC,GAAGP,YAAY,CAACO,QAAQ,CAAC;MAC1C;IACF;EACF,CAAC,MAAM,IAAI,CAACX,KAAK,EAAE;IACjBA,KAAK,GAAGI,YAAY,IAAI,CAAC,CAAC;EAC5B;EAEA,OAAO;IACLQ,QAAQ,EAAEf,kBAAkB;IAC5BE,IAAI,EAAEA,IAAI;IACVE,GAAG,EAAEA,GAAG,KAAKY,SAAS,GAAG,IAAI,GAAG,EAAE,GAAGZ,GAAG;IACxCa,GAAG,EAAE,IAAI;IACTd,KAAK,EAAEA,KAAK;IACZe,MAAM,EAAE;EACV,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,21 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_utils_encode = require("./encode.js");
//#region src/utils/basic-auth.ts
const CREDENTIALS_REGEXP = /^ *(?:[Bb][Aa][Ss][Ii][Cc]) +([A-Za-z0-9._~+/-]+=*) *$/;
const USER_PASS_REGEXP = /^([^:]*):(.*)$/;
const utf8Decoder = new TextDecoder();
const auth = (req) => {
const match = CREDENTIALS_REGEXP.exec(req.headers.get("Authorization") || "");
if (!match) return;
let userPass = void 0;
try {
userPass = USER_PASS_REGEXP.exec(utf8Decoder.decode(require_utils_encode.decodeBase64(match[1])));
} catch {}
if (!userPass) return;
return {
username: userPass[1],
password: userPass[2]
};
};
//#endregion
exports.auth = auth;
@@ -0,0 +1,97 @@
3.1.2 / 2022-01-27
==================
* Fix return value for un-parsable strings
3.1.1 / 2021-11-15
==================
* Fix "thousandsSeparator" incorrecting formatting fractional part
3.1.0 / 2019-01-22
==================
* Add petabyte (`pb`) support
3.0.0 / 2017-08-31
==================
* Change "kB" to "KB" in format output
* Remove support for Node.js 0.6
* Remove support for ComponentJS
2.5.0 / 2017-03-24
==================
* Add option "unit"
2.4.0 / 2016-06-01
==================
* Add option "unitSeparator"
2.3.0 / 2016-02-15
==================
* Drop partial bytes on all parsed units
* Fix non-finite numbers to `.format` to return `null`
* Fix parsing byte string that looks like hex
* perf: hoist regular expressions
2.2.0 / 2015-11-13
==================
* add option "decimalPlaces"
* add option "fixedDecimals"
2.1.0 / 2015-05-21
==================
* add `.format` export
* add `.parse` export
2.0.2 / 2015-05-20
==================
* remove map recreation
* remove unnecessary object construction
2.0.1 / 2015-05-07
==================
* fix browserify require
* remove node.extend dependency
2.0.0 / 2015-04-12
==================
* add option "case"
* add option "thousandsSeparator"
* return "null" on invalid parse input
* support proper round-trip: bytes(bytes(num)) === num
* units no longer case sensitive when parsing
1.0.0 / 2014-05-05
==================
* add negative support. fixes #6
0.3.0 / 2014-03-19
==================
* added terabyte support
0.2.1 / 2013-04-01
==================
* add .component
0.2.0 / 2012-10-28
==================
* bytes(200).should.eql('200b')
0.1.0 / 2012-07-04
==================
* add bytes to string conversion [yields]
@@ -0,0 +1 @@
{"version":3,"file":"italic.js","sources":["../../../src/icons/italic.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Italic\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8bGluZSB4MT0iMTkiIHgyPSIxMCIgeTE9IjQiIHkyPSI0IiAvPgogIDxsaW5lIHgxPSIxNCIgeDI9IjUiIHkxPSIyMCIgeTI9IjIwIiAvPgogIDxsaW5lIHgxPSIxNSIgeDI9IjkiIHkxPSI0IiB5Mj0iMjAiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/italic\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 Italic = createLucideIcon('Italic', [\n ['line', { x1: '19', x2: '10', y1: '4', y2: '4', key: '15jd3p' }],\n ['line', { x1: '14', x2: '5', y1: '20', y2: '20', key: 'bu0au3' }],\n ['line', { x1: '15', x2: '9', y1: '4', y2: '20', key: 'uljnxc' }],\n]);\n\nexport default Italic;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,iBAAiB,QAAU,CAAA,CAAA,CAAA;AAAA,CACxC,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAM,CAAA,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,CAChE,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,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,CAAA;AAAA,CACjE,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAClE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,9 @@
import { Result, Router } from "../../router.js";
//#region src/router/trie-router/router.d.ts
export declare class TrieRouter<T> implements Router<T> {
name: string;
add(method: string, path: string, handler: T): void;
match(method: string, path: string): Result<T>;
}
//#endregion
@@ -0,0 +1,126 @@
import type { $ZodStringFormats } from "../core/checks.js";
import type * as errors from "../core/errors.js";
import * as util from "../core/util.js";
const error: () => errors.$ZodErrorMap = () => {
const Sizable: Record<string, { unit: string; verb: string }> = {
string: { unit: "tekens", verb: "heeft" },
file: { unit: "bytes", verb: "heeft" },
array: { unit: "elementen", verb: "heeft" },
set: { unit: "elementen", verb: "heeft" },
map: { unit: "elementen", verb: "heeft" },
};
function getSizing(origin: string): { unit: string; verb: string } | null {
return Sizable[origin] ?? null;
}
const FormatDictionary: {
[k in $ZodStringFormats | (string & {})]?: string;
} = {
regex: "invoer",
email: "emailadres",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datum en tijd",
date: "ISO datum",
time: "ISO tijd",
duration: "ISO duur",
ipv4: "IPv4-adres",
ipv6: "IPv6-adres",
mac: "MAC-adres",
cidrv4: "IPv4-bereik",
cidrv6: "IPv6-bereik",
base64: "base64-gecodeerde tekst",
base64url: "base64 URL-gecodeerde tekst",
json_string: "JSON string",
e164: "E.164-nummer",
credit_card: "creditcardnummer",
currency_code: "valutacode",
iban: "IBAN",
jwt: "JWT",
template_literal: "invoer",
};
const TypeDictionary: {
[k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;
} = {
nan: "NaN",
number: "getal",
};
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = TypeDictionary[issue.expected] ?? issue.expected;
const receivedType = util.parsedType(issue.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue.expected)) {
return `Ongeldige invoer: verwacht instanceof ${issue.expected}, ontving ${received}`;
}
return `Ongeldige invoer: verwacht ${expected}, ontving ${received}`;
}
case "invalid_value":
if (issue.values.length === 1) return `Ongeldige invoer: verwacht ${util.stringifyPrimitive(issue.values[0])}`;
return `Ongeldige optie: verwacht één van ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
const longName = issue.origin === "date" ? "laat" : issue.origin === "string" ? "lang" : "groot";
if (sizing)
return `Te ${longName}: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementen"} ${sizing.verb}`;
return `Te ${longName}: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} is`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
const shortName = issue.origin === "date" ? "vroeg" : issue.origin === "string" ? "kort" : "klein";
if (sizing) {
return `Te ${shortName}: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
}
return `Te ${shortName}: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} is`;
}
case "invalid_format": {
const _issue = issue as errors.$ZodStringFormatIssues;
if (_issue.format === "starts_with") {
return `Ongeldige tekst: moet met "${_issue.prefix}" beginnen`;
}
if (_issue.format === "ends_with") return `Ongeldige tekst: moet op "${_issue.suffix}" eindigen`;
if (_issue.format === "includes") return `Ongeldige tekst: moet "${_issue.includes}" bevatten`;
if (_issue.format === "regex") return `Ongeldige tekst: moet overeenkomen met patroon ${_issue.pattern}`;
return `Ongeldig: ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Ongeldig getal: moet een veelvoud van ${issue.divisor} zijn`;
case "unrecognized_keys":
return `Onbekende key${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Ongeldige key in ${issue.origin}`;
case "invalid_union":
return "Ongeldige invoer";
case "invalid_element":
return `Ongeldige waarde in ${issue.origin}`;
default:
return `Ongeldige invoer`;
}
};
};
export default function (): { localeError: errors.$ZodErrorMap } {
return {
localeError: error(),
};
}
@@ -0,0 +1,16 @@
export {
validate,
validateAsync,
parse,
safeParse,
parseAsync,
safeParseAsync,
encode,
decode,
encodeAsync,
decodeAsync,
safeEncode,
safeDecode,
safeEncodeAsync,
safeDecodeAsync,
} from "../core/index.js";
@@ -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 BadgeHelp = createLucideIcon("BadgeHelp", [
[
"path",
{
d: "M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",
key: "3c2336"
}
],
["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
["line", { x1: "12", x2: "12.01", y1: "17", y2: "17", key: "io3f8k" }]
]);
export { BadgeHelp as default };
//# sourceMappingURL=badge-help.js.map
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const MessageSquareText = createLucideIcon("MessageSquareText", [
["path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z", key: "1lielz" }],
["path", { d: "M13 8H7", key: "14i4kc" }],
["path", { d: "M17 12H7", key: "16if0g" }]
]);
export { MessageSquareText as default };
//# sourceMappingURL=message-square-text.js.map
@@ -0,0 +1,121 @@
import { HTTPException } from "../../http-exception.js";
//#region src/helper/proxy/index.ts
/**
* @module
* Proxy Helper for Hono.
*/
const hopByHopHeaders = [
"connection",
"keep-alive",
"proxy-authenticate",
"proxy-authorization",
"te",
"trailer",
"transfer-encoding",
"upgrade"
];
const ALLOWED_TOKEN_PATTERN = /^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/;
const buildRequestInitFromRequest = (request, strictConnectionProcessing) => {
if (!request) return {};
const headers = new Headers(request.headers);
if (strictConnectionProcessing) {
const connectionValue = headers.get("connection");
if (connectionValue) {
const headerNames = connectionValue.split(",").map((h) => h.trim());
const invalidHeaders = headerNames.filter((h) => !ALLOWED_TOKEN_PATTERN.test(h));
if (invalidHeaders.length > 0) throw new HTTPException(400, { message: `Invalid Connection header value: ${invalidHeaders.join(", ")}` });
headerNames.forEach((headerName) => {
headers.delete(headerName);
});
}
}
hopByHopHeaders.forEach((header) => {
headers.delete(header);
});
return {
method: request.method,
body: request.body,
duplex: request.body ? "half" : void 0,
headers,
signal: request.signal
};
};
const preprocessRequestInit = (requestInit) => {
if (!requestInit.headers || Array.isArray(requestInit.headers) || requestInit.headers instanceof Headers) return requestInit;
const headers = new Headers();
for (const [key, value] of Object.entries(requestInit.headers)) if (value == null) headers.delete(key);
else headers.set(key, value);
requestInit.headers = headers;
return requestInit;
};
/**
* Fetch API wrapper for proxy.
* The parameters and return value are the same as for `fetch` (except for the proxy-specific options).
*
* The "Accept-Encoding" header is replaced with an encoding that the current runtime can handle.
* Unnecessary response headers are deleted and a Response object is returned that can be returned
* as is as a response from the handler.
*
* @example
* ```ts
* app.get('/proxy/:path', (c) => {
* return proxy(`http://${originServer}/${c.req.param('path')}`, {
* headers: {
* ...c.req.header(), // optional, specify only when forwarding all the request data (including credentials) is necessary.
* 'X-Forwarded-For': '127.0.0.1',
* 'X-Forwarded-Host': c.req.header('host'),
* Authorization: undefined, // do not propagate request headers contained in c.req.header('Authorization')
* },
* }).then((res) => {
* res.headers.delete('Set-Cookie')
* return res
* })
* })
*
* app.all('/proxy/:path', (c) => {
* return proxy(`http://${originServer}/${c.req.param('path')}`, {
* ...c.req, // optional, specify only when forwarding all the request data (including credentials) is necessary.
* headers: {
* ...c.req.header(),
* 'X-Forwarded-For': '127.0.0.1',
* 'X-Forwarded-Host': c.req.header('host'),
* Authorization: undefined, // do not propagate request headers contained in c.req.header('Authorization')
* },
* })
* })
*
* // Strict RFC compliance mode (use only in trusted environments)
* app.get('/internal-proxy/:path', (c) => {
* return proxy(`http://${internalServer}/${c.req.param('path')}`, {
* ...c.req,
* strictConnectionProcessing: true,
* })
* })
* ```
*/
const proxy = async (input, proxyInit) => {
const { raw, customFetch, strictConnectionProcessing = false, ...requestInit } = proxyInit instanceof Request ? { raw: proxyInit } : proxyInit ?? {};
const req = new Request(input, {
...buildRequestInitFromRequest(raw, strictConnectionProcessing),
...preprocessRequestInit(requestInit)
});
req.headers.delete("accept-encoding");
const res = await (customFetch || fetch)(req);
const resHeaders = new Headers(res.headers);
const connectionValue = resHeaders.get("connection");
if (connectionValue) connectionValue.split(",").map((h) => h.trim()).filter((h) => ALLOWED_TOKEN_PATTERN.test(h)).forEach((h) => resHeaders.delete(h));
hopByHopHeaders.forEach((header) => {
resHeaders.delete(header);
});
if (resHeaders.has("content-encoding")) {
resHeaders.delete("content-encoding");
resHeaders.delete("content-length");
}
return new Response(res.body, {
status: res.status,
statusText: res.statusText,
headers: resHeaders
});
};
//#endregion
export { proxy };
@@ -0,0 +1,216 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const tsutils = __importStar(require("ts-api-utils"));
const util_1 = require("../util");
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('prefer-destructuring');
const destructuringTypeConfig = {
type: 'object',
additionalProperties: false,
properties: {
array: {
type: 'boolean',
},
object: {
type: 'boolean',
},
},
};
const schema = [
{
oneOf: [
{
type: 'object',
additionalProperties: false,
properties: {
AssignmentExpression: destructuringTypeConfig,
VariableDeclarator: destructuringTypeConfig,
},
},
destructuringTypeConfig,
],
},
{
type: 'object',
additionalProperties: false,
properties: {
enforceForDeclarationWithTypeAnnotation: {
type: 'boolean',
description: 'Whether to enforce destructuring on variable declarations with type annotations.',
},
enforceForRenamedProperties: {
type: 'boolean',
description: 'Whether to enforce destructuring that use a different variable name than the property name.',
},
},
},
];
exports.default = (0, util_1.createRule)({
name: 'prefer-destructuring',
meta: {
type: 'suggestion',
// defaultOptions, -- base rule does not use defaultOptions
docs: {
description: 'Require destructuring from arrays and/or objects',
extendsBaseRule: true,
frozen: true,
requiresTypeChecking: true,
},
fixable: baseRule.meta.fixable,
hasSuggestions: baseRule.meta.hasSuggestions,
messages: baseRule.meta.messages,
schema,
},
defaultOptions: [
{
AssignmentExpression: {
array: true,
object: true,
},
VariableDeclarator: {
array: true,
object: true,
},
},
{},
],
create(context, [enabledTypes, options]) {
const { enforceForDeclarationWithTypeAnnotation = false, enforceForRenamedProperties = false, } = options;
const { esTreeNodeToTSNodeMap, program } = (0, util_1.getParserServices)(context);
const typeChecker = program.getTypeChecker();
const baseRules = baseRule.create(context);
let baseRulesWithoutFixCache = null;
return {
AssignmentExpression(node) {
if (node.operator !== '=') {
return;
}
performCheck(node.left, node.right, node);
},
VariableDeclarator(node) {
performCheck(node.id, node.init, node);
},
};
function performCheck(leftNode, rightNode, reportNode) {
const rules = leftNode.type === utils_1.AST_NODE_TYPES.Identifier &&
leftNode.typeAnnotation == null
? baseRules
: baseRulesWithoutFix();
if ((leftNode.type === utils_1.AST_NODE_TYPES.ArrayPattern ||
leftNode.type === utils_1.AST_NODE_TYPES.Identifier ||
leftNode.type === utils_1.AST_NODE_TYPES.ObjectPattern) &&
leftNode.typeAnnotation != null &&
!enforceForDeclarationWithTypeAnnotation) {
return;
}
if (rightNode != null &&
isArrayLiteralIntegerIndexAccess(rightNode) &&
rightNode.object.type !== utils_1.AST_NODE_TYPES.Super) {
const tsObj = esTreeNodeToTSNodeMap.get(rightNode.object);
const objType = typeChecker.getTypeAtLocation(tsObj);
if (!isTypeAnyOrIterableType(objType, typeChecker)) {
if (!enforceForRenamedProperties ||
!getNormalizedEnabledType(reportNode.type, 'object')) {
return;
}
context.report({
node: reportNode,
messageId: 'preferDestructuring',
data: { type: 'object' },
});
return;
}
}
if (reportNode.type === utils_1.AST_NODE_TYPES.AssignmentExpression) {
rules.AssignmentExpression(reportNode);
}
else {
rules.VariableDeclarator(reportNode);
}
}
function getNormalizedEnabledType(nodeType, destructuringType) {
if ('object' in enabledTypes || 'array' in enabledTypes) {
return enabledTypes[destructuringType];
}
return enabledTypes[nodeType][destructuringType];
}
function baseRulesWithoutFix() {
baseRulesWithoutFixCache ??= baseRule.create(noFixContext(context));
return baseRulesWithoutFixCache;
}
},
});
function noFixContext(context) {
const customContext = {
report: (descriptor) => {
context.report({
...descriptor,
fix: undefined,
});
},
};
// we can't directly proxy `context` because its `report` property is non-configurable
// and non-writable. So we proxy `customContext` and redirect all
// property access to the original context except for `report`
return new Proxy(customContext, {
get(target, path, receiver) {
if (path !== 'report') {
return Reflect.get(context, path, receiver);
}
return Reflect.get(target, path, receiver);
},
});
}
function isTypeAnyOrIterableType(type, typeChecker) {
if ((0, util_1.isTypeAnyType)(type)) {
return true;
}
if (!type.isUnion()) {
const iterator = tsutils.getWellKnownSymbolPropertyOfType(type, 'iterator', typeChecker);
return iterator != null;
}
return type.types.every(t => isTypeAnyOrIterableType(t, typeChecker));
}
function isArrayLiteralIntegerIndexAccess(node) {
if (node.type !== utils_1.AST_NODE_TYPES.MemberExpression) {
return false;
}
if (node.property.type !== utils_1.AST_NODE_TYPES.Literal) {
return false;
}
return Number.isInteger(node.property.value);
}
@@ -0,0 +1,10 @@
/**
* Simple interactive task client demonstrating elicitation and sampling responses.
*
* This client connects to simpleTaskInteractive.ts server and demonstrates:
* - Handling elicitation requests (y/n confirmation)
* - Handling sampling requests (returns a hardcoded haiku)
* - Using task-based tool execution with streaming
*/
export {};
//# sourceMappingURL=simpleTaskInteractiveClient.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"ice-cream-cone.js","sources":["../../../src/icons/ice-cream-cone.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name IceCreamCone\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtNyAxMSA0LjA4IDEwLjM1YTEgMSAwIDAgMCAxLjg0IDBMMTcgMTEiIC8+CiAgPHBhdGggZD0iTTE3IDdBNSA1IDAgMCAwIDcgNyIgLz4KICA8cGF0aCBkPSJNMTcgN2EyIDIgMCAwIDEgMCA0SDdhMiAyIDAgMCAxIDAtNCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/ice-cream-cone\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 IceCreamCone = createLucideIcon('IceCreamCone', [\n ['path', { d: 'm7 11 4.08 10.35a1 1 0 0 0 1.84 0L17 11', key: '1v6356' }],\n ['path', { d: 'M17 7A5 5 0 0 0 7 7', key: '151p3v' }],\n ['path', { d: 'M17 7a2 2 0 0 1 0 4H7a2 2 0 0 1 0-4', key: '1sdaij' }],\n]);\n\nexport default IceCreamCone;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,iBAAiB,cAAgB,CAAA,CAAA,CAAA;AAAA,CAAA,CACpD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA2C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CACxE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAuB,CAAA,CAAA,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,CACpD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAuC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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;AACtE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,935 @@
export default `flf2a$ 9 8 22 63 16 0 24511 0
Author : LG Beard
Date : 2004/3/27 20:45:15
Version: 1.0
-------------------------------------------------
-------------------------------------------------
This font has been created using JavE's FIGlet font export assistant.
Have a look at: http://www.jave.de
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $#
$ $#
$ $#
$ $#
$ $#
$ $#
$ $#
$ $#
$ $##
.=-.-. #
/==/_ / #
|==|, | #
|==| | #
/==/. / #
\`--\`-\` #
.=. #
:=; : #
\`=\` ##
,--.- ,--.-, #
/==/, /==/ -/ #
|==|_ |==|_ | #
|==| |==| | #
/==/, /==/, / #
\`--\`-'\`--\`-' #
#
#
##
,--, ,--, #
__ /-\\==\\/-\\==\\_ #
/\\_ \\'/==/ '/==/_\\#
\\/================/#
/\\__ \\/==/ /==/_\\/ #
\\/===============/ #
/ \`/==/ \`/==/ #
\`--\`-\` -\`-\` #
##
$#
#
#
#
#
#
#
#
##
.=. ,--, #
:=; :/-\\==\\ #
\`=\`/ '/==/ #
/ /==/ #
/ -/==/ #
/ \`/==/ #
/ -/==/.=. #
/ \`/==/:=; : #
\`--\`-\` \`=\` ##
,---.--. #
/ -_ \\==\\ #
|\` / \\/==/ #
\\ \\ /==/ #
/ \\==/ #
/. / \\==\\ #
| _ \\_/\\==\\ #
\\ . - /\\==\\ #
'----\`-\`--\` ##
.--.-. #
/==/ / #
\\==\\ -\\ #
\\==\\- \\ #
\`--\`-' #
#
#
#
##
.-.--. #
\\ \\==\\ #
/- /==/ #
/' /==/ #
|,|==| #
\\ \\==\\ #
\\ ,\\==\\ #
/ -/==/ #
\`-'--' ##
.--.-. #
/==/ / #
\\==\\ -\\ #
\\==\\ \`\\ #
|==|,| #
/==/ / #
/==/, / #
\\==\\- \\ #
\`--\`-' ##
*#
#
#
#
#
#
#
#
##
.--.-. #
/==/ / #
\\==\\ -\\ #
,--,--\`--\`--\`--. #
\\==\\ ========== \\ #
\`--\`-,--,--,---\` #
/==/, / #
\\==\\- \\ #
\`--\`-' ##
#
#
#
#
,--, #
/-\\==\\ #
/ '/==/ #
/ /==/ #
\`--\`--\` ##
#
#
,--.--------. #
/==/, - , -\\ #
\\==\\.-. - ,-./ #
\`--\`--------\` #
#
#
##
#
#
#
#
#
#
.=. #
:=; : #
\`=\` ##
,--, #
/-\\==\\ #
/ '/==/ #
/ /==/ #
/ -/==/ #
/ \`/==/ #
/ -/==/ #
/ \`/==/ #
\`--\`-\` ##
_.---.,_ #
.' - , \`.-, #
/ - , ,_\\==\\ #
| .=. |==| #
| - :=; : _|==| #
| \`=\` , |==| #
\\ _, - /==/ #
\`. - .\`=.\` #
\`\`--'--' ##
,-----.--. #
/\` \` - /==/ #
\`-'-. -|==| #
| \`|==| #
| -|==| #
| \`|==| #
.-','|==| #
/ \\==\\ #
\`-----\`---\` ##
,-----,--, #
| '- -\\==\\ #
\\,--, '/==/ #
/ /==/ #
/ -/==/ #
/ -/==/ #
/ \`\\==\\_,--, #
/\` - ,/==/ #
\`------\`--\` ##
.----, #
/ \`\`--\`.-, #
'-._ -|==| #
.-.' |==| #
\\ , _\\==\\ #
\`-. |==| #
_.-', _|==| #
\\ , \\==\\ #
\`\`-----'--' ##
.--, .-.--, #
| |=| -\\==\\ #
| \`-' _|==| #
\\ , |==| #
\`--. -|==| #
\\_ |==| #
| \\==\\ #
\\ /==/ #
\`--\` ##
,-.--. #
/ - \\==\\ #
/ /\\/==/ #
| \\==\\ #
/ \`-.\`-. #
\`--. \\==\\ #
.-/ /==/ #
/ /==/ #
\`-----\`-\` ##
.,-. #
/ \\==\\ #
/ -/==/ #
/- /==/ #
/ /==/ #
/. / \\==\\ #
| _ \\_/\\==\\ #
\\ . - /==/ #
'----\`--\` ##
,-----,--, #
| '- -\\==\\ #
\\,--, '/==/ #
/ /==/ #
/ -/==/ #
/ \`/==/ #
/ -/==/ #
/ \`/==/ #
\`--\`-\` ##
,---.--. #
/ -_ \\==\\ #
|\` / \\/==/ #
\\ \\ /==/ #
/ \\==/ #
/. / \\==\\ #
| _ \\_/\\==\\ #
\\ . - /==/ #
'----\`--\` ##
,--,----. #
/==/ .=. \\ #
\\==\\ '='\\ \\ #
\`--\`--'/ \`/ #
/==/ -/ #
/==/ -/ #
/==/- / #
\\==\\ / #
\`-'\` ##
#
.=. #
:=; : #
\`=\` #
.=. #
:=; : #
\`=\` #
#
##
#
.=. #
:=; : #
\`=\` #
.=. #
:=; : #
\`.\` #
#
##
.--. #
/ \\==\\ #
/- /==/ #
/' /==/ #
| ,|==| #
\\ \\==\\ #
\\ ,\\==\\ #
\\- \\==\\ #
\`./==/ ##
,--.--------. #
/==/, - , -\\ #
\\==\\.-. - ,-./ #
\`--\`--------\` #
,--.--------. #
/==/, - , -\\ #
\\==\\.-. - ,-./ #
\`--\`--------\` #
##
.--. #
/==/ \\ #
\\==\\ -\\ #
\\==\\ \`\\ #
|==|, | #
/==/ / #
/==/, / #
/==/ -/ #
\\==\\.' ##
,--,---. #
/==/ - \` \\ #
\\==\\/\\ - | #
\`--\`/ \`/ #
|==| | #
\`--\`--\` #
.=. #
:=; : #
\`=\` ##
_,----. #
,-.--\` , \\ #
/==/- _.-\`\\ #
/==/ \`.-. \\ #
\\==\\_ , / / #
\\==\\ .-' / #
\`._\`.___.' #
#
##
,---. #
.--.' \\ #
\\==\\-/\\ \\ #
/==/-|_\\ | #
\\==\\, - \\ #
/==/ - ,| #
/==/- /\\ - \\ #
\\==\\ _.\\=\\.-' #
\`--\` ##
#
_..---. #
.' .'.-. \\ #
/==/- '=' / #
|==|-, ' #
|==| .=. \\ #
/==/- '=' ,| #
|==| - / #
\`-._\`.___,' ##
_,.----. #
.' .' - \\ #
/==/ , ,-' #
|==|- | . #
|==|_ \`-' \\ #
|==| _ , | #
\\==\\. / #
\`-.\`.___.-' #
##
#
_,..---._ #
/==/, - \\ #
|==| _ _\\ #
|==| .=. | #
|==|,| | -| #
|==| '=' / #
|==|-, _\`/ #
\`-.\`.____.' ##
,----. #
,-.--\` , \\ #
|==|- _.-\` #
|==| \`.-. #
/==/_ , / #
|==| .-' #
|==|_ ,\`-._ #
/==/ , / #
\`--\`-----\`\` ##
_,---. #
.-\`.' , \\ #
/==/_ _.-' #
/==/- '..-. #
|==|_ , / #
|==| .--' #
|==|- | #
/==/ \\ #
\`--\`---' ##
_,---. #
_.='.'-, \\ #
/==.'- / #
/==/ - .-' #
|==|_ /_,-. #
|==| , \\_.' ) #
\\==\\- , ( #
/==/ _ , / #
\`--\`------' ##
,--.-,,-,--, #
/==/ /|=| | #
|==|_ ||=|, | #
|==| ,|/=| _| #
|==|- \`-' _ | #
|==| _ | #
|==| .-. ,\\ #
/==/, //=/ | #
\`--\`-' \`-\`--\` ##
.=-.-. #
/==/_ / #
|==|, | #
|==| | #
|==|- | #
|==| ,| #
|==|- | #
/==/. / #
\`--\`-\` ##
,--.-, #
|==' -| #
|==|- | #
__|==|, | #
,--.-'\\=|- | #
|==|- |=/ ,| #
|==|. /=| -| #
\\==\\, \`-' / #
\`--\`----' ##
,--.-.,-. #
/==/- |\\ \\ #
|==|_ \`/_ / #
|==| , / #
|==|- .| #
|==| _ , \\ #
/==/ '\\ | #
\\==\\ /\\=\\.' #
\`--\` ##
#
_.-. #
.-,.'| #
|==|, | #
|==|- | #
|==|, | #
|==|- \`-._ #
/==/ - , ,/ #
\`--\`-----' ##
___ #
.-._ .'=.'\\ #
/==/ \\|==| | #
|==|,| / - | #
|==| \\/ , | #
|==|- , _ | #
|==| _ /\\ | #
/==/ / / , / #
\`--\`./ \`--\` ##
.-._ #
/==/ \\ .-._ #
|==|, \\/ /, / #
|==|- \\| | #
|==| , | -| #
|==| - _ | #
|==| /\\ , | #
/==/, | |- | #
\`--\`./ \`--\` ##
_,.---._ #
,-.' , - \`. #
/==/_, , - \\ #
|==| .=. | #
|==|_ : ;=: - | #
|==| , '=' | #
\\==\\ - ,_ / #
'.='. - .' #
\`--\`--'' ##
_ __ #
.-\`.' ,\`. #
/==/, - \\ #
|==| _ .=. | #
|==| , '=',| #
|==|- '..' #
|==|, | #
/==/ - | #
\`--\`---' ##
_,.---._ #
,-.' - , \`. #
/==/ , - \\ #
|==| - .=. , | #
|==| : ;=: - | #
|==|, '=' , | #
\\==\\ _ - ; #
'.='. , ; -\\ #
\`--\`--'' \`--\` ##
#
.-.,.---. #
/==/ \` \\ #
|==|-, .=., | #
|==| '=' / #
|==|- , .' #
|==|_ . ,'. #
/==/ /\\ , ) #
\`--\`-\`--\`--' ##
,-,--. #
,-.'- _\\ #
/==/_ ,_.' #
\\==\\ \\ #
\\==\\ -\\ #
_\\==\\ ,\\ #
/==/\\/ _ | #
\\==\\ - , / #
\`--\`---' ##
,--.--------. #
/==/, - , -\\ #
\\==\\.-. - ,-./ #
\`--\`\\==\\- \\ #
\\==\\_ \\ #
|==|- | #
|==|, | #
/==/ -/ #
\`--\`--\` ##
#
.--.-. .-.-. #
/==/ -|/=/ | #
|==| ,||=| -| #
|==|- | =/ | #
|==|, \\/ - | #
|==|- , / #
/==/ , _ .' #
\`--\`..---' ##
,-.-. #
,--.-./=/ ,/ #
/==/, ||=| -| #
\\==\\, \\ / ,| #
\\==\\ - ' - / #
\\==\\ , | #
|==| - ,/ #
\\==\\ _ / #
\`--\`--' ##
,-.-. #
,-..-.-./ \\==\\ #
|, \\=/\\=|- |==| #
|- |/ |/ , /==/ #
\\, , _|==| #
| - - , |==| #
\\ , - /==/ #
|- /\\ /==/ #
\`--\` \`--\` ##
,-.--, #
.--.-. /=/, .' #
\\==\\ -\\/=/- / #
\\==\\ \`-' ,/ #
|==|, - | #
/==/ , \\ #
/==/, .--, - \\ #
\\==\\- \\/=/ , / #
\`--\`-' \`--\` ##
#
,--.-. .-,--. #
/==/- / /=/_ / #
\\==\\, \\/=/. / #
\\==\\ \\/ -/ #
|==| ,_/ #
\\==\\-, / #
/==/._/ #
\`--\`-\` ##
#
,--,----. #
/==/\` - ./ #
\`--\`=/. / #
/==/- / #
/==/- /-. #
/==/, \`--\`\\ #
\\==\\- -, | #
\`--\`.-.--\` ##
,--.---, #
\\==\\ - '\\ #
|==|- .-' #
|==|' | #
|==|- | #
|==|' | #
|==|\`,\`-. #
/==/ / #
\`--\`---' ##
,--, #
/==/-\\ #
\\==\\\` \\ #
\\==\\ \\ #
\\==\\- \\ #
\\==\\' \\ #
\\==\\- \\ #
\\==\\' \\ #
'-'--' ##
,---.--. #
/\` - /==/ #
\`-. -|==| #
| \`|==| #
| -|==| #
| \`|==| #
.-','|==| #
\\ \\==\\ #
\`---\`---\` ##
,--.--. #
/==/ _- \\ #
/==/ -/\\. \\ #
/==/, /==\\ ,\\ #
\\==\\-/ \\==\\ .\` #
\`--\` \`--\` #
#
#
##
#
#
#
#
#
,--.--------. #
/==/, - , -\\ #
\\==\\.-. - ,-./ #
\`--\`--------\` ##
,--, #
/==/-\\ #
\\==\\\` \\ #
\\==\\-.' #
\`--\` #
#
#
#
##
,---. #
.--.' \\ #
\\==\\-/\\ \\ #
/==/-|_\\ | #
\\==\\, - \\ #
/==/ - ,| #
/==/- /\\ - \\ #
\\==\\ _.\\=\\.-' #
\`--\` ##
#
_..---. #
.' .'.-. \\ #
/==/- '=' / #
|==|-, ' #
|==| .=. \\ #
/==/- '=' ,| #
|==| - / #
\`-._\`.___,' ##
_,.----. #
.' .' - \\ #
/==/ , ,-' #
|==|- | . #
|==|_ \`-' \\ #
|==| _ , | #
\\==\\. / #
\`-.\`.___.-' #
##
#
_,..---._ #
/==/, - \\ #
|==| _ _\\ #
|==| .=. | #
|==|,| | -| #
|==| '=' / #
|==|-, _\`/ #
\`-.\`.____.' ##
,----. #
,-.--\` , \\ #
|==|- _.-\` #
|==| \`.-. #
/==/_ , / #
|==| .-' #
|==|_ ,\`-._ #
/==/ , / #
\`--\`-----\`\` ##
_,---. #
.-\`.' , \\ #
/==/_ _.-' #
/==/- '..-. #
|==|_ , / #
|==| .--' #
|==|- | #
/==/ \\ #
\`--\`---' ##
_,---. #
_.='.'-, \\ #
/==.'- / #
/==/ - .-' #
|==|_ /_,-. #
|==| , \\_.' ) #
\\==\\- , ( #
/==/ _ , / #
\`--\`------' ##
,--.-,,-,--, #
/==/ /|=| | #
|==|_ ||=|, | #
|==| ,|/=| _| #
|==|- \`-' _ | #
|==| _ | #
|==| .-. ,\\ #
/==/, //=/ | #
\`--\`-' \`-\`--\` ##
.=-.-. #
/==/_ / #
|==|, | #
|==| | #
|==|- | #
|==| ,| #
|==|- | #
/==/. / #
\`--\`-\` ##
,--.-, #
|==' -| #
|==|- | #
__|==|, | #
,--.-'\\=|- | #
|==|- |=/ ,| #
|==|. /=| -| #
\\==\\, \`-' / #
\`--\`----' ##
,--.-.,-. #
/==/- |\\ \\ #
|==|_ \`/_ / #
|==| , / #
|==|- .| #
|==| _ , \\ #
/==/ '\\ | #
\\==\\ /\\=\\.' #
\`--\` ##
#
_.-. #
.-,.'| #
|==|, | #
|==|- | #
|==|, | #
|==|- \`-._ #
/==/ - , ,/ #
\`--\`-----' ##
___ #
.-._ .'=.'\\ #
/==/ \\|==| | #
|==|,| / - | #
|==| \\/ , | #
|==|- , _ | #
|==| _ /\\ | #
/==/ / / , / #
\`--\`./ \`--\` ##
.-._ #
/==/ \\ .-._ #
|==|, \\/ /, / #
|==|- \\| | #
|==| , | -| #
|==| - _ | #
|==| /\\ , | #
/==/, | |- | #
\`--\`./ \`--\` ##
_,.---._ #
,-.' , - \`. #
/==/_, , - \\ #
|==| .=. | #
|==|_ : ;=: - | #
|==| , '=' | #
\\==\\ - ,_ / #
'.='. - .' #
\`--\`--'' ##
_ __ #
.-\`.' ,\`. #
/==/, - \\ #
|==| _ .=. | #
|==| , '=',| #
|==|- '..' #
|==|, | #
/==/ - | #
\`--\`---' ##
_,.---._ #
,-.' - , \`. #
/==/ , - \\ #
|==| - .=. , | #
|==| : ;=: - | #
|==|, '=' , | #
\\==\\ _ - ; #
'.='. , ; -\\ #
\`--\`--'' \`--\` ##
#
.-.,.---. #
/==/ \` \\ #
|==|-, .=., | #
|==| '=' / #
|==|- , .' #
|==|_ . ,'. #
/==/ /\\ , ) #
\`--\`-\`--\`--' ##
,-,--. #
,-.'- _\\ #
/==/_ ,_.' #
\\==\\ \\ #
\\==\\ -\\ #
_\\==\\ ,\\ #
/==/\\/ _ | #
\\==\\ - , / #
\`--\`---' ##
,--.--------. #
/==/, - , -\\ #
\\==\\.-. - ,-./ #
\`--\`\\==\\- \\ #
\\==\\_ \\ #
|==|- | #
|==|, | #
/==/ -/ #
\`--\`--\` ##
#
.--.-. .-.-. #
/==/ -|/=/ | #
|==| ,||=| -| #
|==|- | =/ | #
|==|, \\/ - | #
|==|- , / #
/==/ , _ .' #
\`--\`..---' ##
,-.-. #
,--.-./=/ ,/ #
/==/, ||=| -| #
\\==\\, \\ / ,| #
\\==\\ - ' - / #
\\==\\ , | #
|==| - ,/ #
\\==\\ _ / #
\`--\`--' ##
,-.-. #
,-..-.-./ \\==\\ #
|, \\=/\\=|- |==| #
|- |/ |/ , /==/ #
\\, , _|==| #
| - - , |==| #
\\ , - /==/ #
|- /\\ /==/ #
\`--\` \`--\` ##
,-.--, #
.--.-. /=/, .' #
\\==\\ -\\/=/- / #
\\==\\ \`-' ,/ #
|==|, - | #
/==/ , \\ #
/==/, .--, - \\ #
\\==\\- \\/=/ , / #
\`--\`-' \`--\` ##
#
,--.-. .-,--. #
/==/- / /=/_ / #
\\==\\, \\/=/. / #
\\==\\ \\/ -/ #
|==| ,_/ #
\\==\\-, / #
/==/._/ #
\`--\`-\` ##
#
,--,----. #
/==/\` - ./ #
\`--\`=/. / #
/==/- / #
/==/- /-. #
/==/, \`--\`\\ #
\\==\\- -, | #
\`--\`.-.--\` ##
.-.--. #
\\ \\==\\ #
/- /==/ #
/' /==/ #
|,|==| #
\\ \\==\\ #
\\ ,\\==\\ #
/ -/==/ #
\`-'--' ##
,--.-, #
/==/ / #
|==|_ | #
|==| ,| #
|==|- | #
|==| | #
|==| | #
/==/, / #
\`--\`-' ##
.--.-. #
/==/ / #
\\==\\ -\\ #
\\==\\ \`\\ #
|==|,| #
/==/ / #
/==/, / #
\\==\\- \\ #
\`--\`-' ##
~#
#
#
#
#
#
#
#
##
,---. #
.--.' \\ #
\\==\\-/\\ \\ #
/==/-|_\\ | #
\\==\\, - \\ #
/==/ - ,| #
/==/- /\\ - \\ #
\\==\\ _.\\=\\.-' #
\`--\` ##
_,.---._ #
,-.' , - \`. #
/==/_, , - \\ #
|==| .=. | #
|==|_ : ;=: - | #
|==| , '=' | #
\\==\\ - ,_ / #
'.='. - .' #
\`--\`--'' ##
#
.--.-. .-.-. #
/==/ -|/=/ | #
|==| ,||=| -| #
|==|- | =/ | #
|==|, \\/ - | #
|==|- , / #
/==/ , _ .' #
\`--\`..---' ##
,---. #
.--.' \\ #
\\==\\-/\\ \\ #
/==/-|_\\ | #
\\==\\, - \\ #
/==/ - ,| #
/==/- /\\ - \\ #
\\==\\ _.\\=\\.-' #
\`--\` ##
_,.---._ #
,-.' , - \`. #
/==/_, , - \\ #
|==| .=. | #
|==|_ : ;=: - | #
|==| , '=' | #
\\==\\ - ,_ / #
'.='. - .' #
\`--\`--'' ##
#
.--.-. .-.-. #
/==/ -|/=/ | #
|==| ,||=| -| #
|==|- | =/ | #
|==|, \\/ - | #
|==|- , / #
/==/ , _ .' #
\`--\`..---' ##
�#
#
#
#
#
#
#
#
##`
@@ -0,0 +1,31 @@
/**
* Tool name validation utilities according to SEP: Specify Format for Tool Names
*
* Tool names SHOULD be between 1 and 128 characters in length (inclusive).
* Tool names are case-sensitive.
* Allowed characters: uppercase and lowercase ASCII letters (A-Z, a-z), digits
* (0-9), underscore (_), dash (-), and dot (.).
* Tool names SHOULD NOT contain spaces, commas, or other special characters.
*/
/**
* Validates a tool name according to the SEP specification
* @param name - The tool name to validate
* @returns An object containing validation result and any warnings
*/
export declare function validateToolName(name: string): {
isValid: boolean;
warnings: string[];
};
/**
* Issues warnings for non-conforming tool names
* @param name - The tool name that triggered the warnings
* @param warnings - Array of warning messages
*/
export declare function issueToolNameWarning(name: string, warnings: string[]): void;
/**
* Validates a tool name and issues warnings for non-conforming names
* @param name - The tool name to validate
* @returns true if the name is valid, false otherwise
*/
export declare function validateAndWarnToolName(name: string): boolean;
//# sourceMappingURL=toolNameValidation.d.ts.map
@@ -0,0 +1,220 @@
tlf2a 2 3 6 -1 15 0 0 0
===============================================================================
This is smbraille.tlf", or “Small Braille”, by Sam Hocevar <sam@hocevar.net>.
It was created on September 30th, 2006.
This font is free software. It comes without any warranty, to the extent
permitted by applicable law. You can redistribute it and/or modify it under
the terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
details.
Missing characters: # $ % & * + , : ; < > ?
This font is part of TOIlet’s official distribution. More information
on the TOIlet website at http://caca.zoy.org/wiki/toilet
===============================================================================
@
@@
⡇!
⠅!!
⠃⠃"
""
@
#@@
@
$@@
@
%@@
@
&@@
⠃'
''
⡔⠁(
⠣⡀((
⠈⢢)
⢀⠜))
@
*@@
@
+@@
@
,@@
-
⠉⠉--
.
⠶..
⡜/
⠎ //
⣎⣵0
⠫⠜00
⢺ 1
⠼⠄11
⠊⡱2
⠮⠤22
⢉⡹3
⠤⠜33
⢇⣸4
⠸44
⣏⡉5
⠤⠜55
⣎⡁8
⠣⠜88
⠉⡹7
⠸ 77
⢎⡱8
⠣⠜88
⢎⣱9
⠠⠜99
@
:@@
@
;@@
@
<@@
⣀⣀=
⠒⠒==
@
>@@
@
?@@
⣎⣱@
⠫⠥@@
⣎⣱A
⠇⠸AA
⣏⡱B
⠧⠜BB
⡎⠑C
⠣⠔CC
⡏⢱D
⠧⠜DD
⣏⡉E
⠧⠤EE
⣏⡉F
⠇ FF
⡎⠑G
⠣⠝GG
⣇⣸H
⠇⠸HH
⡇I
⠇II
⠈⢹J
⠣⠜JJ
⣇⠜K
⠇⠱KK
⡇ L
⠧⠤LL
⡷⢾M
⠇⠸MM
⡷⣸N
⠇⠹NN
⡎⢱O
⠣⠜OO
⣏⡱P
⠇ PP
⡎⢱Q
⠣⠪QQ
⣏⡱R
⠇⠱RR
⢎⡑S
⠢⠜SS
⢹⠁T
⠸ TT
⡇⢸U
⠣⠜UU
⡇⢸V
⠸⠃VV
⡇⢸W
⠟⠻WW
⢇⡸X
⠇⠸XX
⢇⢸Y
⠇YY
⢉⠝Z
⠮⠤ZZ
⡏[
⣇[[
⢣ \
⠱\\
⢹]
⣸]]
⠊⠂^
^^
_
⠤⠤__
⠑`
``
⢀⣀a
⠣⠼aa
⣇⡀b
⠧⠜bb
⢀⣀c
⠣⠤cc
⢀⣸d
⠣⠼dd
⢀⡀e
⠣⠭ee
⣰⡁f
⢸ ff
⢀⡀g
⣑⡺gg
⣇⡀h
⠇⠸hh
⠄i
⠇ii
⠠j
⡸jj
⡇⡠k
⠏⠢kk
⡇l
⠣ll
⣀⣀ m
⠇⠇⠇mm
⣀⡀n
⠇⠸nn
⢀⡀o
⠣⠜oo
⣀⡀p
⡧⠜pp
⢀⣀q
⠣⢼qq
⡀⣀r
⠏ rr
⢀⣀s
⠭⠕ss
⣰⡀t
⠘⠤tt
⡀⢀u
⠣⠼uu
⡀⢀v
⠱⠃vv
⡀ ⢀w
⠱⠱⠃ww
⡀⢀x
⠜⠣xx
⡀⢀y
⣑⡺yy
⣀⣀z
⠴⠥zz
⡰⠁{
⠘⠄{{
⡇|
⠇||
⠈⢆}
⠠⠃}}
⡠⡠~
~~
⣕⣪Ä
⠇⠸ÄÄ
⡕⢪Ö
⠣⠜ÖÖ
⡅⢨Ü
⠣⠜ÜÜ
⢂⣐ä
⠣⠼ää
⢂⡐ö
⠣⠜öö
⡂⢐ü
⠣⠼üü
⡔⡢ß
⡇⠜ßß
@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAO,MAAM,MAAM,GAAG,CAAC,CAAS,EAAsB,EAAE,CACtD,YAAI,CAAC,GAAG,CAAC,CAAkB,CAAC,CAAA;AADjB,QAAA,MAAM,UACW;AAEvB,MAAM,MAAM,GAAG,CAAC,CAAS,EAAsB,EAAE,CACtD,YAAI,CAAC,GAAG,CAAC,CAAkB,CAAC,CAAA;AADjB,QAAA,MAAM,UACW;AAiD9B;;;;;;;GAOG;AACU,QAAA,aAAa,GAAG,IAAI,GAAG,CAAgB;IAClD,GAAG;IACH,EAAE;IACF,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACJ,CAAC,CAAA;AAEF,4CAA4C;AAC/B,QAAA,IAAI,GAAG,IAAI,GAAG,CAA+B;IACxD,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,eAAe;IACf,CAAC,EAAE,EAAE,SAAS,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,cAAc,CAAC;IACrB,2CAA2C;IAC3C,8CAA8C;IAC9C,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,aAAa,CAAC;IACpB,CAAC,GAAG,EAAE,WAAW,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,CAAC;IACb,eAAe;IACf,CAAC,GAAG,EAAE,gBAAgB,CAAC;IACvB,cAAc;IACd,CAAC,GAAG,EAAE,sBAAsB,CAAC;IAC7B,CAAC,GAAG,EAAE,gBAAgB,CAAC;IACvB,wBAAwB;IACxB,OAAO;IACP,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,iDAAiD;IACjD,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,sBAAsB;IACtB,CAAC,GAAG,EAAE,OAAO,CAAC;IACd,gCAAgC;IAChC,CAAC,GAAG,EAAE,yBAAyB,CAAC;IAChC,2BAA2B;IAC3B,CAAC,GAAG,EAAE,qBAAqB,CAAC;IAC5B,OAAO;IACP,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACzB,SAAS;IACT,CAAC,GAAG,EAAE,gBAAgB,CAAC;IACvB,OAAO;IACP,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,OAAO;IACP,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACzB,SAAS;IACT,CAAC,GAAG,EAAE,mBAAmB,CAAC;CAC3B,CAAC,CAAA;AAEF,0BAA0B;AACb,QAAA,IAAI,GAAG,IAAI,GAAG,CACzB,KAAK,CAAC,IAAI,CAAC,YAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3C,CAAA","sourcesContent":["export const isCode = (c: string): c is EntryTypeCode =>\n name.has(c as EntryTypeCode)\n\nexport const isName = (c: string): c is EntryTypeName =>\n code.has(c as EntryTypeName)\n\nexport type EntryTypeCode =\n | '0'\n | ''\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | 'g'\n | 'x'\n | 'A'\n | 'D'\n | 'I'\n | 'K'\n | 'L'\n | 'M'\n | 'N'\n | 'S'\n | 'V'\n | 'X'\n\nexport type EntryTypeName =\n | 'File'\n | 'OldFile'\n | 'Link'\n | 'SymbolicLink'\n | 'CharacterDevice'\n | 'BlockDevice'\n | 'Directory'\n | 'FIFO'\n | 'ContiguousFile'\n | 'GlobalExtendedHeader'\n | 'ExtendedHeader'\n | 'SolarisACL'\n | 'GNUDumpDir'\n | 'Inode'\n | 'NextFileHasLongLinkpath'\n | 'NextFileHasLongPath'\n | 'ContinuationFile'\n | 'OldGnuLongPath'\n | 'SparseFile'\n | 'TapeVolumeHeader'\n | 'OldExtendedHeader'\n | 'Unsupported'\n\n/**\n * types that are a normal file system entry, not metadata.\n *\n * These can be the subject of extended/globalExtended headers, long path\n * names, long linkpath names, etc.\n *\n * Any other types are meta, and cannot be targetted by extended PAX headers.\n */\nexport const normalFsTypes = new Set<EntryTypeCode>([\n '0',\n '',\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n 'D',\n])\n\n// map types from key to human-friendly name\nexport const name = new Map<EntryTypeCode, EntryTypeName>([\n ['0', 'File'],\n // same as File\n ['', 'OldFile'],\n ['1', 'Link'],\n ['2', 'SymbolicLink'],\n // Devices and FIFOs aren't fully supported\n // they are parsed, but skipped when unpacking\n ['3', 'CharacterDevice'],\n ['4', 'BlockDevice'],\n ['5', 'Directory'],\n ['6', 'FIFO'],\n // same as File\n ['7', 'ContiguousFile'],\n // pax headers\n ['g', 'GlobalExtendedHeader'],\n ['x', 'ExtendedHeader'],\n // vendor-specific stuff\n // skip\n ['A', 'SolarisACL'],\n // like 5, but with data, which should be skipped\n ['D', 'GNUDumpDir'],\n // metadata only, skip\n ['I', 'Inode'],\n // data = link path of next file\n ['K', 'NextFileHasLongLinkpath'],\n // data = path of next file\n ['L', 'NextFileHasLongPath'],\n // skip\n ['M', 'ContinuationFile'],\n // like L\n ['N', 'OldGnuLongPath'],\n // skip\n ['S', 'SparseFile'],\n // skip\n ['V', 'TapeVolumeHeader'],\n // like x\n ['X', 'OldExtendedHeader'],\n])\n\n// map the other direction\nexport const code = new Map<EntryTypeName, EntryTypeCode>(\n Array.from(name).map(kv => [kv[1], kv[0]]),\n)\n"]}
@@ -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.es2024_promise = void 0;
const base_config_1 = require("./base-config");
exports.es2024_promise = {
libs: [],
variables: [
['PromiseWithResolvers', base_config_1.TYPE],
['PromiseConstructor', base_config_1.TYPE],
],
};
@@ -0,0 +1,11 @@
License
(The MIT License)
Copyright (c) 2014 The cheeriojs contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,20 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const VideoOff = createLucideIcon("VideoOff", [
[
"path",
{ d: "M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196", key: "w8jjjt" }
],
["path", { d: "M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2", key: "1xawa7" }],
["path", { d: "m2 2 20 20", key: "1ooewy" }]
]);
export { VideoOff as default };
//# sourceMappingURL=video-off.js.map
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es6: LibDefinition;
@@ -0,0 +1,366 @@
// @ts-ignore TS6133
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
test(".optional()", () => {
const schema = z.string().optional();
expect(schema.parse("adsf")).toEqual("adsf");
expect(schema.parse(undefined)).toEqual(undefined);
expect(schema.safeParse(null).success).toEqual(false);
expectTypeOf<typeof schema._output>().toEqualTypeOf<string | undefined>();
});
test("unwrap", () => {
const unwrapped = z.string().optional().unwrap();
expect(unwrapped).toBeInstanceOf(z.ZodString);
});
test("optionality", () => {
const a = z.string();
expect(a._zod.optin).toEqual(undefined);
expect(a._zod.optout).toEqual(undefined);
const b = z.string().optional();
expect(b._zod.optin).toEqual("optional");
expect(b._zod.optout).toEqual("optional");
const c = z.string().default("asdf");
expect(c._zod.optin).toEqual("defaulted");
expect(c._zod.optout).toEqual(undefined);
const d = z.string().optional().nullable();
expect(d._zod.optin).toEqual("optional");
expect(d._zod.optout).toEqual("optional");
const e = z.string().default("asdf").nullable();
expect(e._zod.optin).toEqual("defaulted");
expect(e._zod.optout).toEqual(undefined);
// z.undefined should NOT be optional
const f = z.undefined();
expect(f._zod.optin).toEqual(undefined);
expect(f._zod.optout).toEqual(undefined);
expectTypeOf<typeof f._zod.optin>().toEqualTypeOf<"optional" | "defaulted" | undefined>();
expectTypeOf<typeof f._zod.optout>().toEqualTypeOf<"optional" | undefined>();
// z.union should be optional if any of the types are optional
const g = z.union([z.string(), z.undefined()]);
expect(g._zod.optin).toEqual(undefined);
expect(g._zod.optout).toEqual(undefined);
expectTypeOf<typeof g._zod.optin>().toEqualTypeOf<"optional" | "defaulted" | undefined>();
expectTypeOf<typeof g._zod.optout>().toEqualTypeOf<"optional" | undefined>();
const h = z.union([z.string(), z.optional(z.string())]);
expect(h._zod.optin).toEqual("optional");
expect(h._zod.optout).toEqual("optional");
expectTypeOf<typeof h._zod.optin>().toEqualTypeOf<"optional" | "defaulted">();
expectTypeOf<typeof h._zod.optout>().toEqualTypeOf<"optional">();
});
test("pipe optionality", () => {
z.string().optional()._zod.optin;
const a = z.string().optional().pipe(z.string());
expect(a._zod.optin).toEqual("optional");
expect(a._zod.optout).toEqual(undefined);
expectTypeOf<typeof a._zod.optin>().toEqualTypeOf<"optional" | "defaulted">();
expectTypeOf<typeof a._zod.optout>().toEqualTypeOf<"optional" | undefined>();
const b = z
.string()
.transform((val) => (Math.random() ? val : undefined))
.pipe(z.string().optional());
expect(b._zod.optin).toEqual(undefined);
expect(b._zod.optout).toEqual("optional");
expectTypeOf<typeof b._zod.optin>().toEqualTypeOf<"optional" | "defaulted" | undefined>();
expectTypeOf<typeof b._zod.optout>().toEqualTypeOf<"optional">();
const c = z.string().default("asdf").pipe(z.string());
expect(c._zod.optin).toEqual("defaulted");
expect(c._zod.optout).toEqual(undefined);
const d = z
.string()
.transform((val) => (Math.random() ? val : undefined))
.pipe(z.string().default("asdf"));
expect(d._zod.optin).toEqual(undefined);
expect(d._zod.optout).toEqual(undefined);
});
test("pipe optionality inside objects", () => {
const schema = z.object({
a: z.string().optional(),
b: z.string().optional().pipe(z.string()),
c: z.string().default("asdf").pipe(z.string()),
d: z
.string()
.transform((val) => (Math.random() ? val : undefined))
.pipe(z.string().optional()),
e: z
.string()
.transform((val) => (Math.random() ? val : undefined))
.pipe(z.string().default("asdf")),
});
type SchemaIn = z.input<typeof schema>;
expectTypeOf<SchemaIn>().toEqualTypeOf<{
a?: string | undefined;
b?: string | undefined;
c?: string | undefined;
d: string;
e: string;
}>();
type SchemaOut = z.output<typeof schema>;
expectTypeOf<SchemaOut>().toEqualTypeOf<{
a?: string | undefined;
b: string;
c: string;
d?: string | undefined;
e: string;
}>();
});
test("optional prop with pipe", () => {
const schema = z.object({
id: z
.union([z.number(), z.string().nullish()])
.transform((val) => (val === null || val === undefined ? val : Number(val)))
.pipe(z.number())
.optional(),
});
schema.parse({});
schema.parse({}, { jitless: true });
});
test("object absent keys require optin optional", () => {
const valueUndefined = z.object({
value: z.undefined(),
union: z.union([z.string(), z.undefined()]),
});
expect(valueUndefined.safeParse({}).error!.issues).toMatchInlineSnapshot(`
[
{
"code": "invalid_type",
"expected": "nonoptional",
"message": "Invalid input: expected nonoptional, received undefined",
"path": [
"value",
],
},
{
"code": "invalid_type",
"expected": "nonoptional",
"message": "Invalid input: expected nonoptional, received undefined",
"path": [
"union",
],
},
]
`);
expect(valueUndefined.safeParse({}, { jitless: true }).success).toEqual(false);
expect(valueUndefined.parse({ value: undefined, union: undefined })).toEqual({
value: undefined,
union: undefined,
});
const optionalOutOnly = z.object({
value: z
.string()
.transform((val) => (Math.random() ? val : undefined))
.pipe(z.string().optional()),
});
expect(optionalOutOnly.safeParse({}).success).toEqual(false);
expect(optionalOutOnly.safeParse({}, { jitless: true }).success).toEqual(false);
const defaulted = z.object({ value: z.string().default("fallback") });
expect(defaulted.parse({})).toEqual({ value: "fallback" });
expect(defaulted.parse({}, { jitless: true })).toEqual({ value: "fallback" });
});
// exactOptional tests
test(".exactOptional()", () => {
const schema = z.string().exactOptional();
expect(schema.parse("asdf")).toEqual("asdf");
expect(schema.safeParse(undefined).success).toEqual(false);
expect(schema.safeParse(null).success).toEqual(false);
// Type should NOT include undefined
expectTypeOf<typeof schema._output>().toEqualTypeOf<string>();
expectTypeOf<typeof schema._input>().toEqualTypeOf<string>();
});
test("exactOptional unwrap", () => {
const unwrapped = z.string().exactOptional().unwrap();
expect(unwrapped).toBeInstanceOf(z.ZodString);
});
test("exactOptional optionality", () => {
const a = z.string().exactOptional();
expect(a._zod.optin).toEqual("optional");
expect(a._zod.optout).toEqual("optional");
expectTypeOf<typeof a._zod.optin>().toEqualTypeOf<"optional" | "defaulted">();
expectTypeOf<typeof a._zod.optout>().toEqualTypeOf<"optional">();
});
test("exactOptional in objects - absent keys", () => {
const schema = z.object({
a: z.string().exactOptional(),
});
// Absent key should pass
expect(schema.parse({})).toEqual({});
expect(schema.parse({}, { jitless: true })).toEqual({});
// Present key with valid value should pass
expect(schema.parse({ a: "hello" })).toEqual({ a: "hello" });
expect(schema.parse({ a: "hello" }, { jitless: true })).toEqual({ a: "hello" });
});
test("exactOptional in objects - explicit undefined rejected", () => {
const schema = z.object({
a: z.string().exactOptional(),
});
// Explicit undefined should fail
expect(schema.safeParse({ a: undefined }).success).toEqual(false);
expect(schema.safeParse({ a: undefined }, { jitless: true }).success).toEqual(false);
});
test("exactOptional type inference in objects", () => {
const schema = z.object({
a: z.string().exactOptional(),
b: z.string().optional(),
});
type SchemaIn = z.input<typeof schema>;
expectTypeOf<SchemaIn>().toEqualTypeOf<{
a?: string;
b?: string | undefined;
}>();
type SchemaOut = z.output<typeof schema>;
expectTypeOf<SchemaOut>().toEqualTypeOf<{
a?: string;
b?: string | undefined;
}>();
});
test("exactOptional vs optional comparison", () => {
const optionalSchema = z.object({ a: z.string().optional() });
const exactOptionalSchema = z.object({ a: z.string().exactOptional() });
// Both accept absent keys
expect(optionalSchema.parse({})).toEqual({});
expect(exactOptionalSchema.parse({})).toEqual({});
// Both accept valid values
expect(optionalSchema.parse({ a: "hi" })).toEqual({ a: "hi" });
expect(exactOptionalSchema.parse({ a: "hi" })).toEqual({ a: "hi" });
// optional() accepts explicit undefined
expect(optionalSchema.parse({ a: undefined })).toEqual({ a: undefined });
// exactOptional() rejects explicit undefined
expect(exactOptionalSchema.safeParse({ a: undefined }).success).toEqual(false);
});
// Defensive inference coverage: every schema that propagates `optout` participates in object-key optionality inference. If anyone ever changes the set of values that `optout` can take (or how OptionalOutSchema matches them), these assertions must continue to hold or downstream `z.infer<typeof obj>` types silently flip required keys.
test("object key optionality through optout propagation", () => {
const direct = z.object({ k: z.string().optional() });
expectTypeOf<z.infer<typeof direct>>().toEqualTypeOf<{ k?: string | undefined }>();
const exact = z.object({ k: z.string().exactOptional() });
expectTypeOf<z.infer<typeof exact>>().toEqualTypeOf<{ k?: string }>();
// nullable() preserves the inner type's optout
const nullableOpt = z.object({ k: z.string().optional().nullable() });
expectTypeOf<z.infer<typeof nullableOpt>>().toEqualTypeOf<{ k?: string | null | undefined }>();
// optional() wrapping nullable() — still optional out
const optNullable = z.object({ k: z.string().nullable().optional() });
expectTypeOf<z.infer<typeof optNullable>>().toEqualTypeOf<{ k?: string | null | undefined }>();
// union containing an optional member must mark the key as optional
const unionWithOpt = z.object({ k: z.union([z.string(), z.string().optional()]) });
expectTypeOf<z.infer<typeof unionWithOpt>>().toEqualTypeOf<{ k?: string | undefined }>();
// pipe ending in optional()
const pipedToOpt = z.object({
k: z
.string()
.transform((v) => (Math.random() ? v : undefined))
.pipe(z.string().optional()),
});
expectTypeOf<z.output<typeof pipedToOpt>>().toEqualTypeOf<{ k?: string | undefined }>();
// mixed shape pinning required vs optional keys end-to-end
const mixed = z.object({
req: z.string(),
opt: z.string().optional(),
exact: z.string().exactOptional(),
def: z.string().default("x"),
nullableOpt: z.string().optional().nullable(),
});
expectTypeOf<z.output<typeof mixed>>().toEqualTypeOf<{
req: string;
opt?: string | undefined;
exact?: string;
def: string;
nullableOpt?: string | null | undefined;
}>();
});
// Defensive: tuple optional-tail inference also reads optout. The PR that introduced `"includeUndefined"` had to update TupleOutputTypeWithOptionals; pin the result so any future flag change has to keep this contract.
test("tuple tail optionality through optout propagation", () => {
const trailingOptional = z.tuple([z.string(), z.number().optional()]);
expectTypeOf<z.output<typeof trailingOptional>>().toEqualTypeOf<[string, (number | undefined)?]>();
const trailingExact = z.tuple([z.string(), z.number().exactOptional()]);
expectTypeOf<z.output<typeof trailingExact>>().toEqualTypeOf<[string, number?]>();
// Interior optional must NOT make the tail optional
const interiorOptional = z.tuple([z.string(), z.number().optional(), z.string()]);
expectTypeOf<z.output<typeof interiorOptional>>().toEqualTypeOf<[string, number | undefined, string]>();
});
// An absent optional key whose check fails has its issue swallowed; the value the check wrote must go with it, on the JIT fastpass as well as the interpreted path.
test("swallowed issue on an absent optional key drops its value", async () => {
const schema = z.object({
a: z
.string()
.optional()
.superRefine((_v, ctx) => {
ctx.addIssue({ code: "custom", message: "bad" });
ctx.value = "leaked";
}),
});
for (const result of [
schema.safeParse({}),
schema.safeParse({}, { jitless: true }),
await schema.safeParseAsync({}),
]) {
expect(result.success).toEqual(true);
expect("a" in result.data!).toEqual(false);
}
// A present key keeps both the issue and its value.
expect(schema.safeParse({ a: "x" }).success).toEqual(false);
expect(schema.safeParse({ a: "x" }, { jitless: true }).success).toEqual(false);
});
test("optional does not swallow an issue it did not cause", () => {
// A pipe hands its `out` schema the caller's issues array so an unrecognized key can survive to an enclosing intersection. A defaulted inner substituting for absence must not read that as its own failing and drop it.
const result = z
.strictObject({ a: z.string() })
.transform((): number | undefined => undefined)
.pipe(z.number().default(5).optional())
.safeParse({ a: "x", extra: 1 });
expect(result.success).toBe(false);
expect(result.error!.issues.map((i) => i.code)).toEqual(["unrecognized_keys"]);
});