@octohash/vite-config 0.4.0 → 0.5.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 CHANGED
@@ -12,7 +12,7 @@ pnpm add -D @octohash/vite-config
12
12
 
13
13
  ## Usage
14
14
 
15
- Automatically detects the project type (app or library) and applies suitable plugins. Manual configuration is rarely needed.
15
+ Provides an application-focused Vite preset with suitable plugins. Manual configuration is rarely needed.
16
16
 
17
17
  ```ts
18
18
  import { defineConfig } from '@octohash/vite-config'
@@ -32,7 +32,7 @@ export default defineConfig({
32
32
 
33
33
  ## Customization
34
34
 
35
- The following is the top-level configuration (OptionsConfig) used to customize the Vite setup. It covers project type detection, alias resolution, common plugins, and both app/library-specific options.
35
+ The following is the top-level configuration (OptionsConfig) used to customize the Vite setup. It covers alias resolution, common plugins, and application-specific options.
36
36
 
37
37
  ```ts
38
38
  interface OptionsConfig {
@@ -42,12 +42,6 @@ interface OptionsConfig {
42
42
  * @default auto-detect based on `command === 'build'`
43
43
  */
44
44
  isBuild?: boolean
45
- /**
46
- * Type of the project
47
- *
48
- * @default auto-detect based on the `index.html` file
49
- */
50
- type?: ProjectType
51
45
  /**
52
46
  * Aliases used to replace values in `import` or `require` statements
53
47
  * Paths are automatically resolved if needed
@@ -71,12 +65,6 @@ interface OptionsConfig {
71
65
  * @default true
72
66
  */
73
67
  license?: boolean | LicensePluginOptions
74
- /**
75
- * https://github.com/originjs/vite-plugin-federation
76
- * Module federation
77
- */
78
- federation?: FederationPluginOptions
79
-
80
68
  // Application Plugin
81
69
  /**
82
70
  * https://github.com/chenxch/vite-plugin-dynamic-base
@@ -89,33 +77,16 @@ interface OptionsConfig {
89
77
  * You can customize the root element and loading template
90
78
  * Use `[app-loading-title]` as a placeholder to dynamically set the document title during loading`
91
79
  *
92
- * @default auto-detect based on `projectType === 'app'`
80
+ * @default true
93
81
  */
94
82
  appLoading?: boolean | AppLoadingPluginOptions
95
83
  /**
96
84
  * Injects metadata using `define`, accessible via `__VITE_APP_METADATA__`.
97
85
  * Includes information such as author, build time, version, and more.
98
86
  *
99
- * @default auto-detect based on `projectType === 'app'`
87
+ * @default true
100
88
  */
101
89
  metadata?: boolean | MetadataPluginOptions
102
- /**
103
- * Generates an import map for the project.
104
- * Based on https://github.com/jspm/vite-plugin-jspm, with extended CDN provider support and options for include/exclude.
105
- *
106
- * @default false
107
- */
108
- importMap?: boolean | ImportMapPluginOptions
109
-
110
- // Library Plugin
111
- /**
112
- * https://github.com/qmhc/vite-plugin-dts
113
- * Generates declaration files from .ts or .vue source files
114
- *
115
- * @default auto-detect based on `projectType === 'lib'`
116
- */
117
- dts?: boolean | DtsPluginOptions
118
-
119
90
  // Vue Plugin
120
91
  /**
121
92
  * Enable Vue support
@@ -153,7 +124,7 @@ interface OptionsVue {
153
124
  * Automatically imports commonly used APIs such as `vue`, `vue-router`, `pinia`, `@vueuse/core`, etc
154
125
  * Also supports auto-importing UI components from libraries like `ant-design-vue`, `element-plus`, etc
155
126
  *
156
- * @default auto-detect based on `projectType === 'app'`
127
+ * @default true
157
128
  */
158
129
  imports?: boolean | VueImportsPluginOptions
159
130
  /**
@@ -161,15 +132,15 @@ interface OptionsVue {
161
132
  * Enabled by default when the project type is `app`
162
133
  * The `directoryAsNamespace` option is enabled by default.
163
134
  *
164
- * @default auto-detect based on `projectType === 'app'`
135
+ * @default true
165
136
  */
166
137
  components?: boolean | VueComponentsPluginOptions
167
138
  /**
168
- * https://github.com/posva/unplugin-vue-router
139
+ * https://router.vuejs.org/guide/file-based-routing.html
169
140
  * Enabled by default when the project type is `app`
170
141
  * Folder(s) to scan for files and generate routes. Defaults to scanning the pages directory.
171
142
  *
172
- * @default auto-detect based on `projectType === 'app'`
143
+ * @default true
173
144
  */
174
145
  pages?: boolean | VuePagesPluginOptions
175
146
  }
@@ -5,6 +5,9 @@
5
5
  }
6
6
 
