@socketsecurity/cli-with-sentry 1.1.15 → 1.1.18

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 (103) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cli.js +14 -15
  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/coana-fix.d.mts.map +1 -1
  14. package/dist/types/commands/optimize/apply-optimization.d.mts.map +1 -1
  15. package/dist/types/commands/optimize/update-lockfile.d.mts.map +1 -1
  16. package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -1
  17. package/dist/types/commands/patch/handle-patch.d.mts.map +1 -1
  18. package/dist/types/commands/yarn/cmd-yarn.d.mts +1 -1
  19. package/dist/types/commands/yarn/cmd-yarn.d.mts.map +1 -1
  20. package/dist/types/constants.d.mts +15 -19
  21. package/dist/types/constants.d.mts.map +1 -1
  22. package/dist/types/shadow/pnpm/bin.d.mts.map +1 -1
  23. package/dist/types/utils/agent.d.mts.map +1 -1
  24. package/dist/types/utils/dlx.d.mts.map +1 -1
  25. package/dist/types/utils/package-environment.d.mts.map +1 -1
  26. package/dist/types/utils/path-resolve.d.mts.map +1 -1
  27. package/dist/utils.js +65 -27
  28. package/dist/utils.js.map +1 -1
  29. package/dist/vendor.js +522 -524
  30. package/external/@socketsecurity/registry/external/@inquirer/confirm.js +45 -205
  31. package/external/@socketsecurity/registry/external/@inquirer/input.js +45 -205
  32. package/external/@socketsecurity/registry/external/@inquirer/password.js +181 -205
  33. package/external/@socketsecurity/registry/external/@inquirer/search.js +47 -207
  34. package/external/@socketsecurity/registry/external/@inquirer/select.js +183 -207
  35. package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +388 -2280
  36. package/external/@socketsecurity/registry/external/browserslist.js +11534 -567
  37. package/external/@socketsecurity/registry/external/cacache.js +2575 -4914
  38. package/external/@socketsecurity/registry/external/libnpmpack.js +64667 -166061
  39. package/external/@socketsecurity/registry/external/make-fetch-happen.js +384 -4044
  40. package/external/@socketsecurity/registry/external/normalize-package-data.js +30 -278
  41. package/external/@socketsecurity/registry/external/npm-package-arg.js +28 -9
  42. package/external/@socketsecurity/registry/external/pacote.js +46680 -66482
  43. package/external/@socketsecurity/registry/external/spdx-correct.js +19 -0
  44. package/external/@socketsecurity/registry/external/spdx-expression-parse.js +19 -0
  45. package/external/@socketsecurity/registry/lib/agent.js +390 -0
  46. package/external/@socketsecurity/registry/lib/arrays.js +31 -0
  47. package/external/@socketsecurity/registry/lib/bin.js +650 -0
  48. package/external/@socketsecurity/registry/lib/constants/bun-lock.js +3 -0
  49. package/external/@socketsecurity/registry/lib/constants/bun-lockb.js +3 -0
  50. package/external/@socketsecurity/registry/lib/constants/bun.js +3 -0
  51. package/external/@socketsecurity/registry/lib/constants/dot-git-dir.js +3 -0
  52. package/external/@socketsecurity/registry/lib/constants/dot-socket-dir.js +3 -0
  53. package/external/@socketsecurity/registry/lib/constants/empty-value.js +3 -0
  54. package/external/@socketsecurity/registry/lib/constants/env.js +17 -3
  55. package/external/@socketsecurity/registry/lib/constants/ext-yaml.js +3 -0
  56. package/external/@socketsecurity/registry/lib/constants/ext-yml.js +3 -0
  57. package/external/@socketsecurity/registry/lib/constants/index.js +20 -11
  58. package/external/@socketsecurity/registry/lib/constants/npm-exec-path.js +2 -2
  59. package/external/@socketsecurity/registry/lib/constants/npm-real-exec-path.js +1 -1
  60. package/external/@socketsecurity/registry/lib/constants/npm-shrinkwrap-json.js +3 -0
  61. package/external/@socketsecurity/registry/lib/constants/pnpm-exec-path.js +5 -0
  62. package/external/@socketsecurity/registry/lib/constants/pnpm-lock-yaml.js +3 -0
  63. package/external/@socketsecurity/registry/lib/constants/unknown-error.js +3 -0
  64. package/external/@socketsecurity/registry/lib/constants/unknown-value.js +3 -0
  65. package/external/@socketsecurity/registry/lib/constants/vlt-lock-json.js +3 -0
  66. package/external/@socketsecurity/registry/lib/constants/vlt.js +3 -0
  67. package/external/@socketsecurity/registry/lib/constants/yarn-berry.js +3 -0
  68. package/external/@socketsecurity/registry/lib/constants/yarn-classic.js +3 -0
  69. package/external/@socketsecurity/registry/lib/constants/yarn-exec-path.js +5 -0
  70. package/external/@socketsecurity/registry/lib/constants/yarn.js +3 -0
  71. package/external/@socketsecurity/registry/lib/debug.js +53 -0
  72. package/external/@socketsecurity/registry/lib/env.js +18 -0
  73. package/external/@socketsecurity/registry/lib/fs.js +218 -2
  74. package/external/@socketsecurity/registry/lib/functions.js +5 -0
  75. package/external/@socketsecurity/registry/lib/globs.js +22 -1
  76. package/external/@socketsecurity/registry/lib/json.js +16 -0
  77. package/external/@socketsecurity/registry/lib/logger.js +157 -0
  78. package/external/@socketsecurity/registry/lib/objects.js +103 -0
  79. package/external/@socketsecurity/registry/lib/packages.js +88 -0
  80. package/external/@socketsecurity/registry/lib/path.js +51 -1
  81. package/external/@socketsecurity/registry/lib/promises.js +55 -0
  82. package/external/@socketsecurity/registry/lib/regexps.js +5 -0
  83. package/external/@socketsecurity/registry/lib/sorts.js +17 -0
  84. package/external/@socketsecurity/registry/lib/spawn.js +105 -7
  85. package/external/@socketsecurity/registry/lib/streams.js +26 -0
  86. package/external/@socketsecurity/registry/lib/strings.js +123 -9
  87. package/external/@socketsecurity/registry/lib/url.js +21 -0
  88. package/external/@socketsecurity/registry/lib/words.js +16 -0
  89. package/external/@socketsecurity/registry/manifest.json +5 -4
  90. package/package.json +6 -5
  91. package/external/@socketsecurity/registry/external/ansi-regex.js +0 -13
  92. package/external/@socketsecurity/registry/lib/constants/node-workspaces.js +0 -3
  93. package/external/@socketsecurity/registry/lib/constants/parse-args-config.js +0 -14
  94. package/external/@socketsecurity/registry/lib/constants/skip-tests-by-ecosystem.js +0 -43
  95. package/external/@socketsecurity/registry/lib/constants/template-cjs-browser.js +0 -3
  96. package/external/@socketsecurity/registry/lib/constants/template-cjs-esm.js +0 -3
  97. package/external/@socketsecurity/registry/lib/constants/template-cjs.js +0 -3
  98. package/external/@socketsecurity/registry/lib/constants/template-es-shim-constructor.js +0 -3
  99. package/external/@socketsecurity/registry/lib/constants/template-es-shim-prototype-method.js +0 -3
  100. package/external/@socketsecurity/registry/lib/constants/template-es-shim-static-method.js +0 -3
  101. package/external/@socketsecurity/registry/lib/constants/win32-ensure-tests-by-ecosystem.js +0 -3
  102. package/external/@socketsecurity/registry/lib/npm.js +0 -404
  103. /package/external/@socketsecurity/registry/lib/constants/{hidden-package-lock-json.js → dot-package-lock-json.js} +0 -0
