@sprlab/wccompiler 0.11.8 → 0.11.9

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 +4 -0
  2. package/package.json +1 -1
package/lib/codegen.js CHANGED
@@ -901,6 +901,7 @@ export function generateComponent(parseResult, options = {}) {
901
901
  }
902
902
 
903
903
  // ── 1. Reactive runtime (shared import or inline) ──
904
+ if (options.comments) lines.push('// ── Runtime ──────────────────────────────────────────');
904
905
  // Determine which runtime functions this component needs
905
906
  const needsEffect = effects.length > 0 || bindings.length > 0 || showBindings.length > 0 || modelBindings.length > 0 || modelPropBindings.length > 0 || attrBindings.length > 0 || ifBlocks.length > 0 || forBlocks.length > 0 || watchers.length > 0 || childComponents.length > 0 || slots.some(s => s.slotProps.length > 0);
906
907
  const needsComputed = computeds.length > 0;
@@ -930,6 +931,7 @@ export function generateComponent(parseResult, options = {}) {
930
931
 
931
932
  // ── 2. CSS injection (scoped, deduplicated via id guard) ──
932
933
  if (style) {
934
+ if (options.comments) lines.push('// ── Styles ───────────────────────────────────────────');
933
935
  const scoped = scopeCSS(style, tagName);
934
936
  const cssId = `__css_${className}`;
935
937
  lines.push(`if (!document.getElementById('${cssId}')) {`);
@@ -942,11 +944,13 @@ export function generateComponent(parseResult, options = {}) {
942
944
  }
943
945
 
944
946
  // ── 3. Template element ──
947
+ if (options.comments) lines.push('// ── Template ─────────────────────────────────────────');
945
948
  lines.push(`const __t_${className} = document.createElement('template');`);
946
949
  lines.push(`__t_${className}.innerHTML = \`${processedTemplate || ''}\`;`);
947
950
  lines.push('');
948
951
 
949
952
  // ── 4. HTMLElement class ──
953
+ if (options.comments) lines.push('// ── Component ────────────────────────────────────────');
950
954
  lines.push(`class ${className} extends HTMLElement {`);
951
955
 
952
956
  // Static observedAttributes (if props or model props exist)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprlab/wccompiler",
3
- "version": "0.11.8",
3
+ "version": "0.11.9",
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": {