@sprlab/wccompiler 0.5.7 → 0.5.8

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.
Files changed (2) hide show
  1. package/lib/codegen.js +8 -4
  2. package/package.json +1 -1
package/lib/codegen.js CHANGED
@@ -1093,7 +1093,7 @@ export function generateComponent(parseResult, options = {}) {
1093
1093
  for (const hook of onMountHooks) {
1094
1094
  const body = transformMethodBody(hook.body, signalNames, computedNames, propsObjectName, propNames, emitsObjectName, refVarNames, constantNames);
1095
1095
  if (hook.async) {
1096
- lines.push(' (async () => {');
1096
+ lines.push(' ;(async () => {');
1097
1097
  const bodyLines = body.split('\n');
1098
1098
  for (const line of bodyLines) {
1099
1099
  lines.push(` ${line}`);
@@ -1102,7 +1102,9 @@ export function generateComponent(parseResult, options = {}) {
1102
1102
  } else {
1103
1103
  const bodyLines = body.split('\n');
1104
1104
  for (const line of bodyLines) {
1105
- lines.push(` ${line}`);
1105
+ const trimmed = line.trimEnd();
1106
+ const needsSemi = trimmed && !trimmed.endsWith(';') && !trimmed.endsWith('{') && !trimmed.endsWith('}');
1107
+ lines.push(` ${trimmed}${needsSemi ? ';' : ''}`);
1106
1108
  }
1107
1109
  }
1108
1110
  }
@@ -1119,7 +1121,7 @@ export function generateComponent(parseResult, options = {}) {
1119
1121
  for (const hook of onDestroyHooks) {
1120
1122
  const body = transformMethodBody(hook.body, signalNames, computedNames, propsObjectName, propNames, emitsObjectName, refVarNames, constantNames);
1121
1123
  if (hook.async) {
1122
- lines.push(' (async () => {');
1124
+ lines.push(' ;(async () => {');
1123
1125
  const bodyLines = body.split('\n');
1124
1126
  for (const line of bodyLines) {
1125
1127
  lines.push(` ${line}`);
@@ -1128,7 +1130,9 @@ export function generateComponent(parseResult, options = {}) {
1128
1130
  } else {
1129
1131
  const bodyLines = body.split('\n');
1130
1132
  for (const line of bodyLines) {
1131
- lines.push(` ${line}`);
1133
+ const trimmed = line.trimEnd();
1134
+ const needsSemi = trimmed && !trimmed.endsWith(';') && !trimmed.endsWith('{') && !trimmed.endsWith('}');
1135
+ lines.push(` ${trimmed}${needsSemi ? ';' : ''}`);
1132
1136
  }
1133
1137
  }
1134
1138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprlab/wccompiler",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "description": "Zero-runtime compiler that transforms .wcc single-file components into native web components with signals-based reactivity",
5
5
  "type": "module",
6
6
  "bin": {