@socketsecurity/cli-with-sentry 0.14.129 → 0.14.131

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 (59) hide show
  1. package/bin/cli.js +37 -44
  2. package/bin/npx-cli.js +1 -3
  3. package/dist/{module-sync/cli.js → cli.js} +336 -338
  4. package/dist/cli.js.map +1 -0
  5. package/dist/constants.js +8 -25
  6. package/dist/constants.js.map +1 -1
  7. package/dist/instrument-with-sentry.js +3 -14
  8. package/dist/instrument-with-sentry.js.map +1 -1
  9. package/dist/{module-sync/shadow-bin.js → shadow-bin.js} +52 -1
  10. package/dist/shadow-bin.js.map +1 -0
  11. package/dist/{module-sync/shadow-npm-inject.js → shadow-npm-inject.js} +67 -48
  12. package/dist/shadow-npm-inject.js.map +1 -0
  13. package/dist/shadow-npm-paths.js.map +1 -0
  14. package/dist/{module-sync/vendor.js → vendor.js} +10320 -4778
  15. package/dist/vendor.js.map +1 -0
  16. package/package.json +16 -26
  17. package/dist/constants.d.ts +0 -285
  18. package/dist/instrument-with-sentry.d.ts +0 -1
  19. package/dist/module-sync/arborist-helpers.d.ts +0 -69
  20. package/dist/module-sync/artifact.d.ts +0 -63
  21. package/dist/module-sync/cli.d.ts +0 -2
  22. package/dist/module-sync/cli.js.map +0 -1
  23. package/dist/module-sync/cmd.d.ts +0 -4
  24. package/dist/module-sync/config.d.ts +0 -44
  25. package/dist/module-sync/constants.js +0 -3
  26. package/dist/module-sync/edge.d.ts +0 -78
  27. package/dist/module-sync/errors.d.ts +0 -29
  28. package/dist/module-sync/fs.d.ts +0 -63
  29. package/dist/module-sync/index.d.ts +0 -34
  30. package/dist/module-sync/node.d.ts +0 -121
  31. package/dist/module-sync/override-set.d.ts +0 -43
  32. package/dist/module-sync/package-environment.d.ts +0 -83
  33. package/dist/module-sync/path-resolve.d.ts +0 -15
  34. package/dist/module-sync/sdk.d.ts +0 -9
  35. package/dist/module-sync/semver.d.ts +0 -17
  36. package/dist/module-sync/shadow-bin.d.ts +0 -5
  37. package/dist/module-sync/shadow-bin.js.map +0 -1
  38. package/dist/module-sync/shadow-npm-inject.d.ts +0 -1
  39. package/dist/module-sync/shadow-npm-inject.js.map +0 -1
  40. package/dist/module-sync/shadow-npm-paths.d.ts +0 -27
  41. package/dist/module-sync/shadow-npm-paths.js.map +0 -1
  42. package/dist/module-sync/socket-package-alert.d.ts +0 -104
  43. package/dist/module-sync/vendor.d.ts +0 -0
  44. package/dist/module-sync/vendor.js.map +0 -1
  45. package/dist/require/cli.d.ts +0 -2
  46. package/dist/require/cli.js +0 -12361
  47. package/dist/require/cli.js.map +0 -1
  48. package/dist/require/constants.js +0 -3
  49. package/dist/require/shadow-bin.d.ts +0 -5
  50. package/dist/require/shadow-bin.js +0 -110
  51. package/dist/require/shadow-bin.js.map +0 -1
  52. package/dist/require/shadow-npm-inject.d.ts +0 -1
  53. package/dist/require/shadow-npm-inject.js +0 -2616
  54. package/dist/require/shadow-npm-inject.js.map +0 -1
  55. package/dist/require/shadow-npm-paths.d.ts +0 -27
  56. package/dist/require/shadow-npm-paths.js +0 -292
  57. package/dist/require/shadow-npm-paths.js.map +0 -1
  58. package/dist/require/vendor.js +0 -3
  59. /package/dist/{module-sync/shadow-npm-paths.js → shadow-npm-paths.js} +0 -0
