@socketsecurity/cli-with-sentry 0.14.78 → 0.14.80

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.
@@ -0,0 +1,61 @@
1
+ /// <reference types="node" />
2
+ import { Remap } from '@socketsecurity/registry/lib/objects'
3
+ import { Abortable } from 'node:events'
4
+ import {
5
+ ObjectEncodingOptions,
6
+ OpenMode,
7
+ PathLike,
8
+ PathOrFileDescriptor
9
+ } from 'node:fs'
10
+ import { FileHandle } from 'node:fs/promises'
11
+ type FindUpOptions = {
12
+ cwd?: string | undefined
13
+ signal?: AbortSignal | undefined
14
+ }
15
+ declare function findUp(
16
+ name: string | string[],
17
+ { cwd, signal }: FindUpOptions
18
+ ): Promise<string | undefined>
19
+ type ReadFileOptions = Remap<
20
+ ObjectEncodingOptions &
21
+ Abortable & {
22
+ flag?: OpenMode | undefined
23
+ }
24
+ >
25
+ declare function readFileBinary(
26
+ filepath: PathLike | FileHandle,
27
+ options?: ReadFileOptions | undefined
28
+ ): Promise<Buffer>
29
+ declare function readFileUtf8(
30
+ filepath: PathLike | FileHandle,
31
+ options?: ReadFileOptions | undefined
32
+ ): Promise<string>
33
+ declare function safeReadFile(
34
+ filepath: PathLike | FileHandle,
35
+ options?:
36
+ | 'utf8'
37
+ | 'utf-8'
38
+ | {
39
+ encoding: 'utf8' | 'utf-8'
40
+ }
41
+ | undefined
42
+ ): Promise<string | undefined>
43
+ declare function safeReadFileSync(
44
+ filepath: PathOrFileDescriptor,
45
+ options?:
46
+ | 'utf8'
47
+ | 'utf-8'
48
+ | {
49
+ encoding: 'utf8' | 'utf-8'
50
+ }
51
+ | undefined
52
+ ): string | undefined
53
+ export {
54
+ FindUpOptions,
55
+ findUp,
56
+ ReadFileOptions,
57
+ readFileBinary,
58
+ readFileUtf8,
59
+ safeReadFile,
60
+ safeReadFileSync
61
+ }
@@ -406,7 +406,7 @@ async function setupSdk(
406
406
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_NAME']".
407
407
  name: '@socketsecurity/cli',
408
408
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
409
- version: '0.14.78',
409
+ version: '0.14.80',
410
410
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_HOMEPAGE']".
411
411
  homepage: 'https://github.com/SocketDev/socket-cli'
412
412
  })
@@ -1729,6 +1729,52 @@ function logAlertsMap(alertsMap, options) {
1729
1729
  output.write('\n')
1730
1730
  }
1731
1731
 
1732
+ function assignDefaultFixOptions(options) {
1733
+ if (options.autoMerge === undefined) {
1734
+ options.autoMerge = false
1735
+ }
1736
+ if (options.cwd === undefined) {
1737
+ options.cwd = process.cwd()
1738
+ }
1739
+ if (options.rangeStyle === undefined) {
1740
+ options.rangeStyle = 'preserve'
1741
+ }
1742
+ if (options.test === undefined) {
1743
+ options.test = !!options.testScript
1744
+ }
1745
+ if (options.testScript === undefined) {
1746
+ options.testScript = 'test'
1747
+ }
1748
+ return options
1749
+ }
1750
+ function applyRange(refRange, version, style = 'preserve') {
1751
+ switch (style) {
1752
+ case 'caret':
1753
+ return `^${version}`
1754
+ case 'gt':
1755
+ return `>${version}`
1756
+ case 'gte':
1757
+ return `>=${version}`
1758
+ case 'lt':
1759
+ return `<${version}`
1760
+ case 'lte':
1761
+ return `<=${version}`
1762
+ case 'preserve': {
1763
+ const comparators = [...new semver.Range(refRange).set].flat()
1764
+ const { length } = comparators
1765
+ return !length || length > 1
1766
+ ? version
1767
+ : `${comparators[0].operator}${version}`
1768
+ }
1769
+ case 'tilde':
1770
+ return `~${version}`
1771
+ case 'pin':
1772
+ default:
1773
+ return version
1774
+ }
1775
+ }
1776
+ const RangeStyles = ['caret', 'gt', 'lt', 'pin', 'preserve', 'tilde']
1777
+
1732
1778
  const { LOOP_SENTINEL, NPM: NPM$1, NPM_REGISTRY_URL } = constants
1733
1779
  function getDetailsFromDiff(diff_, options) {
1734
1780
  const details = []
@@ -2069,7 +2115,7 @@ function updateNode(
2069
2115
  }
2070
2116
  return true
2071
2117
  }
2072
- function updatePackageJsonFromNode(editablePkgJson, tree, node) {
2118
+ function updatePackageJsonFromNode(editablePkgJson, tree, node, rangeStyle) {
2073
2119
  if (isTopLevel(tree, node)) {
2074
2120
  const { name, version } = node
2075
2121
  for (const depField of [
@@ -2081,11 +2127,10 @@ function updatePackageJsonFromNode(editablePkgJson, tree, node) {
2081
2127
  if (oldValue) {
2082
2128
  const oldVersion = oldValue[name]
2083
2129
  if (oldVersion) {
2084
- const rangeDecorator = /^[~^]/.exec(oldVersion)?.[0] ?? ''
2085
2130
  editablePkgJson.update({
2086
2131
  [depField]: {
2087
2132
  ...oldValue,
2088
- [name]: `${rangeDecorator}${version}`
2133
+ [name]: applyRange(oldVersion, version, rangeStyle)
2089
2134
  }
2090
2135
  })
2091
2136
  }
@@ -2249,10 +2294,12 @@ exports.Arborist = Arborist
2249
2294
  exports.AuthError = AuthError
2250
2295
  exports.ColorOrMarkdown = ColorOrMarkdown
2251
2296
  exports.InputError = InputError
2297
+ exports.RangeStyles = RangeStyles
2252
2298
  exports.SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES =
2253
2299
  SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES
2254
2300
  exports.SafeArborist = SafeArborist
2255
2301
  exports.addArtifactToAlertsMap = addArtifactToAlertsMap
2302
+ exports.assignDefaultFixOptions = assignDefaultFixOptions
2256
2303
  exports.captureException = captureException
2257
2304
  exports.findBestPatchVersion = findBestPatchVersion
2258
2305
  exports.findPackageNode = findPackageNode
@@ -2279,5 +2326,5 @@ exports.supportedConfigKeys = supportedConfigKeys
2279
2326
  exports.updateConfigValue = updateConfigValue
2280
2327
  exports.updateNode = updateNode
2281
2328
  exports.updatePackageJsonFromNode = updatePackageJsonFromNode
2282
- //# debugId=614f78b2-1784-408d-8999-6c772d924dc8
2329
+ //# debugId=1ea02c68-cb36-4183-b2b8-febb070cf18d
2283
2330
  //# sourceMappingURL=shadow-npm-inject.js.map