nuxt-ignis 0.3.2 → 0.3.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.
Files changed (54) hide show
  1. package/.data/content/contents.sqlite +0 -0
  2. package/.nuxt/components.d.ts +224 -224
  3. package/.nuxt/content/components.ts +56 -56
  4. package/.nuxt/dev/index.mjs +15 -7
  5. package/.nuxt/dev/index.mjs.map +1 -1
  6. package/.nuxt/eslint.config.mjs +1 -1
  7. package/.nuxt/imports.d.ts +16 -14
  8. package/.nuxt/manifest/latest.json +1 -1
  9. package/.nuxt/manifest/meta/dev.json +1 -1
  10. package/.nuxt/nitro.json +3 -3
  11. package/.nuxt/nuxt.d.ts +10 -10
  12. package/.nuxt/tsconfig.json +12 -12
  13. package/.nuxt/tsconfig.server.json +6 -6
  14. package/.nuxt/types/imports.d.ts +52 -50
  15. package/.nuxt/types/plugins.d.ts +2 -1
  16. package/.nuxt/types/schema.d.ts +40 -26
  17. package/app.vue +2 -2
  18. package/components/AppFeatureList.vue +5 -0
  19. package/composables/useValibot.ts +16 -0
  20. package/composables/useZod.ts +16 -0
  21. package/features.ts +45 -5
  22. package/i18n/locales/en.json +2 -0
  23. package/nuxt.config.ts +14 -4
  24. package/package.json +12 -8
  25. package/plugins/errorHandler.ts +26 -0
  26. package/test/config/default.txt +16 -0
  27. package/test/config/equipment-1-composable.txt +22 -0
  28. package/test/config/equipment-2-plugins.txt +23 -0
  29. package/test/config/equipment-all.txt +28 -0
  30. package/test/config.test.ts +47 -0
  31. package/test/features/db-neon.txt +3 -3
  32. package/test/features/db-off.txt +3 -3
  33. package/test/features/db-supabase.txt +3 -3
  34. package/test/features/default.txt +3 -3
  35. package/test/features/enable-all.txt +4 -4
  36. package/test/features/equipment.txt +3 -0
  37. package/test/features/forms-formkit.txt +3 -3
  38. package/test/features/forms-off.txt +3 -3
  39. package/test/features/forms-vueform.txt +3 -3
  40. package/test/features/ui-nuxt-ui.txt +3 -3
  41. package/test/features/ui-off.txt +3 -3
  42. package/test/features/ui-tailwind.txt +4 -4
  43. package/test/features/validation-off.txt +3 -0
  44. package/test/features/validation-valibot.txt +4 -0
  45. package/test/features/validation-zod.txt +4 -0
  46. package/test/features.test.ts +48 -0
  47. package/utils/config/content.ts +35 -0
  48. package/utils/config/vueform.ts +25 -0
  49. package/utils/consola.ts +23 -13
  50. package/utils/content.ts +12 -25
  51. package/utils/vueform.ts +14 -11
  52. package/vueform.config.ts +3 -5
  53. package/utils/config/content.config.ts +0 -12
  54. package/utils/config/vueform.config.ts +0 -20
