@socketsecurity/cli-with-sentry 1.1.101 → 1.1.102

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
@@ -115,6 +115,10 @@ const CONFIG_KEY_API_TOKEN = 'apiToken';
115
115
  const CONFIG_KEY_DEFAULT_ORG = 'defaultOrg';
116
116
  const CONFIG_KEY_ENFORCED_ORGS = 'enforcedOrgs';
117
117
  const CONFIG_KEY_ORG = 'org';
118
+ // Must stay in sync with `ext.SOCKET_FACTS_FILENAME` in
119
+ // src/commands/manifest/socket-facts.init.gradle (Groovy side).
120
+ // Groovy can't import a TS constant, so the two values are intentionally
121
+ // duplicated; change them together.
118
122
  const DOT_SOCKET_DOT_FACTS_JSON = `${DOT_SOCKET_DIR}.facts.json`;
119
123
  const DLX_BINARY_CACHE_TTL = 7 * 24 * 60 * 60 * 1_000; // 7 days in milliseconds.
120
124
  const DRY_RUN_LABEL = '[DryRun]';
@@ -276,10 +280,10 @@ const LAZY_ENV = () => {
276
280
  INLINED_SOCKET_CLI_SYNP_VERSION: envAsString("1.9.14"),
277
281
  // Comp-time inlined Socket package version.
278
282
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
279
- INLINED_SOCKET_CLI_VERSION: envAsString("1.1.101"),
283
+ INLINED_SOCKET_CLI_VERSION: envAsString("1.1.102"),
280
284
  // Comp-time inlined Socket package version hash.
281
285
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
282
- INLINED_SOCKET_CLI_VERSION_HASH: envAsString("1.1.101:2c4618f:03497c24"),
286
+ INLINED_SOCKET_CLI_VERSION_HASH: envAsString("1.1.102:d1c99be:7705784a"),
283
287
  // Enable the module compile cache for the Node.js instance.
284
288
  // https://nodejs.org/api/cli.html#node_compile_cachedir
285
289
  NODE_COMPILE_CACHE: constants.SUPPORTS_NODE_COMPILE_CACHE_ENV_VAR ? constants.socketCachePath : '',
@@ -851,5 +855,5 @@ exports.YARN_BERRY = YARN_BERRY;
851
855
  exports.YARN_CLASSIC = YARN_CLASSIC;
852
856
  exports.YARN_LOCK = YARN_LOCK;
853
857
  exports.default = constants;
854
- //# debugId=c0c37532-06fb-4848-99d0-a465b4205ee1
858
+ //# debugId=eb5d2318-70e6-479d-9973-4891be3fc1da
855
859
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../src/constants.mts"],"sourcesContent":["import { realpathSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport registryConstants from '@socketsecurity/registry/lib/constants'\n\nimport type { Agent } from './utils/package-environment.mts'\nimport type { Remap } from '@socketsecurity/registry/lib/objects'\nimport type { SpawnOptions } from '@socketsecurity/registry/lib/spawn'\n\nconst require = createRequire(import.meta.url)\nconst __filename = fileURLToPath(import.meta.url)\n// Using `path.dirname(__filename)` to resolve `__dirname` works for both 'dist'\n// AND 'src' directories because constants.js and constants.mts respectively are\n// in the root of each.\nconst __dirname = path.dirname(__filename)\n\nconst {\n AT_LATEST,\n BIOME_JSON,\n BUN,\n CI,\n COLUMN_LIMIT,\n DOT_GIT_DIR,\n DOT_SOCKET_DIR,\n EMPTY_FILE,\n EMPTY_VALUE,\n ESLINT_CONFIG_JS,\n ESNEXT,\n EXT_CJS,\n EXT_CMD,\n EXT_CTS,\n EXT_DTS,\n EXT_JS,\n EXT_JSON,\n EXT_LOCK,\n EXT_LOCKB,\n EXT_MD,\n EXT_MJS,\n EXT_MTS,\n EXT_PS1,\n EXT_YAML,\n EXT_YML,\n EXTENSIONS,\n EXTENSIONS_JSON,\n GITIGNORE,\n DOT_PACKAGE_LOCK_JSON,\n LATEST,\n LICENSE,\n LICENSE_GLOB,\n LICENSE_GLOB_RECURSIVE,\n LICENSE_ORIGINAL,\n LICENSE_ORIGINAL_GLOB,\n LICENSE_ORIGINAL_GLOB_RECURSIVE,\n LOOP_SENTINEL,\n MANIFEST_JSON,\n MIT,\n NODE_AUTH_TOKEN,\n NODE_ENV,\n NODE_MODULES,\n NODE_MODULES_GLOB_RECURSIVE,\n NPM,\n NPX,\n OVERRIDES,\n PACKAGE_DEFAULT_VERSION,\n PACKAGE_JSON,\n PACKAGE_LOCK_JSON,\n PNPM,\n PNPM_LOCK_YAML,\n PRE_COMMIT,\n README_GLOB,\n README_GLOB_RECURSIVE,\n REGISTRY_SCOPE_DELIMITER,\n README_MD,\n REGISTRY,\n RESOLUTIONS,\n SOCKET_GITHUB_ORG,\n SOCKET_IPC_HANDSHAKE,\n SOCKET_OVERRIDE_SCOPE,\n SOCKET_PUBLIC_API_TOKEN,\n SOCKET_REGISTRY_NPM_ORG,\n SOCKET_REGISTRY_PACKAGE_NAME,\n SOCKET_REGISTRY_REPO_NAME,\n SOCKET_REGISTRY_SCOPE,\n SOCKET_SECURITY_SCOPE,\n TSCONFIG_JSON,\n UNKNOWN_ERROR,\n UNKNOWN_VALUE,\n UNLICENCED,\n UNLICENSED,\n UTF8,\n VITEST,\n VLT,\n YARN,\n YARN_BERRY,\n YARN_CLASSIC,\n YARN_LOCK,\n kInternalsSymbol,\n [kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)']: {\n attributes: registryConstantsAttribs,\n createConstantsObject,\n getIpc,\n },\n} = registryConstants\n\nexport type RegistryEnv = typeof registryConstants.ENV\n\nexport type RegistryInternals =\n (typeof registryConstants)['Symbol(kInternalsSymbol)']\n\nexport type Sentry = any\n\nexport type Internals = Remap<\n Omit<RegistryInternals, 'getIpc'> &\n Readonly<{\n getIpc: {\n (): Promise<IpcObject>\n <K extends keyof IpcObject | undefined>(\n key?: K | undefined,\n ): Promise<K extends keyof IpcObject ? IpcObject[K] : IpcObject>\n }\n getSentry: () => Sentry\n setSentry(Sentry: Sentry): boolean\n }>\n>\n\nexport type ENV = Remap<\n RegistryEnv &\n Readonly<{\n DISABLE_GITHUB_CACHE: boolean\n GITHUB_API_URL: string\n GITHUB_BASE_REF: string\n GITHUB_REF_NAME: string\n GITHUB_REF_TYPE: string\n GITHUB_REPOSITORY: string\n GITHUB_SERVER_URL: string\n GITHUB_TOKEN: string\n INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION: string\n INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION: string\n INLINED_SOCKET_CLI_HOMEPAGE: string\n INLINED_SOCKET_CLI_LEGACY_BUILD: string\n INLINED_SOCKET_CLI_NAME: string\n INLINED_SOCKET_CLI_PUBLISHED_BUILD: string\n INLINED_SOCKET_CLI_SENTRY_BUILD: string\n INLINED_SOCKET_CLI_VERSION: string\n INLINED_SOCKET_CLI_VERSION_HASH: string\n INLINED_SOCKET_CLI_SYNP_VERSION: string\n LOCALAPPDATA: string\n NODE_COMPILE_CACHE: string\n NODE_EXTRA_CA_CERTS: string\n npm_config_cache: string\n npm_config_user_agent: string\n PATH: string\n SOCKET_CLI_ACCEPT_RISKS: boolean\n SOCKET_CLI_DEBUG: boolean\n SOCKET_CLI_API_BASE_URL: string\n SOCKET_CLI_API_PROXY: string\n SOCKET_CLI_API_TIMEOUT: number\n SOCKET_CLI_API_TOKEN: string\n SOCKET_CLI_CONFIG: string\n SOCKET_CLI_GIT_USER_EMAIL: string\n SOCKET_CLI_GIT_USER_NAME: string\n SOCKET_CLI_GITHUB_TOKEN: string\n SOCKET_CLI_NO_API_TOKEN: boolean\n SOCKET_CLI_NPM_PATH: string\n SOCKET_CLI_ORG_SLUG: string\n SOCKET_CLI_VIEW_ALL_RISKS: boolean\n SOCKET_PATCH_PROXY_URL: string\n TERM: string\n XDG_DATA_HOME: string\n }>\n>\n\nexport type IpcObject = Readonly<{\n SOCKET_CLI_FIX?: string | undefined\n SOCKET_CLI_OPTIMIZE?: boolean | undefined\n SOCKET_CLI_SHADOW_ACCEPT_RISKS?: boolean | undefined\n SOCKET_CLI_SHADOW_API_TOKEN?: string | undefined\n SOCKET_CLI_SHADOW_BIN?: string | undefined\n SOCKET_CLI_SHADOW_PROGRESS?: boolean | undefined\n SOCKET_CLI_SHADOW_SILENT?: boolean | undefined\n}>\n\nexport type ProcessEnv = {\n [K in keyof ENV]?: string | undefined\n}\n\n// Socket CLI specific constants that are not in socket-registry.\nconst ALERT_TYPE_CRITICAL_CVE = 'criticalCVE'\nconst ALERT_TYPE_CVE = 'cve'\nconst ALERT_TYPE_MEDIUM_CVE = 'mediumCVE'\nconst ALERT_TYPE_MILD_CVE = 'mildCVE'\nconst API_V0_URL = 'https://api.socket.dev/v0/'\nconst CONFIG_KEY_API_BASE_URL = 'apiBaseUrl'\nconst CONFIG_KEY_API_PROXY = 'apiProxy'\nconst CONFIG_KEY_API_TOKEN = 'apiToken'\nconst CONFIG_KEY_DEFAULT_ORG = 'defaultOrg'\nconst CONFIG_KEY_ENFORCED_ORGS = 'enforcedOrgs'\nconst CONFIG_KEY_ORG = 'org'\nconst DOT_SOCKET_DOT_FACTS_JSON = `${DOT_SOCKET_DIR}.facts.json`\nconst DLX_BINARY_CACHE_TTL = 7 * 24 * 60 * 60 * 1_000 // 7 days in milliseconds.\nconst DRY_RUN_LABEL = '[DryRun]'\nconst DRY_RUN_BAILING_NOW = `${DRY_RUN_LABEL}: Bailing now`\nconst DRY_RUN_NOT_SAVING = `${DRY_RUN_LABEL}: Not saving`\nconst ENVIRONMENT_YAML = 'environment.yaml'\nconst ENVIRONMENT_YML = 'environment.yml'\nconst ERROR_NO_MANIFEST_FILES = 'No manifest files found'\nconst ERROR_NO_PACKAGE_JSON = 'No package.json found'\nconst ERROR_NO_REPO_FOUND = 'No repo found'\nconst ERROR_NO_SOCKET_DIR = 'No .socket directory found'\nconst ERROR_UNABLE_RESOLVE_ORG =\n 'Unable to resolve a Socket account organization'\nconst FLAG_CONFIG = '--config'\nconst FLAG_DRY_RUN = '--dry-run'\nconst FLAG_HELP = '--help'\nconst FLAG_HELP_FULL = '--help-full'\nconst FLAG_ID = '--id'\nconst FLAG_JSON = '--json'\nconst FLAG_LOGLEVEL = '--loglevel'\nconst FLAG_MARKDOWN = '--markdown'\nconst FLAG_ORG = '--org'\nconst FLAG_PIN = '--pin'\nconst FLAG_PROD = '--prod'\nconst FLAG_QUIET = '--quiet'\nconst FLAG_SILENT = '--silent'\nconst FLAG_TEXT = '--text'\nconst FLAG_VERBOSE = '--verbose'\nconst FLAG_VERSION = '--version'\nconst FOLD_SETTING_FILE = 'file'\nconst FOLD_SETTING_NONE = 'none'\nconst FOLD_SETTING_PKG = 'pkg'\nconst FOLD_SETTING_VERSION = 'version'\nconst GQL_PAGE_SENTINEL = 100\nconst GQL_PR_STATE_CLOSED = 'CLOSED'\nconst GQL_PR_STATE_MERGED = 'MERGED'\nconst GQL_PR_STATE_OPEN = 'OPEN'\nconst HTTP_STATUS_BAD_REQUEST = 400\nconst HTTP_STATUS_FORBIDDEN = 403\nconst HTTP_STATUS_INTERNAL_SERVER_ERROR = 500\nconst HTTP_STATUS_NOT_FOUND = 404\nconst HTTP_STATUS_UNAUTHORIZED = 401\nconst NPM_BUGGY_OVERRIDES_PATCHED_VERSION = '11.2.0'\nconst NPM_REGISTRY_URL = 'https://registry.npmjs.org'\nconst OUTPUT_JSON = 'json'\nconst OUTPUT_MARKDOWN = 'markdown'\nconst OUTPUT_TEXT = 'text'\nconst PNPM_WORKSPACE_YAML = 'pnpm-workspace.yaml'\nconst REDACTED = '<redacted>'\nconst REPORT_LEVEL_DEFER = 'defer'\nconst REPORT_LEVEL_ERROR = 'error'\nconst REPORT_LEVEL_IGNORE = 'ignore'\nconst REPORT_LEVEL_MONITOR = 'monitor'\nconst REPORT_LEVEL_WARN = 'warn'\nconst REQUIREMENTS_TXT = 'requirements.txt'\nconst SOCKET_CLI_ACCEPT_RISKS = 'SOCKET_CLI_ACCEPT_RISKS'\nconst SOCKET_CLI_BIN_NAME = 'socket'\nconst SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues'\nconst SOCKET_CLI_SHADOW_ACCEPT_RISKS = 'SOCKET_CLI_SHADOW_ACCEPT_RISKS'\nconst SOCKET_CLI_SHADOW_API_TOKEN = 'SOCKET_CLI_SHADOW_API_TOKEN'\nconst SOCKET_CLI_SHADOW_BIN = 'SOCKET_CLI_SHADOW_BIN'\nconst SOCKET_CLI_SHADOW_PROGRESS = 'SOCKET_CLI_SHADOW_PROGRESS'\nconst SOCKET_CLI_SHADOW_SILENT = 'SOCKET_CLI_SHADOW_SILENT'\nconst SOCKET_CLI_VIEW_ALL_RISKS = 'SOCKET_CLI_VIEW_ALL_RISKS'\nconst SCAN_TYPE_SOCKET = 'socket'\nconst SCAN_TYPE_SOCKET_TIER1 = 'socket_tier1'\nconst SOCKET_DEFAULT_BRANCH = 'socket-default-branch'\nconst SOCKET_DEFAULT_REPOSITORY = 'socket-default-repository'\nconst SOCKET_JSON = 'socket.json'\nconst SOCKET_WEBSITE_URL = 'https://socket.dev'\nconst SOCKET_YAML = 'socket.yaml'\nconst SOCKET_YML = 'socket.yml'\nconst V1_MIGRATION_GUIDE_URL = 'https://docs.socket.dev/docs/v1-migration-guide'\n\nexport type Constants = Remap<\n Omit<\n typeof registryConstants,\n 'Symbol(kInternalsSymbol)' | 'ENV' | 'ipcObject'\n > & {\n readonly 'Symbol(kInternalsSymbol)': Internals\n readonly ALERT_TYPE_CRITICAL_CVE: typeof ALERT_TYPE_CRITICAL_CVE\n readonly ALERT_TYPE_CVE: typeof ALERT_TYPE_CVE\n readonly ALERT_TYPE_MEDIUM_CVE: typeof ALERT_TYPE_MEDIUM_CVE\n readonly ALERT_TYPE_MILD_CVE: typeof ALERT_TYPE_MILD_CVE\n readonly API_V0_URL: typeof API_V0_URL\n readonly BUN: typeof BUN\n readonly CONFIG_KEY_API_BASE_URL: typeof CONFIG_KEY_API_BASE_URL\n readonly CONFIG_KEY_API_PROXY: typeof CONFIG_KEY_API_PROXY\n readonly CONFIG_KEY_API_TOKEN: typeof CONFIG_KEY_API_TOKEN\n readonly CONFIG_KEY_DEFAULT_ORG: typeof CONFIG_KEY_DEFAULT_ORG\n readonly CONFIG_KEY_ENFORCED_ORGS: typeof CONFIG_KEY_ENFORCED_ORGS\n readonly CONFIG_KEY_ORG: typeof CONFIG_KEY_ORG\n readonly DOT_GIT_DIR: typeof DOT_GIT_DIR\n readonly DOT_SOCKET_DIR: typeof DOT_SOCKET_DIR\n readonly DLX_BINARY_CACHE_TTL: typeof DLX_BINARY_CACHE_TTL\n readonly DOT_SOCKET_DOT_FACTS_JSON: typeof DOT_SOCKET_DOT_FACTS_JSON\n readonly DRY_RUN_BAILING_NOW: typeof DRY_RUN_BAILING_NOW\n readonly DRY_RUN_LABEL: typeof DRY_RUN_LABEL\n readonly DRY_RUN_NOT_SAVING: typeof DRY_RUN_NOT_SAVING\n readonly EMPTY_VALUE: typeof EMPTY_VALUE\n readonly ENV: ENV\n readonly ENVIRONMENT_YAML: typeof ENVIRONMENT_YAML\n readonly ENVIRONMENT_YML: typeof ENVIRONMENT_YML\n readonly ERROR_NO_MANIFEST_FILES: typeof ERROR_NO_MANIFEST_FILES\n readonly ERROR_NO_PACKAGE_JSON: typeof ERROR_NO_PACKAGE_JSON\n readonly ERROR_NO_REPO_FOUND: typeof ERROR_NO_REPO_FOUND\n readonly ERROR_NO_SOCKET_DIR: typeof ERROR_NO_SOCKET_DIR\n readonly ERROR_UNABLE_RESOLVE_ORG: typeof ERROR_UNABLE_RESOLVE_ORG\n readonly EXT_YAML: typeof EXT_YAML\n readonly EXT_YML: typeof EXT_YML\n readonly FLAG_CONFIG: typeof FLAG_CONFIG\n readonly FLAG_DRY_RUN: typeof FLAG_DRY_RUN\n readonly FLAG_HELP: typeof FLAG_HELP\n readonly FLAG_ID: typeof FLAG_ID\n readonly FLAG_JSON: typeof FLAG_JSON\n readonly FLAG_LOGLEVEL: typeof FLAG_LOGLEVEL\n readonly FLAG_MARKDOWN: typeof FLAG_MARKDOWN\n readonly FLAG_ORG: typeof FLAG_ORG\n readonly FLAG_PIN: typeof FLAG_PIN\n readonly FLAG_PROD: typeof FLAG_PROD\n readonly FLAG_QUIET: typeof FLAG_QUIET\n readonly FLAG_SILENT: typeof FLAG_SILENT\n readonly FLAG_TEXT: typeof FLAG_TEXT\n readonly FLAG_VERBOSE: typeof FLAG_VERBOSE\n readonly FLAG_VERSION: typeof FLAG_VERSION\n readonly FOLD_SETTING_FILE: typeof FOLD_SETTING_FILE\n readonly FOLD_SETTING_NONE: typeof FOLD_SETTING_NONE\n readonly FOLD_SETTING_PKG: typeof FOLD_SETTING_PKG\n readonly FOLD_SETTING_VERSION: typeof FOLD_SETTING_VERSION\n readonly GQL_PAGE_SENTINEL: typeof GQL_PAGE_SENTINEL\n readonly GQL_PR_STATE_CLOSED: typeof GQL_PR_STATE_CLOSED\n readonly GQL_PR_STATE_MERGED: typeof GQL_PR_STATE_MERGED\n readonly GQL_PR_STATE_OPEN: typeof GQL_PR_STATE_OPEN\n readonly HTTP_STATUS_BAD_REQUEST: typeof HTTP_STATUS_BAD_REQUEST\n readonly HTTP_STATUS_FORBIDDEN: typeof HTTP_STATUS_FORBIDDEN\n readonly HTTP_STATUS_INTERNAL_SERVER_ERROR: typeof HTTP_STATUS_INTERNAL_SERVER_ERROR\n readonly HTTP_STATUS_NOT_FOUND: typeof HTTP_STATUS_NOT_FOUND\n readonly HTTP_STATUS_UNAUTHORIZED: typeof HTTP_STATUS_UNAUTHORIZED\n readonly NODE_MODULES: typeof NODE_MODULES\n readonly NPM: typeof NPM\n readonly NPM_BUGGY_OVERRIDES_PATCHED_VERSION: typeof NPM_BUGGY_OVERRIDES_PATCHED_VERSION\n readonly NPM_REGISTRY_URL: typeof NPM_REGISTRY_URL\n readonly NPX: typeof NPX\n readonly OUTPUT_JSON: typeof OUTPUT_JSON\n readonly OUTPUT_MARKDOWN: typeof OUTPUT_MARKDOWN\n readonly OUTPUT_TEXT: typeof OUTPUT_TEXT\n readonly PACKAGE_JSON: typeof PACKAGE_JSON\n readonly PACKAGE_LOCK_JSON: typeof PACKAGE_LOCK_JSON\n readonly PNPM: typeof PNPM\n readonly PNPM_LOCK_YAML: typeof PNPM_LOCK_YAML\n readonly PNPM_WORKSPACE_YAML: typeof PNPM_WORKSPACE_YAML\n readonly REDACTED: typeof REDACTED\n readonly REPORT_LEVEL_DEFER: typeof REPORT_LEVEL_DEFER\n readonly REPORT_LEVEL_ERROR: typeof REPORT_LEVEL_ERROR\n readonly REPORT_LEVEL_IGNORE: typeof REPORT_LEVEL_IGNORE\n readonly REPORT_LEVEL_MONITOR: typeof REPORT_LEVEL_MONITOR\n readonly REPORT_LEVEL_WARN: typeof REPORT_LEVEL_WARN\n readonly REQUIREMENTS_TXT: typeof REQUIREMENTS_TXT\n readonly SCAN_TYPE_SOCKET: typeof SCAN_TYPE_SOCKET\n readonly SCAN_TYPE_SOCKET_TIER1: typeof SCAN_TYPE_SOCKET_TIER1\n readonly SOCKET_CLI_ACCEPT_RISKS: typeof SOCKET_CLI_ACCEPT_RISKS\n readonly SOCKET_CLI_BIN_NAME: typeof SOCKET_CLI_BIN_NAME\n readonly SOCKET_CLI_ISSUES_URL: typeof SOCKET_CLI_ISSUES_URL\n readonly SOCKET_CLI_SHADOW_ACCEPT_RISKS: typeof SOCKET_CLI_SHADOW_ACCEPT_RISKS\n readonly SOCKET_CLI_SHADOW_API_TOKEN: typeof SOCKET_CLI_SHADOW_API_TOKEN\n readonly SOCKET_CLI_SHADOW_BIN: typeof SOCKET_CLI_SHADOW_BIN\n readonly SOCKET_CLI_SHADOW_PROGRESS: typeof SOCKET_CLI_SHADOW_PROGRESS\n readonly SOCKET_CLI_SHADOW_SILENT: typeof SOCKET_CLI_SHADOW_SILENT\n readonly SOCKET_CLI_VIEW_ALL_RISKS: typeof SOCKET_CLI_VIEW_ALL_RISKS\n readonly SOCKET_DEFAULT_BRANCH: typeof SOCKET_DEFAULT_BRANCH\n readonly SOCKET_DEFAULT_REPOSITORY: typeof SOCKET_DEFAULT_REPOSITORY\n readonly SOCKET_JSON: typeof SOCKET_JSON\n readonly SOCKET_WEBSITE_URL: typeof SOCKET_WEBSITE_URL\n readonly SOCKET_YAML: typeof SOCKET_YAML\n readonly SOCKET_YML: typeof SOCKET_YML\n readonly TSCONFIG_JSON: typeof TSCONFIG_JSON\n readonly UNKNOWN_ERROR: typeof UNKNOWN_ERROR\n readonly UNKNOWN_VALUE: typeof UNKNOWN_VALUE\n readonly V1_MIGRATION_GUIDE_URL: typeof V1_MIGRATION_GUIDE_URL\n readonly VLT: typeof VLT\n readonly YARN: typeof YARN\n readonly YARN_BERRY: typeof YARN_BERRY\n readonly YARN_CLASSIC: typeof YARN_CLASSIC\n readonly bashRcPath: string\n readonly binCliPath: string\n readonly binPath: string\n readonly blessedContribPath: string\n readonly blessedOptions: {\n smartCSR: boolean\n term: string\n useBCE: boolean\n }\n readonly blessedPath: string\n readonly distCliPath: string\n readonly distPath: string\n readonly externalPath: string\n readonly githubCachePath: string\n readonly homePath: string\n readonly instrumentWithSentryPath: string\n readonly ipcObject: IpcObject\n readonly minimumVersionByAgent: Map<Agent, string>\n readonly nmBinPath: string\n readonly nodeDebugFlags: string[]\n readonly nodeHardenFlags: string[]\n readonly nodeMemoryFlags: string[]\n readonly npmCachePath: string\n readonly npmGlobalPrefix: string\n readonly npmNmNodeGypPath: string\n readonly processEnv: ProcessEnv\n readonly rootPath: string\n readonly shadowBinPath: string\n readonly shadowNpmBinPath: string\n readonly shadowNpmInjectPath: string\n readonly shadowNpxBinPath: string\n readonly shadowPnpmBinPath: string\n readonly shadowYarnBinPath: string\n readonly socketAppDataPath: string\n readonly socketCachePath: string\n readonly socketRegistryPath: string\n readonly zshRcPath: string\n }\n>\n\nlet _Sentry: any\n\nlet _npmStdioPipeOptions: SpawnOptions | undefined\nfunction getNpmStdioPipeOptions() {\n if (_npmStdioPipeOptions === undefined) {\n _npmStdioPipeOptions = {\n cwd: process.cwd(),\n // On Windows, npm is often a .cmd file that requires shell execution.\n // The spawn function from @socketsecurity/registry will handle this properly\n // when shell is true.\n shell: constants.WIN32,\n }\n }\n return _npmStdioPipeOptions\n}\n\nconst LAZY_ENV = () => {\n const { env } = process\n const envHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/env')\n const utils = /*@__PURE__*/ require(\n path.join(constants.rootPath, 'dist/utils.js'),\n )\n const envAsBoolean = envHelpers.envAsBoolean\n const envAsNumber = envHelpers.envAsNumber\n const envAsString = envHelpers.envAsString\n const getConfigValueOrUndef = utils.getConfigValueOrUndef\n const readOrDefaultSocketJson = utils.readOrDefaultSocketJson\n const GITHUB_TOKEN = envAsString(env['GITHUB_TOKEN'])\n const INLINED_SOCKET_CLI_PUBLISHED_BUILD = envAsBoolean(\n process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD'],\n )\n // We inline some environment values so that they CANNOT be influenced by user\n // provided environment variables.\n return Object.freeze({\n __proto__: null,\n // Lazily access registryConstants.ENV.\n ...registryConstants.ENV,\n // Disable using GitHub's workflow actions/cache.\n // https://github.com/actions/cache\n DISABLE_GITHUB_CACHE: envAsBoolean(env['DISABLE_GITHUB_CACHE']),\n // The API URL. For example, https://api.github.com.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_API_URL:\n envAsString(env['GITHUB_API_URL']) || 'https://api.github.com',\n // The name of the base ref or target branch of the pull request in a workflow\n // run. This is only set when the event that triggers a workflow run is either\n // pull_request or pull_request_target. For example, main.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_BASE_REF: envAsString(env['GITHUB_BASE_REF']),\n // The short ref name of the branch or tag that triggered the GitHub workflow\n // run. This value matches the branch or tag name shown on GitHub. For example,\n // feature-branch-1. For pull requests, the format is <pr_number>/merge.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REF_NAME: envAsString(env['GITHUB_REF_NAME']),\n // The type of ref that triggered the workflow run. Valid values are branch or tag.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REF_TYPE: envAsString(env['GITHUB_REF_TYPE']),\n // The owner and repository name. For example, octocat/Hello-World.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REPOSITORY: envAsString(env['GITHUB_REPOSITORY']),\n // The URL of the GitHub server. For example, https://github.com.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_SERVER_URL:\n envAsString(env['GITHUB_SERVER_URL']) || 'https://github.com',\n // The GITHUB_TOKEN secret is a GitHub App installation access token.\n // The token's permissions are limited to the repository that contains the\n // workflow.\n // https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#about-the-github_token-secret\n GITHUB_TOKEN,\n // Comp-time inlined @coana-tech/cli package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION']\".\n INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION'],\n ),\n // Comp-time inlined @cyclonedx/cdxgen package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION']\".\n INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION'],\n ),\n // Comp-time inlined Socket package homepage.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_HOMEPAGE']\".\n INLINED_SOCKET_CLI_HOMEPAGE: envAsString(\n process.env['INLINED_SOCKET_CLI_HOMEPAGE'],\n ),\n // Comp-time inlined flag to determine if this is the Legacy build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_LEGACY_BUILD']\".\n INLINED_SOCKET_CLI_LEGACY_BUILD: envAsBoolean(\n process.env['INLINED_SOCKET_CLI_LEGACY_BUILD'],\n ),\n // Comp-time inlined Socket package name.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_NAME']\".\n INLINED_SOCKET_CLI_NAME: envAsString(\n process.env['INLINED_SOCKET_CLI_NAME'],\n ),\n // Comp-time inlined flag to determine if this is a published build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\".\n INLINED_SOCKET_CLI_PUBLISHED_BUILD,\n // Comp-time inlined flag to determine if this is the Sentry build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']\".\n INLINED_SOCKET_CLI_SENTRY_BUILD: envAsBoolean(\n process.env['INLINED_SOCKET_CLI_SENTRY_BUILD'],\n ),\n // Comp-time inlined synp package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SYNP_VERSION']\".\n INLINED_SOCKET_CLI_SYNP_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_SYNP_VERSION'],\n ),\n // Comp-time inlined Socket package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION']\".\n INLINED_SOCKET_CLI_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_VERSION'],\n ),\n // Comp-time inlined Socket package version hash.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION_HASH']\".\n INLINED_SOCKET_CLI_VERSION_HASH: envAsString(\n process.env['INLINED_SOCKET_CLI_VERSION_HASH'],\n ),\n // Enable the module compile cache for the Node.js instance.\n // https://nodejs.org/api/cli.html#node_compile_cachedir\n NODE_COMPILE_CACHE: constants.SUPPORTS_NODE_COMPILE_CACHE_ENV_VAR\n ? constants.socketCachePath\n : '',\n // Redefine registryConstants.ENV.NODE_ENV to account for the\n // INLINED_SOCKET_CLI_PUBLISHED_BUILD environment variable.\n NODE_ENV:\n envAsString(env['NODE_ENV']).toLowerCase() === 'production'\n ? 'production'\n : INLINED_SOCKET_CLI_PUBLISHED_BUILD\n ? ''\n : 'development',\n // Well known \"root\" CAs (like VeriSign) will be extended with the extra\n // certificates in file. The file should consist of one or more trusted\n // certificates in PEM format.\n // https://nodejs.org/api/cli.html#node_extra_ca_certsfile\n NODE_EXTRA_CA_CERTS:\n envAsString(env['NODE_EXTRA_CA_CERTS']) ||\n // Commonly used environment variable to specify the path to a single\n // PEM-encoded certificate file.\n envAsString(env['SSL_CERT_FILE']),\n // npm cache directory path. Used to detect if running from npm's npx cache\n // for temporary execution contexts.\n npm_config_cache: envAsString(env['npm_config_cache']),\n // Package manager user agent string that identifies which package manager\n // is executing commands. Used to detect temporary execution contexts like\n // npx, pnpm dlx, or yarn dlx.\n // Expected values:\n // - npm: 'npm/version node/version os arch' (e.g., 'npm/10.0.0 node/v20.0.0 darwin x64')\n // - npx: Similar to npm but may include 'npx' or 'exec' in the string\n // - yarn: 'yarn/version npm/? node/version os arch' (e.g., 'yarn/1.22.0 npm/? node/v20.0.0 darwin x64')\n // - pnpm: 'pnpm/version node/version os arch' (Note: Not set for pnpm dlx/create/init)\n // - When running via exec/npx/dlx, the string may contain 'exec', 'npx', or 'dlx'\n npm_config_user_agent: envAsString(env['npm_config_user_agent']),\n // PATH is an environment variable that lists directories where executable\n // programs are located. When a command is run, the system searches these\n // directories to find the executable.\n PATH: envAsString(env['PATH']),\n // Accept risks of a Socket wrapped npm/npx run.\n SOCKET_CLI_ACCEPT_RISKS: envAsBoolean(env[SOCKET_CLI_ACCEPT_RISKS]),\n // Enable debug logging in Socket CLI.\n SOCKET_CLI_DEBUG: envAsBoolean(env['SOCKET_CLI_DEBUG']),\n // Change the base URL for Socket API calls.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables-for-development\n SOCKET_CLI_API_BASE_URL:\n envAsString(env['SOCKET_CLI_API_BASE_URL']) ||\n // TODO: Remove legacy environment variable name.\n envAsString(env['SOCKET_SECURITY_API_BASE_URL']) ||\n getConfigValueOrUndef('apiBaseUrl') ||\n API_V0_URL,\n // Set the proxy that all requests are routed through.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables-for-development\n SOCKET_CLI_API_PROXY:\n envAsString(env['SOCKET_CLI_API_PROXY']) ||\n // TODO: Remove legacy environment variable name.\n envAsString(env['SOCKET_SECURITY_API_PROXY']) ||\n // Commonly used environment variables to specify routing requests through\n // a proxy server.\n envAsString(env['HTTPS_PROXY']) ||\n envAsString(env['https_proxy']) ||\n envAsString(env['HTTP_PROXY']) ||\n envAsString(env['http_proxy']),\n // Set the timeout in milliseconds for Socket API requests.\n // https://nodejs.org/api/http.html#httprequesturl-options-callback\n SOCKET_CLI_API_TIMEOUT: envAsNumber(env['SOCKET_CLI_API_TIMEOUT']),\n // Set the Socket API token.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables\n SOCKET_CLI_API_TOKEN:\n envAsString(env['SOCKET_CLI_API_TOKEN']) ||\n // TODO: Remove legacy environment variable names.\n envAsString(env['SOCKET_CLI_API_KEY']) ||\n envAsString(env['SOCKET_SECURITY_API_TOKEN']) ||\n envAsString(env['SOCKET_SECURITY_API_KEY']),\n // A JSON stringified Socket configuration object.\n SOCKET_CLI_CONFIG: envAsString(env['SOCKET_CLI_CONFIG']),\n // The git config user.email used by Socket CLI.\n SOCKET_CLI_GIT_USER_EMAIL:\n envAsString(env['SOCKET_CLI_GIT_USER_EMAIL']) ||\n 'github-actions[bot]@users.noreply.github.com',\n // The git config user.name used by Socket CLI.\n SOCKET_CLI_GIT_USER_NAME:\n envAsString(env['SOCKET_CLI_GIT_USER_NAME']) ||\n envAsString(env['SOCKET_CLI_GIT_USERNAME']) ||\n 'github-actions[bot]',\n // Change the base URL for GitHub REST API calls.\n // https://docs.github.com/en/rest\n SOCKET_CLI_GITHUB_API_URL:\n envAsString(env['SOCKET_CLI_GITHUB_API_URL']) ||\n readOrDefaultSocketJson(process.cwd())?.defaults?.scan?.github\n ?.githubApiUrl ||\n 'https://api.github.com',\n // A classic GitHub personal access token with the \"repo\" scope or a\n // fine-grained access token with at least read/write permissions set for\n // \"Contents\" and \"Pull Request\".\n // https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens\n SOCKET_CLI_GITHUB_TOKEN:\n envAsString(env['SOCKET_CLI_GITHUB_TOKEN']) ||\n // TODO: Remove undocumented legacy environment variable name.\n envAsString(env['SOCKET_SECURITY_GITHUB_PAT']) ||\n GITHUB_TOKEN,\n // Make the default API token `undefined`.\n SOCKET_CLI_NO_API_TOKEN: envAsBoolean(env['SOCKET_CLI_NO_API_TOKEN']),\n // The absolute location of the npm directory.\n SOCKET_CLI_NPM_PATH: envAsString(env['SOCKET_CLI_NPM_PATH']),\n // Specify the Socket organization slug.\n SOCKET_CLI_ORG_SLUG:\n envAsString(env['SOCKET_CLI_ORG_SLUG']) ||\n // Coana CLI accepts the SOCKET_ORG_SLUG environment variable.\n envAsString(env['SOCKET_ORG_SLUG']),\n // View all risks of a Socket wrapped npm/npx run.\n SOCKET_CLI_VIEW_ALL_RISKS: envAsBoolean(env[SOCKET_CLI_VIEW_ALL_RISKS]),\n // Override the public patch API proxy URL for socket-patch.\n SOCKET_PATCH_PROXY_URL: envAsString(env['SOCKET_PATCH_PROXY_URL']),\n // Specifies the type of terminal or terminal emulator being used by the process.\n TERM: envAsString(env['TERM']),\n // Redefine registryConstants.ENV.VITEST to account for the\n // INLINED_SOCKET_CLI_PUBLISHED_BUILD environment variable.\n VITEST: INLINED_SOCKET_CLI_PUBLISHED_BUILD\n ? false\n : envAsBoolean(process.env[VITEST]),\n })\n}\n\nconst lazyBashRcPath = () => path.join(constants.homePath, '.bashrc')\n\nconst lazyBinPath = () => path.join(constants.rootPath, 'bin')\n\nconst lazyBinCliPath = () => path.join(constants.binPath, 'cli.js')\n\nconst lazyBlessedContribPath = () =>\n path.join(constants.externalPath, 'blessed-contrib')\n\nconst lazyBlessedOptions = () =>\n Object.freeze({\n smartCSR: true,\n term: constants.WIN32 ? 'windows-ansi' : 'xterm',\n useBCE: true,\n })\n\nconst lazyBlessedPath = () => path.join(constants.externalPath, 'blessed')\n\nconst lazyDistCliPath = () => path.join(constants.distPath, 'cli.js')\n\nconst lazyDistPath = () => path.join(constants.rootPath, 'dist')\n\nconst lazyExternalPath = () => path.join(constants.rootPath, 'external')\n\nconst lazyGithubCachePath = () => path.join(constants.socketCachePath, 'github')\n\nconst lazyHomePath = () => os.homedir()\n\nconst lazyInstrumentWithSentryPath = () =>\n path.join(constants.distPath, 'instrument-with-sentry.js')\n\nconst lazyMinimumVersionByAgent = () =>\n new Map([\n // Bun >=1.1.39 supports the text-based lockfile.\n // https://bun.sh/blog/bun-lock-text-lockfile\n [BUN, '1.1.39'],\n // The npm version bundled with Node 18.\n // https://nodejs.org/en/about/previous-releases#looking-for-the-latest-release-of-a-version-branch\n [NPM, '10.8.2'],\n // 8.x is the earliest version to support Node 18.\n // https://pnpm.io/installation#compatibility\n // https://www.npmjs.com/package/pnpm?activeTab=versions\n [PNPM, '8.15.7'],\n // 4.x supports >= Node 18.12.0\n // https://github.com/yarnpkg/berry/blob/%40yarnpkg/core/4.1.0/CHANGELOG.md#400\n [YARN_BERRY, '4.0.0'],\n // Latest 1.x.\n // https://www.npmjs.com/package/yarn?activeTab=versions\n [YARN_CLASSIC, '1.22.22'],\n // vlt does not support overrides so we don't gate on it.\n [VLT, '*'],\n ])\n\nconst lazyNmBinPath = () => path.join(constants.rootPath, 'node_modules/.bin')\n\nconst lazyNodeDebugFlags = () =>\n constants.ENV.SOCKET_CLI_DEBUG ? ['--trace-uncaught', '--trace-warnings'] : []\n\n// Redefine registryConstants.nodeHardenFlags to account for the\n// INLINED_SOCKET_CLI_SENTRY_BUILD environment variable.\nconst lazyNodeHardenFlags = () =>\n Object.freeze(\n // Harden Node security.\n // https://nodejs.org/en/learn/getting-started/security-best-practices\n constants.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD || constants.WIN32\n ? [\n // https://nodejs.org/api/cli.html#--disallow-code-generation-from-strings\n // '--disallow-code-generation-from-strings'\n ]\n : [\n // '--disallow-code-generation-from-strings',\n // https://nodejs.org/api/cli.html#--disable-protomode\n // '--disable-proto',\n // 'throw',\n // https://nodejs.org/api/cli.html#--frozen-intrinsics\n // We have contributed the following patches to our dependencies to make\n // Node's --frozen-intrinsics workable.\n // √ https://github.com/SBoudrias/Inquirer.js/pull/1683\n // √ https://github.com/pnpm/components/pull/23\n // '--frozen-intrinsics',\n // https://nodejs.org/api/cli.html#--no-deprecation\n // '--no-deprecation',\n ],\n )\n\nconst lazyNodeMemoryFlags = () => {\n const flags = /*@__PURE__*/ require(\n path.join(constants.rootPath, 'dist/flags.js'),\n )\n const getMaxOldSpaceSizeFlag = flags.getMaxOldSpaceSizeFlag\n const getMaxSemiSpaceSizeFlag = flags.getMaxSemiSpaceSizeFlag\n return Object.freeze([\n `--max-old-space-size=${getMaxOldSpaceSizeFlag()}`,\n `--max-semi-space-size=${getMaxSemiSpaceSizeFlag()}`,\n ])\n}\n\nconst lazyNpmCachePath = () => {\n const spawnHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/spawn')\n const spawnSync = spawnHelpers.spawnSync\n return spawnSync(\n constants.npmExecPath,\n ['config', 'get', 'cache'],\n getNpmStdioPipeOptions(),\n ).stdout\n}\n\nconst lazyNpmGlobalPrefix = () => {\n const spawnHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/spawn')\n const spawnSync = spawnHelpers.spawnSync\n return spawnSync(\n constants.npmExecPath,\n ['prefix', '-g'],\n getNpmStdioPipeOptions(),\n ).stdout\n}\n\nconst lazyNpmNmNodeGypPath = () =>\n path.join(\n constants.npmRealExecPath,\n '../../node_modules/node-gyp/bin/node-gyp.js',\n )\n\nconst lazyProcessEnv = () =>\n Object.setPrototypeOf(\n Object.fromEntries(\n Object.entries(constants.ENV).reduce(\n (entries, entry) => {\n const { 0: key, 1: value } = entry\n if (key.startsWith('INLINED_SOCKET_CLI_')) {\n return entries\n }\n if (typeof value === 'string') {\n if (value) {\n entries.push(entry as [string, string])\n }\n } else if (typeof value === 'boolean' && value) {\n entries.push([key, '1'])\n }\n return entries\n },\n [] as Array<[string, string]>,\n ),\n ),\n null,\n )\n\nconst lazyRootPath = () => path.join(realpathSync.native(__dirname), '..')\n\nconst lazyShadowBinPath = () => path.join(constants.rootPath, 'shadow-npm-bin')\n\nconst lazyShadowNpmBinPath = () =>\n path.join(constants.distPath, 'shadow-npm-bin.js')\n\nconst lazyShadowNpmInjectPath = () =>\n path.join(constants.distPath, 'shadow-npm-inject.js')\n\nconst lazyShadowNpxBinPath = () =>\n path.join(constants.distPath, 'shadow-npx-bin.js')\n\nconst lazyShadowPnpmBinPath = () =>\n path.join(constants.distPath, 'shadow-pnpm-bin.js')\n\nconst lazyShadowYarnBinPath = () =>\n path.join(constants.distPath, 'shadow-yarn-bin.js')\n\nconst lazySocketAppDataPath = (): string | undefined => {\n // Get the OS app data directory:\n // - Win: %LOCALAPPDATA% or fail?\n // - Mac: %XDG_DATA_HOME% or fallback to \"~/Library/Application Support/\"\n // - Linux: %XDG_DATA_HOME% or fallback to \"~/.local/share/\"\n // Note: LOCALAPPDATA is typically: C:\\Users\\USERNAME\\AppData\n // Note: XDG stands for \"X Desktop Group\", nowadays \"freedesktop.org\"\n // On most systems that path is: $HOME/.local/share\n // Then append `socket/settings`, so:\n // - Win: %LOCALAPPDATA%\\socket\\settings or return undefined\n // - Mac: %XDG_DATA_HOME%/socket/settings or \"~/Library/Application Support/socket/settings\"\n // - Linux: %XDG_DATA_HOME%/socket/settings or \"~/.local/share/socket/settings\"\n const { WIN32 } = constants\n let dataHome: string | undefined = WIN32\n ? constants.ENV.LOCALAPPDATA\n : constants.ENV.XDG_DATA_HOME\n if (!dataHome) {\n if (WIN32) {\n const logger = /*@__PURE__*/ require('@socketsecurity/registry/lib/logger')\n logger.warn(`Missing %LOCALAPPDATA%.`)\n } else {\n dataHome = path.join(\n constants.homePath,\n constants.DARWIN ? 'Library/Application Support' : '.local/share',\n )\n }\n }\n return dataHome ? path.join(dataHome, 'socket/settings') : undefined\n}\n\nconst lazySocketCachePath = () => path.join(constants.rootPath, '.cache')\n\nconst lazySocketRegistryPath = () =>\n path.join(constants.externalPath, '@socketsecurity/registry')\n\nconst lazyZshRcPath = () => path.join(constants.homePath, '.zshrc')\n\nconst constants: Constants = createConstantsObject(\n {\n ...registryConstantsAttribs.props,\n ALERT_TYPE_CRITICAL_CVE,\n ALERT_TYPE_CVE,\n ALERT_TYPE_MEDIUM_CVE,\n ALERT_TYPE_MILD_CVE,\n API_V0_URL,\n BUN,\n CONFIG_KEY_API_BASE_URL,\n CONFIG_KEY_API_PROXY,\n CONFIG_KEY_API_TOKEN,\n CONFIG_KEY_DEFAULT_ORG,\n CONFIG_KEY_ENFORCED_ORGS,\n CONFIG_KEY_ORG,\n DOT_GIT_DIR,\n DOT_SOCKET_DIR,\n DOT_SOCKET_DOT_FACTS_JSON,\n DRY_RUN_BAILING_NOW,\n DRY_RUN_LABEL,\n DRY_RUN_NOT_SAVING,\n ENV: undefined,\n ENVIRONMENT_YAML,\n ENVIRONMENT_YML,\n ERROR_NO_MANIFEST_FILES,\n ERROR_NO_PACKAGE_JSON,\n ERROR_NO_REPO_FOUND,\n ERROR_NO_SOCKET_DIR,\n ERROR_UNABLE_RESOLVE_ORG,\n EXT_YAML,\n EXT_YML,\n FLAG_CONFIG,\n FLAG_DRY_RUN,\n FLAG_HELP,\n FLAG_HELP_FULL,\n FLAG_ID,\n FLAG_JSON,\n FLAG_LOGLEVEL,\n FLAG_MARKDOWN,\n FLAG_ORG,\n FLAG_PIN,\n FLAG_PROD,\n FLAG_QUIET,\n FLAG_SILENT,\n FLAG_TEXT,\n FLAG_VERBOSE,\n FLAG_VERSION,\n FOLD_SETTING_FILE,\n FOLD_SETTING_NONE,\n FOLD_SETTING_PKG,\n FOLD_SETTING_VERSION,\n GQL_PAGE_SENTINEL,\n GQL_PR_STATE_CLOSED,\n GQL_PR_STATE_MERGED,\n GQL_PR_STATE_OPEN,\n HTTP_STATUS_BAD_REQUEST,\n HTTP_STATUS_FORBIDDEN,\n HTTP_STATUS_INTERNAL_SERVER_ERROR,\n HTTP_STATUS_NOT_FOUND,\n HTTP_STATUS_UNAUTHORIZED,\n NODE_MODULES,\n NPM_BUGGY_OVERRIDES_PATCHED_VERSION,\n NPM_REGISTRY_URL,\n NPX,\n OUTPUT_JSON,\n OUTPUT_MARKDOWN,\n OUTPUT_TEXT,\n PACKAGE_JSON,\n PACKAGE_LOCK_JSON,\n PNPM,\n PNPM_LOCK_YAML,\n PNPM_WORKSPACE_YAML,\n REDACTED,\n REPORT_LEVEL_DEFER,\n REPORT_LEVEL_ERROR,\n REPORT_LEVEL_IGNORE,\n REPORT_LEVEL_MONITOR,\n REPORT_LEVEL_WARN,\n REQUIREMENTS_TXT,\n SCAN_TYPE_SOCKET,\n SCAN_TYPE_SOCKET_TIER1,\n SOCKET_CLI_ACCEPT_RISKS,\n SOCKET_CLI_BIN_NAME,\n SOCKET_CLI_ISSUES_URL,\n SOCKET_CLI_SHADOW_ACCEPT_RISKS,\n SOCKET_CLI_SHADOW_API_TOKEN,\n SOCKET_CLI_SHADOW_BIN,\n SOCKET_CLI_SHADOW_PROGRESS,\n SOCKET_CLI_SHADOW_SILENT,\n SOCKET_CLI_VIEW_ALL_RISKS,\n SOCKET_DEFAULT_BRANCH,\n SOCKET_DEFAULT_REPOSITORY,\n SOCKET_JSON,\n SOCKET_WEBSITE_URL,\n SOCKET_YAML,\n SOCKET_YML,\n TSCONFIG_JSON,\n UNKNOWN_ERROR,\n UNKNOWN_VALUE,\n V1_MIGRATION_GUIDE_URL,\n VLT,\n YARN,\n YARN_BERRY,\n YARN_CLASSIC,\n bashRcPath: undefined,\n binPath: undefined,\n binCliPath: undefined,\n blessedContribPath: undefined,\n blessedOptions: undefined,\n blessedPath: undefined,\n distCliPath: undefined,\n distPath: undefined,\n externalPath: undefined,\n githubCachePath: undefined,\n homePath: undefined,\n instrumentWithSentryPath: undefined,\n minimumVersionByAgent: undefined,\n nmBinPath: undefined,\n nodeHardenFlags: undefined,\n nodeDebugFlags: undefined,\n nodeMemoryFlags: undefined,\n npmCachePath: undefined,\n npmGlobalPrefix: undefined,\n npmNmNodeGypPath: undefined,\n processEnv: undefined,\n rootPath: undefined,\n shadowBinPath: undefined,\n shadowNpmInjectPath: undefined,\n shadowNpmBinPath: undefined,\n shadowPnpmBinPath: undefined,\n shadowYarnBinPath: undefined,\n socketAppDataPath: undefined,\n socketCachePath: undefined,\n socketRegistryPath: undefined,\n zshRcPath: undefined,\n },\n {\n getters: {\n ...registryConstantsAttribs.getters,\n ENV: LAZY_ENV,\n bashRcPath: lazyBashRcPath,\n binCliPath: lazyBinCliPath,\n binPath: lazyBinPath,\n blessedContribPath: lazyBlessedContribPath,\n blessedOptions: lazyBlessedOptions,\n blessedPath: lazyBlessedPath,\n distCliPath: lazyDistCliPath,\n distPath: lazyDistPath,\n externalPath: lazyExternalPath,\n githubCachePath: lazyGithubCachePath,\n homePath: lazyHomePath,\n instrumentWithSentryPath: lazyInstrumentWithSentryPath,\n minimumVersionByAgent: lazyMinimumVersionByAgent,\n nmBinPath: lazyNmBinPath,\n nodeDebugFlags: lazyNodeDebugFlags,\n nodeHardenFlags: lazyNodeHardenFlags,\n nodeMemoryFlags: lazyNodeMemoryFlags,\n npmCachePath: lazyNpmCachePath,\n npmGlobalPrefix: lazyNpmGlobalPrefix,\n npmNmNodeGypPath: lazyNpmNmNodeGypPath,\n processEnv: lazyProcessEnv,\n rootPath: lazyRootPath,\n shadowBinPath: lazyShadowBinPath,\n shadowNpmBinPath: lazyShadowNpmBinPath,\n shadowNpmInjectPath: lazyShadowNpmInjectPath,\n shadowNpxBinPath: lazyShadowNpxBinPath,\n shadowPnpmBinPath: lazyShadowPnpmBinPath,\n shadowYarnBinPath: lazyShadowYarnBinPath,\n socketAppDataPath: lazySocketAppDataPath,\n socketCachePath: lazySocketCachePath,\n socketRegistryPath: lazySocketRegistryPath,\n zshRcPath: lazyZshRcPath,\n },\n internals: {\n ...registryConstantsAttribs.internals,\n getIpc,\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 },\n) as Constants\n\nexport {\n // Re-exported from socket-registry.\n AT_LATEST,\n BIOME_JSON,\n BUN,\n CI,\n COLUMN_LIMIT,\n DOT_GIT_DIR,\n DOT_PACKAGE_LOCK_JSON,\n DOT_SOCKET_DIR,\n EMPTY_FILE,\n EMPTY_VALUE,\n ESLINT_CONFIG_JS,\n ESNEXT,\n EXTENSIONS,\n EXTENSIONS_JSON,\n EXT_CJS,\n EXT_CMD,\n EXT_CTS,\n EXT_DTS,\n EXT_JS,\n EXT_JSON,\n EXT_LOCK,\n EXT_LOCKB,\n EXT_MD,\n EXT_MJS,\n EXT_MTS,\n EXT_PS1,\n EXT_YAML,\n EXT_YML,\n GITIGNORE,\n LATEST,\n LICENSE,\n LICENSE_GLOB,\n LICENSE_GLOB_RECURSIVE,\n LICENSE_ORIGINAL,\n LICENSE_ORIGINAL_GLOB,\n LICENSE_ORIGINAL_GLOB_RECURSIVE,\n LOOP_SENTINEL,\n MANIFEST_JSON,\n MIT,\n NODE_AUTH_TOKEN,\n NODE_ENV,\n NODE_MODULES,\n NODE_MODULES_GLOB_RECURSIVE,\n NPM,\n NPX,\n OVERRIDES,\n PACKAGE_DEFAULT_VERSION,\n PACKAGE_JSON,\n PACKAGE_LOCK_JSON,\n PNPM,\n PNPM_LOCK_YAML,\n PRE_COMMIT,\n README_GLOB,\n README_GLOB_RECURSIVE,\n README_MD,\n REGISTRY,\n REGISTRY_SCOPE_DELIMITER,\n RESOLUTIONS,\n SOCKET_GITHUB_ORG,\n SOCKET_IPC_HANDSHAKE,\n SOCKET_OVERRIDE_SCOPE,\n SOCKET_PUBLIC_API_TOKEN,\n SOCKET_REGISTRY_NPM_ORG,\n SOCKET_REGISTRY_PACKAGE_NAME,\n SOCKET_REGISTRY_REPO_NAME,\n SOCKET_REGISTRY_SCOPE,\n SOCKET_SECURITY_SCOPE,\n TSCONFIG_JSON,\n UNKNOWN_ERROR,\n UNKNOWN_VALUE,\n UNLICENCED,\n UNLICENSED,\n UTF8,\n VITEST,\n VLT,\n YARN,\n YARN_BERRY,\n YARN_CLASSIC,\n YARN_LOCK,\n // Socket CLI specific constants.\n ALERT_TYPE_CRITICAL_CVE,\n ALERT_TYPE_CVE,\n ALERT_TYPE_MEDIUM_CVE,\n ALERT_TYPE_MILD_CVE,\n API_V0_URL,\n CONFIG_KEY_API_BASE_URL,\n CONFIG_KEY_API_PROXY,\n CONFIG_KEY_API_TOKEN,\n CONFIG_KEY_DEFAULT_ORG,\n CONFIG_KEY_ENFORCED_ORGS,\n CONFIG_KEY_ORG,\n DLX_BINARY_CACHE_TTL,\n DOT_SOCKET_DOT_FACTS_JSON,\n DRY_RUN_BAILING_NOW,\n DRY_RUN_LABEL,\n DRY_RUN_NOT_SAVING,\n ENVIRONMENT_YAML,\n ENVIRONMENT_YML,\n ERROR_NO_MANIFEST_FILES,\n ERROR_NO_PACKAGE_JSON,\n ERROR_NO_REPO_FOUND,\n ERROR_NO_SOCKET_DIR,\n ERROR_UNABLE_RESOLVE_ORG,\n FLAG_CONFIG,\n FLAG_DRY_RUN,\n FLAG_HELP,\n FLAG_HELP_FULL,\n FLAG_ID,\n FLAG_JSON,\n FLAG_LOGLEVEL,\n FLAG_MARKDOWN,\n FLAG_ORG,\n FLAG_PIN,\n FLAG_PROD,\n FLAG_QUIET,\n FLAG_SILENT,\n FLAG_TEXT,\n FLAG_VERBOSE,\n FLAG_VERSION,\n FOLD_SETTING_FILE,\n FOLD_SETTING_NONE,\n FOLD_SETTING_PKG,\n FOLD_SETTING_VERSION,\n GQL_PAGE_SENTINEL,\n GQL_PR_STATE_CLOSED,\n GQL_PR_STATE_MERGED,\n GQL_PR_STATE_OPEN,\n HTTP_STATUS_BAD_REQUEST,\n HTTP_STATUS_FORBIDDEN,\n HTTP_STATUS_INTERNAL_SERVER_ERROR,\n HTTP_STATUS_NOT_FOUND,\n HTTP_STATUS_UNAUTHORIZED,\n NPM_BUGGY_OVERRIDES_PATCHED_VERSION,\n NPM_REGISTRY_URL,\n OUTPUT_JSON,\n OUTPUT_MARKDOWN,\n OUTPUT_TEXT,\n PNPM_WORKSPACE_YAML,\n REDACTED,\n REPORT_LEVEL_DEFER,\n REPORT_LEVEL_ERROR,\n REPORT_LEVEL_IGNORE,\n REPORT_LEVEL_MONITOR,\n REPORT_LEVEL_WARN,\n REQUIREMENTS_TXT,\n SCAN_TYPE_SOCKET,\n SCAN_TYPE_SOCKET_TIER1,\n SOCKET_CLI_ACCEPT_RISKS,\n SOCKET_CLI_BIN_NAME,\n SOCKET_CLI_ISSUES_URL,\n SOCKET_CLI_SHADOW_ACCEPT_RISKS,\n SOCKET_CLI_SHADOW_API_TOKEN,\n SOCKET_CLI_SHADOW_BIN,\n SOCKET_CLI_SHADOW_PROGRESS,\n SOCKET_CLI_SHADOW_SILENT,\n SOCKET_CLI_VIEW_ALL_RISKS,\n SOCKET_DEFAULT_BRANCH,\n SOCKET_DEFAULT_REPOSITORY,\n SOCKET_JSON,\n SOCKET_WEBSITE_URL,\n SOCKET_YAML,\n SOCKET_YML,\n V1_MIGRATION_GUIDE_URL,\n}\n\nexport default constants\n"],"names":["attributes","getIpc","_npmStdioPipeOptions","cwd","env","__proto__","DISABLE_GITHUB_CACHE","GITHUB_BASE_REF","GITHUB_REF_NAME","GITHUB_REF_TYPE","GITHUB_REPOSITORY","NODE_EXTRA_CA_CERTS","envAsString","npm_config_cache","npm_config_user_agent","PATH","SOCKET_CLI_ACCEPT_RISKS","SOCKET_CLI_DEBUG","SOCKET_CLI_API_BASE_URL","SOCKET_CLI_API_PROXY","SOCKET_CLI_API_TIMEOUT","SOCKET_CLI_API_TOKEN","SOCKET_CLI_CONFIG","SOCKET_CLI_GIT_USER_NAME","SOCKET_CLI_GITHUB_TOKEN","SOCKET_CLI_NO_API_TOKEN","SOCKET_CLI_NPM_PATH","SOCKET_CLI_ORG_SLUG","SOCKET_CLI_VIEW_ALL_RISKS","SOCKET_PATCH_PROXY_URL","TERM","VITEST","smartCSR","term","useBCE","constants","entries","WIN32","logger","dataHome","ENV","bashRcPath","binPath","binCliPath","blessedContribPath","blessedOptions","blessedPath","distCliPath","distPath","externalPath","githubCachePath","homePath","instrumentWithSentryPath","minimumVersionByAgent","nmBinPath","nodeHardenFlags","nodeDebugFlags","nodeMemoryFlags","npmCachePath","npmGlobalPrefix","npmNmNodeGypPath","processEnv","rootPath","shadowBinPath","shadowNpmInjectPath","shadowNpmBinPath","shadowPnpmBinPath","shadowYarnBinPath","socketAppDataPath","socketCachePath","socketRegistryPath","zshRcPath","getters","shadowNpxBinPath","internals","getSentry","_Sentry"],"mappings":";;;;;;;;;;;;AAYA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFE;AACEA;;AAEAC;AACF;AACF;AAoFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAuJA;AAEA;AACA;;AAEIC;AACEC;AACA;AACA;AACA;;;AAGJ;AACA;AACF;AAEA;;AACUC;AAAI;AACZ;AACA;AAGA;AACA;AACA;AACA;AACA;;;AAKA;AACA;;AAEEC;AACA;;AAEA;AACA;AACAC;AACA;AACA;;AAGA;AACA;AACA;AACA;AACAC;AACA;AACA;AACA;AACA;AACAC;AACA;AACA;AACAC;AACA;AACA;AACAC;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAEA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAOA;AACA;AACA;AACA;AACAC;AAEE;AACA;AACAC;AACF;AACA;AACAC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAC;AACA;AACA;AACA;AACAC;AACA;AACAC;AACA;AACAC;AACA;AACA;AACAC;AAEE;AACAN;AAGF;AACA;AACAO;AAEE;AACAP;AACA;AACA;AACAA;AAIF;AACA;AACAQ;AACA;AACA;AACAC;AAEE;;AAIF;AACAC;AACA;;AAIA;AACAC;AAIA;AACA;;AAMA;AACA;AACA;AACA;AACAC;AAEE;AACAZ;AAEF;AACAa;AACA;AACAC;AACA;AACAC;AAEE;AACAf;AACF;AACAgB;AACA;AACAC;AACA;AACAC;AACA;AACA;AACAC;AAGF;AACF;AAEA;AAEA;AAEA;AAEA;AAGA;AAEIC;AACAC;AACAC;AACF;AAEF;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AAGA;AAEI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGJ;AAEA;;AAGA;AACA;AACA;AAEI;AACA;AACAC;AAEM;AACA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAIV;AACE;AAGA;AACA;AACA;AAIF;AAEA;AACE;AACA;AACA;AAKF;AAEA;AACE;AACA;AACA;AAKF;AAEA;AAMA;;AAKkB;AAAQ;AAAS;AACzB;AACE;AACF;AACA;AACE;AACEC;AACF;;;AAGF;AACA;AACF;AAOR;AAEA;AAEA;AAGA;AAGA;AAGA;AAGA;AAGA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACQC;AAAM;AACd;;AAIE;AACE;AACAC;AACF;AACEC;AAIF;AACF;;AAEF;AAEA;AAEA;AAGA;AAEA;;;;;;;;;;;;;;;;;;;;AAqBIC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACF;AAEEC;;AAEEhC;AACAC;AACAE;AACAD;AACAE;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAE;AACAD;AACAE;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAE;AACAD;AACAS;AACAP;AACAC;AACAC;AACAC;AACAC;AACAC;;AAEFG;;;AAGEC;AACE;;;;AAIEC;AACA;AACF;AACA;AACF;AACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","debugId":"c0c37532-06fb-4848-99d0-a465b4205ee1"}
1
+ {"version":3,"file":"constants.js","sources":["../src/constants.mts"],"sourcesContent":["import { realpathSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport registryConstants from '@socketsecurity/registry/lib/constants'\n\nimport type { Agent } from './utils/package-environment.mts'\nimport type { Remap } from '@socketsecurity/registry/lib/objects'\nimport type { SpawnOptions } from '@socketsecurity/registry/lib/spawn'\n\nconst require = createRequire(import.meta.url)\nconst __filename = fileURLToPath(import.meta.url)\n// Using `path.dirname(__filename)` to resolve `__dirname` works for both 'dist'\n// AND 'src' directories because constants.js and constants.mts respectively are\n// in the root of each.\nconst __dirname = path.dirname(__filename)\n\nconst {\n AT_LATEST,\n BIOME_JSON,\n BUN,\n CI,\n COLUMN_LIMIT,\n DOT_GIT_DIR,\n DOT_SOCKET_DIR,\n EMPTY_FILE,\n EMPTY_VALUE,\n ESLINT_CONFIG_JS,\n ESNEXT,\n EXT_CJS,\n EXT_CMD,\n EXT_CTS,\n EXT_DTS,\n EXT_JS,\n EXT_JSON,\n EXT_LOCK,\n EXT_LOCKB,\n EXT_MD,\n EXT_MJS,\n EXT_MTS,\n EXT_PS1,\n EXT_YAML,\n EXT_YML,\n EXTENSIONS,\n EXTENSIONS_JSON,\n GITIGNORE,\n DOT_PACKAGE_LOCK_JSON,\n LATEST,\n LICENSE,\n LICENSE_GLOB,\n LICENSE_GLOB_RECURSIVE,\n LICENSE_ORIGINAL,\n LICENSE_ORIGINAL_GLOB,\n LICENSE_ORIGINAL_GLOB_RECURSIVE,\n LOOP_SENTINEL,\n MANIFEST_JSON,\n MIT,\n NODE_AUTH_TOKEN,\n NODE_ENV,\n NODE_MODULES,\n NODE_MODULES_GLOB_RECURSIVE,\n NPM,\n NPX,\n OVERRIDES,\n PACKAGE_DEFAULT_VERSION,\n PACKAGE_JSON,\n PACKAGE_LOCK_JSON,\n PNPM,\n PNPM_LOCK_YAML,\n PRE_COMMIT,\n README_GLOB,\n README_GLOB_RECURSIVE,\n REGISTRY_SCOPE_DELIMITER,\n README_MD,\n REGISTRY,\n RESOLUTIONS,\n SOCKET_GITHUB_ORG,\n SOCKET_IPC_HANDSHAKE,\n SOCKET_OVERRIDE_SCOPE,\n SOCKET_PUBLIC_API_TOKEN,\n SOCKET_REGISTRY_NPM_ORG,\n SOCKET_REGISTRY_PACKAGE_NAME,\n SOCKET_REGISTRY_REPO_NAME,\n SOCKET_REGISTRY_SCOPE,\n SOCKET_SECURITY_SCOPE,\n TSCONFIG_JSON,\n UNKNOWN_ERROR,\n UNKNOWN_VALUE,\n UNLICENCED,\n UNLICENSED,\n UTF8,\n VITEST,\n VLT,\n YARN,\n YARN_BERRY,\n YARN_CLASSIC,\n YARN_LOCK,\n kInternalsSymbol,\n [kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)']: {\n attributes: registryConstantsAttribs,\n createConstantsObject,\n getIpc,\n },\n} = registryConstants\n\nexport type RegistryEnv = typeof registryConstants.ENV\n\nexport type RegistryInternals =\n (typeof registryConstants)['Symbol(kInternalsSymbol)']\n\nexport type Sentry = any\n\nexport type Internals = Remap<\n Omit<RegistryInternals, 'getIpc'> &\n Readonly<{\n getIpc: {\n (): Promise<IpcObject>\n <K extends keyof IpcObject | undefined>(\n key?: K | undefined,\n ): Promise<K extends keyof IpcObject ? IpcObject[K] : IpcObject>\n }\n getSentry: () => Sentry\n setSentry(Sentry: Sentry): boolean\n }>\n>\n\nexport type ENV = Remap<\n RegistryEnv &\n Readonly<{\n DISABLE_GITHUB_CACHE: boolean\n GITHUB_API_URL: string\n GITHUB_BASE_REF: string\n GITHUB_REF_NAME: string\n GITHUB_REF_TYPE: string\n GITHUB_REPOSITORY: string\n GITHUB_SERVER_URL: string\n GITHUB_TOKEN: string\n INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION: string\n INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION: string\n INLINED_SOCKET_CLI_HOMEPAGE: string\n INLINED_SOCKET_CLI_LEGACY_BUILD: string\n INLINED_SOCKET_CLI_NAME: string\n INLINED_SOCKET_CLI_PUBLISHED_BUILD: string\n INLINED_SOCKET_CLI_SENTRY_BUILD: string\n INLINED_SOCKET_CLI_VERSION: string\n INLINED_SOCKET_CLI_VERSION_HASH: string\n INLINED_SOCKET_CLI_SYNP_VERSION: string\n LOCALAPPDATA: string\n NODE_COMPILE_CACHE: string\n NODE_EXTRA_CA_CERTS: string\n npm_config_cache: string\n npm_config_user_agent: string\n PATH: string\n SOCKET_CLI_ACCEPT_RISKS: boolean\n SOCKET_CLI_DEBUG: boolean\n SOCKET_CLI_API_BASE_URL: string\n SOCKET_CLI_API_PROXY: string\n SOCKET_CLI_API_TIMEOUT: number\n SOCKET_CLI_API_TOKEN: string\n SOCKET_CLI_CONFIG: string\n SOCKET_CLI_GIT_USER_EMAIL: string\n SOCKET_CLI_GIT_USER_NAME: string\n SOCKET_CLI_GITHUB_TOKEN: string\n SOCKET_CLI_NO_API_TOKEN: boolean\n SOCKET_CLI_NPM_PATH: string\n SOCKET_CLI_ORG_SLUG: string\n SOCKET_CLI_VIEW_ALL_RISKS: boolean\n SOCKET_PATCH_PROXY_URL: string\n TERM: string\n XDG_DATA_HOME: string\n }>\n>\n\nexport type IpcObject = Readonly<{\n SOCKET_CLI_FIX?: string | undefined\n SOCKET_CLI_OPTIMIZE?: boolean | undefined\n SOCKET_CLI_SHADOW_ACCEPT_RISKS?: boolean | undefined\n SOCKET_CLI_SHADOW_API_TOKEN?: string | undefined\n SOCKET_CLI_SHADOW_BIN?: string | undefined\n SOCKET_CLI_SHADOW_PROGRESS?: boolean | undefined\n SOCKET_CLI_SHADOW_SILENT?: boolean | undefined\n}>\n\nexport type ProcessEnv = {\n [K in keyof ENV]?: string | undefined\n}\n\n// Socket CLI specific constants that are not in socket-registry.\nconst ALERT_TYPE_CRITICAL_CVE = 'criticalCVE'\nconst ALERT_TYPE_CVE = 'cve'\nconst ALERT_TYPE_MEDIUM_CVE = 'mediumCVE'\nconst ALERT_TYPE_MILD_CVE = 'mildCVE'\nconst API_V0_URL = 'https://api.socket.dev/v0/'\nconst CONFIG_KEY_API_BASE_URL = 'apiBaseUrl'\nconst CONFIG_KEY_API_PROXY = 'apiProxy'\nconst CONFIG_KEY_API_TOKEN = 'apiToken'\nconst CONFIG_KEY_DEFAULT_ORG = 'defaultOrg'\nconst CONFIG_KEY_ENFORCED_ORGS = 'enforcedOrgs'\nconst CONFIG_KEY_ORG = 'org'\n// Must stay in sync with `ext.SOCKET_FACTS_FILENAME` in\n// src/commands/manifest/socket-facts.init.gradle (Groovy side).\n// Groovy can't import a TS constant, so the two values are intentionally\n// duplicated; change them together.\nconst DOT_SOCKET_DOT_FACTS_JSON = `${DOT_SOCKET_DIR}.facts.json`\nconst DLX_BINARY_CACHE_TTL = 7 * 24 * 60 * 60 * 1_000 // 7 days in milliseconds.\nconst DRY_RUN_LABEL = '[DryRun]'\nconst DRY_RUN_BAILING_NOW = `${DRY_RUN_LABEL}: Bailing now`\nconst DRY_RUN_NOT_SAVING = `${DRY_RUN_LABEL}: Not saving`\nconst ENVIRONMENT_YAML = 'environment.yaml'\nconst ENVIRONMENT_YML = 'environment.yml'\nconst ERROR_NO_MANIFEST_FILES = 'No manifest files found'\nconst ERROR_NO_PACKAGE_JSON = 'No package.json found'\nconst ERROR_NO_REPO_FOUND = 'No repo found'\nconst ERROR_NO_SOCKET_DIR = 'No .socket directory found'\nconst ERROR_UNABLE_RESOLVE_ORG =\n 'Unable to resolve a Socket account organization'\nconst FLAG_CONFIG = '--config'\nconst FLAG_DRY_RUN = '--dry-run'\nconst FLAG_HELP = '--help'\nconst FLAG_HELP_FULL = '--help-full'\nconst FLAG_ID = '--id'\nconst FLAG_JSON = '--json'\nconst FLAG_LOGLEVEL = '--loglevel'\nconst FLAG_MARKDOWN = '--markdown'\nconst FLAG_ORG = '--org'\nconst FLAG_PIN = '--pin'\nconst FLAG_PROD = '--prod'\nconst FLAG_QUIET = '--quiet'\nconst FLAG_SILENT = '--silent'\nconst FLAG_TEXT = '--text'\nconst FLAG_VERBOSE = '--verbose'\nconst FLAG_VERSION = '--version'\nconst FOLD_SETTING_FILE = 'file'\nconst FOLD_SETTING_NONE = 'none'\nconst FOLD_SETTING_PKG = 'pkg'\nconst FOLD_SETTING_VERSION = 'version'\nconst GQL_PAGE_SENTINEL = 100\nconst GQL_PR_STATE_CLOSED = 'CLOSED'\nconst GQL_PR_STATE_MERGED = 'MERGED'\nconst GQL_PR_STATE_OPEN = 'OPEN'\nconst HTTP_STATUS_BAD_REQUEST = 400\nconst HTTP_STATUS_FORBIDDEN = 403\nconst HTTP_STATUS_INTERNAL_SERVER_ERROR = 500\nconst HTTP_STATUS_NOT_FOUND = 404\nconst HTTP_STATUS_UNAUTHORIZED = 401\nconst NPM_BUGGY_OVERRIDES_PATCHED_VERSION = '11.2.0'\nconst NPM_REGISTRY_URL = 'https://registry.npmjs.org'\nconst OUTPUT_JSON = 'json'\nconst OUTPUT_MARKDOWN = 'markdown'\nconst OUTPUT_TEXT = 'text'\nconst PNPM_WORKSPACE_YAML = 'pnpm-workspace.yaml'\nconst REDACTED = '<redacted>'\nconst REPORT_LEVEL_DEFER = 'defer'\nconst REPORT_LEVEL_ERROR = 'error'\nconst REPORT_LEVEL_IGNORE = 'ignore'\nconst REPORT_LEVEL_MONITOR = 'monitor'\nconst REPORT_LEVEL_WARN = 'warn'\nconst REQUIREMENTS_TXT = 'requirements.txt'\nconst SOCKET_CLI_ACCEPT_RISKS = 'SOCKET_CLI_ACCEPT_RISKS'\nconst SOCKET_CLI_BIN_NAME = 'socket'\nconst SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues'\nconst SOCKET_CLI_SHADOW_ACCEPT_RISKS = 'SOCKET_CLI_SHADOW_ACCEPT_RISKS'\nconst SOCKET_CLI_SHADOW_API_TOKEN = 'SOCKET_CLI_SHADOW_API_TOKEN'\nconst SOCKET_CLI_SHADOW_BIN = 'SOCKET_CLI_SHADOW_BIN'\nconst SOCKET_CLI_SHADOW_PROGRESS = 'SOCKET_CLI_SHADOW_PROGRESS'\nconst SOCKET_CLI_SHADOW_SILENT = 'SOCKET_CLI_SHADOW_SILENT'\nconst SOCKET_CLI_VIEW_ALL_RISKS = 'SOCKET_CLI_VIEW_ALL_RISKS'\nconst SCAN_TYPE_SOCKET = 'socket'\nconst SCAN_TYPE_SOCKET_TIER1 = 'socket_tier1'\nconst SOCKET_DEFAULT_BRANCH = 'socket-default-branch'\nconst SOCKET_DEFAULT_REPOSITORY = 'socket-default-repository'\nconst SOCKET_JSON = 'socket.json'\nconst SOCKET_WEBSITE_URL = 'https://socket.dev'\nconst SOCKET_YAML = 'socket.yaml'\nconst SOCKET_YML = 'socket.yml'\nconst V1_MIGRATION_GUIDE_URL = 'https://docs.socket.dev/docs/v1-migration-guide'\n\nexport type Constants = Remap<\n Omit<\n typeof registryConstants,\n 'Symbol(kInternalsSymbol)' | 'ENV' | 'ipcObject'\n > & {\n readonly 'Symbol(kInternalsSymbol)': Internals\n readonly ALERT_TYPE_CRITICAL_CVE: typeof ALERT_TYPE_CRITICAL_CVE\n readonly ALERT_TYPE_CVE: typeof ALERT_TYPE_CVE\n readonly ALERT_TYPE_MEDIUM_CVE: typeof ALERT_TYPE_MEDIUM_CVE\n readonly ALERT_TYPE_MILD_CVE: typeof ALERT_TYPE_MILD_CVE\n readonly API_V0_URL: typeof API_V0_URL\n readonly BUN: typeof BUN\n readonly CONFIG_KEY_API_BASE_URL: typeof CONFIG_KEY_API_BASE_URL\n readonly CONFIG_KEY_API_PROXY: typeof CONFIG_KEY_API_PROXY\n readonly CONFIG_KEY_API_TOKEN: typeof CONFIG_KEY_API_TOKEN\n readonly CONFIG_KEY_DEFAULT_ORG: typeof CONFIG_KEY_DEFAULT_ORG\n readonly CONFIG_KEY_ENFORCED_ORGS: typeof CONFIG_KEY_ENFORCED_ORGS\n readonly CONFIG_KEY_ORG: typeof CONFIG_KEY_ORG\n readonly DOT_GIT_DIR: typeof DOT_GIT_DIR\n readonly DOT_SOCKET_DIR: typeof DOT_SOCKET_DIR\n readonly DLX_BINARY_CACHE_TTL: typeof DLX_BINARY_CACHE_TTL\n readonly DOT_SOCKET_DOT_FACTS_JSON: typeof DOT_SOCKET_DOT_FACTS_JSON\n readonly DRY_RUN_BAILING_NOW: typeof DRY_RUN_BAILING_NOW\n readonly DRY_RUN_LABEL: typeof DRY_RUN_LABEL\n readonly DRY_RUN_NOT_SAVING: typeof DRY_RUN_NOT_SAVING\n readonly EMPTY_VALUE: typeof EMPTY_VALUE\n readonly ENV: ENV\n readonly ENVIRONMENT_YAML: typeof ENVIRONMENT_YAML\n readonly ENVIRONMENT_YML: typeof ENVIRONMENT_YML\n readonly ERROR_NO_MANIFEST_FILES: typeof ERROR_NO_MANIFEST_FILES\n readonly ERROR_NO_PACKAGE_JSON: typeof ERROR_NO_PACKAGE_JSON\n readonly ERROR_NO_REPO_FOUND: typeof ERROR_NO_REPO_FOUND\n readonly ERROR_NO_SOCKET_DIR: typeof ERROR_NO_SOCKET_DIR\n readonly ERROR_UNABLE_RESOLVE_ORG: typeof ERROR_UNABLE_RESOLVE_ORG\n readonly EXT_YAML: typeof EXT_YAML\n readonly EXT_YML: typeof EXT_YML\n readonly FLAG_CONFIG: typeof FLAG_CONFIG\n readonly FLAG_DRY_RUN: typeof FLAG_DRY_RUN\n readonly FLAG_HELP: typeof FLAG_HELP\n readonly FLAG_ID: typeof FLAG_ID\n readonly FLAG_JSON: typeof FLAG_JSON\n readonly FLAG_LOGLEVEL: typeof FLAG_LOGLEVEL\n readonly FLAG_MARKDOWN: typeof FLAG_MARKDOWN\n readonly FLAG_ORG: typeof FLAG_ORG\n readonly FLAG_PIN: typeof FLAG_PIN\n readonly FLAG_PROD: typeof FLAG_PROD\n readonly FLAG_QUIET: typeof FLAG_QUIET\n readonly FLAG_SILENT: typeof FLAG_SILENT\n readonly FLAG_TEXT: typeof FLAG_TEXT\n readonly FLAG_VERBOSE: typeof FLAG_VERBOSE\n readonly FLAG_VERSION: typeof FLAG_VERSION\n readonly FOLD_SETTING_FILE: typeof FOLD_SETTING_FILE\n readonly FOLD_SETTING_NONE: typeof FOLD_SETTING_NONE\n readonly FOLD_SETTING_PKG: typeof FOLD_SETTING_PKG\n readonly FOLD_SETTING_VERSION: typeof FOLD_SETTING_VERSION\n readonly GQL_PAGE_SENTINEL: typeof GQL_PAGE_SENTINEL\n readonly GQL_PR_STATE_CLOSED: typeof GQL_PR_STATE_CLOSED\n readonly GQL_PR_STATE_MERGED: typeof GQL_PR_STATE_MERGED\n readonly GQL_PR_STATE_OPEN: typeof GQL_PR_STATE_OPEN\n readonly HTTP_STATUS_BAD_REQUEST: typeof HTTP_STATUS_BAD_REQUEST\n readonly HTTP_STATUS_FORBIDDEN: typeof HTTP_STATUS_FORBIDDEN\n readonly HTTP_STATUS_INTERNAL_SERVER_ERROR: typeof HTTP_STATUS_INTERNAL_SERVER_ERROR\n readonly HTTP_STATUS_NOT_FOUND: typeof HTTP_STATUS_NOT_FOUND\n readonly HTTP_STATUS_UNAUTHORIZED: typeof HTTP_STATUS_UNAUTHORIZED\n readonly NODE_MODULES: typeof NODE_MODULES\n readonly NPM: typeof NPM\n readonly NPM_BUGGY_OVERRIDES_PATCHED_VERSION: typeof NPM_BUGGY_OVERRIDES_PATCHED_VERSION\n readonly NPM_REGISTRY_URL: typeof NPM_REGISTRY_URL\n readonly NPX: typeof NPX\n readonly OUTPUT_JSON: typeof OUTPUT_JSON\n readonly OUTPUT_MARKDOWN: typeof OUTPUT_MARKDOWN\n readonly OUTPUT_TEXT: typeof OUTPUT_TEXT\n readonly PACKAGE_JSON: typeof PACKAGE_JSON\n readonly PACKAGE_LOCK_JSON: typeof PACKAGE_LOCK_JSON\n readonly PNPM: typeof PNPM\n readonly PNPM_LOCK_YAML: typeof PNPM_LOCK_YAML\n readonly PNPM_WORKSPACE_YAML: typeof PNPM_WORKSPACE_YAML\n readonly REDACTED: typeof REDACTED\n readonly REPORT_LEVEL_DEFER: typeof REPORT_LEVEL_DEFER\n readonly REPORT_LEVEL_ERROR: typeof REPORT_LEVEL_ERROR\n readonly REPORT_LEVEL_IGNORE: typeof REPORT_LEVEL_IGNORE\n readonly REPORT_LEVEL_MONITOR: typeof REPORT_LEVEL_MONITOR\n readonly REPORT_LEVEL_WARN: typeof REPORT_LEVEL_WARN\n readonly REQUIREMENTS_TXT: typeof REQUIREMENTS_TXT\n readonly SCAN_TYPE_SOCKET: typeof SCAN_TYPE_SOCKET\n readonly SCAN_TYPE_SOCKET_TIER1: typeof SCAN_TYPE_SOCKET_TIER1\n readonly SOCKET_CLI_ACCEPT_RISKS: typeof SOCKET_CLI_ACCEPT_RISKS\n readonly SOCKET_CLI_BIN_NAME: typeof SOCKET_CLI_BIN_NAME\n readonly SOCKET_CLI_ISSUES_URL: typeof SOCKET_CLI_ISSUES_URL\n readonly SOCKET_CLI_SHADOW_ACCEPT_RISKS: typeof SOCKET_CLI_SHADOW_ACCEPT_RISKS\n readonly SOCKET_CLI_SHADOW_API_TOKEN: typeof SOCKET_CLI_SHADOW_API_TOKEN\n readonly SOCKET_CLI_SHADOW_BIN: typeof SOCKET_CLI_SHADOW_BIN\n readonly SOCKET_CLI_SHADOW_PROGRESS: typeof SOCKET_CLI_SHADOW_PROGRESS\n readonly SOCKET_CLI_SHADOW_SILENT: typeof SOCKET_CLI_SHADOW_SILENT\n readonly SOCKET_CLI_VIEW_ALL_RISKS: typeof SOCKET_CLI_VIEW_ALL_RISKS\n readonly SOCKET_DEFAULT_BRANCH: typeof SOCKET_DEFAULT_BRANCH\n readonly SOCKET_DEFAULT_REPOSITORY: typeof SOCKET_DEFAULT_REPOSITORY\n readonly SOCKET_JSON: typeof SOCKET_JSON\n readonly SOCKET_WEBSITE_URL: typeof SOCKET_WEBSITE_URL\n readonly SOCKET_YAML: typeof SOCKET_YAML\n readonly SOCKET_YML: typeof SOCKET_YML\n readonly TSCONFIG_JSON: typeof TSCONFIG_JSON\n readonly UNKNOWN_ERROR: typeof UNKNOWN_ERROR\n readonly UNKNOWN_VALUE: typeof UNKNOWN_VALUE\n readonly V1_MIGRATION_GUIDE_URL: typeof V1_MIGRATION_GUIDE_URL\n readonly VLT: typeof VLT\n readonly YARN: typeof YARN\n readonly YARN_BERRY: typeof YARN_BERRY\n readonly YARN_CLASSIC: typeof YARN_CLASSIC\n readonly bashRcPath: string\n readonly binCliPath: string\n readonly binPath: string\n readonly blessedContribPath: string\n readonly blessedOptions: {\n smartCSR: boolean\n term: string\n useBCE: boolean\n }\n readonly blessedPath: string\n readonly distCliPath: string\n readonly distPath: string\n readonly externalPath: string\n readonly githubCachePath: string\n readonly homePath: string\n readonly instrumentWithSentryPath: string\n readonly ipcObject: IpcObject\n readonly minimumVersionByAgent: Map<Agent, string>\n readonly nmBinPath: string\n readonly nodeDebugFlags: string[]\n readonly nodeHardenFlags: string[]\n readonly nodeMemoryFlags: string[]\n readonly npmCachePath: string\n readonly npmGlobalPrefix: string\n readonly npmNmNodeGypPath: string\n readonly processEnv: ProcessEnv\n readonly rootPath: string\n readonly shadowBinPath: string\n readonly shadowNpmBinPath: string\n readonly shadowNpmInjectPath: string\n readonly shadowNpxBinPath: string\n readonly shadowPnpmBinPath: string\n readonly shadowYarnBinPath: string\n readonly socketAppDataPath: string\n readonly socketCachePath: string\n readonly socketRegistryPath: string\n readonly zshRcPath: string\n }\n>\n\nlet _Sentry: any\n\nlet _npmStdioPipeOptions: SpawnOptions | undefined\nfunction getNpmStdioPipeOptions() {\n if (_npmStdioPipeOptions === undefined) {\n _npmStdioPipeOptions = {\n cwd: process.cwd(),\n // On Windows, npm is often a .cmd file that requires shell execution.\n // The spawn function from @socketsecurity/registry will handle this properly\n // when shell is true.\n shell: constants.WIN32,\n }\n }\n return _npmStdioPipeOptions\n}\n\nconst LAZY_ENV = () => {\n const { env } = process\n const envHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/env')\n const utils = /*@__PURE__*/ require(\n path.join(constants.rootPath, 'dist/utils.js'),\n )\n const envAsBoolean = envHelpers.envAsBoolean\n const envAsNumber = envHelpers.envAsNumber\n const envAsString = envHelpers.envAsString\n const getConfigValueOrUndef = utils.getConfigValueOrUndef\n const readOrDefaultSocketJson = utils.readOrDefaultSocketJson\n const GITHUB_TOKEN = envAsString(env['GITHUB_TOKEN'])\n const INLINED_SOCKET_CLI_PUBLISHED_BUILD = envAsBoolean(\n process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD'],\n )\n // We inline some environment values so that they CANNOT be influenced by user\n // provided environment variables.\n return Object.freeze({\n __proto__: null,\n // Lazily access registryConstants.ENV.\n ...registryConstants.ENV,\n // Disable using GitHub's workflow actions/cache.\n // https://github.com/actions/cache\n DISABLE_GITHUB_CACHE: envAsBoolean(env['DISABLE_GITHUB_CACHE']),\n // The API URL. For example, https://api.github.com.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_API_URL:\n envAsString(env['GITHUB_API_URL']) || 'https://api.github.com',\n // The name of the base ref or target branch of the pull request in a workflow\n // run. This is only set when the event that triggers a workflow run is either\n // pull_request or pull_request_target. For example, main.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_BASE_REF: envAsString(env['GITHUB_BASE_REF']),\n // The short ref name of the branch or tag that triggered the GitHub workflow\n // run. This value matches the branch or tag name shown on GitHub. For example,\n // feature-branch-1. For pull requests, the format is <pr_number>/merge.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REF_NAME: envAsString(env['GITHUB_REF_NAME']),\n // The type of ref that triggered the workflow run. Valid values are branch or tag.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REF_TYPE: envAsString(env['GITHUB_REF_TYPE']),\n // The owner and repository name. For example, octocat/Hello-World.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REPOSITORY: envAsString(env['GITHUB_REPOSITORY']),\n // The URL of the GitHub server. For example, https://github.com.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_SERVER_URL:\n envAsString(env['GITHUB_SERVER_URL']) || 'https://github.com',\n // The GITHUB_TOKEN secret is a GitHub App installation access token.\n // The token's permissions are limited to the repository that contains the\n // workflow.\n // https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#about-the-github_token-secret\n GITHUB_TOKEN,\n // Comp-time inlined @coana-tech/cli package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION']\".\n INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION'],\n ),\n // Comp-time inlined @cyclonedx/cdxgen package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION']\".\n INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION'],\n ),\n // Comp-time inlined Socket package homepage.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_HOMEPAGE']\".\n INLINED_SOCKET_CLI_HOMEPAGE: envAsString(\n process.env['INLINED_SOCKET_CLI_HOMEPAGE'],\n ),\n // Comp-time inlined flag to determine if this is the Legacy build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_LEGACY_BUILD']\".\n INLINED_SOCKET_CLI_LEGACY_BUILD: envAsBoolean(\n process.env['INLINED_SOCKET_CLI_LEGACY_BUILD'],\n ),\n // Comp-time inlined Socket package name.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_NAME']\".\n INLINED_SOCKET_CLI_NAME: envAsString(\n process.env['INLINED_SOCKET_CLI_NAME'],\n ),\n // Comp-time inlined flag to determine if this is a published build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\".\n INLINED_SOCKET_CLI_PUBLISHED_BUILD,\n // Comp-time inlined flag to determine if this is the Sentry build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']\".\n INLINED_SOCKET_CLI_SENTRY_BUILD: envAsBoolean(\n process.env['INLINED_SOCKET_CLI_SENTRY_BUILD'],\n ),\n // Comp-time inlined synp package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SYNP_VERSION']\".\n INLINED_SOCKET_CLI_SYNP_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_SYNP_VERSION'],\n ),\n // Comp-time inlined Socket package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION']\".\n INLINED_SOCKET_CLI_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_VERSION'],\n ),\n // Comp-time inlined Socket package version hash.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION_HASH']\".\n INLINED_SOCKET_CLI_VERSION_HASH: envAsString(\n process.env['INLINED_SOCKET_CLI_VERSION_HASH'],\n ),\n // Enable the module compile cache for the Node.js instance.\n // https://nodejs.org/api/cli.html#node_compile_cachedir\n NODE_COMPILE_CACHE: constants.SUPPORTS_NODE_COMPILE_CACHE_ENV_VAR\n ? constants.socketCachePath\n : '',\n // Redefine registryConstants.ENV.NODE_ENV to account for the\n // INLINED_SOCKET_CLI_PUBLISHED_BUILD environment variable.\n NODE_ENV:\n envAsString(env['NODE_ENV']).toLowerCase() === 'production'\n ? 'production'\n : INLINED_SOCKET_CLI_PUBLISHED_BUILD\n ? ''\n : 'development',\n // Well known \"root\" CAs (like VeriSign) will be extended with the extra\n // certificates in file. The file should consist of one or more trusted\n // certificates in PEM format.\n // https://nodejs.org/api/cli.html#node_extra_ca_certsfile\n NODE_EXTRA_CA_CERTS:\n envAsString(env['NODE_EXTRA_CA_CERTS']) ||\n // Commonly used environment variable to specify the path to a single\n // PEM-encoded certificate file.\n envAsString(env['SSL_CERT_FILE']),\n // npm cache directory path. Used to detect if running from npm's npx cache\n // for temporary execution contexts.\n npm_config_cache: envAsString(env['npm_config_cache']),\n // Package manager user agent string that identifies which package manager\n // is executing commands. Used to detect temporary execution contexts like\n // npx, pnpm dlx, or yarn dlx.\n // Expected values:\n // - npm: 'npm/version node/version os arch' (e.g., 'npm/10.0.0 node/v20.0.0 darwin x64')\n // - npx: Similar to npm but may include 'npx' or 'exec' in the string\n // - yarn: 'yarn/version npm/? node/version os arch' (e.g., 'yarn/1.22.0 npm/? node/v20.0.0 darwin x64')\n // - pnpm: 'pnpm/version node/version os arch' (Note: Not set for pnpm dlx/create/init)\n // - When running via exec/npx/dlx, the string may contain 'exec', 'npx', or 'dlx'\n npm_config_user_agent: envAsString(env['npm_config_user_agent']),\n // PATH is an environment variable that lists directories where executable\n // programs are located. When a command is run, the system searches these\n // directories to find the executable.\n PATH: envAsString(env['PATH']),\n // Accept risks of a Socket wrapped npm/npx run.\n SOCKET_CLI_ACCEPT_RISKS: envAsBoolean(env[SOCKET_CLI_ACCEPT_RISKS]),\n // Enable debug logging in Socket CLI.\n SOCKET_CLI_DEBUG: envAsBoolean(env['SOCKET_CLI_DEBUG']),\n // Change the base URL for Socket API calls.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables-for-development\n SOCKET_CLI_API_BASE_URL:\n envAsString(env['SOCKET_CLI_API_BASE_URL']) ||\n // TODO: Remove legacy environment variable name.\n envAsString(env['SOCKET_SECURITY_API_BASE_URL']) ||\n getConfigValueOrUndef('apiBaseUrl') ||\n API_V0_URL,\n // Set the proxy that all requests are routed through.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables-for-development\n SOCKET_CLI_API_PROXY:\n envAsString(env['SOCKET_CLI_API_PROXY']) ||\n // TODO: Remove legacy environment variable name.\n envAsString(env['SOCKET_SECURITY_API_PROXY']) ||\n // Commonly used environment variables to specify routing requests through\n // a proxy server.\n envAsString(env['HTTPS_PROXY']) ||\n envAsString(env['https_proxy']) ||\n envAsString(env['HTTP_PROXY']) ||\n envAsString(env['http_proxy']),\n // Set the timeout in milliseconds for Socket API requests.\n // https://nodejs.org/api/http.html#httprequesturl-options-callback\n SOCKET_CLI_API_TIMEOUT: envAsNumber(env['SOCKET_CLI_API_TIMEOUT']),\n // Set the Socket API token.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables\n SOCKET_CLI_API_TOKEN:\n envAsString(env['SOCKET_CLI_API_TOKEN']) ||\n // TODO: Remove legacy environment variable names.\n envAsString(env['SOCKET_CLI_API_KEY']) ||\n envAsString(env['SOCKET_SECURITY_API_TOKEN']) ||\n envAsString(env['SOCKET_SECURITY_API_KEY']),\n // A JSON stringified Socket configuration object.\n SOCKET_CLI_CONFIG: envAsString(env['SOCKET_CLI_CONFIG']),\n // The git config user.email used by Socket CLI.\n SOCKET_CLI_GIT_USER_EMAIL:\n envAsString(env['SOCKET_CLI_GIT_USER_EMAIL']) ||\n 'github-actions[bot]@users.noreply.github.com',\n // The git config user.name used by Socket CLI.\n SOCKET_CLI_GIT_USER_NAME:\n envAsString(env['SOCKET_CLI_GIT_USER_NAME']) ||\n envAsString(env['SOCKET_CLI_GIT_USERNAME']) ||\n 'github-actions[bot]',\n // Change the base URL for GitHub REST API calls.\n // https://docs.github.com/en/rest\n SOCKET_CLI_GITHUB_API_URL:\n envAsString(env['SOCKET_CLI_GITHUB_API_URL']) ||\n readOrDefaultSocketJson(process.cwd())?.defaults?.scan?.github\n ?.githubApiUrl ||\n 'https://api.github.com',\n // A classic GitHub personal access token with the \"repo\" scope or a\n // fine-grained access token with at least read/write permissions set for\n // \"Contents\" and \"Pull Request\".\n // https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens\n SOCKET_CLI_GITHUB_TOKEN:\n envAsString(env['SOCKET_CLI_GITHUB_TOKEN']) ||\n // TODO: Remove undocumented legacy environment variable name.\n envAsString(env['SOCKET_SECURITY_GITHUB_PAT']) ||\n GITHUB_TOKEN,\n // Make the default API token `undefined`.\n SOCKET_CLI_NO_API_TOKEN: envAsBoolean(env['SOCKET_CLI_NO_API_TOKEN']),\n // The absolute location of the npm directory.\n SOCKET_CLI_NPM_PATH: envAsString(env['SOCKET_CLI_NPM_PATH']),\n // Specify the Socket organization slug.\n SOCKET_CLI_ORG_SLUG:\n envAsString(env['SOCKET_CLI_ORG_SLUG']) ||\n // Coana CLI accepts the SOCKET_ORG_SLUG environment variable.\n envAsString(env['SOCKET_ORG_SLUG']),\n // View all risks of a Socket wrapped npm/npx run.\n SOCKET_CLI_VIEW_ALL_RISKS: envAsBoolean(env[SOCKET_CLI_VIEW_ALL_RISKS]),\n // Override the public patch API proxy URL for socket-patch.\n SOCKET_PATCH_PROXY_URL: envAsString(env['SOCKET_PATCH_PROXY_URL']),\n // Specifies the type of terminal or terminal emulator being used by the process.\n TERM: envAsString(env['TERM']),\n // Redefine registryConstants.ENV.VITEST to account for the\n // INLINED_SOCKET_CLI_PUBLISHED_BUILD environment variable.\n VITEST: INLINED_SOCKET_CLI_PUBLISHED_BUILD\n ? false\n : envAsBoolean(process.env[VITEST]),\n })\n}\n\nconst lazyBashRcPath = () => path.join(constants.homePath, '.bashrc')\n\nconst lazyBinPath = () => path.join(constants.rootPath, 'bin')\n\nconst lazyBinCliPath = () => path.join(constants.binPath, 'cli.js')\n\nconst lazyBlessedContribPath = () =>\n path.join(constants.externalPath, 'blessed-contrib')\n\nconst lazyBlessedOptions = () =>\n Object.freeze({\n smartCSR: true,\n term: constants.WIN32 ? 'windows-ansi' : 'xterm',\n useBCE: true,\n })\n\nconst lazyBlessedPath = () => path.join(constants.externalPath, 'blessed')\n\nconst lazyDistCliPath = () => path.join(constants.distPath, 'cli.js')\n\nconst lazyDistPath = () => path.join(constants.rootPath, 'dist')\n\nconst lazyExternalPath = () => path.join(constants.rootPath, 'external')\n\nconst lazyGithubCachePath = () => path.join(constants.socketCachePath, 'github')\n\nconst lazyHomePath = () => os.homedir()\n\nconst lazyInstrumentWithSentryPath = () =>\n path.join(constants.distPath, 'instrument-with-sentry.js')\n\nconst lazyMinimumVersionByAgent = () =>\n new Map([\n // Bun >=1.1.39 supports the text-based lockfile.\n // https://bun.sh/blog/bun-lock-text-lockfile\n [BUN, '1.1.39'],\n // The npm version bundled with Node 18.\n // https://nodejs.org/en/about/previous-releases#looking-for-the-latest-release-of-a-version-branch\n [NPM, '10.8.2'],\n // 8.x is the earliest version to support Node 18.\n // https://pnpm.io/installation#compatibility\n // https://www.npmjs.com/package/pnpm?activeTab=versions\n [PNPM, '8.15.7'],\n // 4.x supports >= Node 18.12.0\n // https://github.com/yarnpkg/berry/blob/%40yarnpkg/core/4.1.0/CHANGELOG.md#400\n [YARN_BERRY, '4.0.0'],\n // Latest 1.x.\n // https://www.npmjs.com/package/yarn?activeTab=versions\n [YARN_CLASSIC, '1.22.22'],\n // vlt does not support overrides so we don't gate on it.\n [VLT, '*'],\n ])\n\nconst lazyNmBinPath = () => path.join(constants.rootPath, 'node_modules/.bin')\n\nconst lazyNodeDebugFlags = () =>\n constants.ENV.SOCKET_CLI_DEBUG ? ['--trace-uncaught', '--trace-warnings'] : []\n\n// Redefine registryConstants.nodeHardenFlags to account for the\n// INLINED_SOCKET_CLI_SENTRY_BUILD environment variable.\nconst lazyNodeHardenFlags = () =>\n Object.freeze(\n // Harden Node security.\n // https://nodejs.org/en/learn/getting-started/security-best-practices\n constants.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD || constants.WIN32\n ? [\n // https://nodejs.org/api/cli.html#--disallow-code-generation-from-strings\n // '--disallow-code-generation-from-strings'\n ]\n : [\n // '--disallow-code-generation-from-strings',\n // https://nodejs.org/api/cli.html#--disable-protomode\n // '--disable-proto',\n // 'throw',\n // https://nodejs.org/api/cli.html#--frozen-intrinsics\n // We have contributed the following patches to our dependencies to make\n // Node's --frozen-intrinsics workable.\n // √ https://github.com/SBoudrias/Inquirer.js/pull/1683\n // √ https://github.com/pnpm/components/pull/23\n // '--frozen-intrinsics',\n // https://nodejs.org/api/cli.html#--no-deprecation\n // '--no-deprecation',\n ],\n )\n\nconst lazyNodeMemoryFlags = () => {\n const flags = /*@__PURE__*/ require(\n path.join(constants.rootPath, 'dist/flags.js'),\n )\n const getMaxOldSpaceSizeFlag = flags.getMaxOldSpaceSizeFlag\n const getMaxSemiSpaceSizeFlag = flags.getMaxSemiSpaceSizeFlag\n return Object.freeze([\n `--max-old-space-size=${getMaxOldSpaceSizeFlag()}`,\n `--max-semi-space-size=${getMaxSemiSpaceSizeFlag()}`,\n ])\n}\n\nconst lazyNpmCachePath = () => {\n const spawnHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/spawn')\n const spawnSync = spawnHelpers.spawnSync\n return spawnSync(\n constants.npmExecPath,\n ['config', 'get', 'cache'],\n getNpmStdioPipeOptions(),\n ).stdout\n}\n\nconst lazyNpmGlobalPrefix = () => {\n const spawnHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/spawn')\n const spawnSync = spawnHelpers.spawnSync\n return spawnSync(\n constants.npmExecPath,\n ['prefix', '-g'],\n getNpmStdioPipeOptions(),\n ).stdout\n}\n\nconst lazyNpmNmNodeGypPath = () =>\n path.join(\n constants.npmRealExecPath,\n '../../node_modules/node-gyp/bin/node-gyp.js',\n )\n\nconst lazyProcessEnv = () =>\n Object.setPrototypeOf(\n Object.fromEntries(\n Object.entries(constants.ENV).reduce(\n (entries, entry) => {\n const { 0: key, 1: value } = entry\n if (key.startsWith('INLINED_SOCKET_CLI_')) {\n return entries\n }\n if (typeof value === 'string') {\n if (value) {\n entries.push(entry as [string, string])\n }\n } else if (typeof value === 'boolean' && value) {\n entries.push([key, '1'])\n }\n return entries\n },\n [] as Array<[string, string]>,\n ),\n ),\n null,\n )\n\nconst lazyRootPath = () => path.join(realpathSync.native(__dirname), '..')\n\nconst lazyShadowBinPath = () => path.join(constants.rootPath, 'shadow-npm-bin')\n\nconst lazyShadowNpmBinPath = () =>\n path.join(constants.distPath, 'shadow-npm-bin.js')\n\nconst lazyShadowNpmInjectPath = () =>\n path.join(constants.distPath, 'shadow-npm-inject.js')\n\nconst lazyShadowNpxBinPath = () =>\n path.join(constants.distPath, 'shadow-npx-bin.js')\n\nconst lazyShadowPnpmBinPath = () =>\n path.join(constants.distPath, 'shadow-pnpm-bin.js')\n\nconst lazyShadowYarnBinPath = () =>\n path.join(constants.distPath, 'shadow-yarn-bin.js')\n\nconst lazySocketAppDataPath = (): string | undefined => {\n // Get the OS app data directory:\n // - Win: %LOCALAPPDATA% or fail?\n // - Mac: %XDG_DATA_HOME% or fallback to \"~/Library/Application Support/\"\n // - Linux: %XDG_DATA_HOME% or fallback to \"~/.local/share/\"\n // Note: LOCALAPPDATA is typically: C:\\Users\\USERNAME\\AppData\n // Note: XDG stands for \"X Desktop Group\", nowadays \"freedesktop.org\"\n // On most systems that path is: $HOME/.local/share\n // Then append `socket/settings`, so:\n // - Win: %LOCALAPPDATA%\\socket\\settings or return undefined\n // - Mac: %XDG_DATA_HOME%/socket/settings or \"~/Library/Application Support/socket/settings\"\n // - Linux: %XDG_DATA_HOME%/socket/settings or \"~/.local/share/socket/settings\"\n const { WIN32 } = constants\n let dataHome: string | undefined = WIN32\n ? constants.ENV.LOCALAPPDATA\n : constants.ENV.XDG_DATA_HOME\n if (!dataHome) {\n if (WIN32) {\n const logger = /*@__PURE__*/ require('@socketsecurity/registry/lib/logger')\n logger.warn(`Missing %LOCALAPPDATA%.`)\n } else {\n dataHome = path.join(\n constants.homePath,\n constants.DARWIN ? 'Library/Application Support' : '.local/share',\n )\n }\n }\n return dataHome ? path.join(dataHome, 'socket/settings') : undefined\n}\n\nconst lazySocketCachePath = () => path.join(constants.rootPath, '.cache')\n\nconst lazySocketRegistryPath = () =>\n path.join(constants.externalPath, '@socketsecurity/registry')\n\nconst lazyZshRcPath = () => path.join(constants.homePath, '.zshrc')\n\nconst constants: Constants = createConstantsObject(\n {\n ...registryConstantsAttribs.props,\n ALERT_TYPE_CRITICAL_CVE,\n ALERT_TYPE_CVE,\n ALERT_TYPE_MEDIUM_CVE,\n ALERT_TYPE_MILD_CVE,\n API_V0_URL,\n BUN,\n CONFIG_KEY_API_BASE_URL,\n CONFIG_KEY_API_PROXY,\n CONFIG_KEY_API_TOKEN,\n CONFIG_KEY_DEFAULT_ORG,\n CONFIG_KEY_ENFORCED_ORGS,\n CONFIG_KEY_ORG,\n DOT_GIT_DIR,\n DOT_SOCKET_DIR,\n DOT_SOCKET_DOT_FACTS_JSON,\n DRY_RUN_BAILING_NOW,\n DRY_RUN_LABEL,\n DRY_RUN_NOT_SAVING,\n ENV: undefined,\n ENVIRONMENT_YAML,\n ENVIRONMENT_YML,\n ERROR_NO_MANIFEST_FILES,\n ERROR_NO_PACKAGE_JSON,\n ERROR_NO_REPO_FOUND,\n ERROR_NO_SOCKET_DIR,\n ERROR_UNABLE_RESOLVE_ORG,\n EXT_YAML,\n EXT_YML,\n FLAG_CONFIG,\n FLAG_DRY_RUN,\n FLAG_HELP,\n FLAG_HELP_FULL,\n FLAG_ID,\n FLAG_JSON,\n FLAG_LOGLEVEL,\n FLAG_MARKDOWN,\n FLAG_ORG,\n FLAG_PIN,\n FLAG_PROD,\n FLAG_QUIET,\n FLAG_SILENT,\n FLAG_TEXT,\n FLAG_VERBOSE,\n FLAG_VERSION,\n FOLD_SETTING_FILE,\n FOLD_SETTING_NONE,\n FOLD_SETTING_PKG,\n FOLD_SETTING_VERSION,\n GQL_PAGE_SENTINEL,\n GQL_PR_STATE_CLOSED,\n GQL_PR_STATE_MERGED,\n GQL_PR_STATE_OPEN,\n HTTP_STATUS_BAD_REQUEST,\n HTTP_STATUS_FORBIDDEN,\n HTTP_STATUS_INTERNAL_SERVER_ERROR,\n HTTP_STATUS_NOT_FOUND,\n HTTP_STATUS_UNAUTHORIZED,\n NODE_MODULES,\n NPM_BUGGY_OVERRIDES_PATCHED_VERSION,\n NPM_REGISTRY_URL,\n NPX,\n OUTPUT_JSON,\n OUTPUT_MARKDOWN,\n OUTPUT_TEXT,\n PACKAGE_JSON,\n PACKAGE_LOCK_JSON,\n PNPM,\n PNPM_LOCK_YAML,\n PNPM_WORKSPACE_YAML,\n REDACTED,\n REPORT_LEVEL_DEFER,\n REPORT_LEVEL_ERROR,\n REPORT_LEVEL_IGNORE,\n REPORT_LEVEL_MONITOR,\n REPORT_LEVEL_WARN,\n REQUIREMENTS_TXT,\n SCAN_TYPE_SOCKET,\n SCAN_TYPE_SOCKET_TIER1,\n SOCKET_CLI_ACCEPT_RISKS,\n SOCKET_CLI_BIN_NAME,\n SOCKET_CLI_ISSUES_URL,\n SOCKET_CLI_SHADOW_ACCEPT_RISKS,\n SOCKET_CLI_SHADOW_API_TOKEN,\n SOCKET_CLI_SHADOW_BIN,\n SOCKET_CLI_SHADOW_PROGRESS,\n SOCKET_CLI_SHADOW_SILENT,\n SOCKET_CLI_VIEW_ALL_RISKS,\n SOCKET_DEFAULT_BRANCH,\n SOCKET_DEFAULT_REPOSITORY,\n SOCKET_JSON,\n SOCKET_WEBSITE_URL,\n SOCKET_YAML,\n SOCKET_YML,\n TSCONFIG_JSON,\n UNKNOWN_ERROR,\n UNKNOWN_VALUE,\n V1_MIGRATION_GUIDE_URL,\n VLT,\n YARN,\n YARN_BERRY,\n YARN_CLASSIC,\n bashRcPath: undefined,\n binPath: undefined,\n binCliPath: undefined,\n blessedContribPath: undefined,\n blessedOptions: undefined,\n blessedPath: undefined,\n distCliPath: undefined,\n distPath: undefined,\n externalPath: undefined,\n githubCachePath: undefined,\n homePath: undefined,\n instrumentWithSentryPath: undefined,\n minimumVersionByAgent: undefined,\n nmBinPath: undefined,\n nodeHardenFlags: undefined,\n nodeDebugFlags: undefined,\n nodeMemoryFlags: undefined,\n npmCachePath: undefined,\n npmGlobalPrefix: undefined,\n npmNmNodeGypPath: undefined,\n processEnv: undefined,\n rootPath: undefined,\n shadowBinPath: undefined,\n shadowNpmInjectPath: undefined,\n shadowNpmBinPath: undefined,\n shadowPnpmBinPath: undefined,\n shadowYarnBinPath: undefined,\n socketAppDataPath: undefined,\n socketCachePath: undefined,\n socketRegistryPath: undefined,\n zshRcPath: undefined,\n },\n {\n getters: {\n ...registryConstantsAttribs.getters,\n ENV: LAZY_ENV,\n bashRcPath: lazyBashRcPath,\n binCliPath: lazyBinCliPath,\n binPath: lazyBinPath,\n blessedContribPath: lazyBlessedContribPath,\n blessedOptions: lazyBlessedOptions,\n blessedPath: lazyBlessedPath,\n distCliPath: lazyDistCliPath,\n distPath: lazyDistPath,\n externalPath: lazyExternalPath,\n githubCachePath: lazyGithubCachePath,\n homePath: lazyHomePath,\n instrumentWithSentryPath: lazyInstrumentWithSentryPath,\n minimumVersionByAgent: lazyMinimumVersionByAgent,\n nmBinPath: lazyNmBinPath,\n nodeDebugFlags: lazyNodeDebugFlags,\n nodeHardenFlags: lazyNodeHardenFlags,\n nodeMemoryFlags: lazyNodeMemoryFlags,\n npmCachePath: lazyNpmCachePath,\n npmGlobalPrefix: lazyNpmGlobalPrefix,\n npmNmNodeGypPath: lazyNpmNmNodeGypPath,\n processEnv: lazyProcessEnv,\n rootPath: lazyRootPath,\n shadowBinPath: lazyShadowBinPath,\n shadowNpmBinPath: lazyShadowNpmBinPath,\n shadowNpmInjectPath: lazyShadowNpmInjectPath,\n shadowNpxBinPath: lazyShadowNpxBinPath,\n shadowPnpmBinPath: lazyShadowPnpmBinPath,\n shadowYarnBinPath: lazyShadowYarnBinPath,\n socketAppDataPath: lazySocketAppDataPath,\n socketCachePath: lazySocketCachePath,\n socketRegistryPath: lazySocketRegistryPath,\n zshRcPath: lazyZshRcPath,\n },\n internals: {\n ...registryConstantsAttribs.internals,\n getIpc,\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 },\n) as Constants\n\nexport {\n // Re-exported from socket-registry.\n AT_LATEST,\n BIOME_JSON,\n BUN,\n CI,\n COLUMN_LIMIT,\n DOT_GIT_DIR,\n DOT_PACKAGE_LOCK_JSON,\n DOT_SOCKET_DIR,\n EMPTY_FILE,\n EMPTY_VALUE,\n ESLINT_CONFIG_JS,\n ESNEXT,\n EXTENSIONS,\n EXTENSIONS_JSON,\n EXT_CJS,\n EXT_CMD,\n EXT_CTS,\n EXT_DTS,\n EXT_JS,\n EXT_JSON,\n EXT_LOCK,\n EXT_LOCKB,\n EXT_MD,\n EXT_MJS,\n EXT_MTS,\n EXT_PS1,\n EXT_YAML,\n EXT_YML,\n GITIGNORE,\n LATEST,\n LICENSE,\n LICENSE_GLOB,\n LICENSE_GLOB_RECURSIVE,\n LICENSE_ORIGINAL,\n LICENSE_ORIGINAL_GLOB,\n LICENSE_ORIGINAL_GLOB_RECURSIVE,\n LOOP_SENTINEL,\n MANIFEST_JSON,\n MIT,\n NODE_AUTH_TOKEN,\n NODE_ENV,\n NODE_MODULES,\n NODE_MODULES_GLOB_RECURSIVE,\n NPM,\n NPX,\n OVERRIDES,\n PACKAGE_DEFAULT_VERSION,\n PACKAGE_JSON,\n PACKAGE_LOCK_JSON,\n PNPM,\n PNPM_LOCK_YAML,\n PRE_COMMIT,\n README_GLOB,\n README_GLOB_RECURSIVE,\n README_MD,\n REGISTRY,\n REGISTRY_SCOPE_DELIMITER,\n RESOLUTIONS,\n SOCKET_GITHUB_ORG,\n SOCKET_IPC_HANDSHAKE,\n SOCKET_OVERRIDE_SCOPE,\n SOCKET_PUBLIC_API_TOKEN,\n SOCKET_REGISTRY_NPM_ORG,\n SOCKET_REGISTRY_PACKAGE_NAME,\n SOCKET_REGISTRY_REPO_NAME,\n SOCKET_REGISTRY_SCOPE,\n SOCKET_SECURITY_SCOPE,\n TSCONFIG_JSON,\n UNKNOWN_ERROR,\n UNKNOWN_VALUE,\n UNLICENCED,\n UNLICENSED,\n UTF8,\n VITEST,\n VLT,\n YARN,\n YARN_BERRY,\n YARN_CLASSIC,\n YARN_LOCK,\n // Socket CLI specific constants.\n ALERT_TYPE_CRITICAL_CVE,\n ALERT_TYPE_CVE,\n ALERT_TYPE_MEDIUM_CVE,\n ALERT_TYPE_MILD_CVE,\n API_V0_URL,\n CONFIG_KEY_API_BASE_URL,\n CONFIG_KEY_API_PROXY,\n CONFIG_KEY_API_TOKEN,\n CONFIG_KEY_DEFAULT_ORG,\n CONFIG_KEY_ENFORCED_ORGS,\n CONFIG_KEY_ORG,\n DLX_BINARY_CACHE_TTL,\n DOT_SOCKET_DOT_FACTS_JSON,\n DRY_RUN_BAILING_NOW,\n DRY_RUN_LABEL,\n DRY_RUN_NOT_SAVING,\n ENVIRONMENT_YAML,\n ENVIRONMENT_YML,\n ERROR_NO_MANIFEST_FILES,\n ERROR_NO_PACKAGE_JSON,\n ERROR_NO_REPO_FOUND,\n ERROR_NO_SOCKET_DIR,\n ERROR_UNABLE_RESOLVE_ORG,\n FLAG_CONFIG,\n FLAG_DRY_RUN,\n FLAG_HELP,\n FLAG_HELP_FULL,\n FLAG_ID,\n FLAG_JSON,\n FLAG_LOGLEVEL,\n FLAG_MARKDOWN,\n FLAG_ORG,\n FLAG_PIN,\n FLAG_PROD,\n FLAG_QUIET,\n FLAG_SILENT,\n FLAG_TEXT,\n FLAG_VERBOSE,\n FLAG_VERSION,\n FOLD_SETTING_FILE,\n FOLD_SETTING_NONE,\n FOLD_SETTING_PKG,\n FOLD_SETTING_VERSION,\n GQL_PAGE_SENTINEL,\n GQL_PR_STATE_CLOSED,\n GQL_PR_STATE_MERGED,\n GQL_PR_STATE_OPEN,\n HTTP_STATUS_BAD_REQUEST,\n HTTP_STATUS_FORBIDDEN,\n HTTP_STATUS_INTERNAL_SERVER_ERROR,\n HTTP_STATUS_NOT_FOUND,\n HTTP_STATUS_UNAUTHORIZED,\n NPM_BUGGY_OVERRIDES_PATCHED_VERSION,\n NPM_REGISTRY_URL,\n OUTPUT_JSON,\n OUTPUT_MARKDOWN,\n OUTPUT_TEXT,\n PNPM_WORKSPACE_YAML,\n REDACTED,\n REPORT_LEVEL_DEFER,\n REPORT_LEVEL_ERROR,\n REPORT_LEVEL_IGNORE,\n REPORT_LEVEL_MONITOR,\n REPORT_LEVEL_WARN,\n REQUIREMENTS_TXT,\n SCAN_TYPE_SOCKET,\n SCAN_TYPE_SOCKET_TIER1,\n SOCKET_CLI_ACCEPT_RISKS,\n SOCKET_CLI_BIN_NAME,\n SOCKET_CLI_ISSUES_URL,\n SOCKET_CLI_SHADOW_ACCEPT_RISKS,\n SOCKET_CLI_SHADOW_API_TOKEN,\n SOCKET_CLI_SHADOW_BIN,\n SOCKET_CLI_SHADOW_PROGRESS,\n SOCKET_CLI_SHADOW_SILENT,\n SOCKET_CLI_VIEW_ALL_RISKS,\n SOCKET_DEFAULT_BRANCH,\n SOCKET_DEFAULT_REPOSITORY,\n SOCKET_JSON,\n SOCKET_WEBSITE_URL,\n SOCKET_YAML,\n SOCKET_YML,\n V1_MIGRATION_GUIDE_URL,\n}\n\nexport default constants\n"],"names":["attributes","getIpc","_npmStdioPipeOptions","cwd","env","__proto__","DISABLE_GITHUB_CACHE","GITHUB_BASE_REF","GITHUB_REF_NAME","GITHUB_REF_TYPE","GITHUB_REPOSITORY","NODE_EXTRA_CA_CERTS","envAsString","npm_config_cache","npm_config_user_agent","PATH","SOCKET_CLI_ACCEPT_RISKS","SOCKET_CLI_DEBUG","SOCKET_CLI_API_BASE_URL","SOCKET_CLI_API_PROXY","SOCKET_CLI_API_TIMEOUT","SOCKET_CLI_API_TOKEN","SOCKET_CLI_CONFIG","SOCKET_CLI_GIT_USER_NAME","SOCKET_CLI_GITHUB_TOKEN","SOCKET_CLI_NO_API_TOKEN","SOCKET_CLI_NPM_PATH","SOCKET_CLI_ORG_SLUG","SOCKET_CLI_VIEW_ALL_RISKS","SOCKET_PATCH_PROXY_URL","TERM","VITEST","smartCSR","term","useBCE","constants","entries","WIN32","logger","dataHome","ENV","bashRcPath","binPath","binCliPath","blessedContribPath","blessedOptions","blessedPath","distCliPath","distPath","externalPath","githubCachePath","homePath","instrumentWithSentryPath","minimumVersionByAgent","nmBinPath","nodeHardenFlags","nodeDebugFlags","nodeMemoryFlags","npmCachePath","npmGlobalPrefix","npmNmNodeGypPath","processEnv","rootPath","shadowBinPath","shadowNpmInjectPath","shadowNpmBinPath","shadowPnpmBinPath","shadowYarnBinPath","socketAppDataPath","socketCachePath","socketRegistryPath","zshRcPath","getters","shadowNpxBinPath","internals","getSentry","_Sentry"],"mappings":";;;;;;;;;;;;AAYA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFE;AACEA;;AAEAC;AACF;AACF;AAoFA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAuJA;AAEA;AACA;;AAEIC;AACEC;AACA;AACA;AACA;;;AAGJ;AACA;AACF;AAEA;;AACUC;AAAI;AACZ;AACA;AAGA;AACA;AACA;AACA;AACA;;;AAKA;AACA;;AAEEC;AACA;;AAEA;AACA;AACAC;AACA;AACA;;AAGA;AACA;AACA;AACA;AACAC;AACA;AACA;AACA;AACA;AACAC;AACA;AACA;AACAC;AACA;AACA;AACAC;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAEA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAOA;AACA;AACA;AACA;AACAC;AAEE;AACA;AACAC;AACF;AACA;AACAC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAC;AACA;AACA;AACA;AACAC;AACA;AACAC;AACA;AACAC;AACA;AACA;AACAC;AAEE;AACAN;AAGF;AACA;AACAO;AAEE;AACAP;AACA;AACA;AACAA;AAIF;AACA;AACAQ;AACA;AACA;AACAC;AAEE;;AAIF;AACAC;AACA;;AAIA;AACAC;AAIA;AACA;;AAMA;AACA;AACA;AACA;AACAC;AAEE;AACAZ;AAEF;AACAa;AACA;AACAC;AACA;AACAC;AAEE;AACAf;AACF;AACAgB;AACA;AACAC;AACA;AACAC;AACA;AACA;AACAC;AAGF;AACF;AAEA;AAEA;AAEA;AAEA;AAGA;AAEIC;AACAC;AACAC;AACF;AAEF;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AAGA;AAEI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGJ;AAEA;;AAGA;AACA;AACA;AAEI;AACA;AACAC;AAEM;AACA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAIV;AACE;AAGA;AACA;AACA;AAIF;AAEA;AACE;AACA;AACA;AAKF;AAEA;AACE;AACA;AACA;AAKF;AAEA;AAMA;;AAKkB;AAAQ;AAAS;AACzB;AACE;AACF;AACA;AACE;AACEC;AACF;;;AAGF;AACA;AACF;AAOR;AAEA;AAEA;AAGA;AAGA;AAGA;AAGA;AAGA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACQC;AAAM;AACd;;AAIE;AACE;AACAC;AACF;AACEC;AAIF;AACF;;AAEF;AAEA;AAEA;AAGA;AAEA;;;;;;;;;;;;;;;;;;;;AAqBIC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACF;AAEEC;;AAEEhC;AACAC;AACAE;AACAD;AACAE;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAE;AACAD;AACAE;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAE;AACAD;AACAS;AACAP;AACAC;AACAC;AACAC;AACAC;AACAC;;AAEFG;;;AAGEC;AACE;;;;AAIEC;AACA;AACF;AACA;AACF;AACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","debugId":"eb5d2318-70e6-479d-9973-4891be3fc1da"}
@@ -0,0 +1,353 @@
1
+ // Gradle init script that emits a single `.socket.facts.json` file at the
2
+ // build root describing the resolved compile/runtime dependency graph of
3
+ // every subproject combined.
4
+ //
5
+ // Schema matches the canonical SocketFacts shape consumed by depscan
6
+ // (`workspaces/lib/src/socket-facts/socket-facts-schema.ts`):
7
+ //
8
+ // { components: SF_Artifact[] }
9
+ //
10
+ // Each Maven SF_Artifact is `{ type: 'maven', namespace, name, version?,
11
+ // qualifiers? } & { id, direct?, dev?, tooling?, dependencies? }`.
12
+ // `qualifiers` is strict on `{ classifier?, ext? }` — anything else is
13
+ // dropped.
14
+ //
15
+ // Invoke via:
16
+ // ./gradlew --init-script socket-facts.init.gradle socketFacts
17
+ //
18
+ // Structure:
19
+ // - per-subproject `socketFactsCollect` tasks resolve that subproject's
20
+ // configurations and contribute to shared accumulators on gradle.ext
21
+ // - the root `socketFacts` task depends on every collector, then
22
+ // serializes the accumulated graph to a single JSON file at the build
23
+ // root
24
+ //
25
+ // Intra-project dependencies (i.e. `project(':lib')` style edges between
26
+ // subprojects in the same build) are dropped from the output entirely.
27
+ // Their reasoning: each subproject contributes its own external deps to
28
+ // the shared facts; the inter-project edges would just be noise that
29
+ // downstream consumers (coana mvn dependency:get) would try to resolve
30
+ // against Maven Central and fail. The externals each intra-project dep
31
+ // brings in are picked up via that subproject's own collector.
32
+
33
+ import java.util.Collections
34
+ import groovy.json.JsonOutput
35
+
36
+ // Must stay in sync with `DOT_SOCKET_DOT_FACTS_JSON` in
37
+ // src/constants.mts (TS side). Groovy can't import the TS constant, so
38
+ // the two strings are intentionally duplicated; if you change one,
39
+ // change the other.
40
+ ext.SOCKET_FACTS_FILENAME = '.socket.facts.json'
41
+
42
+ // Shared accumulators across all subprojects' contributions. Synchronized
43
+ // collections so --parallel-enabled builds don't race. The accumulator
44
+ // lives on `gradle.ext` so every subproject's collector and the root
45
+ // aggregator share the same instance.
46
+ gradle.ext.socketFactsState = [
47
+ // id -> [coord, children, prod, nonTooling]
48
+ nodes : Collections.synchronizedMap([:]),
49
+ // first-level dep ids
50
+ directIds : Collections.synchronizedSet([] as Set),
51
+ // selectors we've already logged as unresolved (deduped across configs)
52
+ reportedUnresolved : Collections.synchronizedSet([] as Set),
53
+ // "group:name" of every project in this build — used to filter
54
+ // intra-project deps. Populated once all projects are evaluated.
55
+ projectKeys : Collections.synchronizedSet([] as Set),
56
+ ]
57
+
58
+ // Capture every project's (group:name) once all projects are configured so
59
+ // per-subproject collectors can filter intra-project deps without an
60
+ // ordering dependency on other subprojects.
61
+ gradle.projectsEvaluated { g ->
62
+ g.rootProject.allprojects.each { p ->
63
+ g.socketFactsState.projectKeys.add("${p.group ?: ''}:${p.name}")
64
+ }
65
+ }
66
+
67
+ allprojects { project ->
68
+ def collectTask = project.tasks.create('socketFactsCollect') {
69
+ description = "Resolves ${project.path}'s configurations into the build-wide Socket facts accumulator"
70
+ // Dependency resolution depends on state Gradle's up-to-date tracking
71
+ // can't represent reliably.
72
+ outputs.upToDateWhen { false }
73
+
74
+ doLast {
75
+ def state = gradle.socketFactsState
76
+ def nodes = state.nodes
77
+ def directIds = state.directIds
78
+ def reportedUnresolved = state.reportedUnresolved
79
+ def projectKeys = state.projectKeys
80
+
81
+ // `id` omits ext so Gradle's variant artifacts (e.g.
82
+ // `java-classes-directory` and `jar` for the same project dep)
83
+ // dedupe into a single component. Classifier stays in the id since
84
+ // it identifies a distinct artifact (sources, javadoc, etc.).
85
+ def coordId = { coord ->
86
+ def parts = [coord.groupId, coord.artifactId]
87
+ if (coord.classifier) parts << coord.classifier
88
+ parts << coord.version
89
+ parts.join(':')
90
+ }
91
+
92
+ def isIntraProject = { String group, String name ->
93
+ projectKeys.contains("${group ?: ''}:${name}")
94
+ }
95
+
96
+ // Atomic upsert: bracket the read-modify-write under the nodes map's
97
+ // monitor so concurrent contributions don't lose flag updates.
98
+ def upsertNode = { Map coord, boolean isProd, boolean isNonTooling ->
99
+ def id = coordId(coord)
100
+ synchronized (nodes) {
101
+ def node = nodes[id]
102
+ if (node == null) {
103
+ node = [coord: coord, children: [] as Set, prod: false, nonTooling: false]
104
+ nodes[id] = node
105
+ } else if (!node.coord.ext && coord.ext) {
106
+ // Upgrade to the variant whose Gradle artifact has a real
107
+ // packaging extension. Compile classpath visits often arrive
108
+ // with no ext (a project dep exposes only its classes-directory
109
+ // variant there); the runtime classpath visit then fills in
110
+ // the canonical jar/aar.
111
+ node.coord = coord
112
+ }
113
+ if (isProd) {
114
+ node.prod = true
115
+ }
116
+ if (isNonTooling) {
117
+ node.nonTooling = true
118
+ }
119
+ }
120
+ id
121
+ }
122
+
123
+ // Walk a resolved dependency, emitting nodes for itself and its
124
+ // transitive closure. `cache` is keyed by ResolvedDependency identity
125
+ // and short-circuits revisits in diamond/cyclic graphs.
126
+ //
127
+ // We never touch `artifact.file` — that forces Gradle to *download*
128
+ // the underlying file (catastrophic on large builds that declare
129
+ // distribution archives as dependencies). `artifact.extension` and
130
+ // `artifact.classifier` read from metadata that resolution already
131
+ // needed.
132
+ //
133
+ // Intra-project deps (project(':lib') and friends) are dropped at
134
+ // visit time: we return an empty produced-id set, don't emit a node,
135
+ // and don't recurse into the dep's children. The transitives those
136
+ // intra-project deps expose are picked up via the consumer
137
+ // subproject's classpath directly (Gradle merges them) and via the
138
+ // intra-project's own collector.
139
+ def visit
140
+ visit = { dep, boolean isProd, boolean isNonTooling, Map cache ->
141
+ if (cache.containsKey(dep)) {
142
+ return cache[dep]
143
+ }
144
+ if (isIntraProject(dep.moduleGroup, dep.moduleName)) {
145
+ def empty = [] as Set
146
+ cache[dep] = empty
147
+ return empty
148
+ }
149
+ // Pre-populate the cache to break cycles before we recurse.
150
+ def producedIds = [] as Set
151
+ cache[dep] = producedIds
152
+
153
+ def artifacts = dep.moduleArtifacts
154
+ if (artifacts.isEmpty()) {
155
+ producedIds << upsertNode([
156
+ groupId : dep.moduleGroup ?: '',
157
+ artifactId: dep.moduleName,
158
+ version : dep.moduleVersion ?: '',
159
+ classifier: '',
160
+ ext : '',
161
+ ], isProd, isNonTooling)
162
+ } else {
163
+ artifacts.each { a ->
164
+ producedIds << upsertNode([
165
+ groupId : dep.moduleGroup ?: '',
166
+ artifactId: dep.moduleName,
167
+ version : dep.moduleVersion ?: '',
168
+ classifier: a.classifier ?: '',
169
+ // Use the file extension Gradle reports. For Gradle-internal
170
+ // directory variants (java-classes-directory etc.) the
171
+ // extension is empty — we let that through and emit no ext
172
+ // qualifier. Never fall back to artifact.type, which is
173
+ // Gradle's variant attribute, not Maven packaging.
174
+ ext : a.extension ?: '',
175
+ ], isProd, isNonTooling)
176
+ }
177
+ }
178
+
179
+ def childIds = [] as Set
180
+ dep.children.each { child ->
181
+ childIds.addAll(visit(child, isProd, isNonTooling, cache))
182
+ }
183
+ synchronized (nodes) {
184
+ producedIds.each { pid ->
185
+ nodes[pid].children.addAll(childIds)
186
+ }
187
+ }
188
+ producedIds
189
+ }
190
+
191
+ // Configuration selection by name pattern. We match the conventional
192
+ // suffixes used across Gradle plugins for resolvable classpath configs:
193
+ // Java (`compileClasspath`, `runtimeClasspath`,
194
+ // `testCompileClasspath`, `testRuntimeClasspath`), Kotlin Gradle Plugin
195
+ // (`jvmMainCompileClasspath`, `linuxX64MainRuntimeClasspath`, ...) and
196
+ // AGP per-variant (`debugCompileClasspath`, `releaseRuntimeClasspath`,
197
+ // `debugUnitTestRuntimeClasspath`, ...).
198
+ //
199
+ // Beyond classpaths we also walk other resolvable configurations
200
+ // (annotation processors, linter classpaths, etc.) so build-tooling
201
+ // deps land in the output too — tagged `tooling: true` so downstream
202
+ // reachability scanners can skip them.
203
+ //
204
+ // We exclude AGP's instrumented-test classpaths (`*AndroidTest*`)
205
+ // because their variant resolution requires consumer attributes
206
+ // (target SDK, device/host runtime) that an init-script-driven
207
+ // resolution doesn't set, and they produce ambiguity errors at
208
+ // resolution time. Unit-test classpaths (`*UnitTest*`) resolve fine.
209
+ def isClasspath = { String name ->
210
+ def lower = name.toLowerCase()
211
+ lower.endsWith('compileclasspath') || lower.endsWith('runtimeclasspath')
212
+ }
213
+ def isAndroidInstrumentedTest = { String name ->
214
+ name.toLowerCase().contains('androidtest')
215
+ }
216
+ def isTestConfig = { String name -> name.toLowerCase().contains('test') }
217
+
218
+ def targetConfigs = project.configurations.findAll {
219
+ it.canBeResolved && !isAndroidInstrumentedTest(it.name)
220
+ }
221
+
222
+ targetConfigs.each { cfg ->
223
+ def isProd = !isTestConfig(cfg.name)
224
+ def isNonTooling = isClasspath(cfg.name)
225
+ // Per-configuration try/catch: AGP-style configurations can fail
226
+ // with "variant ambiguity" when resolved from an init-script
227
+ // context that doesn't carry the consumer attributes AGP sets
228
+ // internally. We log and continue so a single ambiguous config
229
+ // doesn't sink the whole facts file.
230
+ try {
231
+ def lenient = cfg.resolvedConfiguration.lenientConfiguration
232
+ def cache = [:]
233
+ lenient.firstLevelModuleDependencies.each { dep ->
234
+ directIds.addAll(visit(dep, isProd, isNonTooling, cache))
235
+ }
236
+ lenient.unresolvedModuleDependencies.each { dep ->
237
+ if (isIntraProject(dep.selector.group, dep.selector.name)) {
238
+ return
239
+ }
240
+ def selectorKey = dep.selector.toString()
241
+ if (reportedUnresolved.add(selectorKey)) {
242
+ def reason = dep.problem?.message?.readLines()?.first() ?: 'unknown reason'
243
+ println "[socket-facts] unresolved: ${selectorKey} in ${project.path}: ${reason}"
244
+ }
245
+ def coord = [
246
+ groupId : dep.selector.group ?: '',
247
+ artifactId: dep.selector.name,
248
+ version : dep.selector.version ?: '',
249
+ classifier: '',
250
+ ext : '',
251
+ ]
252
+ directIds.add(upsertNode(coord, isProd, isNonTooling))
253
+ }
254
+ } catch (Exception e) {
255
+ println "[socket-facts] skipping ${project.path}:${cfg.name}: ${e.message?.readLines()?.first()}"
256
+ }
257
+ }
258
+ }
259
+ }
260
+ }
261
+
262
+ rootProject {
263
+ tasks.create('socketFacts') {
264
+ group = 'socket'
265
+ description = 'Aggregates a single Socket facts JSON for the entire build'
266
+ outputs.upToDateWhen { false }
267
+
268
+ doLast {
269
+ def state = gradle.socketFactsState
270
+ def nodes = state.nodes
271
+ def directIds = state.directIds
272
+
273
+ // Snapshot the accumulators under the same monitor used by writers in
274
+ // each subproject's socketFactsCollect doLast. Task dependencies
275
+ // (`aggregator.dependsOn(collector)`) already guarantee a
276
+ // happens-before edge between writes and this read, but we
277
+ // synchronize on `nodes` here so the read path is symmetric with the
278
+ // write path — no implicit reliance on Gradle's task-graph ordering
279
+ // semantics for memory visibility of plain HashMap/HashSet fields.
280
+ def components
281
+ synchronized (nodes) {
282
+ components = nodes.collect { id, node ->
283
+ [id: id, coord: node.coord, prod: node.prod, nonTooling: node.nonTooling, children: (node.children as List).sort()]
284
+ }
285
+ }
286
+
287
+ components = components.collect { snapshot ->
288
+ def id = snapshot.id
289
+ def coord = snapshot.coord
290
+ def component = [
291
+ type : 'maven',
292
+ namespace: coord.groupId,
293
+ name : coord.artifactId,
294
+ ]
295
+ if (coord.version) {
296
+ component.version = coord.version
297
+ }
298
+ def qualifiers = [:]
299
+ if (coord.classifier) {
300
+ qualifiers.classifier = coord.classifier
301
+ }
302
+ if (coord.ext) {
303
+ qualifiers.ext = coord.ext
304
+ }
305
+ if (!qualifiers.isEmpty()) {
306
+ component.qualifiers = qualifiers
307
+ }
308
+ component.id = id
309
+ if (directIds.contains(id)) {
310
+ component.direct = true
311
+ }
312
+ if (!snapshot.prod) {
313
+ component.dev = true
314
+ }
315
+ if (!snapshot.nonTooling) {
316
+ component.tooling = true
317
+ }
318
+ if (!snapshot.children.isEmpty()) {
319
+ component.dependencies = snapshot.children
320
+ }
321
+ component
322
+ }
323
+
324
+ if (components.isEmpty()) {
325
+ println "[socket-facts] no resolvable dependencies in build, skipping"
326
+ return
327
+ }
328
+
329
+ def outputDir = project.findProperty('socket.outputDirectory')
330
+ ? new File(project.findProperty('socket.outputDirectory').toString())
331
+ : project.projectDir
332
+ outputDir.mkdirs()
333
+ def fileName = project.findProperty('socket.outputFile') ?: SOCKET_FACTS_FILENAME
334
+ def outFile = new File(outputDir, fileName.toString())
335
+ outFile.text = JsonOutput.prettyPrint(JsonOutput.toJson([components: components]))
336
+ println "Socket facts file written to: ${outFile.absolutePath}"
337
+ }
338
+ }
339
+ }
340
+
341
+ // Wire every subproject's collector as a dependency of the root aggregator
342
+ // so the aggregator runs after all contributions have been made.
343
+ gradle.projectsEvaluated { g ->
344
+ def aggregator = g.rootProject.tasks.findByName('socketFacts')
345
+ if (aggregator) {
346
+ g.rootProject.allprojects.each { p ->
347
+ def collector = p.tasks.findByName('socketFactsCollect')
348
+ if (collector) {
349
+ aggregator.dependsOn(collector)
350
+ }
351
+ }
352
+ }
353
+ }