@socketsecurity/cli-with-sentry 1.1.14 → 1.1.17

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cli.js +114 -32
  3. package/dist/cli.js.map +1 -1
  4. package/dist/constants.js +35 -37
  5. package/dist/constants.js.map +1 -1
  6. package/dist/shadow-npm-bin.js +6 -6
  7. package/dist/shadow-npm-bin.js.map +1 -1
  8. package/dist/shadow-pnpm-bin.js +3 -5
  9. package/dist/shadow-pnpm-bin.js.map +1 -1
  10. package/dist/shadow-yarn-bin.js +2 -2
  11. package/dist/shadow-yarn-bin.js.map +1 -1
  12. package/dist/tsconfig.dts.tsbuildinfo +1 -1
  13. package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
  14. package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
  15. package/dist/types/commands/fix/env-helpers.d.mts +13 -0
  16. package/dist/types/commands/fix/env-helpers.d.mts.map +1 -1
  17. package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
  18. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +1 -1
  19. package/dist/types/commands/manifest/run-cdxgen.d.mts.map +1 -1
  20. package/dist/types/commands/optimize/apply-optimization.d.mts.map +1 -1
  21. package/dist/types/commands/optimize/update-lockfile.d.mts.map +1 -1
  22. package/dist/types/commands/package/fetch-purls-shallow-score.d.mts.map +1 -1
  23. package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -1
  24. package/dist/types/commands/patch/handle-patch.d.mts.map +1 -1
  25. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts.map +1 -1
  26. package/dist/types/commands/yarn/cmd-yarn.d.mts +1 -1
  27. package/dist/types/commands/yarn/cmd-yarn.d.mts.map +1 -1
  28. package/dist/types/constants.d.mts +15 -19
  29. package/dist/types/constants.d.mts.map +1 -1
  30. package/dist/types/shadow/pnpm/bin.d.mts.map +1 -1
  31. package/dist/types/utils/agent.d.mts.map +1 -1
  32. package/dist/types/utils/api.d.mts.map +1 -1
  33. package/dist/types/utils/dlx.d.mts.map +1 -1
  34. package/dist/types/utils/package-environment.d.mts.map +1 -1
  35. package/dist/types/utils/path-resolve.d.mts.map +1 -1
  36. package/dist/utils.js +70 -29
  37. package/dist/utils.js.map +1 -1
  38. package/dist/vendor.js +514 -517
  39. package/external/@socketsecurity/registry/external/@inquirer/confirm.js +45 -205
  40. package/external/@socketsecurity/registry/external/@inquirer/input.js +45 -205
  41. package/external/@socketsecurity/registry/external/@inquirer/password.js +181 -205
  42. package/external/@socketsecurity/registry/external/@inquirer/search.js +47 -207
  43. package/external/@socketsecurity/registry/external/@inquirer/select.js +183 -207
  44. package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +388 -2280
  45. package/external/@socketsecurity/registry/external/browserslist.js +11534 -567
  46. package/external/@socketsecurity/registry/external/cacache.js +2575 -4914
  47. package/external/@socketsecurity/registry/external/libnpmpack.js +64667 -166061
  48. package/external/@socketsecurity/registry/external/make-fetch-happen.js +384 -4044
  49. package/external/@socketsecurity/registry/external/normalize-package-data.js +30 -278
  50. package/external/@socketsecurity/registry/external/npm-package-arg.js +28 -9
  51. package/external/@socketsecurity/registry/external/pacote.js +46680 -66482
  52. package/external/@socketsecurity/registry/external/spdx-correct.js +19 -0
  53. package/external/@socketsecurity/registry/external/spdx-expression-parse.js +19 -0
  54. package/external/@socketsecurity/registry/lib/agent.js +390 -0
  55. package/external/@socketsecurity/registry/lib/arrays.js +31 -0
  56. package/external/@socketsecurity/registry/lib/bin.js +650 -0
  57. package/external/@socketsecurity/registry/lib/constants/bun-lock.js +3 -0
  58. package/external/@socketsecurity/registry/lib/constants/bun-lockb.js +3 -0
  59. package/external/@socketsecurity/registry/lib/constants/bun.js +3 -0
  60. package/external/@socketsecurity/registry/lib/constants/dot-git-dir.js +3 -0
  61. package/external/@socketsecurity/registry/lib/constants/dot-socket-dir.js +3 -0
  62. package/external/@socketsecurity/registry/lib/constants/empty-value.js +3 -0
  63. package/external/@socketsecurity/registry/lib/constants/env.js +17 -3
  64. package/external/@socketsecurity/registry/lib/constants/ext-yaml.js +3 -0
  65. package/external/@socketsecurity/registry/lib/constants/ext-yml.js +3 -0
  66. package/external/@socketsecurity/registry/lib/constants/index.js +20 -11
  67. package/external/@socketsecurity/registry/lib/constants/npm-exec-path.js +2 -2
  68. package/external/@socketsecurity/registry/lib/constants/npm-real-exec-path.js +1 -1
  69. package/external/@socketsecurity/registry/lib/constants/npm-shrinkwrap-json.js +3 -0
  70. package/external/@socketsecurity/registry/lib/constants/pnpm-exec-path.js +5 -0
  71. package/external/@socketsecurity/registry/lib/constants/pnpm-lock-yaml.js +3 -0
  72. package/external/@socketsecurity/registry/lib/constants/unknown-error.js +3 -0
  73. package/external/@socketsecurity/registry/lib/constants/unknown-value.js +3 -0
  74. package/external/@socketsecurity/registry/lib/constants/vlt-lock-json.js +3 -0
  75. package/external/@socketsecurity/registry/lib/constants/vlt.js +3 -0
  76. package/external/@socketsecurity/registry/lib/constants/yarn-berry.js +3 -0
  77. package/external/@socketsecurity/registry/lib/constants/yarn-classic.js +3 -0
  78. package/external/@socketsecurity/registry/lib/constants/yarn-exec-path.js +5 -0
  79. package/external/@socketsecurity/registry/lib/constants/yarn.js +3 -0
  80. package/external/@socketsecurity/registry/lib/debug.js +53 -0
  81. package/external/@socketsecurity/registry/lib/env.js +18 -0
  82. package/external/@socketsecurity/registry/lib/fs.js +218 -2
  83. package/external/@socketsecurity/registry/lib/functions.js +5 -0
  84. package/external/@socketsecurity/registry/lib/globs.js +22 -1
  85. package/external/@socketsecurity/registry/lib/json.js +16 -0
  86. package/external/@socketsecurity/registry/lib/logger.js +157 -0
  87. package/external/@socketsecurity/registry/lib/objects.js +103 -0
  88. package/external/@socketsecurity/registry/lib/packages.js +88 -0
  89. package/external/@socketsecurity/registry/lib/path.js +51 -1
  90. package/external/@socketsecurity/registry/lib/promises.js +55 -0
  91. package/external/@socketsecurity/registry/lib/regexps.js +5 -0
  92. package/external/@socketsecurity/registry/lib/sorts.js +17 -0
  93. package/external/@socketsecurity/registry/lib/spawn.js +105 -7
  94. package/external/@socketsecurity/registry/lib/streams.js +26 -0
  95. package/external/@socketsecurity/registry/lib/strings.js +123 -9
  96. package/external/@socketsecurity/registry/lib/url.js +21 -0
  97. package/external/@socketsecurity/registry/lib/words.js +16 -0
  98. package/external/@socketsecurity/registry/manifest.json +5 -4
  99. package/package.json +5 -4
  100. package/external/@socketsecurity/registry/external/ansi-regex.js +0 -13
  101. package/external/@socketsecurity/registry/lib/constants/node-workspaces.js +0 -3
  102. package/external/@socketsecurity/registry/lib/constants/parse-args-config.js +0 -14
  103. package/external/@socketsecurity/registry/lib/constants/skip-tests-by-ecosystem.js +0 -43
  104. package/external/@socketsecurity/registry/lib/constants/template-cjs-browser.js +0 -3
  105. package/external/@socketsecurity/registry/lib/constants/template-cjs-esm.js +0 -3
  106. package/external/@socketsecurity/registry/lib/constants/template-cjs.js +0 -3
  107. package/external/@socketsecurity/registry/lib/constants/template-es-shim-constructor.js +0 -3
  108. package/external/@socketsecurity/registry/lib/constants/template-es-shim-prototype-method.js +0 -3
  109. package/external/@socketsecurity/registry/lib/constants/template-es-shim-static-method.js +0 -3
  110. package/external/@socketsecurity/registry/lib/constants/win32-ensure-tests-by-ecosystem.js +0 -3
  111. package/external/@socketsecurity/registry/lib/npm.js +0 -404
  112. /package/external/@socketsecurity/registry/lib/constants/{hidden-package-lock-json.js → dot-package-lock-json.js} +0 -0
