@sprlab/wccompiler 0.16.8 → 0.16.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.
package/lib/sfc-parser.js CHANGED
@@ -60,13 +60,6 @@ function findBlocks(source, blockName) {
60
60
  while ((m = openRe.exec(source)) !== null) {
61
61
  const attrs = m[1] || '';
62
62
 
63
- // For template blocks: skip <template #name> and <template slot="name"> (slot content, not SFC block)
64
- if (blockName === 'template') {
65
- if (/#/.test(attrs) || /\bslot\s*=/.test(attrs)) {
66
- continue;
67
- }
68
- }
69
-
70
63
  const openEnd = m.index + m[0].length;
71
64
 
72
65
  // Use depth counting to find the matching close tag (handles nested <template #name>)
@@ -245,9 +238,17 @@ export function parseSFC(source, fileName = '<unknown>') {
245
238
  // ── Phase 1: Extract blocks ─────────────────────────────────────
246
239
 
247
240
  const scriptBlocks = findBlocks(source, 'script');
248
- const templateBlocks = findBlocks(source, 'template');
241
+ const allTemplateBlocks = findBlocks(source, 'template');
249
242
  const styleBlocks = findBlocks(source, 'style');
250
243
 
244
+ // Filter out slot templates (<template slot="name"> and <template #name>) from SFC blocks
245
+ // These are HTML elements inside the main template, not SFC blocks
246
+ const templateBlocks = allTemplateBlocks.filter(block => {
247
+ const attrs = block.attrs || '';
248
+ // Exclude templates with slot attribute or # shorthand (these are slot content)
249
+ return !/#/.test(attrs) && !/\bslot\s*=/.test(attrs);
250
+ });
251
+
251
252
  // Check for duplicates
252
253
  if (scriptBlocks.length > 1) {
253
254
  throw sfcError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprlab/wccompiler",
3
- "version": "0.16.8",
3
+ "version": "0.16.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": {