From e7b3d59facabad5a94a2e25a0e67d88298efcb99 Mon Sep 17 00:00:00 2001 From: Ioannis Karachristos Date: Mon, 12 Oct 2026 21:42:43 +0300 Subject: [PATCH] chore: drop lodash and uuid runtime dependencies (DS-3443) lodash was declared but never imported, and uuid was only used for v4(), which crypto.randomUUID() covers. Removing both clears the runtime Dependabot alerts and takes them out of every consumer's dependency tree. engines.node goes to >=14.17.0, the first version with crypto.randomUUID(). Co-Authored-By: Claude Opus 5.5 --- package-lock.json | 36 +++++------------------------------- package.json | 7 ++----- ts/exchange.ts | 4 ++-- ts/queue.ts | 4 ++-- ts/reply-queue.ts | 4 ++-- 5 files changed, 13 insertions(+), 42 deletions(-) diff --git a/package-lock.json b/package-lock.json index 84de98e..6519220 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,9 +10,7 @@ "license": "MIT", "dependencies": { "amqplib": ">=0.10.0", - "lodash": "^4.17.23", - "race-until": "~2.3.1", - "uuid": "~8.3.2" + "race-until": "~2.3.1" }, "devDependencies": { "@types/amqplib": "^0.10.7", @@ -21,7 +19,6 @@ "@types/should": "^13.0.0", "@types/sinon": "~10.0.2", "@types/source-map-support": "~0.5.4", - "@types/uuid": "~8.3.1", "husky": "~7.0.1", "lint-staged": "~11.1.0", "mocha": "^11.7.5", @@ -35,7 +32,7 @@ "typescript": "4.3.5" }, "engines": { - "node": ">=10.0.0" + "node": ">=14.17.0" } }, "node_modules/@babel/code-frame": { @@ -688,12 +685,6 @@ "source-map": "^0.6.0" } }, - "node_modules/@types/uuid": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz", - "integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==", - "dev": true - }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -1974,6 +1965,7 @@ "version": "4.17.23", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", + "dev": true, "license": "MIT" }, "node_modules/lodash.flattendeep": { @@ -3570,14 +3562,6 @@ "requires-port": "^1.0.0" } }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4281,12 +4265,6 @@ "source-map": "^0.6.0" } }, - "@types/uuid": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz", - "integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==", - "dev": true - }, "aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -5230,7 +5208,8 @@ "lodash": { "version": "4.17.23", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", - "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==" + "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", + "dev": true }, "lodash.flattendeep": { "version": "4.4.0", @@ -6416,11 +6395,6 @@ "requires-port": "^1.0.0" } }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" - }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 1602f6b..054a4b9 100644 --- a/package.json +++ b/package.json @@ -50,13 +50,11 @@ "author": "Nikos Kostoulas ", "license": "MIT", "engines": { - "node": ">=10.0.0" + "node": ">=14.17.0" }, "dependencies": { "amqplib": ">=0.10.0", - "lodash": "^4.17.23", - "race-until": "~2.3.1", - "uuid": "~8.3.2" + "race-until": "~2.3.1" }, "typings": "js/index", "devDependencies": { @@ -66,7 +64,6 @@ "@types/should": "^13.0.0", "@types/sinon": "~10.0.2", "@types/source-map-support": "~0.5.4", - "@types/uuid": "~8.3.1", "husky": "~7.0.1", "lint-staged": "~11.1.0", "mocha": "^11.7.5", diff --git a/ts/exchange.ts b/ts/exchange.ts index 2f72724..3e1339b 100644 --- a/ts/exchange.ts +++ b/ts/exchange.ts @@ -3,7 +3,7 @@ import { Channel } from './channel'; import { raceUntil } from 'race-until'; import { getReply } from './reply-queue'; import { encode } from './encode-decode'; -import * as uuid from 'uuid'; +import { randomUUID } from 'crypto'; import getLogger from './logger'; const logger = getLogger('rabbit-queue'); @@ -14,7 +14,7 @@ export default { publish(channel: Channel, exchange: string, routingKey: string, content: any, properties: amqp.Options.Publish = {}) { return new Promise((resolve, reject) => { - const correlationId = properties.correlationId || uuid.v4(); + const correlationId = properties.correlationId || randomUUID(); const bufferContent = encode(content, properties.contentType); const exchangeHeaders: amqp.Options.Publish = Object.assign({ correlationId }, this.defaultHeaders, properties); logger.debug(`[${correlationId}] -> Publishing to ${exchange} ${routingKey} ${bufferContent.byteLength} bytes`); diff --git a/ts/queue.ts b/ts/queue.ts index 770d672..4a6498f 100644 --- a/ts/queue.ts +++ b/ts/queue.ts @@ -1,4 +1,4 @@ -import * as uuid from 'uuid'; +import { randomUUID } from 'crypto'; import * as amqp from 'amqplib'; import { Channel } from './channel'; import { getReply } from './reply-queue'; @@ -161,7 +161,7 @@ export default class Queue { await queue.created; } return new Promise((resolve, reject) => { - const correlationId = properties.correlationId || uuid.v4(); + const correlationId = properties.correlationId || randomUUID(); properties = Object.assign({ persistent: true, correlationId }, properties); const bufferContent = encode(obj, properties.contentType); diff --git a/ts/reply-queue.ts b/ts/reply-queue.ts index c41c7ee..a85f7a4 100644 --- a/ts/reply-queue.ts +++ b/ts/reply-queue.ts @@ -1,7 +1,7 @@ import { Channel } from './channel'; import * as amqp from 'amqplib'; import * as assert from 'assert'; -import * as uuid from 'uuid'; +import { randomUUID } from 'crypto'; import Queue from './queue'; import { Readable } from 'stream'; import { decode, encode } from './encode-decode'; @@ -29,7 +29,7 @@ export function addHandler(correlationId, handler: (err: Error, body: string) => export function getReply(content: any, properties: amqp.Options.Publish = {}, channel: Channel, cb: Function) { return new Promise((resolve, reject) => { - var correlationId = properties.correlationId || uuid.v4(); + var correlationId = properties.correlationId || randomUUID(); properties = Object.assign( { persistent: false,