@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 +12 -0
- package/dist/compile.cjs +5 -2
- package/dist/compile.cjs.map +1 -1
- package/dist/compile.js +5 -2
- package/dist/compile.js.map +1 -1
- package/package.json +1 -1
- package/src/compile/build/client/addPushDevBoundary.ts +8 -5
- package/src/compile/build/client/replaceForVarNames.ts +1 -1
package/package.json
CHANGED
|
@@ -10,13 +10,16 @@ export default function addPushDevBoundary(
|
|
|
10
10
|
if (status.options.dev === true) {
|
|
11
11
|
status.imports.add("t_push_dev_bound");
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// Ensure the name is wrapped with quotes, and internal quotes are escaped
|
|
14
|
+
const nameHasQuotes =
|
|
14
15
|
(name.startsWith("'") && name.endsWith("'")) ||
|
|
15
16
|
(name.startsWith('"') && name.endsWith('"')) ||
|
|
16
|
-
name.startsWith("`")
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
name =
|
|
17
|
+
(name.startsWith("`") && name.endsWith("`"));
|
|
18
|
+
if (nameHasQuotes) {
|
|
19
|
+
const quote = name[0];
|
|
20
|
+
name = quote + name.substring(1, name.length - 1).replaceAll(quote, "\\" + quote) + quote;
|
|
21
|
+
} else {
|
|
22
|
+
name = `"${name.replaceAll('"', '\\"')}"`;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
b.append(`t_push_dev_bound("${type}", ${name});`);
|
|
@@ -8,7 +8,7 @@ export default function replaceForVarNames(value: string, status: BuildStatus):
|
|
|
8
8
|
// get it from the loop data to trigger an update when it is changed
|
|
9
9
|
for (let varName of status.forVarNames) {
|
|
10
10
|
value = value.replaceAll(
|
|
11
|
-
new RegExp(`(^|\\s|\\(|\\[|\\{|!)${varName[0]}($|\\s
|
|
11
|
+
new RegExp(`(^|\\s|\\(|\\[|\\{|!)${varName[0]}($|\\s|\\.|,|\\(|\\)|\\[|\\]|\\}|;)`, "g"),
|
|
12
12
|
`$1${varName[1]}$2`,
|
|
13
13
|
);
|
|
14
14
|
}
|