File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,17 @@ function templateSource(template: string): string {
2424 }
2525}
2626
27+ /**
28+ * The block types a template actually renders, read from its own `block.type ==`
29+ * guards so the answer cannot drift from the markup. Every shipped template
30+ * dispatches this way and none has a catch-all `{% else %}`, so a type absent
31+ * here is genuinely dropped. Scanning the whole file rather than a single loop
32+ * keeps the set over-permissive on purpose: a missed warning costs less than one
33+ * that cries about a card which renders fine.
34+ *
35+ * Returns undefined when the template is unknown or dispatches some other way —
36+ * callers stay quiet rather than guess.
37+ */
2738function handledBlockTypes ( template : string ) : Set < string > | undefined {
2839 const matches = templateSource ( template ) . matchAll ( / b l o c k \. t y p e \s * = = \s * " ( [ a - z - ] + ) " / g) ;
2940 const types = new Set ( [ ...matches ] . map ( ( m ) => m [ 1 ] as string ) ) ;
You can’t perform that action at this time.
0 commit comments