socket 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/cli.js +27 -28
  2. package/dist/cli.js.map +1 -1
  3. package/dist/constants.js +3 -3
  4. package/dist/constants.js.map +1 -1
  5. package/dist/shadow-npm-bin.js +4 -3
  6. package/dist/shadow-npm-bin.js.map +1 -1
  7. package/dist/types/commands/fix/git.d.mts.map +1 -1
  8. package/dist/types/commands/optimize/ls-by-agent.d.mts.map +1 -1
  9. package/dist/types/shadow/npm/bin.d.mts.map +1 -1
  10. package/dist/types/utils/coana.d.mts.map +1 -1
  11. package/dist/types/utils/package-environment.d.mts.map +1 -1
  12. package/dist/utils.js +8 -7
  13. package/dist/utils.js.map +1 -1
  14. package/dist/vendor.js +326 -325
  15. package/external/@socketsecurity/registry/external/@inquirer/confirm.js +60 -21
  16. package/external/@socketsecurity/registry/external/@inquirer/input.js +60 -21
  17. package/external/@socketsecurity/registry/external/@inquirer/password.js +60 -21
  18. package/external/@socketsecurity/registry/external/@inquirer/search.js +61 -22
  19. package/external/@socketsecurity/registry/external/@inquirer/select.js +61 -22
  20. package/external/@socketsecurity/registry/external/ansi-regex.js +13 -0
  21. package/external/@socketsecurity/registry/external/libnpmpack.js +137 -146
  22. package/external/@socketsecurity/registry/external/make-fetch-happen.js +85 -94
  23. package/external/@socketsecurity/registry/external/normalize-package-data.js +17 -404
  24. package/external/@socketsecurity/registry/external/pacote.js +124 -133
  25. package/external/@socketsecurity/registry/lib/strings.js +16 -0
  26. package/external/blessed-contrib/lib/widget/table.js +47 -12
  27. package/package.json +3 -2
