diff --git a/cspell.json b/cspell.json index 19cef298e..fdd1e1adb 100644 --- a/cspell.json +++ b/cspell.json @@ -235,7 +235,6 @@ "Sapegin", "sbdchd", "scandir", - "sdbm", "seiyab", "Setext", "setlocal", diff --git a/package.json b/package.json index e48b6e126..28cf78126 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "html-ua-styles": "0.4.0", "ignore": "7.0.5", "import-meta-resolve": "4.2.0", + "imurmurhash-esm": "0.0.2", "index-to-position": "1.2.0", "is-es5-identifier-name": "1.0.1", "jest-docblock": "30.4.0", @@ -119,7 +120,6 @@ "remark-footnotes": "2.0.0", "remark-math": "3.0.1", "remark-parse": "8.0.3", - "sdbm": "3.0.0", "search-closest": "3.0.0", "smol-toml": "1.6.1", "strip-ansi": "7.2.0", diff --git a/src/cli/utilities.js b/src/cli/utilities.js index 61b37cdc3..2f86fd3cb 100644 --- a/src/cli/utilities.js +++ b/src/cli/utilities.js @@ -1,6 +1,6 @@ import fs from "node:fs/promises"; import path from "node:path"; -import sdbm from "sdbm"; +import MurmurHash3 from "imurmurhash-esm"; // @ts-expect-error import { __internal as sharedWithCli } from "../index.js"; @@ -43,11 +43,11 @@ function pick(object, keys) { } /** - * @param {string} source + * @param {string} string * @returns {string} */ -function createHash(source) { - return String(sdbm(source)); +function createHash(string) { + return MurmurHash3(string).result().toString(36); } /** @import {Stats} from "fs" */ diff --git a/yarn.lock b/yarn.lock index b76d5705e..6b4a8e1ad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5389,6 +5389,13 @@ __metadata: languageName: node linkType: hard +"imurmurhash-esm@npm:0.0.2": + version: 0.0.2 + resolution: "imurmurhash-esm@npm:0.0.2" + checksum: 10/5105c36082c13dcf862dec66f2cb679341fe501f70c41b9d6674e6d2bf2eb473fdcb01b1bdd88030e5a0d9162f6686c872800324855be7b1187664d4f549e016 + languageName: node + linkType: hard + "imurmurhash@npm:^0.1.4": version: 0.1.4 resolution: "imurmurhash@npm:0.1.4" @@ -8134,6 +8141,7 @@ __metadata: html-ua-styles: "npm:0.4.0" ignore: "npm:7.0.5" import-meta-resolve: "npm:4.2.0" + imurmurhash-esm: "npm:0.0.2" index-to-position: "npm:1.2.0" is-es5-identifier-name: "npm:1.0.1" jest: "npm:30.4.2" @@ -8190,7 +8198,6 @@ __metadata: remark-math: "npm:3.0.1" remark-parse: "npm:8.0.3" rollup-plugin-license: "npm:3.7.1" - sdbm: "npm:3.0.0" search-closest: "npm:3.0.0" semver: "npm:7.8.4" serialize-javascript: "npm:7.0.5" @@ -8521,13 +8528,6 @@ __metadata: languageName: node linkType: hard -"sdbm@npm:3.0.0": - version: 3.0.0 - resolution: "sdbm@npm:3.0.0" - checksum: 10/77c2e9e04d78f468252a64f571c3763fcde5c200c963cc7ba4b7b51ad44b3905d5775a9c68c172d17b45111a26b4ff96d12168972e856ed0631997e6a21de07f - languageName: node - linkType: hard - "search-closest@npm:3.0.0": version: 3.0.0 resolution: "search-closest@npm:3.0.0"