astro-accelerator 7.1.28 → 7.1.30

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.1.28",
2
+ "version": "7.1.30",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -8,7 +8,6 @@
8
8
  "themes"
9
9
  ],
10
10
  "type": "module",
11
- "packageManager": "pnpm@12.6.0",
12
11
  "engines": {
13
12
  "node": ">=24",
14
13
  "pnpm": ">=10"
@@ -37,21 +36,21 @@
37
36
  },
38
37
  "dependencies": {
39
38
  "@astrojs/markdown-remark": "^7.3.1",
40
- "@astrojs/mdx": "^8.0.1",
41
- "@img/sharp-linux-x64": "^0.35.4",
42
- "astro": "^7.3.3",
39
+ "@astrojs/mdx": "^8.0.2",
40
+ "@img/sharp-linux-x64": "^0.35.5",
41
+ "astro": "^7.3.5",
43
42
  "astro-accelerator-utils": "^0.3.111",
44
- "csv": "^6.6.3",
43
+ "csv": "^6.6.4",
45
44
  "hast-util-from-selector": "^3.0.1",
46
45
  "html-to-text": "^10.0.1",
47
46
  "keyword-extractor": "^0.3.0",
48
47
  "optional": "^0.1.4",
49
48
  "remark-directive": "^4.0.0",
50
- "sharp": "^0.35.4"
49
+ "sharp": "^0.35.5"
51
50
  },
52
51
  "devDependencies": {
53
52
  "@playwright/test": "^1.63.0",
54
- "cspell": "^10.3.3",
53
+ "cspell": "^10.3.5",
55
54
  "glob": "^13.0.6",
56
55
  "linkinator": "^8.1.0",
57
56
  "rimraf": "^6.1.3"
@@ -90,12 +89,5 @@
90
89
  "public/icons/**/*",
91
90
  "public/css/*",
92
91
  "public/js/*"
93
- ],
94
- "pnpm": {
95
- "overrides": {
96
- "postcss@<8.4.31": ">=8.4.31",
97
- "vite@<=5.0.11": ">=5.0.12",
98
- "zod@<=3.22.2": ">=3.22.3"
99
- }
100
- }
92
+ ]
101
93
  }
@@ -38,6 +38,7 @@ type Article = {
38
38
  title: string;
39
39
  frontmatter: Record<string, any>;
40
40
  img: ImageInfo | null;
41
+ imageAlt: string;
41
42
  };
42
43
 
43
44
  const articles: Article[] = [];
@@ -47,9 +48,10 @@ for (let p of posts.filter(PostFiltering.isListable)) {
47
48
  url: p.url ?? "",
48
49
  title: await accelerator.markdown.getTextFrom(p.frontmatter?.title),
49
50
  frontmatter: p.frontmatter,
50
- img: p.frontmatter.bannerImage
51
+ img: p.frontmatter.bannerImage?.src
51
52
  ? getImageInfo(p.frontmatter.bannerImage.src, "", SITE.images.listerSize)
52
53
  : null,
54
+ imageAlt: p.frontmatter.bannerImage?.alt ?? "",
53
55
  };
54
56
 
55
57
  articles.push(item);
@@ -70,7 +72,7 @@ stats.stop();
70
72
  <li
71
73
  class="list-item"
72
74
  data-destination={accelerator.urlFormatter.formatAddress(post.url)}
73
- data-image={(post.frontmatter.bannerImage?.src.length > 0).toString()}>
75
+ data-image={Boolean(post.img).toString()}>
74
76
  <article>
75
77
  <div class="list-item-image">
