socket 0.14.50 → 0.14.51

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.js CHANGED
@@ -85,7 +85,7 @@ const LAZY_ENV = () => {
85
85
  [SOCKET_CLI_SHOW_BANNER]: env.envAsBoolean(env$1[SOCKET_CLI_SHOW_BANNER]),
86
86
  // Inlined flag set to determine the version hash of the build.
87
87
  // The '@rollup/plugin-replace' will replace "process.env[SOCKET_CLI_VERSION_HASH]".
88
- [SOCKET_CLI_VERSION_HASH]: "0.14.50:c8e152a:9d057324:pub"
88
+ [SOCKET_CLI_VERSION_HASH]: "0.14.51:8252840:74d39aac:pub"
89
89
  });
90
90
  };
91
91
  const lazyBashRcPath = () =>
@@ -220,5 +220,5 @@ const constants = createConstantsObject({
220
220
  });
221
221
 
222
222
  module.exports = constants;
223
- //# debugId=a5771a10-6737-427c-9cb8-6f8ff5e25da9
223
+ //# debugId=bdcb3caf-5282-4fa6-ae91-2e8d5092c6de
224
224
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
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_NO_API_TOKEN: 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_NO_API_TOKEN: 'SOCKET_CLI_NO_API_TOKEN'\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_NO_API_TOKEN = 'SOCKET_CLI_NO_API_TOKEN'\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 // Flag set to make the default API token `undefined`.\n [SOCKET_CLI_NO_API_TOKEN]: envAsBoolean(env[SOCKET_CLI_NO_API_TOKEN]),\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_NO_API_TOKEN,\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;AAqGA;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;AACA;AAEA;AAEA;AACE;AACAC;AACAA;AACA;AACF;AAEA;AAGA;;AACUC;AAAI;AACZ;AACA;;AAEE;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;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;;;;;;;;;;;;;;;;;;;;;;;;;AAyBAC;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":"a5771a10-6737-427c-9cb8-6f8ff5e25da9"}
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_NO_API_TOKEN: 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_NO_API_TOKEN: 'SOCKET_CLI_NO_API_TOKEN'\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_NO_API_TOKEN = 'SOCKET_CLI_NO_API_TOKEN'\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 // Flag set to make the default API token `undefined`.\n [SOCKET_CLI_NO_API_TOKEN]: envAsBoolean(env[SOCKET_CLI_NO_API_TOKEN]),\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_NO_API_TOKEN,\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;AAqGA;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;AACA;AAEA;AAEA;AACE;AACAC;AACAA;AACA;AACF;AAEA;AAGA;;AACUC;AAAI;AACZ;AACA;;AAEE;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;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;;;;;;;;;;;;;;;;;;;;;;;;;AAyBAC;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":"bdcb3caf-5282-4fa6-ae91-2e8d5092c6de"}
@@ -15,6 +15,7 @@ var node_url = require('node:url');
15
15
  var ponyCause = _socketInterop(require('pony-cause'));
16
16
  var updateNotifier = _socketInterop(require('tiny-updater'));
17
17
  var colors = _socketInterop(require('yoctocolors-cjs'));
18
+ var logger = require('@socketsecurity/registry/lib/logger');
18
19
  var micromatch = _socketInterop(require('micromatch'));
19
20
  var simpleGit = _socketInterop(require('simple-git'));
20
21
  var sdk = require('@socketsecurity/sdk');
