@@ -5,67 +5,24 @@ import generateSitemap from 'vite-ssg-sitemap'
5
5
import { server } from '@stacksjs/server'
6
6
import { alias } from '@stacksjs/alias'
7
7
import { config } from '@stacksjs/config'
8
- // @ts -expect-error missing types
8
+ // @ts -expect-error missing types - somehow, @stacksjs/vite-plugin-vue-layouts does not work
9
9
import Layouts from 'vite-plugin-vue-layouts'
10
- import Components from 'unplugin-vue-components/vite'
11
- import AutoImport from 'unplugin-auto-import/vite'
12
- import Markdown from 'unplugin-vue-markdown/vite'
10
+ import { autoImports } from './plugin/auto-imports'
11
+ import { layouts } from './plugin/layouts'
12
+ import { markdown } from './plugin/ui-engine'
13
+ import { components } from './plugin/components'
14
+ import { i18n } from './plugin/i18n'
15
+ import { fonts } from './plugin/fonts'
16
+ import { pwa } from './plugin/pwa'
17
+ import { cssEngine } from './plugin/css-engine'
13
18
import VueMacros from 'unplugin-vue-macros/vite'
14
- import VueI18n from '@intlify/unplugin-vue-i18n/vite'
15
- import { VitePWA } from 'vite-plugin-pwa'
16
19
import VueDevTools from 'vite-plugin-vue-devtools'
17
- import LinkAttributes from 'markdown-it-link-attributes'
18
- import Unocss from 'unocss/vite'
19
- import Shiki from 'markdown-it-shikiji'
20
- import WebfontDownload from 'vite-plugin-webfont-dl'
21
20
import VueRouter from 'unplugin-vue-router/vite'
22
- import { VueRouterAutoImports } from 'unplugin-vue-router'
23
21
24
22
// const isMaintenanceMode = config.app.maintenanceMode
25
23
// const maintenancePath = isMaintenanceMode ? '' : './maintenance'
26
24
27
25
export default defineConfig ( {
28
- build : {
29
- rollupOptions : {
30
- external : [ 'path' , 'fs' , 'net' , 'tls' , 'stream' , 'node:process' , 'constants' , 'node:dns/promises' , 'node:util' ] ,
31
- }
32
- } ,
33
-
34
- // define: {
35
- // 'process.env': {
36
- // APP_NAME: JSON.stringify(process.env.APP_NAME),
37
- // APP_ENV: JSON.stringify(process.env.APP_ENV),
38
- // APP_KEY: JSON.stringify(process.env.APP_KEY),
39
- // APP_DEBUG: JSON.stringify(process.env.APP_DEBUG),
40
- // APP_URL: JSON.stringify(process.env.APP_URL),
41
- // APP_PORT: JSON.stringify(process.env.APP_PORT),
42
- // APP_MAINTENANCE: JSON.stringify(process.env.APP_MAINTENANCE),
43
- // DB_CONNECTION: JSON.stringify(process.env.DB_CONNECTION),
44
- // DB_HOST: JSON.stringify(process.env.DB_HOST),
45
- // DB_PORT: JSON.stringify(process.env.DB_PORT),
46
- // DB_DATABASE: JSON.stringify(process.env.DB_DATABASE),
47
- // DB_USERNAME: JSON.stringify(process.env.DB_USERNAME),
48
- // DB_PASSWORD: JSON.stringify(process.env.DB_PASSWORD),
49
- // AWS_ACCESS_KEY_ID: JSON.stringify(process.env.AWS_ACCESS_KEY_ID),
50
- // AWS_SECRET_ACCESS_KEY: JSON.stringify(process.env.AWS_SECRET_ACCESS_KEY),
51
- // AWS_DEFAULT_PASSWORD: JSON.stringify(process.env.AWS_DEFAULT_PASSWORD),
52
- // AWS_REGION: JSON.stringify(process.env.AWS_REGION),
53
- // MAIL_MAILER: JSON.stringify(process.env.MAIL_MAILER),
54
- // MAIL_HOST: JSON.stringify(process.env.MAIL_HOST),
55
- // MAIL_PORT: JSON.stringify(process.env.MAIL_PORT),
56
- // MAIL_USERNAME: JSON.stringify(process.env.MAIL_USERNAME),
57
- // MAIL_PASSWORD: JSON.stringify(process.env.MAIL_PASSWORD),
58
- // MAIL_ENCRYPTION: JSON.stringify(process.env.MAIL_ENCRYPTION),
59
- // MAIL_FROM_NAME: JSON.stringify(process.env.MAIL_FROM_NAME),
60
- // MAIL_FROM_ADDRESS: JSON.stringify(process.env.MAIL_FROM_ADDRESS),
61
- // SEARCH_ENGINE_DRIVER: JSON.stringify(process.env.SEARCH_ENGINE_DRIVER),
62
- // MEILISEARCH_HOST: JSON.stringify(process.env.MEILISEARCH_HOST),
63
- // MEILISEARCH_KEY: JSON.stringify(process.env.MEILISEARCH_KEY),
64
- // FRONTEND_APP_ENV: JSON.stringify(process.env.FRONTEND_APP_ENV),
65
- // FRONTEND_APP_URL: JSON.stringify(process.env.FRONTEND_APP_URL),
66
- // },
67
- // },
68
-
69
26
root : p . frameworkStoragePath ( 'views' ) ,
70
27
publicDir : p . publicPath ( ) ,
71
28
envDir : p . projectPath ( ) ,
@@ -99,117 +56,27 @@ export default defineConfig({
99
56
} ) ,
100
57
101
58
// https://github.com/JohnCampionJr/vite-plugin-vue-layouts
102
- Layouts ( {
103
- layoutsDir : p . resourcesPath ( 'layouts' ) ,
104
- defaultLayout : p . resourcesPath ( 'layouts/default.vue' ) ,
105
- exclude : [
106
- p . resourcesPath ( 'layouts/mails' ) ,
107
- ] ,
108
- } ) ,
59
+ layouts ( ) ,
109
60
110
61
// https://github.com/antfu/unplugin-auto-import
111
- AutoImport ( {
112
- imports : [
113
- 'vue' ,
114
- 'vue-i18n' ,
115
- '@vueuse/head' ,
116
- '@vueuse/core' ,
117
- VueRouterAutoImports ,
118
- {
119
- // add any other imports you were relying on
120
- 'vue-router/auto' : [ 'useLink' ] ,
121
- } ,
122
- ] ,
123
- dts : p . frameworkStoragePath ( 'types/auto-imports.d.ts' ) ,
124
- dirs : [
125
- p . resourcesPath ( 'functions' ) ,
126
- p . resourcesPath ( 'stores' ) ,
127
- ] ,
128
- vueTemplate : true ,
129
- } ) ,
62
+ autoImports ( ) ,
130
63
131
64
// https://github.com/antfu/unplugin-vue-components
132
- Components ( {
133
- // allow auto load markdown components under `./resources/components/`
134
- extensions : [ 'vue' , 'md' ] ,
135
- // allow auto import and register components used in markdown
136
- include : [ / \. v u e $ / , / \. v u e \? v u e / , / \. m d $ / ] ,
137
- dts : p . frameworkStoragePath ( 'types/components.d.ts' ) ,
138
- dirs : [
139
- p . resourcesPath ( 'components' ) ,
140
- ] ,
141
- } ) ,
65
+ components ( ) ,
142
66
143
67
// https://github.com/antfu/unocss
144
68
// see uno.config.ts for config
145
- Unocss ( {
146
- configFile : p . uiPath ( 'src/uno.config.ts' ) ,
147
- } ) ,
69
+ cssEngine ( ) ,
148
70
149
- // https://github.com/unplugin/unplugin-vue-markdown
150
- Markdown ( {
151
- wrapperClasses : 'prose prose-sm m-auto text-left' ,
152
- headEnabled : true ,
153
- async markdownItSetup ( md ) {
154
- md . use ( LinkAttributes , {
155
- matcher : ( link : string ) => / ^ h t t p s ? : \/ \/ / . test ( link ) ,
156
- attrs : {
157
- target : '_blank' ,
158
- rel : 'noopener' ,
159
- } ,
160
- } )
161
- md . use ( await Shiki ( {
162
- defaultColor : false ,
163
- themes : {
164
- light : 'vitesse-light' ,
165
- dark : 'vitesse-dark' ,
166
- } ,
167
- } ) )
168
- } ,
169
- } ) ,
71
+ markdown ( ) ,
170
72
171
73
// https://github.com/antfu/vite-plugin-pwa
172
- VitePWA ( {
173
- srcDir : p . publicPath ( ) ,
174
- registerType : 'autoUpdate' ,
175
- includeAssets : [ 'favicon.svg' , 'safari-pinned-tab.svg' ] ,
176
- manifest : {
177
- name : 'Stacks' ,
178
- short_name : 'Stacks' ,
179
- theme_color : '#ffffff' ,
180
- icons : [
181
- {
182
- src : '/pwa-192x192.png' ,
183
- sizes : '192x192' ,
184
- type : 'image/png' ,
185
- } ,
186
- {
187
- src : '/pwa-512x512.png' ,
188
- sizes : '512x512' ,
189
- type : 'image/png' ,
190
- } ,
191
- {
192
- src : '/pwa-512x512.png' ,
193
- sizes : '512x512' ,
194
- type : 'image/png' ,
195
- purpose : 'any maskable' ,
196
- } ,
197
- ] ,
198
- } ,
199
- } ) ,
74
+ pwa ( ) ,
200
75
201
76
// https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n
202
- VueI18n ( {
203
- runtimeOnly : true ,
204
- compositionOnly : true ,
205
- fullInstall : true ,
206
- include : [
207
- p . resolve ( __dirname , '../../../../../../lang/**' )
208
- ] ,
209
- } ) ,
77
+ i18n ( ) ,
210
78
211
- // https://github.com/feat-agency/vite-plugin-webfont-dl
212
- WebfontDownload ( ) ,
79
+ fonts ( ) ,
213
80
214
81
// https://github.com/webfansplz/vite-plugin-vue-devtools
215
82
VueDevTools ( ) ,
@@ -233,4 +100,10 @@ export default defineConfig({
233
100
// TODO: workaround until they support native ESM
234
101
noExternal : [ 'workbox-window' , / v u e - i 1 8 n / ] ,
235
102
} ,
103
+
104
+ build : {
105
+ rollupOptions : {
106
+ external : [ 'path' , 'fs' , 'net' , 'tls' , 'stream' , 'node:process' , 'constants' , 'node:dns/promises' , 'node:util' ] ,
107
+ }
108
+ } ,
236
109
} )
0 commit comments