Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
update.js33 linesDownload Raw Back to commonjs
1"use strict";
2// tar -u
3Object.defineProperty(exports, "__esModule", { value: true });
4exports.update = void 0;
5const make_command_js_1 = require("./make-command.js");
6const replace_js_1 = require("./replace.js");
7// just call tar.r with the filter and mtimeCache
8exports.update = (0, make_command_js_1.makeCommand)(replace_js_1.replace.syncFile, replace_js_1.replace.asyncFile, replace_js_1.replace.syncNoFile, replace_js_1.replace.asyncNoFile, (opt, entries = []) => {
9    replace_js_1.replace.validate?.(opt, entries);
10    mtimeFilter(opt);
11});
12const mtimeFilter = (opt) => {
13    const filter = opt.filter;
14    if (!opt.mtimeCache) {
15        opt.mtimeCache = new Map();
16    }
17    opt.filter =
18        filter ?
19            (path, stat) => filter(path, stat) &&
20                !(
21                /* c8 ignore start */
22                ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >
23                    (stat.mtime ?? 0))
24                /* c8 ignore stop */
25                )
26            : (path, stat) => !(
27            /* c8 ignore start */
28            ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >
29                (stat.mtime ?? 0))
30            /* c8 ignore stop */
31            );
32};
33//# sourceMappingURL=update.js.map
codekingpro/portable-devtools · Team Ai