76
78
  {post.img && (
@@ -78,7 +80,7 @@ stats.stop();
78
80
  srcset={post.img.srcset}
79
81
  sizes={post.img.sizes}
80
82
  src={post.img.src}
81
- alt={post.frontmatter.bannerImage.alt}
83
+ alt={post.imageAlt}
82
84
  class={post.img.class}
83
85
  width={post.img.metadata?.width}
84
86
  height={post.img.metadata?.height}
@@ -25,20 +25,25 @@ const _ = Lang(lang);
25
25
  const authorList = accelerator.authors.forPost(frontmatter);
26
26
 
27
27
  // Get image info
28
- const authorImage = authorList?.image?.src
28
+ const authorImage = authorList?.image?.src
29
29
  ? getImageInfo(authorList.image.src, 'author-image', SITE.images.authorSize)
30
30
  : null;
31
31
 
32
32
  const canonical = frontmatter.meta?.find(
33
33
  (meta) => meta.name.toLowerCase() === 'canonical',
34
34
  )?.content;
35
- const canonicalDomain = canonical ? new URL(canonical).hostname : undefined;
35
+ let canonicalDomain: string | undefined;
36
+ try {
37
+ canonicalDomain = canonical ? new URL(canonical).hostname : undefined;
38
+ } catch {
39
+ canonicalDomain = undefined;
40
+ }
36
41
 
37
42
  stats.stop();
38
43
  ---
39
- {authorList.writers.length > 0 &&
44
+ {authorList.writers.length > 0 &&
40
45
  <div class="post-meta">
41
- {authorImage &&
46
+ {authorImage &&
42
47
  <img
43
48
  srcset={ authorImage.srcset }
44
49
  sizes={ authorImage.sizes }
@@ -64,7 +69,7 @@ stats.stop();
64
69
  { _(Translations.post.last_modified) + ' ' + accelerator.dateFormatter.formatDate(frontmatter.modDate, lang) }
65
70
  </time>
66
71
  }
67
- {canonical &&
72
+ {canonicalDomain &&
68
73
  <br /><span set:html={ _(Translations.post.originally_published).replace('{link}', `<a href="${canonical}">${canonicalDomain}</a>`) }></span>
69
74
  }
70
75
  {authorList.mainAuthor &&
@@ -73,4 +78,4 @@ stats.stop();
73
78
  </div>
74
79
  </div>
75
80
  </div>
76
- }
81
+ }
@@ -37,7 +37,12 @@ const authorImage = authorList?.image?.src
37
37
  const canonical = frontmatter.meta?.find(
38
38
  (meta) => meta.name.toLowerCase() === "canonical",
39
39
  )?.content;
40
- const canonicalDomain = canonical ? new URL(canonical).hostname : undefined;
40
+ let canonicalDomain: string | undefined;
41
+ try {
42
+ canonicalDomain = canonical ? new URL(canonical).hostname : undefined;
43
+ } catch {
44
+ canonicalDomain = undefined;
45
+ }
41
46
 
42
47
  stats.stop();
43
48
  ---
@@ -87,7 +92,7 @@ stats.stop();
87
92
  )}
88
93
  />
89
94
  <ReadingTime lang={lang} frontmatter={frontmatter} />
90
- {canonical && (
95
+ {canonicalDomain && (
91
96
  <span
92
97
  class="originally-published"
93
98
  set:html={_(
@@ -26,7 +26,7 @@ const _ = Lang(lang);
26
26
  const currentUrl = new URL(Astro.request.url);
27
27
  const navPages = accelerator.navigation.breadcrumbs(currentUrl, SITE.subfolder, breadcrumbs?.length ?? 0);
28
28
 
29
- let metaIndex = navPages.length;
29
+ let metaIndex = navPages.length + 1;
30
30
 
31
31
  stats.stop();
32
32
  ---
@@ -36,7 +36,7 @@ stats.stop();
36
36
  {
37
37
  navPages.map((page, index) => (
38
38
  <li property="itemListElement" typeof="ListItem">
39
- <meta property="position" content={index.toString()} />
39
+ <meta property="position" content={(index + 1).toString()} />
40
40
  <a property="item" typeof="WebPage" href={accelerator.urlFormatter.formatAddress(page.url)} aria-current={page.ariaCurrent ? page.ariaCurrent : null} rel={page.rel}>
41
41
  <span property="name">{page.title}</span></a>
42
42
  </li>
@@ -36,7 +36,7 @@ stats.stop();
36
36
  <h2 class="site-nav-title">{_(Translations.navigation.title)}</h2>
37
37
  <ul>
38
38
  {
39
- pages
39
+ [...pages]
40
40
  .sort((a, b) => a.order - b.order)
41
41
  .map((page) => <NavigationItem lang={lang} page={page} />)
42
42
  }
@@ -35,7 +35,7 @@ stats.stop();
35
35
  <h2 class="site-nav-title">{_(Translations.navigation.title)}</h2>
36
36
  <ul>
37
37
  {
38
- pages
38
+ [...pages]
39
39
  .sort((a, b) => a.order - b.order)
40
40
  .map((page) => (
41
41
  <li>
@@ -33,7 +33,7 @@ stats.stop();
33
33
  <details class="sub-nav" open={ page.isOpen }>
34
34
  <summary><span>{ page.section }</span></summary>
35
35
  <ul>
36
- { page.children.sort((a, b) => a.order - b.order).map((page) => (
36
+ { [...page.children].sort((a, b) => a.order - b.order).map((page) => (
37
37
  <Astro.self lang={ lang } page={ page } />
38
38
  ))}
39
39
  </ul>
@@ -24,8 +24,9 @@ const accelerator = new Accelerator(SITE);
24
24
  {showSearch &&
25
25
  <form method="GET" action={SITE.search.fallbackUrl ?? "https://www.google.com/search"} role="search" autocomplete="off" data-sourcedata={SITE.subfolder + "/search.json"}>
26
26
  <fieldset>
27
- <input type="hidden" name={SITE.search.fallbackSite ?? "q"} value={"site:" + siteUrl} />
28
- <input type="text" name={SITE.search.fallbackSite ?? "q"} class="site-search-query" placeholder={_(Translations.search.search_for)} spellcheck="true" autocomplete="off" autofocus="autofocus" />
27
+ <input type="hidden" name={SITE.search.fallbackQuery ?? "q"} value={"site:" + siteUrl} />
28
+ <label class="visually-hidden" for="site-search-query">{_(Translations.search.search_for)}</label>
29
+ <input id="site-search-query" type="text" name={SITE.search.fallbackQuery ?? "q"} class="site-search-query" placeholder={_(Translations.search.search_for)} spellcheck="true" autocomplete="off" />
29
30
  <button type="submit" set:html={_(Translations.search.submit)}></button>
30
31
  </fieldset>
31
32
  </form>
@@ -39,13 +39,12 @@ stats.stop();
39
39
  autocomplete="off"
40
40
  data-sourcedata={SITE.subfolder + '/search.json'}>
41
41
  <fieldset>
42
- <input type="hidden" name={SITE.search.fallbackSite ?? 'q'} value={'site:' + siteUrl} />
42
+ <input type="hidden" name={SITE.search.fallbackQuery ?? 'q'} value={'site:' + siteUrl} />
43
43
  <div>
44
44
  <label for="site-search-query">{_(Translations.search.search_for)}</label>
45
45
  <input
46
- autofocus="autofocus"
47
46
  type="text"
48
- name={SITE.search.fallbackSite ?? 'q'}
47
+ name={SITE.search.fallbackQuery ?? 'q'}
49
48
  id="site-search-query"
50
49
  spellcheck="true"
51
50
  autocomplete="off"
@@ -9,6 +9,8 @@ import fs from 'fs';
9
9
  import path from 'path';
10
10
  import sharp from 'sharp';
11
11
 
12
+ const quality = 70;
13
+
12
14
  const workingDirectory = process.cwd();
13
15
 
14
16
  const imageSize = await import(
@@ -128,12 +130,12 @@ for (const file of filesToProcess) {
128
130
  break;
129
131
  case '.webp':
130
132
  sharp(source)
131
- .webp({ quality: 80 })
133
+ .webp({ quality: quality })
132
134
  .toFile(destination + '.webp');
133
135
  break;
134
136
  case '.avif':
135
137
  sharp(source)
136
- .avif({ quality: 80 })
138
+ .avif({ quality: quality })
137
139
  .toFile(destination + '.avif');
138
140
  break;
139
141
  }
@@ -159,18 +161,17 @@ for (const file of filesToProcess) {
159
161
  await createDestinationFolder(resizeDestination);
160
162
 
161
163
  const metadata = await sharp(source).metadata();
162
- const avifQuality = 80;
163
164
 
164
165
  if (metadata.width > size[key]) {
165
166
  // Only resize if the image is larger than the target size
166
167
  sharp(source)
167
168
  .resize(size[key], null)
168
- .avif({ quality: avifQuality })
169
+ .avif({ quality: quality })
169
170
  .toFile(resizeDestination + '.avif');
170
171
  } else {
171
172
  // Don't resize as it's smaller than target size
172
173
  sharp(source)
173
- .avif({ quality: avifQuality })
174
+ .avif({ quality: quality })
174
175
  .toFile(resizeDestination + '.avif');
175
176
  }
176
177
  }
File without changes
File without changes
File without changes
File without changes