@@ -1,15 +1,18 @@
1
1
  'use strict'
2
2
 
3
3
  const { freeze: ObjectFreeze, hasOwn: ObjectHasOwn } = Object
4
+ const { env } = process
4
5
 
5
6
  const { envAsBoolean, envAsString } = /*@__PURE__*/ require('../env')
6
-
7
- const { env } = process
7
+ const WIN32 = /*@__PURE__*/ require('./win32')
8
8
 
9
9
  const DEBUG = envAsString(env.DEBUG)
10
+ const HOME = envAsString(env.HOME)
10
11
 
11
12
  module.exports = ObjectFreeze({
12
13
  __proto__: null,
14
+ // Windows-specific AppData folder for application data.
15
+ APPDATA: envAsString(env.APPDATA),
13
16
  // CI is always set to 'true' in a GitHub action.
14
17
  // https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables
15
18
  // Libraries like yocto-colors check for CI not by value but my existence,
@@ -18,6 +21,12 @@ module.exports = ObjectFreeze({
18
21
  // Enable debug logging based on the 'debug' package.
19
22
  // https://socket.dev/npm/package/debug/overview/4.4.1
20
23
  DEBUG,
24
+ // User home directory.
25
+ HOME,
26
+ // The absolute location of the %localappdata% folder on Windows used to store
27
+ // user-specific, non-roaming application data, like temporary files, cached
28
+ // data, and program settings, that are specific to the current machine and user.
29
+ LOCALAPPDATA: envAsString(env.LOCALAPPDATA),
21
30
  // Set the debug log level (notice, error, warn, info, verbose, http, silly).
22
31
  LOG_LEVEL: envAsString(env.LOG_LEVEL),
23
32
  // .github/workflows/provenance.yml defines this.
@@ -41,5 +50,10 @@ module.exports = ObjectFreeze({
41
50
  SOCKET_CLI_DEBUG: !!DEBUG || envAsBoolean(env.SOCKET_CLI_DEBUG),
42
51
  // VITEST=true is set by the Vitest test runner.
43
52
  // https://vitest.dev/config/#configuring-vitest
44
- VITEST: envAsBoolean(env.VITEST)
53
+ VITEST: envAsBoolean(env.VITEST),
54
+ // The location of the base directory on Linux and MacOS used to store
55
+ // user-specific data files, defaulting to $HOME/.local/share if not set or empty.
56
+ XDG_DATA_HOME: WIN32
57
+ ? ''
58
+ : envAsString(env['XDG_DATA_HOME']) || (HOME ? `${HOME}/.local/share` : '')
45
59
  })
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = '.yaml'
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = '.yml'
@@ -8,10 +8,17 @@ const props = {
8
8
  // Lazily defined values are initialized as `undefined` to keep their key order.
9
9
  AT_LATEST: '@latest',
10
10
  BIOME_JSON: 'biome.json',
11
+ BUN: 'bun',
12
+ BUN_LOCK: 'bun.lock',
13
+ BUN_LOCKB: 'bun.lockb',
11
14
  CI: 'CI',
12
15
  COLUMN_LIMIT: 80,
13
16
  DARWIN: undefined,
17
+ DOT_GIT_DIR: '.git',
18
+ DOT_PACKAGE_LOCK_JSON: '.package-lock.json',
19
+ DOT_SOCKET_DIR: '.socket',
14
20
  EMPTY_FILE: '/* empty */\n',
21
+ EMPTY_VALUE: '<value>',
15
22
  ENV: undefined,
16
23
  ESLINT_CONFIG_JS: 'eslint.config.js',
17
24
  ESNEXT: 'esnext',
@@ -27,10 +34,11 @@ const props = {
27
34
  EXT_MJS: '.mjs',
28
35
  EXT_MTS: '.mts',
29
36
  EXT_PS1: '.ps1',
37
+ EXT_YAML: '.yaml',
38
+ EXT_YML: '.yml',
30
39
  EXTENSIONS: 'extensions',
31
40
  EXTENSIONS_JSON: 'extensions.json',
32
41
  GITIGNORE: '.gitignore',
33
- HIDDEN_PACKAGE_LOCK_JSON: '.package-lock.json',
34
42
  LATEST: 'latest',
35
43
  LICENSE: 'LICENSE',
36
44
  LICENSE_GLOB: 'LICEN[CS]E{[.-]*,}',
@@ -45,9 +53,9 @@ const props = {
45
53
  NODE_ENV: 'NODE_ENV',
46
54
  NODE_MODULES: 'node_modules',
47
55
  NODE_MODULES_GLOB_RECURSIVE: '**/node_modules',
48
- NODE_WORKSPACES: 'node_workspaces',
49
56
  NODE_VERSION: undefined,
50
57
  NPM: 'npm',
58
+ NPM_SHRINKWRAP_JSON: 'npm-shrinkwrap.json',
51
59
  NPX: 'npx',
52
60
  OVERRIDES: 'overrides',
53
61
  PACKAGE_DEFAULT_SOCKET_CATEGORIES: undefined,
@@ -56,6 +64,7 @@ const props = {
56
64
  PACKAGE_JSON: 'package.json',
57
65
  PACKAGE_LOCK_JSON: 'package-lock.json',
58
66
  PNPM: 'pnpm',
67
+ PNPM_LOCK_YAML: 'pnpm-lock.yaml',
59
68
  PRE_COMMIT: 'PRE_COMMIT',
60
69
  README_GLOB: 'README{.*,}',
61
70
  README_GLOB_RECURSIVE: '**/README{.*,}',
@@ -80,19 +89,20 @@ const props = {
80
89
  SUPPORTS_NODE_REQUIRE_MODULE: undefined,
81
90
  SUPPORTS_NODE_RUN: undefined,
82
91
  SUPPORTS_PROCESS_SEND: undefined,
83
- TEMPLATE_CJS: 'cjs',
84
- TEMPLATE_CJS_BROWSER: 'cjs-browser',
85
- TEMPLATE_CJS_ESM: 'cjs-esm',
86
- TEMPLATE_ES_SHIM_CONSTRUCTOR: 'es-shim-constructor',
87
- TEMPLATE_ES_SHIM_PROTOTYPE_METHOD: 'es-shim-prototype-method',
88
- TEMPLATE_ES_SHIM_STATIC_METHOD: 'es-shim-static-method',
89
92
  TSCONFIG_JSON: 'tsconfig.json',
90
93
  UNDEFINED_TOKEN: undefined,
94
+ UNKNOWN_ERROR: 'Unknown error',
95
+ UNKNOWN_VALUE: '<unknown>',
91
96
  UNLICENCED: 'UNLICENCED',
92
97
  UNLICENSED: 'UNLICENSED',
93
98
  UTF8: 'utf8',
94
99
  VITEST: 'VITEST',
100
+ VLT: 'vlt',
101
+ VLT_LOCK_JSON: 'vlt-lock.json',
95
102
  WIN32: undefined,
103
+ YARN: 'yarn',
104
+ YARN_BERRY: 'yarn/berry',
105
+ YARN_CLASSIC: 'yarn/classic',
96
106
  YARN_LOCK: 'yarn.lock',
97
107
  abortController: undefined,
98
108
  abortSignal: undefined,
@@ -107,14 +117,13 @@ const props = {
107
117
  npmExecPath: undefined,
108
118
  npmRealExecPath: undefined,
109
119
  packageExtensions: undefined,
120
+ pnpmExecPath: undefined,
110
121
  packumentCache: undefined,
111
122
  pacoteCachePath: undefined,
112
- parseArgsConfig: undefined,
113
- skipTestsByEcosystem: undefined,
114
123
  spinner: undefined,
115
124
  tsLibsAvailable: undefined,
116
125
  tsTypesAvailable: undefined,
117
- win32EnsureTestsByEcosystem: undefined
126
+ yarnExecPath: undefined
118
127
  }
119
128
 
120
129
  module.exports = createConstantsObject(props, {
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
2
 
3
- const which = /*@__PURE__*/ require('../../external/which')
3
+ const { findRealNpm } = /*@__PURE__*/ require('../bin')
4
4
 
5
- module.exports = which.sync('npm')
5
+ module.exports = findRealNpm()
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
3
  const npmExecPath = /*@__PURE__*/ require('./npm-exec-path')
4
- const { resolveBinPathSync } = /*@__PURE__*/ require('../npm')
4
+ const { resolveBinPathSync } = /*@__PURE__*/ require('../agent')
5
5
 
6
6
  module.exports = resolveBinPathSync(npmExecPath)
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = 'npm-shrinkwrap.json'
@@ -0,0 +1,5 @@
1
+ 'use strict'
2
+
3
+ const { findRealPnpm } = /*@__PURE__*/ require('../bin')
4
+
5
+ module.exports = findRealPnpm()
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = 'pnpm-lock.yaml'
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = 'Unknown error'
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = '<unknown>'
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = 'vlt-lock.json'
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = 'vlt'
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = 'yarn/berry'
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = 'yarn/classic'
@@ -0,0 +1,5 @@
1
+ 'use strict'
2
+
3
+ const { findRealYarn } = /*@__PURE__*/ require('../bin')
4
+
5
+ module.exports = findRealYarn()
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = 'yarn'
@@ -6,6 +6,11 @@ const { hasOwn } = /*@__PURE__*/ require('./objects')
6
6
  const { applyLinePrefix } = /*@__PURE__*/ require('./strings')
7
7
 
8
8
  let _debugJs
9
+ /**
10
+ * Lazily load the debug module.
11
+ * @returns {Function} The debug module.
12
+ * @private
13
+ */
9
14
  /*@__NO_SIDE_EFFECTS__*/
10
15
  function getDebugJs() {
11
16
  if (_debugJs === undefined) {
@@ -17,6 +22,12 @@ function getDebugJs() {
17
22
  }
18
23
 
19
24
  const debugByNamespace = new Map()
25
+ /**
26
+ * Get or create a debug instance for a namespace.
27
+ * @param {string} namespace - The debug namespace.
28
+ * @returns {Function} The debug instance.
29
+ * @private
30
+ */
20
31
  /*@__NO_SIDE_EFFECTS__*/
21
32
  function getDebugJsInstance(namespace) {
22
33
  let inst = debugByNamespace.get(namespace)
@@ -39,6 +50,11 @@ function getDebugJsInstance(namespace) {
39
50
  }
40
51
 
41
52
  let _util
53
+ /**
54
+ * Lazily load the util module.
55
+ * @returns {import('util')} The Node.js util module.
56
+ * @private
57
+ */
42
58
  /*@__NO_SIDE_EFFECTS__*/
43
59
  function getUtil() {
44
60
  if (_util === undefined) {
@@ -49,6 +65,10 @@ function getUtil() {
49
65
  return _util
50
66
  }
51
67
 
68
+ /**
69
+ * Custom log function for debug output.
70
+ * @private
71
+ */
52
72
  /*@__NO_SIDE_EFFECTS__*/
53
73
  function customLog() {
54
74
  const { logger } = /*@__PURE__*/ require('./logger')
@@ -59,6 +79,12 @@ function customLog() {
59
79
  ])
60
80
  }
61
81
 
82
+ /**
83
+ * Extract options from namespaces parameter.
84
+ * @param {string | Object} namespaces - Namespaces string or options object.
85
+ * @returns {Object} Normalized options object.
86
+ * @private
87
+ */
62
88
  /*@__NO_SIDE_EFFECTS__*/
63
89
  function extractOptions(namespaces) {
64
90
  return namespaces !== null && typeof namespaces === 'object'
@@ -66,6 +92,12 @@ function extractOptions(namespaces) {
66
92
  : { __proto__: null, namespaces }
67
93
  }
68
94
 
95
+ /**
96
+ * Check if debug is enabled for given namespaces.
97
+ * @param {string} namespaces - Debug namespaces to check.
98
+ * @returns {boolean} True if debug is enabled.
99
+ * @private
100
+ */
69
101
  /*@__NO_SIDE_EFFECTS__*/
70
102
  function isEnabled(namespaces) {
71
103
  if (typeof namespaces !== 'string' || !namespaces || namespaces === '*') {
@@ -93,6 +125,12 @@ function isEnabled(namespaces) {
93
125
  return skips.every(ns => !getDebugJsInstance(ns).enabled)
94
126
  }
95
127
 
128
+ /**
129
+ * Debug output for object inspection.
130
+ * @param {string | Object} namespacesOrOpts - Namespaces or options.
131
+ * @param {any} obj - Object to inspect.
132
+ * @param {Object} [inspectOpts] - Inspection options.
133
+ */
96
134
  /*@__NO_SIDE_EFFECTS__*/
97
135
  function debugDir(namespacesOrOpts, obj, inspectOpts) {
98
136
  const options = extractOptions(namespacesOrOpts)
@@ -115,6 +153,11 @@ function debugDir(namespacesOrOpts, obj, inspectOpts) {
115
153
  }
116
154
 
117
155
  let pointingTriangle
156
+ /**
157
+ * Debug output with function name prefix.
158
+ * @param {string | Object} namespacesOrOpts - Namespaces or options.
159
+ * @param {...any} args - Arguments to log.
160
+ */
118
161
  /*@__NO_SIDE_EFFECTS__*/
119
162
  function debugFn(namespacesOrOpts, ...args) {
120
163
  const options = extractOptions(namespacesOrOpts)
@@ -181,6 +224,11 @@ function debugFn(namespacesOrOpts, ...args) {
181
224
  }
182
225
  }
183
226
 
227
+ /**
228
+ * Debug logging function.
229
+ * @param {string | Object} namespacesOrOpts - Namespaces or options.
230
+ * @param {...any} args - Arguments to log.
231
+ */
184
232
  /*@__NO_SIDE_EFFECTS__*/
185
233
  function debugLog(namespacesOrOpts, ...args) {
186
234
  const options = extractOptions(namespacesOrOpts)
@@ -197,6 +245,11 @@ function debugLog(namespacesOrOpts, ...args) {
197
245
  }
198
246
  }
199
247
 
248
+ /**
249
+ * Check if debug mode is enabled.
250
+ * @param {string} [namespaces] - Specific namespaces to check.
251
+ * @returns {boolean} True if debug is enabled.
252
+ */
200
253
  /*@__NO_SIDE_EFFECTS__*/
201
254
  function isDebug(namespaces) {
202
255
  const ENV = /*@__PURE__*/ require('./constants/env')
@@ -4,6 +4,12 @@ const NumberCtor = Number
4
4
  const { isFinite: NumberIsFinite, parseInt: NumberParseInt } = NumberCtor
5
5
  const StringCtor = String
6
6
 
7
+ /**
8
+ * Convert an environment variable value to a boolean.
9
+ * @param {any} value - The value to convert.
10
+ * @param {boolean} [defaultValue=false] - Default value when input is null/undefined.
11
+ * @returns {boolean} The boolean representation of the value.
12
+ */
7
13
  /*@__NO_SIDE_EFFECTS__*/
8
14
  function envAsBoolean(value, defaultValue = false) {
9
15
  if (typeof value === 'string') {
@@ -16,6 +22,12 @@ function envAsBoolean(value, defaultValue = false) {
16
22
  return !!value
17
23
  }
18
24
 
25
+ /**
26
+ * Convert an environment variable value to a number.
27
+ * @param {any} value - The value to convert.
28
+ * @param {number} [defaultValue=0] - Default value when conversion fails.
29
+ * @returns {number} The numeric representation of the value.
30
+ */
19
31
  /*@__NO_SIDE_EFFECTS__*/
20
32
  function envAsNumber(value, defaultValue = 0) {
21
33
  const numOrNaN = NumberParseInt(value, 10)
@@ -26,6 +38,12 @@ function envAsNumber(value, defaultValue = 0) {
26
38
  return numMayBeNegZero || 0
27
39
  }
28
40
 
41
+ /**
42
+ * Convert an environment variable value to a trimmed string.
43
+ * @param {any} value - The value to convert.
44
+ * @param {string} [defaultValue=''] - Default value when input is null/undefined.
45
+ * @returns {string} The trimmed string representation of the value.
46
+ */
29
47
  /*@__NO_SIDE_EFFECTS__*/
30
48
  function envAsString(value, defaultValue = '') {
31
49
  if (typeof value === 'string') {