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,125 @@
/**
* @fileoverview Rule to
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Types
//------------------------------------------------------------------------------
/** @typedef {import("eslint-scope").Scope} Scope */
/** @typedef {import("eslint-scope").Variable} Variable */
/** @typedef {import("eslint-scope").Reference} Reference */
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Gets the variable object of `arguments` which is defined implicitly.
* @param {Scope} scope A scope to get.
* @returns {Variable} The found variable object.
*/
function getVariableOfArguments(scope) {
const variables = scope.variables;
for (let i = 0; i < variables.length; ++i) {
const variable = variables[i];
if (variable.name === "arguments") {
/*
* If there was a parameter which is named "arguments", the implicit "arguments" is not defined.
* So does fast return with null.
*/
return variable.identifiers.length === 0 ? variable : null;
}
}
/* c8 ignore next */
return null;
}
/**
* Checks if the given reference is not normal member access.
*
* - arguments .... true // not member access
* - arguments[i] .... true // computed member access
* - arguments[0] .... true // computed member access
* - arguments.length .... false // normal member access
* @param {Reference} reference The reference to check.
* @returns {boolean} `true` if the reference is not normal member access.
*/
function isNotNormalMemberAccess(reference) {
const id = reference.identifier;
const parent = id.parent;
return !(
parent.type === "MemberExpression" &&
parent.object === id &&
!parent.computed
);
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Require rest parameters instead of `arguments`",
recommended: false,
url: "https://eslint.org/docs/latest/rules/prefer-rest-params",
},
schema: [],
messages: {
preferRestParams: "Use the rest parameters instead of 'arguments'.",
},
},
create(context) {
const sourceCode = context.sourceCode;
/**
* Reports a given reference.
* @param {Reference} reference A reference to report.
* @returns {void}
*/
function report(reference) {
context.report({
node: reference.identifier,
loc: reference.identifier.loc,
messageId: "preferRestParams",
});
}
/**
* Reports references of the implicit `arguments` variable if exist.
* @param {ASTNode} node The node representing the function.
* @returns {void}
*/
function checkForArguments(node) {
const argumentsVar = getVariableOfArguments(
sourceCode.getScope(node),
);
if (argumentsVar) {
argumentsVar.references
.filter(isNotNormalMemberAccess)
.forEach(report);
}
}
return {
"FunctionDeclaration:exit": checkForArguments,
"FunctionExpression:exit": checkForArguments,
};
},
};

View File