package/dist/cli.js CHANGED
@@ -3010,9 +3010,9 @@ async function getBaseGitBranch(cwd = process.cwd()) {
3010
3010
  // 3. Try to resolve the default remote branch using 'git remote show origin'.
3011
3011
  // This handles detached HEADs or workflows triggered by tags/releases.
3012
3012
  try {
3013
- const stdout = (await spawn.spawn('git', ['remote', 'show', 'origin'], {
3013
+ const stdout = strings.stripAnsi((await spawn.spawn('git', ['remote', 'show', 'origin'], {
3014
3014
  cwd
3015
- })).stdout.trim();
3015
+ })).stdout.trim());
3016
3016
  const match = /(?<=HEAD branch: ).+/.exec(stdout);
3017
3017
  if (match?.[0]) {
3018
3018
  return match[0].trim();
@@ -3122,9 +3122,9 @@ async function gitCreateAndPushBranch(branch, commitMsg, filepaths, options) {
3122
3122
  }
3123
3123
  async function gitRepoInfo(cwd = process.cwd()) {
3124
3124
  try {
3125
- const remoteUrl = (await spawn.spawn('git', ['remote', 'get-url', 'origin'], {
3125
+ const remoteUrl = strings.stripAnsi((await spawn.spawn('git', ['remote', 'get-url', 'origin'], {
3126
3126
  cwd
3127
- })).stdout.trim();
3127
+ })).stdout.trim());
3128
3128
  // 1. Handle SSH-style, e.g. git@github.com:owner/repo.git
3129
3129
  const sshMatch = /^git@[^:]+:([^/]+)\/(.+?)(?:\.git)?$/.exec(remoteUrl);
3130
3130
  if (sshMatch) {
@@ -3168,7 +3168,7 @@ async function gitEnsureIdentity(name, email, cwd = process.cwd()) {
3168
3168
  let configValue;
3169
3169
  try {
3170
3170
  // Will throw with exit code 1 if the config property is not set.
3171
- configValue = (await spawn.spawn('git', ['config', '--get', prop], stdioPipeOptions)).stdout.trim();
3171
+ configValue = strings.stripAnsi((await spawn.spawn('git', ['config', '--get', prop], stdioPipeOptions)).stdout.trim());
3172
3172
  } catch {}
3173
3173
  if (configValue !== value) {
3174
3174
  try {
@@ -3184,7 +3184,7 @@ async function gitRemoteBranchExists(branch, cwd = process.cwd()) {
3184
3184
  cwd
3185
3185
  };
3186
3186
  try {
3187
- return (await spawn.spawn('git', ['ls-remote', '--heads', 'origin', branch], stdioPipeOptions)).stdout.trim().length > 0;
3187
+ return strings.stripAnsi((await spawn.spawn('git', ['ls-remote', '--heads', 'origin', branch], stdioPipeOptions)).stdout.trim()).length > 0;
3188
3188
  } catch {
3189
3189
  return false;
3190
3190
  }
@@ -3207,7 +3207,7 @@ async function gitUnstagedModifiedFiles(cwd = process.cwd()) {
3207
3207
  const stdioPipeOptions = {
3208
3208
  cwd
3209
3209
  };
3210
- const stdout = (await spawn.spawn('git', ['diff', '--name-only'], stdioPipeOptions)).stdout.trim();
3210
+ const stdout = strings.stripAnsi((await spawn.spawn('git', ['diff', '--name-only'], stdioPipeOptions)).stdout.trim());
3211
3211
  const rawFiles = stdout.split('\n') ?? [];
3212
3212
  return {
3213
3213
  ok: true,
@@ -4579,7 +4579,7 @@ async function handleFix({
4579
4579
  await outputFixResult({
4580
4580
  ok: false,
4581
4581
  message: 'Not supported.',
4582
- cause: `${agent} is not supported by this command at the moment.`
4582
+ cause: `${agent} is not supported by this command.`
4583
4583
  }, outputKind);
4584
4584
  return;
4585
4585
  }
@@ -7163,11 +7163,11 @@ function parsableToQueryStdout(stdout) {
7163
7163
  async function npmQuery(npmExecPath, cwd) {
7164
7164
  let stdout = '';
7165
7165
  try {
7166
- stdout = (await spawn.spawn(npmExecPath, ['query', ':not(.dev)'], {
7166
+ stdout = strings.stripAnsi((await spawn.spawn(npmExecPath, ['query', ':not(.dev)'], {
7167
7167
  cwd,
7168
7168
  // Lazily access constants.WIN32.
7169
7169
  shell: constants.WIN32
7170
- })).stdout.trim();
7170
+ })).stdout.trim());
7171
7171
  } catch {}
7172
7172
  return cleanupQueryStdout(stdout);
7173
7173
  }
@@ -7175,11 +7175,11 @@ async function lsBun(pkgEnvDetails, cwd) {
7175
7175
  try {
7176
7176
  // Bun does not support filtering by production packages yet.
7177
7177
  // https://github.com/oven-sh/bun/issues/8283
7178
- return (await spawn.spawn(pkgEnvDetails.agentExecPath, ['pm', 'ls', '--all'], {
7178
+ return strings.stripAnsi((await spawn.spawn(pkgEnvDetails.agentExecPath, ['pm', 'ls', '--all'], {
7179
7179
  cwd,
7180
7180
  // Lazily access constants.WIN32.
7181
7181
  shell: constants.WIN32
7182
- })).stdout.trim();
7182
+ })).stdout.trim());
7183
7183
  } catch {}
7184
7184
  return '';
7185
7185
  }
@@ -7196,14 +7196,14 @@ async function lsPnpm(pkgEnvDetails, cwd, options) {
7196
7196
  }
7197
7197
  let stdout = '';
7198
7198
  try {
7199
- stdout = (await spawn.spawn(pkgEnvDetails.agentExecPath,
7199
+ stdout = strings.stripAnsi((await spawn.spawn(pkgEnvDetails.agentExecPath,
7200
7200
  // Pnpm uses the alternative spelling of parsable.
7201
7201
  // https://en.wiktionary.org/wiki/parsable
7202
7202
  ['ls', '--parseable', '--prod', '--depth', 'Infinity'], {
7203
7203
  cwd,
7204
7204
  // Lazily access constants.WIN32.
7205
7205
  shell: constants.WIN32
7206
- })).stdout.trim();
7206
+ })).stdout.trim());
7207
7207
  } catch {}
7208
7208
  return parsableToQueryStdout(stdout);
7209
7209
  }
@@ -7211,25 +7211,24 @@ async function lsVlt(pkgEnvDetails, cwd) {
7211
7211
  let stdout = '';
7212
7212
  try {
7213
7213
  // See https://docs.vlt.sh/cli/commands/list#options.
7214
- stdout = (await spawn.spawn(pkgEnvDetails.agentExecPath, ['ls', '--view', 'human', ':not(.dev)'], {
7214
+ stdout = strings.stripAnsi((await spawn.spawn(pkgEnvDetails.agentExecPath, ['ls', '--view', 'human', ':not(.dev)'], {
7215
7215
  cwd,
7216
7216
  // Lazily access constants.WIN32.
7217
7217
  shell: constants.WIN32
7218
- })).stdout.trim();
7218
+ })).stdout.trim());
7219
7219
  } catch {}
7220
7220
  return cleanupQueryStdout(stdout);
7221
7221
  }
7222
7222
  async function lsYarnBerry(pkgEnvDetails, cwd) {
7223
7223
  try {
7224
- return (
7225
- // Yarn Berry does not support filtering by production packages yet.
7226
- // https://github.com/yarnpkg/berry/issues/5117
7227
- (await spawn.spawn(pkgEnvDetails.agentExecPath, ['info', '--recursive', '--name-only'], {
7228
- cwd,
7229
- // Lazily access constants.WIN32.
7230
- shell: constants.WIN32
7231
- })).stdout.trim()
7232
- );
7224
+ return strings.stripAnsi(
7225
+ // Yarn Berry does not support filtering by production packages yet.
7226
+ // https://github.com/yarnpkg/berry/issues/5117
7227
+ (await spawn.spawn(pkgEnvDetails.agentExecPath, ['info', '--recursive', '--name-only'], {
7228
+ cwd,
7229
+ // Lazily access constants.WIN32.
7230
+ shell: constants.WIN32
7231
+ })).stdout.trim());
7233
7232
  } catch {}
7234
7233
  return '';
7235
7234
  }
@@ -7239,11 +7238,11 @@ async function lsYarnClassic(pkgEnvDetails, cwd) {
7239
7238
  // https://github.com/yarnpkg/yarn/releases/tag/v1.0.0
7240
7239
  // > Fix: Excludes dev dependencies from the yarn list output when the
7241
7240
  // environment is production
7242
- return (await spawn.spawn(pkgEnvDetails.agentExecPath, ['list', '--prod'], {
7241
+ return strings.stripAnsi((await spawn.spawn(pkgEnvDetails.agentExecPath, ['list', '--prod'], {
7243
7242
  cwd,
7244
7243
  // Lazily access constants.WIN32.
7245
7244
  shell: constants.WIN32
7246
- })).stdout.trim();
7245
+ })).stdout.trim());
7247
7246
  } catch {}
7248
7247
  return '';
7249
7248
  }
@@ -14178,5 +14177,5 @@ void (async () => {
14178
14177
  await utils.captureException(e);
14179
14178
  }
14180
14179
  })();
14181
- //# debugId=3540e251-1510-40db-8d43-e0489ddabe14
14180
+ //# debugId=4d7d8bf0-8e58-40ba-ab95-da5d3fbe5cdd
14182
14181
  //# sourceMappingURL=cli.js.map