@dargmuesli/nuxt-vio 11.0.1 → 11.1.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/components/vio/_/VioApp.vue +2 -2
- package/components/vio/button/VioButtonShare.vue +1 -1
- package/composables/useDateTime.ts +0 -1
- package/composables/useFireError.ts +1 -1
- package/composables/useLoadingDoneIndicator.ts +2 -2
- package/eslint.config.js +83 -0
- package/locales/de.json +0 -1
- package/locales/en.json +0 -1
- package/nuxt.config.ts +2 -1
- package/package.json +31 -30
- package/types/api.d.ts +1 -1
- package/types/modules/gql.d.ts +1 -1
- package/types/modules/graphql.d.ts +1 -1
- package/utils/auth.ts +7 -10
- package/utils/networking.ts +3 -3
@@ -28,14 +28,14 @@ const { loadingIds, indicateLoadingDone } = useLoadingDoneIndicator('app')
|
|
28
28
|
const init = () => {
|
29
29
|
$dayjs.locale(locale.value)
|
30
30
|
|
31
|
-
if (
|
31
|
+
if (import.meta.client) {
|
32
32
|
const cookieTimezone = useCookie(TIMEZONE_COOKIE_NAME, {
|
33
33
|
// default: () => undefined, // setting `default` on the client side only does not write the cookie
|
34
34
|
httpOnly: false,
|
35
35
|
sameSite: 'strict',
|
36
36
|
secure: true,
|
37
37
|
})
|
38
|
-
// @ts-
|
38
|
+
// @ts-expect-error `tz` should be part of `$dayjs` (https://github.com/iamkun/dayjs/issues/2106)
|
39
39
|
cookieTimezone.value = $dayjs.tz.guess()
|
40
40
|
}
|
41
41
|
}
|
@@ -11,6 +11,5 @@ export const useDateTime = () => {
|
|
11
11
|
: timezoneCookie.value || undefined
|
12
12
|
|
13
13
|
return (dateTime?: string | number | Dayjs | Date | null) =>
|
14
|
-
// @ts-ignore `tz` should be part of `$dayjs` (https://github.com/iamkun/dayjs/issues/2106)
|
15
14
|
$dayjs(dateTime).tz(timezone)
|
16
15
|
}
|
@@ -5,7 +5,7 @@ import type { Ref } from 'vue'
|
|
5
5
|
export const useFireError = () => {
|
6
6
|
const { t } = useI18n()
|
7
7
|
|
8
|
-
return ({ error }: { error: Error }, api?: Ref<
|
8
|
+
return ({ error }: { error: Error }, api?: Ref<{ errors: Error[] }>) => {
|
9
9
|
Swal.fire({
|
10
10
|
icon: 'error',
|
11
11
|
title: t('globalStatusError'),
|
@@ -7,7 +7,7 @@ export const useLoadingDoneIndicator = (id?: string) => {
|
|
7
7
|
if (!loadingId)
|
8
8
|
throw createError({ statusCode: 500, statusMessage: 'Loading id missing!' })
|
9
9
|
|
10
|
-
const loadingIdToAdd = `${
|
10
|
+
const loadingIdToAdd = `${import.meta.server ? 'ssr' : 'csr'}_${loadingId}`
|
11
11
|
|
12
12
|
if (loadingIds.value.includes(loadingIdToAdd)) {
|
13
13
|
throw createError({
|
@@ -18,7 +18,7 @@ export const useLoadingDoneIndicator = (id?: string) => {
|
|
18
18
|
|
19
19
|
const loadingIdSsr = `ssr_${loadingId}`
|
20
20
|
|
21
|
-
if (
|
21
|
+
if (import.meta.client && loadingIds.value.includes(loadingIdSsr)) {
|
22
22
|
loadingIds.value.splice(loadingIds.value.indexOf(loadingIdSsr), 1)
|
23
23
|
}
|
24
24
|
|
package/eslint.config.js
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
// // TODO: add compat plugin when it supports flat config (https://github.com/amilajack/eslint-plugin-compat/issues/603)
|
2
|
+
// import { FlatCompat } from '@eslint/eslintrc'
|
3
|
+
import vueI18n from '@intlify/eslint-plugin-vue-i18n'
|
4
|
+
import prettier from 'eslint-plugin-prettier/recommended'
|
5
|
+
import eslintPluginYml from 'eslint-plugin-yml'
|
6
|
+
import globals from 'globals'
|
7
|
+
import jiti from 'jiti'
|
8
|
+
|
9
|
+
import withNuxt from './.nuxt/eslint.config.mjs'
|
10
|
+
|
11
|
+
const moduleFileUrl = new URL(import.meta.url)
|
12
|
+
// const compat = new FlatCompat({
|
13
|
+
// baseDirectory: moduleFileUrl.pathname,
|
14
|
+
// })
|
15
|
+
const JITI = jiti(moduleFileUrl.pathname)
|
16
|
+
const POLYFILLS = JITI('./utils/constants.ts').POLYFILLS
|
17
|
+
|
18
|
+
export const VIO_ESLINT_CONFIG = [
|
19
|
+
...vueI18n.configs['flat/recommended'],
|
20
|
+
// ...compat.extends('plugin:compat/recommended'),
|
21
|
+
...eslintPluginYml.configs['flat/recommended'],
|
22
|
+
prettier, // must be last
|
23
|
+
|
24
|
+
// {
|
25
|
+
// files: ['server/**/*'],
|
26
|
+
// rules: {
|
27
|
+
// 'compat/compat': 'off',
|
28
|
+
// },
|
29
|
+
// },
|
30
|
+
{
|
31
|
+
languageOptions: {
|
32
|
+
globals: {
|
33
|
+
...globals.node,
|
34
|
+
},
|
35
|
+
},
|
36
|
+
rules: {
|
37
|
+
'@intlify/vue-i18n/no-missing-keys': 'error',
|
38
|
+
'@intlify/vue-i18n/no-raw-text': 'error',
|
39
|
+
'@intlify/vue-i18n/no-deprecated-i18n-component': 'error', // TODO: do not specify below rules manually, but have them included in `recommended` https://github.com/intlify/eslint-plugin-vue-i18n/issues/275
|
40
|
+
'@intlify/vue-i18n/no-deprecated-i18n-place-attr': 'error',
|
41
|
+
'@intlify/vue-i18n/no-deprecated-i18n-places-prop': 'error',
|
42
|
+
'@intlify/vue-i18n/no-i18n-t-path-prop': 'error',
|
43
|
+
'@intlify/vue-i18n/valid-message-syntax': 'error',
|
44
|
+
'@intlify/vue-i18n/key-format-style': 'error',
|
45
|
+
'@intlify/vue-i18n/no-duplicate-keys-in-locale': 'error',
|
46
|
+
'@intlify/vue-i18n/no-dynamic-keys': 'error',
|
47
|
+
'@intlify/vue-i18n/no-missing-keys-in-other-locales': 'error',
|
48
|
+
'@intlify/vue-i18n/no-unknown-locale': 'error',
|
49
|
+
'@intlify/vue-i18n/no-unused-keys': 'error',
|
50
|
+
'@intlify/vue-i18n/prefer-sfc-lang-attr': 'error',
|
51
|
+
'@intlify/vue-i18n/prefer-linked-key-with-paren': 'error',
|
52
|
+
// '@intlify/vue-i18n/sfc-locale-attr': 'error',
|
53
|
+
|
54
|
+
'@typescript-eslint/no-unused-vars': [
|
55
|
+
'error',
|
56
|
+
{
|
57
|
+
argsIgnorePattern: '^_',
|
58
|
+
varsIgnorePattern: '^_',
|
59
|
+
},
|
60
|
+
],
|
61
|
+
'vue/multi-word-component-names': 'off', // TODO: remove (https://github.com/nuxt/eslint/issues/261)
|
62
|
+
'yml/quotes': ['error', { prefer: 'single' }],
|
63
|
+
},
|
64
|
+
settings: {
|
65
|
+
polyfills: POLYFILLS,
|
66
|
+
'vue-i18n': {
|
67
|
+
localeDir: './locales/*.json',
|
68
|
+
messageSyntaxVersion: '^9.0.0',
|
69
|
+
},
|
70
|
+
},
|
71
|
+
},
|
72
|
+
{
|
73
|
+
ignores: ['tests'],
|
74
|
+
},
|
75
|
+
{
|
76
|
+
files: ['locales/**/*'],
|
77
|
+
rules: {
|
78
|
+
'@intlify/vue-i18n/no-unused-keys': 'off',
|
79
|
+
},
|
80
|
+
}, // TODO: remove once `@intlify/eslint-plugin-vue-i18n` accounts for translation usage in composables]
|
81
|
+
]
|
82
|
+
|
83
|
+
export default withNuxt(VIO_ESLINT_CONFIG)
|
package/locales/de.json
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
"globalStatusLoading": "Lade...",
|
6
6
|
"globalValidationFailed": "Bitte überprüfe deine Eingaben 🙈",
|
7
7
|
"globalValidationFormat": "Falsches Format",
|
8
|
-
"globalValidationFormatIncorrect": "Falsches Format",
|
9
8
|
"globalValidationFormatUrlHttps": "Muss mit \"https://\" beginnen",
|
10
9
|
"globalValidationLength": "Zu lang",
|
11
10
|
"globalValidationRequired": "Pflichtfeld",
|
package/locales/en.json
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
"globalStatusLoading": "Loading...",
|
6
6
|
"globalValidationFailed": "Please check your input 🙈",
|
7
7
|
"globalValidationFormat": "Incorrect format",
|
8
|
-
"globalValidationFormatIncorrect": "Incorrect format",
|
9
8
|
"globalValidationFormatUrlHttps": "Must start with \"https://\"",
|
10
9
|
"globalValidationLength": "Too long",
|
11
10
|
"globalValidationRequired": "Required",
|
package/nuxt.config.ts
CHANGED
@@ -39,6 +39,7 @@ export default defineNuxtConfig(
|
|
39
39
|
modules: [
|
40
40
|
'@dargmuesli/nuxt-cookie-control',
|
41
41
|
'@nuxt/devtools',
|
42
|
+
'@nuxt/eslint',
|
42
43
|
'@nuxt/image',
|
43
44
|
'@nuxtjs/color-mode',
|
44
45
|
'@nuxtjs/html-validator',
|
@@ -69,7 +70,7 @@ export default defineNuxtConfig(
|
|
69
70
|
;(
|
70
71
|
nuxtConfigSecurity.headers.contentSecurityPolicy as Record<
|
71
72
|
string,
|
72
|
-
|
73
|
+
unknown
|
73
74
|
>
|
74
75
|
)[key] = [...new Set(valueFiltered)]
|
75
76
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dargmuesli/nuxt-vio",
|
3
|
-
"version": "11.0
|
3
|
+
"version": "11.1.0",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "git+https://github.com/dargmuesli/vio.git"
|
@@ -12,7 +12,7 @@
|
|
12
12
|
"engines": {
|
13
13
|
"node": "20"
|
14
14
|
},
|
15
|
-
"packageManager": "pnpm@8.15.
|
15
|
+
"packageManager": "pnpm@8.15.7",
|
16
16
|
"files": [
|
17
17
|
"assets",
|
18
18
|
"components",
|
@@ -27,6 +27,7 @@
|
|
27
27
|
"utils",
|
28
28
|
"app.config.ts",
|
29
29
|
"error.vue",
|
30
|
+
"eslint.config.js",
|
30
31
|
"i18n.config.ts",
|
31
32
|
"nuxt.config.ts",
|
32
33
|
"playwright.config.ts",
|
@@ -34,54 +35,54 @@
|
|
34
35
|
],
|
35
36
|
"main": "nuxt.config.ts",
|
36
37
|
"dependencies": {
|
37
|
-
"@dargmuesli/nuxt-cookie-control": "8.1.
|
38
|
+
"@dargmuesli/nuxt-cookie-control": "8.1.2",
|
38
39
|
"@heroicons/vue": "2.1.3",
|
39
40
|
"@http-util/status-i18n": "0.8.1",
|
40
41
|
"@nuxt/devtools": "1.1.5",
|
41
|
-
"@nuxt/image": "1.
|
42
|
-
"@nuxtjs/color-mode": "3.
|
43
|
-
"@nuxtjs/html-validator": "1.
|
44
|
-
"@nuxtjs/i18n": "8.
|
42
|
+
"@nuxt/image": "1.5.0",
|
43
|
+
"@nuxtjs/color-mode": "3.4.0",
|
44
|
+
"@nuxtjs/html-validator": "1.7.1",
|
45
|
+
"@nuxtjs/i18n": "8.3.0",
|
45
46
|
"@nuxtjs/seo": "2.0.0-rc.10",
|
46
47
|
"@nuxtjs/tailwindcss": "6.11.4",
|
47
48
|
"@pinia/nuxt": "0.5.1",
|
48
49
|
"@tailwindcss/forms": "0.5.7",
|
49
50
|
"@tailwindcss/typography": "0.5.12",
|
50
51
|
"@types/lodash-es": "4.17.12",
|
51
|
-
"@urql/core": "
|
52
|
+
"@urql/core": "5.0.0",
|
52
53
|
"@vuelidate/core": "2.0.3",
|
53
54
|
"@vuelidate/validators": "2.0.4",
|
54
55
|
"clipboardy": "4.0.0",
|
55
56
|
"dayjs": "2.0.0-alpha.4",
|
56
|
-
"jose": "5.2.
|
57
|
+
"jose": "5.2.4",
|
57
58
|
"nuxt-gtag": "2.0.5",
|
58
|
-
"nuxt-security": "1.
|
59
|
+
"nuxt-security": "1.3.2",
|
59
60
|
"sweetalert2": "11.10.7"
|
60
61
|
},
|
61
62
|
"devDependencies": {
|
62
|
-
"@axe-core/playwright": "4.
|
63
|
-
"@intlify/eslint-plugin-vue-i18n": "3.0.0-next.
|
64
|
-
"@
|
65
|
-
"@playwright/test": "1.
|
66
|
-
"@unhead/vue": "1.9.
|
63
|
+
"@axe-core/playwright": "4.9.0",
|
64
|
+
"@intlify/eslint-plugin-vue-i18n": "3.0.0-next.11",
|
65
|
+
"@nuxt/eslint": "0.3.7",
|
66
|
+
"@playwright/test": "1.43.1",
|
67
|
+
"@unhead/vue": "1.9.5",
|
67
68
|
"@urql/devtools": "2.0.3",
|
68
|
-
"@urql/exchange-graphcache": "
|
69
|
-
"@urql/vue": "1.1.
|
69
|
+
"@urql/exchange-graphcache": "7.0.1",
|
70
|
+
"@urql/vue": "1.1.3",
|
70
71
|
"consola": "3.2.3",
|
71
|
-
"cookie-es": "1.
|
72
|
+
"cookie-es": "1.1.0",
|
72
73
|
"cross-env": "7.0.3",
|
73
74
|
"defu": "6.1.4",
|
74
|
-
"eslint": "
|
75
|
+
"eslint": "9.0.0",
|
75
76
|
"eslint-config-prettier": "9.1.0",
|
76
77
|
"eslint-plugin-compat": "4.2.0",
|
77
|
-
"eslint-plugin-nuxt": "4.0.0",
|
78
78
|
"eslint-plugin-prettier": "5.1.3",
|
79
|
-
"eslint-plugin-yml": "1.
|
79
|
+
"eslint-plugin-yml": "1.14.0",
|
80
|
+
"globals": "15.0.0",
|
80
81
|
"h3": "1.11.1",
|
81
82
|
"jiti": "1.21.0",
|
82
83
|
"lint-staged": "15.2.2",
|
83
84
|
"lodash-es": "4.17.21",
|
84
|
-
"nuxt": "3.11.
|
85
|
+
"nuxt": "3.11.2",
|
85
86
|
"pinia": "2.1.7",
|
86
87
|
"prettier": "3.2.5",
|
87
88
|
"prettier-plugin-tailwindcss": "0.5.13",
|
@@ -92,15 +93,15 @@
|
|
92
93
|
"stylelint-no-unsupported-browser-features": "8.0.1",
|
93
94
|
"tailwindcss": "3.4.3",
|
94
95
|
"ufo": "1.5.3",
|
95
|
-
"unhead": "1.9.
|
96
|
-
"vue": "3.4.
|
96
|
+
"unhead": "1.9.5",
|
97
|
+
"vue": "3.4.22",
|
97
98
|
"vue-router": "4.3.0",
|
98
|
-
"vue-tsc": "2.0.
|
99
|
+
"vue-tsc": "2.0.13"
|
99
100
|
},
|
100
101
|
"peerDependencies": {
|
101
|
-
"nuxt": "3.11.
|
102
|
-
"playwright-core": "1.
|
103
|
-
"vue": "3.4.
|
102
|
+
"nuxt": "3.11.2",
|
103
|
+
"playwright-core": "1.43.1",
|
104
|
+
"vue": "3.4.22",
|
104
105
|
"vue-router": "4.3.0"
|
105
106
|
},
|
106
107
|
"scripts": {
|
@@ -111,12 +112,12 @@
|
|
111
112
|
"dev": "pnpm run start:dev",
|
112
113
|
"generate": "pnpm run build:static",
|
113
114
|
"lint:fix": "pnpm run lint:js --fix && pnpm run lint:ts --fix && pnpm run lint:style --fix",
|
114
|
-
"lint:js": "eslint --cache
|
115
|
+
"lint:js": "eslint --cache .",
|
115
116
|
"lint:staged": "lint-staged",
|
116
117
|
"lint:style": "stylelint --cache \"**/*.{vue,css}\" --ignore-path .gitignore",
|
117
118
|
"lint:ts": "nuxt typecheck",
|
118
119
|
"lint": "pnpm run lint:js && pnpm run lint:ts && pnpm run lint:style",
|
119
|
-
"prepare": "nuxt prepare .playground",
|
120
|
+
"prepare": "nuxt prepare && nuxt prepare .playground",
|
120
121
|
"preview": "nuxt preview .playground",
|
121
122
|
"start:dev": "nuxt dev .playground",
|
122
123
|
"start:node": "node .playground/.output/server/index.mjs",
|
package/types/api.d.ts
CHANGED
package/types/modules/gql.d.ts
CHANGED
package/utils/auth.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IncomingMessage, ServerResponse } from 'node:http'
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http'
|
2
2
|
|
3
3
|
import { consola } from 'consola'
|
4
4
|
import { parse, serialize } from 'cookie-es'
|
@@ -37,7 +37,7 @@ export const jwtStore = async ({
|
|
37
37
|
res,
|
38
38
|
jwt,
|
39
39
|
}: {
|
40
|
-
$urqlReset:
|
40
|
+
$urqlReset: () => void
|
41
41
|
store: Store
|
42
42
|
res?: ServerResponse
|
43
43
|
jwt?: string
|
@@ -47,7 +47,7 @@ export const jwtStore = async ({
|
|
47
47
|
consola.trace('Storing the following JWT: ' + jwt)
|
48
48
|
;(store as unknown as { jwtSet: (jwtNew?: string) => void }).jwtSet(jwt)
|
49
49
|
|
50
|
-
if (
|
50
|
+
if (import.meta.server) {
|
51
51
|
res?.setHeader(
|
52
52
|
'Set-Cookie',
|
53
53
|
serialize(JWT_NAME(), jwt || '', {
|
@@ -64,7 +64,7 @@ export const jwtStore = async ({
|
|
64
64
|
method: 'POST',
|
65
65
|
...(jwt ? { headers: { Authorization: `Bearer ${jwt}` } } : {}),
|
66
66
|
})
|
67
|
-
} catch (error:
|
67
|
+
} catch (error: unknown) {
|
68
68
|
return Promise.reject(Error('Authentication api call failed.'))
|
69
69
|
}
|
70
70
|
}
|
@@ -74,13 +74,10 @@ export const useJwtStore = () => {
|
|
74
74
|
const { $urqlReset, ssrContext } = useNuxtApp()
|
75
75
|
const store = useVioAuthStore()
|
76
76
|
|
77
|
-
if (typeof $urqlReset !== 'function')
|
78
|
-
throw new Error('`$urqlReset` is not a function!')
|
79
|
-
|
80
77
|
return {
|
81
78
|
async jwtStore(jwt?: string) {
|
82
79
|
await jwtStore({
|
83
|
-
$urqlReset,
|
80
|
+
$urqlReset: $urqlReset as () => void,
|
84
81
|
store,
|
85
82
|
res: ssrContext ? ssrContext.event.node.res : undefined,
|
86
83
|
jwt,
|
@@ -94,7 +91,7 @@ export const signOut = async ({
|
|
94
91
|
store,
|
95
92
|
res,
|
96
93
|
}: {
|
97
|
-
$urqlReset:
|
94
|
+
$urqlReset: () => void
|
98
95
|
store: Store
|
99
96
|
res?: ServerResponse
|
100
97
|
}) => await jwtStore({ $urqlReset, store, res })
|
@@ -109,7 +106,7 @@ export const useSignOut = () => {
|
|
109
106
|
return {
|
110
107
|
async signOut() {
|
111
108
|
await signOut({
|
112
|
-
$urqlReset,
|
109
|
+
$urqlReset: $urqlReset as () => void,
|
113
110
|
store,
|
114
111
|
res: ssrContext ? ssrContext.event.node.res : undefined,
|
115
112
|
})
|
package/utils/networking.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { CombinedError } from '@urql/core'
|
2
|
-
import { H3Event, getCookie } from 'h3'
|
1
|
+
import type { CombinedError } from '@urql/core'
|
2
|
+
import { type H3Event, getCookie } from 'h3'
|
3
3
|
|
4
4
|
import { type Ref } from 'vue'
|
5
5
|
|
@@ -103,7 +103,7 @@ export const getServiceHref = ({
|
|
103
103
|
|
104
104
|
if (stagingHost) {
|
105
105
|
return `https://${nameSubdomainString}${stagingHost}`
|
106
|
-
} else if (isSsr &&
|
106
|
+
} else if (isSsr && import.meta.server) {
|
107
107
|
return `http://${name}${portString}`
|
108
108
|
} else {
|
109
109
|
return `https://${nameSubdomainString}${getDomainTldPort(host)}`
|