@socketsecurity/cli-with-sentry 0.14.67 → 0.14.68

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 (96) hide show
  1. package/dist/blessed/lib/alias.js +521 -0
  2. package/dist/blessed/lib/blessed.js +34 -0
  3. package/dist/blessed/lib/colors.js +492 -0
  4. package/dist/blessed/lib/events.js +197 -0
  5. package/dist/blessed/lib/gpmclient.js +247 -0
  6. package/dist/blessed/lib/helpers.js +172 -0
  7. package/dist/blessed/lib/keys.js +514 -0
  8. package/dist/blessed/lib/program.js +4532 -0
  9. package/dist/blessed/lib/tput.js +3113 -0
  10. package/dist/blessed/lib/unicode.js +914 -0
  11. package/dist/blessed/lib/widget.js +62 -0
  12. package/dist/blessed/lib/widgets/ansiimage.js +175 -0
  13. package/dist/blessed/lib/widgets/bigtext.js +172 -0
  14. package/dist/blessed/lib/widgets/box.js +36 -0
  15. package/dist/blessed/lib/widgets/button.js +64 -0
  16. package/dist/blessed/lib/widgets/checkbox.js +97 -0
  17. package/dist/blessed/lib/widgets/element.js +2873 -0
  18. package/dist/blessed/lib/widgets/filemanager.js +225 -0
  19. package/dist/blessed/lib/widgets/form.js +303 -0
  20. package/dist/blessed/lib/widgets/image.js +73 -0
  21. package/dist/blessed/lib/widgets/input.js +36 -0
  22. package/dist/blessed/lib/widgets/layout.js +251 -0
  23. package/dist/blessed/lib/widgets/line.js +61 -0
  24. package/dist/blessed/lib/widgets/list.js +654 -0
  25. package/dist/blessed/lib/widgets/listbar.js +454 -0
  26. package/dist/blessed/lib/widgets/listtable.js +267 -0
  27. package/dist/blessed/lib/widgets/loading.js +90 -0
  28. package/dist/blessed/lib/widgets/log.js +84 -0
  29. package/dist/blessed/lib/widgets/message.js +147 -0
  30. package/dist/blessed/lib/widgets/node.js +316 -0
  31. package/dist/blessed/lib/widgets/overlayimage.js +796 -0
  32. package/dist/blessed/lib/widgets/progressbar.js +168 -0
  33. package/dist/blessed/lib/widgets/prompt.js +129 -0
  34. package/dist/blessed/lib/widgets/question.js +131 -0
  35. package/dist/blessed/lib/widgets/radiobutton.js +64 -0
  36. package/dist/blessed/lib/widgets/radioset.js +38 -0
  37. package/dist/blessed/lib/widgets/screen.js +2489 -0
  38. package/dist/blessed/lib/widgets/scrollablebox.js +417 -0
  39. package/dist/blessed/lib/widgets/scrollabletext.js +37 -0
  40. package/dist/blessed/lib/widgets/table.js +385 -0
  41. package/dist/blessed/lib/widgets/terminal.js +454 -0
  42. package/dist/blessed/lib/widgets/text.js +37 -0
  43. package/dist/blessed/lib/widgets/textarea.js +378 -0
  44. package/dist/blessed/lib/widgets/textbox.js +81 -0
  45. package/dist/blessed/lib/widgets/video.js +132 -0
  46. package/dist/blessed/usr/fonts/AUTHORS +1 -0
  47. package/dist/blessed/usr/fonts/LICENSE +94 -0
  48. package/dist/blessed/usr/fonts/README +340 -0
  49. package/dist/blessed/usr/fonts/ter-u14b.json +17826 -0
  50. package/dist/blessed/usr/fonts/ter-u14n.json +17826 -0
  51. package/dist/blessed/usr/linux +0 -0
  52. package/dist/blessed/usr/windows-ansi +0 -0
  53. package/dist/blessed/usr/xterm +0 -0
  54. package/dist/blessed/usr/xterm-256color +0 -0
  55. package/dist/blessed/usr/xterm.termcap +243 -0
  56. package/dist/blessed/usr/xterm.terminfo +1977 -0
  57. package/dist/blessed/vendor/tng.js +1878 -0
  58. package/dist/constants.d.ts +271 -207
  59. package/dist/constants.js +271 -227
  60. package/dist/constants.js.map +1 -1
  61. package/dist/instrument-with-sentry.d.ts +1 -1
  62. package/dist/instrument-with-sentry.js +27 -24
  63. package/dist/instrument-with-sentry.js.map +1 -1
  64. package/dist/module-sync/artifact.d.ts +60 -26
  65. package/dist/module-sync/cli.d.ts +1 -1
  66. package/dist/module-sync/cli.js +6624 -4527
  67. package/dist/module-sync/cli.js.map +1 -1
  68. package/dist/module-sync/cmd.d.ts +4 -4
  69. package/dist/module-sync/config.d.ts +30 -17
  70. package/dist/module-sync/edge.d.ts +73 -60
  71. package/dist/module-sync/errors.d.ts +26 -11
  72. package/dist/module-sync/fs.d.ts +61 -0
  73. package/dist/module-sync/index.d.ts +31 -20
  74. package/dist/module-sync/node.d.ts +118 -83
  75. package/dist/module-sync/override-set.d.ts +39 -33
  76. package/dist/module-sync/package-environment.d.ts +83 -52
  77. package/dist/module-sync/path-resolve.d.ts +14 -9
  78. package/dist/module-sync/sdk.d.ts +9 -5
  79. package/dist/module-sync/shadow-bin.d.ts +5 -2
  80. package/dist/module-sync/shadow-bin.js +82 -66
  81. package/dist/module-sync/shadow-bin.js.map +1 -1
  82. package/dist/module-sync/shadow-npm-inject.d.ts +1 -1
  83. package/dist/module-sync/shadow-npm-inject.js +1176 -983
  84. package/dist/module-sync/shadow-npm-inject.js.map +1 -1
  85. package/dist/module-sync/shadow-npm-paths.d.ts +28 -14
  86. package/dist/module-sync/shadow-npm-paths.js +285 -208
  87. package/dist/module-sync/shadow-npm-paths.js.map +1 -1
  88. package/dist/module-sync/socket-package-alert.d.ts +95 -39
  89. package/dist/module-sync/types.d.ts +75 -47
  90. package/dist/module-sync/vendor.js +11181 -0
  91. package/dist/{require → module-sync}/vendor.js.map +1 -1
  92. package/dist/require/cli.d.ts +1 -1
  93. package/dist/require/cli.js +6624 -4525
  94. package/dist/require/cli.js.map +1 -1
  95. package/dist/require/vendor.js +2 -9145
  96. package/package.json +46 -38
