@@ -4,6 +4,28 @@ import path from 'node:path'
44import { envAsBoolean } from '@socketsecurity/registry/lib/env'
55import registryConstants from '@socketsecurity/registry/lib/constants'
66
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+
729const {
830 kInternalsSymbol,
931 PACKAGE_JSON ,
@@ -21,7 +43,7 @@ const SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues'
2143const UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE =
2244 'UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE'
2345
24- const ENV = Object . freeze ( {
46+ const ENV : Constants [ 'ENV' ] = Object . freeze ( {
2547 ...registryConstants . ENV ,
2648 // Flag set by the optimize command to bypass the packagesHaveRiskyIssues check.
2749 [ UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE ] : envAsBoolean (
@@ -43,25 +65,7 @@ const LAZY_DIST_TYPE = () =>
4365
4466const lazyDistPath = ( ) => path . join ( rootDistPath , constants . DIST_TYPE )
4567
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 (
6569 {
6670 API_V0_URL ,
6771 ENV ,
0 commit comments