create-caspian-app 1.3.20 → 1.3.22

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.
@@ -53,6 +53,7 @@ import subprocess
53
53
  import sys
54
54
  import tempfile
55
55
  from dataclasses import dataclass, field
56
+ from functools import lru_cache
56
57
  from pathlib import Path
57
58
 
58
59
  import _markup_equivalence as eq
@@ -345,6 +346,20 @@ def render_literal(block: Block, markup: str) -> str | None:
345
346
  return f"{block.prefix}{body}{block.quote}"
346
347
 
347
348
 
349
+ @lru_cache(maxsize=None)
350
+ def jinja_classes(path: Path) -> dict:
351
+ """Class lists this file hides behind an expression.
352
+
353
+ Recovered from the file's own source so the oracle can see the display of a
354
+ root written as `<div {{ attributes }}>` or `class="{helper()}"`. Cached
355
+ because every block in a file shares one answer.
356
+ """
357
+ try:
358
+ return eq.class_hints(path.read_text(encoding="utf-8"))
359
+ except OSError:
360
+ return {}
361
+
362
+
348
363
  @dataclass
349
364
  class Skip:
350
365
  path: str
@@ -402,7 +417,7 @@ def format_markup_blocks(*, write: bool) -> MarkupReport:
402
417
  if formatted.strip("\n") == block.source.strip("\n"):
403
418
  report.already += 1
404
419
  continue
405
- same, why = eq.equivalent(block.source, formatted)
420
+ same, why = eq.equivalent(block.source, formatted, jinja_classes(path))
406
421
  if not same:
407
422
  report.skips.append(Skip(rel, block.lineno, why))
408
423
  continue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-caspian-app",
3
- "version": "1.3.20",
3
+ "version": "1.3.22",
4
4
  "description": "Scaffold a new Caspian project (FastAPI-powered reactive Python framework).",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",