@@ -1,5 +1,6 @@
1
1
  'use strict'
2
2
 
3
+ const { isArray: ArrayIsArray } = Array
3
4
  const { freeze: ObjectFreeze } = Object
4
5
 
5
6
  const { defaultIgnore, getGlobMatcher } = /*@__PURE__*/ require('./globs')
@@ -37,6 +38,105 @@ function getPath() {
37
38
  return _path
38
39
  }
39
40
 
41
+ /**
42
+ * Find a file or directory by traversing up parent directories.
43
+ * @param {string | string[]} name - Name(s) to search for.
44
+ * @param {FindUpOptions} [options] - Search options.
45
+ * @returns {Promise<string | undefined>} Path to found file/directory.
46
+ * @typedef {{cwd?: string; onlyDirectories?: boolean; onlyFiles?: boolean; signal?: AbortSignal}} FindUpOptions
47
+ */
48
+ /*@__NO_SIDE_EFFECTS__*/
49
+ async function findUp(name, options) {
50
+ const {
51
+ cwd = process.cwd(),
52
+ signal = /*@__PURE__*/ require('./constants/abort-signal')
53
+ } = { __proto__: null, ...options }
54
+ let { onlyDirectories = false, onlyFiles = true } = {
55
+ __proto__: null,
56
+ ...options
57
+ }
58
+ if (onlyDirectories) {
59
+ onlyFiles = false
60
+ }
61
+ if (onlyFiles) {
62
+ onlyDirectories = false
63
+ }
64
+ const fs = getFs()
65
+ const path = getPath()
66
+ let dir = path.resolve(cwd)
67
+ const { root } = path.parse(dir)
68
+ const names = ArrayIsArray(name) ? name : [name]
69
+ while (dir && dir !== root) {
70
+ for (const n of names) {
71
+ if (signal?.aborted) {
72
+ return undefined
73
+ }
74
+ const thePath = path.join(dir, n)
75
+ try {
76
+ // eslint-disable-next-line no-await-in-loop
77
+ const stats = await fs.promises.stat(thePath)
78
+ if (!onlyDirectories && stats.isFile()) {
79
+ return thePath
80
+ }
81
+ if (!onlyFiles && stats.isDirectory()) {
82
+ return thePath
83
+ }
84
+ } catch {}
85
+ }
86
+ dir = path.dirname(dir)
87
+ }
88
+ return undefined
89
+ }
90
+
91
+ /**
92
+ * Synchronously find a file or directory by traversing up parent directories.
93
+ * @param {string | string[]} name - Name(s) to search for.
94
+ * @param {Omit<FindUpOptions, 'signal'>} [options] - Search options.
95
+ * @returns {string | undefined} Path to found file/directory.
96
+ */
97
+ /*@__NO_SIDE_EFFECTS__*/
98
+ function findUpSync(name, options) {
99
+ const { cwd = process.cwd() } = { __proto__: null, ...options }
100
+ let { onlyDirectories = false, onlyFiles = true } = {
101
+ __proto__: null,
102
+ ...options
103
+ }
104
+ if (onlyDirectories) {
105
+ onlyFiles = false
106
+ }
107
+ if (onlyFiles) {
108
+ onlyDirectories = false
109
+ }
110
+ const fs = getFs()
111
+ const path = getPath()
112
+ let dir = path.resolve(cwd)
113
+ const { root } = path.parse(dir)
114
+ const names = ArrayIsArray(name) ? name : [name]
115
+ while (dir && dir !== root) {
116
+ for (const n of names) {
117
+ const thePath = path.join(dir, n)
118
+ try {
119
+ const stats = fs.statSync(thePath)
120
+ if (!onlyDirectories && stats.isFile()) {
121
+ return thePath
122
+ }
123
+ if (!onlyFiles && stats.isDirectory()) {
124
+ return thePath
125
+ }
126
+ } catch {}
127
+ }
128
+ dir = path.dirname(dir)
129
+ }
130
+ return undefined
131
+ }
132
+
133
+ /**
134
+ * Process directory entries and filter for directories.
135
+ * @param {import('fs').Dirent[]} dirents - Directory entries to process.
136
+ * @param {ReadDirOptions} [options] - Options for filtering and sorting.
137
+ * @returns {string[]} Array of directory names.
138
+ * @private
139
+ */
40
140
  /*@__NO_SIDE_EFFECTS__*/
