socket 1.0.10 → 1.0.11

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/cli.js CHANGED
@@ -3010,10 +3010,10 @@ 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 = strings.stripAnsi((await spawn.spawn('git', ['remote', 'show', 'origin'], {
3013
+ const originDetails = (await spawn.spawn('git', ['remote', 'show', 'origin'], {
3014
3014
  cwd
3015
- })).stdout.trim());
3016
- const match = /(?<=HEAD branch: ).+/.exec(stdout);
3015
+ })).stdout;
3016
+ const match = /(?<=HEAD branch: ).+/.exec(originDetails);
3017
3017
  if (match?.[0]) {
3018
3018
  return match[0].trim();
3019
3019
  }
@@ -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 = strings.stripAnsi((await spawn.spawn('git', ['remote', 'get-url', 'origin'], {
3125
+ const remoteUrl = (await spawn.spawn('git', ['remote', 'get-url', 'origin'], {
3126
3126
  cwd
3127
- })).stdout.trim());
3127
+ })).stdout;
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 = strings.stripAnsi((await spawn.spawn('git', ['config', '--get', prop], stdioPipeOptions)).stdout.trim());
3171
+ configValue = (await spawn.spawn('git', ['config', '--get', prop], stdioPipeOptions)).stdout;
3172
3172
  } catch {}
3173
3173
  if (configValue !== value) {
3174
3174
  try {
@@ -3184,10 +3184,9 @@ async function gitRemoteBranchExists(branch, cwd = process.cwd()) {
3184
3184
  cwd
3185
3185
  };
3186
3186
  try {
3187
- return strings.stripAnsi((await spawn.spawn('git', ['ls-remote', '--heads', 'origin', branch], stdioPipeOptions)).stdout.trim()).length > 0;
3188
- } catch {
3189
- return false;
3190
- }
3187
+ return (await spawn.spawn('git', ['ls-remote', '--heads', 'origin', branch], stdioPipeOptions)).stdout.length > 0;
3188
+ } catch {}
3189
+ return false;
3191
3190
  }
