WIP: bootstrap and partial real Solana watcher implementation

This commit is contained in:
2026-08-16 09:17:45 +00:00
commit dc23412c3f
7232 changed files with 1687637 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
"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.es2022_full = void 0;
const dom_1 = require("./dom");
const dom_asynciterable_1 = require("./dom.asynciterable");
const dom_iterable_1 = require("./dom.iterable");
const es2022_1 = require("./es2022");
const scripthost_1 = require("./scripthost");
const webworker_importscripts_1 = require("./webworker.importscripts");
exports.es2022_full = {
libs: [
es2022_1.es2022,
dom_1.dom,
webworker_importscripts_1.webworker_importscripts,
scripthost_1.scripthost,
dom_iterable_1.dom_iterable,
dom_asynciterable_1.dom_asynciterable,
],
variables: [],
};

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WithScope = void 0;
const assert_1 = require("../assert");
const ScopeBase_1 = require("./ScopeBase");
const ScopeType_1 = require("./ScopeType");
class WithScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.with, upperScope, block, false);
}
close(scopeManager) {
if (this.shouldStaticallyClose()) {
return super.close(scopeManager);
}
(0, assert_1.assert)(this.leftToResolve);
this.leftToResolve.forEach(ref => this.delegateToUpperScope(ref));
this.leftToResolve = null;
return this.upper;
}
}
exports.WithScope = WithScope;

View File

