@danielx/civet 0.5.87 → 0.5.88

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/browser.js CHANGED
@@ -175,10 +175,11 @@ var Civet = (() => {
175
175
  }
176
176
  const block = outer.parent;
177
177
  const { expressions } = block;
178
- const index = expressions.indexOf(outer);
179
- const indent = getIndent(outer);
180
- if (indent)
181
- hoistDec[0][0] = indent;
178
+ const index = expressions.findIndex(([, s]) => outer === s);
179
+ if (index < 0)
180
+ throw new Error("Couldn't find expression in block for hoistable declaration.");
181
+ const indent = expressions[index][0];
182
+ hoistDec[0][0] = indent;
182
183
  expressions.splice(index, 0, hoistDec);
183
184
  node.hoistDec = null;
184
185
  });
@@ -11155,7 +11156,7 @@ ${input.slice(result.pos)}
11155
11156
  const initCondition = {
11156
11157
  type: "AssignmentExpression",
11157
11158
  children: [ref, " ", initializer],
11158
- hoistDec: [["", ["let ", ref], ";\n"]],
11159
+ hoistDec: [["", ["let ", ref], ";"]],
11159
11160
  blockPrefix: [["", [binding, "= ", ref], ";\n"]]
11160
11161
  };
11161
11162
  return initCondition;
@@ -21400,6 +21401,8 @@ ${input.slice(result.pos)}
21400
21401
  exp.blocks.forEach((block) => insertPush(block, ref));
21401
21402
  return;
21402
21403
  }
21404
+ if (node[node.length - 1]?.type === "SemicolonDelimiter")
21405
+ return;
21403
21406
  node.splice(1, 0, ref, ".push(");
21404
21407
  node.push(")");
21405
21408
  }
package/dist/main.js CHANGED
@@ -174,10 +174,11 @@ var require_lib = __commonJS({
174
174
  }
175
175
  const block = outer.parent;
176
176
  const { expressions } = block;
177
- const index = expressions.indexOf(outer);
178
- const indent = getIndent(outer);
179
- if (indent)
180
- hoistDec[0][0] = indent;
177
+ const index = expressions.findIndex(([, s]) => outer === s);
178
+ if (index < 0)
179
+ throw new Error("Couldn't find expression in block for hoistable declaration.");
180
+ const indent = expressions[index][0];
181
+ hoistDec[0][0] = indent;
181
182
  expressions.splice(index, 0, hoistDec);
182
183
  node.hoistDec = null;
183
184
  });
@@ -11154,7 +11155,7 @@ ${input.slice(result.pos)}
11154
11155
  const initCondition = {
11155
11156
  type: "AssignmentExpression",
11156
11157
  children: [ref, " ", initializer],
11157
- hoistDec: [["", ["let ", ref], ";\n"]],
11158
+ hoistDec: [["", ["let ", ref], ";"]],
11158
11159
  blockPrefix: [["", [binding, "= ", ref], ";\n"]]
11159
11160
  };
11160
11161
  return initCondition;
@@ -21399,6 +21400,8 @@ ${input.slice(result.pos)}
21399
21400
  exp.blocks.forEach((block) => insertPush(block, ref));
21400
21401
  return;
21401
21402
  }
21403
+ if (node[node.length - 1]?.type === "SemicolonDelimiter")
21404
+ return;
21402
21405
  node.splice(1, 0, ref, ".push(");
21403
21406
  node.push(")");
21404
21407
  }
package/dist/main.mjs CHANGED
@@ -172,10 +172,11 @@ var require_lib = __commonJS({
172
172
  }
173
173
  const block = outer.parent;
174
174
  const { expressions } = block;
175
- const index = expressions.indexOf(outer);
176
- const indent = getIndent(outer);
177
- if (indent)
178
- hoistDec[0][0] = indent;
175
+ const index = expressions.findIndex(([, s]) => outer === s);
176
+ if (index < 0)
177
+ throw new Error("Couldn't find expression in block for hoistable declaration.");
178
+ const indent = expressions[index][0];
179
+ hoistDec[0][0] = indent;
179
180
  expressions.splice(index, 0, hoistDec);
180
181
  node.hoistDec = null;
181
182
  });
@@ -11152,7 +11153,7 @@ ${input.slice(result.pos)}
11152
11153
  const initCondition = {
11153
11154
  type: "AssignmentExpression",
11154
11155
  children: [ref, " ", initializer],
11155
- hoistDec: [["", ["let ", ref], ";\n"]],
11156
+ hoistDec: [["", ["let ", ref], ";"]],
11156
11157
  blockPrefix: [["", [binding, "= ", ref], ";\n"]]
11157
11158
  };
11158
11159
  return initCondition;
@@ -21397,6 +21398,8 @@ ${input.slice(result.pos)}
21397
21398
  exp.blocks.forEach((block) => insertPush(block, ref));
21398
21399
  return;
21399
21400
  }
21401
+ if (node[node.length - 1]?.type === "SemicolonDelimiter")
21402
+ return;
21400
21403
  node.splice(1, 0, ref, ".push(");
21401
21404
  node.push(")");
21402
21405
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.5.87",
3
+ "version": "0.5.88",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/main.mjs",