vowel 0.1.46 → 0.2.2

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.
Files changed (115) hide show
  1. package/README.md +82 -20
  2. package/bin.js +2 -78
  3. package/docs-source/$features/cards.md +7 -0
  4. package/docs-source/$features/editing.md +7 -0
  5. package/docs-source/$features/emoji.md +7 -0
  6. package/docs-source/$features/frontmatter.md +7 -0
  7. package/docs-source/$features/lists.md +7 -0
  8. package/docs-source/$features/navigation.md +7 -0
  9. package/docs-source/$features/rich-previews.md +7 -0
  10. package/docs-source/$features/robots.md +7 -0
  11. package/docs-source/$features/rss.md +7 -0
  12. package/docs-source/$features/sitemap.md +7 -0
  13. package/docs-source/$features/speed.md +7 -0
  14. package/docs-source/$features/static.md +7 -0
  15. package/docs-source/$features/taxonomies.md +7 -0
  16. package/docs-source/.cache.json +9 -0
  17. package/docs-source/.obsidian/app.json +3 -0
  18. package/docs-source/.obsidian/appearance.json +3 -0
  19. package/docs-source/.obsidian/core-plugins-migration.json +30 -0
  20. package/docs-source/.obsidian/core-plugins.json +20 -0
  21. package/docs-source/.obsidian/workspace.json +168 -0
  22. package/docs-source/.stackblitzrc +3 -0
  23. package/docs-source/.vercel/README.txt +11 -0
  24. package/docs-source/.vercel/project.json +1 -0
  25. package/docs-source/about.md +3 -0
  26. package/docs-source/assets/styles.css +51 -0
  27. package/docs-source/blog/home.md +5 -0
  28. package/docs-source/blog/url-ui.md +21 -0
  29. package/docs-source/docs/.votive.db +0 -0
  30. package/docs-source/docs/deploy.md +67 -0
  31. package/docs-source/docs/file-structure.md +31 -0
  32. package/docs-source/docs/folder-settings.md +23 -0
  33. package/docs-source/docs/home.md +55 -0
  34. package/docs-source/docs/images.md +10 -0
  35. package/docs-source/docs/items.md +13 -0
  36. package/docs-source/docs/pages.md +141 -0
  37. package/docs-source/docs/settings.md +4 -0
  38. package/docs-source/docs/styling.md +34 -0
  39. package/docs-source/docs/taxonomies.md +37 -0
  40. package/docs-source/home.md +42 -0
  41. package/docs-source/roadmap.md +98 -0
  42. package/docs-source/settings.md +12 -0
  43. package/extractDate.js +83 -0
  44. package/getMetadata.js +41 -0
  45. package/index.js +669 -0
  46. package/jsconfig.json +9 -17
  47. package/package.json +61 -63
  48. package/regex.js +36 -0
  49. package/{src/lib/components → stylesheets}/DefaultStyles.css +5 -5
  50. package/utils.js +10 -0
  51. package/.cache.json +0 -1
  52. package/.prettierrc +0 -8
  53. package/.vscode/settings.json +0 -3
  54. package/CHANGELOG.md +0 -79
  55. package/server.js +0 -87
  56. package/src/app.d.ts +0 -12
  57. package/src/app.html +0 -13
  58. package/src/lib/components/Breadcrumbs.svelte +0 -19
  59. package/src/lib/components/ConditionalWrapper.svelte +0 -10
  60. package/src/lib/components/DefaultStyles.svelte +0 -11
  61. package/src/lib/components/FrontMatterTaxonomy.svelte +0 -48
  62. package/src/lib/components/Frontmatter.svelte +0 -56
  63. package/src/lib/components/FrontmatterProperty.svelte +0 -78
  64. package/src/lib/components/Markdown/Image.svelte +0 -50
  65. package/src/lib/components/Markdown/Link.svelte +0 -19
  66. package/src/lib/components/Markdown/LinkPreview.svelte +0 -45
  67. package/src/lib/components/Markdown/Text.svelte +0 -6
  68. package/src/lib/components/Markdown/index.svelte +0 -147
  69. package/src/lib/components/Markdown/validators.js +0 -29
  70. package/src/lib/components/Nav.svelte +0 -40
  71. package/src/lib/components/NoStyles.svelte +0 -5
  72. package/src/lib/components/Page.svelte +0 -90
  73. package/src/lib/components/ResetStyles.svelte +0 -7
  74. package/src/lib/components/Sitemap.svelte +0 -38
  75. package/src/lib/components/TypographyStyles.svelte +0 -10
  76. package/src/lib/components/index.js +0 -12
  77. package/src/lib/index.js +0 -1
  78. package/src/lib/utilities/buildURL.js +0 -18
  79. package/src/lib/utilities/checkFileExists.js +0 -16
  80. package/src/lib/utilities/createFolderClass.js +0 -4
  81. package/src/lib/utilities/createPageClass.js +0 -6
  82. package/src/lib/utilities/getFileLabel.js +0 -35
  83. package/src/lib/utilities/getFolder.js +0 -16
  84. package/src/lib/utilities/getFolderLabel.js +0 -12
  85. package/src/lib/utilities/getMetadata.js +0 -46
  86. package/src/lib/utilities/getPage.js +0 -25
  87. package/src/lib/utilities/getPagesByFolder.js +0 -95
  88. package/src/lib/utilities/index.js +0 -22
  89. package/src/lib/utilities/isActiveLink.js +0 -12
  90. package/src/lib/utilities/isObject.js +0 -8
  91. package/src/lib/utilities/loadCache.js +0 -28
  92. package/src/lib/utilities/mutateMarkdownAST.js +0 -68
  93. package/src/lib/utilities/mutateMarkdownFrontmatter.js +0 -113
  94. package/src/lib/utilities/parseDate.js +0 -43
  95. package/src/lib/utilities/processMarkdownFiles.js +0 -243
  96. package/src/lib/utilities/readMarkdownFile.js +0 -188
  97. package/src/lib/utilities/regexPatterns.js +0 -12
  98. package/src/lib/utilities/resolveHomeDirPath.js +0 -5
  99. package/src/lib/utilities/sendWebmention.js +0 -34
  100. package/src/lib/utilities/writeCache.js +0 -14
  101. package/src/routes/$vowel/published.json/+server.js +0 -54
  102. package/src/routes/+error.svelte +0 -110
  103. package/src/routes/[...path]/+layout.server.js +0 -78
  104. package/src/routes/[...path]/+page.server.js +0 -42
  105. package/src/routes/[...path]/+page.svelte +0 -186
  106. package/src/routes/feed.xml/+server.js +0 -120
  107. package/src/routes/robots.txt/+server.js +0 -54
  108. package/src/routes/sitemap.xml/+server.js +0 -68
  109. package/static/favicon.png +0 -0
  110. package/static/styles.css +0 -0
  111. package/svelte.config.js +0 -30
  112. package/vercel.json +0 -5
  113. package/vite.config.js +0 -84
  114. /package/{src/lib/components → stylesheets}/ResetStyles.css +0 -0
  115. /package/{src/lib/components → stylesheets}/TypographyStyles.css +0 -0