@@ -0,0 +1 @@
{"version":3,"file":"characterCodes.enum.js","sourceRoot":"","sources":["../../src/enums/characterCodes.enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cA0IX;AA1ID,WAAY,cAAc;IACtB,kDAAQ,CAAA;IACR,qEAAiB,CAAA;IACjB,+EAAwB,CAAA;IAExB,4DAAe,CAAA;IACf,wEAAqB,CAAA;IACrB,wEAAsB,CAAA;IACtB,kFAA2B,CAAA;IAC3B,6DAAiB,CAAA;IAEjB,+BAA+B;IAC/B,sDAAc,CAAA;IACd,6EAAyB,CAAA;IACzB,0DAAe,CAAA;IACf,0DAAe,CAAA;IACf,4DAAgB,CAAA;IAChB,4DAAgB,CAAA;IAChB,4EAAwB,CAAA;IACxB,0EAAuB,CAAA;IACvB,wEAAsB,CAAA;IACtB,oEAAoB,CAAA;IACpB,8EAAyB,CAAA;IACzB,gEAAkB,CAAA;IAClB,gEAAkB,CAAA;IAClB,0EAAuB,CAAA;IACvB,kFAA2B,CAAA;IAC3B,+EAAyB,CAAA;IACzB,gFAA0B,CAAA;IAC1B,wDAAc,CAAA;IAEd,yEAAyE;IACzE,uFAA6B,CAAA;IAE7B,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IAER,gDAAS,CAAA;IACT,gDAAS,CAAA;IACT,gDAAS,CAAA;IACT,gDAAS,CAAA;IACT,gDAAS,CAAA;IACT,gDAAS,CAAA;IACT,gDAAS,CAAA;IACT,gDAAS,CAAA;IACT,gDAAS,CAAA;IACT,gDAAS,CAAA;IAET,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IAER,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IACR,8CAAQ,CAAA;IAER,8DAAgB,CAAA;IAChB,4DAAe,CAAA;IACf,gDAAS,CAAA;IACT,8DAAgB,CAAA;IAChB,4DAAe,CAAA;IACf,mDAAU,CAAA;IACV,sDAAY,CAAA;IACZ,iEAAiB,CAAA;IACjB,oEAAmB,CAAA;IACnB,gEAAiB,CAAA;IACjB,sDAAY,CAAA;IACZ,sDAAY,CAAA;IACZ,kDAAU,CAAA;IACV,kEAAkB,CAAA;IAClB,wDAAa,CAAA;IACb,kEAAkB,CAAA;IAClB,kEAAkB,CAAA;IAClB,oDAAW,CAAA;IACX,4DAAe,CAAA;IACf,sDAAY,CAAA;IACZ,+DAAgB,CAAA;IAChB,kEAAkB,CAAA;IAClB,8DAAgB,CAAA;IAChB,0DAAc,CAAA;IACd,oDAAW,CAAA;IACX,4DAAe,CAAA;IACf,8DAAgB,CAAA;IAChB,kEAAkB,CAAA;IAClB,sDAAY,CAAA;IACZ,uDAAY,CAAA;IAEZ,6DAAgB,CAAA;IAChB,4DAAe,CAAA;IACf,yEAAsB,CAAA;IACtB,iDAAU,CAAA;IACV,kEAAkB,CAAA;AACtB,CAAC,EA1IW,cAAc,KAAd,cAAc,QA0IzB"}

View File

@@ -0,0 +1,387 @@
/**
* @fileoverview Disallow redundant return statements
* @author Teddy Katz
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils"),
FixTracker = require("./utils/fix-tracker");
const { isAnySegmentReachable } = require("./utils/code-path-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Removes the given element from the array.
* @param {Array} array The source array to remove.
* @param {any} element The target item to remove.
* @returns {void}
*/
function remove(array, element) {
const index = array.indexOf(element);
if (index !== -1) {
array.splice(index, 1);
}
}
/**
* Checks whether it can remove the given return statement or not.
* @param {ASTNode} node The return statement node to check.
* @returns {boolean} `true` if the node is removable.
*/
function isRemovable(node) {
return astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type);
}
/**
* Checks whether the given return statement is in a `finally` block or not.
* @param {ASTNode} node The return statement node to check.
* @returns {boolean} `true` if the node is in a `finally` block.
*/
function isInFinally(node) {
for (
let currentNode = node;
currentNode && currentNode.parent && !astUtils.isFunction(currentNode);
currentNode = currentNode.parent
) {
if (
currentNode.parent.type === "TryStatement" &&
currentNode.parent.finalizer === currentNode
) {
return true;
}
}
return false;
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow redundant return statements",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-useless-return",
},
fixable: "code",
schema: [],
messages: {
unnecessaryReturn: "Unnecessary return statement.",
},
},
create(context) {
const segmentInfoMap = new WeakMap();
const sourceCode = context.sourceCode;
let scopeInfo = null;
/**
* Checks whether the given segment is terminated by a return statement or not.
* @param {CodePathSegment} segment The segment to check.
* @returns {boolean} `true` if the segment is terminated by a return statement, or if it's still a part of unreachable.
*/
function isReturned(segment) {
const info = segmentInfoMap.get(segment);
return !info || info.returned;
}
/**
* Collects useless return statements from the given previous segments.
*
* A previous segment may be an unreachable segment.
* In that case, the information object of the unreachable segment is not
* initialized because `onCodePathSegmentStart` event is not notified for
* unreachable segments.
* This goes to the previous segments of the unreachable segment recursively
* if the unreachable segment was generated by a return statement. Otherwise,
* this ignores the unreachable segment.
*
* This behavior would simulate code paths for the case that the return
* statement does not exist.
* @param {ASTNode[]} uselessReturns The collected return statements.
* @param {CodePathSegment[]} prevSegments The previous segments to traverse.
* @param {WeakSet<CodePathSegment>} [providedTraversedSegments] A set of segments that have already been traversed in this call
* @returns {ASTNode[]} `uselessReturns`.
*/
function getUselessReturns(
uselessReturns,
prevSegments,
providedTraversedSegments,
) {
const traversedSegments =
providedTraversedSegments || new WeakSet();
for (const segment of prevSegments) {
if (!segment.reachable) {
if (!traversedSegments.has(segment)) {
traversedSegments.add(segment);
getUselessReturns(
uselessReturns,
segment.allPrevSegments.filter(isReturned),
traversedSegments,
);
}
continue;
}
if (segmentInfoMap.has(segment)) {
uselessReturns.push(
...segmentInfoMap.get(segment).uselessReturns,
);
}
}
return uselessReturns;
}
/**
* Removes the return statements on the given segment from the useless return
* statement list.
*
* This segment may be an unreachable segment.
* In that case, the information object of the unreachable segment is not
* initialized because `onCodePathSegmentStart` event is not notified for
* unreachable segments.
* This goes to the previous segments of the unreachable segment recursively
* if the unreachable segment was generated by a return statement. Otherwise,
* this ignores the unreachable segment.
*
* This behavior would simulate code paths for the case that the return
* statement does not exist.
* @param {CodePathSegment} segment The segment to get return statements.
* @param {Set<CodePathSegment>} usedUnreachableSegments A set of segments that have already been traversed in this call.
* @returns {void}
*/
function markReturnStatementsOnSegmentAsUsed(
segment,
usedUnreachableSegments,
) {
if (!segment.reachable) {
usedUnreachableSegments.add(segment);
segment.allPrevSegments
.filter(isReturned)
.filter(
prevSegment =>
!usedUnreachableSegments.has(prevSegment),
)
.forEach(prevSegment =>
markReturnStatementsOnSegmentAsUsed(
prevSegment,
usedUnreachableSegments,
),
);
return;
}
const info = segmentInfoMap.get(segment);
if (!info) {
return;
}
info.uselessReturns = info.uselessReturns.filter(node => {
if (
scopeInfo.traversedTryBlockStatements &&
scopeInfo.traversedTryBlockStatements.length > 0
) {
const returnInitialRange = node.range[0];
const returnFinalRange = node.range[1];
const areBlocksInRange =
scopeInfo.traversedTryBlockStatements.some(
tryBlockStatement => {
const blockInitialRange =
tryBlockStatement.range[0];
const blockFinalRange =
tryBlockStatement.range[1];
return (
returnInitialRange >= blockInitialRange &&
returnFinalRange <= blockFinalRange
);
},
);
if (areBlocksInRange) {
return true;
}
}
remove(scopeInfo.uselessReturns, node);
return false;
});
}
/**
* Removes the return statements on the current segments from the useless
* return statement list.
*
* This function will be called at every statement except FunctionDeclaration,
* BlockStatement, and BreakStatement.
*
* - FunctionDeclarations are always executed whether it's returned or not.
* - BlockStatements do nothing.
* - BreakStatements go the next merely.
* @returns {void}
*/
function markReturnStatementsOnCurrentSegmentsAsUsed() {
scopeInfo.currentSegments.forEach(segment =>
markReturnStatementsOnSegmentAsUsed(segment, new Set()),
);
}
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------
return {
// Makes and pushes a new scope information.
onCodePathStart(codePath) {
scopeInfo = {
upper: scopeInfo,
uselessReturns: [],
traversedTryBlockStatements: [],
codePath,
currentSegments: new Set(),
};
},
// Reports useless return statements if exist.
onCodePathEnd() {
for (const node of scopeInfo.uselessReturns) {
context.report({
node,
loc: node.loc,
messageId: "unnecessaryReturn",
fix(fixer) {
if (
isRemovable(node) &&
!sourceCode.getCommentsInside(node).length
) {
/*
* Extend the replacement range to include the
* entire function to avoid conflicting with
* no-else-return.
* https://github.com/eslint/eslint/issues/8026
*/
return new FixTracker(fixer, sourceCode)
.retainEnclosingFunction(node)
.remove(node);
}
return null;
},
});
}
scopeInfo = scopeInfo.upper;
},
/*
* Initializes segments.
* NOTE: This event is notified for only reachable segments.
*/
onCodePathSegmentStart(segment) {
scopeInfo.currentSegments.add(segment);
const info = {
uselessReturns: getUselessReturns(
[],
segment.allPrevSegments,
),
returned: false,
};
// Stores the info.
segmentInfoMap.set(segment, info);
},
onUnreachableCodePathSegmentStart(segment) {
scopeInfo.currentSegments.add(segment);
},
onUnreachableCodePathSegmentEnd(segment) {
scopeInfo.currentSegments.delete(segment);
},
onCodePathSegmentEnd(segment) {
scopeInfo.currentSegments.delete(segment);
},
// Adds ReturnStatement node to check whether it's useless or not.
ReturnStatement(node) {
if (node.argument) {
markReturnStatementsOnCurrentSegmentsAsUsed();
}
if (
node.argument ||
astUtils.isInLoop(node) ||
isInFinally(node) ||
// Ignore `return` statements in unreachable places (https://github.com/eslint/eslint/issues/11647).
!isAnySegmentReachable(scopeInfo.currentSegments)
) {
return;
}
for (const segment of scopeInfo.currentSegments) {
const info = segmentInfoMap.get(segment);
if (info) {
info.uselessReturns.push(node);
info.returned = true;
}
}
scopeInfo.uselessReturns.push(node);
},
"TryStatement > BlockStatement.block:exit"(node) {
scopeInfo.traversedTryBlockStatements.push(node);
},
"TryStatement:exit"() {
scopeInfo.traversedTryBlockStatements.pop();
},
/*
* Registers for all statement nodes except FunctionDeclaration, BlockStatement, BreakStatement.
* Removes return statements of the current segments from the useless return statement list.
*/
ClassDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed,
ContinueStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
DebuggerStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
DoWhileStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
EmptyStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
ExpressionStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
ForInStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
ForOfStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
ForStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
IfStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
ImportDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed,
LabeledStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
SwitchStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
ThrowStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
TryStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
VariableDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed,
WhileStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
WithStatement: markReturnStatementsOnCurrentSegmentsAsUsed,
ExportNamedDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed,
ExportDefaultDeclaration:
markReturnStatementsOnCurrentSegmentsAsUsed,
ExportAllDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed,
};
},
};

View File

