reasonix 0.27.0 → 0.27.1

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/index.js CHANGED
@@ -5866,7 +5866,7 @@ function splitOnChainOps(cmd) {
5866
5866
  const ch = cmd[i];
5867
5867
  if (quote) {
5868
5868
  if (ch === quote) quote = null;
5869
- else if (ch === "\\" && quote === '"' && i + 1 < cmd.length) i++;
5869
+ else if (quote === '"' && isDqEscape(ch, cmd[i + 1])) i++;
5870
5870
  i++;
5871
5871
  atTokenStart = false;
5872
5872
  continue;
@@ -5938,7 +5938,7 @@ function parseSegment(segStr) {
5938
5938
  if (quote) {
5939
5939
  if (ch === quote) {
5940
5940
  quote = null;
5941
- } else if (ch === "\\" && quote === '"' && i + 1 < segStr.length) {
5941
+ } else if (quote === '"' && isDqEscape(ch, segStr[i + 1])) {
5942
5942
  cur += segStr[++i] ?? "";
5943
5943
  curHasContent = true;
5944
5944
  } else {
@@ -6341,6 +6341,9 @@ var BUILTIN_ALLOWLIST = [
6341
6341
  "ruff",
6342
6342
  "mypy"
6343
6343
  ];
6344
+ function isDqEscape(prev, next) {
6345
+ return prev === "\\" && (next === '"' || next === "\\");
6346
+ }
6344
6347
  function tokenizeCommand(cmd) {
6345
6348
  const out = [];
6346
6349
  let cur = "";
@@ -6350,7 +6353,7 @@ function tokenizeCommand(cmd) {
6350
6353
  if (quote) {
6351
6354
  if (ch === quote) {
6352
6355
  quote = null;
6353
- } else if (ch === "\\" && quote === '"' && i + 1 < cmd.length) {
6356
+ } else if (quote === '"' && isDqEscape(ch, cmd[i + 1])) {
6354
6357
  cur += cmd[++i];
6355
6358
  } else {
6356
6359
  cur += ch;
@@ -6392,7 +6395,7 @@ function detectShellOperator(cmd) {
6392
6395
  if (quote) {
6393
6396
  if (ch === quote) {
6394
6397
  quote = null;
6395
- } else if (ch === "\\" && quote === '"' && i + 1 < cmd.length) {
6398
+ } else if (quote === '"' && isDqEscape(ch, cmd[i + 1])) {
6396
6399
  cur += cmd[++i];
6397
6400
  curQuoted = true;
6398
6401
  } else {