@wpnuxt/core 1.0.0-edge.8 → 2.0.0-alpha.1

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.
Files changed (68) hide show
  1. package/dist/client-options.d.mts +1 -0
  2. package/dist/client-options.d.ts +1 -0
  3. package/dist/client-options.mjs +1 -0
  4. package/dist/module.d.mts +72 -82
  5. package/dist/module.d.ts +72 -82
  6. package/dist/module.json +4 -5
  7. package/dist/module.mjs +431 -268
  8. package/dist/runtime/app/graphqlMiddleware.clientOptions.d.ts +0 -0
  9. package/dist/runtime/app/graphqlMiddleware.clientOptions.js +12 -0
  10. package/dist/runtime/components/WPNuxtLogo.d.vue.ts +0 -0
  11. package/dist/runtime/components/WPNuxtLogo.vue +7 -7
  12. package/dist/runtime/components/WPNuxtLogo.vue.d.ts +0 -0
  13. package/dist/runtime/composables/useWPContent.d.ts +0 -5
  14. package/dist/runtime/composables/useWPContent.js +30 -16
  15. package/dist/runtime/plugins/graphqlConfig.d.ts +0 -0
  16. package/dist/runtime/plugins/graphqlConfig.js +17 -0
  17. package/dist/runtime/plugins/graphqlErrors.d.ts +0 -0
  18. package/dist/runtime/plugins/graphqlErrors.js +9 -0
  19. package/dist/runtime/queries/GeneralSettings.gql +0 -2
  20. package/dist/runtime/queries/Menu.gql +0 -2
  21. package/dist/runtime/queries/Node.gql +0 -3
  22. package/dist/runtime/queries/Pages.gql +0 -2
  23. package/dist/runtime/queries/Posts.gql +15 -2
  24. package/dist/runtime/queries/fragments/GeneralSettings.fragment.gql +1 -1
  25. package/dist/runtime/queries/fragments/NodeWithContentEditor.fragment.gql +3 -0
  26. package/dist/runtime/queries/fragments/NodeWithFeaturedImage.fragment.gql +0 -2
  27. package/dist/runtime/queries/fragments/NodeWithFeaturedImageToMediaItemConnectionEdge.fragment.gql +0 -2
  28. package/dist/runtime/queries/fragments/Page.fragment.gql +1 -4
  29. package/dist/runtime/queries/fragments/Post.fragment.gql +9 -5
  30. package/dist/runtime/server/graphqlMiddleware.serverOptions.d.ts +0 -0
  31. package/dist/runtime/server/graphqlMiddleware.serverOptions.js +18 -0
  32. package/dist/runtime/server/tsconfig.json +3 -0
  33. package/dist/runtime/util/images.d.ts +0 -2
  34. package/dist/runtime/util/images.js +11 -3
  35. package/dist/server-options.d.mts +2 -0
  36. package/dist/server-options.d.ts +2 -0
  37. package/dist/server-options.mjs +1 -0
  38. package/dist/types.d.mts +2 -2
  39. package/package.json +50 -79
  40. package/README.md +0 -80
  41. package/dist/module.cjs +0 -5
  42. package/dist/runtime/app/graphqlMiddleware.serverOptions.d.ts +0 -2
  43. package/dist/runtime/app/graphqlMiddleware.serverOptions.js +0 -11
  44. package/dist/runtime/components/StagingBanner.vue +0 -107
  45. package/dist/runtime/components/WordPressLogo.vue +0 -15
  46. package/dist/runtime/composables/index.d.ts +0 -3
  47. package/dist/runtime/composables/index.js +0 -3
  48. package/dist/runtime/composables/isStaging.d.ts +0 -1
  49. package/dist/runtime/composables/isStaging.js +0 -6
  50. package/dist/runtime/composables/useFeaturedImage.d.ts +0 -2
  51. package/dist/runtime/composables/useFeaturedImage.js +0 -7
  52. package/dist/runtime/composables/usePrevNextPost.d.ts +0 -4
  53. package/dist/runtime/composables/usePrevNextPost.js +0 -25
  54. package/dist/runtime/composables/useWPUri.d.ts +0 -8
  55. package/dist/runtime/composables/useWPUri.js +0 -23
  56. package/dist/runtime/plugins/vue-sanitize-directive.d.ts +0 -2
  57. package/dist/runtime/plugins/vue-sanitize-directive.js +0 -5
  58. package/dist/runtime/server/api/purgeCache.get.d.ts +0 -5
  59. package/dist/runtime/server/api/purgeCache.get.js +0 -9
  60. package/dist/runtime/server/api/wpContent.post.d.ts +0 -9
  61. package/dist/runtime/server/api/wpContent.post.js +0 -50
  62. package/dist/runtime/server/index.d.ts +0 -1
  63. package/dist/runtime/server/index.js +0 -8
  64. package/dist/runtime/server/storage.d.ts +0 -3
  65. package/dist/runtime/server/storage.js +0 -11
  66. package/dist/runtime/util/logger.d.ts +0 -3
  67. package/dist/runtime/util/logger.js +0 -25
  68. package/dist/types.d.ts +0 -7
