@stacksjs/build 0.37.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.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2022 Open Web Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Stacks Build
2
+
3
+ This package contains the web development build tooling. In simple terms, here lives the Vite & Nitro engine code.
4
+
5
+ ## โ˜˜๏ธ Features
6
+
7
+ wip
8
+
9
+ - โšก๏ธ
10
+
11
+ wip
12
+
13
+ ## ๐Ÿค– Usage
14
+
15
+ wip
16
+
17
+ ```bash
18
+ pnpm i -D @stacksjs/actions
19
+ ```
20
+
21
+ Now, you can use it in your project:
22
+
23
+ ```js
24
+ import * as build from '@stacksjs/build'
25
+
26
+ // wip
27
+ ```
28
+
29
+ Learn more in the docs.
30
+
31
+ ## ๐Ÿงช Testing
32
+
33
+ ```bash
34
+ pnpm test
35
+ ```
36
+
37
+ ## ๐Ÿ“ˆ Changelog
38
+
39
+ Please see our [releases](https://github.com/stacksjs/stacksjs/releases) page for more information on what has changed recently.
40
+
41
+ ## ๐Ÿ’ช๐Ÿผ Contributing
42
+
43
+ Please see [CONTRIBUTING](../../.github/CONTRIBUTING.md) for details.
44
+
45
+ ## ๐Ÿ Community
46
+
47
+ For help, discussion about best practices, or any other conversation that would benefit from being searchable:
48
+
49
+ [Discussions on GitHub](https://github.com/stacksjs/stacks/discussions)
50
+
51
+ For casual chit-chat with others using this package:
52
+
53
+ [Join the Open Web Discord Server](https://discord.ow3.org)
54
+
55
+ ## ๐Ÿ“„ License
56
+
57
+ The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
58
+
59
+ Made with โค๏ธ
@@ -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,20 @@
1
+ import { defineConfig } from "vite";
2
+ import { examplesPath } from "@stacksjs/paths";
3
+ import { alias } from "../../../alias";
4
+ import { uiEngine } from "./index.mjs";
5
+ export const vueComponentsExampleConfig = {
6
+ root: examplesPath("vue-components"),
7
+ resolve: {
8
+ alias
9
+ },
10
+ server: {
11
+ port: 3333,
12
+ open: true
13
+ },
14
+ plugins: [
15
+ uiEngine()
16
+ ]
17
+ };
18
+ export default defineConfig(() => {
19
+ return vueComponentsExampleConfig;
20
+ });
@@ -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,20 @@
1
+ import { defineConfig } from "vite";
2
+ import { examplesPath } from "@stacksjs/paths";
3
+ import { alias } from "../../../alias";
4
+ import { uiEngine } from "./index.mjs";
5
+ export const webComponentsExampleConfig = {
6
+ root: examplesPath("web-components"),
7
+ resolve: {
8
+ alias
9
+ },
10
+ server: {
11
+ port: 3333,
12
+ open: true
13
+ },
14
+ plugins: [
15
+ uiEngine(true)
16
+ ]
17
+ };
18
+ export default defineConfig(() => {
19
+ return webComponentsExampleConfig;
20
+ });
@@ -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,43 @@
1
+ import { defineConfig } from "vite";
2
+ import { buildEntriesPath, frameworkPath, functionsPath, projectPath } from "@stacksjs/paths";
3
+ import { library } from "../../../config";
4
+ import { alias } from "../../../alias";
5
+ import { autoImports } from "./index.mjs";
6
+ export const functionsConfig = {
7
+ root: functionsPath(),
8
+ envDir: projectPath(),
9
+ envPrefix: "APP_",
10
+ resolve: {
11
+ alias
12
+ },
13
+ plugins: [
14
+ autoImports()
15
+ ],
16
+ build: functionsBuildOptions()
17
+ };
18
+ export function functionsBuildOptions() {
19
+ return {
20
+ outDir: frameworkPath("functions/dist"),
21
+ emptyOutDir: true,
22
+ sourcemap: library.functions.shouldGenerateSourcemap,
23
+ lib: {
24
+ entry: buildEntriesPath("functions.ts"),
25
+ name: library.functions.name,
26
+ formats: library.functions.shouldBuildIife ? ["cjs", "es", "iife"] : ["cjs", "es"],
27
+ fileName: (format) => {
28
+ if (format === "es")
29
+ return "index.mjs";
30
+ if (format === "cjs")
31
+ return "index.cjs";
32
+ if (format === "iife")
33
+ return "index.iife.js";
34
+ return "index.?.js";
35
+ }
36
+ }
37
+ };
38
+ }
39
+ export default defineConfig(({ command }) => {
40
+ if (command === "serve")
41
+ return functionsConfig;
42
+ return functionsConfig;
43
+ });
@@ -0,0 +1,7 @@
1
+ export * from './example-vue';
2
+ export * from './example-wc';
3
+ export * from './functions';
4
+ export * from './pages';
5
+ export * from './vue-components';
6
+ export * from './web-components';
7
+ export * from './stacks';
package/dist/index.mjs ADDED
@@ -0,0 +1,7 @@
1
+ export * from "./example-vue.mjs";
2
+ export * from "./example-wc.mjs";
3
+ export * from "./functions.mjs";
4
+ export * from "./pages.mjs";
5
+ export * from "./vue-components.mjs";
6
+ export * from "./web-components.mjs";
7
+ export * from "./stacks.mjs";
@@ -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/pages.mjs ADDED
@@ -0,0 +1,41 @@
1
+ import { defineConfig } from "vite";
2
+ import generateSitemap from "vite-ssg-sitemap";
3
+ import { functionsPath, projectPath } from "@stacksjs/paths";
4
+ import { alias } from "../../../alias";
5
+ import { atomicCssEngine, autoImports, components, i18n, inspect, layouts, markdown, pages, preview, pwa, uiEngine } from "./index.mjs";
6
+ export const pagesConfig = {
7
+ root: functionsPath(),
8
+ envDir: projectPath(),
9
+ envPrefix: "APP_",
10
+ resolve: {
11
+ alias
12
+ },
13
+ plugins: [
14
+ preview(),
15
+ uiEngine(),
16
+ pages(),
17
+ atomicCssEngine(),
18
+ components(),
19
+ layouts(),
20
+ i18n(),
21
+ markdown(),
22
+ autoImports(),
23
+ pwa(),
24
+ inspect()
25
+ ],
26
+ ssgOptions: {
27
+ script: "async",
28
+ formatting: "minify",
29
+ onFinished() {
30
+ generateSitemap();
31
+ }
32
+ },
33
+ ssr: {
34
+ noExternal: ["workbox-window", /vue-i18n/]
35
+ }
36
+ };
37
+ export default defineConfig(({ command }) => {
38
+ if (command === "serve")
39
+ return pagesConfig;
40
+ return pagesConfig;
41
+ });
@@ -0,0 +1,18 @@
1
+ import type { PluginOption } from 'vite';
2
+ import type { AutoImportsOptions, ComponentOptions, InspectOptions, LayoutOptions, MarkdownOptions, PagesOptions, i18nOptions } from '@stacksjs/types';
3
+ import { resolve } from '@stacksjs/paths';
4
+ declare function inspect(options?: InspectOptions): import("vite").Plugin;
5
+ declare function preview(): any;
6
+ declare function layouts(options?: LayoutOptions): import("vite").Plugin;
7
+ declare function components(options?: ComponentOptions): import("vite").Plugin & {
8
+ api: import("unplugin-vue-components/types").PublicPluginAPI;
9
+ };
10
+ declare function pages(options?: PagesOptions): import("vite").Plugin;
11
+ declare function markdown(options?: MarkdownOptions): import("vite").Plugin;
12
+ declare function autoImports(options?: AutoImportsOptions): any;
13
+ declare function atomicCssEngine(isWebComponent?: boolean): import("vite").Plugin[];
14
+ declare function pwa(): import("vite").Plugin[];
15
+ declare function i18n(options?: i18nOptions): import("vite").Plugin;
16
+ declare function uiEngine(isWebComponent?: boolean): import("vite").Plugin;
17
+ declare const componentPreset: (isWebComponent?: boolean) => PluginOption;
18
+ export { resolve, componentPreset, uiEngine, autoImports, atomicCssEngine, components, inspect, markdown, pages, pwa, preview, layouts, i18n };
@@ -0,0 +1,168 @@
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 Layouts from "vite-plugin-vue-layouts";
8
+ import VueI18n from "@intlify/vite-plugin-vue-i18n";
9
+ import Preview from "vite-plugin-vue-component-preview";
10
+ import Markdown from "vite-plugin-vue-markdown";
11
+ import LinkAttributes from "markdown-it-link-attributes";
12
+ import Shiki from "markdown-it-shiki";
13
+ import { VitePWA } from "vite-plugin-pwa";
14
+ import { defu } from "defu";
15
+ import { arraysPath, collectionsPath, componentsPath, frameworkPath, fsPath, functionsPath, helpersPath, langPath, pagesPath, pathsPath, projectPath, resolve, securityPath, stringsPath } from "@stacksjs/paths";
16
+ function inspect(options) {
17
+ return Inspect(options);
18
+ }
19
+ function preview() {
20
+ return Preview;
21
+ }
22
+ function layouts(options) {
23
+ return Layouts(options);
24
+ }
25
+ function components(options) {
26
+ const defaultOptions = {
27
+ extensions: ["vue", "md"],
28
+ include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
29
+ dirs: [
30
+ componentsPath(),
31
+ pagesPath()
32
+ ],
33
+ dts: frameworkPath("components.d.ts")
34
+ };
35
+ const newOptions = defu(options, defaultOptions);
36
+ return Components(newOptions);
37
+ }
38
+ function pages(options) {
39
+ const defaultOptions = {
40
+ extensions: ["vue", "md"],
41
+ dirs: [
42
+ pagesPath()
43
+ ]
44
+ };
45
+ const newOptions = defu(options, defaultOptions);
46
+ return Pages(newOptions);
47
+ }
48
+ function markdown(options) {
49
+ const defaultOptions = {
50
+ wrapperClasses: "prose prose-sm m-auto text-left",
51
+ headEnabled: true,
52
+ markdownItSetup(md) {
53
+ md.use(Shiki, {
54
+ theme: "nord"
55
+ });
56
+ md.use(LinkAttributes, {
57
+ matcher: (link) => /^https?:\/\//.test(link),
58
+ attrs: {
59
+ target: "_blank",
60
+ rel: "noopener"
61
+ }
62
+ });
63
+ }
64
+ };
65
+ const newOptions = defu(options, defaultOptions);
66
+ return Markdown(newOptions);
67
+ }
68
+ function autoImports(options) {
69
+ const defaultOptions = {
70
+ imports: [
71
+ "vue",
72
+ "vue-router",
73
+ "vue/macros",
74
+ "@vueuse/core",
75
+ "@vueuse/head",
76
+ "@vueuse/math",
77
+ "vitest",
78
+ { "@vueuse/shared": ["isClient", "isDef", "isBoolean", "isFunction", "isNumber", "isString", "isObject", "isWindow", "now", "timestamp", "clamp", "noop", "rand", "isIOS", "hasOwn"] }
79
+ ],
80
+ dirs: [
81
+ functionsPath(),
82
+ componentsPath(),
83
+ projectPath("config"),
84
+ arraysPath("src"),
85
+ stringsPath("src"),
86
+ collectionsPath("src"),
87
+ fsPath("src"),
88
+ helpersPath("src"),
89
+ pathsPath("src"),
90
+ securityPath("src")
91
+ ],
92
+ dts: frameworkPath("auto-imports.d.ts"),
93
+ vueTemplate: true,
94
+ eslintrc: {
95
+ enabled: false
96
+ }
97
+ };
98
+ const newOptions = defu(options, defaultOptions);
99
+ return AutoImport(newOptions);
100
+ }
101
+ function atomicCssEngine(isWebComponent = false) {
102
+ return Unocss({
103
+ configFile: frameworkPath("src/unocss.ts"),
104
+ mode: isWebComponent ? "shadow-dom" : "vue-scoped"
105
+ });
106
+ }
107
+ 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
+ function i18n(options) {
137
+ const defaultOptions = {
138
+ runtimeOnly: true,
139
+ compositionOnly: true,
140
+ include: [langPath("./**")]
141
+ };
142
+ const newOptions = defu(options, defaultOptions);
143
+ return VueI18n(newOptions);
144
+ }
145
+ function uiEngine(isWebComponent = false) {
146
+ if (isWebComponent) {
147
+ return Vue({
148
+ include: [/\.vue$/, /\.md$/],
149
+ template: {
150
+ compilerOptions: {
151
+ isCustomElement: () => true
152
+ }
153
+ }
154
+ });
155
+ }
156
+ return Vue({
157
+ include: [/\.vue$/, /\.md$/]
158
+ });
159
+ }
160
+ const componentPreset = (isWebComponent = false) => [
161
+ inspect,
162
+ uiEngine(isWebComponent),
163
+ atomicCssEngine(isWebComponent),
164
+ autoImports,
165
+ components,
166
+ markdown
167
+ ];
168
+ export { resolve, componentPreset, uiEngine, autoImports, atomicCssEngine, components, inspect, markdown, pages, pwa, preview, layouts, i18n };
@@ -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,61 @@
1
+ import { defineConfig } from "vite";
2
+ import { buildEntriesPath, componentsPath, frameworkPath, projectPath } from "@stacksjs/paths";
3
+ import { library } from "../../../config";
4
+ import { alias } from "../../../alias";
5
+ import { atomicCssEngine, autoImports, components, inspect, preview, uiEngine } from "./index.mjs";
6
+ export const vueComponentsConfig = {
7
+ root: componentsPath(),
8
+ envDir: projectPath(),
9
+ envPrefix: "APP_",
10
+ server: {
11
+ port: 3333,
12
+ open: true
13
+ },
14
+ resolve: {
15
+ dedupe: ["vue"],
16
+ alias
17
+ },
18
+ optimizeDeps: {
19
+ exclude: ["vue"]
20
+ },
21
+ plugins: [
22
+ preview(),
23
+ uiEngine(),
24
+ atomicCssEngine(),
25
+ autoImports(),
26
+ components(),
27
+ inspect()
28
+ ],
29
+ build: vueComponentsBuildOptions()
30
+ };
31
+ export function vueComponentsBuildOptions() {
32
+ return {
33
+ outDir: frameworkPath("vue-components/dist"),
34
+ emptyOutDir: true,
35
+ lib: {
36
+ entry: buildEntriesPath("vue-components.ts"),
37
+ name: library.vueComponents.name,
38
+ formats: ["cjs", "es"],
39
+ fileName: (format) => {
40
+ if (format === "es")
41
+ return "index.mjs";
42
+ if (format === "cjs")
43
+ return "index.cjs";
44
+ return "index.?.js";
45
+ }
46
+ },
47
+ rollupOptions: {
48
+ external: ["vue"],
49
+ output: {
50
+ globals: {
51
+ vue: "Vue"
52
+ }
53
+ }
54
+ }
55
+ };
56
+ }
57
+ export default defineConfig(({ command }) => {
58
+ if (command === "serve")
59
+ return vueComponentsConfig;
60
+ return vueComponentsConfig;
61
+ });
@@ -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,49 @@
1
+ import { defineConfig } from "vite";
2
+ import { buildEntriesPath, componentsPath, frameworkPath, projectPath } from "@stacksjs/paths";
3
+ import { library } from "../../../config";
4
+ import { alias } from "../../../alias";
5
+ import { atomicCssEngine, autoImports, components, inspect, uiEngine } from "./index.mjs";
6
+ const isWebComponent = true;
7
+ export const webComponentsConfig = {
8
+ root: componentsPath(),
9
+ envDir: projectPath(),
10
+ envPrefix: "APP_",
11
+ server: {
12
+ port: 3333,
13
+ open: true
14
+ },
15
+ resolve: {
16
+ alias
17
+ },
18
+ plugins: [
19
+ inspect(),
20
+ uiEngine(isWebComponent),
21
+ atomicCssEngine(isWebComponent),
22
+ autoImports(),
23
+ components()
24
+ ],
25
+ build: webComponentsBuildOptions()
26
+ };
27
+ export function webComponentsBuildOptions() {
28
+ return {
29
+ outDir: frameworkPath("web-components/dist"),
30
+ emptyOutDir: true,
31
+ lib: {
32
+ entry: buildEntriesPath("web-components.ts"),
33
+ name: library.webComponents.name,
34
+ formats: ["cjs", "es"],
35
+ fileName: (format) => {
36
+ if (format === "es")
37
+ return "index.mjs";
38
+ if (format === "cjs")
39
+ return "index.cjs";
40
+ return "index.?.js";
41
+ }
42
+ }
43
+ };
44
+ }
45
+ export default defineConfig(({ command }) => {
46
+ if (command === "serve")
47
+ return webComponentsConfig;
48
+ return webComponentsConfig;
49
+ });
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@stacksjs/build",
3
+ "type": "module",
4
+ "version": "0.37.3",
5
+ "packageManager": "pnpm@7.13.6",
6
+ "description": "The Stacks framework build tools and configurations.",
7
+ "author": "Chris Breuer",
8
+ "license": "MIT",
9
+ "funding": "https://github.com/sponsors/chrisbbreuer",
10
+ "homepage": "https://github.com/stacksjs/stacks/tree/main/.stacks/core/build#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/stacksjs/stacks.git",
14
+ "directory": "./.stacks/core/build"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/stacksjs/stacks/issues"
18
+ },
19
+ "keywords": [
20
+ "build",
21
+ "stacks",
22
+ "framework",
23
+ "typescript",
24
+ "javascript",
25
+ "vite",
26
+ "nitro",
27
+ "vue"
28
+ ],
29
+ "contributors": [
30
+ "Chris Breuer <chris@ow3.org>"
31
+ ],
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "engines": {
36
+ "node": ">=v18.10.0",
37
+ "pnpm": ">=7.13.6"
38
+ },
39
+ "dependencies": {
40
+ "@intlify/vite-plugin-vue-i18n": "^6.0.3",
41
+ "@stacksjs/paths": "0.37.3",
42
+ "@stacksjs/types": "0.37.3",
43
+ "@types/markdown-it-link-attributes": "^3.0.1",
44
+ "defu": "^6.1.0",
45
+ "jiti": "^1.16.0",
46
+ "markdown-it-link-attributes": "^4.0.1",
47
+ "markdown-it-shiki": "^0.5.1",
48
+ "unplugin-auto-import": "^0.11.2",
49
+ "unplugin-vue-components": "^0.22.8",
50
+ "vite": "^3.1.8",
51
+ "vite-plugin-inspect": "^0.7.5",
52
+ "vite-plugin-pages": "^0.27.0",
53
+ "vite-plugin-pwa": "^0.13.1",
54
+ "vite-plugin-vue-component-preview": "^0.3.3",
55
+ "vite-plugin-vue-layouts": "^0.7.0",
56
+ "vite-plugin-vue-markdown": "^0.22.1",
57
+ "vite-ssg": "^0.21.1",
58
+ "vite-ssg-sitemap": "^0.4.3",
59
+ "vue-docgen-web-types": "^0.1.8",
60
+ "vue-i18n": "^9.2.2"
61
+ },
62
+ "devDependencies": {
63
+ "mkdist": "^0.3.13"
64
+ },
65
+ "scripts": {
66
+ "build": "mkdist -d",
67
+ "dev": "mkdist -d",
68
+ "typecheck": "tsc --noEmit"
69
+ }
70
+ }