@@ -1517,7 +1518,7 @@ function meowOrExit({
1517
1518
  }
1518
1519
  function getAsciiHeader(command) {
1519
1520
  const cliVersion = // The '@rollup/plugin-replace' will replace "process.env['SOCKET_CLI_VERSION_HASH']".
1520
- "0.14.50:c8e152a:9d057324:pub";
1521
+ "0.14.51:8252840:74d39aac:pub";
1521
1522
  const nodeVersion = process.version;
1522
1523
  const apiToken = index.getSetting('apiToken');
1523
1524
  const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no';
@@ -2337,10 +2338,8 @@ async function getDiffScan({
2337
2338
  orgSlug,
2338
2339
  outputJson
2339
2340
  }, apiToken) {
2340
- const spinnerText = 'Getting diff scan... \n';
2341
- const spinner$1 = new spinner.Spinner({
2342
- text: spinnerText
2343
- }).start();
2341
+ const spinner$1 = new spinner.Spinner();
2342
+ spinner$1.start('Getting diff scan...');
2344
2343
  const response = await queryAPI(`${orgSlug}/full-scans/diff?before=${before}&after=${after}&preview`, apiToken);
2345
2344
  const data = await response.json();
2346
2345
  if (!response.ok) {
@@ -2517,9 +2516,7 @@ async function runFix() {
2517
2516
  const tree = arb.idealTree;
2518
2517
  const hasUpgrade = !!registry.getManifestData(NPM$d, name);
2519
2518
  if (hasUpgrade) {
2520
- spinner$1.stop();
2521
- console.log(`Skipping ${name}. Socket Optimize package exists.`);
2522
- spinner$1.start();
2519
+ spinner$1.info(`Skipping ${name}. Socket Optimize package exists.`);
2523
2520
  continue;
2524
2521
  }
2525
2522
  const nodes = index.findPackageNodes(tree, name);
@@ -2545,10 +2542,10 @@ async function runFix() {
2545
2542
  try {
2546
2543
  // eslint-disable-next-line no-await-in-loop
2547
2544
  await npm.runScript('test', [], {
2548
- stdio: 'pipe'
2545
+ spinner: spinner$1,
2546
+ stdio: 'ignore'
2549
2547
  });
2550
2548
  spinner$1.info(`Patched ${name} ${oldVersion} -> ${node.version}`);
2551
- spinner$1.start();
2552
2549
  if (isTopLevel(tree, node)) {
2553
2550
  for (const depField of ['dependencies', 'optionalDependencies', 'peerDependencies']) {
2554
2551
  const oldVersion = editablePkgJson.content[depField]?.[name];
@@ -2561,14 +2558,11 @@ async function runFix() {
2561
2558
  // eslint-disable-next-line no-await-in-loop
2562
2559
  await editablePkgJson.save();
2563
2560
  } catch {
2564
- spinner$1.errorAndStop(`Reverting ${name} to ${oldVersion}`);
2565
- spinner$1.start();
2561
+ spinner$1.error(`Reverting ${name} to ${oldVersion}`);
2566
2562
  arb.idealTree = revertToIdealTree;
2567
2563
  }
2568
2564
  } else {
2569
- spinner$1.stop();
2570
- console.log(`Could not patch ${name} ${oldVersion}`);
2571
- spinner$1.start();
2565
+ spinner$1.error(`Could not patch ${name} ${oldVersion}`);
2572
2566
  }
2573
2567
  }
2574
2568
  }
@@ -2909,9 +2903,8 @@ async function attemptLogin(apiBaseUrl, apiProxy) {
2909
2903
  })) || SOCKET_PUBLIC_API_TOKEN;
2910
2904
  apiBaseUrl ??= index.getSetting('apiBaseUrl') ?? undefined;
2911
2905
  apiProxy ??= index.getSetting('apiProxy') ?? undefined;
2912
- const spinner$1 = new spinner.Spinner({
2913
- text: 'Verifying API key...'
2914
- }).start();
2906
+ const spinner$1 = new spinner.Spinner();
2907
+ spinner$1.start('Verifying API key...');
2915
2908
  let orgs;
2916
2909
  try {
2917
2910
  const sdk = await index.setupSdk(apiToken, apiBaseUrl, apiProxy);
@@ -2938,6 +2931,8 @@ async function attemptLogin(apiBaseUrl, apiProxy) {
2938
2931
  value: '',
2939
2932
  description: 'Pick "None" if this is a personal device'
2940
2933
  })
2934
+ }, {
2935
+ spinner: spinner$1
2941
2936
  });
2942
2937
  if (id) {
2943
2938
  enforcedOrgs = [id];
@@ -2946,6 +2941,8 @@ async function attemptLogin(apiBaseUrl, apiProxy) {
2946
2941
  const confirmOrg = await prompts.confirm({
2947
2942
  message: `Should Socket enforce ${enforcedChoices[0]?.name}'s security policies system-wide?`,
2948
2943
  default: true
2944
+ }, {
2945
+ spinner: spinner$1
2949
2946
  });
2950
2947
  if (confirmOrg) {
2951
2948
  const existing = enforcedChoices[0];
@@ -3027,9 +3024,9 @@ function applyLogout() {
3027
3024
  function attemptLogout() {
3028
3025
  try {
3029
3026
  applyLogout();
3030
- new spinner.Spinner().success('Successfully logged out');
3027
+ logger.logger.success('Successfully logged out');
3031
3028
  } catch {
3032
- new spinner.Spinner().success('Failed to complete logout steps');
3029
+ logger.logger.error('Failed to complete logout steps');
3033
3030
  }
3034
3031
  }
3035
3032
 
@@ -3096,12 +3093,11 @@ async function convertGradleToMaven(target, bin, _out, verbose, gradleOpts) {
3096
3093
  const initLocation = path.join(constants.rootDistPath, 'init.gradle');
3097
3094
  const commandArgs = ['--init-script', initLocation, ...gradleOpts, 'pom'];
3098
3095
  if (verbose) {
3099
- console.log('\n[VERBOSE] Executing:', bin, commandArgs);
3096
+ spinner$1.log('[VERBOSE] Executing:', bin, commandArgs);
3100
3097
  }
3101
3098
  const output = await spawn(bin, commandArgs, {
3102
3099
  cwd: target || '.'
3103
3100
  });
3104
- spinner$1.stop();
3105
3101
  if (verbose) {
3106
3102
  console.group('[VERBOSE] gradle stdout:');
3107
3103
  console.log(output);
@@ -3117,7 +3113,6 @@ async function convertGradleToMaven(target, bin, _out, verbose, gradleOpts) {
3117
3113
  }
3118
3114
  process.exit(1);
3119
3115
  }
3120
- spinner$1.start();
3121
3116
  spinner$1.successAndStop('Executed gradle successfully');
3122
3117
  console.log('Reported exports:');
3123
3118
  output.stdout.replace(/^POM file copied to: (.*)/gm, (_all, fn) => {
@@ -3127,7 +3122,7 @@ async function convertGradleToMaven(target, bin, _out, verbose, gradleOpts) {
3127
3122
 
3128
3123
  // const loc = output.stdout?.match(/Wrote (.*?.pom)\n/)?.[1]?.trim()
3129
3124
  // if (!loc) {
3130
- // spinner.errorAndStop(
3125
+ // console.error(
3131
3126
  // 'There were no errors from sbt but could not find the location of resulting .pom file either'
3132
3127
  // )
3133
3128
  // process.exit(1)
@@ -3135,22 +3130,22 @@ async function convertGradleToMaven(target, bin, _out, verbose, gradleOpts) {
3135
3130
  //
3136
3131
  // // Move the pom file to ...? initial cwd? loc will be an absolute path, or dump to stdout
3137
3132
  // if (out === '-') {
3138
- // spinner.start('Result:\n```').success()
3133
+ // spinner.start('Result:\n```')
3139
3134
  // console.log(await safeReadFile(loc, 'utf8'))
3140
3135
  // console.log('```')
3141
- // spinner.start().success(`OK`)
3136
+ // spinner.successAndStop(`OK`)
3142
3137
  // } else {
3138
+ // spinner.start()
3143
3139
  // if (verbose) {
3144
- // spinner.start(
3140
+ // spinner.log(
3145
3141
  // `Moving manifest file from \`${loc.replace(/^\/home\/[^/]*?\//, '~/')}\` to \`${out}\``
3146
3142
  // )
3147
3143
  // } else {
3148
- // spinner.start('Moving output pom file')
3144
+ // spinner.log('Moving output pom file')
3149
3145
  // }
3150
3146
  // // TODO: do we prefer fs-extra? renaming can be gnarly on windows and fs-extra's version is better
3151
3147
  // await renamep(loc, out)
3152
- // spinner.successAndStop()
3153
- // spinner.start().success(`OK. File should be available in \`${out}\``)
3148
+ // spinner.successAndStop(`OK. File should be available in \`${out}\``)
3154
3149
  // }
3155
3150
  } catch (e) {
3156
3151
  spinner$1.errorAndStop('There was an unexpected error while running this' + (verbose ? '' : ' (use --verbose for details)'));
@@ -3321,22 +3316,22 @@ async function convertSbtToMaven(target, bin, out, verbose, sbtOpts) {
3321
3316
  const spinner$1 = new spinner.Spinner();
3322
3317
  spinner$1.start(`Converting sbt to maven from \`${bin}\` on \`${target}\`...`);
3323
3318
  try {
3324
- // Run sbt with the init script we provide which should yield zero or more pom files.
3325
- // We have to figure out where to store those pom files such that we can upload them and predict them through the GitHub API.
3326
- // We could do a .socket folder. We could do a socket.pom.gz with all the poms, although I'd prefer something plain-text if it is to be committed.
3327
-
3319
+ // Run sbt with the init script we provide which should yield zero or more
3320
+ // pom files. We have to figure out where to store those pom files such that
3321
+ // we can upload them and predict them through the GitHub API. We could do a
3322
+ // .socket folder. We could do a socket.pom.gz with all the poms, although
3323
+ // I'd prefer something plain-text if it is to be committed.
3328
3324
  const output = await spawn(bin, ['makePom'].concat(sbtOpts), {
3329
3325
  cwd: target || '.'
3330
3326
  });
3331
- spinner$1.successAndStop();
3327
+ spinner$1.stop();
3332
3328
  if (verbose) {
3333
3329
  console.group('[VERBOSE] sbt stdout:');
3334
3330
  console.log(output);
3335
3331
  console.groupEnd();
3336
3332
  }
3337
3333
  if (output.stderr) {
3338
- spinner$1.start();
3339
- spinner$1.errorAndStop('There were errors while running sbt');
3334
+ logger.logger.error('There were errors while running sbt');
3340
3335
  // (In verbose mode, stderr was printed above, no need to repeat it)
3341
3336
  if (!verbose) {
3342
3337
  console.group('[VERBOSE] stderr:');
@@ -3351,36 +3346,35 @@ async function convertSbtToMaven(target, bin, out, verbose, sbtOpts) {
3351
3346
  return fn;
3352
3347
  });
3353
3348
  if (!poms.length) {
3354
- spinner$1.errorAndStop('There were no errors from sbt but it seems to not have generated any poms either');
3349
+ logger.logger.error('There were no errors from sbt but it seems to not have generated any poms either');
3355
3350
  process.exit(1);
3356
3351
  }
3357
-
3358
3352
  // Move the pom file to ...? initial cwd? loc will be an absolute path, or dump to stdout
3359
3353
  // TODO: what to do with multiple output files? Do we want to dump them to stdout? Raw or with separators or ?
3360
3354
  // TODO: maybe we can add an option to target a specific file to dump to stdout
3361
3355
  if (out === '-' && poms.length === 1) {
3362
- spinner$1.start('Result:\n```').success();
3356
+ logger.logger.log('Result:\n```');
3363
3357
  console.log(await index.safeReadFile(poms[0], 'utf8'));
3364
- console.log('```');
3365
- spinner$1.start().success(`OK`);
3358
+ logger.logger.log('```');
3359
+ logger.logger.success(`OK`);
3366
3360
  } else if (out === '-') {
3367
- spinner$1.start().error('Requested out target was stdout but there are multiple generated files');
3361
+ logger.logger.error('Requested out target was stdout but there are multiple generated files');
3368
3362
  poms.forEach(fn => console.error('-', fn));
3369
3363
  console.error('Exiting now...');
3370
3364
  process.exit(1);
3371
3365
  } else {
3372
3366
  // if (verbose) {
3373
- // spinner.start(
3367
+ // console.log(
3374
3368
  // `Moving manifest file from \`${loc.replace(/^\/home\/[^/]*?\//, '~/')}\` to \`${out}\``
3375
3369
  // )
3376
3370
  // } else {
3377
- // spinner.start('Moving output pom file')
3371
+ // console.log('Moving output pom file')
3378
3372
  // }
3379
3373
  // TODO: do we prefer fs-extra? renaming can be gnarly on windows and fs-extra's version is better
3380
3374
  // await renamep(loc, out)
3381
- spinner$1.start().success(`Generated ${poms.length} pom files`);
3375
+ logger.logger.success(`Generated ${poms.length} pom files`);
3382
3376
  poms.forEach(fn => console.log('-', fn));
3383
- spinner$1.start().success(`OK`);
3377
+ logger.logger.success(`OK`);
3384
3378
  }
3385
3379
  } catch (e) {
3386
3380
  spinner$1.errorAndStop('There was an unexpected error while running this' + (verbose ? '' : ' (use --verbose for details)'));
@@ -4805,9 +4799,7 @@ async function addOverrides(pkgPath, pkgEnvDetails, options) {
4805
4799
  } else {
4806
4800
  overridesDataObjects.push(overridesDataByAgent.get(NPM$1)(pkgJson), overridesDataByAgent.get(YARN_CLASSIC)(pkgJson));
4807
4801
  }
4808
- if (spinner) {
4809
- spinner.text = `Adding overrides${workspaceName ? ` to ${workspaceName}` : ''}...`;
4810
- }
4802
+ spinner?.setText(`Adding overrides${workspaceName ? ` to ${workspaceName}` : ''}...`);
4811
4803
  const depAliasMap = new Map();
4812
4804
  const nodeRange = `>=${pkgEnvDetails.minimumNodeVersion}`;
4813
4805
  const manifestEntries = manifestNpmOverrides.filter(({
@@ -4984,9 +4976,8 @@ async function getOrganization(format = 'text') {
4984
4976
  await printOrganizationsFromToken(apiToken, format);
4985
4977
  }
4986
4978
  async function printOrganizationsFromToken(apiToken, format = 'text') {
4987
- const spinner$1 = new spinner.Spinner({
4988
- text: 'Fetching organizations...'
4989
- }).start();
4979
+ const spinner$1 = new spinner.Spinner();
4980
+ spinner$1.start('Fetching organizations...');
4990
4981
  const socketSdk = await index.setupSdk(apiToken);
4991
4982
  const result = await handleApiCall(socketSdk.getOrganizations(), 'looking up organizations');
4992
4983
  if (!result.success) {
@@ -5228,24 +5219,28 @@ async function createReport(socketConfig, inputPaths, {
5228
5219
  });
5229
5220
  });
5230
5221
  const packagePaths = await npmPaths.getPackageFiles(cwd, inputPaths, socketConfig, supportedFiles);
5231
- npmPaths.debugLog('Uploading:', packagePaths.join(`\n${npmPaths.getLogSymbols().info} Uploading: `));
5222
+ const {
5223
+ length: packagePathsCount
5224
+ } = packagePaths;
5225
+ if (packagePathsCount && npmPaths.isDebug()) {
5226
+ for (const pkgPath of packagePaths) {
5227
+ npmPaths.debugLog(`Uploading: ${pkgPath}`);
5228
+ }
5229
+ }
5232
5230
  if (dryRun) {
5233
5231
  npmPaths.debugLog('[dryRun] Skipped actual upload');
5234
5232
  return undefined;
5235
- } else {
5236
- const socketSdk = await index.setupSdk();
5237
- const spinner$1 = new spinner.Spinner({
5238
- text: `Creating report with ${packagePaths.length} package files`
5239
- }).start();
5240
- const apiCall = socketSdk.createReportFromFilePaths(packagePaths, cwd, socketConfig?.issueRules);
5241
- const result = await handleApiCall(apiCall, 'creating report');
5242
- if (!result.success) {
5243
- handleUnsuccessfulApiResponse('createReport', result, spinner$1);
5244
- return undefined;
5245
- }
5246
- spinner$1.successAndStop();
5247
- return result;
5248
5233
  }
5234
+ const spinner$1 = new spinner.Spinner();
5235
+ spinner$1.start(`Creating report with ${packagePathsCount} package ${words.pluralize('file', packagePathsCount)}`);
5236
+ const apiCall = socketSdk.createReportFromFilePaths(packagePaths, cwd, socketConfig?.issueRules);
5237
+ const result = await handleApiCall(apiCall, 'creating report');
5238
+ if (!result.success) {
5239
+ handleUnsuccessfulApiResponse('createReport', result, spinner$1);
5240
+ return undefined;
5241
+ }
5242
+ spinner$1.successAndStop();
5243
+ return result;
5249
5244
  }
5250
5245
 
5251
5246
  async function getSocketConfig(absoluteConfigPath) {
@@ -5272,10 +5267,9 @@ async function getSocketConfig(absoluteConfigPath) {
5272
5267
  const MAX_TIMEOUT_RETRY = 5;
5273
5268
  const HTTP_CODE_TIMEOUT = 524;
5274
5269
  async function fetchReportData(reportId, includeAllIssues, strict) {
5270
+ const spinner$1 = new spinner.Spinner();
5271
+ spinner$1.start(`Fetching report with ID ${reportId} (this could take a while)`);
5275
5272
  const socketSdk = await index.setupSdk();
5276
- const spinner$1 = new spinner.Spinner({
5277
- text: `Fetching report with ID ${reportId} (this could take a while)`
5278
- }).start();
5279
5273
  let result;
5280
5274
  for (let retry = 1; !result; ++retry) {
5281
5275
  try {
@@ -5283,6 +5277,7 @@ async function fetchReportData(reportId, includeAllIssues, strict) {
5283
5277
  result = await handleApiCall(socketSdk.getReport(reportId), 'fetching report');
5284
5278
  } catch (err) {
5285
5279
  if (retry >= MAX_TIMEOUT_RETRY || !(err instanceof Error) || err.cause?.cause?.response?.statusCode !== HTTP_CODE_TIMEOUT) {
5280
+ spinner$1.stop();
5286
5281
  throw err;
5287
5282
  }
5288
5283
  }
@@ -5291,21 +5286,21 @@ async function fetchReportData(reportId, includeAllIssues, strict) {
5291
5286
  return handleUnsuccessfulApiResponse('getReport', result, spinner$1);
5292
5287
  }
5293
5288
 
5294
- // Conclude the status of the API call
5295
-
5289
+ // Conclude the status of the API call.
5296
5290
  if (strict) {
5297
5291
  if (result.data.healthy) {
5298
- spinner$1.successAndStop('Report result is healthy and great!');
5292
+ spinner$1.success('Report result is healthy and great!');
5299
5293
  } else {
5300
- spinner$1.errorAndStop('Report result deemed unhealthy for project');
5294
+ spinner$1.error('Report result deemed unhealthy for project');
5301
5295
  }
5302
5296
  } else if (!result.data.healthy) {
5303
5297
  const severityCount = getSeverityCount(result.data.issues, includeAllIssues ? undefined : 'high');
5304
5298
  const issueSummary = formatSeverityCount(severityCount);
5305
- spinner$1.successAndStop(`Report has these issues: ${issueSummary}`);
5299
+ spinner$1.success(`Report has these issues: ${issueSummary}`);
5306
5300
  } else {
5307
- spinner$1.successAndStop('Report has no issues');
5301
+ spinner$1.success('Report has no issues');
5308
5302
  }
5303
+ spinner$1.stop();
5309
5304
  return result.data;
5310
5305
  }
5311
5306
 
@@ -5527,10 +5522,8 @@ async function createRepo({
5527
5522
  repoName,
5528
5523
  visibility
5529
5524
  }) {
5530
- const spinnerText = 'Creating repository... \n';
5531
- const spinner$1 = new spinner.Spinner({
5532
- text: spinnerText
5533
- }).start();
5525
+ const spinner$1 = new spinner.Spinner();
5526
+ spinner$1.start('Creating repository...');
5534
5527
  const socketSdk = await index.setupSdk(apiToken);
5535
5528
  const result = await handleApiCall(socketSdk.createOrgRepo(orgSlug, {
5536
5529
  outputJson,
@@ -5645,10 +5638,8 @@ async function run$b(argv, importMeta, {
5645
5638
  }
5646
5639
 
5647
5640
  async function deleteRepo(orgSlug, repoName, apiToken) {
5648
- const spinnerText = 'Deleting repository... \n';
5649
- const spinner$1 = new spinner.Spinner({
5650
- text: spinnerText
5651
- }).start();
5641
+ const spinner$1 = new spinner.Spinner();
5642
+ spinner$1.start('Deleting repository...');
5652
5643
  const socketSdk = await index.setupSdk(apiToken);
5653
5644
  const result = await handleApiCall(socketSdk.deleteOrgRepo(orgSlug, repoName), 'deleting repository');
5654
5645
  if (result.success) {
@@ -6203,7 +6194,7 @@ function dirNameToSlug(name) {
6203
6194
  async function suggestBranchSlug(repoDefaultBranch) {
6204
6195
  const spawnResult = node_child_process.spawnSync('git', ['branch', '--show-current']);
6205
6196
  const currentBranch = spawnResult.stdout.toString('utf8').trim();
6206
- if (spawnResult.status === 0 && currentBranch) {
6197
+ if (currentBranch && spawnResult.status === 0) {
6207
6198
  const proceed = await prompts.select({
6208
6199
  message: 'Use the current git branch as target branch name?',
6209
6200
  choices: [{
@@ -6523,17 +6514,15 @@ async function run$6(argv, importMeta, {
6523
6514
  }
6524
6515
 
6525
6516
  async function deleteOrgFullScan(orgSlug, fullScanId, apiToken) {
6526
- const spinnerText = 'Deleting scan...';
6527
- const spinner$1 = new spinner.Spinner({
6528
- text: spinnerText
6529
- }).start();
6517
+ const spinner$1 = new spinner.Spinner();
6518
+ spinner$1.start('Deleting scan...');
6530
6519
  const socketSdk = await index.setupSdk(apiToken);
6531
6520
  const result = await handleApiCall(socketSdk.deleteOrgFullScan(orgSlug, fullScanId), 'Deleting scan');
6532
- if (result.success) {
6533
- spinner$1.successAndStop('Scan deleted successfully');
6534
- } else {
6521
+ if (!result.success) {
6535
6522
  handleUnsuccessfulApiResponse('deleteOrgFullScan', result, spinner$1);
6523
+ return;
6536
6524
  }
6525
+ spinner$1.successAndStop('Scan deleted successfully');
6537
6526
  }
6538
6527
 
6539
6528
  const config$5 = {
@@ -6592,10 +6581,8 @@ async function run$5(argv, importMeta, {
6592
6581
 
6593
6582
  // @ts-ignore
6594
6583
  async function listFullScans(orgSlug, input, apiToken) {
6595
- const spinnerText = 'Listing scans... \n';
6596
- const spinner$1 = new spinner.Spinner({
6597
- text: spinnerText
6598
- }).start();
6584
+ const spinner$1 = new spinner.Spinner();
6585
+ spinner$1.start('Listing scans...');
6599
6586
  const socketSdk = await index.setupSdk(apiToken);
6600
6587
  const result = await handleApiCall(socketSdk.getOrgFullScanList(orgSlug, input), 'Listing scans');
6601
6588
  if (!result.success) {
@@ -6735,10 +6722,8 @@ async function run$4(argv, importMeta, {
6735
6722
  }
6736
6723
 
6737
6724
  async function getOrgScanMetadata(orgSlug, scanId, apiToken) {
6738
- const spinnerText = "Getting scan's metadata... \n";
6739
- const spinner$1 = new spinner.Spinner({
6740
- text: spinnerText
6741
- }).start();
6725
+ const spinner$1 = new spinner.Spinner();
6726
+ spinner$1.start("Getting scan's metadata...");
6742
6727
  const socketSdk = await index.setupSdk(apiToken);
6743
6728
  const result = await handleApiCall(socketSdk.getOrgFullScanMetadata(orgSlug, scanId), 'Listing scans');
6744
6729
  if (!result.success) {
@@ -6804,9 +6789,8 @@ async function run$3(argv, importMeta, {
6804
6789
  }
6805
6790
 
6806
6791
  async function getFullScan(orgSlug, fullScanId, file, apiToken) {
6807
- const spinner$1 = new spinner.Spinner({
6808
- text: 'Streaming scan...'
6809
- }).start();
6792
+ const spinner$1 = new spinner.Spinner();
6793
+ spinner$1.start('Streaming scan...');
6810
6794
  const socketSdk = await index.setupSdk(apiToken);
6811
6795
  const data = await handleApiCall(socketSdk.getOrgFullScan(orgSlug, fullScanId, file === '-' ? undefined : file), 'Streaming a scan');
6812
6796
  if (data?.success) {
@@ -6902,9 +6886,8 @@ async function getThreatFeed({
6902
6886
  page,
6903
6887
  perPage
6904
6888
  }) {
6905
- const spinner$1 = new spinner.Spinner({
6906
- text: 'Looking up the threat feed'
6907
- }).start();
6889
+ const spinner$1 = new spinner.Spinner();
6890
+ spinner$1.start('Looking up the threat feed');
6908
6891
  const formattedQueryParams = formatQueryParams({
6909
6892
  per_page: perPage,
6910
6893
  page,
@@ -7304,12 +7287,12 @@ void (async () => {
7304
7287
  } else {
7305
7288
  errorTitle = 'Unexpected error with no details';
7306
7289
  }
7307
- console.error(`${npmPaths.getLogSymbols().error} ${colors.bgRed(colors.white(errorTitle + ':'))} ${errorMessage}`);
7290
+ logger.logger.error(`${colors.bgRed(colors.white(errorTitle + ':'))} ${errorMessage}`);
7308
7291
  if (errorBody) {
7309
7292
  console.error(`\n${errorBody}`);
7310
7293
  }
7311
7294
  await index.captureException(e);
7312
7295
  }
7313
7296
  })();
7314
- //# debugId=5ebdde59-83d7-40b0-a2b4-52200ebea950
7297
+ //# debugId=e73d6282-88a9-4605-949e-c9068eee1c15
7315
7298
  //# sourceMappingURL=cli.js.map