@@ -1,67 +1,73 @@
1
- 'use strict';
1
+ 'use strict'
2
2
 
3
3
  function _socketInterop(e) {
4
4
  let c = 0
5
5
  for (const k in e ?? {}) {
6
6
  c = c === 0 && k === 'default' ? 1 : 0
7
- if (!c && k !== '__esModule') break
7
+ if (!c && k !== '__esModule') {
8
+ break
9
+ }
8
10
  }
9
11
  return c ? e.default : e
10
12
  }
11
13
 
12
- var fs = require('node:fs');
13
- var Module = require('node:module');
14
- var path = require('node:path');
15
- var process = require('node:process');
16
- var logger = require('@socketsecurity/registry/lib/logger');
17
- var path$1 = require('@socketsecurity/registry/lib/path');
18
- var constants = require('./constants.js');
19
- var ignore = _socketInterop(require('ignore'));
20
- var micromatch = _socketInterop(require('micromatch'));
21
- var tinyglobby = _socketInterop(require('tinyglobby'));
22
- var which = _socketInterop(require('which'));
23
- var debug = require('@socketsecurity/registry/lib/debug');
24
- var npm = require('@socketsecurity/registry/lib/npm');
14
+ const fs = require('node:fs')
15
+ const Module = require('node:module')
16
+ const path = require('node:path')
17
+ const process = require('node:process')
18
+ const logger = require('@socketsecurity/registry/lib/logger')
19
+ const path$1 = require('@socketsecurity/registry/lib/path')
20
+ const constants = require('./constants.js')
21
+ const ignore = _socketInterop(require('ignore'))
22
+ const micromatch = _socketInterop(require('micromatch'))
23
+ const tinyglobby = _socketInterop(require('tinyglobby'))
24
+ const which = _socketInterop(require('which'))
25
+ const debug = require('@socketsecurity/registry/lib/debug')
26
+ const npm = require('@socketsecurity/registry/lib/npm')
25
27
 
26
28
  const ignoredDirs = [
27
- // Taken from ignore-by-default:
28
- // https://github.com/novemberborn/ignore-by-default/blob/v2.1.0/index.js
29
- '.git',
30
- // Git repository files, see <https://git-scm.com/>
31
- '.log',
32
- // Log files emitted by tools such as `tsserver`, see <https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29>
33
- '.nyc_output',
34
- // Temporary directory where nyc stores coverage data, see <https://github.com/bcoe/nyc>
35
- '.sass-cache',
36
- // Cache folder for node-sass, see <https://github.com/sass/node-sass>
37
- '.yarn',
38
- // Where node modules are installed when using Yarn, see <https://yarnpkg.com/>
39
- 'bower_components',
40
- // Where Bower packages are installed, see <http://bower.io/>
41
- 'coverage',
42
- // Standard output directory for code coverage reports, see <https://github.com/gotwarlost/istanbul>
43
- 'node_modules',
44
- // Where Node modules are installed, see <https://nodejs.org/>
45
- // Taken from globby:
46
- // https://github.com/sindresorhus/globby/blob/v14.0.2/ignore.js#L11-L16
47
- 'flow-typed'];
48
- const ignoredDirPatterns = ignoredDirs.map(i => `**/${i}`);
29
+ // Taken from ignore-by-default:
30
+ // https://github.com/novemberborn/ignore-by-default/blob/v2.1.0/index.js
31
+ '.git',
32
+ // Git repository files, see <https://git-scm.com/>
33
+ '.log',
34
+ // Log files emitted by tools such as `tsserver`, see <https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29>
35
+ '.nyc_output',
36
+ // Temporary directory where nyc stores coverage data, see <https://github.com/bcoe/nyc>
37
+ '.sass-cache',
38
+ // Cache folder for node-sass, see <https://github.com/sass/node-sass>
39
+ '.yarn',
40
+ // Where node modules are installed when using Yarn, see <https://yarnpkg.com/>
41
+ 'bower_components',
42
+ // Where Bower packages are installed, see <http://bower.io/>
43
+ 'coverage',
44
+ // Standard output directory for code coverage reports, see <https://github.com/gotwarlost/istanbul>
45
+ 'node_modules',
46
+ // Where Node modules are installed, see <https://nodejs.org/>
47
+ // Taken from globby:
48
+ // https://github.com/sindresorhus/globby/blob/v14.0.2/ignore.js#L11-L16
49
+ 'flow-typed'
50
+ ]
51
+ const ignoredDirPatterns = ignoredDirs.map(i => `**/${i}`)
49
52
  function directoryPatterns() {
50
- return [...ignoredDirPatterns];
53
+ return [...ignoredDirPatterns]
51
54
  }