@@ -0,0 +1,420 @@
const nodeUtils = require('util')
// eslint-disable-next-line
var Native
// eslint-disable-next-line no-useless-catch
try {
// Wrap this `require()` in a try-catch to avoid upstream bundlers from complaining that this might not be available since it is an optional import
Native = require('pg-native')
} catch (e) {
throw e
}
const TypeOverrides = require('../type-overrides')
const EventEmitter = require('events').EventEmitter
const util = require('util')
const ConnectionParameters = require('../connection-parameters')
const NativeQuery = require('./query')
const queryQueueLengthDeprecationNotice = nodeUtils.deprecate(
() => {},
'Calling client.query() when the client is already executing a query is deprecated and will be removed in pg@9.0. Use async/await or an external async flow control mechanism instead.'
)
const Client = (module.exports = function (config) {
EventEmitter.call(this)
config = config || {}
this._Promise = config.Promise || global.Promise
this._types = new TypeOverrides(config.types)
this.native = new Native({
types: this._types,
})
this._queryQueue = []
this._ending = false
this._connecting = false
this._connected = false
this._queryable = true
this.pipeline = Boolean(config.pipeline)
this._pipelineInFlight = false
// keep these on the object for legacy reasons
// for the time being. TODO: deprecate all this jazz
const cp = (this.connectionParameters = new ConnectionParameters(config))
if (config.nativeConnectionString) cp.nativeConnectionString = config.nativeConnectionString
this.user = cp.user
// "hiding" the password so it doesn't show up in stack traces
// or if the client is console.logged
Object.defineProperty(this, 'password', {
configurable: true,
enumerable: false,
writable: true,
value: cp.password,
})
this.database = cp.database
this.host = cp.host
this.port = cp.port
// a hash to hold named queries
this.namedQueries = {}
})
Client.Query = NativeQuery
util.inherits(Client, EventEmitter)
Client.prototype._errorAllQueries = function (err) {
const enqueueError = (query) => {
process.nextTick(() => {
query.native = this.native
query.handleError(err)
})
}
if (this._hasActiveQuery()) {
enqueueError(this._activeQuery)
this._activeQuery = null
}
this._queryQueue.forEach(enqueueError)
this._queryQueue.length = 0
}
// connect to the backend
// pass an optional callback to be called once connected
// or with an error if there was a connection error
Client.prototype._connect = function (cb) {
const self = this
if (this._connecting) {
process.nextTick(() => cb(new Error('Client has already been connected. You cannot reuse a client.')))
return
}
this._connecting = true
this.connectionParameters.getLibpqConnectionString(function (err, conString) {
if (self.connectionParameters.nativeConnectionString) conString = self.connectionParameters.nativeConnectionString
if (err) return cb(err)
self.native.connect(conString, function (err) {
if (err) {
self.native.end()
return cb(err)
}
// set internal states to connected
self._connected = true
// handle connection errors from the native layer
self.native.on('error', function (err) {
self._queryable = false
self._errorAllQueries(err)
self.emit('error', err)
})
self.native.on('notification', function (msg) {
self.emit('notification', {
channel: msg.relname,
payload: msg.extra,
})
})
// signal we are connected now
self.emit('connect')
self._pulseQueryQueue(true)
cb(null, this)
})
})
}
Client.prototype.connect = function (callback) {
if (callback) {
this._connect(callback)
return
}
return new this._Promise((resolve, reject) => {
this._connect((error) => {
if (error) {
reject(error)
} else {
resolve(this)
}
})
})
}
// send a query to the server
// this method is highly overloaded to take
// 1) string query, optional array of parameters, optional function callback
// 2) object query with {
// string query
// optional array values,
// optional function callback instead of as a separate parameter
// optional string name to name & cache the query plan
// optional string rowMode = 'array' for an array of results
// }
Client.prototype.query = function (config, values, callback) {
let query
let result
let readTimeout
let readTimeoutTimer
let queryCallback
if (config === null || config === undefined) {
throw new TypeError('Client was passed a null or undefined query')
} else if (typeof config.submit === 'function') {
readTimeout = config.query_timeout || this.connectionParameters.query_timeout
result = query = config
// accept query(new Query(...), (err, res) => { }) style
if (typeof values === 'function') {
config.callback = values
}
} else {
readTimeout = config.query_timeout || this.connectionParameters.query_timeout
query = new NativeQuery(config, values, callback)
if (!query.callback) {
let resolveOut, rejectOut
result = new this._Promise((resolve, reject) => {
resolveOut = resolve
rejectOut = reject
}).catch((err) => {
Error.captureStackTrace(err)
throw err
})
query.callback = (err, res) => (err ? rejectOut(err) : resolveOut(res))
}
}
if (readTimeout) {
queryCallback = query.callback || (() => {})
readTimeoutTimer = setTimeout(() => {
const error = new Error('Query read timeout')
process.nextTick(() => {
query.handleError(error, this.connection)
})
queryCallback(error)
// we already returned an error,
// just do nothing if query completes
query.callback = () => {}
// Remove from queue
const index = this._queryQueue.indexOf(query)
if (index > -1) {
this._queryQueue.splice(index, 1)
}
this._pulseQueryQueue()
}, readTimeout)
query.callback = (err, res) => {
clearTimeout(readTimeoutTimer)
queryCallback(err, res)
}
}
if (!this._queryable) {
query.native = this.native
process.nextTick(() => {
query.handleError(new Error('Client has encountered a connection error and is not queryable'))
})
return result
}
if (this._ending) {
query.native = this.native
process.nextTick(() => {
query.handleError(new Error('Client was closed and is not queryable'))
})
return result
}
if (this._queryQueue.length > 0 && !this.pipeline) {
queryQueueLengthDeprecationNotice()
}
this._queryQueue.push(query)
this._pulseQueryQueue()
return result
}
// disconnect from the backend server
Client.prototype.end = function (cb) {
const self = this
this._ending = true
if (this._connecting && !this._connected) {
this.once('connect', () => {
this.end(() => {})
})
}
let result
if (!cb) {
result = new this._Promise(function (resolve, reject) {
cb = (err) => (err ? reject(err) : resolve())
})
}
const doEnd = function () {
self.native.end(function () {
self._connected = false
self._errorAllQueries(new Error('Connection terminated'))
process.nextTick(() => {
self.emit('end')
if (cb) cb()
})
})
}
// If pipeline has in-flight or queued queries, wait for them to drain before closing
if (this.pipeline && (this._pipelineInFlight || this._queryQueue.length > 0)) {
this.once('drain', doEnd)
} else {
doEnd()
}
return result
}
Client.prototype._hasActiveQuery = function () {
return this._activeQuery && this._activeQuery.state !== 'error' && this._activeQuery.state !== 'end'
}
Client.prototype._pulseQueryQueue = function (initialConnection) {
if (!this._connected) {
return
}
if (this.pipeline && !initialConnection) {
return this._pulsePipelinedQueryQueue()
}
if (this._hasActiveQuery()) {
return
}
const query = this._queryQueue.shift()
if (!query) {
if (!initialConnection) {
this.emit('drain')
}
return
}
this._activeQuery = query
query.submit(this)
const self = this
query.once('_done', function () {
self._pulseQueryQueue()
})
}
Client.prototype._pulsePipelinedQueryQueue = function () {
if (!this._connected || this._pipelineInFlight) {
return
}
if (this._queryQueue.length === 0) {
if (this.hasExecuted) {
this.emit('drain')
}
return
}
this._pipelineInFlight = true
const self = this
const queries = []
const nativeQueries = []
const utils = require('../utils')
while (this._queryQueue.length > 0) {
const query = this._queryQueue.shift()
this.hasExecuted = true
nativeQueries.push(query)
const values = query.values ? query.values.map(utils.prepareValue) : null
const pipelineEntry = { text: query.text, name: query.name }
if (values) {
pipelineEntry.values = values
}
if (query.name && this.namedQueries[query.name]) {
pipelineEntry._alreadyPrepared = true
}
queries.push(pipelineEntry)
}
this.native.pipeline(queries, function (err, results) {
self._pipelineInFlight = false
if (err) {
// Total pipeline failure — error all queries
for (let i = 0; i < nativeQueries.length; i++) {
const q = nativeQueries[i]
q.native = self.native
q.handleError(err)
}
self._pulsePipelinedQueryQueue()
return
}
// Deliver results to each query
for (let i = 0; i < nativeQueries.length; i++) {
const q = nativeQueries[i]
const r = results[i]
q.native = self.native
if (r.err) {
q.handleError(r.err)
} else {
// Track named queries on success
if (q.name) {
self.namedQueries[q.name] = q.text
}
q.state = 'end'
q.emit('end', r.result)
if (q.callback) {
q.callback(null, r.result)
}
}
setImmediate(function () {
q.emit('_done')
})
}
// Process any queries that arrived while we were reading
self._pulsePipelinedQueryQueue()
})
}
// attempt to cancel an in-progress query
Client.prototype.cancel = function (query) {
if (this._activeQuery === query) {
this.native.cancel(function () {})
} else if (this._queryQueue.indexOf(query) !== -1) {
this._queryQueue.splice(this._queryQueue.indexOf(query), 1)
}
}
Client.prototype.ref = function () {}
Client.prototype.unref = function () {}
Client.prototype.setTypeParser = function (oid, format, parseFn) {
return this._types.setTypeParser(oid, format, parseFn)
}
Client.prototype.getTypeParser = function (oid, format) {
return this._types.getTypeParser(oid, format)
}
Client.prototype.isConnected = function () {
return this._connected
}
Client.prototype.getTransactionStatus = function () {
return this.native.getTransactionStatus()
}

View File

@@ -0,0 +1,58 @@
{
"name": "punycode",
"version": "2.3.1",
"description": "A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.",
"homepage": "https://mths.be/punycode",
"main": "punycode.js",
"jsnext:main": "punycode.es6.js",
"module": "punycode.es6.js",
"engines": {
"node": ">=6"
},
"keywords": [
"punycode",
"unicode",
"idn",
"idna",
"dns",
"url",
"domain"
],
"license": "MIT",
"author": {
"name": "Mathias Bynens",
"url": "https://mathiasbynens.be/"
},
"contributors": [
{
"name": "Mathias Bynens",
"url": "https://mathiasbynens.be/"
}
],
"repository": {
"type": "git",
"url": "https://github.com/mathiasbynens/punycode.js.git"
},
"bugs": "https://github.com/mathiasbynens/punycode.js/issues",
"files": [
"LICENSE-MIT.txt",
"punycode.js",
"punycode.es6.js"
],
"scripts": {
"test": "mocha tests",
"build": "node scripts/prepublish.js"
},
"devDependencies": {
"codecov": "^3.8.3",
"nyc": "^15.1.0",
"mocha": "^10.2.0"
},
"jspm": {
"map": {
"./punycode.js": {
"node": "@node/punycode"
}
}
}
}

View File

