Use built in uuid

This commit is contained in:
Matt Godbolt
2023-07-23 13:26:05 -05:00
parent 5416d80eef
commit 66da2054f6
3 changed files with 5 additions and 66 deletions
+2 -2
View File
@@ -26,12 +26,12 @@ import path from 'path';
import fs from 'fs-extra';
import {LRUCache} from 'lru-cache';
import crypto from 'crypto';
import type {GetResult} from '../../types/cache.interfaces.js';
import {logger} from '../logger.js';
import {BaseCache} from './base.js';
import {v4 as uuidv4} from 'uuid';
// With thanks to https://gist.github.com/kethinov/6658166
function getAllFiles(root: string, dir?: string) {
@@ -113,7 +113,7 @@ export class OnDiskCache extends BaseCache {
size: value.length,
};
// Write to a temp file and then rename
const tempFile = info.path + `.tmp.${uuidv4()}`;
const tempFile = info.path + `.tmp.${crypto.randomUUID()}`;
await fs.writeFile(tempFile, value);
await fs.rename(tempFile, info.path);
this.cache.set(key, info);
+3 -63
View File
@@ -74,7 +74,6 @@
"tslib": "^2.3.1",
"underscore": "^1.13.2",
"url-join": "^5.0.0",
"uuid": "^9.0.0",
"whatwg-fetch": "^3.6.2",
"which": "^3.0.0",
"winston": "^3.3.3",
@@ -384,14 +383,6 @@
"node": ">=14.0.0"
}
},
"node_modules/@aws-sdk/client-dynamodb/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/@aws-sdk/client-ec2": {
"version": "3.370.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-ec2/-/client-ec2-3.370.0.tgz",
@@ -442,14 +433,6 @@
"node": ">=14.0.0"
}
},
"node_modules/@aws-sdk/client-ec2/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/@aws-sdk/client-s3": {
"version": "3.370.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.370.0.tgz",
@@ -562,14 +545,6 @@
"node": ">=14.0.0"
}
},
"node_modules/@aws-sdk/client-ssm/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/@aws-sdk/client-sso": {
"version": "3.370.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.370.0.tgz",
@@ -2069,15 +2044,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/@cypress/request/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==",
"dev": true,
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/@cypress/xvfb": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@cypress/xvfb/-/xvfb-1.2.4.tgz",
@@ -3904,14 +3870,6 @@
"node": ">=14.0.0"
}
},
"node_modules/@smithy/middleware-retry/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/@smithy/middleware-serde": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-1.0.2.tgz",
@@ -17869,15 +17827,6 @@
"websocket-driver": "^0.7.4"
}
},
"node_modules/sockjs/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==",
"dev": true,
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/sort-any": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/sort-any/-/sort-any-2.0.0.tgz",
@@ -18581,15 +18530,6 @@
"node": ">=10"
}
},
"node_modules/teeny-request/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==",
"dev": true,
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/temp": {
"version": "0.9.4",
"resolved": "https://registry.npmjs.org/temp/-/temp-0.9.4.tgz",
@@ -19468,9 +19408,9 @@
}
},
"node_modules/uuid": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
"integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==",
"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"
}
-1
View File
@@ -83,7 +83,6 @@
"tslib": "^2.3.1",
"underscore": "^1.13.2",
"url-join": "^5.0.0",
"uuid": "^9.0.0",
"whatwg-fetch": "^3.6.2",
"which": "^3.0.0",
"winston": "^3.3.3",