3192
3191
  async function gitResetAndClean(branch = 'HEAD', cwd = process.cwd()) {
3193
3192
  // Discards tracked changes.
@@ -3207,11 +3206,11 @@ async function gitUnstagedModifiedFiles(cwd = process.cwd()) {
3207
3206
  const stdioPipeOptions = {
3208
3207
  cwd
3209
3208
  };
3210
- const stdout = strings.stripAnsi((await spawn.spawn('git', ['diff', '--name-only'], stdioPipeOptions)).stdout.trim());
3211
- const rawFiles = stdout.split('\n') ?? [];
3209
+ const changedFilesDetails = (await spawn.spawn('git', ['diff', '--name-only'], stdioPipeOptions)).stdout;
3210
+ const rawRelPaths = changedFilesDetails.split('\n') ?? [];
3212
3211
  return {
3213
3212
  ok: true,
3214
- data: rawFiles.map(relPath => path$1.normalizePath(relPath))
3213
+ data: rawRelPaths.map(relPath => path$1.normalizePath(relPath))
3215
3214
  };
3216
3215
  } catch (e) {
3217
3216
  debug.debugFn('catch: git diff --name-only failed\n', e);
@@ -7163,11 +7162,11 @@ function parsableToQueryStdout(stdout) {
7163
7162
  async function npmQuery(npmExecPath, cwd) {
7164
7163
  let stdout = '';
7165
7164
  try {
7166
- stdout = strings.stripAnsi((await spawn.spawn(npmExecPath, ['query', ':not(.dev)'], {
7165
+ stdout = (await spawn.spawn(npmExecPath, ['query', ':not(.dev)'], {
7167
7166
  cwd,
7168
7167
  // Lazily access constants.WIN32.
7169
7168
  shell: constants.WIN32
7170
- })).stdout.trim());
7169
+ })).stdout;
7171
7170
  } catch {}
7172
7171
  return cleanupQueryStdout(stdout);
7173
7172
  }
@@ -7175,11 +7174,11 @@ async function lsBun(pkgEnvDetails, cwd) {
7175
7174
  try {
7176
7175
  // Bun does not support filtering by production packages yet.
7177
7176
  // https://github.com/oven-sh/bun/issues/8283
7178
- return strings.stripAnsi((await spawn.spawn(pkgEnvDetails.agentExecPath, ['pm', 'ls', '--all'], {
7177
+ return (await spawn.spawn(pkgEnvDetails.agentExecPath, ['pm', 'ls', '--all'], {
7179
7178
  cwd,
7180
7179
  // Lazily access constants.WIN32.
7181
7180
  shell: constants.WIN32
7182
- })).stdout.trim());
7181
+ })).stdout;
7183
7182
  } catch {}
7184
7183
  return '';
7185
7184
  }
@@ -7196,14 +7195,14 @@ async function lsPnpm(pkgEnvDetails, cwd, options) {
7196
7195
  }
7197
7196
  let stdout = '';
7198
7197
  try {
7199
- stdout = strings.stripAnsi((await spawn.spawn(pkgEnvDetails.agentExecPath,
7198
+ stdout = (await spawn.spawn(pkgEnvDetails.agentExecPath,
7200
7199
  // Pnpm uses the alternative spelling of parsable.
7201
7200
  // https://en.wiktionary.org/wiki/parsable
7202
7201
  ['ls', '--parseable', '--prod', '--depth', 'Infinity'], {
7203
7202
  cwd,
7204
7203
  // Lazily access constants.WIN32.
7205
7204
  shell: constants.WIN32
7206
- })).stdout.trim());
7205
+ })).stdout;
7207
7206
  } catch {}
7208
7207
  return parsableToQueryStdout(stdout);
7209
7208
  }
@@ -7211,24 +7210,23 @@ async function lsVlt(pkgEnvDetails, cwd) {
7211
7210
  let stdout = '';
7212
7211
  try {
7213
7212
  // See https://docs.vlt.sh/cli/commands/list#options.
7214
- stdout = strings.stripAnsi((await spawn.spawn(pkgEnvDetails.agentExecPath, ['ls', '--view', 'human', ':not(.dev)'], {
7213
+ stdout = (await spawn.spawn(pkgEnvDetails.agentExecPath, ['ls', '--view', 'human', ':not(.dev)'], {
7215
7214
  cwd,
7216
7215
  // Lazily access constants.WIN32.
7217
7216
  shell: constants.WIN32
7218
- })).stdout.trim());
7217
+ })).stdout;
7219
7218
  } catch {}
7220
7219
  return cleanupQueryStdout(stdout);
7221
7220
  }
7222
7221
  async function lsYarnBerry(pkgEnvDetails, cwd) {
7223
7222
  try {
7224
- return strings.stripAnsi(
7225
7223
  // Yarn Berry does not support filtering by production packages yet.
7226
7224
  // https://github.com/yarnpkg/berry/issues/5117
7227
- (await spawn.spawn(pkgEnvDetails.agentExecPath, ['info', '--recursive', '--name-only'], {
7225
+ return (await spawn.spawn(pkgEnvDetails.agentExecPath, ['info', '--recursive', '--name-only'], {
7228
7226
  cwd,
7229
7227
  // Lazily access constants.WIN32.
7230
7228
  shell: constants.WIN32
7231
- })).stdout.trim());
7229
+ })).stdout;
7232
7230
  } catch {}
7233
7231
  return '';
7234
7232
  }
@@ -7238,11 +7236,11 @@ async function lsYarnClassic(pkgEnvDetails, cwd) {
7238
7236
  // https://github.com/yarnpkg/yarn/releases/tag/v1.0.0
7239
7237
  // > Fix: Excludes dev dependencies from the yarn list output when the
7240
7238
  // environment is production
7241
- return strings.stripAnsi((await spawn.spawn(pkgEnvDetails.agentExecPath, ['list', '--prod'], {
7239
+ return (await spawn.spawn(pkgEnvDetails.agentExecPath, ['list', '--prod'], {
7242
7240
  cwd,
7243
7241
  // Lazily access constants.WIN32.
7244
7242
  shell: constants.WIN32
7245
- })).stdout.trim());
7243
+ })).stdout;
7246
7244
  } catch {}
7247
7245
  return '';
7248
7246
  }
@@ -14177,5 +14175,5 @@ void (async () => {
14177
14175
  await utils.captureException(e);
14178
14176
  }
14179
14177
  })();
14180
- //# debugId=4d7d8bf0-8e58-40ba-ab95-da5d3fbe5cdd
14178
+ //# debugId=50b201bd-872f-4cc2-a080-a88cc2f0878
14181
14179
  //# sourceMappingURL=cli.js.map