Socket
Socket
Sign inDemoInstall

npm-packlist

Package Overview
Dependencies
4
Maintainers
5
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.0.1 to 8.0.2

42

lib/index.js

@@ -45,16 +45,2 @@ 'use strict'

const allLevels = [
// these are included by default but can be excluded by package.json files array
'!/readme{,.*[^~$]}',
'!/copying{,.*[^~$]}',
'!/license{,.*[^~$]}',
'!/licence{,.*[^~$]}',
]
const rootOnly = [
/^!.*readme/i,
/^!.*copying/i,
/^!.*licen[sc]e/i,
]
const normalizePath = (path) => path.split('\\').join('/')

@@ -145,3 +131,2 @@

...strictDefaults,
...allLevels,
...this.requiredFiles.map((file) => `!${file}`),

@@ -299,4 +284,7 @@ ])

...strictDefaults,
...allLevels,
'!/package.json',
'!/readme{,.*[^~$]}',
'!/copying{,.*[^~$]}',
'!/license{,.*[^~$]}',
'!/licence{,.*[^~$]}',
'/.git',

@@ -316,9 +304,7 @@ '/node_modules',

file = file.slice(1)
} else if (file.endsWith('/*')) {
file = file.slice(0, -1)
}
if (file.endsWith('/*')) {
file += '*'
}
const inverse = `!${file}`
this.excludeNonRoot(file)
try {

@@ -372,16 +358,2 @@ // if an entry in the files array is a specific file, then we need to include it as a

// excludes non root files by checking if elements from the files array in
// package.json contain an ! and readme/license/licence/copying, and then
// removing readme/license/licence/copying accordingly from strict defaults
excludeNonRoot (file) {
// Find the pattern
const matchingPattern = rootOnly.find(regex => regex.test(file))
if (matchingPattern) {
// Find which index matches the pattern and remove it from allLevels
const indexToRemove = allLevels.findIndex(element => matchingPattern.test(element))
allLevels.splice(indexToRemove, 1)
}
}
// custom method: after we've finished gathering the files for the root package, we call this

@@ -388,0 +360,0 @@ // before emitting the 'done' event in order to gather all of the files for bundled deps

2

package.json
{
"name": "npm-packlist",
"version": "8.0.1",
"version": "8.0.2",
"description": "Get a list of the files to add from a folder into an npm package",

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

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