Socket
Socket
Sign inDemoInstall

npm-packlist

Package Overview
Dependencies
2
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.4 to 1.1.5

38

index.js

@@ -23,4 +23,2 @@ 'use strict'

'.gitignore',
'/node_modules/**',
'/node_modules/.bin/**',
'**/.git/',

@@ -66,5 +64,6 @@ '**/.svn/',

this.bundled = opt.bundled || []
const bundleRules = this.bundled.map(
dep => '!/node_modules/' + dep + '/**')
const rules = defaultRules.concat(bundleRules).join('\n') + '\n'
this.bundledScopes = Array.from(new Set(
this.bundled.filter(f => /^@/.test(f))
.map(f => f.split('/')[0])))
const rules = defaultRules.join('\n') + '\n'
this.packageJsonCache = opt.packageJsonCache || new Map()

@@ -76,2 +75,30 @@ super.onReadIgnoreFile(rootBuiltinRules, rules, _=>_)

filterEntry (entry, partial) {
// get the partial path from the root of the walk
const p = this.path.substr(this.root.length + 1)
const pkgre = /^node_modules\/(@[^\/]+\/?[^\/]+|[^\/]+)(\/.*)?$/
const pkg = pkgre.test(entry) ? entry.replace(pkgre, '$1') : null
return (
// if we're in a bundled package, check with the parent.
/^node_modules($|\/)/i.test(p) ? this.parent.filterEntry(
this.basename + '/' + entry, partial)
// if package is bundled, all files included
// also include @scope dirs for bundled scoped deps
// they'll be ignored if no files end up in them.
: pkg ? -1 !== this.bundled.indexOf(pkg) ||
-1 !== this.bundledScopes.indexOf(pkg)
// only walk top node_modules if we want to bundle something
: entry === 'node_modules' && !this.parent ? !!this.bundled.length
// always include package.json at the root.
: entry === 'package.json' && !this.parent ? true
// otherwise, follow ignore-walk's logic
: super.filterEntry(entry, partial)
)
}
filterEntries () {

@@ -101,3 +128,2 @@ if (this.ignoreRules['package.json'])

pkg.main ? '!' + pkg.main : '',
'!package.json',
'!@(readme|license|licence|notice|changes|changelog|history){,.*}'

@@ -104,0 +130,0 @@ ].filter(f => f).join('\n') + '\n'

2

package.json
{
"name": "npm-packlist",
"version": "1.1.4",
"version": "1.1.5",
"main": "index.js",

@@ -5,0 +5,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc