@@ -4,6 +4,28 @@ import path from 'node:path'
4
4
import { envAsBoolean } from '@socketsecurity/registry/lib/env'
5
5
import registryConstants from '@socketsecurity/registry/lib/constants'
6
6
7
+ type RegistryEnv = typeof registryConstants . ENV
8
+
9
+ type Constants = {
10
+ readonly API_V0_URL : 'https://api.socket.dev/v0'
11
+ readonly ENV : RegistryEnv & {
12
+ UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE : boolean
13
+ }
14
+ readonly DIST_TYPE : 'module-sync' | 'require'
15
+ readonly NPM_REGISTRY_URL : 'https://registry.npmjs.org'
16
+ readonly SOCKET_CLI_ISSUES_URL : 'https://github.com/SocketDev/socket-cli/issues'
17
+ readonly UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE : 'UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE'
18
+ readonly cdxgenBinPath : string
19
+ readonly distPath : string
20
+ readonly nmBinPath : string
21
+ readonly rootBinPath : string
22
+ readonly rootDistPath : string
23
+ readonly rootPath : string
24
+ readonly rootPkgJsonPath : string
25
+ readonly shadowBinPath : string
26
+ readonly synpBinPath : string
27
+ } & typeof registryConstants
28
+
7
29
const {
8
30
kInternalsSymbol,
9
31
PACKAGE_JSON ,
@@ -21,7 +43,7 @@ const SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues'
21
43
const UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE =
22
44
'UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE'
23
45
24
- const ENV = Object . freeze ( {
46
+ const ENV : Constants [ 'ENV' ] = Object . freeze ( {
25
47
...registryConstants . ENV ,
26
48
// Flag set by the optimize command to bypass the packagesHaveRiskyIssues check.
27
49
[ UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE ] : envAsBoolean (
@@ -43,25 +65,7 @@ const LAZY_DIST_TYPE = () =>
43
65
44
66
const lazyDistPath = ( ) => path . join ( rootDistPath , constants . DIST_TYPE )
45
67
46
- const constants = <
47
- {
48
- readonly API_V0_URL : 'https://api.socket.dev/v0'
49
- readonly ENV : typeof ENV
50
- readonly DIST_TYPE : 'module-sync' | 'require'
51
- readonly NPM_REGISTRY_URL : 'https://registry.npmjs.org'
52
- readonly SOCKET_CLI_ISSUES_URL : 'https://github.com/SocketDev/socket-cli/issues'
53
- readonly UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE : 'UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE'
54
- readonly cdxgenBinPath : string
55
- readonly distPath : string
56
- readonly nmBinPath : string
57
- readonly rootBinPath : string
58
- readonly rootDistPath : string
59
- readonly rootPath : string
60
- readonly rootPkgJsonPath : string
61
- readonly shadowBinPath : string
62
- readonly synpBinPath : string
63
- } & typeof registryConstants
64
- > createConstantsObject (
68
+ const constants = < Constants > createConstantsObject (
65
69
{
66
70
API_V0_URL ,
67
71
ENV ,
0 commit comments