WIP: bootstrap and partial real Solana watcher implementation
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : { default: obj };
|
||||
}
|
||||
export { _interop_require_default as _ };
|
||||
@@ -0,0 +1,17 @@
|
||||
export declare class Writer {
|
||||
private size;
|
||||
private buffer;
|
||||
private offset;
|
||||
private headerPosition;
|
||||
constructor(size?: number);
|
||||
private ensure;
|
||||
addInt32(num: number): Writer;
|
||||
addInt16(num: number): Writer;
|
||||
addCString(string: string): Writer;
|
||||
addString(string?: string): Writer;
|
||||
addInt32PrefixedString(string: string): Writer;
|
||||
add(otherBuffer: Buffer): Writer;
|
||||
private join;
|
||||
flush(code?: number): Buffer;
|
||||
clear(): void;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
# postgres-date [](https://travis-ci.org/bendrucker/postgres-date) [](https://greenkeeper.io/)
|
||||
|
||||
> Postgres date output parser
|
||||
|
||||
This package parses [date/time outputs](https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT) from Postgres into Javascript `Date` objects. Its goal is to match Postgres behavior and preserve data accuracy.
|
||||
|
||||
If you find a case where a valid Postgres output results in incorrect parsing (including loss of precision), please [create a pull request](https://github.com/bendrucker/postgres-date/compare) and provide a failing test.
|
||||
|
||||
**Supported Postgres Versions:** `>= 9.6`
|
||||
|
||||
All prior versions of Postgres are likely compatible but not officially supported.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save postgres-date
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var parse = require('postgres-date')
|
||||
parse('2011-01-23 22:15:51Z')
|
||||
// => 2011-01-23T22:15:51.000Z
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
#### `parse(isoDate)` -> `date`
|
||||
|
||||
##### isoDate
|
||||
|
||||
*Required*
|
||||
Type: `string`
|
||||
|
||||
A date string from Postgres.
|
||||
|
||||
## Releases
|
||||
|
||||
The following semantic versioning increments will be used for changes:
|
||||
|
||||
* **Major**: Removal of support for Node.js versions or Postgres versions (not expected)
|
||||
* **Minor**: Unused, since Postgres returns dates in standard ISO 8601 format
|
||||
* **Patch**: Any fix for parsing behavior
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Ben Drucker](http://bendrucker.me)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/api/node/protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAC9C,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,CAAC;AACrD,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAC7C,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAC9C,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAE9B,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC;AAE3B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;AAChD,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AACjD,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;AAElD,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC"}
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule } from '../util';
|
||||
import { getESLintCoreRule } from '../util/getESLintCoreRule';
|
||||
declare const baseRule: ReturnType<typeof getESLintCoreRule>;
|
||||
export type Options = InferOptionsTypeFromRule<NonNullable<typeof baseRule>>;
|
||||
export type MessageIds = InferMessageIdsTypeFromRule<NonNullable<typeof baseRule>>;
|
||||
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noLossOfPrecision", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
export default _default;
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TSModuleNameDefinition = void 0;
|
||||
const DefinitionBase_1 = require("./DefinitionBase");
|
||||
const DefinitionType_1 = require("./DefinitionType");
|
||||
class TSModuleNameDefinition extends DefinitionBase_1.DefinitionBase {
|
||||
isTypeDefinition = true;
|
||||
isVariableDefinition = true;
|
||||
constructor(name, node) {
|
||||
super(DefinitionType_1.DefinitionType.TSModuleName, name, node, null);
|
||||
}
|
||||
}
|
||||
exports.TSModuleNameDefinition = TSModuleNameDefinition;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
export { SourceMapGenerator } from '..';
|
||||
@@ -0,0 +1,64 @@
|
||||
## Long Term Support
|
||||
|
||||
Pino's Long Term Support (LTS) is provided according to the schedule laid
|
||||
out in this document:
|
||||
|
||||
1. Major releases, "X" release of [semantic versioning][semver] X.Y.Z release
|
||||
versions, are supported for a minimum period of six months from their release
|
||||
date. The release date of any specific version can be found at
|
||||
[https://github.com/pinojs/pino/releases](https://github.com/pinojs/pino/releases).
|
||||
|
||||
1. Major releases will receive security updates for an additional six months
|
||||
from the release of the next major release. After this period
|
||||
we will still review and release security fixes as long as they are
|
||||
provided by the community and they do not violate other constraints,
|
||||
e.g. minimum supported Node.js version.
|
||||
|
||||
1. Major releases will be tested and verified against all Node.js
|
||||
release lines that are supported by the
|
||||
[Node.js LTS policy](https://github.com/nodejs/Release) within the
|
||||
LTS period of that given Pino release line. This implies that only
|
||||
the latest Node.js release of a given line is supported.
|
||||
|
||||
A "month" is defined as 30 consecutive days.
|
||||
|
||||
> ## Security Releases and Semver
|
||||
>
|
||||
> As a consequence of providing long-term support for major releases, there
|
||||
> are occasions where we need to release breaking changes as a _minor_
|
||||
> version release. Such changes will _always_ be noted in the
|
||||
> [release notes](https://github.com/pinojs/pino/releases).
|
||||
>
|
||||
> To avoid automatically receiving breaking security updates it is possible to use
|
||||
> the tilde (`~`) range qualifier. For example, to get patches for the 6.1
|
||||
> release, and avoid automatically updating to the 6.1 release, specify
|
||||
> the dependency as `"pino": "~6.1.x"`. This will leave your application vulnerable,
|
||||
> so please use with caution.
|
||||
|
||||
[semver]: https://semver.org/
|
||||
|
||||
<a name="lts-schedule"></a>
|
||||
|
||||
### Schedule
|
||||
|
||||
| Version | Release Date | End Of LTS Date | Node.js |
|
||||
| :------ | :----------- | :-------------- | :------------------- |
|
||||
| 9.x | 2024-04-26 | TBD | 18, 20, 22 |
|
||||
| 8.x | 2022-06-01 | 2024-10-26 | 14, 16, 18, 20 |
|
||||
| 7.x | 2021-10-14 | 2023-06-01 | 12, 14, 16 |
|
||||
| 6.x | 2020-03-07 | 2022-04-14 | 10, 12, 14, 16 |
|
||||
|
||||
<a name="supported-os"></a>
|
||||
|
||||
### CI tested operating systems
|
||||
|
||||
Pino uses GitHub Actions for CI testing, please refer to
|
||||
[GitHub's documentation regarding workflow runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources)
|
||||
for further details on what the latest virtual environment is in relation to
|
||||
the YAML workflow labels below:
|
||||
|
||||
| OS | YAML Workflow Label | Node.js |
|
||||
|---------|------------------------|--------------|
|
||||
| Linux | `ubuntu-latest` | 18, 20, 22 |
|
||||
| Windows | `windows-latest` | 18, 20, 22 |
|
||||
| MacOS | `macos-latest` | 18, 20, 22 |
|
||||
@@ -0,0 +1,29 @@
|
||||
export declare const PROTOCOL_VERSION = 5;
|
||||
export declare const HEADER_OFFSET_METADATA = 0;
|
||||
export declare const HEADER_OFFSET_HASH_LO0 = 4;
|
||||
export declare const HEADER_OFFSET_HASH_LO1 = 8;
|
||||
export declare const HEADER_OFFSET_HASH_HI0 = 12;
|
||||
export declare const HEADER_OFFSET_HASH_HI1 = 16;
|
||||
export declare const HEADER_OFFSET_PARSE_OPTIONS = 20;
|
||||
export declare const HEADER_OFFSET_STRING_TABLE_OFFSETS = 24;
|
||||
export declare const HEADER_OFFSET_STRING_TABLE = 28;
|
||||
export declare const HEADER_OFFSET_EXTENDED_DATA = 32;
|
||||
export declare const HEADER_OFFSET_STRUCTURED_DATA = 36;
|
||||
export declare const HEADER_OFFSET_NODES = 40;
|
||||
export declare const HEADER_SIZE = 44;
|
||||
export declare const NODE_LEN = 28;
|
||||
export declare const NODE_OFFSET_KIND = 0;
|
||||
export declare const NODE_OFFSET_POS = 4;
|
||||
export declare const NODE_OFFSET_END = 8;
|
||||
export declare const NODE_OFFSET_NEXT = 12;
|
||||
export declare const NODE_OFFSET_PARENT = 16;
|
||||
export declare const NODE_OFFSET_DATA = 20;
|
||||
export declare const NODE_OFFSET_FLAGS = 24;
|
||||
export declare const KIND_NODE_LIST = 4294967295;
|
||||
export declare const NODE_DATA_TYPE_CHILDREN = 0;
|
||||
export declare const NODE_DATA_TYPE_STRING = 1073741824;
|
||||
export declare const NODE_DATA_TYPE_EXTENDED = 2147483648;
|
||||
export declare const NODE_STRING_INDEX_MASK = 16777215;
|
||||
export declare const NODE_EXTENDED_DATA_MASK = 16777215;
|
||||
export { childProperties, singleChildNodePropertyNames } from "./protocol.generated.ts";
|
||||
//# sourceMappingURL=protocol.d.ts.map
|
||||
@@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
|
||||
const FilterBase = require('./FilterBase');
|
||||
const withParser = require('../utils/withParser');
|
||||
|
||||
class Pick extends FilterBase {
|
||||
static make(options) {
|
||||
return new Pick(options);
|
||||
}
|
||||
|
||||
static withParser(options) {
|
||||
return withParser(Pick.make, options);
|
||||
}
|
||||
|
||||
_checkChunk(chunk) {
|
||||
switch (chunk.name) {
|
||||
case 'startObject':
|
||||
case 'startArray':
|
||||
if (this._filter(this._stack, chunk)) {
|
||||
this.push(chunk);
|
||||
this._transform = this._passObject;
|
||||
this._depth = 1;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 'startString':
|
||||
if (this._filter(this._stack, chunk)) {
|
||||
this.push(chunk);
|
||||
this._transform = this._passString;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 'startNumber':
|
||||
if (this._filter(this._stack, chunk)) {
|
||||
this.push(chunk);
|
||||
this._transform = this._passNumber;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 'nullValue':
|
||||
case 'trueValue':
|
||||
case 'falseValue':
|
||||
case 'stringValue':
|
||||
case 'numberValue':
|
||||
if (this._filter(this._stack, chunk)) {
|
||||
this.push(chunk);
|
||||
this._transform = this._once ? this._skip : this._check;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Pick.pick = Pick.make;
|
||||
Pick.make.Constructor = Pick;
|
||||
|
||||
module.exports = Pick;
|
||||
@@ -0,0 +1,7 @@
|
||||
declare global {
|
||||
interface Object {
|
||||
should: Chai.Assertion;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "flat-cache",
|
||||
"version": "4.0.1",
|
||||
"description": "A stupidly simple key/value storage using files to persist some data",
|
||||
"repository": "jaredwray/flat-cache",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Jared Wray",
|
||||
"url": "https://jaredwray.com"
|
||||
},
|
||||
"main": "src/cache.js",
|
||||
"files": [
|
||||
"src/cache.js",
|
||||
"src/del.js",
|
||||
"src/utils.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"precommit": [
|
||||
"npm run verify --silent"
|
||||
],
|
||||
"prepush": [
|
||||
"npm run verify --silent"
|
||||
],
|
||||
"scripts": {
|
||||
"eslint": "eslint --cache --cache-location=node_modules/.cache/ ./src/**/*.js ./test/**/*.js",
|
||||
"clean": "rimraf ./node_modules ./package-lock.json ./yarn.lock ./coverage",
|
||||
"eslint-fix": "npm run eslint -- --fix",
|
||||
"autofix": "npm run eslint-fix",
|
||||
"check": "npm run eslint",
|
||||
"verify": "npm run eslint && npm run test:cache",
|
||||
"test:cache": "c8 mocha -R spec test/specs",
|
||||
"test:ci:cache": "c8 --reporter=lcov mocha -R spec test/specs",
|
||||
"test": "npm run verify --silent",
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"keywords": [
|
||||
"json cache",
|
||||
"simple cache",
|
||||
"file cache",
|
||||
"key par",
|
||||
"key value",
|
||||
"cache"
|
||||
],
|
||||
"devDependencies": {
|
||||
"c8": "^9.1.0",
|
||||
"chai": "^4.3.10",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-mocha": "^10.2.0",
|
||||
"glob-expand": "^0.2.1",
|
||||
"mocha": "^10.3.0",
|
||||
"prettier": "^3.2.4",
|
||||
"rimraf": "^5.0.5",
|
||||
"sinon": "^17.0.1",
|
||||
"write": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"flatted": "^3.2.9",
|
||||
"keyv": "^4.5.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const minor = (a, loose) => new SemVer(a, loose).minor
|
||||
module.exports = minor
|
||||
@@ -0,0 +1,14 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = isValidDate
|
||||
|
||||
/**
|
||||
* Checks if the argument is a JS Date and not 'Invalid Date'.
|
||||
*
|
||||
* @param {Date} date The date to check.
|
||||
*
|
||||
* @returns {boolean} true if the argument is a JS Date and not 'Invalid Date'.
|
||||
*/
|
||||
function isValidDate (date) {
|
||||
return date instanceof Date && !Number.isNaN(date.getTime())
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Emitter = exports.Event = void 0;
|
||||
const ral_1 = __importDefault(require("./ral"));
|
||||
var Event;
|
||||
(function (Event) {
|
||||
const _disposable = { dispose() { } };
|
||||
Event.None = function () { return _disposable; };
|
||||
})(Event || (exports.Event = Event = {}));
|
||||
class CallbackList {
|
||||
_callbacks;
|
||||
_contexts;
|
||||
add(callback, context = null, bucket) {
|
||||
if (!this._callbacks) {
|
||||
this._callbacks = [];
|
||||
this._contexts = [];
|
||||
}
|
||||
this._callbacks.push(callback);
|
||||
this._contexts.push(context);
|
||||
if (Array.isArray(bucket)) {
|
||||
bucket.push({ dispose: () => this.remove(callback, context) });
|
||||
}
|
||||
}
|
||||
remove(callback, context = null) {
|
||||
if (!this._callbacks) {
|
||||
return;
|
||||
}
|
||||
let foundCallbackWithDifferentContext = false;
|
||||
for (let i = 0, len = this._callbacks.length; i < len; i++) {
|
||||
if (this._callbacks[i] === callback) {
|
||||
if (this._contexts[i] === context) {
|
||||
// callback & context match => remove it
|
||||
this._callbacks.splice(i, 1);
|
||||
this._contexts.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
foundCallbackWithDifferentContext = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (foundCallbackWithDifferentContext) {
|
||||
throw new Error('When adding a listener with a context, you should remove it with the same context');
|
||||
}
|
||||
}
|
||||
invoke(...args) {
|
||||
if (!this._callbacks) {
|
||||
return [];
|
||||
}
|
||||
const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
|
||||
for (let i = 0, len = callbacks.length; i < len; i++) {
|
||||
try {
|
||||
ret.push(callbacks[i].apply(contexts[i], args));
|
||||
}
|
||||
catch (e) {
|
||||
(0, ral_1.default)().console.error(e);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
isEmpty() {
|
||||
return !this._callbacks || this._callbacks.length === 0;
|
||||
}
|
||||
dispose() {
|
||||
this._callbacks = undefined;
|
||||
this._contexts = undefined;
|
||||
}
|
||||
}
|
||||
class Emitter {
|
||||
_options;
|
||||
static _noop = function () { };
|
||||
_event;
|
||||
_callbacks;
|
||||
constructor(_options) {
|
||||
this._options = _options;
|
||||
}
|
||||
/**
|
||||
* For the public to allow to subscribe
|
||||
* to events from this Emitter
|
||||
*/
|
||||
get event() {
|
||||
if (!this._event) {
|
||||
this._event = (listener, thisArgs, disposables) => {
|
||||
if (!this._callbacks) {
|
||||
this._callbacks = new CallbackList();
|
||||
}
|
||||
if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
|
||||
this._options.onFirstListenerAdd(this);
|
||||
}
|
||||
this._callbacks.add(listener, thisArgs);
|
||||
const result = {
|
||||
dispose: () => {
|
||||
if (!this._callbacks) {
|
||||
// disposable is disposed after emitter is disposed.
|
||||
return;
|
||||
}
|
||||
this._callbacks.remove(listener, thisArgs);
|
||||
result.dispose = Emitter._noop;
|
||||
if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
|
||||
this._options.onLastListenerRemove(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (Array.isArray(disposables)) {
|
||||
disposables.push(result);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
return this._event;
|
||||
}
|
||||
/**
|
||||
* To be kept private to fire an event to
|
||||
* subscribers
|
||||
*/
|
||||
fire(event) {
|
||||
if (this._callbacks) {
|
||||
this._callbacks.invoke.call(this._callbacks, event);
|
||||
}
|
||||
}
|
||||
dispose() {
|
||||
if (this._callbacks) {
|
||||
this._callbacks.dispose();
|
||||
this._callbacks = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Emitter = Emitter;
|
||||
@@ -0,0 +1,102 @@
|
||||
export type IncludeIgnoreFileOptionsObject = {
|
||||
/**
|
||||
* Whether to interpret the contents of an ignore file relative to the config file or the ignore file.
|
||||
* - gitignoreResolution: false (default): Interprets ignore patterns relative to the config file
|
||||
* - gitignoreResolution: true: Interprets the ignore patterns in a file relative to the ignore file
|
||||
*/
|
||||
gitignoreResolution?: boolean;
|
||||
/**
|
||||
* The name to give the output config object(s).
|
||||
*/
|
||||
name?: string;
|
||||
};
|
||||
/**
|
||||
* Options for `includeIgnoreFile()`. May be provided as an object or, for
|
||||
* legacy compatibility with `@eslint/compat`, as a string which is treated as
|
||||
* the `name` option.
|
||||
*/
|
||||
export type IncludeIgnoreFileOptions = IncludeIgnoreFileOptionsObject | string;
|
||||
export type ConfigObject = $eslintcore.ConfigObject;
|
||||
export type LegacyConfig = $eslintcore.LegacyConfigObject;
|
||||
export type Plugin = $eslintcore.Plugin;
|
||||
export type RuleConfig = $eslintcore.RuleConfig;
|
||||
export type Config = $typests.Config;
|
||||
export type ExtendsElement = $typests.ExtendsElement;
|
||||
export type ExtensionConfigObject = $typests.ExtensionConfigObject;
|
||||
export type SimpleExtendsElement = $typests.SimpleExtendsElement;
|
||||
export type ConfigWithExtends = $typests.ConfigWithExtends;
|
||||
export type InfiniteConfigArray = $typests.InfiniteArray<ConfigObject>;
|
||||
export type ConfigWithExtendsArray = $typests.ConfigWithExtendsArray;
|
||||
/**
|
||||
* @fileoverview Ignore file utilities for the config-helpers package.
|
||||
* This file was forked from the source code for the compat package.
|
||||
*
|
||||
* @author Nicholas C. Zakas
|
||||
* @author Kirk Waiblinger
|
||||
*/
|
||||
/**
|
||||
* @typedef {object} IncludeIgnoreFileOptionsObject
|
||||
* @property {boolean} [gitignoreResolution] Whether to interpret the contents of an ignore file relative to the config file or the ignore file.
|
||||
* - gitignoreResolution: false (default): Interprets ignore patterns relative to the config file
|
||||
* - gitignoreResolution: true: Interprets the ignore patterns in a file relative to the ignore file
|
||||
* @property {string} [name] The name to give the output config object(s).
|
||||
*/
|
||||
/**
|
||||
* Options for `includeIgnoreFile()`. May be provided as an object or, for
|
||||
* legacy compatibility with `@eslint/compat`, as a string which is treated as
|
||||
* the `name` option.
|
||||
* @typedef {IncludeIgnoreFileOptionsObject | string} IncludeIgnoreFileOptions
|
||||
*/
|
||||
/**
|
||||
* Converts an ESLint ignore pattern to a minimatch pattern.
|
||||
* @param {string} pattern The .eslintignore or .gitignore pattern to convert.
|
||||
* @returns {string} The converted pattern.
|
||||
*/
|
||||
export function convertIgnorePatternToMinimatch(pattern: string): string;
|
||||
/**
|
||||
* Helper function to define a config array.
|
||||
* @param {ConfigWithExtendsArray} args The arguments to the function.
|
||||
* @returns {ConfigObject[]} The config array.
|
||||
* @throws {TypeError} If no arguments are provided or if an argument is not an object.
|
||||
*/
|
||||
export function defineConfig(...args: ConfigWithExtendsArray): ConfigObject[];
|
||||
/**
|
||||
* Creates a global ignores config with the given patterns.
|
||||
* @param {string[]} ignorePatterns The ignore patterns.
|
||||
* @param {string} [name] The name of the global ignores config.
|
||||
* @returns {ConfigObject} The global ignores config.
|
||||
* @throws {TypeError} If ignorePatterns is not an array or if it is empty.
|
||||
*/
|
||||
export function globalIgnores(ignorePatterns: string[], name?: string): ConfigObject;
|
||||
/**
|
||||
* @overload
|
||||
*
|
||||
* Reads ignore files and returns objects with the ignore patterns.
|
||||
*
|
||||
* @param {string[]} ignoreFilePathArg The paths of ignore files to include.
|
||||
* @param {IncludeIgnoreFileOptions} [options]
|
||||
* @returns {ConfigObject[]}
|
||||
*/
|
||||
export function includeIgnoreFile(ignoreFilePathArg: string[], options?: IncludeIgnoreFileOptions): ConfigObject[];
|
||||
/**
|
||||
* @overload
|
||||
*
|
||||
* Reads an ignore file and returns an object with the ignore patterns.
|
||||
*
|
||||
* @param {string} ignoreFilePathArg The path of the ignore file to include.
|
||||
* @param {IncludeIgnoreFileOptions} [options]
|
||||
* @returns {ConfigObject}
|
||||
*/
|
||||
export function includeIgnoreFile(ignoreFilePathArg: string, options?: IncludeIgnoreFileOptions): ConfigObject;
|
||||
/**
|
||||
* @overload
|
||||
*
|
||||
* Reads an ignore file(s) and returns an object(s) with the ignore patterns.
|
||||
*
|
||||
* @param {string[] | string} ignoreFilePathArg The path(s) of the ignore file(s) to include.
|
||||
* @param {IncludeIgnoreFileOptions} [options]
|
||||
* @returns {ConfigObject[] | ConfigObject}
|
||||
*/
|
||||
export function includeIgnoreFile(ignoreFilePathArg: string[] | string, options?: IncludeIgnoreFileOptions): ConfigObject[] | ConfigObject;
|
||||
import type * as $eslintcore from "@eslint/core";
|
||||
import type * as $typests from "./types.ts";
|
||||
@@ -0,0 +1,291 @@
|
||||
var path = require('path');
|
||||
var crypto = require('crypto');
|
||||
|
||||
module.exports = {
|
||||
createFromFile: function (filePath, useChecksum) {
|
||||
var fname = path.basename(filePath);
|
||||
var dir = path.dirname(filePath);
|
||||
return this.create(fname, dir, useChecksum);
|
||||
},
|
||||
|
||||
create: function (cacheId, _path, useChecksum) {
|
||||
var fs = require('fs');
|
||||
var flatCache = require('flat-cache');
|
||||
var cache = flatCache.load(cacheId, _path);
|
||||
var normalizedEntries = {};
|
||||
|
||||
var removeNotFoundFiles = function removeNotFoundFiles() {
|
||||
const cachedEntries = cache.keys();
|
||||
// remove not found entries
|
||||
cachedEntries.forEach(function remover(fPath) {
|
||||
try {
|
||||
fs.statSync(fPath);
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
cache.removeKey(fPath);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
removeNotFoundFiles();
|
||||
|
||||
return {
|
||||
/**
|
||||
* the flat cache storage used to persist the metadata of the `files
|
||||
* @type {Object}
|
||||
*/
|
||||
cache: cache,
|
||||
|
||||
/**
|
||||
* Given a buffer, calculate md5 hash of its content.
|
||||
* @method getHash
|
||||
* @param {Buffer} buffer buffer to calculate hash on
|
||||
* @return {String} content hash digest
|
||||
*/
|
||||
getHash: function (buffer) {
|
||||
return crypto.createHash('md5').update(buffer).digest('hex');
|
||||
},
|
||||
|
||||
/**
|
||||
* Return whether or not a file has changed since last time reconcile was called.
|
||||
* @method hasFileChanged
|
||||
* @param {String} file the filepath to check
|
||||
* @return {Boolean} wheter or not the file has changed
|
||||
*/
|
||||
hasFileChanged: function (file) {
|
||||
return this.getFileDescriptor(file).changed;
|
||||
},
|
||||
|
||||
/**
|
||||
* given an array of file paths it return and object with three arrays:
|
||||
* - changedFiles: Files that changed since previous run
|
||||
* - notChangedFiles: Files that haven't change
|
||||
* - notFoundFiles: Files that were not found, probably deleted
|
||||
*
|
||||
* @param {Array} files the files to analyze and compare to the previous seen files
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
analyzeFiles: function (files) {
|
||||
var me = this;
|
||||
files = files || [];
|
||||
|
||||
var res = {
|
||||
changedFiles: [],
|
||||
notFoundFiles: [],
|
||||
notChangedFiles: [],
|
||||
};
|
||||
|
||||
me.normalizeEntries(files).forEach(function (entry) {
|
||||
if (entry.changed) {
|
||||
res.changedFiles.push(entry.key);
|
||||
return;
|
||||
}
|
||||
if (entry.notFound) {
|
||||
res.notFoundFiles.push(entry.key);
|
||||
return;
|
||||
}
|
||||
res.notChangedFiles.push(entry.key);
|
||||
});
|
||||
return res;
|
||||
},
|
||||
|
||||
getFileDescriptor: function (file) {
|
||||
var fstat;
|
||||
|
||||
try {
|
||||
fstat = fs.statSync(file);
|
||||
} catch (ex) {
|
||||
this.removeEntry(file);
|
||||
return { key: file, notFound: true, err: ex };
|
||||
}
|
||||
|
||||
if (useChecksum) {
|
||||
return this._getFileDescriptorUsingChecksum(file);
|
||||
}
|
||||
|
||||
return this._getFileDescriptorUsingMtimeAndSize(file, fstat);
|
||||
},
|
||||
|
||||
_getFileDescriptorUsingMtimeAndSize: function (file, fstat) {
|
||||
var meta = cache.getKey(file);
|
||||
var cacheExists = !!meta;
|
||||
|
||||
var cSize = fstat.size;
|
||||
var cTime = fstat.mtime.getTime();
|
||||
|
||||
var isDifferentDate;
|
||||
var isDifferentSize;
|
||||
|
||||
if (!meta) {
|
||||
meta = { size: cSize, mtime: cTime };
|
||||
} else {
|
||||
isDifferentDate = cTime !== meta.mtime;
|
||||
isDifferentSize = cSize !== meta.size;
|
||||
}
|
||||
|
||||
var nEntry = (normalizedEntries[file] = {
|
||||
key: file,
|
||||
changed: !cacheExists || isDifferentDate || isDifferentSize,
|
||||
meta: meta,
|
||||
});
|
||||
|
||||
return nEntry;
|
||||
},
|
||||
|
||||
_getFileDescriptorUsingChecksum: function (file) {
|
||||
var meta = cache.getKey(file);
|
||||
var cacheExists = !!meta;
|
||||
|
||||
var contentBuffer;
|
||||
try {
|
||||
contentBuffer = fs.readFileSync(file);
|
||||
} catch (ex) {
|
||||
contentBuffer = '';
|
||||
}
|
||||
|
||||
var isDifferent = true;
|
||||
var hash = this.getHash(contentBuffer);
|
||||
|
||||
if (!meta) {
|
||||
meta = { hash: hash };
|
||||
} else {
|
||||
isDifferent = hash !== meta.hash;
|
||||
}
|
||||
|
||||
var nEntry = (normalizedEntries[file] = {
|
||||
key: file,
|
||||
changed: !cacheExists || isDifferent,
|
||||
meta: meta,
|
||||
});
|
||||
|
||||
return nEntry;
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the list o the files that changed compared
|
||||
* against the ones stored in the cache
|
||||
*
|
||||
* @method getUpdated
|
||||
* @param files {Array} the array of files to compare against the ones in the cache
|
||||
* @returns {Array}
|
||||
*/
|
||||
getUpdatedFiles: function (files) {
|
||||
var me = this;
|
||||
files = files || [];
|
||||
|
||||
return me
|
||||
.normalizeEntries(files)
|
||||
.filter(function (entry) {
|
||||
return entry.changed;
|
||||
})
|
||||
.map(function (entry) {
|
||||
return entry.key;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* return the list of files
|
||||
* @method normalizeEntries
|
||||
* @param files
|
||||
* @returns {*}
|
||||
*/
|
||||
normalizeEntries: function (files) {
|
||||
files = files || [];
|
||||
|
||||
var me = this;
|
||||
var nEntries = files.map(function (file) {
|
||||
return me.getFileDescriptor(file);
|
||||
});
|
||||
|
||||
//normalizeEntries = nEntries;
|
||||
return nEntries;
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove an entry from the file-entry-cache. Useful to force the file to still be considered
|
||||
* modified the next time the process is run
|
||||
*
|
||||
* @method removeEntry
|
||||
* @param entryName
|
||||
*/
|
||||
removeEntry: function (entryName) {
|
||||
delete normalizedEntries[entryName];
|
||||
cache.removeKey(entryName);
|
||||
},
|
||||
|
||||
/**
|
||||
* Delete the cache file from the disk
|
||||
* @method deleteCacheFile
|
||||
*/
|
||||
deleteCacheFile: function () {
|
||||
cache.removeCacheFile();
|
||||
},
|
||||
|
||||
/**
|
||||
* remove the cache from the file and clear the memory cache
|
||||
*/
|
||||
destroy: function () {
|
||||
normalizedEntries = {};
|
||||
cache.destroy();
|
||||
},
|
||||
|
||||
_getMetaForFileUsingCheckSum: function (cacheEntry) {
|
||||
var contentBuffer = fs.readFileSync(cacheEntry.key);
|
||||
var hash = this.getHash(contentBuffer);
|
||||
var meta = Object.assign(cacheEntry.meta, { hash: hash });
|
||||
delete meta.size;
|
||||
delete meta.mtime;
|
||||
return meta;
|
||||
},
|
||||
|
||||
_getMetaForFileUsingMtimeAndSize: function (cacheEntry) {
|
||||
var stat = fs.statSync(cacheEntry.key);
|
||||
var meta = Object.assign(cacheEntry.meta, {
|
||||
size: stat.size,
|
||||
mtime: stat.mtime.getTime(),
|
||||
});
|
||||
delete meta.hash;
|
||||
return meta;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sync the files and persist them to the cache
|
||||
* @method reconcile
|
||||
*/
|
||||
reconcile: function (noPrune) {
|
||||
removeNotFoundFiles();
|
||||
|
||||
noPrune = typeof noPrune === 'undefined' ? true : noPrune;
|
||||
|
||||
var entries = normalizedEntries;
|
||||
var keys = Object.keys(entries);
|
||||
|
||||
if (keys.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var me = this;
|
||||
|
||||
keys.forEach(function (entryName) {
|
||||
var cacheEntry = entries[entryName];
|
||||
|
||||
try {
|
||||
var meta = useChecksum
|
||||
? me._getMetaForFileUsingCheckSum(cacheEntry)
|
||||
: me._getMetaForFileUsingMtimeAndSize(cacheEntry);
|
||||
cache.setKey(entryName, meta);
|
||||
} catch (err) {
|
||||
// if the file does not exists we don't save it
|
||||
// other errors are just thrown
|
||||
if (err.code !== 'ENOENT') {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cache.save(noPrune);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
function _usingCtx() {
|
||||
var r = "function" == typeof SuppressedError ? SuppressedError : function (r, e) {
|
||||
var n = Error();
|
||||
return n.name = "SuppressedError", n.error = r, n.suppressed = e, n;
|
||||
},
|
||||
e = {},
|
||||
n = [];
|
||||
function using(r, e) {
|
||||
if (null != e) {
|
||||
if (Object(e) !== e) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
||||
if (r) var o = e[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
|
||||
if (void 0 === o && (o = e[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r)) var t = o;
|
||||
if ("function" != typeof o) throw new TypeError("Object is not disposable.");
|
||||
t && (o = function o() {
|
||||
try {
|
||||
t.call(e);
|
||||
} catch (r) {
|
||||
return Promise.reject(r);
|
||||
}
|
||||
}), n.push({
|
||||
v: e,
|
||||
d: o,
|
||||
a: r
|
||||
});
|
||||
} else r && n.push({
|
||||
d: e,
|
||||
a: r
|
||||
});
|
||||
return e;
|
||||
}
|
||||
return {
|
||||
e: e,
|
||||
u: using.bind(null, !1),
|
||||
a: using.bind(null, !0),
|
||||
d: function d() {
|
||||
var o,
|
||||
t = this.e,
|
||||
s = 0;
|
||||
function next() {
|
||||
for (; o = n.pop();) try {
|
||||
if (!o.a && 1 === s) return s = 0, n.push(o), Promise.resolve().then(next);
|
||||
if (o.d) {
|
||||
var r = o.d.call(o.v);
|
||||
if (o.a) return s |= 2, Promise.resolve(r).then(next, err);
|
||||
} else s |= 1;
|
||||
} catch (r) {
|
||||
return err(r);
|
||||
}
|
||||
if (1 === s) return t !== e ? Promise.reject(t) : Promise.resolve();
|
||||
if (t !== e) throw t;
|
||||
}
|
||||
function err(n) {
|
||||
return t = t !== e ? new r(n, t) : n, next();
|
||||
}
|
||||
return next();
|
||||
}
|
||||
};
|
||||
}
|
||||
module.exports = _usingCtx, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,72 @@
|
||||
'use strict';
|
||||
|
||||
const tls = require('tls');
|
||||
const utils = require('../utils');
|
||||
|
||||
/**
|
||||
* Constructor for a Jayson TLS-encrypted TCP server
|
||||
* @class ServerTls
|
||||
* @extends require('tls').Server
|
||||
* @param {Server} server Server instance
|
||||
* @param {Object} [options] Options for this instance
|
||||
* @return {ServerTls}
|
||||
*/
|
||||
const ServerTls = function(server, options) {
|
||||
if(!(this instanceof ServerTls)) {
|
||||
return new ServerTls(server, options);
|
||||
}
|
||||
|
||||
this.options = utils.merge(server.options, options || {});
|
||||
|
||||
tls.Server.call(this, this.options, getTlsListener(this, server));
|
||||
};
|
||||
require('util').inherits(ServerTls, tls.Server);
|
||||
|
||||
module.exports = ServerTls;
|
||||
|
||||
/**
|
||||
* Returns a TLS-encrypted TCP connection listener bound to the server in the argument.
|
||||
* @param {Server} server Instance of JaysonServer
|
||||
* @param {tls.Server} self Instance of tls.Server
|
||||
* @return {Function}
|
||||
* @private
|
||||
* @ignore
|
||||
*/
|
||||
function getTlsListener(self, server) {
|
||||
return function(conn) {
|
||||
const options = self.options || {};
|
||||
|
||||
utils.parseStream(conn, options, function(err, request) {
|
||||
if(err) {
|
||||
return respondError(err);
|
||||
}
|
||||
|
||||
server.call(request, function(error, success) {
|
||||
const response = error || success;
|
||||
if(response) {
|
||||
utils.JSON.stringify(response, options, function(err, body) {
|
||||
if(err) {
|
||||
return respondError(err);
|
||||
}
|
||||
conn.write(body);
|
||||
});
|
||||
} else {
|
||||
// no response received at all, must be a notification
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ends the request with an error code
|
||||
function respondError(err) {
|
||||
const error = server.error(-32700, null, String(err));
|
||||
const response = utils.response(error, undefined, undefined, self.options.version);
|
||||
utils.JSON.stringify(response, options, function(err, body) {
|
||||
if(err) {
|
||||
body = ''; // we tried our best.
|
||||
}
|
||||
conn.end(body);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import * as util from "../core/util.js";
|
||||
const error = () => {
|
||||
const Sizable = {
|
||||
string: { unit: "Zeichen", verb: "zu haben" },
|
||||
file: { unit: "Bytes", verb: "zu haben" },
|
||||
array: { unit: "Elemente", verb: "zu haben" },
|
||||
set: { unit: "Elemente", verb: "zu haben" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const FormatDictionary = {
|
||||
regex: "Eingabe",
|
||||
email: "E-Mail-Adresse",
|
||||
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 und -Uhrzeit",
|
||||
date: "ISO-Datum",
|
||||
time: "ISO-Uhrzeit",
|
||||
duration: "ISO-Dauer",
|
||||
ipv4: "IPv4-Adresse",
|
||||
ipv6: "IPv6-Adresse",
|
||||
cidrv4: "IPv4-Bereich",
|
||||
cidrv6: "IPv6-Bereich",
|
||||
base64: "Base64-codierter String",
|
||||
base64url: "Base64-URL-codierter String",
|
||||
json_string: "JSON-String",
|
||||
e164: "E.164-Nummer",
|
||||
jwt: "JWT",
|
||||
template_literal: "Eingabe",
|
||||
};
|
||||
const TypeDictionary = {
|
||||
nan: "NaN",
|
||||
number: "Zahl",
|
||||
array: "Array",
|
||||
};
|
||||
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 `Ungültige Eingabe: erwartet instanceof ${issue.expected}, erhalten ${received}`;
|
||||
}
|
||||
return `Ungültige Eingabe: erwartet ${expected}, erhalten ${received}`;
|
||||
}
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `Ungültige Eingabe: erwartet ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Ungültige Option: erwartet eine von ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Zu groß: erwartet, dass ${issue.origin ?? "Wert"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "Elemente"} hat`;
|
||||
return `Zu groß: erwartet, dass ${issue.origin ?? "Wert"} ${adj}${issue.maximum.toString()} ist`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Zu klein: erwartet, dass ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} hat`;
|
||||
}
|
||||
return `Zu klein: erwartet, dass ${issue.origin} ${adj}${issue.minimum.toString()} ist`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with")
|
||||
return `Ungültiger String: muss mit "${_issue.prefix}" beginnen`;
|
||||
if (_issue.format === "ends_with")
|
||||
return `Ungültiger String: muss mit "${_issue.suffix}" enden`;
|
||||
if (_issue.format === "includes")
|
||||
return `Ungültiger String: muss "${_issue.includes}" enthalten`;
|
||||
if (_issue.format === "regex")
|
||||
return `Ungültiger String: muss dem Muster ${_issue.pattern} entsprechen`;
|
||||
return `Ungültig: ${FormatDictionary[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Ungültige Zahl: muss ein Vielfaches von ${issue.divisor} sein`;
|
||||
case "unrecognized_keys":
|
||||
return `${issue.keys.length > 1 ? "Unbekannte Schlüssel" : "Unbekannter Schlüssel"}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Ungültiger Schlüssel in ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return "Ungültige Eingabe";
|
||||
case "invalid_element":
|
||||
return `Ungültiger Wert in ${issue.origin}`;
|
||||
default:
|
||||
return `Ungültige Eingabe`;
|
||||
}
|
||||
};
|
||||
};
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error(),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./lib/picomatch');
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { TSESLint } from '@typescript-eslint/utils';
|
||||
export type Options = [];
|
||||
export type MessageIds = 'useTopLevelQualifier';
|
||||
declare const _default: TSESLint.RuleModule<"useTopLevelQualifier", [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
export default _default;
|
||||
@@ -0,0 +1,6 @@
|
||||
function _class_extract_field_descriptor(receiver, privateMap, action) {
|
||||
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
|
||||
|
||||
return privateMap.get(receiver);
|
||||
}
|
||||
export { _class_extract_field_descriptor as _ };
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"main": "../../cjs/_class_check_private_static_access.cjs",
|
||||
"module": "../../esm/_class_check_private_static_access.js"
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
import type { $ZodStringFormats } from "../core/checks.js";
|
||||
import type * as errors from "../core/errors.js";
|
||||
import * as util from "../core/util.js";
|
||||
|
||||
const error: () => errors.$ZodErrorMap = () => {
|
||||
const Sizable: Record<string, { unit: string; verb: string }> = {
|
||||
string: { unit: "characters", verb: "to have" },
|
||||
file: { unit: "bytes", verb: "to have" },
|
||||
array: { unit: "items", verb: "to have" },
|
||||
set: { unit: "items", verb: "to have" },
|
||||
map: { unit: "entries", verb: "to have" },
|
||||
};
|
||||
|
||||
function getSizing(origin: string): { unit: string; verb: string } | null {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
|
||||
const FormatDictionary: {
|
||||
[k in $ZodStringFormats | (string & {})]?: string;
|
||||
} = {
|
||||
regex: "input",
|
||||
email: "email address",
|
||||
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 datetime",
|
||||
date: "ISO date",
|
||||
time: "ISO time",
|
||||
duration: "ISO duration",
|
||||
ipv4: "IPv4 address",
|
||||
ipv6: "IPv6 address",
|
||||
mac: "MAC address",
|
||||
cidrv4: "IPv4 range",
|
||||
cidrv6: "IPv6 range",
|
||||
base64: "base64-encoded string",
|
||||
base64url: "base64url-encoded string",
|
||||
json_string: "JSON string",
|
||||
e164: "E.164 number",
|
||||
jwt: "JWT",
|
||||
template_literal: "input",
|
||||
};
|
||||
|
||||
// type names: missing keys = do not translate (use raw value via ?? fallback)
|
||||
const TypeDictionary: {
|
||||
[k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;
|
||||
} = {
|
||||
// Compatibility: "nan" -> "NaN" for display
|
||||
nan: "NaN",
|
||||
// All other type names omitted - they fall back to raw values via ?? operator
|
||||
};
|
||||
|
||||
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;
|
||||
return `Invalid input: expected ${expected}, received ${received}`;
|
||||
}
|
||||
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1) return `Invalid input: expected ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `Invalid option: expected one of ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
||||
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
|
||||
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue as errors.$ZodStringFormatIssues;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `Invalid string: must start with "${_issue.prefix}"`;
|
||||
}
|
||||
if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
|
||||
if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
|
||||
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `Invalid number: must be a multiple of ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `Invalid key in ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
|
||||
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
|
||||
return `Invalid discriminator value. Expected ${opts}`;
|
||||
}
|
||||
return "Invalid input";
|
||||
case "invalid_element":
|
||||
return `Invalid value in ${issue.origin}`;
|
||||
default:
|
||||
return `Invalid input`;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export default function (): { localeError: errors.$ZodErrorMap } {
|
||||
return {
|
||||
localeError: error(),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
|
||||
// npx nx generate-lib repo
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.es2024_regexp = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
exports.es2024_regexp = {
|
||||
libs: [],
|
||||
variables: [['RegExp', base_config_1.TYPE]],
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `pnpm run generate-configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
'error',
|
||||
{ minimumDescriptionLength: 10 },
|
||||
],
|
||||
'no-array-constructor': 'off',
|
||||
'@typescript-eslint/no-array-constructor': 'error',
|
||||
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
||||
'@typescript-eslint/no-dynamic-delete': 'error',
|
||||
'@typescript-eslint/no-empty-object-type': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-extraneous-class': 'error',
|
||||
'@typescript-eslint/no-invalid-void-type': 'error',
|
||||
'@typescript-eslint/no-misused-new': 'error',
|
||||
'@typescript-eslint/no-namespace': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-require-imports': 'error',
|
||||
'@typescript-eslint/no-this-alias': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
||||
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
||||
'@typescript-eslint/no-unsafe-function-type': 'error',
|
||||
'no-unused-expressions': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'error',
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
'no-useless-constructor': 'off',
|
||||
'@typescript-eslint/no-useless-constructor': 'error',
|
||||
'@typescript-eslint/no-wrapper-object-types': 'error',
|
||||
'@typescript-eslint/prefer-as-const': 'error',
|
||||
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
||||
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
||||
'@typescript-eslint/triple-slash-reference': 'error',
|
||||
'@typescript-eslint/unified-signatures': 'error',
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user