@socketsecurity/cli-with-sentry 0.14.130 → 0.14.131

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 (59) hide show
  1. package/bin/cli.js +37 -44
  2. package/bin/npx-cli.js +1 -3
  3. package/dist/{module-sync/cli.js → cli.js} +55 -36
  4. package/dist/cli.js.map +1 -0
  5. package/dist/constants.js +8 -25
  6. package/dist/constants.js.map +1 -1
  7. package/dist/instrument-with-sentry.js +3 -14
  8. package/dist/instrument-with-sentry.js.map +1 -1
  9. package/dist/{module-sync/shadow-bin.js → shadow-bin.js} +52 -1
  10. package/dist/shadow-bin.js.map +1 -0
  11. package/dist/{module-sync/shadow-npm-inject.js → shadow-npm-inject.js} +55 -16
  12. package/dist/shadow-npm-inject.js.map +1 -0
  13. package/dist/shadow-npm-paths.js.map +1 -0
  14. package/dist/{module-sync/vendor.js → vendor.js} +10320 -4778
  15. package/dist/vendor.js.map +1 -0
  16. package/package.json +16 -26
  17. package/dist/constants.d.ts +0 -285
  18. package/dist/instrument-with-sentry.d.ts +0 -1
  19. package/dist/module-sync/arborist-helpers.d.ts +0 -68
  20. package/dist/module-sync/artifact.d.ts +0 -63
  21. package/dist/module-sync/cli.d.ts +0 -2
  22. package/dist/module-sync/cli.js.map +0 -1
  23. package/dist/module-sync/cmd.d.ts +0 -4
  24. package/dist/module-sync/config.d.ts +0 -44
  25. package/dist/module-sync/constants.js +0 -3
  26. package/dist/module-sync/edge.d.ts +0 -78
  27. package/dist/module-sync/errors.d.ts +0 -29
  28. package/dist/module-sync/fs.d.ts +0 -63
  29. package/dist/module-sync/index.d.ts +0 -34
  30. package/dist/module-sync/node.d.ts +0 -121
  31. package/dist/module-sync/override-set.d.ts +0 -43
  32. package/dist/module-sync/package-environment.d.ts +0 -83
  33. package/dist/module-sync/path-resolve.d.ts +0 -15
  34. package/dist/module-sync/sdk.d.ts +0 -9
  35. package/dist/module-sync/semver.d.ts +0 -17
  36. package/dist/module-sync/shadow-bin.d.ts +0 -5
  37. package/dist/module-sync/shadow-bin.js.map +0 -1
  38. package/dist/module-sync/shadow-npm-inject.d.ts +0 -1
  39. package/dist/module-sync/shadow-npm-inject.js.map +0 -1
  40. package/dist/module-sync/shadow-npm-paths.d.ts +0 -27
  41. package/dist/module-sync/shadow-npm-paths.js.map +0 -1
  42. package/dist/module-sync/socket-package-alert.d.ts +0 -104
  43. package/dist/module-sync/vendor.d.ts +0 -0
  44. package/dist/module-sync/vendor.js.map +0 -1
  45. package/dist/require/cli.d.ts +0 -2
  46. package/dist/require/cli.js +0 -12340
  47. package/dist/require/cli.js.map +0 -1
  48. package/dist/require/constants.js +0 -3
  49. package/dist/require/shadow-bin.d.ts +0 -5
  50. package/dist/require/shadow-bin.js +0 -110
  51. package/dist/require/shadow-bin.js.map +0 -1
  52. package/dist/require/shadow-npm-inject.d.ts +0 -1
  53. package/dist/require/shadow-npm-inject.js +0 -2596
  54. package/dist/require/shadow-npm-inject.js.map +0 -1
  55. package/dist/require/shadow-npm-paths.d.ts +0 -27
  56. package/dist/require/shadow-npm-paths.js +0 -292
  57. package/dist/require/shadow-npm-paths.js.map +0 -1
  58. package/dist/require/vendor.js +0 -3
  59. /package/dist/{module-sync/shadow-npm-paths.js → shadow-npm-paths.js} +0 -0
