@socketsecurity/cli-with-sentry 0.14.45 → 0.14.47
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.
- package/dist/constants.d.ts +7 -2
- package/dist/constants.js +215 -3
- package/dist/constants.js.map +1 -1
- package/dist/instrument-with-sentry.js +9 -7
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/module-sync/cli.js +388 -259
- package/dist/module-sync/cli.js.map +1 -1
- package/dist/module-sync/index.js +14 -14
- package/dist/module-sync/index.js.map +1 -1
- package/dist/module-sync/npm-paths.js +7 -7
- package/dist/module-sync/npm-paths.js.map +1 -1
- package/dist/module-sync/npm.js +6 -6
- package/dist/module-sync/npm.js.map +1 -1
- package/dist/module-sync/shadow-bin.js +12 -12
- package/dist/module-sync/shadow-bin.js.map +1 -1
- package/dist/require/cli.d.ts +2 -0
- package/dist/require/cli.js +360 -231
- package/dist/require/cli.js.map +1 -0
- package/dist/require/vendor.js.map +1 -0
- package/package.json +17 -15
- package/dist/module-sync/constants2.d.ts +0 -0
- package/dist/module-sync/constants2.js +0 -231
- package/dist/module-sync/constants2.js.map +0 -1
package/dist/constants.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ type ENV = Remap<RegistryEnv & Readonly<{
|
|
|
17
17
|
SOCKET_CLI_LEGACY_BUILD: boolean;
|
|
18
18
|
SOCKET_CLI_PUBLISHED_BUILD: boolean;
|
|
19
19
|
SOCKET_CLI_SENTRY_BUILD: boolean;
|
|
20
|
+
SOCKET_CLI_SHOW_BANNER: boolean;
|
|
20
21
|
SOCKET_CLI_VERSION_HASH: string;
|
|
21
22
|
}>>;
|
|
22
23
|
type IPC = Readonly<{
|
|
@@ -25,15 +26,15 @@ type IPC = Readonly<{
|
|
|
25
26
|
SOCKET_CLI_SAFE_WRAPPER?: boolean;
|
|
26
27
|
}>;
|
|
27
28
|
declare const constants: {
|
|
29
|
+
readonly CI: "CI";
|
|
28
30
|
readonly [kInternalsSymbol]: registryConstants.Internals;
|
|
29
31
|
readonly NODE_MODULES: "node_modules";
|
|
30
32
|
readonly PACKAGE_JSON: "package.json";
|
|
31
|
-
readonly TAP: "TAP";
|
|
32
33
|
readonly kInternalsSymbol: unique symbol;
|
|
33
|
-
readonly CI: "CI";
|
|
34
34
|
readonly NODE_AUTH_TOKEN: "NODE_AUTH_TOKEN";
|
|
35
35
|
readonly NODE_ENV: "NODE_ENV";
|
|
36
36
|
readonly PRE_COMMIT: "PRE_COMMIT";
|
|
37
|
+
readonly TAP: "TAP";
|
|
37
38
|
readonly VITEST: "VITEST";
|
|
38
39
|
readonly AT_LATEST: "@latest";
|
|
39
40
|
readonly BIOME_JSON: "biome.json";
|
|
@@ -142,13 +143,16 @@ declare const constants: {
|
|
|
142
143
|
readonly SOCKET_CLI_PUBLISHED_BUILD: 'SOCKET_CLI_PUBLISHED_BUILD';
|
|
143
144
|
readonly SOCKET_CLI_SAFE_WRAPPER: 'SOCKET_CLI_SAFE_WRAPPER';
|
|
144
145
|
readonly SOCKET_CLI_SENTRY_BUILD: 'SOCKET_CLI_SENTRY_BUILD';
|
|
146
|
+
readonly SOCKET_CLI_SHOW_BANNER: 'SOCKET_CLI_SHOW_BANNER';
|
|
145
147
|
readonly SOCKET_CLI_VERSION_HASH: 'SOCKET_CLI_VERSION_HASH';
|
|
146
148
|
readonly VLT: 'vlt';
|
|
147
149
|
readonly YARN: 'yarn';
|
|
148
150
|
readonly YARN_BERRY: 'yarn/berry';
|
|
149
151
|
readonly YARN_CLASSIC: 'yarn/classic';
|
|
152
|
+
readonly bashRcPath: string;
|
|
150
153
|
readonly cdxgenBinPath: string;
|
|
151
154
|
readonly distPath: string;
|
|
155
|
+
readonly homePath: string;
|
|
152
156
|
readonly instrumentWithSentryPath: string;
|
|
153
157
|
readonly nmBinPath: string;
|
|
154
158
|
readonly npmInjectionPath: string;
|
|
@@ -158,5 +162,6 @@ declare const constants: {
|
|
|
158
162
|
readonly rootPkgJsonPath: string;
|
|
159
163
|
readonly shadowBinPath: string;
|
|
160
164
|
readonly synpBinPath: string;
|
|
165
|
+
readonly zshRcPath: string;
|
|
161
166
|
};
|
|
162
167
|
export { constants as default };
|
package/dist/constants.js
CHANGED
|
@@ -1,8 +1,220 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var constants = require('./constants2.js');
|
|
3
2
|
|
|
3
|
+
var fs = require('node:fs');
|
|
4
|
+
var os = require('node:os');
|
|
5
|
+
var path = require('node:path');
|
|
6
|
+
var process = require('node:process');
|
|
7
|
+
var registryConstants = require('@socketsecurity/registry/lib/constants');
|
|
8
|
+
var env = require('@socketsecurity/registry/lib/env');
|
|
4
9
|
|
|
10
|
+
const {
|
|
11
|
+
NODE_MODULES,
|
|
12
|
+
PACKAGE_JSON,
|
|
13
|
+
kInternalsSymbol,
|
|
14
|
+
[kInternalsSymbol]: {
|
|
15
|
+
createConstantsObject
|
|
16
|
+
}
|
|
17
|
+
} = registryConstants;
|
|
18
|
+
const ALERT_TYPE_CRITICAL_CVE = 'criticalCVE';
|
|
19
|
+
const ALERT_TYPE_CVE = 'cve';
|
|
20
|
+
const ALERT_TYPE_MEDIUM_CVE = 'mediumCVE';
|
|
21
|
+
const ALERT_TYPE_MILD_CVE = 'mildCVE';
|
|
22
|
+
const ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE = 'socketUpgradeAvailable';
|
|
23
|
+
const API_V0_URL = 'https://api.socket.dev/v0';
|
|
24
|
+
const BABEL_RUNTIME = '@babel/runtime';
|
|
25
|
+
const BINARY_LOCK_EXT = '.lockb';
|
|
26
|
+
const BUN = 'bun';
|
|
27
|
+
const CLI = 'cli';
|
|
28
|
+
const CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER = 'firstPatchedVersionIdentifier';
|
|
29
|
+
const CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE = 'vulnerableVersionRange';
|
|
30
|
+
const LOCK_EXT = '.lock';
|
|
31
|
+
const MODULE_SYNC = 'module-sync';
|
|
32
|
+
const NPM_INJECTION = 'npm-injection';
|
|
33
|
+
const NPM_REGISTRY_URL = 'https://registry.npmjs.org';
|
|
34
|
+
const NPX = 'npx';
|
|
35
|
+
const PNPM = 'pnpm';
|
|
36
|
+
const REQUIRE = 'require';
|
|
37
|
+
const SHADOW_BIN = 'shadow-bin';
|
|
38
|
+
const SOCKET = 'socket';
|
|
39
|
+
const SOCKET_CLI_DEBUG = 'SOCKET_CLI_DEBUG';
|
|
40
|
+
const SOCKET_CLI_FIX = 'SOCKET_CLI_FIX';
|
|
41
|
+
const SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues';
|
|
42
|
+
const SOCKET_CLI_LEGACY_BUILD = 'SOCKET_CLI_LEGACY_BUILD';
|
|
43
|
+
const SOCKET_CLI_OPTIMIZE = 'SOCKET_CLI_OPTIMIZE';
|
|
44
|
+
const SOCKET_CLI_PUBLISHED_BUILD = 'SOCKET_CLI_PUBLISHED_BUILD';
|
|
45
|
+
const SOCKET_CLI_SAFE_WRAPPER = 'SOCKET_CLI_SAFE_WRAPPER';
|
|
46
|
+
const SOCKET_CLI_SENTRY_BUILD = 'SOCKET_CLI_SENTRY_BUILD';
|
|
47
|
+
const SOCKET_CLI_SHOW_BANNER = 'SOCKET_CLI_SHOW_BANNER';
|
|
48
|
+
const SOCKET_CLI_VERSION_HASH = 'SOCKET_CLI_VERSION_HASH';
|
|
49
|
+
const VLT = 'vlt';
|
|
50
|
+
const YARN = 'yarn';
|
|
51
|
+
const YARN_BERRY = `${YARN}/berry`;
|
|
52
|
+
const YARN_CLASSIC = `${YARN}/classic`;
|
|
53
|
+
let _Sentry;
|
|
54
|
+
const LAZY_BATCH_PURL_ENDPOINT = () => {
|
|
55
|
+
const query = new URLSearchParams();
|
|
56
|
+
query.append('alerts', 'true');
|
|
57
|
+
query.append('compact', 'true');
|
|
58
|
+
return `${API_V0_URL}/purl?${query}`;
|
|
59
|
+
};
|
|
60
|
+
const LAZY_DIST_TYPE = () => registryConstants.SUPPORTS_NODE_REQUIRE_MODULE ? MODULE_SYNC : REQUIRE;
|
|
61
|
+
const LAZY_ENV = () => {
|
|
62
|
+
const {
|
|
63
|
+
env: env$1
|
|
64
|
+
} = process;
|
|
65
|
+
// We inline some environment values so that they CANNOT be influenced by user
|
|
66
|
+
// provided environment variables.
|
|
67
|
+
return Object.freeze({
|
|
68
|
+
// Lazily access registryConstants.ENV.
|
|
69
|
+
...registryConstants.ENV,
|
|
70
|
+
// Flag set to help debug Socket CLI.
|
|
71
|
+
[SOCKET_CLI_DEBUG]: env.envAsBoolean(env$1[SOCKET_CLI_DEBUG]),
|
|
72
|
+
// Inlined flag set to determine if this is the Legacy build.
|
|
73
|
+
// The '@rollup/plugin-replace' will replace "process.env[SOCKET_CLI_LEGACY_BUILD]".
|
|
74
|
+
[SOCKET_CLI_LEGACY_BUILD]: false,
|
|
75
|
+
// Inlined flag set to determine if this is a published build.
|
|
76
|
+
// The '@rollup/plugin-replace' will replace "process.env[SOCKET_CLI_PUBLISHED_BUILD]".
|
|
77
|
+
[SOCKET_CLI_PUBLISHED_BUILD]: true,
|
|
78
|
+
// Inlined flag set to determine if this is the Sentry build.
|
|
79
|
+
// The '@rollup/plugin-replace' will replace "process.env[SOCKET_CLI_SENTRY_BUILD]".
|
|
80
|
+
[SOCKET_CLI_SENTRY_BUILD]: true,
|
|
81
|
+
// Flag set to toggle the informative ASCII art banner.
|
|
82
|
+
[SOCKET_CLI_SHOW_BANNER]: env.envAsBoolean(env$1[SOCKET_CLI_SHOW_BANNER]),
|
|
83
|
+
// Inlined flag set to determine the version hash of the build.
|
|
84
|
+
// The '@rollup/plugin-replace' will replace "process.env[SOCKET_CLI_VERSION_HASH]".
|
|
85
|
+
[SOCKET_CLI_VERSION_HASH]: "0.14.47:e0c97e0:714b50c6:pub"
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
const lazyBashRcPath = () =>
|
|
89
|
+
// Lazily access constants.homePath.
|
|
90
|
+
path.join(constants.homePath, '.bashrc');
|
|
91
|
+
const lazyCdxgenBinPath = () =>
|
|
92
|
+
// Lazily access constants.nmBinPath.
|
|
93
|
+
path.join(constants.nmBinPath, 'cdxgen');
|
|
94
|
+
const lazyDistPath = () =>
|
|
95
|
+
// Lazily access constants.rootDistPath and constants.DIST_TYPE.
|
|
96
|
+
path.join(constants.rootDistPath, constants.DIST_TYPE);
|
|
97
|
+
const lazyHomePath = () => os.homedir();
|
|
98
|
+
const lazyInstrumentWithSentryPath = () =>
|
|
99
|
+
// Lazily access constants.rootDistPath.
|
|
100
|
+
path.join(constants.rootDistPath, 'instrument-with-sentry.js');
|
|
101
|
+
const lazyNmBinPath = () =>
|
|
102
|
+
// Lazily access constants.rootPath.
|
|
103
|
+
path.join(constants.rootPath, `${NODE_MODULES}/.bin`);
|
|
104
|
+
const lazyNpmInjectionPath = () =>
|
|
105
|
+
// Lazily access constants.distPath.
|
|
106
|
+
path.join(constants.distPath, `${NPM_INJECTION}.js`);
|
|
107
|
+
const lazyRootBinPath = () =>
|
|
108
|
+
// Lazily access constants.rootPath.
|
|
109
|
+
path.join(constants.rootPath, 'bin');
|
|
110
|
+
const lazyRootDistPath = () =>
|
|
111
|
+
// Lazily access constants.rootPath.
|
|
112
|
+
path.join(constants.rootPath, 'dist');
|
|
113
|
+
const lazyRootPath = () =>
|
|
114
|
+
// The '@rollup/plugin-replace' will replace "process.env.['VITEST']" with `false` and
|
|
115
|
+
// it will be dead code eliminated by Rollup.
|
|
116
|
+
path.resolve(fs.realpathSync.native(__dirname), '..');
|
|
117
|
+
const lazyRootPkgJsonPath = () =>
|
|
118
|
+
// Lazily access constants.rootPath.
|
|
119
|
+
path.join(constants.rootPath, PACKAGE_JSON);
|
|
120
|
+
const lazyShadowBinPath = () =>
|
|
121
|
+
// Lazily access constants.rootPath.
|
|
122
|
+
path.join(constants.rootPath, SHADOW_BIN);
|
|
123
|
+
const lazySynpBinPath = () =>
|
|
124
|
+
// Lazily access constants.nmBinPath.
|
|
125
|
+
path.join(constants.nmBinPath, 'synp');
|
|
126
|
+
const lazyZshRcPath = () =>
|
|
127
|
+
// Lazily access constants.homePath.
|
|
128
|
+
path.join(constants.homePath, '.zshrc');
|
|
129
|
+
const constants = createConstantsObject({
|
|
130
|
+
ALERT_TYPE_CRITICAL_CVE,
|
|
131
|
+
ALERT_TYPE_CVE,
|
|
132
|
+
ALERT_TYPE_MEDIUM_CVE,
|
|
133
|
+
ALERT_TYPE_MILD_CVE,
|
|
134
|
+
ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE,
|
|
135
|
+
API_V0_URL,
|
|
136
|
+
BABEL_RUNTIME,
|
|
137
|
+
// Lazily defined values are initialized as `undefined` to keep their key order.
|
|
138
|
+
BATCH_PURL_ENDPOINT: undefined,
|
|
139
|
+
BINARY_LOCK_EXT,
|
|
140
|
+
BUN,
|
|
141
|
+
CLI,
|
|
142
|
+
CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER,
|
|
143
|
+
CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE,
|
|
144
|
+
DIST_TYPE: undefined,
|
|
145
|
+
ENV: undefined,
|
|
146
|
+
LOCK_EXT,
|
|
147
|
+
MODULE_SYNC,
|
|
148
|
+
NPM_INJECTION,
|
|
149
|
+
NPM_REGISTRY_URL,
|
|
150
|
+
NPX,
|
|
151
|
+
PNPM,
|
|
152
|
+
REQUIRE,
|
|
153
|
+
SHADOW_BIN,
|
|
154
|
+
SOCKET,
|
|
155
|
+
SOCKET_CLI_DEBUG,
|
|
156
|
+
SOCKET_CLI_FIX,
|
|
157
|
+
SOCKET_CLI_ISSUES_URL,
|
|
158
|
+
SOCKET_CLI_LEGACY_BUILD,
|
|
159
|
+
SOCKET_CLI_OPTIMIZE,
|
|
160
|
+
SOCKET_CLI_PUBLISHED_BUILD,
|
|
161
|
+
SOCKET_CLI_SAFE_WRAPPER,
|
|
162
|
+
SOCKET_CLI_SENTRY_BUILD,
|
|
163
|
+
SOCKET_CLI_SHOW_BANNER,
|
|
164
|
+
SOCKET_CLI_VERSION_HASH,
|
|
165
|
+
VLT,
|
|
166
|
+
YARN,
|
|
167
|
+
YARN_BERRY,
|
|
168
|
+
YARN_CLASSIC,
|
|
169
|
+
bashRcPath: undefined,
|
|
170
|
+
cdxgenBinPath: undefined,
|
|
171
|
+
distPath: undefined,
|
|
172
|
+
homePath: undefined,
|
|
173
|
+
instrumentWithSentryPath: undefined,
|
|
174
|
+
nmBinPath: undefined,
|
|
175
|
+
npmInjectionPath: undefined,
|
|
176
|
+
rootBinPath: undefined,
|
|
177
|
+
rootDistPath: undefined,
|
|
178
|
+
rootPath: undefined,
|
|
179
|
+
rootPkgJsonPath: undefined,
|
|
180
|
+
shadowBinPath: undefined,
|
|
181
|
+
synpBinPath: undefined,
|
|
182
|
+
zshRcPath: undefined
|
|
183
|
+
}, {
|
|
184
|
+
getters: {
|
|
185
|
+
BATCH_PURL_ENDPOINT: LAZY_BATCH_PURL_ENDPOINT,
|
|
186
|
+
DIST_TYPE: LAZY_DIST_TYPE,
|
|
187
|
+
ENV: LAZY_ENV,
|
|
188
|
+
bashRcPath: lazyBashRcPath,
|
|
189
|
+
distPath: lazyDistPath,
|
|
190
|
+
cdxgenBinPath: lazyCdxgenBinPath,
|
|
191
|
+
homePath: lazyHomePath,
|
|
192
|
+
instrumentWithSentryPath: lazyInstrumentWithSentryPath,
|
|
193
|
+
nmBinPath: lazyNmBinPath,
|
|
194
|
+
npmInjectionPath: lazyNpmInjectionPath,
|
|
195
|
+
rootBinPath: lazyRootBinPath,
|
|
196
|
+
rootDistPath: lazyRootDistPath,
|
|
197
|
+
rootPath: lazyRootPath,
|
|
198
|
+
rootPkgJsonPath: lazyRootPkgJsonPath,
|
|
199
|
+
shadowBinPath: lazyShadowBinPath,
|
|
200
|
+
synpBinPath: lazySynpBinPath,
|
|
201
|
+
zshRcPath: lazyZshRcPath
|
|
202
|
+
},
|
|
203
|
+
internals: {
|
|
204
|
+
getSentry() {
|
|
205
|
+
return _Sentry;
|
|
206
|
+
},
|
|
207
|
+
setSentry(Sentry) {
|
|
208
|
+
if (_Sentry === undefined) {
|
|
209
|
+
_Sentry = Sentry;
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
mixin: registryConstants
|
|
216
|
+
});
|
|
5
217
|
|
|
6
|
-
module.exports = constants
|
|
7
|
-
//# debugId=
|
|
218
|
+
module.exports = constants;
|
|
219
|
+
//# debugId=2f3f6718-efed-4ef0-9f73-7227183876d4
|
|
8
220
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;","debugId":"415faf35-61fa-4973-8b4c-040eacb52c54"}
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["import { realpathSync } from 'node:fs'\nimport os from 'node:os'\nimport path from 'node:path'\nimport process from 'node:process'\n\nimport registryConstants from '@socketsecurity/registry/lib/constants'\nimport { envAsBoolean } from '@socketsecurity/registry/lib/env'\n\nimport type { Remap } from '@socketsecurity/registry/lib/objects'\n\nconst {\n NODE_MODULES,\n PACKAGE_JSON,\n kInternalsSymbol,\n [kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)']: {\n createConstantsObject\n }\n} = registryConstants\n\ntype RegistryEnv = typeof registryConstants.ENV\n\ntype RegistryInternals = (typeof registryConstants)['Symbol(kInternalsSymbol)']\n\ntype Sentry = any\n\ntype Internals = Remap<\n Omit<RegistryInternals, 'getIPC'> &\n Readonly<{\n getIPC: {\n (): Promise<IPC>\n <K extends keyof IPC | undefined>(\n key?: K\n ): Promise<K extends keyof IPC ? IPC[K] : IPC>\n }\n getSentry: () => Sentry\n setSentry(Sentry: Sentry): boolean\n }>\n>\n\ntype ENV = Remap<\n RegistryEnv &\n Readonly<{\n SOCKET_CLI_DEBUG: boolean\n SOCKET_CLI_LEGACY_BUILD: boolean\n SOCKET_CLI_PUBLISHED_BUILD: boolean\n SOCKET_CLI_SENTRY_BUILD: boolean\n SOCKET_CLI_SHOW_BANNER: boolean\n SOCKET_CLI_VERSION_HASH: string\n }>\n>\n\ntype IPC = Readonly<{\n SOCKET_CLI_FIX?: string\n SOCKET_CLI_OPTIMIZE?: boolean\n SOCKET_CLI_SAFE_WRAPPER?: boolean\n}>\n\ntype Constants = Remap<\n Omit<typeof registryConstants, 'Symbol(kInternalsSymbol)' | 'ENV' | 'IPC'> & {\n readonly 'Symbol(kInternalsSymbol)': Internals\n readonly ALERT_TYPE_CRITICAL_CVE: 'criticalCVE'\n readonly ALERT_TYPE_CVE: 'cve'\n readonly ALERT_TYPE_MEDIUM_CVE: 'mediumCVE'\n readonly ALERT_TYPE_MILD_CVE: 'mildCVE'\n readonly ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE: 'socketUpgradeAvailable'\n readonly API_V0_URL: 'https://api.socket.dev/v0'\n readonly BABEL_RUNTIME: '@babel/runtime'\n readonly BATCH_PURL_ENDPOINT: 'https://api.socket.dev/v0/purl?alerts=true&compact=true'\n readonly BINARY_LOCK_EXT: '.lockb'\n readonly BUN: 'bun'\n readonly CLI: 'cli'\n readonly CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER: 'firstPatchedVersionIdentifier'\n readonly CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE: 'vulnerableVersionRange'\n readonly ENV: ENV\n readonly DIST_TYPE: 'module-sync' | 'require'\n readonly IPC: IPC\n readonly LOCK_EXT: '.lock'\n readonly MODULE_SYNC: 'module-sync'\n readonly NPM_INJECTION: 'npm-injection'\n readonly NPM_REGISTRY_URL: 'https://registry.npmjs.org'\n readonly NPX: 'npx'\n readonly PNPM: 'pnpm'\n readonly REQUIRE: 'require'\n readonly SHADOW_BIN: 'shadow-bin'\n readonly SOCKET: 'socket'\n readonly SOCKET_CLI_DEBUG: 'SOCKET_CLI_DEBUG'\n readonly SOCKET_CLI_FIX: 'SOCKET_CLI_FIX'\n readonly SOCKET_CLI_ISSUES_URL: 'https://github.com/SocketDev/socket-cli/issues'\n readonly SOCKET_CLI_LEGACY_BUILD: 'SOCKET_CLI_LEGACY_BUILD'\n readonly SOCKET_CLI_OPTIMIZE: 'SOCKET_CLI_OPTIMIZE'\n readonly SOCKET_CLI_PUBLISHED_BUILD: 'SOCKET_CLI_PUBLISHED_BUILD'\n readonly SOCKET_CLI_SAFE_WRAPPER: 'SOCKET_CLI_SAFE_WRAPPER'\n readonly SOCKET_CLI_SENTRY_BUILD: 'SOCKET_CLI_SENTRY_BUILD'\n readonly SOCKET_CLI_SHOW_BANNER: 'SOCKET_CLI_SHOW_BANNER'\n readonly SOCKET_CLI_VERSION_HASH: 'SOCKET_CLI_VERSION_HASH'\n readonly VLT: 'vlt'\n readonly YARN: 'yarn'\n readonly YARN_BERRY: 'yarn/berry'\n readonly YARN_CLASSIC: 'yarn/classic'\n readonly bashRcPath: string\n readonly cdxgenBinPath: string\n readonly distPath: string\n readonly homePath: string\n readonly instrumentWithSentryPath: string\n readonly nmBinPath: string\n readonly npmInjectionPath: string\n readonly rootBinPath: string\n readonly rootDistPath: string\n readonly rootPath: string\n readonly rootPkgJsonPath: string\n readonly shadowBinPath: string\n readonly synpBinPath: string\n readonly zshRcPath: string\n }\n>\n\nconst ALERT_TYPE_CRITICAL_CVE = 'criticalCVE'\nconst ALERT_TYPE_CVE = 'cve'\nconst ALERT_TYPE_MEDIUM_CVE = 'mediumCVE'\nconst ALERT_TYPE_MILD_CVE = 'mildCVE'\nconst ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE = 'socketUpgradeAvailable'\nconst API_V0_URL = 'https://api.socket.dev/v0'\nconst BABEL_RUNTIME = '@babel/runtime'\nconst BINARY_LOCK_EXT = '.lockb'\nconst BUN = 'bun'\nconst CLI = 'cli'\nconst CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER =\n 'firstPatchedVersionIdentifier'\nconst CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE = 'vulnerableVersionRange'\nconst LOCK_EXT = '.lock'\nconst MODULE_SYNC = 'module-sync'\nconst NPM_INJECTION = 'npm-injection'\nconst NPM_REGISTRY_URL = 'https://registry.npmjs.org'\nconst NPX = 'npx'\nconst PNPM = 'pnpm'\nconst REQUIRE = 'require'\nconst SHADOW_BIN = 'shadow-bin'\nconst SOCKET = 'socket'\nconst SOCKET_CLI_DEBUG = 'SOCKET_CLI_DEBUG'\nconst SOCKET_CLI_FIX = 'SOCKET_CLI_FIX'\nconst SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues'\nconst SOCKET_CLI_LEGACY_BUILD = 'SOCKET_CLI_LEGACY_BUILD'\nconst SOCKET_CLI_OPTIMIZE = 'SOCKET_CLI_OPTIMIZE'\nconst SOCKET_CLI_PUBLISHED_BUILD = 'SOCKET_CLI_PUBLISHED_BUILD'\nconst SOCKET_CLI_SAFE_WRAPPER = 'SOCKET_CLI_SAFE_WRAPPER'\nconst SOCKET_CLI_SENTRY_BUILD = 'SOCKET_CLI_SENTRY_BUILD'\nconst SOCKET_CLI_SHOW_BANNER = 'SOCKET_CLI_SHOW_BANNER'\nconst SOCKET_CLI_VERSION_HASH = 'SOCKET_CLI_VERSION_HASH'\nconst VLT = 'vlt'\nconst YARN = 'yarn'\nconst YARN_BERRY = `${YARN}/berry`\nconst YARN_CLASSIC = `${YARN}/classic`\n\nlet _Sentry: any\n\nconst LAZY_BATCH_PURL_ENDPOINT = () => {\n const query = new URLSearchParams()\n query.append('alerts', 'true')\n query.append('compact', 'true')\n return `${API_V0_URL}/purl?${query}`\n}\n\nconst LAZY_DIST_TYPE = () =>\n registryConstants.SUPPORTS_NODE_REQUIRE_MODULE ? MODULE_SYNC : REQUIRE\n\nconst LAZY_ENV = () => {\n const { env } = process\n // We inline some environment values so that they CANNOT be influenced by user\n // provided environment variables.\n return Object.freeze({\n // Lazily access registryConstants.ENV.\n ...registryConstants.ENV,\n // Flag set to help debug Socket CLI.\n [SOCKET_CLI_DEBUG]: envAsBoolean(env[SOCKET_CLI_DEBUG]),\n // Inlined flag set to determine if this is the Legacy build.\n // The '@rollup/plugin-replace' will replace \"process.env[SOCKET_CLI_LEGACY_BUILD]\".\n [SOCKET_CLI_LEGACY_BUILD]: process.env[SOCKET_CLI_LEGACY_BUILD],\n // Inlined flag set to determine if this is a published build.\n // The '@rollup/plugin-replace' will replace \"process.env[SOCKET_CLI_PUBLISHED_BUILD]\".\n [SOCKET_CLI_PUBLISHED_BUILD]: process.env[SOCKET_CLI_PUBLISHED_BUILD],\n // Inlined flag set to determine if this is the Sentry build.\n // The '@rollup/plugin-replace' will replace \"process.env[SOCKET_CLI_SENTRY_BUILD]\".\n [SOCKET_CLI_SENTRY_BUILD]: process.env[SOCKET_CLI_SENTRY_BUILD],\n // Flag set to toggle the informative ASCII art banner.\n [SOCKET_CLI_SHOW_BANNER]: envAsBoolean(env[SOCKET_CLI_SHOW_BANNER]),\n // Inlined flag set to determine the version hash of the build.\n // The '@rollup/plugin-replace' will replace \"process.env[SOCKET_CLI_VERSION_HASH]\".\n [SOCKET_CLI_VERSION_HASH]: process.env[SOCKET_CLI_VERSION_HASH]\n })\n}\n\nconst lazyBashRcPath = () =>\n // Lazily access constants.homePath.\n path.join(constants.homePath, '.bashrc')\n\nconst lazyCdxgenBinPath = () =>\n // Lazily access constants.nmBinPath.\n path.join(constants.nmBinPath, 'cdxgen')\n\nconst lazyDistPath = () =>\n // Lazily access constants.rootDistPath and constants.DIST_TYPE.\n path.join(constants.rootDistPath, constants.DIST_TYPE)\n\nconst lazyHomePath = () => os.homedir()\n\nconst lazyInstrumentWithSentryPath = () =>\n // Lazily access constants.rootDistPath.\n path.join(constants.rootDistPath, 'instrument-with-sentry.js')\n\nconst lazyNmBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, `${NODE_MODULES}/.bin`)\n\nconst lazyNpmInjectionPath = () =>\n // Lazily access constants.distPath.\n path.join(constants.distPath, `${NPM_INJECTION}.js`)\n\nconst lazyRootBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'bin')\n\nconst lazyRootDistPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'dist')\n\nconst lazyRootPath = () =>\n // The '@rollup/plugin-replace' will replace \"process.env.['VITEST']\" with `false` and\n // it will be dead code eliminated by Rollup.\n path.resolve(\n realpathSync.native(__dirname),\n process.env['SOCKET_CLI_TEST_DIST_BUILD'] ? '../..' : '..'\n )\n\nconst lazyRootPkgJsonPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, PACKAGE_JSON)\n\nconst lazyShadowBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, SHADOW_BIN)\n\nconst lazySynpBinPath = () =>\n // Lazily access constants.nmBinPath.\n path.join(constants.nmBinPath, 'synp')\n\nconst lazyZshRcPath = () =>\n // Lazily access constants.homePath.\n path.join(constants.homePath, '.zshrc')\n\nconst constants = <Constants>createConstantsObject(\n {\n ALERT_TYPE_CRITICAL_CVE,\n ALERT_TYPE_CVE,\n ALERT_TYPE_MEDIUM_CVE,\n ALERT_TYPE_MILD_CVE,\n ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE,\n API_V0_URL,\n BABEL_RUNTIME,\n // Lazily defined values are initialized as `undefined` to keep their key order.\n BATCH_PURL_ENDPOINT: undefined,\n BINARY_LOCK_EXT,\n BUN,\n CLI,\n CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER,\n CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE,\n DIST_TYPE: undefined,\n ENV: undefined,\n LOCK_EXT,\n MODULE_SYNC,\n NPM_INJECTION,\n NPM_REGISTRY_URL,\n NPX,\n PNPM,\n REQUIRE,\n SHADOW_BIN,\n SOCKET,\n SOCKET_CLI_DEBUG,\n SOCKET_CLI_FIX,\n SOCKET_CLI_ISSUES_URL,\n SOCKET_CLI_LEGACY_BUILD,\n SOCKET_CLI_OPTIMIZE,\n SOCKET_CLI_PUBLISHED_BUILD,\n SOCKET_CLI_SAFE_WRAPPER,\n SOCKET_CLI_SENTRY_BUILD,\n SOCKET_CLI_SHOW_BANNER,\n SOCKET_CLI_VERSION_HASH,\n VLT,\n YARN,\n YARN_BERRY,\n YARN_CLASSIC,\n bashRcPath: undefined,\n cdxgenBinPath: undefined,\n distPath: undefined,\n homePath: undefined,\n instrumentWithSentryPath: undefined,\n nmBinPath: undefined,\n npmInjectionPath: undefined,\n rootBinPath: undefined,\n rootDistPath: undefined,\n rootPath: undefined,\n rootPkgJsonPath: undefined,\n shadowBinPath: undefined,\n synpBinPath: undefined,\n zshRcPath: undefined\n },\n {\n getters: {\n BATCH_PURL_ENDPOINT: LAZY_BATCH_PURL_ENDPOINT,\n DIST_TYPE: LAZY_DIST_TYPE,\n ENV: LAZY_ENV,\n bashRcPath: lazyBashRcPath,\n distPath: lazyDistPath,\n cdxgenBinPath: lazyCdxgenBinPath,\n homePath: lazyHomePath,\n instrumentWithSentryPath: lazyInstrumentWithSentryPath,\n nmBinPath: lazyNmBinPath,\n npmInjectionPath: lazyNpmInjectionPath,\n rootBinPath: lazyRootBinPath,\n rootDistPath: lazyRootDistPath,\n rootPath: lazyRootPath,\n rootPkgJsonPath: lazyRootPkgJsonPath,\n shadowBinPath: lazyShadowBinPath,\n synpBinPath: lazySynpBinPath,\n zshRcPath: lazyZshRcPath\n },\n internals: {\n getSentry() {\n return _Sentry\n },\n setSentry(Sentry: Sentry): boolean {\n if (_Sentry === undefined) {\n _Sentry = Sentry\n return true\n }\n return false\n }\n },\n mixin: registryConstants\n }\n)\n\nexport default constants\n"],"names":["createConstantsObject","query","env","path","constants","BATCH_PURL_ENDPOINT","DIST_TYPE","ENV","bashRcPath","cdxgenBinPath","distPath","homePath","instrumentWithSentryPath","nmBinPath","npmInjectionPath","rootBinPath","rootDistPath","rootPath","rootPkgJsonPath","shadowBinPath","synpBinPath","zshRcPath","getters","internals","getSentry","_Sentry","mixin"],"mappings":";;;;;;;;;AAUA;;;;AAIE;AACEA;AACF;AACF;AAmGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACE;AACAC;AACAA;AACA;AACF;AAEA;AAGA;;AACUC;AAAI;AACZ;AACA;;AAEE;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACF;AACF;AAEA;AACE;AACAC;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AAEA;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACA;AACAA;AAKF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEIC;;;;;;;;AASF;AACAC;;;;;;AAMAC;AACAC;;;;;;;;;;;;;;;;;;;;;;;;AAwBAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACF;AAEEC;AACEjB;AACAC;AACAC;AACAC;AACAE;AACAD;AACAE;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;;AAEFE;AACEC;AACE;;;;AAIEC;AACA;AACF;AACA;AACF;;AAEFC;AACF;;","debugId":"2f3f6718-efed-4ef0-9f73-7227183876d4"}
|
|
@@ -10,20 +10,22 @@ function _socketInterop(e) {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
var require$$0 = _socketInterop(require('@sentry/node'));
|
|
13
|
-
var constants = require('./constants2.js');
|
|
14
13
|
|
|
15
14
|
var instrumentWithSentry = {};
|
|
16
15
|
|
|
17
16
|
// This should ONLY be included in the special Sentry build!
|
|
18
17
|
// Otherwise the Sentry dependency won't even be present in the manifest.
|
|
19
18
|
|
|
19
|
+
// Require constants with require(relConstantsPath) instead of require('./constants')
|
|
20
|
+
// so Rollup doesn't generate a constants2.js chunk.
|
|
21
|
+
const relConstantsPath = './constants';
|
|
20
22
|
// The '@rollup/plugin-replace' will replace "process.env['SOCKET_CLI_SENTRY_BUILD']".
|
|
21
23
|
{
|
|
22
24
|
const Sentry = require$$0;
|
|
23
25
|
Sentry.init({
|
|
24
26
|
onFatalError(error) {
|
|
25
27
|
// Defer module loads until after Sentry.init is called.
|
|
26
|
-
if (
|
|
28
|
+
if (require(relConstantsPath).ENV.SOCKET_CLI_DEBUG) {
|
|
27
29
|
console.error('[DEBUG] [Sentry onFatalError]:', error);
|
|
28
30
|
}
|
|
29
31
|
},
|
|
@@ -36,9 +38,9 @@ var instrumentWithSentry = {};
|
|
|
36
38
|
'pub' );
|
|
37
39
|
Sentry.setTag('version',
|
|
38
40
|
// The '@rollup/plugin-replace' will replace "process.env['SOCKET_CLI_VERSION_HASH']".
|
|
39
|
-
"0.14.
|
|
40
|
-
const constants
|
|
41
|
-
if (constants
|
|
41
|
+
"0.14.47:e0c97e0:714b50c6:pub");
|
|
42
|
+
const constants = require(relConstantsPath);
|
|
43
|
+
if (constants.ENV.SOCKET_CLI_DEBUG) {
|
|
42
44
|
Sentry.setTag('debugging', true);
|
|
43
45
|
console.log('[DEBUG] Set up Sentry.');
|
|
44
46
|
} else {
|
|
@@ -49,10 +51,10 @@ var instrumentWithSentry = {};
|
|
|
49
51
|
[kInternalsSymbol]: {
|
|
50
52
|
setSentry
|
|
51
53
|
}
|
|
52
|
-
} = constants
|
|
54
|
+
} = constants;
|
|
53
55
|
setSentry(Sentry);
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
module.exports = instrumentWithSentry;
|
|
57
|
-
//# debugId=
|
|
59
|
+
//# debugId=f9c4c083-a4f7-4aa4-b0af-c0a438552401
|
|
58
60
|
//# sourceMappingURL=instrument-with-sentry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-with-sentry.js","sources":["../../src/instrument-with-sentry.ts"],"sourcesContent":["// This should ONLY be included in the special Sentry build!\n// Otherwise the Sentry dependency won't even be present in the manifest.\n\n// The '@rollup/plugin-replace' will replace \"process.env['SOCKET_CLI_SENTRY_BUILD']\".\nif (process.env['SOCKET_CLI_SENTRY_BUILD']) {\n const Sentry = require('@sentry/node')\n Sentry.init({\n onFatalError(error: Error) {\n // Defer module loads until after Sentry.init is called.\n if (require(
|
|
1
|
+
{"version":3,"file":"instrument-with-sentry.js","sources":["../../src/instrument-with-sentry.ts"],"sourcesContent":["// This should ONLY be included in the special Sentry build!\n// Otherwise the Sentry dependency won't even be present in the manifest.\n\n// Require constants with require(relConstantsPath) instead of require('./constants')\n// so Rollup doesn't generate a constants2.js chunk.\nconst relConstantsPath = './constants'\n// The '@rollup/plugin-replace' will replace \"process.env['SOCKET_CLI_SENTRY_BUILD']\".\nif (process.env['SOCKET_CLI_SENTRY_BUILD']) {\n const Sentry = require('@sentry/node')\n Sentry.init({\n onFatalError(error: Error) {\n // Defer module loads until after Sentry.init is called.\n if (require(relConstantsPath).ENV.SOCKET_CLI_DEBUG) {\n console.error('[DEBUG] [Sentry onFatalError]:', error)\n }\n },\n dsn: 'https://66736701db8e4ffac046bd09fa6aaced@o555220.ingest.us.sentry.io/4508846967619585',\n enabled: true,\n integrations: []\n })\n Sentry.setTag(\n 'environment',\n // The '@rollup/plugin-replace' will replace \"process.env['SOCKET_CLI_PUBLISHED_BUILD']\".\n process.env['SOCKET_CLI_PUBLISHED_BUILD'] ? 'pub' : process.env['NODE_ENV']\n )\n Sentry.setTag(\n 'version',\n // The '@rollup/plugin-replace' will replace \"process.env['SOCKET_CLI_VERSION_HASH']\".\n process.env['SOCKET_CLI_VERSION_HASH']\n )\n const constants = require(relConstantsPath)\n if (constants.ENV.SOCKET_CLI_DEBUG) {\n Sentry.setTag('debugging', true)\n console.log('[DEBUG] Set up Sentry.')\n } else {\n Sentry.setTag('debugging', false)\n }\n const {\n kInternalsSymbol,\n [kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)']: { setSentry }\n } = constants\n setSentry(Sentry)\n} else if (require(relConstantsPath).ENV.SOCKET_CLI_DEBUG) {\n console.log('[DEBUG] Sentry disabled explicitly.')\n}\n"],"names":["console","dsn","enabled","integrations","process","Sentry","setSentry"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;;AAEA;AACA;AACA;AACA;AAC4C;AAC1C;;;AAGI;;AAEEA;AACF;;AAEFC;AACAC;AACAC;AACF;;AAGE;AACAC;;AAIA;AACAA;AAEF;AACA;AACEC;AACAL;AACF;AACEK;AACF;;;AAGE;AAA+DC;AAAU;AAC3E;;AAEF;;","debugId":"f9c4c083-a4f7-4aa4-b0af-c0a438552401"}
|