@torpor/view 0.3.3 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torpor/view",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Torpor's view library, for writing and mounting components",
5
5
  "type": "module",
6
6
  "exports": {
@@ -106,9 +106,17 @@ function buildTemplate(
106
106
 
107
107
  let currentIndex = 0;
108
108
  let current = template.components[0];
109
+ let status: BuildStatus = makeStatus(imports, map, current, options);
110
+ let first = true;
109
111
 
110
112
  for (let chunk of template.script) {
111
113
  if (chunk.script === "/* @params */") {
114
+ // Reset the status for each new function body
115
+ if (!first) {
116
+ status = makeStatus(imports, map, current, options);
117
+ }
118
+ first = false;
119
+
112
120
  // TODO: Support other params, like the user setting $context
113
121
  let params = [
114
122
  `${current.markup ? "$parent" : "_$parent"}: ParentNode`,
@@ -137,7 +145,6 @@ function buildTemplate(
137
145
  } else if (chunk.script === "/* @render */") {
138
146
  if (current.markup) {
139
147
  // Add the interface
140
- let status = makeStatus(imports, map, current, options);
141
148
  b.append("");
142
149
  b.append("/* User interface */");
143
150
  buildFragmentText(current.markup, status, b);
@@ -147,7 +154,6 @@ function buildTemplate(
147
154
  } else if (chunk.script === "/* @head */") {
148
155
  if (current.head) {
149
156
  // Add the head tags
150
- let status = makeStatus(imports, map, current, options);
151
157
  b.append("");
152
158
  b.append("/* Head */");
153
159
  status.inHead = true;
@@ -161,7 +167,6 @@ function buildTemplate(
161
167
  currentIndex += 1;
162
168
  current = template.components[currentIndex];
163
169
  } else {
164
- let status = makeStatus(imports, map, current, options);
165
170
  addMappedText("", chunk.script, "", chunk.range, status, b);
166
171
  }
167
172
  }