Skip to content

Commit

Permalink
Update memoize dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 26, 2023
1 parent e07179b commit 6790d50
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/snapshot-manager.js
Expand Up @@ -9,7 +9,7 @@ import zlib from 'node:zlib';
import cbor from 'cbor';
import concordance from 'concordance';
import indentString from 'indent-string';
import mem from 'mem';
import memoize from 'memoize';
import writeFileAtomic from 'write-file-atomic';

import {snapshotManager as concordanceOptions} from './concordance-options.js';
Expand Down Expand Up @@ -395,7 +395,7 @@ class Manager {
}
}

const resolveSourceFile = mem(file => {
const resolveSourceFile = memoize(file => {
const sourceMap = findSourceMap(file);
// Prior to Node.js 18.8.0, the value when a source map could not be found was `undefined`.
// This changed to `null` in <https://github.com/nodejs/node/pull/43875>. Check both.
Expand All @@ -413,7 +413,7 @@ const resolveSourceFile = mem(file => {
: payload.sources[0];
});

export const determineSnapshotDir = mem(({file, fixedLocation, projectDir}) => {
export const determineSnapshotDir = memoize(({file, fixedLocation, projectDir}) => {
const testDir = path.dirname(resolveSourceFile(file));
if (fixedLocation) {
const relativeTestLocation = path.relative(projectDir, testDir);
Expand Down
31 changes: 30 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -106,7 +106,7 @@
"is-plain-object": "^5.0.0",
"is-promise": "^4.0.0",
"matcher": "^5.0.0",
"mem": "^9.0.2",
"memoize": "^10.0.0",
"ms": "^2.1.3",
"p-map": "^6.0.0",
"package-config": "^5.0.0",
Expand Down

0 comments on commit 6790d50

Please sign in to comment.