@@ -1,3 +1,3 @@
1
- Nuxt Ignis will start using following settings:
2
- Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @pinia/nuxt, @nuxt/scripts, nuxt-security, @vueuse/nuxt
3
- Nuxt: log-level=info[default]
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt
3
+ Nuxt: log-level=info[default]
@@ -1,4 +1,4 @@
1
- Nuxt Ignis will start using following settings:
2
- Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @pinia/nuxt, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @nuxt/ui, nuxt-neon, @nuxtjs/supabase, @nuxtjs/i18n, @vueform/nuxt, @formkit/nuxt, @nuxtjs/seo, @nuxt/content, nuxt-auth-utils
3
- Extras: Open Props CSS, elrh-pslo
4
- Nuxt: log-level=info[default]
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt, @nuxt/ui, nuxt-neon, @nuxtjs/supabase, @nuxtjs/i18n, @vueform/nuxt, @formkit/nuxt, @nuxtjs/seo, @nuxt/content, nuxt-auth-utils
3
+ Extras: Open Props CSS, elrh-pslo
4
+ Nuxt: log-level=info[default]
@@ -0,0 +1,3 @@
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt, @maas/vue-equipment/nuxt
3
+ Nuxt: log-level=info[default]
@@ -1,3 +1,3 @@
1
- Nuxt Ignis will start using following settings:
2
- Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @pinia/nuxt, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @formkit/nuxt
3
- Nuxt: log-level=info[default]
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt, @formkit/nuxt
3
+ Nuxt: log-level=info[default]
@@ -1,3 +1,3 @@
1
- Nuxt Ignis will start using following settings:
2
- Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @pinia/nuxt, @nuxt/scripts, nuxt-security, @vueuse/nuxt
3
- Nuxt: log-level=info[default]
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt
3
+ Nuxt: log-level=info[default]
@@ -1,3 +1,3 @@
1
- Nuxt Ignis will start using following settings:
2
- Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @pinia/nuxt, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @vueform/nuxt
3
- Nuxt: log-level=info[default]
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt, @vueform/nuxt
3
+ Nuxt: log-level=info[default]
@@ -1,3 +1,3 @@
1
- Nuxt Ignis will start using following settings:
2
- Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @pinia/nuxt, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @nuxt/ui
3
- Nuxt: log-level=info[default]
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt, @nuxt/ui
3
+ Nuxt: log-level=info[default]
@@ -1,3 +1,3 @@
1
- Nuxt Ignis will start using following settings:
2
- Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @pinia/nuxt, @nuxt/scripts, nuxt-security, @vueuse/nuxt
3
- Nuxt: log-level=info[default]
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt
3
+ Nuxt: log-level=info[default]
@@ -1,4 +1,4 @@
1
- Nuxt Ignis will start using following settings:
2
- Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @pinia/nuxt, @nuxt/scripts, nuxt-security, @vueuse/nuxt
3
- Extras: Tailwind CSS
4
- Nuxt: log-level=info[default]
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt
3
+ Extras: Tailwind CSS
4
+ Nuxt: log-level=info[default]
@@ -0,0 +1,3 @@
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt
3
+ Nuxt: log-level=info[default]
@@ -0,0 +1,4 @@
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt
3
+ Extras: valibot
4
+ Nuxt: log-level=info[default]
@@ -0,0 +1,4 @@
1
+ Nuxt Ignis will start using following settings:
2
+ Modules: @nuxt/eslint, @nuxt/fonts, @nuxt/image, @nuxt/scripts, nuxt-security, @vueuse/nuxt, @pinia/nuxt
3
+ Extras: zod
4
+ Nuxt: log-level=info[default]
@@ -158,6 +158,46 @@ describe('setFeatures() unit tests', () => {
158
158
  await expect(getConsoleOutput()).toMatchFileSnapshot('./features/forms-formkit.txt')
159
159
  })
160
160
 
161
+ // preset - validation
162
+
163
+ test('setFeatures() - validation preset - valibot', async () => {
164
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_VALIDATION = 'valibot'
165
+ setFeatures()
166
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/validation-valibot.txt')
167
+ })
168
+
169
+ test('setFeatures() - validation preset - zod', async () => {
170
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_VALIDATION = 'zod'
171
+ setFeatures()
172
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/validation-zod.txt')
173
+ })
174
+
175
+ test('setFeatures() - validation preset - off', async () => {
176
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_VALIDATION = 'off'
177
+ setFeatures()
178
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/validation-off.txt')
179
+ })
180
+
181
+ test('setFeatures() - validation preset - invalid', async () => {
182
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_VALIDATION = 'invalid'
183
+ setFeatures()
184
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/validation-off.txt')
185
+ })
186
+
187
+ // validation - set directly
188
+
189
+ test('setFeatures() - validation - valibot', async () => {
190
+ process.env.NUXT_PUBLIC_IGNIS_VALIBOT = 'true'
191
+ setFeatures()
192
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/validation-valibot.txt')
193
+ })
194
+
195
+ test('setFeatures() - validation - zod', async () => {
196
+ process.env.NUXT_PUBLIC_IGNIS_ZOD = 'true'
197
+ setFeatures()
198
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/validation-zod.txt')
199
+ })
200
+
161
201
  // disable "core" features
