@socketsecurity/lib 5.15.0 → 5.17.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.
- package/CHANGELOG.md +21 -0
- package/README.md +2 -2
- package/dist/abort.d.ts +13 -0
- package/dist/agent.d.ts +81 -0
- package/dist/ansi.d.ts +13 -0
- package/dist/archives.d.ts +31 -0
- package/dist/argv/flags.d.ts +91 -0
- package/dist/argv/parse.d.ts +31 -0
- package/dist/bin.d.ts +54 -0
- package/dist/cacache.d.ts +38 -0
- package/dist/cache-with-ttl.d.ts +7 -0
- package/dist/colors.d.ts +12 -0
- package/dist/cover/formatters.d.ts +18 -0
- package/dist/debug.d.ts +6 -0
- package/dist/dlx/binary.d.ts +84 -0
- package/dist/dlx/cache.d.ts +6 -0
- package/dist/dlx/detect.d.ts +33 -0
- package/dist/dlx/dir.d.ts +34 -0
- package/dist/dlx/manifest.d.ts +16 -0
- package/dist/dlx/package.d.ts +43 -0
- package/dist/dlx/packages.d.ts +36 -0
- package/dist/dlx/paths.d.ts +20 -0
- package/dist/dlx/paths.js +1 -1
- package/dist/effects/pulse-frames.d.ts +6 -0
- package/dist/effects/text-shimmer.d.ts +9 -0
- package/dist/effects/ultra.d.ts +6 -0
- package/dist/env/ci.d.ts +14 -0
- package/dist/env/debug.d.ts +13 -0
- package/dist/env/github.d.ts +80 -0
- package/dist/env/helpers.d.ts +45 -0
- package/dist/env/home.d.ts +13 -0
- package/dist/env/locale.d.ts +30 -0
- package/dist/env/node-auth-token.d.ts +13 -0
- package/dist/env/node-env.d.ts +13 -0
- package/dist/env/npm.d.ts +50 -0
- package/dist/env/path.d.ts +13 -0
- package/dist/env/pre-commit.d.ts +14 -0
- package/dist/env/rewire.d.ts +38 -0
- package/dist/env/shell.d.ts +13 -0
- package/dist/env/socket-cli-shadow.d.ts +43 -0
- package/dist/env/socket-cli.d.ts +116 -0
- package/dist/env/socket.d.ts +153 -0
- package/dist/env/temp-dir.d.ts +30 -0
- package/dist/env/term.d.ts +13 -0
- package/dist/env/test.d.ts +32 -0
- package/dist/env/windows.d.ts +40 -0
- package/dist/env/xdg.d.ts +30 -0
- package/dist/env.d.ts +40 -0
- package/dist/external/npm-pack.js +202 -291
- package/dist/external/tar-fs.js +27 -7
- package/dist/fs.d.ts +13 -0
- package/dist/functions.d.ts +30 -0
- package/dist/globs.d.ts +27 -0
- package/dist/http-request.d.ts +16 -0
- package/dist/json/format.d.ts +18 -0
- package/dist/memoization.d.ts +5 -0
- package/dist/packages/edit.d.ts +28 -0
- package/dist/packages/exports.d.ts +40 -0
- package/dist/packages/licenses.d.ts +59 -0
- package/dist/packages/manifest.d.ts +18 -0
- package/dist/packages/normalize.d.ts +22 -0
- package/dist/packages/operations.d.ts +51 -0
- package/dist/packages/provenance.d.ts +11 -0
- package/dist/packages/specs.d.ts +30 -0
- package/dist/packages/validation.d.ts +18 -0
- package/dist/paths/normalize.d.ts +81 -5
- package/dist/paths/normalize.js +29 -2
- package/dist/paths/rewire.js +12 -3
- package/dist/regexps.d.ts +7 -0
- package/dist/releases/github.d.ts +63 -0
- package/dist/releases/socket-btm.d.ts +31 -0
- package/dist/sea.d.ts +15 -0
- package/dist/shadow.d.ts +7 -0
- package/dist/signal-exit.d.ts +27 -0
- package/dist/sorts.d.ts +33 -0
- package/dist/spawn.d.ts +9 -0
- package/dist/stdio/mask.d.ts +26 -0
- package/dist/streams.d.ts +28 -0
- package/dist/suppress-warnings.d.ts +7 -0
- package/dist/temporary-executor.d.ts +7 -0
- package/dist/url.d.ts +59 -0
- package/dist/versions.d.ts +119 -0
- package/dist/words.d.ts +20 -0
- package/package.json +7 -57
package/dist/env/ci.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns whether the CI environment variable is set.
|
|
3
|
+
*
|
|
4
|
+
* @returns `true` if running in a CI environment, `false` otherwise
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { getCI } from '@socketsecurity/lib/env/ci'
|
|
9
|
+
*
|
|
10
|
+
* if (getCI()) {
|
|
11
|
+
* console.log('Running in CI')
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
1
15
|
/*@__NO_SIDE_EFFECTS__*/
|
|
2
16
|
export declare function getCI(): boolean;
|
package/dist/env/debug.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value of the DEBUG environment variable.
|
|
3
|
+
*
|
|
4
|
+
* @returns The debug filter string, or `undefined` if not set
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { getDebug } from '@socketsecurity/lib/env/debug'
|
|
9
|
+
*
|
|
10
|
+
* const debug = getDebug()
|
|
11
|
+
* // e.g. 'socket:*' or undefined
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
/*@__NO_SIDE_EFFECTS__*/
|
|
2
15
|
export declare function getDebug(): string | undefined;
|
package/dist/env/github.d.ts
CHANGED
|
@@ -1,48 +1,128 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GITHUB_API_URL environment variable.
|
|
3
3
|
* GitHub API URL (e.g., https://api.github.com).
|
|
4
|
+
*
|
|
5
|
+
* @returns The GitHub API URL, or `undefined` if not set
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { getGithubApiUrl } from '@socketsecurity/lib/env/github'
|
|
10
|
+
*
|
|
11
|
+
* const apiUrl = getGithubApiUrl()
|
|
12
|
+
* // e.g. 'https://api.github.com' or undefined
|
|
13
|
+
* ```
|
|
4
14
|
*/
|
|
5
15
|
/*@__NO_SIDE_EFFECTS__*/
|
|
6
16
|
export declare function getGithubApiUrl(): string | undefined;
|
|
7
17
|
/**
|
|
8
18
|
* GITHUB_BASE_REF environment variable.
|
|
9
19
|
* GitHub pull request base branch.
|
|
20
|
+
*
|
|
21
|
+
* @returns The pull request base branch name, or `undefined` if not set
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { getGithubBaseRef } from '@socketsecurity/lib/env/github'
|
|
26
|
+
*
|
|
27
|
+
* const baseRef = getGithubBaseRef()
|
|
28
|
+
* // e.g. 'main' or undefined
|
|
29
|
+
* ```
|
|
10
30
|
*/
|
|
11
31
|
/*@__NO_SIDE_EFFECTS__*/
|
|
12
32
|
export declare function getGithubBaseRef(): string | undefined;
|
|
13
33
|
/**
|
|
14
34
|
* GITHUB_REF_NAME environment variable.
|
|
15
35
|
* GitHub branch or tag name.
|
|
36
|
+
*
|
|
37
|
+
* @returns The branch or tag name, or `undefined` if not set
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { getGithubRefName } from '@socketsecurity/lib/env/github'
|
|
42
|
+
*
|
|
43
|
+
* const refName = getGithubRefName()
|
|
44
|
+
* // e.g. 'feature/my-branch' or 'v1.0.0'
|
|
45
|
+
* ```
|
|
16
46
|
*/
|
|
17
47
|
/*@__NO_SIDE_EFFECTS__*/
|
|
18
48
|
export declare function getGithubRefName(): string | undefined;
|
|
19
49
|
/**
|
|
20
50
|
* GITHUB_REF_TYPE environment variable.
|
|
21
51
|
* GitHub ref type (branch or tag).
|
|
52
|
+
*
|
|
53
|
+
* @returns The ref type ('branch' or 'tag'), or `undefined` if not set
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import { getGithubRefType } from '@socketsecurity/lib/env/github'
|
|
58
|
+
*
|
|
59
|
+
* const refType = getGithubRefType()
|
|
60
|
+
* // e.g. 'branch' or 'tag'
|
|
61
|
+
* ```
|
|
22
62
|
*/
|
|
23
63
|
/*@__NO_SIDE_EFFECTS__*/
|
|
24
64
|
export declare function getGithubRefType(): string | undefined;
|
|
25
65
|
/**
|
|
26
66
|
* GITHUB_REPOSITORY environment variable.
|
|
27
67
|
* GitHub repository name in owner/repo format.
|
|
68
|
+
*
|
|
69
|
+
* @returns The repository name, or `undefined` if not set
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* import { getGithubRepository } from '@socketsecurity/lib/env/github'
|
|
74
|
+
*
|
|
75
|
+
* const repo = getGithubRepository()
|
|
76
|
+
* // e.g. 'SocketDev/socket-cli' or undefined
|
|
77
|
+
* ```
|
|
28
78
|
*/
|
|
29
79
|
/*@__NO_SIDE_EFFECTS__*/
|
|
30
80
|
export declare function getGithubRepository(): string | undefined;
|
|
31
81
|
/**
|
|
32
82
|
* GITHUB_SERVER_URL environment variable.
|
|
33
83
|
* GitHub server URL (e.g., https://github.com).
|
|
84
|
+
*
|
|
85
|
+
* @returns The GitHub server URL, or `undefined` if not set
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* import { getGithubServerUrl } from '@socketsecurity/lib/env/github'
|
|
90
|
+
*
|
|
91
|
+
* const serverUrl = getGithubServerUrl()
|
|
92
|
+
* // e.g. 'https://github.com' or undefined
|
|
93
|
+
* ```
|
|
34
94
|
*/
|
|
35
95
|
/*@__NO_SIDE_EFFECTS__*/
|
|
36
96
|
export declare function getGithubServerUrl(): string | undefined;
|
|
37
97
|
/**
|
|
38
98
|
* GITHUB_TOKEN environment variable.
|
|
39
99
|
* GitHub authentication token for API access.
|
|
100
|
+
*
|
|
101
|
+
* @returns The GitHub token, or `undefined` if not set
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* import { getGithubToken } from '@socketsecurity/lib/env/github'
|
|
106
|
+
*
|
|
107
|
+
* const token = getGithubToken()
|
|
108
|
+
* // e.g. 'ghp_abc123...' or undefined
|
|
109
|
+
* ```
|
|
40
110
|
*/
|
|
41
111
|
/*@__NO_SIDE_EFFECTS__*/
|
|
42
112
|
export declare function getGithubToken(): string | undefined;
|
|
43
113
|
/**
|
|
44
114
|
* GH_TOKEN environment variable.
|
|
45
115
|
* Alternative GitHub authentication token for API access (used by GitHub CLI).
|
|
116
|
+
*
|
|
117
|
+
* @returns The GH CLI token, or `undefined` if not set
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* import { getGhToken } from '@socketsecurity/lib/env/github'
|
|
122
|
+
*
|
|
123
|
+
* const token = getGhToken()
|
|
124
|
+
* // e.g. 'gho_abc123...' or undefined
|
|
125
|
+
* ```
|
|
46
126
|
*/
|
|
47
127
|
/*@__NO_SIDE_EFFECTS__*/
|
|
48
128
|
export declare function getGhToken(): string | undefined;
|
package/dist/env/helpers.d.ts
CHANGED
|
@@ -1,9 +1,54 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Environment variable type conversion helpers.
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Convert an environment variable string to a boolean.
|
|
6
|
+
*
|
|
7
|
+
* @param value - The environment variable value to convert
|
|
8
|
+
* @returns `true` if value is 'true', '1', or 'yes' (case-insensitive), `false` otherwise
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { envAsBoolean } from '@socketsecurity/lib/env/helpers'
|
|
13
|
+
*
|
|
14
|
+
* envAsBoolean('true') // true
|
|
15
|
+
* envAsBoolean('1') // true
|
|
16
|
+
* envAsBoolean('yes') // true
|
|
17
|
+
* envAsBoolean(undefined) // false
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
4
20
|
/*@__NO_SIDE_EFFECTS__*/
|
|
5
21
|
export declare function envAsBoolean(value: string | undefined): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Convert an environment variable string to a number.
|
|
24
|
+
*
|
|
25
|
+
* @param value - The environment variable value to convert
|
|
26
|
+
* @returns The parsed number, or `0` if the value is undefined or not a valid number
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { envAsNumber } from '@socketsecurity/lib/env/helpers'
|
|
31
|
+
*
|
|
32
|
+
* envAsNumber('3000') // 3000
|
|
33
|
+
* envAsNumber(undefined) // 0
|
|
34
|
+
* envAsNumber('abc') // 0
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
6
37
|
/*@__NO_SIDE_EFFECTS__*/
|
|
7
38
|
export declare function envAsNumber(value: string | undefined): number;
|
|
39
|
+
/**
|
|
40
|
+
* Convert an environment variable value to a string.
|
|
41
|
+
*
|
|
42
|
+
* @param value - The environment variable value to convert
|
|
43
|
+
* @returns The string value, or an empty string if undefined
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { envAsString } from '@socketsecurity/lib/env/helpers'
|
|
48
|
+
*
|
|
49
|
+
* envAsString('hello') // 'hello'
|
|
50
|
+
* envAsString(undefined) // ''
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
8
53
|
/*@__NO_SIDE_EFFECTS__*/
|
|
9
54
|
export declare function envAsString(value: string | undefined): string;
|
package/dist/env/home.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value of the HOME environment variable.
|
|
3
|
+
*
|
|
4
|
+
* @returns The user's home directory path, or `undefined` if not set
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { getHome } from '@socketsecurity/lib/env/home'
|
|
9
|
+
*
|
|
10
|
+
* const home = getHome()
|
|
11
|
+
* // e.g. '/tmp/user' or undefined
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
/*@__NO_SIDE_EFFECTS__*/
|
|
2
15
|
export declare function getHome(): string | undefined;
|
package/dist/env/locale.d.ts
CHANGED
|
@@ -1,18 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* LANG environment variable.
|
|
3
3
|
* System locale and language settings.
|
|
4
|
+
*
|
|
5
|
+
* @returns The system locale string, or `undefined` if not set
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { getLang } from '@socketsecurity/lib/env/locale'
|
|
10
|
+
*
|
|
11
|
+
* const lang = getLang()
|
|
12
|
+
* // e.g. 'en_US.UTF-8' or undefined
|
|
13
|
+
* ```
|
|
4
14
|
*/
|
|
5
15
|
/*@__NO_SIDE_EFFECTS__*/
|
|
6
16
|
export declare function getLang(): string | undefined;
|
|
7
17
|
/**
|
|
8
18
|
* LC_ALL environment variable.
|
|
9
19
|
* Override for all locale settings.
|
|
20
|
+
*
|
|
21
|
+
* @returns The locale override string, or `undefined` if not set
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { getLcAll } from '@socketsecurity/lib/env/locale'
|
|
26
|
+
*
|
|
27
|
+
* const lcAll = getLcAll()
|
|
28
|
+
* // e.g. 'C' or 'en_US.UTF-8'
|
|
29
|
+
* ```
|
|
10
30
|
*/
|
|
11
31
|
/*@__NO_SIDE_EFFECTS__*/
|
|
12
32
|
export declare function getLcAll(): string | undefined;
|
|
13
33
|
/**
|
|
14
34
|
* LC_MESSAGES environment variable.
|
|
15
35
|
* Locale setting for message translations.
|
|
36
|
+
*
|
|
37
|
+
* @returns The messages locale string, or `undefined` if not set
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { getLcMessages } from '@socketsecurity/lib/env/locale'
|
|
42
|
+
*
|
|
43
|
+
* const lcMessages = getLcMessages()
|
|
44
|
+
* // e.g. 'en_US.UTF-8' or undefined
|
|
45
|
+
* ```
|
|
16
46
|
*/
|
|
17
47
|
/*@__NO_SIDE_EFFECTS__*/
|
|
18
48
|
export declare function getLcMessages(): string | undefined;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value of the NODE_AUTH_TOKEN environment variable.
|
|
3
|
+
*
|
|
4
|
+
* @returns The Node.js registry auth token, or `undefined` if not set
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { getNodeAuthToken } from '@socketsecurity/lib/env/node-auth-token'
|
|
9
|
+
*
|
|
10
|
+
* const token = getNodeAuthToken()
|
|
11
|
+
* // e.g. 'npm_abc123...' or undefined
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
/*@__NO_SIDE_EFFECTS__*/
|
|
2
15
|
export declare function getNodeAuthToken(): string | undefined;
|
package/dist/env/node-env.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value of the NODE_ENV environment variable.
|
|
3
|
+
*
|
|
4
|
+
* @returns The Node.js environment mode, or `undefined` if not set
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { getNodeEnv } from '@socketsecurity/lib/env/node-env'
|
|
9
|
+
*
|
|
10
|
+
* const env = getNodeEnv()
|
|
11
|
+
* // e.g. 'production', 'development', 'test', or undefined
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
/*@__NO_SIDE_EFFECTS__*/
|
|
2
15
|
export declare function getNodeEnv(): string | undefined;
|
package/dist/env/npm.d.ts
CHANGED
|
@@ -1,30 +1,80 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* npm_config_registry environment variable.
|
|
3
3
|
* NPM registry URL configured by package managers.
|
|
4
|
+
*
|
|
5
|
+
* @returns The configured NPM registry URL, or `undefined` if not set
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { getNpmConfigRegistry } from '@socketsecurity/lib/env/npm'
|
|
10
|
+
*
|
|
11
|
+
* const registry = getNpmConfigRegistry()
|
|
12
|
+
* // e.g. 'https://registry.npmjs.org/' or undefined
|
|
13
|
+
* ```
|
|
4
14
|
*/
|
|
5
15
|
/*@__NO_SIDE_EFFECTS__*/
|
|
6
16
|
export declare function getNpmConfigRegistry(): string | undefined;
|
|
7
17
|
/**
|
|
8
18
|
* npm_config_user_agent environment variable.
|
|
9
19
|
* User agent string set by npm/pnpm/yarn package managers.
|
|
20
|
+
*
|
|
21
|
+
* @returns The package manager user agent string, or `undefined` if not set
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { getNpmConfigUserAgent } from '@socketsecurity/lib/env/npm'
|
|
26
|
+
*
|
|
27
|
+
* const ua = getNpmConfigUserAgent()
|
|
28
|
+
* // e.g. 'pnpm/9.0.0 npm/? node/v20.0.0 darwin arm64'
|
|
29
|
+
* ```
|
|
10
30
|
*/
|
|
11
31
|
/*@__NO_SIDE_EFFECTS__*/
|
|
12
32
|
export declare function getNpmConfigUserAgent(): string | undefined;
|
|
13
33
|
/**
|
|
14
34
|
* npm_lifecycle_event environment variable.
|
|
15
35
|
* The name of the npm lifecycle event that's currently running.
|
|
36
|
+
*
|
|
37
|
+
* @returns The current lifecycle event name, or `undefined` if not set
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { getNpmLifecycleEvent } from '@socketsecurity/lib/env/npm'
|
|
42
|
+
*
|
|
43
|
+
* const event = getNpmLifecycleEvent()
|
|
44
|
+
* // e.g. 'install', 'postinstall', or 'test'
|
|
45
|
+
* ```
|
|
16
46
|
*/
|
|
17
47
|
/*@__NO_SIDE_EFFECTS__*/
|
|
18
48
|
export declare function getNpmLifecycleEvent(): string | undefined;
|
|
19
49
|
/**
|
|
20
50
|
* NPM_REGISTRY environment variable.
|
|
21
51
|
* NPM registry URL override.
|
|
52
|
+
*
|
|
53
|
+
* @returns The NPM registry URL override, or `undefined` if not set
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import { getNpmRegistry } from '@socketsecurity/lib/env/npm'
|
|
58
|
+
*
|
|
59
|
+
* const registry = getNpmRegistry()
|
|
60
|
+
* // e.g. 'https://registry.npmjs.org/' or undefined
|
|
61
|
+
* ```
|
|
22
62
|
*/
|
|
23
63
|
/*@__NO_SIDE_EFFECTS__*/
|
|
24
64
|
export declare function getNpmRegistry(): string | undefined;
|
|
25
65
|
/**
|
|
26
66
|
* NPM_TOKEN environment variable.
|
|
27
67
|
* Authentication token for NPM registry access.
|
|
68
|
+
*
|
|
69
|
+
* @returns The NPM auth token, or `undefined` if not set
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* import { getNpmToken } from '@socketsecurity/lib/env/npm'
|
|
74
|
+
*
|
|
75
|
+
* const token = getNpmToken()
|
|
76
|
+
* // e.g. 'npm_abc123...' or undefined
|
|
77
|
+
* ```
|
|
28
78
|
*/
|
|
29
79
|
/*@__NO_SIDE_EFFECTS__*/
|
|
30
80
|
export declare function getNpmToken(): string | undefined;
|
package/dist/env/path.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value of the PATH environment variable.
|
|
3
|
+
*
|
|
4
|
+
* @returns The system executable search paths, or `undefined` if not set
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { getPath } from '@socketsecurity/lib/env/path'
|
|
9
|
+
*
|
|
10
|
+
* const path = getPath()
|
|
11
|
+
* // e.g. '/usr/local/bin:/usr/bin:/bin' or undefined
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
/*@__NO_SIDE_EFFECTS__*/
|
|
2
15
|
export declare function getPath(): string | undefined;
|
package/dist/env/pre-commit.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns whether the PRE_COMMIT environment variable is set to a truthy value.
|
|
3
|
+
*
|
|
4
|
+
* @returns `true` if running in a pre-commit hook, `false` otherwise
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { getPreCommit } from '@socketsecurity/lib/env/pre-commit'
|
|
9
|
+
*
|
|
10
|
+
* if (getPreCommit()) {
|
|
11
|
+
* console.log('Running in pre-commit hook')
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
1
15
|
/*@__NO_SIDE_EFFECTS__*/
|
|
2
16
|
export declare function getPreCommit(): boolean;
|
package/dist/env/rewire.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Clear a specific environment variable override.
|
|
3
|
+
*
|
|
4
|
+
* @param key - The environment variable name to clear
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { setEnv, clearEnv } from '@socketsecurity/lib/env/rewire'
|
|
9
|
+
*
|
|
10
|
+
* setEnv('CI', '1')
|
|
11
|
+
* clearEnv('CI')
|
|
12
|
+
* ```
|
|
3
13
|
*/
|
|
4
14
|
export declare function clearEnv(key: string): void;
|
|
5
15
|
/**
|
|
@@ -11,10 +21,30 @@ export declare function clearEnv(key: string): void;
|
|
|
11
21
|
* 3. process.env (including vi.stubEnv modifications)
|
|
12
22
|
*
|
|
13
23
|
* @internal Used by env getters to support test rewiring
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { getEnvValue } from '@socketsecurity/lib/env/rewire'
|
|
28
|
+
*
|
|
29
|
+
* const value = getEnvValue('NODE_ENV')
|
|
30
|
+
* // e.g. 'production' or undefined
|
|
31
|
+
* ```
|
|
14
32
|
*/
|
|
15
33
|
export declare function getEnvValue(key: string): string | undefined;
|
|
16
34
|
/**
|
|
17
35
|
* Check if an environment variable has been overridden.
|
|
36
|
+
*
|
|
37
|
+
* @param key - The environment variable name to check
|
|
38
|
+
* @returns `true` if the variable has been overridden, `false` otherwise
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { setEnv, hasOverride } from '@socketsecurity/lib/env/rewire'
|
|
43
|
+
*
|
|
44
|
+
* hasOverride('CI') // false
|
|
45
|
+
* setEnv('CI', '1')
|
|
46
|
+
* hasOverride('CI') // true
|
|
47
|
+
* ```
|
|
18
48
|
*/
|
|
19
49
|
export declare function hasOverride(key: string): boolean;
|
|
20
50
|
/**
|
|
@@ -26,6 +56,14 @@ export declare function hasOverride(key: string): boolean;
|
|
|
26
56
|
* 3. process.env (including vi.stubEnv modifications)
|
|
27
57
|
*
|
|
28
58
|
* @internal Used by env getters to check for key presence (not value truthiness)
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* import { isInEnv } from '@socketsecurity/lib/env/rewire'
|
|
63
|
+
*
|
|
64
|
+
* isInEnv('PATH') // true (usually set)
|
|
65
|
+
* isInEnv('MISSING') // false
|
|
66
|
+
* ```
|
|
29
67
|
*/
|
|
30
68
|
export declare function isInEnv(key: string): boolean;
|
|
31
69
|
/**
|
package/dist/env/shell.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value of the SHELL environment variable.
|
|
3
|
+
*
|
|
4
|
+
* @returns The user's default shell path, or `undefined` if not set
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { getShell } from '@socketsecurity/lib/env/shell'
|
|
9
|
+
*
|
|
10
|
+
* const shell = getShell()
|
|
11
|
+
* // e.g. '/bin/zsh' or '/bin/bash'
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
/*@__NO_SIDE_EFFECTS__*/
|
|
2
15
|
export declare function getShell(): string | undefined;
|
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
* Controls Socket CLI shadow mode risk acceptance.
|
|
3
3
|
*
|
|
4
4
|
* @returns Whether to accept all risks in shadow mode
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { getSocketCliShadowAcceptRisks } from '@socketsecurity/lib/env/socket-cli-shadow'
|
|
9
|
+
*
|
|
10
|
+
* if (getSocketCliShadowAcceptRisks()) {
|
|
11
|
+
* console.log('Shadow mode risks accepted')
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
5
14
|
*/
|
|
6
15
|
/*@__NO_SIDE_EFFECTS__*/
|
|
7
16
|
export declare function getSocketCliShadowAcceptRisks(): boolean;
|
|
@@ -9,6 +18,14 @@ export declare function getSocketCliShadowAcceptRisks(): boolean;
|
|
|
9
18
|
* API token for Socket CLI shadow mode.
|
|
10
19
|
*
|
|
11
20
|
* @returns Shadow mode API token or undefined
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { getSocketCliShadowApiToken } from '@socketsecurity/lib/env/socket-cli-shadow'
|
|
25
|
+
*
|
|
26
|
+
* const token = getSocketCliShadowApiToken()
|
|
27
|
+
* // e.g. 'sk_shadow_abc123...' or undefined
|
|
28
|
+
* ```
|
|
12
29
|
*/
|
|
13
30
|
/*@__NO_SIDE_EFFECTS__*/
|
|
14
31
|
export declare function getSocketCliShadowApiToken(): string | undefined;
|
|
@@ -16,6 +33,14 @@ export declare function getSocketCliShadowApiToken(): string | undefined;
|
|
|
16
33
|
* Binary path for Socket CLI shadow mode.
|
|
17
34
|
*
|
|
18
35
|
* @returns Shadow mode binary path or undefined
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { getSocketCliShadowBin } from '@socketsecurity/lib/env/socket-cli-shadow'
|
|
40
|
+
*
|
|
41
|
+
* const bin = getSocketCliShadowBin()
|
|
42
|
+
* // e.g. '/usr/local/bin/socket-shadow' or undefined
|
|
43
|
+
* ```
|
|
19
44
|
*/
|
|
20
45
|
/*@__NO_SIDE_EFFECTS__*/
|
|
21
46
|
export declare function getSocketCliShadowBin(): string | undefined;
|
|
@@ -23,6 +48,15 @@ export declare function getSocketCliShadowBin(): string | undefined;
|
|
|
23
48
|
* Controls Socket CLI shadow mode progress display.
|
|
24
49
|
*
|
|
25
50
|
* @returns Whether to show progress in shadow mode
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* import { getSocketCliShadowProgress } from '@socketsecurity/lib/env/socket-cli-shadow'
|
|
55
|
+
*
|
|
56
|
+
* if (getSocketCliShadowProgress()) {
|
|
57
|
+
* console.log('Shadow mode progress enabled')
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
26
60
|
*/
|
|
27
61
|
/*@__NO_SIDE_EFFECTS__*/
|
|
28
62
|
export declare function getSocketCliShadowProgress(): boolean;
|
|
@@ -30,6 +64,15 @@ export declare function getSocketCliShadowProgress(): boolean;
|
|
|
30
64
|
* Controls Socket CLI shadow mode silent operation.
|
|
31
65
|
*
|
|
32
66
|
* @returns Whether shadow mode should operate silently
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* import { getSocketCliShadowSilent } from '@socketsecurity/lib/env/socket-cli-shadow'
|
|
71
|
+
*
|
|
72
|
+
* if (getSocketCliShadowSilent()) {
|
|
73
|
+
* console.log('Shadow mode is silent')
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
33
76
|
*/
|
|
34
77
|
/*@__NO_SIDE_EFFECTS__*/
|
|
35
78
|
export declare function getSocketCliShadowSilent(): boolean;
|