@socketsecurity/cli-with-sentry 1.0.69 → 1.0.70

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.
@@ -177,6 +177,7 @@ function requireCommonjs() {
177
177
  #max
178
178
  #maxSize
179
179
  #dispose
180
+ #onInsert
180
181
  #disposeAfter
181
182
  #fetchMethod
182
183
  #memoMethod
@@ -258,6 +259,7 @@ function requireCommonjs() {
258
259
  #hasDispose
259
260
  #hasFetchMethod
260
261
  #hasDisposeAfter
262
+ #hasOnInsert
261
263
  /**
262
264
  * Do not call this method unless you need to inspect the
263
265
  * inner workings of the cache. If anything returned by this
@@ -335,6 +337,12 @@ function requireCommonjs() {
335
337
  get dispose() {
336
338
  return this.#dispose
337
339
  }
340
+ /**
341
+ * {@link LRUCache.OptionsBase.onInsert} (read-only)
342
+ */
343
+ get onInsert() {
344
+ return this.#onInsert
345
+ }
338
346
  /**
339
347
  * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
340
348
  */
@@ -351,6 +359,7 @@ function requireCommonjs() {
351
359
  updateAgeOnHas,
352
360
  allowStale,
353
361
  dispose,
362
+ onInsert,
354
363
  disposeAfter,
355
364
  noDisposeOnSet,
356
365
  noUpdateTTL,
@@ -408,6 +417,9 @@ function requireCommonjs() {
408
417
  if (typeof dispose === 'function') {
409
418
  this.#dispose = dispose
410
419
  }
420
+ if (typeof onInsert === 'function') {
421
+ this.#onInsert = onInsert
422
+ }
411
423
  if (typeof disposeAfter === 'function') {
412
424
  this.#disposeAfter = disposeAfter
413
425
  this.#disposed = []
@@ -416,6 +428,7 @@ function requireCommonjs() {
416
428
  this.#disposed = undefined
417
429
  }
418
430
  this.#hasDispose = !!this.#dispose
431
+ this.#hasOnInsert = !!this.#onInsert
419
432
  this.#hasDisposeAfter = !!this.#disposeAfter
420
433
  this.noDisposeOnSet = !!noDisposeOnSet
421
434
  this.noUpdateTTL = !!noUpdateTTL
@@ -861,7 +874,7 @@ function requireCommonjs() {
861
874
  }
862
875
  /**
863
876
  * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
864
- * passed to {@link LRLUCache#load}.
877
+ * passed to {@link LRUCache#load}.
865
878
  *
866
879
  * The `start` fields are calculated relative to a portable `Date.now()`
867
880
  * timestamp, even if `performance.now()` is available.
@@ -1008,6 +1021,9 @@ function requireCommonjs() {
1008
1021
  status.set = 'add'
1009
1022
  }
1010
1023
  noUpdateTTL = false
1024
+ if (this.#hasOnInsert) {
1025
+ this.#onInsert?.(v, k, 'add')
1026
+ }
1011
1027
  } else {
1012
1028
  // update
1013
1029
  this.#moveToTail(index)
@@ -1048,6 +1064,9 @@ function requireCommonjs() {
1048
1064
  } else if (status) {
1049
1065
  status.set = 'update'
1050
1066
  }
1067
+ if (this.#hasOnInsert) {
1068
+ this.onInsert?.(v, k, v === oldVal ? 'update' : 'replace')
1069
+ }
1051
1070
  }
1052
1071
  if (ttl !== 0 && !this.#ttls) {
1053
1072
  this.#initializeTTLTracking()
@@ -2149,6 +2168,19 @@ function requireLib$2() {
2149
2168
  const cache = new LRUCache({
2150
2169
  max: 1000
2151
2170
  })
2171
+ function unknownHostedUrl(url) {
2172
+ try {
2173
+ const { protocol, hostname, pathname } = new URL(url)
2174
+ if (!hostname) {
2175
+ return null
2176
+ }
2177
+ const proto = /(?:git\+)http:$/.test(protocol) ? 'http:' : 'https:'
2178
+ const path = pathname.replace(/\.git$/, '')
2179
+ return `${proto}//${hostname}${path}`
2180
+ } catch {
2181
+ return null
2182
+ }
2183
+ }
2152
2184
  class GitHost {
2153
2185
  constructor(
2154
2186
  type,
@@ -2219,6 +2251,31 @@ function requireLib$2() {
2219
2251
  }
2220
2252
  return cache.get(key)
2221
2253
  }
2254
+ static fromManifest(manifest, opts = {}) {
2255
+ if (!manifest || typeof manifest !== 'object') {
2256
+ return
2257
+ }
2258
+ const r = manifest.repository
2259
+ // TODO: look into also checking the `bugs`/`homepage` URLs
2260
+
2261
+ const rurl =
2262
+ r &&
2263
+ (typeof r === 'string'
2264
+ ? r
2265
+ : typeof r === 'object' && typeof r.url === 'string'
2266
+ ? r.url
2267
+ : null)
2268
+ if (!rurl) {
2269
+ throw new Error('no repository')
2270
+ }
2271
+ const info =
2272
+ (rurl && GitHost.fromUrl(rurl.replace(/^git\+/, ''), opts)) || null
2273
+ if (info) {
2274
+ return info
2275
+ }
2276
+ const unk = unknownHostedUrl(rurl)
2277
+ return GitHost.fromUrl(unk, opts) || unk
2278
+ }
2222
2279
  static parseUrl(url) {
2223
2280
  return parseUrl(url)
2224
2281
  }