@torpor/view 0.4.2 → 0.4.4

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/compile.js CHANGED
@@ -91,7 +91,10 @@ function addPopDevBoundary(status, b) {
91
91
  function addPushDevBoundary(type, name, status, b) {
92
92
  if (status.options.dev === true) {
93
93
  status.imports.add("t_push_dev_bound");
94
- if (!(name.startsWith("'") && name.endsWith("'") || name.startsWith("\"") && name.endsWith("\"") || name.startsWith("`") || name.endsWith("`"))) name = `"${name}"`;
94
+ if (name.startsWith("'") && name.endsWith("'") || name.startsWith("\"") && name.endsWith("\"") || name.startsWith("`") && name.endsWith("`")) {
95
+ const quote = name[0];
96
+ name = quote + name.substring(1, name.length - 1).replaceAll(quote, "\\" + quote) + quote;
97
+ } else name = `"${name.replaceAll("\"", "\\\"")}"`;
95
98
  b.append(`t_push_dev_bound("${type}", ${name});`);
96
99
  b.append("");
97
100
  }
@@ -678,7 +681,7 @@ function printDebug(varName, status, b) {}
678
681
  * Variables used within a for loop need to be retrieved from the loop data.
679
682
  */
680
683
  function replaceForVarNames(value, status) {
681
- for (let varName of status.forVarNames) value = value.replaceAll(new RegExp(`(^|\\s|\\(|\\[|\\{|!)${varName[0]}($|\\s|\\.|\\(|\\)|\\[|\\]|\\}|;)`, "g"), `$1${varName[1]}$2`);
684
+ for (let varName of status.forVarNames) value = value.replaceAll(new RegExp(`(^|\\s|\\(|\\[|\\{|!)${varName[0]}($|\\s|\\.|,|\\(|\\)|\\[|\\]|\\}|;)`, "g"), `$1${varName[1]}$2`);
682
685
  return value;
683
686
  }
684
687