MCPcopy
hub / github.com/webpack/webpack / doReadLink

Function doReadLink

lib/util/fs.js:703–714  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

701const lstatReadlinkAbsolute = (fs, p, callback) => {
702 let i = 3;
703 const doReadLink = () => {
704 fs.readlink(p, (err, target) => {
705 if (err && --i > 0) {
706 // It might was just changed from symlink to file
707 // we retry 2 times to catch this case before throwing the error
708 return doStat();
709 }
710 if (err) return callback(err);
711 const value = /** @type {string} */ (target).toString();
712 callback(null, join(fs, dirname(fs, p), value));
713 });
714 };
715 const doStat = () => {
716 if ("lstat" in fs) {
717 return /** @type {NonNullable<InputFileSystem["lstat"]>} */ (fs.lstat)(

Callers 2

doStatFunction · 0.85
lstatReadlinkAbsoluteFunction · 0.85

Calls 5

joinFunction · 0.85
dirnameFunction · 0.85
doStatFunction · 0.70
callbackFunction · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected