@nuxtjs/prismic 3.0.1 → 3.0.2
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/dist/module.d.mts +20 -0
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/runtime/plugin.mjs +12 -3
- package/dist/types.d.mts +7 -0
- package/package.json +12 -12
- package/src/runtime/plugin.ts +12 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { PrismicPluginOptions } from '@prismicio/vue';
|
|
3
|
+
|
|
4
|
+
type PrismicModuleOptions = Omit<PrismicPluginOptions, 'endpoint' | 'client' | 'linkResolver' | 'htmlSerializer' | 'richTextSerializer'> & {
|
|
5
|
+
endpoint: string;
|
|
6
|
+
client?: string;
|
|
7
|
+
linkResolver?: string;
|
|
8
|
+
richTextSerializer?: string;
|
|
9
|
+
preview?: string | false;
|
|
10
|
+
toolbar?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
declare module '@nuxt/schema' {
|
|
14
|
+
interface PublicRuntimeConfig {
|
|
15
|
+
prismic: PrismicModuleOptions;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
declare const _default: _nuxt_schema.NuxtModule<PrismicModuleOptions>;
|
|
19
|
+
|
|
20
|
+
export { type PrismicModuleOptions, _default as default };
|
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
package/dist/runtime/plugin.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import NuxtLink from "#app/components/nuxt-link";
|
|
2
1
|
import { isRepositoryEndpoint, getRepositoryName } from "@prismicio/client";
|
|
3
2
|
import { createPrismic } from "@prismicio/vue";
|
|
4
|
-
import
|
|
3
|
+
import NuxtLink from "#app/components/nuxt-link";
|
|
4
|
+
import { defineNuxtPlugin, useCookie, useRequestEvent, onNuxtReady, refreshNuxtData, useHead, useRuntimeConfig, useRouter } from "#imports";
|
|
5
5
|
import client from "#build/prismic/proxy/client";
|
|
6
6
|
import linkResolver from "#build/prismic/proxy/linkResolver";
|
|
7
7
|
import richTextSerializer from "#build/prismic/proxy/richTextSerializer";
|
|
@@ -30,7 +30,16 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
30
30
|
try {
|
|
31
31
|
const session = typeof previewCookie === "string" ? JSON.parse(decodeURIComponent(previewCookie)) : previewCookie;
|
|
32
32
|
if (Object.keys(session).some((key) => key in session && typeof session[key] === "object" && session[key] !== null && "preview" in session[key] && session[key].preview)) {
|
|
33
|
-
|
|
33
|
+
let afterEachCalled = false;
|
|
34
|
+
onNuxtReady(() => {
|
|
35
|
+
if (!afterEachCalled) {
|
|
36
|
+
refreshNuxtData();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
useRouter().afterEach(() => {
|
|
40
|
+
afterEachCalled = true;
|
|
41
|
+
refreshNuxtData();
|
|
42
|
+
});
|
|
34
43
|
}
|
|
35
44
|
} catch (error) {
|
|
36
45
|
console.warn("Failed to parse Prismic preview cookie", error);
|
package/dist/types.d.mts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtjs/prismic",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Easily connect your Nuxt 3 application to your content hosted on Prismic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nuxt",
|
|
@@ -50,22 +50,22 @@
|
|
|
50
50
|
"unit:watch": "vitest watch"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@nuxt/kit": "^3.
|
|
54
|
-
"@prismicio/client": "^7.0
|
|
55
|
-
"@prismicio/vue": "^4.0.
|
|
56
|
-
"consola": "^3.
|
|
53
|
+
"@nuxt/kit": "^3.7.3",
|
|
54
|
+
"@prismicio/client": "^7.2.0",
|
|
55
|
+
"@prismicio/vue": "^4.0.3",
|
|
56
|
+
"consola": "^3.2.3",
|
|
57
57
|
"defu": "^6.1.2"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@nuxt/module-builder": "^0.
|
|
61
|
-
"@nuxtjs/eslint-config-typescript": "^12.
|
|
62
|
-
"@vitest/coverage-
|
|
63
|
-
"eslint": "^8.
|
|
60
|
+
"@nuxt/module-builder": "^0.5.1",
|
|
61
|
+
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
62
|
+
"@vitest/coverage-v8": "^0.34.4",
|
|
63
|
+
"eslint": "^8.49.0",
|
|
64
64
|
"mock-fs": "^5.2.0",
|
|
65
|
-
"nuxt": "^3.
|
|
65
|
+
"nuxt": "^3.7.3",
|
|
66
66
|
"standard-version": "^9.5.0",
|
|
67
|
-
"typescript": "^5.
|
|
68
|
-
"vitest": "^0.
|
|
67
|
+
"typescript": "^5.2.2",
|
|
68
|
+
"vitest": "^0.34.4"
|
|
69
69
|
},
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">=16.10.0"
|
package/src/runtime/plugin.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import NuxtLink from '#app/components/nuxt-link'
|
|
2
|
-
|
|
3
1
|
import { isRepositoryEndpoint, getRepositoryName } from '@prismicio/client'
|
|
4
2
|
import { createPrismic } from '@prismicio/vue'
|
|
5
3
|
|
|
6
4
|
import { PrismicModuleOptions } from '../types'
|
|
7
|
-
import
|
|
5
|
+
import NuxtLink from '#app/components/nuxt-link'
|
|
6
|
+
import { defineNuxtPlugin, useCookie, useRequestEvent, onNuxtReady, refreshNuxtData, useHead, useRuntimeConfig, useRouter } from '#imports'
|
|
8
7
|
|
|
9
8
|
// @ts-expect-error vfs cannot be resolved here
|
|
10
9
|
import client from '#build/prismic/proxy/client'
|
|
@@ -50,7 +49,16 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
50
49
|
'preview' in session[key] &&
|
|
51
50
|
session[key].preview)
|
|
52
51
|
) {
|
|
53
|
-
|
|
52
|
+
let afterEachCalled = false
|
|
53
|
+
onNuxtReady(() => {
|
|
54
|
+
if (!afterEachCalled) {
|
|
55
|
+
refreshNuxtData()
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
useRouter().afterEach(() => {
|
|
59
|
+
afterEachCalled = true
|
|
60
|
+
refreshNuxtData()
|
|
61
|
+
})
|
|
54
62
|
}
|
|
55
63
|
} catch (error) {
|
|
56
64
|
// eslint-disable-next-line no-console
|