@@ -0,0 +1,144 @@
import { Struct, Infer, Result, Context, Describe } from './struct.js';
import { Failure } from './error.js';
/**
* Check if a value is a plain object.
*/
export declare function isObject(x: unknown): x is object;
/**
* Check if a value is a non-array object.
*/
export declare function isNonArrayObject(x: unknown): x is object;
/**
* Check if a value is a plain object.
*/
export declare function isPlainObject(x: unknown): x is {
[key: string]: any;
};
/**
* Return a value as a printable string.
*/
export declare function print(value: any): string;
/**
* Shifts (removes and returns) the first value from the `input` iterator.
* Like `Array.prototype.shift()` but for an `Iterator`.
*/
export declare function shiftIterator<T>(input: Iterator<T>): T | undefined;
/**
* Convert a single validation result to a failure.
*/
export declare function toFailure<T, S>(result: string | boolean | Partial<Failure>, context: Context, struct: Struct<T, S>, value: any): Failure | undefined;
/**
* Convert a validation result to an iterable of failures.
*/
export declare function toFailures<T, S>(result: Result, context: Context, struct: Struct<T, S>, value: any): IterableIterator<Failure>;
/**
* Check a value against a struct, traversing deeply into nested values, and
* returning an iterator of failures or success.
*/
export declare function run<T, S>(value: unknown, struct: Struct<T, S>, options?: {
path?: any[];
branch?: any[];
coerce?: boolean;
mask?: boolean;
message?: string;
}): IterableIterator<[Failure, undefined] | [undefined, T]>;
/**
* Convert a union of type to an intersection.
*/
export type UnionToIntersection<U> = (U extends any ? (arg: U) => any : never) extends (arg: infer I) => void ? I : never;
/**
* Assign properties from one type to another, overwriting existing.
*/
export type Assign<T, U> = Simplify<U & Omit<T, keyof U>>;
/**
* A schema for enum structs.
*/
export type EnumSchema<T extends string | number | undefined | null> = {
[K in NonNullable<T>]: K;
};
/**
* Check if a type is a match for another whilst treating overlapping
* unions as a match.
*/
export type IsMatch<T, G> = T extends G ? (G extends T ? T : never) : never;
/**
* Check if a type is an exact match.
*/
export type IsExactMatch<T, U> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? T : never;
/**
* Check if a type is a record type.
*/
export type IsRecord<T> = T extends object ? string extends keyof T ? T : never : never;
/**
* Check if a type is a tuple.
*/
export type IsTuple<T> = T extends [any] ? T : T extends [any, any] ? T : T extends [any, any, any] ? T : T extends [any, any, any, any] ? T : T extends [any, any, any, any, any] ? T : never;
/**
* Check if a type is a union.
*/
export type IsUnion<T, U extends T = T> = (T extends any ? (U extends T ? false : true) : false) extends false ? never : T;
/**
* A schema for object structs.
*/
export type ObjectSchema = Record<string, Struct<any, any>>;
/**
* Infer a type from an object struct schema.
*/
export type ObjectType<S extends ObjectSchema> = Simplify<Optionalize<{
[K in keyof S]: Infer<S[K]>;
}>>;
/**
* Omit properties from a type that extend from a specific type.
*/
export type OmitBy<T, V> = Omit<T, {
[K in keyof T]: V extends Extract<T[K], V> ? K : never;
}[keyof T]>;
/**
* Normalize properties of a type that allow `undefined` to make them optional.
*/
export type Optionalize<S extends object> = OmitBy<S, undefined> & Partial<PickBy<S, undefined>>;
/**
* Transform an object schema type to represent a partial.
*/
export type PartialObjectSchema<S extends ObjectSchema> = {
[K in keyof S]: Struct<Infer<S[K]> | undefined>;
};
/**
* Pick properties from a type that extend from a specific type.
*/
export type PickBy<T, V> = Pick<T, {
[K in keyof T]: V extends Extract<T[K], V> ? K : never;
}[keyof T]>;
/**
* Simplifies a type definition to its most basic representation.
*/
export type Simplify<T> = T extends any[] | Date ? T : {
[K in keyof T]: T[K];
} & {};
export type If<B extends Boolean, Then, Else> = B extends true ? Then : Else;
/**
* A schema for any type of struct.
*/
export type StructSchema<T> = [T] extends [string | undefined | null] ? [T] extends [IsMatch<T, string | undefined | null>] ? null : [T] extends [IsUnion<T>] ? EnumSchema<T> : T : [T] extends [number | undefined | null] ? [T] extends [IsMatch<T, number | undefined | null>] ? null : [T] extends [IsUnion<T>] ? EnumSchema<T> : T : [T] extends [boolean] ? [T] extends [IsExactMatch<T, boolean>] ? null : T : T extends bigint | symbol | undefined | null | Function | Date | Error | RegExp | Map<any, any> | WeakMap<any, any> | Set<any> | WeakSet<any> | Promise<any> ? null : T extends Array<infer E> ? T extends IsTuple<T> ? null : Struct<E> : T extends object ? T extends IsRecord<T> ? null : {
[K in keyof T]: Describe<T[K]>;
} : null;
/**
* A schema for tuple structs.
*/
export type TupleSchema<T> = {
[K in keyof T]: Struct<T[K]>;
};
/**
* Shorthand type for matching any `Struct`.
*/
export type AnyStruct = Struct<any, any>;
/**
* Infer a tuple of types from a tuple of `Struct`s.
*
* This is used to recursively retrieve the type from `union` `intersection` and
* `tuple` structs.
*/
export type InferStructTuple<Tuple extends AnyStruct[], Length extends number = Tuple['length']> = Length extends Length ? number extends Length ? Tuple : _InferTuple<Tuple, Length, []> : never;
type _InferTuple<Tuple extends AnyStruct[], Length extends number, Accumulated extends unknown[], Index extends number = Accumulated['length']> = Index extends Length ? Accumulated : _InferTuple<Tuple, Length, [...Accumulated, Infer<Tuple[Index]>]>;
export {};
//# sourceMappingURL=utils.d.ts.map

View File

@@ -0,0 +1,28 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" />
/// <reference lib="decorators" />
interface SymbolConstructor {
readonly metadata: unique symbol;
}
interface Function {
[Symbol.metadata]: DecoratorMetadata | null;
}

View File

@@ -0,0 +1,4 @@
{
"main": "../../cjs/_array_with_holes.cjs",
"module": "../../esm/_array_with_holes.js"
}

View File

