Comparing version 1.5.6 to 1.5.7
@@ -12,2 +12,9 @@ # Changelog | ||
## [1.5.7] - 2022-07-06 | ||
- Fix escaping of characters after whitespace with `{interpolation:true}` for | ||
Bash, Dash, and Zsh on Unix systems. ([#324]) | ||
- Fix escaping of characters after whitespace with `{interpolation:true}` for | ||
Powershell on Windows systems. ([#322]) | ||
## [1.5.6] - 2022-07-02 | ||
@@ -146,3 +153,5 @@ | ||
[#310]: https://github.com/ericcornelissen/shescape/pull/310 | ||
[#322]: https://github.com/ericcornelissen/shescape/pull/322 | ||
[#324]: https://github.com/ericcornelissen/shescape/pull/324 | ||
[keep a changelog]: https://keepachangelog.com/en/1.0.0/ | ||
[semantic versioning]: https://semver.org/spec/v2.0.0.html |
@@ -11,3 +11,3 @@ /** | ||
* @module shescape | ||
* @version 1.5.6 | ||
* @version 1.5.7 | ||
* @license MPL-2.0 | ||
@@ -14,0 +14,0 @@ */ |
{ | ||
"name": "shescape", | ||
"version": "1.5.6", | ||
"version": "1.5.7", | ||
"description": "simple shell escape library", | ||
@@ -62,5 +62,5 @@ "homepage": "https://ericcornelissen.github.io/shescape/", | ||
"devDependencies": { | ||
"@fast-check/ava": "0.0.1", | ||
"@stryker-mutator/core": "6.1.2", | ||
"ava": "4.3.0", | ||
"ava-fast-check": "6.0.0", | ||
"benchmark": "2.1.4", | ||
@@ -67,0 +67,0 @@ "c8": "7.11.3", |
@@ -86,2 +86,3 @@ /** | ||
* @param {boolean} [args.options.interpolation] Is interpolation enabled. | ||
* @param {boolean} [args.options.quoted] Is `arg` being quoted. | ||
* @param {Object} args.process The `process` values. | ||
@@ -92,3 +93,3 @@ * @param {Object} args.process.env The environment variables. | ||
* @param {Function} deps.getShellName Get the name of a shell. | ||
* @returns {Object} The parsed arguments `{ arg, interpolation, shellName }`. | ||
* @returns {Object} The parsed arguments. | ||
*/ | ||
@@ -100,3 +101,4 @@ function parseArgs( | ||
const env = process.env; | ||
const interpolation = options.interpolation; | ||
const interpolation = options.interpolation ? true : false; | ||
const quoted = options.quoted; | ||
const shell = isString(options.shell) | ||
@@ -107,3 +109,3 @@ ? options.shell | ||
const shellName = getShellName({ shell }, { resolveExecutable }); | ||
return { arg, interpolation, shellName }; | ||
return { arg, interpolation, quoted, shellName }; | ||
} | ||
@@ -177,3 +179,3 @@ | ||
export function escapeShellArg({ arg, options, process }, deps) { | ||
options = mergeObjects({ interpolation: false }, options); | ||
options = mergeObjects(options, { quoted: false }); | ||
const escapeArgs = parseArgs({ arg, options, process }, deps); | ||
@@ -180,0 +182,0 @@ return escape(escapeArgs, deps); |
@@ -49,3 +49,3 @@ /** | ||
.replace(/\\/g, "\\\\") | ||
.replace(/^(~|#)/g, "\\$1") | ||
.replace(/(^|\s)(~|#)/g, "$1\\$2") | ||
.replace(/(\*|\?)/g, "\\$1") | ||
@@ -78,3 +78,3 @@ .replace(/(\$|\;|\&|\|)/g, "\\$1") | ||
.replace(/\\/g, "\\\\") | ||
.replace(/^(~|#)/g, "\\$1") | ||
.replace(/(^|\s)(~|#)/g, "$1\\$2") | ||
.replace(/(\*|\?)/g, "\\$1") | ||
@@ -106,3 +106,3 @@ .replace(/(\$|\;|\&|\|)/g, "\\$1") | ||
.replace(/\\/g, "\\\\") | ||
.replace(/^(~|#)/g, "\\$1") | ||
.replace(/(^|\s)(~|#)/g, "$1\\$2") | ||
.replace(/(\*|\?)/g, "\\$1") | ||
@@ -112,3 +112,3 @@ .replace(/(\$|\;|\&|\|)/g, "\\$1") | ||
.replace(/("|'|`)/g, "\\$1") | ||
.replace(/^=/g, "\\=") | ||
.replace(/(^|\s)=/g, "$1\\=") | ||
.replace(/(\[|\]|\{|\})/g, "\\$1"); | ||
@@ -115,0 +115,0 @@ } else if (quoted) { |
@@ -67,4 +67,4 @@ /** | ||
result = result | ||
.replace(/^((?:\*|[1-6])?)(>)/g, "$1`$2") | ||
.replace(/^(<|@|#|-|\:|\])/g, "`$1") | ||
.replace(/(^|\s)((?:\*|[1-6])?)(>)/g, "$1$2`$3") | ||
.replace(/(^|\s)(<|@|#|-|\:|\])/g, "$1`$2") | ||
.replace(/(,|\;|\&|\|)/g, "`$1") | ||
@@ -71,0 +71,0 @@ .replace(/(\(|\)|\{|\})/g, "`$1") |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83385
1538