@sprlab/wccompiler 0.16.13 → 0.16.14

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 +18 -0
  2. package/package.json +1 -1
package/lib/codegen.js CHANGED
@@ -120,6 +120,19 @@ function wrapTernaryExpr(expr) {
120
120
  export function transformExpr(expr, signalNames, computedNames, propsObjectName = null, propNames = new Set(), emitsObjectName = null, constantNames = [], methodNames = [], modelVarMap = new Map()) {
121
121
  let result = expr;
122
122
 
123
+ // BUG-0011 FIX: Protect string literals from transformation
124
+ // Store original strings and replace with placeholders to prevent signal names inside strings from being transformed
125
+ const stringPlaceholders = new Map();
126
+ let stringPlaceholderIndex = 0;
127
+
128
+ // Match all string literals (single quotes, double quotes, backticks)
129
+ // Replace them with placeholders before any transformations
130
+ result = result.replace(/(['"`])(.*?)(?<!\\)\1/g, (match, quote, content) => {
131
+ const placeholder = `__STRING_PLACEHOLDER_${stringPlaceholderIndex++}__`;
132
+ stringPlaceholders.set(placeholder, match);
133
+ return placeholder;
134
+ });
135
+
123
136
  // BUG-0009 FIX: Protect object literal keys from transformation
124
137
  // Store original keys and replace with placeholders to prevent them from being transformed
125
138
  const keyPlaceholders = new Map();
@@ -225,6 +238,11 @@ export function transformExpr(expr, signalNames, computedNames, propsObjectName
225
238
  result = result.replace(placeholder, originalKey);
226
239
  }
227
240
 
241
+ // BUG-0011 FIX: Restore original string literals from placeholders
242
+ for (const [placeholder, originalString] of stringPlaceholders) {
243
+ result = result.replace(placeholder, originalString);
244
+ }
245
+
228
246
  return result;
229
247
  }
230
248
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprlab/wccompiler",
3
- "version": "0.16.13",
3
+ "version": "0.16.14",
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
  "exports": {