@agence-zef/astro 0.6.0-pilot.0 → 0.6.0-pilot.1
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/components/Image.astro
CHANGED
|
@@ -17,11 +17,13 @@ interface Props {
|
|
|
17
17
|
* priorité (`fetchpriority="high"`). Une seule par page.
|
|
18
18
|
*/
|
|
19
19
|
priority?: boolean;
|
|
20
|
+
/** Qualité de compression (1 à 100, défaut 75 : à l'œil identique, deux à trois fois plus léger). */
|
|
21
|
+
quality?: number;
|
|
20
22
|
/** Largeur affichée (`(min-width: 48rem) 33vw, 100vw`) : active le `srcset`. */
|
|
21
23
|
sizes?: string;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
const { media, class: className, priority = false, sizes } = Astro.props;
|
|
26
|
+
const { media, class: className, priority = false, sizes, quality = 75 } = Astro.props;
|
|
25
27
|
const loading = priority ? "eager" : (Astro.props.loading ?? "lazy");
|
|
26
28
|
const fetchpriority = priority ? "high" : undefined;
|
|
27
29
|
// Proportions réservées même si le CSS du site force `width: auto` (pas de décalage au chargement).
|
|
@@ -53,6 +55,7 @@ const widths =
|
|
|
53
55
|
decoding={priority ? "sync" : "async"}
|
|
54
56
|
sizes={sizes}
|
|
55
57
|
widths={widths}
|
|
58
|
+
quality={quality}
|
|
56
59
|
class={className}
|
|
57
60
|
style={style}
|
|
58
61
|
/>
|
|
@@ -8,11 +8,9 @@ import { CACHE_TAG, PAGE_CACHE } from "./cache";
|
|
|
8
8
|
* assistants IA, avec ses pages et ses collections et leur description.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export const prerender = true;
|
|
12
|
-
|
|
13
11
|
export const GET: APIRoute = async ({ site: astroSite, cache }) => {
|
|
14
12
|
// Rendu à la demande (`rendering: "cached"`) : gardé en cache, invalidé par une publication.
|
|
15
|
-
cache.set({ ...PAGE_CACHE, tags: [CACHE_TAG] });
|
|
13
|
+
if (cache.enabled) cache.set({ ...PAGE_CACHE, tags: [CACHE_TAG] });
|
|
16
14
|
const site = await getClient().site();
|
|
17
15
|
const collections = (config.collections ?? [])
|
|
18
16
|
.filter((c) => c.page)
|
|
@@ -19,7 +19,7 @@ try {
|
|
|
19
19
|
props = await zefRouteProps(path, visitorOf(Astro));
|
|
20
20
|
} catch {
|
|
21
21
|
// CMS injoignable : 503 sans cache, le CDN continue de servir la version qu'il a.
|
|
22
|
-
Astro.cache.set(false);
|
|
22
|
+
if (Astro.cache.enabled) Astro.cache.set(false);
|
|
23
23
|
return new Response("Service momentanément indisponible.", { status: 503 });
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ if (!props) {
|
|
|
29
29
|
.redirects()
|
|
30
30
|
.catch(() => [])
|
|
31
31
|
).find((r) => r.from === path || r.from === path.replace(/\/$/, ""));
|
|
32
|
-
Astro.cache.set({ maxAge: 60, tags: [CACHE_TAG] });
|
|
32
|
+
if (Astro.cache.enabled) Astro.cache.set({ maxAge: 60, tags: [CACHE_TAG] });
|
|
33
33
|
if (redirect) return Astro.redirect(redirect.to, redirect.status === 302 ? 302 : 301);
|
|
34
34
|
return new Response(null, { status: 404 });
|
|
35
35
|
}
|
|
@@ -37,8 +37,7 @@ if (!props) {
|
|
|
37
37
|
const doc = props.kind === "page" ? props.page : props.item;
|
|
38
38
|
const reserved = doc.access?.reserved === true;
|
|
39
39
|
// Le contenu réservé dépend du visiteur : jamais en cache.
|
|
40
|
-
if (
|
|
41
|
-
else Astro.cache.set({ ...PAGE_CACHE, tags: [CACHE_TAG] });
|
|
40
|
+
if (Astro.cache.enabled) Astro.cache.set(reserved ? false : { ...PAGE_CACHE, tags: [CACHE_TAG] });
|
|
42
41
|
|
|
43
42
|
// Site en développement (§ 5.11) : aucune page n'est indexable.
|
|
44
43
|
const seo =
|
|
@@ -8,11 +8,9 @@ import { CACHE_TAG, PAGE_CACHE } from "./cache";
|
|
|
8
8
|
* sitemap est déclaré. Construit avec le site : la mise en ligne relance un build.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export const prerender = true;
|
|
12
|
-
|
|
13
11
|
export const GET: APIRoute = async ({ site: astroSite, cache }) => {
|
|
14
12
|
// Rendu à la demande (`rendering: "cached"`) : gardé en cache, invalidé par une publication.
|
|
15
|
-
cache.set({ ...PAGE_CACHE, tags: [CACHE_TAG] });
|
|
13
|
+
if (cache.enabled) cache.set({ ...PAGE_CACHE, tags: [CACHE_TAG] });
|
|
16
14
|
const site = await getClient().site();
|
|
17
15
|
const body = robotsTxt(site, siteOrigin(site, astroSite?.origin));
|
|
18
16
|
return new Response(body, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
|
|
@@ -8,11 +8,9 @@ import { CACHE_TAG, PAGE_CACHE } from "./cache";
|
|
|
8
8
|
* indexables, chaque langue liée par `xhtml:link`, date de dernière publication.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export const prerender = true;
|
|
12
|
-
|
|
13
11
|
export const GET: APIRoute = async ({ site: astroSite, cache }) => {
|
|
14
12
|
// Rendu à la demande (`rendering: "cached"`) : gardé en cache, invalidé par une publication.
|
|
15
|
-
cache.set({ ...PAGE_CACHE, tags: [CACHE_TAG] });
|
|
13
|
+
if (cache.enabled) cache.set({ ...PAGE_CACHE, tags: [CACHE_TAG] });
|
|
16
14
|
const site = await getClient().site();
|
|
17
15
|
const body = sitemapXml(await zefSiteIndex(config), siteOrigin(site, astroSite?.origin));
|
|
18
16
|
return new Response(body, { headers: { "Content-Type": "application/xml; charset=utf-8" } });
|
package/package.json
CHANGED