From c0d39273793d09cc9a0c1ca9955afaf77f9f62c6 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Thu, 17 Aug 2023 10:53:11 -0600 Subject: [PATCH] feat(NODE-5399): use mongodb-js/saslprep instead of saslprep (#3818) --- package-lock.json | 19 +++++++++++-------- package.json | 3 +-- src/deps.ts | 15 ++++++++------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc8511c64d..535efa5517 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,6 @@ "@types/kerberos": "^1.1.2", "@types/mocha": "^10.0.1", "@types/node": "^20.1.0", - "@types/saslprep": "^1.0.1", "@types/semver": "^7.5.0", "@types/sinon": "^10.0.14", "@types/sinon-chai": "^3.2.9", @@ -65,7 +64,7 @@ "node": ">=14.20.1" }, "optionalDependencies": { - "saslprep": "^1.0.3" + "@mongodb-js/saslprep": "^1.1.0" }, "peerDependencies": { "@aws-sdk/credential-providers": "^3.201.0", @@ -2015,6 +2014,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/@mongodb-js/saslprep": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.0.tgz", + "integrity": "sha512-Xfijy7HvfzzqiOAhAepF4SGN5e9leLkMvg/OPOF97XemjfVCYN/oWa75wnkc6mltMSTwY+XlbhWgUOJmkFspSw==", + "optional": true, + "dependencies": { + "sparse-bitfield": "^3.0.3" + } + }, "node_modules/@mongodb-js/zstd": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@mongodb-js/zstd/-/zstd-1.1.0.tgz", @@ -2804,12 +2812,6 @@ "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", "dev": true }, - "node_modules/@types/saslprep": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/saslprep/-/saslprep-1.0.1.tgz", - "integrity": "sha512-JHSoEmJi4Gav2Y53dIGdvW2w2tr8iymXWhI/qNiKx9/eSgREsJkn7gJK22ldVXuisQXreSyXqogtzRtT0ls8Lg==", - "dev": true - }, "node_modules/@types/semver": { "version": "7.5.0", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", @@ -7423,6 +7425,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", + "dev": true, "optional": true, "dependencies": { "sparse-bitfield": "^3.0.3" diff --git a/package.json b/package.json index c6de830495..a33e2faf91 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "socks": "^2.7.1" }, "optionalDependencies": { - "saslprep": "^1.0.3" + "@mongodb-js/saslprep": "^1.1.0" }, "peerDependencies": { "@aws-sdk/credential-providers": "^3.201.0", @@ -69,7 +69,6 @@ "@types/kerberos": "^1.1.2", "@types/mocha": "^10.0.1", "@types/node": "^20.1.0", - "@types/saslprep": "^1.0.1", "@types/semver": "^7.5.0", "@types/sinon": "^10.0.14", "@types/sinon-chai": "^3.2.9", diff --git a/src/deps.ts b/src/deps.ts index 88e7096e90..3185b3fe18 100644 --- a/src/deps.ts +++ b/src/deps.ts @@ -126,13 +126,14 @@ export function getSnappy(): SnappyLib | { kModuleError: MongoMissingDependencyE } } -export let saslprep: typeof import('saslprep') | { kModuleError: MongoMissingDependencyError } = - makeErrorModule( - new MongoMissingDependencyError( - 'Optional module `saslprep` not found.' + - ' Please install it to enable Stringprep Profile for User Names and Passwords' - ) - ); +export let saslprep: + | typeof import('@mongodb-js/saslprep') + | { kModuleError: MongoMissingDependencyError } = makeErrorModule( + new MongoMissingDependencyError( + 'Optional module `saslprep` not found.' + + ' Please install it to enable Stringprep Profile for User Names and Passwords' + ) +); try { // Ensure you always wrap an optional require in the try block NODE-3199