WIP: bootstrap and partial real Solana watcher implementation
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
export { CharacterCodes } from "#enums/characterCodes";
|
||||
export { CommentDirectiveType } from "#enums/commentDirectiveType";
|
||||
export { InternalSymbolName } from "#enums/internalSymbolName";
|
||||
export { LanguageVariant } from "#enums/languageVariant";
|
||||
export { ModifierFlags } from "#enums/modifierFlags";
|
||||
export { NodeFlags } from "#enums/nodeFlags";
|
||||
export { RegularExpressionFlags } from "#enums/regularExpressionFlags";
|
||||
export { ScriptKind } from "#enums/scriptKind";
|
||||
export { ScriptTarget } from "#enums/scriptTarget";
|
||||
export { SyntaxKind } from "#enums/syntaxKind";
|
||||
export { TokenFlags } from "#enums/tokenFlags";
|
||||
export * from "./ast.js";
|
||||
export * from "./astnav.js";
|
||||
export * from "./clone.js";
|
||||
export * from "./is.js";
|
||||
export * from "./jsdoc.js";
|
||||
export * from "./scanner.js";
|
||||
export * from "./utils.js";
|
||||
export * from "./visitor.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from './applyDefault';
|
||||
export * from './deepMerge';
|
||||
export * from './getParserServices';
|
||||
export * from './InferTypesFromRule';
|
||||
export * from './nullThrows';
|
||||
export * from './RuleCreator';
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"main": "../../cjs/_apply_decs_2311.cjs",
|
||||
"module": "../../esm/_apply_decs_2311.js"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 typescript-eslint and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,4 @@
|
||||
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"unnecessaryQualifier", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
export default _default;
|
||||
@@ -0,0 +1,99 @@
|
||||
import { ChildProcess, SpawnOptions, SpawnSyncOptions } from "node:child_process";
|
||||
import { Readable } from "node:stream";
|
||||
//#region src/normalize.d.ts
|
||||
interface NormalizedSpawnCommand {
|
||||
command: string;
|
||||
args: readonly string[];
|
||||
options: SpawnOptions;
|
||||
}
|
||||
/**
|
||||
* Normalizes the command and arguments to work cross-platform.
|
||||
* On Windows, this basically handles things like shebangs, calling
|
||||
* `node_modules/.bin` commands, and escaping meta characters.
|
||||
* On other platforms, it just returns the command and arguments as-is.
|
||||
*/
|
||||
declare function normalizeSpawnCommand(command: string, args?: readonly string[], options?: SpawnOptions): NormalizedSpawnCommand;
|
||||
//#endregion
|
||||
//#region src/non-zero-exit-error.d.ts
|
||||
declare class NonZeroExitError extends Error {
|
||||
readonly result: CommonOutputApi;
|
||||
readonly output?: Output | undefined;
|
||||
readonly exitCode: number;
|
||||
get signalCode(): string | null;
|
||||
constructor(result: CommonOutputApi, output?: Output | undefined, command?: string, args?: readonly string[]);
|
||||
}
|
||||
//#endregion
|
||||
//#region src/main.d.ts
|
||||
interface Output {
|
||||
stderr: string;
|
||||
stdout: string;
|
||||
exitCode: number | undefined;
|
||||
}
|
||||
interface PipeOptions extends Options {}
|
||||
type KillSignal = Parameters<ChildProcess['kill']>[0];
|
||||
interface CommonOutputApi {
|
||||
get pid(): number | undefined;
|
||||
get killed(): boolean;
|
||||
get exitCode(): number | undefined;
|
||||
get signalCode(): string | null;
|
||||
}
|
||||
interface OutputApi extends AsyncIterable<string>, CommonOutputApi {
|
||||
process: ChildProcess | undefined;
|
||||
get aborted(): boolean;
|
||||
pipe(command: string, args?: readonly string[], options?: Partial<PipeOptions>): Result;
|
||||
kill(signal?: KillSignal): boolean;
|
||||
}
|
||||
interface OutputApiSync extends Iterable<string>, CommonOutputApi {}
|
||||
type Result = PromiseLike<Output> & OutputApi;
|
||||
type SyncResult = Output & OutputApiSync;
|
||||
interface CommonOptions {
|
||||
timeout: number;
|
||||
throwOnError: boolean;
|
||||
nodePath: boolean;
|
||||
}
|
||||
interface Options extends CommonOptions {
|
||||
signal: AbortSignal;
|
||||
nodeOptions: SpawnOptions;
|
||||
persist: boolean;
|
||||
stdin: Result | ExecProcess | string;
|
||||
}
|
||||
interface SyncOptions extends CommonOptions {
|
||||
nodeOptions: SpawnSyncOptions;
|
||||
}
|
||||
interface TinyExec {
|
||||
(command: string, args?: readonly string[], options?: Partial<Options>): Result;
|
||||
}
|
||||
declare class ExecProcess implements Result {
|
||||
protected _process?: ChildProcess;
|
||||
protected _aborted: boolean;
|
||||
protected _options: Partial<Options>;
|
||||
protected _command: string;
|
||||
protected _args: readonly string[];
|
||||
protected _resolveClose?: () => void;
|
||||
protected _processClosed: Promise<void>;
|
||||
protected _thrownError?: Error;
|
||||
get process(): ChildProcess | undefined;
|
||||
get pid(): number | undefined;
|
||||
get exitCode(): number | undefined;
|
||||
get signalCode(): string | null;
|
||||
constructor(command: string, args?: readonly string[], options?: Partial<Options>);
|
||||
kill(signal?: KillSignal): boolean;
|
||||
get aborted(): boolean;
|
||||
get killed(): boolean;
|
||||
pipe(command: string, args?: readonly string[], options?: Partial<PipeOptions>): Result;
|
||||
[Symbol.asyncIterator](): AsyncIterator<string>;
|
||||
protected _waitForOutput(): Promise<Output>;
|
||||
then<TResult1 = Output, TResult2 = never>(onfulfilled?: ((value: Output) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
||||
protected _streamOut?: Readable;
|
||||
protected _streamErr?: Readable;
|
||||
spawn(): void;
|
||||
protected _resetState(): void;
|
||||
protected _onError: (err: Error) => void;
|
||||
protected _onClose: () => void;
|
||||
}
|
||||
declare function xSync(command: string, args?: readonly string[], options?: Partial<SyncOptions>): SyncResult;
|
||||
declare const x: TinyExec;
|
||||
declare const exec: TinyExec;
|
||||
declare const execSync: typeof xSync;
|
||||
//#endregion
|
||||
export { CommonOptions, CommonOutputApi, ExecProcess, KillSignal, NonZeroExitError, Options, Output, OutputApi, OutputApiSync, PipeOptions, Result, SyncOptions, SyncResult, TinyExec, exec, execSync, normalizeSpawnCommand, x, xSync };
|
||||
@@ -0,0 +1,13 @@
|
||||
export type Options = [
|
||||
{
|
||||
allowConstructorOnly?: boolean;
|
||||
allowEmpty?: boolean;
|
||||
allowStaticOnly?: boolean;
|
||||
allowWithDecorator?: boolean;
|
||||
}
|
||||
];
|
||||
export type MessageIds = 'empty' | 'onlyConstructor' | 'onlyStatic';
|
||||
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
export default _default;
|
||||
@@ -0,0 +1,12 @@
|
||||
export default KEYS;
|
||||
export type VisitorKeys = {
|
||||
readonly [type: string]: readonly string[];
|
||||
};
|
||||
/**
|
||||
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
|
||||
*/
|
||||
/**
|
||||
* @type {VisitorKeys}
|
||||
*/
|
||||
declare const KEYS: VisitorKeys;
|
||||
//# sourceMappingURL=visitor-keys.d.ts.map
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Get visitor keys of a given node.
|
||||
* @param {Object} node The AST node to get keys.
|
||||
* @returns {readonly string[]} Visitor keys of the node.
|
||||
*/
|
||||
export function getKeys(node: Object): readonly string[];
|
||||
/**
|
||||
* Make the union set with `KEYS` and given keys.
|
||||
* @param {VisitorKeys} additionalKeys The additional keys.
|
||||
* @returns {VisitorKeys} The union set.
|
||||
*/
|
||||
export function unionWith(additionalKeys: VisitorKeys): VisitorKeys;
|
||||
export { KEYS };
|
||||
export type VisitorKeys = import("./visitor-keys.js").VisitorKeys;
|
||||
import KEYS from "./visitor-keys.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { Node, NodeArray } from "./ast.ts";
|
||||
/**
|
||||
* Creates a deep clone of a node and its subtree, synthesizing new nodes for every child.
|
||||
* The resulting tree has fully set parent pointers.
|
||||
*
|
||||
* @param node The node to clone.
|
||||
* @param includeTrivia Whether to preserve the text range (pos/end) on the clone.
|
||||
*/
|
||||
export declare function getSynthesizedDeepClone<T extends Node>(node: T, includeTrivia?: boolean): T;
|
||||
export declare function getSynthesizedDeepClone<T extends Node>(node: T | undefined, includeTrivia?: boolean): T | undefined;
|
||||
/**
|
||||
* Creates deep clones of a NodeArray and all its elements.
|
||||
*/
|
||||
export declare function getSynthesizedDeepClones<T extends Node>(nodes: NodeArray<T>, includeTrivia?: boolean): NodeArray<T>;
|
||||
export declare function getSynthesizedDeepClones<T extends Node>(nodes: NodeArray<T> | undefined, includeTrivia?: boolean): NodeArray<T> | undefined;
|
||||
//# sourceMappingURL=clone.d.ts.map
|
||||
@@ -0,0 +1,66 @@
|
||||
# quick-format-unescaped
|
||||
|
||||
## unescaped ?
|
||||
|
||||
Sometimes you want to embed the results of quick-format into another string,
|
||||
and then escape the whole string.
|
||||
|
||||
## usage
|
||||
|
||||
```js
|
||||
var format = require('quick-format-unescaped')
|
||||
format('hello %s %j %d', ['world', [{obj: true}, 4, {another: 'obj'}]])
|
||||
```
|
||||
|
||||
## format(fmt, parameters, [options])
|
||||
|
||||
### fmt
|
||||
|
||||
A `printf`-like format string. Example: `'hello %s %j %d'`
|
||||
|
||||
### parameters
|
||||
|
||||
Array of values to be inserted into the `format` string. Example: `['world', {obj:true}]`
|
||||
|
||||
### options.stringify
|
||||
|
||||
Passing an options object as the third parameter with a `stringify` will mean
|
||||
any objects will be passed to the supplied function instead of an the
|
||||
internal `tryStringify` function. This can be useful when using augmented
|
||||
capability serializers such as [`fast-safe-stringify`](http://github.com/davidmarkclements/fast-safe-stringify) or [`fast-redact`](http://github.com/davidmarkclements/fast-redact).
|
||||
|
||||
## caveats
|
||||
|
||||
By default `quick-format-unescaped` uses `JSON.stringify` instead of `util.inspect`, this means functions *will not be serialized*.
|
||||
|
||||
## Benchmarks
|
||||
|
||||
### Node 8.11.2
|
||||
|
||||
```
|
||||
util*100000: 350.325ms
|
||||
quick*100000: 268.141ms
|
||||
utilWithTailObj*100000: 586.387ms
|
||||
quickWithTailObj*100000: 280.200ms
|
||||
util*100000: 325.735ms
|
||||
quick*100000: 270.251ms
|
||||
utilWithTailObj*100000: 492.270ms
|
||||
quickWithTailObj*100000: 261.797ms
|
||||
```
|
||||
|
||||
### Node 10.4.0
|
||||
|
||||
```
|
||||
util*100000: 301.035ms
|
||||
quick*100000: 217.005ms
|
||||
utilWithTailObj*100000: 404.778ms
|
||||
quickWithTailObj*100000: 236.176ms
|
||||
util*100000: 286.349ms
|
||||
quick*100000: 214.646ms
|
||||
utilWithTailObj*100000: 388.574ms
|
||||
quickWithTailObj*100000: 226.036ms
|
||||
```
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
Sponsored by [nearForm](http://www.nearform.com)
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { LibDefinition } from '../variable';
|
||||
export declare const es2016: LibDefinition;
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"main": "../../cjs/_class_name_tdz_error.cjs",
|
||||
"module": "../../esm/_class_name_tdz_error.js"
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
export {};
|
||||
|
||||
import * as perf_hooks from "node:perf_hooks";
|
||||
|
||||
type _Performance = typeof globalThis extends { onmessage: any } ? {} : perf_hooks.Performance;
|
||||
type _PerformanceEntry = typeof globalThis extends { onmessage: any } ? {} : perf_hooks.PerformanceEntry;
|
||||
type _PerformanceMark = typeof globalThis extends { onmessage: any } ? {} : perf_hooks.PerformanceMark;
|
||||
type _PerformanceMeasure = typeof globalThis extends { onmessage: any } ? {} : perf_hooks.PerformanceMeasure;
|
||||
type _PerformanceObserver = typeof globalThis extends { onmessage: any } ? {} : perf_hooks.PerformanceObserver;
|
||||
type _PerformanceObserverEntryList = typeof globalThis extends { onmessage: any } ? {}
|
||||
: perf_hooks.PerformanceObserverEntryList;
|
||||
type _PerformanceResourceTiming = typeof globalThis extends { onmessage: any } ? {}
|
||||
: perf_hooks.PerformanceResourceTiming;
|
||||
|
||||
declare global {
|
||||
interface Performance extends _Performance {}
|
||||
var Performance: typeof globalThis extends { onmessage: any; Performance: infer T } ? T
|
||||
: typeof perf_hooks.Performance;
|
||||
|
||||
interface PerformanceEntry extends _PerformanceEntry {}
|
||||
var PerformanceEntry: typeof globalThis extends { onmessage: any; PerformanceEntry: infer T } ? T
|
||||
: typeof perf_hooks.PerformanceEntry;
|
||||
|
||||
interface PerformanceMark extends _PerformanceMark {}
|
||||
var PerformanceMark: typeof globalThis extends { onmessage: any; PerformanceMark: infer T } ? T
|
||||
: typeof perf_hooks.PerformanceMark;
|
||||
|
||||
interface PerformanceMeasure extends _PerformanceMeasure {}
|
||||
var PerformanceMeasure: typeof globalThis extends { onmessage: any; PerformanceMeasure: infer T } ? T
|
||||
: typeof perf_hooks.PerformanceMeasure;
|
||||
|
||||
interface PerformanceObserver extends _PerformanceObserver {}
|
||||
var PerformanceObserver: typeof globalThis extends { onmessage: any; PerformanceObserver: infer T } ? T
|
||||
: typeof perf_hooks.PerformanceObserver;
|
||||
|
||||
interface PerformanceObserverEntryList extends _PerformanceObserverEntryList {}
|
||||
var PerformanceObserverEntryList: typeof globalThis extends
|
||||
{ onmessage: any; PerformanceObserverEntryList: infer T } ? T : typeof perf_hooks.PerformanceObserverEntryList;
|
||||
|
||||
interface PerformanceResourceTiming extends _PerformanceResourceTiming {}
|
||||
var PerformanceResourceTiming: typeof globalThis extends { onmessage: any; PerformanceResourceTiming: infer T } ? T
|
||||
: typeof perf_hooks.PerformanceResourceTiming;
|
||||
|
||||
var performance: typeof globalThis extends { onmessage: any; performance: infer T } ? T : perf_hooks.Performance;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
I am only useful as an install script to make node-gyp not compile for purely optional native deps
|
||||
*/
|
||||
|
||||
process.exit(0)
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { TSESTree } from '@typescript-eslint/utils';
|
||||
/**
|
||||
* Recursively checks whether a given reference is used in a type predicate (e.g., `arg is string`)
|
||||
*/
|
||||
export declare function referenceContainsTypePredicate(node: TSESTree.Node): boolean;
|
||||
@@ -0,0 +1,25 @@
|
||||
import { formatSyntaxKind } from "../ast/utils.js";
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
/**
|
||||
* Indicates whether a map-like contains an own property with the specified key.
|
||||
*
|
||||
* @param map A map-like.
|
||||
* @param key A property key.
|
||||
*/
|
||||
export function hasProperty(map, key) {
|
||||
return hasOwnProperty.call(map, key);
|
||||
}
|
||||
export function assertNever(member, message = "Illegal value:", stackCrawlMark) {
|
||||
const detail = typeof member === "object" && hasProperty(member, "kind") && hasProperty(member, "pos") ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
|
||||
return fail(`${message} ${detail}`, stackCrawlMark || assertNever);
|
||||
}
|
||||
export function fail(message, stackCrawlMark) {
|
||||
// eslint-disable-next-line no-debugger
|
||||
debugger;
|
||||
const e = new Error(message ? `Debug Failure. ${message}` : "Debug Failure.");
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(e, stackCrawlMark || fail);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
//# sourceMappingURL=utils.js.map
|
||||
@@ -0,0 +1,96 @@
|
||||
# node-postgres
|
||||
|
||||
[](http://travis-ci.org/brianc/node-postgres)
|
||||
<span class="badge-npmversion"><a href="https://npmjs.org/package/pg" title="View this project on NPM"><img src="https://img.shields.io/npm/v/pg.svg" alt="NPM version" /></a></span>
|
||||
<span class="badge-npmdownloads"><a href="https://npmjs.org/package/pg" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/pg.svg" alt="NPM downloads" /></a></span>
|
||||
|
||||
Non-blocking PostgreSQL client for Node.js. Pure JavaScript and optional native libpq bindings.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install pg
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## :star: [Documentation](https://node-postgres.com) :star:
|
||||
|
||||
### Features
|
||||
|
||||
- [Fastest PostgreSQL client for Node.js](https://github.com/nigrosimone/postgres-benchmarks)
|
||||
- Pure JavaScript client and native libpq bindings share _the same API_
|
||||
- Connection pooling
|
||||
- Extensible JS ↔ PostgreSQL data-type coercion
|
||||
- Supported PostgreSQL features
|
||||
- Parameterized queries
|
||||
- Named statements with query plan caching
|
||||
- Async notifications with `LISTEN/NOTIFY`
|
||||
- Bulk import & export with `COPY TO/COPY FROM`
|
||||
|
||||
### Extras
|
||||
|
||||
node-postgres is by design pretty light on abstractions. These are some handy modules we've been using over the years to complete the picture.
|
||||
The entire list can be found on our [wiki](https://github.com/brianc/node-postgres/wiki/Extras).
|
||||
|
||||
## Support
|
||||
|
||||
node-postgres is free software. If you encounter a bug with the library please open an issue on the [GitHub repo](https://github.com/brianc/node-postgres). If you have questions unanswered by the documentation please open an issue pointing out how the documentation was unclear & I will do my best to make it better!
|
||||
|
||||
When you open an issue please provide:
|
||||
|
||||
- version of Node
|
||||
- version of Postgres
|
||||
- smallest possible snippet of code to reproduce the problem
|
||||
|
||||
You can also follow me [@brianc](https://bsky.app/profile/brianc.bsky.social) on bluesky if that's your thing for updates on node-postgres with nearly zero non node-postgres content. My old twitter/x account is no longer used.
|
||||
|
||||
## Sponsorship :two_hearts:
|
||||
|
||||
node-postgres's continued development has been made possible in part by generous financial support from [the community](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md).
|
||||
|
||||
If you or your company are benefiting from node-postgres and would like to help keep the project financially sustainable [please consider supporting](https://github.com/sponsors/brianc) its development.
|
||||
|
||||
### Featured sponsor
|
||||
|
||||
Special thanks to [medplum](https://medplum.com) for their generous and thoughtful support of node-postgres!
|
||||
|
||||

|
||||
|
||||
## Contributing
|
||||
|
||||
**:heart: contributions!**
|
||||
|
||||
I will **happily** accept your pull request if it:
|
||||
|
||||
- **has tests**
|
||||
- looks reasonable
|
||||
- does not break backwards compatibility
|
||||
|
||||
If your change involves breaking backwards compatibility please please point that out in the pull request & we can discuss & plan when and how to release it and what type of documentation or communicate it will require.
|
||||
|
||||
## Troubleshooting and FAQ
|
||||
|
||||
The causes and solutions to common errors can be found among the [Frequently Asked Questions (FAQ)](https://github.com/brianc/node-postgres/wiki/FAQ)
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2010-2020 Brian Carlson (brian.m.carlson@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,10 @@
|
||||
export declare class Semaphore<T = void> {
|
||||
private _capacity;
|
||||
private _active;
|
||||
private _waiting;
|
||||
constructor(capacity?: number);
|
||||
lock(thunk: () => T | PromiseLike<T>): Promise<T>;
|
||||
get active(): number;
|
||||
private runNext;
|
||||
private doRunNext;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
name: ci
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
node-version: [14.x, 16.x, 18.x, 20.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
npm install
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
npm run test
|
||||
@@ -0,0 +1,14 @@
|
||||
export * as core from "../core/index.js";
|
||||
export * from "./parse.js";
|
||||
export * from "./schemas.js";
|
||||
export * from "./checks.js";
|
||||
export { globalRegistry, registry, config, $output, $input, $brand, clone, regexes, treeifyError, prettifyError, formatError, flattenError, TimePrecision, util, NEVER, } from "../core/index.js";
|
||||
export { toJSONSchema } from "../core/json-schema-processors.js";
|
||||
export * as locales from "../locales/index.js";
|
||||
/** A special constant with type `never` */
|
||||
// export const NEVER = {} as never;
|
||||
// iso
|
||||
export * as iso from "./iso.js";
|
||||
export { ZodMiniISODateTime, ZodMiniISODate, ZodMiniISOTime, ZodMiniISODuration, } from "./iso.js";
|
||||
// coerce
|
||||
export * as coerce from "./coerce.js";
|
||||
@@ -0,0 +1,95 @@
|
||||
import * as mod from './modular.ts';
|
||||
import type { WeierstrassPoint, WeierstrassPointCons } from './weierstrass.ts';
|
||||
export type BigintTuple = [bigint, bigint];
|
||||
export type Fp = bigint;
|
||||
export type Fp2 = {
|
||||
c0: bigint;
|
||||
c1: bigint;
|
||||
};
|
||||
export type BigintSix = [bigint, bigint, bigint, bigint, bigint, bigint];
|
||||
export type Fp6 = {
|
||||
c0: Fp2;
|
||||
c1: Fp2;
|
||||
c2: Fp2;
|
||||
};
|
||||
export type Fp12 = {
|
||||
c0: Fp6;
|
||||
c1: Fp6;
|
||||
};
|
||||
export type BigintTwelve = [
|
||||
bigint,
|
||||
bigint,
|
||||
bigint,
|
||||
bigint,
|
||||
bigint,
|
||||
bigint,
|
||||
bigint,
|
||||
bigint,
|
||||
bigint,
|
||||
bigint,
|
||||
bigint,
|
||||
bigint
|
||||
];
|
||||
export type Fp2Bls = mod.IField<Fp2> & {
|
||||
Fp: mod.IField<Fp>;
|
||||
frobeniusMap(num: Fp2, power: number): Fp2;
|
||||
fromBigTuple(num: BigintTuple): Fp2;
|
||||
mulByB: (num: Fp2) => Fp2;
|
||||
mulByNonresidue: (num: Fp2) => Fp2;
|
||||
reim: (num: Fp2) => {
|
||||
re: Fp;
|
||||
im: Fp;
|
||||
};
|
||||
Fp4Square: (a: Fp2, b: Fp2) => {
|
||||
first: Fp2;
|
||||
second: Fp2;
|
||||
};
|
||||
NONRESIDUE: Fp2;
|
||||
};
|
||||
export type Fp6Bls = mod.IField<Fp6> & {
|
||||
Fp2: Fp2Bls;
|
||||
frobeniusMap(num: Fp6, power: number): Fp6;
|
||||
fromBigSix: (tuple: BigintSix) => Fp6;
|
||||
mul1(num: Fp6, b1: Fp2): Fp6;
|
||||
mul01(num: Fp6, b0: Fp2, b1: Fp2): Fp6;
|
||||
mulByFp2(lhs: Fp6, rhs: Fp2): Fp6;
|
||||
mulByNonresidue: (num: Fp6) => Fp6;
|
||||
};
|
||||
export type Fp12Bls = mod.IField<Fp12> & {
|
||||
Fp6: Fp6Bls;
|
||||
frobeniusMap(num: Fp12, power: number): Fp12;
|
||||
fromBigTwelve: (t: BigintTwelve) => Fp12;
|
||||
mul014(num: Fp12, o0: Fp2, o1: Fp2, o4: Fp2): Fp12;
|
||||
mul034(num: Fp12, o0: Fp2, o3: Fp2, o4: Fp2): Fp12;
|
||||
mulByFp2(lhs: Fp12, rhs: Fp2): Fp12;
|
||||
conjugate(num: Fp12): Fp12;
|
||||
finalExponentiate(num: Fp12): Fp12;
|
||||
_cyclotomicSquare(num: Fp12): Fp12;
|
||||
_cyclotomicExp(num: Fp12, n: bigint): Fp12;
|
||||
};
|
||||
export declare function psiFrobenius(Fp: mod.IField<Fp>, Fp2: Fp2Bls, base: Fp2): {
|
||||
psi: (x: Fp2, y: Fp2) => [Fp2, Fp2];
|
||||
psi2: (x: Fp2, y: Fp2) => [Fp2, Fp2];
|
||||
G2psi: (c: WeierstrassPointCons<Fp2>, P: WeierstrassPoint<Fp2>) => WeierstrassPoint<Fp2>;
|
||||
G2psi2: (c: WeierstrassPointCons<Fp2>, P: WeierstrassPoint<Fp2>) => WeierstrassPoint<Fp2>;
|
||||
PSI_X: Fp2;
|
||||
PSI_Y: Fp2;
|
||||
PSI2_X: Fp2;
|
||||
PSI2_Y: Fp2;
|
||||
};
|
||||
export type Tower12Opts = {
|
||||
ORDER: bigint;
|
||||
X_LEN: number;
|
||||
NONRESIDUE?: Fp;
|
||||
FP2_NONRESIDUE: BigintTuple;
|
||||
Fp2sqrt?: (num: Fp2) => Fp2;
|
||||
Fp2mulByB: (num: Fp2) => Fp2;
|
||||
Fp12finalExponentiate: (num: Fp12) => Fp12;
|
||||
};
|
||||
export declare function tower12(opts: Tower12Opts): {
|
||||
Fp: Readonly<mod.IField<bigint> & Required<Pick<mod.IField<bigint>, 'isOdd'>>>;
|
||||
Fp2: Fp2Bls;
|
||||
Fp6: Fp6Bls;
|
||||
Fp12: Fp12Bls;
|
||||
};
|
||||
//# sourceMappingURL=tower.d.ts.map
|
||||
@@ -0,0 +1,137 @@
|
||||
export enum TypeId {
|
||||
BOOL = 16,
|
||||
BYTEA = 17,
|
||||
CHAR = 18,
|
||||
INT8 = 20,
|
||||
INT2 = 21,
|
||||
INT4 = 23,
|
||||
REGPROC = 24,
|
||||
TEXT = 25,
|
||||
OID = 26,
|
||||
TID = 27,
|
||||
XID = 28,
|
||||
CID = 29,
|
||||
JSON = 114,
|
||||
XML = 142,
|
||||
PG_NODE_TREE = 194,
|
||||
SMGR = 210,
|
||||
PATH = 602,
|
||||
POLYGON = 604,
|
||||
CIDR = 650,
|
||||
FLOAT4 = 700,
|
||||
FLOAT8 = 701,
|
||||
ABSTIME = 702,
|
||||
RELTIME = 703,
|
||||
TINTERVAL = 704,
|
||||
CIRCLE = 718,
|
||||
MACADDR8 = 774,
|
||||
MONEY = 790,
|
||||
MACADDR = 829,
|
||||
INET = 869,
|
||||
ACLITEM = 1033,
|
||||
BPCHAR = 1042,
|
||||
VARCHAR = 1043,
|
||||
DATE = 1082,
|
||||
TIME = 1083,
|
||||
TIMESTAMP = 1114,
|
||||
TIMESTAMPTZ = 1184,
|
||||
INTERVAL = 1186,
|
||||
TIMETZ = 1266,
|
||||
BIT = 1560,
|
||||
VARBIT = 1562,
|
||||
NUMERIC = 1700,
|
||||
REFCURSOR = 1790,
|
||||
REGPROCEDURE = 2202,
|
||||
REGOPER = 2203,
|
||||
REGOPERATOR = 2204,
|
||||
REGCLASS = 2205,
|
||||
REGTYPE = 2206,
|
||||
UUID = 2950,
|
||||
TXID_SNAPSHOT = 2970,
|
||||
PG_LSN = 3220,
|
||||
PG_NDISTINCT = 3361,
|
||||
PG_DEPENDENCIES = 3402,
|
||||
TSVECTOR = 3614,
|
||||
TSQUERY = 3615,
|
||||
GTSVECTOR = 3642,
|
||||
REGCONFIG = 3734,
|
||||
REGDICTIONARY = 3769,
|
||||
JSONB = 3802,
|
||||
REGNAMESPACE = 4089,
|
||||
REGROLE = 4096
|
||||
}
|
||||
|
||||
export type builtinsTypes =
|
||||
'BOOL' |
|
||||
'BYTEA' |
|
||||
'CHAR' |
|
||||
'INT8' |
|
||||
'INT2' |
|
||||
'INT4' |
|
||||
'REGPROC' |
|
||||
'TEXT' |
|
||||
'OID' |
|
||||
'TID' |
|
||||
'XID' |
|
||||
'CID' |
|
||||
'JSON' |
|
||||
'XML' |
|
||||
'PG_NODE_TREE' |
|
||||
'SMGR' |
|
||||
'PATH' |
|
||||
'POLYGON' |
|
||||
'CIDR' |
|
||||
'FLOAT4' |
|
||||
'FLOAT8' |
|
||||
'ABSTIME' |
|
||||
'RELTIME' |
|
||||
'TINTERVAL' |
|
||||
'CIRCLE' |
|
||||
'MACADDR8' |
|
||||
'MONEY' |
|
||||
'MACADDR' |
|
||||
'INET' |
|
||||
'ACLITEM' |
|
||||
'BPCHAR' |
|
||||
'VARCHAR' |
|
||||
'DATE' |
|
||||
'TIME' |
|
||||
'TIMESTAMP' |
|
||||
'TIMESTAMPTZ' |
|
||||
'INTERVAL' |
|
||||
'TIMETZ' |
|
||||
'BIT' |
|
||||
'VARBIT' |
|
||||
'NUMERIC' |
|
||||
'REFCURSOR' |
|
||||
'REGPROCEDURE' |
|
||||
'REGOPER' |
|
||||
'REGOPERATOR' |
|
||||
'REGCLASS' |
|
||||
'REGTYPE' |
|
||||
'UUID' |
|
||||
'TXID_SNAPSHOT' |
|
||||
'PG_LSN' |
|
||||
'PG_NDISTINCT' |
|
||||
'PG_DEPENDENCIES' |
|
||||
'TSVECTOR' |
|
||||
'TSQUERY' |
|
||||
'GTSVECTOR' |
|
||||
'REGCONFIG' |
|
||||
'REGDICTIONARY' |
|
||||
'JSONB' |
|
||||
'REGNAMESPACE' |
|
||||
'REGROLE';
|
||||
|
||||
export type TypesBuiltins = {[key in builtinsTypes]: TypeId};
|
||||
|
||||
export type TypeFormat = 'text' | 'binary';
|
||||
|
||||
export const builtins: TypesBuiltins;
|
||||
|
||||
export function setTypeParser (id: TypeId, parseFn: ((value: string) => any)): void;
|
||||
export function setTypeParser (id: TypeId, format: TypeFormat, parseFn: (value: string) => any): void;
|
||||
|
||||
export const getTypeParser: (id: TypeId, format?: TypeFormat) => any
|
||||
|
||||
export const arrayParser: (source: string, transform: (entry: any) => any) => any[];
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_blake.d.ts","sourceRoot":"","sources":["src/_blake.ts"],"names":[],"mappings":"AAMA;;;GAGG;AAEH,eAAO,MAAM,MAAM,EAAE,UAkBnB,CAAC;AAGH,MAAM,MAAM,IAAI,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;CAAE,CAAC;AAGnE,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM/E;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM/E"}
|
||||
@@ -0,0 +1,203 @@
|
||||
{{## def.setupKeyword:
|
||||
{{
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.setCompositeRule:
|
||||
{{
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.resetCompositeRule:
|
||||
{{ it.compositeRule = $it.compositeRule = $wasComposite; }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.setupNextLevel:
|
||||
{{
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.ifValid:
|
||||
{{? $breakOnError }}
|
||||
if ({{=$valid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.ifResultValid:
|
||||
{{? $breakOnError }}
|
||||
if ({{=$nextValid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.elseIfValid:
|
||||
{{? $breakOnError }}
|
||||
{{ $closingBraces += '}'; }}
|
||||
else {
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.nonEmptySchema:_schema:
|
||||
(it.opts.strictKeywords
|
||||
? (typeof _schema == 'object' && Object.keys(_schema).length > 0)
|
||||
|| _schema === false
|
||||
: it.util.schemaHasRules(_schema, it.RULES.all))
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.strLength:
|
||||
{{? it.opts.unicode === false }}
|
||||
{{=$data}}.length
|
||||
{{??}}
|
||||
ucs2length({{=$data}})
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.willOptimize:
|
||||
it.util.varOccurences($code, $nextData) < 2
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.generateSubschemaCode:
|
||||
{{
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.insertSubschemaCode:
|
||||
{{= it.validate($it) }}
|
||||
{{ $it.baseId = $currentBaseId; }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def._optimizeValidate:
|
||||
it.util.varReplace($code, $nextData, $passData)
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.optimizeValidate:
|
||||
{{? {{# def.willOptimize}} }}
|
||||
{{= {{# def._optimizeValidate }} }}
|
||||
{{??}}
|
||||
var {{=$nextData}} = {{=$passData}};
|
||||
{{= $code }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.$data:
|
||||
{{
|
||||
var $isData = it.opts.$data && $schema && $schema.$data
|
||||
, $schemaValue;
|
||||
}}
|
||||
{{? $isData }}
|
||||
var schema{{=$lvl}} = {{= it.util.getData($schema.$data, $dataLvl, it.dataPathArr) }};
|
||||
{{ $schemaValue = 'schema' + $lvl; }}
|
||||
{{??}}
|
||||
{{ $schemaValue = $schema; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.$dataNotType:_type:
|
||||
{{?$isData}} ({{=$schemaValue}} !== undefined && typeof {{=$schemaValue}} != _type) || {{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.check$dataIsArray:
|
||||
if (schema{{=$lvl}} === undefined) {{=$valid}} = true;
|
||||
else if (!Array.isArray(schema{{=$lvl}})) {{=$valid}} = false;
|
||||
else {
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.numberKeyword:
|
||||
{{? !($isData || typeof $schema == 'number') }}
|
||||
{{ throw new Error($keyword + ' must be number'); }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.beginDefOut:
|
||||
{{
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.storeDefOut:_variable:
|
||||
{{
|
||||
var _variable = out;
|
||||
out = $$outStack.pop();
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.dataPath:(dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}#}}
|
||||
|
||||
{{## def.setParentData:
|
||||
{{
|
||||
var $parentData = $dataLvl ? 'data' + (($dataLvl-1)||'') : 'parentData'
|
||||
, $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
||||
}}
|
||||
#}}
|
||||
|
||||
{{## def.passParentData:
|
||||
{{# def.setParentData }}
|
||||
, {{= $parentData }}
|
||||
, {{= $parentDataProperty }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.iterateProperties:
|
||||
{{? $ownProperties }}
|
||||
{{=$dataProperties}} = {{=$dataProperties}} || Object.keys({{=$data}});
|
||||
for (var {{=$idx}}=0; {{=$idx}}<{{=$dataProperties}}.length; {{=$idx}}++) {
|
||||
var {{=$key}} = {{=$dataProperties}}[{{=$idx}}];
|
||||
{{??}}
|
||||
for (var {{=$key}} in {{=$data}}) {
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.noPropertyInData:
|
||||
{{=$useData}} === undefined
|
||||
{{? $ownProperties }}
|
||||
|| !{{# def.isOwnProperty }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.isOwnProperty:
|
||||
Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($propertyKey)}}')
|
||||
#}}
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @fileoverview Configuration related to ECMAScript versions
|
||||
* @author Milos Djermanovic
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* The latest ECMAScript version supported by ESLint.
|
||||
* @type {number} year-based ECMAScript version
|
||||
*/
|
||||
const LATEST_ECMA_VERSION = 2026;
|
||||
|
||||
module.exports = {
|
||||
LATEST_ECMA_VERSION,
|
||||
};
|
||||
@@ -0,0 +1,179 @@
|
||||
import { T as TestArtifact, a as Test, S as Suite, b as SuiteHooks, F as FileSpecification, V as VitestRunner, c as File, d as TaskUpdateEvent, e as Task, f as TestAPI, g as SuiteAPI, h as SuiteCollector } from './tasks.d-DEYaIMIu.js';
|
||||
export { A as AfterAllListener, i as AfterEachListener, j as AroundAllListener, k as AroundEachListener, B as BeforeAllListener, l as BeforeEachListener, C as CancelReason, m as FailureScreenshotArtifact, n as Fixture, o as FixtureFn, p as FixtureOptions, q as Fixtures, I as ImportDuration, r as InferFixturesTypes, O as OnTestFailedHandler, s as OnTestFinishedHandler, R as Retry, t as RunMode, u as RuntimeContext, v as SequenceHooks, w as SequenceSetupFiles, x as SerializableRetry, y as SuiteFactory, z as SuiteOptions, D as TaskBase, E as TaskCustomOptions, G as TaskEventPack, H as TaskHook, J as TaskMeta, K as TaskPopulated, L as TaskResult, M as TaskResultPack, N as TaskState, P as TestAnnotation, Q as TestAnnotationArtifact, U as TestAnnotationLocation, W as TestArtifactBase, X as TestArtifactLocation, Y as TestArtifactRegistry, Z as TestAttachment, _ as TestContext, $ as TestFunction, a0 as TestOptions, a1 as TestTagDefinition, a2 as TestTags, a3 as Use, a4 as VisualRegressionArtifact, a5 as VitestRunnerConfig, a6 as VitestRunnerConstructor, a7 as VitestRunnerImportSource, a8 as afterAll, a9 as afterEach, aa as aroundAll, ab as aroundEach, ac as beforeAll, ad as beforeEach, ae as onTestFailed, af as onTestFinished } from './tasks.d-DEYaIMIu.js';
|
||||
import { Awaitable } from '@vitest/utils';
|
||||
import '@vitest/utils/diff';
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
* @advanced
|
||||
*
|
||||
* Records a custom test artifact during test execution.
|
||||
*
|
||||
* This function allows you to attach structured data, files, or metadata to a test.
|
||||
*
|
||||
* Vitest automatically injects the source location where the artifact was created and manages any attachments you include.
|
||||
*
|
||||
* **Note:** artifacts must be recorded before the task is reported. Any artifacts recorded after that will not be included in the task.
|
||||
*
|
||||
* @param task - The test task context, typically accessed via `this.task` in custom matchers or `context.task` in tests
|
||||
* @param artifact - The artifact to record. Must extend {@linkcode TestArtifactBase}
|
||||
*
|
||||
* @returns A promise that resolves to the recorded artifact with location injected
|
||||
*
|
||||
* @throws {Error} If the test runner doesn't support artifacts
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // In a custom assertion
|
||||
* async function toHaveValidSchema(this: MatcherState, actual: unknown) {
|
||||
* const validation = validateSchema(actual)
|
||||
*
|
||||
* await recordArtifact(this.task, {
|
||||
* type: 'my-plugin:schema-validation',
|
||||
* passed: validation.valid,
|
||||
* errors: validation.errors,
|
||||
* })
|
||||
*
|
||||
* return { pass: validation.valid, message: () => '...' }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
declare function recordArtifact<Artifact extends TestArtifact>(task: Test, artifact: Artifact): Promise<Artifact>;
|
||||
|
||||
declare function setFn(key: Test, fn: () => Awaitable<void>): void;
|
||||
declare function getFn<Task = Test>(key: Task): () => Awaitable<void>;
|
||||
declare function setHooks(key: Suite, hooks: SuiteHooks): void;
|
||||
declare function getHooks(key: Suite): SuiteHooks;
|
||||
|
||||
declare function updateTask(event: TaskUpdateEvent, task: Task, runner: VitestRunner): void;
|
||||
declare function startTests(specs: string[] | FileSpecification[], runner: VitestRunner): Promise<File[]>;
|
||||
declare function publicCollect(specs: string[] | FileSpecification[], runner: VitestRunner): Promise<File[]>;
|
||||
|
||||
/**
|
||||
* Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
|
||||
* Suites can contain both tests and other suites, enabling complex test structures.
|
||||
*
|
||||
* @param {string} name - The name of the suite, used for identification and reporting.
|
||||
* @param {Function} fn - A function that defines the tests and suites within this suite.
|
||||
* @example
|
||||
* ```ts
|
||||
* // Define a suite with two tests
|
||||
* suite('Math operations', () => {
|
||||
* test('should add two numbers', () => {
|
||||
* expect(add(1, 2)).toBe(3);
|
||||
* });
|
||||
*
|
||||
* test('should subtract two numbers', () => {
|
||||
* expect(subtract(5, 2)).toBe(3);
|
||||
* });
|
||||
* });
|
||||
* ```
|
||||
* @example
|
||||
* ```ts
|
||||
* // Define nested suites
|
||||
* suite('String operations', () => {
|
||||
* suite('Trimming', () => {
|
||||
* test('should trim whitespace from start and end', () => {
|
||||
* expect(' hello '.trim()).toBe('hello');
|
||||
* });
|
||||
* });
|
||||
*
|
||||
* suite('Concatenation', () => {
|
||||
* test('should concatenate two strings', () => {
|
||||
* expect('hello' + ' ' + 'world').toBe('hello world');
|
||||
* });
|
||||
* });
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
declare const suite: SuiteAPI;
|
||||
/**
|
||||
* Defines a test case with a given name and test function. The test function can optionally be configured with test options.
|
||||
*
|
||||
* @param {string | Function} name - The name of the test or a function that will be used as a test name.
|
||||
* @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided.
|
||||
* @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters.
|
||||
* @throws {Error} If called inside another test function.
|
||||
* @example
|
||||
* ```ts
|
||||
* // Define a simple test
|
||||
* test('should add two numbers', () => {
|
||||
* expect(add(1, 2)).toBe(3);
|
||||
* });
|
||||
* ```
|
||||
* @example
|
||||
* ```ts
|
||||
* // Define a test with options
|
||||
* test('should subtract two numbers', { retry: 3 }, () => {
|
||||
* expect(subtract(5, 2)).toBe(3);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
declare const test: TestAPI;
|
||||
/**
|
||||
* Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
|
||||
* Suites can contain both tests and other suites, enabling complex test structures.
|
||||
*
|
||||
* @param {string} name - The name of the suite, used for identification and reporting.
|
||||
* @param {Function} fn - A function that defines the tests and suites within this suite.
|
||||
* @example
|
||||
* ```ts
|
||||
* // Define a suite with two tests
|
||||
* describe('Math operations', () => {
|
||||
* test('should add two numbers', () => {
|
||||
* expect(add(1, 2)).toBe(3);
|
||||
* });
|
||||
*
|
||||
* test('should subtract two numbers', () => {
|
||||
* expect(subtract(5, 2)).toBe(3);
|
||||
* });
|
||||
* });
|
||||
* ```
|
||||
* @example
|
||||
* ```ts
|
||||
* // Define nested suites
|
||||
* describe('String operations', () => {
|
||||
* describe('Trimming', () => {
|
||||
* test('should trim whitespace from start and end', () => {
|
||||
* expect(' hello '.trim()).toBe('hello');
|
||||
* });
|
||||
* });
|
||||
*
|
||||
* describe('Concatenation', () => {
|
||||
* test('should concatenate two strings', () => {
|
||||
* expect('hello' + ' ' + 'world').toBe('hello world');
|
||||
* });
|
||||
* });
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
declare const describe: SuiteAPI;
|
||||
/**
|
||||
* Defines a test case with a given name and test function. The test function can optionally be configured with test options.
|
||||
*
|
||||
* @param {string | Function} name - The name of the test or a function that will be used as a test name.
|
||||
* @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided.
|
||||
* @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters.
|
||||
* @throws {Error} If called inside another test function.
|
||||
* @example
|
||||
* ```ts
|
||||
* // Define a simple test
|
||||
* it('adds two numbers', () => {
|
||||
* expect(add(1, 2)).toBe(3);
|
||||
* });
|
||||
* ```
|
||||
* @example
|
||||
* ```ts
|
||||
* // Define a test with options
|
||||
* it('subtracts two numbers', { retry: 3 }, () => {
|
||||
* expect(subtract(5, 2)).toBe(3);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
declare const it: TestAPI;
|
||||
declare function getCurrentSuite<ExtraContext = object>(): SuiteCollector<ExtraContext>;
|
||||
declare function createTaskCollector(fn: (...args: any[]) => any): TestAPI;
|
||||
|
||||
declare function getCurrentTest<T extends Test | undefined>(): T;
|
||||
|
||||
export { File, FileSpecification, Suite, SuiteAPI, SuiteCollector, SuiteHooks, Task, TaskUpdateEvent, Test, TestAPI, TestArtifact, VitestRunner, publicCollect as collectTests, createTaskCollector, describe, getCurrentSuite, getCurrentTest, getFn, getHooks, it, recordArtifact, setFn, setHooks, startTests, suite, test, updateTask };
|
||||
@@ -0,0 +1,47 @@
|
||||
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
|
||||
export type FunctionExpression = TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression;
|
||||
export type FunctionNode = FunctionExpression | TSESTree.FunctionDeclaration;
|
||||
export interface FunctionInfo<T extends FunctionNode> {
|
||||
node: T;
|
||||
returns: TSESTree.ReturnStatement[];
|
||||
}
|
||||
/**
|
||||
* Checks if a function belongs to:
|
||||
* ```
|
||||
* () => () => ...
|
||||
* () => function () { ... }
|
||||
* () => { return () => ... }
|
||||
* () => { return function () { ... } }
|
||||
* function fn() { return () => ... }
|
||||
* function fn() { return function() { ... } }
|
||||
* ```
|
||||
*/
|
||||
export declare function doesImmediatelyReturnFunctionExpression({ node, returns, }: FunctionInfo<FunctionNode>): boolean;
|
||||
interface Options {
|
||||
allowDirectConstAssertionInArrowFunctions?: boolean;
|
||||
allowExpressions?: boolean;
|
||||
allowHigherOrderFunctions?: boolean;
|
||||
allowTypedFunctionExpressions?: boolean;
|
||||
}
|
||||
/**
|
||||
* True when the provided function expression is typed.
|
||||
*/
|
||||
export declare function isTypedFunctionExpression(node: FunctionExpression, options: Options): boolean;
|
||||
/**
|
||||
* Check whether the function expression return type is either typed or valid
|
||||
* with the provided options.
|
||||
*/
|
||||
export declare function isValidFunctionExpressionReturnType(node: FunctionExpression, options: Options): boolean;
|
||||
/**
|
||||
* Checks if a function declaration/expression has a return type.
|
||||
*/
|
||||
export declare function checkFunctionReturnType({ node, returns }: FunctionInfo<FunctionNode>, options: Options, sourceCode: TSESLint.SourceCode, report: (loc: TSESTree.SourceLocation) => void): void;
|
||||
/**
|
||||
* Checks if a function declaration/expression has a return type.
|
||||
*/
|
||||
export declare function checkFunctionExpressionReturnType(info: FunctionInfo<FunctionExpression>, options: Options, sourceCode: TSESLint.SourceCode, report: (loc: TSESTree.SourceLocation) => void): void;
|
||||
/**
|
||||
* Check whether any ancestor of the provided function has a valid return type.
|
||||
*/
|
||||
export declare function ancestorHasReturnType(node: FunctionNode): boolean;
|
||||
export {};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,47 @@
|
||||
declare module 'events' {
|
||||
interface NodeEventTarget {
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
|
||||
interface DOMEventTarget {
|
||||
addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any;
|
||||
}
|
||||
|
||||
class EventEmitter extends NodeJS.EventEmitter {
|
||||
constructor();
|
||||
|
||||
static once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>;
|
||||
static once(emitter: DOMEventTarget, event: string): Promise<any[]>;
|
||||
static on(emitter: NodeJS.EventEmitter, event: string): AsyncIterableIterator<any>;
|
||||
|
||||
/** @deprecated since v4.0.0 */
|
||||
static listenerCount(emitter: NodeJS.EventEmitter, event: string | symbol): number;
|
||||
|
||||
/**
|
||||
* This symbol shall be used to install a listener for only monitoring `'error'`
|
||||
* events. Listeners installed using this symbol are called before the regular
|
||||
* `'error'` listeners are called.
|
||||
*
|
||||
* Installing a listener using this symbol does not change the behavior once an
|
||||
* `'error'` event is emitted, therefore the process will still crash if no
|
||||
* regular `'error'` listener is installed.
|
||||
*/
|
||||
static readonly errorMonitor: unique symbol;
|
||||
static readonly captureRejectionSymbol: unique symbol;
|
||||
|
||||
/**
|
||||
* Sets or gets the default captureRejection value for all emitters.
|
||||
*/
|
||||
// TODO: These should be described using static getter/setter pairs:
|
||||
static captureRejections: boolean;
|
||||
static defaultMaxListeners: number;
|
||||
}
|
||||
|
||||
import internal = require('events');
|
||||
namespace EventEmitter {
|
||||
// Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
|
||||
export { internal as EventEmitter };
|
||||
}
|
||||
|
||||
export = EventEmitter;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
"use strict";var u=Object.defineProperty;var t=(r,e)=>u(r,"name",{value:e,configurable:!0});var d=require("module"),n=require("node:path"),o=require("./temporary-directory-B83uKxJF.cjs"),s=typeof document<"u"?document.currentScript:null,p=require;const i=process.platform==="win32",c=t(r=>{const e=n.join(o.tmpdir,`${r}.pipe`);return i?`\\\\?\\pipe\\${e}`:e},"getPipePath");exports.getPipePath=c,exports.isWindows=i,exports.require=p;
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user