@stacksjs/build 0.56.35 → 0.57.3

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.
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfigExport;
2
+ export default _default;
@@ -0,0 +1,139 @@
1
+ import path from "node:path";
2
+ import { defineConfig } from "vite";
3
+ import Vue from "@vitejs/plugin-vue";
4
+ import Pages from "vite-plugin-pages";
5
+ import generateSitemap from "vite-ssg-sitemap";
6
+ import Components from "unplugin-vue-components/vite";
7
+ import AutoImport from "unplugin-auto-import/vite";
8
+ import Markdown from "vite-plugin-vue-markdown";
9
+ import { VitePWA } from "vite-plugin-pwa";
10
+ import Inspect from "vite-plugin-inspect";
11
+ import LinkAttributes from "markdown-it-link-attributes";
12
+ import Unocss from "@unocss/vite";
13
+ import Shiki from "markdown-it-shiki";
14
+ export default defineConfig({
15
+ resolve: {
16
+ alias: {
17
+ "~/": `${path.resolve(__dirname, "../../../../")}/`
18
+ }
19
+ },
20
+ clearScreen: false,
21
+ server: {
22
+ port: 3333,
23
+ strictPort: true
24
+ },
25
+ envPrefix: [""],
26
+ plugins: [
27
+ Vue({
28
+ include: [/\.vue$/, /\.md$/],
29
+ reactivityTransform: true
30
+ }),
31
+ // https://github.com/hannoeru/vite-plugin-pages
32
+ Pages({
33
+ extensions: ["vue", "md"]
34
+ }),
35
+ // https://github.com/antfu/unplugin-auto-import
36
+ AutoImport({
37
+ imports: [
38
+ "vue",
39
+ "vue-router",
40
+ "vue-i18n",
41
+ "vue/macros",
42
+ "@vueuse/head",
43
+ "@vueuse/core"
44
+ ],
45
+ dts: "../../../auto-imports.d.ts",
46
+ dirs: [
47
+ projectPath("functions"),
48
+ "../../../../app/stores"
49
+ ],
50
+ vueTemplate: true
51
+ }),
52
+ // https://github.com/antfu/unplugin-vue-components
53
+ Components({
54
+ // allow auto load markdown components under `./src/components/`
55
+ extensions: ["vue", "md"],
56
+ // allow auto import and register components used in markdown
57
+ include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
58
+ dts: "../../../../components"
59
+ }),
60
+ // https://github.com/antfu/unocss
61
+ // see unocss.config.ts for config
62
+ Unocss({
63
+ configFile: "../../ui/src/unocss.config.ts",
64
+ mode: "vue-scoped"
65
+ }),
66
+ // https://github.com/antfu/vite-plugin-vue-markdown
67
+ // Don't need this? Try vitesse-lite: https://github.com/antfu/vitesse-lite
68
+ Markdown({
69
+ wrapperClasses: "prose prose-sm m-auto text-left",
70
+ headEnabled: true,
71
+ markdownItSetup(md) {
72
+ md.use(Shiki, {
73
+ theme: {
74
+ light: "vitesse-light",
75
+ dark: "vitesse-dark"
76
+ }
77
+ });
78
+ md.use(LinkAttributes, {
79
+ matcher: (link) => /^https?:\/\//.test(link),
80
+ attrs: {
81
+ target: "_blank",
82
+ rel: "noopener"
83
+ }
84
+ });
85
+ }
86
+ }),
87
+ // https://github.com/antfu/vite-plugin-pwa
88
+ VitePWA({
89
+ registerType: "autoUpdate",
90
+ includeAssets: ["favicon.ico", "safari-pinned-tab.svg"],
91
+ manifest: {
92
+ name: "Vitesse",
93
+ short_name: "Vitesse",
94
+ theme_color: "#ffffff",
95
+ icons: [
96
+ {
97
+ src: "/pwa-192x192.png",
98
+ sizes: "192x192",
99
+ type: "image/png"
100
+ },
101
+ {
102
+ src: "/pwa-512x512.png",
103
+ sizes: "512x512",
104
+ type: "image/png"
105
+ },
106
+ {
107
+ src: "/pwa-512x512.png",
108
+ sizes: "512x512",
109
+ type: "image/png",
110
+ purpose: "any maskable"
111
+ }
112
+ ]
113
+ }
114
+ }),
115
+ // https://github.com/antfu/vite-plugin-inspect
116
+ // Visit http://localhost:3333/__inspect/ to see the inspector
117
+ Inspect()
118
+ ],
119
+ // https://github.com/vitest-dev/vitest
120
+ test: {
121
+ include: ["test/**/*.test.ts"],
122
+ environment: "jsdom",
123
+ deps: {
124
+ inline: ["@vue", "@vueuse", "vue-demi"]
125
+ }
126
+ },
127
+ // https://github.com/antfu/vite-ssg
128
+ ssgOptions: {
129
+ script: "async",
130
+ formatting: "minify",
131
+ onFinished() {
132
+ generateSitemap();
133
+ }
134
+ },
135
+ ssr: {
136
+ // TODO: workaround until they support native ESM
137
+ noExternal: ["workbox-window", /vue-i18n/]
138
+ }
139
+ });
@@ -0,0 +1,4 @@
1
+ import type { ViteConfig } from '@stacksjs/types';
2
+ export declare const vueComponentsExampleConfig: ViteConfig;
3
+ declare const _default: import("vite").UserConfigExport;
4
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { defineConfig } from "vite";
2
+ import { examplesPath } from "@stacksjs/path";
3
+ import { server } from "@stacksjs/server";
4
+ import { alias } from "@stacksjs/alias";
5
+ export const vueComponentsExampleConfig = {
6
+ root: examplesPath("vue-components"),
7
+ resolve: {
8
+ alias
9
+ },
10
+ server
11
+ // plugins: [
12
+ // uiEngine(),
13
+ // ],
14
+ };
15
+ export default defineConfig(() => {
16
+ return vueComponentsExampleConfig;
17
+ });
@@ -0,0 +1,4 @@
1
+ import type { ViteConfig } from '@stacksjs/types';
2
+ export declare const webComponentsExampleConfig: ViteConfig;
3
+ declare const _default: import("vite").UserConfigExport;
4
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { defineConfig } from "vite";
2
+ import { examplesPath } from "@stacksjs/path";
3
+ import { server } from "@stacksjs/server";
4
+ import { alias } from "@stacksjs/alias";
5
+ export const webComponentsExampleConfig = {
6
+ root: examplesPath("web-components"),
7
+ resolve: {
8
+ alias
9
+ },
10
+ server
11
+ // plugins: [
12
+ // uiEngine(true),
13
+ // ],
14
+ };
15
+ export default defineConfig(() => {
16
+ return webComponentsExampleConfig;
17
+ });
@@ -0,0 +1,6 @@
1
+ import type { BuildOptions as ViteBuildOptions } from 'vite';
2
+ import type { ViteConfig } from '@stacksjs/types';
3
+ export declare const functionsConfig: ViteConfig;
4
+ export declare function functionsBuildOptions(): ViteBuildOptions;
5
+ declare const _default: import("vite").UserConfigExport;
6
+ export default _default;
@@ -0,0 +1,40 @@
1
+ import { defineConfig } from "vite";
2
+ import { frameworkPath, functionsPath, libraryEntryPath, projectPath } from "@stacksjs/path";
3
+ import { library } from "@stacksjs/config";
4
+ import { alias } from "@stacksjs/alias";
5
+ export const functionsConfig = {
6
+ root: functionsPath(),
7
+ envDir: projectPath(),
8
+ envPrefix: "",
9
+ resolve: {
10
+ alias
11
+ },
12
+ // plugins: [
13
+ // autoImports(),
14
+ // ],
15
+ build: functionsBuildOptions()
16
+ };
17
+ export function functionsBuildOptions() {
18
+ return {
19
+ outDir: frameworkPath("functions/dist"),
20
+ emptyOutDir: true,
21
+ sourcemap: library.functions?.shouldGenerateSourcemap,
22
+ lib: {
23
+ entry: libraryEntryPath("functions"),
24
+ name: library.functions?.name,
25
+ formats: ["cjs", "es"],
26
+ fileName: (format) => {
27
+ if (format === "es")
28
+ return "index.mjs";
29
+ if (format === "cjs")
30
+ return "index.cjs";
31
+ return "index.?.js";
32
+ }
33
+ }
34
+ };
35
+ }
36
+ export default defineConfig(({ command }) => {
37
+ if (command === "serve")
38
+ return functionsConfig;
39
+ return functionsConfig;
40
+ });
package/dist/index.d.ts CHANGED
@@ -1,116 +1,7 @@
1
- import * as vite from 'vite';
2
- import { BuildOptions, PluginOption } from 'vite';
3
- import { ViteConfig, InspectOptions, LayoutOptions, ComponentOptions, PagesOption, AutoImportsOptions } from '@stacksjs/types';
4
- import { resolve } from '@stacksjs/path';
5
-
6
- declare const vueComponentsExampleConfig: ViteConfig;
7
- declare const _default$5: vite.UserConfigExport;
8
-
9
- declare const exampleVue_vueComponentsExampleConfig: typeof vueComponentsExampleConfig;
10
- declare namespace exampleVue {
11
- export {
12
- _default$5 as default,
13
- exampleVue_vueComponentsExampleConfig as vueComponentsExampleConfig,
14
- };
15
- }
16
-
17
- declare const webComponentsExampleConfig: ViteConfig;
18
- declare const _default$4: vite.UserConfigExport;
19
-
20
- declare const exampleWc_webComponentsExampleConfig: typeof webComponentsExampleConfig;
21
- declare namespace exampleWc {
22
- export {
23
- _default$4 as default,
24
- exampleWc_webComponentsExampleConfig as webComponentsExampleConfig,
25
- };
26
- }
27
-
28
- declare const functionsConfig: ViteConfig;
29
- declare function functionsBuildOptions(): BuildOptions;
30
- declare const _default$3: vite.UserConfigExport;
31
-
32
- declare const functions_functionsBuildOptions: typeof functionsBuildOptions;
33
- declare const functions_functionsConfig: typeof functionsConfig;
34
- declare namespace functions {
35
- export {
36
- _default$3 as default,
37
- functions_functionsBuildOptions as functionsBuildOptions,
38
- functions_functionsConfig as functionsConfig,
39
- };
40
- }
41
-
42
- declare const pagesConfig: ViteConfig;
43
- declare const _default$2: vite.UserConfigExport;
44
-
45
- declare const views_pagesConfig: typeof pagesConfig;
46
- declare namespace views {
47
- export {
48
- _default$2 as default,
49
- views_pagesConfig as pagesConfig,
50
- };
51
- }
52
-
53
- declare const vueComponentsConfig: ViteConfig;
54
- declare function vueComponentsBuildOptions(): BuildOptions;
55
- declare const _default$1: vite.UserConfigExport;
56
-
57
- declare const vueComponents_vueComponentsBuildOptions: typeof vueComponentsBuildOptions;
58
- declare const vueComponents_vueComponentsConfig: typeof vueComponentsConfig;
59
- declare namespace vueComponents {
60
- export {
61
- _default$1 as default,
62
- vueComponents_vueComponentsBuildOptions as vueComponentsBuildOptions,
63
- vueComponents_vueComponentsConfig as vueComponentsConfig,
64
- };
65
- }
66
-
67
- declare const webComponentsConfig: ViteConfig;
68
- declare function webComponentsBuildOptions(): BuildOptions;
69
- declare const _default: vite.UserConfigExport;
70
-
71
- declare const webComponents_webComponentsBuildOptions: typeof webComponentsBuildOptions;
72
- declare const webComponents_webComponentsConfig: typeof webComponentsConfig;
73
- declare namespace webComponents {
74
- export {
75
- _default as default,
76
- webComponents_webComponentsBuildOptions as webComponentsBuildOptions,
77
- webComponents_webComponentsConfig as webComponentsConfig,
78
- };
79
- }
80
-
81
- declare function inspect(options?: InspectOptions): vite.Plugin;
82
- declare function layouts(options?: LayoutOptions): vite.Plugin;
83
- declare function components(options?: ComponentOptions): PluginOption;
84
- declare function pages(options?: PagesOption): vite.Plugin;
85
- declare function autoImports(options?: AutoImportsOptions): any;
86
- declare function cssEngine(isWebComponent?: boolean): vite.Plugin[];
87
- declare function pwa(): vite.Plugin[];
88
- declare function uiEngine(isWebComponent?: boolean): vite.Plugin;
89
- declare function componentPreset(isWebComponent?: boolean): (vite.Plugin | vite.Plugin[])[];
90
-
91
- declare const stacks_autoImports: typeof autoImports;
92
- declare const stacks_componentPreset: typeof componentPreset;
93
- declare const stacks_components: typeof components;
94
- declare const stacks_cssEngine: typeof cssEngine;
95
- declare const stacks_inspect: typeof inspect;
96
- declare const stacks_layouts: typeof layouts;
97
- declare const stacks_pages: typeof pages;
98
- declare const stacks_pwa: typeof pwa;
99
- declare const stacks_resolve: typeof resolve;
100
- declare const stacks_uiEngine: typeof uiEngine;
101
- declare namespace stacks {
102
- export {
103
- stacks_autoImports as autoImports,
104
- stacks_componentPreset as componentPreset,
105
- stacks_components as components,
106
- stacks_cssEngine as cssEngine,
107
- stacks_inspect as inspect,
108
- stacks_layouts as layouts,
109
- stacks_pages as pages,
110
- stacks_pwa as pwa,
111
- stacks_resolve as resolve,
112
- stacks_uiEngine as uiEngine,
113
- };
114
- }
115
-
116
- export { functions, stacks, views, exampleVue as vueComponentExample, vueComponents, exampleWc as webComponentExample, webComponents };
1
+ export * as vueComponentExample from './example-vue';
2
+ export * as webComponentExample from './example-wc';
3
+ export * as functions from './functions';
4
+ export * as views from './views';
5
+ export * as vueComponents from './vue-components';
6
+ export * as webComponents from './web-components';
7
+ export * as stacks from './stacks';
package/dist/index.mjs CHANGED
@@ -1,456 +1,7 @@
1
- import { defineConfig, loadEnv } from 'vite';
2
- import { examplesPath, functionsPath, projectPath, frameworkPath, libraryEntryPath, path, resolve, storagePath, libsPath } from '@stacksjs/path';
3
- import { server } from '@stacksjs/server';
4
- import { alias } from '@stacksjs/alias';
5
- import { library, app } from '@stacksjs/config';
6
- import mkcert from 'vite-plugin-mkcert';
7
- import c from 'picocolors';
8
- import AutoImport from 'unplugin-auto-import/vite';
9
- import Components from 'unplugin-vue-components/vite';
10
- import Vue from '@vitejs/plugin-vue';
11
- import Unocss from 'unocss/vite';
12
- import Inspect from 'vite-plugin-inspect';
13
- import Pages from 'vite-plugin-pages';
14
- import Layouts from 'vite-plugin-vue-layouts';
15
- import { VitePWA } from 'vite-plugin-pwa';
16
- import { defu } from 'defu';
17
-
18
- const vueComponentsExampleConfig = {
19
- root: examplesPath("vue-components"),
20
- resolve: {
21
- alias
22
- },
23
- server
24
- // plugins: [
25
- // uiEngine(),
26
- // ],
27
- };
28
- const exampleVue = defineConfig(() => {
29
- return vueComponentsExampleConfig;
30
- });
31
-
32
- const exampleVue$1 = {
33
- __proto__: null,
34
- default: exampleVue,
35
- vueComponentsExampleConfig: vueComponentsExampleConfig
36
- };
37
-
38
- const webComponentsExampleConfig = {
39
- root: examplesPath("web-components"),
40
- resolve: {
41
- alias
42
- },
43
- server
44
- // plugins: [
45
- // uiEngine(true),
46
- // ],
47
- };
48
- const exampleWc = defineConfig(() => {
49
- return webComponentsExampleConfig;
50
- });
51
-
52
- const exampleWc$1 = {
53
- __proto__: null,
54
- default: exampleWc,
55
- webComponentsExampleConfig: webComponentsExampleConfig
56
- };
57
-
58
- const functionsConfig = {
59
- root: functionsPath(),
60
- envDir: projectPath(),
61
- envPrefix: "",
62
- resolve: {
63
- alias
64
- },
65
- // plugins: [
66
- // autoImports(),
67
- // ],
68
- build: functionsBuildOptions()
69
- };
70
- function functionsBuildOptions() {
71
- return {
72
- outDir: frameworkPath("functions/dist"),
73
- emptyOutDir: true,
74
- sourcemap: library.functions?.shouldGenerateSourcemap,
75
- lib: {
76
- entry: libraryEntryPath("functions"),
77
- name: library.functions?.name,
78
- formats: ["cjs", "es"],
79
- fileName: (format) => {
80
- if (format === "es")
81
- return "index.mjs";
82
- if (format === "cjs")
83
- return "index.cjs";
84
- return "index.?.js";
85
- }
86
- }
87
- };
88
- }
89
- const functions = defineConfig(({ command }) => {
90
- if (command === "serve")
91
- return functionsConfig;
92
- return functionsConfig;
93
- });
94
-
95
- const functions$1 = {
96
- __proto__: null,
97
- default: functions,
98
- functionsBuildOptions: functionsBuildOptions,
99
- functionsConfig: functionsConfig
100
- };
101
-
102
- const pagesConfig = {
103
- root: functionsPath(),
104
- envDir: projectPath(),
105
- envPrefix: "FRONTEND_",
106
- resolve: {
107
- alias
108
- },
109
- plugins: [
110
- // preview(),
111
- // uiEngine(),
112
- // pages(),
113
- // cssEngine(),
114
- // components(),
115
- // layouts(),
116
- // // i18n(),
117
- // autoImports(),
118
- // pwa(),
119
- // inspect(),
120
- ],
121
- // https://github.com/antfu/vite-ssg
122
- // ssgOptions: {
123
- // script: 'async',
124
- // formatting: 'minify',
125
- // onFinished() { generateSitemap() },
126
- // },
127
- ssr: {
128
- // TODO: workaround until they support native ESM
129
- noExternal: ["workbox-window", /vue-i18n/]
130
- }
131
- };
132
- const views = defineConfig(({ command }) => {
133
- if (command === "serve")
134
- return pagesConfig;
135
- return pagesConfig;
136
- });
137
-
138
- const views$1 = {
139
- __proto__: null,
140
- default: views,
141
- pagesConfig: pagesConfig
142
- };
143
-
144
- function inspect(options) {
145
- return Inspect(options);
146
- }
147
- function layouts(options) {
148
- return Layouts(options);
149
- }
150
- function components(options) {
151
- const defaultOptions = {
152
- // also allow auto-loading markdown components
153
- extensions: ["vue", "md"],
154
- include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
155
- dirs: [
156
- path.componentsPath()
157
- // pagesPath(),
158
- ],
159
- dts: path.frameworkPath("components.d.ts")
160
- };
161
- const newOptions = defu(options, defaultOptions);
162
- return Components(newOptions);
163
- }
164
- function pages(options) {
165
- const defaultOptions = {
166
- extensions: ["vue", "md"],
167
- dirs: [
168
- path.pagesPath()
169
- ]
170
- };
171
- const newOptions = defu(options, defaultOptions);
172
- return Pages(newOptions);
173
- }
174
- function autoImports(options) {
175
- const defaultOptions = {
176
- imports: [
177
- "vue",
178
- "vue-router",
179
- "vue/macros",
180
- "vitest",
181
- { "@stacksjs/ui": ["CssEngine", "UiEngine", "Store", "presetForms", "transformerCompileClass"] },
182
- { "@stacksjs/logging": ["dd", "dump"] }
183
- // we also export `log` in st stacks/cli
184
- // { '@stacksjs/validation': ['validate', 'validateAll', 'validateSync', 'validateAllSync'] },
185
- ],
186
- dirs: [
187
- path.resourcesPath("functions"),
188
- path.resourcesPath("components"),
189
- path.projectPath("config"),
190
- // auto imported utilities start here
191
- path.aiPath("src"),
192
- path.arraysPath("src"),
193
- path.authPath("src"),
194
- path.cachePath("src"),
195
- path.chatPath("src"),
196
- path.cliPath("src"),
197
- path.cloudPath("src"),
198
- path.databasePath("src"),
199
- path.datetimePath("src"),
200
- path.desktopPath("src"),
201
- path.errorHandlingPath("src"),
202
- path.eventsPath("src"),
203
- path.fakerPath("src"),
204
- path.healthPath("src"),
205
- path.lintPath("src"),
206
- path.notificationsPath("src"),
207
- path.objectsPath("src"),
208
- path.ormPath("src"),
209
- path.pathPath("src"),
210
- path.paymentsPath("src"),
211
- path.pushPath("src"),
212
- path.queuePath("src"),
213
- path.queryBuilderPath("src"),
214
- path.realtimePath("src"),
215
- path.routerPath("src"),
216
- path.searchEnginePath("src"),
217
- path.securityPath("src"),
218
- path.signalsPath("src"),
219
- path.smsPath("src"),
220
- path.slugPath("src"),
221
- path.storagePath("src"),
222
- path.stringsPath("src"),
223
- path.testingPath("src"),
224
- path.utilsPath("src"),
225
- path.validationPath("src")
226
- ],
227
- dts: path.frameworkPath("auto-imports.d.ts"),
228
- vueTemplate: true,
229
- eslintrc: {
230
- enabled: false
231
- // filepath: frameworkPath('.eslintrc-auto-import.json'),
232
- }
233
- };
234
- const newOptions = defu(options, defaultOptions);
235
- return AutoImport(newOptions);
236
- }
237
- function cssEngine(isWebComponent = false) {
238
- return Unocss({
239
- configFile: path.uiPath("src/unocss.ts"),
240
- mode: isWebComponent ? "shadow-dom" : "vue-scoped"
241
- });
242
- }
243
- function pwa() {
244
- return VitePWA({
245
- registerType: "autoUpdate",
246
- includeAssets: ["favicon.svg", "safari-pinned-tab.svg"],
247
- manifest: {
248
- name: "Stacks",
249
- short_name: "Stacks",
250
- theme_color: "#ffffff",
251
- icons: [
252
- {
253
- src: "/pwa-192x192.png",
254
- sizes: "192x192",
255
- type: "image/png"
256
- },
257
- {
258
- src: "/pwa-512x512.png",
259
- sizes: "512x512",
260
- type: "image/png"
261
- },
262
- {
263
- src: "/pwa-512x512.png",
264
- sizes: "512x512",
265
- type: "image/png",
266
- purpose: "any maskable"
267
- }
268
- ]
269
- }
270
- });
271
- }
272
- function uiEngine(isWebComponent = false) {
273
- if (isWebComponent) {
274
- return Vue({
275
- include: [/\.vue$/, /\.md$/],
276
- template: {
277
- compilerOptions: {
278
- isCustomElement: () => true
279
- }
280
- }
281
- });
282
- }
283
- return Vue({
284
- include: [/\.vue$/, /\.md$/]
285
- });
286
- }
287
- function componentPreset(isWebComponent = false) {
288
- return [
289
- // inspect,
290
- uiEngine(isWebComponent),
291
- cssEngine(isWebComponent)
292
- // autoImports,
293
- // components,
294
- ];
295
- }
296
-
297
- const stacks = {
298
- __proto__: null,
299
- autoImports: autoImports,
300
- componentPreset: componentPreset,
301
- components: components,
302
- cssEngine: cssEngine,
303
- inspect: inspect,
304
- layouts: layouts,
305
- pages: pages,
306
- pwa: pwa,
307
- resolve: resolve,
308
- uiEngine: uiEngine
309
- };
310
-
311
- const vueComponentsConfig = {
312
- root: frameworkPath("libs/components/vue"),
313
- base: frameworkPath(),
314
- envDir: projectPath(),
315
- envPrefix: "FRONTEND_",
316
- publicDir: storagePath("public"),
317
- server: {
318
- https: true,
319
- port: 3333,
320
- open: true
321
- },
322
- resolve: {
323
- dedupe: ["vue"],
324
- alias
325
- },
326
- optimizeDeps: {
327
- exclude: ["vue", "fsevents"]
328
- },
329
- plugins: [
330
- // preview(),
331
- uiEngine(),
332
- cssEngine(),
333
- autoImports(),
334
- components(),
335
- inspect(),
336
- mkcert({
337
- autoUpgrade: true,
338
- savePath: libsPath("components/certs"),
339
- keyFileName: library.name ? `library-${library.name}-key.pem` : "library-key.pem",
340
- certFileName: library.name ? `library-${library.name}-cert.pem` : "library-cert.pem"
341
- }),
342
- {
343
- // ...
344
- configureServer(server) {
345
- server.printUrls = () => {
346
- const appUrl = app.url;
347
- const frontendUrl = `https://${appUrl}`;
348
- const backendUrl = `https://api.${appUrl}`;
349
- const dashboardUrl = `https://admin.${appUrl}`;
350
- const libraryUrl = `https://libs.${appUrl}`;
351
- const docsUrl = `https://docs.${appUrl}`;
352
- const inspectUrl = `https://${appUrl}/__inspect/`;
353
- const stacksVersion = "alpha-0.x.x";
354
- console.log(` ${c.blue(c.bold("STACKS"))} ${c.blue(stacksVersion)}`);
355
- console.log(` ${c.green("\u279C")} ${c.bold("Frontend")}: ${c.green(frontendUrl)}`);
356
- console.log(` ${c.green("\u279C")} ${c.bold("Backend")}: ${c.green(backendUrl)}`);
357
- console.log(` ${c.green("\u279C")} ${c.bold("Dashboard")}: ${c.green(dashboardUrl)}`);
358
- console.log(` ${c.green("\u279C")} ${c.bold("Library")}: ${c.green(libraryUrl)}`);
359
- console.log(` ${c.green("\u279C")} ${c.bold("Docs")}: ${c.green(docsUrl)}`);
360
- console.log(` ${c.green("\u279C")} ${c.dim("Inspect")}: ${c.green(inspectUrl)}`);
361
- };
362
- }
363
- }
364
- ],
365
- build: vueComponentsBuildOptions()
366
- };
367
- function vueComponentsBuildOptions() {
368
- return {
369
- target: "esnext",
370
- outDir: libsPath("components/vue/dist"),
371
- emptyOutDir: true,
372
- lib: {
373
- entry: libraryEntryPath("vue-components"),
374
- name: library.vueComponents?.name,
375
- formats: ["cjs", "es"],
376
- fileName: (format) => {
377
- if (format === "es")
378
- return "index.mjs";
379
- if (format === "cjs")
380
- return "index.cjs";
381
- return "index.?.js";
382
- }
383
- },
384
- rollupOptions: {
385
- external: ["vue", "@stacksjs/alias"],
386
- output: {
387
- globals: {
388
- vue: "Vue"
389
- }
390
- }
391
- }
392
- };
393
- }
394
- const vueComponents = defineConfig(({ command, mode }) => {
395
- process.env = { ...process.env, ...loadEnv(mode, projectPath(), "") };
396
- if (command === "serve")
397
- return vueComponentsConfig;
398
- return vueComponentsConfig;
399
- });
400
-
401
- const vueComponents$1 = {
402
- __proto__: null,
403
- default: vueComponents,
404
- vueComponentsBuildOptions: vueComponentsBuildOptions,
405
- vueComponentsConfig: vueComponentsConfig
406
- };
407
-
408
- const webComponentsConfig = {
409
- root: frameworkPath("libs/components/web"),
410
- envDir: projectPath(),
411
- envPrefix: "FRONTEND_",
412
- server,
413
- resolve: {
414
- alias
415
- },
416
- plugins: [
417
- // inspect(),
418
- // uiEngine(isWebComponent),
419
- // cssEngine(isWebComponent),
420
- // autoImports(),
421
- // components(),
422
- ],
423
- build: webComponentsBuildOptions()
424
- };
425
- function webComponentsBuildOptions() {
426
- return {
427
- outDir: frameworkPath("components/web/dist"),
428
- emptyOutDir: true,
429
- lib: {
430
- entry: libraryEntryPath("web-components"),
431
- name: library.webComponents?.name,
432
- formats: ["cjs", "es"],
433
- fileName: (format) => {
434
- if (format === "es")
435
- return "index.mjs";
436
- if (format === "cjs")
437
- return "index.cjs";
438
- return "index.?.js";
439
- }
440
- }
441
- };
442
- }
443
- const webComponents = defineConfig(({ command }) => {
444
- if (command === "serve")
445
- return webComponentsConfig;
446
- return webComponentsConfig;
447
- });
448
-
449
- const webComponents$1 = {
450
- __proto__: null,
451
- default: webComponents,
452
- webComponentsBuildOptions: webComponentsBuildOptions,
453
- webComponentsConfig: webComponentsConfig
454
- };
455
-
456
- export { functions$1 as functions, stacks, views$1 as views, exampleVue$1 as vueComponentExample, vueComponents$1 as vueComponents, exampleWc$1 as webComponentExample, webComponents$1 as webComponents };
1
+ export * as vueComponentExample from "./example-vue.mjs";
2
+ export * as webComponentExample from "./example-wc.mjs";
3
+ export * as functions from "./functions.mjs";
4
+ export * as views from "./views.mjs";
5
+ export * as vueComponents from "./vue-components.mjs";
6
+ export * as webComponents from "./web-components.mjs";
7
+ export * as stacks from "./stacks.mjs";
@@ -0,0 +1,12 @@
1
+ import type { PluginOption } from 'vite';
2
+ import type { AutoImportsOptions, ComponentOptions, InspectOptions, PagesOption } from '@stacksjs/types';
3
+ import { resolve } from '@stacksjs/path';
4
+ export { resolve };
5
+ export declare function inspect(options?: InspectOptions): import("vite").Plugin;
6
+ export declare function components(options?: ComponentOptions): PluginOption;
7
+ export declare function pages(options?: PagesOption): import("vite").Plugin;
8
+ export declare function autoImports(options?: AutoImportsOptions): any;
9
+ export declare function cssEngine(isWebComponent?: boolean): import("vite").Plugin[];
10
+ export declare function pwa(): import("vite").Plugin[];
11
+ export declare function uiEngine(isWebComponent?: boolean): import("vite").Plugin;
12
+ export declare function componentPreset(isWebComponent?: boolean): (import("vite").Plugin | import("vite").Plugin[])[];
@@ -0,0 +1,159 @@
1
+ import AutoImport from "unplugin-auto-import/vite";
2
+ import Components from "unplugin-vue-components/vite";
3
+ import Vue from "@vitejs/plugin-vue";
4
+ import Unocss from "unocss/vite";
5
+ import Inspect from "vite-plugin-inspect";
6
+ import Pages from "vite-plugin-pages";
7
+ import { VitePWA } from "vite-plugin-pwa";
8
+ import { defu } from "defu";
9
+ import { path as p, resolve } from "@stacksjs/path";
10
+ export { resolve };
11
+ export function inspect(options) {
12
+ return Inspect(options);
13
+ }
14
+ export function components(options) {
15
+ const defaultOptions = {
16
+ // also allow auto-loading markdown components
17
+ extensions: ["vue", "md"],
18
+ include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
19
+ dirs: [
20
+ p.componentsPath()
21
+ // pagesPath(),
22
+ ],
23
+ dts: p.frameworkPath("components.d.ts")
24
+ };
25
+ const newOptions = defu(options, defaultOptions);
26
+ return Components(newOptions);
27
+ }
28
+ export function pages(options) {
29
+ const defaultOptions = {
30
+ extensions: ["vue", "md"],
31
+ dirs: [
32
+ p.pagesPath()
33
+ ]
34
+ };
35
+ const newOptions = defu(options, defaultOptions);
36
+ return Pages(newOptions);
37
+ }
38
+ export function autoImports(options) {
39
+ const defaultOptions = {
40
+ imports: [
41
+ "vue",
42
+ "vue-router",
43
+ "vue/macros",
44
+ "vitest",
45
+ { "@stacksjs/ui": ["CssEngine", "UiEngine", "Store", "presetForms", "transformerCompileClass"] },
46
+ { "@stacksjs/logging": ["dd", "dump"] }
47
+ // we also export `log` in st stacks/cli
48
+ // { '@stacksjs/validation': ['validate', 'validateAll', 'validateSync', 'validateAllSync'] },
49
+ ],
50
+ dirs: [
51
+ p.resourcesPath("functions"),
52
+ p.resourcesPath("components"),
53
+ p.projectPath("config"),
54
+ // auto imported utilities start here
55
+ p.aiPath("src"),
56
+ p.arraysPath("src"),
57
+ p.authPath("src"),
58
+ p.cachePath("src"),
59
+ p.chatPath("src"),
60
+ p.cliPath("src"),
61
+ p.cloudPath("src"),
62
+ p.databasePath("src"),
63
+ p.datetimePath("src"),
64
+ p.desktopPath("src"),
65
+ p.errorHandlingPath("src"),
66
+ p.eventsPath("src"),
67
+ p.fakerPath("src"),
68
+ p.healthPath("src"),
69
+ p.lintPath("src"),
70
+ p.notificationsPath("src"),
71
+ p.objectsPath("src"),
72
+ p.ormPath("src"),
73
+ p.pathPath("src"),
74
+ p.paymentsPath("src"),
75
+ p.pushPath("src"),
76
+ p.queuePath("src"),
77
+ p.queryBuilderPath("src"),
78
+ p.realtimePath("src"),
79
+ p.routerPath("src"),
80
+ p.searchEnginePath("src"),
81
+ p.securityPath("src"),
82
+ p.signalsPath("src"),
83
+ p.smsPath("src"),
84
+ p.slugPath("src"),
85
+ p.storagePath("src"),
86
+ p.stringsPath("src"),
87
+ p.testingPath("src"),
88
+ p.utilsPath("src"),
89
+ p.validationPath("src")
90
+ ],
91
+ dts: p.frameworkPath("auto-imports.d.ts"),
92
+ vueTemplate: true,
93
+ eslintrc: {
94
+ enabled: false
95
+ // filepath: frameworkPath('.eslintrc-auto-import.json'),
96
+ }
97
+ };
98
+ const newOptions = defu(options, defaultOptions);
99
+ return AutoImport(newOptions);
100
+ }
101
+ export function cssEngine(isWebComponent = false) {
102
+ return Unocss({
103
+ configFile: p.uiPath("src/unocss.ts"),
104
+ mode: isWebComponent ? "shadow-dom" : "vue-scoped"
105
+ });
106
+ }
107
+ export function pwa() {
108
+ return VitePWA({
109
+ registerType: "autoUpdate",
110
+ includeAssets: ["favicon.svg", "safari-pinned-tab.svg"],
111
+ manifest: {
112
+ name: "Stacks",
113
+ short_name: "Stacks",
114
+ theme_color: "#ffffff",
115
+ icons: [
116
+ {
117
+ src: "/pwa-192x192.png",
118
+ sizes: "192x192",
119
+ type: "image/png"
120
+ },
121
+ {
122
+ src: "/pwa-512x512.png",
123
+ sizes: "512x512",
124
+ type: "image/png"
125
+ },
126
+ {
127
+ src: "/pwa-512x512.png",
128
+ sizes: "512x512",
129
+ type: "image/png",
130
+ purpose: "any maskable"
131
+ }
132
+ ]
133
+ }
134
+ });
135
+ }
136
+ export function uiEngine(isWebComponent = false) {
137
+ if (isWebComponent) {
138
+ return Vue({
139
+ include: [/\.vue$/, /\.md$/],
140
+ template: {
141
+ compilerOptions: {
142
+ isCustomElement: () => true
143
+ }
144
+ }
145
+ });
146
+ }
147
+ return Vue({
148
+ include: [/\.vue$/, /\.md$/]
149
+ });
150
+ }
151
+ export function componentPreset(isWebComponent = false) {
152
+ return [
153
+ // inspect,
154
+ uiEngine(isWebComponent),
155
+ cssEngine(isWebComponent)
156
+ // autoImports,
157
+ // components,
158
+ ];
159
+ }
@@ -0,0 +1,4 @@
1
+ import type { ViteConfig } from '@stacksjs/types';
2
+ export declare const pagesConfig: ViteConfig;
3
+ declare const _default: import("vite").UserConfigExport;
4
+ export default _default;
package/dist/views.mjs ADDED
@@ -0,0 +1,38 @@
1
+ import { defineConfig } from "vite";
2
+ import { functionsPath, projectPath } from "@stacksjs/path";
3
+ import { alias } from "@stacksjs/alias";
4
+ export const pagesConfig = {
5
+ root: functionsPath(),
6
+ envDir: projectPath(),
7
+ envPrefix: "FRONTEND_",
8
+ resolve: {
9
+ alias
10
+ },
11
+ plugins: [
12
+ // preview(),
13
+ // uiEngine(),
14
+ // pages(),
15
+ // cssEngine(),
16
+ // components(),
17
+ // layouts(),
18
+ // // i18n(),
19
+ // autoImports(),
20
+ // pwa(),
21
+ // inspect(),
22
+ ],
23
+ // https://github.com/antfu/vite-ssg
24
+ // ssgOptions: {
25
+ // script: 'async',
26
+ // formatting: 'minify',
27
+ // onFinished() { generateSitemap() },
28
+ // },
29
+ ssr: {
30
+ // TODO: workaround until they support native ESM
31
+ noExternal: ["workbox-window", /vue-i18n/]
32
+ }
33
+ };
34
+ export default defineConfig(({ command }) => {
35
+ if (command === "serve")
36
+ return pagesConfig;
37
+ return pagesConfig;
38
+ });
@@ -0,0 +1,6 @@
1
+ import type { ViteConfig } from '@stacksjs/types';
2
+ import type { BuildOptions as ViteBuildOptions } from 'vite';
3
+ export declare const vueComponentsConfig: ViteConfig;
4
+ export declare function vueComponentsBuildOptions(): ViteBuildOptions;
5
+ declare const _default: import("vite").UserConfigExport;
6
+ export default _default;
@@ -0,0 +1,96 @@
1
+ import { defineConfig, loadEnv } from "vite";
2
+ import { frameworkPath, libraryEntryPath, libsPath, projectPath, storagePath } from "@stacksjs/path";
3
+ import { app, library } from "@stacksjs/config";
4
+ import { alias } from "@stacksjs/alias";
5
+ import mkcert from "vite-plugin-mkcert";
6
+ import c from "picocolors";
7
+ import { autoImports, components, cssEngine, inspect, uiEngine } from "./stacks.mjs";
8
+ export const vueComponentsConfig = {
9
+ root: frameworkPath("libs/components/vue"),
10
+ base: frameworkPath(),
11
+ envDir: projectPath(),
12
+ envPrefix: "FRONTEND_",
13
+ publicDir: storagePath("public"),
14
+ server: {
15
+ https: true,
16
+ port: 3333,
17
+ open: true
18
+ },
19
+ resolve: {
20
+ dedupe: ["vue"],
21
+ alias
22
+ },
23
+ optimizeDeps: {
24
+ exclude: ["vue", "fsevents"]
25
+ },
26
+ plugins: [
27
+ // preview(),
28
+ uiEngine(),
29
+ cssEngine(),
30
+ autoImports(),
31
+ components(),
32
+ inspect(),
33
+ mkcert({
34
+ autoUpgrade: true,
35
+ savePath: libsPath("components/certs"),
36
+ keyFileName: library.name ? `library-${library.name}-key.pem` : "library-key.pem",
37
+ certFileName: library.name ? `library-${library.name}-cert.pem` : "library-cert.pem"
38
+ }),
39
+ {
40
+ // ...
41
+ configureServer(server) {
42
+ server.printUrls = () => {
43
+ const appUrl = app.url;
44
+ const frontendUrl = `https://${appUrl}`;
45
+ const backendUrl = `https://api.${appUrl}`;
46
+ const dashboardUrl = `https://admin.${appUrl}`;
47
+ const libraryUrl = `https://libs.${appUrl}`;
48
+ const docsUrl = `https://docs.${appUrl}`;
49
+ const inspectUrl = `https://${appUrl}/__inspect/`;
50
+ const stacksVersion = "alpha-0.x.x";
51
+ console.log(` ${c.blue(c.bold("STACKS"))} ${c.blue(stacksVersion)}`);
52
+ console.log(` ${c.green("\u279C")} ${c.bold("Frontend")}: ${c.green(frontendUrl)}`);
53
+ console.log(` ${c.green("\u279C")} ${c.bold("Backend")}: ${c.green(backendUrl)}`);
54
+ console.log(` ${c.green("\u279C")} ${c.bold("Dashboard")}: ${c.green(dashboardUrl)}`);
55
+ console.log(` ${c.green("\u279C")} ${c.bold("Library")}: ${c.green(libraryUrl)}`);
56
+ console.log(` ${c.green("\u279C")} ${c.bold("Docs")}: ${c.green(docsUrl)}`);
57
+ console.log(` ${c.green("\u279C")} ${c.dim("Inspect")}: ${c.green(inspectUrl)}`);
58
+ };
59
+ }
60
+ }
61
+ ],
62
+ build: vueComponentsBuildOptions()
63
+ };
64
+ export function vueComponentsBuildOptions() {
65
+ return {
66
+ target: "esnext",
67
+ outDir: libsPath("components/vue/dist"),
68
+ emptyOutDir: true,
69
+ lib: {
70
+ entry: libraryEntryPath("vue-components"),
71
+ name: library.vueComponents?.name,
72
+ formats: ["cjs", "es"],
73
+ fileName: (format) => {
74
+ if (format === "es")
75
+ return "index.mjs";
76
+ if (format === "cjs")
77
+ return "index.cjs";
78
+ return "index.?.js";
79
+ }
80
+ },
81
+ rollupOptions: {
82
+ external: ["vue", "@stacksjs/alias"],
83
+ output: {
84
+ globals: {
85
+ vue: "Vue"
86
+ }
87
+ }
88
+ }
89
+ };
90
+ }
91
+ export default defineConfig(({ command, mode }) => {
92
+ process.env = { ...process.env, ...loadEnv(mode, projectPath(), "") };
93
+ if (command === "serve")
94
+ return vueComponentsConfig;
95
+ return vueComponentsConfig;
96
+ });
@@ -0,0 +1,6 @@
1
+ import type { BuildOptions as ViteBuildOptions } from 'vite';
2
+ import type { ViteConfig } from '@stacksjs/types';
3
+ export declare const webComponentsConfig: ViteConfig;
4
+ export declare function webComponentsBuildOptions(): ViteBuildOptions;
5
+ declare const _default: import("vite").UserConfigExport;
6
+ export default _default;
@@ -0,0 +1,45 @@
1
+ import { defineConfig } from "vite";
2
+ import { frameworkPath, libraryEntryPath, projectPath } from "@stacksjs/path";
3
+ import { library } from "@stacksjs/config";
4
+ import { server } from "@stacksjs/server";
5
+ import { alias } from "@stacksjs/alias";
6
+ export const webComponentsConfig = {
7
+ root: frameworkPath("libs/components/web"),
8
+ envDir: projectPath(),
9
+ envPrefix: "FRONTEND_",
10
+ server,
11
+ resolve: {
12
+ alias
13
+ },
14
+ plugins: [
15
+ // inspect(),
16
+ // uiEngine(isWebComponent),
17
+ // cssEngine(isWebComponent),
18
+ // autoImports(),
19
+ // components(),
20
+ ],
21
+ build: webComponentsBuildOptions()
22
+ };
23
+ export function webComponentsBuildOptions() {
24
+ return {
25
+ outDir: frameworkPath("components/web/dist"),
26
+ emptyOutDir: true,
27
+ lib: {
28
+ entry: libraryEntryPath("web-components"),
29
+ name: library.webComponents?.name,
30
+ formats: ["cjs", "es"],
31
+ fileName: (format) => {
32
+ if (format === "es")
33
+ return "index.mjs";
34
+ if (format === "cjs")
35
+ return "index.cjs";
36
+ return "index.?.js";
37
+ }
38
+ }
39
+ };
40
+ }
41
+ export default defineConfig(({ command }) => {
42
+ if (command === "serve")
43
+ return webComponentsConfig;
44
+ return webComponentsConfig;
45
+ });
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@stacksjs/build",
3
3
  "type": "module",
