Skip to content

Commit 963cf2e

Browse files
authored
Merge pull request #382 from openscript/upgrade-dependencies
Upgrade dependencies
2 parents 56da98c + f13409e commit 963cf2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2102
-4660
lines changed

.devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
]
1919
}
2020
},
21-
"postCreateCommand": "npm install -g [email protected] pnpm@10.2.0"
21+
"postCreateCommand": "npm install -g [email protected] pnpm@10.11.0"
2222
}

.frontmatter/database/mediaDb.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"src":{"content":{"blog":{"2024":{"10":{"31":{}},"09":{"22":{}}}}}}}
1+
{"src":{"content":{"blog":{"2024":{"10":{"31":{}},"09":{"22":{}}}}},"pages":{},"utils":{}}}

package.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"url": "https://github.com/openscript/r.obin.ch/issues"
1212
},
1313
"repository": "github:openscript/r.obin.ch",
14-
"packageManager": "pnpm@10.4.1",
14+
"packageManager": "pnpm@10.11.0",
1515
"scripts": {
1616
"dev": "astro dev --host",
1717
"start": "astro dev --host",
@@ -28,31 +28,32 @@
2828
"dependencies": {
2929
"@anolilab/unplugin-favicons": "^1.0.5",
3030
"@astrojs/check": "^0.9.4",
31-
"@astrojs/mdx": "^4.0.8",
31+
"@astrojs/mdx": "^4.3.0",
3232
"@astrojs/rss": "^4.0.11",
33-
"@astrojs/sitemap": "^3.2.1",
34-
"@fontsource/ibm-plex-mono": "^5.1.1",
35-
"@fontsource/poppins": "^5.1.1",
36-
"@fontsource/rajdhani": "^5.1.1",
37-
"astro": "^5.3.0",
33+
"@astrojs/sitemap": "^3.4.0",
34+
"@fontsource/ibm-plex-mono": "^5.2.5",
35+
"@fontsource/poppins": "^5.2.6",
36+
"@fontsource/rajdhani": "^5.2.5",
37+
"astro": "^5.8.1",
38+
"astro-loader-i18n": "^0.7.1",
3839
"favicons": "^7.2.0",
3940
"limax": "^4.1.0",
4041
"pagefind": "^1.3.0",
4142
"rehype-autolink-headings": "^7.1.0",
4243
"rehype-slug": "^6.0.0",
43-
"sharp": "^0.33.5",
44+
"sharp": "^0.34.2",
4445
"simple-git": "^3.27.0",
4546
"vfile": "^6.0.3"
4647
},
4748
"devDependencies": {
48-
"@changesets/cli": "^2.27.12",
49+
"@changesets/cli": "^2.29.4",
4950
"@types/mdast": "^4.0.4",
50-
"@types/node": "^22.13.4",
51-
"@vitest/coverage-v8": "3.0.6",
52-
"prettier": "^3.5.1",
51+
"@types/node": "^22.15.29",
52+
"@vitest/coverage-v8": "3.2.0",
53+
"prettier": "^3.5.3",
5354
"prettier-plugin-astro": "^0.14.1",
54-
"sirv": "^3.0.0",
55-
"typescript": "^5.7.3",
56-
"vitest": "3.0.6"
55+
"sirv": "^3.0.1",
56+
"typescript": "^5.8.3",
57+
"vitest": "3.2.0"
5758
}
5859
}

pnpm-lock.yaml

Lines changed: 1319 additions & 883 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
onlyBuiltDependencies:
2+
- esbuild
3+
- sharp

src/collections/notes.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
import { getCollection, type CollectionEntry } from "astro:content";
2-
3-
export const defaultNotesCollection = await getCollection("notes");
1+
import { getCollection } from "astro:content";
2+
import type { GitInfoFrontmatter } from "../remark/remark-git-info";
43

4+
export type Note = { path: string, title: string, gitInfo: GitInfoFrontmatter["git"] };
55
export type NestedNotes = {
6-
[key: string]: NestedNotes | { note: CollectionEntry<'notes'> } | {};
7-
}
6+
[key: string]: NestedNotes | { note: Note };
7+
};
88

9-
export const nestedNotesCollection = defaultNotesCollection.reduce((acc, note) => {
10-
const path = note.id.split("/").filter(Boolean);
11-
let current = acc;
12-
for (let part of path) {
13-
if (part === path[path.length - 1]) part = note.data.title;
14-
if (!current[part]) current[part] = {};
15-
current = current[part]!;
16-
}
17-
current.note = note;
18-
return acc;
19-
}, {} as NestedNotes);
9+
export const defaultNotesCollection = await getCollection("notes");

src/components/DateTime.astro

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
---
2-
import { getLocaleFromUrl } from "../utils/i18n";
3-
42
type Props = {
53
date: Date;
64
dateStyle?: Intl.DateTimeFormatOptions["dateStyle"];
75
timeStyle?: Intl.DateTimeFormatOptions["timeStyle"];
86
};
97
108
const { date, dateStyle, timeStyle } = Astro.props;
11-
const locale = getLocaleFromUrl(Astro.url);
9+
const locale = Astro.currentLocale;
1210
---
1311

1412
<time datetime={date.toISOString()}>

src/components/GalleryCard.astro

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
---
2-
import type { CollectionEntry } from 'astro:content'
3-
import { getContentEntryPath } from "../utils/i18n";
42
import { Image } from 'astro:assets';
5-
import type { Locale } from '../configuration';
6-
import { getEntry } from 'astro:content';
73
84
type Props = {
9-
category: CollectionEntry<'gallery'>;
10-
locale: Locale;
11-
}
5+
cover: ImageMetadata;
6+
title: string;
7+
path: string;
8+
};
129
13-
const { category, locale } = Astro.props;
10+
const { cover, title, path } = Astro.props;
1411
1512
---
1613

@@ -64,11 +61,11 @@ const { category, locale } = Astro.props;
6461
</style>
6562

6663
<div>
67-
<a href={getContentEntryPath(await getEntry("gallery", category.id), locale)}>
68-
<Image src={category.data.cover} alt={`Cover: ${category.data.title[locale]}`} width={320} />
64+
<a href={path}>
65+
<Image src={cover} alt={`Cover: ${title}`} width={320} />
6966
<div>
7067
<div>
71-
<h3>{category.data.title[locale]}</h3>
68+
<h3>{title}</h3>
7269
</div>
7370
</div>
7471
</a>

src/components/GitInfo.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
import type { GitInfoFrontmatter } from '../remark/remark-git-info'
3-
import { getLocaleFromUrl, useTranslations } from '../utils/i18n';
3+
import { parseLocale, useTranslations } from '../utils/i18n';
44
import Button from './Button.astro';
55
import DateTime from './DateTime.astro';
66
import Foldable from './Foldable.astro';
77
88
type Props = GitInfoFrontmatter;
99
1010
const { git } = Astro.props;
11-
const locale = getLocaleFromUrl(Astro.url);
11+
const locale = parseLocale(Astro.currentLocale);
1212
const t = useTranslations(locale);
1313
1414
---

src/components/Navigation.astro

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,17 @@
11
---
22
import { Image } from "astro:assets";
3-
import type { Locale } from "../configuration";
43
import Link from "./Link.astro";
5-
import type { InferEntrySchema } from "astro:content";
6-
import {
7-
PROTOCOL_DELIMITER,
8-
splitCollectionAndSlug,
9-
getContentEntryPath,
10-
} from "../utils/i18n";
11-
import { getEntry } from "astro:content";
4+
import type { ImageMetadata } from "astro";
125
136
type Props = {
14-
locale: Locale;
15-
items: InferEntrySchema<"navigation">;
7+
items: Array<{
8+
path: string;
9+
title: string;
10+
icon?: ImageMetadata;
11+
}>
1612
};
1713
18-
async function processPath(path: string) {
19-
if (path.includes(PROTOCOL_DELIMITER) && !path.startsWith("http")) {
20-
const split = splitCollectionAndSlug(path);
21-
const entry = await getEntry(split.collection as any, split.slug);
22-
path = getContentEntryPath(entry);
23-
}
24-
return path;
25-
}
26-
27-
const { items, locale } = Astro.props;
28-
const preparedItems = await Promise.all(
29-
items[locale].map(async (i) => ({ ...i, path: await processPath(i.path) })),
30-
);
14+
const { items } = Astro.props;
3115
---
3216

3317
<style>
@@ -38,10 +22,10 @@ const preparedItems = await Promise.all(
3822
}
3923
</style>
4024

41-
<nav>
25+
<nav class="rounded">
4226
<ul>
4327
{
44-
preparedItems.map((item) => (
28+
items.map((item) => (
4529
<li>
4630
<Link href={item.path}>
4731
{item.icon ? (

src/components/NoteList.astro

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
2-
import type { CollectionEntry } from 'astro:content';
3-
import type { NestedNotes } from '../collections/notes';
42
import NoteListEntry from './NoteListEntry.astro';
3+
import type { Note, NestedNotes } from '../collections/notes';
54
65
type Props = {
76
notes: NestedNotes;
87
};
98
10-
function hasNote(value: any): value is { note: CollectionEntry<"notes"> } {
9+
function hasNote(value: any): value is { note: Note} {
1110
return 'note' in value && value.note !== undefined;
1211
}
1312
@@ -33,10 +32,10 @@ const { notes } = Astro.props;
3332
</style>
3433

3534
<ul class="note-root">
36-
{Object.entries(notes).map(async ([key, value]) => (
35+
{Object.entries(notes).map(([key, value]) => (
3736
<li>
3837
{hasNote(value) ? (
39-
<NoteListEntry note={value.note} />
38+
<NoteListEntry title={value.note.title} path={value.note.path} gitInfo={value.note.gitInfo} />
4039
) : (
4140
<span class="note-category">{key.charAt(0).toUpperCase() + key.slice(1)}</span>
4241
<Astro.self notes={value} />

src/components/NoteListEntry.astro

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
---
2-
import type { CollectionEntry } from "astro:content";
3-
import { getContentEntryPath } from "../utils/i18n";
42
import type { GitInfoFrontmatter } from "../remark/remark-git-info";
53
import DateTime from "./DateTime.astro";
6-
import { getEntry } from "astro:content";
7-
import { render } from "astro:content";
84
95
type Props = {
10-
note: CollectionEntry<"notes">;
6+
path: string;
7+
title: string;
8+
gitInfo: GitInfoFrontmatter["git"];
119
};
1210
13-
const { note } = Astro.props;
14-
const { remarkPluginFrontmatter } = await render(note);
15-
const gitInfo: GitInfoFrontmatter["git"] = remarkPluginFrontmatter.git;
11+
const { path, title, gitInfo } = Astro.props;
1612
---
1713

1814
<style>
@@ -24,8 +20,8 @@ const gitInfo: GitInfoFrontmatter["git"] = remarkPluginFrontmatter.git;
2420
}
2521
</style>
2622

27-
<a href={getContentEntryPath(await getEntry("notes", note.id))}>
28-
<span class="note-title">{note.data.title}</span>
23+
<a href={path}>
24+
<span class="note-title">{title}</span>
2925
{
3026
gitInfo.lastCommit && (
3127
<span class="note-modified">

src/components/Pagination.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
import type { Page } from "astro";
33
import Button from "./Button.astro";
4-
import { getLocaleFromUrl, useTranslations } from "../utils/i18n";
4+
import { parseLocale, useTranslations } from "../utils/i18n";
55
66
type Props = {
77
page: Page;
88
};
99
1010
const { page } = Astro.props as Props;
11-
const locale = getLocaleFromUrl(Astro.url);
11+
const locale = parseLocale(Astro.currentLocale);
1212
const t = useTranslations(locale);
1313
---
1414

src/components/PostCard.astro

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
2-
import type { CollectionEntry } from "astro:content";
3-
import { getContentEntryPath } from "../utils/i18n";
42
import { Image } from "astro:assets";
53
import DateTime from "./DateTime.astro";
64
import DerivedCover from "./DerivedCover.astro";
7-
import { getEntry, render } from "astro:content";
85
96
type Props = {
10-
post: CollectionEntry<"blog">;
7+
title: string;
8+
cover?: { alt?: string; src: ImageMetadata };
9+
publishedAt: Date;
10+
translatedPath: string;
11+
excerpt: string;
1112
};
1213
13-
const { post } = Astro.props;
14-
const { remarkPluginFrontmatter } = await render(post);
14+
const { title, cover, publishedAt, translatedPath, excerpt } = Astro.props;
1515
---
1616

1717
<style>
@@ -36,23 +36,23 @@ const { remarkPluginFrontmatter } = await render(post);
3636
</style>
3737

3838
<div>
39-
<a href={getContentEntryPath(await getEntry("blog", post.id))}>
39+
<a href={translatedPath}>
4040
{
41-
post.data.cover ? (
41+
cover ? (
4242
<Image
43-
src={post.data.cover.src}
44-
alt={post.data.cover.alt || post.data.title}
43+
src={cover.src}
44+
alt={cover.alt || title}
4545
widths={[720]}
4646
/>
4747
) : (
48-
<DerivedCover value={post.id} />
48+
<DerivedCover value={title} />
4949
)
5050
}
5151
<div>
5252
<div>
53-
<DateTime date={post.data.publishedAt} />
54-
<h2>{post.data.title}</h2>
55-
<p>{remarkPluginFrontmatter.excerpt}...</p>
53+
<DateTime date={publishedAt} />
54+
<h2>{title}</h2>
55+
<p>{excerpt}...</p>
5656
</div>
5757
</div>
5858
</a>

src/components/Search.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
import { getLocaleFromUrl, useTranslations } from "../utils/i18n";
2+
import { parseLocale, useTranslations } from "../utils/i18n";
33
4-
const locale = getLocaleFromUrl(Astro.url);
4+
const locale = parseLocale(Astro.currentLocale);
55
const t = useTranslations(locale);
66
const bundle = `/pagefind/pagefind.js`;
77
---

src/components/TableOfContents.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { getLocaleFromUrl, useTranslations } from "../utils/i18n";
2+
import { parseLocale, useTranslations } from "../utils/i18n";
33
import Foldable from "./Foldable.astro";
44
55
type Props = {
@@ -10,7 +10,7 @@ type Props = {
1010
const { headings: headingsProp, fromDepth: fromDepthProp } = Astro.props;
1111
const fromDepth = fromDepthProp || 2;
1212
const headings = headingsProp.filter((heading) => heading.depth >= fromDepth);
13-
const locale = getLocaleFromUrl(Astro.url);
13+
const locale = parseLocale(Astro.currentLocale);
1414
const t = useTranslations(locale);
1515
---
1616

0 commit comments

Comments
 (0)