@@ -0,0 +1,166 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
interface DateTimeFormatPartTypesRegistry {
fractionalSecond: any;
}
interface DateTimeFormatOptions {
formatMatcher?: "basic" | "best fit" | "best fit" | undefined;
dateStyle?: "full" | "long" | "medium" | "short" | undefined;
timeStyle?: "full" | "long" | "medium" | "short" | undefined;
dayPeriod?: "narrow" | "short" | "long" | undefined;
fractionalSecondDigits?: 1 | 2 | 3 | undefined;
}
interface DateTimeRangeFormatPart extends DateTimeFormatPart {
source: "startRange" | "endRange" | "shared";
}
interface DateTimeFormat {
formatRange(startDate: Date | number | bigint, endDate: Date | number | bigint): string;
formatRangeToParts(startDate: Date | number | bigint, endDate: Date | number | bigint): DateTimeRangeFormatPart[];
}
interface ResolvedDateTimeFormatOptions {
formatMatcher?: "basic" | "best fit" | "best fit";
dateStyle?: "full" | "long" | "medium" | "short";
timeStyle?: "full" | "long" | "medium" | "short";
hourCycle?: "h11" | "h12" | "h23" | "h24";
dayPeriod?: "narrow" | "short" | "long";
fractionalSecondDigits?: 1 | 2 | 3;
}
/**
* The locale matching algorithm to use.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters).
*/
type ListFormatLocaleMatcher = "lookup" | "best fit";
/**
* The format of output message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters).
*/
type ListFormatType = "conjunction" | "disjunction" | "unit";
/**
* The length of the formatted message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters).
*/
type ListFormatStyle = "long" | "short" | "narrow";
/**
* An object with some or all properties of the `Intl.ListFormat` constructor `options` parameter.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters).
*/
interface ListFormatOptions {
/** The locale matching algorithm to use. For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation). */
localeMatcher?: ListFormatLocaleMatcher | undefined;
/** The format of output message. */
type?: ListFormatType | undefined;
/** The length of the internationalized message. */
style?: ListFormatStyle | undefined;
}
interface ResolvedListFormatOptions {
locale: string;
style: ListFormatStyle;
type: ListFormatType;
}
interface ListFormat {
/**
* Returns a string with a language-specific representation of the list.
*
* @param list - An iterable object, such as an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).
*
* @throws `TypeError` if `list` includes something other than the possible values.
*
* @returns {string} A language-specific formatted string representing the elements of the list.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/format).
*/
format(list: Iterable<string>): string;
/**
* Returns an Array of objects representing the different components that can be used to format a list of values in a locale-aware fashion.
*
* @param list - An iterable object, such as an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array), to be formatted according to a locale.
*
* @throws `TypeError` if `list` includes something other than the possible values.
*
* @returns {{ type: "element" | "literal", value: string; }[]} An Array of components which contains the formatted parts from the list.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/formatToParts).
*/
formatToParts(list: Iterable<string>): { type: "element" | "literal"; value: string; }[];
/**
* Returns a new object with properties reflecting the locale and style
* formatting options computed during the construction of the current
* `Intl.ListFormat` object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/resolvedOptions).
*/
resolvedOptions(): ResolvedListFormatOptions;
}
const ListFormat: {
prototype: ListFormat;
/**
* Creates [Intl.ListFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat) objects that
* enable language-sensitive list formatting.
*
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
* For the general form and interpretation of the `locales` argument,
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters)
* with some or all options of `ListFormatOptions`.
*
* @returns [Intl.ListFormatOptions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat) object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat).
*/
new (locales?: LocalesArgument, options?: ListFormatOptions): ListFormat;
/**
* Returns an array containing those of the provided locales that are
* supported in list formatting without having to fall back to the runtime's default locale.
*
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
* For the general form and interpretation of the `locales` argument,
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/supportedLocalesOf#parameters).
* with some or all possible options.
*
* @returns An array of strings representing a subset of the given locale tags that are supported in list
* formatting without having to fall back to the runtime's default locale.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/supportedLocalesOf).
*/
supportedLocalesOf(locales: LocalesArgument, options?: Pick<ListFormatOptions, "localeMatcher">): UnicodeBCP47LocaleIdentifier[];
};
}

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScopeType = void 0;
var ScopeType;
(function (ScopeType) {
ScopeType["block"] = "block";
ScopeType["catch"] = "catch";
ScopeType["class"] = "class";
ScopeType["classFieldInitializer"] = "class-field-initializer";
ScopeType["classStaticBlock"] = "class-static-block";
ScopeType["conditionalType"] = "conditionalType";
ScopeType["for"] = "for";
ScopeType["function"] = "function";
ScopeType["functionExpressionName"] = "function-expression-name";
ScopeType["functionType"] = "functionType";
ScopeType["global"] = "global";
ScopeType["mappedType"] = "mappedType";
ScopeType["module"] = "module";
ScopeType["switch"] = "switch";
ScopeType["tsEnum"] = "tsEnum";
ScopeType["tsModule"] = "tsModule";
ScopeType["type"] = "type";
ScopeType["with"] = "with";
})(ScopeType || (exports.ScopeType = ScopeType = {}));

View File

@@ -0,0 +1,6 @@
"use strict";
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: { sourceType: 'module' },
plugins: ['@typescript-eslint'],
};

View File

