@wpnuxt/core 1.0.0-edge.10

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 (59) hide show
  1. package/README.md +80 -0
  2. package/dist/module.cjs +5 -0
  3. package/dist/module.d.mts +89 -0
  4. package/dist/module.d.ts +89 -0
  5. package/dist/module.json +10 -0
  6. package/dist/module.mjs +345 -0
  7. package/dist/runtime/app/graphqlMiddleware.serverOptions.d.ts +2 -0
  8. package/dist/runtime/app/graphqlMiddleware.serverOptions.js +11 -0
  9. package/dist/runtime/components/ContentRenderer.vue +13 -0
  10. package/dist/runtime/components/StagingBanner.vue +107 -0
  11. package/dist/runtime/components/WPContent.vue +26 -0
  12. package/dist/runtime/components/WPNuxtLogo.vue +17 -0
  13. package/dist/runtime/components/WordPressLogo.vue +15 -0
  14. package/dist/runtime/composables/index.d.ts +3 -0
  15. package/dist/runtime/composables/index.js +3 -0
  16. package/dist/runtime/composables/isStaging.d.ts +1 -0
  17. package/dist/runtime/composables/isStaging.js +6 -0
  18. package/dist/runtime/composables/useFeaturedImage.d.ts +2 -0
  19. package/dist/runtime/composables/useFeaturedImage.js +7 -0
  20. package/dist/runtime/composables/usePrevNextPost.d.ts +4 -0
  21. package/dist/runtime/composables/usePrevNextPost.js +25 -0
  22. package/dist/runtime/composables/useWPContent.d.ts +5 -0
  23. package/dist/runtime/composables/useWPContent.js +30 -0
  24. package/dist/runtime/composables/useWPUri.d.ts +8 -0
  25. package/dist/runtime/composables/useWPUri.js +23 -0
  26. package/dist/runtime/plugins/vue-sanitize-directive.d.ts +2 -0
  27. package/dist/runtime/plugins/vue-sanitize-directive.js +5 -0
  28. package/dist/runtime/queries/GeneralSettings.gql +7 -0
  29. package/dist/runtime/queries/Menu.gql +11 -0
  30. package/dist/runtime/queries/Node.gql +9 -0
  31. package/dist/runtime/queries/Pages.gql +19 -0
  32. package/dist/runtime/queries/Posts.gql +19 -0
  33. package/dist/runtime/queries/Revisions.gql +9 -0
  34. package/dist/runtime/queries/Viewer.gql +14 -0
  35. package/dist/runtime/queries/fragments/ContentNode.fragment.gql +28 -0
  36. package/dist/runtime/queries/fragments/GeneralSettings.fragment.gql +11 -0
  37. package/dist/runtime/queries/fragments/MediaItem.fragment.gql +52 -0
  38. package/dist/runtime/queries/fragments/MenuItem.fragment.gql +4 -0
  39. package/dist/runtime/queries/fragments/NodeWithContentEditor.fragment.gql +3 -0
  40. package/dist/runtime/queries/fragments/NodeWithExcerpt.fragment.gql +3 -0
  41. package/dist/runtime/queries/fragments/NodeWithFeaturedImage.fragment.gql +10 -0
  42. package/dist/runtime/queries/fragments/NodeWithFeaturedImageToMediaItemConnectionEdge.fragment.gql +8 -0
  43. package/dist/runtime/queries/fragments/Page.fragment.gql +16 -0
  44. package/dist/runtime/queries/fragments/Post.fragment.gql +12 -0
  45. package/dist/runtime/server/api/purgeCache.get.d.ts +5 -0
  46. package/dist/runtime/server/api/purgeCache.get.js +9 -0
  47. package/dist/runtime/server/api/wpContent.post.d.ts +9 -0
  48. package/dist/runtime/server/api/wpContent.post.js +50 -0
  49. package/dist/runtime/server/index.d.ts +1 -0
  50. package/dist/runtime/server/index.js +8 -0
  51. package/dist/runtime/server/storage.d.ts +3 -0
  52. package/dist/runtime/server/storage.js +11 -0
  53. package/dist/runtime/util/images.d.ts +2 -0
  54. package/dist/runtime/util/images.js +8 -0
  55. package/dist/runtime/util/logger.d.ts +3 -0
  56. package/dist/runtime/util/logger.js +25 -0
  57. package/dist/types.d.mts +7 -0
  58. package/dist/types.d.ts +7 -0
  59. package/package.json +104 -0
