Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

execa

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

execa - npm Package Compare versions

Comparing version 9.3.0 to 9.3.1

4

lib/arguments/cwd.js
import {statSync} from 'node:fs';
import {resolve} from 'node:path';
import path from 'node:path';
import process from 'node:process';

@@ -9,3 +9,3 @@ import {safeNormalizeFileUrl} from './file-url.js';

const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
return resolve(cwdString);
return path.resolve(cwdString);
};

@@ -12,0 +12,0 @@

@@ -41,4 +41,20 @@ import {platform} from 'node:process';

// List of Unicode character categories: https://www.fileformat.info/info/unicode/category/index.htm
const SPECIAL_CHAR_REGEXP = /\p{Separator}|\p{Other}/gu;
const getSpecialCharRegExp = () => {
try {
// This throws when using Node.js without ICU support.
// When using a RegExp literal, this would throw at parsing-time, instead of runtime.
// eslint-disable-next-line prefer-regex-literals
return new RegExp('\\p{Separator}|\\p{Other}', 'gu');
} catch {
// Similar to the above RegExp, but works even when Node.js has been built without ICU support.
// Unlike the above RegExp, it only covers whitespaces and C0/C1 control characters.
// It does not cover some edge cases, such as Unicode reserved characters.
// See https://github.com/sindresorhus/execa/issues/1143
// eslint-disable-next-line no-control-regex
return /[\s\u0000-\u001F\u007F-\u009F\u00AD]/g;
}
};
const SPECIAL_CHAR_REGEXP = getSpecialCharRegExp();
// Accepted by $'...' in Bash.

@@ -45,0 +61,0 @@ // Exclude \a \e \v which are accepted in Bash but not in JavaScript (except \v) and JSON.

@@ -1,2 +0,2 @@

import {basename} from 'node:path';
import path from 'node:path';
import process from 'node:process';

@@ -38,3 +38,3 @@ import crossSpawn from 'cross-spawn';

if (process.platform === 'win32' && basename(file, '.exe') === 'cmd') {
if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {
// #116

@@ -41,0 +41,0 @@ commandArguments.unshift('/q');

import {execPath, execArgv} from 'node:process';
import {basename, resolve} from 'node:path';
import path from 'node:path';
import {safeNormalizeFileUrl} from '../arguments/file-url.js';

@@ -30,3 +30,3 @@

const normalizedNodePath = safeNormalizeFileUrl(nodePath, 'The "nodePath" option');
const resolvedNodePath = resolve(cwd, normalizedNodePath);
const resolvedNodePath = path.resolve(cwd, normalizedNodePath);
const newOptions = {

@@ -43,3 +43,3 @@ ...options,

if (basename(file, '.exe') === 'node') {
if (path.basename(file, '.exe') === 'node') {
throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');

@@ -46,0 +46,0 @@ }

{
"name": "execa",
"version": "9.3.0",
"version": "9.3.1",
"description": "Process execution for humans",

@@ -58,3 +58,3 @@ "license": "MIT",

"get-stream": "^9.0.0",
"human-signals": "^7.0.0",
"human-signals": "^8.0.0",
"is-plain-obj": "^4.1.0",

@@ -69,7 +69,7 @@ "is-stream": "^4.0.1",

"devDependencies": {
"@types/node": "^20.8.9",
"@types/node": "^22.1.0",
"ava": "^6.0.1",
"c8": "^10.1.2",
"get-node": "^15.0.0",
"is-in-ci": "^0.1.0",
"is-in-ci": "^1.0.0",
"is-running": "^2.1.0",

@@ -82,3 +82,3 @@ "path-exists": "^5.0.0",

"which": "^4.0.0",
"xo": "^0.58.0"
"xo": "^0.59.3"
},

@@ -85,0 +85,0 @@ "c8": {

@@ -61,3 +61,3 @@ <picture>

- Improved [Windows support](docs/windows.md): [shebangs](docs/windows.md#shebang), [`PATHEXT`](https://ss64.com/nt/path.html#pathext), [graceful termination](#graceful-termination), [and more](https://github.com/moxystudio/node-cross-spawn?tab=readme-ov-file#why).
- [Detailed errors](#detailed-error) and [verbose mode](#verbose-mode), for [debugging](docs/debugging.md).
- [Detailed errors](#detailed-error), [verbose mode](#verbose-mode) and [custom logging](#custom-logging), for [debugging](docs/debugging.md).
- [Pipe multiple subprocesses](#pipe-multiple-subprocesses) better than in shells: retrieve [intermediate results](docs/pipe.md#result), use multiple [sources](docs/pipe.md#multiple-sources-1-destination)/[destinations](docs/pipe.md#1-source-multiple-destinations), [unpipe](docs/pipe.md#unpipe).

@@ -414,2 +414,30 @@ - [Split](#split-into-text-lines) the output into text lines, or [iterate](#iterate-over-text-lines) progressively over them.

#### Custom logging
```js
import {execa as execa_} from 'execa';
import {createLogger, transports} from 'winston';
// Log to a file using Winston
const transport = new transports.File({filename: 'logs.txt'});
const logger = createLogger({transports: [transport]});
const LOG_LEVELS = {
command: 'info',
output: 'verbose',
ipc: 'verbose',
error: 'error',
duration: 'info',
};
const execa = execa_({
verbose(verboseLine, {message, ...verboseObject}) {
const level = LOG_LEVELS[verboseObject.type];
logger[level](message, verboseObject);
},
});
await execa`npm run build`;
await execa`npm run test`;
```
## Related

@@ -416,0 +444,0 @@

import type {SignalConstants} from 'node:os';
import type {env} from 'node:process';
import type {Readable} from 'node:stream';

@@ -80,3 +79,3 @@ import type {Unless} from '../utils.js';

*/
readonly env?: typeof env;
readonly env?: Readonly<Partial<Record<string, string>>>;

@@ -83,0 +82,0 @@ /**

@@ -321,2 +321,30 @@ import type {Options} from '../arguments/options.js';

```
@example <caption>Custom logging</caption>
```
import {execa as execa_} from 'execa';
import {createLogger, transports} from 'winston';
// Log to a file using Winston
const transport = new transports.File({filename: 'logs.txt'});
const logger = createLogger({transports: [transport]});
const LOG_LEVELS = {
command: 'info',
output: 'verbose',
ipc: 'verbose',
error: 'error',
duration: 'info',
};
const execa = execa_({
verbose(verboseLine, {message, ...verboseObject}) {
const level = LOG_LEVELS[verboseObject.type];
logger[level](message, verboseObject);
},
});
await execa`npm run build`;
await execa`npm run test`;
```
*/

@@ -323,0 +351,0 @@ export declare const execa: ExecaMethod<{}>;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc