Skip to content

Commit 92e18e0

Browse files
committed
Move MODULE_SYNC and REQUIRE to src/constants.ts
1 parent 967118d commit 92e18e0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/constants.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ type Constants = {
1818
}
1919
readonly DIST_TYPE: 'module-sync' | 'require'
2020
readonly LOCK_EXT: '.lock'
21+
readonly MODULE_SYNC: 'module-sync'
2122
readonly NPM_REGISTRY_URL: 'https://registry.npmjs.org'
2223
readonly NPX: 'npx'
2324
readonly PNPM: 'pnpm'
25+
readonly REQUIRE: 'require'
2426
readonly SOCKET_CLI_DEBUG: 'SOCKET_CLI_DEBUG'
2527
readonly SOCKET_CLI_FIX_PACKAGE_LOCK_FILE: 'SOCKET_CLI_FIX_PACKAGE_LOCK_FILE'
2628
readonly SOCKET_CLI_ISSUES_URL: 'https://github.com/SocketDev/socket-cli/issues'
@@ -52,9 +54,11 @@ const BABEL_RUNTIME = '@babel/runtime'
5254
const BINARY_LOCK_EXT = '.lockb'
5355
const BUN = 'bun'
5456
const LOCK_EXT = '.lock'
57+
const MODULE_SYNC = 'module-sync'
5558
const NPM_REGISTRY_URL = 'https://registry.npmjs.org'
5659
const NPX = 'npx'
5760
const PNPM = 'pnpm'
61+
const REQUIRE = 'require'
5862
const SOCKET_CLI_DEBUG = 'SOCKET_CLI_DEBUG'
5963
const SOCKET_CLI_FIX_PACKAGE_LOCK_FILE = 'SOCKET_CLI_FIX_PACKAGE_LOCK_FILE'
6064
const SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues'
@@ -65,7 +69,7 @@ const YARN_BERRY = 'yarn/berry'
6569
const YARN_CLASSIC = 'yarn/classic'
6670

6771
const LAZY_DIST_TYPE = () =>
68-
registryConstants.SUPPORTS_NODE_REQUIRE_MODULE ? 'module-sync' : 'require'
72+
registryConstants.SUPPORTS_NODE_REQUIRE_MODULE ? MODULE_SYNC : REQUIRE
6973

7074
const LAZY_ENV = () =>
7175
Object.freeze({
@@ -132,9 +136,11 @@ const constants = <Constants>createConstantsObject(
132136
// Lazily defined values are initialized as `undefined` to keep their key order.
133137
DIST_TYPE: undefined,
134138
LOCK_EXT,
139+
MODULE_SYNC,
135140
NPM_REGISTRY_URL,
136141
NPX,
137142
PNPM,
143+
REQUIRE,
138144
SOCKET_CLI_DEBUG,
139145
SOCKET_CLI_FIX_PACKAGE_LOCK_FILE,
140146
SOCKET_CLI_ISSUES_URL,

0 commit comments

Comments
 (0)