fastapi-vue-setup 1.4.2 upgrade

This commit is contained in:
2026-09-03 17:40:55 +00:00
parent 4c6ab3dde6
commit 792b9e7aa9
3 changed files with 14 additions and 11 deletions
+12 -2
View File
@@ -30,18 +30,28 @@ walking the tree (``resolve``), moves are slot detach/attach
import asyncio
import logging
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from pathlib import Path
from fastapi import FastAPI, Request
from fastapi.responses import Response
from fastapi_vue import Frontend
from pagerite import api, files, pages, tracking
from pagerite.__main__ import DEVMODE
from pagerite.files import file_store
from pagerite.state import analytics_store, config, frontend, kanta
from collections.abc import AsyncGenerator
from pagerite.state import analytics_store, config, kanta
logger = logging.getLogger(__name__)
# Vue build served at the site root, no SPA catch-all (assets only). The
# build mirrors the URL space: hashed, immutable files live under
# /_assets/ (assetsDir: '_/assets'), the favicon at /favicon.ico.
frontend = Frontend(
Path(__file__).with_name("frontend-build"), spa=False, cached="/_assets/"
)
@asynccontextmanager
async def lifespan(_app: FastAPI) -> AsyncGenerator:
+1 -8
View File
@@ -3,7 +3,7 @@
Everything the route modules (files, api, tracking, pages) need that is not
a route itself: environment-derived paths and tunables, the ``Data`` root
with its ``Kanta`` handle (migrations in pagerite.migrations), the analytics
store, the fastapi-vue ``Frontend``, the page render cache
store, the page render cache
(``_render_html``/``_cached_body``/``_html_response`` plus the
``_render_gen`` ETag generation, bumped by ``_invalidate_pages`` on every
content/settings write), the translator ``dispatcher``, the slug charset
@@ -22,7 +22,6 @@ from pathlib import Path
import blake3
from fastapi import HTTPException, Request
from fastapi.responses import Response
from fastapi_vue import Frontend
from kanta import Kanta
from zstandard import ZstdCompressor
@@ -80,12 +79,6 @@ FAVICON_MAXSIZE = 192
data = Data()
kanta = Kanta(DB_PATH, data, migrations="pagerite.migrations")
# Vue build served at the site root, no SPA catch-all (assets only). The
# build mirrors the URL space: hashed, immutable files live under
# /_assets/ (assetsDir: '_/assets'), the favicon at /favicon.ico.
BUILD_DIR = Path(__file__).with_name("frontend-build")
frontend = Frontend(BUILD_DIR, spa=False, cached="/_assets/")
# Dynamic HTML is compressed per request at level 9 (static assets are
# already pre-compressed by fastapi-vue's Frontend).
_zstd = ZstdCompressor(9)