also looking at this
feat(dx): dev-mode warning for unbalanced template tags (#1769)
#1770
4 files
+277
-0
| @@ -60,6 +60,8 @@ import { processInlineAssets } from './inline-assets' | ||
| 60 | 60 | import { addCloakToConditionalDirectives, addCloakToUnresolvedExpressions, processJsonDirective, processMemoDirective, processOnceDirective, processRefAttributes } from './misc-directives' |
| 61 | 61 | import { validateClientScript } from './script-validation' |
| 62 | 62 | import { safeEvaluate } from './safe-evaluator' |
| 63 | import { isProduction, isTest } from './env' | |
| 64 | import { warnUnbalancedTags } from './template-tag-balance' | |
| 63 | 65 | import { deriveLayoutGroup } from 'stx-router/layout-metadata' |
| 64 | 66 | |
| 65 | 67 | // Re-export public API from extracted modules (preserves backwards compatibility) |
| @@ -299,6 +301,15 @@ export async function processDirectives( | ||
| 299 | 301 | context.__onceStore = new Set<string>() |
| 300 | 302 | } |
| 301 | 303 | |
| 304 | // #1769: dev-mode tag-balance heads-up for top-level views/layouts, on the | |
| 305 | // RAW template before any processing auto-closes tags. @include'd partials | |
| 306 | // are checked separately in the include pipeline. On by default in | |
| 307 | // development; opt-in via `debug` elsewhere; off in prod + the test runner. | |
| 308 | // Deduped + best-effort. | |
| 309 | if ((options.debug || (!isProduction() && !isTest())) && filePath && filePath.endsWith('.stx')) { | |
| 310 | warnUnbalancedTags(template, filePath) | |
| 311 | } | |
| 312 | ||
| 302 | 313 | try { |
| 303 | 314 | return await performanceMonitor.timeAsync('template-processing', async () => { |
| 304 | 315 | let result = await processDirectivesInternal(template, context, filePath, options, dependencies) |