/
usr
/
lib
/
node_modules
/
pnpm
/
dist
/
node_modules
/
tar
/
dist
/
esm
/
/usr/lib/node_modules/pnpm/dist/node_modules/tar/dist/esm
mkdir
upload
Name
Size
Mode
Actions
create.d.ts.map
192
0644
edit
dl
rm
create.js
2163
0644
edit
dl
rm
create.js.map
5329
0644
edit
dl
rm
cwd-error.d.ts.map
283
0644
edit
dl
rm
cwd-error.js
310
0644
edit
dl
rm
cwd-error.js.map
727
0644
edit
dl
rm
extract.d.ts.map
194
0644
edit
dl
rm
extract.js
1692
0644
edit
dl
rm
extract.js.map
3634
0644
edit
dl
rm
get-write-flag.d.ts.map
168
0644
edit
dl
rm
get-write-flag.js
1018
0644
edit
dl
rm
get-write-flag.js.map
1931
0644
edit
dl
rm
header.d.ts.map
1830
0644
edit
dl
rm
header.js
10604
0644
edit
dl
rm
header.js.map
24197
0644
edit
dl
rm
index.d.ts.map
827
0644
edit
dl
rm
index.js
647
0644
edit
dl
rm
index.js.map
1631
0644
edit
dl
rm
large-numbers.d.ts.map
217
0644
edit
dl
rm
large-numbers.js
2581
0644
edit
dl
rm
large-numbers.js.map
5903
0644
edit
dl
rm
list.d.ts.map
287
0644
edit
dl
rm
list.js
3234
0644
edit
dl
rm
list.js.map
7098
0644
edit
dl
rm
make-command.d.ts.map
4407
0644
edit
dl
rm
make-command.js
1870
0644
edit
dl
rm
make-command.js.map
9075
0644
edit
dl
rm
mkdir.d.ts.map
800
0644
edit
dl
rm
mkdir.js
6452
0644
edit
dl
rm
mkdir.js.map
15156
0644
edit
dl
rm
mode-fix.d.ts.map
174
0644
edit
dl
rm
mode-fix.js
753
0644
edit
dl
rm
mode-fix.js.map
1393
0644
edit
dl
rm
normalize-unicode.d.ts.map
173
0644
edit
dl
rm
normalize-unicode.js
489
0644
edit
dl
rm
normalize-unicode.js.map
1004
0644
edit
dl
rm
normalize-windows-path.d.ts.map
184
0644
edit
dl
rm
normalize-windows-path.js
490
0644
edit
dl
rm
normalize-windows-path.js.map
950
0644
edit
dl
rm
options.d.ts.map
5832
0644
edit
dl
rm
options.js
1639
0644
edit
dl
rm
options.js.map
26398
0644
edit
dl
rm
pack.d.ts.map
3795
0644
edit
dl
rm
pack.js
13005
0644
edit
dl
rm
pack.js.map
28182
0644
edit
dl
rm
package.json
23
0644
edit
dl
rm
parse.d.ts.map
3705
0644
edit
dl
rm
parse.js
21741
0644
edit
dl
rm
parse.js.map
40129
0644
edit
dl
rm
path-reservations.d.ts.map
419
0644
edit
dl
rm
path-reservations.js
5461
0644
edit
dl
rm
path-reservations.js.map
10944
0644
edit
dl
rm
pax.d.ts.map
882
0644
edit
dl
rm
pax.js
4754
0644
edit
dl
rm
pax.js.map
10085
0644
edit
dl
rm
read-entry.d.ts.map
1180
0644
edit
dl
rm
read-entry.js
4175
0644
edit
dl
rm
read-entry.js.map
8188
0644
edit
dl
rm
replace.d.ts.map
144
0644
edit
dl
rm
replace.js
7185
0644
edit
dl
rm
replace.js.map
15258
0644
edit
dl
rm
strip-absolute-path.d.ts.map
178
0644
edit
dl
rm
strip-absolute-path.js
1060
0644
edit
dl
rm
strip-absolute-path.js.map
1923
0644
edit
dl
rm
strip-trailing-slashes.d.ts.map
183
0644
edit
dl
rm
strip-trailing-slashes.js
489
0644
edit
dl
rm
strip-trailing-slashes.js.map
1056
0644
edit
dl
rm
symlink-error.d.ts.map
321
0644
edit
dl
rm
symlink-error.js
390
0644
edit
dl
rm
symlink-error.js.map
837
0644
edit
dl
rm
types.d.ts.map
767
0644
edit
dl
rm
types.js
1277
0644
edit
dl
rm
types.js.map
3502
0644
edit
dl
rm
unpack.d.ts.map
3985
0644
edit
dl
rm
unpack.js
32445
0644
edit
dl
rm
unpack.js.map
62081
0644
edit
dl
rm
update.d.ts.map
140
0644
edit
dl
rm
update.js
1006
0644
edit
dl
rm
update.js.map
2324
0644
edit
dl
rm
warn-method.d.ts.map
1111
0644
edit
dl
rm
warn-method.js
795
0644
edit
dl
rm
warn-method.js.map
2593
0644
edit
dl
rm
winchars.d.ts.map
195
0644
edit
dl
rm
winchars.js
549
0644
edit
dl
rm
winchars.js.map
1642
0644
edit
dl
rm
write-entry.d.ts.map
4833
0644
edit
dl
rm
write-entry.js
22781
0644
edit
dl
rm
write-entry.js.map
48386
0644
edit
dl
rm
Edit:
/usr/lib/node_modules/pnpm/dist/node_modules/tar/dist/esm/path-reservations.js
(5461B)
// A path exclusive reservation system // reserve([list, of, paths], fn) // When the fn is first in line for all its paths, it // is called with a cb that clears the reservation. // // Used by async unpack to avoid clobbering paths in use, // while still allowing maximal safe parallelization. import { join } from 'node:path'; import { normalizeUnicode } from './normalize-unicode.js'; import { stripTrailingSlashes } from './strip-trailing-slashes.js'; const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; const isWindows = platform === 'win32'; // return a set of parent dirs for a given path // '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d'] const getDirs = (path) => { const dirs = path .split('/') .slice(0, -1) .reduce((set, path) => { const s = set[set.length - 1]; if (s !== undefined) { path = join(s, path); } set.push(path || '/'); return set; }, []); return dirs; }; export class PathReservations { // path => [function or Set] // A Set object means a directory reservation // A fn is a direct reservation on that path #queues = new Map(); // fn => {paths:[path,...], dirs:[path, ...]} #reservations = new Map(); // functions currently running #running = new Set(); reserve(paths, fn) { paths = isWindows ? ['win32 parallelization disabled'] : paths.map(p => { // don't need normPath, because we skip this entirely for windows return stripTrailingSlashes(join(normalizeUnicode(p))).toLowerCase(); }); const dirs = new Set(paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b))); this.#reservations.set(fn, { dirs, paths }); for (const p of paths) { const q = this.#queues.get(p); if (!q) { this.#queues.set(p, [fn]); } else { q.push(fn); } } for (const dir of dirs) { const q = this.#queues.get(dir); if (!q) { this.#queues.set(dir, [new Set([fn])]); } else { const l = q[q.length - 1]; if (l instanceof Set) { l.add(fn); } else { q.push(new Set([fn])); } } } return this.#run(fn); } // return the queues for each path the function cares about // fn => {paths, dirs} #getQueues(fn) { const res = this.#reservations.get(fn); /* c8 ignore start */ if (!res) { throw new Error('function does not have any path reservations'); } /* c8 ignore stop */ return { paths: res.paths.map((path) => this.#queues.get(path)), dirs: [...res.dirs].map(path => this.#queues.get(path)), }; } // check if fn is first in line for all its paths, and is // included in the first set for all its dir queues check(fn) { const { paths, dirs } = this.#getQueues(fn); return (paths.every(q => q && q[0] === fn) && dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))); } // run the function if it's first in line and not already running #run(fn) { if (this.#running.has(fn) || !this.check(fn)) { return false; } this.#running.add(fn); fn(() => this.#clear(fn)); return true; } #clear(fn) { if (!this.#running.has(fn)) { return false; } const res = this.#reservations.get(fn); /* c8 ignore start */ if (!res) { throw new Error('invalid reservation'); } /* c8 ignore stop */ const { paths, dirs } = res; const next = new Set(); for (const path of paths) { const q = this.#queues.get(path); /* c8 ignore start */ if (!q || q?.[0] !== fn) { continue; } /* c8 ignore stop */ const q0 = q[1]; if (!q0) { this.#queues.delete(path); continue; } q.shift(); if (typeof q0 === 'function') { next.add(q0); } else { for (const f of q0) { next.add(f); } } } for (const dir of dirs) { const q = this.#queues.get(dir); const q0 = q?.[0]; /* c8 ignore next - type safety only */ if (!q || !(q0 instanceof Set)) continue; if (q0.size === 1 && q.length === 1) { this.#queues.delete(dir); continue; } else if (q0.size === 1) { q.shift(); // next one must be a function, // or else the Set would've been reused const n = q[0]; if (typeof n === 'function') { next.add(n); } } else { q0.delete(fn); } } this.#running.delete(fn); next.forEach(fn => this.#run(fn)); return true; } } //# sourceMappingURL=path-reservations.js.map
Save
cmd:
run