@dargmuesli/nuxt-vio 3.3.1 → 3.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/components/vio/_/VioApp.vue +2 -11
- package/components/vio/layout/VioLayout.vue +11 -0
- package/composables/useAppLayout.ts +18 -14
- package/composables/useDateTime.ts +2 -3
- package/composables/useHost.ts +3 -3
- package/composables/usePolyfills.ts +5 -2
- package/package.json +22 -23
- package/utils/auth.ts +4 -6
- package/utils/constants.ts +1 -0
- package/utils/networking.ts +5 -5
- package/plugins/marked.ts +0 -9
@@ -2,18 +2,12 @@
|
|
2
2
|
<div :data-is-loading="isLoading" data-testid="is-loading">
|
3
3
|
<NuxtLayout>
|
4
4
|
<!-- `NuxtLayout` can't have mulitple child nodes (https://github.com/nuxt/nuxt/issues/21759) -->
|
5
|
-
<
|
6
|
-
<NuxtPage :site-description="siteDescriptionProp" />
|
7
|
-
<CookieControl :locale="locale" />
|
8
|
-
</div>
|
5
|
+
<NuxtPage :site-description="siteDescriptionProp" />
|
9
6
|
</NuxtLayout>
|
10
7
|
</div>
|
11
8
|
</template>
|
12
9
|
|
13
10
|
<script setup lang="ts">
|
14
|
-
import type { Locale } from '@dargmuesli/nuxt-cookie-control/dist/runtime/types'
|
15
|
-
import type { WritableComputedRef } from 'vue'
|
16
|
-
|
17
11
|
export interface Props {
|
18
12
|
ogImageAlt: string
|
19
13
|
ogImageComponent?: string
|
@@ -27,15 +21,12 @@ const ogImageComponentProp = toRef(() => props.ogImageComponent)
|
|
27
21
|
const siteDescriptionProp = toRef(() => props.siteDescription)
|
28
22
|
|
29
23
|
const { $dayjs } = useNuxtApp()
|
30
|
-
const
|
24
|
+
const { locale } = useI18n()
|
31
25
|
const cookieControl = useCookieControl()
|
32
26
|
const siteConfig = useSiteConfig()
|
33
27
|
|
34
28
|
const { loadingIds, indicateLoadingDone } = useLoadingDoneIndicator('app')
|
35
29
|
|
36
|
-
// data
|
37
|
-
const locale = i18n.locale as WritableComputedRef<Locale>
|
38
|
-
|
39
30
|
// methods
|
40
31
|
const init = () => {
|
41
32
|
$dayjs.locale(locale.value)
|
@@ -3,5 +3,16 @@
|
|
3
3
|
<main>
|
4
4
|
<slot />
|
5
5
|
</main>
|
6
|
+
<CookieControl :locale="locale" />
|
6
7
|
</div>
|
7
8
|
</template>
|
9
|
+
|
10
|
+
<script setup lang="ts">
|
11
|
+
import type { Locale } from '@dargmuesli/nuxt-cookie-control/dist/runtime/types'
|
12
|
+
import type { WritableComputedRef } from 'vue'
|
13
|
+
|
14
|
+
const i18n = useI18n()
|
15
|
+
|
16
|
+
// data
|
17
|
+
const locale = i18n.locale as WritableComputedRef<Locale>
|
18
|
+
</script>
|
@@ -2,26 +2,30 @@ export const useAppLayout = () => {
|
|
2
2
|
const appConfig = useAppConfig()
|
3
3
|
const siteConfig = useSiteConfig()
|
4
4
|
|
5
|
-
|
5
|
+
useServerHeadSafe({
|
6
6
|
...useLocaleHead({ addSeoAttributes: true }).value,
|
7
7
|
bodyAttrs: {
|
8
8
|
class:
|
9
9
|
'bg-background-bright dark:bg-background-dark font-sans text-text-dark dark:text-text-bright',
|
10
10
|
},
|
11
|
-
})
|
11
|
+
})
|
12
12
|
|
13
|
+
// TODO: convert to `useServerHeadSafe` (https://github.com/harlan-zw/nuxt-seo-kit/issues/98)
|
13
14
|
useServerSeoMeta({
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
}
|
19
|
-
: {}),
|
20
|
-
titleTemplate: (titleChunk) => {
|
21
|
-
return titleChunk && titleChunk !== siteConfig.name
|
22
|
-
? `${titleChunk} ${siteConfig.titleSeparator} ${siteConfig.name}`
|
23
|
-
: siteConfig.name
|
24
|
-
},
|
25
|
-
...(appConfig.vio.seoMeta ? appConfig.vio.seoMeta : {}),
|
15
|
+
titleTemplate: (title) =>
|
16
|
+
title && title !== siteConfig.name
|
17
|
+
? `${title} ${siteConfig.titleSeparator} ${siteConfig.name}`
|
18
|
+
: siteConfig.name,
|
26
19
|
})
|
20
|
+
|
21
|
+
if (appConfig.vio.seoMeta) {
|
22
|
+
useServerSeoMeta(appConfig.vio.seoMeta)
|
23
|
+
}
|
24
|
+
|
25
|
+
if (appConfig.vio.themeColor) {
|
26
|
+
useServerSeoMeta({
|
27
|
+
msapplicationTileColor: appConfig.vio.themeColor,
|
28
|
+
themeColor: appConfig.vio.themeColor,
|
29
|
+
})
|
30
|
+
}
|
27
31
|
}
|
@@ -1,11 +1,10 @@
|
|
1
1
|
import { Dayjs } from 'dayjs'
|
2
2
|
|
3
3
|
export const useDateTime = () => {
|
4
|
-
const
|
5
|
-
const { $dayjs } = useNuxtApp()
|
4
|
+
const { $dayjs, ssrContext } = useNuxtApp()
|
6
5
|
const timezoneCookie = useCookie(TIMEZONE_COOKIE_NAME)
|
7
6
|
|
8
|
-
const timezoneHeader = event
|
7
|
+
const timezoneHeader = ssrContext?.event.node.req.headers[TIMEZONE_HEADER_KEY]
|
9
8
|
const timezone =
|
10
9
|
timezoneHeader && !Array.isArray(timezoneHeader)
|
11
10
|
? timezoneHeader
|
package/composables/useHost.ts
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
import { POLYFILLS } from '../utils/constants'
|
2
|
+
|
1
3
|
export const usePolyfills = () => {
|
2
|
-
const polyfills =
|
3
|
-
'
|
4
|
+
const polyfills = `https://polyfill.io/v3/polyfill.min.js?features=${POLYFILLS.join(
|
5
|
+
'%2C',
|
6
|
+
)}&flags=gated`
|
4
7
|
|
5
8
|
useServerHead({
|
6
9
|
link: [
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dargmuesli/nuxt-vio",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.5.0",
|
4
4
|
"type": "module",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
@@ -8,7 +8,7 @@
|
|
8
8
|
"engines": {
|
9
9
|
"node": "20"
|
10
10
|
},
|
11
|
-
"packageManager": "pnpm@8.7.
|
11
|
+
"packageManager": "pnpm@8.7.4",
|
12
12
|
"files": [
|
13
13
|
"assets",
|
14
14
|
"components",
|
@@ -41,36 +41,36 @@
|
|
41
41
|
"prepare": "nuxt prepare .playground",
|
42
42
|
"preview": "nuxt preview .playground",
|
43
43
|
"start": "PORT=3001 node .playground/.output/server/index.mjs",
|
44
|
-
"test:e2e": "
|
45
|
-
"test:e2e:dev": "cross-env NUXT_PUBLIC_IS_TESTING=1 WAIT_ON_TIMEOUT=100000 pnpm test:e2e",
|
46
|
-
"test:e2e:prod": "cross-env NUXT_PUBLIC_IS_TESTING=1 WAIT_ON_TIMEOUT=10000 NODE_ENV=production pnpm test:e2e",
|
47
|
-
"test:e2e:docker:build": "docker build -t test-e2e_base --build-arg UID=$(id -u) --build-arg GID=$(id -g) --target test-e2e_base ..",
|
48
|
-
"test:e2e:docker:run": "docker run --rm -v \"$PWD/..:/srv/app\" -v \"$(pnpm store path):/srv/.pnpm-store\" test-e2e_base",
|
44
|
+
"test:e2e:dev": "cross-env NUXT_PUBLIC_IS_TESTING=1 pnpm test:e2e",
|
49
45
|
"test:e2e:docker:br": "pnpm test:e2e:docker:build && pnpm test:e2e:docker:run",
|
50
|
-
"test:e2e:docker:
|
46
|
+
"test:e2e:docker:build": "docker build -t test-e2e_base --build-arg UID=$(id -u) --build-arg GID=$(id -g) --target test-e2e_base ..",
|
51
47
|
"test:e2e:docker:dev:update": "pnpm test:e2e:docker:dev --update-snapshots",
|
48
|
+
"test:e2e:docker:dev": "pnpm test:e2e:docker:br pnpm --dir src run test:e2e:dev",
|
49
|
+
"test:e2e:docker:prod:update": "pnpm test:e2e:docker:prod --update-snapshots",
|
52
50
|
"test:e2e:docker:prod": "pnpm test:e2e:docker:br pnpm --dir src run test:e2e:prod",
|
53
|
-
"test:e2e:docker:
|
51
|
+
"test:e2e:docker:run": "docker run --rm -v \"$PWD/..:/srv/app\" -v \"$(pnpm store path):/srv/.pnpm-store\" test-e2e_base",
|
52
|
+
"test:e2e:prod": "cross-env NUXT_PUBLIC_IS_TESTING=1 NODE_ENV=production pnpm test:e2e",
|
53
|
+
"test:e2e": "playwright test"
|
54
54
|
},
|
55
55
|
"dependencies": {
|
56
56
|
"@axe-core/playwright": "4.7.3",
|
57
|
-
"@dargmuesli/nuxt-cookie-control": "6.4.
|
57
|
+
"@dargmuesli/nuxt-cookie-control": "6.4.2",
|
58
58
|
"@http-util/status-i18n": "0.8.1",
|
59
59
|
"@nuxt/image": "1.0.0-rc.1",
|
60
60
|
"@nuxtjs/color-mode": "3.3.0",
|
61
61
|
"@nuxtjs/html-validator": "1.5.2",
|
62
|
-
"@nuxtjs/i18n": "8.0.0-rc.
|
62
|
+
"@nuxtjs/i18n": "8.0.0-rc.4",
|
63
63
|
"@nuxtjs/tailwindcss": "6.8.0",
|
64
|
-
"@nuxtseo/module": "2.0.0-beta.
|
64
|
+
"@nuxtseo/module": "2.0.0-beta.26",
|
65
65
|
"@pinia/nuxt": "0.4.11",
|
66
66
|
"@playwright/test": "1.37.1",
|
67
67
|
"@tailwindcss/forms": "0.5.6",
|
68
|
-
"@tailwindcss/typography": "0.5.
|
69
|
-
"@types/cookie": "0.5.
|
70
|
-
"@types/lodash-es": "4.17.
|
71
|
-
"@urql/core": "4.1.
|
68
|
+
"@tailwindcss/typography": "0.5.10",
|
69
|
+
"@types/cookie": "0.5.2",
|
70
|
+
"@types/lodash-es": "4.17.9",
|
71
|
+
"@urql/core": "4.1.2",
|
72
72
|
"@urql/devtools": "2.0.3",
|
73
|
-
"@urql/exchange-graphcache": "6.3.
|
73
|
+
"@urql/exchange-graphcache": "6.3.3",
|
74
74
|
"@urql/vue": "1.1.2",
|
75
75
|
"@vuelidate/core": "2.0.3",
|
76
76
|
"@vuelidate/validators": "2.0.4",
|
@@ -78,18 +78,17 @@
|
|
78
78
|
"cookie": "0.5.0",
|
79
79
|
"dayjs": "2.0.0-alpha.4",
|
80
80
|
"is-https": "4.0.0",
|
81
|
-
"
|
81
|
+
"jiti": "1.19.3",
|
82
|
+
"jose": "4.14.6",
|
82
83
|
"lodash-es": "4.17.21",
|
83
|
-
"marked": "7.0.5",
|
84
84
|
"pinia": "2.1.6",
|
85
85
|
"sweetalert2": "11.7.27",
|
86
86
|
"vue-gtag": "2.0.1",
|
87
|
-
"vue-tsc": "1.8.
|
87
|
+
"vue-tsc": "1.8.10"
|
88
88
|
},
|
89
89
|
"devDependencies": {
|
90
90
|
"@intlify/eslint-plugin-vue-i18n": "3.0.0-next.3",
|
91
91
|
"@nuxtjs/eslint-config-typescript": "12.1.0",
|
92
|
-
"@types/marked": "5.0.1",
|
93
92
|
"cross-env": "7.0.3",
|
94
93
|
"eslint": "8.48.0",
|
95
94
|
"eslint-config-prettier": "9.0.0",
|
@@ -98,9 +97,9 @@
|
|
98
97
|
"eslint-plugin-prettier": "5.0.0",
|
99
98
|
"eslint-plugin-yml": "1.8.0",
|
100
99
|
"lint-staged": "14.0.1",
|
101
|
-
"nuxt": "3.7.
|
100
|
+
"nuxt": "3.7.1",
|
102
101
|
"prettier": "3.0.3",
|
103
|
-
"prettier-plugin-tailwindcss": "0.5.
|
102
|
+
"prettier-plugin-tailwindcss": "0.5.4",
|
104
103
|
"stylelint": "15.10.3",
|
105
104
|
"stylelint-config-recommended-vue": "1.5.0",
|
106
105
|
"stylelint-config-standard": "34.0.0",
|
package/utils/auth.ts
CHANGED
@@ -69,9 +69,8 @@ export const jwtStore = async ({
|
|
69
69
|
}
|
70
70
|
|
71
71
|
export const useJwtStore = () => {
|
72
|
-
const { $urqlReset } = useNuxtApp()
|
72
|
+
const { $urqlReset, ssrContext } = useNuxtApp()
|
73
73
|
const store = useVioAuthStore()
|
74
|
-
const event = useRequestEvent()
|
75
74
|
|
76
75
|
if (typeof $urqlReset !== 'function')
|
77
76
|
throw new Error('`$urqlReset` is not a function!')
|
@@ -81,7 +80,7 @@ export const useJwtStore = () => {
|
|
81
80
|
await jwtStore({
|
82
81
|
$urqlReset,
|
83
82
|
store,
|
84
|
-
res:
|
83
|
+
res: ssrContext ? ssrContext.event.node.res : undefined,
|
85
84
|
jwt,
|
86
85
|
})
|
87
86
|
},
|
@@ -99,9 +98,8 @@ export const signOut = async ({
|
|
99
98
|
}) => await jwtStore({ $urqlReset, store, res })
|
100
99
|
|
101
100
|
export const useSignOut = () => {
|
102
|
-
const { $urqlReset } = useNuxtApp()
|
101
|
+
const { $urqlReset, ssrContext } = useNuxtApp()
|
103
102
|
const store = useVioAuthStore()
|
104
|
-
const event = useRequestEvent()
|
105
103
|
|
106
104
|
if (typeof $urqlReset !== 'function')
|
107
105
|
throw new Error('`$urqlReset` is not a function!')
|
@@ -111,7 +109,7 @@ export const useSignOut = () => {
|
|
111
109
|
await signOut({
|
112
110
|
$urqlReset,
|
113
111
|
store,
|
114
|
-
res:
|
112
|
+
res: ssrContext ? ssrContext.event.node.res : undefined,
|
115
113
|
})
|
116
114
|
},
|
117
115
|
}
|
package/utils/constants.ts
CHANGED
@@ -40,6 +40,7 @@ export const I18N_VUE_CONFIG = {
|
|
40
40
|
}
|
41
41
|
export const JWT_NAME = () =>
|
42
42
|
`${process.env.NODE_ENV === 'production' ? '__Secure-' : ''}jwt`
|
43
|
+
export const POLYFILLS = ['Promise']
|
43
44
|
export const REGEX_UUID =
|
44
45
|
/^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/
|
45
46
|
export const TIMEZONE_COOKIE_NAME = [COOKIE_PREFIX, 'tz'].join(COOKIE_SEPARATOR)
|
package/utils/networking.ts
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
import { IncomingMessage } from 'node:http'
|
2
|
-
|
3
1
|
import { CombinedError } from '@urql/core'
|
4
2
|
import { H3Event, getCookie } from 'h3'
|
5
3
|
|
@@ -79,10 +77,12 @@ export const getDomainTldPort = (host: string) => {
|
|
79
77
|
return `${hostParts[hostParts.length - 2]}.${hostParts[hostParts.length - 1]}`
|
80
78
|
}
|
81
79
|
|
82
|
-
export const getHost = (
|
83
|
-
|
80
|
+
export const getHost = (event: H3Event) => {
|
81
|
+
const host = event.node.req.headers.host
|
82
|
+
|
83
|
+
if (!host) throw new Error('Host header is not given!')
|
84
84
|
|
85
|
-
return
|
85
|
+
return host
|
86
86
|
}
|
87
87
|
|
88
88
|
export const getServiceHref = ({
|