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,19 @@
// packages/react/use-escape-keydown/src/use-escape-keydown.tsx
import * as React from "react";
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
React.useEffect(() => {
const handleKeyDown = (event) => {
if (event.key === "Escape") {
onEscapeKeyDown(event);
}
};
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
}, [onEscapeKeyDown, ownerDocument]);
}
export {
useEscapeKeydown
};
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,23 @@
delete Object.freeze;
var html = require('../cjs');
console.assert(
html.escape('&<>\'"') === '&amp;&lt;&gt;&#39;&quot;',
'correct escape'
);
console.assert(
html.escape('<>\'"&') === '&lt;&gt;&#39;&quot;&amp;',
'correct inverted escape'
);
console.assert(
'&<>\'"' === html.unescape('&amp;&lt;&gt;&#39;&quot;'),
'correct unescape'
);
console.assert(
'<>\'"&' === html.unescape('&lt;&gt;&#39;&quot;&amp;'),
'correct inverted unescape'
);
@@ -0,0 +1,3 @@
/** Stable identifier used for the root route in a route tree. */
export declare const rootRouteId = "__root__";
export type RootRouteId = typeof rootRouteId;
@@ -0,0 +1,273 @@
/** numeric strings */
type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32"
/** string strings */
type StringType = "string" | "timestamp"
/** Generic JTD Schema without inference of the represented type */
export type SomeJTDSchemaType = (
| // ref
{ref: string}
// primitives
| {type: NumberType | StringType | "boolean"}
// enum
| {enum: string[]}
// elements
| {elements: SomeJTDSchemaType}
// values
| {values: SomeJTDSchemaType}
// properties
| {
properties: Record<string, SomeJTDSchemaType>
optionalProperties?: Record<string, SomeJTDSchemaType>
additionalProperties?: boolean
}
| {
properties?: Record<string, SomeJTDSchemaType>
optionalProperties: Record<string, SomeJTDSchemaType>
additionalProperties?: boolean
}
// discriminator
| {discriminator: string; mapping: Record<string, SomeJTDSchemaType>}
// empty
// NOTE see the end of
// https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492
// eslint-disable-next-line @typescript-eslint/ban-types
| {}
) & {
nullable?: boolean
metadata?: Record<string, unknown>
definitions?: Record<string, SomeJTDSchemaType>
}
/** required keys of an object, not undefined */
type RequiredKeys<T> = {
[K in keyof T]-?: undefined extends T[K] ? never : K
}[keyof T]
/** optional or undifined-able keys of an object */
type OptionalKeys<T> = {
[K in keyof T]-?: undefined extends T[K] ? K : never
}[keyof T]
/** type is true if T is a union type */
type IsUnion_<T, U extends T = T> = false extends (
T extends unknown ? ([U] extends [T] ? false : true) : never
)
? false
: true
type IsUnion<T> = IsUnion_<T>
/** type is true if T is identically E */
type TypeEquality<T, E> = [T] extends [E] ? ([E] extends [T] ? true : false) : false
/** type is true if T or null is identically E or null*/
type NullTypeEquality<T, E> = TypeEquality<T | null, E | null>
/** gets only the string literals of a type or null if a type isn't a string literal */
type EnumString<T> = [T] extends [never]
? null
: T extends string
? string extends T
? null
: T
: null
/** true if type is a union of string literals */
type IsEnum<T> = null extends EnumString<T> ? false : true
/** true only if all types are array types (not tuples) */
// NOTE relies on the fact that tuples don't have an index at 0.5, but arrays
// have an index at every number
type IsElements<T> = false extends IsUnion<T>
? [T] extends [readonly unknown[]]
? undefined extends T[0.5]
? false
: true
: false
: false
/** true if the the type is a values type */
type IsValues<T> = false extends IsUnion<T> ? TypeEquality<keyof T, string> : false
/** true if type is a properties type and Union is false, or type is a discriminator type and Union is true */
type IsRecord<T, Union extends boolean> = Union extends IsUnion<T>
? null extends EnumString<keyof T>
? false
: true
: false
/** true if type represents an empty record */
type IsEmptyRecord<T> = [T] extends [Record<string, never>]
? [T] extends [never]
? false
: true
: false
/** actual schema */
export type JTDSchemaType<T, D extends Record<string, unknown> = Record<string, never>> = (
| // refs - where null wasn't specified, must match exactly
(null extends EnumString<keyof D>
? never
:
| ({[K in keyof D]: [T] extends [D[K]] ? {ref: K} : never}[keyof D] & {nullable?: false})
// nulled refs - if ref is nullable and nullable is specified, then it can
// match either null or non-null definitions
| (null extends T
? {
[K in keyof D]: [Exclude<T, null>] extends [Exclude<D[K], null>]
? {ref: K}
: never
}[keyof D] & {nullable: true}
: never))
// empty - empty schemas also treat nullable differently in that it's now fully ignored
| (unknown extends T ? {nullable?: boolean} : never)
// all other types // numbers - only accepts the type number
| ((true extends NullTypeEquality<T, number>
? {type: NumberType}
: // booleans - accepts the type boolean
true extends NullTypeEquality<T, boolean>
? {type: "boolean"}
: // strings - only accepts the type string
true extends NullTypeEquality<T, string>
? {type: StringType}
: // strings - only accepts the type Date
true extends NullTypeEquality<T, Date>
? {type: "timestamp"}
: // enums - only accepts union of string literals
// TODO we can't actually check that everything in the union was specified
true extends IsEnum<Exclude<T, null>>
? {enum: EnumString<Exclude<T, null>>[]}
: // arrays - only accepts arrays, could be array of unions to be resolved later
true extends IsElements<Exclude<T, null>>
? T extends readonly (infer E)[]
? {
elements: JTDSchemaType<E, D>
}
: never
: // empty properties
true extends IsEmptyRecord<Exclude<T, null>>
?
| {properties: Record<string, never>; optionalProperties?: Record<string, never>}
| {optionalProperties: Record<string, never>}
: // values
true extends IsValues<Exclude<T, null>>
? T extends Record<string, infer V>
? {
values: JTDSchemaType<V, D>
}
: never
: // properties
true extends IsRecord<Exclude<T, null>, false>
? ([RequiredKeys<Exclude<T, null>>] extends [never]
? {
properties?: Record<string, never>
}
: {
properties: {[K in RequiredKeys<T>]: JTDSchemaType<T[K], D>}
}) &
([OptionalKeys<Exclude<T, null>>] extends [never]
? {
optionalProperties?: Record<string, never>
}
: {
optionalProperties: {
[K in OptionalKeys<T>]: JTDSchemaType<Exclude<T[K], undefined>, D>
}
}) & {
additionalProperties?: boolean
}
: // discriminator
true extends IsRecord<Exclude<T, null>, true>
? {
[K in keyof Exclude<T, null>]-?: Exclude<T, null>[K] extends string
? {
discriminator: K
mapping: {
// TODO currently allows descriminator to be present in schema
[M in Exclude<T, null>[K]]: JTDSchemaType<
Omit<T extends Record<K, M> ? T : never, K>,
D
>
}
}
: never
}[keyof Exclude<T, null>]
: never) &
(null extends T
? {
nullable: true
}
: {nullable?: false}))
) & {
// extra properties
metadata?: Record<string, unknown>
// TODO these should only be allowed at the top level
definitions?: {[K in keyof D]: JTDSchemaType<D[K], D>}
}
type JTDDataDef<S, D extends Record<string, unknown>> =
| // ref
(S extends {ref: string}
? D extends {[K in S["ref"]]: infer V}
? JTDDataDef<V, D>
: never
: // type
S extends {type: NumberType}
? number
: S extends {type: "boolean"}
? boolean
: S extends {type: "string"}
? string
: S extends {type: "timestamp"}
? string | Date
: // enum
S extends {enum: readonly (infer E)[]}
? string extends E
? never
: [E] extends [string]
? E
: never
: // elements
S extends {elements: infer E}
? JTDDataDef<E, D>[]
: // properties
S extends {
properties: Record<string, unknown>
optionalProperties?: Record<string, unknown>
additionalProperties?: boolean
}
? {-readonly [K in keyof S["properties"]]-?: JTDDataDef<S["properties"][K], D>} & {
-readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef<
S["optionalProperties"][K],
D
>
} & ([S["additionalProperties"]] extends [true] ? Record<string, unknown> : unknown)
: S extends {
properties?: Record<string, unknown>
optionalProperties: Record<string, unknown>
additionalProperties?: boolean
}
? {-readonly [K in keyof S["properties"]]-?: JTDDataDef<S["properties"][K], D>} & {
-readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef<
S["optionalProperties"][K],
D
>
} & ([S["additionalProperties"]] extends [true] ? Record<string, unknown> : unknown)
: // values
S extends {values: infer V}
? Record<string, JTDDataDef<V, D>>
: // discriminator
S extends {discriminator: infer M; mapping: Record<string, unknown>}
? [M] extends [string]
? {
[K in keyof S["mapping"]]: JTDDataDef<S["mapping"][K], D> & {[KM in M]: K}
}[keyof S["mapping"]]
: never
: // empty
unknown)
| (S extends {nullable: true} ? null : never)
export type JTDDataType<S> = S extends {definitions: Record<string, unknown>}
? JTDDataDef<S, S["definitions"]>
: JTDDataDef<S, Record<string, never>>
@@ -0,0 +1,18 @@
/**
Escape RegExp special characters.
You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
@example
```
import escapeStringRegexp = require('escape-string-regexp');
const escapedString = escapeStringRegexp('How much $ for a 🦄?');
//=> 'How much \\$ for a 🦄\\?'
new RegExp(escapedString);
```
*/
declare const escapeStringRegexp: (string: string) => string;
export = escapeStringRegexp;
@@ -0,0 +1,29 @@
/**
* dd-resizable.ts 12.6.0
* Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license
*/
import { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';
import { DDResizeOpt, DDUIData, GridItemHTMLElement } from './types';
export interface DDResizableOpt extends DDResizeOpt {
maxHeight?: number;
maxHeightMoveUp?: number;
maxWidth?: number;
maxWidthMoveLeft?: number;
minHeight?: number;
minWidth?: number;
start?: (event: Event, ui: DDUIData) => void;
stop?: (event: Event) => void;
resize?: (event: Event, ui: DDUIData) => void;
rtl?: boolean;
}
export declare class DDResizable extends DDBaseImplement implements HTMLElementExtendOpt<DDResizableOpt> {
el: GridItemHTMLElement;
option: DDResizableOpt;
constructor(el: GridItemHTMLElement, option?: DDResizableOpt);
on(event: 'resizestart' | 'resize' | 'resizestop', callback: (event: DragEvent) => void): void;
off(event: 'resizestart' | 'resize' | 'resizestop'): void;
enable(): void;
disable(): void;
destroy(): void;
updateOption(opts: DDResizableOpt): DDResizable;
}
@@ -0,0 +1 @@
export default function pad(str: string, width: number, alignLeft?: boolean): string;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_Z","33":"_A"},B:{"2":"_K","33":"_I"},C:{"2":"_S"},D:{"2":"_Q"},E:{"2":"_R"},F:{"2":"_c"},G:{"2":"_M"},H:{"2":"1D"},I:{"2":"_P"},J:{"2":"_B"},K:{"2":"_N"},L:{"2":"I"},M:{"2":"YC"},N:{"33":"_A"},O:{"2":"bC"},P:{"2":"_F"},Q:{"2":"JE"},R:{"2":"KE"},S:{"2":"_C"}},B:5,C:"CSS Exclusions Level 1",D:true};
@@ -0,0 +1,6 @@
import { DictionaryScoringExtras, MatchEstimated, MatchExtended } from '../../types';
export interface DictionaryReturn extends DictionaryScoringExtras {
calculation: number;
}
declare const _default: ({ rank, reversed, l33t, subs, token, dictionaryName, }: MatchExtended | MatchEstimated) => DictionaryReturn;
export default _default;
@@ -0,0 +1 @@
{"version":3,"names":["_importInjector","require","_isModule","addDefault","path","importedSource","opts","ImportInjector","addNamed","name","addNamespace","addSideEffect"],"sources":["../src/index.ts"],"sourcesContent":["import ImportInjector, { type ImportOptions } from \"./import-injector.ts\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type * as t from \"@babel/types\";\n\nexport { ImportInjector };\n\nexport { default as isModule } from \"./is-module.ts\";\n\nexport function addDefault(\n path: NodePath,\n importedSource: string,\n opts?: Partial<ImportOptions>,\n) {\n return new ImportInjector(path).addDefault(importedSource, opts);\n}\n\nfunction addNamed(\n path: NodePath,\n name: string,\n importedSource: string,\n opts?: Omit<\n Partial<ImportOptions>,\n \"ensureLiveReference\" | \"ensureNoContext\"\n >,\n): t.Identifier;\nfunction addNamed(\n path: NodePath,\n name: string,\n importedSource: string,\n opts?: Omit<Partial<ImportOptions>, \"ensureLiveReference\"> & {\n ensureLiveReference: true;\n },\n): t.MemberExpression;\nfunction addNamed(\n path: NodePath,\n name: string,\n importedSource: string,\n opts?: Omit<Partial<ImportOptions>, \"ensureNoContext\"> & {\n ensureNoContext: true;\n },\n): t.SequenceExpression;\n/**\n * add a named import to the program path of given path\n *\n * @export\n * @param {NodePath} path The starting path to find a program path\n * @param {string} name The name of the generated binding. Babel will prefix it with `_`\n * @param {string} importedSource The source of the import\n * @param {Partial<ImportOptions>} [opts]\n * @returns {t.Identifier | t.MemberExpression | t.SequenceExpression} If opts.ensureNoContext is true, returns a SequenceExpression,\n * else if opts.ensureLiveReference is true, returns a MemberExpression, else returns an Identifier\n */\nfunction addNamed(\n path: NodePath,\n name: string,\n importedSource: string,\n opts?: Partial<ImportOptions>,\n) {\n return new ImportInjector(path).addNamed(name, importedSource, opts);\n}\nexport { addNamed };\n\nexport function addNamespace(\n path: NodePath,\n importedSource: string,\n opts?: Partial<ImportOptions>,\n) {\n return new ImportInjector(path).addNamespace(importedSource, opts);\n}\n\nexport function addSideEffect(\n path: NodePath,\n importedSource: string,\n opts?: Partial<ImportOptions>,\n) {\n return new ImportInjector(path).addSideEffect(importedSource, opts);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAMA,IAAAC,SAAA,GAAAD,OAAA;AAEO,SAASE,UAAUA,CACxBC,IAAc,EACdC,cAAsB,EACtBC,IAA6B,EAC7B;EACA,OAAO,IAAIC,uBAAc,CAACH,IAAI,CAAC,CAACD,UAAU,CAACE,cAAc,EAAEC,IAAI,CAAC;AAClE;AAsCA,SAASE,QAAQA,CACfJ,IAAc,EACdK,IAAY,EACZJ,cAAsB,EACtBC,IAA6B,EAC7B;EACA,OAAO,IAAIC,uBAAc,CAACH,IAAI,CAAC,CAACI,QAAQ,CAACC,IAAI,EAAEJ,cAAc,EAAEC,IAAI,CAAC;AACtE;AAGO,SAASI,YAAYA,CAC1BN,IAAc,EACdC,cAAsB,EACtBC,IAA6B,EAC7B;EACA,OAAO,IAAIC,uBAAc,CAACH,IAAI,CAAC,CAACM,YAAY,CAACL,cAAc,EAAEC,IAAI,CAAC;AACpE;AAEO,SAASK,aAAaA,CAC3BP,IAAc,EACdC,cAAsB,EACtBC,IAA6B,EAC7B;EACA,OAAO,IAAIC,uBAAc,CAACH,IAAI,CAAC,CAACO,aAAa,CAACN,cAAc,EAAEC,IAAI,CAAC;AACrE","ignoreList":[]}
@@ -0,0 +1,11 @@
import { Child } from "./base.js";
//#region src/jsx/children.d.ts
export declare const toArray: (children: Child) => Child[];
export declare const Children: {
map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[];
forEach: (children: Child[], fn: (child: Child, index: number) => void) => void;
count: (children: Child[]) => number;
only: (_children: Child[]) => Child;
toArray: (children: Child) => Child[];
};
//#endregion
@@ -0,0 +1 @@
{"version":3,"file":"calendar-check.js","sources":["../../../src/icons/calendar-check.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CalendarCheck\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNOCAydjQiIC8+CiAgPHBhdGggZD0iTTE2IDJ2NCIgLz4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHg9IjMiIHk9IjQiIHJ4PSIyIiAvPgogIDxwYXRoIGQ9Ik0zIDEwaDE4IiAvPgogIDxwYXRoIGQ9Im05IDE2IDIgMiA0LTQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/calendar-check\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 CalendarCheck = createLucideIcon('CalendarCheck', [\n ['path', { d: 'M8 2v4', key: '1cmpym' }],\n ['path', { d: 'M16 2v4', key: '4m81vk' }],\n ['rect', { width: '18', height: '18', x: '3', y: '4', rx: '2', key: '1hopcy' }],\n ['path', { d: 'M3 10h18', key: '8toen8' }],\n ['path', { d: 'm9 16 2 2 4-4', key: '19s6y9' }],\n]);\n\nexport default CalendarCheck;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,iBAAiB,eAAiB,CAAA,CAAA,CAAA;AAAA,CAAA,CACtD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACvC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,MAAM,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,101 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _tsinterfacechecker = require('ts-interface-checker');
var _Optionsgentypes = require('./Options-gen-types'); var _Optionsgentypes2 = _interopRequireDefault(_Optionsgentypes);
const {Options: OptionsChecker} = _tsinterfacechecker.createCheckers.call(void 0, _Optionsgentypes2.default);
function validateOptions(options) {
OptionsChecker.strictCheck(options);
} exports.validateOptions = validateOptions;
@@ -0,0 +1,71 @@
{
"name": "@radix-ui/react-collection",
"version": "1.1.12",
"license": "MIT",
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"dependencies": {
"@radix-ui/react-compose-refs": "1.1.3",
"@radix-ui/react-context": "1.2.0",
"@radix-ui/react-primitive": "2.1.7",
"@radix-ui/react-slot": "1.3.0"
},
"devDependencies": {
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"typescript": "^5.9.3",
"@repo/builder": "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",
"directory": "packages/react/collection"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"scripts": {
"lint": "oxlint --max-warnings 0 src",
"clean": "rm -rf dist",
"reset": "rm -rf dist node_modules",
"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,89 @@
function padLeft(val, len) {
return String(val).padStart(len || 2, "0");
}
function dateTimeFormat(date, opts) {
return new Intl.DateTimeFormat("en-US", opts).format(date);
}
function getOrdinalSuffix(day) {
if (day > 3 && day < 21) {
return "th";
}
switch (day % 10) {
case 1:
return "st";
case 2:
return "nd";
case 3:
return "rd";
default:
return "th";
}
}
function timezone(date, together) {
let offset = date.getTimezoneOffset();
let prefix;
if (offset <= 0) {
prefix = "+";
offset = Math.abs(offset);
} else {
prefix = "-";
}
return `${prefix}${padLeft(Math.floor(offset / 60))}${together ? "" : ":"}${padLeft(Math.floor(offset % 60))}`;
}
const FORMAT_MAP = {
// 年份
yyyy: (d) => d.getFullYear(),
YYYY: (d) => d.getFullYear(),
YY: (d) => padLeft(d.getFullYear() % 100),
// 月份
MMMM: (d) => dateTimeFormat(d, { month: "long" }),
MMM: (d) => dateTimeFormat(d, { month: "short" }),
MM: (d) => padLeft(d.getMonth() + 1),
M: (d) => d.getMonth() + 1,
// 日期
DD: (d) => padLeft(d.getDate()),
D: (d) => d.getDate(),
Do: (d) => {
const day = d.getDate();
return String(day) + getOrdinalSuffix(day);
},
// 星期
dddd: (d) => dateTimeFormat(d, { weekday: "long" }),
ddd: (d) => dateTimeFormat(d, { weekday: "short" }),
dd: (d) => dateTimeFormat(d, { weekday: "narrow" }),
// 时间
HH: (d) => padLeft(d.getHours()),
H: (d) => d.getHours(),
hh: (d) => padLeft(d.getHours() % 12 || 12),
h: (d) => d.getHours() % 12 || 12,
mm: (d) => padLeft(d.getMinutes()),
m: (d) => d.getMinutes(),
ss: (d) => padLeft(d.getSeconds()),
s: (d) => d.getSeconds(),
SSS: (d) => padLeft(d.getMilliseconds(), 3),
// 其他
A: (d) => d.getHours() >= 12 ? "PM" : "AM",
a: (d) => d.getHours() >= 12 ? "pm" : "am",
Z: (d) => timezone(d),
ZZ: (d) => timezone(d, true)
};
const tokens = Object.keys(FORMAT_MAP).sort((a, b) => b.length - a.length).join("|");
const pattern = new RegExp(
`${tokens}|\\[([^\\]]*)]`,
"g"
);
function format(date, formatString) {
if (!formatString || formatString === "ISO") {
return date.toISOString();
}
return formatString.replace(pattern, (match, escapeContent) => {
if (escapeContent) {
return escapeContent;
}
const formatter = FORMAT_MAP[match];
return formatter ? formatter(date) : match;
});
}
export {
format as default
};
@@ -0,0 +1 @@
{"version":3,"file":"bug-off.js","sources":["../../../src/icons/bug-off.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BugOff\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTUgNy4xM1Y2YTMgMyAwIDAgMC01LjE0LTIuMUw4IDIiIC8+CiAgPHBhdGggZD0iTTE0LjEyIDMuODggMTYgMiIgLz4KICA8cGF0aCBkPSJNMjIgMTNoLTR2LTJhNCA0IDAgMCAwLTQtNGgtMS4zIiAvPgogIDxwYXRoIGQ9Ik0yMC45NyA1YzAgMi4xLTEuNiAzLjgtMy41IDQiIC8+CiAgPHBhdGggZD0ibTIgMiAyMCAyMCIgLz4KICA8cGF0aCBkPSJNNy43IDcuN0E0IDQgMCAwIDAgNiAxMXYzYTYgNiAwIDAgMCAxMS4xMyAzLjEzIiAvPgogIDxwYXRoIGQ9Ik0xMiAyMHYtOCIgLz4KICA8cGF0aCBkPSJNNiAxM0gyIiAvPgogIDxwYXRoIGQ9Ik0zIDIxYzAtMi4xIDEuNy0zLjkgMy44LTQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/bug-off\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst BugOff = createLucideIcon('BugOff', [\n ['path', { d: 'M15 7.13V6a3 3 0 0 0-5.14-2.1L8 2', key: 'vl8zik' }],\n ['path', { d: 'M14.12 3.88 16 2', key: 'qol33r' }],\n ['path', { d: 'M22 13h-4v-2a4 4 0 0 0-4-4h-1.3', key: '1ou0bd' }],\n ['path', { d: 'M20.97 5c0 2.1-1.6 3.8-3.5 4', key: '18gb23' }],\n ['path', { d: 'm2 2 20 20', key: '1ooewy' }],\n ['path', { d: 'M7.7 7.7A4 4 0 0 0 6 11v3a6 6 0 0 0 11.13 3.13', key: '1njkjs' }],\n ['path', { d: 'M12 20v-8', key: 'i3yub9' }],\n ['path', { d: 'M6 13H2', key: '82j7cp' }],\n ['path', { d: 'M3 21c0-2.1 1.7-3.9 3.8-4', key: '4p0ekp' }],\n]);\n\nexport default BugOff;\n"],"names":[],"mappings":"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"}
@@ -0,0 +1 @@
module.exports={C:{"85":0.00555,"96":0.00555,"115":0.4164,"121":0.00555,"127":0.02776,"140":0.02221,"147":0.00555,"149":0.00555,"150":0.05552,"151":0.06107,"152":1.91544,"153":0.02776,"154":1.01046,"155":1.89323,"156":2.71493,"157":0.03331,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 87 88 89 90 91 92 93 94 95 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 120 122 123 124 125 126 128 129 130 131 132 133 134 135 136 137 138 139 141 142 143 144 145 146 148 158 159 160 3.5 3.6"},D:{"103":0.00555,"105":0.0111,"106":0.02776,"107":0.02221,"108":0.0111,"109":0.4053,"110":0.00555,"111":0.0111,"112":0.00555,"113":0.00555,"116":0.02776,"117":0.00555,"118":0.03331,"119":0.00555,"120":0.09438,"121":0.00555,"124":1.60453,"126":0.03886,"131":0.04442,"132":0.00555,"133":0.03886,"134":0.02221,"135":0.00555,"136":0.02221,"137":0.00555,"138":0.32202,"139":0.03331,"140":0.06107,"141":0.03886,"142":0.06107,"143":0.16656,"144":0.02221,"145":0.06107,"146":0.31091,"147":0.00555,"148":0.20542,"149":0.07218,"150":0.16656,"151":1.01046,"152":5.9573,"153":8.89986,"154":4.0141,"155":0.0111,"156":0.02776,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 104 114 115 122 123 125 127 128 129 130 157"},F:{"101":0.00555,"126":0.00555,"134":0.06107,"135":0.37198,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 127 131 132 133 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"106":0.00555,"109":0.00555,"118":0.00555,"128":0.02776,"132":0.00555,"139":0.02221,"140":0.0111,"144":0.00555,"145":0.00555,"146":0.07773,"147":0.04442,"148":0.0111,"149":0.0111,"150":0.34422,"151":0.2776,"152":5.51869,"153":7.12322,"154":1.91544,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 107 108 110 111 112 113 114 115 116 117 119 120 121 122 123 124 125 126 127 129 130 131 133 134 135 136 137 138 141 142 143"},E:{"27":0.10549,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 15.1 15.2-15.3 15.4 16.1 16.3 16.4 17.2 17.4 18.0 18.2 18.4 27.1 27.2 TP","11.1":0.37754,"12.1":0.02776,"13.1":0.00555,"14.1":0.00555,"15.5":0.02776,"15.6":0.2887,"16.0":0.03331,"16.2":0.00555,"16.5":0.00555,"16.6":0.09438,"17.0":0.00555,"17.1":0.17211,"17.3":0.00555,"17.5":0.02776,"17.6":0.21098,"18.1":0.00555,"18.3":0.00555,"18.5-18.7":0.0111,"26.0":0.00555,"26.1":0.00555,"26.2":0.04442,"26.3":0.04442,"26.4":0.0111,"26.5":0.32757,"26.6":2.86483},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00281,"5.0-5.1":0.00281,"6.0-6.1":0,"7.0-7.1":0.00561,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.02807,"11.0-11.2":0.00281,"11.3-11.4":0.00561,"12.0-12.1":0,"12.2-12.5":0.07297,"13.0-13.1":0,"13.2":0.01403,"13.3":0,"13.4-13.7":0.00281,"14.0-14.4":0.01123,"14.5-14.8":0.01684,"15.0-15.1":0.01684,"15.2-15.3":0.01123,"15.4":0.01403,"15.5":0.01684,"15.6-15.8":0.36487,"16.0":0.02807,"16.1":0.05052,"16.2":0.02807,"16.3":0.06175,"16.4":0.01403,"16.5":0.02245,"16.6-16.7":0.50801,"17.0":0.01965,"17.1":0.02807,"17.2":0.02807,"17.3":0.0421,"17.4":0.05894,"17.5":0.11507,"17.6-17.7":0.29751,"18.0":0.06175,"18.1":0.12349,"18.2":0.1684,"18.3":0.2919,"18.4":0.18243,"18.5-18.7":3.76938,"26.0":0.18243,"26.1":0.18524,"26.2":0.48275,"26.3":0.52204,"26.4":0.38171,"26.5":2.55689,"26.6":15.77639,"27.0":1.20968,"27.1":0,"27.2":0.03087},P:{"26":0.03892,"29":0.00973,"30":1.97519,_:"4 20 21 22 23 24 25 27 28 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0"},I:{"0":0.01333,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.13789,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0":13.88722},R:{_:"0"},M:{"0":0.61827},Q:{_:"14.9"},O:{"0":0.00445},H:{all:0}};
@@ -0,0 +1,2 @@
export declare const stripTrailingSlashes: (str: string) => string;
//# sourceMappingURL=strip-trailing-slashes.d.ts.map
@@ -0,0 +1,22 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const ChefHat = createLucideIcon("ChefHat", [
[
"path",
{
d: "M17 21a1 1 0 0 0 1-1v-5.35c0-.457.316-.844.727-1.041a4 4 0 0 0-2.134-7.589 5 5 0 0 0-9.186 0 4 4 0 0 0-2.134 7.588c.411.198.727.585.727 1.041V20a1 1 0 0 0 1 1Z",
key: "1qvrer"
}
],
["path", { d: "M6 17h12", key: "1jwigz" }]
]);
export { ChefHat as default };
//# sourceMappingURL=chef-hat.js.map
@@ -0,0 +1,135 @@
import type {AnySchema} from "../../types"
import type {SchemaObjCxt} from ".."
import {_, str, getProperty, Code, Name} from "../codegen"
import {escapeFragment, getErrorPath, Type} from "../util"
import type {JSONType} from "../rules"
export interface SubschemaContext {
// TODO use Optional? align with SchemCxt property types
schema: AnySchema
schemaPath: Code
errSchemaPath: string
topSchemaRef?: Code
errorPath?: Code
dataLevel?: number
dataTypes?: JSONType[]
data?: Name
parentData?: Name
parentDataProperty?: Code | number
dataNames?: Name[]
dataPathArr?: (Code | number)[]
propertyName?: Name
jtdDiscriminator?: string
jtdMetadata?: boolean
compositeRule?: true
createErrors?: boolean
allErrors?: boolean
}
export type SubschemaArgs = Partial<{
keyword: string
schemaProp: string | number
schema: AnySchema
schemaPath: Code
errSchemaPath: string
topSchemaRef: Code
data: Name | Code
dataProp: Code | string | number
dataTypes: JSONType[]
definedProperties: Set<string>
propertyName: Name
dataPropType: Type
jtdDiscriminator: string
jtdMetadata: boolean
compositeRule: true
createErrors: boolean
allErrors: boolean
}>
export function getSubschema(
it: SchemaObjCxt,
{keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef}: SubschemaArgs
): SubschemaContext {
if (keyword !== undefined && schema !== undefined) {
throw new Error('both "keyword" and "schema" passed, only one allowed')
}
if (keyword !== undefined) {
const sch = it.schema[keyword]
return schemaProp === undefined
? {
schema: sch,
schemaPath: _`${it.schemaPath}${getProperty(keyword)}`,
errSchemaPath: `${it.errSchemaPath}/${keyword}`,
}
: {
schema: sch[schemaProp],
schemaPath: _`${it.schemaPath}${getProperty(keyword)}${getProperty(schemaProp)}`,
errSchemaPath: `${it.errSchemaPath}/${keyword}/${escapeFragment(schemaProp)}`,
}
}
if (schema !== undefined) {
if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) {
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"')
}
return {
schema,
schemaPath,
topSchemaRef,
errSchemaPath,
}
}
throw new Error('either "keyword" or "schema" must be passed')
}
export function extendSubschemaData(
subschema: SubschemaContext,
it: SchemaObjCxt,
{dataProp, dataPropType: dpType, data, dataTypes, propertyName}: SubschemaArgs
): void {
if (data !== undefined && dataProp !== undefined) {
throw new Error('both "data" and "dataProp" passed, only one allowed')
}
const {gen} = it
if (dataProp !== undefined) {
const {errorPath, dataPathArr, opts} = it
const nextData = gen.let("data", _`${it.data}${getProperty(dataProp)}`, true)
dataContextProps(nextData)
subschema.errorPath = str`${errorPath}${getErrorPath(dataProp, dpType, opts.jsPropertySyntax)}`
subschema.parentDataProperty = _`${dataProp}`
subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty]
}
if (data !== undefined) {
const nextData = data instanceof Name ? data : gen.let("data", data, true) // replaceable if used once?
dataContextProps(nextData)
if (propertyName !== undefined) subschema.propertyName = propertyName
// TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr
}
if (dataTypes) subschema.dataTypes = dataTypes
function dataContextProps(_nextData: Name): void {
subschema.data = _nextData
subschema.dataLevel = it.dataLevel + 1
subschema.dataTypes = []
it.definedProperties = new Set<string>()
subschema.parentData = it.data
subschema.dataNames = [...it.dataNames, _nextData]
}
}
export function extendSubschemaMode(
subschema: SubschemaContext,
{jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors}: SubschemaArgs
): void {
if (compositeRule !== undefined) subschema.compositeRule = compositeRule
if (createErrors !== undefined) subschema.createErrors = createErrors
if (allErrors !== undefined) subschema.allErrors = allErrors
subschema.jtdDiscriminator = jtdDiscriminator // not inherited
subschema.jtdMetadata = jtdMetadata // not inherited
}
@@ -0,0 +1,54 @@
{
"name": "find-up",
"version": "5.0.0",
"description": "Find a file or directory by walking up parent directories",
"license": "MIT",
"repository": "sindresorhus/find-up",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"find",
"up",
"find-up",
"findup",
"look-up",
"look",
"file",
"search",
"match",
"package",
"resolve",
"parent",
"parents",
"folder",
"directory",
"walk",
"walking",
"path"
],
"dependencies": {
"locate-path": "^6.0.0",
"path-exists": "^4.0.0"
},
"devDependencies": {
"ava": "^2.1.0",
"is-path-inside": "^2.1.0",
"tempy": "^0.6.0",
"tsd": "^0.13.1",
"xo": "^0.33.0"
}
}
@@ -0,0 +1,7 @@
"use strict";
const constants = require("./constants-DR3SPJ7u.js");
const addMilliseconds = require("./addMilliseconds.js");
function addDays(date, days) {
return addMilliseconds(date, days * constants.MS_IN_DAY);
}
module.exports = addDays;
@@ -0,0 +1 @@
{"version":3,"file":"message-circle-heart.js","sources":["../../../src/icons/message-circle-heart.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name MessageCircleHeart\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNy45IDIwQTkgOSAwIDEgMCA0IDE2LjFMMiAyMloiIC8+CiAgPHBhdGggZD0iTTE1LjggOS4yYTIuNSAyLjUgMCAwIDAtMy41IDBsLS4zLjQtLjM1LS4zYTIuNDIgMi40MiAwIDEgMC0zLjIgMy42bDMuNiAzLjUgMy42LTMuNWMxLjItMS4yIDEuMS0yLjcuMi0zLjciIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/message-circle-heart\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 MessageCircleHeart = createLucideIcon('MessageCircleHeart', [\n ['path', { d: 'M7.9 20A9 9 0 1 0 4 16.1L2 22Z', key: 'vv11sd' }],\n [\n 'path',\n {\n d: 'M15.8 9.2a2.5 2.5 0 0 0-3.5 0l-.3.4-.35-.3a2.42 2.42 0 1 0-3.2 3.6l3.6 3.5 3.6-3.5c1.2-1.2 1.1-2.7.2-3.7',\n key: '43lnbm',\n },\n ],\n]);\n\nexport default MessageCircleHeart;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,iBAAiB,oBAAsB,CAAA,CAAA,CAAA;AAAA,CAAA,CAChE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAkC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAC/D,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,934 @@
import type * as checks from "./checks.js";
import type * as JSONSchema from "./json-schema.js";
import * as regexes from "./regexes.js";
import type { $ZodRegistry } from "./registries.js";
import { base64Charset, base64urlCharset } from "./schemas.js";
import type * as schemas from "./schemas.js";
import {
type ProcessParams,
type Processor,
type RegistryToJSONSchemaParams,
type Seen,
type ToJSONSchemaContext,
type ToJSONSchemaParams,
type ZodStandardJSONSchemaPayload,
extractDefs,
finalize,
handleUnrepresentable,
initializeContext,
processSchema,
} from "./to-json-schema.js";
import { BIGINT_FORMAT_RANGES, NUMBER_FORMAT_RANGES, assignProp, getEnumValues } from "./util.js";
// ==================== CHECK AGGREGATION ====================
// constraint metadata comes from folding `def.checks` here, not from trusting `_zod.bag`: the bag is written by each check's own `onattach` in chain order, which has repeatedly produced order-dependent and lossy values (#6550). runtime checks are a conjunction, so every merge below is the conjunction's — tightest bound wins, patterns union, divisors collect, mime lists intersect
type Bound = number | bigint | Date;
interface CheckAggregate<N extends Bound = Bound> {
minimum?: N;
maximum?: N;
exclusiveMinimum?: N;
exclusiveMaximum?: N;
multipleOf?: number[];
format?: string;
// ORed across formats: any integer format keeps the conjunction integer, whatever format lands last
isInt?: boolean;
patterns?: Set<RegExp>;
mime?: string[];
contentEncoding?: string;
// a datetime that drops the offset or the seconds accepts what `date-time` forbids, so the keyword is withheld
laxFormat?: boolean;
}
const narrowMin = (agg: CheckAggregate, key: "minimum" | "exclusiveMinimum", value: Bound): void => {
if (agg[key] === undefined || value > agg[key]) agg[key] = value;
};
const narrowMax = (agg: CheckAggregate, key: "maximum" | "exclusiveMaximum", value: Bound): void => {
if (agg[key] === undefined || value < agg[key]) agg[key] = value;
};
const narrowBoth = (agg: CheckAggregate, value: number): void => {
narrowMin(agg, "minimum", value);
narrowMax(agg, "maximum", value);
};
const addDivisor = (agg: CheckAggregate, value: number): void => {
agg.multipleOf ??= [];
if (!agg.multipleOf.includes(value)) agg.multipleOf.push(value);
};
const addPattern = (agg: CheckAggregate, pattern: RegExp): void => {
agg.patterns ??= new Set();
agg.patterns.add(pattern);
};
const intersectMime = (agg: CheckAggregate, mime: string[]): void => {
agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
};
// last-wins, matching the bag's historical write order; the flag keeps an integer format from being lost to a later float one
const setFormat = (agg: CheckAggregate, format: string): void => {
agg.format = format;
if (format.includes("int")) agg.isInt = true;
};
type Contributor = (agg: CheckAggregate, def: any) => void;
const minContributor: Contributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
const maxContributor: Contributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
const formatContributor =
(ranges: Record<string, [Bound, Bound]>): Contributor =>
(agg, def) => {
setFormat(agg, def.format);
const [minimum, maximum] = ranges[def.format]!;
narrowMin(agg, "minimum", minimum);
narrowMax(agg, "maximum", maximum);
};
const contributors: Record<string, Contributor> = {
greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
multiple_of: (agg, def) => addDivisor(agg, def.value),
number_format: formatContributor(NUMBER_FORMAT_RANGES),
bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
min_length: minContributor,
max_length: maxContributor,
length_equals: (agg, def) => narrowBoth(agg, def.length),
min_size: minContributor,
max_size: maxContributor,
size_equals: (agg, def) => narrowBoth(agg, def.size),
string_format: (agg, def) => {
setFormat(agg, def.format);
if (def.pattern) addPattern(agg, def.pattern);
if (def.format === "base64" || def.format === "base64url") agg.contentEncoding = def.format;
if (def.local || def.precision === -1) agg.laxFormat = true;
},
mime_type: (agg, def) => intersectMime(agg, def.mime),
};
export function aggregateChecks<N extends Bound = Bound>(schema: schemas.$ZodType): CheckAggregate<N> {
const agg: CheckAggregate = {};
const def = schema._zod.def;
// a format schema is its own first check, same rule as $ZodType init
const list: checks.$ZodCheck[] = schema._zod.traits.has("$ZodCheck")
? [schema as unknown as checks.$ZodCheck, ...(def.checks ?? [])]
: (def.checks ?? []);
for (const ch of list) contributors[ch._zod.def.check]?.(agg, ch._zod.def);
// reconcile with the bag so third-party onattach contributions still land; first-party residue is never tighter than the fold, so merging it back is idempotent for one and additive for the other
const bag = schema._zod.bag as Omit<CheckAggregate, "multipleOf"> & { multipleOf?: number };
if (bag.minimum !== undefined) narrowMin(agg, "minimum", bag.minimum);
if (bag.exclusiveMinimum !== undefined) narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
if (bag.maximum !== undefined) narrowMax(agg, "maximum", bag.maximum);
if (bag.exclusiveMaximum !== undefined) narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
if (bag.multipleOf !== undefined) addDivisor(agg, bag.multipleOf);
if (bag.format !== undefined) {
agg.format ??= bag.format;
if (bag.format.includes("int")) agg.isInt = true;
}
if (bag.mime) intersectMime(agg, bag.mime);
for (const pattern of bag.patterns ?? []) addPattern(agg, pattern);
return agg as CheckAggregate<N>;
}
const formatMap: Partial<Record<checks.$ZodStringFormats, string | undefined>> = {
guid: "uuid",
url: "uri",
datetime: "date-time",
json_string: "json-string",
regex: "", // do not set
};
// ==================== SIMPLE TYPE PROCESSORS ====================
// the runtime patterns are lax so parse paths never overflow the regex stack; the emitted schema swaps in the exact block forms, which zod itself never executes
const exactPatterns: Map<RegExp, RegExp> = new Map([
[base64Charset, regexes.base64],
[base64urlCharset, regexes.base64url],
]);
const exactPattern = (p: RegExp): RegExp => exactPatterns.get(p) ?? p;
export const stringProcessor: Processor<schemas.$ZodString> = (schema, ctx, _json, _params) => {
const json = _json as JSONSchema.StringSchema;
json.type = "string";
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
if (typeof minimum === "number") json.minLength = minimum;
if (typeof maximum === "number") json.maxLength = maximum;
// custom pattern overrides format
if (format) {
json.format = formatMap[format as checks.$ZodStringFormats] ?? format;
if (json.format === "") delete json.format; // empty format is not valid
// `z.iso.time()` is never full-time, and `laxFormat` carries the datetime shapes that also accept what their keyword forbids
if (format === "time" || laxFormat) {
delete json.format;
}
}
if (contentEncoding) json.contentEncoding = contentEncoding;
if (patterns && patterns.size > 0) {
const patternList = [...patterns].map(exactPattern);
if (patternList.length === 1) json.pattern = patternList[0]!.source;
else if (patternList.length > 1) {
json.allOf = [
...patternList.map((regex) => ({
...(ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0"
? ({ type: "string" } as const)
: {}),
pattern: regex.source,
})),
];
}
}
};
export const numberProcessor: Processor<schemas.$ZodNumber> = (schema, ctx, _json, params) => {
const json = _json as JSONSchema.NumberSchema | JSONSchema.IntegerSchema;
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks<number>(schema);
json.type = isInt ? "integer" : "number";
// when both minimum and exclusiveMinimum exist, pick the more restrictive one
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
if (exMin) {
if (legacy) {
json.minimum = exclusiveMinimum;
json.exclusiveMinimum = true;
} else {
json.exclusiveMinimum = exclusiveMinimum;
}
} else if (typeof minimum === "number") {
json.minimum = minimum;
}
if (exMax) {
if (legacy) {
json.maximum = exclusiveMaximum;
json.exclusiveMaximum = true;
} else {
json.exclusiveMaximum = exclusiveMaximum;
}
} else if (typeof maximum === "number") {
json.maximum = maximum;
}
if (multipleOf) {
// JSON Schema requires a divisor strictly greater than zero, and a non-finite one does not survive JSON at all. A negative divisor accepts exactly what its absolute value accepts, so it still maps; zero, NaN and Infinity have no keyword form.
const divisors = new Set<number>();
for (const divisor of multipleOf) {
if (Number.isFinite(divisor) && divisor !== 0) divisors.add(Math.abs(divisor));
else
handleUnrepresentable(
schema,
ctx,
json,
params,
`A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`
);
}
// chained divisors are a conjunction the keyword cannot carry alone, so extras ride an allOf, same as stacked patterns
const [first, ...rest] = divisors;
if (first !== undefined) json.multipleOf = first;
if (rest.length) json.allOf = [...(json.allOf ?? []), ...rest.map((m) => ({ multipleOf: m }))];
}
};
export const booleanProcessor: Processor<schemas.$ZodBoolean> = (_schema, _ctx, json, _params) => {
(json as JSONSchema.BooleanSchema).type = "boolean";
};
export const bigintProcessor: Processor<schemas.$ZodBigInt> = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "BigInt cannot be represented in JSON Schema");
};
export const symbolProcessor: Processor<schemas.$ZodSymbol> = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Symbols cannot be represented in JSON Schema");
};
export const nullProcessor: Processor<schemas.$ZodNull> = (_schema, ctx, json, _params) => {
if (ctx.target === "openapi-3.0") {
json.type = "string";
json.nullable = true;
json.enum = [null];
} else {
json.type = "null";
}
};
export const undefinedProcessor: Processor<schemas.$ZodUndefined> = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Undefined cannot be represented in JSON Schema");
};
export const voidProcessor: Processor<schemas.$ZodVoid> = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Void cannot be represented in JSON Schema");
};
export const neverProcessor: Processor<schemas.$ZodNever> = (_schema, _ctx, json, _params) => {
json.not = {};
};
export const anyProcessor: Processor<schemas.$ZodAny> = (_schema, _ctx, _json, _params) => {
// empty schema accepts anything
};
export const unknownProcessor: Processor<schemas.$ZodUnknown> = (_schema, _ctx, _json, _params) => {
// empty schema accepts anything
};
export const dateProcessor: Processor<schemas.$ZodDate> = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Date cannot be represented in JSON Schema");
};
export const enumProcessor: Processor<schemas.$ZodEnum> = (schema, _ctx, json, _params) => {
const def = schema._zod.def as schemas.$ZodEnumDef;
const values = getEnumValues(def.entries);
// an empty enum accepts nothing, same as z.never()
if (values.length === 0) {
json.not = {};
return;
}
// Number enums can have both string and number values
if (values.every((v) => typeof v === "number")) json.type = "number";
if (values.every((v) => typeof v === "string")) json.type = "string";
json.enum = values;
};
export const literalProcessor: Processor<schemas.$ZodLiteral> = (schema, ctx, json, params) => {
const def = schema._zod.def as schemas.$ZodLiteralDef<any>;
// a literal with no values accepts nothing, same as z.never()
if (def.values.length === 0) {
json.not = {};
return;
}
const vals: (string | number | boolean | null)[] = [];
for (const val of def.values) {
if (val === undefined) {
// a custom schema replaces the whole literal, so there is nothing left to accumulate
if (handleUnrepresentable(schema, ctx, json, params, "Literal `undefined` cannot be represented in JSON Schema"))
return;
// otherwise do not add to vals
} else if (typeof val === "bigint") {
if (handleUnrepresentable(schema, ctx, json, params, "BigInt literals cannot be represented in JSON Schema"))
return;
vals.push(Number(val));
} else {
vals.push(val);
}
}
if (vals.length === 0) {
// do nothing (an undefined literal was stripped)
} else if (vals.length === 1) {
const val = vals[0]!;
json.type = val === null ? ("null" as const) : (typeof val as any);
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
json.enum = [val];
} else {
json.const = val;
}
} else {
if (vals.every((v) => typeof v === "number")) json.type = "number";
if (vals.every((v) => typeof v === "string")) json.type = "string";
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
if (vals.every((v) => v === null)) json.type = "null";
json.enum = vals;
}
};
export const nanProcessor: Processor<schemas.$ZodNaN> = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "NaN cannot be represented in JSON Schema");
};
export const templateLiteralProcessor: Processor<schemas.$ZodTemplateLiteral> = (schema, _ctx, json, _params) => {
const _json = json as JSONSchema.StringSchema;
const pattern = schema._zod.pattern;
if (!pattern) throw new Error("Pattern not found in template literal");
_json.type = "string";
_json.pattern = pattern.source;
};
export const fileProcessor: Processor<schemas.$ZodFile> = (schema, _ctx, json, _params) => {
const _json = json as JSONSchema.StringSchema;
_json.type = "string";
_json.format = "binary";
_json.contentEncoding = "binary";
const { minimum, maximum, mime } = aggregateChecks<number>(schema);
if (minimum !== undefined) _json.minLength = minimum;
if (maximum !== undefined) _json.maxLength = maximum;
if (!mime) return;
// an empty intersection means the mime checks share no value, so nothing passes at runtime; `anyOf` must be non-empty, so the false schema is `not: {}`
if (mime.length === 0) _json.not = {};
else if (mime.length === 1) _json.contentMediaType = mime[0]!;
// only contentMediaType differs, so the shared props stay at the root
else _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
};
export const successProcessor: Processor<schemas.$ZodSuccess> = (_schema, _ctx, json, _params) => {
(json as JSONSchema.BooleanSchema).type = "boolean";
};
export const customProcessor: Processor<schemas.$ZodCustom> = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
};
export const functionProcessor: Processor<schemas.$ZodFunction> = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Function types cannot be represented in JSON Schema");
};
export const transformProcessor: Processor<schemas.$ZodTransform> = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
};
export const mapProcessor: Processor<schemas.$ZodMap> = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Map cannot be represented in JSON Schema");
};
export const setProcessor: Processor<schemas.$ZodSet> = (schema, ctx, json, params) => {
handleUnrepresentable(schema, ctx, json, params, "Set cannot be represented in JSON Schema");
};
// ==================== COMPOSITE TYPE PROCESSORS ====================
export const arrayProcessor: Processor<schemas.$ZodArray> = (schema, ctx, _json, params) => {
const json = _json as JSONSchema.ArraySchema;
const def = schema._zod.def as schemas.$ZodArrayDef;
const { minimum, maximum } = aggregateChecks(schema);
if (typeof minimum === "number") json.minItems = minimum;
if (typeof maximum === "number") json.maxItems = maximum;
json.type = "array";
json.items = processSchema(def.element, ctx as any, {
...params,
path: [...params.path, "items"],
});
};
// Transform and catch set `optin = "optional"` at runtime so the parser lets them observe an
// absent key, but their declared input type stays required. An input JSON Schema describes the
// declared type, so resolve past them to the schema that actually carries the optionality.
// Used by both `objectProcessor` (for `required`) and `tupleProcessor` (for `minItems`); see
// wiki/optionality.md, "The JSON Schema emitter reads the *static* value".
function inputOptin(schema: schemas.$ZodType): "optional" | "defaulted" | undefined {
const def = schema._zod.def;
if (def.type === "pipe" && (def as schemas.$ZodPipeDef).in._zod.traits.has("$ZodTransform")) {
return inputOptin((def as schemas.$ZodPipeDef).out);
}
if (def.type === "catch") {
return inputOptin((def as schemas.$ZodCatchDef).innerType);
}
return schema._zod.optin;
}
export const objectProcessor: Processor<schemas.$ZodObject> = (schema, ctx, _json, params) => {
const json = _json as JSONSchema.ObjectSchema;
const def = schema._zod.def as schemas.$ZodObjectDef;
const shape = def.shape;
// dropping it while still emitting `additionalProperties: false` would emit a schema that rejects data this one requires
const symbolKeys = Object.getOwnPropertySymbols(shape);
if (
symbolKeys.length &&
handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")
) {
return;
}
json.type = "object";
json.properties = {};
for (const key in shape) {
// assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter on the plain {} we build into
assignProp(
json.properties,
key,
processSchema(shape[key]!, ctx as any, {
...params,
path: [...params.path, "properties", key],
})
);
}
// required keys
const requiredKeys: string[] = [];
for (const key of Object.keys(shape)) {
const field = def.shape[key]!;
if (ctx.io === "input" ? inputOptin(field) === undefined : field._zod.optout === undefined) {
requiredKeys.push(key);
}
}
if (requiredKeys.length > 0) {
json.required = requiredKeys;
}
// catchall
if (def.catchall?._zod.def.type === "never") {
// strict
json.additionalProperties = false;
} else if (!def.catchall) {
// regular
if (ctx.io === "output") json.additionalProperties = false;
} else if (def.catchall) {
json.additionalProperties = processSchema(def.catchall, ctx as any, {
...params,
path: [...params.path, "additionalProperties"],
});
}
};
export const unionProcessor: Processor<schemas.$ZodUnion> = (schema, ctx, json, params) => {
const def = schema._zod.def as schemas.$ZodUnionDef;
// Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions
const isExclusive = def.inclusive === false;
const options = def.options.map((x, i) =>
processSchema(x, ctx as any, {
...params,
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i],
})
);
if (isExclusive) {
json.oneOf = options;
} else {
json.anyOf = options;
}
};
export const intersectionProcessor: Processor<schemas.$ZodIntersection> = (schema, ctx, json, params) => {
const def = schema._zod.def as schemas.$ZodIntersectionDef;
const a = processSchema(def.left, ctx as any, {
...params,
path: [...params.path, "allOf", 0],
});
const b = processSchema(def.right, ctx as any, {
...params,
path: [...params.path, "allOf", 1],
});
const isSimpleIntersection = (val: any) => "allOf" in val && Object.keys(val).length === 1;
const allOf = [
...(isSimpleIntersection(a) ? (a.allOf as any[]) : [a]),
...(isSimpleIntersection(b) ? (b.allOf as any[]) : [b]),
];
json.allOf = allOf;
// Recorded innermost first, so a nested intersection has already folded by the time this one is considered. The array is the handle rather than the schema, because a wrapper that inherits this schema shares the same array; `finalize` folds every object holding it. See `foldIntersection`.
ctx.intersections.push(allOf);
};
export const tupleProcessor: Processor<schemas.$ZodTuple> = (schema, ctx, _json, params) => {
const json = _json as JSONSchema.ArraySchema;
const def = schema._zod.def as schemas.$ZodTupleDef;
json.type = "array";
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
const restPath =
ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
const prefixItems = def.items.map((x, i) =>
processSchema(x, ctx as any, {
...params,
path: [...params.path, prefixPath, i],
})
);
const rest = def.rest
? processSchema(def.rest, ctx as any, {
...params,
path: [...params.path, restPath, ...(ctx.target === "openapi-3.0" ? [def.items.length] : [])],
})
: null;
let minItems = def.items.length;
while (minItems > 0) {
const item = def.items[minItems - 1] as schemas.$ZodType;
const optional = ctx.io === "input" ? inputOptin(item) !== undefined : item._zod.optout === "optional";
if (!optional) break;
minItems--;
}
const maxItems = def.items.length;
const isClosed = !def.rest;
if (ctx.target === "draft-2020-12") {
json.prefixItems = prefixItems;
if (isClosed) {
json.items = false;
} else if (rest) {
json.items = rest;
}
if (minItems > 0) json.minItems = minItems;
if (isClosed) json.maxItems = maxItems;
} else if (ctx.target === "openapi-3.0") {
json.items = {
anyOf: prefixItems,
};
if (rest) {
json.items.anyOf!.push(rest);
}
if (minItems > 0) json.minItems = minItems;
if (isClosed) json.maxItems = maxItems;
} else {
json.items = prefixItems;
if (isClosed) {
json.additionalItems = false;
} else if (rest) {
json.additionalItems = rest;
}
if (minItems > 0) json.minItems = minItems;
if (isClosed) json.maxItems = maxItems;
}
// explicit user-defined length checks take precedence
const { minimum, maximum } = aggregateChecks(schema);
if (typeof minimum === "number") json.minItems = minimum;
if (typeof maximum === "number") json.maxItems = maximum;
};
/** JSON object keys are always strings, so a numeric record key schema is re-expressed over the
* numeric-string form the record parser matches. Deferred to `finalize`, after the flatten: a key
* behind a wrapper only carries its own `type` before then, and a union key only has its branches.
*
* A numeric bound cannot apply to a property name, so `minimum` and its siblings are dropped rather
* than carried over: keeping them beside `type: "string"` reproduces the match-nothing schema this
* exists to fix. A key that carries one therefore emits wider than the record parses — `z.record(z.number().min(5), V)`
* accepts `"3"` — which is the deliberate trade, since throwing on it would reject an ordinary schema
* outright. */
function stringifyKeyNames(
bySchema: Map<JSONSchema.BaseSchema, Seen>,
json: JSONSchema.BaseSchema,
visited: Set<JSONSchema.BaseSchema>
): JSONSchema.BaseSchema {
// an extracted key that rewrites cannot go on sharing its definition — the string form a key position needs is not the number form every other reference wants — so it inlines. One that does not rewrite keeps the `$ref`.
if (json.$ref) {
// a recursive key holds its own reference inside its definition, so a node already on the path is left alone rather than resolved again
if (visited.has(json)) return json;
visited.add(json);
const def = bySchema.get(json)?.def;
if (!def) return json;
const inlined = stringifyKeyNames(bySchema, def, visited);
return inlined === def ? json : inlined;
}
for (const keyword of ["anyOf", "oneOf"] as const) {
const branches = json[keyword];
if (!Array.isArray(branches)) continue;
const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
// rebuilding regardless would detach a key that had nothing to re-express, dropping its `$ref` and leaking the internal `id`
if (mapped.some((branch, i) => branch !== branches[i])) json = { ...json, [keyword]: mapped };
}
// a member that already admits a string leaves the key unconstrained, so the node's own type re-expresses only when every member is numeric
const types = Array.isArray(json.type) ? json.type : [json.type];
const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
// a heterogeneous key carries no type at all, so its numeric members are caught here instead
const values = json.enum ?? (json.const !== undefined ? [json.const] : undefined);
if (!numericType && !values?.some((v) => typeof v === "number")) return json;
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json;
if (rest.enum) rest.enum = rest.enum.map((v) => (typeof v === "number" ? String(v) : v));
else if (typeof rest.const === "number") rest.const = String(rest.const);
// a heterogeneous key keeps its absent type: the stringified members already say what a key may be
if (!numericType) return rest;
rest.type = "string";
if (!values) rest.pattern = (types.includes("number") ? regexes.number : regexes.integer).source;
return rest;
}
/** Every record of one conversion, so the carriers are found in a single pass rather than once per record. */
const pendingRecords = new WeakMap<ToJSONSchemaContext, schemas.$ZodType[]>();
function rewriteKeyNames(ctx: ToJSONSchemaContext): void {
// an extracted key is resolved by the object `extractToDef` left in its place, so the map is built once rather than searched per reference. `_zod.toJSONSchema` can hand the same object to two schemas, so the first entry carrying a body wins, as a search would have found it.
const bySchema = new Map<JSONSchema.BaseSchema, Seen>();
for (const entry of ctx.seen.values()) {
if (entry.def && !bySchema.has(entry.schema)) bySchema.set(entry.schema, entry);
}
const rewrites = new Map<JSONSchema.BaseSchema, JSONSchema.BaseSchema>();
for (const record of pendingRecords.get(ctx) ?? []) {
const seen = ctx.seen.get(record);
const names = (seen?.def ?? seen?.schema)?.propertyNames;
if (!names || names === true || rewrites.has(names)) continue;
const rewritten = stringifyKeyNames(bySchema, names, new Set());
if (rewritten !== names) rewrites.set(names, rewritten);
}
if (!rewrites.size) return;
// the flatten has already copied each record's own properties onto every wrapper by reference, and an extracted body is another such copy, so every carrier holding a rewritten key is updated together
for (const entry of ctx.seen.values()) {
for (const carrier of [entry.schema, entry.def]) {
const rewritten = carrier && rewrites.get(carrier.propertyNames as JSONSchema.BaseSchema);
if (rewritten) carrier!.propertyNames = rewritten;
}
}
}
export const recordProcessor: Processor<schemas.$ZodRecord> = (schema, ctx, _json, params) => {
const json = _json as JSONSchema.ObjectSchema;
const def = schema._zod.def as schemas.$ZodRecordDef;
json.type = "object";
// For looseRecord with regex patterns, use patternProperties. This correctly represents "only validate keys matching the pattern" semantics and composes well with allOf (intersections)
const keyType = def.keyType as schemas.$ZodTypes;
const patterns = aggregateChecks(keyType).patterns;
if (def.mode === "loose" && patterns && patterns.size > 0) {
// Use patternProperties for looseRecord with regex patterns
const valueSchema = processSchema(def.valueType, ctx as any, {
...params,
path: [...params.path, "patternProperties", "*"],
});
json.patternProperties = {};
for (const pattern of patterns) {
assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
}
} else {
// Default behavior: use propertyNames + additionalProperties
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
json.propertyNames = processSchema(def.keyType, ctx as any, {
...params,
path: [...params.path, "propertyNames"],
});
let pending = pendingRecords.get(ctx);
if (!pending) {
pending = [];
pendingRecords.set(ctx, pending);
ctx.deferred.push(() => rewriteKeyNames(ctx));
}
pending.push(schema);
}
json.additionalProperties = processSchema(def.valueType, ctx as any, {
...params,
path: [...params.path, "additionalProperties"],
});
}
// Add required for keys with discrete values (enum, literal, etc.)
const keyValues = keyType._zod.values;
// Every key shares one value schema, so an optional-in value makes the whole key set omittable on input. Output keeps them: the exhaustive branch assigns every key, even one whose value came back undefined.
const omittableOnInput = ctx.io === "input" && inputOptin(def.valueType as schemas.$ZodType) !== undefined;
if (keyValues && !def.partial && !omittableOnInput) {
const validKeyValues = [...keyValues].filter(
(v): v is string | number => typeof v === "string" || typeof v === "number"
);
if (validKeyValues.length > 0) {
json.required = validKeyValues.map(String);
}
}
};
export const nullableProcessor: Processor<schemas.$ZodNullable> = (schema, ctx, json, params) => {
const def = schema._zod.def as schemas.$ZodNullableDef;
const inner = processSchema(def.innerType, ctx as any, params);
const seen = ctx.seen.get(schema)!;
if (ctx.target === "openapi-3.0") {
seen.ref = def.innerType;
json.nullable = true;
} else {
json.anyOf = [inner, { type: "null" }];
}
};
export const nonoptionalProcessor: Processor<schemas.$ZodNonOptional> = (schema, ctx, _json, params) => {
const def = schema._zod.def as schemas.$ZodNonOptionalDef;
processSchema(def.innerType, ctx as any, params);
const seen = ctx.seen.get(schema)!;
seen.ref = def.innerType;
};
/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
* A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
* unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
const UNREPRESENTABLE_DEFAULT = Symbol();
function serializeDefaultValue(
value: unknown,
schema: schemas.$ZodType,
ctx: ToJSONSchemaContext,
json: JSONSchema.BaseSchema,
params: ProcessParams
): any {
let unrepresentable = false;
const serialized = JSON.stringify(value, (_, val) => {
if (typeof val !== "bigint") return val;
unrepresentable = true;
return null;
});
if (!unrepresentable) return JSON.parse(serialized);
handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
return UNREPRESENTABLE_DEFAULT;
}
export const defaultProcessor: Processor<schemas.$ZodDefault> = (schema, ctx, json, params) => {
const def = schema._zod.def as schemas.$ZodDefaultDef;
processSchema(def.innerType, ctx as any, params);
const seen = ctx.seen.get(schema)!;
seen.ref = def.innerType;
const value = serializeDefaultValue(def.defaultValue, schema, ctx as ToJSONSchemaContext, json, params);
if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
};
export const prefaultProcessor: Processor<schemas.$ZodPrefault> = (schema, ctx, json, params) => {
const def = schema._zod.def as schemas.$ZodPrefaultDef;
processSchema(def.innerType, ctx as any, params);
const seen = ctx.seen.get(schema)!;
seen.ref = def.innerType;
if (ctx.io !== "input") return;
const value = serializeDefaultValue(def.defaultValue, schema, ctx as ToJSONSchemaContext, json, params);
if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
};
export const catchProcessor: Processor<schemas.$ZodCatch> = (schema, ctx, json, params) => {
const def = schema._zod.def as schemas.$ZodCatchDef;
processSchema(def.innerType, ctx as any, params);
const seen = ctx.seen.get(schema)!;
seen.ref = def.innerType;
let catchValue: any;
try {
catchValue = def.catchValue(undefined as any);
} catch {
handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
return;
}
json.default = catchValue;
};
export const pipeProcessor: Processor<schemas.$ZodPipe> = (schema, ctx, _json, params) => {
const def = schema._zod.def as schemas.$ZodPipeDef;
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
processSchema(innerType, ctx as any, params);
const seen = ctx.seen.get(schema)!;
seen.ref = innerType;
};
export const readonlyProcessor: Processor<schemas.$ZodReadonly> = (schema, ctx, json, params) => {
const def = schema._zod.def as schemas.$ZodReadonlyDef;
processSchema(def.innerType, ctx as any, params);
const seen = ctx.seen.get(schema)!;
seen.ref = def.innerType;
json.readOnly = true;
};
export const promiseProcessor: Processor<schemas.$ZodPromise> = (schema, ctx, _json, params) => {
const def = schema._zod.def as schemas.$ZodPromiseDef;
processSchema(def.innerType, ctx as any, params);
const seen = ctx.seen.get(schema)!;
seen.ref = def.innerType;
};
export const optionalProcessor: Processor<schemas.$ZodOptional> = (schema, ctx, _json, params) => {
const def = schema._zod.def as schemas.$ZodOptionalDef;
processSchema(def.innerType, ctx as any, params);
const seen = ctx.seen.get(schema)!;
seen.ref = def.innerType;
};
export const lazyProcessor: Processor<schemas.$ZodLazy> = (schema, ctx, _json, params) => {
const innerType = (schema as schemas.$ZodLazy)._zod.innerType;
processSchema(innerType, ctx as any, params);
const seen = ctx.seen.get(schema)!;
seen.ref = innerType;
};
// ==================== ALL PROCESSORS ====================
export const allProcessors: Record<string, Processor<any>> = {
string: stringProcessor,
number: numberProcessor,
boolean: booleanProcessor,
bigint: bigintProcessor,
symbol: symbolProcessor,
null: nullProcessor,
undefined: undefinedProcessor,
void: voidProcessor,
never: neverProcessor,
any: anyProcessor,
unknown: unknownProcessor,
date: dateProcessor,
enum: enumProcessor,
literal: literalProcessor,
nan: nanProcessor,
template_literal: templateLiteralProcessor,
file: fileProcessor,
success: successProcessor,
custom: customProcessor,
function: functionProcessor,
transform: transformProcessor,
map: mapProcessor,
set: setProcessor,
array: arrayProcessor,
object: objectProcessor,
union: unionProcessor,
intersection: intersectionProcessor,
tuple: tupleProcessor,
record: recordProcessor,
nullable: nullableProcessor,
nonoptional: nonoptionalProcessor,
default: defaultProcessor,
prefault: prefaultProcessor,
catch: catchProcessor,
pipe: pipeProcessor,
readonly: readonlyProcessor,
promise: promiseProcessor,
optional: optionalProcessor,
lazy: lazyProcessor,
};
// ==================== TOP-LEVEL toJSONSchema ====================
export function toJSONSchema<T extends schemas.$ZodType>(
schema: T,
params?: ToJSONSchemaParams
): ZodStandardJSONSchemaPayload<T>;
export function toJSONSchema(
registry: $ZodRegistry<{ id?: string | undefined }>,
params?: RegistryToJSONSchemaParams
): { schemas: Record<string, ZodStandardJSONSchemaPayload<schemas.$ZodType>> };
export function toJSONSchema(
input: schemas.$ZodType | $ZodRegistry<{ id?: string | undefined }>,
params?: ToJSONSchemaParams | RegistryToJSONSchemaParams
): any {
if ("_idmap" in input) {
// Registry case
const registry = input as $ZodRegistry<{ id?: string | undefined }>;
const ctx = initializeContext({ ...params, processors: allProcessors });
const defs: any = {};
// First pass: process all schemas to build the seen map
for (const entry of registry._idmap.entries()) {
const [_, schema] = entry;
processSchema(schema, ctx as any);
}
const schemas: Record<string, JSONSchema.BaseSchema> = {};
const external = {
registry,
uri: (params as RegistryToJSONSchemaParams)?.uri,
defs,
};
// Update the context with external configuration
ctx.external = external;
// Second pass: emit each schema
for (const entry of registry._idmap.entries()) {
const [key, schema] = entry;
extractDefs(ctx as any, schema);
assignProp(schemas, key, finalize(ctx as any, schema));
}
if (Object.keys(defs).length > 0) {
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
schemas.__shared = {
[defsSegment]: defs,
};
}
return { schemas };
}
// Single schema case
const ctx = initializeContext({ ...params, processors: allProcessors });
processSchema(input, ctx as any);
extractDefs(ctx as any, input);
return finalize(ctx as any, input);
}
@@ -0,0 +1,16 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const ChevronsRightLeft = createLucideIcon("ChevronsRightLeft", [
["path", { d: "m20 17-5-5 5-5", key: "30x0n2" }],
["path", { d: "m4 17 5-5-5-5", key: "16spf4" }]
]);
export { ChevronsRightLeft as default };
//# sourceMappingURL=chevrons-right-left.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_ZE","2":"_5B"},C:{"1":"_w","2":"_f"},D:{"1":"_DP","2":"_UC"},E:{"1":"_YB","2":"_k","16":"mB"},F:{"1":"_oB","2":"F"},G:{"1":"_t","2":"_d"},H:{"1":"1D"},I:{"1":"_8B","2":"_n"},J:{"1":"_B"},K:{"1":"_N"},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:"Form attribute",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"arrow-right-left.js","sources":["../../../src/icons/arrow-right-left.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ArrowRightLeft\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTYgMyA0IDQtNCA0IiAvPgogIDxwYXRoIGQ9Ik0yMCA3SDQiIC8+CiAgPHBhdGggZD0ibTggMjEtNC00IDQtNCIgLz4KICA8cGF0aCBkPSJNNCAxN2gxNiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/arrow-right-left\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 ArrowRightLeft = createLucideIcon('ArrowRightLeft', [\n ['path', { d: 'm16 3 4 4-4 4', key: '1x1c3m' }],\n ['path', { d: 'M20 7H4', key: 'zbl0bi' }],\n ['path', { d: 'm8 21-4-4 4-4', key: 'h9nckh' }],\n ['path', { d: 'M4 17h16', key: 'g4d7ey' }],\n]);\n\nexport default ArrowRightLeft;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,iBAAiB,gBAAkB,CAAA,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,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 CatchScope extends ScopeBase<ScopeType.catch, TSESTree.CatchClause, Scope> {
constructor(scopeManager: ScopeManager, upperScope: CatchScope['upper'], block: CatchScope['block']);
}
@@ -0,0 +1,152 @@
import { isTag, isText } from "domhandler";
import { filter, findOne } from "./querying.js";
/**
* A map of functions to check nodes against.
*/
const Checks = {
tag_name(name) {
if (typeof name === "function") {
return (elem) => isTag(elem) && name(elem.name);
}
else if (name === "*") {
return isTag;
}
return (elem) => isTag(elem) && elem.name === name;
},
tag_type(type) {
if (typeof type === "function") {
return (elem) => type(elem.type);
}
return (elem) => elem.type === type;
},
tag_contains(data) {
if (typeof data === "function") {
return (elem) => isText(elem) && data(elem.data);
}
return (elem) => isText(elem) && elem.data === data;
},
};
/**
* Returns a function to check whether a node has an attribute with a particular
* value.
*
* @param attrib Attribute to check.
* @param value Attribute value to look for.
* @returns A function to check whether the a node has an attribute with a
* particular value.
*/
function getAttribCheck(attrib, value) {
if (typeof value === "function") {
return (elem) => isTag(elem) && value(elem.attribs[attrib]);
}
return (elem) => isTag(elem) && elem.attribs[attrib] === value;
}
/**
* Returns a function that returns `true` if either of the input functions
* returns `true` for a node.
*
* @param a First function to combine.
* @param b Second function to combine.
* @returns A function taking a node and returning `true` if either of the input
* functions returns `true` for the node.
*/
function combineFuncs(a, b) {
return (elem) => a(elem) || b(elem);
}
/**
* Returns a function that executes all checks in `options` and returns `true`
* if any of them match a node.
*
* @param options An object describing nodes to look for.
* @returns A function that executes all checks in `options` and returns `true`
* if any of them match a node.
*/
function compileTest(options) {
const funcs = Object.keys(options).map((key) => {
const value = options[key];
return Object.prototype.hasOwnProperty.call(Checks, key)
? Checks[key](value)
: getAttribCheck(key, value);
});
return funcs.length === 0 ? null : funcs.reduce(combineFuncs);
}
/**
* Checks whether a node matches the description in `options`.
*
* @category Legacy Query Functions
* @param options An object describing nodes to look for.
* @param node The element to test.
* @returns Whether the element matches the description in `options`.
*/
export function testElement(options, node) {
const test = compileTest(options);
return test ? test(node) : true;
}
/**
* Returns all nodes that match `options`.
*
* @category Legacy Query Functions
* @param options An object describing nodes to look for.
* @param nodes Nodes to search through.
* @param recurse Also consider child nodes.
* @param limit Maximum number of nodes to return.
* @returns All nodes that match `options`.
*/
export function getElements(options, nodes, recurse, limit = Infinity) {
const test = compileTest(options);
return test ? filter(test, nodes, recurse, limit) : [];
}
/**
* Returns the node with the supplied ID.
*
* @category Legacy Query Functions
* @param id The unique ID attribute value to look for.
* @param nodes Nodes to search through.
* @param recurse Also consider child nodes.
* @returns The node with the supplied ID.
*/
export function getElementById(id, nodes, recurse = true) {
if (!Array.isArray(nodes))
nodes = [nodes];
return findOne(getAttribCheck("id", id), nodes, recurse);
}
/**
* Returns all nodes with the supplied `tagName`.
*
* @category Legacy Query Functions
* @param tagName Tag name to search for.
* @param nodes Nodes to search through.
* @param recurse Also consider child nodes.
* @param limit Maximum number of nodes to return.
* @returns All nodes with the supplied `tagName`.
*/
export function getElementsByTagName(tagName, nodes, recurse = true, limit = Infinity) {
return filter(Checks["tag_name"](tagName), nodes, recurse, limit);
}
/**
* Returns all nodes with the supplied `className`.
*
* @category Legacy Query Functions
* @param className Class name to search for.
* @param nodes Nodes to search through.
* @param recurse Also consider child nodes.
* @param limit Maximum number of nodes to return.
* @returns All nodes with the supplied `className`.
*/
export function getElementsByClassName(className, nodes, recurse = true, limit = Infinity) {
return filter(getAttribCheck("class", className), nodes, recurse, limit);
}
/**
* Returns all nodes with the supplied `type`.
*
* @category Legacy Query Functions
* @param type Element type to look for.
* @param nodes Nodes to search through.
* @param recurse Also consider child nodes.
* @param limit Maximum number of nodes to return.
* @returns All nodes with the supplied `type`.
*/
export function getElementsByTagType(type, nodes, recurse = true, limit = Infinity) {
return filter(Checks["tag_type"](type), nodes, recurse, limit);
}
//# sourceMappingURL=legacy.js.map
@@ -0,0 +1,115 @@
import * as util from "../core/util.js";
const error = () => {
const Sizable = {
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) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
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 = {
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;
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 () {
return {
localeError: error(),
};
}
@@ -0,0 +1,55 @@
'use strict'
const fs = require('graceful-fs')
const path = require('path')
const copySync = require('../copy').copySync
const removeSync = require('../remove').removeSync
const mkdirpSync = require('../mkdirs').mkdirpSync
const stat = require('../util/stat')
function moveSync (src, dest, opts) {
opts = opts || {}
const overwrite = opts.overwrite || opts.clobber || false
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)
stat.checkParentPathsSync(src, srcStat, dest, 'move')
if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))
return doRename(src, dest, overwrite, isChangingCase)
}
function isParentRoot (dest) {
const parent = path.dirname(dest)
const parsedPath = path.parse(parent)
return parsedPath.root === parent
}
function doRename (src, dest, overwrite, isChangingCase) {
if (isChangingCase) return rename(src, dest, overwrite)
if (overwrite) {
removeSync(dest)
return rename(src, dest, overwrite)
}
if (fs.existsSync(dest)) throw new Error('dest already exists.')
return rename(src, dest, overwrite)
}
function rename (src, dest, overwrite) {
try {
fs.renameSync(src, dest)
} catch (err) {
if (err.code !== 'EXDEV') throw err
return moveAcrossDevice(src, dest, overwrite)
}
}
function moveAcrossDevice (src, dest, overwrite) {
const opts = {
overwrite,
errorOnExist: true,
preserveTimestamps: true
}
copySync(src, dest, opts)
return removeSync(src)
}
module.exports = moveSync
@@ -0,0 +1,18 @@
import type { CanonicalPath } from '../create-program/shared';
import type { TSESTreeOptions } from '../parser-options';
export declare function clearGlobCache(): void;
/**
* Normalizes, sanitizes, resolves and filters the provided project paths
*/
export declare function resolveProjectList(options: Readonly<{
cacheLifetime?: TSESTreeOptions['cacheLifetime'];
project: string[] | null;
projectFolderIgnoreList: TSESTreeOptions['projectFolderIgnoreList'];
singleRun: boolean;
tsconfigRootDir: string;
}>): ReadonlyMap<CanonicalPath, string>;
/**
* Exported for testing purposes only
* @internal
*/
export declare function clearGlobResolutionCache(): void;
@@ -0,0 +1 @@
{"version":3,"file":"rotate-cw-square.js","sources":["../../../src/icons/rotate-cw-square.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name RotateCwSquare\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgNUg2YTIgMiAwIDAgMC0yIDJ2MyIgLz4KICA8cGF0aCBkPSJtOSA4IDMtMy0zLTMiIC8+CiAgPHBhdGggZD0iTTQgMTR2NGEyIDIgMCAwIDAgMiAyaDEyYTIgMiAwIDAgMCAyLTJWN2EyIDIgMCAwIDAtMi0yaC0yIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/rotate-cw-square\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 RotateCwSquare = createLucideIcon('RotateCwSquare', [\n ['path', { d: 'M12 5H6a2 2 0 0 0-2 2v3', key: 'l96uqu' }],\n ['path', { d: 'm9 8 3-3-3-3', key: '1gzgc3' }],\n ['path', { d: 'M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2', key: '1w2k5h' }],\n]);\n\nexport default RotateCwSquare;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,iBAAiB,gBAAkB,CAAA,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC7C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA6D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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;AAC5F,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,33 @@
/**
* Audited & minimal JS implementation of hash functions, MACs, and KDFs.
* Check out individual modules.
* @module
* @example
```js
import {
sha256, sha384, sha512, sha224, sha512_224, sha512_256
} from '@noble/hashes/sha2.js';
import {
sha3_224, sha3_256, sha3_384, sha3_512,
keccak_224, keccak_256, keccak_384, keccak_512,
shake128, shake256
} from '@noble/hashes/sha3.js';
import {
cshake128, cshake256,
turboshake128, turboshake256,
kt128, kt256,
kmac128, kmac256,
tuplehash256, parallelhash256,
keccakprg
} from '@noble/hashes/sha3-addons.js';
import { blake3 } from '@noble/hashes/blake3.js';
import { blake2b, blake2s } from '@noble/hashes/blake2.js';
import { hmac } from '@noble/hashes/hmac.js';
import { hkdf } from '@noble/hashes/hkdf.js';
import { pbkdf2, pbkdf2Async } from '@noble/hashes/pbkdf2.js';
import { scrypt, scryptAsync } from '@noble/hashes/scrypt.js';
import { md5, ripemd160, sha1 } from '@noble/hashes/legacy.js';
import * as utils from '@noble/hashes/utils.js';
```
*/
throw new Error('root module cannot be imported: import submodules instead. Check out README');
@@ -0,0 +1,14 @@
# Security Policy
## Supported Versions
Version 1.0.0 will be supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 1.x.x | :white_check_mark: |
| < 1.0 | :x: |
## Reporting a Vulnerability
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
@@ -0,0 +1,43 @@
import api from './rules/api.js';
import guide from './rules/guide.js';
import routing from './rules/routing.js';
import installation from './rules/installation.js';
import setupAndArchitecture from './rules/setup-and-architecture.js';
const rules = [
{
name: 'api',
description: 'TanStack Router: API',
rule: api,
alwaysApply: false,
globs: ['src/**/*.ts', 'src/**/*.tsx'],
},
{
name: 'guide',
description: 'TanStack Router: Guide',
rule: guide,
alwaysApply: false,
globs: ['src/**/*.ts', 'src/**/*.tsx'],
},
{
name: 'routing',
description: 'TanStack Router: Routing',
rule: routing,
alwaysApply: false,
globs: ['src/**/*.ts', 'src/**/*.tsx'],
},
{
name: 'installation',
description: 'TanStack Router: Installation',
rule: installation,
alwaysApply: false,
globs: ['src/**/*.ts', 'src/**/*.tsx'],
},
{
name: 'setup-and-architecture',
description: 'TanStack Router: Setup and Architecture',
rule: setupAndArchitecture,
alwaysApply: false,
globs: ['package.json', 'vite.config.ts', 'tsconfig.json', 'src/**/*.ts', 'src/**/*.tsx'],
}
];
export default rules;
@@ -0,0 +1,118 @@
import express from 'express';
import { clientRegistrationHandler } from './handlers/register.js';
import { tokenHandler } from './handlers/token.js';
import { authorizationHandler } from './handlers/authorize.js';
import { revocationHandler } from './handlers/revoke.js';
import { metadataHandler } from './handlers/metadata.js';
// Check for dev mode flag that allows HTTP issuer URLs (for development/testing only)
const allowInsecureIssuerUrl = process.env.MCP_DANGEROUSLY_ALLOW_INSECURE_ISSUER_URL === 'true' || process.env.MCP_DANGEROUSLY_ALLOW_INSECURE_ISSUER_URL === '1';
if (allowInsecureIssuerUrl) {
// eslint-disable-next-line no-console
console.warn('MCP_DANGEROUSLY_ALLOW_INSECURE_ISSUER_URL is enabled - HTTP issuer URLs are allowed. Do not use in production.');
}
const checkIssuerUrl = (issuer) => {
// Technically RFC 8414 does not permit a localhost HTTPS exemption, but this will be necessary for ease of testing
if (issuer.protocol !== 'https:' && issuer.hostname !== 'localhost' && issuer.hostname !== '127.0.0.1' && !allowInsecureIssuerUrl) {
throw new Error('Issuer URL must be HTTPS');
}
if (issuer.hash) {
throw new Error(`Issuer URL must not have a fragment: ${issuer}`);
}
if (issuer.search) {
throw new Error(`Issuer URL must not have a query string: ${issuer}`);
}
};
export const createOAuthMetadata = (options) => {
const issuer = options.issuerUrl;
const baseUrl = options.baseUrl;
checkIssuerUrl(issuer);
const authorization_endpoint = '/authorize';
const token_endpoint = '/token';
const registration_endpoint = options.provider.clientsStore.registerClient ? '/register' : undefined;
const revocation_endpoint = options.provider.revokeToken ? '/revoke' : undefined;
const metadata = {
issuer: issuer.href,
service_documentation: options.serviceDocumentationUrl?.href,
authorization_endpoint: new URL(authorization_endpoint, baseUrl || issuer).href,
response_types_supported: ['code'],
code_challenge_methods_supported: ['S256'],
token_endpoint: new URL(token_endpoint, baseUrl || issuer).href,
token_endpoint_auth_methods_supported: ['client_secret_post', 'none'],
grant_types_supported: ['authorization_code', 'refresh_token'],
scopes_supported: options.scopesSupported,
revocation_endpoint: revocation_endpoint ? new URL(revocation_endpoint, baseUrl || issuer).href : undefined,
revocation_endpoint_auth_methods_supported: revocation_endpoint ? ['client_secret_post'] : undefined,
registration_endpoint: registration_endpoint ? new URL(registration_endpoint, baseUrl || issuer).href : undefined
};
return metadata;
};
/**
* Installs standard MCP authorization server endpoints, including dynamic client registration and token revocation (if supported).
* Also advertises standard authorization server metadata, for easier discovery of supported configurations by clients.
* Note: if your MCP server is only a resource server and not an authorization server, use mcpAuthMetadataRouter instead.
*
* By default, rate limiting is applied to all endpoints to prevent abuse.
*
* This router MUST be installed at the application root, like so:
*
* const app = express();
* app.use(mcpAuthRouter(...));
*/
export function mcpAuthRouter(options) {
const oauthMetadata = createOAuthMetadata(options);
const router = express.Router();
router.use(new URL(oauthMetadata.authorization_endpoint).pathname, authorizationHandler({ provider: options.provider, ...options.authorizationOptions }));
router.use(new URL(oauthMetadata.token_endpoint).pathname, tokenHandler({ provider: options.provider, ...options.tokenOptions }));
router.use(mcpAuthMetadataRouter({
oauthMetadata,
// Prefer explicit RS; otherwise fall back to AS baseUrl, then to issuer (back-compat)
resourceServerUrl: options.resourceServerUrl ?? options.baseUrl ?? new URL(oauthMetadata.issuer),
serviceDocumentationUrl: options.serviceDocumentationUrl,
scopesSupported: options.scopesSupported,
resourceName: options.resourceName
}));
if (oauthMetadata.registration_endpoint) {
router.use(new URL(oauthMetadata.registration_endpoint).pathname, clientRegistrationHandler({
clientsStore: options.provider.clientsStore,
...options.clientRegistrationOptions
}));
}
if (oauthMetadata.revocation_endpoint) {
router.use(new URL(oauthMetadata.revocation_endpoint).pathname, revocationHandler({ provider: options.provider, ...options.revocationOptions }));
}
return router;
}
export function mcpAuthMetadataRouter(options) {
checkIssuerUrl(new URL(options.oauthMetadata.issuer));
const router = express.Router();
const protectedResourceMetadata = {
resource: options.resourceServerUrl.href,
authorization_servers: [options.oauthMetadata.issuer],
scopes_supported: options.scopesSupported,
resource_name: options.resourceName,
resource_documentation: options.serviceDocumentationUrl?.href
};
// Serve PRM at the path-specific URL per RFC 9728
const rsPath = new URL(options.resourceServerUrl.href).pathname;
router.use(`/.well-known/oauth-protected-resource${rsPath === '/' ? '' : rsPath}`, metadataHandler(protectedResourceMetadata));
// Always add this for OAuth Authorization Server metadata per RFC 8414
router.use('/.well-known/oauth-authorization-server', metadataHandler(options.oauthMetadata));
return router;
}
/**
* Helper function to construct the OAuth 2.0 Protected Resource Metadata URL
* from a given server URL. This replaces the path with the standard metadata endpoint.
*
* @param serverUrl - The base URL of the protected resource server
* @returns The URL for the OAuth protected resource metadata endpoint
*
* @example
* getOAuthProtectedResourceMetadataUrl(new URL('https://api.example.com/mcp'))
* // Returns: 'https://api.example.com/.well-known/oauth-protected-resource/mcp'
*/
export function getOAuthProtectedResourceMetadataUrl(serverUrl) {
const u = new URL(serverUrl.href);
const rsPath = u.pathname && u.pathname !== '/' ? u.pathname : '';
return new URL(`/.well-known/oauth-protected-resource${rsPath}`, u).href;
}
//# sourceMappingURL=router.js.map
@@ -0,0 +1,349 @@
/* eslint no-param-reassign: 0 -- stylistic choice */
import TokenTranslator from "./token-translator.js";
import { normalizeOptions } from "./options.js";
const STATE = Symbol("espree's internal state");
const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode");
/**
* Converts an Acorn comment to a Esprima comment.
* @param {boolean} block True if it's a block comment, false if not.
* @param {string} text The text of the comment.
* @param {int} start The index at which the comment starts.
* @param {int} end The index at which the comment ends.
* @param {Location} startLoc The location at which the comment starts.
* @param {Location} endLoc The location at which the comment ends.
* @param {string} code The source code being parsed.
* @returns {Object} The comment object.
* @private
*/
function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code) {
let type;
if (block) {
type = "Block";
} else if (code.slice(start, start + 2) === "#!") {
type = "Hashbang";
} else {
type = "Line";
}
const comment = {
type,
value: text
};
if (typeof start === "number") {
comment.start = start;
comment.end = end;
comment.range = [start, end];
}
if (typeof startLoc === "object") {
comment.loc = {
start: startLoc,
end: endLoc
};
}
return comment;
}
export default () => Parser => {
const tokTypes = Object.assign({}, Parser.acorn.tokTypes);
if (Parser.acornJsx) {
Object.assign(tokTypes, Parser.acornJsx.tokTypes);
}
return class Espree extends Parser {
constructor(opts, code) {
if (typeof opts !== "object" || opts === null) {
opts = {};
}
if (typeof code !== "string" && !(code instanceof String)) {
code = String(code);
}
// save original source type in case of commonjs
const originalSourceType = opts.sourceType;
const options = normalizeOptions(opts);
const ecmaFeatures = options.ecmaFeatures || {};
const tokenTranslator =
options.tokens === true
? new TokenTranslator(tokTypes, code)
: null;
/*
* Data that is unique to Espree and is not represented internally
* in Acorn.
*
* For ES2023 hashbangs, Espree will call `onComment()` during the
* constructor, so we must define state before having access to
* `this`.
*/
const state = {
originalSourceType: originalSourceType || options.sourceType,
tokens: tokenTranslator ? [] : null,
comments: options.comment === true ? [] : null,
impliedStrict: ecmaFeatures.impliedStrict === true && options.ecmaVersion >= 5,
ecmaVersion: options.ecmaVersion,
jsxAttrValueToken: false,
lastToken: null,
templateElements: []
};
// Initialize acorn parser.
super({
// do not use spread, because we don't want to pass any unknown options to acorn
ecmaVersion: options.ecmaVersion,
sourceType: options.sourceType,
ranges: options.ranges,
locations: options.locations,
allowReserved: options.allowReserved,
// Truthy value is true for backward compatibility.
allowReturnOutsideFunction: options.allowReturnOutsideFunction,
// Collect tokens
onToken(token) {
if (tokenTranslator) {
// Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.
tokenTranslator.onToken(token, state);
}
if (token.type !== tokTypes.eof) {
state.lastToken = token;
}
},
// Collect comments
onComment(block, text, start, end, startLoc, endLoc) {
if (state.comments) {
const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code);
state.comments.push(comment);
}
}
}, code);
/*
* We put all of this data into a symbol property as a way to avoid
* potential naming conflicts with future versions of Acorn.
*/
this[STATE] = state;
}
tokenize() {
do {
this.next();
} while (this.type !== tokTypes.eof);
// Consume the final eof token
this.next();
const extra = this[STATE];
const tokens = extra.tokens;
if (extra.comments) {
tokens.comments = extra.comments;
}
return tokens;
}
finishNode(...args) {
const result = super.finishNode(...args);
return this[ESPRIMA_FINISH_NODE](result);
}
finishNodeAt(...args) {
const result = super.finishNodeAt(...args);
return this[ESPRIMA_FINISH_NODE](result);
}
parse() {
const extra = this[STATE];
const program = super.parse();
program.sourceType = extra.originalSourceType;
if (extra.comments) {
program.comments = extra.comments;
}
if (extra.tokens) {
program.tokens = extra.tokens;
}
/*
* Adjust opening and closing position of program to match Esprima.
* Acorn always starts programs at range 0 whereas Esprima starts at the
* first AST node's start (the only real difference is when there's leading
* whitespace or leading comments). Acorn also counts trailing whitespace
* as part of the program whereas Esprima only counts up to the last token.
*/
if (program.body.length) {
const [firstNode] = program.body;
if (program.range) {
program.range[0] = firstNode.range[0];
}
if (program.loc) {
program.loc.start = firstNode.loc.start;
}
program.start = firstNode.start;
}
if (extra.lastToken) {
if (program.range) {
program.range[1] = extra.lastToken.range[1];
}
if (program.loc) {
program.loc.end = extra.lastToken.loc.end;
}
program.end = extra.lastToken.end;
}
/*
* https://github.com/eslint/espree/issues/349
* Ensure that template elements have correct range information.
* This is one location where Acorn produces a different value
* for its start and end properties vs. the values present in the
* range property. In order to avoid confusion, we set the start
* and end properties to the values that are present in range.
* This is done here, instead of in finishNode(), because Acorn
* uses the values of start and end internally while parsing, making
* it dangerous to change those values while parsing is ongoing.
* By waiting until the end of parsing, we can safely change these
* values without affect any other part of the process.
*/
this[STATE].templateElements.forEach(templateElement => {
const startOffset = -1;
const endOffset = templateElement.tail ? 1 : 2;
templateElement.start += startOffset;
templateElement.end += endOffset;
if (templateElement.range) {
templateElement.range[0] += startOffset;
templateElement.range[1] += endOffset;
}
if (templateElement.loc) {
templateElement.loc.start.column += startOffset;
templateElement.loc.end.column += endOffset;
}
});
return program;
}
parseTopLevel(node) {
if (this[STATE].impliedStrict) {
this.strict = true;
}
return super.parseTopLevel(node);
}
/**
* Overwrites the default raise method to throw Esprima-style errors.
* @param {int} pos The position of the error.
* @param {string} message The error message.
* @throws {SyntaxError} A syntax error.
* @returns {void}
*/
raise(pos, message) {
const loc = Parser.acorn.getLineInfo(this.input, pos);
const err = new SyntaxError(message);
err.index = pos;
err.lineNumber = loc.line;
err.column = loc.column + 1; // acorn uses 0-based columns
throw err;
}
/**
* Overwrites the default raise method to throw Esprima-style errors.
* @param {int} pos The position of the error.
* @param {string} message The error message.
* @throws {SyntaxError} A syntax error.
* @returns {void}
*/
raiseRecoverable(pos, message) {
this.raise(pos, message);
}
/**
* Overwrites the default unexpected method to throw Esprima-style errors.
* @param {int} pos The position of the error.
* @throws {SyntaxError} A syntax error.
* @returns {void}
*/
unexpected(pos) {
let message = "Unexpected token";
if (pos !== null && pos !== void 0) {
this.pos = pos;
if (this.options.locations) {
while (this.pos < this.lineStart) {
this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1;
--this.curLine;
}
}
this.nextToken();
}
if (this.end > this.start) {
message += ` ${this.input.slice(this.start, this.end)}`;
}
this.raise(this.start, message);
}
/*
* Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX
* uses regular tt.string without any distinction between this and regular JS
* strings. As such, we intercept an attempt to read a JSX string and set a flag
* on extra so that when tokens are converted, the next token will be switched
* to JSXText via onToken.
*/
jsx_readString(quote) { // eslint-disable-line camelcase -- required by API
const result = super.jsx_readString(quote);
if (this.type === tokTypes.string) {
this[STATE].jsxAttrValueToken = true;
}
return result;
}
/**
* Performs last-minute Esprima-specific compatibility checks and fixes.
* @param {ASTNode} result The node to check.
* @returns {ASTNode} The finished node.
*/
[ESPRIMA_FINISH_NODE](result) {
// Acorn doesn't count the opening and closing backticks as part of templates
// so we have to adjust ranges/locations appropriately.
if (result.type === "TemplateElement") {
// save template element references to fix start/end later
this[STATE].templateElements.push(result);
}
if (result.type.includes("Function") && !result.generator) {
result.generator = false;
}
return result;
}
};
};
@@ -0,0 +1,17 @@
'use strict';
var inspect = require('../');
var test = require('tape');
var globalThis = require('globalthis')();
test('global object', function (t) {
/* eslint-env browser */
var expected = typeof window === 'undefined' ? 'globalThis' : 'Window';
t.equal(
inspect([globalThis]),
'[ { [object ' + expected + '] } ]'
);
t.end();
});
@@ -0,0 +1,36 @@
import { collectMotionValues, motionValue } from './index.mjs';
import { subscribeValue } from './subscribe-value.mjs';
/**
* Create a `MotionValue` that transforms the output of other `MotionValue`s by
* passing their latest values through a transform function.
*
* Whenever a `MotionValue` referred to in the provided function is updated,
* it will be re-evaluated.
*
* ```jsx
* const x = motionValue(0)
* const y = transformValue(() => x.get() * 2) // double x
* ```
*
* @param transformer - A transform function. This function must be pure with no side-effects or conditional statements.
* @returns `MotionValue`
*
* @public
*/
function transformValue(transform) {
const collectedValues = [];
/**
* Open session of collectMotionValues. Any MotionValue that calls get()
* inside transform will be saved into this array.
*/
collectMotionValues.current = collectedValues;
const initialValue = transform();
collectMotionValues.current = undefined;
const value = motionValue(initialValue);
subscribeValue(collectedValues, value, transform);
return value;
}
export { transformValue };
//# sourceMappingURL=transform-value.mjs.map
@@ -0,0 +1,3 @@
#!/usr/bin/env node
import { crossEnv } from "../index.js";
crossEnv(process.argv.slice(2), { shell: true });
@@ -0,0 +1 @@
{"version":3,"file":"get-write-flag.js","sourceRoot":"","sources":["../../src/get-write-flag.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,uDAAuD;AACvD,wDAAwD;AACxD,wDAAwD;AACxD,qDAAqD;AACrD,uDAAuD;AACvD,8CAA8C;AAE9C,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,OAAO,CAAC,QAAQ,CAAA;AAClE,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAA;AAEtC,qBAAqB;AACrB,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,CAAA;AAC/D,MAAM,eAAe,GACnB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IAC1C,EAAE,CAAC,SAAS,CAAC,eAAe;IAC5B,CAAC,CAAA;AACH,oBAAoB;AAEpB,MAAM,WAAW,GAAG,SAAS,IAAI,CAAC,CAAC,eAAe,CAAA;AAClD,MAAM,SAAS,GAAG,GAAG,GAAG,IAAI,CAAA;AAC5B,MAAM,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAA;AAC/D,MAAM,YAAY,GAChB,CAAC,SAAS,IAAI,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC;IAC5C,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ;IAC3C,CAAC,CAAC,IAAI,CAAA;AACR,MAAM,CAAC,MAAM,YAAY,GACvB,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,YAAY;IAC1C,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG;QAC1B,CAAC,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA","sourcesContent":["// Get the appropriate flag to use for creating files\n// We use fmap on Windows platforms for files less than\n// 512kb. This is a fairly low limit, but avoids making\n// things slower in some cases. Since most of what this\n// library is used for is extracting tarballs of many\n// relatively small files in npm packages and the like,\n// it can be a big boost on Windows platforms.\n\nimport fs from 'fs'\n\nconst platform = process.env.__FAKE_PLATFORM__ || process.platform\nconst isWindows = platform === 'win32'\n\n/* c8 ignore start */\nconst { O_CREAT, O_NOFOLLOW, O_TRUNC, O_WRONLY } = fs.constants\nconst UV_FS_O_FILEMAP =\n Number(process.env.__FAKE_FS_O_FILENAME__) ||\n fs.constants.UV_FS_O_FILEMAP ||\n 0\n/* c8 ignore stop */\n\nconst fMapEnabled = isWindows && !!UV_FS_O_FILEMAP\nconst fMapLimit = 512 * 1024\nconst fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY\nconst noFollowFlag =\n !isWindows && typeof O_NOFOLLOW === 'number' ?\n O_NOFOLLOW | O_TRUNC | O_CREAT | O_WRONLY\n : null\nexport const getWriteFlag =\n noFollowFlag !== null ? () => noFollowFlag\n : !fMapEnabled ? () => 'w'\n : (size: number) => (size < fMapLimit ? fMapFlag : 'w')\n"]}
@@ -0,0 +1 @@
{"version":3,"file":"streamableHttp.js","sourceRoot":"","sources":["../../../src/client/streamableHttp.ts"],"names":[],"mappings":"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 truncated
@@ -0,0 +1,4 @@
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"dynamicDelete", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1 @@
{"version":3,"file":"indent-increase.js","sources":["../../../src/icons/indent-increase.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name IndentIncrease\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjEgMTJIMTEiIC8+CiAgPHBhdGggZD0iTTIxIDE4SDExIiAvPgogIDxwYXRoIGQ9Ik0yMSA2SDExIiAvPgogIDxwYXRoIGQ9Im0zIDggNCA0LTQgNCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/indent-increase\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 IndentIncrease = createLucideIcon('IndentIncrease', [\n ['path', { d: 'M21 12H11', key: 'wd7e0v' }],\n ['path', { d: 'M21 18H11', key: '4wu86t' }],\n ['path', { d: 'M21 6H11', key: '6dy1d6' }],\n ['path', { d: 'm3 8 4 4-4 4', key: '1a3j6y' }],\n]);\n\nexport default IndentIncrease;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,iBAAiB,gBAAkB,CAAA,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,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,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC/C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"use-reset-projection.mjs","sources":["../../../src/projection/use-reset-projection.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { rootProjectionNode } from \"motion-dom\"\n\nexport function useResetProjection() {\n const reset = useCallback(() => {\n const root = rootProjectionNode.current\n if (!root) return\n root.resetTree()\n }, [])\n\n return reset\n}\n"],"names":[],"mappings":";;;SAGgB,kBAAkB,GAAA;AAC9B,IAAA,MAAM,KAAK,GAAG,WAAW,CAAC,MAAK;AAC3B,QAAA,MAAM,IAAI,GAAG,kBAAkB,CAAC,OAAO;AACvC,QAAA,IAAI,CAAC,IAAI;YAAE;QACX,IAAI,CAAC,SAAS,EAAE;IACpB,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,KAAK;AAChB;;;;"}
@@ -0,0 +1 @@
{"version":3,"file":"lightbulb-off.js","sources":["../../../src/icons/lightbulb-off.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name LightbulbOff\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTYuOCAxMS4yYy44LS45IDEuMi0yIDEuMi0zLjJhNiA2IDAgMCAwLTkuMy01IiAvPgogIDxwYXRoIGQ9Im0yIDIgMjAgMjAiIC8+CiAgPHBhdGggZD0iTTYuMyA2LjNhNC42NyA0LjY3IDAgMCAwIDEuMiA1LjJjLjcuNyAxLjMgMS41IDEuNSAyLjUiIC8+CiAgPHBhdGggZD0iTTkgMThoNiIgLz4KICA8cGF0aCBkPSJNMTAgMjJoNCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/lightbulb-off\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst LightbulbOff = createLucideIcon('LightbulbOff', [\n ['path', { d: 'M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5', key: '1fkcox' }],\n ['path', { d: 'm2 2 20 20', key: '1ooewy' }],\n ['path', { d: 'M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5', key: '10m8kw' }],\n ['path', { d: 'M9 18h6', key: 'x1upvd' }],\n ['path', { d: 'M10 22h4', key: 'ceow96' }],\n]);\n\nexport default LightbulbOff;\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,CAAkD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAC/E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC3C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAyD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CACtF,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,79 @@
"use strict";
// zod-json-schema-compat.ts
// ----------------------------------------------------
// JSON Schema conversion for both Zod v3 and Zod v4 (Mini)
// v3 uses your vendored converter; v4 uses Mini's toJSONSchema
// ----------------------------------------------------
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.toJsonSchemaCompat = toJsonSchemaCompat;
exports.getMethodLiteral = getMethodLiteral;
exports.parseWithCompat = parseWithCompat;
const z4mini = __importStar(require("zod/v4-mini"));
const zod_compat_js_1 = require("./zod-compat.js");
const zod_to_json_schema_1 = require("zod-to-json-schema");
function mapMiniTarget(t) {
if (!t)
return 'draft-7';
if (t === 'jsonSchema7' || t === 'draft-7')
return 'draft-7';
if (t === 'jsonSchema2019-09' || t === 'draft-2020-12')
return 'draft-2020-12';
return 'draft-7'; // fallback
}
function toJsonSchemaCompat(schema, opts) {
if ((0, zod_compat_js_1.isZ4Schema)(schema)) {
// v4 branch — use Mini's built-in toJSONSchema
return z4mini.toJSONSchema(schema, {
target: mapMiniTarget(opts?.target),
io: opts?.pipeStrategy ?? 'input'
});
}
// v3 branch — use vendored converter
return (0, zod_to_json_schema_1.zodToJsonSchema)(schema, {
strictUnions: opts?.strictUnions ?? true,
pipeStrategy: opts?.pipeStrategy ?? 'input'
});
}
function getMethodLiteral(schema) {
const shape = (0, zod_compat_js_1.getObjectShape)(schema);
const methodSchema = shape?.method;
if (!methodSchema) {
throw new Error('Schema is missing a method literal');
}
const value = (0, zod_compat_js_1.getLiteralValue)(methodSchema);
if (typeof value !== 'string') {
throw new Error('Schema method literal must be a string');
}
return value;
}
function parseWithCompat(schema, data) {
const result = (0, zod_compat_js_1.safeParse)(schema, data);
if (!result.success) {
throw result.error;
}
return result.data;
}
//# sourceMappingURL=zod-json-schema-compat.js.map
@@ -0,0 +1 @@
module.exports={C:{"112":0.01061,"120":0.13083,"121":0.26697,"147":0.00354,"154":0.17857,"155":0.33592,"156":0.1379,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 113 114 115 116 117 118 119 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 148 149 150 151 152 153 157 158 159 160 3.5","3.6":0.00354},D:{"66":0.00707,"68":0.00354,"81":0.01945,"88":0.01945,"98":0.01238,"103":0.01238,"104":0.01238,"105":0.01238,"106":0.01945,"107":0.00707,"108":0.04597,"109":0.07602,"110":0.02652,"111":0.01591,"112":0.01945,"114":0.00707,"116":0.03006,"117":0.01945,"118":0.52686,"119":0.27581,"120":0.31647,"122":0.00354,"123":0.00354,"124":0.01591,"128":0.00707,"131":0.03536,"132":0.01238,"133":0.07956,"134":0.06188,"135":0.06188,"136":0.03006,"137":0.05658,"138":0.09901,"139":0.31647,"140":0.03536,"141":0.05304,"142":0.14144,"143":0.01238,"144":0.06011,"145":0.01238,"146":0.05304,"148":0.10785,"149":0.14144,"150":0.29879,"151":1.03074,"152":2.82173,"153":1.81043,"154":0.42078,"155":0.00354,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 67 69 70 71 72 73 74 75 76 77 78 79 80 83 84 85 86 87 89 90 91 92 93 94 95 96 97 99 100 101 102 113 115 121 125 126 127 129 130 147 156 157"},F:{"85":0.00354,"101":0.01238,"102":0.00707,"120":0.00354,"123":0.00354,"131":0.00707,"132":0.00354,"133":0.02298,"134":0.02298,"135":0.32531,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 121 122 124 125 126 127 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"16":0.05304,"18":0.00707,"89":0.00707,"90":0.00707,"92":0.05658,"109":0.05304,"119":0.14851,"120":0.11492,"127":0.00354,"138":0.00354,"140":0.00354,"143":0.00354,"147":0.00354,"148":0.00707,"149":0.01945,"150":0.01061,"151":0.12199,"152":0.62587,"153":0.82212,"154":0.18741,_:"12 13 14 15 17 79 80 81 83 84 85 86 87 88 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 121 122 123 124 125 126 128 129 130 131 132 133 134 135 136 137 139 141 142 144 145 146"},E:{"4":0.00354,_:"5 6 7 8 9 10 11 12 13 14 15 27 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 15.2-15.3 15.4 15.5 16.0 16.2 16.3 16.4 16.5 16.6 17.0 17.2 17.3 17.4 17.5 18.0 18.1 18.2 18.3 18.4 18.5-18.7 26.0 26.1 26.2 26.4 27.1 27.2 TP","15.6":0.03359,"16.1":0.01945,"17.1":0.01238,"17.6":0.01945,"26.3":0.01061,"26.5":0.00354,"26.6":0.19802},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00038,"5.0-5.1":0.00038,"6.0-6.1":0,"7.0-7.1":0.00075,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00376,"11.0-11.2":0.00038,"11.3-11.4":0.00075,"12.0-12.1":0,"12.2-12.5":0.00978,"13.0-13.1":0,"13.2":0.00188,"13.3":0,"13.4-13.7":0.00038,"14.0-14.4":0.0015,"14.5-14.8":0.00226,"15.0-15.1":0.00226,"15.2-15.3":0.0015,"15.4":0.00188,"15.5":0.00226,"15.6-15.8":0.0489,"16.0":0.00376,"16.1":0.00677,"16.2":0.00376,"16.3":0.00828,"16.4":0.00188,"16.5":0.00301,"16.6-16.7":0.06808,"17.0":0.00263,"17.1":0.00376,"17.2":0.00376,"17.3":0.00564,"17.4":0.0079,"17.5":0.01542,"17.6-17.7":0.03987,"18.0":0.00828,"18.1":0.01655,"18.2":0.02257,"18.3":0.03912,"18.4":0.02445,"18.5-18.7":0.50518,"26.0":0.02445,"26.1":0.02483,"26.2":0.0647,"26.3":0.06997,"26.4":0.05116,"26.5":0.34268,"26.6":2.11438,"27.0":0.16212,"27.1":0,"27.2":0.00414},P:{"22":0.00983,"24":0.07862,"25":0.02948,"26":0.03931,"27":0.08845,"28":0.32433,"29":0.09828,"30":0.54054,_:"4 20 21 23 5.0-5.4 6.2-6.4 8.2 9.2 10.1 12.0 13.0 14.0 15.0 16.0 17.0 18.0","7.2-7.4":0.0688,"11.1-11.2":0.00983,"19.0":0.02948},I:{"0":0.01645,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.62556,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},L:{"0":80.13516},R:{_:"0"},M:{"0":0.32101},Q:{_:"14.9"},O:{"0":0.14816},H:{all:0}};
@@ -0,0 +1,16 @@
export declare class StringWriter {
pos: number;
private out;
private buffer;
write(v: number): void;
flush(): string;
}
export declare class StringReader {
pos: number;
private buffer;
constructor(buffer: string);
next(): number;
peek(): number;
indexOf(char: string): number;
}
//# sourceMappingURL=strings.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"pilcrow-left.js","sources":["../../../src/icons/pilcrow-left.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name PilcrowLeft\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTQgM3YxMSIgLz4KICA8cGF0aCBkPSJNMTQgOWgtM2EzIDMgMCAwIDEgMC02aDkiIC8+CiAgPHBhdGggZD0iTTE4IDN2MTEiIC8+CiAgPHBhdGggZD0iTTIyIDE4SDJsNC00IiAvPgogIDxwYXRoIGQ9Im02IDIyLTQtNCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/pilcrow-left\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 PilcrowLeft = createLucideIcon('PilcrowLeft', [\n ['path', { d: 'M14 3v11', key: 'mlfb7b' }],\n ['path', { d: 'M14 9h-3a3 3 0 0 1 0-6h9', key: '1ulc19' }],\n ['path', { d: 'M18 3v11', key: '1phi0r' }],\n ['path', { d: 'M22 18H2l4-4', key: 'yt65j9' }],\n ['path', { d: 'm6 22-4-4', key: '6jgyf5' }],\n]);\n\nexport default PilcrowLeft;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAAA,CAClD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgB,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,CAC7C,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;AAC5C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,21 @@
import type {KeywordCxt} from "../../compile/validate"
import {_, not, nil, Code, Name} from "../../compile/codegen"
export function checkNullable(
{gen, data, parentSchema}: KeywordCxt,
cond: Code = nil
): [Name, Code] {
const valid = gen.name("valid")
if (parentSchema.nullable) {
gen.let(valid, _`${data} === null`)
cond = not(valid)
} else {
gen.let(valid, false)
}
return [valid, cond]
}
export function checkNullableObject(cxt: KeywordCxt, cond: Code): [Name, Code] {
const [valid, cond_] = checkNullable(cxt, cond)
return [valid, _`${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`]
}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"2":"_J"},C:{"2":"_S"},D:{"2":"_5F","33":"_8H"},E:{"2":"_e","33":"_DB"},F:{"2":"_0B sB _NG _O","33":"_dF"},G:{"33":"_M"},H:{"2":"1D"},I:{"2":"I","33":"_G"},J:{"33":"_B"},K:{"2":"_N"},L:{"2":"I"},M:{"2":"YC"},N:{"2":"_A"},O:{"2":"bC"},P:{"2":"_U","33":"J"},Q:{"2":"JE"},R:{"2":"KE"},S:{"2":"_C"}},B:7,C:"CSS Canvas Drawings",D:true};
@@ -0,0 +1,42 @@
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { expect, test } from "vitest";
import { z } from "../../../../index.js";
// Every locale must carry an entry for each key `en` translates. Four keys have drifted this way already — `credit_card` (#5931), `mac` (#5440), `Sizable.map` (#5316) and Hebrew's `uuidv4`/`uuidv6`/`template_literal` — each shipped in `en` and left the rest behind, so the gap only surfaced as a raw key in a user's error message.
//
// The key lists are read out of `en.ts` rather than hardcoded, so adding a format to `en` extends this test automatically. That is the whole point: a hand-maintained list here would miss the next one exactly the way the last four were missed.
const enSource = readFileSync(fileURLToPath(new URL("../../../locales/en.ts", import.meta.url)), "utf8");
function keysOf(block: string): string[] {
const body = enSource.match(new RegExp(`const ${block}[^=]*= \\{([\\s\\S]*?)\\n \\};`))?.[1];
if (!body) throw new Error(`could not read ${block} out of en.ts`);
return [...body.matchAll(/^\s{4}([a-z_0-9]+):/gm)].map((m) => m[1]!);
}
const locales = z.locales as unknown as Record<string, () => { localeError: z.core.$ZodErrorMap }>;
const names = Object.keys(locales).filter((k) => typeof locales[k] === "function");
const SENTINEL = "zzsentinelzz";
/** True when the locale has no entry for `key`: the message is what the sentinel produces. */
function fallsThrough(locale: string, key: string, build: (k: string) => unknown): boolean {
const map = locales[locale]!().localeError as (iss: unknown) => string | undefined;
const real = String(map(build(key)) ?? "");
const sentinel = String(map(build(SENTINEL)) ?? "");
return real === sentinel.split(SENTINEL).join(key);
}
const asFormat = (k: string) => ({ code: "invalid_format", format: k, input: "x", path: [] });
const asSize = (k: string) => ({ code: "too_small", origin: k, minimum: 2, inclusive: true, input: null, path: [] });
test.each([
["FormatDictionary", keysOf("FormatDictionary"), asFormat],
["Sizable", keysOf("Sizable"), asSize],
] as const)("every locale translates each %s key that en translates", (_block, keys, build) => {
// A key `en` maps to its own name (emoji, nanoid, cuid, cuid2) renders identically whether or not a locale defines it, so omitting it is not drift.
const required = keys.filter((k) => !fallsThrough("en", k, build));
const gaps = required.flatMap((k) => names.filter((n) => fallsThrough(n, k, build)).map((n) => `${n}.${k}`));
expect(gaps).toEqual([]);
});
@@ -0,0 +1,91 @@
'use strict';
var feedback$8 = require('./matcher/bruteforce/feedback.cjs');
var feedback$7 = require('./matcher/date/feedback.cjs');
var feedback$6 = require('./matcher/dictionary/feedback.cjs');
var feedback$5 = require('./matcher/regex/feedback.cjs');
var feedback$4 = require('./matcher/repeat/feedback.cjs');
var feedback$3 = require('./matcher/sequence/feedback.cjs');
var feedback$2 = require('./matcher/spatial/feedback.cjs');
var feedback$1 = require('./matcher/separator/feedback.cjs');
var feedback = require('./matcher/wordSequence/feedback.cjs');
const defaultFeedback = {
warning: null,
suggestions: []
};
/*
* -------------------------------------------------------------------------------
* Generate feedback ---------------------------------------------------------------
* -------------------------------------------------------------------------------
*/
class Feedback {
constructor(options) {
this.options = options;
this.matchers = {};
this.defaultFeedback = {
warning: null,
suggestions: []
};
this.setDefaultSuggestions();
this.matchers = {
bruteforce: feedback$8,
date: feedback$7,
dictionary: feedback$6,
regex: feedback$5,
repeat: feedback$4,
sequence: feedback$3,
spatial: feedback$2,
separator: feedback$1,
wordSequence: feedback
};
Object.entries(this.options.matchers).forEach(([key, matcher]) => {
if (matcher.feedback) {
this.matchers[key] = matcher.feedback;
}
});
}
setDefaultSuggestions() {
this.defaultFeedback.suggestions.push(this.options.translations.suggestions.useWords, this.options.translations.suggestions.noNeed);
}
getFeedback(score, sequence) {
if (sequence.length === 0) {
return this.defaultFeedback;
}
if (score > 2) {
return defaultFeedback;
}
const extraFeedback = this.options.translations.suggestions.anotherWord;
const longestMatch = this.getLongestMatch(sequence);
let feedback = this.getMatchFeedback(longestMatch, sequence.length === 1);
if (feedback !== null && feedback !== undefined) {
feedback.suggestions.unshift(extraFeedback);
} else {
feedback = {
warning: null,
suggestions: [extraFeedback]
};
}
return feedback;
}
getLongestMatch(sequence) {
let longestMatch = sequence[0];
// ignore first entry
for (let i = 1; i < sequence.length; i += 1) {
const match = sequence[i];
if (match.token.length > longestMatch.token.length) {
longestMatch = match;
}
}
return longestMatch;
}
getMatchFeedback(match, isSoleMatch) {
if (this.matchers[match.pattern]) {
return this.matchers[match.pattern](this.options, match, isSoleMatch);
}
return defaultFeedback;
}
}
module.exports = Feedback;
//# sourceMappingURL=Feedback.cjs.map
@@ -0,0 +1,11 @@
import { a as absFloor } from "./absFloor-BlD_nfEw.mjs";
import { c as MS_IN_SECOND } from "./constants-BuFquuHl.mjs";
import parse from "./parse.mjs";
function diffInSeconds(date, input, asFloat) {
const parsed = parse(input);
const output = (+date - +parsed) / MS_IN_SECOND;
return asFloat ? output : absFloor(output);
}
export {
diffInSeconds as default
};
@@ -0,0 +1,6 @@
(function(f){function e(){var i=f();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.meriyah=e()}})(function(){"use strict";var Xe=Object.defineProperty;var J2=Object.getOwnPropertyDescriptor;var j2=Object.getOwnPropertyNames;var X2=Object.prototype.hasOwnProperty;var kt=(e,t)=>{for(var n in t)Xe(e,n,{get:t[n],enumerable:!0})},H2=(e,t,n,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of j2(t))!X2.call(e,o)&&o!==n&&Xe(e,o,{get:()=>t[o],enumerable:!(u=J2(t,o))||u.enumerable});return e};var W2=e=>H2(Xe({},"__esModule",{value:!0}),e);var mi={};kt(mi,{parsers:()=>ht});var ht={};kt(ht,{meriyah:()=>gi});var z2=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),ae=z2;var Z=(e,t)=>(n,u,...o)=>n|1&&u==null?void 0:(t.call(u)??u[e]).apply(u,o);var K2=String.prototype.replaceAll??function(e,t){return e.global?this.replace(e,t):this.split(e).join(t)},$2=Z("replaceAll",function(){if(typeof this=="string")return K2}),$=$2;var Y2=55296,Q2=56319,Z2=56320,G2=String.prototype.isWellFormed??function(){let{length:e}=this;for(let t=0;t<e;t++){let n=this.charCodeAt(t);if((n&64512)===Y2&&(n>Q2||++t>=e||(this.charCodeAt(t)&64512)!==Z2))return!1}return!0},x2=Z("isWellFormed",function(){if(typeof this=="string")return G2}),yt=x2;var St=((e,t)=>{let n=new Uint32Array(69632),u=0,o=0;for(;u<2597;){let i=e[u++];if(i<0)o-=i;else{let l=e[u++];i&2&&(l=t[l]),i&1?n.fill(l,o,o+=e[u++]):n[o++]=l}}return n})([-1,2,26,2,27,2,5,-1,0,77595648,3,44,2,3,0,14,2,61,2,62,3,0,3,0,3168796671,0,4294956992,2,1,2,0,2,41,3,0,4,0,4294966523,3,0,4,2,16,2,63,2,0,0,4294836735,0,3221225471,0,4294901942,2,64,0,134152192,3,0,2,0,4294951935,3,0,2,0,2683305983,0,2684354047,2,17,2,0,0,4294961151,3,0,2,2,19,2,0,0,608174079,2,0,2,58,2,7,2,6,0,4286643967,3,0,2,2,1,3,0,3,0,4294901711,2,40,0,4089839103,0,2961209759,0,1342439375,0,4294543342,0,3547201023,0,1577204103,0,4194240,0,4294688750,2,2,0,80831,0,4261478351,0,4294549486,2,2,0,2967484831,0,196559,0,3594373100,0,3288319768,0,8469959,0,65472,2,3,0,4093640191,0,929054175,0,65487,0,4294828015,0,4092591615,0,1885355487,0,982991,2,3,2,0,0,2163244511,0,4227923919,0,4236247022,2,69,0,4284449919,0,851904,2,4,2,12,0,67076095,-1,2,70,0,1073741743,0,4093607775,-1,0,50331649,0,3265266687,2,33,0,4294844415,0,4278190047,2,20,2,137,-1,3,0,2,2,23,2,0,2,9,2,0,2,15,2,22,3,0,10,2,72,2,0,2,73,2,74,2,75,2,0,2,76,2,0,2,11,0,261632,2,25,3,0,2,2,13,2,4,3,0,18,2,77,2,5,3,0,2,2,78,0,2151677951,2,29,2,10,0,909311,3,0,2,0,814743551,2,48,0,67090432,3,0,2,2,42,2,0,2,6,2,0,2,30,2,8,0,268374015,2,108,2,51,2,0,2,79,0,134153215,-1,2,7,2,0,2,8,0,2684354559,0,67044351,0,3221160064,2,9,2,18,3,0,2,2,53,0,1046528,3,0,3,2,10,2,0,2,127,0,4294960127,2,9,2,6,2,11,0,4294377472,2,12,3,0,16,2,13,2,0,2,80,2,9,2,0,2,81,2,82,2,83,0,12288,2,54,0,1048577,2,84,2,14,-1,2,14,0,131042,2,85,2,86,2,87,2,0,2,34,-83,3,0,7,0,1046559,2,0,2,15,2,0,0,2147516671,2,21,3,88,2,2,0,-16,2,89,0,524222462,2,4,2,0,0,4269801471,2,4,3,0,2,2,28,2,16,3,0,2,2,49,2,0,-1,2,17,-16,3,0,206,-2,3,0,692,2,71,-1,2,17,2,9,3,0,8,2,91,2,18,2,0,0,3220242431,3,0,3,2,19,2,92,2,93,3,0,2,2,94,2,0,2,20,2,95,2,0,0,4351,2,0,2,10,3,0,2,0,67043391,0,3909091327,2,0,2,24,2,10,2,20,3,0,2,0,67076097,2,8,2,0,2,21,0,67059711,0,4236247039,3,0,2,0,939524103,0,8191999,2,99,2,100,2,22,2,23,3,0,3,0,67057663,3,0,349,2,101,2,102,2,7,-264,3,0,11,2,24,3,0,2,2,32,-1,0,3774349439,2,103,2,104,3,0,2,2,19,2,105,3,0,10,2,9,2,17,2,0,2,46,2,0,2,31,2,106,2,25,0,1638399,0,57344,2,107,3,0,3,2,20,2,26,2,27,2,5,2,28,2,0,2,8,2,109,-1,2,110,2,111,2,112,-1,3,0,3,2,12,-2,2,0,2,29,-3,0,536870912,-4,2,20,2,0,2,36,0,1,2,0,2,65,2,6,2,12,2,9,2,0,2,113,-1,3,0,4,2,9,2,23,2,114,2,7,2,0,2,115,2,0,2,116,2,117,2,118,2,0,2,10,3,0,9,2,21,2,30,2,31,2,119,2,120,-2,2,121,2,122,2,30,2,21,2,8,-2,2,123,2,30,3,32,2,-1,2,0,2,39,-2,0,4277137519,0,2269118463,-1,3,20,2,-1,2,33,2,38,2,0,3,30,2,2,35,2,19,-3,3,0,2,2,34,-1,2,0,2,35,2,0,2,35,2,0,2,47,2,0,0,4294950463,2,37,-7,2,0,0,203775,2,125,0,4227858432,2,20,2,43,2,36,2,17,2,37,2,17,2,124,2,21,3,0,2,2,38,0,2151677888,2,0,2,12,0,4294901764,2,145,2,0,2,56,2,55,0,5242879,3,0,2,0,402644511,-1,2,128,2,39,0,3,-1,2,129,2,130,2,0,0,67045375,2,40,0,4226678271,0,3766565279,0,2039759,2,132,2,41,0,1046437,0,6,3,0,2,0,3288270847,0,3,3,0,2,0,67043519,-5,2,0,0,4282384383,0,1056964609,-1,3,0,2,0,67043345,-1,2,0,2,42,2,23,2,50,2,11,2,59,2,38,-5,2,0,2,12,-3,3,0,2,0,2147484671,2,133,0,4190109695,2,52,-2,2,134,0,4244635647,0,27,2,0,2,8,2,43,2,0,2,66,2,17,2,0,2,42,-3,2,31,-2,2,0,2,45,2,57,2,44,2,45,2,135,2,46,0,8388351,-2,2,136,0,3028287487,2,47,2,138,0,33259519,2,23,2,7,2,48,-7,2,21,0,4294836223,0,3355443199,0,134152199,-2,2,67,-2,3,0,28,2,32,-3,3,0,3,2,49,3,0,6,2,50,-81,2,17,3,0,2,2,36,3,0,33,2,25,2,30,3,0,124,2,12,3,0,18,2,38,-213,2,0,2,32,-54,3,0,17Line truncated
`))return[];let t=[];for(let n of`*${e.value}*`.split(`
`)){if(n=n.trimStart(),!n.startsWith("*"))return[];t.push(n)}return t}var h2=new WeakMap;function Ku(e){return se(h2,e,zu)}function k2(e){h2.delete(e)}function gt(e){return Ku(e).length>0}function y2(e){if(e.length<2)return;let t;for(let n=e.length-1;n>=0;n--){let u=e[n];if(t&&V(u)===R(t)&&gt(u)&&gt(t)&&(e.splice(n+1,1),u.value+="*//*"+t.value,u.range=[R(u),V(t)],k2(u)),!a2(u)&&!ce(u))throw new TypeError(`Unknown comment type: "${u.type}".`);t=u}}function $u(e){return e!==null&&typeof e=="object"}var A2=$u;var be=null;function De(e){if(be!==null&&typeof be.property){let t=be;return be=De.prototype=null,t}return be=De.prototype=e??Object.create(null),new De}var Yu=10;for(let e=0;e<=Yu;e++)De();function mt(e){return De(e)}function Qu(e,t="type"){mt(e);function n(u){let o=u[t],i=e[o];if(!Array.isArray(i))throw Object.assign(new Error(`Missing visitor keys for '${o}'.`),{node:u});return i}return n}var T2=Qu;var g=[["elements"],["left","right"],["value"],["directives","body"],["label"],["callee","typeArguments","arguments"],["test","consequent","alternate"],["body","test"],["expression"],["left","right","body"],["id","typeParameters","params","predicate","returnType","body"],["object","property"],["properties"],["decorators","key","typeParameters","params","returnType","body"],["decorators","key","value"],["argument"],["expressions"],["id","init"],["body"],["decorators","id","typeParameters","superClass","superTypeArguments","mixins","implements","body"],["declaration","specifiers","source","attributes"],["local"],["exported"],["decorators","variance","key","typeAnnotation","value"],["id"],["key","value"],["elementType"],["id","typeParameters"],["id","typeParameters","extends","body"],["id","body"],["typeAnnotation"],["id","typeParameters","right"],["name","typeAnnotation"],["types"],["qualification","id"],["elementTypes"],["expression","typeAnnotation"],["params"],["members"],["objectType","indexType"],["decorators","key","typeAnnotation","value"],["id","typeParameters","params","returnType","body"],["key","typeParameters","params","returnType"],["typeParameters","params","returnType"],["parameterName","typeAnnotation"],["checkType","extendsType","trueType","falseType"],["typeParameter"],["literal"],["expression","typeArguments"],["decorators","key","typeAnnotation"],["argument","cases"],["pattern","body","guard"],["properties","rest"],["node"]],b2={ArrayExpression:g[0],AssignmentExpression:g[1],BinaryExpression:g[1],InterpreterDirective:[],Directive:g[2],DirectiveLiteral:[],BlockStatement:g[3],BreakStatement:g[4],CallExpression:g[5],CatchClause:["param","body"],ConditionalExpression:g[6],ContinueStatement:g[4],DebuggerStatement:[],DoWhileStatement:g[7],EmptyStatement:[],ExpressionStatement:g[8],File:["program"],ForInStatement:g[9],ForStatement:["init","test","update","body"],FunctionDeclaration:g[10],FunctionExpression:g[10],Identifier:["typeAnnotation","decorators"],IfStatement:g[6],LabeledStatement:["label","body"],StringLiteral:[],NumericLiteral:[],NullLiteral:[],BooleanLiteral:[],RegExpLiteral:[],LogicalExpression:g[1],MemberExpression:g[11],NewExpression:g[5],Program:g[3],ObjectExpression:g[12],ObjectMethod:g[13],ObjectProperty:g[14],RestElement:["argument","typeAnnotation","decorators"],ReturnStatement:g[15],SequenceExpression:g[16],ParenthesizedExpression:g[8],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],ThisExpression:[],ThrowStatement:g[15],TryStatement:["block","handler","finalizer"],UnaryExpression:g[15],UpdateExpression:g[15],VariableDeclaration:["declarations"],VariableDeclarator:g[17],WhileStatement:g[7],WithStatement:["object","body"],AssignmentPattern:["left","right","decorators","typeAnnotation"],ArrayPattern:["elements","typeAnnotation","decorators"],ArrowFunctionExpression:["typeParameters","params","predicate","returnType","body"],ClassBody:g[18],ClassExpression:g[19],ClassDeclaration:g[19],ExportAllDeclaration:["source","attributes","exported"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:g[20],ExportSpecifier:["local","exported"],ForOfStatement:g[9],ImportDeclaration:["specifiers","source","attributes"],ImportDefaultSpecifier:g[21],ImportNamespaceSpecifier:g[21],ImportSpecifier:["imported","local"],MetaProperty:["meta","property"],ClassMethod:g[13],ObjectPattern:["decorators","properties","typeAnnotation"],SpreadElement:g[15],Super:[],TaggedTemplateExpression:["tag","typeArguments","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],YieldExpression:g[15],AwaitExpression:g[15],ImportExpression:["source","options"],BigIntLiteral:[],ExportNamespaceSpecifier:g[22],OptionalMemberExpression:g[11],OptionalCallExpression:g[5],ClassProperty:g[23],ClassPrivateProperty:g[23],ClassPrivateMethod:g[13],PrivateName:g[24],StaticBlock:g[18],ImportAttribute:g[25],AnyTypeAnnotation:[],ArrayTypeAnnotation:g[26],BooleanTypeAnnotation:[],BooleanLiteralTypeAnnotation:[],NullLiteralTypeAnnotation:[],ClassImplements:g[27],DeclareClass:["id","typePaLine truncated
$1 $2
`);e=e.replace(S2,"").trimEnd();let u=Object.create(null),o=$(0,e,B2,"").replace(S2,"").trimEnd(),i;for(;i=B2.exec(e);){let l=$(0,i[2],ni,"");if(typeof u[i[1]]=="string"||Array.isArray(u[i[1]])){let f=u[i[1]];u[i[1]]=[...oi,...Array.isArray(f)?f:[f],l]}else u[i[1]]=l}return{comments:o,pragmas:u}}var I2=["noformat","noprettier"],L2=["format","prettier"];function li(e){if(!e.startsWith("#!"))return"";let t=e.indexOf(`
`);return t===-1?e:e.slice(0,t)}var q2=li;function P2(e){let t=q2(e);t&&(e=e.slice(t.length+1));let n=F2(e),{pragmas:u,comments:o}=N2(n);return{shebang:t,text:e,pragmas:u,comments:o}}function O2(e){let{pragmas:t}=P2(e);return L2.some(n=>ae(t,n))}function R2(e){let{pragmas:t}=P2(e);return I2.some(n=>ae(t,n))}function fi(e){return e=typeof e=="function"?{parse:e}:e,{astFormat:"estree",hasPragma:O2,hasIgnorePragma:R2,locStart:R,locEnd:V,...e}}var V2=fi;var M2="module",v2="commonjs",U2=[M2,v2];function _2(e){if(typeof e=="string"){if(e=e.toLowerCase(),/\.(?:mjs|mts)$/i.test(e))return M2;if(/\.(?:cjs|cts)$/i.test(e))return v2}}var ci={next:!0,ranges:!0,webcompat:!0,loc:!1,raw:!0,directives:!0,impliedStrict:!1,preserveParens:!0,lexical:!1,jsx:!0,validateRegex:!1};function si(e,t){let n=[],u=i2(e,{...ci,sourceType:t,onComment:n});return u.comments=n,u}function di(e){let{description:t,loc:n}=e;return n?o2(t,{loc:{start:{line:n.start.line,column:n.start.column+1},end:{line:n.end.line,column:n.end.column+1}},cause:e}):e}function ai(e,t){let n=_2(t?.filepath),u=(n?[n]:U2).map(i=>()=>si(e,i)),o;try{o=l2(u)}catch({errors:[i]}){throw di(i)}return w2(o,{text:e,astType:"meriyah"})}var gi=V2(ai);return W2(mi);});
@@ -0,0 +1,115 @@
/* c8 ignore start */
import type { Handler } from "gensync";
import type {
ConfigFile,
IgnoreFile,
RelativeConfig,
FilePackageData,
} from "./types.ts";
import type { CallerMetadata } from "../validation/options.ts";
export type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData };
export function findConfigUpwards(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
rootDir: string,
): string | null {
return null;
}
// eslint-disable-next-line require-yield
export function* findPackageData(filepath: string): Handler<FilePackageData> {
return {
filepath,
directories: [],
pkg: null,
isPackage: false,
};
}
// eslint-disable-next-line require-yield
export function* findRelativeConfig(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
pkgData: FilePackageData,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
envName: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
caller: CallerMetadata | undefined,
): Handler<RelativeConfig> {
return { config: null, ignore: null };
}
// eslint-disable-next-line require-yield
export function* findRootConfig(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
dirname: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
envName: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
caller: CallerMetadata | undefined,
): Handler<ConfigFile | null> {
return null;
}
// eslint-disable-next-line require-yield
export function* loadConfig(
name: string,
dirname: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
envName: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
caller: CallerMetadata | undefined,
): Handler<ConfigFile> {
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
}
// eslint-disable-next-line require-yield
export function* resolveShowConfigPath(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
dirname: string,
): Handler<string | null> {
return null;
}
export const ROOT_CONFIG_FILENAMES: string[] = [];
type Resolved =
| { loader: "require"; filepath: string }
| { loader: "import"; filepath: string };
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function resolvePlugin(name: string, dirname: string): Resolved | null {
return null;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function resolvePreset(name: string, dirname: string): Resolved | null {
return null;
}
export function loadPlugin(
name: string,
dirname: string,
): Handler<{
filepath: string;
value: unknown;
}> {
throw new Error(
`Cannot load plugin ${name} relative to ${dirname} in a browser`,
);
}
export function loadPreset(
name: string,
dirname: string,
): Handler<{
filepath: string;
value: unknown;
}> {
throw new Error(
`Cannot load preset ${name} relative to ${dirname} in a browser`,
);
}