41
141
  function innerReadDirNames(dirents, options) {
42
142
  const {
@@ -56,12 +156,24 @@ function innerReadDirNames(dirents, options) {
56
156
  return sort ? names.sort(naturalCompare) : names
57
157
  }
58
158
 
159
+ /**
160
+ * Check if a path is a directory synchronously.
161
+ * @param {import('fs').PathLike} filepath - Path to check.
162
+ * @returns {boolean} True if the path is a directory.
163
+ */
59
164
  /*@__NO_SIDE_EFFECTS__*/
60
165
  function isDirSync(filepath) {
61
166
  const fs = getFs()
62
167
  return fs.existsSync(filepath) && !!safeStatsSync(filepath)?.isDirectory()
63
168
  }
64
169
 
170
+ /**
171
+ * Check if a directory is empty synchronously.
172
+ * @param {import('fs').PathLike} dirname - Directory path to check.
173
+ * @param {IsDirEmptyOptions} [options] - Options with ignore patterns.
174
+ * @returns {boolean} True if the directory is empty or only contains ignored files.
175
+ * @typedef {{ignore?: string[] | readonly string[]}} IsDirEmptyOptions
176
+ */
65
177
  /*@__NO_SIDE_EFFECTS__*/
66
178
  function isDirEmptySync(dirname, options) {
67
179
  const { ignore = defaultIgnore } = { __proto__: null, ...options }
@@ -85,6 +197,11 @@ function isDirEmptySync(dirname, options) {
85
197
  }
86
198
  }
87
199
 
200
+ /**
201
+ * Check if a path is a symbolic link synchronously.
202
+ * @param {import('fs').PathLike} filepath - Path to check.
203
+ * @returns {boolean} True if the path is a symbolic link.
204
+ */
88
205
  /*@__NO_SIDE_EFFECTS__*/
89
206
  function isSymLinkSync(filepath) {
90
207
  const fs = getFs()
@@ -94,6 +211,13 @@ function isSymLinkSync(filepath) {
94
211
  return false
95
212
  }
96
213
 
214
+ /**
215
+ * Read directory names asynchronously with filtering and sorting.
216
+ * @param {import('fs').PathLike} dirname - Directory to read.
217
+ * @param {ReadDirOptions} [options] - Options for filtering and sorting.
218
+ * @returns {Promise<string[]>} Array of directory names.
219
+ * @typedef {{ignore?: string[] | readonly string[]; includeEmpty?: boolean; sort?: boolean}} ReadDirOptions
220
+ */
97
221
  /*@__NO_SIDE_EFFECTS__*/
98
222
  async function readDirNames(dirname, options) {
99
223
  const fs = getFs()
@@ -109,6 +233,12 @@ async function readDirNames(dirname, options) {
109
233
  return []
110
234
  }
111
235
 
236
+ /**
237
+ * Read directory names synchronously with filtering and sorting.
238
+ * @param {import('fs').PathLike} dirname - Directory to read.
239
+ * @param {ReadDirOptions} [options] - Options for filtering and sorting.
240
+ * @returns {string[]} Array of directory names.
241
+ */
112
242
  /*@__NO_SIDE_EFFECTS__*/
113
243
  function readDirNamesSync(dirname, options) {
114
244
  const fs = getFs()
@@ -121,6 +251,12 @@ function readDirNamesSync(dirname, options) {
121
251
  return []
122
252
  }
123
253
 
254
+ /**
255
+ * Read a file as binary data asynchronously.
256
+ * @param {import('fs').PathLike | import('fs/promises').FileHandle} filepath - Path to the file.
257
+ * @param {import('fs').ReadFileOptions} [options] - Read options.
258
+ * @returns {Promise<Buffer>} The file contents as a Buffer.
259
+ */
124
260
  /*@__NO_SIDE_EFFECTS__*/
125
261
  async function readFileBinary(filepath, options) {
126
262
  const fs = getFs()
@@ -131,6 +267,12 @@ async function readFileBinary(filepath, options) {
131
267
  })
132
268
  }
133
269
 
270
+ /**
271
+ * Read a file as UTF-8 text asynchronously.
272
+ * @param {import('fs').PathLike | import('fs/promises').FileHandle} filepath - Path to the file.
273
+ * @param {import('fs').ReadFileOptions} [options] - Read options.
274
+ * @returns {Promise<string>} The file contents as a string.
275
+ */
134
276
  /*@__NO_SIDE_EFFECTS__*/
135
277
  async function readFileUtf8(filepath, options) {
136
278
  const fs = getFs()
@@ -141,6 +283,13 @@ async function readFileUtf8(filepath, options) {
141
283
  })
142
284
  }
143
285
 
286
+ /**
287
+ * Read and parse a JSON file asynchronously.
288
+ * @param {import('fs').PathLike} filepath - Path to the JSON file.
289
+ * @param {ReadJsonOptions} [options] - Read and parse options.
290
+ * @returns {Promise<any>} The parsed JSON content.
291
+ * @typedef {{encoding?: string; throws?: boolean; reviver?: Function} & import('fs').ReadFileOptions} ReadJsonOptions
292
+ */
144
293
  /*@__NO_SIDE_EFFECTS__*/
145
294
  async function readJson(filepath, options) {
146
295
  if (typeof options === 'string') {
@@ -169,6 +318,12 @@ async function readJson(filepath, options) {
169
318
  })
170
319
  }
171
320
 
321
+ /**
322
+ * Read and parse a JSON file synchronously.
323
+ * @param {import('fs').PathLike} filepath - Path to the JSON file.
324
+ * @param {ReadJsonOptions} [options] - Read and parse options.
325
+ * @returns {any} The parsed JSON content.
326
+ */
172
327
  /*@__NO_SIDE_EFFECTS__*/
173
328
  function readJsonSync(filepath, options) {
174
329
  if (typeof options === 'string') {
@@ -197,6 +352,12 @@ function readJsonSync(filepath, options) {
197
352
  })
198
353
  }
199
354
 
355
+ /**
356
+ * Remove a file or directory asynchronously.
357
+ * @param {import('fs').PathLike} filepath - Path to remove.
358
+ * @param {import('fs').RmOptions} [options] - Remove options.
359
+ * @returns {Promise<void>}
360
+ */
200
361
  /*@__NO_SIDE_EFFECTS__*/
201
362
  async function remove(filepath, options) {
202
363
  // Attempt to workaround occasional ENOTEMPTY errors in Windows.
@@ -209,6 +370,12 @@ async function remove(filepath, options) {
209
370
  })
210
371
  }
211
372
 
373
+ /**
374
+ * Remove a file or directory synchronously.
375
+ * @param {import('fs').PathLike} filepath - Path to remove.
376
+ * @param {import('fs').RmOptions} [options] - Remove options.
377
+ * @returns {void}
378
+ */
212
379
  /*@__NO_SIDE_EFFECTS__*/
213
380
  function removeSync(filepath, options) {
214
381
  const fs = getFs()
@@ -219,6 +386,12 @@ function removeSync(filepath, options) {
219
386
  })
220
387
  }
221
388
 
389
+ /**
390
+ * Safely read a file asynchronously, returning undefined on error.
391
+ * @param {import('fs').PathLike | import('fs/promises').FileHandle} filepath - Path to the file.
392
+ * @param {import('fs').ReadFileOptions | string} [options] - Read options or encoding.
393
+ * @returns {Promise<string | undefined>} The file contents or undefined if read fails.
394
+ */
222
395
  /*@__NO_SIDE_EFFECTS__*/
223
396
  async function safeReadFile(filepath, options) {
224
397
  const fs = getFs()
@@ -232,6 +405,12 @@ async function safeReadFile(filepath, options) {
232
405
  return undefined
233
406
  }
234
407
 
408
+ /**
409
+ * Safely get file stats synchronously, returning undefined on error.
410
+ * @param {import('fs').PathLike} filepath - Path to stat.
411
+ * @param {import('fs').StatSyncOptions} [options] - Stat options.
412
+ * @returns {import('fs').Stats | undefined} File stats or undefined if stat fails.
413
+ */
235
414
  /*@__NO_SIDE_EFFECTS__*/
236
415
  function safeStatsSync(filepath, options) {
237
416
  const fs = getFs()
@@ -245,6 +424,12 @@ function safeStatsSync(filepath, options) {
245
424
  return undefined
246
425
  }
247
426
 
427
+ /**
428
+ * Safely read a file synchronously, returning undefined on error.
429
+ * @param {import('fs').PathOrFileDescriptor} filepath - Path to the file.
430
+ * @param {import('fs').ReadFileOptions | string} [options] - Read options or encoding.
431
+ * @returns {string | Buffer | undefined} The file contents or undefined if read fails.
432
+ */
248
433
  /*@__NO_SIDE_EFFECTS__*/
249
434
  function safeReadFileSync(filepath, options) {
250
435
  const fs = getFs()
@@ -258,6 +443,15 @@ function safeReadFileSync(filepath, options) {
258
443
  return undefined
259
444
  }
260
445
 
446
+ /**
447
+ * Stringify JSON with custom formatting options.
448
+ * @param {any} json - The JSON object to stringify.
449
+ * @param {string} [EOL='\n'] - End of line character.
450
+ * @param {boolean} [finalEOL=true] - Whether to add final EOL.
451
+ * @param {Function | null} [replacer=null] - JSON replacer function.
452
+ * @param {number | string} [spaces=2] - Indentation spaces.
453
+ * @returns {string} The formatted JSON string.
454
+ */
261
455
  /*@__NO_SIDE_EFFECTS__*/
262
456
  function stringify(
263
457
  json,
@@ -271,6 +465,11 @@ function stringify(
271
465
  return `${str.replace(/\n/g, EOL)}${EOF}`
272
466
  }
273
467
 
468
+ /**
469
+ * Generate a unique filepath by prepending underscores if the path exists.
470
+ * @param {import('fs').PathLike} filepath - The desired filepath.
471
+ * @returns {string} A unique filepath that doesn't exist.
472
+ */
274
473
  /*@__NO_SIDE_EFFECTS__*/
275
474
  function uniqueSync(filepath) {
276
475
  const fs = getFs()
@@ -283,6 +482,14 @@ function uniqueSync(filepath) {
283
482
  return path.join(dirname, basename)
284
483
  }
285
484
 
485
+ /**
486
+ * Write JSON content to a file asynchronously with formatting.
487
+ * @param {import('fs').PathLike} filepath - Path to write to.
488
+ * @param {any} jsonContent - The JSON content to write.
489
+ * @param {WriteJsonOptions} [options] - Write and format options.
490
+ * @returns {Promise<void>}
491
+ * @typedef {{EOL?: string; finalEOL?: boolean; replacer?: Function; spaces?: number | string} & import('fs').WriteFileOptions} WriteJsonOptions
492
+ */
286
493
  /*@__NO_SIDE_EFFECTS__*/
287
494
  async function writeJson(filepath, jsonContent, options) {
288
495
  if (typeof options === 'string') {
@@ -301,6 +508,13 @@ async function writeJson(filepath, jsonContent, options) {
301
508
  })
302
509
  }
303
510
 
511
+ /**
512
+ * Write JSON content to a file synchronously with formatting.
513
+ * @param {import('fs').PathLike} filepath - Path to write to.
514
+ * @param {any} jsonContent - The JSON content to write.
515
+ * @param {WriteJsonOptions} [options] - Write and format options.
516
+ * @returns {void}
517
+ */
304
518
  /*@__NO_SIDE_EFFECTS__*/
305
519
  function writeJsonSync(filepath, jsonContent, options) {
306
520
  if (typeof options === 'string') {
@@ -320,15 +534,17 @@ function writeJsonSync(filepath, jsonContent, options) {
320
534
  }
321
535
 
322
536
  module.exports = {
537
+ findUp,
538
+ findUpSync,
323
539
  isDirSync,
324
540
  isDirEmptySync,
325
541
  isSymLinkSync,
542
+ readDirNames,
543
+ readDirNamesSync,
326
544
  readFileBinary,
327
545
  readFileUtf8,
328
546
  readJson,
329
547
  readJsonSync,
330
- readDirNames,
331
- readDirNamesSync,
332
548
  remove,
333
549
  removeSync,
334
550
  safeReadFile,
@@ -1,5 +1,10 @@
1
1
  'use strict'
2
2
 
3
+ /**
4
+ * Wrap an async function to silently catch and ignore errors.
5
+ * @param {Function} fn - The async function to wrap.
6
+ * @returns {Function} The wrapped async function that returns undefined on error.
7
+ */
3
8
  /*@__NO_SIDE_EFFECTS__*/
4
9
  function silentWrapAsync(fn) {
5
10
  return async (...args) => {
@@ -36,7 +36,6 @@ const defaultIgnore = ObjectFreeze([
36
36
  '**/.eslintcache',
37
37
  '**/.nvm',
38
38
  '**/.tap',
39
- '**/.tapci.yaml',
40
39
  '**/.vscode',
41
40
  '**/*.tsbuildinfo',
42
41
  '**/Thumbs.db',
@@ -45,6 +44,11 @@ const defaultIgnore = ObjectFreeze([
45
44
  ])
46
45
 
47
46
  let _picomatch
47
+ /**
48
+ * Lazily load the picomatch module.
49
+ * @returns {import('picomatch')} The picomatch module.
50
+ * @private
51
+ */
48
52
  /*@__NO_SIDE_EFFECTS__*/
49
53
  function getPicomatch() {
50
54
  if (_picomatch === undefined) {
@@ -55,6 +59,11 @@ function getPicomatch() {
55
59
  }
56
60
 
57
61
  let _fastGlob
62
+ /**
63
+ * Lazily load the fast-glob module.
64
+ * @returns {import('fast-glob')} The fast-glob module.
65
+ * @private
66
+ */
58
67
  /*@__NO_SIDE_EFFECTS__*/
59
68
  function getFastGlob() {
60
69
  if (_fastGlob === undefined) {
@@ -63,6 +72,12 @@ function getFastGlob() {
63
72
  return _fastGlob
64
73
  }
65
74
 
75
+ /**
76
+ * Create a stream of license file paths matching glob patterns.
77
+ * @param {string} dirname - The directory to search in.
78
+ * @param {{ignore?: string[]; ignoreOriginals?: boolean; recursive?: boolean}} [options] - Glob options.
79
+ * @returns {import('stream').Stream} Stream of matching file paths.
80
+ */
66
81
  /*@__NO_SIDE_EFFECTS__*/
67
82
  function globStreamLicenses(dirname, options) {
68
83
  const {
@@ -99,6 +114,12 @@ function globStreamLicenses(dirname, options) {
99
114
  }
100
115
 
101
116
  const matcherCache = new Map()
117
+ /**
118
+ * Get a cached glob matcher function.
119
+ * @param {string | string[]} glob - Glob pattern(s) to match.
120
+ * @param {Object} [options] - Picomatch options.
121
+ * @returns {Function} The glob matcher function.
122
+ */
102
123
  /*@__NO_SIDE_EFFECTS__*/
103
124
  function getGlobMatcher(glob, options) {
104
125
  const patterns = Array.isArray(glob) ? glob : [glob]
@@ -4,6 +4,11 @@ const { parse: JSONParse } = JSON
4
4
 
5
5
  const { stripBom } = /*@__PURE__*/ require('./strings')
6
6
 
7
+ /**
8
+ * Check if a value is a Buffer instance.
9
+ * @param {any} x - The value to check.
10
+ * @returns {boolean} True if the value is a Buffer.
11
+ */
7
12
  /*@__NO_SIDE_EFFECTS__*/
8
13
  function isBuffer(x) {
9
14
  if (!x || typeof x !== 'object' || typeof x.length !== 'number') {
@@ -20,6 +25,11 @@ function isBuffer(x) {
20
25
  return !!(typeof Ctor?.isBuffer === 'function' && Ctor.isBuffer(x))
21
26
  }
22
27
 
28
+ /**
29
+ * Check if a value is a JSON primitive (null, boolean, number, or string).
30
+ * @param {any} value - The value to check.
31
+ * @returns {boolean} True if the value is a JSON primitive.
32
+ */
23
33
  /*@__NO_SIDE_EFFECTS__*/
24
34
  function isJsonPrimitive(value) {
25
35
  return (
@@ -30,6 +40,12 @@ function isJsonPrimitive(value) {
30
40
  )
31
41
  }
32
42
 
43
+ /**
44
+ * Parse JSON content with error handling and BOM stripping.
45
+ * @param {string | Buffer} content - The JSON content to parse.
46
+ * @param {{filepath?: string; reviver?: Function; throws?: boolean}} [options] - Parse options.
47
+ * @returns {any} The parsed JSON object, or null if parsing fails and throws is false.
48
+ */
33
49
  /*@__NO_SIDE_EFFECTS__*/
34
50
  function jsonParse(content, options) {
35
51
  const { filepath, reviver, throws } = { __proto__: null, ...options }