WIP: bootstrap and partial real Solana watcher implementation
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import toPropertyKey from "./toPropertyKey.js";
|
||||
function _defineProperty(e, r, t) {
|
||||
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
||||
value: t,
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0
|
||||
}) : e[r] = t, e;
|
||||
}
|
||||
export { _defineProperty as default };
|
||||
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { LibDefinition } from '../variable';
|
||||
export declare const es2016_array_include: LibDefinition;
|
||||
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getConstraintInfo = getConstraintInfo;
|
||||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
/**
|
||||
* Returns whether the type is a generic and what its constraint is.
|
||||
*
|
||||
* If the type is not a generic, `isTypeParameter` will be `false`, and
|
||||
* `constraintType` will be the same as the input type.
|
||||
*
|
||||
* If the type is a generic, and it is constrained, `isTypeParameter` will be
|
||||
* `true`, and `constraintType` will be the constraint type.
|
||||
*
|
||||
* If the type is a generic, but it is not constrained, `constraintType` will be
|
||||
* `undefined` (rather than an `unknown` type), due to https://github.com/microsoft/TypeScript/issues/60475
|
||||
*
|
||||
* Successor to {@link getConstrainedTypeAtLocation} due to https://github.com/typescript-eslint/typescript-eslint/issues/10438
|
||||
*
|
||||
* This is considered internal since it is unstable for now and may have breaking changes at any time.
|
||||
* Use at your own risk.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
*/
|
||||
function getConstraintInfo(checker, type) {
|
||||
if (tsutils.isTypeParameter(type)) {
|
||||
const constraintType = checker.getBaseConstraintOfType(type);
|
||||
return {
|
||||
constraintType,
|
||||
isTypeParameter: true,
|
||||
};
|
||||
}
|
||||
return {
|
||||
constraintType: type,
|
||||
isTypeParameter: false,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import { type FileReference, ModifierFlags, type Node, SyntaxKind } from "../../ast/index.ts";
|
||||
import type { TimingCollector } from "../timing.ts";
|
||||
import { NODE_DATA_TYPE_CHILDREN, NODE_DATA_TYPE_EXTENDED, NODE_DATA_TYPE_STRING } from "./protocol.ts";
|
||||
export declare const popcount8: number[];
|
||||
export type NodeDataType = typeof NODE_DATA_TYPE_CHILDREN | typeof NODE_DATA_TYPE_STRING | typeof NODE_DATA_TYPE_EXTENDED;
|
||||
export declare const NODE_DATA_TYPE_MASK = 3221225472;
|
||||
export declare const NODE_CHILD_MASK = 255;
|
||||
export declare const NODE_STRING_INDEX_MASK = 16777215;
|
||||
export declare const NODE_EXTENDED_DATA_MASK = 16777215;
|
||||
export interface TextDecoder {
|
||||
decode(input?: ArrayBufferView | ArrayBufferLike): string;
|
||||
}
|
||||
export interface SourceFileInfo {
|
||||
readonly _offsetNodes: number;
|
||||
readonly _offsetStringTableOffsets: number;
|
||||
readonly _offsetStringTable: number;
|
||||
readonly _offsetExtendedData: number;
|
||||
readonly _offsetStructuredData: number;
|
||||
readonly _decoder: TextDecoder;
|
||||
nodes: any[];
|
||||
readonly path?: string;
|
||||
/**
|
||||
* The timing collector that per-node materialization is reported into, and
|
||||
* that this source file registered itself with when fetched. Present only
|
||||
* when timing collection is enabled; when undefined, materialization is not
|
||||
* timed and no clock is read.
|
||||
*/
|
||||
readonly _timing?: TimingCollector | undefined;
|
||||
readFileReferences(offset: number): readonly FileReference[];
|
||||
readNodeIndexArray(offset: number): readonly Node[];
|
||||
readStringArray(offset: number): readonly string[];
|
||||
getOrCreateNodeAtIndex(index: number): Node;
|
||||
}
|
||||
/**
|
||||
* Read the 128-bit content hash from a source file binary response as a hex string.
|
||||
*/
|
||||
export declare function readSourceFileHash(data: DataView): string;
|
||||
/**
|
||||
* Read the per-file parse options key from a source file binary response.
|
||||
* This encodes the ExternalModuleIndicatorOptions bitmask as a string,
|
||||
* allowing the client to distinguish files parsed with different options.
|
||||
*/
|
||||
export declare function readParseOptionsKey(data: DataView): string;
|
||||
export declare function modifierToFlag(kind: SyntaxKind): ModifierFlags;
|
||||
export declare class RemoteNodeBase {
|
||||
parent: any;
|
||||
view: DataView;
|
||||
protected index: number;
|
||||
protected _byteIndex: number;
|
||||
constructor(view: DataView, index: number, parent: any, byteIndex: number);
|
||||
get kind(): SyntaxKind;
|
||||
get pos(): number;
|
||||
get end(): number;
|
||||
get next(): number;
|
||||
protected get parentIndex(): number;
|
||||
protected get data(): number;
|
||||
protected get dataType(): NodeDataType;
|
||||
protected get childMask(): number;
|
||||
protected getFileText(start: number, end: number): string;
|
||||
protected get sourceFile(): SourceFileInfo;
|
||||
}
|
||||
//# sourceMappingURL=node.infrastructure.d.ts.map
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Blake2s hash function. Focuses on 8-bit to 32-bit platforms. blake2b for 64-bit, but in JS it is slower.
|
||||
* @module
|
||||
* @deprecated
|
||||
*/
|
||||
import { G1s as G1s_n, G2s as G2s_n } from './_blake.ts';
|
||||
import { BLAKE2s as B2S, blake2s as b2s, compress as compress_n } from './blake2.ts';
|
||||
/** @deprecated Use import from `noble/hashes/blake2` module */
|
||||
export declare const B2S_IV: Uint32Array;
|
||||
/** @deprecated Use import from `noble/hashes/blake2` module */
|
||||
export declare const G1s: typeof G1s_n;
|
||||
/** @deprecated Use import from `noble/hashes/blake2` module */
|
||||
export declare const G2s: typeof G2s_n;
|
||||
/** @deprecated Use import from `noble/hashes/blake2` module */
|
||||
export declare const compress: typeof compress_n;
|
||||
/** @deprecated Use import from `noble/hashes/blake2` module */
|
||||
export declare const BLAKE2s: typeof B2S;
|
||||
/** @deprecated Use import from `noble/hashes/blake2` module */
|
||||
export declare const blake2s: typeof b2s;
|
||||
//# sourceMappingURL=blake2s.d.ts.map
|
||||
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
const uk_js_1 = __importDefault(require("./uk.cjs"));
|
||||
/** @deprecated Use `uk` instead. */
|
||||
function default_1() {
|
||||
return (0, uk_js_1.default)();
|
||||
}
|
||||
module.exports = exports.default;
|
||||
@@ -0,0 +1,110 @@
|
||||
/* This file is automatically generated and should not be manually edited. */
|
||||
/* To modify this file, please run the `npm run build` command instead. */
|
||||
|
||||
export { _ as _apply_decorated_descriptor } from "./_apply_decorated_descriptor.js";
|
||||
export { _ as _apply_decs_2203_r } from "./_apply_decs_2203_r.js";
|
||||
export { _ as _apply_decs_2311 } from "./_apply_decs_2311.js";
|
||||
export { _ as _array_like_to_array } from "./_array_like_to_array.js";
|
||||
export { _ as _array_with_holes } from "./_array_with_holes.js";
|
||||
export { _ as _array_without_holes } from "./_array_without_holes.js";
|
||||
export { _ as _assert_this_initialized } from "./_assert_this_initialized.js";
|
||||
export { _ as _async_generator } from "./_async_generator.js";
|
||||
export { _ as _async_generator_delegate } from "./_async_generator_delegate.js";
|
||||
export { _ as _async_iterator } from "./_async_iterator.js";
|
||||
export { _ as _async_to_generator } from "./_async_to_generator.js";
|
||||
export { _ as _await_async_generator } from "./_await_async_generator.js";
|
||||
export { _ as _await_value } from "./_await_value.js";
|
||||
export { _ as _call_super } from "./_call_super.js";
|
||||
export { _ as _check_private_redeclaration } from "./_check_private_redeclaration.js";
|
||||
export { _ as _class_apply_descriptor_destructure } from "./_class_apply_descriptor_destructure.js";
|
||||
export { _ as _class_apply_descriptor_get } from "./_class_apply_descriptor_get.js";
|
||||
export { _ as _class_apply_descriptor_set } from "./_class_apply_descriptor_set.js";
|
||||
export { _ as _class_apply_descriptor_update } from "./_class_apply_descriptor_update.js";
|
||||
export { _ as _class_call_check } from "./_class_call_check.js";
|
||||
export { _ as _class_check_private_static_access } from "./_class_check_private_static_access.js";
|
||||
export { _ as _class_check_private_static_field_descriptor } from "./_class_check_private_static_field_descriptor.js";
|
||||
export { _ as _class_extract_field_descriptor } from "./_class_extract_field_descriptor.js";
|
||||
export { _ as _class_name_tdz_error } from "./_class_name_tdz_error.js";
|
||||
export { _ as _class_private_field_destructure } from "./_class_private_field_destructure.js";
|
||||
export { _ as _class_private_field_get } from "./_class_private_field_get.js";
|
||||
export { _ as _class_private_field_init } from "./_class_private_field_init.js";
|
||||
export { _ as _class_private_field_loose_base } from "./_class_private_field_loose_base.js";
|
||||
export { _ as _class_private_field_loose_key } from "./_class_private_field_loose_key.js";
|
||||
export { _ as _class_private_field_set } from "./_class_private_field_set.js";
|
||||
export { _ as _class_private_field_update } from "./_class_private_field_update.js";
|
||||
export { _ as _class_private_method_get } from "./_class_private_method_get.js";
|
||||
export { _ as _class_private_method_init } from "./_class_private_method_init.js";
|
||||
export { _ as _class_private_method_set } from "./_class_private_method_set.js";
|
||||
export { _ as _class_static_private_field_destructure } from "./_class_static_private_field_destructure.js";
|
||||
export { _ as _class_static_private_field_spec_get } from "./_class_static_private_field_spec_get.js";
|
||||
export { _ as _class_static_private_field_spec_set } from "./_class_static_private_field_spec_set.js";
|
||||
export { _ as _class_static_private_field_update } from "./_class_static_private_field_update.js";
|
||||
export { _ as _class_static_private_method_get } from "./_class_static_private_method_get.js";
|
||||
export { _ as _construct } from "./_construct.js";
|
||||
export { _ as _create_class } from "./_create_class.js";
|
||||
export { _ as _create_for_of_iterator_helper_loose } from "./_create_for_of_iterator_helper_loose.js";
|
||||
export { _ as _create_super } from "./_create_super.js";
|
||||
export { _ as _decorate } from "./_decorate.js";
|
||||
export { _ as _defaults } from "./_defaults.js";
|
||||
export { _ as _define_enumerable_properties } from "./_define_enumerable_properties.js";
|
||||
export { _ as _define_property } from "./_define_property.js";
|
||||
export { _ as _dispose } from "./_dispose.js";
|
||||
export { _ as _export_star } from "./_export_star.js";
|
||||
export { _ as _extends } from "./_extends.js";
|
||||
export { _ as _get } from "./_get.js";
|
||||
export { _ as _get_prototype_of } from "./_get_prototype_of.js";
|
||||
export { _ as _identity } from "./_identity.js";
|
||||
export { _ as _inherits } from "./_inherits.js";
|
||||
export { _ as _inherits_loose } from "./_inherits_loose.js";
|
||||
export { _ as _initializer_define_property } from "./_initializer_define_property.js";
|
||||
export { _ as _initializer_warning_helper } from "./_initializer_warning_helper.js";
|
||||
export { _ as _instanceof } from "./_instanceof.js";
|
||||
export { _ as _interop_require_default } from "./_interop_require_default.js";
|
||||
export { _ as _interop_require_wildcard } from "./_interop_require_wildcard.js";
|
||||
export { _ as _is_native_function } from "./_is_native_function.js";
|
||||
export { _ as _is_native_reflect_construct } from "./_is_native_reflect_construct.js";
|
||||
export { _ as _iterable_to_array } from "./_iterable_to_array.js";
|
||||
export { _ as _iterable_to_array_limit } from "./_iterable_to_array_limit.js";
|
||||
export { _ as _iterable_to_array_limit_loose } from "./_iterable_to_array_limit_loose.js";
|
||||
export { _ as _jsx } from "./_jsx.js";
|
||||
export { _ as _new_arrow_check } from "./_new_arrow_check.js";
|
||||
export { _ as _non_iterable_rest } from "./_non_iterable_rest.js";
|
||||
export { _ as _non_iterable_spread } from "./_non_iterable_spread.js";
|
||||
export { _ as _object_destructuring_empty } from "./_object_destructuring_empty.js";
|
||||
export { _ as _object_spread } from "./_object_spread.js";
|
||||
export { _ as _object_spread_props } from "./_object_spread_props.js";
|
||||
export { _ as _object_without_properties } from "./_object_without_properties.js";
|
||||
export { _ as _object_without_properties_loose } from "./_object_without_properties_loose.js";
|
||||
export { _ as _overload_yield } from "./_overload_yield.js";
|
||||
export { _ as _possible_constructor_return } from "./_possible_constructor_return.js";
|
||||
export { _ as _read_only_error } from "./_read_only_error.js";
|
||||
export { _ as _set } from "./_set.js";
|
||||
export { _ as _set_prototype_of } from "./_set_prototype_of.js";
|
||||
export { _ as _skip_first_generator_next } from "./_skip_first_generator_next.js";
|
||||
export { _ as _sliced_to_array } from "./_sliced_to_array.js";
|
||||
export { _ as _sliced_to_array_loose } from "./_sliced_to_array_loose.js";
|
||||
export { _ as _super_prop_base } from "./_super_prop_base.js";
|
||||
export { _ as _tagged_template_literal } from "./_tagged_template_literal.js";
|
||||
export { _ as _tagged_template_literal_loose } from "./_tagged_template_literal_loose.js";
|
||||
export { _ as _throw } from "./_throw.js";
|
||||
export { _ as _to_array } from "./_to_array.js";
|
||||
export { _ as _to_consumable_array } from "./_to_consumable_array.js";
|
||||
export { _ as _to_primitive } from "./_to_primitive.js";
|
||||
export { _ as _to_property_key } from "./_to_property_key.js";
|
||||
export { _ as _ts_add_disposable_resource } from "./_ts_add_disposable_resource.js";
|
||||
export { _ as _ts_decorate } from "./_ts_decorate.js";
|
||||
export { _ as _ts_dispose_resources } from "./_ts_dispose_resources.js";
|
||||
export { _ as _ts_generator } from "./_ts_generator.js";
|
||||
export { _ as _ts_metadata } from "./_ts_metadata.js";
|
||||
export { _ as _ts_param } from "./_ts_param.js";
|
||||
export { _ as _ts_rewrite_relative_import_extension } from "./_ts_rewrite_relative_import_extension.js";
|
||||
export { _ as _ts_values } from "./_ts_values.js";
|
||||
export { _ as _type_of } from "./_type_of.js";
|
||||
export { _ as _unsupported_iterable_to_array } from "./_unsupported_iterable_to_array.js";
|
||||
export { _ as _update } from "./_update.js";
|
||||
export { _ as _using } from "./_using.js";
|
||||
export { _ as _using_ctx } from "./_using_ctx.js";
|
||||
export { _ as _wrap_async_generator } from "./_wrap_async_generator.js";
|
||||
export { _ as _wrap_native_super } from "./_wrap_native_super.js";
|
||||
export { _ as _wrap_reg_exp } from "./_wrap_reg_exp.js";
|
||||
export { _ as _write_only_error } from "./_write_only_error.js";
|
||||
@@ -0,0 +1,41 @@
|
||||
module.exports = isexe
|
||||
isexe.sync = sync
|
||||
|
||||
var fs = require('fs')
|
||||
|
||||
function isexe (path, options, cb) {
|
||||
fs.stat(path, function (er, stat) {
|
||||
cb(er, er ? false : checkStat(stat, options))
|
||||
})
|
||||
}
|
||||
|
||||
function sync (path, options) {
|
||||
return checkStat(fs.statSync(path), options)
|
||||
}
|
||||
|
||||
function checkStat (stat, options) {
|
||||
return stat.isFile() && checkMode(stat, options)
|
||||
}
|
||||
|
||||
function checkMode (stat, options) {
|
||||
var mod = stat.mode
|
||||
var uid = stat.uid
|
||||
var gid = stat.gid
|
||||
|
||||
var myUid = options.uid !== undefined ?
|
||||
options.uid : process.getuid && process.getuid()
|
||||
var myGid = options.gid !== undefined ?
|
||||
options.gid : process.getgid && process.getgid()
|
||||
|
||||
var u = parseInt('100', 8)
|
||||
var g = parseInt('010', 8)
|
||||
var o = parseInt('001', 8)
|
||||
var ug = u | g
|
||||
|
||||
var ret = (mod & o) ||
|
||||
(mod & g) && gid === myGid ||
|
||||
(mod & u) && uid === myUid ||
|
||||
(mod & ug) && myUid === 0
|
||||
|
||||
return ret
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getParentFunctionNode = getParentFunctionNode;
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
function getParentFunctionNode(node) {
|
||||
let current = node.parent;
|
||||
while (current) {
|
||||
if (current.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression ||
|
||||
current.type === utils_1.AST_NODE_TYPES.FunctionDeclaration ||
|
||||
current.type === utils_1.AST_NODE_TYPES.FunctionExpression) {
|
||||
return current;
|
||||
}
|
||||
current = current.parent;
|
||||
}
|
||||
// this shouldn't happen in correct code, but someone may attempt to parse bad code
|
||||
// the parser won't error, so we shouldn't throw here
|
||||
/* istanbul ignore next */ return null;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
ahdsadhdash
|
||||
@@ -0,0 +1,228 @@
|
||||
import {Buffer} from 'buffer';
|
||||
import * as BufferLayout from '@solana/buffer-layout';
|
||||
import {keccak_256} from '@noble/hashes/sha3';
|
||||
|
||||
import {PublicKey} from '../publickey';
|
||||
import {TransactionInstruction} from '../transaction';
|
||||
import assert from '../utils/assert';
|
||||
import {publicKeyCreate, ecdsaSign} from '../utils/secp256k1';
|
||||
import {toBuffer} from '../utils/to-buffer';
|
||||
|
||||
const PRIVATE_KEY_BYTES = 32;
|
||||
const ETHEREUM_ADDRESS_BYTES = 20;
|
||||
const PUBLIC_KEY_BYTES = 64;
|
||||
const SIGNATURE_OFFSETS_SERIALIZED_SIZE = 11;
|
||||
|
||||
/**
|
||||
* Params for creating an secp256k1 instruction using a public key
|
||||
*/
|
||||
export type CreateSecp256k1InstructionWithPublicKeyParams = {
|
||||
publicKey: Buffer | Uint8Array | Array<number>;
|
||||
message: Buffer | Uint8Array | Array<number>;
|
||||
signature: Buffer | Uint8Array | Array<number>;
|
||||
recoveryId: number;
|
||||
instructionIndex?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Params for creating an secp256k1 instruction using an Ethereum address
|
||||
*/
|
||||
export type CreateSecp256k1InstructionWithEthAddressParams = {
|
||||
ethAddress: Buffer | Uint8Array | Array<number> | string;
|
||||
message: Buffer | Uint8Array | Array<number>;
|
||||
signature: Buffer | Uint8Array | Array<number>;
|
||||
recoveryId: number;
|
||||
instructionIndex?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Params for creating an secp256k1 instruction using a private key
|
||||
*/
|
||||
export type CreateSecp256k1InstructionWithPrivateKeyParams = {
|
||||
privateKey: Buffer | Uint8Array | Array<number>;
|
||||
message: Buffer | Uint8Array | Array<number>;
|
||||
instructionIndex?: number;
|
||||
};
|
||||
|
||||
const SECP256K1_INSTRUCTION_LAYOUT = BufferLayout.struct<
|
||||
Readonly<{
|
||||
ethAddress: Uint8Array;
|
||||
ethAddressInstructionIndex: number;
|
||||
ethAddressOffset: number;
|
||||
messageDataOffset: number;
|
||||
messageDataSize: number;
|
||||
messageInstructionIndex: number;
|
||||
numSignatures: number;
|
||||
recoveryId: number;
|
||||
signature: Uint8Array;
|
||||
signatureInstructionIndex: number;
|
||||
signatureOffset: number;
|
||||
}>
|
||||
>([
|
||||
BufferLayout.u8('numSignatures'),
|
||||
BufferLayout.u16('signatureOffset'),
|
||||
BufferLayout.u8('signatureInstructionIndex'),
|
||||
BufferLayout.u16('ethAddressOffset'),
|
||||
BufferLayout.u8('ethAddressInstructionIndex'),
|
||||
BufferLayout.u16('messageDataOffset'),
|
||||
BufferLayout.u16('messageDataSize'),
|
||||
BufferLayout.u8('messageInstructionIndex'),
|
||||
BufferLayout.blob(20, 'ethAddress'),
|
||||
BufferLayout.blob(64, 'signature'),
|
||||
BufferLayout.u8('recoveryId'),
|
||||
]);
|
||||
|
||||
export class Secp256k1Program {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* Public key that identifies the secp256k1 program
|
||||
*/
|
||||
static programId: PublicKey = new PublicKey(
|
||||
'KeccakSecp256k11111111111111111111111111111',
|
||||
);
|
||||
|
||||
/**
|
||||
* Construct an Ethereum address from a secp256k1 public key buffer.
|
||||
* @param {Buffer} publicKey a 64 byte secp256k1 public key buffer
|
||||
*/
|
||||
static publicKeyToEthAddress(
|
||||
publicKey: Buffer | Uint8Array | Array<number>,
|
||||
): Buffer {
|
||||
assert(
|
||||
publicKey.length === PUBLIC_KEY_BYTES,
|
||||
`Public key must be ${PUBLIC_KEY_BYTES} bytes but received ${publicKey.length} bytes`,
|
||||
);
|
||||
|
||||
try {
|
||||
return Buffer.from(keccak_256(toBuffer(publicKey))).slice(
|
||||
-ETHEREUM_ADDRESS_BYTES,
|
||||
);
|
||||
} catch (error) {
|
||||
throw new Error(`Error constructing Ethereum address: ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an secp256k1 instruction with a public key. The public key
|
||||
* must be a buffer that is 64 bytes long.
|
||||
*/
|
||||
static createInstructionWithPublicKey(
|
||||
params: CreateSecp256k1InstructionWithPublicKeyParams,
|
||||
): TransactionInstruction {
|
||||
const {publicKey, message, signature, recoveryId, instructionIndex} =
|
||||
params;
|
||||
return Secp256k1Program.createInstructionWithEthAddress({
|
||||
ethAddress: Secp256k1Program.publicKeyToEthAddress(publicKey),
|
||||
message,
|
||||
signature,
|
||||
recoveryId,
|
||||
instructionIndex,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an secp256k1 instruction with an Ethereum address. The address
|
||||
* must be a hex string or a buffer that is 20 bytes long.
|
||||
*/
|
||||
static createInstructionWithEthAddress(
|
||||
params: CreateSecp256k1InstructionWithEthAddressParams,
|
||||
): TransactionInstruction {
|
||||
const {
|
||||
ethAddress: rawAddress,
|
||||
message,
|
||||
signature,
|
||||
recoveryId,
|
||||
instructionIndex = 0,
|
||||
} = params;
|
||||
|
||||
let ethAddress;
|
||||
if (typeof rawAddress === 'string') {
|
||||
if (rawAddress.startsWith('0x')) {
|
||||
ethAddress = Buffer.from(rawAddress.substr(2), 'hex');
|
||||
} else {
|
||||
ethAddress = Buffer.from(rawAddress, 'hex');
|
||||
}
|
||||
} else {
|
||||
ethAddress = rawAddress;
|
||||
}
|
||||
|
||||
assert(
|
||||
ethAddress.length === ETHEREUM_ADDRESS_BYTES,
|
||||
`Address must be ${ETHEREUM_ADDRESS_BYTES} bytes but received ${ethAddress.length} bytes`,
|
||||
);
|
||||
|
||||
const dataStart = 1 + SIGNATURE_OFFSETS_SERIALIZED_SIZE;
|
||||
const ethAddressOffset = dataStart;
|
||||
const signatureOffset = dataStart + ethAddress.length;
|
||||
const messageDataOffset = signatureOffset + signature.length + 1;
|
||||
const numSignatures = 1;
|
||||
|
||||
const instructionData = Buffer.alloc(
|
||||
SECP256K1_INSTRUCTION_LAYOUT.span + message.length,
|
||||
);
|
||||
|
||||
SECP256K1_INSTRUCTION_LAYOUT.encode(
|
||||
{
|
||||
numSignatures,
|
||||
signatureOffset,
|
||||
signatureInstructionIndex: instructionIndex,
|
||||
ethAddressOffset,
|
||||
ethAddressInstructionIndex: instructionIndex,
|
||||
messageDataOffset,
|
||||
messageDataSize: message.length,
|
||||
messageInstructionIndex: instructionIndex,
|
||||
signature: toBuffer(signature),
|
||||
ethAddress: toBuffer(ethAddress),
|
||||
recoveryId,
|
||||
},
|
||||
instructionData,
|
||||
);
|
||||
|
||||
instructionData.fill(toBuffer(message), SECP256K1_INSTRUCTION_LAYOUT.span);
|
||||
|
||||
return new TransactionInstruction({
|
||||
keys: [],
|
||||
programId: Secp256k1Program.programId,
|
||||
data: instructionData,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an secp256k1 instruction with a private key. The private key
|
||||
* must be a buffer that is 32 bytes long.
|
||||
*/
|
||||
static createInstructionWithPrivateKey(
|
||||
params: CreateSecp256k1InstructionWithPrivateKeyParams,
|
||||
): TransactionInstruction {
|
||||
const {privateKey: pkey, message, instructionIndex} = params;
|
||||
|
||||
assert(
|
||||
pkey.length === PRIVATE_KEY_BYTES,
|
||||
`Private key must be ${PRIVATE_KEY_BYTES} bytes but received ${pkey.length} bytes`,
|
||||
);
|
||||
|
||||
try {
|
||||
const privateKey = toBuffer(pkey);
|
||||
const publicKey = publicKeyCreate(
|
||||
privateKey,
|
||||
false /* isCompressed */,
|
||||
).slice(1); // throw away leading byte
|
||||
const messageHash = Buffer.from(keccak_256(toBuffer(message)));
|
||||
const [signature, recoveryId] = ecdsaSign(messageHash, privateKey);
|
||||
|
||||
return this.createInstructionWithPublicKey({
|
||||
publicKey,
|
||||
message,
|
||||
signature,
|
||||
recoveryId,
|
||||
instructionIndex,
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error(`Error creating instruction; ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016-2019 David Mark Clements
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,16 @@
|
||||
"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.es2025_iterator = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
const es2015_iterable_1 = require("./es2015.iterable");
|
||||
exports.es2025_iterator = {
|
||||
libs: [es2015_iterable_1.es2015_iterable],
|
||||
variables: [
|
||||
['Iterator', base_config_1.TYPE_VALUE],
|
||||
['IteratorObjectConstructor', base_config_1.TYPE],
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,200 @@
|
||||
"use strict";
|
||||
const usm = require("./url-state-machine");
|
||||
|
||||
exports.implementation = class URLImpl {
|
||||
constructor(constructorArgs) {
|
||||
const url = constructorArgs[0];
|
||||
const base = constructorArgs[1];
|
||||
|
||||
let parsedBase = null;
|
||||
if (base !== undefined) {
|
||||
parsedBase = usm.basicURLParse(base);
|
||||
if (parsedBase === "failure") {
|
||||
throw new TypeError("Invalid base URL");
|
||||
}
|
||||
}
|
||||
|
||||
const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase });
|
||||
if (parsedURL === "failure") {
|
||||
throw new TypeError("Invalid URL");
|
||||
}
|
||||
|
||||
this._url = parsedURL;
|
||||
|
||||
// TODO: query stuff
|
||||
}
|
||||
|
||||
get href() {
|
||||
return usm.serializeURL(this._url);
|
||||
}
|
||||
|
||||
set href(v) {
|
||||
const parsedURL = usm.basicURLParse(v);
|
||||
if (parsedURL === "failure") {
|
||||
throw new TypeError("Invalid URL");
|
||||
}
|
||||
|
||||
this._url = parsedURL;
|
||||
}
|
||||
|
||||
get origin() {
|
||||
return usm.serializeURLOrigin(this._url);
|
||||
}
|
||||
|
||||
get protocol() {
|
||||
return this._url.scheme + ":";
|
||||
}
|
||||
|
||||
set protocol(v) {
|
||||
usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" });
|
||||
}
|
||||
|
||||
get username() {
|
||||
return this._url.username;
|
||||
}
|
||||
|
||||
set username(v) {
|
||||
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.setTheUsername(this._url, v);
|
||||
}
|
||||
|
||||
get password() {
|
||||
return this._url.password;
|
||||
}
|
||||
|
||||
set password(v) {
|
||||
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.setThePassword(this._url, v);
|
||||
}
|
||||
|
||||
get host() {
|
||||
const url = this._url;
|
||||
|
||||
if (url.host === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (url.port === null) {
|
||||
return usm.serializeHost(url.host);
|
||||
}
|
||||
|
||||
return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port);
|
||||
}
|
||||
|
||||
set host(v) {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "host" });
|
||||
}
|
||||
|
||||
get hostname() {
|
||||
if (this._url.host === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return usm.serializeHost(this._url.host);
|
||||
}
|
||||
|
||||
set hostname(v) {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" });
|
||||
}
|
||||
|
||||
get port() {
|
||||
if (this._url.port === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return usm.serializeInteger(this._url.port);
|
||||
}
|
||||
|
||||
set port(v) {
|
||||
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (v === "") {
|
||||
this._url.port = null;
|
||||
} else {
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "port" });
|
||||
}
|
||||
}
|
||||
|
||||
get pathname() {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return this._url.path[0];
|
||||
}
|
||||
|
||||
if (this._url.path.length === 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return "/" + this._url.path.join("/");
|
||||
}
|
||||
|
||||
set pathname(v) {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._url.path = [];
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "path start" });
|
||||
}
|
||||
|
||||
get search() {
|
||||
if (this._url.query === null || this._url.query === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return "?" + this._url.query;
|
||||
}
|
||||
|
||||
set search(v) {
|
||||
// TODO: query stuff
|
||||
|
||||
const url = this._url;
|
||||
|
||||
if (v === "") {
|
||||
url.query = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const input = v[0] === "?" ? v.substring(1) : v;
|
||||
url.query = "";
|
||||
usm.basicURLParse(input, { url, stateOverride: "query" });
|
||||
}
|
||||
|
||||
get hash() {
|
||||
if (this._url.fragment === null || this._url.fragment === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return "#" + this._url.fragment;
|
||||
}
|
||||
|
||||
set hash(v) {
|
||||
if (v === "") {
|
||||
this._url.fragment = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const input = v[0] === "#" ? v.substring(1) : v;
|
||||
this._url.fragment = "";
|
||||
usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" });
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return this.href;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* @fileoverview require default case in switch statements
|
||||
* @author Aliaksei Shytkin
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const DEFAULT_COMMENT_PATTERN = /^no default$/iu;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../types').Rule.RuleModule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
defaultOptions: [{}],
|
||||
|
||||
docs: {
|
||||
description: "Require `default` cases in `switch` statements",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/default-case",
|
||||
},
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
commentPattern: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
missingDefaultCase: "Expected a default case.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const [options] = context.options;
|
||||
const commentPattern = options.commentPattern
|
||||
? new RegExp(options.commentPattern, "u")
|
||||
: DEFAULT_COMMENT_PATTERN;
|
||||
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Shortcut to get last element of array
|
||||
* @param {*[]} collection Array
|
||||
* @returns {any} Last element
|
||||
*/
|
||||
function last(collection) {
|
||||
return collection.at(-1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
SwitchStatement(node) {
|
||||
if (!node.cases.length) {
|
||||
/*
|
||||
* skip check of empty switch because there is no easy way
|
||||
* to extract comments inside it now
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
const hasDefault = node.cases.some(v => v.test === null);
|
||||
|
||||
if (!hasDefault) {
|
||||
let comment;
|
||||
|
||||
const lastCase = last(node.cases);
|
||||
const comments = sourceCode.getCommentsAfter(lastCase);
|
||||
|
||||
if (comments.length) {
|
||||
comment = last(comments);
|
||||
}
|
||||
|
||||
if (
|
||||
!comment ||
|
||||
!commentPattern.test(comment.value.trim())
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "missingDefaultCase",
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"keys-while": {
|
||||
"name": "keys-while",
|
||||
"browser": "Edge 14.14393.0 (Windows 10 0.0.0)",
|
||||
"suite": "iter",
|
||||
"hz": 39031.42857339076,
|
||||
"success": true,
|
||||
"fastest": true,
|
||||
"rme": 0.017905605200443618,
|
||||
"rhz": 1,
|
||||
"sampleSize": 168
|
||||
},
|
||||
"keys-for": {
|
||||
"name": "keys-for",
|
||||
"browser": "Edge 14.14393.0 (Windows 10 0.0.0)",
|
||||
"suite": "iter",
|
||||
"hz": 38547.41168447369,
|
||||
"success": true,
|
||||
"fastest": true,
|
||||
"rme": 0.020491580283930267,
|
||||
"rhz": 0.987599303776264,
|
||||
"sampleSize": 170
|
||||
},
|
||||
"incr-for": {
|
||||
"name": "incr-for",
|
||||
"browser": "Edge 14.14393.0 (Windows 10 0.0.0)",
|
||||
"suite": "iter",
|
||||
"hz": 14785.513229498973,
|
||||
"success": true,
|
||||
"fastest": false,
|
||||
"rme": 0.016773346589086083,
|
||||
"rhz": 0.37881045531545904,
|
||||
"sampleSize": 168
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export default '00000000-0000-0000-0000-000000000000';
|
||||
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getWrappedCode = getWrappedCode;
|
||||
function getWrappedCode(text, nodePrecedence, parentPrecedence) {
|
||||
return nodePrecedence > parentPrecedence ? text : `(${text})`;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
declare function sha1(bytes: Uint8Array): Uint8Array;
|
||||
export default sha1;
|
||||
@@ -0,0 +1,26 @@
|
||||
"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/adjacent-overload-signatures': 'error',
|
||||
'@typescript-eslint/array-type': 'error',
|
||||
'@typescript-eslint/ban-tslint-comment': 'error',
|
||||
'@typescript-eslint/class-literal-property-style': 'error',
|
||||
'@typescript-eslint/consistent-generic-constructors': 'error',
|
||||
'@typescript-eslint/consistent-indexed-object-style': 'error',
|
||||
'@typescript-eslint/consistent-type-assertions': 'error',
|
||||
'@typescript-eslint/consistent-type-definitions': 'error',
|
||||
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
|
||||
'no-empty-function': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'error',
|
||||
'@typescript-eslint/no-inferrable-types': 'error',
|
||||
'@typescript-eslint/prefer-for-of': 'error',
|
||||
'@typescript-eslint/prefer-function-type': 'error',
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('node:test')
|
||||
const prettifyLevel = require('./prettify-level')
|
||||
const getColorizer = require('../colors')
|
||||
const getLevelLabelData = require('./get-level-label-data')
|
||||
const {
|
||||
LEVEL_KEY
|
||||
} = require('../constants')
|
||||
|
||||
const context = {
|
||||
colorizer: getColorizer(),
|
||||
customLevelNames: undefined,
|
||||
customLevels: undefined,
|
||||
levelKey: LEVEL_KEY,
|
||||
customPrettifiers: undefined,
|
||||
getLevelLabelData: getLevelLabelData(false, {}, {})
|
||||
}
|
||||
|
||||
test('returns `undefined` for unknown level', t => {
|
||||
const colorized = prettifyLevel({
|
||||
log: {},
|
||||
context: {
|
||||
...context
|
||||
}
|
||||
})
|
||||
t.assert.strictEqual(colorized, undefined)
|
||||
})
|
||||
|
||||
test('returns non-colorized value for default colorizer', t => {
|
||||
const log = {
|
||||
level: 30
|
||||
}
|
||||
const colorized = prettifyLevel({
|
||||
log,
|
||||
context: {
|
||||
...context
|
||||
}
|
||||
})
|
||||
t.assert.strictEqual(colorized, 'INFO')
|
||||
})
|
||||
|
||||
test('returns colorized value for color colorizer', t => {
|
||||
const log = {
|
||||
level: 30
|
||||
}
|
||||
const colorizer = getColorizer(true)
|
||||
const colorized = prettifyLevel({
|
||||
log,
|
||||
context: {
|
||||
...context,
|
||||
colorizer
|
||||
}
|
||||
})
|
||||
t.assert.strictEqual(colorized, '\u001B[32mINFO\u001B[39m')
|
||||
})
|
||||
|
||||
test('passes output through provided prettifier', t => {
|
||||
const log = {
|
||||
level: 30
|
||||
}
|
||||
const colorized = prettifyLevel({
|
||||
log,
|
||||
context: {
|
||||
...context,
|
||||
customPrettifiers: { level () { return 'modified' } }
|
||||
}
|
||||
})
|
||||
t.assert.strictEqual(colorized, 'modified')
|
||||
})
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
export { _ as default } from "../esm/_non_iterable_rest.js";
|
||||
@@ -0,0 +1,61 @@
|
||||
import type { ParserServicesWithTypeInformation, TSESTree } from '@typescript-eslint/utils';
|
||||
import type { SourceCode } from '@typescript-eslint/utils/ts-eslint';
|
||||
import type { PreferOptionalChainOptions } from './PreferOptionalChainOptions';
|
||||
export declare const enum Yoda {
|
||||
Yes = 0,
|
||||
No = 1,
|
||||
Unknown = 2
|
||||
}
|
||||
export declare const enum OperandValidity {
|
||||
Valid = "Valid",
|
||||
Last = "Last",
|
||||
Invalid = "Invalid"
|
||||
}
|
||||
export declare const enum NullishComparisonType {
|
||||
/** `x != null`, `x != undefined` */
|
||||
NotEqualNullOrUndefined = "NotEqualNullOrUndefined",
|
||||
/** `x == null`, `x == undefined` */
|
||||
EqualNullOrUndefined = "EqualNullOrUndefined",
|
||||
/** `x !== null` */
|
||||
NotStrictEqualNull = "NotStrictEqualNull",
|
||||
/** `x === null` */
|
||||
StrictEqualNull = "StrictEqualNull",
|
||||
/** `x !== undefined`, `typeof x !== 'undefined'` */
|
||||
NotStrictEqualUndefined = "NotStrictEqualUndefined",
|
||||
/** `x === undefined`, `typeof x === 'undefined'` */
|
||||
StrictEqualUndefined = "StrictEqualUndefined",
|
||||
/** `!x` */
|
||||
NotBoolean = "NotBoolean",
|
||||
/** `x` */
|
||||
Boolean = "Boolean"
|
||||
}
|
||||
export declare const enum ComparisonType {
|
||||
NotEqual = "NotEqual",
|
||||
Equal = "Equal",
|
||||
NotStrictEqual = "NotStrictEqual",
|
||||
StrictEqual = "StrictEqual"
|
||||
}
|
||||
export interface ValidOperand {
|
||||
comparedName: TSESTree.Node;
|
||||
comparisonType: NullishComparisonType;
|
||||
isYoda: boolean;
|
||||
node: TSESTree.Expression;
|
||||
type: OperandValidity.Valid;
|
||||
}
|
||||
export interface LastChainOperand {
|
||||
comparedName: TSESTree.Node;
|
||||
comparisonType: ComparisonType;
|
||||
comparisonValue: TSESTree.Node;
|
||||
yoda: Yoda;
|
||||
node: TSESTree.BinaryExpression;
|
||||
type: OperandValidity.Last;
|
||||
}
|
||||
export interface InvalidOperand {
|
||||
type: OperandValidity.Invalid;
|
||||
}
|
||||
type Operand = InvalidOperand | LastChainOperand | ValidOperand;
|
||||
export declare function gatherLogicalOperands(node: TSESTree.LogicalExpression, parserServices: ParserServicesWithTypeInformation, sourceCode: Readonly<SourceCode>, options: PreferOptionalChainOptions): {
|
||||
newlySeenLogicals: Set<TSESTree.LogicalExpression>;
|
||||
operands: Operand[];
|
||||
};
|
||||
export {};
|
||||
Reference in New Issue
Block a user