@wpnuxt/core 2.0.0-alpha.11 → 2.0.0-alpha.13
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 +10 -1
- package/dist/runtime/components/WPContent.vue +3 -2
- package/package.json +1 -3
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { parse, GraphQLError } from 'graphql';
|
|
|
9
9
|
import { execSync } from 'node:child_process';
|
|
10
10
|
import { consola } from 'consola';
|
|
11
11
|
|
|
12
|
-
const version = "2.0.0-alpha.
|
|
12
|
+
const version = "2.0.0-alpha.13";
|
|
13
13
|
|
|
14
14
|
function createModuleError(module, message) {
|
|
15
15
|
return new Error(formatErrorMessage(module, message));
|
|
@@ -808,6 +808,11 @@ const module$1 = defineNuxtModule({
|
|
|
808
808
|
async setup(options, nuxt) {
|
|
809
809
|
const startTime = (/* @__PURE__ */ new Date()).getTime();
|
|
810
810
|
const wpNuxtConfig = loadConfig(options, nuxt);
|
|
811
|
+
if (!wpNuxtConfig) {
|
|
812
|
+
const logger2 = initLogger(false);
|
|
813
|
+
logger2.warn("WordPress URL not configured. Skipping WPNuxt setup. Set it in nuxt.config.ts or via WPNUXT_WORDPRESS_URL environment variable.");
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
811
816
|
const logger = initLogger(wpNuxtConfig.debug);
|
|
812
817
|
logger.debug("Starting WPNuxt in debug mode");
|
|
813
818
|
const resolver = createResolver(import.meta.url);
|
|
@@ -963,6 +968,7 @@ function loadConfig(options, nuxt) {
|
|
|
963
968
|
graphqlEndpoint: config.graphqlEndpoint,
|
|
964
969
|
replaceLinks: config.replaceLinks ?? true,
|
|
965
970
|
imageRelativePaths: config.imageRelativePaths ?? false,
|
|
971
|
+
hasBlocks: hasNuxtModule("@wpnuxt/blocks"),
|
|
966
972
|
cache: {
|
|
967
973
|
enabled: config.cache?.enabled ?? true,
|
|
968
974
|
maxAge: config.cache?.maxAge ?? 300,
|
|
@@ -970,6 +976,9 @@ function loadConfig(options, nuxt) {
|
|
|
970
976
|
}
|
|
971
977
|
};
|
|
972
978
|
if (!config.wordpressUrl?.trim()) {
|
|
979
|
+
if (nuxt.options._prepare) {
|
|
980
|
+
return null;
|
|
981
|
+
}
|
|
973
982
|
throw createModuleError("core", "WordPress URL is required. Set it in nuxt.config.ts or via WPNUXT_WORDPRESS_URL environment variable.");
|
|
974
983
|
}
|
|
975
984
|
if (config.wordpressUrl.endsWith("/")) {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { isInternalLink, toRelativePath } from "../util/links";
|
|
3
3
|
import { ref, resolveComponent, onMounted, onBeforeUnmount, useRuntimeConfig, navigateTo } from "#imports";
|
|
4
|
+
const wpNuxtConfig = useRuntimeConfig().public.wpNuxt;
|
|
5
|
+
const hasBlockRenderer = !!wpNuxtConfig?.hasBlocks;
|
|
6
|
+
const blockRenderer = hasBlockRenderer ? resolveComponent("BlockRenderer") : null;
|
|
4
7
|
const props = defineProps({
|
|
5
8
|
node: { type: Object, required: false, default: void 0 },
|
|
6
9
|
replaceLinks: { type: Boolean, required: false, default: void 0 }
|
|
7
10
|
});
|
|
8
11
|
const containerRef = ref(null);
|
|
9
|
-
const blockRenderer = resolveComponent("BlockRenderer");
|
|
10
|
-
const hasBlockRenderer = typeof blockRenderer !== "string";
|
|
11
12
|
function shouldReplaceLinks() {
|
|
12
13
|
if (props.replaceLinks !== void 0) {
|
|
13
14
|
return props.replaceLinks;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wpnuxt/core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.13",
|
|
4
4
|
"description": "Nuxt module for WordPress integration via GraphQL (WPGraphQL)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nuxt",
|
|
@@ -27,12 +27,10 @@
|
|
|
27
27
|
},
|
|
28
28
|
"./server-options": {
|
|
29
29
|
"types": "./dist/server-options.d.mts",
|
|
30
|
-
"development": "./src/server-options.ts",
|
|
31
30
|
"import": "./dist/server-options.mjs"
|
|
32
31
|
},
|
|
33
32
|
"./client-options": {
|
|
34
33
|
"types": "./dist/client-options.d.mts",
|
|
35
|
-
"development": "./src/client-options.ts",
|
|
36
34
|
"import": "./dist/client-options.mjs"
|
|
37
35
|
}
|
|
38
36
|
},
|