WIP: bootstrap and partial real Solana watcher implementation
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./CatchClauseDefinition"), exports);
|
||||
__exportStar(require("./ClassNameDefinition"), exports);
|
||||
__exportStar(require("./Definition"), exports);
|
||||
__exportStar(require("./DefinitionType"), exports);
|
||||
__exportStar(require("./FunctionNameDefinition"), exports);
|
||||
__exportStar(require("./ImplicitGlobalVariableDefinition"), exports);
|
||||
__exportStar(require("./ImportBindingDefinition"), exports);
|
||||
__exportStar(require("./ParameterDefinition"), exports);
|
||||
__exportStar(require("./TSEnumMemberDefinition"), exports);
|
||||
__exportStar(require("./TSEnumNameDefinition"), exports);
|
||||
__exportStar(require("./TSModuleNameDefinition"), exports);
|
||||
__exportStar(require("./TypeDefinition"), exports);
|
||||
__exportStar(require("./VariableDefinition"), exports);
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Mathias Buus
|
||||
|
||||
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":"objectFlags.d.ts","sourceRoot":"","sources":["../../src/enums/objectFlags.ts"],"names":[],"mappings":"AACA,eAAO,IAAI,WAAW,EAAE,GAAG,CAAC"}
|
||||
@@ -0,0 +1,452 @@
|
||||
/**
|
||||
* Blake1 legacy hash function, one of SHA3 proposals.
|
||||
* Rarely used. Check out blake2 or blake3 instead.
|
||||
* https://www.aumasson.jp/blake/blake.pdf
|
||||
*
|
||||
* In the best case, there are 0 allocations.
|
||||
*
|
||||
* Differences from blake2:
|
||||
*
|
||||
* - BE instead of LE
|
||||
* - Paddings, similar to MD5, RIPEMD, SHA1, SHA2, but:
|
||||
* - length flag is located before actual length
|
||||
* - padding block is compressed differently (no lengths)
|
||||
* Instead of msg[sigma[k]], we have `msg[sigma[k]] ^ constants[sigma[k-1]]`
|
||||
* (-1 for g1, g2 without -1)
|
||||
* - Salt is XOR-ed into constants instead of state
|
||||
* - Salt is XOR-ed with output in `compress`
|
||||
* - Additional rows (+64 bytes) in SIGMA for new rounds
|
||||
* - Different round count:
|
||||
* - 14 / 10 rounds in blake256 / blake2s
|
||||
* - 16 / 12 rounds in blake512 / blake2b
|
||||
* - blake512: G1b: rotr 24 -> 25, G2b: rotr 63 -> 11
|
||||
* @module
|
||||
*/
|
||||
import { BSIGMA, G1s, G2s } from "./_blake.js";
|
||||
import { setBigUint64, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from "./_md.js";
|
||||
import * as u64 from "./_u64.js";
|
||||
// prettier-ignore
|
||||
import { abytes, aexists, aoutput, clean, createOptHasher, createView, Hash, toBytes, } from "./utils.js";
|
||||
// Empty zero-filled salt
|
||||
const EMPTY_SALT = /* @__PURE__ */ new Uint32Array(8);
|
||||
class BLAKE1 extends Hash {
|
||||
constructor(blockLen, outputLen, lengthFlag, counterLen, saltLen, constants, opts = {}) {
|
||||
super();
|
||||
this.finished = false;
|
||||
this.length = 0;
|
||||
this.pos = 0;
|
||||
this.destroyed = false;
|
||||
const { salt } = opts;
|
||||
this.blockLen = blockLen;
|
||||
this.outputLen = outputLen;
|
||||
this.lengthFlag = lengthFlag;
|
||||
this.counterLen = counterLen;
|
||||
this.buffer = new Uint8Array(blockLen);
|
||||
this.view = createView(this.buffer);
|
||||
if (salt) {
|
||||
let slt = salt;
|
||||
slt = toBytes(slt);
|
||||
abytes(slt);
|
||||
if (slt.length !== 4 * saltLen)
|
||||
throw new Error('wrong salt length');
|
||||
const salt32 = (this.salt = new Uint32Array(saltLen));
|
||||
const sv = createView(slt);
|
||||
this.constants = constants.slice();
|
||||
for (let i = 0, offset = 0; i < salt32.length; i++, offset += 4) {
|
||||
salt32[i] = sv.getUint32(offset, false);
|
||||
this.constants[i] ^= salt32[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.salt = EMPTY_SALT;
|
||||
this.constants = constants;
|
||||
}
|
||||
}
|
||||
update(data) {
|
||||
aexists(this);
|
||||
data = toBytes(data);
|
||||
abytes(data);
|
||||
// From _md, but update length before each compress
|
||||
const { view, buffer, blockLen } = this;
|
||||
const len = data.length;
|
||||
let dataView;
|
||||
for (let pos = 0; pos < len;) {
|
||||
const take = Math.min(blockLen - this.pos, len - pos);
|
||||
// Fast path: we have at least one block in input, cast it to view and process
|
||||
if (take === blockLen) {
|
||||
if (!dataView)
|
||||
dataView = createView(data);
|
||||
for (; blockLen <= len - pos; pos += blockLen) {
|
||||
this.length += blockLen;
|
||||
this.compress(dataView, pos);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
buffer.set(data.subarray(pos, pos + take), this.pos);
|
||||
this.pos += take;
|
||||
pos += take;
|
||||
if (this.pos === blockLen) {
|
||||
this.length += blockLen;
|
||||
this.compress(view, 0, true);
|
||||
this.pos = 0;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
destroy() {
|
||||
this.destroyed = true;
|
||||
if (this.salt !== EMPTY_SALT) {
|
||||
clean(this.salt, this.constants);
|
||||
}
|
||||
}
|
||||
_cloneInto(to) {
|
||||
to || (to = new this.constructor());
|
||||
to.set(...this.get());
|
||||
const { buffer, length, finished, destroyed, constants, salt, pos } = this;
|
||||
to.buffer.set(buffer);
|
||||
to.constants = constants.slice();
|
||||
to.destroyed = destroyed;
|
||||
to.finished = finished;
|
||||
to.length = length;
|
||||
to.pos = pos;
|
||||
to.salt = salt.slice();
|
||||
return to;
|
||||
}
|
||||
clone() {
|
||||
return this._cloneInto();
|
||||
}
|
||||
digestInto(out) {
|
||||
aexists(this);
|
||||
aoutput(out, this);
|
||||
this.finished = true;
|
||||
// Padding
|
||||
const { buffer, blockLen, counterLen, lengthFlag, view } = this;
|
||||
clean(buffer.subarray(this.pos)); // clean buf
|
||||
const counter = BigInt((this.length + this.pos) * 8);
|
||||
const counterPos = blockLen - counterLen - 1;
|
||||
buffer[this.pos] |= 128; // End block flag
|
||||
this.length += this.pos; // add unwritten length
|
||||
// Not enough in buffer for length: write what we have.
|
||||
if (this.pos > counterPos) {
|
||||
this.compress(view, 0);
|
||||
clean(buffer);
|
||||
this.pos = 0;
|
||||
}
|
||||
// Difference with md: here we have lengthFlag!
|
||||
buffer[counterPos] |= lengthFlag; // Length flag
|
||||
// We always set 8 byte length flag. Because length will overflow significantly sooner.
|
||||
setBigUint64(view, blockLen - 8, counter, false);
|
||||
this.compress(view, 0, this.pos !== 0); // don't add length if length is not empty block?
|
||||
// Write output
|
||||
clean(buffer);
|
||||
const v = createView(out);
|
||||
const state = this.get();
|
||||
for (let i = 0; i < this.outputLen / 4; ++i)
|
||||
v.setUint32(i * 4, state[i]);
|
||||
}
|
||||
digest() {
|
||||
const { buffer, outputLen } = this;
|
||||
this.digestInto(buffer);
|
||||
const res = buffer.slice(0, outputLen);
|
||||
this.destroy();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
// Constants
|
||||
const B64C = /* @__PURE__ */ Uint32Array.from([
|
||||
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
|
||||
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
|
||||
0x9216d5d9, 0x8979fb1b, 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96,
|
||||
0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69,
|
||||
]);
|
||||
// first half of C512
|
||||
const B32C = B64C.slice(0, 16);
|
||||
const B256_IV = SHA256_IV.slice();
|
||||
const B224_IV = SHA224_IV.slice();
|
||||
const B384_IV = SHA384_IV.slice();
|
||||
const B512_IV = SHA512_IV.slice();
|
||||
function generateTBL256() {
|
||||
const TBL = [];
|
||||
for (let i = 0, j = 0; i < 14; i++, j += 16) {
|
||||
for (let offset = 1; offset < 16; offset += 2) {
|
||||
TBL.push(B32C[BSIGMA[j + offset]]);
|
||||
TBL.push(B32C[BSIGMA[j + offset - 1]]);
|
||||
}
|
||||
}
|
||||
return new Uint32Array(TBL);
|
||||
}
|
||||
const TBL256 = /* @__PURE__ */ generateTBL256(); // C256[SIGMA[X]] precompute
|
||||
// Reusable temporary buffer
|
||||
const BLAKE256_W = /* @__PURE__ */ new Uint32Array(16);
|
||||
class Blake1_32 extends BLAKE1 {
|
||||
constructor(outputLen, IV, lengthFlag, opts = {}) {
|
||||
super(64, outputLen, lengthFlag, 8, 4, B32C, opts);
|
||||
this.v0 = IV[0] | 0;
|
||||
this.v1 = IV[1] | 0;
|
||||
this.v2 = IV[2] | 0;
|
||||
this.v3 = IV[3] | 0;
|
||||
this.v4 = IV[4] | 0;
|
||||
this.v5 = IV[5] | 0;
|
||||
this.v6 = IV[6] | 0;
|
||||
this.v7 = IV[7] | 0;
|
||||
}
|
||||
get() {
|
||||
const { v0, v1, v2, v3, v4, v5, v6, v7 } = this;
|
||||
return [v0, v1, v2, v3, v4, v5, v6, v7];
|
||||
}
|
||||
// prettier-ignore
|
||||
set(v0, v1, v2, v3, v4, v5, v6, v7) {
|
||||
this.v0 = v0 | 0;
|
||||
this.v1 = v1 | 0;
|
||||
this.v2 = v2 | 0;
|
||||
this.v3 = v3 | 0;
|
||||
this.v4 = v4 | 0;
|
||||
this.v5 = v5 | 0;
|
||||
this.v6 = v6 | 0;
|
||||
this.v7 = v7 | 0;
|
||||
}
|
||||
destroy() {
|
||||
super.destroy();
|
||||
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
compress(view, offset, withLength = true) {
|
||||
for (let i = 0; i < 16; i++, offset += 4)
|
||||
BLAKE256_W[i] = view.getUint32(offset, false);
|
||||
// NOTE: we cannot re-use compress from blake2s, since there is additional xor over u256[SIGMA[e]]
|
||||
let v00 = this.v0 | 0;
|
||||
let v01 = this.v1 | 0;
|
||||
let v02 = this.v2 | 0;
|
||||
let v03 = this.v3 | 0;
|
||||
let v04 = this.v4 | 0;
|
||||
let v05 = this.v5 | 0;
|
||||
let v06 = this.v6 | 0;
|
||||
let v07 = this.v7 | 0;
|
||||
let v08 = this.constants[0] | 0;
|
||||
let v09 = this.constants[1] | 0;
|
||||
let v10 = this.constants[2] | 0;
|
||||
let v11 = this.constants[3] | 0;
|
||||
const { h, l } = u64.fromBig(BigInt(withLength ? this.length * 8 : 0));
|
||||
let v12 = (this.constants[4] ^ l) >>> 0;
|
||||
let v13 = (this.constants[5] ^ l) >>> 0;
|
||||
let v14 = (this.constants[6] ^ h) >>> 0;
|
||||
let v15 = (this.constants[7] ^ h) >>> 0;
|
||||
// prettier-ignore
|
||||
for (let i = 0, k = 0, j = 0; i < 14; i++) {
|
||||
({ a: v00, b: v04, c: v08, d: v12 } = G1s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v00, b: v04, c: v08, d: v12 } = G2s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v01, b: v05, c: v09, d: v13 } = G1s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v01, b: v05, c: v09, d: v13 } = G2s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v02, b: v06, c: v10, d: v14 } = G1s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v02, b: v06, c: v10, d: v14 } = G2s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v03, b: v07, c: v11, d: v15 } = G1s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v03, b: v07, c: v11, d: v15 } = G2s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v00, b: v05, c: v10, d: v15 } = G1s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v00, b: v05, c: v10, d: v15 } = G2s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v01, b: v06, c: v11, d: v12 } = G1s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v01, b: v06, c: v11, d: v12 } = G2s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v02, b: v07, c: v08, d: v13 } = G1s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v02, b: v07, c: v08, d: v13 } = G2s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v03, b: v04, c: v09, d: v14 } = G1s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
({ a: v03, b: v04, c: v09, d: v14 } = G2s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
|
||||
}
|
||||
this.v0 = (this.v0 ^ v00 ^ v08 ^ this.salt[0]) >>> 0;
|
||||
this.v1 = (this.v1 ^ v01 ^ v09 ^ this.salt[1]) >>> 0;
|
||||
this.v2 = (this.v2 ^ v02 ^ v10 ^ this.salt[2]) >>> 0;
|
||||
this.v3 = (this.v3 ^ v03 ^ v11 ^ this.salt[3]) >>> 0;
|
||||
this.v4 = (this.v4 ^ v04 ^ v12 ^ this.salt[0]) >>> 0;
|
||||
this.v5 = (this.v5 ^ v05 ^ v13 ^ this.salt[1]) >>> 0;
|
||||
this.v6 = (this.v6 ^ v06 ^ v14 ^ this.salt[2]) >>> 0;
|
||||
this.v7 = (this.v7 ^ v07 ^ v15 ^ this.salt[3]) >>> 0;
|
||||
clean(BLAKE256_W);
|
||||
}
|
||||
}
|
||||
const BBUF = /* @__PURE__ */ new Uint32Array(32);
|
||||
const BLAKE512_W = /* @__PURE__ */ new Uint32Array(32);
|
||||
function generateTBL512() {
|
||||
const TBL = [];
|
||||
for (let r = 0, k = 0; r < 16; r++, k += 16) {
|
||||
for (let offset = 1; offset < 16; offset += 2) {
|
||||
TBL.push(B64C[BSIGMA[k + offset] * 2 + 0]);
|
||||
TBL.push(B64C[BSIGMA[k + offset] * 2 + 1]);
|
||||
TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 0]);
|
||||
TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 1]);
|
||||
}
|
||||
}
|
||||
return new Uint32Array(TBL);
|
||||
}
|
||||
const TBL512 = /* @__PURE__ */ generateTBL512(); // C512[SIGMA[X]] precompute
|
||||
// Mixing function G splitted in two halfs
|
||||
function G1b(a, b, c, d, msg, k) {
|
||||
const Xpos = 2 * BSIGMA[k];
|
||||
const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore
|
||||
let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore
|
||||
let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore
|
||||
let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore
|
||||
let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore
|
||||
// v[a] = (v[a] + v[b] + x) | 0;
|
||||
let ll = u64.add3L(Al, Bl, Xl);
|
||||
Ah = u64.add3H(ll, Ah, Bh, Xh) >>> 0;
|
||||
Al = (ll | 0) >>> 0;
|
||||
// v[d] = rotr(v[d] ^ v[a], 32)
|
||||
({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
|
||||
({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) });
|
||||
// v[c] = (v[c] + v[d]) | 0;
|
||||
({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
|
||||
// v[b] = rotr(v[b] ^ v[c], 25)
|
||||
({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
|
||||
({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 25), Bl: u64.rotrSL(Bh, Bl, 25) });
|
||||
(BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah);
|
||||
(BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh);
|
||||
(BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch);
|
||||
(BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh);
|
||||
}
|
||||
function G2b(a, b, c, d, msg, k) {
|
||||
const Xpos = 2 * BSIGMA[k];
|
||||
const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore
|
||||
let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore
|
||||
let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore
|
||||
let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore
|
||||
let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore
|
||||
// v[a] = (v[a] + v[b] + x) | 0;
|
||||
let ll = u64.add3L(Al, Bl, Xl);
|
||||
Ah = u64.add3H(ll, Ah, Bh, Xh);
|
||||
Al = ll | 0;
|
||||
// v[d] = rotr(v[d] ^ v[a], 16)
|
||||
({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
|
||||
({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) });
|
||||
// v[c] = (v[c] + v[d]) | 0;
|
||||
({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
|
||||
// v[b] = rotr(v[b] ^ v[c], 11)
|
||||
({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
|
||||
({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 11), Bl: u64.rotrSL(Bh, Bl, 11) });
|
||||
(BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah);
|
||||
(BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh);
|
||||
(BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch);
|
||||
(BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh);
|
||||
}
|
||||
class Blake1_64 extends BLAKE1 {
|
||||
constructor(outputLen, IV, lengthFlag, opts = {}) {
|
||||
super(128, outputLen, lengthFlag, 16, 8, B64C, opts);
|
||||
this.v0l = IV[0] | 0;
|
||||
this.v0h = IV[1] | 0;
|
||||
this.v1l = IV[2] | 0;
|
||||
this.v1h = IV[3] | 0;
|
||||
this.v2l = IV[4] | 0;
|
||||
this.v2h = IV[5] | 0;
|
||||
this.v3l = IV[6] | 0;
|
||||
this.v3h = IV[7] | 0;
|
||||
this.v4l = IV[8] | 0;
|
||||
this.v4h = IV[9] | 0;
|
||||
this.v5l = IV[10] | 0;
|
||||
this.v5h = IV[11] | 0;
|
||||
this.v6l = IV[12] | 0;
|
||||
this.v6h = IV[13] | 0;
|
||||
this.v7l = IV[14] | 0;
|
||||
this.v7h = IV[15] | 0;
|
||||
}
|
||||
// prettier-ignore
|
||||
get() {
|
||||
let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
|
||||
return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
|
||||
}
|
||||
// prettier-ignore
|
||||
set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
|
||||
this.v0l = v0l | 0;
|
||||
this.v0h = v0h | 0;
|
||||
this.v1l = v1l | 0;
|
||||
this.v1h = v1h | 0;
|
||||
this.v2l = v2l | 0;
|
||||
this.v2h = v2h | 0;
|
||||
this.v3l = v3l | 0;
|
||||
this.v3h = v3h | 0;
|
||||
this.v4l = v4l | 0;
|
||||
this.v4h = v4h | 0;
|
||||
this.v5l = v5l | 0;
|
||||
this.v5h = v5h | 0;
|
||||
this.v6l = v6l | 0;
|
||||
this.v6h = v6h | 0;
|
||||
this.v7l = v7l | 0;
|
||||
this.v7h = v7h | 0;
|
||||
}
|
||||
destroy() {
|
||||
super.destroy();
|
||||
this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
compress(view, offset, withLength = true) {
|
||||
for (let i = 0; i < 32; i++, offset += 4)
|
||||
BLAKE512_W[i] = view.getUint32(offset, false);
|
||||
this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state.
|
||||
BBUF.set(this.constants.subarray(0, 16), 16);
|
||||
if (withLength) {
|
||||
const { h, l } = u64.fromBig(BigInt(this.length * 8));
|
||||
BBUF[24] = (BBUF[24] ^ h) >>> 0;
|
||||
BBUF[25] = (BBUF[25] ^ l) >>> 0;
|
||||
BBUF[26] = (BBUF[26] ^ h) >>> 0;
|
||||
BBUF[27] = (BBUF[27] ^ l) >>> 0;
|
||||
}
|
||||
for (let i = 0, k = 0; i < 16; i++) {
|
||||
G1b(0, 4, 8, 12, BLAKE512_W, k++);
|
||||
G2b(0, 4, 8, 12, BLAKE512_W, k++);
|
||||
G1b(1, 5, 9, 13, BLAKE512_W, k++);
|
||||
G2b(1, 5, 9, 13, BLAKE512_W, k++);
|
||||
G1b(2, 6, 10, 14, BLAKE512_W, k++);
|
||||
G2b(2, 6, 10, 14, BLAKE512_W, k++);
|
||||
G1b(3, 7, 11, 15, BLAKE512_W, k++);
|
||||
G2b(3, 7, 11, 15, BLAKE512_W, k++);
|
||||
G1b(0, 5, 10, 15, BLAKE512_W, k++);
|
||||
G2b(0, 5, 10, 15, BLAKE512_W, k++);
|
||||
G1b(1, 6, 11, 12, BLAKE512_W, k++);
|
||||
G2b(1, 6, 11, 12, BLAKE512_W, k++);
|
||||
G1b(2, 7, 8, 13, BLAKE512_W, k++);
|
||||
G2b(2, 7, 8, 13, BLAKE512_W, k++);
|
||||
G1b(3, 4, 9, 14, BLAKE512_W, k++);
|
||||
G2b(3, 4, 9, 14, BLAKE512_W, k++);
|
||||
}
|
||||
this.v0l ^= BBUF[0] ^ BBUF[16] ^ this.salt[0];
|
||||
this.v0h ^= BBUF[1] ^ BBUF[17] ^ this.salt[1];
|
||||
this.v1l ^= BBUF[2] ^ BBUF[18] ^ this.salt[2];
|
||||
this.v1h ^= BBUF[3] ^ BBUF[19] ^ this.salt[3];
|
||||
this.v2l ^= BBUF[4] ^ BBUF[20] ^ this.salt[4];
|
||||
this.v2h ^= BBUF[5] ^ BBUF[21] ^ this.salt[5];
|
||||
this.v3l ^= BBUF[6] ^ BBUF[22] ^ this.salt[6];
|
||||
this.v3h ^= BBUF[7] ^ BBUF[23] ^ this.salt[7];
|
||||
this.v4l ^= BBUF[8] ^ BBUF[24] ^ this.salt[0];
|
||||
this.v4h ^= BBUF[9] ^ BBUF[25] ^ this.salt[1];
|
||||
this.v5l ^= BBUF[10] ^ BBUF[26] ^ this.salt[2];
|
||||
this.v5h ^= BBUF[11] ^ BBUF[27] ^ this.salt[3];
|
||||
this.v6l ^= BBUF[12] ^ BBUF[28] ^ this.salt[4];
|
||||
this.v6h ^= BBUF[13] ^ BBUF[29] ^ this.salt[5];
|
||||
this.v7l ^= BBUF[14] ^ BBUF[30] ^ this.salt[6];
|
||||
this.v7h ^= BBUF[15] ^ BBUF[31] ^ this.salt[7];
|
||||
clean(BBUF, BLAKE512_W);
|
||||
}
|
||||
}
|
||||
export class BLAKE224 extends Blake1_32 {
|
||||
constructor(opts = {}) {
|
||||
super(28, B224_IV, 0, opts);
|
||||
}
|
||||
}
|
||||
export class BLAKE256 extends Blake1_32 {
|
||||
constructor(opts = {}) {
|
||||
super(32, B256_IV, 1, opts);
|
||||
}
|
||||
}
|
||||
export class BLAKE384 extends Blake1_64 {
|
||||
constructor(opts = {}) {
|
||||
super(48, B384_IV, 0, opts);
|
||||
}
|
||||
}
|
||||
export class BLAKE512 extends Blake1_64 {
|
||||
constructor(opts = {}) {
|
||||
super(64, B512_IV, 1, opts);
|
||||
}
|
||||
}
|
||||
/** blake1-224 hash function */
|
||||
export const blake224 = /* @__PURE__ */ createOptHasher((opts) => new BLAKE224(opts));
|
||||
/** blake1-256 hash function */
|
||||
export const blake256 = /* @__PURE__ */ createOptHasher((opts) => new BLAKE256(opts));
|
||||
/** blake1-384 hash function */
|
||||
export const blake384 = /* @__PURE__ */ createOptHasher((opts) => new BLAKE384(opts));
|
||||
/** blake1-512 hash function */
|
||||
export const blake512 = /* @__PURE__ */ createOptHasher((opts) => new BLAKE512(opts));
|
||||
//# sourceMappingURL=blake1.js.map
|
||||
@@ -0,0 +1,42 @@
|
||||
export declare enum ModifierFlags {
|
||||
None = 0,
|
||||
Public = 1,
|
||||
Private = 2,
|
||||
Protected = 4,
|
||||
Readonly = 8,
|
||||
Override = 16,
|
||||
Export = 32,
|
||||
Abstract = 64,
|
||||
Ambient = 128,
|
||||
Static = 256,
|
||||
Accessor = 512,
|
||||
Async = 1024,
|
||||
Default = 2048,
|
||||
Const = 4096,
|
||||
In = 8192,
|
||||
Out = 16384,
|
||||
Decorator = 32768,
|
||||
Deprecated = 65536,
|
||||
JSDocPublic = 8388608,
|
||||
JSDocPrivate = 16777216,
|
||||
JSDocProtected = 33554432,
|
||||
JSDocReadonly = 67108864,
|
||||
JSDocOverride = 134217728,
|
||||
HasComputedJSDocModifiers = 268435456,
|
||||
HasComputedFlags = 536870912,
|
||||
SyntacticOrJSDocModifiers = 31,
|
||||
SyntacticOnlyModifiers = 65504,
|
||||
SyntacticModifiers = 65535,
|
||||
JSDocCacheOnlyModifiers = 260046848,
|
||||
JSDocOnlyModifiers = 65536,
|
||||
NonCacheOnlyModifiers = 131071,
|
||||
AccessibilityModifier = 7,
|
||||
ParameterPropertyModifier = 31,
|
||||
NonPublicAccessibilityModifier = 6,
|
||||
TypeScriptModifier = 28895,
|
||||
ExportDefault = 2080,
|
||||
All = 131071,
|
||||
Modifier = 98303,
|
||||
JavaScript = 3872
|
||||
}
|
||||
//# sourceMappingURL=modifierFlags.enum.d.ts.map
|
||||
@@ -0,0 +1,110 @@
|
||||
{
|
||||
"name": "lightningcss",
|
||||
"version": "1.33.0",
|
||||
"license": "MPL-2.0",
|
||||
"description": "A CSS parser, transformer, and minifier written in Rust",
|
||||
"main": "node/index.js",
|
||||
"types": "node/index.d.ts",
|
||||
"exports": {
|
||||
"types": "./node/index.d.ts",
|
||||
"import": "./node/index.mjs",
|
||||
"require": "./node/index.js"
|
||||
},
|
||||
"browserslist": "last 2 versions, not dead",
|
||||
"targets": {
|
||||
"main": false,
|
||||
"types": false
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/parcel-bundler/lightningcss.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"napi": {
|
||||
"name": "lightningcss"
|
||||
},
|
||||
"files": [
|
||||
"node/*.js",
|
||||
"node/*.mjs",
|
||||
"node/*.d.ts",
|
||||
"node/*.flow"
|
||||
],
|
||||
"dependencies": {
|
||||
"detect-libc": "^2.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/parser": "7.21.4",
|
||||
"@babel/traverse": "7.21.4",
|
||||
"@codemirror/lang-css": "^6.0.1",
|
||||
"@codemirror/lang-javascript": "^6.1.2",
|
||||
"@codemirror/lint": "^6.1.0",
|
||||
"@codemirror/theme-one-dark": "^6.1.0",
|
||||
"@mdn/browser-compat-data": "~8.0.7",
|
||||
"@napi-rs/cli": "^2.14.0",
|
||||
"autoprefixer": "^10.5.4",
|
||||
"caniuse-lite": "^1.0.30001806",
|
||||
"codemirror": "^6.0.1",
|
||||
"cssnano": "^7.0.6",
|
||||
"esbuild": "^0.19.8",
|
||||
"flowgen": "^1.21.0",
|
||||
"jest-diff": "^27.4.2",
|
||||
"json-schema-to-typescript": "^11.0.2",
|
||||
"markdown-it-anchor": "^8.6.6",
|
||||
"markdown-it-prism": "^2.3.0",
|
||||
"markdown-it-table-of-contents": "^0.6.0",
|
||||
"napi-wasm": "^1.0.1",
|
||||
"node-fetch": "^3.1.0",
|
||||
"parcel": "^2.8.2",
|
||||
"patch-package": "^6.5.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"postcss": "^8.3.11",
|
||||
"posthtml-include": "^1.7.4",
|
||||
"posthtml-markdownit": "^1.3.1",
|
||||
"posthtml-prism": "^1.0.4",
|
||||
"process": "^0.11.10",
|
||||
"puppeteer": "^12.0.1",
|
||||
"recast": "^0.22.0",
|
||||
"sharp": "^0.33.5",
|
||||
"typescript": "^5.7.2",
|
||||
"util": "^0.12.4",
|
||||
"uvu": "^0.5.6"
|
||||
},
|
||||
"resolutions": {
|
||||
"lightningcss": "link:."
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "patch-package",
|
||||
"build": "node scripts/build.js && node scripts/build-flow.js",
|
||||
"build-release": "node scripts/build.js --release && node scripts/build-flow.js",
|
||||
"prepublishOnly": "node scripts/build-flow.js",
|
||||
"wasm:build": "cargo build --target wasm32-unknown-unknown -p lightningcss_node && wasm-opt target/wasm32-unknown-unknown/debug/lightningcss_node.wasm --asyncify --pass-arg=asyncify-imports@env.await_promise_sync -Oz -o wasm/lightningcss_node.wasm && node scripts/build-wasm.js",
|
||||
"wasm:build-release": "cargo build --target wasm32-unknown-unknown -p lightningcss_node --release && wasm-opt target/wasm32-unknown-unknown/release/lightningcss_node.wasm --asyncify --pass-arg=asyncify-imports@env.await_promise_sync -Oz -o wasm/lightningcss_node.wasm && node scripts/build-wasm.js",
|
||||
"website:start": "parcel 'website/*.html' website/playground/index.html",
|
||||
"website:build": "yarn wasm:build-release && parcel build 'website/*.html' website/playground/index.html",
|
||||
"build-ast": "cargo run --example schema --features jsonschema && node scripts/build-ast.js",
|
||||
"tsc": "tsc -p node/tsconfig.json",
|
||||
"test": "uvu node/test"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"lightningcss-darwin-x64": "1.33.0",
|
||||
"lightningcss-linux-x64-gnu": "1.33.0",
|
||||
"lightningcss-win32-x64-msvc": "1.33.0",
|
||||
"lightningcss-win32-arm64-msvc": "1.33.0",
|
||||
"lightningcss-darwin-arm64": "1.33.0",
|
||||
"lightningcss-linux-arm64-gnu": "1.33.0",
|
||||
"lightningcss-linux-arm-gnueabihf": "1.33.0",
|
||||
"lightningcss-linux-arm64-musl": "1.33.0",
|
||||
"lightningcss-linux-x64-musl": "1.33.0",
|
||||
"lightningcss-freebsd-x64": "1.33.0",
|
||||
"lightningcss-android-arm64": "1.33.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
import _typeof from "./typeof.js";
|
||||
import checkInRHS from "./checkInRHS.js";
|
||||
import setFunctionName from "./setFunctionName.js";
|
||||
import toPropertyKey from "./toPropertyKey.js";
|
||||
function applyDecs2305(e, t, r, n, o, a) {
|
||||
function i(e, t, r) {
|
||||
return function (n, o) {
|
||||
return r && r(n), e[t].call(n, o);
|
||||
};
|
||||
}
|
||||
function c(e, t) {
|
||||
for (var r = 0; r < e.length; r++) e[r].call(t);
|
||||
return t;
|
||||
}
|
||||
function s(e, t, r, n) {
|
||||
if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined"));
|
||||
return e;
|
||||
}
|
||||
function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) {
|
||||
function m(e) {
|
||||
if (!h(e)) throw new TypeError("Attempted to access private element on non-instance");
|
||||
}
|
||||
var y,
|
||||
v = t[0],
|
||||
g = t[3],
|
||||
b = !u;
|
||||
if (!b) {
|
||||
r || Array.isArray(v) || (v = [v]);
|
||||
var w = {},
|
||||
S = [],
|
||||
A = 3 === o ? "get" : 4 === o || d ? "set" : "value";
|
||||
f ? (p || d ? w = {
|
||||
get: setFunctionName(function () {
|
||||
return g(this);
|
||||
}, n, "get"),
|
||||
set: function set(e) {
|
||||
t[4](this, e);
|
||||
}
|
||||
} : w[A] = g, p || setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n));
|
||||
}
|
||||
for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) {
|
||||
var D = v[j],
|
||||
E = r ? v[j - 1] : void 0,
|
||||
I = {},
|
||||
O = {
|
||||
kind: ["field", "accessor", "method", "getter", "setter", "class"][o],
|
||||
name: n,
|
||||
metadata: a,
|
||||
addInitializer: function (e, t) {
|
||||
if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
|
||||
s(t, "An initializer", "be", !0), c.push(t);
|
||||
}.bind(null, I)
|
||||
};
|
||||
try {
|
||||
if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else {
|
||||
var k, F;
|
||||
O["static"] = l, O["private"] = f, f ? 2 === o ? k = function k(e) {
|
||||
return m(e), w.value;
|
||||
} : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) {
|
||||
return e[n];
|
||||
}, (o < 2 || 4 === o) && (F = function F(e, t) {
|
||||
e[n] = t;
|
||||
}));
|
||||
var N = O.access = {
|
||||
has: f ? h.bind() : function (e) {
|
||||
return n in e;
|
||||
}
|
||||
};
|
||||
if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? {
|
||||
get: w.get,
|
||||
set: w.set
|
||||
} : w[A], O), d) {
|
||||
if ("object" == _typeof(P) && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
||||
} else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P);
|
||||
}
|
||||
} finally {
|
||||
I.v = !0;
|
||||
}
|
||||
}
|
||||
return (p || d) && u.push(function (e, t) {
|
||||
for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t);
|
||||
return t;
|
||||
}), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P;
|
||||
}
|
||||
function u(e, t) {
|
||||
return Object.defineProperty(e, Symbol.metadata || Symbol["for"]("Symbol.metadata"), {
|
||||
configurable: !0,
|
||||
enumerable: !0,
|
||||
value: t
|
||||
});
|
||||
}
|
||||
if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol["for"]("Symbol.metadata")];
|
||||
var f = Object.create(null == l ? null : l),
|
||||
p = function (e, t, r, n) {
|
||||
var o,
|
||||
a,
|
||||
i = [],
|
||||
s = function s(t) {
|
||||
return checkInRHS(t) === e;
|
||||
},
|
||||
u = new Map();
|
||||
function l(e) {
|
||||
e && i.push(c.bind(null, e));
|
||||
}
|
||||
for (var f = 0; f < t.length; f++) {
|
||||
var p = t[f];
|
||||
if (Array.isArray(p)) {
|
||||
var d = p[1],
|
||||
h = p[2],
|
||||
m = p.length > 3,
|
||||
y = 16 & d,
|
||||
v = !!(8 & d),
|
||||
g = 0 == (d &= 7),
|
||||
b = h + "/" + v;
|
||||
if (!g && !m) {
|
||||
var w = u.get(b);
|
||||
if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
|
||||
u.set(b, !(d > 2) || d);
|
||||
}
|
||||
applyDec(v ? e : e.prototype, p, y, m ? "#" + h : toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r);
|
||||
}
|
||||
}
|
||||
return l(o), l(a), i;
|
||||
}(e, t, o, f);
|
||||
return r.length || u(e, f), {
|
||||
e: p,
|
||||
get c() {
|
||||
var t = [];
|
||||
return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)];
|
||||
}
|
||||
};
|
||||
}
|
||||
export { applyDecs2305 as default };
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Parser } from './postcss.js'
|
||||
|
||||
interface Parse extends Parser {
|
||||
default: Parse
|
||||
}
|
||||
|
||||
declare let parse: Parse
|
||||
|
||||
export = parse
|
||||
@@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Checks if a status code is allowed in a close frame.
|
||||
*
|
||||
* @param {Number} code The status code
|
||||
* @return {Boolean} `true` if the status code is valid, else `false`
|
||||
* @public
|
||||
*/
|
||||
function isValidStatusCode(code) {
|
||||
return (
|
||||
(code >= 1000 &&
|
||||
code <= 1014 &&
|
||||
code !== 1004 &&
|
||||
code !== 1005 &&
|
||||
code !== 1006) ||
|
||||
(code >= 3000 && code <= 4999)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given buffer contains only correct UTF-8.
|
||||
* Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by
|
||||
* Markus Kuhn.
|
||||
*
|
||||
* @param {Buffer} buf The buffer to check
|
||||
* @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false`
|
||||
* @public
|
||||
*/
|
||||
function _isValidUTF8(buf) {
|
||||
const len = buf.length;
|
||||
let i = 0;
|
||||
|
||||
while (i < len) {
|
||||
if ((buf[i] & 0x80) === 0) {
|
||||
// 0xxxxxxx
|
||||
i++;
|
||||
} else if ((buf[i] & 0xe0) === 0xc0) {
|
||||
// 110xxxxx 10xxxxxx
|
||||
if (
|
||||
i + 1 === len ||
|
||||
(buf[i + 1] & 0xc0) !== 0x80 ||
|
||||
(buf[i] & 0xfe) === 0xc0 // Overlong
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
i += 2;
|
||||
} else if ((buf[i] & 0xf0) === 0xe0) {
|
||||
// 1110xxxx 10xxxxxx 10xxxxxx
|
||||
if (
|
||||
i + 2 >= len ||
|
||||
(buf[i + 1] & 0xc0) !== 0x80 ||
|
||||
(buf[i + 2] & 0xc0) !== 0x80 ||
|
||||
(buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80) || // Overlong
|
||||
(buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0) // Surrogate (U+D800 - U+DFFF)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
i += 3;
|
||||
} else if ((buf[i] & 0xf8) === 0xf0) {
|
||||
// 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
||||
if (
|
||||
i + 3 >= len ||
|
||||
(buf[i + 1] & 0xc0) !== 0x80 ||
|
||||
(buf[i + 2] & 0xc0) !== 0x80 ||
|
||||
(buf[i + 3] & 0xc0) !== 0x80 ||
|
||||
(buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80) || // Overlong
|
||||
(buf[i] === 0xf4 && buf[i + 1] > 0x8f) ||
|
||||
buf[i] > 0xf4 // > U+10FFFF
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
i += 4;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
let isValidUTF8 = require('utf-8-validate');
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (typeof isValidUTF8 === 'object') {
|
||||
isValidUTF8 = isValidUTF8.Validation.isValidUTF8; // utf-8-validate@<3.0.0
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isValidStatusCode,
|
||||
isValidUTF8(buf) {
|
||||
return buf.length < 150 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
||||
}
|
||||
};
|
||||
} catch (e) /* istanbul ignore next */ {
|
||||
module.exports = {
|
||||
isValidStatusCode,
|
||||
isValidUTF8: _isValidUTF8
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*!
|
||||
* word-wrap <https://github.com/jonschlinkert/word-wrap>
|
||||
*
|
||||
* Copyright (c) 2014-2023, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
function trimEnd(str) {
|
||||
let lastCharPos = str.length - 1;
|
||||
let lastChar = str[lastCharPos];
|
||||
while(lastChar === ' ' || lastChar === '\t') {
|
||||
lastChar = str[--lastCharPos];
|
||||
}
|
||||
return str.substring(0, lastCharPos + 1);
|
||||
}
|
||||
|
||||
function trimTabAndSpaces(str) {
|
||||
const lines = str.split('\n');
|
||||
const trimmedLines = lines.map((line) => trimEnd(line));
|
||||
return trimmedLines.join('\n');
|
||||
}
|
||||
|
||||
module.exports = function(str, options) {
|
||||
options = options || {};
|
||||
if (str == null) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var width = options.width || 50;
|
||||
var indent = (typeof options.indent === 'string')
|
||||
? options.indent
|
||||
: ' ';
|
||||
|
||||
var newline = options.newline || '\n' + indent;
|
||||
var escape = typeof options.escape === 'function'
|
||||
? options.escape
|
||||
: identity;
|
||||
|
||||
var regexString = '.{1,' + width + '}';
|
||||
if (options.cut !== true) {
|
||||
regexString += '([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)';
|
||||
}
|
||||
|
||||
var re = new RegExp(regexString, 'g');
|
||||
var lines = str.match(re) || [];
|
||||
var result = indent + lines.map(function(line) {
|
||||
if (line.slice(-1) === '\n') {
|
||||
line = line.slice(0, line.length - 1);
|
||||
}
|
||||
return escape(line);
|
||||
}).join(newline);
|
||||
|
||||
if (options.trim === true) {
|
||||
result = trimTabAndSpaces(result);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
function identity(str) {
|
||||
return str;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { _ as default } from "../esm/_construct.js";
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"f32.d.ts","sourceRoot":"","sources":["../../src/f32.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa,GAAI,SAAQ,iBAAsB,KAAG,gBAAgB,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,CAM5F,CAAC;AAEP;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa,GAAI,SAAQ,iBAAsB,KAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAMnF,CAAC;AAEP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,WAAW,GAAI,SAAQ,iBAAsB,KAAG,cAAc,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CACxC,CAAC"}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "path-key",
|
||||
"version": "3.1.1",
|
||||
"description": "Get the PATH environment variable key cross-platform",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-key",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"key",
|
||||
"environment",
|
||||
"env",
|
||||
"variable",
|
||||
"var",
|
||||
"get",
|
||||
"cross-platform",
|
||||
"windows"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^11.13.0",
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var acorn = require('./acorn.js');
|
||||
|
||||
function _interopNamespaceDefault(e) {
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () { return e[k]; }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n.default = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var acorn__namespace = /*#__PURE__*/_interopNamespaceDefault(acorn);
|
||||
|
||||
var inputFilePaths = [], forceFileName = false, fileMode = false, silent = false, compact = false, tokenize = false;
|
||||
var options = {};
|
||||
|
||||
function help(status) {
|
||||
var print = (status === 0) ? console.log : console.error;
|
||||
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
|
||||
print(" [--tokenize] [--locations] [--allow-hash-bang] [--allow-await-outside-function] [--compact] [--silent] [--module] [--help] [--] [<infile>...]");
|
||||
process.exit(status);
|
||||
}
|
||||
|
||||
for (var i = 2; i < process.argv.length; ++i) {
|
||||
var arg = process.argv[i];
|
||||
if (arg[0] !== "-" || arg === "-") { inputFilePaths.push(arg); }
|
||||
else if (arg === "--") {
|
||||
inputFilePaths.push.apply(inputFilePaths, process.argv.slice(i + 1));
|
||||
forceFileName = true;
|
||||
break
|
||||
} else if (arg === "--locations") { options.locations = true; }
|
||||
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
|
||||
else if (arg === "--allow-await-outside-function") { options.allowAwaitOutsideFunction = true; }
|
||||
else if (arg === "--silent") { silent = true; }
|
||||
else if (arg === "--compact") { compact = true; }
|
||||
else if (arg === "--help") { help(0); }
|
||||
else if (arg === "--tokenize") { tokenize = true; }
|
||||
else if (arg === "--module") { options.sourceType = "module"; }
|
||||
else {
|
||||
var match = arg.match(/^--ecma(\d+)$/);
|
||||
if (match)
|
||||
{ options.ecmaVersion = +match[1]; }
|
||||
else
|
||||
{ help(1); }
|
||||
}
|
||||
}
|
||||
|
||||
function run(codeList) {
|
||||
var result = [], fileIdx = 0;
|
||||
try {
|
||||
codeList.forEach(function (code, idx) {
|
||||
fileIdx = idx;
|
||||
if (!tokenize) {
|
||||
result = acorn__namespace.parse(code, options);
|
||||
options.program = result;
|
||||
} else {
|
||||
var tokenizer = acorn__namespace.tokenizer(code, options), token;
|
||||
do {
|
||||
token = tokenizer.getToken();
|
||||
result.push(token);
|
||||
} while (token.type !== acorn__namespace.tokTypes.eof)
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(fileMode ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + inputFilePaths[fileIdx] + " " + m.slice(1); }) : e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
if (!silent) { console.log(JSON.stringify(result, function (_, value) { return typeof value === "bigint" ? null : value; }, compact ? null : 2)); }
|
||||
}
|
||||
|
||||
if (fileMode = inputFilePaths.length && (forceFileName || !inputFilePaths.includes("-") || inputFilePaths.length !== 1)) {
|
||||
run(inputFilePaths.map(function (path) { return fs.readFileSync(path, "utf8"); }));
|
||||
} else {
|
||||
var code = "";
|
||||
process.stdin.resume();
|
||||
process.stdin.on("data", function (chunk) { return code += chunk; });
|
||||
process.stdin.on("end", function () { return run([code]); });
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export const version = {
|
||||
major: 4,
|
||||
minor: 4,
|
||||
patch: 3,
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { LibDefinition } from '../variable';
|
||||
export declare const esnext_sharedmemory: LibDefinition;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,111 @@
|
||||
import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq';
|
||||
import { StringWriter, StringReader } from './strings';
|
||||
|
||||
export {
|
||||
decodeOriginalScopes,
|
||||
encodeOriginalScopes,
|
||||
decodeGeneratedRanges,
|
||||
encodeGeneratedRanges,
|
||||
} from './scopes';
|
||||
export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes';
|
||||
|
||||
export type SourceMapSegment =
|
||||
| [number]
|
||||
| [number, number, number, number]
|
||||
| [number, number, number, number, number];
|
||||
export type SourceMapLine = SourceMapSegment[];
|
||||
export type SourceMapMappings = SourceMapLine[];
|
||||
|
||||
export function decode(mappings: string): SourceMapMappings {
|
||||
const { length } = mappings;
|
||||
const reader = new StringReader(mappings);
|
||||
const decoded: SourceMapMappings = [];
|
||||
let genColumn = 0;
|
||||
let sourcesIndex = 0;
|
||||
let sourceLine = 0;
|
||||
let sourceColumn = 0;
|
||||
let namesIndex = 0;
|
||||
|
||||
do {
|
||||
const semi = reader.indexOf(';');
|
||||
const line: SourceMapLine = [];
|
||||
let sorted = true;
|
||||
let lastCol = 0;
|
||||
genColumn = 0;
|
||||
|
||||
while (reader.pos < semi) {
|
||||
let seg: SourceMapSegment;
|
||||
|
||||
genColumn = decodeInteger(reader, genColumn);
|
||||
if (genColumn < lastCol) sorted = false;
|
||||
lastCol = genColumn;
|
||||
|
||||
if (hasMoreVlq(reader, semi)) {
|
||||
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
||||
sourceLine = decodeInteger(reader, sourceLine);
|
||||
sourceColumn = decodeInteger(reader, sourceColumn);
|
||||
|
||||
if (hasMoreVlq(reader, semi)) {
|
||||
namesIndex = decodeInteger(reader, namesIndex);
|
||||
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
||||
} else {
|
||||
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
||||
}
|
||||
} else {
|
||||
seg = [genColumn];
|
||||
}
|
||||
|
||||
line.push(seg);
|
||||
reader.pos++;
|
||||
}
|
||||
|
||||
if (!sorted) sort(line);
|
||||
decoded.push(line);
|
||||
reader.pos = semi + 1;
|
||||
} while (reader.pos <= length);
|
||||
|
||||
return decoded;
|
||||
}
|
||||
|
||||
function sort(line: SourceMapSegment[]) {
|
||||
line.sort(sortComparator);
|
||||
}
|
||||
|
||||
function sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {
|
||||
return a[0] - b[0];
|
||||
}
|
||||
|
||||
export function encode(decoded: SourceMapMappings): string;
|
||||
export function encode(decoded: Readonly<SourceMapMappings>): string;
|
||||
export function encode(decoded: Readonly<SourceMapMappings>): string {
|
||||
const writer = new StringWriter();
|
||||
let sourcesIndex = 0;
|
||||
let sourceLine = 0;
|
||||
let sourceColumn = 0;
|
||||
let namesIndex = 0;
|
||||
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const line = decoded[i];
|
||||
if (i > 0) writer.write(semicolon);
|
||||
if (line.length === 0) continue;
|
||||
|
||||
let genColumn = 0;
|
||||
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const segment = line[j];
|
||||
if (j > 0) writer.write(comma);
|
||||
|
||||
genColumn = encodeInteger(writer, segment[0], genColumn);
|
||||
|
||||
if (segment.length === 1) continue;
|
||||
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
||||
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
||||
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
||||
|
||||
if (segment.length === 4) continue;
|
||||
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return writer.flush();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { TSESLint } from '@typescript-eslint/utils';
|
||||
declare const _default: TSESLint.RuleModule<"bannedClassType", [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
||||
name: string;
|
||||
};
|
||||
export default _default;
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { LibDefinition } from '../variable';
|
||||
export declare const webworker_iterable: LibDefinition;
|
||||
@@ -0,0 +1,5 @@
|
||||
export * from './astUtilities';
|
||||
export * from './PatternMatcher';
|
||||
export * from './predicates';
|
||||
export * from './ReferenceTracker';
|
||||
export * from './scopeAnalysis';
|
||||
@@ -0,0 +1,15 @@
|
||||
"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.esnext_temporal = void 0;
|
||||
const base_config_1 = require("./base-config");
|
||||
const es2015_symbol_wellknown_1 = require("./es2015.symbol.wellknown");
|
||||
const es2020_intl_1 = require("./es2020.intl");
|
||||
const es2025_intl_1 = require("./es2025.intl");
|
||||
exports.esnext_temporal = {
|
||||
libs: [es2015_symbol_wellknown_1.es2015_symbol_wellknown, es2020_intl_1.es2020_intl, es2025_intl_1.es2025_intl],
|
||||
variables: [['Temporal', base_config_1.TYPE_VALUE]],
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/api/path.ts"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGlD;AAgED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAExD;AAaD;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKrE;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKrE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,CAanF;AAqBD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CA4FpG;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAK7H;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,yBAAyB,EAAE,OAAO,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAE3G;AAYD;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,CAKzF;AAkCD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA8C9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAuDzD"}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"scriptKind.js","sourceRoot":"","sources":["../../src/enums/scriptKind.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAI,UAAe,CAAC;AAC3B,CAAC,UAAU,UAAU;IACjB,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;IAClD,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;IACxC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;IAC1C,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;IACxC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;IAC1C,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;IACpD,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;IAC5C,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AACxD,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC,CAAC,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user