Comparing version 2.1.4-next.0a73f20.0 to 2.1.4-next.0b1898a.0
@@ -178,2 +178,2 @@ /// <reference lib="dom" /> | ||
export { BigIntegers, BinaryPrimitives, BinaryTokens, Deserializer, DeserializerError, DeserializerReason, Numbers, OnUnsupported, RegExps, Serializer, SerializerError, SerializerReason, TypedArray, TypedArrays, deserialize, deserializeWithMetadata, serialize }; | ||
export { BigIntegers, BinaryPrimitives, BinaryTokens, Deserializer, DeserializerError, DeserializerReason, Numbers, type OnUnsupported, RegExps, Serializer, SerializerError, SerializerReason, TypedArray, TypedArrays, deserialize, deserializeWithMetadata, serialize }; |
@@ -44,3 +44,3 @@ "use strict"; | ||
// src/lib/errors/DeserializerError.ts | ||
var DeserializerError = class extends Error { | ||
var _DeserializerError = class _DeserializerError extends Error { | ||
constructor(message, kind) { | ||
@@ -51,3 +51,4 @@ super(message); | ||
}; | ||
__name(DeserializerError, "DeserializerError"); | ||
__name(_DeserializerError, "DeserializerError"); | ||
var DeserializerError = _DeserializerError; | ||
var DeserializerReason = /* @__PURE__ */ ((DeserializerReason2) => { | ||
@@ -131,14 +132,8 @@ DeserializerReason2["UnknownType"] = "UnknownType"; | ||
let ret = ""; | ||
if (integer & g) | ||
ret += "g"; | ||
if (integer & i) | ||
ret += "i"; | ||
if (integer & m) | ||
ret += "m"; | ||
if (integer & y) | ||
ret += "y"; | ||
if (integer & u) | ||
ret += "u"; | ||
if (integer & s) | ||
ret += "s"; | ||
if (integer & g) ret += "g"; | ||
if (integer & i) ret += "i"; | ||
if (integer & m) ret += "m"; | ||
if (integer & y) ret += "y"; | ||
if (integer & u) ret += "u"; | ||
if (integer & s) ret += "s"; | ||
return ret; | ||
@@ -179,6 +174,4 @@ } | ||
]; | ||
if (typeof BigInt64Array === "function") | ||
TypedArrays2.constructors.push(BigInt64Array); | ||
if (typeof BigUint64Array === "function") | ||
TypedArrays2.constructors.push(BigUint64Array); | ||
if (typeof BigInt64Array === "function") TypedArrays2.constructors.push(BigInt64Array); | ||
if (typeof BigUint64Array === "function") TypedArrays2.constructors.push(BigUint64Array); | ||
TypedArrays2.typedArrayTags = new Map( | ||
@@ -205,3 +198,3 @@ TypedArrays2.constructors.map( | ||
var uInt8Float64Array = new Uint8Array(float64Array.buffer); | ||
var _Deserializer = class { | ||
var _Deserializer = class _Deserializer { | ||
constructor(buffer) { | ||
@@ -421,8 +414,8 @@ this.offset = 0; | ||
}; | ||
__name(_Deserializer, "Deserializer"); | ||
_Deserializer._textDecoder = new TextDecoder(); | ||
var Deserializer = _Deserializer; | ||
__name(Deserializer, "Deserializer"); | ||
Deserializer._textDecoder = new TextDecoder(); | ||
// src/lib/errors/SerializerError.ts | ||
var SerializerError = class extends Error { | ||
var _SerializerError = class _SerializerError extends Error { | ||
constructor(message, kind) { | ||
@@ -433,3 +426,4 @@ super(message); | ||
}; | ||
__name(SerializerError, "SerializerError"); | ||
__name(_SerializerError, "SerializerError"); | ||
var SerializerError = _SerializerError; | ||
var SerializerReason = /* @__PURE__ */ ((SerializerReason2) => { | ||
@@ -449,3 +443,3 @@ SerializerReason2["UnsupportedType"] = "UnsupportedType"; | ||
var uInt8Float64Array2 = new Uint8Array(float64Array2.buffer); | ||
var _Serializer = class { | ||
var _Serializer = class _Serializer { | ||
constructor(data, onUnsupported = null) { | ||
@@ -544,10 +538,7 @@ this._buffer = new Uint8Array(16); | ||
parseObject(value) { | ||
if (value === null) | ||
return this.parseValueNull(); | ||
if (value === null) return this.parseValueNull(); | ||
const id = this._objectIDs.get(value); | ||
if (typeof id === "number") | ||
return this.parseValueReference(id); | ||
if (typeof id === "number") return this.parseValueReference(id); | ||
this._objectIDs.set(value, this._objectIDs.size); | ||
if (Array.isArray(value)) | ||
return this.parseValueArray(value); | ||
if (Array.isArray(value)) return this.parseValueArray(value); | ||
const tag = Object.prototype.toString.call(value); | ||
@@ -661,6 +652,4 @@ switch (tag) { | ||
const typedArrayTag = TypedArrays.typedArrayTags.get(tag); | ||
if (typedArrayTag) | ||
this.writeValueTypedArray(value, typedArrayTag); | ||
else | ||
this.parseValueObjectLiteral(value); | ||
if (typedArrayTag) this.writeValueTypedArray(value, typedArrayTag); | ||
else this.parseValueObjectLiteral(value); | ||
} | ||
@@ -732,6 +721,4 @@ parseValueReference(value) { | ||
if (value % 1 === 0) { | ||
if (value >= MIN_INT8 && value <= MAX_INT8) | ||
return sign ? 9 /* SignedByte */ : 8 /* UnsignedByte */; | ||
if (value >= MIN_INT32 && value <= MAX_INT32) | ||
return sign ? 11 /* SignedInt32 */ : 10 /* UnsignedInt32 */; | ||
if (value >= MIN_INT8 && value <= MAX_INT8) return sign ? 9 /* SignedByte */ : 8 /* UnsignedByte */; | ||
if (value >= MIN_INT32 && value <= MAX_INT32) return sign ? 11 /* SignedInt32 */ : 10 /* UnsignedInt32 */; | ||
} | ||
@@ -751,5 +738,5 @@ return sign ? 13 /* SignedFloat64 */ : 12 /* UnsignedFloat64 */; | ||
}; | ||
__name(_Serializer, "Serializer"); | ||
_Serializer._textEncoder = new TextEncoder(); | ||
var Serializer = _Serializer; | ||
__name(Serializer, "Serializer"); | ||
Serializer._textEncoder = new TextEncoder(); | ||
@@ -763,4 +750,3 @@ // src/index.ts | ||
const deserializer = new Deserializer(buffer); | ||
if (offset !== -1) | ||
deserializer.offset = offset; | ||
if (offset !== -1) deserializer.offset = offset; | ||
const value = deserializer.read(); | ||
@@ -773,4 +759,3 @@ deserializer.clean(); | ||
const deserializer = new Deserializer(buffer); | ||
if (offset !== -1) | ||
deserializer.offset = offset; | ||
if (offset !== -1) deserializer.offset = offset; | ||
const value = deserializer.read(); | ||
@@ -777,0 +762,0 @@ const bufferOffset = deserializer.offset; |
@@ -44,3 +44,3 @@ "use strict"; | ||
// src/lib/errors/DeserializerError.ts | ||
var DeserializerError = class extends Error { | ||
var _DeserializerError = class _DeserializerError extends Error { | ||
constructor(message, kind) { | ||
@@ -51,3 +51,4 @@ super(message); | ||
}; | ||
__name(DeserializerError, "DeserializerError"); | ||
__name(_DeserializerError, "DeserializerError"); | ||
var DeserializerError = _DeserializerError; | ||
var DeserializerReason = /* @__PURE__ */ ((DeserializerReason2) => { | ||
@@ -131,14 +132,8 @@ DeserializerReason2["UnknownType"] = "UnknownType"; | ||
let ret = ""; | ||
if (integer & g) | ||
ret += "g"; | ||
if (integer & i) | ||
ret += "i"; | ||
if (integer & m) | ||
ret += "m"; | ||
if (integer & y) | ||
ret += "y"; | ||
if (integer & u) | ||
ret += "u"; | ||
if (integer & s) | ||
ret += "s"; | ||
if (integer & g) ret += "g"; | ||
if (integer & i) ret += "i"; | ||
if (integer & m) ret += "m"; | ||
if (integer & y) ret += "y"; | ||
if (integer & u) ret += "u"; | ||
if (integer & s) ret += "s"; | ||
return ret; | ||
@@ -179,6 +174,4 @@ } | ||
]; | ||
if (typeof BigInt64Array === "function") | ||
TypedArrays2.constructors.push(BigInt64Array); | ||
if (typeof BigUint64Array === "function") | ||
TypedArrays2.constructors.push(BigUint64Array); | ||
if (typeof BigInt64Array === "function") TypedArrays2.constructors.push(BigInt64Array); | ||
if (typeof BigUint64Array === "function") TypedArrays2.constructors.push(BigUint64Array); | ||
TypedArrays2.typedArrayTags = new Map( | ||
@@ -205,3 +198,3 @@ TypedArrays2.constructors.map( | ||
var uInt8Float64Array = new Uint8Array(float64Array.buffer); | ||
var _Deserializer = class { | ||
var _Deserializer = class _Deserializer { | ||
constructor(buffer) { | ||
@@ -421,8 +414,8 @@ this.offset = 0; | ||
}; | ||
__name(_Deserializer, "Deserializer"); | ||
_Deserializer._textDecoder = new TextDecoder(); | ||
var Deserializer = _Deserializer; | ||
__name(Deserializer, "Deserializer"); | ||
Deserializer._textDecoder = new TextDecoder(); | ||
// src/lib/errors/SerializerError.ts | ||
var SerializerError = class extends Error { | ||
var _SerializerError = class _SerializerError extends Error { | ||
constructor(message, kind) { | ||
@@ -433,3 +426,4 @@ super(message); | ||
}; | ||
__name(SerializerError, "SerializerError"); | ||
__name(_SerializerError, "SerializerError"); | ||
var SerializerError = _SerializerError; | ||
var SerializerReason = /* @__PURE__ */ ((SerializerReason2) => { | ||
@@ -449,3 +443,3 @@ SerializerReason2["UnsupportedType"] = "UnsupportedType"; | ||
var uInt8Float64Array2 = new Uint8Array(float64Array2.buffer); | ||
var _Serializer = class { | ||
var _Serializer = class _Serializer { | ||
constructor(data, onUnsupported = null) { | ||
@@ -544,10 +538,7 @@ this._buffer = new Uint8Array(16); | ||
parseObject(value) { | ||
if (value === null) | ||
return this.parseValueNull(); | ||
if (value === null) return this.parseValueNull(); | ||
const id = this._objectIDs.get(value); | ||
if (typeof id === "number") | ||
return this.parseValueReference(id); | ||
if (typeof id === "number") return this.parseValueReference(id); | ||
this._objectIDs.set(value, this._objectIDs.size); | ||
if (Array.isArray(value)) | ||
return this.parseValueArray(value); | ||
if (Array.isArray(value)) return this.parseValueArray(value); | ||
const tag = Object.prototype.toString.call(value); | ||
@@ -661,6 +652,4 @@ switch (tag) { | ||
const typedArrayTag = TypedArrays.typedArrayTags.get(tag); | ||
if (typedArrayTag) | ||
this.writeValueTypedArray(value, typedArrayTag); | ||
else | ||
this.parseValueObjectLiteral(value); | ||
if (typedArrayTag) this.writeValueTypedArray(value, typedArrayTag); | ||
else this.parseValueObjectLiteral(value); | ||
} | ||
@@ -732,6 +721,4 @@ parseValueReference(value) { | ||
if (value % 1 === 0) { | ||
if (value >= MIN_INT8 && value <= MAX_INT8) | ||
return sign ? 9 /* SignedByte */ : 8 /* UnsignedByte */; | ||
if (value >= MIN_INT32 && value <= MAX_INT32) | ||
return sign ? 11 /* SignedInt32 */ : 10 /* UnsignedInt32 */; | ||
if (value >= MIN_INT8 && value <= MAX_INT8) return sign ? 9 /* SignedByte */ : 8 /* UnsignedByte */; | ||
if (value >= MIN_INT32 && value <= MAX_INT32) return sign ? 11 /* SignedInt32 */ : 10 /* UnsignedInt32 */; | ||
} | ||
@@ -751,5 +738,5 @@ return sign ? 13 /* SignedFloat64 */ : 12 /* UnsignedFloat64 */; | ||
}; | ||
__name(_Serializer, "Serializer"); | ||
_Serializer._textEncoder = new TextEncoder(); | ||
var Serializer = _Serializer; | ||
__name(Serializer, "Serializer"); | ||
Serializer._textEncoder = new TextEncoder(); | ||
@@ -763,4 +750,3 @@ // src/index.ts | ||
const deserializer = new Deserializer(buffer); | ||
if (offset !== -1) | ||
deserializer.offset = offset; | ||
if (offset !== -1) deserializer.offset = offset; | ||
const value = deserializer.read(); | ||
@@ -773,4 +759,3 @@ deserializer.clean(); | ||
const deserializer = new Deserializer(buffer); | ||
if (offset !== -1) | ||
deserializer.offset = offset; | ||
if (offset !== -1) deserializer.offset = offset; | ||
const value = deserializer.read(); | ||
@@ -777,0 +762,0 @@ const bufferOffset = deserializer.offset; |
{ | ||
"name": "binarytf", | ||
"version": "2.1.4-next.0a73f20.0", | ||
"version": "2.1.4-next.0b1898a.0", | ||
"description": "Binary Term Format", | ||
@@ -13,5 +13,5 @@ "author": "kyranet <kyradiscord@gmail.com>", | ||
"exports": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
"require": "./dist/index.js" | ||
}, | ||
@@ -23,2 +23,3 @@ "sideEffects": false, | ||
"lint": "eslint --fix src tests --ext ts", | ||
"prettier": "prettier --ignore-path=.prettierignore", | ||
"format": "prettier --write .", | ||
@@ -30,30 +31,25 @@ "test": "vitest run", | ||
"check-update": "cliff-jumper --dry-run", | ||
"_postinstall": "husky install .github/husky", | ||
"prepack": "yarn build && pinst --disable", | ||
"postpack": "pinst --enable" | ||
"prepack": "yarn build" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.6.1", | ||
"@commitlint/config-conventional": "^17.6.1", | ||
"@favware/cliff-jumper": "^2.0.0", | ||
"@sapphire/eslint-config": "^4.4.1", | ||
"@sapphire/prettier-config": "^1.4.5", | ||
"@sapphire/ts-config": "^4.0.0", | ||
"@types/node": "^18.15.13", | ||
"@typescript-eslint/eslint-plugin": "^5.59.0", | ||
"@typescript-eslint/parser": "^5.59.0", | ||
"@vitest/coverage-c8": "^0.30.1", | ||
"@commitlint/cli": "^19.3.0", | ||
"@commitlint/config-conventional": "^19.2.2", | ||
"@favware/cliff-jumper": "^3.0.3", | ||
"@sapphire/eslint-config": "^5.0.5", | ||
"@sapphire/prettier-config": "^2.0.0", | ||
"@sapphire/ts-config": "^5.0.1", | ||
"@types/node": "^20.11.5", | ||
"@typescript-eslint/eslint-plugin": "^7.12.0", | ||
"@typescript-eslint/parser": "^7.12.0", | ||
"@vitest/coverage-v8": "^1.6.0", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.39.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.2.1", | ||
"pinst": "^3.0.0", | ||
"prettier": "^2.8.7", | ||
"pretty-quick": "^3.1.3", | ||
"tsup": "^6.7.0", | ||
"typedoc": "^0.23.28", | ||
"typescript": "^5.0.4", | ||
"vitest": "^0.30.1" | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"lint-staged": "^15.2.5", | ||
"prettier": "^3.3.1", | ||
"tsup": "^8.1.0", | ||
"typedoc": "^0.25.13", | ||
"typescript": "^5.4.5", | ||
"vitest": "^1.6.0" | ||
}, | ||
@@ -88,2 +84,3 @@ "repository": { | ||
"lint-staged": { | ||
"*": "prettier --ignore-unknown --write", | ||
"*.{mjs,js,ts}": "eslint --fix --ext mjs,js,ts" | ||
@@ -104,3 +101,3 @@ }, | ||
"prettier": "@sapphire/prettier-config", | ||
"packageManager": "yarn@3.5.0" | ||
"packageManager": "yarn@4.2.2" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
221692
20
12
2413