PATH: //opt/alt/alt-nodejs16/root/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
📄 add-rm-pkg-deps.js
↓
X
📁 arborist/
X
📄 audit-report.js
↓
X
📄 calc-dep-flags.js
↓
X
📄 can-place-dep.js
↓
X
📄 case-insensitive-map.js
↓
X
📄 consistent-resolve.js
↓
X
📄 debug.js
↓
X
📄 deepest-nesting-target.js
↓
X
📄 dep-valid.js
↓
X
📄 diff.js
↓
X
📄 edge.js
↓
X
📄 from-path.js
↓
X
📄 gather-dep-set.js
↓
X
📄 get-workspace-nodes.js
↓
X
📄 index.js
↓
X
📄 inventory.js
↓
X
📄 link.js
↓
X
📄 node.js
↓
X
📄 optional-set.js
↓
X
📄 override-resolves.js
↓
X
📄 override-set.js
↓
X
📄 peer-entry-sets.js
↓
X
📄 place-dep.js
↓
X
📄 printable.js
↓
X
📄 query-selector-all.js
↓
X
📄 realpath.js
↓
X
📄 relpath.js
↓
X
📄 reset-dep-flags.js
↓
X
📄 retire-path.js
↓
X
📄 shrinkwrap.js
↓
X
📄 signal-handling.js
↓
X
📄 signals.js
↓
X
📄 spec-from-lock.js
↓
X
📄 tracker.js
↓
X
📄 tree-check.js
↓
X
📄 version-from-tgz.js
↓
X
📄 vuln.js
↓
X
📄 yarn-lock.js
↓
X
SAVING...
BERHASIL DIUBAH!
EDITING: inventory.js
// a class to manage an inventory and set of indexes of // a set of objects based on specific fields. // primary is the primary index key. // keys is the set of fields to be able to query. const _primaryKey = Symbol('_primaryKey') const _index = Symbol('_index') const defaultKeys = ['name', 'license', 'funding', 'realpath', 'packageName'] const { hasOwnProperty } = Object.prototype const debug = require('./debug.js') // handling for the outdated "licenses" array, just pick the first one // also support the alternative spelling "licence" const getLicense = pkg => { if (pkg) { const lic = pkg.license || pkg.licence if (lic) { return lic } const lics = pkg.licenses || pkg.licences if (Array.isArray(lics)) { return lics[0] } } } class Inventory extends Map { constructor (opt = {}) { const { primary, keys } = opt super() this[_primaryKey] = primary || 'location' this[_index] = (keys || defaultKeys).reduce((index, i) => { index.set(i, new Map()) return index }, new Map()) } get primaryKey () { return this[_primaryKey] } get indexes () { return [...this[_index].keys()] } * filter (fn) { for (const node of this.values()) { if (fn(node)) { yield node } } } add (node) { const root = super.get('') if (root && node.root !== root && node.root !== root.root) { debug(() => { throw Object.assign(new Error('adding external node to inventory'), { root: root.path, node: node.path, nodeRoot: node.root.path, }) }) return } const current = super.get(node[this.primaryKey]) if (current) { if (current === node) { return } this.delete(current) } super.set(node[this.primaryKey], node) for (const [key, map] of this[_index].entries()) { // if the node has the value, but it's false, then use that const val_ = hasOwnProperty.call(node, key) ? node[key] : key === 'license' ? getLicense(node.package) : node[key] ? node[key] : node.package && node.package[key] const val = typeof val_ === 'string' ? val_ : !val_ || typeof val_ !== 'object' ? val_ : key === 'license' ? val_.type : key === 'funding' ? val_.url : /* istanbul ignore next - not used */ val_ const set = map.get(val) || new Set() set.add(node) map.set(val, set) } } delete (node) { if (!this.has(node)) { return } super.delete(node[this.primaryKey]) for (const [key, map] of this[_index].entries()) { const val = node[key] !== undefined ? node[key] : (node[key] || (node.package && node.package[key])) const set = map.get(val) if (set) { set.delete(node) if (set.size === 0) { map.delete(node[key]) } } } } query (key, val) { const map = this[_index].get(key) return map && (arguments.length === 2 ? map.get(val) : map.keys()) || new Set() } has (node) { return super.get(node[this.primaryKey]) === node } set (k, v) { throw new Error('direct set() not supported, use inventory.add(node)') } } module.exports = Inventory
SIMPAN PERUBAHAN