52
55
 
53
- const {
54
- NODE_MODULES: NODE_MODULES$1,
55
- NPM: NPM$1,
56
- shadowBinPath
57
- } = constants;
56
+ const { NODE_MODULES: NODE_MODULES$1, NPM: NPM$1, shadowBinPath } = constants
58
57
  async function filterGlobResultToSupportedFiles(entries, supportedFiles) {
59
- const patterns = ['golang', NPM$1, 'maven', 'pypi', 'gem', 'nuget'].reduce((r, n) => {
60
- const supported = supportedFiles[n];
61
- r.push(...(supported ? Object.values(supported).map(p => `**/${p.pattern}`) : []));
62
- return r;
63
- }, []);
64
- return entries.filter(p => micromatch.some(p, patterns));
58
+ const patterns = ['golang', NPM$1, 'maven', 'pypi', 'gem', 'nuget'].reduce(
59
+ (r, n) => {
60
+ const supported = supportedFiles[n]
61
+ r.push(
62
+ ...(supported
63
+ ? Object.values(supported).map(p => `**/${p.pattern}`)
64
+ : [])
65
+ )
66
+ return r
67
+ },
68
+ []
69
+ )
70
+ return entries.filter(p => micromatch.some(p, patterns))
65
71
  }
66
72
  async function globWithGitIgnore(patterns, options) {
67
73
  const {
@@ -71,50 +77,74 @@ async function globWithGitIgnore(patterns, options) {
71
77
  } = {
72
78
  __proto__: null,
73
79
  ...options
74
- };
75
- const projectIgnorePaths = socketConfig?.projectIgnorePaths;
80
+ }
81
+ const projectIgnorePaths = socketConfig?.projectIgnorePaths
76
82
  const ignoreFiles = await tinyglobby.glob(['**/.gitignore'], {
77
83
  absolute: true,
78
84
  cwd,
79
85
  expandDirectories: true
80
- });
81
- const ignores = [...directoryPatterns(), ...(Array.isArray(projectIgnorePaths) ? ignoreFileLinesToGlobPatterns(projectIgnorePaths, path.join(cwd, '.gitignore'), cwd) : []), ...(await Promise.all(ignoreFiles.map(async filepath => ignoreFileToGlobPatterns(await fs.promises.readFile(filepath, 'utf8'), filepath, cwd)))).flat()];
82
- const hasNegatedPattern = ignores.some(p => p.charCodeAt(0) === 33 /*'!'*/);
86
+ })
87
+ const ignores = [
88
+ ...directoryPatterns(),
89
+ ...(Array.isArray(projectIgnorePaths)
90
+ ? ignoreFileLinesToGlobPatterns(
91
+ projectIgnorePaths,
92
+ path.join(cwd, '.gitignore'),
93
+ cwd
94
+ )
95
+ : []),
96
+ ...(
97
+ await Promise.all(
98
+ ignoreFiles.map(async filepath =>
99
+ ignoreFileToGlobPatterns(
100
+ await fs.promises.readFile(filepath, 'utf8'),
101
+ filepath,
102
+ cwd
103
+ )
104
+ )
105
+ )
106
+ ).flat()
107
+ ]
108
+ const hasNegatedPattern = ignores.some(p => p.charCodeAt(0) === 33 /*'!'*/)
83
109
  const globOptions = {
84
110
  absolute: true,
85
111
  cwd,
86
112
  expandDirectories: false,
87
113
  ignore: hasNegatedPattern ? [] : ignores,
88
114
  ...additionalOptions
89
- };
90
- const result = await tinyglobby.glob(patterns, globOptions);
115
+ }
116
+ const result = await tinyglobby.glob(patterns, globOptions)
91
117
  if (!hasNegatedPattern) {
92
- return result;
118
+ return result
93
119
  }
94
- const {
95
- absolute
96
- } = globOptions;
120
+ const { absolute } = globOptions
97
121
 
