mirror of
https://github.com/Swatinem/rust-cache
synced 2025-12-27 07:17:05 +00:00
Remove a few synchronous FS interactions
This commit is contained in:
parent
42c55942cf
commit
230365fb7a
3 changed files with 41 additions and 19 deletions
18
dist/save/index.js
vendored
18
dist/save/index.js
vendored
|
|
@ -149506,6 +149506,8 @@ var external_crypto_default = /*#__PURE__*/__nccwpck_require__.n(external_crypto
|
|||
// EXTERNAL MODULE: external "fs/promises"
|
||||
var promises_ = __nccwpck_require__(91943);
|
||||
var promises_default = /*#__PURE__*/__nccwpck_require__.n(promises_);
|
||||
;// CONCATENATED MODULE: external "stream/promises"
|
||||
const external_stream_promises_namespaceObject = require("stream/promises");
|
||||
// EXTERNAL MODULE: external "os"
|
||||
var external_os_ = __nccwpck_require__(70857);
|
||||
var external_os_default = /*#__PURE__*/__nccwpck_require__.n(external_os_);
|
||||
|
|
@ -150783,6 +150785,7 @@ class Workspace {
|
|||
|
||||
|
||||
|
||||
|
||||
const HOME = external_os_default().homedir();
|
||||
const CARGO_HOME = process.env.CARGO_HOME || external_path_default().join(HOME, ".cargo");
|
||||
const STATE_CONFIG = "RUST_CACHE_CONFIG";
|
||||
|
|
@ -150980,9 +150983,7 @@ class CacheConfig {
|
|||
}
|
||||
keyFiles = sort_and_uniq(keyFiles);
|
||||
for (const file of keyFiles) {
|
||||
for await (const chunk of external_fs_default().createReadStream(file)) {
|
||||
hasher.update(chunk);
|
||||
}
|
||||
await (0,external_stream_promises_namespaceObject.pipeline)((0,external_fs_.createReadStream)(file), hasher);
|
||||
}
|
||||
keyFiles.push(...parsedKeyFiles);
|
||||
self.keyFiles = sort_and_uniq(keyFiles);
|
||||
|
|
@ -151099,10 +151100,17 @@ async function globFiles(pattern) {
|
|||
const globber = await glob.create(pattern, {
|
||||
followSymbolicLinks: false,
|
||||
});
|
||||
// fs.statSync resolve the symbolic link and returns stat for the
|
||||
// fs.stat resolve the symbolic link and returns stat for the
|
||||
// file it pointed to, so isFile would make sure the resolved
|
||||
// file is actually a regular file.
|
||||
return (await globber.glob()).filter((file) => external_fs_default().statSync(file).isFile());
|
||||
const files = [];
|
||||
for (const file of await globber.glob()) {
|
||||
const stats = await promises_default().stat(file);
|
||||
if (stats.isFile()) {
|
||||
files.push(file);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
function sort_and_uniq(a) {
|
||||
return a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue