@xingwangzhe/stalux 1.3.6 → 1.3.7
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xingwangzhe/stalux",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7",
|
|
4
4
|
"description": "A powerful, modern Astro blog theme \u2014 use as template or install as plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -85,21 +85,21 @@
|
|
|
85
85
|
"astro-expressive-code": "^0.44.1",
|
|
86
86
|
"pagefind": "^1.5.2",
|
|
87
87
|
"photoswipe": "^5.4.4",
|
|
88
|
-
"subset-font": "^2.5.0"
|
|
89
|
-
},
|
|
90
|
-
"devDependencies": {
|
|
88
|
+
"subset-font": "^2.5.0",
|
|
91
89
|
"@astrojs/rss": "^4.0.19",
|
|
92
|
-
"@lucide/astro": "^1.27.0",
|
|
93
|
-
"@types/node": "^26.1.1",
|
|
94
90
|
"astro-seo": "^1.1.0",
|
|
95
91
|
"astro-typewriter": "^1.2.0",
|
|
92
|
+
"@lucide/astro": "^1.27.0",
|
|
96
93
|
"badge-maker": "^6.0.0",
|
|
94
|
+
"simple-icons": "^16.27.1",
|
|
95
|
+
"temml": "^0.13.3"
|
|
96
|
+
},
|
|
97
|
+
"devDependencies": {
|
|
98
|
+
"@types/node": "^26.1.1",
|
|
97
99
|
"knip": "^6.29.0",
|
|
98
100
|
"license-checker-rseidelsohn": "5.0.1",
|
|
99
101
|
"oxfmt": "^0.60.0",
|
|
100
102
|
"oxlint": "^1.75.0",
|
|
101
|
-
"simple-icons": "^16.27.1",
|
|
102
|
-
"temml": "^0.13.3",
|
|
103
103
|
"typescript": "^7.0.2"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
@@ -30,7 +30,7 @@ import subsetFontFn from "subset-font";
|
|
|
30
30
|
/** Content root directory (relative to project root) */
|
|
31
31
|
const CONTENT_ROOT = "stalux";
|
|
32
32
|
|
|
33
|
-
/** Full font input path */
|
|
33
|
+
/** Full font input path (relative to project root or package) */
|
|
34
34
|
const FONT_INPUT = "src/assets/fonts/LXGWWenKai-Regular.ttf";
|
|
35
35
|
|
|
36
36
|
/** Output directory for generated subsets */
|
|
@@ -217,18 +217,32 @@ function deduplicate(routes: RouteCharSet[]): Map<string, string[]> {
|
|
|
217
217
|
* Called from astro:build:start hook.
|
|
218
218
|
*/
|
|
219
219
|
export async function runFontSubsetting(
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
projectRoot: string,
|
|
221
|
+
logger: AstroIntegrationLogger,
|
|
222
222
|
): Promise<void> {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
223
|
+
logger.info("Font subsetting: scanning content...");
|
|
224
|
+
|
|
225
|
+
// 1. Locate font file (check project root first, then stalux package dir)
|
|
226
|
+
const { fileURLToPath } = await import("node:url");
|
|
227
|
+
const fontPaths = [
|
|
228
|
+
resolve(projectRoot, FONT_INPUT),
|
|
229
|
+
resolve(projectRoot, "node_modules", "@xingwangzhe", "stalux", FONT_INPUT),
|
|
230
|
+
resolve(fileURLToPath(new URL("..", import.meta.url)), "..", FONT_INPUT),
|
|
231
|
+
];
|
|
232
|
+
|
|
233
|
+
let fontPath: string | undefined;
|
|
234
|
+
for (const p of fontPaths) {
|
|
235
|
+
if (existsSync(p)) {
|
|
236
|
+
fontPath = p;
|
|
237
|
+
break;
|
|
230
238
|
}
|
|
231
|
-
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!fontPath) {
|
|
242
|
+
logger.warn(`Font not found at ${FONT_INPUT}, skipping subsetting`);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const fontBuffer = readFileSync(fontPath);
|
|
232
246
|
|
|
233
247
|
// 2. Scan content files
|
|
234
248
|
const contentFiles = scanContent(projectRoot);
|
|
@@ -3,7 +3,7 @@ import sitemap from "@astrojs/sitemap";
|
|
|
3
3
|
import { mermaidHast } from "@xingwangzhe/satteri-mermaid";
|
|
4
4
|
import { photoswipe } from "@xingwangzhe/satteri-photoswipe";
|
|
5
5
|
import expressiveCode from "astro-expressive-code";
|
|
6
|
-
import { defineConfig } from "astro/config";
|
|
6
|
+
import { defineConfig, fontProviders } from "astro/config";
|
|
7
7
|
import stalux from "@xingwangzhe/stalux";
|
|
8
8
|
|
|
9
9
|
// https://astro.build/config
|
|
@@ -14,8 +14,28 @@ export default defineConfig({
|
|
|
14
14
|
prefetchAll: false,
|
|
15
15
|
defaultStrategy: "hover",
|
|
16
16
|
},
|
|
17
|
+
fonts: [
|
|
18
|
+
{
|
|
19
|
+
provider: fontProviders.local(),
|
|
20
|
+
name: "Google Sans Code",
|
|
21
|
+
cssVariable: "--font-code",
|
|
22
|
+
options: {
|
|
23
|
+
variants: [
|
|
24
|
+
{
|
|
25
|
+
weight: "100 900",
|
|
26
|
+
style: "normal",
|
|
27
|
+
src: ["./node_modules/@xingwangzhe/stalux/src/assets/fonts/GoogleSansCode.woff2"],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
weight: "100 900",
|
|
31
|
+
style: "italic",
|
|
32
|
+
src: ["./node_modules/@xingwangzhe/stalux/src/assets/fonts/GoogleSansCode-Italic.woff2"],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
17
38
|
integrations: [
|
|
18
|
-
// Stalux 主题集成 — 自动注入所有页面、组件、路由
|
|
19
39
|
stalux({
|
|
20
40
|
contentDir: "stalux",
|
|
21
41
|
}),
|