@wpnuxt/core 1.0.0-edge.9 → 2.0.0-alpha.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/client-options.d.mts +1 -0
- package/dist/client-options.d.ts +1 -0
- package/dist/client-options.mjs +1 -0
- package/dist/module.d.mts +72 -82
- package/dist/module.d.ts +72 -82
- package/dist/module.json +4 -5
- package/dist/module.mjs +601 -271
- package/dist/runtime/app/graphqlMiddleware.clientOptions.d.ts +0 -0
- package/dist/runtime/app/graphqlMiddleware.clientOptions.js +12 -0
- package/dist/runtime/components/WPNuxtLogo.d.vue.ts +0 -0
- package/dist/runtime/components/WPNuxtLogo.vue +7 -7
- package/dist/runtime/components/WPNuxtLogo.vue.d.ts +0 -0
- package/dist/runtime/composables/useWPContent.d.ts +0 -5
- package/dist/runtime/composables/useWPContent.js +30 -16
- package/dist/runtime/plugins/graphqlConfig.d.ts +0 -0
- package/dist/runtime/plugins/graphqlConfig.js +17 -0
- package/dist/runtime/plugins/graphqlErrors.d.ts +0 -0
- package/dist/runtime/plugins/graphqlErrors.js +9 -0
- package/dist/runtime/queries/GeneralSettings.gql +0 -2
- package/dist/runtime/queries/Menu.gql +0 -2
- package/dist/runtime/queries/Node.gql +0 -3
- package/dist/runtime/queries/Pages.gql +0 -2
- package/dist/runtime/queries/Posts.gql +15 -2
- package/dist/runtime/queries/Viewer.gql +4 -4
- package/dist/runtime/queries/fragments/GeneralSettings.fragment.gql +0 -1
- package/dist/runtime/queries/fragments/NodeWithFeaturedImage.fragment.gql +0 -2
- package/dist/runtime/queries/fragments/NodeWithFeaturedImageToMediaItemConnectionEdge.fragment.gql +0 -2
- package/dist/runtime/queries/fragments/Page.fragment.gql +0 -4
- package/dist/runtime/queries/fragments/Post.fragment.gql +8 -5
- package/dist/runtime/server/graphqlMiddleware.serverOptions.d.ts +0 -0
- package/dist/runtime/server/graphqlMiddleware.serverOptions.js +18 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/types/stub.d.ts +22 -0
- package/dist/runtime/util/images.d.ts +0 -2
- package/dist/runtime/util/images.js +11 -3
- package/dist/server-options.d.mts +2 -0
- package/dist/server-options.d.ts +2 -0
- package/dist/server-options.mjs +1 -0
- package/dist/types.d.mts +2 -2
- package/package.json +50 -79
- package/README.md +0 -80
- package/dist/module.cjs +0 -5
- package/dist/runtime/app/graphqlMiddleware.serverOptions.d.ts +0 -2
- package/dist/runtime/app/graphqlMiddleware.serverOptions.js +0 -11
- package/dist/runtime/components/StagingBanner.vue +0 -107
- package/dist/runtime/components/WordPressLogo.vue +0 -15
- package/dist/runtime/composables/index.d.ts +0 -3
- package/dist/runtime/composables/index.js +0 -3
- package/dist/runtime/composables/isStaging.d.ts +0 -1
- package/dist/runtime/composables/isStaging.js +0 -6
- package/dist/runtime/composables/useFeaturedImage.d.ts +0 -2
- package/dist/runtime/composables/useFeaturedImage.js +0 -7
- package/dist/runtime/composables/usePrevNextPost.d.ts +0 -4
- package/dist/runtime/composables/usePrevNextPost.js +0 -25
- package/dist/runtime/composables/useWPUri.d.ts +0 -8
- package/dist/runtime/composables/useWPUri.js +0 -23
- package/dist/runtime/plugins/vue-sanitize-directive.d.ts +0 -2
- package/dist/runtime/plugins/vue-sanitize-directive.js +0 -5
- package/dist/runtime/server/api/purgeCache.get.d.ts +0 -5
- package/dist/runtime/server/api/purgeCache.get.js +0 -9
- package/dist/runtime/server/api/wpContent.post.d.ts +0 -9
- package/dist/runtime/server/api/wpContent.post.js +0 -50
- package/dist/runtime/server/index.d.ts +0 -1
- package/dist/runtime/server/index.js +0 -8
- package/dist/runtime/server/storage.d.ts +0 -3
- package/dist/runtime/server/storage.js +0 -11
- package/dist/runtime/util/logger.d.ts +0 -3
- package/dist/runtime/util/logger.js +0 -25
- package/dist/types.d.ts +0 -7
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineGraphqlClientOptions } from "nuxt-graphql-middleware/client-options";
|
|
2
|
+
import { useRoute } from "#imports";
|
|
3
|
+
export default defineGraphqlClientOptions({
|
|
4
|
+
buildClientContext() {
|
|
5
|
+
const route = useRoute();
|
|
6
|
+
return {
|
|
7
|
+
// Context values must be strings - use 'true'/'false' instead of boolean
|
|
8
|
+
preview: route.query.preview === "true" ? "true" : void 0,
|
|
9
|
+
previewToken: route.query.token
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
});
|
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
const props = defineProps
|
|
3
|
-
wpColor
|
|
4
|
-
}
|
|
5
|
-
const wpLight = props.wpColor ? props.wpColor :
|
|
6
|
-
const wpDark = props.wpColor ? props.wpColor :
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
wpColor: { type: String, required: false }
|
|
4
|
+
});
|
|
5
|
+
const wpLight = props.wpColor ? props.wpColor : "black";
|
|
6
|
+
const wpDark = props.wpColor ? props.wpColor : "white";
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<template>
|
|
@@ -13,5 +13,5 @@ const wpDark = props.wpColor ? props.wpColor : 'white'
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<style scoped>
|
|
16
|
-
.wpnuxt-logo{display:inline-flex;font-size:
|
|
16
|
+
.wpnuxt-logo{display:inline-flex;font-size:2rem;font-weight:700;line-height:2rem}.wpnuxt-logo-wp{color:v-bind(wpLight);font-family:ui-serif,Times,serif}html.dark .wpnuxt-logo-wp{color:v-bind(wpDark);font-family:ui-serif,Times,serif}.wpnuxt-logo-nuxt{color:#baaf4e}
|
|
17
17
|
</style>
|
|
File without changes
|
|
@@ -1,30 +1,44 @@
|
|
|
1
1
|
import { getRelativeImagePath } from "../util/images.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { computed, useAsyncGraphqlQuery } from "#imports";
|
|
3
|
+
export const useWPContent = (queryName, nodes, fixImagePaths, params, options) => {
|
|
4
|
+
const { data, pending, refresh, execute, clear, error, status } = useAsyncGraphqlQuery(
|
|
5
|
+
queryName,
|
|
6
|
+
params ?? {},
|
|
7
|
+
options
|
|
8
|
+
);
|
|
9
|
+
const transformedData = computed(() => {
|
|
10
|
+
const queryResult = data.value && typeof data.value === "object" && data.value !== null && "data" in data.value ? data.value.data : void 0;
|
|
11
|
+
return queryResult ? transformData(queryResult, nodes, fixImagePaths) : void 0;
|
|
9
12
|
});
|
|
10
13
|
return {
|
|
11
|
-
data:
|
|
12
|
-
|
|
14
|
+
data: transformedData,
|
|
15
|
+
pending,
|
|
16
|
+
refresh,
|
|
17
|
+
execute,
|
|
18
|
+
clear,
|
|
19
|
+
error,
|
|
20
|
+
status
|
|
13
21
|
};
|
|
14
22
|
};
|
|
15
23
|
const transformData = (data, nodes, fixImagePaths) => {
|
|
16
24
|
const transformedData = findData(data, nodes);
|
|
17
|
-
if (fixImagePaths && transformedData
|
|
18
|
-
|
|
25
|
+
if (fixImagePaths && transformedData && typeof transformedData === "object" && "featuredImage" in transformedData) {
|
|
26
|
+
const featuredImage = transformedData.featuredImage;
|
|
27
|
+
if (featuredImage && typeof featuredImage === "object" && "node" in featuredImage) {
|
|
28
|
+
const node = featuredImage.node;
|
|
29
|
+
if (node && typeof node === "object" && "sourceUrl" in node && typeof node.sourceUrl === "string") {
|
|
30
|
+
node.relativePath = getRelativeImagePath(node.sourceUrl);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
19
33
|
}
|
|
20
34
|
return transformedData;
|
|
21
35
|
};
|
|
22
36
|
const findData = (data, nodes) => {
|
|
23
37
|
if (nodes.length === 0) return data;
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
return nodes.reduce((acc, node) => {
|
|
39
|
+
if (acc && typeof acc === "object" && node in acc) {
|
|
26
40
|
return acc[node];
|
|
27
|
-
}
|
|
28
|
-
|
|
41
|
+
}
|
|
42
|
+
return void 0;
|
|
43
|
+
}, data);
|
|
29
44
|
};
|
|
30
|
-
export const useWPContent = _useWPContent;
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from "nuxt/app";
|
|
2
|
+
import { useGraphqlState, useRuntimeConfig } from "#imports";
|
|
3
|
+
export default defineNuxtPlugin((_NuxtApp) => {
|
|
4
|
+
const state = useGraphqlState();
|
|
5
|
+
if (!state) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const { buildHash } = useRuntimeConfig().public;
|
|
9
|
+
state.fetchOptions = {
|
|
10
|
+
async onRequest({ options }) {
|
|
11
|
+
if (!options.params) {
|
|
12
|
+
options.params = {};
|
|
13
|
+
}
|
|
14
|
+
options.params.hash = buildHash;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineNuxtPlugin, useNuxtApp } from "nuxt/app";
|
|
2
|
+
export default defineNuxtPlugin(() => {
|
|
3
|
+
const nuxtApp = useNuxtApp();
|
|
4
|
+
nuxtApp.hook("nuxt-graphql-middleware:errors", (errors) => {
|
|
5
|
+
if (import.meta.dev) {
|
|
6
|
+
console.error("[WPNuxt] GraphQL errors:", errors);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
#import "~/.queries/fragments/Post.fragment.gql"
|
|
2
|
-
|
|
3
1
|
query Posts($limit: Int = 10) {
|
|
4
2
|
posts(first: $limit) {
|
|
5
3
|
nodes {
|
|
@@ -17,3 +15,18 @@ query PostById($id: ID!, $asPreview: Boolean = false) {
|
|
|
17
15
|
...Post
|
|
18
16
|
}
|
|
19
17
|
}
|
|
18
|
+
|
|
19
|
+
query PostsByCategoryName($categoryName: String!, $limit: Int = 10) {
|
|
20
|
+
posts(first: $limit, where: {categoryName: $categoryName}) {
|
|
21
|
+
nodes {
|
|
22
|
+
...Post
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
query PostsByCategoryId($categoryId: Int!, $limit: Int = 10) {
|
|
27
|
+
posts(first: $limit, where: {categoryId: $categoryId}) {
|
|
28
|
+
nodes {
|
|
29
|
+
...Post
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
#import "~/.queries/fragments/NodeWithExcerpt.fragment.gql";
|
|
2
|
-
#import '~/.queries/fragments/ContentNode.fragment.gql';
|
|
3
|
-
#import '~/.queries/fragments/NodeWithFeaturedImage.fragment.gql';
|
|
4
|
-
#import '~/.queries/fragments/NodeWithContentEditor.fragment.gql';
|
|
5
|
-
|
|
6
1
|
fragment Post on Post {
|
|
7
2
|
...NodeWithExcerpt
|
|
8
3
|
...ContentNode
|
|
9
4
|
...NodeWithFeaturedImage
|
|
10
5
|
...NodeWithContentEditor
|
|
11
6
|
title
|
|
7
|
+
categories {
|
|
8
|
+
nodes {
|
|
9
|
+
id
|
|
10
|
+
name
|
|
11
|
+
uri
|
|
12
|
+
description
|
|
13
|
+
}
|
|
14
|
+
}
|
|
12
15
|
}
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineGraphqlServerOptions } from "nuxt-graphql-middleware/server-options";
|
|
2
|
+
import { getHeader } from "h3";
|
|
3
|
+
export default defineGraphqlServerOptions({
|
|
4
|
+
async serverFetchOptions(event, _operation, _operationName, _context) {
|
|
5
|
+
return {
|
|
6
|
+
headers: {
|
|
7
|
+
// Forward WordPress auth cookies for previews
|
|
8
|
+
Cookie: getHeader(event, "cookie") || "",
|
|
9
|
+
// Forward authorization header if present
|
|
10
|
+
Authorization: getHeader(event, "authorization") || ""
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
async onServerError(event, error, _operation, operationName) {
|
|
15
|
+
const url = event.node.req.url || "unknown";
|
|
16
|
+
console.error(`[WPNuxt] GraphQL error in ${operationName} (${url}):`, error.message);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type stubs for Nuxt-generated imports.
|
|
3
|
+
* These are used during module development when .nuxt folder doesn't exist.
|
|
4
|
+
* Actual types are generated at runtime in consuming applications.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
|
|
9
|
+
// Stub for #imports
|
|
10
|
+
export const computed: any
|
|
11
|
+
export const useAsyncGraphqlQuery: any
|
|
12
|
+
export const useGraphqlState: any
|
|
13
|
+
export const useRuntimeConfig: any
|
|
14
|
+
export const useRoute: any
|
|
15
|
+
|
|
16
|
+
// Stub for #nuxt-graphql-middleware/operation-types
|
|
17
|
+
export type Query = Record<string, any>
|
|
18
|
+
|
|
19
|
+
// Stub for #build/graphql-operations
|
|
20
|
+
export type PostFragment = any
|
|
21
|
+
export type PageFragment = any
|
|
22
|
+
export type MenuItemFragment = any
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
const getRelativeImagePath = function getRelativeImagePath2(imgUrl) {
|
|
2
|
-
if (imgUrl) {
|
|
2
|
+
if (!imgUrl || typeof imgUrl !== "string") {
|
|
3
|
+
return "";
|
|
4
|
+
}
|
|
5
|
+
try {
|
|
3
6
|
const url = new URL(imgUrl);
|
|
4
|
-
|
|
7
|
+
return url.pathname;
|
|
8
|
+
} catch {
|
|
9
|
+
if (imgUrl.startsWith("/")) {
|
|
10
|
+
return imgUrl;
|
|
11
|
+
}
|
|
12
|
+
console.warn(`WPNuxt: Invalid image URL provided: ${imgUrl}`);
|
|
13
|
+
return "";
|
|
5
14
|
}
|
|
6
|
-
return imgUrl;
|
|
7
15
|
};
|
|
8
16
|
export { getRelativeImagePath };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineGraphqlServerOptions } from 'nuxt-graphql-middleware/server-options';
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NuxtModule } from '@nuxt/schema'
|
|
2
2
|
|
|
3
|
-
import type { default as Module } from './module.
|
|
3
|
+
import type { default as Module } from './module.mjs'
|
|
4
4
|
|
|
5
5
|
export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
|
|
6
6
|
|
|
7
|
-
export { default } from './module.
|
|
7
|
+
export { default } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,104 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wpnuxt/core",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
|
+
"description": "Nuxt module for WordPress integration via GraphQL (WPGraphQL)",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"nuxt",
|
|
7
|
+
"nuxt-module",
|
|
8
|
+
"wordpress",
|
|
9
|
+
"graphql",
|
|
10
|
+
"wpgraphql",
|
|
11
|
+
"headless-cms",
|
|
12
|
+
"headless-wordpress",
|
|
13
|
+
"vue",
|
|
14
|
+
"typescript"
|
|
15
|
+
],
|
|
5
16
|
"repository": {
|
|
6
17
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/wpnuxt/wpnuxt
|
|
18
|
+
"url": "git+https://github.com/wpnuxt/wpnuxt.git",
|
|
19
|
+
"directory": "packages/core"
|
|
8
20
|
},
|
|
9
21
|
"license": "MIT",
|
|
10
22
|
"type": "module",
|
|
11
23
|
"exports": {
|
|
12
24
|
".": {
|
|
13
|
-
"types": "./dist/types.d.
|
|
14
|
-
"import": "./dist/module.mjs"
|
|
15
|
-
|
|
25
|
+
"types": "./dist/types.d.mts",
|
|
26
|
+
"import": "./dist/module.mjs"
|
|
27
|
+
},
|
|
28
|
+
"./server-options": {
|
|
29
|
+
"types": "./dist/server-options.d.mts",
|
|
30
|
+
"import": "./dist/server-options.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./client-options": {
|
|
33
|
+
"types": "./dist/client-options.d.mts",
|
|
34
|
+
"import": "./dist/client-options.mjs"
|
|
16
35
|
}
|
|
17
36
|
},
|
|
18
|
-
"main": "./dist/module.
|
|
19
|
-
"types": "./dist/types.d.
|
|
37
|
+
"main": "./dist/module.mjs",
|
|
38
|
+
"types": "./dist/types.d.mts",
|
|
20
39
|
"files": [
|
|
21
40
|
"dist"
|
|
22
41
|
],
|
|
23
42
|
"publishConfig": {
|
|
24
43
|
"access": "public"
|
|
25
44
|
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "nuxt-module-build build && pnpm build:web-types",
|
|
28
|
-
"build:web-types": "vue-docgen-web-types src/runtime/components/ ./dist/web-types.json",
|
|
29
|
-
"prepare": "nuxi prepare .",
|
|
30
|
-
"prepack": "nuxt-module-build build",
|
|
31
|
-
"generate": "pnpm --filter ./playground/ run generate",
|
|
32
|
-
"dev": "pnpm --filter ./playground/ run dev --host app.local",
|
|
33
|
-
"dev:build": "pnpm --filter ./playground/ run build",
|
|
34
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
35
|
-
"lint": "eslint .",
|
|
36
|
-
"lint:fix": "eslint . --fix",
|
|
37
|
-
"lint:docs": "markdownlint ./docs && case-police 'docs/**/*.md' *.md",
|
|
38
|
-
"lint:docs:fix": "markdownlint ./docs --fix && case-police 'docs/**/*.md' *.md --fix",
|
|
39
|
-
"test": "vitest run",
|
|
40
|
-
"test:watch": "vitest watch",
|
|
41
|
-
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
42
|
-
"coverage": "vitest run --coverage",
|
|
43
|
-
"typecheck": "vue-tsc --noEmit",
|
|
44
|
-
"typecheck:docs": "DOCS_TYPECHECK=true pnpm nuxi prepare && nuxt-content-twoslash verify --content-dir docs",
|
|
45
|
-
"release": "pnpm run lint && pnpm run prepack; release-it --git.tagExclude='*[-edge]*'",
|
|
46
|
-
"release-edge": "pnpm run lint && pnpm run prepack; release-it --preRelease=edge --config .release-it-edge.json",
|
|
47
|
-
"wp:cli": "docker-compose up wordpress-cli",
|
|
48
|
-
"wp:stop": "docker-compose down",
|
|
49
|
-
"wp:delete": "docker-compose down --volumes --remove-orphans --rmi local && rm -rf ./wordpress/files",
|
|
50
|
-
"wp-env": "wp-env",
|
|
51
|
-
"wp-env:create": "wp-env start --update && ./wordpress/wp-env-cli.sh",
|
|
52
|
-
"start": "pnpm run wp-env:create && pnpm run dev"
|
|
53
|
-
},
|
|
54
45
|
"dependencies": {
|
|
55
|
-
"@nuxt/kit": "
|
|
56
|
-
"@
|
|
46
|
+
"@nuxt/kit": "4.2.2",
|
|
47
|
+
"@radya/nuxt-dompurify": "^1.0.5",
|
|
57
48
|
"defu": "^6.1.4",
|
|
58
|
-
"graphql": "^16.
|
|
59
|
-
"nuxt-graphql-middleware": "
|
|
60
|
-
"
|
|
61
|
-
"unstorage": "^1.10.2",
|
|
62
|
-
"vue-sanitize-directive": "^0.2.1"
|
|
49
|
+
"graphql": "^16.12.0",
|
|
50
|
+
"nuxt-graphql-middleware": "5.3.1",
|
|
51
|
+
"scule": "^1.3.0"
|
|
63
52
|
},
|
|
64
53
|
"devDependencies": {
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@nuxt/
|
|
69
|
-
"@
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"@rollup/rollup-linux-arm64-gnu": "^4.20.0",
|
|
74
|
-
"@rollup/rollup-linux-arm64-musl": "^4.20.0",
|
|
75
|
-
"@types/node": "22.4.1",
|
|
76
|
-
"@vitest/coverage-v8": "^2.0.5",
|
|
77
|
-
"@vue/test-utils": "^2.4.6",
|
|
78
|
-
"@wordpress/env": "^10.5.0",
|
|
79
|
-
"changelogen": "^0.5.5",
|
|
80
|
-
"markdownlint-cli": "^0.41.0",
|
|
81
|
-
"nuxt": "^3.12.4",
|
|
82
|
-
"nuxt-content-twoslash": "^0.1.1",
|
|
83
|
-
"release-it": "^17.6.0",
|
|
84
|
-
"shiki": "^1.13.0",
|
|
85
|
-
"twoslash": "^0.2.9",
|
|
86
|
-
"typescript": "^5.5.4",
|
|
87
|
-
"untyped": "1.4.2",
|
|
88
|
-
"vite": "^5.4.1",
|
|
89
|
-
"vitest": "^2.0.5",
|
|
90
|
-
"vue-docgen-web-types": "^0.1.8",
|
|
91
|
-
"vue-tsc": "2.0.29"
|
|
54
|
+
"@nuxt/devtools": "^3.1.1",
|
|
55
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
56
|
+
"@nuxt/schema": "4.2.2",
|
|
57
|
+
"@nuxt/test-utils": "^3.21.0",
|
|
58
|
+
"@types/node": "^25.0.3",
|
|
59
|
+
"nuxt": "4.2.2",
|
|
60
|
+
"vitest": "^4.0.16",
|
|
61
|
+
"vue-tsc": "^3.2.1"
|
|
92
62
|
},
|
|
93
63
|
"peerDependencies": {
|
|
94
|
-
"
|
|
95
|
-
"graphql": "^16.9.0",
|
|
96
|
-
"knitwork": "^1.1.0",
|
|
97
|
-
"pathe": "^1.1.2",
|
|
98
|
-
"scule": "^1.3.0"
|
|
64
|
+
"nuxt": "^4.0.0"
|
|
99
65
|
},
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
"
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "nuxt-module-build build",
|
|
68
|
+
"dev:prepare": "nuxt-module-build build --stub",
|
|
69
|
+
"lint": "eslint src",
|
|
70
|
+
"test": "vitest run",
|
|
71
|
+
"test:watch": "vitest watch",
|
|
72
|
+
"typecheck": "vue-tsc --noEmit",
|
|
73
|
+
"clean": "rm -rf dist .nuxt node_modules"
|
|
103
74
|
}
|
|
104
|
-
}
|
|
75
|
+
}
|
package/README.md
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
This module is still being developed and not ready for production usage yet.
|
|
3
|
-
There will be many smaller alpha releases the coming weeks, often with breaking changes.
|
|
4
|
-
|
|
5
|
-
I am working towards a stable release. And will inform about it here
|
|
6
|
-
|
|
7
|
-
# WPNuxt
|
|
8
|
-
|
|
9
|
-
[![npm version][npm-version-src]][npm-version-href]
|
|
10
|
-
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
11
|
-
[![License][license-src]][license-href]
|
|
12
|
-
[![Nuxt][nuxt-src]][nuxt-href]
|
|
13
|
-
|
|
14
|
-
Nuxt module for using WordPress as a headless CMS with a Nuxt 3 frontend
|
|
15
|
-
|
|
16
|
-
- [✨ Release Notes](/CHANGELOG.md)
|
|
17
|
-
- [🏀 Online playground](https://stackblitz.com/github/wpnuxt/wpnuxt-core?file=playground%2Fapp%2Fpages%2Findex.vue)
|
|
18
|
-
- [📖 Documentation](https://wpnuxt.com)
|
|
19
|
-
|
|
20
|
-
## Features
|
|
21
|
-
|
|
22
|
-
- Content is fetched from WordPress using server-side GraphQL api calls
|
|
23
|
-
- Support for (Gutenberg Blocks) by adding the separate [@wpnuxt/blocks](https://github.com/wpnuxt/wpnuxt-blocks), which uses WPEngine's [wp-graphql-content-blocks](https://faustjs.org/tutorial/get-started-with-wp-graphql-content-blocks) and a set of custom vue components
|
|
24
|
-
|
|
25
|
-
## Quick Setup
|
|
26
|
-
|
|
27
|
-
Install the module to your Nuxt application with one command:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npx nuxi module add @wpnuxt/core
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
And connect WPNuxt to your wordpress installation in your nuxt.config.ts:
|
|
34
|
-
|
|
35
|
-
```json
|
|
36
|
-
wpNuxt: {
|
|
37
|
-
wordpressUrl: 'https://yourwordpress.domain.com'
|
|
38
|
-
},
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
That's it! You can now use the WPNuxt module in your Nuxt app ✨
|
|
42
|
-
|
|
43
|
-
## Development
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
# Install dependencies
|
|
47
|
-
pnpm install
|
|
48
|
-
|
|
49
|
-
# Generate type stubs
|
|
50
|
-
pnpm run dev:prepare
|
|
51
|
-
|
|
52
|
-
# Develop with the playground
|
|
53
|
-
pnpm run dev
|
|
54
|
-
|
|
55
|
-
# Build the playground
|
|
56
|
-
pnpm run dev:build
|
|
57
|
-
|
|
58
|
-
# Run ESLint
|
|
59
|
-
pnpm run lint
|
|
60
|
-
|
|
61
|
-
# Run Vitest
|
|
62
|
-
pnpm run test
|
|
63
|
-
pnpm run test:watch
|
|
64
|
-
|
|
65
|
-
# Release new version
|
|
66
|
-
pnpm run release
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
<!-- Badges -->
|
|
70
|
-
[npm-version-src]: https://img.shields.io/npm/v/@vernaillen/wpnuxt/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
71
|
-
[npm-version-href]: https://www.npmjs.com/package/@vernaillen/wpnuxt
|
|
72
|
-
|
|
73
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/@vernaillen/wpnuxt.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
74
|
-
[npm-downloads-href]: https://www.npmjs.com/package/@vernaillen/wpnuxt
|
|
75
|
-
|
|
76
|
-
[license-src]: https://img.shields.io/npm/l/@vernaillen/wpnuxt?style=flat&colorA=18181B&colorB=28CF8D
|
|
77
|
-
[license-href]: https://www.npmjs.com/package/@vernaillen/wpnuxt
|
|
78
|
-
|
|
79
|
-
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
|
|
80
|
-
[nuxt-href]: https://nuxt.com
|
package/dist/module.cjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { defineGraphqlServerOptions } from "nuxt-graphql-middleware/dist/runtime/serverOptions";
|
|
2
|
-
import { getHeader } from "h3";
|
|
3
|
-
export default defineGraphqlServerOptions({
|
|
4
|
-
serverFetchOptions(event) {
|
|
5
|
-
return {
|
|
6
|
-
headers: {
|
|
7
|
-
Authorization: getHeader(event, "Authorization")
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
});
|