98
122
  // Note: the input files must be INSIDE the cwd. If you get strange looking
99
123
  // relative path errors here, most likely your path is outside the given cwd.
100
- const filtered = ignore().add(ignores).filter(absolute ? result.map(p => path.relative(cwd, p)) : result);
101
- return absolute ? filtered.map(p => path.resolve(cwd, p)) : filtered;
124
+ const filtered = ignore()
125
+ .add(ignores)
126
+ .filter(absolute ? result.map(p => path.relative(cwd, p)) : result)
127
+ return absolute ? filtered.map(p => path.resolve(cwd, p)) : filtered
102
128
  }
103
129
  function ignoreFileLinesToGlobPatterns(lines, filepath, cwd) {
104
- const base = path.relative(cwd, path.dirname(filepath)).replace(/\\/g, '/');
105
- const patterns = [];
106
- for (let i = 0, {
107
- length
108
- } = lines; i < length; i += 1) {
109
- const pattern = lines[i].trim();
130
+ const base = path.relative(cwd, path.dirname(filepath)).replace(/\\/g, '/')
131
+ const patterns = []
132
+ for (let i = 0, { length } = lines; i < length; i += 1) {
133
+ const pattern = lines[i].trim()
110
134
  if (pattern.length > 0 && pattern.charCodeAt(0) !== 35 /*'#'*/) {
111
- patterns.push(ignorePatternToMinimatch(pattern.length && pattern.charCodeAt(0) === 33 /*'!'*/ ? `!${path.posix.join(base, pattern.slice(1))}` : path.posix.join(base, pattern)));
135
+ patterns.push(
136
+ ignorePatternToMinimatch(
137
+ pattern.length && pattern.charCodeAt(0) === 33 /*'!'*/
138
+ ? `!${path.posix.join(base, pattern.slice(1))}`
139
+ : path.posix.join(base, pattern)
140
+ )
141
+ )
112
142
  }
113
143
  }
114
- return patterns;
144
+ return patterns
115
145
  }
116
146
  function ignoreFileToGlobPatterns(content, filepath, cwd) {
117
- return ignoreFileLinesToGlobPatterns(content.split(/\r?\n/), filepath, cwd);
147
+ return ignoreFileLinesToGlobPatterns(content.split(/\r?\n/), filepath, cwd)
118
148
  }
119
149
 
120
150
  // Based on `@eslint/compat` convertIgnorePatternToMinimatch.
@@ -122,16 +152,25 @@ function ignoreFileToGlobPatterns(content, filepath, cwd) {
122
152
  // Copyright Nicholas C. Zakas
123
153
  // https://github.com/eslint/rewrite/blob/compat-v1.2.1/packages/compat/src/ignore-file.js#L28
124
154
  function ignorePatternToMinimatch(pattern) {
125
- const isNegated = pattern.startsWith('!');
126
- const negatedPrefix = isNegated ? '!' : '';
127
- const patternToTest = (isNegated ? pattern.slice(1) : pattern).trimEnd();
155
+ const isNegated = pattern.startsWith('!')
156
+ const negatedPrefix = isNegated ? '!' : ''
157
+ const patternToTest = (isNegated ? pattern.slice(1) : pattern).trimEnd()
128
158
  // Special cases.
129
- if (patternToTest === '' || patternToTest === '**' || patternToTest === '/**' || patternToTest === '**') {
130
- return `${negatedPrefix}${patternToTest}`;
159
+ if (
160
+ patternToTest === '' ||
161
+ patternToTest === '**' ||
162
+ patternToTest === '/**' ||
163
+ patternToTest === '**'
164
+ ) {
165
+ return `${negatedPrefix}${patternToTest}`
131
166
  }
132
- const firstIndexOfSlash = patternToTest.indexOf('/');
133
- const matchEverywherePrefix = firstIndexOfSlash === -1 || firstIndexOfSlash === patternToTest.length - 1 ? '**/' : '';
134
- const patternWithoutLeadingSlash = firstIndexOfSlash === 0 ? patternToTest.slice(1) : patternToTest;
167
+ const firstIndexOfSlash = patternToTest.indexOf('/')
168
+ const matchEverywherePrefix =
169
+ firstIndexOfSlash === -1 || firstIndexOfSlash === patternToTest.length - 1
170
+ ? '**/'
171
+ : ''
172
+ const patternWithoutLeadingSlash =
173
+ firstIndexOfSlash === 0 ? patternToTest.slice(1) : patternToTest
135
174
  // Escape `{` and `(` because in gitignore patterns they are just
136
175
  // literal characters without any specific syntactic meaning,
137
176
  // while in minimatch patterns they can form brace expansion or extglob syntax.
@@ -139,237 +178,275 @@ function ignorePatternToMinimatch(pattern) {
139
178
  // For example, gitignore pattern `src/{a,b}.js` ignores file `src/{a,b}.js`.
140
179
  // But, the same minimatch pattern `src/{a,b}.js` ignores files `src/a.js` and `src/b.js`.
141
180
  // Minimatch pattern `src/\{a,b}.js` is equivalent to gitignore pattern `src/{a,b}.js`.
142
- const escapedPatternWithoutLeadingSlash = patternWithoutLeadingSlash.replaceAll(/(?=((?:\\.|[^{(])*))\1([{(])/guy, '$1\\$2');
143
- const matchInsideSuffix = patternToTest.endsWith('/**') ? '/*' : '';
144
- return `${negatedPrefix}${matchEverywherePrefix}${escapedPatternWithoutLeadingSlash}${matchInsideSuffix}`;
181
+ const escapedPatternWithoutLeadingSlash =
182
+ patternWithoutLeadingSlash.replaceAll(
183
+ /(?=((?:\\.|[^{(])*))\1([{(])/guy,
184
+ '$1\\$2'
185
+ )
186
+ const matchInsideSuffix = patternToTest.endsWith('/**') ? '/*' : ''
187
+ return `${negatedPrefix}${matchEverywherePrefix}${escapedPatternWithoutLeadingSlash}${matchInsideSuffix}`
145
188
  }
146
189
  function pathsToPatterns(paths) {
147
190
  // TODO: Does not support `~/` paths.
148
- return paths.map(p => p === '.' ? '**/*' : p);
191
+ return paths.map(p => (p === '.' ? '**/*' : p))
149
192
  }
150
193
  function findBinPathDetailsSync(binName) {
151
- const binPaths = which.sync(binName, {
152
- all: true,
153
- nothrow: true
154
- }) ?? [];
155
- let shadowIndex = -1;
156
- let theBinPath;
157
- for (let i = 0, {
158
- length
159
- } = binPaths; i < length; i += 1) {
160
- const binPath = binPaths[i];
194
+ const binPaths =
195
+ which.sync(binName, {
196
+ all: true,
197
+ nothrow: true
198
+ }) ?? []
199
+ let shadowIndex = -1
200
+ let theBinPath
201
+ for (let i = 0, { length } = binPaths; i < length; i += 1) {
202
+ const binPath = binPaths[i]
161
203
  // Skip our bin directory if it's in the front.
162
204
  if (path.dirname(binPath) === shadowBinPath) {
163
- shadowIndex = i;
205
+ shadowIndex = i
164
206
  } else {
165
- theBinPath = npm.resolveBinPath(binPath);
166
- break;
207
+ theBinPath = npm.resolveBinPath(binPath)
208
+ break
167
209
  }
168
210
  }
169
211
  return {
170
212
  name: binName,
171
213
  path: theBinPath,
172
214
  shadowed: shadowIndex !== -1
173
- };
215
+ }
174
216
  }
175
217
  function findNpmPathSync(npmBinPath) {
176
218
  // Lazily access constants.WIN32.
177
- const {
178
- WIN32
179
- } = constants;
180
- let thePath = npmBinPath;
219
+ const { WIN32 } = constants
220
+ let thePath = npmBinPath
181
221
  while (true) {
182
- const libNmNpmPath = path.join(thePath, 'lib', NODE_MODULES$1, NPM$1);
222
+ const libNmNpmPath = path.join(thePath, 'lib', NODE_MODULES$1, NPM$1)
183
223
  // mise puts its npm bin in a path like:
184
224
  // /Users/SomeUsername/.local/share/mise/installs/node/vX.X.X/bin/npm.
185
225
  // HOWEVER, the location of the npm install is:
186
226
  // /Users/SomeUsername/.local/share/mise/installs/node/vX.X.X/lib/node_modules/npm.
187
227
  if (
188
- // Use existsSync here because statsSync, even with { throwIfNoEntry: false },
189
- // will throw an ENOTDIR error for paths like ./a-file-that-exists/a-directory-that-does-not.
190
- // See https://github.com/nodejs/node/issues/56993.
191
- fs.existsSync(libNmNpmPath) && fs.statSync(libNmNpmPath, {
192
- throwIfNoEntry: false
193
- })?.isDirectory()) {
194
- thePath = path.join(libNmNpmPath, NPM$1);
228
+ // Use existsSync here because statsSync, even with { throwIfNoEntry: false },
229
+ // will throw an ENOTDIR error for paths like ./a-file-that-exists/a-directory-that-does-not.
230
+ // See https://github.com/nodejs/node/issues/56993.
231
+ fs.existsSync(libNmNpmPath) &&
232
+ fs
233
+ .statSync(libNmNpmPath, {
234
+ throwIfNoEntry: false
235
+ })
236
+ ?.isDirectory()
237
+ ) {
238
+ thePath = path.join(libNmNpmPath, NPM$1)
195
239
  }
196
- const nmPath = path.join(thePath, NODE_MODULES$1);
240
+ const nmPath = path.join(thePath, NODE_MODULES$1)
197
241
  if (
198
- // npm bin paths may look like:
199
- // /usr/local/share/npm/bin/npm
200
- // /Users/SomeUsername/.nvm/versions/node/vX.X.X/bin/npm
201
- // C:\Users\SomeUsername\AppData\Roaming\npm\bin\npm.cmd
202
- // OR
203
- // C:\Program Files\nodejs\npm.cmd
204
- //
205
- // In practically all cases the npm path contains a node_modules folder:
206
- // /usr/local/share/npm/bin/npm/node_modules
207
- // C:\Program Files\nodejs\node_modules
208
- fs.existsSync(nmPath) && fs.statSync(nmPath, {
209
- throwIfNoEntry: false
210
- })?.isDirectory() && (
211
- // Optimistically look for the default location.
212
- path.basename(thePath) === NPM$1 ||
213
- // Chocolatey installs npm bins in the same directory as node bins.
214
- WIN32 && fs.existsSync(path.join(thePath, `${NPM$1}.cmd`)))) {
215
- return thePath;
242
+ // npm bin paths may look like:
243
+ // /usr/local/share/npm/bin/npm
244
+ // /Users/SomeUsername/.nvm/versions/node/vX.X.X/bin/npm
245
+ // C:\Users\SomeUsername\AppData\Roaming\npm\bin\npm.cmd
246
+ // OR
247
+ // C:\Program Files\nodejs\npm.cmd
248
+ //
249
+ // In practically all cases the npm path contains a node_modules folder:
250
+ // /usr/local/share/npm/bin/npm/node_modules
251
+ // C:\Program Files\nodejs\node_modules
252
+ fs.existsSync(nmPath) &&
253
+ fs
254
+ .statSync(nmPath, {
255
+ throwIfNoEntry: false
256
+ })
257
+ ?.isDirectory() &&
258
+ // Optimistically look for the default location.
259
+ (path.basename(thePath) === NPM$1 ||
260
+ // Chocolatey installs npm bins in the same directory as node bins.
261
+ (WIN32 && fs.existsSync(path.join(thePath, `${NPM$1}.cmd`))))
262
+ ) {
263
+ return thePath
216
264
  }
217
- const parent = path.dirname(thePath);
265
+ const parent = path.dirname(thePath)
218
266
  if (parent === thePath) {
219
- return undefined;
267
+ return undefined
220
268
  }
221
- thePath = parent;
269
+ thePath = parent
222
270
  }
223
271
  }
224
272
  async function getPackageFilesForScan(cwd, inputPaths, supportedFiles, config) {
225
- debug.debugLog(`Globbed resolving ${inputPaths.length} paths:`, inputPaths);
273
+ debug.debugLog(`Globbed resolving ${inputPaths.length} paths:`, inputPaths)
226
274
  const entries = await globWithGitIgnore(pathsToPatterns(inputPaths), {
227
275
  cwd,
228
276
  socketConfig: config
229
- });
230
- debug.debugLog(`Globbed resolved ${inputPaths.length} paths to ${entries.length} paths:`, entries);
231
- const packageFiles = await filterGlobResultToSupportedFiles(entries, supportedFiles);
232
- debug.debugLog(`Mapped ${entries.length} entries to ${packageFiles.length} files:`, packageFiles);
233
- return packageFiles;
277
+ })
278
+ debug.debugLog(
279
+ `Globbed resolved ${inputPaths.length} paths to ${entries.length} paths:`,
280
+ entries
281
+ )
282
+ const packageFiles = await filterGlobResultToSupportedFiles(
283
+ entries,
284
+ supportedFiles
285
+ )
286
+ debug.debugLog(
287
+ `Mapped ${entries.length} entries to ${packageFiles.length} files:`,
288
+ packageFiles
289
+ )
290
+ return packageFiles
234
291
  }
235
292
 
236
- const {
237
- NODE_MODULES,
238
- NPM,
239
- NPX,
240
- SOCKET_CLI_ISSUES_URL
241
- } = constants;
293
+ const { NODE_MODULES, NPM, NPX, SOCKET_CLI_ISSUES_URL } = constants
242
294
  function exitWithBinPathError(binName) {
243
- logger.logger.fail(`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable.`);
295
+ logger.logger.fail(
296
+ `Socket unable to locate ${binName}; ensure it is available in the PATH environment variable.`
297
+ )
244
298
  // The exit code 127 indicates that the command or binary being executed
245
299
  // could not be found.
246
- process.exit(127);
300
+ // eslint-disable-next-line n/no-process-exit
301
+ process.exit(127)
247
302
  }
248
- let _npmBinPathDetails;
303
+ let _npmBinPathDetails
249
304
  function getNpmBinPathDetails() {
250
305
  if (_npmBinPathDetails === undefined) {
251
- _npmBinPathDetails = findBinPathDetailsSync(NPM);
306
+ _npmBinPathDetails = findBinPathDetailsSync(NPM)
252
307
  }
253
- return _npmBinPathDetails;
308
+ return _npmBinPathDetails
254
309
  }
255
- let _npxBinPathDetails;
310
+ let _npxBinPathDetails
256
311
  function getNpxBinPathDetails() {
257
312
  if (_npxBinPathDetails === undefined) {
258
- _npxBinPathDetails = findBinPathDetailsSync(NPX);
313
+ _npxBinPathDetails = findBinPathDetailsSync(NPX)
259
314
  }
260
- return _npxBinPathDetails;
315
+ return _npxBinPathDetails
261
316
  }
262
- let _npmBinPath;
317
+ let _npmBinPath
263
318
  function getNpmBinPath() {
264
319
  if (_npmBinPath === undefined) {
265
- _npmBinPath = getNpmBinPathDetails().path;
320
+ _npmBinPath = getNpmBinPathDetails().path
266
321
  if (!_npmBinPath) {
267
- exitWithBinPathError(NPM);
322
+ exitWithBinPathError(NPM)
268
323
  }
269
324
  }
270
- return _npmBinPath;
325
+ return _npmBinPath
271
326
  }
272
327
  function isNpmBinPathShadowed() {
273
- return getNpmBinPathDetails().shadowed;
328
+ return getNpmBinPathDetails().shadowed
274
329
  }
275
- let _npxBinPath;
330
+ let _npxBinPath
276
331
  function getNpxBinPath() {
277
332
  if (_npxBinPath === undefined) {
278
- _npxBinPath = getNpxBinPathDetails().path;
333
+ _npxBinPath = getNpxBinPathDetails().path
279
334
  if (!_npxBinPath) {
280
- exitWithBinPathError(NPX);
335
+ exitWithBinPathError(NPX)
281
336
  }
282
337
  }
283
- return _npxBinPath;
338
+ return _npxBinPath
284
339
  }
285
340
  function isNpxBinPathShadowed() {
286
- return getNpxBinPathDetails().shadowed;
341
+ return getNpxBinPathDetails().shadowed
287
342
  }
288
- let _npmPath;
343
+ let _npmPath
289
344
  function getNpmPath() {
290
345
  if (_npmPath === undefined) {
291
- const npmBinPath = getNpmBinPath();
292
- _npmPath = npmBinPath ? findNpmPathSync(npmBinPath) : undefined;
346
+ const npmBinPath = getNpmBinPath()
347
+ _npmPath = npmBinPath ? findNpmPathSync(npmBinPath) : undefined
293
348
  if (!_npmPath) {
294
- let message = 'Unable to find npm CLI install directory.';
349
+ let message = 'Unable to find npm CLI install directory.'
295
350
  if (npmBinPath) {
296
- message += `\nSearched parent directories of ${path.dirname(npmBinPath)}.`;
351
+ message += `\nSearched parent directories of ${path.dirname(npmBinPath)}.`
297
352
  }
298
- message += `\n\nThis is may be a bug with socket-npm related to changes to the npm CLI.\nPlease report to ${SOCKET_CLI_ISSUES_URL}.`;
299
- logger.logger.fail(message);
353
+ message += `\n\nThis is may be a bug with socket-npm related to changes to the npm CLI.\nPlease report to ${SOCKET_CLI_ISSUES_URL}.`
354
+ logger.logger.fail(message)
300
355
  // The exit code 127 indicates that the command or binary being executed
301
356
  // could not be found.
302
- process.exit(127);
357
+ // eslint-disable-next-line n/no-process-exit
358
+ process.exit(127)
303
359
  }
304
360
  }
305
- return _npmPath;
361
+ return _npmPath
306
362
  }
307
- let _npmRequire;
363
+ let _npmRequire
308
364
  function getNpmRequire() {
309
365
  if (_npmRequire === undefined) {
310
- const npmPath = getNpmPath();
311
- const npmNmPath = path.join(npmPath, NODE_MODULES, NPM);
312
- _npmRequire = Module.createRequire(path.join(fs.existsSync(npmNmPath) ? npmNmPath : npmPath, '<dummy-basename>'));
366
+ const npmPath = getNpmPath()
367
+ const npmNmPath = path.join(npmPath, NODE_MODULES, NPM)
368
+ _npmRequire = Module.createRequire(
369
+ path.join(
370
+ fs.existsSync(npmNmPath) ? npmNmPath : npmPath,
371
+ '<dummy-basename>'
372
+ )
373
+ )
313
374
  }
314
- return _npmRequire;
375
+ return _npmRequire
315
376
  }
316
- let _arboristPkgPath;
377
+ let _arboristPkgPath
317
378
  function getArboristPackagePath() {
318
379
  if (_arboristPkgPath === undefined) {
319
- const pkgName = '@npmcli/arborist';
320
- const mainPathWithForwardSlashes = path$1.normalizePath(getNpmRequire().resolve(pkgName));
321
- const arboristPkgPathWithForwardSlashes = mainPathWithForwardSlashes.slice(0, mainPathWithForwardSlashes.lastIndexOf(pkgName) + pkgName.length);
380
+ const pkgName = '@npmcli/arborist'
381
+ const mainPathWithForwardSlashes = path$1.normalizePath(
382
+ getNpmRequire().resolve(pkgName)
383
+ )
384
+ const arboristPkgPathWithForwardSlashes = mainPathWithForwardSlashes.slice(
385
+ 0,
386
+ mainPathWithForwardSlashes.lastIndexOf(pkgName) + pkgName.length
387
+ )
322
388
  // Lazily access constants.WIN32.
323
- _arboristPkgPath = constants.WIN32 ? path.normalize(arboristPkgPathWithForwardSlashes) : arboristPkgPathWithForwardSlashes;
389
+ _arboristPkgPath = constants.WIN32
390
+ ? path.normalize(arboristPkgPathWithForwardSlashes)
391
+ : arboristPkgPathWithForwardSlashes
324
392
  }
325
- return _arboristPkgPath;
393
+ return _arboristPkgPath
326
394
  }
327
- let _arboristClassPath;
395
+ let _arboristClassPath
328
396
  function getArboristClassPath() {
329
397
  if (_arboristClassPath === undefined) {
330
- _arboristClassPath = path.join(getArboristPackagePath(), 'lib/arborist/index.js');
398
+ _arboristClassPath = path.join(
399
+ getArboristPackagePath(),
400
+ 'lib/arborist/index.js'
401
+ )
331
402
  }
332
- return _arboristClassPath;
403
+ return _arboristClassPath
333
404
  }
334
- let _arboristDepValidPath;
405
+ let _arboristDepValidPath
335
406
  function getArboristDepValidPath() {
336
407
  if (_arboristDepValidPath === undefined) {
337
- _arboristDepValidPath = path.join(getArboristPackagePath(), 'lib/dep-valid.js');
408
+ _arboristDepValidPath = path.join(
409
+ getArboristPackagePath(),
410
+ 'lib/dep-valid.js'
411
+ )
338
412
  }
339
- return _arboristDepValidPath;
413
+ return _arboristDepValidPath
340
414
  }
341
- let _arboristEdgeClassPath;
415
+ let _arboristEdgeClassPath
342
416
  function getArboristEdgeClassPath() {
343
417
  if (_arboristEdgeClassPath === undefined) {
344
- _arboristEdgeClassPath = path.join(getArboristPackagePath(), 'lib/edge.js');
418
+ _arboristEdgeClassPath = path.join(getArboristPackagePath(), 'lib/edge.js')
345
419
  }
346
- return _arboristEdgeClassPath;
420
+ return _arboristEdgeClassPath
347
421
  }
348
- let _arboristNodeClassPath;
422
+ let _arboristNodeClassPath
349
423
  function getArboristNodeClassPath() {
350
424
  if (_arboristNodeClassPath === undefined) {
351
- _arboristNodeClassPath = path.join(getArboristPackagePath(), 'lib/node.js');
425
+ _arboristNodeClassPath = path.join(getArboristPackagePath(), 'lib/node.js')
352
426
  }
353
- return _arboristNodeClassPath;
427
+ return _arboristNodeClassPath
354
428
  }
355
- let _arboristOverrideSetClassPath;
429
+ let _arboristOverrideSetClassPath
356
430
  function getArboristOverrideSetClassPath() {
357
431
  if (_arboristOverrideSetClassPath === undefined) {
358
- _arboristOverrideSetClassPath = path.join(getArboristPackagePath(), 'lib/override-set.js');
432
+ _arboristOverrideSetClassPath = path.join(
433
+ getArboristPackagePath(),
434
+ 'lib/override-set.js'
435
+ )
359
436
  }
360
- return _arboristOverrideSetClassPath;
437
+ return _arboristOverrideSetClassPath
361
438
  }
362
439
 
363
- exports.getArboristClassPath = getArboristClassPath;
364
- exports.getArboristDepValidPath = getArboristDepValidPath;
365
- exports.getArboristEdgeClassPath = getArboristEdgeClassPath;
366
- exports.getArboristNodeClassPath = getArboristNodeClassPath;
367
- exports.getArboristOverrideSetClassPath = getArboristOverrideSetClassPath;
368
- exports.getNpmBinPath = getNpmBinPath;
369
- exports.getNpmRequire = getNpmRequire;
370
- exports.getNpxBinPath = getNpxBinPath;
371
- exports.getPackageFilesForScan = getPackageFilesForScan;
372
- exports.isNpmBinPathShadowed = isNpmBinPathShadowed;
373
- exports.isNpxBinPathShadowed = isNpxBinPathShadowed;
374
- //# debugId=13ebca93-7937-4895-a63d-3f53428c40b
440
+ exports.getArboristClassPath = getArboristClassPath
441
+ exports.getArboristDepValidPath = getArboristDepValidPath
442
+ exports.getArboristEdgeClassPath = getArboristEdgeClassPath
443
+ exports.getArboristNodeClassPath = getArboristNodeClassPath
444
+ exports.getArboristOverrideSetClassPath = getArboristOverrideSetClassPath
445
+ exports.getNpmBinPath = getNpmBinPath
446
+ exports.getNpmRequire = getNpmRequire
447
+ exports.getNpxBinPath = getNpxBinPath
448
+ exports.getPackageFilesForScan = getPackageFilesForScan
449
+ exports.isNpmBinPathShadowed = isNpmBinPathShadowed
450
+ exports.isNpxBinPathShadowed = isNpxBinPathShadowed
451
+ //# debugId=4777fee1-28c3-4c4f-a837-eddb2bc51332
375
452
  //# sourceMappingURL=shadow-npm-paths.js.map