PATH: //opt/alt/alt-nodejs16/root/usr/lib/node_modules/npm/lib/commands
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
📄 access.js
↓
X
📄 adduser.js
↓
X
📄 audit.js
↓
X
📄 bin.js
↓
X
📄 birthday.js
↓
X
📄 bugs.js
↓
X
📄 cache.js
↓
X
📄 ci.js
↓
X
📄 completion.js
↓
X
📄 config.js
↓
X
📄 dedupe.js
↓
X
📄 deprecate.js
↓
X
📄 diff.js
↓
X
📄 dist-tag.js
↓
X
📄 docs.js
↓
X
📄 doctor.js
↓
X
📄 edit.js
↓
X
📄 exec.js
↓
X
📄 explain.js
↓
X
📄 explore.js
↓
X
📄 find-dupes.js
↓
X
📄 fund.js
↓
X
📄 get.js
↓
X
📄 help-search.js
↓
X
📄 help.js
↓
X
📄 hook.js
↓
X
📄 init.js
↓
X
📄 install-ci-test.js
↓
X
📄 install-test.js
↓
X
📄 install.js
↓
X
📄 link.js
↓
X
📄 ll.js
↓
X
📄 logout.js
↓
X
📄 ls.js
↓
X
📄 org.js
↓
X
📄 outdated.js
↓
X
📄 owner.js
↓
X
📄 pack.js
↓
X
📄 ping.js
↓
X
📄 pkg.js
↓
X
📄 prefix.js
↓
X
📄 profile.js
↓
X
📄 prune.js
↓
X
📄 publish.js
↓
X
📄 query.js
↓
X
📄 rebuild.js
↓
X
📄 repo.js
↓
X
📄 restart.js
↓
X
📄 root.js
↓
X
📄 run-script.js
↓
X
📄 search.js
↓
X
📄 set-script.js
↓
X
📄 set.js
↓
X
📄 shrinkwrap.js
↓
X
📄 star.js
↓
X
📄 stars.js
↓
X
📄 start.js
↓
X
📄 stop.js
↓
X
📄 team.js
↓
X
📄 test.js
↓
X
📄 token.js
↓
X
📄 uninstall.js
↓
X
📄 unpublish.js
↓
X
📄 unstar.js
↓
X
📄 update.js
↓
X
📄 version.js
↓
X
📄 view.js
↓
X
📄 whoami.js
↓
X
SAVING...
BERHASIL DIUBAH!
EDITING: search.js
const Minipass = require('minipass') const Pipeline = require('minipass-pipeline') const libSearch = require('libnpmsearch') const log = require('../utils/log-shim.js') const formatSearchStream = require('../utils/format-search-stream.js') function filter (data, include, exclude) { const words = [data.name] .concat(data.maintainers.map(m => `=${m.username}`)) .concat(data.keywords || []) .map(f => f && f.trim && f.trim()) .filter(f => f) .join(' ') .toLowerCase() if (exclude.find(e => match(words, e))) { return false } return true } function match (words, pattern) { if (pattern.startsWith('/')) { if (pattern.endsWith('/')) { pattern = pattern.slice(0, -1) } pattern = new RegExp(pattern.slice(1)) return words.match(pattern) } return words.indexOf(pattern) !== -1 } const BaseCommand = require('../base-command.js') class Search extends BaseCommand { static description = 'Search for packages' static name = 'search' static params = [ 'long', 'json', 'color', 'parseable', 'description', 'searchopts', 'searchexclude', 'registry', 'prefer-online', 'prefer-offline', 'offline', ] static usage = ['[search terms ...]'] static ignoreImplicitWorkspace = true async exec (args) { const opts = { ...this.npm.flatOptions, ...this.npm.flatOptions.search, include: args.map(s => s.toLowerCase()).filter(s => s), exclude: this.npm.flatOptions.search.exclude.split(/\s+/), } if (opts.include.length === 0) { throw new Error('search must be called with arguments') } // Used later to figure out whether we had any packages go out let anyOutput = false class FilterStream extends Minipass { write (pkg) { if (filter(pkg, opts.include, opts.exclude)) { super.write(pkg) } } } const filterStream = new FilterStream() // Grab a configured output stream that will spit out packages in the // desired format. const outputStream = formatSearchStream({ args, // --searchinclude options are not highlighted ...opts, }) log.silly('search', 'searching packages') const p = new Pipeline( libSearch.stream(opts.include, opts), filterStream, outputStream ) p.on('data', chunk => { if (!anyOutput) { anyOutput = true } this.npm.output(chunk.toString('utf8')) }) await p.promise() if (!anyOutput && !this.npm.config.get('json') && !this.npm.config.get('parseable')) { this.npm.output('No matches found for ' + (args.map(JSON.stringify).join(' '))) } log.silly('search', 'search completed') log.clearProgress() } } module.exports = Search
SIMPAN PERUBAHAN