04a2a00eca3b0ac076d489b7687429c857619531f4595d41b215f7e905cff9f495176067c196a35afd991143c4ae63a4ab326b7d3af1920507ad88a3e847be 1006 B

123456789101112131415161718192021222324252627282930
  1. // tar -u
  2. import { makeCommand } from './make-command.js';
  3. import { replace as r } from './replace.js';
  4. // just call tar.r with the filter and mtimeCache
  5. export const update = makeCommand(r.syncFile, r.asyncFile, r.syncNoFile, r.asyncNoFile, (opt, entries = []) => {
  6. r.validate?.(opt, entries);
  7. mtimeFilter(opt);
  8. });
  9. const mtimeFilter = (opt) => {
  10. const filter = opt.filter;
  11. if (!opt.mtimeCache) {
  12. opt.mtimeCache = new Map();
  13. }
  14. opt.filter =
  15. filter ?
  16. (path, stat) => filter(path, stat) &&
  17. !(
  18. /* c8 ignore start */
  19. ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >
  20. (stat.mtime ?? 0))
  21. /* c8 ignore stop */
  22. )
  23. : (path, stat) => !(
  24. /* c8 ignore start */
  25. ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >
  26. (stat.mtime ?? 0))
  27. /* c8 ignore stop */
  28. );
  29. };
  30. //# sourceMappingURL=update.js.map