Skip to content

Commit

Permalink
deps: npm-packlist@8.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Jan 9, 2024
1 parent 2fd8292 commit 3fd5213
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 41 deletions.
42 changes: 7 additions & 35 deletions node_modules/npm-packlist/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,6 @@ const strictDefaults = [
'/.git',
]

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('/')

const readOutOfTreeIgnoreFiles = (root, rel, result = []) => {
Expand Down Expand Up @@ -141,7 +127,6 @@ class PackWalker extends IgnoreWalker {
// known required files for this directory
this.injectRules(strictRules, [
...strictDefaults,
...allLevels,
...this.requiredFiles.map((file) => `!${file}`),
])
}
Expand Down Expand Up @@ -294,8 +279,11 @@ class PackWalker extends IgnoreWalker {
const ignores = []
const strict = [
...strictDefaults,
...allLevels,
'!/package.json',
'!/readme{,.*[^~$]}',
'!/copying{,.*[^~$]}',
'!/license{,.*[^~$]}',
'!/licence{,.*[^~$]}',
'/.git',
'/node_modules',
'.npmrc',
Expand All @@ -310,13 +298,11 @@ class PackWalker extends IgnoreWalker {
// invert the rule because these are things we want to include
if (file.startsWith('./')) {
file = file.slice(1)
} else if (file.endsWith('/*')) {
file = file.slice(0, -1)
}
if (file.endsWith('/*')) {
file += '*'
}
const inverse = `!${file}`

this.excludeNonRoot(file)

try {
// if an entry in the files array is a specific file, then we need to include it as a
// strict requirement for this package. if it's a directory or a pattern, it's a default
Expand Down Expand Up @@ -365,20 +351,6 @@ class PackWalker extends IgnoreWalker {
this.injectRules(strictRules, strict, callback)
}

// 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
// before emitting the 'done' event in order to gather all of the files for bundled deps
async gatherBundles () {
Expand Down
2 changes: 1 addition & 1 deletion node_modules/npm-packlist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"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",
"directories": {
"test": "test"
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
"diff": "^5.1.0",
"licensee": "^10.0.0",
"nock": "^13.4.0",
"npm-packlist": "^8.0.1",
"npm-packlist": "^8.0.2",
"remark": "^14.0.2",
"remark-gfm": "^3.0.1",
"remark-github": "^11.2.4",
Expand Down Expand Up @@ -10158,9 +10158,9 @@
}
},
"node_modules/npm-packlist": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-8.0.1.tgz",
"integrity": "sha512-MQpL27ZrsJQ2kiAuQPpZb5LtJwydNRnI15QWXsf3WHERu4rzjRj6Zju/My2fov7tLuu3Gle/uoIX/DDZ3u4O4Q==",
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-8.0.2.tgz",
"integrity": "sha512-shYrPFIS/JLP4oQmAwDyk5HcyysKW8/JLTEA32S0Z5TzvpaeeX2yMFfoK1fjEBnCBvVyIB/Jj/GBFdm0wsgzbA==",
"inBundle": true,
"dependencies": {
"ignore-walk": "^6.0.4"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
"diff": "^5.1.0",
"licensee": "^10.0.0",
"nock": "^13.4.0",
"npm-packlist": "^8.0.1",
"npm-packlist": "^8.0.2",
"remark": "^14.0.2",
"remark-gfm": "^3.0.1",
"remark-github": "^11.2.4",
Expand Down

0 comments on commit 3fd5213

Please sign in to comment.