@@ -0,0 +1,87 @@
"use strict";
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
/// <reference path="../../typings/thenable.d.ts" preserve="true"/>
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProgressType = exports.ProgressToken = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.AbstractMessageBuffer = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.LRUCache = exports.Touch = exports.LinkedMap = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.Message = exports.RAL = void 0;
exports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.RequestCancellationReceiverStrategy = exports.IdCancellationReceiverStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.TraceValue = exports.Trace = void 0;
const messages_1 = require("./messages");
Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return messages_1.Message; } });
Object.defineProperty(exports, "RequestType", { enumerable: true, get: function () { return messages_1.RequestType; } });
Object.defineProperty(exports, "RequestType0", { enumerable: true, get: function () { return messages_1.RequestType0; } });
Object.defineProperty(exports, "RequestType1", { enumerable: true, get: function () { return messages_1.RequestType1; } });
Object.defineProperty(exports, "RequestType2", { enumerable: true, get: function () { return messages_1.RequestType2; } });
Object.defineProperty(exports, "RequestType3", { enumerable: true, get: function () { return messages_1.RequestType3; } });
Object.defineProperty(exports, "RequestType4", { enumerable: true, get: function () { return messages_1.RequestType4; } });
Object.defineProperty(exports, "RequestType5", { enumerable: true, get: function () { return messages_1.RequestType5; } });
Object.defineProperty(exports, "RequestType6", { enumerable: true, get: function () { return messages_1.RequestType6; } });
Object.defineProperty(exports, "RequestType7", { enumerable: true, get: function () { return messages_1.RequestType7; } });
Object.defineProperty(exports, "RequestType8", { enumerable: true, get: function () { return messages_1.RequestType8; } });
Object.defineProperty(exports, "RequestType9", { enumerable: true, get: function () { return messages_1.RequestType9; } });
Object.defineProperty(exports, "ResponseError", { enumerable: true, get: function () { return messages_1.ResponseError; } });
Object.defineProperty(exports, "ErrorCodes", { enumerable: true, get: function () { return messages_1.ErrorCodes; } });
Object.defineProperty(exports, "NotificationType", { enumerable: true, get: function () { return messages_1.NotificationType; } });
Object.defineProperty(exports, "NotificationType0", { enumerable: true, get: function () { return messages_1.NotificationType0; } });
Object.defineProperty(exports, "NotificationType1", { enumerable: true, get: function () { return messages_1.NotificationType1; } });
Object.defineProperty(exports, "NotificationType2", { enumerable: true, get: function () { return messages_1.NotificationType2; } });
Object.defineProperty(exports, "NotificationType3", { enumerable: true, get: function () { return messages_1.NotificationType3; } });
Object.defineProperty(exports, "NotificationType4", { enumerable: true, get: function () { return messages_1.NotificationType4; } });
Object.defineProperty(exports, "NotificationType5", { enumerable: true, get: function () { return messages_1.NotificationType5; } });
Object.defineProperty(exports, "NotificationType6", { enumerable: true, get: function () { return messages_1.NotificationType6; } });
Object.defineProperty(exports, "NotificationType7", { enumerable: true, get: function () { return messages_1.NotificationType7; } });
Object.defineProperty(exports, "NotificationType8", { enumerable: true, get: function () { return messages_1.NotificationType8; } });
Object.defineProperty(exports, "NotificationType9", { enumerable: true, get: function () { return messages_1.NotificationType9; } });
Object.defineProperty(exports, "ParameterStructures", { enumerable: true, get: function () { return messages_1.ParameterStructures; } });
const linkedMap_1 = require("./linkedMap");
Object.defineProperty(exports, "LinkedMap", { enumerable: true, get: function () { return linkedMap_1.LinkedMap; } });
Object.defineProperty(exports, "LRUCache", { enumerable: true, get: function () { return linkedMap_1.LRUCache; } });
Object.defineProperty(exports, "Touch", { enumerable: true, get: function () { return linkedMap_1.Touch; } });
const disposable_1 = require("./disposable");
Object.defineProperty(exports, "Disposable", { enumerable: true, get: function () { return disposable_1.Disposable; } });
const events_1 = require("./events");
Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return events_1.Event; } });
Object.defineProperty(exports, "Emitter", { enumerable: true, get: function () { return events_1.Emitter; } });
const cancellation_1 = require("./cancellation");
Object.defineProperty(exports, "CancellationTokenSource", { enumerable: true, get: function () { return cancellation_1.CancellationTokenSource; } });
Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function () { return cancellation_1.CancellationToken; } });
const sharedArrayCancellation_1 = require("./sharedArrayCancellation");
Object.defineProperty(exports, "SharedArraySenderStrategy", { enumerable: true, get: function () { return sharedArrayCancellation_1.SharedArraySenderStrategy; } });
Object.defineProperty(exports, "SharedArrayReceiverStrategy", { enumerable: true, get: function () { return sharedArrayCancellation_1.SharedArrayReceiverStrategy; } });
const messageReader_1 = require("./messageReader");
Object.defineProperty(exports, "MessageReader", { enumerable: true, get: function () { return messageReader_1.MessageReader; } });
Object.defineProperty(exports, "AbstractMessageReader", { enumerable: true, get: function () { return messageReader_1.AbstractMessageReader; } });
Object.defineProperty(exports, "ReadableStreamMessageReader", { enumerable: true, get: function () { return messageReader_1.ReadableStreamMessageReader; } });
const messageWriter_1 = require("./messageWriter");
Object.defineProperty(exports, "MessageWriter", { enumerable: true, get: function () { return messageWriter_1.MessageWriter; } });
Object.defineProperty(exports, "AbstractMessageWriter", { enumerable: true, get: function () { return messageWriter_1.AbstractMessageWriter; } });
Object.defineProperty(exports, "WriteableStreamMessageWriter", { enumerable: true, get: function () { return messageWriter_1.WriteableStreamMessageWriter; } });
const messageBuffer_1 = require("./messageBuffer");
Object.defineProperty(exports, "AbstractMessageBuffer", { enumerable: true, get: function () { return messageBuffer_1.AbstractMessageBuffer; } });
const connection_1 = require("./connection");
Object.defineProperty(exports, "ConnectionStrategy", { enumerable: true, get: function () { return connection_1.ConnectionStrategy; } });
Object.defineProperty(exports, "ConnectionOptions", { enumerable: true, get: function () { return connection_1.ConnectionOptions; } });
Object.defineProperty(exports, "NullLogger", { enumerable: true, get: function () { return connection_1.NullLogger; } });
Object.defineProperty(exports, "createMessageConnection", { enumerable: true, get: function () { return connection_1.createMessageConnection; } });
Object.defineProperty(exports, "ProgressToken", { enumerable: true, get: function () { return connection_1.ProgressToken; } });
Object.defineProperty(exports, "ProgressType", { enumerable: true, get: function () { return connection_1.ProgressType; } });
Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return connection_1.Trace; } });
Object.defineProperty(exports, "TraceValue", { enumerable: true, get: function () { return connection_1.TraceValue; } });
Object.defineProperty(exports, "TraceFormat", { enumerable: true, get: function () { return connection_1.TraceFormat; } });
Object.defineProperty(exports, "SetTraceNotification", { enumerable: true, get: function () { return connection_1.SetTraceNotification; } });
Object.defineProperty(exports, "LogTraceNotification", { enumerable: true, get: function () { return connection_1.LogTraceNotification; } });
Object.defineProperty(exports, "ConnectionErrors", { enumerable: true, get: function () { return connection_1.ConnectionErrors; } });
Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return connection_1.ConnectionError; } });
Object.defineProperty(exports, "CancellationReceiverStrategy", { enumerable: true, get: function () { return connection_1.CancellationReceiverStrategy; } });
Object.defineProperty(exports, "IdCancellationReceiverStrategy", { enumerable: true, get: function () { return connection_1.IdCancellationReceiverStrategy; } });
Object.defineProperty(exports, "RequestCancellationReceiverStrategy", { enumerable: true, get: function () { return connection_1.RequestCancellationReceiverStrategy; } });
Object.defineProperty(exports, "CancellationSenderStrategy", { enumerable: true, get: function () { return connection_1.CancellationSenderStrategy; } });
Object.defineProperty(exports, "CancellationStrategy", { enumerable: true, get: function () { return connection_1.CancellationStrategy; } });
Object.defineProperty(exports, "MessageStrategy", { enumerable: true, get: function () { return connection_1.MessageStrategy; } });
Object.defineProperty(exports, "TraceValues", { enumerable: true, get: function () { return connection_1.TraceValues; } });
const ral_1 = __importDefault(require("./ral"));
exports.RAL = ral_1.default;

View File

@@ -0,0 +1,33 @@
/*
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function () {
'use strict';
exports.ast = require('./ast');
exports.code = require('./code');
exports.keyword = require('./keyword');
}());
/* vim: set sw=4 ts=4 et tw=80 : */

View File

@@ -0,0 +1,2 @@
import type { TSESTree } from '@typescript-eslint/utils';
export declare function isAssignee(node: TSESTree.Node): boolean;

View File

@@ -0,0 +1,37 @@
import { ClientConfig } from 'pg'
export function parse(connectionString: string, options?: Options): ConnectionOptions
export interface Options {
// Use libpq semantics when interpreting the connection string
useLibpqCompat?: boolean
}
interface SSLConfig {
ca?: string
cert?: string | null
key?: string
rejectUnauthorized?: boolean
}
export interface ConnectionOptions {
host: string | null
password?: string
user?: string
port?: string | null
database: string | null | undefined
client_encoding?: string
ssl?: boolean | string | SSLConfig
sslnegotiation?: 'postgres' | 'direct'
application_name?: string
fallback_application_name?: string
options?: string
keepalives?: number
// We allow any other options to be passed through
[key: string]: unknown
}
export function toClientConfig(config: ConnectionOptions): ClientConfig
export function parseIntoClientConfig(connectionString: string): ClientConfig

View File

@@ -0,0 +1,27 @@
import type { Program } from 'typescript';
import * as ts from 'typescript';
import type { ParseSettings } from '../parseSettings';
export interface ASTAndNoProgram {
ast: ts.SourceFile;
program: null;
}
export interface ASTAndDefiniteProgram {
ast: ts.SourceFile;
program: ts.Program;
}
export type ASTAndProgram = ASTAndDefiniteProgram | ASTAndNoProgram;
export declare const DEFAULT_EXTRA_FILE_EXTENSIONS: Set<string>;
export declare function createDefaultCompilerOptionsFromExtra(parseSettings: ParseSettings): ts.CompilerOptions;
export type CanonicalPath = {
__brand: unknown;
} & string;
export declare function getCanonicalFileName(filePath: string): CanonicalPath;
export declare function ensureAbsolutePath(p: string, tsconfigRootDir: string): string;
export declare function canonicalDirname(p: CanonicalPath): CanonicalPath;
export declare function getAstFromProgram(currentProgram: Program, filePath: string): ASTAndDefiniteProgram | undefined;
/**
* Hash content for compare content.
* @param content hashed contend
* @returns hashed result
*/
export declare function createHash(content: string): string;

View File

@@ -0,0 +1,57 @@
{
"reg": {
"name": "reg",
"browser": "IE 9.0.0 (Windows 7 0.0.0)",
"suite": "escape-short",
"hz": 451918.6269906427,
"success": true,
"fastest": false,
"rme": 0.014367526545734477,
"rhz": 0.3631427610829891,
"sampleSize": 166
},
"fn if": {
"name": "fn if",
"browser": "IE 9.0.0 (Windows 7 0.0.0)",
"suite": "escape-short",
"hz": 458041.9492929381,
"success": true,
"fastest": false,
"rme": 0.014164362470847206,
"rhz": 0.36806320479796495,
"sampleSize": 168
},
"fn if reverse": {
"name": "fn if reverse",
"browser": "IE 9.0.0 (Windows 7 0.0.0)",
"suite": "escape-short",
"hz": 307481.77110852796,
"success": true,
"fastest": false,
"rme": 0.012392303592867627,
"rhz": 0.2470793914528124,
"sampleSize": 159
},
"escape31": {
"name": "escape31",
"browser": "IE 9.0.0 (Windows 7 0.0.0)",
"suite": "escape-short",
"hz": 521251.41025503376,
"success": true,
"fastest": false,
"rme": 0.01429694912407263,
"rhz": 0.41885566346070136,
"sampleSize": 159
},
"native": {
"name": "native",
"browser": "IE 9.0.0 (Windows 7 0.0.0)",
"suite": "escape-short",
"hz": 1244465.4703921403,
"success": true,
"fastest": true,
"rme": 0.013138952266236287,
"rhz": 1,
"sampleSize": 164
}
}

View File

@@ -0,0 +1,24 @@
'use strict'
let Node = require('./node')
class Declaration extends Node {
get variable() {
return this.prop.startsWith('--') || this.prop[0] === '$'
}
constructor(defaults) {
if (
defaults &&
typeof defaults.value !== 'undefined' &&
typeof defaults.value !== 'string'
) {
defaults = { ...defaults, value: String(defaults.value) }
}
super(defaults)
this.type = 'decl'
}
}
module.exports = Declaration
Declaration.default = Declaration

View File

@@ -0,0 +1 @@
export { _ as default } from "../esm/_await_async_generator.js";

View File

@@ -0,0 +1,5 @@
import type { TSESLint } from '@typescript-eslint/utils';
declare const _default: TSESLint.RuleModule<"replaceUsagesWithConstraint" | "sole", [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
name: string;
};
export default _default;

View File

@@ -0,0 +1,8 @@
var myStringify = require('../index');
var data = require("../fixtures/index").input;
var result = 0;
for (var i = 0; i < 1000; i++) {
result += myStringify(data).length;
}
console.log('Finished running (cumulative string length: ' + result + ")");

View File

