build: bump astro to 3.4

This commit is contained in:
Maciej Jur 2023-10-28 16:58:58 +02:00
parent 56261f3379
commit 7b63588fcc
Signed by: kamov
GPG key ID: 191CBFF5F72ECAFD
6 changed files with 1278 additions and 814 deletions

View file

@ -1,34 +1,39 @@
import { defineConfig } from 'astro/config';
import rehypeKatex from 'rehype-katex';
import remarkMath from 'remark-math';
import remarkEmoji from 'remark-emoji';
import mdx from '@astrojs/mdx';
import solid from '@astrojs/solid-js';
import pagefind from 'astro-pagefind';
import remarkDirective from 'remark-directive';
import remarkBibliography from "./src/utils/remark/bibliography";
import remarkRuby from "./src/utils/remark/ruby";
import mdx from '@astrojs/mdx';
import solid from '@astrojs/solid-js';
import pagefind from 'astro-pagefind';
import remarkDirective from 'remark-directive';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
import remarkEmoji from 'remark-emoji';
import remarkBib from './src/utils/remark/bib';
import remarkRuby from './src/utils/remark/ruby';
// https://astro.build/config
export default defineConfig({
site: 'https://kamoshi.org',
trailingSlash: 'always',
compressHTML: true,
markdown: {
remarkPlugins: [
// NOTE: pinned ^2.0.0
remarkDirective,
[remarkRuby, {separator: ';'}],
remarkBibliography,
[remarkEmoji, {accessible: true}],
// NOTE: pinned ^5.0.0
remarkMath,
remarkEmoji,
[remarkRuby, {sep: ';'}],
remarkBib,
],
rehypePlugins: [
[rehypeKatex, {output: 'mathml'}]
// https://katex.org/docs/options.html
[rehypeKatex, {output: 'mathml'}],
],
shikiConfig: {
theme: 'min-light'
}
},
},
experimental: {
devOverlay: true,
},
integrations: [
mdx(),

View file

@ -11,40 +11,40 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^1.0.3",
"@astrojs/solid-js": "^3.0.1",
"@citation-js/plugin-bibtex": "^0.6.8",
"@astrojs/mdx": "^1.1.3",
"@astrojs/solid-js": "^3.0.2",
"@citation-js/plugin-bibtex": "^0.7.2",
"@js-temporal/polyfill": "^0.4.4",
"astro": "^3.0.12",
"astro-pagefind": "^1.2.3",
"astro": "^3.4.0",
"astro-pagefind": "^1.3.0",
"chart.js": "^4.4.0",
"citation-js": "^0.6.8",
"dayjs": "^1.11.9",
"citation-js": "^0.7.1",
"dayjs": "^1.11.10",
"leaflet": "^1.9.4",
"leaflet.markercluster": "^1.5.3",
"mdast-util-to-string": "^4.0.0",
"purify-ts": "^2.0.1",
"rehype-katex": "^6.0.3",
"rehype-katex": "^7.0.0",
"rehype-raw": "^7.0.0",
"rehype-stringify": "^10.0.0",
"remark-directive": "^2.0.1",
"remark-directive": "^2.0.0",
"remark-emoji": "^4.0.0",
"remark-gfm": "^3.0.1",
"remark-math": "^5.1.1",
"remark-parse": "^10.0.2",
"remark-rehype": "^10.1.0",
"reveal.js": "^4.5.0",
"solid-js": "^1.7.11",
"unified": "^11.0.3",
"remark-gfm": "^4.0.0",
"remark-math": "^5.0.0",
"remark-parse": "^11.0.0",
"remark-rehype": "^11.0.0",
"reveal.js": "^5.0.0",
"solid-js": "^1.8.4",
"unified": "^11.0.4",
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@types/leaflet": "^1.9.4",
"@types/leaflet.markercluster": "^1.5.2",
"@types/reveal.js": "^4.4.2",
"@types/unist": "^3.0.0",
"pagefind": "^0.12.0",
"sass": "^1.66.1",
"sharp": "^0.32.5"
"@types/leaflet": "^1.9.7",
"@types/leaflet.markercluster": "^1.5.3",
"@types/reveal.js": "^4.4.5",
"@types/unist": "^3.0.1",
"pagefind": "^1.0.3",
"sass": "^1.69.5",
"sharp": "^0.32.6"
}
}

File diff suppressed because it is too large Load diff

View file

@ -28,12 +28,13 @@ interface PagefindDocument {
word_count: number;
}
async function loadPagefind(): Promise<Pagefind> {
const pf = "/_pagefind/pagefind.js";
return await import(/* @vite-ignore */ pf);
const enum PagefindModule {
LINK = '/pagefind/pagefind.js',
}
const loadPagefind = () => import(/* @vite-ignore */PagefindModule.LINK) as Promise<Pagefind>;
function Result(props: { page: PagefindResult }) {
const [data, setData] = createSignal<PagefindDocument>();
@ -53,7 +54,6 @@ function Result(props: { page: PagefindResult }) {
<div>Loading...</div>
)}
</>
)
}

View file

@ -1,8 +1,6 @@
import "@citation-js/plugin-bibtex";
// @ts-ignore
import Cite from "citation-js";
import type { Root } from "remark-directive";
import type { Plugin } from "unified";
import { visit, EXIT, CONTINUE } from "unist-util-visit";
import { toString } from "mdast-util-to-string";
import { Maybe } from "purify-ts";
@ -11,8 +9,8 @@ import { Maybe } from "purify-ts";
function locateBibliography(tree: any) {
let bibliography: Maybe<Cite> = Maybe.empty();
visit(tree, "containerDirective", (node, index, parent) => {
if (node.name !== "bib")
visit(tree, 'containerDirective', (node, index, parent) => {
if (node.name !== 'bib')
return CONTINUE;
const data = new Cite(toString(node));
@ -57,11 +55,9 @@ function convertCitations(tree: any, data: Cite) {
}
export const remarkBibliography: Plugin<[], Root> = (options?: any) => {
export default function remarkBibliography(options?: any) {
return (tree: any) => {
locateBibliography(tree)
.ifJust(data => convertCitations(tree, data));
}
}
export default remarkBibliography;

View file

@ -5,7 +5,7 @@ import { toString } from "mdast-util-to-string";
interface Options {
separator: string;
sep: string;
}
type Pair = [string, string];
@ -17,7 +17,7 @@ function toHtml([text, help]: Pair) {
function createRuby(text: string, help: string, options?: Options) {
const splitText = text.split('');
const splitHelp = help.split(options?.separator || ';');
const splitHelp = help.split(options?.sep || ';');
const pairs = (splitText.length === splitHelp.length)
? splitText.map((e, i) => [e, splitHelp[i]] as Pair)
@ -27,7 +27,7 @@ function createRuby(text: string, help: string, options?: Options) {
}
export const remarkRuby: Plugin<[Options?], Root> = (options?: Options) => {
export default function remarkRuby(options?: Options) {
return (tree: any) => {
visit(tree, "textDirective", (node, index, parent) => {
if (node.name !== 'ruby')
@ -46,5 +46,3 @@ export const remarkRuby: Plugin<[Options?], Root> = (options?: Options) => {
})
}
}
export default remarkRuby;