diff --git a/docs/tsconfig.json b/docs/tsconfig.json
index a746f2a..c09b41b 100644
--- a/docs/tsconfig.json
+++ b/docs/tsconfig.json
@@ -1,4 +1,9 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
- "extends": "./.nuxt/tsconfig.json"
+ "extends": "./.nuxt/tsconfig.json",
+ "exclude": [
+ "node_modules",
+ "dist",
+ ".nuxt",
+ ]
}
diff --git a/package.json b/package.json
index 104b8df..8ef3383 100644
--- a/package.json
+++ b/package.json
@@ -18,15 +18,16 @@
"dist"
],
"scripts": {
- "build": "npm run prepack",
+ "build": "nuxt-module-build build && pnpm build:web-types",
+ "build:web-types": "vue-docgen-web-types src/runtime/components/ ./dist/web-types.json",
"prepare": "nuxi prepare .",
"prepack": "nuxt-module-build build",
"generate": "pnpm --filter ./playground/ run generate",
"dev": "pnpm --filter ./playground/ run dev --host app.local",
"dev:build": "pnpm --filter ./playground/ run build",
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
- "release": "npm run lint && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
- "release:major": "npm run lint && npm run prepack && changelogen --release --major && npm publish && git push --follow-tags",
+ "release": "npm run lint && nuxi prepare && nuxt-module-build build && changelogen --release && pnpm publish && git push --follow-tags",
+ "release:major": "npm run lint && nuxi prepare && nuxt-module-build build && changelogen --release --major && pnpm publish && git push --follow-tags",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "vitest run",
@@ -72,6 +73,7 @@
"typescript": "^5.4.5",
"untyped": "1.4.2",
"vitest": "^1.6.0",
+ "vue-docgen-web-types": "^0.1.8",
"vue-tsc": "^2.0.16"
}
-}
\ No newline at end of file
+}
diff --git a/playground/app.vue b/playground/app.vue
index bd10267..5afcbce 100644
--- a/playground/app.vue
+++ b/playground/app.vue
@@ -1,63 +1,16 @@
-
-
- playground
-
-
-
-
- Staging
-
-
-
+
-
-
- a Proof of Concept by Wouter Vernaillen
-
-
+
diff --git a/playground/components/HeaderComponent.vue b/playground/components/HeaderComponent.vue
new file mode 100644
index 0000000..1127a05
--- /dev/null
+++ b/playground/components/HeaderComponent.vue
@@ -0,0 +1,36 @@
+
+
+
+
+
+ playground
+
+
+
+
+
+
diff --git a/playground/error.vue b/playground/error.vue
new file mode 100644
index 0000000..c6b3d29
--- /dev/null
+++ b/playground/error.vue
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/playground/pages/[...slug].vue b/playground/pages/[...slug].vue
index 5fd1026..eaffbf2 100644
--- a/playground/pages/[...slug].vue
+++ b/playground/pages/[...slug].vue
@@ -1,11 +1,15 @@
+
+
+
+
+ You should never see this
+ {{ post }}
+
+
+
diff --git a/playground/pages/index.vue b/playground/pages/index.vue
index 8b80d55..d5d5ea7 100644
--- a/playground/pages/index.vue
+++ b/playground/pages/index.vue
@@ -1,12 +1,11 @@
diff --git a/playground/pages/pages.vue b/playground/pages/pages.vue
new file mode 100644
index 0000000..ba80335
--- /dev/null
+++ b/playground/pages/pages.vue
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/playground/pages/test.vue b/playground/pages/test.vue
index fc7d3eb..1fd193c 100644
--- a/playground/pages/test.vue
+++ b/playground/pages/test.vue
@@ -1,10 +1,9 @@
@@ -67,15 +66,15 @@ if (post?.data?.title) {
- Edit {{ post.data.contentTypeName }}
+ Edit {{ post.contentTypeName }}
diff --git a/src/runtime/composables/useGeneralSettings.ts b/src/runtime/composables/useGeneralSettings.ts
index 128748d..34eb07c 100644
--- a/src/runtime/composables/useGeneralSettings.ts
+++ b/src/runtime/composables/useGeneralSettings.ts
@@ -1,7 +1,9 @@
+import type { FetchError } from 'ofetch'
import { getContentNodes } from './useWPContent'
import type { GeneralSettings } from '#graphql-operations'
+import type { AsyncData } from '#app'
-const _useGeneralSettings = async (): Promise => {
+const _useGeneralSettings = async (): Promise> => {
return getContentNodes('GeneralSettings', 'generalSettings')
}
diff --git a/src/runtime/composables/useMenu.ts b/src/runtime/composables/useMenu.ts
index ab285be..55adcf3 100644
--- a/src/runtime/composables/useMenu.ts
+++ b/src/runtime/composables/useMenu.ts
@@ -1,11 +1,13 @@
+import type { FetchError } from 'ofetch'
import { getContentNodes } from './useWPContent'
import { useRuntimeConfig } from '#imports'
import type { Menu } from '#graphql-operations'
+import type { AsyncData } from '#app'
-const _useMenu = async (name?: string): Promise