From 63a3e5c73b3ea0b83451048fd19b6be18444937a Mon Sep 17 00:00:00 2001 From: Holly Date: Tue, 7 Nov 2023 00:01:33 +0000 Subject: [PATCH] Allow getting of the read offset (needed for mc-beta-server) --- base/ReaderBase.ts | 4 +++ package-lock.json | 83 ++++++++++++++++++++++++++++------------------ package.json | 10 +++--- 3 files changed, 60 insertions(+), 37 deletions(-) diff --git a/base/ReaderBase.ts b/base/ReaderBase.ts index 2c31433..0089b36 100644 --- a/base/ReaderBase.ts +++ b/base/ReaderBase.ts @@ -10,6 +10,10 @@ export class ReaderBase { this.offset = 0; } + public get readOffset() { + return this.offset; + } + public readBuffer(bytes:number) { const value = this.buffer.subarray(this.offset, this.offset + bytes); this.offset += bytes; diff --git a/package-lock.json b/package-lock.json index 10ebc80..d3f5087 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,20 +1,20 @@ { "name": "bufferstuff", - "version": "1.3.4", + "version": "1.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bufferstuff", - "version": "1.3.4", + "version": "1.4.0", "license": "MIT", "devDependencies": { - "check-outdated": "^2.11.0", + "check-outdated": "^2.12.0", "npm-run-all": "^4.1.5", - "terser": "^5.22.0", - "ts-loader": "^9.4.4", + "terser": "^5.24.0", + "ts-loader": "^9.5.0", "ts-node": "^10.9.1", - "typescript": "^5.1.6" + "typescript": "^5.2.2" } }, "node_modules/@cspotcode/source-map-support": { @@ -547,9 +547,9 @@ } }, "node_modules/check-outdated": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/check-outdated/-/check-outdated-2.11.0.tgz", - "integrity": "sha512-YZmbRlpWCi2plPRpKLNPJLeel+86qvHMK1Tt9Dpt/APjtSCDrI9YpMvXr4lGrsx8aH0QJev7VJUyfcfwKQ/CCg==", + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/check-outdated/-/check-outdated-2.12.0.tgz", + "integrity": "sha512-kWThJFiqxAE09XSNJLLD4hWNvLhWdxFLKxOHhxB+XhGlZGyeELXP8V6R/dRrZ5vbjmp9VmoTYe0vp6egftKz7Q==", "dev": true, "bin": { "check-outdated": "check-outdated.js" @@ -2052,9 +2052,9 @@ } }, "node_modules/terser": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.22.0.tgz", - "integrity": "sha512-hHZVLgRA2z4NWcN6aS5rQDc+7Dcy58HOf2zbYwmFcQ+ua3h6eEFf5lIDKTzbWwlazPyOZsFQO8V80/IjVNExEw==", + "version": "5.24.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.24.0.tgz", + "integrity": "sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -2145,15 +2145,16 @@ } }, "node_modules/ts-loader": { - "version": "9.4.4", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.4.tgz", - "integrity": "sha512-MLukxDHBl8OJ5Dk3y69IsKVFRA/6MwzEqBgh+OXMPB/OD01KQuWPFd1WAQP8a5PeSCAxfnkhiuWqfmFJzJQt9w==", + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.0.tgz", + "integrity": "sha512-LLlB/pkB4q9mW2yLdFMnK3dEHbrBjeZTYguaaIfusyojBgAGf5kF+O6KcWqiGzWqHk0LBsoolrp4VftEURhybg==", "dev": true, "dependencies": { "chalk": "^4.1.0", "enhanced-resolve": "^5.0.0", "micromatch": "^4.0.0", - "semver": "^7.3.4" + "semver": "^7.3.4", + "source-map": "^0.7.4" }, "engines": { "node": ">=12.0.0" @@ -2163,6 +2164,15 @@ "webpack": "^5.0.0" } }, + "node_modules/ts-loader/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/ts-node": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", @@ -2221,9 +2231,9 @@ } }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -2886,9 +2896,9 @@ } }, "check-outdated": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/check-outdated/-/check-outdated-2.11.0.tgz", - "integrity": "sha512-YZmbRlpWCi2plPRpKLNPJLeel+86qvHMK1Tt9Dpt/APjtSCDrI9YpMvXr4lGrsx8aH0QJev7VJUyfcfwKQ/CCg==", + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/check-outdated/-/check-outdated-2.12.0.tgz", + "integrity": "sha512-kWThJFiqxAE09XSNJLLD4hWNvLhWdxFLKxOHhxB+XhGlZGyeELXP8V6R/dRrZ5vbjmp9VmoTYe0vp6egftKz7Q==", "dev": true }, "chrome-trace-event": { @@ -4012,9 +4022,9 @@ "dev": true }, "terser": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.22.0.tgz", - "integrity": "sha512-hHZVLgRA2z4NWcN6aS5rQDc+7Dcy58HOf2zbYwmFcQ+ua3h6eEFf5lIDKTzbWwlazPyOZsFQO8V80/IjVNExEw==", + "version": "5.24.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.24.0.tgz", + "integrity": "sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw==", "dev": true, "requires": { "@jridgewell/source-map": "^0.3.3", @@ -4074,15 +4084,24 @@ } }, "ts-loader": { - "version": "9.4.4", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.4.tgz", - "integrity": "sha512-MLukxDHBl8OJ5Dk3y69IsKVFRA/6MwzEqBgh+OXMPB/OD01KQuWPFd1WAQP8a5PeSCAxfnkhiuWqfmFJzJQt9w==", + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.0.tgz", + "integrity": "sha512-LLlB/pkB4q9mW2yLdFMnK3dEHbrBjeZTYguaaIfusyojBgAGf5kF+O6KcWqiGzWqHk0LBsoolrp4VftEURhybg==", "dev": true, "requires": { "chalk": "^4.1.0", "enhanced-resolve": "^5.0.0", "micromatch": "^4.0.0", - "semver": "^7.3.4" + "semver": "^7.3.4", + "source-map": "^0.7.4" + }, + "dependencies": { + "source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true + } } }, "ts-node": { @@ -4118,9 +4137,9 @@ } }, "typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true }, "unbox-primitive": { diff --git a/package.json b/package.json index b009cfc..2f7c6b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bufferstuff", - "version": "1.3.4", + "version": "1.4.0", "description": "A set of utility classes for reading and writing binary data in NodeJS and the browser", "main": "./lib/index.js", "types": "./lib/index.d.ts", @@ -30,11 +30,11 @@ }, "homepage": "https://github.com/tgpholly/bufferStuff#readme", "devDependencies": { - "check-outdated": "^2.11.0", + "check-outdated": "^2.12.0", "npm-run-all": "^4.1.5", - "terser": "^5.22.0", - "ts-loader": "^9.4.4", + "terser": "^5.24.0", + "ts-loader": "^9.5.0", "ts-node": "^10.9.1", - "typescript": "^5.1.6" + "typescript": "^5.2.2" } }