@nuxtjs/prismic 4.1.0-pr.235.71fb8db → 4.1.0-pr.235.f2901c8
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.json +1 -1
- package/dist/module.mjs +28 -3
- package/package.json +4 -2
- package/src/module.ts +34 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,15 +1,41 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import { defineNuxtModule, createResolver,
|
|
4
|
+
import { useLogger, defineNuxtModule, createResolver, addPlugin, addComponent, addImports, extendPages, getNuxtVersion, addTemplate } from '@nuxt/kit';
|
|
5
5
|
import { defu } from 'defu';
|
|
6
|
+
import { addDependency } from 'nypm';
|
|
7
|
+
import { readPackage } from 'pkg-types';
|
|
6
8
|
|
|
9
|
+
const name = "@nuxtjs/prismic";
|
|
10
|
+
const version = "4.1.0-pr.235.f2901c8";
|
|
11
|
+
|
|
12
|
+
const logger = useLogger("nuxt:prismic");
|
|
13
|
+
async function addPrismicClient() {
|
|
14
|
+
try {
|
|
15
|
+
const pkg = await readPackage();
|
|
16
|
+
if (!pkg.dependencies?.["@prismicio/client"] && !pkg.devDependencies?.["@prismicio/client"]) {
|
|
17
|
+
await addDependency("@prismicio/client");
|
|
18
|
+
logger.info("Added `@prismicio/client` required peer dependency");
|
|
19
|
+
}
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
7
23
|
const module$1 = defineNuxtModule({
|
|
8
24
|
meta: {
|
|
9
|
-
name
|
|
25
|
+
name,
|
|
26
|
+
version,
|
|
10
27
|
configKey: "prismic",
|
|
11
28
|
compatibility: { nuxt: ">=3.7.0" }
|
|
12
29
|
},
|
|
30
|
+
onInstall() {
|
|
31
|
+
return addPrismicClient();
|
|
32
|
+
},
|
|
33
|
+
onUpgrade(_options, _nuxt, previousVersion) {
|
|
34
|
+
const previousMajor = parseInt(previousVersion.split(".")[0]);
|
|
35
|
+
if (previousMajor < 4) {
|
|
36
|
+
return addPrismicClient();
|
|
37
|
+
}
|
|
38
|
+
},
|
|
13
39
|
defaults: (nuxt) => {
|
|
14
40
|
const nuxt3flavor = getNuxtVersion(nuxt).startsWith("3") && !nuxt.options?.future?.compatibilityVersion;
|
|
15
41
|
if (nuxt3flavor) {
|
|
@@ -41,7 +67,6 @@ const module$1 = defineNuxtModule({
|
|
|
41
67
|
},
|
|
42
68
|
setup(options, nuxt) {
|
|
43
69
|
const resolver = createResolver(import.meta.url);
|
|
44
|
-
const logger = useLogger("nuxt:prismic");
|
|
45
70
|
const moduleOptions = defu(
|
|
46
71
|
nuxt.options.runtimeConfig.public?.prismic,
|
|
47
72
|
options
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtjs/prismic",
|
|
3
|
-
"version": "4.1.0-pr.235.
|
|
3
|
+
"version": "4.1.0-pr.235.f2901c8",
|
|
4
4
|
"description": "Easily connect your Nuxt application to your content hosted on Prismic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nuxt",
|
|
@@ -54,7 +54,9 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@nuxt/kit": "^4.2.2",
|
|
56
56
|
"@prismicio/vue": "pr-89",
|
|
57
|
-
"defu": "^6.1.4"
|
|
57
|
+
"defu": "^6.1.4",
|
|
58
|
+
"nypm": "^0.6.2",
|
|
59
|
+
"pkg-types": "^2.3.0"
|
|
58
60
|
},
|
|
59
61
|
"devDependencies": {
|
|
60
62
|
"@nuxt/module-builder": "^1.0.2",
|
package/src/module.ts
CHANGED
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
import type { ClientConfig } from "@prismicio/client"
|
|
17
17
|
import { defu } from "defu"
|
|
18
18
|
|
|
19
|
+
import { name, version } from '../package.json'
|
|
20
|
+
import { addDependency } from "nypm"
|
|
21
|
+
import { readPackage } from "pkg-types"
|
|
22
|
+
|
|
19
23
|
/**
|
|
20
24
|
* Prismic Nuxt module options.
|
|
21
25
|
*
|
|
@@ -128,12 +132,41 @@ declare module "@nuxt/schema" {
|
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
|
|
135
|
+
const logger = useLogger("nuxt:prismic")
|
|
136
|
+
|
|
137
|
+
async function addPrismicClient() {
|
|
138
|
+
try {
|
|
139
|
+
const pkg = await readPackage()
|
|
140
|
+
|
|
141
|
+
if (
|
|
142
|
+
!pkg.dependencies?.["@prismicio/client"] &&
|
|
143
|
+
!pkg.devDependencies?.["@prismicio/client"]
|
|
144
|
+
) {
|
|
145
|
+
await addDependency("@prismicio/client")
|
|
146
|
+
logger.info("Added `@prismicio/client` required peer dependency")
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
} catch {
|
|
150
|
+
// noop
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
131
154
|
export default defineNuxtModule<PrismicModuleOptions>({
|
|
132
155
|
meta: {
|
|
133
|
-
name
|
|
156
|
+
name,
|
|
157
|
+
version,
|
|
134
158
|
configKey: "prismic",
|
|
135
159
|
compatibility: { nuxt: ">=3.7.0" },
|
|
136
160
|
},
|
|
161
|
+
onInstall() {
|
|
162
|
+
return addPrismicClient()
|
|
163
|
+
},
|
|
164
|
+
onUpgrade(_options: unknown, _nuxt: unknown, previousVersion: string) {
|
|
165
|
+
const previousMajor = parseInt(previousVersion.split(".")[0]!)
|
|
166
|
+
if (previousMajor < 4) {
|
|
167
|
+
return addPrismicClient()
|
|
168
|
+
}
|
|
169
|
+
},
|
|
137
170
|
defaults: (nuxt) => {
|
|
138
171
|
const nuxt3flavor =
|
|
139
172
|
getNuxtVersion(nuxt).startsWith("3") &&
|
|
@@ -169,7 +202,6 @@ export default defineNuxtModule<PrismicModuleOptions>({
|
|
|
169
202
|
},
|
|
170
203
|
setup(options, nuxt) {
|
|
171
204
|
const resolver = createResolver(import.meta.url)
|
|
172
|
-
const logger = useLogger("nuxt:prismic")
|
|
173
205
|
|
|
174
206
|
const moduleOptions: PrismicModuleOptions = defu(
|
|
175
207
|
nuxt.options.runtimeConfig.public?.prismic,
|