@@ -0,0 +1 @@
1
+ export declare function usePosts(): Promise<unknown>;
@@ -0,0 +1,8 @@
1
+ export function usePosts() {
2
+ return $fetch("/api/wpContent", {
3
+ method: "POST",
4
+ body: {
5
+ queryName: "Posts"
6
+ }
7
+ });
8
+ }
@@ -0,0 +1,3 @@
1
+ import { type Storage } from 'unstorage';
2
+ export declare const cacheStorage: Storage;
3
+ export declare const purgeCache: () => Promise<void>;
@@ -0,0 +1,11 @@
1
+ import { prefixStorage } from "unstorage";
2
+ import { useLogger } from "../util/logger.js";
3
+ import { useStorage } from "#imports";
4
+ export const cacheStorage = prefixStorage(useStorage(), "cache:wpnuxt-content");
5
+ export const purgeCache = async () => {
6
+ const keys = await cacheStorage.getKeys("cache:wpnuxt-content");
7
+ keys.forEach(async (key) => {
8
+ await cacheStorage.removeItem(key);
9
+ });
10
+ useLogger().info("ServerSide cache purged!");
11
+ };
@@ -0,0 +1,2 @@
1
+ declare const getRelativeImagePath: (imgUrl: string) => string;
2
+ export { getRelativeImagePath };
@@ -0,0 +1,8 @@
1
+ const getRelativeImagePath = function getRelativeImagePath2(imgUrl) {
2
+ if (imgUrl) {
3
+ const url = new URL(imgUrl);
4
+ imgUrl = url.pathname;
5
+ }
6
+ return imgUrl;
7
+ };
8
+ export { getRelativeImagePath };
@@ -0,0 +1,3 @@
1
+ import { type LogLevel } from 'consola';
2
+ export declare const useLogger: () => any;
3
+ export declare const initLogger: (logLevel: LogLevel | undefined) => any;
@@ -0,0 +1,25 @@
1
+ import { createConsola } from "consola";
2
+ import { ref } from "vue";
3
+ import { useRuntimeConfig } from "#imports";
4
+ const loggerRef = ref();
5
+ export const useLogger = () => {
6
+ const logger = loggerRef.value;
7
+ if (logger) {
8
+ return logger;
9
+ } else {
10
+ const config = useRuntimeConfig();
11
+ return initLogger(config.public.wpNuxt.logLevel ? config.public.wpNuxt.logLevel : 3);
12
+ }
13
+ };
14
+ export const initLogger = (logLevel) => {
15
+ loggerRef.value = createConsola({
16
+ level: logLevel ? logLevel : 3,
17
+ formatOptions: {
18
+ colors: true,
19
+ compact: true,
20
+ date: true,
21
+ fancy: true
22
+ }
23
+ }).withTag("wpnuxt");
24
+ return loggerRef.value;
25
+ };
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module.js'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { default } from './module.js'
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { default } from './module'
package/package.json ADDED
@@ -0,0 +1,104 @@
1
+ {
2
+ "name": "@wpnuxt/core",
3
+ "version": "1.0.0-edge.10",
4
+ "description": "WPNuxt",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/wpnuxt/wpnuxt-core.git"
8
+ },
9
+ "license": "MIT",
10
+ "type": "module",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/types.d.ts",
14
+ "import": "./dist/module.mjs",
15
+ "require": "./dist/module.cjs"
16
+ }
17
+ },
18
+ "main": "./dist/module.cjs",
19
+ "types": "./dist/types.d.ts",
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
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
+ "dependencies": {
55
+ "@nuxt/kit": "3.12.4",
56
+ "@vueuse/nuxt": "^11.0.0",
57
+ "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"
63
+ },
64
+ "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.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"
92
+ },
93
+ "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"
99
+ },
100
+ "packageManager": "pnpm@9.7.0",
101
+ "engines": {
102
+ "node": ">=18"
103
+ }
104
+ }