diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2088690..c8445bc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -55,7 +55,7 @@ jobs: steps: - name: Ensure steps to avoid vulnerabilities - uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # curl -s https://api.github.com/repos/step-security/harden-runner/commits/v2.14.2 | jq -r .sha + uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # curl -s https://api.github.com/repos/step-security/harden-runner/commits/v2.19.3 | jq -r .sha with: egress-policy: audit @@ -71,7 +71,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Setup NodeJS v${{ env.NODE_VERSION }} - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # curl -s https://api.github.com/repos/actions/setup-node/commits/v6.3.0 | jq -r .sha + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # curl -s https://api.github.com/repos/actions/setup-node/commits/v6.4.0 | jq -r .sha with: node-version: ${{ env.NODE_VERSION }} @@ -116,7 +116,7 @@ jobs: fetch-tags: true # so local checks stay consistent; ls-remote still authoritative - name: Setup NodeJS v${{ env.NODE_VERSION }} - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # curl -s https://api.github.com/repos/actions/setup-node/commits/v6.3.0 | jq -r .sha + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # curl -s https://api.github.com/repos/actions/setup-node/commits/v6.4.0 | jq -r .sha with: node-version: ${{ env.NODE_VERSION }} registry-url: 'https://registry.npmjs.org' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 50f6e10..9d7d7f3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,7 +48,7 @@ jobs: steps: - name: Ensure steps to avoid vulnerabilities - uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # curl -s https://api.github.com/repos/step-security/harden-runner/commits/v2.14.2 | jq -r .sha + uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # curl -s https://api.github.com/repos/step-security/harden-runner/commits/v2.19.3 | jq -r .sha with: egress-policy: audit @@ -63,7 +63,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Setup NodeJS v${{ env.NODE_VERSION }} - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # curl -s https://api.github.com/repos/actions/setup-node/commits/v6.3.0 | jq -r .sha + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # curl -s https://api.github.com/repos/actions/setup-node/commits/v6.4.0 | jq -r .sha with: node-version: ${{ env.NODE_VERSION }} @@ -76,6 +76,9 @@ jobs: - name: Run build run: npm run build + - name: Check node engine + run: npm run check-node-engine + - name: Check requires (used-deps-analyzer) run: npm run check-requires diff --git a/lib/src/SplitFrames.ts b/lib/src/SplitFrames.ts index 47dadf5..bc32ff1 100644 --- a/lib/src/SplitFrames.ts +++ b/lib/src/SplitFrames.ts @@ -168,7 +168,7 @@ export default class SplitFrames extends Transform { KEYS.forEach((key: string): void => { - const size: number = "object" === typeof this._specifics[key] && this._specifics[key] instanceof Buffer ? (this._specifics[key] as Buffer).length : 1; + const size: number = "object" === typeof this._specifics[key] && this._specifics[key] instanceof Buffer ? this._specifics[key].length : 1; for (let foundAt: number = this._searchTags(this._specifics[key]); -1 < foundAt; foundAt = this._searchTags(this._specifics[key])) { @@ -300,7 +300,7 @@ export default class SplitFrames extends Transform { found = true; const size: number = "object" === typeof this._specifics[key] && this._specifics[key] instanceof Buffer - ? (this._specifics[key] as Buffer).length + ? this._specifics[key].length : 1; this.emit(key); @@ -328,7 +328,7 @@ export default class SplitFrames extends Transform { const firstStart: iSearchedBits | undefined = this._searchFirstStart(); - const size: number = "object" === typeof this._specifics[key] && this._specifics[key] instanceof Buffer ? (this._specifics[key] as Buffer).length : 1; + const size: number = "object" === typeof this._specifics[key] && this._specifics[key] instanceof Buffer ? this._specifics[key].length : 1; for ( let foundAt: number = this._searchTags(this._specifics[key]), i = 0; diff --git a/package.json b/package.json index c6f3b4e..b0f4684 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "split-frames", - "version": "2.7.0", + "version": "2.8.0", "description": "Split Buffer frames from streams.", "type": "commonjs", @@ -19,8 +19,6 @@ "scripts": { - "prepare": "npx husky || true", - "lint-back": "npx eslint --config .eslintrc-back.js --ext .ts,.cts,.mts ./lib/src/**/*", "lint-tests": "npx eslint --config .eslintrc-tests.js --ext .js,.cjs,.mjs ./test/**/*", "lint": "npm run lint-back && npm run lint-tests", @@ -31,12 +29,13 @@ "build-back": "npm run clean-back && npx tsc --project ./tsconfig.json", "build": "npm run build-back", + "check-node-engine": "npx check-node-engine", "check-requires": "npx used-deps-analyzer ./package.json ./lib/src --no-dev", "check-updates": "npx check-version-modules --no-fail-at-major --fail-at-minor --fail-at-patch", "unit-tests": "npx mocha", "unit-tests-local": "npx nyc --reporter=html --reporter=text mocha", - "tests": "npm run lint && npm run check-requires && npm run check-updates && npm run build && npm run unit-tests-local" + "tests": "npm run lint && npm run check-node-engine && npm run check-requires && npm run check-updates && npm run build && npm run unit-tests-local" }, @@ -44,29 +43,24 @@ "lib/cjs" ], "engines": { - "node": ">=22.22.0" + "node": ">=22.22.3" }, "dependencies": {}, "devDependencies": { - "@types/node": "25.6.0", - "check-version-modules": "2.3.0", + "@types/node": "25.9.1", + "check-node-engine": "1.0.0", + "check-version-modules": "2.5.0", "colors": "1.4.0", "eslint-plugin-personnallinter": "git+ssh://git@github.com/Psychopoulet/eslint-plugin-personnallinter", "husky": "9.1.7", - "mocha": "11.7.5", + "mocha": "11.7.6", "nyc": "18.0.0", "rimraf": "6.1.3", "typescript": "5.9.3", "used-deps-analyzer": "0.3.0" }, - "husky": { - "hooks": { - "pre-commit": "npm run lint", - "pre-push": "npm run build && npm run unit-tests-local" - } - }, "keywords": [ "frame", "Buffer", @@ -91,6 +85,7 @@ "MSB", "LSB" ], + "author": "Sébastien VIDAL", "contributors": [ {