4
- "version": "0.56.35",
5
- "packageManager": "pnpm@8.6.5",
4
+ "version": "0.57.3",
5
+ "packageManager": "pnpm@8.6.6",
6
6
  "description": "The Stacks framework build tools and configurations.",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -49,24 +49,24 @@
49
49
  "unplugin-auto-import": "^0.16.4",
50
50
  "unplugin-vue-components": "^0.25.1",
51
51
  "vite": "^4.3.9",
52
- "vite-plugin-inspect": "^0.7.30",
52
+ "vite-plugin-inspect": "^0.7.32",
53
53
  "vite-plugin-pages": "^0.31.0",
54
54
  "vite-plugin-pwa": "^0.16.4",
55
55
  "vite-plugin-vue-layouts": "^0.8.0",
56
56
  "vite-plugin-vue-markdown": "^0.23.5",
57
- "vite-ssg": "^0.22.2",
57
+ "vite-ssg": "^0.23.0",
58
58
  "vite-ssg-sitemap": "^0.5.1",
59
59
  "vue-docgen-web-types": "^0.1.8",
60
- "@stacksjs/alias": "0.56.35",
61
- "@stacksjs/config": "0.56.35",
62
- "@stacksjs/path": "0.56.35",
63
- "@stacksjs/server": "0.56.35",
64
- "@stacksjs/types": "0.56.35",
65
- "@stacksjs/utils": "0.56.35"
60
+ "@stacksjs/alias": "0.57.3",
61
+ "@stacksjs/config": "0.57.3",
62
+ "@stacksjs/path": "0.57.3",
63
+ "@stacksjs/server": "0.57.3",
64
+ "@stacksjs/types": "0.57.3",
65
+ "@stacksjs/utils": "0.57.3"
66
66
  },
67
67
  "devDependencies": {
68
68
  "vite-plugin-mkcert": "^1.16.0",
69
- "@stacksjs/development": "0.56.35"
69
+ "@stacksjs/development": "0.57.3"
70
70
  },
71
71
  "scripts": {
72
72
  "build": "unbuild",