@dargmuesli/nuxt-vio 1.11.6 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,6 @@
4
4
  <!-- `NuxtLayout` can't have mulitple child nodes (https://github.com/nuxt/nuxt/issues/21759) -->
5
5
  <div>
6
6
  <SeoKit :site-description="siteDescription" :language="locale" />
7
- <OgImageStatic :alt="ogImageAlt" component="OgImage" />
8
7
  <NuxtPage />
9
8
  <CookieControl :locale="locale" />
10
9
  </div>
@@ -17,13 +16,18 @@ export interface Props {
17
16
  siteDescription: string
18
17
  ogImageAlt: string
19
18
  }
20
- withDefaults(defineProps<Props>(), {})
19
+ const props = withDefaults(defineProps<Props>(), {})
21
20
 
22
21
  const { locale } = useI18n()
23
22
  const cookieControl = useCookieControl()
24
23
 
25
24
  const { loadingIds, indicateLoadingDone } = useLoadingDoneIndicator('app')
26
25
 
26
+ // data
27
+ const ogImageOptions = {
28
+ alt: props.ogImageAlt,
29
+ }
30
+
27
31
  // computations
28
32
  const isLoading = computed(() => !!loadingIds.value.length)
29
33
 
@@ -41,7 +45,9 @@ watch(
41
45
  },
42
46
  { deep: true },
43
47
  )
48
+
44
49
  // initialization
50
+ defineOgImage(ogImageOptions)
45
51
  useAppLayout()
46
52
  useFavicons()
47
53
  </script>
@@ -1,22 +1,31 @@
1
1
  <template>
2
- <h1>{{ statusCode ? `${statusCode} - ` : '' }}{{ statusReason }}</h1>
2
+ <h1>{{ `${statusCode} - ${statusReason}` }}</h1>
3
+ <div>
4
+ {{ description }}
5
+ </div>
6
+ <div v-if="stack && !runtimeConfig.public.isInProduction" v-html="stack" />
3
7
  </template>
4
8
 
5
9
  <script setup lang="ts">
6
10
  import { status } from '@http-util/status-i18n'
7
11
 
8
12
  export interface Props {
9
- statusCode?: number
13
+ statusCode: number
14
+ statusMessage?: string
15
+ description: string
16
+ stack?: string
10
17
  }
11
18
  const props = withDefaults(defineProps<Props>(), {
12
- statusCode: undefined,
19
+ statusMessage: undefined,
20
+ stack: undefined,
13
21
  })
14
22
 
23
+ const runtimeConfig = useRuntimeConfig()
15
24
  const { locale, t } = useI18n()
16
25
 
17
26
  // computations
18
27
  const statusReason = computed(() => {
19
- return status(props.statusCode, locale) || t('error')
28
+ return status(props.statusCode, locale.value) || t('error')
20
29
  })
21
30
  </script>
22
31
 
package/error.vue CHANGED
@@ -1,21 +1,23 @@
1
1
  <template>
2
2
  <NuxtLayout>
3
3
  <VioError
4
- :status-code="error?.statusCode ? +error?.statusCode : undefined"
4
+ :status-code="error.statusCode"
5
+ :status-message="error.statusMessage"
6
+ :description="error.message"
7
+ :stack="error.stack"
5
8
  />
6
9
  </NuxtLayout>
7
10
  </template>
8
11
 
9
12
  <script setup lang="ts">
10
- export type Error = { statusCode: string }
13
+ import { NuxtError } from 'nuxt/app'
14
+
11
15
  export interface Props {
12
- error?: Error
16
+ error: NuxtError
13
17
  }
14
- const props = withDefaults(defineProps<Props>(), {
15
- error: undefined,
16
- })
18
+ const props = withDefaults(defineProps<Props>(), {})
17
19
 
18
20
  useHead({
19
- title: props.error?.statusCode?.toString(),
21
+ title: `${props.error.statusCode} - ${props.error.message}`,
20
22
  })
21
23
  </script>
package/nuxt.config.ts CHANGED
@@ -41,11 +41,12 @@ export default defineNuxtConfig({
41
41
  runtimeConfig: {
42
42
  public: {
43
43
  googleAnalyticsId: '', // set via environment variable `NUXT_PUBLIC_GOOGLE_ANALYTICS_ID` only
44
+ isInProduction: process.env.NODE_ENV === 'production',
44
45
  isTesting: false,
45
46
  ...{
46
47
  siteName: SITE_NAME,
47
48
  siteUrl: BASE_URL,
48
- },
49
+ }, // TODO: remove once http://localhost:3000/api/__site-config__/debug shows correct data without this extension.
49
50
  },
50
51
  },
51
52
  typescript: {
@@ -119,7 +120,10 @@ export default defineNuxtConfig({
119
120
  failOn404: false, // TODO: enable (https://github.com/harlan-zw/nuxt-seo-kit/issues/4#issuecomment-1434522124)
120
121
  },
121
122
  site: {
123
+ // debug: process.env.NODE_ENV === 'development',
124
+ // name: SITE_NAME,
122
125
  splash: false,
126
+ // url: BASE_URL,
123
127
  },
124
128
  tailwindcss: {
125
129
  cssPath: join(currentDir, './assets/css/tailwind.css'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-vio",
3
- "version": "1.11.6",
3
+ "version": "1.12.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -38,7 +38,7 @@
38
38
  "lint:ts": "nuxt typecheck"
39
39
  },
40
40
  "dependencies": {
41
- "@dargmuesli/nuxt-cookie-control": "6.1.4",
41
+ "@dargmuesli/nuxt-cookie-control": "6.1.5",
42
42
  "@http-util/status-i18n": "0.7.0",
43
43
  "@nuxtjs/html-validator": "1.5.2",
44
44
  "@nuxtjs/i18n": "8.0.0-beta.10",
@@ -68,5 +68,10 @@
68
68
  "stylelint-no-unsupported-browser-features": "7.0.0",
69
69
  "typescript": "5.1.6",
70
70
  "vue-tsc": "1.8.6"
71
+ },
72
+ "pnpm": {
73
+ "overrides": {
74
+ "nuxt-og-image": "2.0.11"
75
+ }
71
76
  }
72
77
  }