@astro-minimax/cli 0.7.4 → 0.8.0
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/README.md +2 -2
- package/package.json +1 -1
- package/template/astro.config.ts +32 -11
- package/template/functions/api/chat.ts +5 -1
- package/template/package.json +10 -11
- package/template/public/favicon.ico +0 -0
- package/template/src/config.ts +3 -11
- package/template/src/data/blog/zh/alerts-examples.md +1 -0
- package/template/src/data/blog/zh/code-examples.md +1 -0
- package/template/src/data/blog/zh/hello-world.md +1 -0
- package/template/src/data/blog/zh/markmap-examples.md +1 -0
- package/template/src/data/blog/zh/math-examples.md +1 -0
- package/template/src/data/blog/zh/mermaid-examples.md +1 -0
- package/template/tsconfig.json +4 -1
package/README.md
CHANGED
|
@@ -20,10 +20,10 @@ yarn dlx @astro-minimax/cli my-blog
|
|
|
20
20
|
```
|
|
21
21
|
my-blog/
|
|
22
22
|
├── astro.config.ts # Astro + minimax integration config
|
|
23
|
-
├── package.json # Dependencies (core,
|
|
23
|
+
├── package.json # Dependencies (core, tailwind, etc.)
|
|
24
24
|
├── tsconfig.json # TypeScript configuration
|
|
25
25
|
├── public/
|
|
26
|
-
│ └── favicon.
|
|
26
|
+
│ └── favicon.ico
|
|
27
27
|
└── src/
|
|
28
28
|
├── config.ts # SITE configuration object
|
|
29
29
|
├── constants.ts # Social links and share links
|
package/package.json
CHANGED
package/template/astro.config.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineConfig, envField } from "astro/config";
|
|
2
2
|
import tailwindcss from "@tailwindcss/vite";
|
|
3
3
|
import minimax from "@astro-minimax/core";
|
|
4
|
-
import minimaxViz from "@astro-minimax/viz";
|
|
5
4
|
import sitemap from "@astrojs/sitemap";
|
|
6
5
|
import mdx from "@astrojs/mdx";
|
|
7
6
|
import preact from "@astrojs/preact";
|
|
@@ -31,6 +30,7 @@ import { SITE } from "./src/config";
|
|
|
31
30
|
import { SOCIALS, SHARE_LINKS } from "./src/constants";
|
|
32
31
|
import { FRIENDS } from "./src/data/friends";
|
|
33
32
|
|
|
33
|
+
// Shiki transformers require type casting since they use a different type system
|
|
34
34
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
35
|
const asTransformer = (t: any) => t;
|
|
36
36
|
|
|
@@ -59,9 +59,11 @@ export default defineConfig({
|
|
|
59
59
|
shareLinks: SHARE_LINKS,
|
|
60
60
|
friends: FRIENDS,
|
|
61
61
|
blogPath: "src/data/blog",
|
|
62
|
+
viz: { mermaid: true, markmap: true },
|
|
63
|
+
}),
|
|
64
|
+
preact({
|
|
65
|
+
compat: true,
|
|
62
66
|
}),
|
|
63
|
-
minimaxViz({ mermaid: true, markmap: true }),
|
|
64
|
-
preact({ compat: true }),
|
|
65
67
|
sitemap({
|
|
66
68
|
filter: page => SITE.showArchives || !page.endsWith("/archives"),
|
|
67
69
|
}),
|
|
@@ -97,10 +99,13 @@ export default defineConfig({
|
|
|
97
99
|
},
|
|
98
100
|
},
|
|
99
101
|
vite: {
|
|
100
|
-
plugins: [
|
|
102
|
+
plugins: [
|
|
103
|
+
tailwindcss() as never,
|
|
104
|
+
],
|
|
101
105
|
server: {
|
|
102
106
|
fs: {
|
|
103
|
-
strict:
|
|
107
|
+
strict: true,
|
|
108
|
+
allow: ["./src", "./.astro"],
|
|
104
109
|
},
|
|
105
110
|
proxy: {
|
|
106
111
|
"/api": {
|
|
@@ -108,18 +113,35 @@ export default defineConfig({
|
|
|
108
113
|
changeOrigin: true,
|
|
109
114
|
},
|
|
110
115
|
},
|
|
116
|
+
warmup: {
|
|
117
|
+
clientFiles: [
|
|
118
|
+
"./src/components/**/*.astro",
|
|
119
|
+
"./src/layouts/**/*.astro",
|
|
120
|
+
],
|
|
121
|
+
},
|
|
111
122
|
},
|
|
112
123
|
resolve: {
|
|
113
124
|
alias: {
|
|
114
|
-
"@/": new URL("./src/", import.meta.url).pathname,
|
|
125
|
+
"@/" : new URL("./src/", import.meta.url).pathname,
|
|
115
126
|
"react": "preact/compat",
|
|
116
127
|
"react-dom": "preact/compat",
|
|
117
128
|
"react/jsx-runtime": "preact/jsx-runtime",
|
|
118
129
|
},
|
|
119
130
|
dedupe: ["preact", "preact/hooks", "preact/compat", "preact/debug", "preact/devtools", "react", "react-dom"],
|
|
120
131
|
},
|
|
132
|
+
// Pre-bundle dependencies to speed up development and ensure consistency.
|
|
133
|
+
//
|
|
134
|
+
// WHY: By explicitly including these packages in optimizeDeps, Vite pre-bundles
|
|
135
|
+
// them on startup. This prevents lazy-loading race conditions where modules
|
|
136
|
+
// might load from different copies during dev. Particularly important for
|
|
137
|
+
// @ai-sdk/react which uses hooks that must resolve consistently.
|
|
138
|
+
//
|
|
139
|
+
// NOTE: Local workspace packages (@astro-minimax/*) are excluded from optimization
|
|
140
|
+
// because they're linked via workspace protocol and should be loaded fresh on changes.
|
|
141
|
+
// Excluding them also ensures JSX transformation uses Preact's jsx-runtime correctly.
|
|
121
142
|
optimizeDeps: {
|
|
122
|
-
|
|
143
|
+
noDiscovery: true,
|
|
144
|
+
exclude: ["@resvg/resvg-js", "@astro-minimax/ai", "@astro-minimax/core"],
|
|
123
145
|
include: [
|
|
124
146
|
"preact",
|
|
125
147
|
"preact/hooks",
|
|
@@ -130,9 +152,9 @@ export default defineConfig({
|
|
|
130
152
|
"preact/jsx-dev-runtime",
|
|
131
153
|
"@ai-sdk/react",
|
|
132
154
|
"ai",
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
155
|
+
"mermaid",
|
|
156
|
+
"markmap-lib",
|
|
157
|
+
"katex",
|
|
136
158
|
],
|
|
137
159
|
},
|
|
138
160
|
ssr: {
|
|
@@ -140,7 +162,6 @@ export default defineConfig({
|
|
|
140
162
|
noExternal: [
|
|
141
163
|
"@astro-minimax/ai",
|
|
142
164
|
"@astro-minimax/core",
|
|
143
|
-
"@astro-minimax/viz",
|
|
144
165
|
"@ai-sdk/react",
|
|
145
166
|
"ai",
|
|
146
167
|
],
|
|
@@ -7,8 +7,11 @@ import voiceProfile from '../../datas/voice-profile.json';
|
|
|
7
7
|
import factRegistry from '../../datas/fact-registry.json';
|
|
8
8
|
|
|
9
9
|
// Optional: TF-IDF vector index for enhanced search reranking
|
|
10
|
+
// The vector index is created by `astro-minimax ai process` command
|
|
11
|
+
// Using dynamic import in try/catch since the file may not exist yet
|
|
10
12
|
let vectorIndex: unknown = null;
|
|
11
|
-
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
try { vectorIndex = (await import('../../src/data/vectors/index.json' as any)).default; } catch { /* not available */ }
|
|
12
15
|
|
|
13
16
|
interface FunctionEnv extends ChatHandlerEnv {
|
|
14
17
|
CACHE_KV?: KVNamespace;
|
|
@@ -24,5 +27,6 @@ export const onRequest: PagesFunction<FunctionEnv> = async (context) => {
|
|
|
24
27
|
return handleChatRequest({
|
|
25
28
|
env: context.env,
|
|
26
29
|
request: context.request,
|
|
30
|
+
waitUntil: context.waitUntil,
|
|
27
31
|
});
|
|
28
32
|
};
|
package/template/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"dev": "concurrently -n \"astro,ai\" -c \"blue,green\" \"astro dev\" \"pnpm exec astro-ai-dev\"",
|
|
7
7
|
"dev:astro": "astro dev",
|
|
8
8
|
"dev:ai": "pnpm exec astro-ai-dev",
|
|
9
|
-
"build": "astro check && astro build && pagefind --site dist
|
|
9
|
+
"build": "astro check && astro build && pagefind --site dist",
|
|
10
10
|
"preview": "wrangler pages dev dist",
|
|
11
11
|
"preview:astro": "astro preview",
|
|
12
12
|
"lint": "eslint .",
|
|
@@ -28,38 +28,37 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@ai-sdk/openai-compatible": "^2.0.35",
|
|
30
30
|
"@ai-sdk/react": "^3.0.118",
|
|
31
|
-
"@astro-minimax/ai": "^0.
|
|
32
|
-
"@astro-minimax/core": "^0.
|
|
33
|
-
"@astro-minimax/notify": "^0.
|
|
34
|
-
"@astro-minimax/viz": "^0.7.2",
|
|
31
|
+
"@astro-minimax/ai": "^0.8.0",
|
|
32
|
+
"@astro-minimax/core": "^0.8.0",
|
|
33
|
+
"@astro-minimax/notify": "^0.8.0",
|
|
35
34
|
"@astrojs/mdx": "^5.0.0",
|
|
36
35
|
"@astrojs/preact": "^5.0.0",
|
|
37
36
|
"@astrojs/rss": "^4.0.17",
|
|
38
37
|
"@astrojs/sitemap": "^3.7.1",
|
|
39
38
|
"@fontsource/ibm-plex-mono": "^5.2.7",
|
|
40
|
-
"@resvg/resvg-js": "^2.6.
|
|
39
|
+
"@resvg/resvg-js": "^2.6.2",
|
|
41
40
|
"@shikijs/rehype": "^4.0.2",
|
|
42
|
-
"@tailwindcss/typography": "^0.5.19",
|
|
43
41
|
"@tailwindcss/vite": "^4.2.1",
|
|
44
42
|
"ai": "^6.0.116",
|
|
45
43
|
"astro": "^6.0.0",
|
|
46
44
|
"dayjs": "^1.11.19",
|
|
47
45
|
"lodash.kebabcase": "^4.1.1",
|
|
46
|
+
"markmap-lib": "^0.18.11",
|
|
48
47
|
"mermaid": "^11.12.3",
|
|
49
48
|
"preact": "^10.29.0",
|
|
49
|
+
"qrcode": "^1.5.4",
|
|
50
50
|
"rehype-katex": "^7.0.1",
|
|
51
51
|
"remark-emoji": "^5.0.2",
|
|
52
52
|
"remark-github-alerts": "^0.1.1",
|
|
53
|
-
"remark-markmap": "^1.1.5",
|
|
54
53
|
"remark-math": "^6.0.0",
|
|
55
|
-
"satori": "^0.
|
|
54
|
+
"satori": "^0.25.0",
|
|
56
55
|
"sharp": "^0.34.5",
|
|
57
56
|
"slugify": "^1.6.6",
|
|
58
57
|
"tailwindcss": "^4.2.1"
|
|
59
58
|
},
|
|
60
59
|
"devDependencies": {
|
|
61
|
-
"@astro-minimax/cli": "^0.
|
|
62
|
-
"@astrojs/check": "^0.9.
|
|
60
|
+
"@astro-minimax/cli": "^0.8.0",
|
|
61
|
+
"@astrojs/check": "^0.9.7",
|
|
63
62
|
"@cloudflare/workers-types": "^4.20260313.1",
|
|
64
63
|
"@pagefind/default-ui": "^1.4.0",
|
|
65
64
|
"@shikijs/transformers": "^4.0.2",
|
|
Binary file
|
package/template/src/config.ts
CHANGED
|
@@ -23,12 +23,12 @@ export const SITE: SiteConfig = {
|
|
|
23
23
|
series: true,
|
|
24
24
|
archives: true,
|
|
25
25
|
search: true,
|
|
26
|
-
darkMode: true,
|
|
27
26
|
friends: false,
|
|
28
27
|
projects: false,
|
|
29
|
-
ai: false,
|
|
30
28
|
},
|
|
31
29
|
|
|
30
|
+
darkMode: true,
|
|
31
|
+
|
|
32
32
|
nav: {
|
|
33
33
|
items: [
|
|
34
34
|
{ key: "home", enabled: true },
|
|
@@ -109,15 +109,7 @@ export const SITE: SiteConfig = {
|
|
|
109
109
|
apiEndpoint: "/api/chat",
|
|
110
110
|
},
|
|
111
111
|
|
|
112
|
-
get lightAndDarkMode() {
|
|
113
|
-
return this.features?.darkMode;
|
|
114
|
-
},
|
|
115
|
-
|
|
116
112
|
get showArchives() {
|
|
117
113
|
return this.features?.archives ?? true;
|
|
118
114
|
},
|
|
119
|
-
|
|
120
|
-
get aiEnabled() {
|
|
121
|
-
return (this.features?.ai ?? false) && (this.ai?.enabled ?? false);
|
|
122
|
-
},
|
|
123
|
-
};
|
|
115
|
+
};
|