@@ -1,78 +0,0 @@
1
- import { loadCache, writeCache, processMarkdownFiles, readMarkdownFile } from '$lib/utilities';
2
- import { access } from 'fs/promises';
3
- import { constants } from 'fs';
4
- import { normalize, join, basename } from 'path';
5
- import { dev } from '$app/environment';
6
- import mri from 'mri';
7
-
8
- const args = mri(process.argv);
9
- const isBuild = args._.includes('build');
10
-
11
- export const prerender = true;
12
- export const csr = dev;
13
-
14
- let contentCache = false;
15
- // let contentCacheTime = $build[0] ? 600000 : 0;
16
-
17
- async function checkFileExists(filePath, homeDir) {
18
- try {
19
- await access(join(homeDir, filePath), constants.F_OK);
20
- return true;
21
- } catch {
22
- return false;
23
- }
24
- }
25
-
26
-
27
-
28
- /** @type {import('./$types').PageLoad} */
29
- export async function load() {
30
- // const startLoad = performance.now();
31
-
32
- const hotURLCache = await loadCache($home[0]);
33
-
34
- const initialURLCache = JSON.parse(JSON.stringify(hotURLCache));
35
-
36
- const cssExists = await checkFileExists(normalize('/assets/styles.css'), $home[0]);
37
-
38
- // if (cssExists) console.log('Found CSS file at /assets/styles.css');
39
- // else console.log('No CSS file found as /assets/styles.css');
40
-
41
- const faviconExists = await checkFileExists(normalize('/assets/favicon.png'), $home[0]);
42
-
43
- const files = {
44
- css: {
45
- exists: cssExists,
46
- path: join($home[0], 'assets', 'styles.css')
47
- },
48
- favicon: {
49
- exists: faviconExists,
50
- path: join($home[0], 'assets', 'favicon.png')
51
- }
52
- };
53
-
54
-
55
-
56
-
57
- let data = {};
58
-
59
- if (contentCache) {
60
- console.log('Using content cache');
61
- data = contentCache;
62
- } else {
63
- console.log('Not using content cache');
64
- data = await processMarkdownFiles(hotURLCache);
65
- if ($build[0]) contentCache = data;
66
- }
67
-
68
- // const { folder: website, finalCache } = await processMarkdownFiles(initialCache);
69
- const { folder: website } = data;
70
-
71
- if (JSON.stringify(initialURLCache) !== JSON.stringify(hotURLCache)) {
72
- writeCache(hotURLCache, $home[0]);
73
- }
74
-
75
- const folderName = basename($home[0]);
76
-
77
- return { website, homeDir: $home[0], folderName, files, dev };
78
- }
@@ -1,42 +0,0 @@
1
- import { getPagesByFolder, processMarkdownFiles, loadCache } from '../../lib/utilities';
2
-
3
- export const prerender = true;
4
-
5
- function createURL(domain, path) {
6
- try {
7
- return new URL(path, domain)
8
- } catch(e) {
9
- console.error(e)
10
- return ""
11
- }
12
- }
13
-
14
- /** @type {import('./$types').PageLoad} */
15
- export async function load({ params, parent }) {
16
- const { website } = await parent()
17
- const url =createURL(website._.domain, params.path)
18
- // const url = new URL(params.path, website._.domain)
19
-
20
- const webmentionTarget = params.path === "" ? url.origin : url.href
21
-
22
- const webmentions = await (await fetch(`https://webmention.io/api/mentions.jf2?target=${webmentionTarget}`)).json()
23
-
24
- const { path } = params;
25
- const segments = path ? params.path.split('/') : [];
26
-
27
- return { path, segments, webmentions };
28
- }
29
-
30
- export async function entries() {
31
- const initialCache = await loadCache($home[0]);
32
-
33
- const { folder: website } = await processMarkdownFiles(initialCache);
34
-
35
- const pages = getPagesByFolder(website, '/', false).map((page) => {
36
- return { path: page.url?.replace('/', '') };
37
- });
38
-
39
- pages.push({ path: '404' });
40
-
41
- return pages;
42
- }
@@ -1,186 +0,0 @@
1
- <script>
2
- import {
3
- Nav,
4
- Page,
5
- Breadcrumbs,
6
- Sitemap,
7
- ResetStyles,
8
- DefaultStyles,
9
- TypographyStyles,
10
- NoStyles
11
- } from '$lib/components/index.js';
12
- import { getPage, createPageClass } from '$lib/utilities/index.js';
13
- import getFileLabel from '../../lib/utilities/getFileLabel';
14
- import { error } from '@sveltejs/kit';
15
- import { getFolder, getFolderLabel } from '../../lib/utilities';
16
- import { page as pageStore } from '$app/stores';
17
- import { invalidateAll } from '$app/navigation';
18
-
19
- const themes = {
20
- none: NoStyles,
21
- reset: ResetStyles,
22
- typography: TypographyStyles,
23
- default: DefaultStyles
24
- };
25
-
26
- // propData is a workaround due to a seeming bug in Svelte
27
- let { data: propData } = $props();
28
-
29
- const data = $state(JSON.parse(JSON.stringify(propData, null, 2)))
30
-
31
- const { website, folderName } = $derived(data);
32
-
33
- const { slogan, theme } = $derived(website._);
34
-
35
- // Import CSS for HMR in dev mode
36
- if (data.dev && data.files.css.exists) {
37
- import(/* @vite-ignore */ data.files.css.path);
38
- }
39
-
40
- const page = $derived(getPage(website, data.path));
41
-
42
- if (!page || page.url === '/404') {
43
- throw error(404, { message: 'Page not found', ...data });
44
- }
45
-
46
- const websiteTitle = data.website._.title || data.folderName;
47
- const pageMetaTitle = $derived(getFileLabel(page));
48
- const siteTitle = website._.title;
49
-
50
- function getBreadcrumbs(level = 0) {
51
- const path = $pageStore.data.segments.slice(0, level).join('/');
52
- const crumbyPage = getFolder($pageStore.data.website, path);
53
- const folderLabel = getFolderLabel(crumbyPage);
54
- const active = level > $pageStore.data.segments.length;
55
- if (!active) return [folderLabel, ...getBreadcrumbs(level + 1)];
56
- return [];
57
- }
58
-
59
- function makePageMetaTitle() {
60
- if (page.url === '/') {
61
- if (slogan) return `${siteTitle || pageMetaTitle} - ${slogan}`;
62
- return siteTitle || pageMetaTitle;
63
- }
64
-
65
- const breadcrumbs = getBreadcrumbs().slice(1, -1).reverse();
66
- const breadcrumbSegment = breadcrumbs.length ? ` - ${breadcrumbs.join(' - ')} - ` : ' - ';
67
- return `${pageMetaTitle}${breadcrumbSegment}${siteTitle}`;
68
- }
69
-
70
- function getFavicon() {
71
- if (website._?.icon)
72
- return `data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 20 90 60%22><text y=%22.9em%22 font-size=%2290%22>${website._.icon}</text></svg>`;
73
- if (data.files.favicon.exists) return '/favicon.png';
74
- return false;
75
- }
76
-
77
- const favicon = getFavicon();
78
-
79
- $effect(() => {
80
- // Update website on file change
81
- if (import.meta.hot) {
82
- import.meta.hot.on('vowel:update', ({ path, file }) => {
83
- if (path.endsWith('_')) {
84
- invalidateAll().then(() => {
85
- window.location.reload();
86
- });
87
- } else {
88
- let updatedPage = getPage(website, path);
89
- if (!updatedPage) {
90
- invalidateAll().then(() => {
91
- window.location.reload();
92
- });
93
- }
94
-
95
- for (const key in file) {
96
- if (!updatedPage[key]) updatedPage[key] = {};
97
- updatedPage[key] = file[key];
98
- }
99
- }
100
- });
101
- import.meta.hot.on('vowel:refresh', () => {
102
- console.log('Refresh');
103
- invalidateAll().then(() => {
104
- window.location.reload();
105
- });
106
- });
107
- }
108
- });
109
-
110
- function createWebmentionURL() {
111
- try {
112
- if(website._.domain) {
113
- const domain = new URL(website._.domain)
114
- return `https://webmention.io/${domain.host}/webmention`
115
- }
116
- return undefined
117
- } catch(error) {
118
- console.warn(error)
119
- return undefined
120
- }
121
- }
122
- </script>
123
-
124
- <svelte:component this={themes[theme || 'default']} />
125
-
126
- <svelte:head>
127
- <title>{makePageMetaTitle()}</title>
128
- <meta property="”og:url”" content={page.url} />
129
- <meta property="og:site_name" content={website._.title || folderName} />
130
- {#if page.hasOwnProperty('description') || page.imputedProperties?.hasOwnProperty('description')}
131
- <meta
132
- property="og:description"
133
- content={page.description || page.imputedProperties.description}
134
- />
135
- {/if}
136
- {#if favicon}
137
- <link rel="icon" href={favicon} />
138
- {/if}
139
- {#if !data.dev && data.files.css.exists}
140
- <link rel="stylesheet" href="/styles.css" />
141
- {/if}
142
- {#if website._.github}
143
- <link href={`https://github.com/${website._.github}`} rel="me">
144
- {/if}
145
- {#if website._.webmentions && website._.domain}
146
- <link rel="webmention" href={createWebmentionURL()} />
147
- {/if}
148
- {#if page.hasOwnProperty('image') || page.imputedProperties?.hasOwnProperty('image')}
149
- <meta property="og:image" content={page.image.output || page.imputedProperties.image} />
150
- {/if}
151
- </svelte:head>
152
-
153
- <div data-sveltekit-preload-data="hover" class={createPageClass(page.url, 'page')}>
154
- <header>
155
- {#if website._.logo}
156
- <a href="/" class="site-logo">
157
- {#if website._.logo.endsWith('.svg')}
158
- <object type="image/svg+xml" data={website._.logo} title={website._.title || undefined}
159
- ></object>
160
- {:else}
161
- <img alt="website logo" src={website._.logo} />
162
- {/if}
163
- </a>
164
- {/if}
165
- {#if siteTitle}
166
- <a href="/" class="site-title">{siteTitle}</a>
167
- {/if}
168
- {#if website._.slogan}
169
- <p class="slogan">{website._.slogan}</p>
170
- {/if}
171
- <Nav folder={website} segments={data.path.split('/')} />
172
- <nav class="breadcrumbs" aria-label="Breadcrumb">
173
- <Breadcrumbs level={0} />
174
- </nav>
175
- </header>
176
- <main class="h-entry">
177
- <Page level={0} {page} {website} path={data.path} webmentions={data.webmentions} />
178
- </main>
179
- <nav class="sidebar">
180
- <Sitemap section={website} segments={data.path.split('/')} root />
181
- </nav>
182
- <footer>
183
- © {website._.author ? website._.author + ' ' : ''}
184
- {new Date().getFullYear()}
185
- </footer>
186
- </div>
@@ -1,120 +0,0 @@
1
- import xml from 'xml';
2
- import { render } from 'svelte/server';
3
- import Page from './../../lib/components/Page.svelte';
4
- import {
5
- getPagesByFolder,
6
- getFileLabel,
7
- processMarkdownFiles,
8
- loadCache
9
- } from '../../lib/utilities';
10
-
11
- export const prerender = true;
12
-
13
- export async function GET({}) {
14
- /*
15
- It's wasteful to load everything here, but it should only run
16
- once at buildtime, so it's not a significant issue.
17
- */
18
- const initialCache = await loadCache($home[0]);
19
-
20
- const { folder: website } = await processMarkdownFiles(initialCache);
21
-
22
- const allPages = getPagesByFolder(website, '/');
23
-
24
- const sortedPages = allPages.filter((page) => page.hasOwnProperty('date'));
25
-
26
- const site_title = {
27
- title: website._.title || 'Untitled'
28
- };
29
-
30
- const feed = [];
31
-
32
- feed.push({
33
- _attr: {
34
- xmlns: 'http://www.w3.org/2005/Atom'
35
- }
36
- });
37
-
38
- feed.push(site_title);
39
-
40
- if (website._.domain)
41
- feed.push(
42
- {
43
- link: {
44
- _attr: {
45
- rel: 'self',
46
- href: `${website._.domain}/feed`
47
- }
48
- }
49
- },
50
- {
51
- id: 'https://littlefair.ca/feed'
52
- }
53
- );
54
-
55
- if (website._.author)
56
- feed.push(
57
- {
58
- author: {
59
- name: 'Sam Littlefair'
60
- }
61
- },
62
- { rights: `Copyright (c) ${new Date().getFullYear()} Sam Littlefair` }
63
- );
64
-
65
- feed.push(
66
- ...sortedPages.map((page) => {
67
- const url = website._.domain ? website._.domain + page.url : 'undefined';
68
- const entry = [
69
- {
70
- title: getFileLabel(page)
71
- },
72
- {
73
- link: {
74
- _attr: {
75
- rel: 'alternate',
76
- href: url
77
- }
78
- }
79
- },
80
- { id: url },
81
- { updated: page.date }
82
- ];
83
-
84
- if (page.description) {
85
- entry.push({
86
- summary: page.description
87
- });
88
- }
89
-
90
- if (page.author) {
91
- entry.push({
92
- author: {
93
- name: page.author
94
- }
95
- });
96
- }
97
-
98
- entry.push({
99
- content: [
100
- { _attr: { type: 'html' } },
101
- render(Page, { props: { page, level: 0, format: 'rss' } }).html
102
- ]
103
- });
104
-
105
- return {
106
- entry
107
- };
108
- })
109
- );
110
-
111
- const headers = {
112
- 'Cache-Control': 'max-age=0, s-maxage=3600',
113
- 'Content-Type': 'text/xml'
114
- };
115
-
116
- const response = new Response(`<?xml version="1.0" encoding="utf-8"?>` + xml({ feed }, true), {
117
- headers
118
- });
119
- return response;
120
- }
@@ -1,54 +0,0 @@
1
- import { processMarkdownFiles, loadCache } from '../../lib/utilities';
2
-
3
- /*
4
- TODO: Will this work at this location? Otherwise, figure out how to move it.
5
- */
6
-
7
- const allow = `Allow: /`;
8
- const disallow = `Disallow: /`;
9
-
10
- const google_images = `User-agent: Googlebot-Image`;
11
-
12
- const google_general = `User-agent: Google-Extended`;
13
-
14
- const gpt_bot = `User-agent: GPTBot`;
15
-
16
- const gpt_user = `User-agent: ChatGPT-User`;
17
-
18
- const common_crawl = `User-agent: CCBot`;
19
-
20
- export const prerender = true;
21
-
22
- export async function GET({}) {
23
- /*
24
- It's wasteful to load everything here, but it should only run
25
- once at buildtime, so it's not a significant issue.
26
- */
27
- const initialCache = await loadCache($home[0]);
28
-
29
- const { folder: website } = await processMarkdownFiles(initialCache);
30
-
31
- const declarations = [];
32
-
33
- declarations.push(
34
- google_general + '\n' + (website._.robots?.google === false ? disallow : allow)
35
- );
36
- declarations.push(
37
- google_images + '\n' + (website._.robots?.google_images === false ? disallow : allow)
38
- );
39
- declarations.push(gpt_bot + '\n' + (website._.robots?.ai === false ? disallow : allow));
40
- declarations.push(gpt_user + '\n' + (website._.robots?.ai === false ? disallow : allow));
41
- declarations.push(common_crawl + '\n' + (website._.robots?.ai === false ? disallow : allow));
42
-
43
- const text = declarations.join('\n\n') || '';
44
-
45
- const headers = {
46
- 'Cache-Control': 'max-age=0, s-maxage=3600',
47
- 'Content-Type': 'text/plain'
48
- };
49
-
50
- const response = new Response(text, {
51
- headers
52
- });
53
- return response;
54
- }
@@ -1,68 +0,0 @@
1
- import { getPagesByFolder, processMarkdownFiles, loadCache } from '../../lib/utilities';
2
-
3
- export const prerender = true;
4
-
5
- export async function GET({}) {
6
- const fallback = {
7
- folder: {}
8
- };
9
-
10
- const initialCache = await loadCache($home[0]);
11
-
12
- const { folder: website } = await processMarkdownFiles(initialCache);
13
-
14
- const pages = getPagesByFolder(website, '/');
15
-
16
- const site_title = {
17
- title: website._.title || 'Untitled'
18
- };
19
-
20
- const domain = website._.domain || false;
21
-
22
- function createEntry(page) {
23
- return `
24
- <url>
25
- <loc>${new URL(page.url || '/', domain)}</loc>
26
- <changefreq>daily</changefreq>
27
- <priority>0.7</priority>
28
- </url>
29
- `;
30
- }
31
-
32
- function createSitemap(pages, domain) {
33
- return `<?xml version="1.0" encoding="UTF-8" ?>
34
- <urlset
35
- xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
36
- xmlns:news="https://www.google.com/schemas/sitemap-news/0.9"
37
- xmlns:xhtml="https://www.w3.org/1999/xhtml"
38
- xmlns:mobile="https://www.google.com/schemas/sitemap-mobile/1.0"
39
- xmlns:image="https://www.google.com/schemas/sitemap-image/1.1"
40
- xmlns:video="https://www.google.com/schemas/sitemap-video/1.1"
41
- >
42
- <url>
43
- <loc>${domain}</loc>
44
- <changefreq>daily</changefreq>
45
- <priority>0.7</priority>
46
- </url>
47
- ${pages.map(createEntry).join('')}
48
- </urlset>
49
- `;
50
- }
51
-
52
- function createFallBackSitemap() {
53
- return `<?xml version="1.0" encoding="UTF-8" ?><message>Specify a 'domain' in /settings.md</message>`;
54
- }
55
-
56
- const sitemap = domain ? createSitemap(pages, domain) : createFallBackSitemap();
57
-
58
- const headers = {
59
- 'Cache-Control': 'max-age=0, s-maxage=3600',
60
- 'Content-Type': 'text/xml'
61
- };
62
-
63
- const response = new Response(sitemap, {
64
- headers
65
- });
66
-
67
- return response;
68
- }
Binary file
package/static/styles.css DELETED
File without changes
package/svelte.config.js DELETED
@@ -1,30 +0,0 @@
1
- import adapter from '@sveltejs/adapter-static';
2
- import path, { join } from 'path';
3
- import mri from 'mri';
4
-
5
- const args = mri(process.argv);
6
- const homeDir = args.directory;
7
- const relativePathToHome = path.relative(process.cwd(), homeDir || '/');
8
-
9
- /** @type {import('@sveltejs/kit').Config} */
10
- const config = {
11
- kit: {
12
- // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
13
- // If your environment is not supported or you settled on a specific environment, switch out the adapter.
14
- // See https://kit.svelte.dev/docs/adapters for more information about adapters.
15
- adapter: adapter({
16
- pages: join(relativePathToHome, '.output'),
17
- assets: join(relativePathToHome, '.output'),
18
- strict: false
19
- }),
20
- files: {
21
- assets: join(relativePathToHome, 'assets')
22
- },
23
- prerender: {
24
- handleHttpError: 'warn',
25
- entries: ['*', '/', '/robots.txt', '/sitemap.xml', '/feed.xml', '/404']
26
- }
27
- }
28
- };
29
-
30
- export default config;
package/vercel.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "cleanUrls": true,
3
- "outputDirectory": ".output",
4
- "buildCommand": null
5
- }
package/vite.config.js DELETED
@@ -1,84 +0,0 @@
1
- import { sveltekit } from '@sveltejs/kit/vite';
2
- import { defineConfig } from 'vite';
3
- import path from 'path';
4
- import { readMarkdownFile, loadCache } from './src/lib/utilities/index';
5
- import mri from 'mri';
6
-
7
- const args = mri(process.argv);
8
-
9
- const demoDir = process.cwd() + '/content';
10
- const NPMRunDev = process.argv[2] === 'dev';
11
- const isBuild = process.argv[2] === 'build';
12
- const receivedHomePath = NPMRunDev || isBuild ? false : args.directory;
13
-
14
- const homeDir = receivedHomePath || demoDir;
15
-
16
- const $home = [homeDir];
17
-
18
- export default defineConfig({
19
- plugins: [
20
- sveltekit(),
21
- {
22
- // Hot reload markdown
23
- name: 'markdown:watch',
24
- configureServer(server) {
25
- server.watcher.add(homeDir);
26
- server.watcher.on('add', () => {
27
- server.ws.send('vowel:refresh');
28
- });
29
- server.watcher.on('unlink', () => {
30
- server.ws.send('vowel:refresh');
31
- });
32
- server.watcher.on('change', async (homePath, stats) => {
33
- if (homePath.endsWith('.md')) {
34
- // Remove `.md`
35
- const cache = await loadCache(homeDir);
36
- const file = await readMarkdownFile(homePath, cache);
37
- Object.assign(file, file.frontmatter);
38
- const relativePath = path
39
- .relative(homeDir, homePath)
40
- .slice(0, -3)
41
- .replace(/\/?(home)$/, '')
42
- .replace(/\/?(settings)$/, '_');
43
- server.ws.send('vowel:update', {
44
- path: relativePath,
45
- stats,
46
- file
47
- });
48
- }
49
- });
50
- }
51
- }
52
- ],
53
- define: { $home },
54
- optimizeDeps: {
55
- exclude: ['svelte', 'remark', 'remark-frontmatter', 'remark-html'],
56
- include: [
57
- 'micromark',
58
- 'unified',
59
- 'fault',
60
- 'url-metadata',
61
- 'any-date-parser',
62
- 'any-date-parser/src/formats/ago/ago.js',
63
- 'any-date-parser/src/formats/ago/ago.js',
64
- 'any-date-parser/src/formats/chinese/chinese.js',
65
- 'any-date-parser/src/formats/dayMonth/dayMonth.js',
66
- 'any-date-parser/src/formats/dayMonthname/dayMonthname.js',
67
- 'any-date-parser/src/formats/monthDay/monthDay.js',
68
- 'any-date-parser/src/formats/monthnameDay/monthnameDay.js',
69
- 'any-date-parser/src/formats/today/today.js'
70
- ]
71
- },
72
- server: {
73
- fs: {
74
- strict: false,
75
- allow: homeDir
76
- },
77
- hmr: {
78
- overlay: false
79
- }
80
- },
81
- resolve: {
82
- // extensions: ['.css']
83
- }
84
- });