Skip to content

Commit a818a4c

Browse files
committed
build: update to lume v2.2.3
1 parent 581bfcc commit a818a4c

File tree

34 files changed

+183
-209
lines changed

34 files changed

+183
-209
lines changed

.github/workflows/deploy-site.yml

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ concurrency:
1010
group: ${{ github.workflow }}-${{ github.ref }}
1111
cancel-in-progress: true
1212

13+
env:
14+
BUILD_MODE: prod
15+
1316
jobs:
1417
test:
1518
name: Run tests

_config.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import { config } from './_build.ts'
22

33
import lume from 'lume/mod.ts'
44
import date from 'lume/plugins/date.ts'
5+
import feed from 'lume/plugins/feed.ts'
56
import inline from 'lume/plugins/inline.ts'
67
import jsx from 'lume/plugins/jsx_preact.ts'
7-
import unified from 'lume/plugins/remark.ts'
8+
import remark from 'lume/plugins/remark.ts'
89
import sass from 'lume/plugins/sass.ts'
910
import sitemap from 'lume/plugins/sitemap.ts'
1011
import slugify_urls from 'lume/plugins/slugify_urls.ts'
1112
import terser from 'lume/plugins/terser.ts'
1213

13-
import atomFeed from '#plugins/atom-feed/mod.ts'
1414
import md5CacheBuster from '#plugins/md5-cache-buster/mod.ts'
1515
import rehypePlugins from '#plugins/unified/rehype/mod.ts'
1616
import remarkPlugins from '#plugins/unified/remark/mod.ts'
@@ -39,16 +39,18 @@ site
3939
'@': '',
4040
},
4141
}))
42-
.use(unified({
43-
remarkPlugins,
44-
rehypePlugins,
45-
}))
42+
.use(remark(
43+
{
44+
remarkPlugins,
45+
rehypePlugins,
46+
},
47+
))
4648
.use(jsx())
4749
.use(sass())
4850
.loadAssets(['.js'])
4951
.use(terser())
5052
.use(inline())
51-
.use(atomFeed())
53+
.use(feed())
5254
.use(sitemap({
5355
query: 'indexable=true',
5456
}))

deno.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
"importMap": "import_map.json",
33
"compilerOptions": {
44
"jsx": "react-jsx",
5-
"jsxImportSource": "npm:preact"
5+
"jsxImportSource": "npm:preact",
6+
"types": [
7+
"lume/types.ts"
8+
]
69
},
710
"tasks": {
811
"clean": "rm -rf ./_site",
@@ -17,10 +20,6 @@
1720
"rules": {
1821
"tags": [
1922
"recommended"
20-
],
21-
"exclude": [
22-
"no-explicit-any",
23-
"no-unused-vars"
2423
]
2524
}
2625
},

import_map.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"imports": {
3-
"lume/": "https://deno.land/x/lume@v1.19.4/",
3+
"lume/": "https://deno.land/x/lume@v2.2.3/",
44
"#plugins/": "./plugins/",
55
"#types": "./src/_includes/types.ts",
66
"#utils": "./src/_includes/utils/index.ts"

plugins/_deprecated/atom-feed/deps.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// @ts-nocheck
2+
// deno-lint-ignore-file -- The plugin is deprecated in favour of: https://lume.land/plugins/sitemap/
3+
4+
export * as XMLFormat from 'npm:[email protected]'

plugins/atom-feed/mod.ts renamed to plugins/_deprecated/atom-feed/mod.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// @ts-nocheck
2+
// deno-lint-ignore-file -- The plugin is deprecated in favour of: https://lume.land/plugins/sitemap/
3+
14
import { Page } from 'lume/core/filesystem.ts'
25
import { buildSort } from 'lume/core/searcher.ts'
36
import { merge } from 'lume/core/utils.ts'

plugins/unified/rehype/slug.ts renamed to plugins/_deprecated/rehype-slug/mod.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// @ts-nocheck
2+
// deno-lint-ignore-file -- The plugin is deprecated in favour of: https://www.npmjs.com/package/rehype-slug-anchor-sectionize
13
import type { Element, Root } from 'npm:@types/[email protected]'
24
import {
35
findAfter,
@@ -6,7 +8,7 @@ import {
68
toString as hastToString,
79
unified,
810
visit,
9-
} from '../deps.ts'
11+
} from '../../unified/deps.ts'
1012

1113
export interface RehypeSlugAnchorSectionizeOptions {
1214
/** The heading level depth to sectionize. defaults to `3` */

plugins/_deprecated/sitemap/mod.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-nocheck
12
// deno-lint-ignore-file -- The plugin is deprecated in favour of: https://lume.land/plugins/sitemap/
23

34
import { Page } from 'lume/core/filesystem.ts'

plugins/atom-feed/deps.ts

-1
This file was deleted.

plugins/md5-cache-buster/mod.ts

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { merge } from 'lume/core/utils.ts'
1+
import { merge } from 'lume/core/utils/object.ts'
22
import modifyUrls from 'lume/plugins/modify_urls.ts'
33
import { Md5 } from './deps.ts'
44

5-
import type { Page, Site } from 'lume/core.ts'
65
import type { Message } from './deps.ts'
76

87
export interface Options {
@@ -28,26 +27,24 @@ export default function (userOptions?: Partial<Options>) {
2827

2928
const hashedAssets: HashedAssets = []
3029

31-
return (site: Site) => {
30+
return (site: Lume.Site) => {
3231
site.addEventListener('afterRender', () => {
33-
site.process(options.extensions, buildHash)
32+
site.process(options.extensions, (pages) => pages.forEach(buildHash))
3433

3534
site.process(['.html'], replaceUrls)
3635
})
3736

38-
function buildHash(file: Page) {
39-
const hash = new Md5().update(file.content as Message).toString()
37+
function buildHash(page: Lume.Page) {
38+
const hash = new Md5().update(page.content as Message).toString()
4039

4140
hashedAssets.push({
42-
filename: `${file.dest.path}${file.dest.ext}`,
43-
hashFilename: `${file.dest.path}.${hash}${file.dest.ext}`,
44-
ext: file.dest.ext,
41+
filename: `${page.src.path}${page.src.ext}`,
42+
hashFilename: `${page.src.path}.${hash}${page.src.ext}`,
43+
ext: page.src.ext,
4544
hash: hash,
4645
})
4746

48-
file.updateDest({
49-
path: `${file.dest.path}.${hash}`,
50-
})
47+
page.data.url = `${page.src.path}.${hash}${page.src.ext}`
5148
}
5249

5350
function replaceUrls() {

plugins/unified/deps.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ export { default as rehypeSanitize } from 'npm:[email protected]'
33
export { default as rehypeStringify } from 'npm:[email protected]'
44
export { default as remarkGfm } from 'npm:[email protected]'
55
export { default as remarkParse } from 'npm:[email protected]'
6-
export { default as remarkRehype } from 'npm:remark-rehype@11.0.0'
7-
export * as unified from 'npm:[email protected].3'
6+
export { default as remarkRehype } from 'npm:remark-rehype@11.1.0'
7+
export * as unified from 'npm:[email protected].5'
88

99
export { default as readingTime } from 'https://esm.sh/[email protected]?bundle'
1010

@@ -13,14 +13,14 @@ export { default as rehypeCodeTitles } from 'npm:[email protected]'
1313
export { default as rehypeExternalLinks } from 'npm:[email protected]'
1414
export { default as rehypeMinifyWhitespace } from 'npm:[email protected]'
1515
export { default as rehypePrismDiff } from 'npm:[email protected]'
16-
export { default as rehypePrismPlus } from 'npm:[email protected]'
16+
export { default as rehypePrismPlus } from 'npm:[email protected]'
17+
export { default as rehypeSlugAnchorSectionize } from 'npm:[email protected]'
1718

1819
export { slug } from 'npm:[email protected]'
1920
export { toString } from 'npm:[email protected]'
2021
export { findAfter } from 'npm:[email protected]'
2122
export { CONTINUE, EXIT, SKIP, visit } from 'npm:[email protected]'
2223

24+
export { default as rehypeCopyCode } from '#plugins/unified/rehype/rehypeCopyCode.ts'
2325
export { default as rehypeImgSize } from 'npm:[email protected]'
2426
export type { Test } from 'npm:[email protected]'
25-
export { default as rehypeCopyCode } from './rehype/rehypeCopyCode.ts'
26-
export { default as rehypeSlugAnchorSectionize } from './rehype/slug.ts'

plugins/unified/rehype/mod.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ import {
99
rehypePrismDiff,
1010
rehypePrismPlus,
1111
rehypeSlugAnchorSectionize,
12+
unified,
1213
} from '../deps.ts'
1314

1415
const __dirname = dirname(fromFileUrl(import.meta.url))
1516

16-
export default [
17+
export default <unified.PluggableList> [
1718
[rehypeImgSize, {
1819
dir: new URL(`${__dirname}/../../../src/assets`, import.meta.url).pathname,
1920
}],

plugins/unified/remark/mod.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { readingTime } from '../deps.ts'
1+
import { readingTime, unified } from '#plugins/unified/deps.ts'
22

3-
export default [
3+
export default <unified.PluggableList> [
44
[readingTime, { name: 'readingTime' }],
55
]

src/404.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import type { PageData, PageHelpers } from '#types'
2-
31
export const indexable = false
42
export const title = '404: Page Not Found'
53
export const layout = 'layouts/root.tsx'
64
export const url = '/404/'
75

8-
export default (_data: PageData, { urlFilter }: PageHelpers) => {
6+
export default (_data: Lume.Data, { urlFilter }: Lume.Helpers) => {
97
return (
108
<>
119
<h1>{title}</h1>

src/_components/blog/header.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import type { PageData } from '#types'
2-
31
export default (
4-
{ comp, title, date, icons: { unicons }, readingTime, tags }: PageData,
2+
{ comp, title, date, icons: { unicons }, readingTime, tags }: Lume.PageProps,
53
) => {
64
return (
75
<header>

src/_components/blog/pagination.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import type { PageData, PageHelpers } from '#types'
21
import { getPaginationPages } from '#utils'
32

43
export default (
5-
{ comp, icons: { unicons }, pagination }: PageData,
6-
{ urlFilter }: PageHelpers,
4+
{ comp, icons: { unicons }, pagination }: Lume.PageProps,
5+
{ urlFilter }: Lume.Helpers,
76
) => {
87
return (
98
<nav id='pagination'>

src/_components/blog/post.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { PageData, PageHelpers } from '#types'
2-
31
export default (
42
{
53
comp,
@@ -11,8 +9,8 @@ export default (
119
excerpt,
1210
url,
1311
index,
14-
}: PageData,
15-
{ urlFilter }: PageHelpers,
12+
}: Lume.PageProps,
13+
{ urlFilter }: Lume.Helpers,
1614
) => {
1715
return (
1816
<article

src/_components/blog/search.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default ({ query }: { query: string }) => {
1+
export default ({ query }: Lume.PageProps) => {
22
return (
33
<>
44
<div id='search-inner' className='search'>

src/_components/blog/showcase.tsx

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
import type { Page, PageData, PageHelpers } from '#types'
2-
31
import { isEmptyArray, truncateString } from '#utils'
42

53
export default (
6-
{ comp, icons: { unicons }, search, url }: PageData,
7-
{ urlFilter }: PageHelpers,
4+
{ comp, icons: { unicons }, search, url }: Lume.PageProps,
5+
{ urlFilter }: Lume.Helpers,
86
) => {
9-
const previousPost = search?.previousPage(
10-
url?.toString(),
7+
const previousPost = search.previousPage(
8+
url.toString(),
119
'type=post',
12-
) as Page
10+
)
1311

14-
const nextPost = search?.nextPage(
15-
url?.toString(),
12+
const nextPost = search.nextPage(
13+
url.toString(),
1614
'type=post',
17-
) as Page
15+
)
1816

1917
return (
2018
<nav
@@ -44,7 +42,7 @@ export default (
4442
<small itemProp='name'>Previous</small>
4543
<span>
4644
{truncateString(
47-
previousPost.data.title as string,
45+
previousPost.title!,
4846
30,
4947
'...',
5048
true,
@@ -67,7 +65,7 @@ export default (
6765
<small itemProp='name'>Next</small>
6866
<span>
6967
{truncateString(
70-
nextPost.data.title as string,
68+
nextPost.title!,
7169
30,
7270
'...',
7371
true,

src/_components/blog/tag.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import type { PageData, PageHelpers } from '#types'
2-
3-
export default ({ tags }: PageData, { urlFilter }: PageHelpers) => {
1+
export default ({ tags }: Lume.Data, { urlFilter }: Lume.Helpers) => {
42
return (
53
<>
64
{tags?.map((tag: string, index: number) => {

src/_components/blog/time.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import type { PageData, PageHelpers } from '#types'
2-
3-
export default ({ date }: PageData, filters: PageHelpers) => {
1+
export default ({ date }: Lume.Data, filters: Lume.Helpers) => {
42
return (
53
<time dateTime={filters.date(date, 'DATE')} itemProp='datePublished'>
64
{filters.date(date, 'HUMAN_DATE')}

src/_components/blog/tocSeries.tsx

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
import type { Page, PageData, PageHelpers } from '#types'
2-
31
import { capitalize, isEmptyArray } from '#utils'
42

53
export default (
6-
{ comp, icons: { unicons }, search, series, url }: PageData,
7-
{ urlFilter }: PageHelpers,
4+
{ comp, icons: { unicons }, search, series, url }: Lume.PageProps,
5+
{ urlFilter }: Lume.Helpers,
86
) => {
9-
const parts: any[] = []
7+
const parts: { title: string; url: string; chapter?: string }[] = []
108
const activeUrl = url
119

1210
if (typeof series !== 'undefined') {
1311
for (
14-
const post of search.pages(
12+
const data of search.pages(
1513
`series.ident=${series.ident}`,
1614
'date=asc',
17-
) as Page[]
15+
)
1816
) {
1917
parts.push({
2018
title: series.title,
21-
chapter: post.data.title,
22-
url: urlFilter!(post.data.url),
19+
url: urlFilter!(data.url),
20+
chapter: data.title,
2321
})
2422
}
2523
}

src/_components/layout/footer.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import type { PageData, PageHelpers } from '#types'
2-
3-
export default ({ comp, site }: PageData, { urlFilter }: PageHelpers) => {
1+
export default (
2+
{ comp, site }: Lume.PageProps,
3+
{ urlFilter }: Lume.Helpers,
4+
) => {
45
return (
56
<footer className='container'>
67
<p>

0 commit comments

Comments
 (0)