@@ -5,24 +5,50 @@ import process from 'node:process'
55import registryConstants from '@socketsecurity/registry/lib/constants'
66import { envAsBoolean } from '@socketsecurity/registry/lib/env'
77
8+ const {
9+ PACKAGE_JSON ,
10+ kInternalsSymbol,
11+ [ kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)' ] : {
12+ createConstantsObject
13+ }
14+ } = registryConstants
15+
816type RegistryEnv = typeof registryConstants . ENV
917
10- type IPCObject = {
18+ type RegistryInternals = ( typeof registryConstants ) [ 'Symbol(kInternalsSymbol)' ]
19+
20+ type Internals = Omit < RegistryInternals , 'getIPC' > &
21+ Readonly < {
22+ getIPC : {
23+ ( ) : Promise < IPC >
24+ < K extends keyof IPC | undefined > (
25+ key ?: K
26+ ) : Promise < K extends keyof IPC ? IPC [ K ] : IPC >
27+ }
28+ } >
29+
30+ type ENV = RegistryEnv &
31+ Readonly < {
32+ SOCKET_CLI_DEBUG : boolean
33+ } >
34+
35+ type IPC = Readonly < {
1136 SOCKET_CLI_FIX_PACKAGE_LOCK_FILE : boolean
1237 SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE : boolean
13- [ key : string ] : any
14- }
38+ } >
1539
16- type Constants = {
40+ type Constants = Omit <
41+ typeof registryConstants ,
42+ 'Symbol(kInternalsSymbol)' | 'ENV' | 'IPC'
43+ > & {
44+ readonly 'Symbol(kInternalsSymbol)' : Internals
1745 readonly API_V0_URL : 'https://api.socket.dev/v0'
1846 readonly BABEL_RUNTIME : '@babel/runtime'
1947 readonly BINARY_LOCK_EXT : '.lockb'
2048 readonly BUN : 'bun'
21- readonly ENV : RegistryEnv & {
22- SOCKET_CLI_DEBUG : boolean
23- }
49+ readonly ENV : ENV
2450 readonly DIST_TYPE : 'module-sync' | 'require'
25- readonly IPC : IPCObject
51+ readonly IPC : IPC
2652 readonly LOCK_EXT : '.lock'
2753 readonly MODULE_SYNC : 'module-sync'
2854 readonly NPM_REGISTRY_URL : 'https://registry.npmjs.org'
@@ -46,15 +72,7 @@ type Constants = {
4672 readonly rootPkgJsonPath : string
4773 readonly shadowBinPath : string
4874 readonly synpBinPath : string
49- } & typeof registryConstants
50-
51- const {
52- PACKAGE_JSON ,
53- kInternalsSymbol,
54- [ kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)' ] : {
55- createConstantsObject
56- }
57- } = registryConstants
75+ }
5876
5977const API_V0_URL = 'https://api.socket.dev/v0'
6078const BABEL_RUNTIME = '@babel/runtime'
0 commit comments