@@ -1,4 +0,0 @@
1
- declare function cmdFlagsToString(args: string[]): string
2
- declare function cmdPrefixMessage(cmdName: string, text: string): string
3
- declare function isHelpFlag(cmdArg: string): boolean
4
- export { cmdFlagsToString, cmdPrefixMessage, isHelpFlag }
@@ -1,44 +0,0 @@
1
- import config from '@socketsecurity/config'
2
- interface LocalConfig {
3
- apiBaseUrl?: string | null | undefined
4
- apiKey?: string | null | undefined
5
- apiProxy?: string | null | undefined
6
- apiToken?: string | null | undefined
7
- defaultOrg?: string
8
- enforcedOrgs?: string[] | readonly string[] | null | undefined
9
- }
10
- declare const supportedConfigKeys: Map<keyof LocalConfig, string>
11
- declare const sensitiveConfigKeys: Set<keyof LocalConfig>
12
- declare function overrideCachedConfig(jsonConfig: unknown):
13
- | {
14
- ok: true
15
- message: undefined
16
- }
17
- | {
18
- ok: false
19
- message: string
20
- }
21
- declare function overrideConfigApiToken(apiToken: unknown): void
22
- declare function findSocketYmlSync(dir?: string): {
23
- path: string
24
- parsed: config.SocketYml
25
- } | null
26
- declare function getConfigValue<Key extends keyof LocalConfig>(
27
- key: Key
28
- ): LocalConfig[Key]
29
- declare function isReadOnlyConfig(): boolean
30
- declare function updateConfigValue<Key extends keyof LocalConfig>(
31
- key: keyof LocalConfig,
32
- value: LocalConfig[Key]
33
- ): void
34
- export {
35
- LocalConfig,
36
- supportedConfigKeys,
37
- sensitiveConfigKeys,
38
- overrideCachedConfig,
39
- overrideConfigApiToken,
40
- findSocketYmlSync,
41
- getConfigValue,
42
- isReadOnlyConfig,
43
- updateConfigValue
44
- }
@@ -1,3 +0,0 @@
1
- 'use strict'
2
-
3
- module.exports = require('../constants.js')
@@ -1,78 +0,0 @@
1
- /// <reference types="npmcli__arborist" />
2
- import { SafeNode } from './node.js'
3
- import { SafeOverrideSet } from './override-set.js'
4
- import { DependencyProblem } from '@npmcli/arborist'
5
- import { Edge as BaseEdge } from '@npmcli/arborist'
6
- type EdgeClass = Omit<
7
- BaseEdge,
8
- | 'accept'
9
- | 'detach'
10
- | 'optional'
11
- | 'overrides'
12
- | 'peer'
13
- | 'peerConflicted'
14
- | 'rawSpec'
15
- | 'reload'
16
- | 'satisfiedBy'
17
- | 'spec'
18
- | 'to'
19
- > & {
20
- optional: boolean
21
- overrides: SafeOverrideSet | undefined
22
- peer: boolean
23
- peerConflicted: boolean
24
- rawSpec: string
25
- get accept(): string | undefined
26
- get spec(): string
27
- get to(): SafeNode | null
28
- new (...args: any): EdgeClass
29
- detach(): void
30
- reload(hard?: boolean): void
31
- satisfiedBy(node: SafeNode): boolean
32
- }
33
- type EdgeOptions = {
34
- type: string
35
- name: string
36
- spec: string
37
- from: SafeNode
38
- accept?: string | undefined
39
- overrides?: SafeOverrideSet | undefined
40
- to?: SafeNode | undefined
41
- }
42
- type ErrorStatus = DependencyProblem | 'OK'
43
- type Explanation = {
44
- type: string
45
- name: string
46
- spec: string
47
- bundled: boolean
48
- overridden: boolean
49
- error: ErrorStatus | undefined
50
- rawSpec: string | undefined
51
- from: object | undefined
52
- } | null
53
- declare const Edge: EdgeClass
54
- declare class SafeEdge extends Edge {
55
- #private
56
- constructor(options: EdgeOptions)
57
- get bundled(): boolean
58
- get error(): 'DETACHED' | 'MISSING' | 'PEER LOCAL' | 'INVALID' | null
59
- get from(): SafeNode | null
60
- get spec(): string
61
- get to(): SafeNode | null
62
- detach(): void
63
- // Return the edge data, and an explanation of how that edge came to be here.
64
- // @ts-ignore: Edge#explain is defined with an unused `seen = []` param.
65
- explain(): {
66
- type: string
67
- name: string
68
- spec: string
69
- bundled: boolean
70
- overridden: boolean
71
- error: ErrorStatus | undefined
72
- rawSpec: string | undefined
73
- from: object | undefined
74
- }
75
- reload(hard?: boolean): void
76
- satisfiedBy(node: SafeNode): boolean
77
- }
78
- export { EdgeOptions, ErrorStatus, Explanation, Edge, SafeEdge }
@@ -1,29 +0,0 @@
1
- /// <reference types="node" />
2
- type EventHintOrCaptureContext =
3
- | {
4
- [key: string]: any
5
- }
6
- | Function
7
- declare class AuthError extends Error {}
8
- declare class InputError extends Error {
9
- body: string | undefined
10
- constructor(message: string, body?: string)
11
- }
12
- declare function captureException(
13
- exception: unknown,
14
- hint?: EventHintOrCaptureContext | undefined
15
- ): Promise<string>
16
- declare function captureExceptionSync(
17
- exception: unknown,
18
- hint?: EventHintOrCaptureContext | undefined
19
- ): string
20
- declare function isErrnoException(
21
- value: unknown
22
- ): value is NodeJS.ErrnoException
23
- export {
24
- AuthError,
25
- InputError,
26
- captureException,
27
- captureExceptionSync,
28
- isErrnoException
29
- }
@@ -1,63 +0,0 @@
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
- declare function removeNodeModules(cwd?: string): Promise<void>
12
- type FindUpOptions = {
13
- cwd?: string | undefined
14
- signal?: AbortSignal | undefined
15
- }
16
- declare function findUp(
17
- name: string | string[],
18
- { cwd, signal }: FindUpOptions
19
- ): Promise<string | undefined>
20
- type ReadFileOptions = Remap<
21
- ObjectEncodingOptions &
22
- Abortable & {
23
- flag?: OpenMode | undefined
24
- }
25
- >
26
- declare function readFileBinary(
27
- filepath: PathLike | FileHandle,
28
- options?: ReadFileOptions | undefined
29
- ): Promise<Buffer>
30
- declare function readFileUtf8(
31
- filepath: PathLike | FileHandle,
32
- options?: ReadFileOptions | undefined
33
- ): Promise<string>
34
- declare function safeReadFile(
35
- filepath: PathLike | FileHandle,
36
- options?:
37
- | 'utf8'
38
- | 'utf-8'
39
- | {
40
- encoding: 'utf8' | 'utf-8'
41
- }
42
- | undefined
43
- ): Promise<string | undefined>
44
- declare function safeReadFileSync(
45
- filepath: PathOrFileDescriptor,
46
- options?:
47
- | 'utf8'
48
- | 'utf-8'
49
- | {
50
- encoding: 'utf8' | 'utf-8'
51
- }
52
- | undefined
53
- ): string | undefined
54
- export {
55
- removeNodeModules,
56
- FindUpOptions,
57
- findUp,
58
- ReadFileOptions,
59
- readFileBinary,
60
- readFileUtf8,
61
- safeReadFile,
62
- safeReadFileSync
63
- }
@@ -1,34 +0,0 @@
1
- import { ArboristClass } from './shadow-npm-inject.js'
2
- import { SafeNode } from './node.js'
3
- declare const SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES: {
4
- __proto__: null
5
- audit: boolean
6
- dryRun: boolean
7
- fund: boolean
8
- ignoreScripts: boolean
9
- progress: boolean
10
- save: boolean
11
- saveBundle: boolean
12
- silent: boolean
13
- }
14
- declare const kCtorArgs: unique symbol
15
- declare const kRiskyReify: unique symbol
16
- declare const Arborist: ArboristClass
17
- declare class SafeArborist extends Arborist {
18
- constructor(...ctorArgs: ConstructorParameters<ArboristClass>)
19
- [kRiskyReify](
20
- ...args: Parameters<InstanceType<ArboristClass>['reify']>
21
- ): Promise<SafeNode>
22
- // @ts-ignore Incorrectly typed.
23
- reify(
24
- this: SafeArborist,
25
- ...args: Parameters<InstanceType<ArboristClass>['reify']>
26
- ): Promise<SafeNode>
27
- }
28
- export {
29
- SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES,
30
- kCtorArgs,
31
- kRiskyReify,
32
- Arborist,
33
- SafeArborist
34
- }
@@ -1,121 +0,0 @@
1
- /// <reference types="npmcli__arborist" />
2
- import { SafeOverrideSet } from './override-set.js'
3
- import { SafeEdge } from './edge.js'
4
- import { Link } from '@npmcli/arborist'
5
- import { Node as BaseNode } from '@npmcli/arborist'
6
- type NodeClass = Omit<
7
- BaseNode,
8
- | 'addEdgeIn'
9
- | 'addEdgeOut'
10
- | 'canDedupe'
11
- | 'canReplace'
12
- | 'canReplaceWith'
13
- | 'children'
14
- | 'deleteEdgeIn'
15
- | 'edgesIn'
16
- | 'edgesOut'
17
- | 'from'
18
- | 'hasShrinkwrap'
19
- | 'inDepBundle'
20
- | 'inShrinkwrap'
21
- | 'integrity'
22
- | 'isTop'
23
- | 'matches'
24
- | 'meta'
25
- | 'name'
26
- | 'overrides'
27
- | 'packageName'
28
- | 'parent'
29
- | 'recalculateOutEdgesOverrides'
30
- | 'resolve'
31
- | 'resolveParent'
32
- | 'root'
33
- | 'updateOverridesEdgeInAdded'
34
- | 'updateOverridesEdgeInRemoved'
35
- | 'version'
36
- | 'versions'
37
- > & {
38
- name: string
39
- version: string
40
- children: Map<string, SafeNode | Link>
41
- edgesIn: Set<SafeEdge>
42
- edgesOut: Map<string, SafeEdge>
43
- from: SafeNode | null
44
- hasShrinkwrap: boolean
45
- inShrinkwrap: boolean | undefined
46
- integrity?: string | null
47
- isTop: boolean | undefined
48
- meta: BaseNode['meta'] & {
49
- addEdge(edge: SafeEdge): void
50
- }
51
- overrides: SafeOverrideSet | undefined
52
- versions: string[]
53
- get inDepBundle(): boolean
54
- get packageName(): string | null
55
- get parent(): SafeNode | null
56
- set parent(value: SafeNode | null)
57
- get resolveParent(): SafeNode | null
58
- get root(): SafeNode | null
59
- set root(value: SafeNode | null)
60
- new (...args: any): NodeClass
61
- addEdgeIn(edge: SafeEdge): void
62
- addEdgeOut(edge: SafeEdge): void
63
- canDedupe(preferDedupe?: boolean): boolean
64
- canReplace(node: SafeNode, ignorePeers?: string[]): boolean
65
- canReplaceWith(node: SafeNode, ignorePeers?: string[]): boolean
66
- deleteEdgeIn(edge: SafeEdge): void
67
- matches(node: SafeNode): boolean
68
- recalculateOutEdgesOverrides(): void
69
- resolve(name: string): SafeNode
70
- updateOverridesEdgeInAdded(
71
- otherOverrideSet: SafeOverrideSet | undefined
72
- ): boolean
73
- updateOverridesEdgeInRemoved(otherOverrideSet: SafeOverrideSet): boolean
74
- }
75
- declare const Node: NodeClass
76
- declare class SafeNode extends Node {
77
- // Return true if it's safe to remove this node, because anything that is
78
- // depending on it would be fine with the thing that they would resolve to if
79
- // it was removed, or nothing is depending on it in the first place.
80
- canDedupe(preferDedupe?: boolean): boolean
81
- // Is it safe to replace one node with another? check the edges to
82
- // make sure no one will get upset. Note that the node might end up
83
- // having its own unmet dependencies, if the new node has new deps.
84
- // Note that there are cases where Arborist will opt to insert a node
85
- // into the tree even though this function returns false! This is
86
- // necessary when a root dependency is added or updated, or when a
87
- // root dependency brings peer deps along with it. In that case, we
88
- // will go ahead and create the invalid state, and then try to resolve
89
- // it with more tree construction, because it's a user request.
90
- canReplaceWith(node: SafeNode, ignorePeers?: string[]): boolean
91
- // Patch adding deleteEdgeIn is based on https://github.com/npm/cli/pull/8089.
92
- deleteEdgeIn(edge: SafeEdge): void
93
- addEdgeIn(edge: SafeEdge): void
94
- get overridden(): boolean
95
- set parent(newParent: SafeNode)
96
- // Patch adding recalculateOutEdgesOverrides is based on
97
- // https://github.com/npm/cli/pull/8089.
98
- recalculateOutEdgesOverrides(): void
99
- set root(newRoot: SafeNode)
100
- // Patch adding updateOverridesEdgeInAdded is based on
101
- // https://github.com/npm/cli/pull/7025.
102
- //
103
- // This logic isn't perfect either. When we have two edges in that have
104
- // different override sets, then we have to decide which set is correct. This
105
- // function assumes the more specific override set is applicable, so if we have
106
- // dependencies A->B->C and A->C and an override set that specifies what happens
107
- // for C under A->B, this will work even if the new A->C edge comes along and
108
- // tries to change the override set. The strictly correct logic is not to allow
109
- // two edges with different overrides to point to the same node, because even
110
- // if this node can satisfy both, one of its dependencies might need to be
111
- // different depending on the edge leading to it. However, this might cause a
112
- // lot of duplication, because the conflict in the dependencies might never
113
- // actually happen.
114
- updateOverridesEdgeInAdded(
115
- otherOverrideSet: SafeOverrideSet | undefined
116
- ): boolean
117
- // Patch adding updateOverridesEdgeInRemoved is based on
118
- // https://github.com/npm/cli/pull/7025.
119
- updateOverridesEdgeInRemoved(otherOverrideSet: SafeOverrideSet): boolean
120
- }
121
- export { SafeNode }
@@ -1,43 +0,0 @@
1
- import { SafeEdge } from './edge.js'
2
- import { SafeNode } from './node.js'
3
- interface OverrideSetClass {
4
- children: Map<string, SafeOverrideSet>
5
- key: string | undefined
6
- keySpec: string | undefined
7
- name: string | undefined
8
- parent: SafeOverrideSet | undefined
9
- value: string | undefined
10
- version: string | undefined
11
- new (...args: any[]): OverrideSetClass
12
- get isRoot(): boolean
13
- get ruleset(): Map<string, SafeOverrideSet>
14
- ancestry(): Generator<SafeOverrideSet>
15
- childrenAreEqual(otherOverrideSet: SafeOverrideSet | undefined): boolean
16
- getEdgeRule(edge: SafeEdge): SafeOverrideSet
17
- getNodeRule(node: SafeNode): SafeOverrideSet
18
- getMatchingRule(node: SafeNode): SafeOverrideSet | null
19
- isEqual(otherOverrideSet: SafeOverrideSet | undefined): boolean
20
- }
21
- declare const OverrideSet: OverrideSetClass
22
- declare class SafeOverrideSet extends OverrideSet {
23
- // Patch adding doOverrideSetsConflict is based on
24
- // https://github.com/npm/cli/pull/8089.
25
- static doOverrideSetsConflict(
26
- first: SafeOverrideSet | undefined,
27
- second: SafeOverrideSet | undefined
28
- ): boolean
29
- // Patch adding findSpecificOverrideSet is based on
30
- // https://github.com/npm/cli/pull/8089.
31
- static findSpecificOverrideSet(
32
- first: SafeOverrideSet | undefined,
33
- second: SafeOverrideSet | undefined
34
- ): SafeOverrideSet | undefined
35
- // Patch adding childrenAreEqual is based on
36
- // https://github.com/npm/cli/pull/8089.
37
- childrenAreEqual(otherOverrideSet: SafeOverrideSet): boolean
38
- getEdgeRule(edge: SafeEdge): SafeOverrideSet
39
- // Patch adding isEqual is based on
40
- // https://github.com/npm/cli/pull/8089.
41
- isEqual(otherOverrideSet: SafeOverrideSet | undefined): boolean
42
- }
43
- export { SafeOverrideSet }
@@ -1,83 +0,0 @@
1
- import { Logger } from '@socketsecurity/registry/lib/logger'
2
- import { Remap } from '@socketsecurity/registry/lib/objects'
3
- import { EditablePackageJson } from '@socketsecurity/registry/lib/packages'
4
- import { SemVer } from 'semver'
5
- declare const AGENTS: readonly [
6
- 'bun',
7
- 'npm',
8
- 'pnpm',
9
- 'yarn/berry',
10
- 'yarn/classic',
11
- 'vlt'
12
- ]
13
- type Agent = (typeof AGENTS)[number]
14
- type EnvBase = {
15
- agent: Agent
16
- agentExecPath: string
17
- agentSupported: boolean
18
- features: {
19
- npmBuggyOverrides: boolean
20
- }
21
- nodeSupported: boolean
22
- nodeVersion: SemVer
23
- npmExecPath: string
24
- pkgRequirements: {
25
- agent: string
26
- node: string
27
- }
28
- pkgSupports: {
29
- agent: boolean
30
- node: boolean
31
- }
32
- }
33
- type EnvDetails = Readonly<
34
- Remap<
35
- EnvBase & {
36
- agentVersion: SemVer
37
- editablePkgJson: EditablePackageJson
38
- lockName: string
39
- lockPath: string
40
- lockSrc: string
41
- pkgPath: string
42
- }
43
- >
44
- >
45
- type PartialEnvDetails = Readonly<
46
- Remap<
47
- EnvBase & {
48
- agentVersion: SemVer | undefined
49
- editablePkgJson: EditablePackageJson | undefined
50
- lockName: string | undefined
51
- lockPath: string | undefined
52
- lockSrc: string | undefined
53
- pkgPath: string | undefined
54
- }
55
- >
56
- >
57
- type DetectOptions = {
58
- cwd?: string | undefined
59
- onUnknown?: (pkgManager: string | undefined) => void
60
- }
61
- declare function detectPackageEnvironment({
62
- cwd,
63
- onUnknown
64
- }?: DetectOptions): Promise<EnvDetails | PartialEnvDetails>
65
- type DetectAndValidateOptions = {
66
- cmdName?: string | undefined
67
- logger?: Logger | undefined
68
- prod?: boolean | undefined
69
- }
70
- declare function detectAndValidatePackageEnvironment(
71
- cwd: string,
72
- options?: DetectAndValidateOptions | undefined
73
- ): Promise<void | EnvDetails>
74
- export {
75
- AGENTS,
76
- Agent,
77
- EnvDetails,
78
- PartialEnvDetails,
79
- DetectOptions,
80
- detectPackageEnvironment,
81
- DetectAndValidateOptions,
82
- detectAndValidatePackageEnvironment
83
- }
@@ -1,15 +0,0 @@
1
- import { SocketYml } from '@socketsecurity/config'
2
- import { SocketSdkReturnType } from '@socketsecurity/sdk'
3
- declare function findBinPathDetailsSync(binName: string): {
4
- name: string
5
- path: string | undefined
6
- shadowed: boolean
7
- }
8
- declare function findNpmPathSync(npmBinPath: string): string | undefined
9
- declare function getPackageFilesForScan(
10
- cwd: string,
11
- inputPaths: string[],
12
- supportedFiles: SocketSdkReturnType<'getReportSupportedFiles'>['data'],
13
- config?: SocketYml | undefined
14
- ): Promise<string[]>
15
- export { findBinPathDetailsSync, findNpmPathSync, getPackageFilesForScan }
@@ -1,9 +0,0 @@
1
- import { SocketSdk } from '@socketsecurity/sdk'
2
- declare function getDefaultToken(): string | undefined
3
- declare function getPublicToken(): string
4
- declare function setupSdk(
5
- apiToken?: string | undefined,
6
- apiBaseUrl?: string | undefined,
7
- proxy?: string | undefined
8
- ): Promise<SocketSdk>
9
- export { getDefaultToken, getPublicToken, setupSdk }
@@ -1,17 +0,0 @@
1
- declare const RangeStyles: string[]
2
- type RangeStyle =
3
- | 'caret'
4
- | 'gt'
5
- | 'gte'
6
- | 'lt'
7
- | 'lte'
8
- | 'pin'
9
- | 'preserve'
10
- | 'tilde'
11
- declare function applyRange(
12
- refRange: string,
13
- version: string,
14
- style?: RangeStyle
15
- ): string
16
- declare function getMajor(version: string): number | null
17
- export { RangeStyles, RangeStyle, applyRange, getMajor }
@@ -1,5 +0,0 @@
1
- declare function shadowBin(
2
- binName: 'npm' | 'npx',
3
- args?: string[]
4
- ): Promise<void>
5
- export { shadowBin as default }
@@ -1 +0,0 @@
1
- {"version":3,"file":"shadow-bin.js","sources":["../../src/shadow/npm/link.ts","../../src/shadow/npm/bin.ts"],"sourcesContent":["import path from 'node:path'\nimport process from 'node:process'\n\nimport cmdShim from 'cmd-shim'\n\nimport {\n getNpmBinPath,\n getNpxBinPath,\n isNpmBinPathShadowed,\n isNpxBinPathShadowed\n} from './paths'\nimport constants from '../../constants'\n\nconst { CLI, NPX } = constants\n\nexport async function installLinks(\n realBinPath: string,\n binName: 'npm' | 'npx'\n): Promise<string> {\n const isNpx = binName === NPX\n // Find package manager being shadowed by this process.\n const binPath = isNpx ? getNpxBinPath() : getNpmBinPath()\n // Lazily access constants.WIN32.\n const { WIN32 } = constants\n // TODO: Is this early exit needed?\n if (WIN32 && binPath) {\n return binPath\n }\n const shadowed = isNpx ? isNpxBinPathShadowed() : isNpmBinPathShadowed()\n // Move our bin directory to front of PATH so its found first.\n if (!shadowed) {\n if (WIN32) {\n await cmdShim(\n // Lazily access constants.rootDistPath.\n path.join(constants.rootDistPath, `${binName}-${CLI}.js`),\n path.join(realBinPath, binName)\n )\n }\n const { env } = process\n env['PATH'] = `${realBinPath}${path.delimiter}${env['PATH']}`\n }\n return binPath\n}\n","import process from 'node:process'\n\nimport { isDebug } from '@socketsecurity/registry/lib/debug'\nimport {\n isLoglevelFlag,\n isProgressFlag\n} from '@socketsecurity/registry/lib/npm'\nimport { spawn } from '@socketsecurity/registry/lib/spawn'\n\nimport { installLinks } from './link'\nimport constants from '../../constants'\n\nconst { SOCKET_CLI_SAFE_BIN, SOCKET_CLI_SAFE_PROGRESS, SOCKET_IPC_HANDSHAKE } =\n constants\n\nexport default async function shadowBin(\n binName: 'npm' | 'npx',\n args = process.argv.slice(2)\n) {\n process.exitCode = 1\n const useDebug = isDebug()\n const terminatorPos = args.indexOf('--')\n const rawBinArgs = terminatorPos === -1 ? args : args.slice(0, terminatorPos)\n const progressArg = rawBinArgs.findLast(isProgressFlag) !== '--no-progress'\n const binArgs = rawBinArgs.filter(a => !isProgressFlag(a))\n const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos)\n const isSilent = !useDebug && !binArgs.some(isLoglevelFlag)\n // The default value of loglevel is \"notice\". We default to \"error\" which is\n // two levels quieter.\n const logLevelArgs = isSilent ? ['--loglevel', 'error'] : []\n const spawnPromise = spawn(\n // Lazily access constants.execPath.\n constants.execPath,\n [\n // Lazily access constants.nodeHardenFlags.\n ...constants.nodeHardenFlags,\n // Lazily access constants.nodeNoWarningsFlags.\n ...constants.nodeNoWarningsFlags,\n // Lazily access process.env['INLINED_SOCKET_CLI_SENTRY_BUILD'].\n ...(process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']\n ? [\n '--require',\n // Lazily access constants.distInstrumentWithSentryPath.\n constants.distInstrumentWithSentryPath\n ]\n : []),\n '--require',\n // Lazily access constants.distShadowNpmInjectPath.\n constants.distShadowNpmInjectPath,\n // Lazily access constants.shadowBinPath.\n await installLinks(constants.shadowBinPath, binName),\n // Add '--no-progress' to fix input being swallowed by the npm spinner.\n '--no-progress',\n // Add '--loglevel=error' if a loglevel flag is not provided and the\n // SOCKET_CLI_DEBUG environment variable is not truthy.\n ...logLevelArgs,\n ...binArgs,\n ...otherArgs\n ],\n {\n // 'inherit' + 'ipc'\n stdio: [0, 1, 2, 'ipc']\n }\n )\n // See https://nodejs.org/api/all.html#all_child_process_event-exit.\n spawnPromise.process.on('exit', (code, signalName) => {\n if (signalName) {\n process.kill(process.pid, signalName)\n } else if (code !== null) {\n // eslint-disable-next-line n/no-process-exit\n process.exit(code)\n }\n })\n spawnPromise.process.send({\n [SOCKET_IPC_HANDSHAKE]: {\n [SOCKET_CLI_SAFE_BIN]: binName,\n [SOCKET_CLI_SAFE_PROGRESS]: progressArg\n }\n })\n await spawnPromise\n}\n"],"names":["NPX","WIN32","env","SOCKET_IPC_HANDSHAKE","constants","process","spawnPromise"],"mappings":";;;;;;;;;;;AAaA;;AAAaA;AAAI;AAEV;AAIL;AACA;;AAEA;;AACQC;AAAM;AACd;;AAEE;AACF;;AAEA;;AAEE;AACE;AACE;;AAIJ;;AACQC;AAAI;AACZA;AACF;AACA;AACF;;AC9BA;;;AAAuDC;AAAqB;AAG7D;;AAKb;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGE;;AAGE;;AAEA;;AAEA;;AAIM;AACAC;AAIN;AACAA;AACA;AACA;AACA;;AAEA;AACA;;AAMA;;AAEF;AAEF;;AAEE;;AAEA;AACE;AACAC;AACF;AACF;AACAC;AACE;;AAEE;AACF;AACF;AACA;AACF;;","debugId":"a3ff14de-2729-4213-91d1-6f1ab7249f1d"}
@@ -1 +0,0 @@
1
- export {}