@xingwangzhe/stalux 1.25.13 → 1.25.14
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 +2 -19
- package/src/internal/vite-aliases.ts +16 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
collectPluginNames,
|
|
33
33
|
prepareSatteriProcessor,
|
|
34
34
|
} from "./internal/satteri-config";
|
|
35
|
+
import { createViteAliases } from "./internal/vite-aliases";
|
|
35
36
|
import { featureFlagsHast, featureFlagsMdast } from "./plugins/feature-flags";
|
|
36
37
|
import { temml } from "./plugins/satteri-temml";
|
|
37
38
|
|
|
@@ -118,24 +119,6 @@ function syncBackgroundSvgs(srcDir: string): { copied: number; skipped: number }
|
|
|
118
119
|
return { copied, skipped };
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
// ---------------------------------------------------------------------------
|
|
122
|
-
// Vite 别名配置(供页面使用 @components etc.)
|
|
123
|
-
// ---------------------------------------------------------------------------
|
|
124
|
-
|
|
125
|
-
function getViteAliases(srcDir: string) {
|
|
126
|
-
return {
|
|
127
|
-
"@components": path.resolve(srcDir, "components"),
|
|
128
|
-
"@assets": path.resolve(srcDir, "assets"),
|
|
129
|
-
"@layouts": path.resolve(srcDir, "layouts"),
|
|
130
|
-
"@scripts": path.resolve(srcDir, "scripts"),
|
|
131
|
-
"@styles": path.resolve(srcDir, "styles"),
|
|
132
|
-
"@utils": path.resolve(srcDir, "utils"),
|
|
133
|
-
"@i18n": path.resolve(srcDir, "i18n"),
|
|
134
|
-
"@plugins": path.resolve(srcDir, "plugins"),
|
|
135
|
-
"@schemas": path.resolve(srcDir, "schemas"),
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
|
|
139
122
|
// ---------------------------------------------------------------------------
|
|
140
123
|
// 集成入口
|
|
141
124
|
// ---------------------------------------------------------------------------
|
|
@@ -189,7 +172,7 @@ export function stalux(options: StaluxOptions = {}): AstroIntegration[] {
|
|
|
189
172
|
updateConfig({
|
|
190
173
|
vite: {
|
|
191
174
|
resolve: {
|
|
192
|
-
alias:
|
|
175
|
+
alias: createViteAliases(srcDir),
|
|
193
176
|
},
|
|
194
177
|
plugins: [staluxComponentsAlias(opt.components)],
|
|
195
178
|
define: {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
|
|
3
|
+
export function createViteAliases(srcDir: string): Record<string, string> {
|
|
4
|
+
return {
|
|
5
|
+
"@components": path.resolve(srcDir, "components"),
|
|
6
|
+
"@assets": path.resolve(srcDir, "assets"),
|
|
7
|
+
"@layouts": path.resolve(srcDir, "layouts"),
|
|
8
|
+
"@scripts": path.resolve(srcDir, "scripts"),
|
|
9
|
+
"@styles": path.resolve(srcDir, "styles"),
|
|
10
|
+
"@utils": path.resolve(srcDir, "utils"),
|
|
11
|
+
"@i18n": path.resolve(srcDir, "i18n"),
|
|
12
|
+
"@plugins": path.resolve(srcDir, "plugins"),
|
|
13
|
+
"@schemas": path.resolve(srcDir, "schemas"),
|
|
14
|
+
"@internal": path.resolve(srcDir, "internal"),
|
|
15
|
+
};
|
|
16
|
+
}
|