@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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @torpor/view
2
2
 
3
+ ## 0.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 84b5b9e: Fix: for var names before commas
8
+
9
+ ## 0.4.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 00a1868: Fix: escape quotes in dev boundary names
14
+
3
15
  ## 0.4.2
4
16
 
5
17
  ### Patch Changes
package/dist/compile.cjs CHANGED
@@ -92,7 +92,10 @@ function addPopDevBoundary(status, b) {
92
92
  function addPushDevBoundary(type, name, status, b) {
93
93
  if (status.options.dev === true) {
94
94
  status.imports.add("t_push_dev_bound");
95
- if (!(name.startsWith("'") && name.endsWith("'") || name.startsWith("\"") && name.endsWith("\"") || name.startsWith("`") || name.endsWith("`"))) name = `"${name}"`;
95
+ if (name.startsWith("'") && name.endsWith("'") || name.startsWith("\"") && name.endsWith("\"") || name.startsWith("`") && name.endsWith("`")) {
96
+ const quote = name[0];
97
+ name = quote + name.substring(1, name.length - 1).replaceAll(quote, "\\" + quote) + quote;
98
+ } else name = `"${name.replaceAll("\"", "\\\"")}"`;
96
99
  b.append(`t_push_dev_bound("${type}", ${name});`);
97
100
  b.append("");
98
101
  }
@@ -679,7 +682,7 @@ function printDebug(varName, status, b) {}
679
682
  * Variables used within a for loop need to be retrieved from the loop data.
680
683
  */
681
684
  function replaceForVarNames(value, status) {
682
- for (let varName of status.forVarNames) value = value.replaceAll(new RegExp(`(^|\\s|\\(|\\[|\\{|!)${varName[0]}($|\\s|\\.|\\(|\\)|\\[|\\]|\\}|;)`, "g"), `$1${varName[1]}$2`);
685
+ for (let varName of status.forVarNames) value = value.replaceAll(new RegExp(`(^|\\s|\\(|\\[|\\{|!)${varName[0]}($|\\s|\\.|,|\\(|\\)|\\[|\\]|\\}|;)`, "g"), `$1${varName[1]}$2`);
683
686
  return value;
684
687
  }
685
688