@@ -0,0 +1 @@
{"version":3,"file":"argon2.d.ts","sourceRoot":"","sources":["src/argon2.ts"],"names":[],"mappings":"AAYA,OAAO,EAAqD,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAkK9F;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAuNF,qCAAqC;AACrC,eAAO,MAAM,OAAO,GAAI,UAAU,QAAQ,EAAE,MAAM,QAAQ,EAAE,MAAM,SAAS,KAAG,UACnC,CAAC;AAC5C,8CAA8C;AAC9C,eAAO,MAAM,OAAO,GAAI,UAAU,QAAQ,EAAE,MAAM,QAAQ,EAAE,MAAM,SAAS,KAAG,UACpC,CAAC;AAC3C,sEAAsE;AACtE,eAAO,MAAM,QAAQ,GAAI,UAAU,QAAQ,EAAE,MAAM,QAAQ,EAAE,MAAM,SAAS,KAAG,UACpC,CAAC;AAiE5C,2CAA2C;AAC3C,eAAO,MAAM,YAAY,GACvB,UAAU,QAAQ,EAClB,MAAM,QAAQ,EACd,MAAM,SAAS,KACd,OAAO,CAAC,UAAU,CAAmD,CAAC;AACzE,oDAAoD;AACpD,eAAO,MAAM,YAAY,GACvB,UAAU,QAAQ,EAClB,MAAM,QAAQ,EACd,MAAM,SAAS,KACd,OAAO,CAAC,UAAU,CAAkD,CAAC;AACxE,4EAA4E;AAC5E,eAAO,MAAM,aAAa,GACxB,UAAU,QAAQ,EAClB,MAAM,QAAQ,EACd,MAAM,SAAS,KACd,OAAO,CAAC,UAAU,CAAmD,CAAC"}

View File

@@ -0,0 +1,116 @@
import { Hash, type CHashO, type Input } from './utils.ts';
/** Blake hash options. dkLen is output length. key is used in MAC mode. salt is used in KDF mode. */
export type Blake2Opts = {
dkLen?: number;
key?: Input;
salt?: Input;
personalization?: Input;
};
/** Class, from which others are subclassed. */
export declare abstract class BLAKE2<T extends BLAKE2<T>> extends Hash<T> {
protected abstract compress(msg: Uint32Array, offset: number, isLast: boolean): void;
protected abstract get(): number[];
protected abstract set(...args: number[]): void;
abstract destroy(): void;
protected buffer: Uint8Array;
protected buffer32: Uint32Array;
protected finished: boolean;
protected destroyed: boolean;
protected length: number;
protected pos: number;
readonly blockLen: number;
readonly outputLen: number;
constructor(blockLen: number, outputLen: number);
update(data: Input): this;
digestInto(out: Uint8Array): void;
digest(): Uint8Array;
_cloneInto(to?: T): T;
clone(): T;
}
export declare class BLAKE2b extends BLAKE2<BLAKE2b> {
private v0l;
private v0h;
private v1l;
private v1h;
private v2l;
private v2h;
private v3l;
private v3h;
private v4l;
private v4h;
private v5l;
private v5h;
private v6l;
private v6h;
private v7l;
private v7h;
constructor(opts?: Blake2Opts);
protected get(): [
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number,
number
];
protected set(v0l: number, v0h: number, v1l: number, v1h: number, v2l: number, v2h: number, v3l: number, v3h: number, v4l: number, v4h: number, v5l: number, v5h: number, v6l: number, v6h: number, v7l: number, v7h: number): void;
protected compress(msg: Uint32Array, offset: number, isLast: boolean): void;
destroy(): void;
}
/**
* Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
* @param msg - message that would be hashed
* @param opts - dkLen output length, key for MAC mode, salt, personalization
*/
export declare const blake2b: CHashO;
export type Num16 = {
v0: number;
v1: number;
v2: number;
v3: number;
v4: number;
v5: number;
v6: number;
v7: number;
v8: number;
v9: number;
v10: number;
v11: number;
v12: number;
v13: number;
v14: number;
v15: number;
};
export declare function compress(s: Uint8Array, offset: number, msg: Uint32Array, rounds: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number): Num16;
export declare class BLAKE2s extends BLAKE2<BLAKE2s> {
private v0;
private v1;
private v2;
private v3;
private v4;
private v5;
private v6;
private v7;
constructor(opts?: Blake2Opts);
protected get(): [number, number, number, number, number, number, number, number];
protected set(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number): void;
protected compress(msg: Uint32Array, offset: number, isLast: boolean): void;
destroy(): void;
}
/**
* Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS.
* @param msg - message that would be hashed
* @param opts - dkLen output length, key for MAC mode, salt, personalization
*/
export declare const blake2s: CHashO;
//# sourceMappingURL=blake2.d.ts.map

View File

@@ -0,0 +1,22 @@
var superPropBase = require("./superPropBase.js");
var defineProperty = require("./defineProperty.js");
function set(e, r, t, o) {
return set = "undefined" != typeof Reflect && Reflect.set ? Reflect.set : function (e, r, t, o) {
var f,
i = superPropBase(e, r);
if (i) {
if ((f = Object.getOwnPropertyDescriptor(i, r)).set) return f.set.call(o, t), !0;
if (!f.writable) return !1;
}
if (f = Object.getOwnPropertyDescriptor(o, r)) {
if (!f.writable) return !1;
f.value = t, Object.defineProperty(o, r, f);
} else defineProperty(o, r, t);
return !0;
}, set(e, r, t, o);
}
function _set(e, r, t, o, f) {
if (!set(e, r, t, o || e) && f) throw new TypeError("failed to set property");
return t;
}
module.exports = _set, module.exports.__esModule = true, module.exports["default"] = module.exports;

