ventojs 0.12.1 → 0.12.3
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/esm/plugins/layout.js +3 -1
- package/esm/plugins/set.js +3 -6
- package/esm/src/environment.js +3 -1
- package/package.json +1 -1
package/esm/plugins/layout.js
CHANGED
|
@@ -12,7 +12,9 @@ function layoutTag(env, code, output, tokens) {
|
|
|
12
12
|
throw new Error(`Invalid wrap: ${code}`);
|
|
13
13
|
}
|
|
14
14
|
const [_, file, data] = match;
|
|
15
|
-
const varname = "
|
|
15
|
+
const varname = output.startsWith("__layout")
|
|
16
|
+
? output + "_layout"
|
|
17
|
+
: "__layout";
|
|
16
18
|
const compiled = [];
|
|
17
19
|
const compiledFilters = env.compileFilters(tokens, varname);
|
|
18
20
|
compiled.push("{");
|
package/esm/plugins/set.js
CHANGED
|
@@ -17,12 +17,9 @@ function setTag(env, code, _output, tokens) {
|
|
|
17
17
|
}
|
|
18
18
|
const [, variable, value] = match;
|
|
19
19
|
const val = env.compileFilters(tokens, value);
|
|
20
|
-
return `
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
var ${variable} = ${val};
|
|
24
|
-
}
|
|
25
|
-
${dataVarname}["${variable}"] = ${variable};
|
|
20
|
+
return `
|
|
21
|
+
${dataVarname}["${variable}"] = ${val};
|
|
22
|
+
var ${variable} = ${val};
|
|
26
23
|
`;
|
|
27
24
|
}
|
|
28
25
|
// Value is captured (eg: {{ set foo }}bar{{ /set }})
|
package/esm/src/environment.js
CHANGED
|
@@ -100,7 +100,9 @@ export class Environment {
|
|
|
100
100
|
continue;
|
|
101
101
|
}
|
|
102
102
|
if (type === "string") {
|
|
103
|
-
|
|
103
|
+
if (code !== "") {
|
|
104
|
+
compiled.push(`${outputVar} += ${JSON.stringify(code)};`);
|
|
105
|
+
}
|
|
104
106
|
continue;
|
|
105
107
|
}
|
|
106
108
|
if (type === "tag") {
|