162
202
  test('setFeatures() - disable core features', async () => {
163
203
  process.env.NUXT_PUBLIC_IGNIS_CORE_ESLINT = 'false'
@@ -188,4 +228,12 @@ describe('setFeatures() unit tests', () => {
188
228
  setFeatures()
189
229
  await expect(getConsoleOutput()).toMatchFileSnapshot('./features/enable-all.txt')
190
230
  })
231
+
232
+ // Vue Equipment
233
+
234
+ test('setFeatures() - Vue Equipment - none', async () => {
235
+ process.env.NUXT_PUBLIC_IGNIS_EQUIPMENT_ENABLED = 'true'
236
+ setFeatures()
237
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/equipment.txt')
238
+ })
191
239
  })
@@ -0,0 +1,35 @@
1
+ // Nuxt Content requires its configuration to be injected and config exported
2
+ // this normally happens in content.config.ts file in project root
3
+ // however, it is not possible to transfer this config file when extending a layer
4
+ // user only have to setup small custom config file in his own project
5
+ // more info in the docs
6
+ // TODO can this be changed? can layer's "auto-imports" be configured?
7
+
8
+ import { defu } from 'defu'
9
+ import { defineCollection, defineContentConfig } from '@nuxt/content'
10
+ import { log } from '../consola'
11
+
12
+ // re-export so it can be called in target apps without '@nuxt/content' dependency
13
+ export function defineContentCollection(...args: Parameters<typeof defineCollection>) {
14
+ return defineCollection(...args)
15
+ }
16
+
17
+ // @ts-expect-error no-implicit-any
18
+ // TODO set proper type for the object
19
+ export function getContentConfig(userContentConfig) {
20
+ // only Nuxt Content is allowed
21
+ if (process.env.NUXT_PUBLIC_IGNIS_CONTENT === 'true') {
22
+ // defu-merge nuxt-ignis default with possible user values
23
+ return defu(userContentConfig, defineContentConfig({
24
+ collections: {
25
+ content: defineCollection({
26
+ source: '**',
27
+ type: 'page',
28
+ }),
29
+ },
30
+ }))
31
+ }
32
+ // otherwise throw warning and return just a dummy object
33
+ log.warn('loadContentConfig: @nuxt/content is not enabled, settings will take no effect')
34
+ return {}
35
+ }
@@ -0,0 +1,25 @@
1
+ // Vueform requires its configuration to be injected and config exported
2
+ // this normally happens in vueform.config.ts file in project root
3
+ // however, it is not possible to transfer this config file when extending a layer
4
+ // user only have to setup small custom config file in his own project
5
+ // more info in the docs
6
+ // TODO can this be changed? can layer's "auto-imports" be configured?
7
+
8
+ import { defu } from 'defu'
9
+
10
+ import en from '@vueform/vueform/locales/en'
11
+ import vueform from '@vueform/vueform/dist/vueform'
12
+ import { defineConfig } from '@vueform/vueform'
13
+
14
+ import '@vueform/vueform/types/index.d.ts'
15
+ import '@vueform/vueform/dist/vueform.css'
16
+
17
+ // @ts-expect-error no-implicit-any
18
+ // TODO set proper type for the object
19
+ export function getVueformConfig(userVueformConfig) {
20
+ return defu(userVueformConfig, defineConfig({
21
+ theme: vueform,
22
+ locales: { en },
23
+ locale: 'en',
24
+ }))
25
+ }
package/utils/consola.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  import type { LogLevel, LogObject } from 'consola/core'
5
5
  import { LogLevels, createConsola } from 'consola/core'
6
6
  import { consola } from 'consola'
