@studio-fes/layer-strapi 0.2.18 → 0.3.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/CHANGELOG.md +6 -0
- package/app/components/StrapiMedia.vue +8 -4
- package/nuxt.config.ts +9 -2
- package/package.json +5 -5
- package/parse-env.ts +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -14,12 +14,12 @@ const isImage = computed(() => mediaIsImage(props.media))
|
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<template>
|
|
17
|
-
<
|
|
17
|
+
<LazyStrapiImage
|
|
18
18
|
v-if="isImage"
|
|
19
19
|
v-bind="imgProps"
|
|
20
20
|
:image="media"
|
|
21
21
|
/>
|
|
22
|
-
<
|
|
22
|
+
<LazyStrapiVideo
|
|
23
23
|
v-else-if="isVideo"
|
|
24
24
|
v-bind="videoProps"
|
|
25
25
|
:video="media"
|
|
@@ -27,6 +27,10 @@ const isImage = computed(() => mediaIsImage(props.media))
|
|
|
27
27
|
<template #default="{ progress, isPlaying }">
|
|
28
28
|
<slot name="media-chrome" :progress :is-playing />
|
|
29
29
|
</template>
|
|
30
|
-
</
|
|
31
|
-
<
|
|
30
|
+
</LazyStrapiVideo>
|
|
31
|
+
<slot v-else name="empty">
|
|
32
|
+
<DevOnly>
|
|
33
|
+
There is no format for you.
|
|
34
|
+
</DevOnly>
|
|
35
|
+
</slot>
|
|
32
36
|
</template>
|
package/nuxt.config.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { parseEnv } from './parse-env'
|
|
2
|
+
|
|
3
|
+
const { graphqlEndpoint, hostname } = parseEnv()
|
|
4
|
+
|
|
2
5
|
export default defineNuxtConfig({
|
|
3
6
|
extends: ['@studio-fes/layer-base'],
|
|
4
7
|
|
|
@@ -13,11 +16,15 @@ export default defineNuxtConfig({
|
|
|
13
16
|
|
|
14
17
|
graphqlMiddleware: {
|
|
15
18
|
downloadSchema: false,
|
|
16
|
-
graphqlEndpoint
|
|
19
|
+
graphqlEndpoint,
|
|
17
20
|
serverApiPrefix: '/gql',
|
|
18
21
|
clientCache: {
|
|
19
22
|
enabled: true,
|
|
20
23
|
},
|
|
21
24
|
autoImportPatterns: ['./queries/**/*.gql'],
|
|
22
25
|
},
|
|
26
|
+
|
|
27
|
+
image: {
|
|
28
|
+
domains: [hostname],
|
|
29
|
+
},
|
|
23
30
|
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studio-fes/layer-strapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@nuxt/eslint": "latest",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"vue-strapi-blocks-renderer": "1.1.1"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@types/node": "^25.
|
|
14
|
-
"eslint": "^10.
|
|
15
|
-
"nuxt": "^4.4.
|
|
13
|
+
"@types/node": "^25.9.3",
|
|
14
|
+
"eslint": "^10.5.0",
|
|
15
|
+
"nuxt": "^4.4.8",
|
|
16
16
|
"typescript": "^6.0.3",
|
|
17
17
|
"vue": "latest",
|
|
18
|
-
"@studio-fes/layer-base": "0.
|
|
18
|
+
"@studio-fes/layer-base": "0.3.0"
|
|
19
19
|
},
|
|
20
20
|
"description": "Create Nuxt extendable layer with this GitHub template.",
|
|
21
21
|
"repository": {
|
package/parse-env.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function parseEnv() {
|
|
2
|
+
const backendUrl = import.meta.env.NUXT_PUBLIC_BACKEND_URL
|
|
3
|
+
if (!backendUrl) {
|
|
4
|
+
throw new Error('NUXT_PUBLIC_BACKEND_URL environment variable is not set')
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
let graphqlEndpoint: string
|
|
8
|
+
let hostname: string
|
|
9
|
+
try {
|
|
10
|
+
const baseUrl = new URL(backendUrl)
|
|
11
|
+
hostname = baseUrl.hostname
|
|
12
|
+
if (!hostname) {
|
|
13
|
+
throw new Error('Missing hostname in NUXT_PUBLIC_BACKEND_URL environment variable')
|
|
14
|
+
}
|
|
15
|
+
graphqlEndpoint = new URL('graphql', baseUrl).toString()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
catch {
|
|
19
|
+
throw new Error('Invalid NUXT_PUBLIC_BACKEND_URL environment variable')
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return { graphqlEndpoint, hostname }
|
|
23
|
+
}
|