@xingwangzhe/stalux 1.3.5 → 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,7 +1,7 @@
1
1
  {
2
2
  "name": "@xingwangzhe/stalux",
3
- "version": "1.3.5",
4
- "description": "A powerful, modern Astro blog theme — use as template or install as plugin",
3
+ "version": "1.3.7",
4
+ "description": "A powerful, modern Astro blog theme \u2014 use as template or install as plugin",
5
5
  "keywords": [
6
6
  "astro",
7
7
  "astro-integration",
@@ -47,6 +47,7 @@
47
47
  ".": "./src/index.ts",
48
48
  "./config": "./src/config.ts",
49
49
  "./schemas": "./src/schemas/config.ts",
50
+ "./schemas/collections": "./src/schemas/collections.ts",
50
51
  "./components/*": "./src/components/*",
51
52
  "./layouts/*": "./src/layouts/*",
52
53
  "./pages/*": "./src/pages/*",
@@ -84,21 +85,21 @@
84
85
  "astro-expressive-code": "^0.44.1",
85
86
  "pagefind": "^1.5.2",
86
87
  "photoswipe": "^5.4.4",
87
- "subset-font": "^2.5.0"
88
- },
89
- "devDependencies": {
88
+ "subset-font": "^2.5.0",
90
89
  "@astrojs/rss": "^4.0.19",
91
- "@lucide/astro": "^1.27.0",
92
- "@types/node": "^26.1.1",
93
90
  "astro-seo": "^1.1.0",
94
91
  "astro-typewriter": "^1.2.0",
92
+ "@lucide/astro": "^1.27.0",
95
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",
96
99
  "knip": "^6.29.0",
97
100
  "license-checker-rseidelsohn": "5.0.1",
98
101
  "oxfmt": "^0.60.0",
99
102
  "oxlint": "^1.75.0",
100
- "simple-icons": "^16.27.1",
101
- "temml": "^0.13.3",
102
103
  "typescript": "^7.0.2"
103
104
  },
104
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
- projectRoot: string,
221
- logger: AstroIntegrationLogger,
220
+ projectRoot: string,
221
+ logger: AstroIntegrationLogger,
222
222
  ): Promise<void> {
223
- logger.info("Font subsetting: scanning content...");
224
-
225
- // 1. Locate font file
226
- const fontPath = resolve(projectRoot, FONT_INPUT);
227
- if (!existsSync(fontPath)) {
228
- logger.warn(`Font not found at ${fontPath}, skipping subsetting`);
229
- return;
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
- const fontBuffer = readFileSync(fontPath);
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,8 +3,8 @@ 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";
7
- import stalux from "stalux";
6
+ import { defineConfig, fontProviders } from "astro/config";
7
+ import stalux from "@xingwangzhe/stalux";
8
8
 
9
9
  // https://astro.build/config
10
10
  export default defineConfig({
@@ -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
  }),
@@ -4,7 +4,7 @@
4
4
  * 使用 stalux 包提供的 defineCollections 快速配置。
5
5
  * 如需自定义内容路径,修改 contentDir 参数即可。
6
6
  */
7
- import { defineCollections } from "stalux/schemas";
7
+ import { defineCollections } from "@xingwangzhe/stalux/schemas/collections";
8
8
 
9
9
  export const collections = defineCollections({
10
10
  contentDir: "stalux",
@@ -1,5 +1,2 @@
1
1
  id: comment
2
2
  enabled: false
3
- waline:
4
- serverURL: ""
5
- lang: en
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Hello Stalux!
3
3
  abbrlink: hello-stalux
4
- date: 2026-07-27 10:00:00
4
+ date: "2026-07-27 10:00:00"
5
5
  tags: [Stalux, Getting Started]
6
6
  categories: [Blog]
7
7
  desc: Welcome to Stalux! This is your first blog post.