@dargmuesli/nuxt-vio 23.1.9 → 24.0.0-beta.1
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/app/components/vio/form/VioForm.vue +2 -0
- package/app/components/vio/loader/VioLoader.vue +2 -0
- package/app/composables/head.ts +2 -2
- package/app/composables/networking.ts +1 -2
- package/node/networking.ts +3 -11
- package/node/static/index.ts +3 -3
- package/node/static/nuxt.ts +3 -3
- package/nuxt.config.ts +5 -9
- package/package.json +17 -17
- package/server/middleware/dateTime.ts +4 -8
- package/server/middleware/sentry.ts +5 -5
- package/server/plugins/nodemailer.ts +3 -12
- package/server/plugins/security.ts +4 -0
- package/server/utils/dateTime.ts +9 -9
- package/server/utils/networking.ts +14 -5
- package/server/utils/site.ts +2 -0
- package/server/utils/testing.ts +8 -17
- package/shared/utils/constants.ts +1 -1
- package/shared/utils/networking.ts +1 -1
package/app/composables/head.ts
CHANGED
|
@@ -61,7 +61,7 @@ export const useAppLayout = () => {
|
|
|
61
61
|
useSeoMeta({
|
|
62
62
|
titleTemplate: (title) =>
|
|
63
63
|
TITLE_TEMPLATE({
|
|
64
|
-
siteName: siteConfig.name,
|
|
64
|
+
siteName: siteConfig.name || '',
|
|
65
65
|
title,
|
|
66
66
|
}),
|
|
67
67
|
})
|
|
@@ -78,7 +78,7 @@ export const useHeadDefault = (
|
|
|
78
78
|
const description =
|
|
79
79
|
toValue(input.description) || (siteConfig.description as string)
|
|
80
80
|
const title = TITLE_TEMPLATE({
|
|
81
|
-
siteName: siteConfig.name,
|
|
81
|
+
siteName: siteConfig.name || '',
|
|
82
82
|
title: toValue(input.title)?.toString() || undefined,
|
|
83
83
|
})
|
|
84
84
|
|
|
@@ -25,8 +25,7 @@ export const useGetServiceHref = () => {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const useHost = () => {
|
|
28
|
-
const
|
|
29
|
-
const host = ssrContext ? getHost(ssrContext.event) : location.host
|
|
28
|
+
const host = useRequestURL().host
|
|
30
29
|
|
|
31
30
|
if (!host) throw new Error('Host is not given!')
|
|
32
31
|
|
package/node/networking.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { SERVICES } from './services'
|
|
2
|
-
import type { Service, ServiceName } from './services'
|
|
3
|
-
import { SITE_URL_TYPED } from './static'
|
|
4
|
-
|
|
5
|
-
export const getHost = (event: { headers: Headers }) => {
|
|
6
|
-
const host = event.headers.get('host')
|
|
7
|
-
|
|
8
|
-
if (!host) throw new Error('Host header is not given!')
|
|
9
|
-
|
|
10
|
-
return host
|
|
11
|
-
}
|
|
1
|
+
import { SERVICES } from './services.ts'
|
|
2
|
+
import type { Service, ServiceName } from './services.ts'
|
|
3
|
+
import { SITE_URL_TYPED } from './static/index.ts'
|
|
12
4
|
|
|
13
5
|
// derives the origins this project itself talks to, so Sentry's trace context is only propagated
|
|
14
6
|
// to its own services and never to third parties
|
package/node/static/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './environment'
|
|
2
|
-
export * from './nuxt'
|
|
3
|
-
export * from './sentry'
|
|
1
|
+
export * from './environment.ts'
|
|
2
|
+
export * from './nuxt.ts'
|
|
3
|
+
export * from './sentry.ts'
|
package/node/static/nuxt.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { defineNuxtConfig } from 'nuxt/config'
|
|
2
2
|
|
|
3
|
-
import type { Service } from '../services'
|
|
4
|
-
import { SERVICES } from '../services'
|
|
5
|
-
import { IS_IN_FRONTEND_DEVELOPMENT } from './'
|
|
3
|
+
import type { Service } from '../services.ts'
|
|
4
|
+
import { SERVICES } from '../services.ts'
|
|
5
|
+
import { IS_IN_FRONTEND_DEVELOPMENT } from './environment.ts'
|
|
6
6
|
|
|
7
7
|
export const VIO_NUXT_BASE_CONFIG = ({
|
|
8
8
|
services,
|
package/nuxt.config.ts
CHANGED
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
NUXT_PUBLIC_SENTRY_RELEASE,
|
|
13
13
|
SITE_URL,
|
|
14
14
|
VIO_NUXT_BASE_CONFIG,
|
|
15
|
-
} from './node/static'
|
|
15
|
+
} from './node/static/index.ts'
|
|
16
16
|
import {
|
|
17
17
|
GTAG_COOKIE_ID,
|
|
18
18
|
TIMEZONE_COOKIE_NAME,
|
|
19
19
|
VIO_GET_CSP,
|
|
20
20
|
VIO_SITE_NAME,
|
|
21
|
-
} from './shared/utils/constants'
|
|
21
|
+
} from './shared/utils/constants.ts'
|
|
22
22
|
|
|
23
23
|
const { resolve } = createResolver(import.meta.url)
|
|
24
24
|
// mirrors the suffix `mkcert.sh` and the node and static test servers use for the local certificates
|
|
@@ -67,13 +67,12 @@ export default defineNuxtConfig(
|
|
|
67
67
|
},
|
|
68
68
|
experimental: {
|
|
69
69
|
early404: true,
|
|
70
|
-
inlineErrorRendering: true,
|
|
71
70
|
prefetchPreloadTags: true,
|
|
72
71
|
prerenderErrorPages: true,
|
|
73
|
-
routeTypedFetch: true,
|
|
74
72
|
strictRouteTypes: true,
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
},
|
|
74
|
+
future: {
|
|
75
|
+
compatibilityVersion: 5,
|
|
77
76
|
},
|
|
78
77
|
hooks: {
|
|
79
78
|
// consumers' generated tsconfigs exclude `node_modules`, so this layer's type augmentations need explicit references
|
|
@@ -150,9 +149,6 @@ export default defineNuxtConfig(
|
|
|
150
149
|
],
|
|
151
150
|
nitro: {
|
|
152
151
|
compressPublicAssets: true,
|
|
153
|
-
experimental: {
|
|
154
|
-
asyncContext: true,
|
|
155
|
-
},
|
|
156
152
|
},
|
|
157
153
|
routeRules: {
|
|
158
154
|
'/**': {
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@dargmuesli/nuxt-cookie-control": "10.0.
|
|
3
|
+
"@dargmuesli/nuxt-cookie-control": "10.0.1",
|
|
4
4
|
"@eslint/compat": "2.1.1",
|
|
5
5
|
"@heroicons/vue": "2.2.0",
|
|
6
6
|
"@http-util/status-i18n": "0.9.1",
|
|
7
7
|
"@intlify/eslint-plugin-vue-i18n": "4.5.1",
|
|
8
|
-
"@lucide/vue": "1.
|
|
9
|
-
"@nuxt/devtools": "4.
|
|
8
|
+
"@lucide/vue": "1.77.0",
|
|
9
|
+
"@nuxt/devtools": "4.2.0",
|
|
10
10
|
"@nuxt/eslint": "1.17.0",
|
|
11
11
|
"@nuxt/image": "2.2.1",
|
|
12
12
|
"@nuxtjs/color-mode": "4.1.0",
|
|
13
13
|
"@nuxtjs/html-validator": "2.1.0",
|
|
14
|
-
"@nuxtjs/i18n": "10.
|
|
14
|
+
"@nuxtjs/i18n": "10.7.0",
|
|
15
15
|
"@nuxtjs/seo": "6.0.1",
|
|
16
16
|
"@nuxtjs/turnstile": "1.1.3",
|
|
17
17
|
"@pinia/nuxt": "1.0.3",
|
|
18
|
-
"@sentry/nuxt": "11.
|
|
19
|
-
"@sentry/profiling-node": "11.
|
|
18
|
+
"@sentry/nuxt": "11.16.0",
|
|
19
|
+
"@sentry/profiling-node": "11.16.0",
|
|
20
20
|
"@tailwindcss/forms": "0.5.11",
|
|
21
21
|
"@tailwindcss/typography": "0.5.20",
|
|
22
22
|
"@tailwindcss/vite": "4.3.5",
|
|
23
|
-
"@takumi-rs/core": "2.
|
|
23
|
+
"@takumi-rs/core": "2.22.1",
|
|
24
24
|
"@types/lodash-es": "4.17.12",
|
|
25
25
|
"@types/nodemailer": "8.0.2",
|
|
26
26
|
"@urql/core": "6.0.3",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"eslint-plugin-yml": "3.10.0",
|
|
38
38
|
"globals": "17.14.0",
|
|
39
39
|
"jiti": "2.7.0",
|
|
40
|
-
"jose": "6.2.
|
|
41
|
-
"nodemailer": "10.
|
|
40
|
+
"jose": "6.2.18",
|
|
41
|
+
"nodemailer": "10.6.1",
|
|
42
42
|
"nuxt-gtag": "5.1.0",
|
|
43
43
|
"nuxt-security": "2.7.0",
|
|
44
44
|
"reka-ui": "2.11.0",
|
|
45
45
|
"shadcn-nuxt": "2.9.0",
|
|
46
|
-
"tailwind-merge": "3.7.
|
|
46
|
+
"tailwind-merge": "3.7.1",
|
|
47
47
|
"tw-animate-css": "1.4.0",
|
|
48
48
|
"typescript": "6.0.3",
|
|
49
49
|
"vue-sonner": "2.0.9",
|
|
@@ -58,21 +58,21 @@
|
|
|
58
58
|
"defu": "6.1.7",
|
|
59
59
|
"lodash-es": "4.18.1",
|
|
60
60
|
"nuxt": "4.6.4",
|
|
61
|
-
"nuxtseo-devtools-host": "1.0.
|
|
61
|
+
"nuxtseo-devtools-host": "1.0.3",
|
|
62
62
|
"pinia": "4.1.0",
|
|
63
|
-
"postcss-html": "2.0.
|
|
63
|
+
"postcss-html": "2.0.1",
|
|
64
64
|
"prettier": "3.10.1",
|
|
65
65
|
"prettier-plugin-tailwindcss": "0.8.1",
|
|
66
66
|
"serve": "14.2.8",
|
|
67
67
|
"sharp": "0.35.5",
|
|
68
|
-
"stylelint": "18.
|
|
68
|
+
"stylelint": "18.1.0",
|
|
69
69
|
"stylelint-config-html": "2.0.0",
|
|
70
|
-
"stylelint-config-recommended": "19.
|
|
70
|
+
"stylelint-config-recommended": "19.1.0",
|
|
71
71
|
"stylelint-config-recommended-vue": "2.0.0",
|
|
72
|
-
"stylelint-config-standard": "41.
|
|
72
|
+
"stylelint-config-standard": "41.1.0",
|
|
73
73
|
"stylelint-no-unsupported-browser-features": "8.1.2",
|
|
74
74
|
"tailwindcss": "4.3.5",
|
|
75
|
-
"vue": "3.5.
|
|
75
|
+
"vue": "3.5.46",
|
|
76
76
|
"vue-router": "5.5.1"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"url": "git+https://github.com/dargmuesli/vio.git"
|
|
106
106
|
},
|
|
107
107
|
"type": "module",
|
|
108
|
-
"version": "
|
|
108
|
+
"version": "24.0.0-beta.1",
|
|
109
109
|
"scripts": {
|
|
110
110
|
"build": "pnpm run build:node",
|
|
111
111
|
"build:node": "NUXT_PUBLIC_I18N_BASE_URL=https://app.localhost:3001 nuxt build playground",
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { defineEventHandler } from 'nuxt/server'
|
|
2
2
|
|
|
3
|
+
import { getTimeZone } from '../utils/dateTime'
|
|
4
|
+
import { useIsTesting } from '../utils/testing'
|
|
5
|
+
|
|
3
6
|
export default defineEventHandler(async (event) => {
|
|
4
|
-
const isTesting = useIsTesting()
|
|
7
|
+
const isTesting = useIsTesting({ event })
|
|
5
8
|
event.context.$timeZone = await getTimeZone({ event, isTesting })
|
|
6
9
|
})
|
|
7
|
-
|
|
8
|
-
// h3 handlers, `useEvent()` and the app's `ssrContext.event` still see h3's context
|
|
9
|
-
declare module 'h3' {
|
|
10
|
-
interface H3EventContext {
|
|
11
|
-
$timeZone?: string
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { defineEventHandler, useRuntimeConfig } from 'nuxt/server'
|
|
2
|
+
|
|
1
3
|
export default defineEventHandler((event) => {
|
|
2
|
-
const runtimeConfig = useRuntimeConfig(
|
|
4
|
+
const runtimeConfig = useRuntimeConfig()
|
|
3
5
|
const sentryConfig = runtimeConfig.public.sentry
|
|
4
6
|
|
|
5
7
|
if (
|
|
@@ -20,13 +22,11 @@ export default defineEventHandler((event) => {
|
|
|
20
22
|
.filter(Boolean)
|
|
21
23
|
.join('&')
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
event,
|
|
25
|
+
event.res.headers.append(
|
|
25
26
|
'NEL',
|
|
26
27
|
'\'{"report_to":"sentry","max_age":31536000,"include_subdomains":true}\'',
|
|
27
28
|
)
|
|
28
|
-
|
|
29
|
-
event,
|
|
29
|
+
event.res.headers.append(
|
|
30
30
|
'Report-To',
|
|
31
31
|
`'{"group":"sentry","max_age":31536000,"endpoints":[{"url":"https://${sentryConfig.host}/api/${sentryConfig.project.id}/security/?${securityEndpointParams}"}],"include_subdomains":true}'`,
|
|
32
32
|
)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineNitroPlugin } from 'nitropack/runtime'
|
|
2
|
+
import { createTransport } from 'nodemailer'
|
|
3
|
+
import { useRuntimeConfig } from 'nuxt/server'
|
|
2
4
|
|
|
3
5
|
export default defineNitroPlugin((nitroApp) => {
|
|
4
6
|
const runtimeConfig = useRuntimeConfig()
|
|
@@ -26,14 +28,3 @@ export default defineNitroPlugin((nitroApp) => {
|
|
|
26
28
|
transporter.close()
|
|
27
29
|
})
|
|
28
30
|
})
|
|
29
|
-
|
|
30
|
-
// h3 handlers and `useEvent()` still see h3's context
|
|
31
|
-
declare module 'h3' {
|
|
32
|
-
interface H3EventContext {
|
|
33
|
-
$email?: {
|
|
34
|
-
nodemailer: {
|
|
35
|
-
transporter: Transporter
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { defu } from 'defu'
|
|
2
|
+
import { defineNitroPlugin } from 'nitropack/runtime'
|
|
2
3
|
import type { ModuleOptions } from 'nuxt-security'
|
|
3
4
|
|
|
5
|
+
import { VIO_GET_CSP } from '../../shared/utils/constants'
|
|
6
|
+
import { useSiteUrl } from '../utils/site'
|
|
7
|
+
|
|
4
8
|
// remove invalid `'none'`s and duplicates
|
|
5
9
|
export const cleanupCsp = (
|
|
6
10
|
nuxtSecurityConfiguration: Partial<ModuleOptions>,
|
package/server/utils/dateTime.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getCookie, getRequestIP, type RequestEvent } from 'nuxt/server'
|
|
2
2
|
|
|
3
|
+
import { TIMEZONE_COOKIE_NAME } from '../../shared/utils/constants'
|
|
4
|
+
|
|
3
5
|
export const getTimeZone = async ({
|
|
4
6
|
event,
|
|
5
7
|
isTesting,
|
|
@@ -26,15 +28,13 @@ export const getTimeZone = async ({
|
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
// the `dateTime` middleware has already resolved the time zone for every request
|
|
30
|
-
export const useTimeZone = async () => useEvent().context.$timeZone
|
|
31
|
-
|
|
32
31
|
export const getTimeZoneByIpApi = async ({ ip }: { ip: string }) => {
|
|
33
|
-
const
|
|
34
|
-
`http://geoip:8080/${ip}`,
|
|
35
|
-
).catch(() => {})
|
|
32
|
+
const response = await fetch(`http://geoip:8080/${ip}`).catch(() => {})
|
|
36
33
|
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
}
|
|
34
|
+
if (!response?.ok) return
|
|
35
|
+
|
|
36
|
+
const ipApiResult = (await response.json().catch(() => {})) as
|
|
37
|
+
{ timezone?: string } | undefined
|
|
38
|
+
|
|
39
|
+
return ipApiResult?.timezone
|
|
40
40
|
}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
getRequestHost,
|
|
3
|
+
useRuntimeConfig,
|
|
4
|
+
type RequestEvent,
|
|
5
|
+
} from 'nuxt/server'
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
import { getServiceHref } from '../../node/networking'
|
|
8
|
+
import type { ServiceName } from '../../node/services'
|
|
9
|
+
import { useSiteUrl } from './site'
|
|
10
|
+
import { useIsTesting } from './testing'
|
|
11
|
+
|
|
12
|
+
export const useGetServiceHref = ({ event }: { event?: RequestEvent } = {}) => {
|
|
4
13
|
const host = useHost({ event })
|
|
5
14
|
const runtimeConfig = useRuntimeConfig()
|
|
6
|
-
const isTesting = useIsTesting()
|
|
15
|
+
const isTesting = useIsTesting({ event })
|
|
7
16
|
|
|
8
17
|
return ({
|
|
9
18
|
allowInternal = true,
|
|
@@ -26,9 +35,9 @@ export const useGetServiceHref = ({ event }: { event?: H3Event } = {}) => {
|
|
|
26
35
|
})
|
|
27
36
|
}
|
|
28
37
|
|
|
29
|
-
export const useHost = ({ event }: { event?:
|
|
38
|
+
export const useHost = ({ event }: { event?: RequestEvent } = {}) => {
|
|
30
39
|
const { siteUrlTyped: siteUrl } = useSiteUrl()
|
|
31
|
-
const host = event ?
|
|
40
|
+
const host = event ? getRequestHost(event) : siteUrl.host
|
|
32
41
|
|
|
33
42
|
if (!host) throw new Error('Host is not given!')
|
|
34
43
|
|
package/server/utils/site.ts
CHANGED
package/server/utils/testing.ts
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { getCookie, useRuntimeConfig, type RequestEvent } from 'nuxt/server'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
// Testing detection still works there through the runtime config, so fall back to no event rather than letting that error escape.
|
|
5
|
-
const tryUseEvent = () => {
|
|
6
|
-
try {
|
|
7
|
-
return useEvent()
|
|
8
|
-
} catch {
|
|
9
|
-
return undefined
|
|
10
|
-
}
|
|
11
|
-
}
|
|
3
|
+
import { TESTING_COOKIE_NAME } from '../../shared/utils/constants'
|
|
12
4
|
|
|
13
5
|
export const useIsTesting = ({
|
|
6
|
+
event,
|
|
14
7
|
isCookieEnabled = true,
|
|
15
|
-
}:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| undefined = {}) => {
|
|
20
|
-
const event = tryUseEvent()
|
|
8
|
+
}: {
|
|
9
|
+
event?: RequestEvent
|
|
10
|
+
isCookieEnabled?: boolean
|
|
11
|
+
} = {}) => {
|
|
21
12
|
const runtimeConfig = useRuntimeConfig()
|
|
22
13
|
|
|
23
14
|
return getIsTesting({ event, isCookieEnabled, runtimeConfig })
|
|
@@ -28,7 +19,7 @@ export const getIsTesting = ({
|
|
|
28
19
|
isCookieEnabled,
|
|
29
20
|
runtimeConfig,
|
|
30
21
|
}: {
|
|
31
|
-
event?:
|
|
22
|
+
event?: RequestEvent
|
|
32
23
|
isCookieEnabled?: boolean
|
|
33
24
|
runtimeConfig: ReturnType<typeof useRuntimeConfig>
|
|
34
25
|
}) => {
|
|
@@ -2,7 +2,7 @@ import { DEFAULTS } from '@dargmuesli/nuxt-cookie-control/runtime/types.js'
|
|
|
2
2
|
import { helpers } from '@vuelidate/validators'
|
|
3
3
|
import { defu } from 'defu'
|
|
4
4
|
|
|
5
|
-
export { IS_IN_FRONTEND_DEVELOPMENT } from '../../node/static'
|
|
5
|
+
export { IS_IN_FRONTEND_DEVELOPMENT } from '../../node/static/index.ts'
|
|
6
6
|
|
|
7
7
|
export const VIO_SITE_NAME = 'Vio'
|
|
8
8
|
|
|
@@ -4,7 +4,7 @@ import type { Ref } from 'vue'
|
|
|
4
4
|
|
|
5
5
|
import type { ApiData, BackendError } from '../types/api'
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export { getRootHost, getServiceHref } from '../../node/networking'
|
|
8
8
|
|
|
9
9
|
export const getApiDataDefault = (): ApiData =>
|
|
10
10
|
computed(() =>
|