@@ -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 lang="ts">
2
- const props = defineProps<{
3
- wpColor?: string
4
- }>()
5
- const wpLight = props.wpColor ? props.wpColor : 'back'
6
- const wpDark = props.wpColor ? props.wpColor : 'white'
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:1.5rem;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{margin-top:-1px;--tw-text-opacity:1;color:rgb(186 175 78/var(--tw-text-opacity))}
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,5 +0,0 @@
1
- import type { FetchError } from 'ofetch';
2
- export declare const useWPContent: <T>(queryName: string, nodes: string[], fixImagePaths: boolean, params?: T) => Promise<{
3
- data: T;
4
- error: import("vue").Ref<FetchError<any> | null>;
5
- }>;
@@ -1,30 +1,44 @@
1
1
  import { getRelativeImagePath } from "../util/images.js";
2
- const _useWPContent = async (queryName, nodes, fixImagePaths, params) => {
3
- const { data, error } = await $fetch("/api/wpContent", {
4
- method: "POST",
5
- body: {
6
- queryName,
7
- params
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: transformData(data, nodes, fixImagePaths),
12
- error
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?.featuredImage?.node?.sourceUrl) {
18
- transformedData.featuredImage.node.relativePath = getRelativeImagePath(transformedData.featuredImage.node.sourceUrl);
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
- if (nodes.length > 0) {
25
- return nodes.reduce((acc, node) => {
38
+ return nodes.reduce((acc, node) => {
39
+ if (acc && typeof acc === "object" && node in acc) {
26
40
  return acc[node];
27
- }, data);
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/GeneralSettings.fragment.gql"
2
-
3
1
  query GeneralSettings {
4
2
  generalSettings {
5
3
  ...GeneralSettings
@@ -1,5 +1,3 @@
1
- #import "~/.queries/fragments/MenuItem.fragment.gql"
2
-
3
1
  query Menu($name: ID! = "main", $idType: MenuNodeIdTypeEnum! = NAME) {
4
2
  menu(id: $name, idType: $idType) {
5
3
  menuItems {
@@ -1,6 +1,3 @@
1
- #import "~/.queries/fragments/Page.fragment.gql"
2
- #import "~/.queries/fragments/Post.fragment.gql"
3
-
4
1
  query NodeByUri($uri: String!) {
5
2
  nodeByUri(uri: $uri) {
6
3
  ...Page
@@ -1,5 +1,3 @@
1
- #import "~/.queries/fragments/Page.fragment.gql"
2
-
3
1
  query Pages($limit: Int = 10) {
4
2
  pages(first: $limit) {
5
3
  nodes {
@@ -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
+ }
@@ -2,10 +2,10 @@ fragment GeneralSettings on GeneralSettings {
2
2
  title
3
3
  description
4
4
  url
5
- email
6
5
  dateFormat
7
6
  language
8
7
  startOfWeek
9
8
  timezone
10
9
  timeFormat
10
+ email
11
11
  }
@@ -0,0 +1,3 @@
1
+ fragment NodeWithContentEditor on NodeWithContentEditor {
2
+ content
3
+ }
@@ -1,5 +1,3 @@
1
- #import '~/.queries/fragments/NodeWithFeaturedImageToMediaItemConnectionEdge.fragment.gql';
2
-
3
1
  fragment NodeWithFeaturedImage on NodeWithFeaturedImage {
4
2
  featuredImage {
5
3
  ...NodeWithFeaturedImageToMediaItemConnectionEdge
@@ -1,5 +1,3 @@
1
- #import '~/.queries/fragments/MediaItem.fragment.gql';
2
-
3
1
  fragment NodeWithFeaturedImageToMediaItemConnectionEdge on NodeWithFeaturedImageToMediaItemConnectionEdge {
4
2
  cursor
5
3
  node {
@@ -1,10 +1,7 @@
1
- #import '~/.queries/fragments/ContentNode.fragment.gql';
2
- #import '~/.queries/fragments/NodeWithFeaturedImage.fragment.gql';
3
-
4
1
  fragment Page on Page {
5
2
  ...ContentNode
6
3
  ...NodeWithFeaturedImage
7
- content
4
+ ...NodeWithContentEditor
8
5
  isFrontPage
9
6
  isPostsPage
10
7
  isPreview
@@ -1,11 +1,15 @@
1
- #import "~/.queries/fragments/NodeWithExcerpt.fragment.gql";
2
- #import '~/.queries/fragments/ContentNode.fragment.gql';
3
- #import '~/.queries/fragments/NodeWithFeaturedImage.fragment.gql';
4
-
5
1
  fragment Post on Post {
6
2
  ...NodeWithExcerpt
7
3
  ...ContentNode
8
4
  ...NodeWithFeaturedImage
9
- content
5
+ ...NodeWithContentEditor
10
6
  title
7
+ categories {
8
+ nodes {
9
+ id
10
+ name
11
+ uri
12
+ description
13
+ }
14
+ }
11
15
  }
@@ -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,3 @@
1
+ {
2
+ "extends": "../../../.nuxt/tsconfig.server.json"
3
+ }
@@ -1,2 +0,0 @@
1
- declare const getRelativeImagePath: (imgUrl: string) => string;
2
- export { getRelativeImagePath };
@@ -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
- imgUrl = url.pathname;
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,2 @@
1
+ export { defineGraphqlServerOptions } from 'nuxt-graphql-middleware/server-options';
2
+ import 'nuxt-graphql-middleware/client-options';
@@ -0,0 +1,2 @@
1
+ export { defineGraphqlServerOptions } from 'nuxt-graphql-middleware/server-options';
2
+ import 'nuxt-graphql-middleware/client-options';
@@ -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.js'
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.js'
7
+ export { default } from './module.mjs'
package/package.json CHANGED
@@ -1,104 +1,75 @@
1
1
  {
2
2
  "name": "@wpnuxt/core",
3
- "version": "1.0.0-edge.8",
4
- "description": "WPNuxt",
3
+ "version": "2.0.0-alpha.1",
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-core.git"
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.ts",
14
- "import": "./dist/module.mjs",
15
- "require": "./dist/module.cjs"
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.cjs",
19
- "types": "./dist/types.d.ts",
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": "3.12.4",
56
- "@vueuse/nuxt": "^11.0.0",
46
+ "@nuxt/kit": "4.2.2",
47
+ "@radya/nuxt-dompurify": "^1.0.5",
57
48
  "defu": "^6.1.4",
58
- "graphql": "^16.9.0",
59
- "nuxt-graphql-middleware": "4.1.1",
60
- "ohash": "^1.1.3",
61
- "unstorage": "^1.10.2",
62
- "vue-sanitize-directive": "^0.2.1"
49
+ "graphql": "^16.12.0",
50
+ "nuxt-graphql-middleware": "5.3.0",
51
+ "scule": "^1.3.0"
63
52
  },
64
53
  "devDependencies": {
65
- "@graphql-codegen/cli": "^5.0.2",
66
- "@graphql-codegen/client-preset": "^4.3.3",
67
- "@graphql-codegen/typescript-operations": "^4.2.3",
68
- "@nuxt/devtools": "^1.3.9",
69
- "@nuxt/eslint-config": "^0.5.0",
70
- "@nuxt/module-builder": "^0.8.3",
71
- "@nuxt/schema": "3.12.4",
72
- "@nuxt/test-utils": "^3.14.1",
73
- "@rollup/rollup-linux-arm64-gnu": "^4.20.0",
74
- "@rollup/rollup-linux-arm64-musl": "^4.20.0",
75
- "@types/node": "22.3.0",
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
- "consola": "^3.2.3",
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
- "packageManager": "pnpm@9.7.0",
101
- "engines": {
102
- "node": ">=18"
66
+ "scripts": {
67
+ "build": "nuxt-module-build build",
68
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare",
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
- - [✨ &nbsp;Release Notes](/CHANGELOG.md)
17
- - [🏀 Online playground](https://stackblitz.com/github/wpnuxt/wpnuxt-core?file=playground%2Fapp%2Fpages%2Findex.vue)
18
- - [📖 &nbsp;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,5 +0,0 @@
1
- module.exports = function(...args) {
2
- return import('./module.mjs').then(m => m.default.call(this, ...args))
3
- }
4
- const _meta = module.exports.meta = require('./module.json')
5
- module.exports.getMeta = () => Promise.resolve(_meta)
@@ -1,2 +0,0 @@
1
- declare const _default: import("nuxt-graphql-middleware").GraphqlMiddlewareServerOptions<object>;
2
- export default _default;
@@ -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
- });