7
7
  .loading {
8
+ --app-loading-background: #fff;
9
+ --app-loading-foreground: #000;
10
+
8
11
  position: fixed;
9
12
  top: 0;
10
13
  left: 0;
@@ -16,7 +19,8 @@
16
19
  width: 100%;
17
20
  height: 100%;
18
21
  overflow: hidden;
19
- background-color: #f4f7f9;
22
+ color: var(--app-loading-foreground);
23
+ background-color: var(--app-loading-background);
20
24
 
21
25
  /* transition: all 0.8s ease-out; */
22
26
  }
@@ -29,81 +33,86 @@
29
33
  }
30
34
 
31
35
  .dark .loading {
32
- background: #0d0d10;
36
+ --app-loading-background: #000;
37
+ --app-loading-foreground: #fff;
33
38
  }
34
39
 
35
40
  .title {
36
- margin-top: 66px;
41
+ margin-top: 64px;
37
42
  font-size: 28px;
38
43
  font-weight: 600;
39
- color: rgb(0 0 0 / 85%);
40
- }
41
-
42
- .dark .title {
43
- color: #fff;
44
+ color: var(--app-loading-foreground);
44
45
  }
45
46
 
46
47
  .loader {
47
48
  position: relative;
48
- width: 48px;
49
- height: 48px;
49
+ width: 2.5em;
50
+ height: 2.5em;
51
+ font-size: 20px;
52
+ color: var(--app-loading-foreground);
53
+ transform: rotate(165deg);
50
54
  }
51
55
 
52
- .loader::before {
56
+ .loader::before,
57
+ .loader::after {
53
58
  position: absolute;
54
- top: 60px;
55
- left: 0;
56
- width: 48px;
57
- height: 5px;
59
+ top: 50%;
60
+ left: 50%;
61
+ display: block;
62
+ width: 0.5em;
63
+ height: 0.5em;
58
64
  content: '';
59
- background: hsl(var(--primary, 212 100% 45%) / 50%);
60
- border-radius: 50%;
61
- animation: shadow-ani 0.5s linear infinite;
65
+ border-radius: 0.25em;
66
+ transform: translate(-50%, -50%);
62
67
  }
63
68
 
64
- .loader::after {
65
- position: absolute;
66
- top: 0;
67
- left: 0;
68
- width: 100%;
69
- height: 100%;
70
- content: '';
71
- background: hsl(var(--primary, 212 100% 45%));
72
- border-radius: 4px;
73
- animation: jump-ani 0.5s linear infinite;
69
+ .loader::before {
70
+ animation: before8 2s infinite;
74
71
  }
75
72
 
76
- @keyframes jump-ani {
77
- 15% {
78
- border-bottom-right-radius: 3px;
79
- }
73
+ .loader::after {
74
+ animation: after6 2s infinite;
75
+ }
80
76
 
81
- 25% {
82
- transform: translateY(9px) rotate(22.5deg);
77
+ @keyframes before8 {
78
+ 0% {
79
+ width: 0.5em;
80
+ box-shadow: 1em -0.5em currentColor, -1em 0.5em currentColor;
83
81
  }
84
82
 
85
- 50% {
86
- border-bottom-right-radius: 40px;
87
- transform: translateY(18px) scale(1, 0.9) rotate(45deg);
83
+ 35% {
84
+ width: 2.5em;
85
+ box-shadow: 0 -0.5em currentColor, 0 0.5em currentColor;
88
86
  }
89
87
 
90
- 75% {
91
- transform: translateY(9px) rotate(67.5deg);
88
+ 70% {
89
+ width: 0.5em;
90
+ box-shadow: -1em -0.5em currentColor, 1em 0.5em currentColor;
92
91
  }
93
92
 
94
93
  100% {
95
- transform: translateY(0) rotate(90deg);
94
+ box-shadow: 1em -0.5em currentColor, -1em 0.5em currentColor;
96
95
  }
97
96
  }
98
97
 
99
- @keyframes shadow-ani {
100
- 0%,
101
- 100% {
102
- transform: scale(1, 1);
98
+ @keyframes after6 {
99
+ 0% {
100
+ height: 0.5em;
101
+ box-shadow: 0.5em 1em currentColor, -0.5em -1em currentColor;
103
102
  }
104
103
 
105
- 50% {
106
- transform: scale(1.2, 1);
104
+ 35% {
105
+ height: 2.5em;
106
+ box-shadow: 0.5em 0 currentColor, -0.5em 0 currentColor;
107
+ }
108
+
109
+ 70% {
110
+ height: 0.5em;
111
+ box-shadow: 0.5em -1em currentColor, -0.5em 1em currentColor;
112
+ }
113
+
114
+ 100% {
115
+ box-shadow: 0.5em 1em currentColor, -0.5em -1em currentColor;
107
116
  }
108
117
  }
109
118
  </style>