@dargmuesli/nuxt-vio 10.0.0 → 10.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@
12
12
  </template>
13
13
 
14
14
  <script setup lang="ts">
15
- import { status } from '@http-util/status-i18n'
15
+ const httpUtilStatusI18n = await import('@http-util/status-i18n')
16
16
 
17
17
  interface Props {
18
18
  statusCode?: number
@@ -31,7 +31,7 @@ const { locale, t } = useI18n()
31
31
 
32
32
  // data
33
33
  const title = `${props.statusCode ? `${props.statusCode} - ` : ''}${
34
- status(props.statusCode, locale.value) || t('error')
34
+ httpUtilStatusI18n.status(props.statusCode, locale.value) || t('error')
35
35
  }`
36
36
 
37
37
  // initialization
@@ -1,6 +1,8 @@
1
1
  import { POLYFILLS } from '../utils/constants'
2
2
 
3
3
  export const usePolyfills = () => {
4
+ if (!POLYFILLS.length) return
5
+
4
6
  const polyfillsUrl = `https://polyfill.io/v3/polyfill.min.js?features=${POLYFILLS.join(
5
7
  '%2C',
6
8
  )}&flags=gated`
package/nuxt.config.ts CHANGED
@@ -186,7 +186,7 @@ export default defineNuxtConfig(
186
186
  // Cloudflare
187
187
  ...(process.env.NODE_ENV === 'production'
188
188
  ? {
189
- 'connect-src': ["'self'"], // `${SITE_URL}/cdn-cgi/rum`
189
+ 'connect-src': ['https://cloudflareinsights.com'],
190
190
  'script-src': ['https://static.cloudflareinsights.com'], // TODO: replace with `script-src-elem` once Webkit supports it (https://caniuse.com/mdn-http_headers_content-security-policy_script-src-elem)
191
191
  }
192
192
  : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-vio",
3
- "version": "10.0.0",
3
+ "version": "10.0.2",
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.12.0",
15
+ "packageManager": "pnpm@8.14.0",
16
16
  "files": [
17
17
  "assets",
18
18
  "components",
@@ -34,28 +34,28 @@
34
34
  ],
35
35
  "main": "nuxt.config.ts",
36
36
  "dependencies": {
37
- "@dargmuesli/nuxt-cookie-control": "7.2.0",
38
- "@heroicons/vue": "2.0.18",
37
+ "@dargmuesli/nuxt-cookie-control": "7.2.2",
38
+ "@heroicons/vue": "2.1.1",
39
39
  "@http-util/status-i18n": "0.8.1",
40
- "@nuxt/devtools": "1.0.5",
40
+ "@nuxt/devtools": "1.0.6",
41
41
  "@nuxt/image": "1.1.0",
42
42
  "@nuxtjs/color-mode": "3.3.2",
43
43
  "@nuxtjs/html-validator": "1.6.0",
44
- "@nuxtjs/i18n": "8.0.0-rc.9",
45
- "@nuxtjs/tailwindcss": "6.10.1",
46
- "@nuxtseo/module": "2.0.0-beta.50",
44
+ "@nuxtjs/i18n": "8.0.0",
45
+ "@nuxtjs/tailwindcss": "6.10.3",
46
+ "@nuxtseo/module": "2.0.0-beta.55",
47
47
  "@pinia/nuxt": "0.5.1",
48
48
  "@tailwindcss/forms": "0.5.7",
49
49
  "@tailwindcss/typography": "0.5.10",
50
50
  "@types/lodash-es": "4.17.12",
51
- "@urql/core": "4.2.1",
51
+ "@urql/core": "4.2.2",
52
52
  "@vuelidate/core": "2.0.3",
53
53
  "@vuelidate/validators": "2.0.4",
54
54
  "clipboardy": "4.0.0",
55
55
  "dayjs": "2.0.0-alpha.4",
56
- "jose": "5.1.3",
57
- "nuxt-security": "1.0.0-rc.5",
58
- "sweetalert2": "11.10.1",
56
+ "jose": "5.2.0",
57
+ "nuxt-security": "1.0.0",
58
+ "sweetalert2": "11.10.2",
59
59
  "vue-gtag": "2.0.1"
60
60
  },
61
61
  "devDependencies": {
@@ -70,37 +70,37 @@
70
70
  "consola": "3.2.3",
71
71
  "cookie-es": "1.0.0",
72
72
  "cross-env": "7.0.3",
73
- "defu": "6.1.3",
74
- "eslint": "8.55.0",
73
+ "defu": "6.1.4",
74
+ "eslint": "8.56.0",
75
75
  "eslint-config-prettier": "9.1.0",
76
76
  "eslint-plugin-compat": "4.2.0",
77
77
  "eslint-plugin-nuxt": "4.0.0",
78
- "eslint-plugin-prettier": "5.0.1",
79
- "eslint-plugin-yml": "1.10.0",
80
- "h3": "1.9.0",
78
+ "eslint-plugin-prettier": "5.1.2",
79
+ "eslint-plugin-yml": "1.11.0",
80
+ "h3": "1.10.0",
81
81
  "jiti": "1.21.0",
82
82
  "lint-staged": "15.2.0",
83
83
  "lodash-es": "4.17.21",
84
- "nuxt": "3.8.2",
84
+ "nuxt": "3.9.1",
85
85
  "pinia": "2.1.7",
86
86
  "prettier": "3.1.1",
87
- "prettier-plugin-tailwindcss": "0.5.9",
87
+ "prettier-plugin-tailwindcss": "0.5.10",
88
88
  "serve": "14.2.1",
89
- "stylelint": "16.0.2",
89
+ "stylelint": "16.1.0",
90
90
  "stylelint-config-recommended-vue": "1.5.0",
91
- "stylelint-config-standard": "35.0.0",
92
- "stylelint-no-unsupported-browser-features": "7.0.0",
93
- "tailwindcss": "3.3.6",
91
+ "stylelint-config-standard": "36.0.0",
92
+ "stylelint-no-unsupported-browser-features": "8.0.0",
93
+ "tailwindcss": "3.4.1",
94
94
  "ufo": "1.3.2",
95
95
  "unhead": "1.8.9",
96
- "vue": "3.3.11",
96
+ "vue": "3.4.5",
97
97
  "vue-router": "4.2.5",
98
- "vue-tsc": "1.8.25"
98
+ "vue-tsc": "1.8.27"
99
99
  },
100
100
  "peerDependencies": {
101
- "nuxt": "3.8.2",
101
+ "nuxt": "3.9.1",
102
102
  "playwright-core": "1.40.1",
103
- "vue": "3.3.11",
103
+ "vue": "3.4.5",
104
104
  "vue-router": "4.2.5"
105
105
  },
106
106
  "scripts": {
package/plugins/dayjs.ts CHANGED
@@ -1,16 +1,16 @@
1
- import dayjs from 'dayjs'
1
+ export default defineNuxtPlugin(async (_nuxtApp) => {
2
+ const dayjs = (await import('dayjs')).default
2
3
 
3
- // workaround for [1]
4
- import de from 'dayjs/locale/de'
5
- // import 'dayjs/locale/de' does not make locale available
4
+ // workaround for [1]
5
+ const de = (await import('dayjs/locale/de')).default
6
+ // import 'dayjs/locale/de' does not make locale available
6
7
 
7
- import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'
8
- import localizedFormat from 'dayjs/plugin/localizedFormat'
9
- import relativeTime from 'dayjs/plugin/relativeTime'
10
- import timezone from 'dayjs/plugin/timezone'
11
- import utc from 'dayjs/plugin/utc'
8
+ const isSameOrBefore = (await import('dayjs/plugin/isSameOrBefore')).default
9
+ const localizedFormat = (await import('dayjs/plugin/localizedFormat')).default
10
+ const relativeTime = (await import('dayjs/plugin/relativeTime')).default
11
+ const timezone = (await import('dayjs/plugin/timezone')).default
12
+ const utc = (await import('dayjs/plugin/utc')).default
12
13
 
13
- export default defineNuxtPlugin((_nuxtApp) => {
14
14
  dayjs.extend(isSameOrBefore)
15
15
  dayjs.extend(localizedFormat)
16
16
  dayjs.extend(relativeTime)
@@ -1,10 +1,10 @@
1
- import VueGtag from 'vue-gtag'
2
-
3
- export default defineNuxtPlugin((nuxtApp) => {
1
+ export default defineNuxtPlugin(async (nuxtApp) => {
4
2
  const config = useRuntimeConfig()
5
3
  const router = useRouter()
6
4
  const cookieControl = useCookieControl()
7
5
 
6
+ const VueGtag = (await import('vue-gtag')).default
7
+
8
8
  nuxtApp.vueApp.use(
9
9
  VueGtag,
10
10
  {
package/utils/auth.ts CHANGED
@@ -6,7 +6,6 @@ import { decodeJwt } from 'jose'
6
6
  import type { Store } from 'pinia'
7
7
 
8
8
  import { useVioAuthStore } from '../store/auth'
9
- import { xhrPromise } from '../utils/networking'
10
9
  import { JWT_NAME } from './constants'
11
10
 
12
11
  export const getJwtFromCookie = ({ req }: { req: IncomingMessage }) => {
@@ -61,7 +60,10 @@ export const jwtStore = async ({
61
60
  )
62
61
  } else {
63
62
  try {
64
- await xhrPromise('POST', '/api/auth', jwt || '')
63
+ await $fetch('/api/auth', {
64
+ method: 'POST',
65
+ ...(jwt ? { headers: { Authorization: `Bearer ${jwt}` } } : {}),
66
+ })
65
67
  } catch (error: any) {
66
68
  return Promise.reject(Error('Authentication api call failed.'))
67
69
  }
@@ -37,7 +37,9 @@ export const I18N_VUE_CONFIG = {
37
37
  }
38
38
  export const JWT_NAME = () =>
39
39
  `${process.env.NODE_ENV === 'production' ? '__Secure-' : ''}jwt`
40
- export const POLYFILLS = ['Promise']
40
+ export const POLYFILLS = [
41
+ // 'Promise', // op_mini
42
+ ]
41
43
  export const REGEX_UUID =
42
44
  /^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/
43
45
  export const TIMEZONE_COOKIE_NAME = [COOKIE_PREFIX, 'tz'].join(COOKIE_SEPARATOR)
package/utils/form.ts CHANGED
@@ -1,12 +1,13 @@
1
+ import type { Validation } from '@vuelidate/core'
1
2
  import { consola } from 'consola'
2
3
 
3
4
  export const isFormValid = async ({
4
5
  v$,
5
6
  isFormSent,
6
7
  }: {
7
- v$: any
8
+ v$: Ref<Validation>
8
9
  isFormSent: Ref<boolean>
9
- }): Promise<boolean> => {
10
+ }) => {
10
11
  v$.value.$touch()
11
12
 
12
13
  const isValid = await v$.value.$validate()
@@ -129,25 +129,3 @@ export const getTimezone = async (event: H3Event) => {
129
129
 
130
130
  return undefined
131
131
  }
132
-
133
- // TODO: use fetch
134
- export const xhrPromise = (method: string, url: string, jwt: string) =>
135
- new Promise((resolve, reject) => {
136
- const xhr = new XMLHttpRequest()
137
- xhr.open(method, url)
138
-
139
- if (jwt) {
140
- xhr.setRequestHeader('Authorization', 'Bearer ' + jwt)
141
- }
142
-
143
- xhr.onload = () => {
144
- if (xhr.status >= 200 && xhr.status < 300) {
145
- resolve(xhr.response)
146
- } else {
147
- reject(new Error(`${xhr.status}\n${xhr.statusText}`))
148
- }
149
- }
150
- xhr.onerror = () => reject(new Error(`${xhr.status}\n${xhr.statusText}`))
151
-
152
- xhr.send()
153
- })