/
snap
/
node
/
11691
/
lib
/
node_modules
/
npm
/
node_modules
/
@npmcli
/
arborist
/
lib
/
/snap/node/11691/lib/node_modules/npm/node_modules/@npmcli/arborist/lib
mkdir
upload
Name
Size
Mode
Actions
arborist/
-
0755
rm
add-rm-pkg-deps.js
5008
0644
edit
dl
rm
audit-report.js
12232
0644
edit
dl
rm
calc-dep-flags.js
3506
0644
edit
dl
rm
can-place-dep.js
14273
0644
edit
dl
rm
case-insensitive-map.js
1239
0644
edit
dl
rm
consistent-resolve.js
1296
0644
edit
dl
rm
debug.js
1282
0644
edit
dl
rm
deepest-nesting-target.js
691
0644
edit
dl
rm
dep-valid.js
5125
0644
edit
dl
rm
diff.js
10005
0644
edit
dl
rm
edge.js
6784
0644
edit
dl
rm
from-path.js
1095
0644
edit
dl
rm
gather-dep-set.js
1286
0644
edit
dl
rm
index.js
273
0644
edit
dl
rm
inventory.js
3321
0644
edit
dl
rm
isolated-classes.js
2717
0644
edit
dl
rm
link.js
3114
0644
edit
dl
rm
node.js
44529
0644
edit
dl
rm
optional-set.js
1353
0644
edit
dl
rm
override-resolves.js
225
0644
edit
dl
rm
override-set.js
8567
0644
edit
dl
rm
packument-cache.js
2556
0644
edit
dl
rm
peer-entry-sets.js
2632
0644
edit
dl
rm
place-dep.js
20226
0644
edit
dl
rm
printable.js
5222
0644
edit
dl
rm
query-selector-all.js
29903
0644
edit
dl
rm
realpath.js
2655
0644
edit
dl
rm
relpath.js
136
0644
edit
dl
rm
reset-dep-flags.js
638
0644
edit
dl
rm
retire-path.js
501
0644
edit
dl
rm
shrinkwrap.js
37711
0644
edit
dl
rm
signal-handling.js
2245
0644
edit
dl
rm
signals.js
1381
0644
edit
dl
rm
spec-from-lock.js
874
0644
edit
dl
rm
tracker.js
2991
0644
edit
dl
rm
tree-check.js
4142
0644
edit
dl
rm
version-from-tgz.js
1488
0644
edit
dl
rm
vuln.js
5958
0644
edit
dl
rm
yarn-lock.js
10813
0644
edit
dl
rm
Edit:
/snap/node/11691/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/tracker.js
(2991B)
const proggy = require('proggy') module.exports = cls => class Tracker extends cls { #progress = new Map() #createTracker (key, name) { const tracker = new proggy.Tracker(name ?? key) tracker.on('done', () => this.#progress.delete(key)) this.#progress.set(key, tracker) } addTracker (section, subsection = null, key = null) { if (section === null || section === undefined) { this.#onError(`Tracker can't be null or undefined`) } if (key === null) { key = subsection } const hasTracker = this.#progress.has(section) const hasSubtracker = this.#progress.has(`${section}:${key}`) if (hasTracker && subsection === null) { // 0. existing tracker, no subsection this.#onError(`Tracker "${section}" already exists`) } else if (!hasTracker && subsection === null) { // 1. no existing tracker, no subsection // Create a new progress tracker this.#createTracker(section) } else if (!hasTracker && subsection !== null) { // 2. no parent tracker and subsection this.#onError(`Parent tracker "${section}" does not exist`) } else if (!hasTracker || !hasSubtracker) { // 3. existing parent tracker, no subsection tracker // Create a new subtracker and update parents const parentTracker = this.#progress.get(section) parentTracker.update(parentTracker.value, parentTracker.total + 1) this.#createTracker(`${section}:${key}`, `${section}:${subsection}`) } // 4. existing parent tracker, existing subsection tracker // skip it } finishTracker (section, subsection = null, key = null) { if (section === null || section === undefined) { this.#onError(`Tracker can't be null or undefined`) } if (key === null) { key = subsection } const hasTracker = this.#progress.has(section) const hasSubtracker = this.#progress.has(`${section}:${key}`) // 0. parent tracker exists, no subsection // Finish parent tracker and remove from this.#progress if (hasTracker && subsection === null) { // check if parent tracker does // not have any remaining children const keys = this.#progress.keys() for (const key of keys) { if (key.match(new RegExp(section + ':'))) { this.finishTracker(section, key) } } // remove parent tracker this.#progress.get(section).finish() } else if (!hasTracker && subsection === null) { // 1. no existing parent tracker, no subsection this.#onError(`Tracker "${section}" does not exist`) } else if (!hasTracker || hasSubtracker) { // 2. subtracker exists // Finish subtracker and remove from this.#progress const parentTracker = this.#progress.get(section) parentTracker.update(parentTracker.value + 1) this.#progress.get(`${section}:${key}`).finish() } // 3. existing parent tracker, no subsection } #onError (msg) { throw new Error(msg) } }
Save
cmd:
run