nuxt-ignis 0.3.1 → 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 (88) hide show
  1. package/.data/content/contents.sqlite +0 -0
  2. package/.env +3 -3
  3. package/.nuxt/app.config.mjs +227 -1
  4. package/.nuxt/components.d.ts +372 -140
  5. package/.nuxt/content/components.ts +93 -36
  6. package/.nuxt/dev/index.mjs +7609 -0
  7. package/.nuxt/dev/index.mjs.map +1 -0
  8. package/.nuxt/dist/server/client.manifest.json +2 -2
  9. package/.nuxt/dist/server/client.manifest.mjs +2 -2
  10. package/.nuxt/eslint.config.d.mts +2 -2
  11. package/.nuxt/eslint.config.mjs +2 -2
  12. package/.nuxt/imports.d.ts +59 -42
  13. package/.nuxt/manifest/latest.json +1 -1
  14. package/.nuxt/manifest/meta/dev.json +1 -1
  15. package/.nuxt/module/@nuxtjs-sitemap.d.ts +8 -8
  16. package/.nuxt/module/nuxt-robots.d.ts +3 -3
  17. package/.nuxt/module/nuxt-seo-utils.d.ts +6 -6
  18. package/.nuxt/module/nuxt-site-config.d.ts +8 -8
  19. package/.nuxt/nitro.json +4 -4
  20. package/.nuxt/nuxt.d.ts +11 -9
  21. package/.nuxt/nuxt.json +2 -2
  22. package/.nuxt/schema/nuxt.schema.d.ts +193 -0
  23. package/.nuxt/schema/nuxt.schema.json +261 -1
  24. package/.nuxt/tsconfig.json +133 -110
  25. package/.nuxt/tsconfig.server.json +82 -64
  26. package/.nuxt/types/app.config.d.ts +227 -1
  27. package/.nuxt/types/build.d.ts +2 -1
  28. package/.nuxt/types/i18n-plugin.d.ts +2 -2
  29. package/.nuxt/types/imports.d.ts +320 -264
  30. package/.nuxt/types/neon.d.ts +136 -34
  31. package/.nuxt/types/nitro-imports.d.ts +40 -40
  32. package/.nuxt/types/nitro-routes.d.ts +21 -18
  33. package/.nuxt/types/plugins.d.ts +38 -33
  34. package/.nuxt/types/schema.d.ts +110 -36
  35. package/.nuxt/types/ui.d.ts +1 -1
  36. package/.nuxt/ui/checkbox-group.ts +1 -1
  37. package/.nuxt/ui/context-menu.ts +2 -1
  38. package/.nuxt/ui/dropdown-menu.ts +2 -1
  39. package/.nuxt/ui/input-menu.ts +2 -2
  40. package/.nuxt/ui/navigation-menu.ts +43 -34
  41. package/.nuxt/ui/radio-group.ts +1 -1
  42. package/.nuxt/ui/select-menu.ts +2 -2
  43. package/.nuxt/ui/select.ts +2 -2
  44. package/.nuxt/ui/tooltip.ts +1 -1
  45. package/.nuxt/ui.css +4 -1
  46. package/app.vue +2 -2
  47. package/components/AppFeatureList.vue +5 -0
  48. package/composables/useValibot.ts +16 -0
  49. package/composables/useZod.ts +16 -0
  50. package/content.config.ts +6 -10
  51. package/features.ts +59 -6
  52. package/i18n/locales/en.json +2 -0
  53. package/nuxt.config.ts +15 -5
  54. package/package.json +20 -16
  55. package/plugins/errorHandler.ts +26 -0
  56. package/server/api/neonTest.ts +7 -5
  57. package/test/config/default.txt +16 -0
  58. package/test/config/equipment-1-composable.txt +22 -0
  59. package/test/config/equipment-2-plugins.txt +23 -0
  60. package/test/config/equipment-all.txt +28 -0
  61. package/test/config.test.ts +47 -0
  62. package/test/features/db-neon.txt +3 -0
  63. package/test/features/db-off.txt +3 -0
  64. package/test/features/db-supabase.txt +3 -0
  65. package/test/features/default.txt +3 -0
  66. package/test/features/disable-core.txt +3 -0
  67. package/test/features/enable-all.txt +4 -0
  68. package/test/features/equipment.txt +3 -0
  69. package/test/features/forms-formkit.txt +3 -0
  70. package/test/features/forms-off.txt +3 -0
  71. package/test/features/forms-vueform.txt +3 -0
  72. package/test/features/ui-nuxt-ui.txt +3 -0
  73. package/test/features/ui-off.txt +3 -0
  74. package/test/features/ui-tailwind.txt +4 -0
  75. package/test/features/validation-off.txt +3 -0
  76. package/test/features/validation-valibot.txt +4 -0
  77. package/test/features/validation-zod.txt +4 -0
  78. package/test/features.test.ts +239 -0
  79. package/utils/config/content.ts +35 -0
  80. package/utils/config/vueform.ts +25 -0
  81. package/utils/consola.ts +23 -13
  82. package/utils/content.ts +18 -0
  83. package/utils/tailwind.ts +19 -0
  84. package/utils/vueform.ts +19 -0
  85. package/vueform.config.ts +4 -18
  86. package/.nuxt/component-chunk.mjs +0 -1
  87. package/.nuxt/dist/server/server.mjs +0 -1
  88. package/.nuxt/tailwind/postcss.mjs +0 -15
