npq 3.27.1 → 3.27.3

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.
@@ -30,11 +30,11 @@
30
30
  * Detects if the current version being installed was published very recently.
31
31
  * - ≤7 days: Throws an Error (high risk)
32
32
  * - ≤30 days: Throws a Warning (moderate risk)
33
- * - Only applies if version is ≤45 days old.
34
33
  * - Rationale: Very recently published versions haven't had time for community review
35
34
  * and could contain undiscovered malicious code. This is independent of author history.
36
35
  *
37
- * Checks run in order (1 → 2 → 3); the first thrown Error or Warning ends validation.
36
+ * Checks run in order (1 → 2 → 3); the first thrown Error or Warning ends validation, except that
37
+ * a dormant maintainer Warning is reported only if the version recency check finds no Error.
38
38
  */
39
39
 
40
40
  const BaseMarshall = require('./baseMarshall')
@@ -196,6 +196,9 @@ class Marshall extends BaseMarshall {
196
196
  versionAgeDays !== null && versionAgeDays <= MAX_VERSION_RECENCY_DAYS
197
197
  ? findLastPriorPublishTimeMsForPublisher(pakument, currentMs, publisherIdentity)
198
198
  : null
199
+ // A dormant Warning is held until the version recency Error check runs, so it never
200
+ // downgrades a more severe finding
201
+ let dormantWarning = null
199
202
  if (priorPublishMs !== null) {
200
203
  const gapMs = currentMs - priorPublishMs
201
204
  let gapDays = 0
@@ -208,7 +211,7 @@ class Marshall extends BaseMarshall {
208
211
  )
209
212
  }
210
213
  if (gapDays > DORMANT_MAINTAINER_WARNING_DAYS) {
211
- throw new Warning(
214
+ dormantWarning = new Warning(
212
215
  `The maintainer ${describePublisher(npmUser)} had not published this package for ${gapDays} days before this release (more than 6 months dormant)`
213
216
  )
214
217
  }
@@ -221,18 +224,20 @@ class Marshall extends BaseMarshall {
221
224
  dateDiffVersionPublished = Math.round(dateDiffInMsVersionPublished / (1000 * 60 * 60 * 24))
222
225
  }
223
226
 
224
- if (dateDiffVersionPublished <= 45) {
225
- if (dateDiffVersionPublished <= 7) {
226
- throw new Error(
227
- `This version was published only ${dateDiffVersionPublished} days ago by ${npmUser.name} <${npmUser.email}>`
228
- )
229
- }
227
+ if (dateDiffVersionPublished <= 7) {
228
+ throw new Error(
229
+ `This version was published only ${dateDiffVersionPublished} days ago by ${npmUser.name} <${npmUser.email}>`
230
+ )
231
+ }
230
232
 
231
- if (dateDiffVersionPublished <= MAX_VERSION_RECENCY_DAYS) {
232
- throw new Warning(
233
- `This version was published only ${dateDiffVersionPublished} days ago by ${npmUser.name} <${npmUser.email}>`
234
- )
235
- }
233
+ if (dormantWarning) {
234
+ throw dormantWarning
235
+ }
236
+
237
+ if (dateDiffVersionPublished <= MAX_VERSION_RECENCY_DAYS) {
238
+ throw new Warning(
239
+ `This version was published only ${dateDiffVersionPublished} days ago by ${npmUser.name} <${npmUser.email}>`
240
+ )
236
241
  }
237
242
 
238
243
  return versionPublishedDateString
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npq",
3
- "version": "3.27.1",
3
+ "version": "3.27.3",
4
4
  "description": "marshall your npm/npm package installs with high quality and class 🎖",
5
5
  "bin": {
6
6
  "npq": "./bin/npq.js",
@@ -93,5 +93,6 @@
93
93
  }
94
94
  ]
95
95
  }
96
- }
96
+ },
97
+ "packageManager": "npm@11.21.0"
97
98
  }