npm-packlist 8.0.1 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +7 -35
  2. package/package.json +10 -10
package/lib/index.js CHANGED
@@ -42,20 +42,6 @@ const strictDefaults = [
42
42
  '/.git',
43
43
  ]
44
44
 
45
- const allLevels = [
46
- // these are included by default but can be excluded by package.json files array
47
- '!/readme{,.*[^~$]}',
48
- '!/copying{,.*[^~$]}',
49
- '!/license{,.*[^~$]}',
50
- '!/licence{,.*[^~$]}',
51
- ]
52
-
53
- const rootOnly = [
54
- /^!.*readme/i,
55
- /^!.*copying/i,
56
- /^!.*licen[sc]e/i,
57
- ]
58
-
59
45
  const normalizePath = (path) => path.split('\\').join('/')
60
46
 
61
47
  const readOutOfTreeIgnoreFiles = (root, rel, result = []) => {
@@ -141,7 +127,6 @@ class PackWalker extends IgnoreWalker {
141
127
  // known required files for this directory
142
128
  this.injectRules(strictRules, [
143
129
  ...strictDefaults,
144
- ...allLevels,
145
130
  ...this.requiredFiles.map((file) => `!${file}`),
146
131
  ])
147
132
  }
@@ -294,8 +279,11 @@ class PackWalker extends IgnoreWalker {
294
279
  const ignores = []
295
280
  const strict = [
296
281
  ...strictDefaults,
297
- ...allLevels,
298
282
  '!/package.json',
283
+ '!/readme{,.*[^~$]}',
284
+ '!/copying{,.*[^~$]}',
285
+ '!/license{,.*[^~$]}',
286
+ '!/licence{,.*[^~$]}',
299
287
  '/.git',
300
288
  '/node_modules',
301
289
  '.npmrc',
@@ -310,13 +298,11 @@ class PackWalker extends IgnoreWalker {
310
298
  // invert the rule because these are things we want to include
311
299
  if (file.startsWith('./')) {
312
300
  file = file.slice(1)
313
- } else if (file.endsWith('/*')) {
314
- file = file.slice(0, -1)
301
+ }
302
+ if (file.endsWith('/*')) {
303
+ file += '*'
315
304
  }
316
305
  const inverse = `!${file}`
317
-
318
- this.excludeNonRoot(file)
319
-
320
306
  try {
321
307
  // if an entry in the files array is a specific file, then we need to include it as a
322
308
  // strict requirement for this package. if it's a directory or a pattern, it's a default
@@ -365,20 +351,6 @@ class PackWalker extends IgnoreWalker {
365
351
  this.injectRules(strictRules, strict, callback)
366
352
  }
367
353
 
368
- // excludes non root files by checking if elements from the files array in
369
- // package.json contain an ! and readme/license/licence/copying, and then
370
- // removing readme/license/licence/copying accordingly from strict defaults
371
- excludeNonRoot (file) {
372
- // Find the pattern
373
- const matchingPattern = rootOnly.find(regex => regex.test(file))
374
-
375
- if (matchingPattern) {
376
- // Find which index matches the pattern and remove it from allLevels
377
- const indexToRemove = allLevels.findIndex(element => matchingPattern.test(element))
378
- allLevels.splice(indexToRemove, 1)
379
- }
380
- }
381
-
382
354
  // custom method: after we've finished gathering the files for the root package, we call this
383
355
  // before emitting the 'done' event in order to gather all of the files for bundled deps
384
356
  async gatherBundles () {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "npm-packlist",
3
- "version": "8.0.1",
3
+ "version": "9.0.0",
4
4
  "description": "Get a list of the files to add from a folder into an npm package",
5
5
  "directories": {
6
6
  "test": "test"
7
7
  },
8
8
  "main": "lib/index.js",
9
9
  "dependencies": {
10
- "ignore-walk": "^6.0.4"
10
+ "ignore-walk": "^7.0.0"
11
11
  },
12
12
  "author": "GitHub Inc.",
13
13
  "license": "ISC",
@@ -16,9 +16,9 @@
16
16
  "lib/"
17
17
  ],
18
18
  "devDependencies": {
19
- "@npmcli/arborist": "^6.0.0 || ^6.0.0-pre.0",
19
+ "@npmcli/arborist": "^7.5.4",
20
20
  "@npmcli/eslint-config": "^4.0.0",
21
- "@npmcli/template-oss": "4.21.2",
21
+ "@npmcli/template-oss": "4.23.3",
22
22
  "mutate-fs": "^2.1.1",
23
23
  "tap": "^16.0.1"
24
24
  },
@@ -27,16 +27,16 @@
27
27
  "posttest": "npm run lint",
28
28
  "snap": "tap",
29
29
  "postsnap": "npm run lintfix --",
30
- "eslint": "eslint",
31
- "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
32
- "lintfix": "npm run lint -- --fix",
30
+ "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
31
+ "lint": "npm run eslint",
32
+ "lintfix": "npm run eslint -- --fix",
33
33
  "npmclilint": "npmcli-lint",
34
34
  "postlint": "template-oss-check",
35
35
  "template-oss-apply": "template-oss-apply --force"
36
36
  },
37
37
  "repository": {
38
38
  "type": "git",
39
- "url": "https://github.com/npm/npm-packlist.git"
39
+ "url": "git+https://github.com/npm/npm-packlist.git"
40
40
  },
41
41
  "tap": {
42
42
  "test-env": [
@@ -51,11 +51,11 @@
51
51
  ]
52
52
  },
53
53
  "engines": {
54
- "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
54
+ "node": "^18.17.0 || >=20.5.0"
55
55
  },
56
56
  "templateOSS": {
57
57
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
58
- "version": "4.21.2",
58
+ "version": "4.23.3",
59
59
  "publish": true
60
60
  }
61
61
  }