@xingwangzhe/stalux 1.5.1 → 1.5.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.
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/internal/font-subset-dev.ts +1 -4
- package/src/internal/font-subset.ts +0 -2
- package/src/pages/404.astro +1 -1
- package/src/pages/archives.astro +1 -1
- package/src/pages/categories/[category].astro +1 -1
- package/src/pages/categories/index.astro +1 -1
- package/src/pages/index.astro +1 -1
- package/src/pages/links.astro +1 -1
- package/src/pages/tags/[tag].astro +1 -1
- package/src/pages/tags/index.astro +1 -1
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -226,6 +226,7 @@ export function stalux(options: StaluxOptions = {}): AstroIntegration {
|
|
|
226
226
|
await runFontSubsetting(projectRoot, logger, true);
|
|
227
227
|
// 再添加按需路由切片中间件(放在最前面,优先拦截字体请求)
|
|
228
228
|
const { createDevFontMiddleware } = await import(
|
|
229
|
+
/* @vite-ignore */
|
|
229
230
|
new URL("./internal/font-subset-dev.ts", import.meta.url).href
|
|
230
231
|
);
|
|
231
232
|
const fontMiddleware = createDevFontMiddleware(projectRoot, logger);
|
|
@@ -12,7 +12,6 @@ import { resolve, join, dirname } from "node:path";
|
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
13
|
|
|
14
14
|
import type { AstroIntegrationLogger } from "astro";
|
|
15
|
-
import * as taetype from "taetype";
|
|
16
15
|
import { register_font_raw, get_glyph_ids, subset_font_full } from "taetype";
|
|
17
16
|
|
|
18
17
|
const FONT_INPUT = "src/assets/fonts/LXGWWenKai-Regular.ttf";
|
|
@@ -99,10 +98,8 @@ async function generateSubsetOnDemand(
|
|
|
99
98
|
for (const ch of chars) charSet.add(ch);
|
|
100
99
|
if (charSet.size === 0) return null;
|
|
101
100
|
|
|
102
|
-
// Deduplicate against common subset
|
|
101
|
+
// Deduplicate against common subset
|
|
103
102
|
const outDir = resolve(projectRoot, FONT_OUT_DIR);
|
|
104
|
-
const commonCssPath = join(outDir, "common.css");
|
|
105
|
-
const commonCharSet = new Set<string>();
|
|
106
103
|
|
|
107
104
|
// We can't precisely know which chars common covers without re-extracting.
|
|
108
105
|
// But we can read the i18n + config source for a rough estimate.
|
|
@@ -21,8 +21,6 @@ import { resolve, basename, extname, join, dirname } from "node:path";
|
|
|
21
21
|
import { fileURLToPath } from "node:url";
|
|
22
22
|
|
|
23
23
|
import type { AstroIntegrationLogger } from "astro";
|
|
24
|
-
// taetype 是 Rust 原生字体引擎,比 subset-font (WASM) 快 2-3 倍
|
|
25
|
-
import * as taetype from "taetype";
|
|
26
24
|
import { register_font_raw, get_glyph_ids, subset_font_full } from "taetype";
|
|
27
25
|
|
|
28
26
|
// ---------------------------------------------------------------------------
|
package/src/pages/404.astro
CHANGED
package/src/pages/archives.astro
CHANGED
|
@@ -12,7 +12,7 @@ const { t } = createTranslator(siteConfig.lang || "zh-CN");
|
|
|
12
12
|
const posts = await getCollection("posts", ({ data }) => !data.draft);
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
<Stalux title={t("archives.title") + " | " + siteConfig.title} description={t("archives.description", { title: siteConfig.title })}
|
|
15
|
+
<Stalux title={t("archives.title") + " | " + siteConfig.title} description={t("archives.description", { title: siteConfig.title })}>
|
|
16
16
|
<div style="height: 3em;"></div>
|
|
17
17
|
<Navs />
|
|
18
18
|
<h1 class={styles.h1}>{t("archives.heading")}</h1>
|
|
@@ -27,7 +27,7 @@ const props = Astro.props as Props;
|
|
|
27
27
|
<Stalux
|
|
28
28
|
title={t("taxonomy.category") + ": " + props.category + " | " + siteConfig.title}
|
|
29
29
|
description={t("taxonomy.browseCategory", { title: siteConfig.title, category: props.category, count: props.count })}
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
>
|
|
32
32
|
<div style="height: 3em;"></div>
|
|
33
33
|
<Navs />
|
|
@@ -14,7 +14,7 @@ const { t } = createTranslator(siteConfig.lang || "zh-CN");
|
|
|
14
14
|
<Stalux
|
|
15
15
|
title={t("categories.title") + " | " + siteConfig.title}
|
|
16
16
|
description={t("categories.description", { title: siteConfig.title })}
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
>
|
|
19
19
|
<div style="height: 3em;"></div>
|
|
20
20
|
<Navs />
|
package/src/pages/index.astro
CHANGED
|
@@ -15,7 +15,7 @@ import ToArchive from "@components/stalux/archives/toArchive.astro";
|
|
|
15
15
|
import { getSiteData, getAuthorData, getHeadData, getNavsData, getLinksData, getCommentData, getFooterData, getPromoteData, getTypetextsData, getMediaLinksData } from "@utils/config-utils";
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
-
<Stalux title={siteTitle} description={siteDescription}
|
|
18
|
+
<Stalux title={siteTitle} description={siteDescription}>
|
|
19
19
|
<div class={styles.homeBody}>
|
|
20
20
|
<h1 class={styles.homeTitle}>{siteTitle}</h1>
|
|
21
21
|
<div class={styles.homeNavs}>
|
package/src/pages/links.astro
CHANGED
|
@@ -29,7 +29,7 @@ const props = Astro.props as Props;
|
|
|
29
29
|
title={t("taxonomy.tag") + ": " + props.tag + " | " + siteConfig.title}
|
|
30
30
|
description={t("taxonomy.browseTag", { title: siteConfig.title, tag: props.tag, count: props.count })}
|
|
31
31
|
noindex={props.count < 3}
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
>
|
|
34
34
|
<div style="height: 3em;"></div>
|
|
35
35
|
<Navs />
|
|
@@ -14,7 +14,7 @@ const { t } = createTranslator(siteConfig.lang || "zh-CN");
|
|
|
14
14
|
<Stalux
|
|
15
15
|
title={t("tags.title") + " | " + siteConfig.title}
|
|
16
16
|
description={t("tags.description", { title: siteConfig.title })}
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
>
|
|
19
19
|
<div style="height: 3em;"></div>
|
|
20
20
|
<Navs />
|