* Get file timestamp and hash. * @private * @param {string} path path * @param {(err: WebpackError | null, timestampAndHash?: TimestampAndHash | string) => void} callback callback
(path, callback)
| 3711 | * @param {(err: WebpackError | null, timestampAndHash?: TimestampAndHash | string) => void} callback callback |
| 3712 | */ |
| 3713 | _getFileTimestampAndHash(path, callback) { |
| 3714 | /** |
| 3715 | * Continue with hash. |
| 3716 | * @param {string} hash hash |
| 3717 | * @returns {void} |
| 3718 | */ |
| 3719 | const continueWithHash = (hash) => { |
| 3720 | const cache = this._fileTimestamps.get(path); |
| 3721 | if (cache !== undefined) { |
| 3722 | if (cache !== class="st">"ignore") { |
| 3723 | /** @type {TimestampAndHash} */ |
| 3724 | const result = { |
| 3725 | .../** @type {FileSystemInfoEntry} */ (cache), |
| 3726 | hash |
| 3727 | }; |
| 3728 | this._fileTshs.set(path, result); |
| 3729 | return callback(null, result); |
| 3730 | } |
| 3731 | this._fileTshs.set(path, hash); |
| 3732 | return callback(null, hash); |
| 3733 | } |
| 3734 | this.fileTimestampQueue.add(path, (err, entry) => { |
| 3735 | if (err) { |
| 3736 | return callback(err); |
| 3737 | } |
| 3738 | /** @type {TimestampAndHash} */ |
| 3739 | const result = { |
| 3740 | .../** @type {FileSystemInfoEntry} */ (entry), |
| 3741 | hash |
| 3742 | }; |
| 3743 | this._fileTshs.set(path, result); |
| 3744 | return callback(null, result); |
| 3745 | }); |
| 3746 | }; |
| 3747 | |
| 3748 | const cache = this._fileHashes.get(path); |
| 3749 | if (cache !== undefined) { |
| 3750 | continueWithHash(/** @type {string} */ (cache)); |
| 3751 | } else { |
| 3752 | this.fileHashQueue.add(path, (err, entry) => { |
| 3753 | if (err) { |
| 3754 | return callback(err); |
| 3755 | } |
| 3756 | continueWithHash(/** @type {string} */ (entry)); |
| 3757 | }); |
| 3758 | } |
| 3759 | } |
| 3760 | |
| 3761 | /** |
| 3762 | * Processes the provided object. |
no test coverage detected