* Creates an instance of FileSystemInfo. * @param {InputFileSystem} fs file system * @param {object} options options * @param {Iterable<string | RegExp>=} options.unmanagedPaths paths that are not managed by a package manager and the contents are subject to change * @param {Iterable<string |
(
fs,
{
unmanagedPaths = [],
managedPaths = [],
immutablePaths = [],
logger,
hashFunction = DEFAULTS.HASH_FUNCTION
} = {}
)
| 1260 | * @param {HashFunction=} options.hashFunction the hash function to use |
| 1261 | */ |
| 1262 | constructor( |
| 1263 | fs, |
| 1264 | { |
| 1265 | unmanagedPaths = [], |
| 1266 | managedPaths = [], |
| 1267 | immutablePaths = [], |
| 1268 | logger, |
| 1269 | hashFunction = DEFAULTS.HASH_FUNCTION |
| 1270 | } = {} |
| 1271 | ) { |
| 1272 | /** @type {InputFileSystem} */ |
| 1273 | this.fs = fs; |
| 1274 | this.logger = logger; |
| 1275 | /** @type {number} */ |
| 1276 | this._remainingLogs = logger ? 40 : 0; |
| 1277 | /** @type {LoggedPaths | undefined} */ |
| 1278 | this._loggedPaths = logger ? new Set() : undefined; |
| 1279 | /** @type {HashFunction} */ |
| 1280 | this._hashFunction = hashFunction; |
| 1281 | /** @type {WeakMap<Snapshot, boolean | CheckSnapshotValidCallback[]>} */ |
| 1282 | this._snapshotCache = new WeakMap(); |
| 1283 | /** @type {SnapshotOptimization<FileSystemInfoEntry | null, false>} */ |
| 1284 | this._fileTimestampsOptimization = new SnapshotOptimization( |
| 1285 | (s) => s.hasFileTimestamps(), |
| 1286 | (s) => s.fileTimestamps, |
| 1287 | (s, v) => s.setFileTimestamps(v) |
| 1288 | ); |
| 1289 | /** @type {SnapshotOptimization<string | null, false>} */ |
| 1290 | this._fileHashesOptimization = new SnapshotOptimization( |
| 1291 | (s) => s.hasFileHashes(), |
| 1292 | (s) => s.fileHashes, |
| 1293 | (s, v) => s.setFileHashes(v), |
| 1294 | false |
| 1295 | ); |
| 1296 | /** @type {SnapshotOptimization<string | TimestampAndHash | null, false>} */ |
| 1297 | this._fileTshsOptimization = new SnapshotOptimization( |
| 1298 | (s) => s.hasFileTshs(), |
| 1299 | (s) => s.fileTshs, |
| 1300 | (s, v) => s.setFileTshs(v) |
| 1301 | ); |
| 1302 | /** @type {SnapshotOptimization<ResolvedContextFileSystemInfoEntry | null, false>} */ |
| 1303 | this._contextTimestampsOptimization = new SnapshotOptimization( |
| 1304 | (s) => s.hasContextTimestamps(), |
| 1305 | (s) => s.contextTimestamps, |
| 1306 | (s, v) => s.setContextTimestamps(v) |
| 1307 | ); |
| 1308 | /** @type {SnapshotOptimization<string | null, false>} */ |
| 1309 | this._contextHashesOptimization = new SnapshotOptimization( |
| 1310 | (s) => s.hasContextHashes(), |
| 1311 | (s) => s.contextHashes, |
| 1312 | (s, v) => s.setContextHashes(v), |
| 1313 | false |
| 1314 | ); |
| 1315 | /** @type {SnapshotOptimization<ResolvedContextTimestampAndHash | null, false>} */ |
| 1316 | this._contextTshsOptimization = new SnapshotOptimization( |
| 1317 | (s) => s.hasContextTshs(), |
| 1318 | (s) => s.contextTshs, |
| 1319 | (s, v) => s.setContextTshs(v) |
nothing calls this directly
no test coverage detected