View File

@@ -0,0 +1,90 @@
import * as core from "../core/index.js";
import * as schemas from "./schemas.js";
//////////////////////////////////////////////
//////////////////////////////////////////////
////////// //////////
////////// ZodISODateTime //////////
////////// //////////
//////////////////////////////////////////////
//////////////////////////////////////////////
export interface ZodISODateTime extends schemas.ZodStringFormat {
_zod: core.$ZodISODateTimeInternals;
}
export const ZodISODateTime: core.$constructor<ZodISODateTime> = /*@__PURE__*/ core.$constructor(
"ZodISODateTime",
(inst, def) => {
core.$ZodISODateTime.init(inst, def);
schemas.ZodStringFormat.init(inst, def);
}
);
export function datetime(params?: string | core.$ZodISODateTimeParams): ZodISODateTime {
return core._isoDateTime(ZodISODateTime, params);
}
//////////////////////////////////////////
//////////////////////////////////////////
////////// //////////
////////// ZodISODate //////////
////////// //////////
//////////////////////////////////////////
//////////////////////////////////////////
export interface ZodISODate extends schemas.ZodStringFormat {
_zod: core.$ZodISODateInternals;
}
export const ZodISODate: core.$constructor<ZodISODate> = /*@__PURE__*/ core.$constructor("ZodISODate", (inst, def) => {
core.$ZodISODate.init(inst, def);
schemas.ZodStringFormat.init(inst, def);
});
export function date(params?: string | core.$ZodISODateParams): ZodISODate {
return core._isoDate(ZodISODate, params);
}
// ZodISOTime
//////////////////////////////////////////
//////////////////////////////////////////
////////// //////////
////////// ZodISOTime //////////
////////// //////////
//////////////////////////////////////////
//////////////////////////////////////////
export interface ZodISOTime extends schemas.ZodStringFormat {
_zod: core.$ZodISOTimeInternals;
}
export const ZodISOTime: core.$constructor<ZodISOTime> = /*@__PURE__*/ core.$constructor("ZodISOTime", (inst, def) => {
core.$ZodISOTime.init(inst, def);
schemas.ZodStringFormat.init(inst, def);
});
export function time(params?: string | core.$ZodISOTimeParams): ZodISOTime {
return core._isoTime(ZodISOTime, params);
}
//////////////////////////////////////////////
//////////////////////////////////////////////
////////// //////////
////////// ZodISODuration //////////
////////// //////////
//////////////////////////////////////////////
//////////////////////////////////////////////
export interface ZodISODuration extends schemas.ZodStringFormat {
_zod: core.$ZodISODurationInternals;
}
export const ZodISODuration: core.$constructor<ZodISODuration> = /*@__PURE__*/ core.$constructor(
"ZodISODuration",
(inst, def) => {
core.$ZodISODuration.init(inst, def);
schemas.ZodStringFormat.init(inst, def);
}
);
export function duration(params?: string | core.$ZodISODurationParams): ZodISODuration {
return core._isoDuration(ZodISODuration, params);
}

View File

@@ -0,0 +1,62 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// SEE https://typescript-eslint.io/users/configs
//
// For developers working in the typescript-eslint monorepo:
// You can regenerate it using `pnpm run generate-configs`
module.exports = {
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
rules: {
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
'no-array-constructor': 'off',
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-array-delete': 'error',
'@typescript-eslint/no-base-to-string': 'error',
'@typescript-eslint/no-duplicate-enum-values': 'error',
'@typescript-eslint/no-duplicate-type-constituents': 'error',
'@typescript-eslint/no-empty-object-type': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'no-implied-eval': 'off',
'@typescript-eslint/no-implied-eval': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-redundant-type-constituents': 'error',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/no-unsafe-argument': 'error',
'@typescript-eslint/no-unsafe-assignment': 'error',
'@typescript-eslint/no-unsafe-call': 'error',
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
'@typescript-eslint/no-unsafe-function-type': 'error',
'@typescript-eslint/no-unsafe-member-access': 'error',
'@typescript-eslint/no-unsafe-return': 'error',
'@typescript-eslint/no-unsafe-unary-minus': 'error',
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-wrapper-object-types': 'error',
'no-throw-literal': 'off',
'@typescript-eslint/only-throw-error': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'prefer-promise-reject-errors': 'off',
'@typescript-eslint/prefer-promise-reject-errors': 'error',
'require-await': 'off',
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/restrict-template-expressions': 'error',
'@typescript-eslint/triple-slash-reference': 'error',
'@typescript-eslint/unbound-method': 'error',
},
};