WIP: bootstrap and partial real Solana watcher implementation
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
types/index.d.ts
|
||||
types/index.test-d.ts
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"name": "@typescript-eslint/type-utils",
|
||||
"version": "8.67.0",
|
||||
"description": "Type utilities for working with TypeScript + ESLint together",
|
||||
"files": [
|
||||
"dist",
|
||||
"!**/*.tsbuildinfo"
|
||||
],
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/typescript-eslint/typescript-eslint.git",
|
||||
"directory": "packages/type-utils"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/typescript-eslint/typescript-eslint/issues"
|
||||
},
|
||||
"homepage": "https://typescript-eslint.io",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"typescript",
|
||||
"estree"
|
||||
],
|
||||
"dependencies": {
|
||||
"debug": "^4.4.3",
|
||||
"ts-api-utils": "^2.5.0",
|
||||
"@typescript-eslint/utils": "8.67.0",
|
||||
"@typescript-eslint/typescript-estree": "8.67.0",
|
||||
"@typescript-eslint/types": "8.67.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
||||
"typescript": ">=4.8.4 <6.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/babel__code-frame": "^7.0.6",
|
||||
"@typescript/native": "npm:typescript@^7.0.2",
|
||||
"@vitest/coverage-v8": "^4.0.18",
|
||||
"ajv": "^6.12.6",
|
||||
"eslint": "^10.0.0",
|
||||
"rimraf": "^5.0.10",
|
||||
"typescript": ">=4.8.4 <6.1.0",
|
||||
"vitest": "^4.0.18",
|
||||
"@typescript-eslint/parser": "8.67.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"nx": {
|
||||
"name": "type-utils",
|
||||
"includedScripts": [
|
||||
"clean"
|
||||
],
|
||||
"targets": {
|
||||
"lint": {
|
||||
"command": "eslint"
|
||||
},
|
||||
"typecheck:tsgo": {},
|
||||
"attw-check": {}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "pnpm exec nx build",
|
||||
"clean": "rimraf dist/ coverage/",
|
||||
"format": "pnpm -w run format",
|
||||
"lint": "pnpm -w exec nx lint",
|
||||
"test": "pnpm -w exec nx test",
|
||||
"typecheck": "pnpm -w exec nx typecheck",
|
||||
"typecheck:tsgo": "pnpm -w exec nx typecheck:tsgo",
|
||||
"attw-check": "pnpm -w exec nx attw-check"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.selectorTypeToMessageString = selectorTypeToMessageString;
|
||||
exports.isMetaSelector = isMetaSelector;
|
||||
exports.isMethodOrPropertySelector = isMethodOrPropertySelector;
|
||||
const enums_1 = require("./enums");
|
||||
function selectorTypeToMessageString(selectorType) {
|
||||
const notCamelCase = selectorType.replaceAll(/([A-Z])/g, ' $1');
|
||||
return notCamelCase.charAt(0).toUpperCase() + notCamelCase.slice(1);
|
||||
}
|
||||
function isMetaSelector(selector) {
|
||||
return selector in enums_1.MetaSelectors;
|
||||
}
|
||||
function isMethodOrPropertySelector(selector) {
|
||||
return (selector === enums_1.MetaSelectors.method || selector === enums_1.MetaSelectors.property);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CatchClauseDefinition = void 0;
|
||||
const DefinitionBase_1 = require("./DefinitionBase");
|
||||
const DefinitionType_1 = require("./DefinitionType");
|
||||
class CatchClauseDefinition extends DefinitionBase_1.DefinitionBase {
|
||||
isTypeDefinition = false;
|
||||
isVariableDefinition = true;
|
||||
constructor(name, node) {
|
||||
super(DefinitionType_1.DefinitionType.CatchClause, name, node, null);
|
||||
}
|
||||
}
|
||||
exports.CatchClauseDefinition = CatchClauseDefinition;
|
||||
@@ -0,0 +1,96 @@
|
||||
var once = require('once');
|
||||
|
||||
var noop = function() {};
|
||||
|
||||
var qnt = global.Bare ? queueMicrotask : process.nextTick.bind(process);
|
||||
|
||||
var isRequest = function(stream) {
|
||||
return stream.setHeader && typeof stream.abort === 'function';
|
||||
};
|
||||
|
||||
var isChildProcess = function(stream) {
|
||||
return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3
|
||||
};
|
||||
|
||||
var eos = function(stream, opts, callback) {
|
||||
if (typeof opts === 'function') return eos(stream, null, opts);
|
||||
if (!opts) opts = {};
|
||||
|
||||
callback = once(callback || noop);
|
||||
|
||||
var ws = stream._writableState;
|
||||
var rs = stream._readableState;
|
||||
var readable = opts.readable || (opts.readable !== false && stream.readable);
|
||||
var writable = opts.writable || (opts.writable !== false && stream.writable);
|
||||
var cancelled = false;
|
||||
|
||||
var onlegacyfinish = function() {
|
||||
if (!stream.writable) onfinish();
|
||||
};
|
||||
|
||||
var onfinish = function() {
|
||||
writable = false;
|
||||
if (!readable) callback.call(stream);
|
||||
};
|
||||
|
||||
var onend = function() {
|
||||
readable = false;
|
||||
if (!writable) callback.call(stream);
|
||||
};
|
||||
|
||||
var onexit = function(exitCode) {
|
||||
callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);
|
||||
};
|
||||
|
||||
var onerror = function(err) {
|
||||
callback.call(stream, err);
|
||||
};
|
||||
|
||||
var onclose = function() {
|
||||
qnt(onclosenexttick);
|
||||
};
|
||||
|
||||
var onclosenexttick = function() {
|
||||
if (cancelled) return;
|
||||
if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close'));
|
||||
if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close'));
|
||||
};
|
||||
|
||||
var onrequest = function() {
|
||||
stream.req.on('finish', onfinish);
|
||||
};
|
||||
|
||||
if (isRequest(stream)) {
|
||||
stream.on('complete', onfinish);
|
||||
stream.on('abort', onclose);
|
||||
if (stream.req) onrequest();
|
||||
else stream.on('request', onrequest);
|
||||
} else if (writable && !ws) { // legacy streams
|
||||
stream.on('end', onlegacyfinish);
|
||||
stream.on('close', onlegacyfinish);
|
||||
}
|
||||
|
||||
if (isChildProcess(stream)) stream.on('exit', onexit);
|
||||
|
||||
stream.on('end', onend);
|
||||
stream.on('finish', onfinish);
|
||||
if (opts.error !== false) stream.on('error', onerror);
|
||||
stream.on('close', onclose);
|
||||
|
||||
return function() {
|
||||
cancelled = true;
|
||||
stream.removeListener('complete', onfinish);
|
||||
stream.removeListener('abort', onclose);
|
||||
stream.removeListener('request', onrequest);
|
||||
if (stream.req) stream.req.removeListener('finish', onfinish);
|
||||
stream.removeListener('end', onlegacyfinish);
|
||||
stream.removeListener('close', onlegacyfinish);
|
||||
stream.removeListener('finish', onfinish);
|
||||
stream.removeListener('exit', onexit);
|
||||
stream.removeListener('end', onend);
|
||||
stream.removeListener('error', onerror);
|
||||
stream.removeListener('close', onclose);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = eos;
|
||||
@@ -0,0 +1,20 @@
|
||||
import { _ as _is_native_reflect_construct } from "./_is_native_reflect_construct.js";
|
||||
import { _ as _set_prototype_of } from "./_set_prototype_of.js";
|
||||
function _construct(Parent, args, Class) {
|
||||
if (_is_native_reflect_construct()) _construct = Reflect.construct;
|
||||
else {
|
||||
_construct = function construct(Parent, args, Class) {
|
||||
var a = [null];
|
||||
a.push.apply(a, args);
|
||||
var Constructor = Function.bind.apply(Parent, a);
|
||||
var instance = new Constructor();
|
||||
|
||||
if (Class) _set_prototype_of(instance, Class.prototype);
|
||||
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
return _construct.apply(null, arguments);
|
||||
}
|
||||
export { _construct as _ };
|
||||
@@ -0,0 +1,110 @@
|
||||
import * as util from "../core/util.js";
|
||||
const error = () => {
|
||||
const Sizable = {
|
||||
string: { unit: "តួអក្សរ", verb: "គួរមាន" },
|
||||
file: { unit: "បៃ", verb: "គួរមាន" },
|
||||
array: { unit: "ធាតុ", verb: "គួរមាន" },
|
||||
set: { unit: "ធាតុ", verb: "គួរមាន" },
|
||||
};
|
||||
function getSizing(origin) {
|
||||
return Sizable[origin] ?? null;
|
||||
}
|
||||
const FormatDictionary = {
|
||||
regex: "ទិន្នន័យបញ្ចូល",
|
||||
email: "អាសយដ្ឋានអ៊ីមែល",
|
||||
url: "URL",
|
||||
emoji: "សញ្ញាអារម្មណ៍",
|
||||
uuid: "UUID",
|
||||
uuidv4: "UUIDv4",
|
||||
uuidv6: "UUIDv6",
|
||||
nanoid: "nanoid",
|
||||
guid: "GUID",
|
||||
cuid: "cuid",
|
||||
cuid2: "cuid2",
|
||||
ulid: "ULID",
|
||||
xid: "XID",
|
||||
ksuid: "KSUID",
|
||||
datetime: "កាលបរិច្ឆេទ និងម៉ោង ISO",
|
||||
date: "កាលបរិច្ឆេទ ISO",
|
||||
time: "ម៉ោង ISO",
|
||||
duration: "រយៈពេល ISO",
|
||||
ipv4: "អាសយដ្ឋាន IPv4",
|
||||
ipv6: "អាសយដ្ឋាន IPv6",
|
||||
cidrv4: "ដែនអាសយដ្ឋាន IPv4",
|
||||
cidrv6: "ដែនអាសយដ្ឋាន IPv6",
|
||||
base64: "ខ្សែអក្សរអ៊ិកូដ base64",
|
||||
base64url: "ខ្សែអក្សរអ៊ិកូដ base64url",
|
||||
json_string: "ខ្សែអក្សរ JSON",
|
||||
e164: "លេខ E.164",
|
||||
jwt: "JWT",
|
||||
template_literal: "ទិន្នន័យបញ្ចូល",
|
||||
};
|
||||
const TypeDictionary = {
|
||||
nan: "NaN",
|
||||
number: "លេខ",
|
||||
array: "អារេ (Array)",
|
||||
null: "គ្មានតម្លៃ (null)",
|
||||
};
|
||||
return (issue) => {
|
||||
switch (issue.code) {
|
||||
case "invalid_type": {
|
||||
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
||||
const receivedType = util.parsedType(issue.input);
|
||||
const received = TypeDictionary[receivedType] ?? receivedType;
|
||||
if (/^[A-Z]/.test(issue.expected)) {
|
||||
return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${issue.expected} ប៉ុន្តែទទួលបាន ${received}`;
|
||||
}
|
||||
return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${expected} ប៉ុន្តែទទួលបាន ${received}`;
|
||||
}
|
||||
case "invalid_value":
|
||||
if (issue.values.length === 1)
|
||||
return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${util.stringifyPrimitive(issue.values[0])}`;
|
||||
return `ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${util.joinValues(issue.values, "|")}`;
|
||||
case "too_big": {
|
||||
const adj = issue.inclusive ? "<=" : "<";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing)
|
||||
return `ធំពេក៖ ត្រូវការ ${issue.origin ?? "តម្លៃ"} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "ធាតុ"}`;
|
||||
return `ធំពេក៖ ត្រូវការ ${issue.origin ?? "តម្លៃ"} ${adj} ${issue.maximum.toString()}`;
|
||||
}
|
||||
case "too_small": {
|
||||
const adj = issue.inclusive ? ">=" : ">";
|
||||
const sizing = getSizing(issue.origin);
|
||||
if (sizing) {
|
||||
return `តូចពេក៖ ត្រូវការ ${issue.origin} ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
|
||||
}
|
||||
return `តូចពេក៖ ត្រូវការ ${issue.origin} ${adj} ${issue.minimum.toString()}`;
|
||||
}
|
||||
case "invalid_format": {
|
||||
const _issue = issue;
|
||||
if (_issue.format === "starts_with") {
|
||||
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${_issue.prefix}"`;
|
||||
}
|
||||
if (_issue.format === "ends_with")
|
||||
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${_issue.suffix}"`;
|
||||
if (_issue.format === "includes")
|
||||
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${_issue.includes}"`;
|
||||
if (_issue.format === "regex")
|
||||
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${_issue.pattern}`;
|
||||
return `មិនត្រឹមត្រូវ៖ ${FormatDictionary[_issue.format] ?? issue.format}`;
|
||||
}
|
||||
case "not_multiple_of":
|
||||
return `លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${issue.divisor}`;
|
||||
case "unrecognized_keys":
|
||||
return `រកឃើញសោមិនស្គាល់៖ ${util.joinValues(issue.keys, ", ")}`;
|
||||
case "invalid_key":
|
||||
return `សោមិនត្រឹមត្រូវនៅក្នុង ${issue.origin}`;
|
||||
case "invalid_union":
|
||||
return `ទិន្នន័យមិនត្រឹមត្រូវ`;
|
||||
case "invalid_element":
|
||||
return `ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${issue.origin}`;
|
||||
default:
|
||||
return `ទិន្នន័យមិនត្រឹមត្រូវ`;
|
||||
}
|
||||
};
|
||||
};
|
||||
export default function () {
|
||||
return {
|
||||
localeError: error(),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"name": "ignore",
|
||||
"version": "7.0.6",
|
||||
"description": "Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others.",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"legacy.js",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"LICENSE-MIT"
|
||||
],
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm run build",
|
||||
"build": "babel -o legacy.js index.js",
|
||||
|
||||
"==================== linting ======================": "",
|
||||
"lint": "eslint .",
|
||||
|
||||
"===================== import ======================": "",
|
||||
"ts": "npm run test:ts && npm run test:16",
|
||||
"test:ts": "ts-node ./test/import/simple.ts",
|
||||
"test:16": "npm run test:ts:16 && npm run test:cjs:16 && npm run test:mjs:16",
|
||||
"test:ts:16": "ts-node --compilerOptions '{\"moduleResolution\": \"Node16\", \"module\": \"Node16\"}' ./test/import/simple.ts && tsc ./test/import/simple.ts --lib ES6 --moduleResolution Node16 --module Node16 && node ./test/import/simple.js",
|
||||
"test:cjs:16": "ts-node --compilerOptions '{\"moduleResolution\": \"Node16\", \"module\": \"Node16\"}' ./test/import/simple.cjs",
|
||||
"test:mjs:16": "ts-node --compilerOptions '{\"moduleResolution\": \"Node16\", \"module\": \"Node16\"}' ./test/import/simple.mjs && babel -o ./test/import/simple-mjs.js ./test/import/simple.mjs && node ./test/import/simple-mjs.js",
|
||||
|
||||
"===================== cases =======================": "",
|
||||
"test:cases": "npm run tap test/*.test.js -- --coverage",
|
||||
"tap": "tap --reporter classic",
|
||||
|
||||
"===================== debug =======================": "",
|
||||
"test:git": "npm run tap test/git-check-ignore.test.js",
|
||||
"test:ignore": "npm run tap test/ignore.test.js",
|
||||
"test:ignore:only": "IGNORE_ONLY_IGNORES=1 npm run tap test/ignore.test.js",
|
||||
"test:others": "npm run tap test/others.test.js",
|
||||
"test:no-coverage": "npm run tap test/*.test.js -- --no-check-coverage",
|
||||
|
||||
"test": "npm run lint && npm run ts && npm run build && npm run test:cases",
|
||||
"test:win32": "IGNORE_TEST_WIN32=1 npm run test",
|
||||
"report": "tap --coverage-report=html"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:kaelzhang/node-ignore.git"
|
||||
},
|
||||
"keywords": [
|
||||
"ignore",
|
||||
".gitignore",
|
||||
"gitignore",
|
||||
"npmignore",
|
||||
"rules",
|
||||
"manager",
|
||||
"filter",
|
||||
"regexp",
|
||||
"regex",
|
||||
"fnmatch",
|
||||
"glob",
|
||||
"asterisks",
|
||||
"regular-expression"
|
||||
],
|
||||
"author": "kael",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/kaelzhang/node-ignore/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.22.9",
|
||||
"@babel/core": "^7.22.9",
|
||||
"@babel/preset-env": "^7.22.9",
|
||||
"@typescript-eslint/eslint-plugin": "^8.19.1",
|
||||
"debug": "^4.3.4",
|
||||
"eslint": "^8.46.0",
|
||||
"eslint-config-ostai": "^3.0.0",
|
||||
"eslint-plugin-import": "^2.28.0",
|
||||
"mkdirp": "^3.0.1",
|
||||
"pre-suf": "^1.1.1",
|
||||
"rimraf": "^6.0.1",
|
||||
"spawn-sync": "^2.0.0",
|
||||
"tap": "^16.3.9",
|
||||
"tmp": "0.2.3",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,408 @@
|
||||
/**
|
||||
* BLS != BLS.
|
||||
* The file implements BLS (Boneh-Lynn-Shacham) signatures.
|
||||
* Used in both BLS (Barreto-Lynn-Scott) and BN (Barreto-Naehrig)
|
||||
* families of pairing-friendly curves.
|
||||
* Consists of two curves: G1 and G2:
|
||||
* - G1 is a subgroup of (x, y) E(Fq) over y² = x³ + 4.
|
||||
* - G2 is a subgroup of ((x₁, x₂+i), (y₁, y₂+i)) E(Fq²) over y² = x³ + 4(1 + i) where i is √-1
|
||||
* - Gt, created by bilinear (ate) pairing e(G1, G2), consists of p-th roots of unity in
|
||||
* Fq^k where k is embedding degree. Only degree 12 is currently supported, 24 is not.
|
||||
* Pairing is used to aggregate and verify signatures.
|
||||
* There are two modes of operation:
|
||||
* - Long signatures: X-byte keys + 2X-byte sigs (G1 keys + G2 sigs).
|
||||
* - Short signatures: 2X-byte keys + X-byte sigs (G2 keys + G1 sigs).
|
||||
* @module
|
||||
**/
|
||||
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
||||
import { abytes, ensureBytes, memoized, randomBytes, } from "../utils.js";
|
||||
import { normalizeZ } from "./curve.js";
|
||||
import { createHasher, } from "./hash-to-curve.js";
|
||||
import { getMinHashLength, mapHashToField } from "./modular.js";
|
||||
import { _normFnElement, weierstrassPoints, } from "./weierstrass.js";
|
||||
// prettier-ignore
|
||||
const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);
|
||||
// Not used with BLS12-381 (no sequential `11` in X). Useful for other curves.
|
||||
function NAfDecomposition(a) {
|
||||
const res = [];
|
||||
// a>1 because of marker bit
|
||||
for (; a > _1n; a >>= _1n) {
|
||||
if ((a & _1n) === _0n)
|
||||
res.unshift(0);
|
||||
else if ((a & _3n) === _3n) {
|
||||
res.unshift(-1);
|
||||
a += _1n;
|
||||
}
|
||||
else
|
||||
res.unshift(1);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function aNonEmpty(arr) {
|
||||
if (!Array.isArray(arr) || arr.length === 0)
|
||||
throw new Error('expected non-empty array');
|
||||
}
|
||||
// This should be enough for bn254, no need to export full stuff?
|
||||
function createBlsPairing(fields, G1, G2, params) {
|
||||
const { Fp2, Fp12 } = fields;
|
||||
const { twistType, ateLoopSize, xNegative, postPrecompute } = params;
|
||||
// Applies sparse multiplication as line function
|
||||
let lineFunction;
|
||||
if (twistType === 'multiplicative') {
|
||||
lineFunction = (c0, c1, c2, f, Px, Py) => Fp12.mul014(f, c0, Fp2.mul(c1, Px), Fp2.mul(c2, Py));
|
||||
}
|
||||
else if (twistType === 'divisive') {
|
||||
// NOTE: it should be [c0, c1, c2], but we use different order here to reduce complexity of
|
||||
// precompute calculations.
|
||||
lineFunction = (c0, c1, c2, f, Px, Py) => Fp12.mul034(f, Fp2.mul(c2, Py), Fp2.mul(c1, Px), c0);
|
||||
}
|
||||
else
|
||||
throw new Error('bls: unknown twist type');
|
||||
const Fp2div2 = Fp2.div(Fp2.ONE, Fp2.mul(Fp2.ONE, _2n));
|
||||
function pointDouble(ell, Rx, Ry, Rz) {
|
||||
const t0 = Fp2.sqr(Ry); // Ry²
|
||||
const t1 = Fp2.sqr(Rz); // Rz²
|
||||
const t2 = Fp2.mulByB(Fp2.mul(t1, _3n)); // 3 * T1 * B
|
||||
const t3 = Fp2.mul(t2, _3n); // 3 * T2
|
||||
const t4 = Fp2.sub(Fp2.sub(Fp2.sqr(Fp2.add(Ry, Rz)), t1), t0); // (Ry + Rz)² - T1 - T0
|
||||
const c0 = Fp2.sub(t2, t0); // T2 - T0 (i)
|
||||
const c1 = Fp2.mul(Fp2.sqr(Rx), _3n); // 3 * Rx²
|
||||
const c2 = Fp2.neg(t4); // -T4 (-h)
|
||||
ell.push([c0, c1, c2]);
|
||||
Rx = Fp2.mul(Fp2.mul(Fp2.mul(Fp2.sub(t0, t3), Rx), Ry), Fp2div2); // ((T0 - T3) * Rx * Ry) / 2
|
||||
Ry = Fp2.sub(Fp2.sqr(Fp2.mul(Fp2.add(t0, t3), Fp2div2)), Fp2.mul(Fp2.sqr(t2), _3n)); // ((T0 + T3) / 2)² - 3 * T2²
|
||||
Rz = Fp2.mul(t0, t4); // T0 * T4
|
||||
return { Rx, Ry, Rz };
|
||||
}
|
||||
function pointAdd(ell, Rx, Ry, Rz, Qx, Qy) {
|
||||
// Addition
|
||||
const t0 = Fp2.sub(Ry, Fp2.mul(Qy, Rz)); // Ry - Qy * Rz
|
||||
const t1 = Fp2.sub(Rx, Fp2.mul(Qx, Rz)); // Rx - Qx * Rz
|
||||
const c0 = Fp2.sub(Fp2.mul(t0, Qx), Fp2.mul(t1, Qy)); // T0 * Qx - T1 * Qy == Ry * Qx - Rx * Qy
|
||||
const c1 = Fp2.neg(t0); // -T0 == Qy * Rz - Ry
|
||||
const c2 = t1; // == Rx - Qx * Rz
|
||||
ell.push([c0, c1, c2]);
|
||||
const t2 = Fp2.sqr(t1); // T1²
|
||||
const t3 = Fp2.mul(t2, t1); // T2 * T1
|
||||
const t4 = Fp2.mul(t2, Rx); // T2 * Rx
|
||||
const t5 = Fp2.add(Fp2.sub(t3, Fp2.mul(t4, _2n)), Fp2.mul(Fp2.sqr(t0), Rz)); // T3 - 2 * T4 + T0² * Rz
|
||||
Rx = Fp2.mul(t1, t5); // T1 * T5
|
||||
Ry = Fp2.sub(Fp2.mul(Fp2.sub(t4, t5), t0), Fp2.mul(t3, Ry)); // (T4 - T5) * T0 - T3 * Ry
|
||||
Rz = Fp2.mul(Rz, t3); // Rz * T3
|
||||
return { Rx, Ry, Rz };
|
||||
}
|
||||
// Pre-compute coefficients for sparse multiplication
|
||||
// Point addition and point double calculations is reused for coefficients
|
||||
// pointAdd happens only if bit set, so wNAF is reasonable. Unfortunately we cannot combine
|
||||
// add + double in windowed precomputes here, otherwise it would be single op (since X is static)
|
||||
const ATE_NAF = NAfDecomposition(ateLoopSize);
|
||||
const calcPairingPrecomputes = memoized((point) => {
|
||||
const p = point;
|
||||
const { x, y } = p.toAffine();
|
||||
// prettier-ignore
|
||||
const Qx = x, Qy = y, negQy = Fp2.neg(y);
|
||||
// prettier-ignore
|
||||
let Rx = Qx, Ry = Qy, Rz = Fp2.ONE;
|
||||
const ell = [];
|
||||
for (const bit of ATE_NAF) {
|
||||
const cur = [];
|
||||
({ Rx, Ry, Rz } = pointDouble(cur, Rx, Ry, Rz));
|
||||
if (bit)
|
||||
({ Rx, Ry, Rz } = pointAdd(cur, Rx, Ry, Rz, Qx, bit === -1 ? negQy : Qy));
|
||||
ell.push(cur);
|
||||
}
|
||||
if (postPrecompute) {
|
||||
const last = ell[ell.length - 1];
|
||||
postPrecompute(Rx, Ry, Rz, Qx, Qy, pointAdd.bind(null, last));
|
||||
}
|
||||
return ell;
|
||||
});
|
||||
function millerLoopBatch(pairs, withFinalExponent = false) {
|
||||
let f12 = Fp12.ONE;
|
||||
if (pairs.length) {
|
||||
const ellLen = pairs[0][0].length;
|
||||
for (let i = 0; i < ellLen; i++) {
|
||||
f12 = Fp12.sqr(f12); // This allows us to do sqr only one time for all pairings
|
||||
// NOTE: we apply multiple pairings in parallel here
|
||||
for (const [ell, Px, Py] of pairs) {
|
||||
for (const [c0, c1, c2] of ell[i])
|
||||
f12 = lineFunction(c0, c1, c2, f12, Px, Py);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (xNegative)
|
||||
f12 = Fp12.conjugate(f12);
|
||||
return withFinalExponent ? Fp12.finalExponentiate(f12) : f12;
|
||||
}
|
||||
// Calculates product of multiple pairings
|
||||
// This up to x2 faster than just `map(({g1, g2})=>pairing({g1,g2}))`
|
||||
function pairingBatch(pairs, withFinalExponent = true) {
|
||||
const res = [];
|
||||
// Cache precomputed toAffine for all points
|
||||
normalizeZ(G1, pairs.map(({ g1 }) => g1));
|
||||
normalizeZ(G2, pairs.map(({ g2 }) => g2));
|
||||
for (const { g1, g2 } of pairs) {
|
||||
if (g1.is0() || g2.is0())
|
||||
throw new Error('pairing is not available for ZERO point');
|
||||
// This uses toAffine inside
|
||||
g1.assertValidity();
|
||||
g2.assertValidity();
|
||||
const Qa = g1.toAffine();
|
||||
res.push([calcPairingPrecomputes(g2), Qa.x, Qa.y]);
|
||||
}
|
||||
return millerLoopBatch(res, withFinalExponent);
|
||||
}
|
||||
// Calculates bilinear pairing
|
||||
function pairing(Q, P, withFinalExponent = true) {
|
||||
return pairingBatch([{ g1: Q, g2: P }], withFinalExponent);
|
||||
}
|
||||
return {
|
||||
Fp12, // NOTE: we re-export Fp12 here because pairing results are Fp12!
|
||||
millerLoopBatch,
|
||||
pairing,
|
||||
pairingBatch,
|
||||
calcPairingPrecomputes,
|
||||
};
|
||||
}
|
||||
function createBlsSig(blsPairing, PubCurve, SigCurve, SignatureCoder, isSigG1) {
|
||||
const { Fp12, pairingBatch } = blsPairing;
|
||||
function normPub(point) {
|
||||
return point instanceof PubCurve.Point ? point : PubCurve.Point.fromHex(point);
|
||||
}
|
||||
function normSig(point) {
|
||||
return point instanceof SigCurve.Point ? point : SigCurve.Point.fromHex(point);
|
||||
}
|
||||
function amsg(m) {
|
||||
if (!(m instanceof SigCurve.Point))
|
||||
throw new Error(`expected valid message hashed to ${!isSigG1 ? 'G2' : 'G1'} curve`);
|
||||
return m;
|
||||
}
|
||||
// What matters here is what point pairing API accepts as G1 or G2, not actual size or names
|
||||
const pair = !isSigG1
|
||||
? (a, b) => ({ g1: a, g2: b })
|
||||
: (a, b) => ({ g1: b, g2: a });
|
||||
return {
|
||||
// P = pk x G
|
||||
getPublicKey(secretKey) {
|
||||
// TODO: replace with
|
||||
// const sec = PubCurve.Point.Fn.fromBytes(secretKey);
|
||||
const sec = _normFnElement(PubCurve.Point.Fn, secretKey);
|
||||
return PubCurve.Point.BASE.multiply(sec);
|
||||
},
|
||||
// S = pk x H(m)
|
||||
sign(message, secretKey, unusedArg) {
|
||||
if (unusedArg != null)
|
||||
throw new Error('sign() expects 2 arguments');
|
||||
// TODO: replace with
|
||||
// PubCurve.Point.Fn.fromBytes(secretKey)
|
||||
const sec = _normFnElement(PubCurve.Point.Fn, secretKey);
|
||||
amsg(message).assertValidity();
|
||||
return message.multiply(sec);
|
||||
},
|
||||
// Checks if pairing of public key & hash is equal to pairing of generator & signature.
|
||||
// e(P, H(m)) == e(G, S)
|
||||
// e(S, G) == e(H(m), P)
|
||||
verify(signature, message, publicKey, unusedArg) {
|
||||
if (unusedArg != null)
|
||||
throw new Error('verify() expects 3 arguments');
|
||||
signature = normSig(signature);
|
||||
publicKey = normPub(publicKey);
|
||||
const P = publicKey.negate();
|
||||
const G = PubCurve.Point.BASE;
|
||||
const Hm = amsg(message);
|
||||
const S = signature;
|
||||
// This code was changed in 1.9.x:
|
||||
// Before it was G.negate() in G2, now it's always pubKey.negate
|
||||
// e(P, -Q)===e(-P, Q)==e(P, Q)^-1. Negate can be done anywhere (as long it is done once per pair).
|
||||
// We just moving sign, but since pairing is multiplicative, we doing X * X^-1 = 1
|
||||
const exp = pairingBatch([pair(P, Hm), pair(G, S)]);
|
||||
return Fp12.eql(exp, Fp12.ONE);
|
||||
},
|
||||
// https://ethresear.ch/t/fast-verification-of-multiple-bls-signatures/5407
|
||||
// e(G, S) = e(G, SUM(n)(Si)) = MUL(n)(e(G, Si))
|
||||
// TODO: maybe `{message: G2Hex, publicKey: G1Hex}[]` instead?
|
||||
verifyBatch(signature, messages, publicKeys) {
|
||||
aNonEmpty(messages);
|
||||
if (publicKeys.length !== messages.length)
|
||||
throw new Error('amount of public keys and messages should be equal');
|
||||
const sig = normSig(signature);
|
||||
const nMessages = messages;
|
||||
const nPublicKeys = publicKeys.map(normPub);
|
||||
// NOTE: this works only for exact same object
|
||||
const messagePubKeyMap = new Map();
|
||||
for (let i = 0; i < nPublicKeys.length; i++) {
|
||||
const pub = nPublicKeys[i];
|
||||
const msg = nMessages[i];
|
||||
let keys = messagePubKeyMap.get(msg);
|
||||
if (keys === undefined) {
|
||||
keys = [];
|
||||
messagePubKeyMap.set(msg, keys);
|
||||
}
|
||||
keys.push(pub);
|
||||
}
|
||||
const paired = [];
|
||||
const G = PubCurve.Point.BASE;
|
||||
try {
|
||||
for (const [msg, keys] of messagePubKeyMap) {
|
||||
const groupPublicKey = keys.reduce((acc, msg) => acc.add(msg));
|
||||
paired.push(pair(groupPublicKey, msg));
|
||||
}
|
||||
paired.push(pair(G.negate(), sig));
|
||||
return Fp12.eql(pairingBatch(paired), Fp12.ONE);
|
||||
}
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// Adds a bunch of public key points together.
|
||||
// pk1 + pk2 + pk3 = pkA
|
||||
aggregatePublicKeys(publicKeys) {
|
||||
aNonEmpty(publicKeys);
|
||||
publicKeys = publicKeys.map((pub) => normPub(pub));
|
||||
const agg = publicKeys.reduce((sum, p) => sum.add(p), PubCurve.Point.ZERO);
|
||||
agg.assertValidity();
|
||||
return agg;
|
||||
},
|
||||
// Adds a bunch of signature points together.
|
||||
// pk1 + pk2 + pk3 = pkA
|
||||
aggregateSignatures(signatures) {
|
||||
aNonEmpty(signatures);
|
||||
signatures = signatures.map((sig) => normSig(sig));
|
||||
const agg = signatures.reduce((sum, s) => sum.add(s), SigCurve.Point.ZERO);
|
||||
agg.assertValidity();
|
||||
return agg;
|
||||
},
|
||||
hash(messageBytes, DST) {
|
||||
abytes(messageBytes);
|
||||
const opts = DST ? { DST } : undefined;
|
||||
return SigCurve.hashToCurve(messageBytes, opts);
|
||||
},
|
||||
Signature: SignatureCoder,
|
||||
};
|
||||
}
|
||||
// G1_Point: ProjConstructor<bigint>, G2_Point: ProjConstructor<Fp2>,
|
||||
export function bls(CURVE) {
|
||||
// Fields are specific for curve, so for now we'll need to pass them with opts
|
||||
const { Fp, Fr, Fp2, Fp6, Fp12 } = CURVE.fields;
|
||||
// Point on G1 curve: (x, y)
|
||||
const G1_ = weierstrassPoints(CURVE.G1);
|
||||
const G1 = Object.assign(G1_, createHasher(G1_.Point, CURVE.G1.mapToCurve, {
|
||||
...CURVE.htfDefaults,
|
||||
...CURVE.G1.htfDefaults,
|
||||
}));
|
||||
// Point on G2 curve (complex numbers): (x₁, x₂+i), (y₁, y₂+i)
|
||||
const G2_ = weierstrassPoints(CURVE.G2);
|
||||
const G2 = Object.assign(G2_, createHasher(G2_.Point, CURVE.G2.mapToCurve, {
|
||||
...CURVE.htfDefaults,
|
||||
...CURVE.G2.htfDefaults,
|
||||
}));
|
||||
const pairingRes = createBlsPairing(CURVE.fields, G1.Point, G2.Point, {
|
||||
...CURVE.params,
|
||||
postPrecompute: CURVE.postPrecompute,
|
||||
});
|
||||
const { millerLoopBatch, pairing, pairingBatch, calcPairingPrecomputes } = pairingRes;
|
||||
const longSignatures = createBlsSig(pairingRes, G1, G2, CURVE.G2.Signature, false);
|
||||
const shortSignatures = createBlsSig(pairingRes, G2, G1, CURVE.G1.ShortSignature, true);
|
||||
const rand = CURVE.randomBytes || randomBytes;
|
||||
const randomSecretKey = () => {
|
||||
const length = getMinHashLength(Fr.ORDER);
|
||||
return mapHashToField(rand(length), Fr.ORDER);
|
||||
};
|
||||
const utils = {
|
||||
randomSecretKey,
|
||||
randomPrivateKey: randomSecretKey,
|
||||
calcPairingPrecomputes,
|
||||
};
|
||||
const { ShortSignature } = CURVE.G1;
|
||||
const { Signature } = CURVE.G2;
|
||||
function normP1Hash(point, htfOpts) {
|
||||
return point instanceof G1.Point
|
||||
? point
|
||||
: shortSignatures.hash(ensureBytes('point', point), htfOpts?.DST);
|
||||
}
|
||||
function normP2Hash(point, htfOpts) {
|
||||
return point instanceof G2.Point
|
||||
? point
|
||||
: longSignatures.hash(ensureBytes('point', point), htfOpts?.DST);
|
||||
}
|
||||
function getPublicKey(privateKey) {
|
||||
return longSignatures.getPublicKey(privateKey).toBytes(true);
|
||||
}
|
||||
function getPublicKeyForShortSignatures(privateKey) {
|
||||
return shortSignatures.getPublicKey(privateKey).toBytes(true);
|
||||
}
|
||||
function sign(message, privateKey, htfOpts) {
|
||||
const Hm = normP2Hash(message, htfOpts);
|
||||
const S = longSignatures.sign(Hm, privateKey);
|
||||
return message instanceof G2.Point ? S : Signature.toBytes(S);
|
||||
}
|
||||
function signShortSignature(message, privateKey, htfOpts) {
|
||||
const Hm = normP1Hash(message, htfOpts);
|
||||
const S = shortSignatures.sign(Hm, privateKey);
|
||||
return message instanceof G1.Point ? S : ShortSignature.toBytes(S);
|
||||
}
|
||||
function verify(signature, message, publicKey, htfOpts) {
|
||||
const Hm = normP2Hash(message, htfOpts);
|
||||
return longSignatures.verify(signature, Hm, publicKey);
|
||||
}
|
||||
function verifyShortSignature(signature, message, publicKey, htfOpts) {
|
||||
const Hm = normP1Hash(message, htfOpts);
|
||||
return shortSignatures.verify(signature, Hm, publicKey);
|
||||
}
|
||||
function aggregatePublicKeys(publicKeys) {
|
||||
const agg = longSignatures.aggregatePublicKeys(publicKeys);
|
||||
return publicKeys[0] instanceof G1.Point ? agg : agg.toBytes(true);
|
||||
}
|
||||
function aggregateSignatures(signatures) {
|
||||
const agg = longSignatures.aggregateSignatures(signatures);
|
||||
return signatures[0] instanceof G2.Point ? agg : Signature.toBytes(agg);
|
||||
}
|
||||
function aggregateShortSignatures(signatures) {
|
||||
const agg = shortSignatures.aggregateSignatures(signatures);
|
||||
return signatures[0] instanceof G1.Point ? agg : ShortSignature.toBytes(agg);
|
||||
}
|
||||
function verifyBatch(signature, messages, publicKeys, htfOpts) {
|
||||
const Hm = messages.map((m) => normP2Hash(m, htfOpts));
|
||||
return longSignatures.verifyBatch(signature, Hm, publicKeys);
|
||||
}
|
||||
G1.Point.BASE.precompute(4);
|
||||
return {
|
||||
longSignatures,
|
||||
shortSignatures,
|
||||
millerLoopBatch,
|
||||
pairing,
|
||||
pairingBatch,
|
||||
verifyBatch,
|
||||
fields: {
|
||||
Fr,
|
||||
Fp,
|
||||
Fp2,
|
||||
Fp6,
|
||||
Fp12,
|
||||
},
|
||||
params: {
|
||||
ateLoopSize: CURVE.params.ateLoopSize,
|
||||
twistType: CURVE.params.twistType,
|
||||
// deprecated
|
||||
r: CURVE.params.r,
|
||||
G1b: CURVE.G1.b,
|
||||
G2b: CURVE.G2.b,
|
||||
},
|
||||
utils,
|
||||
// deprecated
|
||||
getPublicKey,
|
||||
getPublicKeyForShortSignatures,
|
||||
sign,
|
||||
signShortSignature,
|
||||
verify,
|
||||
verifyShortSignature,
|
||||
aggregatePublicKeys,
|
||||
aggregateSignatures,
|
||||
aggregateShortSignatures,
|
||||
G1,
|
||||
G2,
|
||||
Signature,
|
||||
ShortSignature,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=bls.js.map
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Generate secure URL-friendly unique ID. The non-blocking version.
|
||||
*
|
||||
* By default, the ID will have 21 symbols to have a collision probability
|
||||
* similar to UUID v4.
|
||||
*
|
||||
* ```js
|
||||
* import { nanoid } from 'nanoid/async'
|
||||
* nanoid().then(id => {
|
||||
* model.id = id
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param size Size of the ID. The default size is 21.
|
||||
* @returns A promise with a random string.
|
||||
*/
|
||||
export function nanoid(size?: number): Promise<string>
|
||||
|
||||
/**
|
||||
* A low-level function.
|
||||
* Generate secure unique ID with custom alphabet. The non-blocking version.
|
||||
*
|
||||
* Alphabet must contain 256 symbols or less. Otherwise, the generator
|
||||
* will not be secure.
|
||||
*
|
||||
* @param alphabet Alphabet used to generate the ID.
|
||||
* @param defaultSize Size of the ID. The default size is 21.
|
||||
* @returns A function that returns a promise with a random string.
|
||||
*
|
||||
* ```js
|
||||
* import { customAlphabet } from 'nanoid/async'
|
||||
* const nanoid = customAlphabet('0123456789абвгдеё', 5)
|
||||
* nanoid().then(id => {
|
||||
* model.id = id //=> "8ё56а"
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
export function customAlphabet(
|
||||
alphabet: string,
|
||||
defaultSize?: number
|
||||
): (size?: number) => Promise<string>
|
||||
|
||||
/**
|
||||
* Generate an array of random bytes collected from hardware noise.
|
||||
*
|
||||
* ```js
|
||||
* import { random } from 'nanoid/async'
|
||||
* random(5).then(bytes => {
|
||||
* bytes //=> [10, 67, 212, 67, 89]
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param bytes Size of the array.
|
||||
* @returns A promise with a random bytes array.
|
||||
*/
|
||||
export function random(bytes: number): Promise<Uint8Array>
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { LibDefinition } from '../variable';
|
||||
export declare const es2017_object: LibDefinition;
|
||||
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
|
||||
// npx nx generate-lib repo
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.es2023_full = void 0;
|
||||
const dom_1 = require("./dom");
|
||||
const dom_asynciterable_1 = require("./dom.asynciterable");
|
||||
const dom_iterable_1 = require("./dom.iterable");
|
||||
const es2023_1 = require("./es2023");
|
||||
const scripthost_1 = require("./scripthost");
|
||||
const webworker_importscripts_1 = require("./webworker.importscripts");
|
||||
exports.es2023_full = {
|
||||
libs: [
|
||||
es2023_1.es2023,
|
||||
dom_1.dom,
|
||||
webworker_importscripts_1.webworker_importscripts,
|
||||
scripthost_1.scripthost,
|
||||
dom_iterable_1.dom_iterable,
|
||||
dom_asynciterable_1.dom_asynciterable,
|
||||
],
|
||||
variables: [],
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { LibDefinition } from '../variable';
|
||||
export declare const es2015_generator: LibDefinition;
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "pathe",
|
||||
"version": "2.0.3",
|
||||
"description": "Universal filesystem path utils",
|
||||
"repository": "unjs/pathe",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.cts",
|
||||
"default": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"./utils": {
|
||||
"import": {
|
||||
"types": "./dist/utils.d.mts",
|
||||
"default": "./dist/utils.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/utils.d.cts",
|
||||
"default": "./dist/utils.cjs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"utils.d.ts"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.13.1",
|
||||
"@vitest/coverage-v8": "^3.0.5",
|
||||
"changelogen": "^0.5.7",
|
||||
"esbuild": "^0.25.0",
|
||||
"eslint": "^9.20.1",
|
||||
"eslint-config-unjs": "^0.4.2",
|
||||
"jiti": "^2.4.2",
|
||||
"prettier": "^3.5.0",
|
||||
"typescript": "^5.7.3",
|
||||
"unbuild": "^3.3.1",
|
||||
"vitest": "^3.0.5",
|
||||
"zeptomatch": "^2.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "vitest",
|
||||
"lint": "eslint . && prettier -c src test",
|
||||
"lint:fix": "eslint . --fix && prettier -w src test",
|
||||
"release": "pnpm test && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
|
||||
"test": "pnpm lint && vitest run --coverage",
|
||||
"test:types": "tsc --noEmit"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
|
||||
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 @@
|
||||
{"version":3,"file":"add-codec-size-prefix.d.ts","sourceRoot":"","sources":["../../src/add-codec-size-prefix.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,EAGL,OAAO,EACP,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAGhB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,SAAS,CAAC;AAGjB,KAAK,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAChE,KAAK,sBAAsB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IACnD,gBAAgB,CAAC,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,GACxC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACtC,KAAK,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AACvD,KAAK,sBAAsB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IACnD,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,GAC/B,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACtC,KAAK,WAAW,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAClE,KAAK,oBAAoB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IACjD,cAAc,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAC9C,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAE5C;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EACtC,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAChC,MAAM,EAAE,sBAAsB,GAC/B,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAC3B,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,aAAa,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;AA8BxH;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EACpC,OAAO,EAAE,gBAAgB,CAAC,GAAG,CAAC,EAC9B,MAAM,EAAE,sBAAsB,GAC/B,gBAAgB,CAAC,GAAG,CAAC,CAAC;AACzB,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,aAAa,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;AA0BlH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,SAAS,KAAK,EACvD,KAAK,EAAE,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,EACjC,MAAM,EAAE,oBAAoB,GAC7B,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC9B,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,SAAS,KAAK,EACvD,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EACxB,MAAM,EAAE,WAAW,GACpB,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC"}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"main": "../../cjs/_async_generator_delegate.cjs",
|
||||
"module": "../../esm/_async_generator_delegate.js"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
function _AwaitValue(t) {
|
||||
this.wrapped = t;
|
||||
}
|
||||
export { _AwaitValue as default };
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
|
||||
|
||||
## Security
|
||||
|
||||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
|
||||
|
||||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||
|
||||
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
|
||||
|
||||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
|
||||
|
||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
||||
|
||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||
|
||||
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||
* Full paths of source file(s) related to the manifestation of the issue
|
||||
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||
* Any special configuration required to reproduce the issue
|
||||
* Step-by-step instructions to reproduce the issue
|
||||
* Proof-of-concept or exploit code (if possible)
|
||||
* Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
|
||||
|
||||
## Preferred Languages
|
||||
|
||||
We prefer all communications to be in English.
|
||||
|
||||
## Policy
|
||||
|
||||
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
|
||||
|
||||
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;GAWG;AACI,MAAM,MAAM,GAAG,CACpB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,EAC5B,aAAa,GAAG,KAAK,MAC+C,EAAE,EACxE,EAAE;IACF,wDAAwD;IACxD,4DAA4D;IAC5D,sDAAsD;IACtD,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,oBAAoB,CAAC,CAAC;YACzB,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC;YACnC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;IACzC,CAAC;IACD,OAAO,oBAAoB,CAAC,CAAC;QACzB,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;AACvC,CAAC,CAAA;AAlBY,QAAA,MAAM,UAkBlB","sourcesContent":["import type { MinimatchOptions } from './index.js'\n\n/**\n * Escape all magic characters in a glob pattern.\n *\n * If the {@link MinimatchOptions.windowsPathsNoEscape}\n * option is used, then characters are escaped by wrapping in `[]`, because\n * a magic character wrapped in a character class can only be satisfied by\n * that exact character. In this mode, `\\` is _not_ escaped, because it is\n * not interpreted as a magic character, but instead as a path separator.\n *\n * If the {@link MinimatchOptions.magicalBraces} option is used,\n * then braces (`{` and `}`) will be escaped.\n */\nexport const escape = (\n s: string,\n {\n windowsPathsNoEscape = false,\n magicalBraces = false,\n }: Pick<MinimatchOptions, 'windowsPathsNoEscape' | 'magicalBraces'> = {},\n) => {\n // don't need to escape +@! because we escape the parens\n // that make those magic, and escaping ! as [!] isn't valid,\n // because [!]] is a valid glob class meaning not ']'.\n if (magicalBraces) {\n return windowsPathsNoEscape ?\n s.replace(/[?*()[\\]{}]/g, '[$&]')\n : s.replace(/[?*()[\\]\\\\{}]/g, '\\\\$&')\n }\n return windowsPathsNoEscape ?\n s.replace(/[?*()[\\]]/g, '[$&]')\n : s.replace(/[?*()[\\]\\\\]/g, '\\\\$&')\n}\n"]}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
flow: Parser;
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
export { B as BaseCoverageProvider } from './chunks/coverage.DM_a_rWm.js';
|
||||
import 'node:fs';
|
||||
import 'node:module';
|
||||
import 'node:path';
|
||||
import 'node:url';
|
||||
import '@vitest/utils/helpers';
|
||||
import 'pathe';
|
||||
import 'picomatch';
|
||||
import 'tinyglobby';
|
||||
import 'tinyrainbow';
|
||||
import './chunks/defaults.9aQKnqFk.js';
|
||||
import 'node:os';
|
||||
import './chunks/env.D4Lgay0q.js';
|
||||
import 'std-env';
|
||||
import 'node:crypto';
|
||||
import './chunks/index.BCY_7LL2.js';
|
||||
import 'node:process';
|
||||
import 'node:fs/promises';
|
||||
import 'node:assert';
|
||||
import 'node:v8';
|
||||
import 'node:util';
|
||||
import 'vite';
|
||||
import './chunks/constants.CPYnjOGj.js';
|
||||
import './chunks/utils.BS4fH3nR.js';
|
||||
import './chunks/coverage.CTzCuANN.js';
|
||||
|
||||
console.warn("Importing from \"vitest/coverage\" is deprecated since Vitest 4.1. Please use \"vitest/node\" instead.");
|
||||
Reference in New Issue
Block a user