vowel 0.1.20 → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vowel",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "bin": "./bin.js",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -269,6 +269,10 @@
269
269
  order: -1;
270
270
  }
271
271
 
272
+ article.thumbnail dl.link {
273
+ display: none;
274
+ }
275
+
272
276
  aside.note {
273
277
  &.note {
274
278
  --icon: 'ℹ️';
@@ -24,7 +24,8 @@
24
24
  'date',
25
25
  'image',
26
26
  'breadcrumb',
27
- 'imputedProperties'
27
+ 'imputedProperties',
28
+ 'toc'
28
29
  ];
29
30
 
30
31
  // const { website } = $page.data;
@@ -1,10 +1,10 @@
1
1
  <script>
2
2
  let { metadata, url, format } = $props();
3
- let { image, description, author } = $derived(metadata || {});
3
+ let { image, description, og_description, author } = $derived(metadata || {});
4
4
 
5
- const href = $derived(metadata?.ogURL || metadata?.canonicalURL || url || '');
5
+ const href = $derived(metadata?.og_url || metadata?.canonical || url || '');
6
6
 
7
- const title = $derived(metadata?.ogTitle || metadata?.title || '');
7
+ const title = $derived(metadata?.og_title || metadata?.title || '');
8
8
 
9
9
  const urlObject = new URL(url);
10
10
  </script>
@@ -24,9 +24,9 @@
24
24
  By {author}
25
25
  </p>
26
26
  {/if}
27
- {#if description}
27
+ {#if description || og_description}
28
28
  <p>
29
- {description}
29
+ {description || og_description}
30
30
  </p>
31
31
  {/if}
32
32
  </a>
@@ -81,15 +81,29 @@ export default async function mutateMarkdownFrontmatter(frontmatter, cache) {
81
81
  includeResponseBody: false,
82
82
  ensureSecureImageRequest: true
83
83
  });
84
- cache[input] = metadata;
84
+
85
+ const selectedMetadata = {
86
+ url: metadata.url,
87
+ canonical: metadata.canonical,
88
+ title: metadata.title,
89
+ image: metadata.image,
90
+ favicons: url.favicons,
91
+ og_url: url['og:url'],
92
+ og_title: url['og:title'],
93
+ og_description: url['og:description'],
94
+ og_site_name: url['og:side_name'],
95
+ og_image: url['og:image']
96
+ };
97
+
98
+ cache[input] = selectedMetadata;
85
99
 
86
100
  frontmatter[key] = {
87
101
  type: 'url',
88
- output: metadata,
102
+ output: selectedMetadata,
89
103
  input
90
104
  };
91
105
  } catch (e) {
92
- // console.error(`Error on URL in frontmatter: ${frontmatter[key]}`);
106
+ console.error(`Error on URL in frontmatter: ${frontmatter[key]}`);
93
107
  frontmatter[key] = {
94
108
  type: 'string',
95
109
  output: input,
@@ -2,6 +2,7 @@ import fs from 'fs/promises';
2
2
  import { resolveHomeDirPath } from '.';
3
3
 
4
4
  export default async function writeCache(data, homeDir) {
5
+ console.log({ data });
5
6
  const cachePath = resolveHomeDirPath('.cache.json', homeDir);
6
7
 
7
8
  try {
@@ -29,7 +29,9 @@ async function checkFileExists(filePath, homeDir) {
29
29
  export async function load() {
30
30
  // const startLoad = performance.now();
31
31
 
32
- const initialURLCache = await loadCache($home[0]);
32
+ const hotURLCache = await loadCache($home[0]);
33
+
34
+ const initialURLCache = JSON.parse(JSON.stringify(hotURLCache));
33
35
 
34
36
  const cssExists = await checkFileExists(normalize('/assets/styles.css'), $home[0]);
35
37
 
@@ -56,15 +58,15 @@ export async function load() {
56
58
  data = contentCache;
57
59
  } else {
58
60
  console.log('Not using content cache');
59
- data = await processMarkdownFiles(initialURLCache);
61
+ data = await processMarkdownFiles(hotURLCache);
60
62
  if ($build[0]) contentCache = data;
61
63
  }
62
64
 
63
65
  // const { folder: website, finalCache } = await processMarkdownFiles(initialCache);
64
- const { folder: website, finalCache } = data;
66
+ const { folder: website } = data;
65
67
 
66
- if (JSON.stringify(initialURLCache) !== JSON.stringify(finalCache)) {
67
- writeCache(finalCache, $home[0]);
68
+ if (JSON.stringify(initialURLCache) !== JSON.stringify(hotURLCache)) {
69
+ writeCache(hotURLCache, $home[0]);
68
70
  }
69
71
 
70
72
  // console.log(`Load time: ${(performance.now() - startLoad).toFixed(2)} ms`);
@@ -19,5 +19,9 @@ export async function entries() {
19
19
  return { path: page.url?.replace('/', '') };
20
20
  });
21
21
 
22
+ pages.push({ path: '404' });
23
+
24
+ console.log({ pages });
25
+
22
26
  return pages;
23
27
  }
@@ -27,8 +27,6 @@
27
27
 
28
28
  const { website, folderName } = $derived(data);
29
29
 
30
- throw error(404, { message: 'Page not found', ...data });
31
-
32
30
  const { slogan, theme } = $derived(website._);
33
31
 
34
32
  // Import CSS for HMR in dev mode
@@ -38,8 +36,8 @@
38
36
 
39
37
  const page = $derived(getPage(website, data.path));
40
38
 
41
- if (!page) {
42
- error(404, 'Page not found');
39
+ if (!page || page.url === '/404') {
40
+ throw error(404, { message: 'Page not found', ...data });
43
41
  }
44
42
 
45
43
  const websiteTitle = data.website._.title || data.folderName;
package/svelte.config.js CHANGED
@@ -22,7 +22,7 @@ const config = {
22
22
  },
23
23
  prerender: {
24
24
  handleHttpError: 'warn',
25
- entries: ['*', '/', '/robots.txt', '/sitemap.xml', '/feed.xml']
25
+ entries: ['*', '/', '/robots.txt', '/sitemap.xml', '/feed.xml', '/404']
26
26
  }
27
27
  }
28
28
  };