@@ -1,3 +0,0 @@
1
- 'use strict'
2
-
3
- module.exports = require('../module-sync/constants.js')
@@ -1,5 +0,0 @@
1
- declare function shadowBin(
2
- binName: 'npm' | 'npx',
3
- args?: string[]
4
- ): Promise<void>
5
- export { shadowBin as default }
@@ -1,110 +0,0 @@
1
- 'use strict'
2
-
3
- const process = require('node:process')
4
- const debug = require('@socketsecurity/registry/lib/debug')
5
- const npm = require('@socketsecurity/registry/lib/npm')
6
- const spawn = require('@socketsecurity/registry/lib/spawn')
7
- const path = require('node:path')
8
- const vendor = require('./vendor.js')
9
- const shadowNpmPaths = require('./shadow-npm-paths.js')
10
- const constants = require('./constants.js')
11
-
12
- const { CLI, NPX } = constants
13
- async function installLinks(realBinPath, binName) {
14
- const isNpx = binName === NPX
15
- // Find package manager being shadowed by this process.
16
- const binPath = isNpx
17
- ? shadowNpmPaths.getNpxBinPath()
18
- : shadowNpmPaths.getNpmBinPath()
19
- // Lazily access constants.WIN32.
20
- const { WIN32 } = constants
21
- // TODO: Is this early exit needed?
22
- if (WIN32 && binPath) {
23
- return binPath
24
- }
25
- const shadowed = isNpx
26
- ? shadowNpmPaths.isNpxBinPathShadowed()
27
- : shadowNpmPaths.isNpmBinPathShadowed()
28
- // Move our bin directory to front of PATH so its found first.
29
- if (!shadowed) {
30
- if (WIN32) {
31
- await vendor.libExports(
32
- // Lazily access constants.rootDistPath.
33
- path.join(constants.rootDistPath, `${binName}-${CLI}.js`),
34
- path.join(realBinPath, binName)
35
- )
36
- }
37
- const { env } = process
38
- env['PATH'] = `${realBinPath}${path.delimiter}${env['PATH']}`
39
- }
40
- return binPath
41
- }
42
-
43
- const { SOCKET_CLI_SAFE_BIN, SOCKET_CLI_SAFE_PROGRESS, SOCKET_IPC_HANDSHAKE } =
44
- constants
45
- async function shadowBin(binName, args = process.argv.slice(2)) {
46
- process.exitCode = 1
47
- const useDebug = debug.isDebug()
48
- const terminatorPos = args.indexOf('--')
49
- const rawBinArgs = terminatorPos === -1 ? args : args.slice(0, terminatorPos)
50
- const progressArg =
51
- rawBinArgs.findLast(npm.isProgressFlag) !== '--no-progress'
52
- const binArgs = rawBinArgs.filter(a => !npm.isProgressFlag(a))
53
- const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos)
54
- const isSilent = !useDebug && !binArgs.some(npm.isLoglevelFlag)
55
- // The default value of loglevel is "notice". We default to "error" which is
56
- // two levels quieter.
57
- const logLevelArgs = isSilent ? ['--loglevel', 'error'] : []
58
- const spawnPromise = spawn.spawn(
59
- // Lazily access constants.execPath.
60
- constants.execPath,
61
- [
62
- // Lazily access constants.nodeHardenFlags.
63
- ...constants.nodeHardenFlags,
64
- // Lazily access constants.nodeNoWarningsFlags.
65
- ...constants.nodeNoWarningsFlags,
66
- // Lazily access true.
67
- ...[
68
- '--require',
69
- // Lazily access constants.distInstrumentWithSentryPath.
70
- constants.distInstrumentWithSentryPath
71
- ],
72
- '--require',
73
- // Lazily access constants.distShadowNpmInjectPath.
74
- constants.distShadowNpmInjectPath,
75
- // Lazily access constants.shadowBinPath.
76
- await installLinks(constants.shadowBinPath, binName),
77
- // Add '--no-progress' to fix input being swallowed by the npm spinner.
78
- '--no-progress',
79
- // Add '--loglevel=error' if a loglevel flag is not provided and the
80
- // SOCKET_CLI_DEBUG environment variable is not truthy.
81
- ...logLevelArgs,
82
- ...binArgs,
83
- ...otherArgs
84
- ],
85
- {
86
- // 'inherit' + 'ipc'
87
- stdio: [0, 1, 2, 'ipc']
88
- }
89
- )
90
- // See https://nodejs.org/api/all.html#all_child_process_event-exit.
91
- spawnPromise.process.on('exit', (code, signalName) => {
92
- if (signalName) {
93
- process.kill(process.pid, signalName)
94
- } else if (code !== null) {
95
- // eslint-disable-next-line n/no-process-exit
96
- process.exit(code)
97
- }
98
- })
99
- spawnPromise.process.send({
100
- [SOCKET_IPC_HANDSHAKE]: {
101
- [SOCKET_CLI_SAFE_BIN]: binName,
102
- [SOCKET_CLI_SAFE_PROGRESS]: progressArg
103
- }
104
- })
105
- await spawnPromise
106
- }
107
-
108
- module.exports = shadowBin
109
- //# debugId=a3ff14de-2729-4213-91d1-6f1ab7249f1d
110
- //# sourceMappingURL=shadow-bin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shadow-bin.js","sources":["../../src/shadow/npm/link.ts","../../src/shadow/npm/bin.ts"],"sourcesContent":["import path from 'node:path'\nimport process from 'node:process'\n\nimport cmdShim from 'cmd-shim'\n\nimport {\n getNpmBinPath,\n getNpxBinPath,\n isNpmBinPathShadowed,\n isNpxBinPathShadowed\n} from './paths'\nimport constants from '../../constants'\n\nconst { CLI, NPX } = constants\n\nexport async function installLinks(\n realBinPath: string,\n binName: 'npm' | 'npx'\n): Promise<string> {\n const isNpx = binName === NPX\n // Find package manager being shadowed by this process.\n const binPath = isNpx ? getNpxBinPath() : getNpmBinPath()\n // Lazily access constants.WIN32.\n const { WIN32 } = constants\n // TODO: Is this early exit needed?\n if (WIN32 && binPath) {\n return binPath\n }\n const shadowed = isNpx ? isNpxBinPathShadowed() : isNpmBinPathShadowed()\n // Move our bin directory to front of PATH so its found first.\n if (!shadowed) {\n if (WIN32) {\n await cmdShim(\n // Lazily access constants.rootDistPath.\n path.join(constants.rootDistPath, `${binName}-${CLI}.js`),\n path.join(realBinPath, binName)\n )\n }\n const { env } = process\n env['PATH'] = `${realBinPath}${path.delimiter}${env['PATH']}`\n }\n return binPath\n}\n","import process from 'node:process'\n\nimport { isDebug } from '@socketsecurity/registry/lib/debug'\nimport {\n isLoglevelFlag,\n isProgressFlag\n} from '@socketsecurity/registry/lib/npm'\nimport { spawn } from '@socketsecurity/registry/lib/spawn'\n\nimport { installLinks } from './link'\nimport constants from '../../constants'\n\nconst { SOCKET_CLI_SAFE_BIN, SOCKET_CLI_SAFE_PROGRESS, SOCKET_IPC_HANDSHAKE } =\n constants\n\nexport default async function shadowBin(\n binName: 'npm' | 'npx',\n args = process.argv.slice(2)\n) {\n process.exitCode = 1\n const useDebug = isDebug()\n const terminatorPos = args.indexOf('--')\n const rawBinArgs = terminatorPos === -1 ? args : args.slice(0, terminatorPos)\n const progressArg = rawBinArgs.findLast(isProgressFlag) !== '--no-progress'\n const binArgs = rawBinArgs.filter(a => !isProgressFlag(a))\n const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos)\n const isSilent = !useDebug && !binArgs.some(isLoglevelFlag)\n // The default value of loglevel is \"notice\". We default to \"error\" which is\n // two levels quieter.\n const logLevelArgs = isSilent ? ['--loglevel', 'error'] : []\n const spawnPromise = spawn(\n // Lazily access constants.execPath.\n constants.execPath,\n [\n // Lazily access constants.nodeHardenFlags.\n ...constants.nodeHardenFlags,\n // Lazily access constants.nodeNoWarningsFlags.\n ...constants.nodeNoWarningsFlags,\n // Lazily access process.env['INLINED_SOCKET_CLI_SENTRY_BUILD'].\n ...(process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']\n ? [\n '--require',\n // Lazily access constants.distInstrumentWithSentryPath.\n constants.distInstrumentWithSentryPath\n ]\n : []),\n '--require',\n // Lazily access constants.distShadowNpmInjectPath.\n constants.distShadowNpmInjectPath,\n // Lazily access constants.shadowBinPath.\n await installLinks(constants.shadowBinPath, binName),\n // Add '--no-progress' to fix input being swallowed by the npm spinner.\n '--no-progress',\n // Add '--loglevel=error' if a loglevel flag is not provided and the\n // SOCKET_CLI_DEBUG environment variable is not truthy.\n ...logLevelArgs,\n ...binArgs,\n ...otherArgs\n ],\n {\n // 'inherit' + 'ipc'\n stdio: [0, 1, 2, 'ipc']\n }\n )\n // See https://nodejs.org/api/all.html#all_child_process_event-exit.\n spawnPromise.process.on('exit', (code, signalName) => {\n if (signalName) {\n process.kill(process.pid, signalName)\n } else if (code !== null) {\n // eslint-disable-next-line n/no-process-exit\n process.exit(code)\n }\n })\n spawnPromise.process.send({\n [SOCKET_IPC_HANDSHAKE]: {\n [SOCKET_CLI_SAFE_BIN]: binName,\n [SOCKET_CLI_SAFE_PROGRESS]: progressArg\n }\n })\n await spawnPromise\n}\n"],"names":["NPX","WIN32","env","SOCKET_IPC_HANDSHAKE","constants","process","spawnPromise"],"mappings":";;;;;;;;;;;AAaA;;AAAaA;AAAI;AAEV;AAIL;AACA;;AAEA;;AACQC;AAAM;AACd;;AAEE;AACF;;AAEA;;AAEE;AACE;AACE;;AAIJ;;AACQC;AAAI;AACZA;AACF;AACA;AACF;;AC9BA;;;AAAuDC;AAAqB;AAG7D;;AAKb;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGE;;AAGE;;AAEA;;AAEA;;AAIM;AACAC;AAIN;AACAA;AACA;AACA;AACA;;AAEA;AACA;;AAMA;;AAEF;AAEF;;AAEE;;AAEA;AACE;AACAC;AACF;AACF;AACAC;AACE;;AAEE;AACF;AACF;AACA;AACF;;","debugId":"a3ff14de-2729-4213-91d1-6f1ab7249f1d"}
@@ -1 +0,0 @@
1
- export {}