@@ -0,0 +1,22 @@
1
+ {
2
+ "modules": [
3
+ "@nuxt/eslint",
4
+ "@nuxt/fonts",
5
+ "@nuxt/image",
6
+ "@nuxt/scripts",
7
+ "nuxt-security",
8
+ "@vueuse/nuxt",
9
+ "@pinia/nuxt",
10
+ "@maas/vue-equipment/nuxt",
11
+ ],
12
+ "vue": {
13
+ "compilerOptions": {
14
+ "isCustomElement": [Function],
15
+ },
16
+ },
17
+ "vueEquipment": {
18
+ "composables": [
19
+ "useScrollTo",
20
+ ],
21
+ },
22
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "modules": [
3
+ "@nuxt/eslint",
4
+ "@nuxt/fonts",
5
+ "@nuxt/image",
6
+ "@nuxt/scripts",
7
+ "nuxt-security",
8
+ "@vueuse/nuxt",
9
+ "@pinia/nuxt",
10
+ "@maas/vue-equipment/nuxt",
11
+ ],
12
+ "vue": {
13
+ "compilerOptions": {
14
+ "isCustomElement": [Function],
15
+ },
16
+ },
17
+ "vueEquipment": {
18
+ "plugins": [
19
+ "MagicMenu",
20
+ "MagicModal",
21
+ ],
22
+ },
23
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "modules": [
3
+ "@nuxt/eslint",
4
+ "@nuxt/fonts",
5
+ "@nuxt/image",
6
+ "@nuxt/scripts",
7
+ "nuxt-security",
8
+ "@vueuse/nuxt",
9
+ "@pinia/nuxt",
10
+ "@maas/vue-equipment/nuxt",
11
+ ],
12
+ "vue": {
13
+ "compilerOptions": {
14
+ "isCustomElement": [Function],
15
+ },
16
+ },
17
+ "vueEquipment": {
18
+ "composables": [
19
+ "useCountdown",
20
+ "useScrollTo",
21
+ ],
22
+ "plugins": [
23
+ "MagicMenu",
24
+ "MagicModal",
25
+ "MagicCookie",
26
+ ],
27
+ },
28
+ }
@@ -0,0 +1,47 @@
1
+ import { beforeEach, describe, expect, test } from 'vitest'
2
+ import { setFeatures } from '../features'
3
+
4
+ // `setFeatures()` is the core function that evaluates the environment variables
5
+ // and decides which features to enable in the user's Nuxt application
6
+ // this suite test the nuxtConfig object output, whether it matches the intended values
7
+
8
+ describe('nuxtConfig unit tests', () => {
9
+ // store original process.env to restore it after tests
10
+ const OLD_ENV = process.env
11
+
12
+ beforeEach(() => {
13
+ // restore env before each test
14
+ process.env = { ...OLD_ENV }
15
+ })
16
+
17
+ // output with no settings provided
18
+
19
+ test('nuxtConfig - default output', async () => {
20
+ const nuxtConfig = setFeatures()
21
+ await expect(nuxtConfig).toMatchFileSnapshot('./config/default.txt')
22
+ })
23
+
24
+ // Vue Equipment
25
+
26
+ test('nuxtConfig - Vue Equipment - 1 composable', async () => {
27
+ process.env.NUXT_PUBLIC_IGNIS_EQUIPMENT_ENABLED = 'true'
28
+ process.env.NUXT_PUBLIC_IGNIS_EQUIPMENT_COMPOSABLES = 'useScrollTo'
29
+ const nuxtConfig = setFeatures()
30
+ await expect(nuxtConfig).toMatchFileSnapshot('./config/equipment-1-composable.txt')
31
+ })
32
+
33
+ test('setFeatures() - Vue Equipment - 2 plugins', async () => {
34
+ process.env.NUXT_PUBLIC_IGNIS_EQUIPMENT_ENABLED = 'true'
35
+ process.env.NUXT_PUBLIC_IGNIS_EQUIPMENT_PLUGINS = 'MagicMenu, MagicModal'
36
+ const nuxtConfig = setFeatures()
37
+ await expect(nuxtConfig).toMatchFileSnapshot('./config/equipment-2-plugins.txt')
38
+ })
39
+
40
+ test('setFeatures() - Vue Equipment - composables + plugins', async () => {
41
+ process.env.NUXT_PUBLIC_IGNIS_EQUIPMENT_ENABLED = 'true'
42
+ process.env.NUXT_PUBLIC_IGNIS_EQUIPMENT_COMPOSABLES = 'useCountdown,useScrollTo'
43
+ process.env.NUXT_PUBLIC_IGNIS_EQUIPMENT_PLUGINS = 'MagicMenu, MagicModal , MagicCookie'
44
+ const nuxtConfig = setFeatures()
45
+ await expect(nuxtConfig).toMatchFileSnapshot('./config/equipment-all.txt')
46
+ })
47
+ })
@@ -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, nuxt-neon
3
+ 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,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, @nuxtjs/supabase
3
+ 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,3 @@
1
+ Nuxt Ignis will start using following settings:
2
+ Modules:
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, @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]
@@ -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, @formkit/nuxt
3
+ 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,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, @vueform/nuxt
3
+ 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, @nuxt/ui
3
+ 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: 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]
@@ -0,0 +1,239 @@
1
+ import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
2
+ import { setFeatures } from '../features'
3
+ import { log } from '../utils/consola'
4
+
5
+ // `setFeatures()` is the core function that evaluates the environment variables
6
+ // and decides which features to enable in the user's Nuxt application
7
+
8
+ describe('setFeatures() unit tests', () => {
9
+ // store original process.env to restore it after tests
10
+ const OLD_ENV = process.env
11
+
12
+ // mock consola instance for listening to `setFeatures()` method output
13
+ const consoleSpy = vi.spyOn(log, 'info').mockImplementation(() => {})
14
+
15
+ // helper function to get the console output from the spy
16
+ function getConsoleOutput() {
17
+ return consoleSpy.mock.calls[0]![0] as string
18
+ }
19
+
20
+ beforeEach(() => {
21
+ // restore env before each test
22
+ process.env = { ...OLD_ENV }
23
+ })
24
+
25
+ afterEach(() => {
26
+ // clear the console spy after each test
27
+ vi.clearAllMocks()
28
+ })
29
+
30
+ // output with no settings provided
31
+
32
+ test('setFeatures() - default output', async () => {
33
+ expect(setFeatures).toBeDefined()
34
+ setFeatures()
35
+ expect(consoleSpy).toHaveBeenCalledOnce()
36
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/default.txt')
37
+ })
38
+
39
+ // following test cases are checking whether presets are evaluated correctly
40
+
41
+ // preset - UI
42
+
43
+ test('setFeatures() - UI preset - nuxt-ui', async () => {
44
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_UI = 'nuxt-ui'
45
+ setFeatures()
46
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/ui-nuxt-ui.txt')
47
+ })
48
+
49
+ test('setFeatures() - UI preset - tailwind', async () => {
50
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_UI = 'tailwind'
51
+ setFeatures()
52
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/ui-tailwind.txt')
53
+ })
54
+
55
+ test('setFeatures() - UI preset - off', async () => {
56
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_UI = 'off'
57
+ setFeatures()
58
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/ui-off.txt')
59
+ })
60
+
61
+ test('setFeatures() - UI preset - invalid', async () => {
62
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_UI = 'invalid'
63
+ setFeatures()
64
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/ui-off.txt')
65
+ })
66
+
67
+ // UI - set directly
68
+
69
+ test('setFeatures() - UI - nuxt-ui', async () => {
70
+ process.env.NUXT_PUBLIC_IGNIS_UI = 'true'
71
+ setFeatures()
72
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/ui-nuxt-ui.txt')
73
+ })
74
+
75
+ test('setFeatures() - UI - tailwind', async () => {
76
+ process.env.NUXT_PUBLIC_IGNIS_TAILWIND = 'true'
77
+ setFeatures()
78
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/ui-tailwind.txt')
79
+ })
80
+
81
+ // preset - DB
82
+
83
+ test('setFeatures() - DB preset - neon', async () => {
84
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_DB = 'neon'
85
+ setFeatures()
86
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/db-neon.txt')
87
+ })
88
+
89
+ test('setFeatures() - DB preset - supabase', async () => {
90
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_DB = 'supabase'
91
+ setFeatures()
92
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/db-supabase.txt')
93
+ })
94
+
95
+ test('setFeatures() - DB preset - off', async () => {
96
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_DB = 'off'
97
+ setFeatures()
98
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/db-off.txt')
99
+ })
100
+
101
+ test('setFeatures() - DB preset - invalid', async () => {
102
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_DB = 'invalid'
103
+ setFeatures()
104
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/db-off.txt')
105
+ })
106
+
107
+ // DB - set directly
108
+
109
+ test('setFeatures() - DB - neon', async () => {
110
+ process.env.NUXT_PUBLIC_IGNIS_NEON = 'true'
111
+ setFeatures()
112
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/db-neon.txt')
113
+ })
114
+
115
+ test('setFeatures() - DB - supabase', async () => {
116
+ process.env.NUXT_PUBLIC_IGNIS_SUPABASE = 'true'
117
+ setFeatures()
118
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/db-supabase.txt')
119
+ })
120
+
121
+ // preset - forms
122
+
123
+ test('setFeatures() - forms preset - vueform', async () => {
124
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_FORMS = 'vueform'
125
+ setFeatures()
126
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/forms-vueform.txt')
127
+ })
128
+
129
+ test('setFeatures() - forms preset - formkit', async () => {
130
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_FORMS = 'formkit'
131
+ setFeatures()
132
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/forms-formkit.txt')
133
+ })
134
+
135
+ test('setFeatures() - forms preset - off', async () => {
136
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_FORMS = 'off'
137
+ setFeatures()
138
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/forms-off.txt')
139
+ })
140
+
141
+ test('setFeatures() - forms preset - invalid', async () => {
142
+ process.env.NUXT_PUBLIC_IGNIS_PRESET_FORMS = 'invalid'
143
+ setFeatures()
144
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/forms-off.txt')
145
+ })
146
+
147
+ // forms - set directly
148
+
149
+ test('setFeatures() - forms - vueform', async () => {
150
+ process.env.NUXT_PUBLIC_IGNIS_VUEFORM = 'true'
151
+ setFeatures()
152
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/forms-vueform.txt')
153
+ })
154
+
155
+ test('setFeatures() - forms - formkit', async () => {
156
+ process.env.NUXT_PUBLIC_IGNIS_FORMKIT_ENABLED = 'true'
157
+ setFeatures()
158
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/forms-formkit.txt')
159
+ })
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
+
201
+ // disable "core" features
202
+ test('setFeatures() - disable core features', async () => {
203
+ process.env.NUXT_PUBLIC_IGNIS_CORE_ESLINT = 'false'
204
+ process.env.NUXT_PUBLIC_IGNIS_CORE_FONTS = 'false'
205
+ process.env.NUXT_PUBLIC_IGNIS_CORE_IMAGE = 'false'
206
+ process.env.NUXT_PUBLIC_IGNIS_CORE_PINIA = 'false'
207
+ process.env.NUXT_PUBLIC_IGNIS_CORE_SCRIPTS = 'false'
208
+ process.env.NUXT_PUBLIC_IGNIS_CORE_SECURITY = 'false'
209
+ process.env.NUXT_PUBLIC_IGNIS_CORE_VUEUSE = 'false'
210
+ setFeatures()
211
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/disable-core.txt')
212
+ })
213
+
214
+ // enable all features
215
+ test('setFeatures() - enable all features', async () => {
216
+ process.env.NUXT_PUBLIC_IGNIS_UI = 'true'
217
+ process.env.NUXT_PUBLIC_IGNIS_NEON = 'true'
218
+ process.env.NUXT_PUBLIC_IGNIS_SUPABASE = 'true'
219
+ process.env.NUXT_PUBLIC_IGNIS_I18N_ENABLED = 'true'
220
+ process.env.NUXT_PUBLIC_IGNIS_FORMKIT_ENABLED = 'true'
221
+ process.env.NUXT_PUBLIC_IGNIS_VUEFORM = 'true'
222
+ process.env.NUXT_PUBLIC_IGNIS_CONTENT = 'true'
223
+ process.env.NUXT_PUBLIC_IGNIS_OPENPROPS = 'true'
224
+ process.env.NUXT_PUBLIC_IGNIS_PSLO_ENABLED = 'true'
225
+ process.env.NUXT_PUBLIC_IGNIS_SEO = 'true'
226
+ process.env.NUXT_PUBLIC_IGNIS_AUTH = 'true'
227
+ process.env.NUXT_PUBLIC_IGNIS_WARN_DUPLICATES = 'false' // to avoid console log
228
+ setFeatures()
229
+ await expect(getConsoleOutput()).toMatchFileSnapshot('./features/enable-all.txt')
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
+ })
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
 
@@ -0,0 +1,18 @@
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
4
+
5
+ import { getContentConfig } from './config/content'
6
+
7
+ // @ts-expect-error no-implicit-any
8
+ // TODO set proper type for the object
9
+ export function loadContentConfig(userContentConfig) {
10
+ // only Nuxt Content is allowed
11
+ if (process.env.NUXT_PUBLIC_IGNIS_CONTENT === 'true') {
12
+ // defu-merge nuxt-ignis default with possible user values
13
+ return getContentConfig(userContentConfig)
14
+ }
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 {}
18
+ }
@@ -0,0 +1,19 @@
1
+ // TEMPORARY FIX for https://github.com/tailwindlabs/tailwindcss/discussions/16119
2
+ export const ignisTailwindcssFix = {
3
+ name: 'vite-plugin-ignore-sourcemap-warnings',
4
+ apply: 'build',
5
+ // @ts-expect-error no-implicit-any
6
+ configResolved(config) {
7
+ // @ts-expect-error no-implicit-any
8
+ config.build.rollupOptions.onwarn = (warning, warn) => {
9
+ if (
10
+ warning.code === 'SOURCEMAP_BROKEN'
11
+ && warning.plugin === '@tailwindcss/vite:generate:build'
12
+ ) {
13
+ return
14
+ }
15
+
16
+ warn(warning)
17
+ }
18
+ },
19
+ }
@@ -0,0 +1,19 @@
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
4
+
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
11
+ const config = useRuntimeConfig().public.ignis
12
+ if (config.preset.forms === 'vueform' || config.vueform === true) {
13
+ // defu-merge nuxt-ignis default with possible user values
14
+ return getVueformConfig(userVueformConfig)
15
+ }
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 {}
19
+ }
package/vueform.config.ts CHANGED
@@ -1,20 +1,6 @@
1
- // this is basic "getting started" configuration example
2
- // for more options check:
3
- // https://vueform.com/docs/configuration
1
+ // minimal config for Vueform
2
+ // currently required to be loaded like this...
4
3
 
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',
4
+ export default loadVueformConfig({
5
+ // custom config here
20
6
  })
@@ -1 +0,0 @@
1
- export default {}