WIP: bootstrap and partial real Solana watcher implementation
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/*! *****************************************************************************
|
||||
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"/>
|
||||
|
||||
interface DateConstructor {
|
||||
/**
|
||||
* Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
|
||||
* @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.
|
||||
* @param monthIndex The month as a number between 0 and 11 (January to December).
|
||||
* @param date The date as a number between 1 and 31.
|
||||
* @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
|
||||
* @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
|
||||
* @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
|
||||
* @param ms A number from 0 to 999 that specifies the milliseconds.
|
||||
*/
|
||||
UTC(year: number, monthIndex?: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
'use strict'
|
||||
|
||||
// Note: this is the semver.org version of the spec that it implements
|
||||
// Not necessarily the package version of this code.
|
||||
const SEMVER_SPEC_VERSION = '2.0.0'
|
||||
|
||||
const MAX_LENGTH = 256
|
||||
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
||||
/* istanbul ignore next */ 9007199254740991
|
||||
|
||||
// Max safe segment length for coercion.
|
||||
const MAX_SAFE_COMPONENT_LENGTH = 16
|
||||
|
||||
// Max safe length for a build identifier. The max length minus 6 characters for
|
||||
// the shortest version with a build 0.0.0+BUILD.
|
||||
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
|
||||
|
||||
const RELEASE_TYPES = [
|
||||
'major',
|
||||
'premajor',
|
||||
'minor',
|
||||
'preminor',
|
||||
'patch',
|
||||
'prepatch',
|
||||
'prerelease',
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
MAX_LENGTH,
|
||||
MAX_SAFE_COMPONENT_LENGTH,
|
||||
MAX_SAFE_BUILD_LENGTH,
|
||||
MAX_SAFE_INTEGER,
|
||||
RELEASE_TYPES,
|
||||
SEMVER_SPEC_VERSION,
|
||||
FLAG_INCLUDE_PRERELEASE: 0b001,
|
||||
FLAG_LOOSE: 0b010,
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"for + if": {
|
||||
"name": "for + if",
|
||||
"browser": "IE 11.0.0 (Windows 7 0.0.0)",
|
||||
"suite": "itar-short",
|
||||
"hz": 299157.6065641091,
|
||||
"success": true,
|
||||
"fastest": false,
|
||||
"rme": 0.017444833079293707,
|
||||
"rhz": 0.9755083449865074,
|
||||
"sampleSize": 214
|
||||
},
|
||||
"while + if": {
|
||||
"name": "while + if",
|
||||
"browser": "IE 11.0.0 (Windows 7 0.0.0)",
|
||||
"suite": "itar-short",
|
||||
"hz": 285034.8470662392,
|
||||
"success": true,
|
||||
"fastest": false,
|
||||
"rme": 0.015476162917584716,
|
||||
"rhz": 0.9294561322327022,
|
||||
"sampleSize": 213
|
||||
},
|
||||
"array join": {
|
||||
"name": "array join",
|
||||
"browser": "IE 11.0.0 (Windows 7 0.0.0)",
|
||||
"suite": "itar-short",
|
||||
"hz": 306668.42380343436,
|
||||
"success": true,
|
||||
"fastest": true,
|
||||
"rme": 0.015684034742271553,
|
||||
"rhz": 1,
|
||||
"sampleSize": 215
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { LibDefinition } from '../variable';
|
||||
export declare const esnext_typedarrays: LibDefinition;
|
||||
@@ -0,0 +1,96 @@
|
||||
// Adapted from Chris Veness' SHA1 code at
|
||||
// http://www.movable-type.co.uk/scripts/sha1.html
|
||||
function f(s, x, y, z) {
|
||||
switch (s) {
|
||||
case 0:
|
||||
return x & y ^ ~x & z;
|
||||
|
||||
case 1:
|
||||
return x ^ y ^ z;
|
||||
|
||||
case 2:
|
||||
return x & y ^ x & z ^ y & z;
|
||||
|
||||
case 3:
|
||||
return x ^ y ^ z;
|
||||
}
|
||||
}
|
||||
|
||||
function ROTL(x, n) {
|
||||
return x << n | x >>> 32 - n;
|
||||
}
|
||||
|
||||
function sha1(bytes) {
|
||||
var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
||||
var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
|
||||
|
||||
if (typeof bytes === 'string') {
|
||||
var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
||||
|
||||
bytes = [];
|
||||
|
||||
for (var i = 0; i < msg.length; ++i) {
|
||||
bytes.push(msg.charCodeAt(i));
|
||||
}
|
||||
} else if (!Array.isArray(bytes)) {
|
||||
// Convert Array-like to Array
|
||||
bytes = Array.prototype.slice.call(bytes);
|
||||
}
|
||||
|
||||
bytes.push(0x80);
|
||||
var l = bytes.length / 4 + 2;
|
||||
var N = Math.ceil(l / 16);
|
||||
var M = new Array(N);
|
||||
|
||||
for (var _i = 0; _i < N; ++_i) {
|
||||
var arr = new Uint32Array(16);
|
||||
|
||||
for (var j = 0; j < 16; ++j) {
|
||||
arr[j] = bytes[_i * 64 + j * 4] << 24 | bytes[_i * 64 + j * 4 + 1] << 16 | bytes[_i * 64 + j * 4 + 2] << 8 | bytes[_i * 64 + j * 4 + 3];
|
||||
}
|
||||
|
||||
M[_i] = arr;
|
||||
}
|
||||
|
||||
M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
|
||||
M[N - 1][14] = Math.floor(M[N - 1][14]);
|
||||
M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
|
||||
|
||||
for (var _i2 = 0; _i2 < N; ++_i2) {
|
||||
var W = new Uint32Array(80);
|
||||
|
||||
for (var t = 0; t < 16; ++t) {
|
||||
W[t] = M[_i2][t];
|
||||
}
|
||||
|
||||
for (var _t = 16; _t < 80; ++_t) {
|
||||
W[_t] = ROTL(W[_t - 3] ^ W[_t - 8] ^ W[_t - 14] ^ W[_t - 16], 1);
|
||||
}
|
||||
|
||||
var a = H[0];
|
||||
var b = H[1];
|
||||
var c = H[2];
|
||||
var d = H[3];
|
||||
var e = H[4];
|
||||
|
||||
for (var _t2 = 0; _t2 < 80; ++_t2) {
|
||||
var s = Math.floor(_t2 / 20);
|
||||
var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[_t2] >>> 0;
|
||||
e = d;
|
||||
d = c;
|
||||
c = ROTL(b, 30) >>> 0;
|
||||
b = a;
|
||||
a = T;
|
||||
}
|
||||
|
||||
H[0] = H[0] + a >>> 0;
|
||||
H[1] = H[1] + b >>> 0;
|
||||
H[2] = H[2] + c >>> 0;
|
||||
H[3] = H[3] + d >>> 0;
|
||||
H[4] = H[4] + e >>> 0;
|
||||
}
|
||||
|
||||
return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
|
||||
}
|
||||
|
||||
export default sha1;
|
||||
@@ -0,0 +1,110 @@
|
||||
export { abytes, anumber, bytesToHex, bytesToUtf8, concatBytes, hexToBytes, isBytes, randomBytes, utf8ToBytes, } from '@noble/hashes/utils.js';
|
||||
export type Hex = Uint8Array | string;
|
||||
export type PrivKey = Hex | bigint;
|
||||
export type CHash = {
|
||||
(message: Uint8Array | string): Uint8Array;
|
||||
blockLen: number;
|
||||
outputLen: number;
|
||||
create(opts?: {
|
||||
dkLen?: number;
|
||||
}): any;
|
||||
};
|
||||
export type FHash = (message: Uint8Array | string) => Uint8Array;
|
||||
export declare function abool(title: string, value: boolean): void;
|
||||
export declare function _abool2(value: boolean, title?: string): boolean;
|
||||
/** Asserts something is Uint8Array. */
|
||||
export declare function _abytes2(value: Uint8Array, length?: number, title?: string): Uint8Array;
|
||||
export declare function numberToHexUnpadded(num: number | bigint): string;
|
||||
export declare function hexToNumber(hex: string): bigint;
|
||||
export declare function bytesToNumberBE(bytes: Uint8Array): bigint;
|
||||
export declare function bytesToNumberLE(bytes: Uint8Array): bigint;
|
||||
export declare function numberToBytesBE(n: number | bigint, len: number): Uint8Array;
|
||||
export declare function numberToBytesLE(n: number | bigint, len: number): Uint8Array;
|
||||
export declare function numberToVarBytesBE(n: number | bigint): Uint8Array;
|
||||
/**
|
||||
* Takes hex string or Uint8Array, converts to Uint8Array.
|
||||
* Validates output length.
|
||||
* Will throw error for other types.
|
||||
* @param title descriptive title for an error e.g. 'secret key'
|
||||
* @param hex hex string or Uint8Array
|
||||
* @param expectedLength optional, will compare to result array's length
|
||||
* @returns
|
||||
*/
|
||||
export declare function ensureBytes(title: string, hex: Hex, expectedLength?: number): Uint8Array;
|
||||
export declare function equalBytes(a: Uint8Array, b: Uint8Array): boolean;
|
||||
/**
|
||||
* Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer,
|
||||
* and Buffer#slice creates mutable copy. Never use Buffers!
|
||||
*/
|
||||
export declare function copyBytes(bytes: Uint8Array): Uint8Array;
|
||||
/**
|
||||
* Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols
|
||||
* Should be safe to use for things expected to be ASCII.
|
||||
* Returns exact same result as utf8ToBytes for ASCII or throws.
|
||||
*/
|
||||
export declare function asciiToBytes(ascii: string): Uint8Array;
|
||||
export declare function inRange(n: bigint, min: bigint, max: bigint): boolean;
|
||||
/**
|
||||
* Asserts min <= n < max. NOTE: It's < max and not <= max.
|
||||
* @example
|
||||
* aInRange('x', x, 1n, 256n); // would assume x is in (1n..255n)
|
||||
*/
|
||||
export declare function aInRange(title: string, n: bigint, min: bigint, max: bigint): void;
|
||||
/**
|
||||
* Calculates amount of bits in a bigint.
|
||||
* Same as `n.toString(2).length`
|
||||
* TODO: merge with nLength in modular
|
||||
*/
|
||||
export declare function bitLen(n: bigint): number;
|
||||
/**
|
||||
* Gets single bit at position.
|
||||
* NOTE: first bit position is 0 (same as arrays)
|
||||
* Same as `!!+Array.from(n.toString(2)).reverse()[pos]`
|
||||
*/
|
||||
export declare function bitGet(n: bigint, pos: number): bigint;
|
||||
/**
|
||||
* Sets single bit at position.
|
||||
*/
|
||||
export declare function bitSet(n: bigint, pos: number, value: boolean): bigint;
|
||||
/**
|
||||
* Calculate mask for N bits. Not using ** operator with bigints because of old engines.
|
||||
* Same as BigInt(`0b${Array(i).fill('1').join('')}`)
|
||||
*/
|
||||
export declare const bitMask: (n: number) => bigint;
|
||||
type Pred<T> = (v: Uint8Array) => T | undefined;
|
||||
/**
|
||||
* Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.
|
||||
* @returns function that will call DRBG until 2nd arg returns something meaningful
|
||||
* @example
|
||||
* const drbg = createHmacDRBG<Key>(32, 32, hmac);
|
||||
* drbg(seed, bytesToKey); // bytesToKey must return Key or undefined
|
||||
*/
|
||||
export declare function createHmacDrbg<T>(hashLen: number, qByteLen: number, hmacFn: (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array): (seed: Uint8Array, predicate: Pred<T>) => T;
|
||||
declare const validatorFns: {
|
||||
readonly bigint: (val: any) => boolean;
|
||||
readonly function: (val: any) => boolean;
|
||||
readonly boolean: (val: any) => boolean;
|
||||
readonly string: (val: any) => boolean;
|
||||
readonly stringOrUint8Array: (val: any) => boolean;
|
||||
readonly isSafeInteger: (val: any) => boolean;
|
||||
readonly array: (val: any) => boolean;
|
||||
readonly field: (val: any, object: any) => any;
|
||||
readonly hash: (val: any) => boolean;
|
||||
};
|
||||
type Validator = keyof typeof validatorFns;
|
||||
type ValMap<T extends Record<string, any>> = {
|
||||
[K in keyof T]?: Validator;
|
||||
};
|
||||
export declare function validateObject<T extends Record<string, any>>(object: T, validators: ValMap<T>, optValidators?: ValMap<T>): T;
|
||||
export declare function isHash(val: CHash): boolean;
|
||||
export declare function _validateObject(object: Record<string, any>, fields: Record<string, string>, optFields?: Record<string, string>): void;
|
||||
/**
|
||||
* throws not implemented error
|
||||
*/
|
||||
export declare const notImplemented: () => never;
|
||||
/**
|
||||
* Memoizes (caches) computation result.
|
||||
* Uses WeakMap: the value is going auto-cleaned by GC after last reference is removed.
|
||||
*/
|
||||
export declare function memoized<T extends object, R, O extends any[]>(fn: (arg: T, ...args: O) => R): (arg: T, ...args: O) => R;
|
||||
//# sourceMappingURL=utils.d.ts.map
|
||||
@@ -0,0 +1,82 @@
|
||||
import * as core from "../core/index.js";
|
||||
import { type ZodError, ZodRealError } from "./errors.js";
|
||||
|
||||
export type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
|
||||
export type ZodSafeParseSuccess<T> = { success: true; data: T; error?: never };
|
||||
export type ZodSafeParseError<T> = { success: false; data?: never; error: ZodError<T> };
|
||||
|
||||
export const parse: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: unknown,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>,
|
||||
_params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }
|
||||
) => core.output<T> = /* @__PURE__ */ core._parse(ZodRealError);
|
||||
|
||||
export const parseAsync: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: unknown,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>,
|
||||
_params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }
|
||||
) => Promise<core.output<T>> = /* @__PURE__ */ core._parseAsync(ZodRealError);
|
||||
|
||||
export const safeParse: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: unknown,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>
|
||||
// _params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }
|
||||
) => ZodSafeParseResult<core.output<T>> = /* @__PURE__ */ core._safeParse(ZodRealError) as any;
|
||||
|
||||
export const safeParseAsync: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: unknown,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>
|
||||
) => Promise<ZodSafeParseResult<core.output<T>>> = /* @__PURE__ */ core._safeParseAsync(ZodRealError) as any;
|
||||
|
||||
// Codec functions
|
||||
export const encode: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: core.output<T>,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>
|
||||
) => core.input<T> = /* @__PURE__ */ core._encode(ZodRealError);
|
||||
|
||||
export const decode: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: core.input<T>,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>
|
||||
) => core.output<T> = /* @__PURE__ */ core._decode(ZodRealError);
|
||||
|
||||
export const encodeAsync: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: core.output<T>,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>
|
||||
) => Promise<core.input<T>> = /* @__PURE__ */ core._encodeAsync(ZodRealError);
|
||||
|
||||
export const decodeAsync: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: core.input<T>,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>
|
||||
) => Promise<core.output<T>> = /* @__PURE__ */ core._decodeAsync(ZodRealError);
|
||||
|
||||
export const safeEncode: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: core.output<T>,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>
|
||||
) => ZodSafeParseResult<core.input<T>> = /* @__PURE__ */ core._safeEncode(ZodRealError) as any;
|
||||
|
||||
export const safeDecode: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: core.input<T>,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>
|
||||
) => ZodSafeParseResult<core.output<T>> = /* @__PURE__ */ core._safeDecode(ZodRealError) as any;
|
||||
|
||||
export const safeEncodeAsync: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: core.output<T>,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>
|
||||
) => Promise<ZodSafeParseResult<core.input<T>>> = /* @__PURE__ */ core._safeEncodeAsync(ZodRealError) as any;
|
||||
|
||||
export const safeDecodeAsync: <T extends core.$ZodType>(
|
||||
schema: T,
|
||||
value: core.input<T>,
|
||||
_ctx?: core.ParseContext<core.$ZodIssue>
|
||||
) => Promise<ZodSafeParseResult<core.output<T>>> = /* @__PURE__ */ core._safeDecodeAsync(ZodRealError) as any;
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Referencer = void 0;
|
||||
var Referencer_1 = require("./Referencer");
|
||||
Object.defineProperty(exports, "Referencer", { enumerable: true, get: function () { return Referencer_1.Referencer; } });
|
||||
@@ -0,0 +1,9 @@
|
||||
function _applyDecoratedDescriptor(i, e, r, n, l) {
|
||||
var a = {};
|
||||
return Object.keys(n).forEach(function (i) {
|
||||
a[i] = n[i];
|
||||
}), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function (r, n) {
|
||||
return n(i, e, r) || r;
|
||||
}, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a;
|
||||
}
|
||||
module.exports = _applyDecoratedDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "webidl-conversions",
|
||||
"version": "3.0.1",
|
||||
"description": "Implements the WebIDL algorithms for converting to and from JavaScript values",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"test": "mocha test/*.js"
|
||||
},
|
||||
"repository": "jsdom/webidl-conversions",
|
||||
"keywords": [
|
||||
"webidl",
|
||||
"web",
|
||||
"types"
|
||||
],
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"author": "Domenic Denicola <d@domenic.me> (https://domenic.me/)",
|
||||
"license": "BSD-2-Clause",
|
||||
"devDependencies": {
|
||||
"mocha": "^1.21.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
import { HookHandler, UserConfig, ConfigEnv } from 'vite';
|
||||
export { ConfigEnv, Plugin, UserConfig as ViteUserConfig, mergeConfig } from 'vite';
|
||||
import { I as InlineConfig, C as CoverageOptions, F as FieldsWithDefaultValues, U as UserWorkspaceConfig, b as UserProjectConfigFn, c as UserProjectConfigExport } from './chunks/reporters.d.DtoKVV2s.js';
|
||||
export { a as TestProjectConfiguration, d as TestProjectInlineConfiguration, e as TestUserConfig, W as WatcherTriggerPattern } from './chunks/reporters.d.DtoKVV2s.js';
|
||||
import { V as VitestPluginContext } from './chunks/plugin.d.DwFIiJ7i.js';
|
||||
import { F as FakeTimerInstallOpts } from './chunks/config.d.A1h_Y6Jt.js';
|
||||
export { TestTagDefinition } from '@vitest/runner';
|
||||
import '@vitest/utils';
|
||||
import './chunks/traces.d.D2T_R8rx.js';
|
||||
import 'node:stream';
|
||||
import './chunks/browser.d.BcoexmFG.js';
|
||||
import './chunks/worker.d.ZpHpO4yb.js';
|
||||
import 'vite/module-runner';
|
||||
import './chunks/environment.d.CrsxCzP1.js';
|
||||
import './chunks/rpc.d.B_8sPU0w.js';
|
||||
import '@vitest/snapshot';
|
||||
import '@vitest/pretty-format';
|
||||
import '@vitest/utils/diff';
|
||||
import '@vitest/expect';
|
||||
import 'vitest/optional-types.js';
|
||||
import './chunks/benchmark.d.DAaHLpsq.js';
|
||||
import '@vitest/runner/utils';
|
||||
import 'tinybench';
|
||||
import '@vitest/mocker';
|
||||
import '@vitest/utils/source-map';
|
||||
import 'vitest/browser';
|
||||
import './chunks/coverage.d.BZtK59WP.js';
|
||||
import '@vitest/snapshot/manager';
|
||||
import 'node:console';
|
||||
import 'node:fs';
|
||||
|
||||
type VitestInlineConfig = InlineConfig;
|
||||
declare module "vite" {
|
||||
interface UserConfig {
|
||||
/**
|
||||
* Options for Vitest
|
||||
*/
|
||||
test?: VitestInlineConfig;
|
||||
}
|
||||
interface Plugin<A = any> {
|
||||
configureVitest?: HookHandler<(context: VitestPluginContext) => void>;
|
||||
}
|
||||
}
|
||||
|
||||
declare const defaultBrowserPort = 63315;
|
||||
|
||||
declare const defaultInclude: string[];
|
||||
declare const defaultExclude: string[];
|
||||
declare const coverageConfigDefaults: Required<Pick<CoverageOptions, FieldsWithDefaultValues>>;
|
||||
declare const configDefaults: Readonly<{
|
||||
allowOnly: boolean;
|
||||
isolate: boolean;
|
||||
watch: boolean;
|
||||
globals: boolean;
|
||||
environment: "node";
|
||||
clearMocks: boolean;
|
||||
restoreMocks: boolean;
|
||||
mockReset: boolean;
|
||||
unstubGlobals: boolean;
|
||||
unstubEnvs: boolean;
|
||||
include: string[];
|
||||
exclude: string[];
|
||||
teardownTimeout: number;
|
||||
forceRerunTriggers: string[];
|
||||
update: boolean;
|
||||
reporters: never[];
|
||||
silent: boolean;
|
||||
hideSkippedTests: boolean;
|
||||
api: boolean;
|
||||
ui: boolean;
|
||||
uiBase: string;
|
||||
open: boolean;
|
||||
css: {
|
||||
include: never[];
|
||||
};
|
||||
coverage: CoverageOptions;
|
||||
fakeTimers: FakeTimerInstallOpts;
|
||||
maxConcurrency: number;
|
||||
dangerouslyIgnoreUnhandledErrors: boolean;
|
||||
typecheck: {
|
||||
checker: "tsc";
|
||||
include: string[];
|
||||
exclude: string[];
|
||||
};
|
||||
slowTestThreshold: number;
|
||||
disableConsoleIntercept: boolean;
|
||||
detectAsyncLeaks: boolean;
|
||||
}>;
|
||||
|
||||
type ViteUserConfigFnObject = (env: ConfigEnv) => UserConfig;
|
||||
type ViteUserConfigFnPromise = (env: ConfigEnv) => Promise<UserConfig>;
|
||||
type ViteUserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
||||
type ViteUserConfigExport = UserConfig | Promise<UserConfig> | ViteUserConfigFnObject | ViteUserConfigFnPromise | ViteUserConfigFn;
|
||||
declare function defineConfig(config: UserConfig): UserConfig;
|
||||
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
||||
declare function defineConfig(config: ViteUserConfigFnObject): ViteUserConfigFnObject;
|
||||
declare function defineConfig(config: ViteUserConfigFnPromise): ViteUserConfigFnPromise;
|
||||
declare function defineConfig(config: ViteUserConfigExport): ViteUserConfigExport;
|
||||
declare function defineProject(config: UserWorkspaceConfig): UserWorkspaceConfig;
|
||||
declare function defineProject(config: Promise<UserWorkspaceConfig>): Promise<UserWorkspaceConfig>;
|
||||
declare function defineProject(config: UserProjectConfigFn): UserProjectConfigFn;
|
||||
declare function defineProject(config: UserProjectConfigExport): UserProjectConfigExport;
|
||||
|
||||
export { UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig, configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject };
|
||||
export type { ViteUserConfigExport, ViteUserConfigFn, ViteUserConfigFnObject, ViteUserConfigFnPromise };
|
||||
@@ -0,0 +1,43 @@
|
||||
let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes))
|
||||
|
||||
let customAlphabet = (alphabet, defaultSize = 21) => {
|
||||
let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
|
||||
|
||||
|
||||
|
||||
let step = -~((1.6 * mask * defaultSize) / alphabet.length)
|
||||
|
||||
return async (size = defaultSize) => {
|
||||
if (size <= 0) return ''
|
||||
let id = ''
|
||||
while (true) {
|
||||
let bytes = crypto.getRandomValues(new Uint8Array(step))
|
||||
let i = step | 0
|
||||
while (i--) {
|
||||
id += alphabet[bytes[i] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let nanoid = async (size = 21) => {
|
||||
let id = ''
|
||||
let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))
|
||||
|
||||
while (size--) {
|
||||
let byte = bytes[size] & 63
|
||||
if (byte < 36) {
|
||||
id += byte.toString(36)
|
||||
} else if (byte < 62) {
|
||||
id += (byte - 26).toString(36).toUpperCase()
|
||||
} else if (byte < 63) {
|
||||
id += '_'
|
||||
} else {
|
||||
id += '-'
|
||||
}
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
module.exports = { nanoid, customAlphabet, random }
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { ParserServicesWithTypeInformation } from '@typescript-eslint/utils';
|
||||
import type { InterfaceType, Type } from 'typescript';
|
||||
export declare function hasBaseTypes(type: Type): type is InterfaceType;
|
||||
/**
|
||||
* Recursively checks if a type or any of its base types matches the provided
|
||||
* matcher function.
|
||||
* @param services Parser services with type information
|
||||
* @param matcher Function to test if a type matches the desired criteria
|
||||
* @param type The type to check
|
||||
* @param seen Set of already visited types to prevent infinite recursion
|
||||
* @returns `true` if the type or any of its base types match the matcher
|
||||
*/
|
||||
export declare function matchesTypeOrBaseType(services: ParserServicesWithTypeInformation, matcher: (type: Type) => boolean, type: Type, seen?: Set<Type>): boolean;
|
||||
@@ -0,0 +1,233 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path')
|
||||
, Stream = require('stream').Stream
|
||||
, split = require('split2')
|
||||
, util = require('util')
|
||||
, defaultPort = 5432
|
||||
, isWin = (process.platform === 'win32')
|
||||
, warnStream = process.stderr
|
||||
;
|
||||
|
||||
|
||||
var S_IRWXG = 56 // 00070(8)
|
||||
, S_IRWXO = 7 // 00007(8)
|
||||
, S_IFMT = 61440 // 00170000(8)
|
||||
, S_IFREG = 32768 // 0100000(8)
|
||||
;
|
||||
function isRegFile(mode) {
|
||||
return ((mode & S_IFMT) == S_IFREG);
|
||||
}
|
||||
|
||||
var fieldNames = [ 'host', 'port', 'database', 'user', 'password' ];
|
||||
var nrOfFields = fieldNames.length;
|
||||
var passKey = fieldNames[ nrOfFields -1 ];
|
||||
|
||||
|
||||
function warn() {
|
||||
var isWritable = (
|
||||
warnStream instanceof Stream &&
|
||||
true === warnStream.writable
|
||||
);
|
||||
|
||||
if (isWritable) {
|
||||
var args = Array.prototype.slice.call(arguments).concat("\n");
|
||||
warnStream.write( util.format.apply(util, args) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Object.defineProperty(module.exports, 'isWin', {
|
||||
get : function() {
|
||||
return isWin;
|
||||
} ,
|
||||
set : function(val) {
|
||||
isWin = val;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
module.exports.warnTo = function(stream) {
|
||||
var old = warnStream;
|
||||
warnStream = stream;
|
||||
return old;
|
||||
};
|
||||
|
||||
module.exports.getFileName = function(rawEnv){
|
||||
var env = rawEnv || process.env;
|
||||
var file = env.PGPASSFILE || (
|
||||
isWin ?
|
||||
path.join( env.APPDATA || './' , 'postgresql', 'pgpass.conf' ) :
|
||||
path.join( env.HOME || './', '.pgpass' )
|
||||
);
|
||||
return file;
|
||||
};
|
||||
|
||||
module.exports.usePgPass = function(stats, fname) {
|
||||
if (Object.prototype.hasOwnProperty.call(process.env, 'PGPASSWORD')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isWin) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fname = fname || '<unkn>';
|
||||
|
||||
if (! isRegFile(stats.mode)) {
|
||||
warn('WARNING: password file "%s" is not a plain file', fname);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stats.mode & (S_IRWXG | S_IRWXO)) {
|
||||
/* If password file is insecure, alert the user and ignore it. */
|
||||
warn('WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less', fname);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
var matcher = module.exports.match = function(connInfo, entry) {
|
||||
return fieldNames.slice(0, -1).reduce(function(prev, field, idx){
|
||||
if (idx == 1) {
|
||||
// the port
|
||||
if ( Number( connInfo[field] || defaultPort ) === Number( entry[field] ) ) {
|
||||
return prev && true;
|
||||
}
|
||||
}
|
||||
return prev && (
|
||||
entry[field] === '*' ||
|
||||
entry[field] === connInfo[field]
|
||||
);
|
||||
}, true);
|
||||
};
|
||||
|
||||
|
||||
module.exports.getPassword = function(connInfo, stream, cb) {
|
||||
var pass;
|
||||
var lineStream = stream.pipe(split());
|
||||
|
||||
function onLine(line) {
|
||||
var entry = parseLine(line);
|
||||
if (entry && isValidEntry(entry) && matcher(connInfo, entry)) {
|
||||
pass = entry[passKey];
|
||||
lineStream.end(); // -> calls onEnd(), but pass is set now
|
||||
}
|
||||
}
|
||||
|
||||
var onEnd = function() {
|
||||
stream.destroy();
|
||||
cb(pass);
|
||||
};
|
||||
|
||||
var onErr = function(err) {
|
||||
stream.destroy();
|
||||
warn('WARNING: error on reading file: %s', err);
|
||||
cb(undefined);
|
||||
};
|
||||
|
||||
stream.on('error', onErr);
|
||||
lineStream
|
||||
.on('data', onLine)
|
||||
.on('end', onEnd)
|
||||
.on('error', onErr)
|
||||
;
|
||||
|
||||
};
|
||||
|
||||
|
||||
var parseLine = module.exports.parseLine = function(line) {
|
||||
if (line.length < 11 || line.match(/^\s+#/)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var curChar = '';
|
||||
var prevChar = '';
|
||||
var fieldIdx = 0;
|
||||
var startIdx = 0;
|
||||
var endIdx = 0;
|
||||
var obj = {};
|
||||
var isLastField = false;
|
||||
var addToObj = function(idx, i0, i1) {
|
||||
var field = line.substring(i0, i1);
|
||||
|
||||
if (! Object.hasOwnProperty.call(process.env, 'PGPASS_NO_DEESCAPE')) {
|
||||
field = field.replace(/\\([:\\])/g, '$1');
|
||||
}
|
||||
|
||||
obj[ fieldNames[idx] ] = field;
|
||||
};
|
||||
|
||||
for (var i = 0 ; i < line.length-1 ; i += 1) {
|
||||
curChar = line.charAt(i+1);
|
||||
prevChar = line.charAt(i);
|
||||
|
||||
isLastField = (fieldIdx == nrOfFields-1);
|
||||
|
||||
if (isLastField) {
|
||||
addToObj(fieldIdx, startIdx);
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= 0 && curChar == ':' && prevChar !== '\\') {
|
||||
addToObj(fieldIdx, startIdx, i+1);
|
||||
|
||||
startIdx = i+2;
|
||||
fieldIdx += 1;
|
||||
}
|
||||
}
|
||||
|
||||
obj = ( Object.keys(obj).length === nrOfFields ) ? obj : null;
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
|
||||
var isValidEntry = module.exports.isValidEntry = function(entry){
|
||||
var rules = {
|
||||
// host
|
||||
0 : function(x){
|
||||
return x.length > 0;
|
||||
} ,
|
||||
// port
|
||||
1 : function(x){
|
||||
if (x === '*') {
|
||||
return true;
|
||||
}
|
||||
x = Number(x);
|
||||
return (
|
||||
isFinite(x) &&
|
||||
x > 0 &&
|
||||
x < 9007199254740992 &&
|
||||
Math.floor(x) === x
|
||||
);
|
||||
} ,
|
||||
// database
|
||||
2 : function(x){
|
||||
return x.length > 0;
|
||||
} ,
|
||||
// username
|
||||
3 : function(x){
|
||||
return x.length > 0;
|
||||
} ,
|
||||
// password
|
||||
4 : function(x){
|
||||
return x.length > 0;
|
||||
}
|
||||
};
|
||||
|
||||
for (var idx = 0 ; idx < fieldNames.length ; idx += 1) {
|
||||
var rule = rules[idx];
|
||||
var value = entry[ fieldNames[idx] ] || '';
|
||||
|
||||
var res = rule(value);
|
||||
if (!res) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "vscode-jsonrpc",
|
||||
"description": "A json rpc implementation over streams",
|
||||
"version": "9.0.0",
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/vscode-languageserver-node.git",
|
||||
"directory": "jsonrpc"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/vscode-languageserver-node/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./lib/common/api.d.ts",
|
||||
"default": "./lib/common/api.js"
|
||||
},
|
||||
"./node": {
|
||||
"types": "./lib/node/main.d.ts",
|
||||
"node": "./lib/node/main.js"
|
||||
},
|
||||
"./browser": {
|
||||
"types": "./lib/browser/main.d.ts",
|
||||
"browser": "./lib/browser/main.js"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/msgpack-lite": "^0.1.12",
|
||||
"msgpack-lite": "^0.1.26"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "echo \"⛔ Can only publish from a secure pipeline ⛔\" && node ../build/npm/fail",
|
||||
"prepack": "npm run all:publish",
|
||||
"preversion": "npm test",
|
||||
"compile": "tsc -b ./tsconfig.json",
|
||||
"watch": "tsc -b ./tsconfig.watch.json -w",
|
||||
"clean": "rimraf lib && rimraf dist",
|
||||
"lint": "eslint src",
|
||||
"test": "npm run test:node && npm run test:browser",
|
||||
"test:node": "node ../node_modules/mocha/bin/_mocha",
|
||||
"test:browser": "npm run webpack:test:silent && node ../build/bin/runBrowserTests.js http://127.0.0.1:8080/jsonrpc/src/browser/test/",
|
||||
"webpack": "node ../build/bin/webpack --mode none --config ./webpack.config.js",
|
||||
"webpack:test": "node ../build/bin/webpack --mode none --config ./src/browser/test/webpack.config.js",
|
||||
"webpack:test:silent": "node ../build/bin/webpack --no-stats --mode none --config ./src/browser/test/webpack.config.js",
|
||||
"all": "npm run clean && npm run compile && npm run lint && npm run test",
|
||||
"compile:publish": "tsc -b ./tsconfig.publish.json",
|
||||
"all:publish": "git clean -xfd . && npm install && npm run compile:publish && npm run lint && npm run test"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
var _typeof = require("./typeof.js")["default"];
|
||||
var setFunctionName = require("./setFunctionName.js");
|
||||
var toPropertyKey = require("./toPropertyKey.js");
|
||||
function applyDecs2203RFactory() {
|
||||
function createAddInitializerMethod(e, t) {
|
||||
return function (r) {
|
||||
!function (e) {
|
||||
if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
|
||||
}(t), assertCallable(r, "An initializer"), e.push(r);
|
||||
};
|
||||
}
|
||||
function memberDec(e, t, r, n, a, i, o, s) {
|
||||
var c;
|
||||
switch (a) {
|
||||
case 1:
|
||||
c = "accessor";
|
||||
break;
|
||||
case 2:
|
||||
c = "method";
|
||||
break;
|
||||
case 3:
|
||||
c = "getter";
|
||||
break;
|
||||
case 4:
|
||||
c = "setter";
|
||||
break;
|
||||
default:
|
||||
c = "field";
|
||||
}
|
||||
var l,
|
||||
u,
|
||||
f = {
|
||||
kind: c,
|
||||
name: o ? "#" + t : toPropertyKey(t),
|
||||
"static": i,
|
||||
"private": o
|
||||
},
|
||||
p = {
|
||||
v: !1
|
||||
};
|
||||
0 !== a && (f.addInitializer = createAddInitializerMethod(n, p)), 0 === a ? o ? (l = r.get, u = r.set) : (l = function l() {
|
||||
return this[t];
|
||||
}, u = function u(e) {
|
||||
this[t] = e;
|
||||
}) : 2 === a ? l = function l() {
|
||||
return r.value;
|
||||
} : (1 !== a && 3 !== a || (l = function l() {
|
||||
return r.get.call(this);
|
||||
}), 1 !== a && 4 !== a || (u = function u(e) {
|
||||
r.set.call(this, e);
|
||||
})), f.access = l && u ? {
|
||||
get: l,
|
||||
set: u
|
||||
} : l ? {
|
||||
get: l
|
||||
} : {
|
||||
set: u
|
||||
};
|
||||
try {
|
||||
return e(s, f);
|
||||
} finally {
|
||||
p.v = !0;
|
||||
}
|
||||
}
|
||||
function assertCallable(e, t) {
|
||||
if ("function" != typeof e) throw new TypeError(t + " must be a function");
|
||||
}
|
||||
function assertValidReturnValue(e, t) {
|
||||
var r = _typeof(t);
|
||||
if (1 === e) {
|
||||
if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
|
||||
} else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0");
|
||||
}
|
||||
function applyMemberDec(e, t, r, n, a, i, o, s) {
|
||||
var c,
|
||||
l,
|
||||
u,
|
||||
f,
|
||||
p,
|
||||
d,
|
||||
h,
|
||||
v = r[0];
|
||||
if (o ? (0 === a || 1 === a ? (c = {
|
||||
get: r[3],
|
||||
set: r[4]
|
||||
}, u = "get") : 3 === a ? (c = {
|
||||
get: r[3]
|
||||
}, u = "get") : 4 === a ? (c = {
|
||||
set: r[3]
|
||||
}, u = "set") : c = {
|
||||
value: r[3]
|
||||
}, 0 !== a && (1 === a && setFunctionName(r[4], "#" + n, "set"), setFunctionName(r[3], "#" + n, u))) : 0 !== a && (c = Object.getOwnPropertyDescriptor(t, n)), 1 === a ? f = {
|
||||
get: c.get,
|
||||
set: c.set
|
||||
} : 2 === a ? f = c.value : 3 === a ? f = c.get : 4 === a && (f = c.set), "function" == typeof v) void 0 !== (p = memberDec(v, n, c, s, a, i, o, f)) && (assertValidReturnValue(a, p), 0 === a ? l = p : 1 === a ? (l = p.init, d = p.get || f.get, h = p.set || f.set, f = {
|
||||
get: d,
|
||||
set: h
|
||||
}) : f = p);else for (var g = v.length - 1; g >= 0; g--) {
|
||||
var y;
|
||||
void 0 !== (p = memberDec(v[g], n, c, s, a, i, o, f)) && (assertValidReturnValue(a, p), 0 === a ? y = p : 1 === a ? (y = p.init, d = p.get || f.get, h = p.set || f.set, f = {
|
||||
get: d,
|
||||
set: h
|
||||
}) : f = p, void 0 !== y && (void 0 === l ? l = y : "function" == typeof l ? l = [l, y] : l.push(y)));
|
||||
}
|
||||
if (0 === a || 1 === a) {
|
||||
if (void 0 === l) l = function l(e, t) {
|
||||
return t;
|
||||
};else if ("function" != typeof l) {
|
||||
var m = l;
|
||||
l = function l(e, t) {
|
||||
for (var r = t, n = 0; n < m.length; n++) r = m[n].call(e, r);
|
||||
return r;
|
||||
};
|
||||
} else {
|
||||
var b = l;
|
||||
l = function l(e, t) {
|
||||
return b.call(e, t);
|
||||
};
|
||||
}
|
||||
e.push(l);
|
||||
}
|
||||
0 !== a && (1 === a ? (c.get = f.get, c.set = f.set) : 2 === a ? c.value = f : 3 === a ? c.get = f : 4 === a && (c.set = f), o ? 1 === a ? (e.push(function (e, t) {
|
||||
return f.get.call(e, t);
|
||||
}), e.push(function (e, t) {
|
||||
return f.set.call(e, t);
|
||||
})) : 2 === a ? e.push(f) : e.push(function (e, t) {
|
||||
return f.call(e, t);
|
||||
}) : Object.defineProperty(t, n, c));
|
||||
}
|
||||
function applyMemberDecs(e, t) {
|
||||
for (var r, n, a = [], i = new Map(), o = new Map(), s = 0; s < t.length; s++) {
|
||||
var c = t[s];
|
||||
if (Array.isArray(c)) {
|
||||
var l,
|
||||
u,
|
||||
f = c[1],
|
||||
p = c[2],
|
||||
d = c.length > 3,
|
||||
h = f >= 5;
|
||||
if (h ? (l = e, 0 != (f -= 5) && (u = n = n || [])) : (l = e.prototype, 0 !== f && (u = r = r || [])), 0 !== f && !d) {
|
||||
var v = h ? o : i,
|
||||
g = v.get(p) || 0;
|
||||
if (!0 === g || 3 === g && 4 !== f || 4 === g && 3 !== f) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + p);
|
||||
!g && f > 2 ? v.set(p, f) : v.set(p, !0);
|
||||
}
|
||||
applyMemberDec(a, l, c, p, f, h, d, u);
|
||||
}
|
||||
}
|
||||
return pushInitializers(a, r), pushInitializers(a, n), a;
|
||||
}
|
||||
function pushInitializers(e, t) {
|
||||
t && e.push(function (e) {
|
||||
for (var r = 0; r < t.length; r++) t[r].call(e);
|
||||
return e;
|
||||
});
|
||||
}
|
||||
return function (e, t, r) {
|
||||
return {
|
||||
e: applyMemberDecs(e, t),
|
||||
get c() {
|
||||
return function (e, t) {
|
||||
if (t.length > 0) {
|
||||
for (var r = [], n = e, a = e.name, i = t.length - 1; i >= 0; i--) {
|
||||
var o = {
|
||||
v: !1
|
||||
};
|
||||
try {
|
||||
var s = t[i](n, {
|
||||
kind: "class",
|
||||
name: a,
|
||||
addInitializer: createAddInitializerMethod(r, o)
|
||||
});
|
||||
} finally {
|
||||
o.v = !0;
|
||||
}
|
||||
void 0 !== s && (assertValidReturnValue(10, s), n = s);
|
||||
}
|
||||
return [n, function () {
|
||||
for (var e = 0; e < r.length; e++) r[e].call(n);
|
||||
}];
|
||||
}
|
||||
}(e, r);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
function applyDecs2203R(e, t, r) {
|
||||
return (module.exports = applyDecs2203R = applyDecs2203RFactory(), module.exports.__esModule = true, module.exports["default"] = module.exports)(e, t, r);
|
||||
}
|
||||
module.exports = applyDecs2203R, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright 2017 Lovell Fuller and others.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export const GLIBC: 'glibc';
|
||||
export const MUSL: 'musl';
|
||||
|
||||
export function family(): Promise<string | null>;
|
||||
export function familySync(): string | null;
|
||||
|
||||
export function isNonGlibcLinux(): Promise<boolean>;
|
||||
export function isNonGlibcLinuxSync(): boolean;
|
||||
|
||||
export function version(): Promise<string | null>;
|
||||
export function versionSync(): string | null;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,184 @@
|
||||
'use strict';
|
||||
|
||||
const WIN_SLASH = '\\\\/';
|
||||
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
||||
|
||||
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
||||
|
||||
/**
|
||||
* Posix glob regex
|
||||
*/
|
||||
|
||||
const DOT_LITERAL = '\\.';
|
||||
const PLUS_LITERAL = '\\+';
|
||||
const QMARK_LITERAL = '\\?';
|
||||
const SLASH_LITERAL = '\\/';
|
||||
const ONE_CHAR = '(?=.)';
|
||||
const QMARK = '[^/]';
|
||||
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
||||
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
||||
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
||||
const NO_DOT = `(?!${DOT_LITERAL})`;
|
||||
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
||||
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
||||
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
||||
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
||||
const STAR = `${QMARK}*?`;
|
||||
const SEP = '/';
|
||||
|
||||
const POSIX_CHARS = {
|
||||
DOT_LITERAL,
|
||||
PLUS_LITERAL,
|
||||
QMARK_LITERAL,
|
||||
SLASH_LITERAL,
|
||||
ONE_CHAR,
|
||||
QMARK,
|
||||
END_ANCHOR,
|
||||
DOTS_SLASH,
|
||||
NO_DOT,
|
||||
NO_DOTS,
|
||||
NO_DOT_SLASH,
|
||||
NO_DOTS_SLASH,
|
||||
QMARK_NO_DOT,
|
||||
STAR,
|
||||
START_ANCHOR,
|
||||
SEP
|
||||
};
|
||||
|
||||
/**
|
||||
* Windows glob regex
|
||||
*/
|
||||
|
||||
const WINDOWS_CHARS = {
|
||||
...POSIX_CHARS,
|
||||
|
||||
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
||||
QMARK: WIN_NO_SLASH,
|
||||
STAR: `${WIN_NO_SLASH}*?`,
|
||||
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
||||
NO_DOT: `(?!${DOT_LITERAL})`,
|
||||
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
||||
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
||||
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
||||
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
||||
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
||||
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
||||
SEP: '\\'
|
||||
};
|
||||
|
||||
/**
|
||||
* POSIX Bracket Regex
|
||||
*/
|
||||
|
||||
const POSIX_REGEX_SOURCE = {
|
||||
__proto__: null,
|
||||
alnum: 'a-zA-Z0-9',
|
||||
alpha: 'a-zA-Z',
|
||||
ascii: '\\x00-\\x7F',
|
||||
blank: ' \\t',
|
||||
cntrl: '\\x00-\\x1F\\x7F',
|
||||
digit: '0-9',
|
||||
graph: '\\x21-\\x7E',
|
||||
lower: 'a-z',
|
||||
print: '\\x20-\\x7E ',
|
||||
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
||||
space: ' \\t\\r\\n\\v\\f',
|
||||
upper: 'A-Z',
|
||||
word: 'A-Za-z0-9_',
|
||||
xdigit: 'A-Fa-f0-9'
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
DEFAULT_MAX_EXTGLOB_RECURSION,
|
||||
MAX_LENGTH: 1024 * 64,
|
||||
POSIX_REGEX_SOURCE,
|
||||
|
||||
// regular expressions
|
||||
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
||||
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
||||
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
||||
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
||||
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
||||
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
||||
|
||||
// Replace globs with equivalent patterns to reduce parsing time.
|
||||
REPLACEMENTS: {
|
||||
__proto__: null,
|
||||
'***': '*',
|
||||
'**/**': '**',
|
||||
'**/**/**': '**'
|
||||
},
|
||||
|
||||
// Digits
|
||||
CHAR_0: 48, /* 0 */
|
||||
CHAR_9: 57, /* 9 */
|
||||
|
||||
// Alphabet chars.
|
||||
CHAR_UPPERCASE_A: 65, /* A */
|
||||
CHAR_LOWERCASE_A: 97, /* a */
|
||||
CHAR_UPPERCASE_Z: 90, /* Z */
|
||||
CHAR_LOWERCASE_Z: 122, /* z */
|
||||
|
||||
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
||||
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
||||
|
||||
CHAR_ASTERISK: 42, /* * */
|
||||
|
||||
// Non-alphabetic chars.
|
||||
CHAR_AMPERSAND: 38, /* & */
|
||||
CHAR_AT: 64, /* @ */
|
||||
CHAR_BACKWARD_SLASH: 92, /* \ */
|
||||
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
||||
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
||||
CHAR_COLON: 58, /* : */
|
||||
CHAR_COMMA: 44, /* , */
|
||||
CHAR_DOT: 46, /* . */
|
||||
CHAR_DOUBLE_QUOTE: 34, /* " */
|
||||
CHAR_EQUAL: 61, /* = */
|
||||
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
||||
CHAR_FORM_FEED: 12, /* \f */
|
||||
CHAR_FORWARD_SLASH: 47, /* / */
|
||||
CHAR_GRAVE_ACCENT: 96, /* ` */
|
||||
CHAR_HASH: 35, /* # */
|
||||
CHAR_HYPHEN_MINUS: 45, /* - */
|
||||
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
||||
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
||||
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
||||
CHAR_LINE_FEED: 10, /* \n */
|
||||
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
||||
CHAR_PERCENT: 37, /* % */
|
||||
CHAR_PLUS: 43, /* + */
|
||||
CHAR_QUESTION_MARK: 63, /* ? */
|
||||
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
||||
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
||||
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
||||
CHAR_SEMICOLON: 59, /* ; */
|
||||
CHAR_SINGLE_QUOTE: 39, /* ' */
|
||||
CHAR_SPACE: 32, /* */
|
||||
CHAR_TAB: 9, /* \t */
|
||||
CHAR_UNDERSCORE: 95, /* _ */
|
||||
CHAR_VERTICAL_LINE: 124, /* | */
|
||||
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
||||
|
||||
/**
|
||||
* Create EXTGLOB_CHARS
|
||||
*/
|
||||
|
||||
extglobChars(chars) {
|
||||
return {
|
||||
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
||||
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
||||
'+': { type: 'plus', open: '(?:', close: ')+' },
|
||||
'*': { type: 'star', open: '(?:', close: ')*' },
|
||||
'@': { type: 'at', open: '(?:', close: ')' }
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Create GLOB_CHARS
|
||||
*/
|
||||
|
||||
globChars(win32) {
|
||||
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"f64.d.ts","sourceRoot":"","sources":["../../src/f64.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa,GAAI,SAAQ,iBAAsB,KAAG,gBAAgB,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,CAM5F,CAAC;AAEP;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa,GAAI,SAAQ,iBAAsB,KAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAMnF,CAAC;AAEP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,WAAW,GAAI,SAAQ,iBAAsB,KAAG,cAAc,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CACxC,CAAC"}
|
||||
@@ -0,0 +1,16 @@
|
||||
function _is_native_reflect_construct() {
|
||||
// Since Reflect.construct can't be properly polyfilled, some
|
||||
// implementations (e.g. core-js@2) don't set the correct internal slots.
|
||||
// Those polyfills don't allow us to subclass built-ins, so we need to
|
||||
// use our fallback implementation.
|
||||
try {
|
||||
// If the internal slots aren't set, this throws an error similar to
|
||||
// TypeError: this is not a Boolean object.
|
||||
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
||||
} catch (_) {}
|
||||
return (_is_native_reflect_construct = function() {
|
||||
return !!result;
|
||||
})();
|
||||
}
|
||||
|
||||
export { _is_native_reflect_construct as _ };
|
||||
@@ -0,0 +1,13 @@
|
||||
"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.es2020_sharedmemory = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
const es2020_bigint_1 = require("./es2020.bigint");
|
||||
exports.es2020_sharedmemory = {
|
||||
libs: [es2020_bigint_1.es2020_bigint],
|
||||
variables: [['Atomics', base_config_1.TYPE]],
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { LibDefinition } from '../variable';
|
||||
export declare const es2015: LibDefinition;
|
||||
@@ -0,0 +1,56 @@
|
||||
var OverloadYield = require("./OverloadYield.js");
|
||||
function _wrapAsyncGenerator(e) {
|
||||
return function () {
|
||||
return new AsyncGenerator(e.apply(this, arguments));
|
||||
};
|
||||
}
|
||||
function AsyncGenerator(e) {
|
||||
var t, n;
|
||||
function resume(t, n) {
|
||||
try {
|
||||
var r = e[t](n),
|
||||
o = r.value,
|
||||
u = o instanceof OverloadYield;
|
||||
Promise.resolve(u ? o.v : o).then(function (n) {
|
||||
if (u) {
|
||||
var i = "return" === t && o.k ? t : "next";
|
||||
if (!o.k || n.done) return resume(i, n);
|
||||
n = e[i](n).value;
|
||||
}
|
||||
settle(!!r.done, n);
|
||||
}, function (e) {
|
||||
resume("throw", e);
|
||||
});
|
||||
} catch (e) {
|
||||
settle(2, e);
|
||||
}
|
||||
}
|
||||
function settle(e, r) {
|
||||
2 === e ? t.reject(r) : t.resolve({
|
||||
value: r,
|
||||
done: e
|
||||
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
||||
}
|
||||
this._invoke = function (e, r) {
|
||||
return new Promise(function (o, u) {
|
||||
var i = {
|
||||
key: e,
|
||||
arg: r,
|
||||
resolve: o,
|
||||
reject: u,
|
||||
next: null
|
||||
};
|
||||
n ? n = n.next = i : (t = n = i, resume(e, r));
|
||||
});
|
||||
}, "function" != typeof e["return"] && (this["return"] = void 0);
|
||||
}
|
||||
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () {
|
||||
return this;
|
||||
}, AsyncGenerator.prototype.next = function (e) {
|
||||
return this._invoke("next", e);
|
||||
}, AsyncGenerator.prototype["throw"] = function (e) {
|
||||
return this._invoke("throw", e);
|
||||
}, AsyncGenerator.prototype["return"] = function (e) {
|
||||
return this._invoke("return", e);
|
||||
};
|
||||
module.exports = _wrapAsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
||||
@@ -0,0 +1,83 @@
|
||||
import nodeos__default from 'node:os';
|
||||
import './env.D4Lgay0q.js';
|
||||
import { isCI, isAgent } from 'std-env';
|
||||
|
||||
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
|
||||
const defaultExclude = ["**/node_modules/**", "**/.git/**"];
|
||||
const benchmarkConfigDefaults = {
|
||||
include: ["**/*.{bench,benchmark}.?(c|m)[jt]s?(x)"],
|
||||
exclude: defaultExclude,
|
||||
includeSource: [],
|
||||
reporters: ["default"],
|
||||
includeSamples: false
|
||||
};
|
||||
// These are the generic defaults for coverage. Providers may also set some provider specific defaults.
|
||||
const coverageConfigDefaults = {
|
||||
provider: "v8",
|
||||
enabled: false,
|
||||
clean: true,
|
||||
cleanOnRerun: true,
|
||||
reportsDirectory: "./coverage",
|
||||
exclude: [],
|
||||
reportOnFailure: false,
|
||||
reporter: [
|
||||
"text",
|
||||
"html",
|
||||
"clover",
|
||||
"json"
|
||||
],
|
||||
allowExternal: false,
|
||||
excludeAfterRemap: false,
|
||||
processingConcurrency: Math.min(20, nodeos__default.availableParallelism?.() ?? nodeos__default.cpus().length),
|
||||
ignoreClassMethods: [],
|
||||
skipFull: false,
|
||||
watermarks: {
|
||||
statements: [50, 80],
|
||||
functions: [50, 80],
|
||||
branches: [50, 80],
|
||||
lines: [50, 80]
|
||||
}
|
||||
};
|
||||
const fakeTimersDefaults = {
|
||||
loopLimit: 1e4,
|
||||
shouldClearNativeTimers: true
|
||||
};
|
||||
const configDefaults = Object.freeze({
|
||||
allowOnly: !isCI,
|
||||
isolate: true,
|
||||
watch: !isCI && process.stdin.isTTY && !isAgent,
|
||||
globals: false,
|
||||
environment: "node",
|
||||
clearMocks: false,
|
||||
restoreMocks: false,
|
||||
mockReset: false,
|
||||
unstubGlobals: false,
|
||||
unstubEnvs: false,
|
||||
include: defaultInclude,
|
||||
exclude: defaultExclude,
|
||||
teardownTimeout: 1e4,
|
||||
forceRerunTriggers: ["**/package.json/**", "**/{vitest,vite}.config.*/**"],
|
||||
update: false,
|
||||
reporters: [],
|
||||
silent: false,
|
||||
hideSkippedTests: false,
|
||||
api: false,
|
||||
ui: false,
|
||||
uiBase: "/__vitest__/",
|
||||
open: !isCI,
|
||||
css: { include: [] },
|
||||
coverage: coverageConfigDefaults,
|
||||
fakeTimers: fakeTimersDefaults,
|
||||
maxConcurrency: 5,
|
||||
dangerouslyIgnoreUnhandledErrors: false,
|
||||
typecheck: {
|
||||
checker: "tsc",
|
||||
include: ["**/*.{test,spec}-d.?(c|m)[jt]s?(x)"],
|
||||
exclude: defaultExclude
|
||||
},
|
||||
slowTestThreshold: 300,
|
||||
disableConsoleIntercept: false,
|
||||
detectAsyncLeaks: false
|
||||
});
|
||||
|
||||
export { coverageConfigDefaults as a, defaultInclude as b, configDefaults as c, defaultExclude as d, benchmarkConfigDefaults as e };
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,605 @@
|
||||
declare module "node:perf_hooks" {
|
||||
import { InternalEventTargetEventProperties } from "node:events";
|
||||
// #region web types
|
||||
type EntryType =
|
||||
| "dns" // Node.js only
|
||||
| "function" // Node.js only
|
||||
| "gc" // Node.js only
|
||||
| "http2" // Node.js only
|
||||
| "http" // Node.js only
|
||||
| "mark" // available on the Web
|
||||
| "measure" // available on the Web
|
||||
| "net" // Node.js only
|
||||
| "node" // Node.js only
|
||||
| "quic" // Node.js only
|
||||
| "resource"; // available on the Web
|
||||
interface ConnectionTimingInfo {
|
||||
domainLookupStartTime: number;
|
||||
domainLookupEndTime: number;
|
||||
connectionStartTime: number;
|
||||
connectionEndTime: number;
|
||||
secureConnectionStartTime: number;
|
||||
ALPNNegotiatedProtocol: string;
|
||||
}
|
||||
interface FetchTimingInfo {
|
||||
startTime: number;
|
||||
redirectStartTime: number;
|
||||
redirectEndTime: number;
|
||||
postRedirectStartTime: number;
|
||||
finalServiceWorkerStartTime: number;
|
||||
finalNetworkRequestStartTime: number;
|
||||
finalNetworkResponseStartTime: number;
|
||||
endTime: number;
|
||||
finalConnectionTimingInfo: ConnectionTimingInfo | null;
|
||||
encodedBodySize: number;
|
||||
decodedBodySize: number;
|
||||
}
|
||||
type PerformanceEntryList = PerformanceEntry[];
|
||||
interface PerformanceMarkOptions {
|
||||
detail?: any;
|
||||
startTime?: number;
|
||||
}
|
||||
interface PerformanceMeasureOptions {
|
||||
detail?: any;
|
||||
duration?: number;
|
||||
end?: string | number;
|
||||
start?: string | number;
|
||||
}
|
||||
interface PerformanceObserverCallback {
|
||||
(entries: PerformanceObserverEntryList, observer: PerformanceObserver): void;
|
||||
}
|
||||
interface PerformanceObserverInit {
|
||||
buffered?: boolean;
|
||||
entryTypes?: EntryType[];
|
||||
type?: EntryType;
|
||||
}
|
||||
interface PerformanceEventMap {
|
||||
"resourcetimingbufferfull": Event;
|
||||
}
|
||||
interface Performance extends EventTarget, InternalEventTargetEventProperties<PerformanceEventMap> {
|
||||
readonly nodeTiming: PerformanceNodeTiming;
|
||||
readonly timeOrigin: number;
|
||||
clearMarks(markName?: string): void;
|
||||
clearMeasures(measureName?: string): void;
|
||||
clearResourceTimings(resourceTimingName?: string): void;
|
||||
getEntries(): PerformanceEntryList;
|
||||
getEntriesByName(name: string, type?: EntryType): PerformanceEntryList;
|
||||
getEntriesByType(type: EntryType): PerformanceEntryList;
|
||||
mark(markName: string, markOptions?: PerformanceMarkOptions): PerformanceMark;
|
||||
markResourceTiming(
|
||||
timingInfo: FetchTimingInfo,
|
||||
requestedUrl: string,
|
||||
initiatorType: string,
|
||||
global: unknown,
|
||||
cacheMode: string,
|
||||
bodyInfo: unknown,
|
||||
responseStatus: number,
|
||||
deliveryType?: string,
|
||||
): PerformanceResourceTiming;
|
||||
measure(measureName: string, startMark?: string, endMark?: string): PerformanceMeasure;
|
||||
measure(measureName: string, options: PerformanceMeasureOptions, endMark?: string): PerformanceMeasure;
|
||||
now(): number;
|
||||
setResourceTimingBufferSize(maxSize: number): void;
|
||||
toJSON(): any;
|
||||
addEventListener<K extends keyof PerformanceEventMap>(
|
||||
type: K,
|
||||
listener: (ev: PerformanceEventMap[K]) => void,
|
||||
options?: AddEventListenerOptions | boolean,
|
||||
): void;
|
||||
addEventListener(
|
||||
type: string,
|
||||
listener: EventListener | EventListenerObject,
|
||||
options?: AddEventListenerOptions | boolean,
|
||||
): void;
|
||||
removeEventListener<K extends keyof PerformanceEventMap>(
|
||||
type: K,
|
||||
listener: (ev: PerformanceEventMap[K]) => void,
|
||||
options?: EventListenerOptions | boolean,
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: string,
|
||||
listener: EventListener | EventListenerObject,
|
||||
options?: EventListenerOptions | boolean,
|
||||
): void;
|
||||
/**
|
||||
* This is an alias of `perf_hooks.eventLoopUtilization()`.
|
||||
*
|
||||
* _This property is an extension by Node.js. It is not available in Web browsers._
|
||||
* @since v14.10.0, v12.19.0
|
||||
* @param utilization1 The result of a previous call to
|
||||
* `eventLoopUtilization()`.
|
||||
* @param utilization2 The result of a previous call to
|
||||
* `eventLoopUtilization()` prior to `utilization1`.
|
||||
*/
|
||||
eventLoopUtilization(
|
||||
utilization1?: EventLoopUtilization,
|
||||
utilization2?: EventLoopUtilization,
|
||||
): EventLoopUtilization;
|
||||
/**
|
||||
* This is an alias of `perf_hooks.timerify()`.
|
||||
*
|
||||
* _This property is an extension by Node.js. It is not available in Web browsers._
|
||||
* @since v8.5.0
|
||||
*/
|
||||
timerify<T extends (...args: any[]) => any>(fn: T, options?: TimerifyOptions): T;
|
||||
}
|
||||
var Performance: {
|
||||
prototype: Performance;
|
||||
new(): Performance;
|
||||
};
|
||||
interface PerformanceEntry {
|
||||
readonly duration: number;
|
||||
readonly entryType: EntryType;
|
||||
readonly name: string;
|
||||
readonly startTime: number;
|
||||
toJSON(): any;
|
||||
}
|
||||
var PerformanceEntry: {
|
||||
prototype: PerformanceEntry;
|
||||
new(): PerformanceEntry;
|
||||
};
|
||||
interface PerformanceMark extends PerformanceEntry {
|
||||
readonly detail: any;
|
||||
readonly entryType: "mark";
|
||||
}
|
||||
var PerformanceMark: {
|
||||
prototype: PerformanceMark;
|
||||
new(markName: string, markOptions?: PerformanceMarkOptions): PerformanceMark;
|
||||
};
|
||||
interface PerformanceMeasure extends PerformanceEntry {
|
||||
readonly detail: any;
|
||||
readonly entryType: "measure";
|
||||
}
|
||||
var PerformanceMeasure: {
|
||||
prototype: PerformanceMeasure;
|
||||
new(): PerformanceMeasure;
|
||||
};
|
||||
interface PerformanceObserver {
|
||||
disconnect(): void;
|
||||
observe(options: PerformanceObserverInit): void;
|
||||
takeRecords(): PerformanceEntryList;
|
||||
}
|
||||
var PerformanceObserver: {
|
||||
prototype: PerformanceObserver;
|
||||
new(callback: PerformanceObserverCallback): PerformanceObserver;
|
||||
readonly supportedEntryTypes: readonly EntryType[];
|
||||
};
|
||||
interface PerformanceObserverEntryList {
|
||||
getEntries(): PerformanceEntryList;
|
||||
getEntriesByName(name: string, type?: EntryType): PerformanceEntryList;
|
||||
getEntriesByType(type: EntryType): PerformanceEntryList;
|
||||
}
|
||||
var PerformanceObserverEntryList: {
|
||||
prototype: PerformanceObserverEntryList;
|
||||
new(): PerformanceObserverEntryList;
|
||||
};
|
||||
interface PerformanceResourceTiming extends PerformanceEntry {
|
||||
readonly connectEnd: number;
|
||||
readonly connectStart: number;
|
||||
readonly decodedBodySize: number;
|
||||
readonly domainLookupEnd: number;
|
||||
readonly domainLookupStart: number;
|
||||
readonly encodedBodySize: number;
|
||||
readonly entryType: "resource";
|
||||
readonly fetchStart: number;
|
||||
readonly initiatorType: string;
|
||||
readonly nextHopProtocol: string;
|
||||
readonly redirectEnd: number;
|
||||
readonly redirectStart: number;
|
||||
readonly requestStart: number;
|
||||
readonly responseEnd: number;
|
||||
readonly responseStart: number;
|
||||
readonly responseStatus: number;
|
||||
readonly secureConnectionStart: number;
|
||||
readonly transferSize: number;
|
||||
readonly workerStart: number;
|
||||
toJSON(): any;
|
||||
}
|
||||
var PerformanceResourceTiming: {
|
||||
prototype: PerformanceResourceTiming;
|
||||
new(): PerformanceResourceTiming;
|
||||
};
|
||||
var performance: Performance;
|
||||
// #endregion
|
||||
/**
|
||||
* _This class is an extension by Node.js. It is not available in Web browsers._
|
||||
*
|
||||
* Provides detailed Node.js timing data.
|
||||
*
|
||||
* The constructor of this class is not exposed to users directly.
|
||||
* @since v19.0.0
|
||||
*/
|
||||
class PerformanceNodeEntry extends PerformanceEntry {
|
||||
/**
|
||||
* Additional detail specific to the `entryType`.
|
||||
* @since v16.0.0
|
||||
*/
|
||||
readonly detail: any;
|
||||
readonly entryType: "dns" | "function" | "gc" | "http2" | "http" | "net" | "node" | "quic";
|
||||
}
|
||||
interface UVMetrics {
|
||||
/**
|
||||
* Number of event loop iterations.
|
||||
*/
|
||||
readonly loopCount: number;
|
||||
/**
|
||||
* Number of events that have been processed by the event handler.
|
||||
*/
|
||||
readonly events: number;
|
||||
/**
|
||||
* Number of events that were waiting to be processed when the event provider was called.
|
||||
*/
|
||||
readonly eventsWaiting: number;
|
||||
}
|
||||
/**
|
||||
* _This property is an extension by Node.js. It is not available in Web browsers._
|
||||
*
|
||||
* Provides timing details for Node.js itself. The constructor of this class
|
||||
* is not exposed to users.
|
||||
* @since v8.5.0
|
||||
*/
|
||||
interface PerformanceNodeTiming extends PerformanceEntry {
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which the Node.js process
|
||||
* completed bootstrapping. If bootstrapping has not yet finished, the property
|
||||
* has the value of -1.
|
||||
* @since v8.5.0
|
||||
*/
|
||||
readonly bootstrapComplete: number;
|
||||
readonly entryType: "node";
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which the Node.js environment was
|
||||
* initialized.
|
||||
* @since v8.5.0
|
||||
*/
|
||||
readonly environment: number;
|
||||
/**
|
||||
* The high resolution millisecond timestamp of the amount of time the event loop
|
||||
* has been idle within the event loop's event provider (e.g. `epoll_wait`). This
|
||||
* does not take CPU usage into consideration. If the event loop has not yet
|
||||
* started (e.g., in the first tick of the main script), the property has the
|
||||
* value of 0.
|
||||
* @since v14.10.0, v12.19.0
|
||||
*/
|
||||
readonly idleTime: number;
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which the Node.js event loop
|
||||
* exited. If the event loop has not yet exited, the property has the value of -1\.
|
||||
* It can only have a value of not -1 in a handler of the `'exit'` event.
|
||||
* @since v8.5.0
|
||||
*/
|
||||
readonly loopExit: number;
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which the Node.js event loop
|
||||
* started. If the event loop has not yet started (e.g., in the first tick of the
|
||||
* main script), the property has the value of -1.
|
||||
* @since v8.5.0
|
||||
*/
|
||||
readonly loopStart: number;
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which the Node.js process was initialized.
|
||||
* @since v8.5.0
|
||||
*/
|
||||
readonly nodeStart: number;
|
||||
/**
|
||||
* This is a wrapper to the `uv_metrics_info` function.
|
||||
* It returns the current set of event loop metrics.
|
||||
*
|
||||
* It is recommended to use this property inside a function whose execution was
|
||||
* scheduled using `setImmediate` to avoid collecting metrics before finishing all
|
||||
* operations scheduled during the current loop iteration.
|
||||
* @since v22.8.0, v20.18.0
|
||||
*/
|
||||
readonly uvMetricsInfo: UVMetrics;
|
||||
/**
|
||||
* The high resolution millisecond timestamp at which the V8 platform was
|
||||
* initialized.
|
||||
* @since v8.5.0
|
||||
*/
|
||||
readonly v8Start: number;
|
||||
}
|
||||
namespace constants {
|
||||
const NODE_PERFORMANCE_GC_MAJOR: number;
|
||||
const NODE_PERFORMANCE_GC_MINOR: number;
|
||||
const NODE_PERFORMANCE_GC_INCREMENTAL: number;
|
||||
const NODE_PERFORMANCE_GC_WEAKCB: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_NO: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
|
||||
const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
|
||||
}
|
||||
interface EventLoopMonitorOptions {
|
||||
/**
|
||||
* The sampling rate in milliseconds.
|
||||
* Must be greater than zero.
|
||||
* @default 10
|
||||
*/
|
||||
resolution?: number | undefined;
|
||||
}
|
||||
interface Histogram {
|
||||
/**
|
||||
* The number of samples recorded by the histogram.
|
||||
* @since v17.4.0, v16.14.0
|
||||
*/
|
||||
readonly count: number;
|
||||
/**
|
||||
* The number of samples recorded by the histogram.
|
||||
* v17.4.0, v16.14.0
|
||||
*/
|
||||
readonly countBigInt: bigint;
|
||||
/**
|
||||
* The number of times the event loop delay exceeded the maximum 1 hour event
|
||||
* loop delay threshold.
|
||||
* @since v11.10.0
|
||||
*/
|
||||
readonly exceeds: number;
|
||||
/**
|
||||
* The number of times the event loop delay exceeded the maximum 1 hour event loop delay threshold.
|
||||
* @since v17.4.0, v16.14.0
|
||||
*/
|
||||
readonly exceedsBigInt: bigint;
|
||||
/**
|
||||
* The maximum recorded event loop delay.
|
||||
* @since v11.10.0
|
||||
*/
|
||||
readonly max: number;
|
||||
/**
|
||||
* The maximum recorded event loop delay.
|
||||
* v17.4.0, v16.14.0
|
||||
*/
|
||||
readonly maxBigInt: number;
|
||||
/**
|
||||
* The mean of the recorded event loop delays.
|
||||
* @since v11.10.0
|
||||
*/
|
||||
readonly mean: number;
|
||||
/**
|
||||
* The minimum recorded event loop delay.
|
||||
* @since v11.10.0
|
||||
*/
|
||||
readonly min: number;
|
||||
/**
|
||||
* The minimum recorded event loop delay.
|
||||
* v17.4.0, v16.14.0
|
||||
*/
|
||||
readonly minBigInt: bigint;
|
||||
/**
|
||||
* Returns the value at the given percentile.
|
||||
* @since v11.10.0
|
||||
* @param percentile A percentile value in the range (0, 100].
|
||||
*/
|
||||
percentile(percentile: number): number;
|
||||
/**
|
||||
* Returns the value at the given percentile.
|
||||
* @since v17.4.0, v16.14.0
|
||||
* @param percentile A percentile value in the range (0, 100].
|
||||
*/
|
||||
percentileBigInt(percentile: number): bigint;
|
||||
/**
|
||||
* Returns a `Map` object detailing the accumulated percentile distribution.
|
||||
* @since v11.10.0
|
||||
*/
|
||||
readonly percentiles: Map<number, number>;
|
||||
/**
|
||||
* Returns a `Map` object detailing the accumulated percentile distribution.
|
||||
* @since v17.4.0, v16.14.0
|
||||
*/
|
||||
readonly percentilesBigInt: Map<bigint, bigint>;
|
||||
/**
|
||||
* Resets the collected histogram data.
|
||||
* @since v11.10.0
|
||||
*/
|
||||
reset(): void;
|
||||
/**
|
||||
* The standard deviation of the recorded event loop delays.
|
||||
* @since v11.10.0
|
||||
*/
|
||||
readonly stddev: number;
|
||||
}
|
||||
interface IntervalHistogram extends Histogram {
|
||||
/**
|
||||
* Enables the update interval timer. Returns `true` if the timer was
|
||||
* started, `false` if it was already started.
|
||||
* @since v11.10.0
|
||||
*/
|
||||
enable(): boolean;
|
||||
/**
|
||||
* Disables the update interval timer. Returns `true` if the timer was
|
||||
* stopped, `false` if it was already stopped.
|
||||
* @since v11.10.0
|
||||
*/
|
||||
disable(): boolean;
|
||||
/**
|
||||
* Disables the update interval timer when the histogram is disposed.
|
||||
*
|
||||
* ```js
|
||||
* const { monitorEventLoopDelay } = require('node:perf_hooks');
|
||||
* {
|
||||
* using hist = monitorEventLoopDelay({ resolution: 20 });
|
||||
* hist.enable();
|
||||
* // The histogram will be disabled when the block is exited.
|
||||
* }
|
||||
* ```
|
||||
* @since v24.2.0
|
||||
*/
|
||||
[Symbol.dispose](): void;
|
||||
}
|
||||
interface RecordableHistogram extends Histogram {
|
||||
/**
|
||||
* @since v15.9.0, v14.18.0
|
||||
* @param val The amount to record in the histogram.
|
||||
*/
|
||||
record(val: number | bigint): void;
|
||||
/**
|
||||
* Calculates the amount of time (in nanoseconds) that has passed since the
|
||||
* previous call to `recordDelta()` and records that amount in the histogram.
|
||||
* @since v15.9.0, v14.18.0
|
||||
*/
|
||||
recordDelta(): void;
|
||||
/**
|
||||
* Adds the values from `other` to this histogram.
|
||||
* @since v17.4.0, v16.14.0
|
||||
*/
|
||||
add(other: RecordableHistogram): void;
|
||||
}
|
||||
interface EventLoopUtilization {
|
||||
idle: number;
|
||||
active: number;
|
||||
utilization: number;
|
||||
}
|
||||
/**
|
||||
* The `eventLoopUtilization()` function returns an object that contains the
|
||||
* cumulative duration of time the event loop has been both idle and active as a
|
||||
* high resolution milliseconds timer. The `utilization` value is the calculated
|
||||
* Event Loop Utilization (ELU).
|
||||
*
|
||||
* If bootstrapping has not yet finished on the main thread the properties have
|
||||
* the value of `0`. The ELU is immediately available on [Worker threads](https://nodejs.org/docs/latest-v26.x/api/worker_threads.html#worker-threads) since
|
||||
* bootstrap happens within the event loop.
|
||||
*
|
||||
* Both `utilization1` and `utilization2` are optional parameters.
|
||||
*
|
||||
* If `utilization1` is passed, then the delta between the current call's `active`
|
||||
* and `idle` times, as well as the corresponding `utilization` value are
|
||||
* calculated and returned (similar to `process.hrtime()`).
|
||||
*
|
||||
* If `utilization1` and `utilization2` are both passed, then the delta is
|
||||
* calculated between the two arguments. This is a convenience option because,
|
||||
* unlike `process.hrtime()`, calculating the ELU is more complex than a
|
||||
* single subtraction.
|
||||
*
|
||||
* ELU is similar to CPU utilization, except that it only measures event loop
|
||||
* statistics and not CPU usage. It represents the percentage of time the event
|
||||
* loop has spent outside the event loop's event provider (e.g. `epoll_wait`).
|
||||
* No other CPU idle time is taken into consideration. The following is an example
|
||||
* of how a mostly idle process will have a high ELU.
|
||||
*
|
||||
* ```js
|
||||
* import { eventLoopUtilization } from 'node:perf_hooks';
|
||||
* import { spawnSync } from 'node:child_process';
|
||||
*
|
||||
* setImmediate(() => {
|
||||
* const elu = eventLoopUtilization();
|
||||
* spawnSync('sleep', ['5']);
|
||||
* console.log(eventLoopUtilization(elu).utilization);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Although the CPU is mostly idle while running this script, the value of
|
||||
* `utilization` is `1`. This is because the call to
|
||||
* `child_process.spawnSync()` blocks the event loop from proceeding.
|
||||
*
|
||||
* Passing in a user-defined object instead of the result of a previous call to
|
||||
* `eventLoopUtilization()` will lead to undefined behavior. The return values
|
||||
* are not guaranteed to reflect any correct state of the event loop.
|
||||
* @since v25.2.0
|
||||
* @param utilization1 The result of a previous call to
|
||||
* `eventLoopUtilization()`.
|
||||
* @param utilization2 The result of a previous call to
|
||||
* `eventLoopUtilization()` prior to `utilization1`.
|
||||
*/
|
||||
function eventLoopUtilization(
|
||||
utilization1?: EventLoopUtilization,
|
||||
utilization2?: EventLoopUtilization,
|
||||
): EventLoopUtilization;
|
||||
/**
|
||||
* _This property is an extension by Node.js. It is not available in Web browsers._
|
||||
*
|
||||
* Creates an `IntervalHistogram` object that samples and reports the event loop
|
||||
* delay over time. The delays will be reported in nanoseconds.
|
||||
*
|
||||
* Using a timer to detect approximate event loop delay works because the
|
||||
* execution of timers is tied specifically to the lifecycle of the libuv
|
||||
* event loop. That is, a delay in the loop will cause a delay in the execution
|
||||
* of the timer, and those delays are specifically what this API is intended to
|
||||
* detect.
|
||||
*
|
||||
* ```js
|
||||
* import { monitorEventLoopDelay } from 'node:perf_hooks';
|
||||
* const h = monitorEventLoopDelay({ resolution: 20 });
|
||||
* h.enable();
|
||||
* // Do something.
|
||||
* h.disable();
|
||||
* console.log(h.min);
|
||||
* console.log(h.max);
|
||||
* console.log(h.mean);
|
||||
* console.log(h.stddev);
|
||||
* console.log(h.percentiles);
|
||||
* console.log(h.percentile(50));
|
||||
* console.log(h.percentile(99));
|
||||
* ```
|
||||
* @since v11.10.0
|
||||
*/
|
||||
function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
|
||||
interface TimerifyOptions {
|
||||
/**
|
||||
* A histogram object created using
|
||||
* `perf_hooks.createHistogram()` that will record runtime durations in
|
||||
* nanoseconds.
|
||||
*/
|
||||
histogram?: RecordableHistogram | undefined;
|
||||
}
|
||||
/**
|
||||
* _This property is an extension by Node.js. It is not available in Web browsers._
|
||||
*
|
||||
* Wraps a function within a new function that measures the running time of the
|
||||
* wrapped function. A `PerformanceObserver` must be subscribed to the `'function'`
|
||||
* event type in order for the timing details to be accessed.
|
||||
*
|
||||
* ```js
|
||||
* import { timerify, performance, PerformanceObserver } from 'node:perf_hooks';
|
||||
*
|
||||
* function someFunction() {
|
||||
* console.log('hello world');
|
||||
* }
|
||||
*
|
||||
* const wrapped = timerify(someFunction);
|
||||
*
|
||||
* const obs = new PerformanceObserver((list) => {
|
||||
* console.log(list.getEntries()[0].duration);
|
||||
*
|
||||
* performance.clearMarks();
|
||||
* performance.clearMeasures();
|
||||
* obs.disconnect();
|
||||
* });
|
||||
* obs.observe({ entryTypes: ['function'] });
|
||||
*
|
||||
* // A performance timeline entry will be created
|
||||
* wrapped();
|
||||
* ```
|
||||
*
|
||||
* If the wrapped function returns a promise, a finally handler will be attached
|
||||
* to the promise and the duration will be reported once the finally handler is
|
||||
* invoked.
|
||||
* @since v25.2.0
|
||||
*/
|
||||
function timerify<T extends (...args: any[]) => any>(fn: T, options?: TimerifyOptions): T;
|
||||
interface CreateHistogramOptions {
|
||||
/**
|
||||
* The minimum recordable value. Must be an integer value greater than 0.
|
||||
* @default 1
|
||||
*/
|
||||
lowest?: number | bigint | undefined;
|
||||
/**
|
||||
* The maximum recordable value. Must be an integer value greater than min.
|
||||
* @default Number.MAX_SAFE_INTEGER
|
||||
*/
|
||||
highest?: number | bigint | undefined;
|
||||
/**
|
||||
* The number of accuracy digits. Must be a number between 1 and 5.
|
||||
* @default 3
|
||||
*/
|
||||
figures?: number | undefined;
|
||||
}
|
||||
/**
|
||||
* Returns a `RecordableHistogram`.
|
||||
* @since v15.9.0, v14.18.0
|
||||
*/
|
||||
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
|
||||
}
|
||||
declare module "perf_hooks" {
|
||||
export * from "node:perf_hooks";
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
'use strict'
|
||||
|
||||
const pino = require('../..')
|
||||
const transport = pino.transport({
|
||||
target: 'pino/file'
|
||||
})
|
||||
const logger = pino(transport)
|
||||
|
||||
logger.info('Hello')
|
||||
|
||||
process.exit(0)
|
||||
Reference in New Issue
Block a user