7
- import { useDateFormat } from '@vueuse/core'
7
+ import { format } from 'date-fns'
8
8
 
9
9
  // default instance to write into browser's console
10
10
  const defaultReporter = consola
@@ -62,29 +62,39 @@ function getLogLevel(logLevel: string): LogLevel {
62
62
  }
63
63
 
64
64
  /**
65
- * Enhance received log object, which should be logged.
66
- * Add current date+time and trim irrelevant call-stack for warn/errors.
65
+ * Enhance received log object before it is logged.
66
+ * Add current date+time and trim irrelevant callstack for warn/errors.
67
67
  * @param logObj Object to be logged
68
- * @returns Enhanced object to be logged
68
+ * @returns Enhanced string to be logged
69
69
  */
70
70
  function transformLog(logObj: LogObject): string {
71
- let logBody = logObj.args[0]
72
- if (typeof logBody !== 'string') {
73
- logBody = JSON.stringify(logBody)
71
+ const logData = logObj.args[0]
72
+
73
+ let logBody
74
+ if (typeof logData === 'string') {
75
+ logBody = logData
76
+ } else {
77
+ if ('message' in logData) {
78
+ logBody = logData.message
79
+ } else {
80
+ logBody = JSON.stringify(logData, null, 2)
81
+ }
74
82
  }
75
83
 
76
- const timestamp = useDateFormat(new Date(), 'YYYY-MM-DD HH:mm:ss.SSS').value
84
+ // add timestamp to the log body
85
+ const timestamp = format(new Date(), 'yyyy-MM-dd HH:mm:ss.SSS')
77
86
  logBody = timestamp + '\n' + logBody
78
87
 
88
+ // for warns and errors the stack is parsed to display only relevant records
89
+ // (= coming from your own codebase)
79
90
  if (logObj.level <= LogLevels.warn) {
80
- const fullStack = new Error(logBody).stack
91
+ const fullStack = logData.stack as string
81
92
  const filteredStack = fullStack?.split('\n at ').filter(x => !x.includes('node_modules'))
82
- const relevantStack = filteredStack?.slice(0, filteredStack.length - 3)
83
- if (relevantStack?.length && logObj.level <= LogLevels.warn) {
93
+ if (filteredStack?.length && logObj.level <= LogLevels.warn) {
84
94
  if (logObj.level === LogLevels.warn) {
85
- relevantStack[0] = relevantStack[0]!.replace('Error:', 'Warn:')
95
+ filteredStack[0] = filteredStack[0]!.replace('Error:', 'Warn:')
86
96
  }
87
- logBody = timestamp + '\n' + relevantStack.join('\n\tat ')
97
+ logBody = timestamp + '\n' + filteredStack.join('\n\tat ')
88
98
  }
89
99
  }
90
100
 
package/utils/content.ts CHANGED
@@ -1,31 +1,18 @@
1
- // this function adresses https://github.com/AloisSeckar/nuxt-ignis/issues/70
2
- // Nuxt Content requires its configuration to be injected and config exported
3
- // this normally happens in content.config.ts file in project root
4
- // however, it is not possible to transfer this config file when extending a layer
5
- // user only have to setup small custom config file in his own project
6
- // more info in the docs
7
- // TODO can this be changed? can layer's "auto-imports" be configured?
1
+ // this functions shield configuration processing
2
+ // when Nuxt Ignis' content.config.ts is presented
3
+ // but the related module is not allowed by .env settings
8
4
 
9
- import { defu } from 'defu'
10
- import { defineCollection } from '@nuxt/content'
11
- import { log } from './consola'
12
-
13
- // re-export so it can be called in target apps without '@nuxt/content' dependency
14
- export function defineContentCollection(...args: Parameters<typeof defineCollection>) {
15
- return defineCollection(...args)
16
- }
5
+ import { getContentConfig } from './config/content'
17
6
 
18
7
  // @ts-expect-error no-implicit-any
19
- export async function loadContentConfig(userContentConfig) {
20
- // only if content is allowed
8
+ // TODO set proper type for the object
9
+ export function loadContentConfig(userContentConfig) {
10
+ // only Nuxt Content is allowed
21
11
  if (process.env.NUXT_PUBLIC_IGNIS_CONTENT === 'true') {
22
- // get nuxt-ignis default
23
- const defaultContentConfig = await import('./config/content.config')
24
- // merge with possible user values
25
- const contentConfig = defu(userContentConfig, defaultContentConfig.default)
26
- return contentConfig
12
+ // defu-merge nuxt-ignis default with possible user values
13
+ return getContentConfig(userContentConfig)
27
14
  }
28
- // otherwise there is nothing to load
29
- log.warn('@nuxt/content is not enabled, ensure you have NUXT_PUBLIC_IGNIS_CONTENT=true')
30
- return null
15
+ // otherwise throw warning and return just a dummy object
16
+ log.warn('loadContentConfig: @nuxt/content is not enabled, settings will take no effect')
17
+ return {}
31
18
  }
package/utils/vueform.ts CHANGED
@@ -1,16 +1,19 @@
1
- // this function adresses https://github.com/AloisSeckar/nuxt-ignis/issues/71
2
- // Vueform requires its configuration to be injected and config exported
3
- // this normally happens in vueform.config.ts file in project root
4
- // however, it is not possible to transfer this config file when extending a layer
5
- // user only have to setup small custom config file in his own project
6
- // more info in the docs
7
- // TODO can this be changed? can layer's "auto-imports" be configured?
1
+ // this functions shield configuration processing
2
+ // when Nuxt Ignis' vueform.config.ts is presented
3
+ // but the related module is not allowed by .env settings
8
4
 
9
- export async function loadDefaultVueformConfig() {
5
+ import { getVueformConfig } from './config/vueform'
6
+
7
+ // @ts-expect-error no-implicit-any
8
+ // TODO set proper type for the object
9
+ export function loadVueformConfig(userVueformConfig) {
10
+ // only if Vueform is allowed
10
11
  const config = useRuntimeConfig().public.ignis
11
12
  if (config.preset.forms === 'vueform' || config.vueform === true) {
12
- const vueformConfig = await import('./config/vueform.config')
13
- return vueformConfig.default
13
+ // defu-merge nuxt-ignis default with possible user values
14
+ return getVueformConfig(userVueformConfig)
14
15
  }
15
- return null
16
+ // otherwise throw warning and return just a dummy object
17
+ log.warn('loadVueformConfig: Vueform is not enabled, settings will take no effect')
18
+ return {}
16
19
  }
package/vueform.config.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  // minimal config for Vueform
2
2
  // currently required to be loaded like this...
3
3
 
4
- import { defineConfig } from '@vueform/vueform'
5
-
6
- const vueformConfig = await loadDefaultVueformConfig()
7
-
8
- export default defineConfig(vueformConfig!)
4
+ export default loadVueformConfig({
5
+ // custom config here
6
+ })
@@ -1,12 +0,0 @@
1
- import { defineCollection, defineContentConfig } from '@nuxt/content'
2
-
3
- export default defineContentConfig({
4
- // while it is not strictily necessary to have a default config file
5
- // it produces warning during startup when not presented
6
- collections: {
7
- content: defineCollection({
8
- source: '**',
9
- type: 'page',
10
- }),
11
- },
12
- })
@@ -1,20 +0,0 @@
1
- // this is basic "getting started" configuration example
2
- // for more options check:
3
- // https://vueform.com/docs/configuration
4
-
5
- import en from '@vueform/vueform/locales/en'
6
- import vueform from '@vueform/vueform/dist/vueform'
7
- import { defineConfig } from '@vueform/vueform'
8
-
9
- // add Vueform type definitions
10
- import '@vueform/vueform/types/index.d.ts'
11
-
12
- // add default CSS styles
13
- // can be placed anywhere else in your project
14
- import '@vueform/vueform/dist/vueform.css'
15
-
16
- export default defineConfig({
17
- theme: vueform,
18
- locales: { en },
19
- locale: 'en',
20
- })