@@ -0,0 +1,117 @@
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: "belgi", verb: "bolishi kerak" },
file: { unit: "bayt", verb: "bolishi kerak" },
array: { unit: "element", verb: "bolishi kerak" },
set: { unit: "element", verb: "bolishi kerak" },
map: { unit: "yozuv", verb: "bolishi kerak" },
};
function getSizing(origin: string): { unit: string; verb: string } | null {
return Sizable[origin] ?? null;
}
const FormatDictionary: {
[k in $ZodStringFormats | (string & {})]?: string;
} = {
regex: "kirish",
email: "elektron pochta manzili",
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 sana va vaqti",
date: "ISO sana",
time: "ISO vaqt",
duration: "ISO davomiylik",
ipv4: "IPv4 manzil",
ipv6: "IPv6 manzil",
mac: "MAC manzil",
cidrv4: "IPv4 diapazon",
cidrv6: "IPv6 diapazon",
base64: "base64 kodlangan satr",
base64url: "base64url kodlangan satr",
json_string: "JSON satr",
e164: "E.164 raqam",
jwt: "JWT",
template_literal: "kirish",
};
const TypeDictionary: {
[k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;
} = {
nan: "NaN",
number: "raqam",
array: "massiv",
};
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 `Notogri kirish: kutilgan instanceof ${issue.expected}, qabul qilingan ${received}`;
}
return `Notogri kirish: kutilgan ${expected}, qabul qilingan ${received}`;
}
case "invalid_value":
if (issue.values.length === 1) return `Notogri kirish: kutilgan ${util.stringifyPrimitive(issue.values[0])}`;
return `Notogri variant: quyidagilardan biri kutilgan ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Juda katta: kutilgan ${issue.origin ?? "qiymat"} ${adj}${issue.maximum.toString()} ${sizing.unit} ${sizing.verb}`;
return `Juda katta: kutilgan ${issue.origin ?? "qiymat"} ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Juda kichik: kutilgan ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
}
return `Juda kichik: kutilgan ${issue.origin} ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue as errors.$ZodStringFormatIssues;
if (_issue.format === "starts_with") return `Notogri satr: "${_issue.prefix}" bilan boshlanishi kerak`;
if (_issue.format === "ends_with") return `Notogri satr: "${_issue.suffix}" bilan tugashi kerak`;
if (_issue.format === "includes") return `Notogri satr: "${_issue.includes}" ni oz ichiga olishi kerak`;
if (_issue.format === "regex") return `Notogri satr: ${_issue.pattern} shabloniga mos kelishi kerak`;
return `Notogri ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Notogri raqam: ${issue.divisor} ning karralisi bolishi kerak`;
case "unrecognized_keys":
return `Nomalum kalit${issue.keys.length > 1 ? "lar" : ""}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `${issue.origin} dagi kalit notogri`;
case "invalid_union":
return "Notogri kirish";
case "invalid_element":
return `${issue.origin} da notogri qiymat`;
default:
return `Notogri kirish`;
}
};
};
export default function (): { localeError: errors.$ZodErrorMap } {
return {
localeError: error(),
};
}

View File

@@ -0,0 +1,11 @@
"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.webworker_importscripts = void 0;
exports.webworker_importscripts = {
libs: [],
variables: [],
};

View File

@@ -0,0 +1 @@
{"version":3,"file":"sha1.d.ts","sourceRoot":"","sources":["src/sha1.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,aAAa,CAAC;AAC3D,+DAA+D;AAC/D,eAAO,MAAM,IAAI,EAAE,OAAO,KAAa,CAAC;AACxC,+DAA+D;AAC/D,eAAO,MAAM,IAAI,EAAE,OAAO,KAAa,CAAC"}

View File

@@ -0,0 +1,173 @@
/**
* @fileoverview Rule to flag when the same variable is declared more then once.
* @author Ilya Volodin
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: [{ builtinGlobals: true }],
docs: {
description: "Disallow variable redeclaration",
recommended: true,
url: "https://eslint.org/docs/latest/rules/no-redeclare",
},
messages: {
redeclared: "'{{id}}' is already defined.",
redeclaredAsBuiltin:
"'{{id}}' is already defined as a built-in global variable.",
redeclaredBySyntax:
"'{{id}}' is already defined by a variable declaration.",
},
schema: [
{
type: "object",
properties: {
builtinGlobals: { type: "boolean" },
},
additionalProperties: false,
},
],
},
create(context) {
const [{ builtinGlobals }] = context.options;
const sourceCode = context.sourceCode;
/**
* Iterate declarations of a given variable.
* @param {escope.variable} variable The variable object to iterate declarations.
* @returns {IterableIterator<{type:string,node:ASTNode,loc:SourceLocation}>} The declarations.
*/
function* iterateDeclarations(variable) {
if (
builtinGlobals &&
(variable.eslintImplicitGlobalSetting === "readonly" ||
variable.eslintImplicitGlobalSetting === "writable")
) {
yield { type: "builtin" };
}
for (const id of variable.identifiers) {
yield { type: "syntax", node: id, loc: id.loc };
}
if (variable.eslintExplicitGlobalComments) {
for (const comment of variable.eslintExplicitGlobalComments) {
yield {
type: "comment",
node: comment,
loc: astUtils.getNameLocationInGlobalDirectiveComment(
sourceCode,
comment,
variable.name,
),
};
}
}
}
/**
* Find variables in a given scope and flag redeclared ones.
* @param {Scope} scope An eslint-scope scope object.
* @returns {void}
* @private
*/
function findVariablesInScope(scope) {
for (const variable of scope.variables) {
const [declaration, ...extraDeclarations] =
iterateDeclarations(variable);
if (extraDeclarations.length === 0) {
continue;
}
/*
* If the type of a declaration is different from the type of
* the first declaration, it shows the location of the first
* declaration.
*/
const detailMessageId =
declaration.type === "builtin"
? "redeclaredAsBuiltin"
: "redeclaredBySyntax";
const data = { id: variable.name };
// Report extra declarations.
for (const { type, node, loc } of extraDeclarations) {
const messageId =
type === declaration.type
? "redeclared"
: detailMessageId;
context.report({ node, loc, messageId, data });
}
}
}
/**
* Find variables in the current scope.
* @param {ASTNode} node The node of the current scope.
* @returns {void}
* @private
*/
function checkForBlock(node) {
const scope = sourceCode.getScope(node);
/*
* In ES5, some node type such as `BlockStatement` doesn't have that scope.
* `scope.block` is a different node in such a case.
*/
if (scope.block === node) {
findVariablesInScope(scope);
}
}
return {
Program(node) {
const scope = sourceCode.getScope(node);
findVariablesInScope(scope);
// Node.js or ES modules has a special scope.
if (
scope.type === "global" &&
scope.childScopes[0] &&
// The special scope's block is the Program node.
scope.block === scope.childScopes[0].block
) {
findVariablesInScope(scope.childScopes[0]);
}
},
FunctionDeclaration: checkForBlock,
FunctionExpression: checkForBlock,
ArrowFunctionExpression: checkForBlock,
StaticBlock: checkForBlock,
BlockStatement: checkForBlock,
ForStatement: checkForBlock,
ForInStatement: checkForBlock,
ForOfStatement: checkForBlock,
SwitchStatement: checkForBlock,
};
},
};

View File

@@ -0,0 +1,106 @@
export {};
type _AddEventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : AddEventListenerOptions;
interface AddEventListenerOptions extends EventListenerOptions {
once?: boolean;
passive?: boolean;
signal?: AbortSignal;
}
type _CustomEvent<T = any> = typeof globalThis extends { onmessage: any } ? {} : CustomEvent<T>;
interface CustomEvent<T = any> extends Event {
readonly detail: T;
}
interface CustomEventInit<T = any> extends EventInit {
detail?: T;
}
type _Event = typeof globalThis extends { onmessage: any } ? {} : Event;
interface Event {
readonly bubbles: boolean;
cancelBubble: boolean;
readonly cancelable: boolean;
readonly composed: boolean;
readonly currentTarget: EventTarget | null;
readonly defaultPrevented: boolean;
readonly eventPhase: 0 | 2;
readonly isTrusted: boolean;
returnValue: boolean;
readonly srcElement: EventTarget | null;
readonly target: EventTarget | null;
readonly timeStamp: number;
readonly type: string;
composedPath(): [EventTarget?];
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
preventDefault(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
}
interface EventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
}
type _EventListener = typeof globalThis extends { onmessage: any } ? {} : EventListener;
interface EventListener {
(evt: Event): void;
}
type _EventListenerObject = typeof globalThis extends { onmessage: any } ? {} : EventListenerObject;
interface EventListenerObject {
handleEvent(object: Event): void;
}
type _EventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : EventListenerOptions;
interface EventListenerOptions {
capture?: boolean;
}
type _EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
interface EventTarget {
addEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: AddEventListenerOptions | boolean,
): void;
dispatchEvent(event: Event): boolean;
removeEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: EventListenerOptions | boolean,
): void;
}
declare global {
interface AddEventListenerOptions extends _AddEventListenerOptions {}
interface CustomEvent<T = any> extends _CustomEvent<T> {}
var CustomEvent: typeof globalThis extends { onmessage: any; CustomEvent: infer T } ? T
: {
prototype: CustomEvent;
new<T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
};
interface Event extends _Event {}
var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
: {
prototype: Event;
new(type: string, eventInitDict?: EventInit): Event;
};
interface EventListener extends _EventListener {}
interface EventListenerObject extends _EventListenerObject {}
interface EventListenerOptions extends _EventListenerOptions {}
interface EventTarget extends _EventTarget {}
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
: {
prototype: EventTarget;
new(): EventTarget;
};
}

View File

@@ -0,0 +1,46 @@
{
"name": "fast-safe-stringify",
"version": "2.1.1",
"description": "Safely and quickly serialize JavaScript objects",
"keywords": [
"stable",
"stringify",
"JSON",
"JSON.stringify",
"safe",
"serialize"
],
"main": "index.js",
"scripts": {
"test": "standard && tap --no-esm test.js test-stable.js",
"benchmark": "node benchmark.js"
},
"author": "David Mark Clements",
"contributors": [
"Ruben Bridgewater",
"Matteo Collina",
"Ben Gourley",
"Gabriel Lesperance",
"Alex Liu",
"Christoph Walcher",
"Nicholas Young"
],
"license": "MIT",
"typings": "index",
"devDependencies": {
"benchmark": "^2.1.4",
"clone": "^2.1.0",
"json-stringify-safe": "^5.0.1",
"standard": "^11.0.0",
"tap": "^12.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/davidmarkclements/fast-safe-stringify.git"
},
"bugs": {
"url": "https://github.com/davidmarkclements/fast-safe-stringify/issues"
},
"homepage": "https://github.com/davidmarkclements/fast-safe-stringify#readme",
"dependencies": {}
}

View File

@@ -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.es2018_promise = void 0;
const base_config_1 = require("./base-config");
exports.es2018_promise = {
libs: [],
variables: [['Promise', base_config_1.TYPE]],
};

View File

@@ -0,0 +1,63 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.coerce = exports.ZodMiniISODuration = exports.ZodMiniISOTime = exports.ZodMiniISODate = exports.ZodMiniISODateTime = exports.iso = exports.locales = exports.toJSONSchema = exports.NEVER = exports.util = exports.TimePrecision = exports.flattenError = exports.formatError = exports.prettifyError = exports.treeifyError = exports.regexes = exports.clone = exports.$brand = exports.$input = exports.$output = exports.config = exports.registry = exports.globalRegistry = exports.core = void 0;
exports.core = __importStar(require("../core/index.cjs"));
__exportStar(require("./parse.cjs"), exports);
__exportStar(require("./schemas.cjs"), exports);
__exportStar(require("./checks.cjs"), exports);
var index_js_1 = require("../core/index.cjs");
Object.defineProperty(exports, "globalRegistry", { enumerable: true, get: function () { return index_js_1.globalRegistry; } });
Object.defineProperty(exports, "registry", { enumerable: true, get: function () { return index_js_1.registry; } });
Object.defineProperty(exports, "config", { enumerable: true, get: function () { return index_js_1.config; } });
Object.defineProperty(exports, "$output", { enumerable: true, get: function () { return index_js_1.$output; } });
Object.defineProperty(exports, "$input", { enumerable: true, get: function () { return index_js_1.$input; } });
Object.defineProperty(exports, "$brand", { enumerable: true, get: function () { return index_js_1.$brand; } });
Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return index_js_1.clone; } });
Object.defineProperty(exports, "regexes", { enumerable: true, get: function () { return index_js_1.regexes; } });
Object.defineProperty(exports, "treeifyError", { enumerable: true, get: function () { return index_js_1.treeifyError; } });
Object.defineProperty(exports, "prettifyError", { enumerable: true, get: function () { return index_js_1.prettifyError; } });
Object.defineProperty(exports, "formatError", { enumerable: true, get: function () { return index_js_1.formatError; } });
Object.defineProperty(exports, "flattenError", { enumerable: true, get: function () { return index_js_1.flattenError; } });
Object.defineProperty(exports, "TimePrecision", { enumerable: true, get: function () { return index_js_1.TimePrecision; } });
Object.defineProperty(exports, "util", { enumerable: true, get: function () { return index_js_1.util; } });
Object.defineProperty(exports, "NEVER", { enumerable: true, get: function () { return index_js_1.NEVER; } });
var json_schema_processors_js_1 = require("../core/json-schema-processors.cjs");
Object.defineProperty(exports, "toJSONSchema", { enumerable: true, get: function () { return json_schema_processors_js_1.toJSONSchema; } });
exports.locales = __importStar(require("../locales/index.cjs"));
/** A special constant with type `never` */
// export const NEVER = {} as never;
// iso
exports.iso = __importStar(require("./iso.cjs"));
var iso_js_1 = require("./iso.cjs");
Object.defineProperty(exports, "ZodMiniISODateTime", { enumerable: true, get: function () { return iso_js_1.ZodMiniISODateTime; } });
Object.defineProperty(exports, "ZodMiniISODate", { enumerable: true, get: function () { return iso_js_1.ZodMiniISODate; } });
Object.defineProperty(exports, "ZodMiniISOTime", { enumerable: true, get: function () { return iso_js_1.ZodMiniISOTime; } });
Object.defineProperty(exports, "ZodMiniISODuration", { enumerable: true, get: function () { return iso_js_1.ZodMiniISODuration; } });
// coerce
exports.coerce = __importStar(require("./coerce.cjs"));

View File

@@ -0,0 +1,52 @@
/// <reference types="node" />
import BN from "bn.js";
export declare function baseEncode(value: Uint8Array | string): string;
export declare function baseDecode(value: string): Buffer;
export declare type Schema = Map<Function, any>;
export declare class BorshError extends Error {
originalMessage: string;
fieldPath: string[];
constructor(message: string);
addToFieldPath(fieldName: string): void;
}
export declare class BinaryWriter {
buf: Buffer;
length: number;
constructor();
maybeResize(): void;
writeU8(value: number): void;
writeU16(value: number): void;
writeU32(value: number): void;
writeU64(value: number | BN): void;
writeU128(value: number | BN): void;
writeU256(value: number | BN): void;
writeU512(value: number | BN): void;
private writeBuffer;
writeString(str: string): void;
writeFixedArray(array: Uint8Array): void;
writeArray(array: any[], fn: any): void;
toArray(): Uint8Array;
}
export declare class BinaryReader {
buf: Buffer;
offset: number;
constructor(buf: Buffer);
readU8(): number;
readU16(): number;
readU32(): number;
readU64(): BN;
readU128(): BN;
readU256(): BN;
readU512(): BN;
private readBuffer;
readString(): string;
readFixedArray(len: number): Uint8Array;
readArray(fn: any): any[];
}
export declare function serialize(schema: Schema, obj: any, Writer?: typeof BinaryWriter): Uint8Array;
export declare function deserialize<T>(schema: Schema, classType: {
new (args: any): T;
}, buffer: Buffer, Reader?: typeof BinaryReader): T;
export declare function deserializeUnchecked<T>(schema: Schema, classType: {
new (args: any): T;
}, buffer: Buffer, Reader?: typeof BinaryReader): T;

View File

@@ -0,0 +1,53 @@
import { M as ModuleMockerInterceptor } from './mocker.d-QEntlm6J.js';
export { C as CompilerHintsOptions, b as ModuleMocker, a as ModuleMockerCompilerHints, c as ModuleMockerConfig, d as ModuleMockerRPC, R as ResolveIdResult, e as ResolveMockResult, f as createCompilerHints } from './mocker.d-QEntlm6J.js';
import { StartOptions, SetupWorker } from 'msw/browser';
import { M as MockerRegistry, a as MockedModule } from './types.d-BjI5eAwu.js';
import '@vitest/spy';
import './index.d-B41z0AuW.js';
interface ModuleMockerMSWInterceptorOptions {
/**
* The identifier to access the globalThis object in the worker.
* This will be injected into the script as is, so make sure it's a valid JS expression.
* @example
* ```js
* // globalThisAccessor: '__my_variable__' produces:
* globalThis[__my_variable__]
* // globalThisAccessor: 'Symbol.for('secret:mocks')' produces:
* globalThis[Symbol.for('secret:mocks')]
* // globalThisAccessor: '"__vitest_mocker__"' (notice quotes) produces:
* globalThis["__vitest_mocker__"]
* ```
* @default `"__vitest_mocker__"`
*/
globalThisAccessor?: string;
/**
* Options passed down to `msw.setupWorker().start(options)`
*/
mswOptions?: StartOptions;
/**
* A pre-configured `msw.setupWorker` instance.
*/
mswWorker?: SetupWorker;
}
declare class ModuleMockerMSWInterceptor implements ModuleMockerInterceptor {
private readonly options;
protected readonly mocks: MockerRegistry;
private startPromise;
private worker;
constructor(options?: ModuleMockerMSWInterceptorOptions);
register(module: MockedModule): Promise<void>;
delete(url: string): Promise<void>;
invalidate(): Promise<void>;
private resolveManualMock;
protected init(): Promise<SetupWorker>;
}
declare class ModuleMockerServerInterceptor implements ModuleMockerInterceptor {
register(module: MockedModule): Promise<void>;
delete(id: string): Promise<void>;
invalidate(): Promise<void>;
}
export { ModuleMockerInterceptor, ModuleMockerMSWInterceptor, ModuleMockerServerInterceptor };
export type { ModuleMockerMSWInterceptorOptions };

View File

@@ -0,0 +1,344 @@
/* @minVersion 7.24.0 */
function toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) {
return input;
}
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") {
return res;
}
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function toPropertyKey(arg) {
var key = toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function checkInRHS(value) {
if (Object(value) !== value) {
throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
}
return value;
}
function setFunctionName(fn, name, prefix) {
if (typeof name === "symbol") {
name = name.description;
name = name ? "[" + name + "]" : "";
}
try {
Object.defineProperty(fn, "name", { configurable: true, value: prefix ? prefix + " " + name : name });
} catch (_) {}
return fn;
}
/**
kind bit layout
FIELD = 0
ACCESSOR = 1
METHOD = 2
GETTER = 3
SETTER = 4
CLASS = 5
STATIC = 8
DECORATORS_HAVE_THIS = 16
*/
function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata");
var defineProperty = Object.defineProperty;
var create = Object.create;
var metadata;
var existingNonFields = [create(null), create(null)];
var hasClassDecs = classDecs.length;
var _;
function createRunInitializers(initializers, useStaticThis, hasValue) {
return function(thisArg, value) {
if (useStaticThis) {
value = thisArg;
thisArg = targetClass;
}
for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []);
return hasValue ? value : thisArg;
};
}
function assertCallable(fn, hint1, hint2, throwUndefined) {
if (typeof fn !== "function") {
if (throwUndefined || fn !== void 0) {
throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
}
}
return fn;
}
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
function assertInstanceIfPrivate(target) {
if (!hasPrivateBrand(target)) {
throw new TypeError("Attempted to access private element on non-instance");
}
}
var decs = [].concat(decInfo[0]);
var decVal = decInfo[3];
var isClass = !ret;
var isAccessor = kind === 1;
var isGetter = kind === 3;
var isSetter = kind === 4;
var isMethod = kind === 2;
function bindPropCall(name, useStaticThis, before) {
return function(_this, value) {
if (useStaticThis) {
value = _this;
_this = Class;
}
if (before) {
before(_this);
}
return desc[name].call(_this, value);
};
}
var desc = {};
var init = [];
var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
if (!isClass) {
if (isPrivate) {
if (isField || isAccessor) {
desc = {
get: setFunctionName(
function() {
return decVal(this);
},
name,
"get"
),
set: function(value) {
decInfo[4](this, value);
}
};
} else {
desc[key] = decVal;
}
if (!isField) {
setFunctionName(desc[key], name, isMethod ? "" : key);
}
} else if (!isField) {
desc = Object.getOwnPropertyDescriptor(Class, name);
}
if (!isField && !isPrivate) {
_ = existingNonFields[+isStatic][name];
if (_ && (_ ^ kind) !== 7) {
throw new Error("Decorating two elements with the same name (" + desc[key].name + ") is not supported yet");
}
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
}
}
var newValue = Class;
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
var dec = assertCallable(decs[i], "A decorator", "be", true);
var decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
var decoratorFinishedRef = {};
var ctx = {
kind: ["field", "accessor", "method", "getter", "setter", "class"][kind],
name: name,
metadata: metadata,
addInitializer: function(decoratorFinishedRef, initializer) {
if (decoratorFinishedRef.v) {
throw new TypeError("attempted to call addInitializer after decoration was finished");
}
assertCallable(initializer, "An initializer", "be", true);
initializers.push(initializer);
}
.bind(null, decoratorFinishedRef)
};
if (isClass) {
_ = dec.call(decThis, newValue, ctx);
decoratorFinishedRef.v = 1;
if (assertCallable(_, "class decorators", "return")) {
newValue = _;
}
continue;
}
ctx.static = isStatic;
ctx.private = isPrivate;
_ = ctx.access = {
has: isPrivate ? hasPrivateBrand.bind() : function(target) {
return name in target;
}
};
if (!isSetter) {
_.get = isPrivate
? isMethod
? function(_this) {
assertInstanceIfPrivate(_this);
return desc.value;
}
: bindPropCall("get", 0, assertInstanceIfPrivate)
: function(target) {
return target[name];
};
}
if (!isMethod && !isGetter) {
_.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) {
target[name] = value;
};
}
newValue = dec.call(decThis, isAccessor ? { get: desc.get, set: desc.set } : desc[key], ctx);
decoratorFinishedRef.v = 1;
if (isAccessor) {
if (typeof newValue === "object" && newValue) {
if ((_ = assertCallable(newValue.get, "accessor.get"))) {
desc.get = _;
}
if ((_ = assertCallable(newValue.set, "accessor.set"))) {
desc.set = _;
}
if ((_ = assertCallable(newValue.init, "accessor.init"))) {
init.unshift(_);
}
} else if (newValue !== void 0) {
throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
}
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) {
if (isField) {
init.unshift(newValue);
} else {
desc[key] = newValue;
}
}
}
if (kind < 2) {
ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
}
if (!isField && !isClass) {
if (isPrivate) {
if (isAccessor) {
ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic));
} else {
ret.push(isMethod ? desc[key] : assertCallable.call.bind(desc[key]));
}
} else {
defineProperty(Class, name, desc);
}
}
return newValue;
}
function applyMemberDecs() {
var ret = [];
var protoInitializers;
var staticInitializers;
var pushInitializers = function(initializers) {
if (initializers) {
ret.push(createRunInitializers(initializers));
}
};
var applyMemberDecsOfKind = function(isStatic, isField) {
for (var i = 0; i < memberDecs.length; i++) {
var decInfo = memberDecs[i];
var kind = decInfo[1];
var kindOnly = kind & 7;
if ((kind & 8) == isStatic && !kindOnly == isField) {
var name = decInfo[2];
var isPrivate = !!decInfo[3];
var decoratorsHaveThis = kind & 16;
applyDec(
isStatic ? targetClass : targetClass.prototype,
decInfo,
decoratorsHaveThis,
isPrivate ? "#" + name : toPropertyKey(name),
kindOnly,
kindOnly < 2 ? [] : isStatic ? (staticInitializers = staticInitializers || []) : (protoInitializers = protoInitializers || []),
ret,
!!isStatic,
isPrivate,
isField,
isStatic && isPrivate
? function(_) {
return checkInRHS(_) === targetClass;
}
: instanceBrand
);
}
}
};
applyMemberDecsOfKind(8, 0);
applyMemberDecsOfKind(0, 0);
applyMemberDecsOfKind(8, 1);
applyMemberDecsOfKind(0, 1);
pushInitializers(protoInitializers);
pushInitializers(staticInitializers);
return ret;
}
function defineMetadata(Class) {
return defineProperty(Class, symbolMetadata, { configurable: true, enumerable: true, value: metadata });
}
if (parentClass !== undefined) {
metadata = parentClass[symbolMetadata];
}
metadata = create(metadata == null ? null : metadata);
_ = applyMemberDecs();
if (!hasClassDecs) {
defineMetadata(targetClass);
}
return {
e: _,
get c() {
var initializers = [];
return (hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)]);
}
};
}
export { _apply_decs_2311 as _ };

View File

@@ -0,0 +1,17 @@
// Code generated by Herebyfile.mjs generate:enums from internal/checker/types.go. DO NOT EDIT.
export var SignatureFlags;
(function (SignatureFlags) {
SignatureFlags[SignatureFlags["None"] = 0] = "None";
SignatureFlags[SignatureFlags["HasRestParameter"] = 1] = "HasRestParameter";
SignatureFlags[SignatureFlags["HasLiteralTypes"] = 2] = "HasLiteralTypes";
SignatureFlags[SignatureFlags["Construct"] = 4] = "Construct";
SignatureFlags[SignatureFlags["Abstract"] = 8] = "Abstract";
SignatureFlags[SignatureFlags["IsInnerCallChain"] = 16] = "IsInnerCallChain";
SignatureFlags[SignatureFlags["IsOuterCallChain"] = 32] = "IsOuterCallChain";
SignatureFlags[SignatureFlags["IsUntypedSignatureInJSFile"] = 64] = "IsUntypedSignatureInJSFile";
SignatureFlags[SignatureFlags["IsNonInferrable"] = 128] = "IsNonInferrable";
SignatureFlags[SignatureFlags["IsSignatureCandidateForOverloadFailure"] = 256] = "IsSignatureCandidateForOverloadFailure";
SignatureFlags[SignatureFlags["PropagatingFlags"] = 335] = "PropagatingFlags";
SignatureFlags[SignatureFlags["CallChainFlags"] = 48] = "CallChainFlags";
})(SignatureFlags || (SignatureFlags = {}));
//# sourceMappingURL=signatureFlags.js.map

View File

@@ -0,0 +1,37 @@
'use strict'
const { test } = require('node:test')
const assert = require('node:assert')
const { join } = require('path')
const { file } = require('./helper')
const { stat } = require('fs')
const ThreadStream = require('..')
test('string limit', { skip: process.env.CI, timeout: 30000 }, (t, done) => {
const dest = file()
const stream = new ThreadStream({
filename: join(__dirname, 'to-file.js'),
workerData: { dest },
sync: false
})
let length = 0
stream.on('close', () => {
stat(dest, (err, f) => {
assert.ifError(err)
assert.strictEqual(f.size, length)
done()
})
})
const buf = Buffer.alloc(1024).fill('x').toString() // 1 KB
// This writes 1 GB of data
for (let i = 0; i < 1024 * 1024; i++) {
length += buf.length
stream.write(buf)
}
stream.end()
})

View File

@@ -0,0 +1,16 @@
import { TSESLint } from '@typescript-eslint/utils';
export interface Config {
allowNamedExports?: boolean;
classes?: boolean;
enums?: boolean;
functions?: boolean;
ignoreTypeReferences?: boolean;
typedefs?: boolean;
variables?: boolean;
}
export type Options = ['nofunc' | Config];
export type MessageIds = 'noUseBeforeDefine';
declare const _default: TSESLint.RuleModule<"noUseBeforeDefine", Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
name: string;
};
export default _default;

View File

@@ -0,0 +1,73 @@
/**
* @fileoverview Rule to disallow empty static blocks.
* @author Sosuke Suzuki
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
hasSuggestions: true,
type: "suggestion",
docs: {
description: "Disallow empty static blocks",
recommended: true,
url: "https://eslint.org/docs/latest/rules/no-empty-static-block",
},
schema: [],
messages: {
unexpected: "Unexpected empty static block.",
suggestComment: "Add comment inside empty static block.",
},
},
create(context) {
const sourceCode = context.sourceCode;
return {
StaticBlock(node) {
if (node.body.length === 0) {
const openingBrace = sourceCode.getFirstToken(node, {
skip: 1,
});
const closingBrace = sourceCode.getLastToken(node);
if (
sourceCode.getCommentsBefore(closingBrace).length === 0
) {
context.report({
loc: {
start: openingBrace.loc.start,
end: closingBrace.loc.end,
},
messageId: "unexpected",
suggest: [
{
messageId: "suggestComment",
fix(fixer) {
const range = [
openingBrace.range[1],
closingBrace.range[0],
];
return fixer.replaceTextRange(
range,
" /* empty */ ",
);
},
},
],
});
}
}
},
};
},
};

View File

@@ -0,0 +1,38 @@
{
"name": "convert-source-map",
"version": "2.0.0",
"description": "Converts a source-map from/to different formats and allows adding/changing properties.",
"main": "index.js",
"scripts": {
"test": "tap test/*.js --color"
},
"repository": {
"type": "git",
"url": "git://github.com/thlorenz/convert-source-map.git"
},
"homepage": "https://github.com/thlorenz/convert-source-map",
"devDependencies": {
"inline-source-map": "~0.6.2",
"tap": "~9.0.0"
},
"keywords": [
"convert",
"sourcemap",
"source",
"map",
"browser",
"debug"
],
"author": {
"name": "Thorsten Lorenz",
"email": "thlorenz@gmx.de",
"url": "http://thlorenz.com"
},
"license": "MIT",
"engine": {
"node": ">=4"
},
"files": [
"index.js"
]
}

View File

@@ -0,0 +1,3 @@
import { buildExps } from "./regexps-uri";
export default buildExps(true);
//# sourceMappingURL=regexps-iri.js.map