nuxt-schema-org 6.0.4 → 6.1.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.
- package/dist/content.d.cts +3 -1
- package/dist/content.d.mts +3 -1
- package/dist/content.d.ts +3 -1
- package/dist/devtools/200.html +1 -1
- package/dist/devtools/404.html +1 -1
- package/dist/devtools/_nuxt/B1DdtD2d.js +30 -0
- package/dist/devtools/_nuxt/{DSI_3olH.js → BOpHBWj1.js} +1 -1
- package/dist/devtools/_nuxt/{CjC_woKp.js → BdQEHo9i.js} +1 -1
- package/dist/devtools/_nuxt/CCjZBs6a.js +3 -0
- package/dist/devtools/_nuxt/CQr7N5ou.js +6 -0
- package/dist/devtools/_nuxt/{DDYa62Sg.js → Cy67RPmZ.js} +1 -1
- package/dist/devtools/_nuxt/D-Oj-loM.js +154 -0
- package/dist/devtools/_nuxt/{UdJJqUtQ.js → D6u4txBo.js} +1 -1
- package/dist/devtools/_nuxt/{DTHFUZxn.js → DKZUJ--l.js} +1 -1
- package/dist/devtools/_nuxt/DevtoolsSnippet.CuW0O0Zu.css +1 -0
- package/dist/devtools/_nuxt/builds/latest.json +1 -1
- package/dist/devtools/_nuxt/builds/meta/66c34cb5-802b-46d0-9839-01f4b2b94230.json +1 -0
- package/dist/devtools/_nuxt/entry.DprwPCib.css +2 -0
- package/dist/devtools/_nuxt/{pages.DptLZl6Y.css → pages.BpqfEWCe.css} +1 -1
- package/dist/devtools/debug/index.html +1 -1
- package/dist/devtools/docs/index.html +1 -1
- package/dist/devtools/index.html +1 -1
- package/dist/devtools/nodes/index.html +1 -1
- package/dist/devtools/raw/index.html +1 -1
- package/dist/module.cjs +38 -9
- package/dist/module.d.cts +2 -1
- package/dist/module.d.mts +2 -1
- package/dist/module.d.ts +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +33 -4
- package/dist/runtime/app/composables/useSchemaOrg.js +6 -3
- package/dist/runtime/app/utils/shared.js +14 -9
- package/dist/runtime/server/plugins/nuxt-content-v2.js +1 -1
- package/package.json +32 -28
- package/dist/devtools/_nuxt/B-pXgC-0.js +0 -154
- package/dist/devtools/_nuxt/BHnqSpjH.js +0 -6
- package/dist/devtools/_nuxt/BJm6aQik.js +0 -3
- package/dist/devtools/_nuxt/CEDNr6o1.js +0 -23
- package/dist/devtools/_nuxt/DevtoolsSnippet.C1FVWfrz.css +0 -1
- package/dist/devtools/_nuxt/builds/meta/f4cdc10a-a52c-414a-a9e2-977472d5a90b.json +0 -1
- package/dist/devtools/_nuxt/entry.D4aPXy2H.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script type="importmap">{"imports":{"#entry":"/__nuxt-schema-org/_nuxt/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script type="importmap">{"imports":{"#entry":"/__nuxt-schema-org/_nuxt/B1DdtD2d.js"}}</script><link rel="stylesheet" href="/__nuxt-schema-org/_nuxt/entry.DprwPCib.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-schema-org/_nuxt/B1DdtD2d.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-schema-org/_nuxt/CHHO6nw6.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-schema-org/_nuxt/CCjZBs6a.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-schema-org/_nuxt/D-Oj-loM.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-schema-org/_nuxt/CQr7N5ou.js"><script type="module" src="/__nuxt-schema-org/_nuxt/B1DdtD2d.js" crossorigin></script><script>"use strict";(()=>{const t=window,e=document.documentElement,c=["dark","light"],n=getStorageValue("localStorage","nuxt-color-mode")||"system";let i=n==="system"?u():n;const r=e.getAttribute("data-color-mode-forced");r&&(i=r),l(i),t["__NUXT_COLOR_MODE__"]={preference:n,value:i,getColorScheme:u,addColorScheme:l,removeColorScheme:d};function l(o){const s=""+o+"",a="";e.classList?e.classList.add(s):e.className+=" "+s,a&&e.setAttribute("data-"+a,o)}function d(o){const s=""+o+"",a="";e.classList?e.classList.remove(s):e.className=e.className.replace(new RegExp(s,"g"),""),a&&e.removeAttribute("data-"+a)}function f(o){return t.matchMedia("(prefers-color-scheme"+o+")")}function u(){if(t.matchMedia&&f("").media!=="not all"){for(const o of c)if(f(":"+o).matches)return o}return"light"}})();function getStorageValue(t,e){switch(t){case"localStorage":return window.localStorage.getItem(e);case"sessionStorage":return window.sessionStorage.getItem(e);case"cookie":return getCookie(e);default:return null}}function getCookie(t){const c=("; "+window.document.cookie).split("; "+t+"=");if(c.length===2)return c.pop()?.split(";").shift()}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-schema-org",buildId:"66c34cb5-802b-46d0-9839-01f4b2b94230",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1780888605293,false]</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script type="importmap">{"imports":{"#entry":"/__nuxt-schema-org/_nuxt/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script type="importmap">{"imports":{"#entry":"/__nuxt-schema-org/_nuxt/B1DdtD2d.js"}}</script><link rel="stylesheet" href="/__nuxt-schema-org/_nuxt/entry.DprwPCib.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-schema-org/_nuxt/B1DdtD2d.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-schema-org/_nuxt/CHHO6nw6.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-schema-org/_nuxt/CCjZBs6a.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-schema-org/_nuxt/D-Oj-loM.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-schema-org/_nuxt/CQr7N5ou.js"><script type="module" src="/__nuxt-schema-org/_nuxt/B1DdtD2d.js" crossorigin></script><script>"use strict";(()=>{const t=window,e=document.documentElement,c=["dark","light"],n=getStorageValue("localStorage","nuxt-color-mode")||"system";let i=n==="system"?u():n;const r=e.getAttribute("data-color-mode-forced");r&&(i=r),l(i),t["__NUXT_COLOR_MODE__"]={preference:n,value:i,getColorScheme:u,addColorScheme:l,removeColorScheme:d};function l(o){const s=""+o+"",a="";e.classList?e.classList.add(s):e.className+=" "+s,a&&e.setAttribute("data-"+a,o)}function d(o){const s=""+o+"",a="";e.classList?e.classList.remove(s):e.className=e.className.replace(new RegExp(s,"g"),""),a&&e.removeAttribute("data-"+a)}function f(o){return t.matchMedia("(prefers-color-scheme"+o+")")}function u(){if(t.matchMedia&&f("").media!=="not all"){for(const o of c)if(f(":"+o).matches)return o}return"light"}})();function getStorageValue(t,e){switch(t){case"localStorage":return window.localStorage.getItem(e);case"sessionStorage":return window.sessionStorage.getItem(e);case"cookie":return getCookie(e);default:return null}}function getCookie(t){const c=("; "+window.document.cookie).split("; "+t+"=");if(c.length===2)return c.pop()?.split(";").shift()}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-schema-org",buildId:"66c34cb5-802b-46d0-9839-01f4b2b94230",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1780888605293,false]</script></body></html>
|
package/dist/module.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const kit = require('@nuxt/kit');
|
|
4
|
-
const schemaOrg = require('@unhead/schema-org');
|
|
5
|
-
const vue = require('@unhead/schema-org/vue');
|
|
6
4
|
const defu = require('defu');
|
|
7
5
|
const kit$1 = require('nuxt-site-config/kit');
|
|
8
6
|
const pkgTypes = require('pkg-types');
|
|
@@ -19,6 +17,25 @@ function setupDevToolsUI(_options, resolve, nuxt = kit.useNuxt()) {
|
|
|
19
17
|
}, resolve, nuxt);
|
|
20
18
|
}
|
|
21
19
|
|
|
20
|
+
async function resolveHostUnheadMajor(rootDir) {
|
|
21
|
+
const url = rootDir.endsWith("/") ? rootDir : `${rootDir}/`;
|
|
22
|
+
for (const id of ["@unhead/vue", "unhead"]) {
|
|
23
|
+
const version = await pkgTypes.readPackageJSON(id, { url }).then((pkg) => pkg.version).catch(() => {
|
|
24
|
+
return void 0;
|
|
25
|
+
});
|
|
26
|
+
const major = version ? Number.parseInt(version, 10) : Number.NaN;
|
|
27
|
+
if (major === 2)
|
|
28
|
+
return 2;
|
|
29
|
+
if (Number.isFinite(major) && major >= 3)
|
|
30
|
+
return 3;
|
|
31
|
+
}
|
|
32
|
+
return 3;
|
|
33
|
+
}
|
|
34
|
+
function schemaOrgVendor(major) {
|
|
35
|
+
const pkg = major === 2 ? "@unhead/schema-org-v2" : "@unhead/schema-org";
|
|
36
|
+
return { main: pkg, vue: `${pkg}/vue` };
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
const module$1 = kit.defineNuxtModule({
|
|
23
40
|
meta: {
|
|
24
41
|
name: "nuxt-schema-org",
|
|
@@ -66,6 +83,18 @@ const module$1 = kit.defineNuxtModule({
|
|
|
66
83
|
}
|
|
67
84
|
if (!nuxt.options.ssr && nuxt.options.dev)
|
|
68
85
|
logger.warn("You are using Schema.org with SSR disabled. This is not recommended, Google may not detect your Schema.org, and it adds extra page weight");
|
|
86
|
+
const unheadMajor = await resolveHostUnheadMajor(nuxt.options.rootDir);
|
|
87
|
+
const vendor = schemaOrgVendor(unheadMajor);
|
|
88
|
+
const { defineWebPage } = await import(vendor.main);
|
|
89
|
+
const { schemaOrgAutoImports, schemaOrgComponents } = await import(vendor.vue);
|
|
90
|
+
if (vendor.main !== "@unhead/schema-org") {
|
|
91
|
+
logger.debug(`Detected unhead v${unheadMajor}, aliasing @unhead/schema-org -> ${vendor.main}`);
|
|
92
|
+
nuxt.options.alias["@unhead/schema-org"] = vendor.main;
|
|
93
|
+
nuxt.hooks.hook("nitro:config", (nitroConfig) => {
|
|
94
|
+
nitroConfig.alias = nitroConfig.alias || {};
|
|
95
|
+
nitroConfig.alias["@unhead/schema-org"] = vendor.main;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
69
98
|
await kit$1.installNuxtSiteConfig();
|
|
70
99
|
const runtimeConfig = {
|
|
71
100
|
reactive: config.reactive,
|
|
@@ -98,7 +127,7 @@ const module$1 = kit.defineNuxtModule({
|
|
|
98
127
|
return;
|
|
99
128
|
}
|
|
100
129
|
const content = ctx.content;
|
|
101
|
-
const nodes = Array.isArray(content.schemaOrg) ? content.schemaOrg : [
|
|
130
|
+
const nodes = Array.isArray(content.schemaOrg) ? content.schemaOrg : [defineWebPage(content.schemaOrg)];
|
|
102
131
|
const replaceType = (node) => {
|
|
103
132
|
if (node.type) {
|
|
104
133
|
node["@type"] = node.type;
|
|
@@ -114,8 +143,8 @@ const module$1 = kit.defineNuxtModule({
|
|
|
114
143
|
const script = {
|
|
115
144
|
type: "application/ld+json",
|
|
116
145
|
key: "schema-org-graph",
|
|
117
|
-
|
|
118
|
-
|
|
146
|
+
nodes: nodes.map(replaceType),
|
|
147
|
+
...config.scriptAttributes || {}
|
|
119
148
|
};
|
|
120
149
|
content.head = defu.defu({ script: [script] }, content.head);
|
|
121
150
|
ctx.content = content;
|
|
@@ -124,8 +153,8 @@ const module$1 = kit.defineNuxtModule({
|
|
|
124
153
|
kit.addServerPlugin(resolve("./runtime/server/plugins/nuxt-content-v2"));
|
|
125
154
|
}
|
|
126
155
|
if (!config.reactive)
|
|
127
|
-
nuxt.options.optimization.treeShake.composables.client["nuxt-schema-org"] =
|
|
128
|
-
for (const component of
|
|
156
|
+
nuxt.options.optimization.treeShake.composables.client["nuxt-schema-org"] = schemaOrgAutoImports[0].imports;
|
|
157
|
+
for (const component of schemaOrgComponents) {
|
|
129
158
|
await kit.addComponent({
|
|
130
159
|
name: component,
|
|
131
160
|
export: component,
|
|
@@ -138,8 +167,8 @@ const module$1 = kit.defineNuxtModule({
|
|
|
138
167
|
name: "useSchemaOrg"
|
|
139
168
|
});
|
|
140
169
|
nuxt.hooks.hook("imports:sources", (autoImports) => {
|
|
141
|
-
|
|
142
|
-
autoImports.unshift(...
|
|
170
|
+
schemaOrgAutoImports[0].imports = schemaOrgAutoImports[0].imports.filter((i) => i !== "useSchemaOrg");
|
|
171
|
+
autoImports.unshift(...schemaOrgAutoImports);
|
|
143
172
|
});
|
|
144
173
|
kit$2.extendTypes("nuxt-schema-org", ({ typesPath }) => {
|
|
145
174
|
return `
|
package/dist/module.d.cts
CHANGED
|
@@ -2,6 +2,7 @@ import { NuxtModule } from '@nuxt/schema';
|
|
|
2
2
|
import { OrganizationSimple, PersonSimple, LocalBusinessSimple } from '@unhead/schema-org';
|
|
3
3
|
import { Script } from '@unhead/vue/types';
|
|
4
4
|
|
|
5
|
+
type SchemaOrgScriptAttributes = Partial<Script> & Record<string, unknown>;
|
|
5
6
|
interface ModuleOptions {
|
|
6
7
|
/**
|
|
7
8
|
* Whether a default WebPage, WebSite and Identity node be created.
|
|
@@ -34,7 +35,7 @@ interface ModuleOptions {
|
|
|
34
35
|
*
|
|
35
36
|
* By default, will apply a `data-nuxt-schema-org` attribute. Set to `false` to apply no attributes.
|
|
36
37
|
*/
|
|
37
|
-
scriptAttributes?:
|
|
38
|
+
scriptAttributes?: SchemaOrgScriptAttributes | false;
|
|
38
39
|
/**
|
|
39
40
|
* Enables debug logs.
|
|
40
41
|
*
|
package/dist/module.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ import { NuxtModule } from '@nuxt/schema';
|
|
|
2
2
|
import { OrganizationSimple, PersonSimple, LocalBusinessSimple } from '@unhead/schema-org';
|
|
3
3
|
import { Script } from '@unhead/vue/types';
|
|
4
4
|
|
|
5
|
+
type SchemaOrgScriptAttributes = Partial<Script> & Record<string, unknown>;
|
|
5
6
|
interface ModuleOptions {
|
|
6
7
|
/**
|
|
7
8
|
* Whether a default WebPage, WebSite and Identity node be created.
|
|
@@ -34,7 +35,7 @@ interface ModuleOptions {
|
|
|
34
35
|
*
|
|
35
36
|
* By default, will apply a `data-nuxt-schema-org` attribute. Set to `false` to apply no attributes.
|
|
36
37
|
*/
|
|
37
|
-
scriptAttributes?:
|
|
38
|
+
scriptAttributes?: SchemaOrgScriptAttributes | false;
|
|
38
39
|
/**
|
|
39
40
|
* Enables debug logs.
|
|
40
41
|
*
|
package/dist/module.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { NuxtModule } from '@nuxt/schema';
|
|
|
2
2
|
import { OrganizationSimple, PersonSimple, LocalBusinessSimple } from '@unhead/schema-org';
|
|
3
3
|
import { Script } from '@unhead/vue/types';
|
|
4
4
|
|
|
5
|
+
type SchemaOrgScriptAttributes = Partial<Script> & Record<string, unknown>;
|
|
5
6
|
interface ModuleOptions {
|
|
6
7
|
/**
|
|
7
8
|
* Whether a default WebPage, WebSite and Identity node be created.
|
|
@@ -34,7 +35,7 @@ interface ModuleOptions {
|
|
|
34
35
|
*
|
|
35
36
|
* By default, will apply a `data-nuxt-schema-org` attribute. Set to `false` to apply no attributes.
|
|
36
37
|
*/
|
|
37
|
-
scriptAttributes?:
|
|
38
|
+
scriptAttributes?: SchemaOrgScriptAttributes | false;
|
|
38
39
|
/**
|
|
39
40
|
* Enables debug logs.
|
|
40
41
|
*
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { useNuxt, defineNuxtModule, createResolver, useLogger, hasNuxtModule, addPlugin, addServerPlugin, addComponent, addImports, addServerHandler } from '@nuxt/kit';
|
|
2
|
-
import { defineWebPage } from '@unhead/schema-org';
|
|
3
|
-
import { schemaOrgAutoImports, schemaOrgComponents } from '@unhead/schema-org/vue';
|
|
4
2
|
import { defu } from 'defu';
|
|
5
3
|
import { installNuxtSiteConfig } from 'nuxt-site-config/kit';
|
|
6
4
|
import { readPackageJSON } from 'pkg-types';
|
|
@@ -16,6 +14,25 @@ function setupDevToolsUI(_options, resolve, nuxt = useNuxt()) {
|
|
|
16
14
|
}, resolve, nuxt);
|
|
17
15
|
}
|
|
18
16
|
|
|
17
|
+
async function resolveHostUnheadMajor(rootDir) {
|
|
18
|
+
const url = rootDir.endsWith("/") ? rootDir : `${rootDir}/`;
|
|
19
|
+
for (const id of ["@unhead/vue", "unhead"]) {
|
|
20
|
+
const version = await readPackageJSON(id, { url }).then((pkg) => pkg.version).catch(() => {
|
|
21
|
+
return void 0;
|
|
22
|
+
});
|
|
23
|
+
const major = version ? Number.parseInt(version, 10) : Number.NaN;
|
|
24
|
+
if (major === 2)
|
|
25
|
+
return 2;
|
|
26
|
+
if (Number.isFinite(major) && major >= 3)
|
|
27
|
+
return 3;
|
|
28
|
+
}
|
|
29
|
+
return 3;
|
|
30
|
+
}
|
|
31
|
+
function schemaOrgVendor(major) {
|
|
32
|
+
const pkg = major === 2 ? "@unhead/schema-org-v2" : "@unhead/schema-org";
|
|
33
|
+
return { main: pkg, vue: `${pkg}/vue` };
|
|
34
|
+
}
|
|
35
|
+
|
|
19
36
|
const module$1 = defineNuxtModule({
|
|
20
37
|
meta: {
|
|
21
38
|
name: "nuxt-schema-org",
|
|
@@ -63,6 +80,18 @@ const module$1 = defineNuxtModule({
|
|
|
63
80
|
}
|
|
64
81
|
if (!nuxt.options.ssr && nuxt.options.dev)
|
|
65
82
|
logger.warn("You are using Schema.org with SSR disabled. This is not recommended, Google may not detect your Schema.org, and it adds extra page weight");
|
|
83
|
+
const unheadMajor = await resolveHostUnheadMajor(nuxt.options.rootDir);
|
|
84
|
+
const vendor = schemaOrgVendor(unheadMajor);
|
|
85
|
+
const { defineWebPage } = await import(vendor.main);
|
|
86
|
+
const { schemaOrgAutoImports, schemaOrgComponents } = await import(vendor.vue);
|
|
87
|
+
if (vendor.main !== "@unhead/schema-org") {
|
|
88
|
+
logger.debug(`Detected unhead v${unheadMajor}, aliasing @unhead/schema-org -> ${vendor.main}`);
|
|
89
|
+
nuxt.options.alias["@unhead/schema-org"] = vendor.main;
|
|
90
|
+
nuxt.hooks.hook("nitro:config", (nitroConfig) => {
|
|
91
|
+
nitroConfig.alias = nitroConfig.alias || {};
|
|
92
|
+
nitroConfig.alias["@unhead/schema-org"] = vendor.main;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
66
95
|
await installNuxtSiteConfig();
|
|
67
96
|
const runtimeConfig = {
|
|
68
97
|
reactive: config.reactive,
|
|
@@ -111,8 +140,8 @@ const module$1 = defineNuxtModule({
|
|
|
111
140
|
const script = {
|
|
112
141
|
type: "application/ld+json",
|
|
113
142
|
key: "schema-org-graph",
|
|
114
|
-
|
|
115
|
-
|
|
143
|
+
nodes: nodes.map(replaceType),
|
|
144
|
+
...config.scriptAttributes || {}
|
|
116
145
|
};
|
|
117
146
|
content.head = defu({ script: [script] }, content.head);
|
|
118
147
|
ctx.content = content;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { useHead } from "#imports";
|
|
2
1
|
import { useNuxtApp } from "nuxt/app";
|
|
3
|
-
import {
|
|
2
|
+
import { isRef, toValue } from "vue";
|
|
3
|
+
import { useHead } from "#imports";
|
|
4
4
|
import { useSchemaOrgConfig } from "../utils/config.js";
|
|
5
5
|
export function useSchemaOrg(input) {
|
|
6
6
|
const config = useSchemaOrgConfig();
|
|
7
7
|
const nuxtApp = useNuxtApp();
|
|
8
|
-
|
|
8
|
+
let nodes = input;
|
|
9
|
+
if (isRef(input)) {
|
|
10
|
+
nodes = import.meta.server ? toValue(input) : () => nuxtApp.runWithContext(() => toValue(input));
|
|
11
|
+
}
|
|
9
12
|
const script = {
|
|
10
13
|
type: "application/ld+json",
|
|
11
14
|
key: "schema-org-graph",
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import * as schemaOrgVue from "@unhead/schema-org/vue";
|
|
2
|
+
import { resolveSitePath } from "nuxt-site-config/urls";
|
|
3
|
+
import { useRoute, useRuntimeConfig } from "nuxt/app";
|
|
4
|
+
import { withTrailingSlash } from "ufo";
|
|
5
|
+
import { toValue, watch } from "vue";
|
|
1
6
|
import { injectHead, useHead } from "#imports";
|
|
2
7
|
import {
|
|
3
8
|
useSiteConfig
|
|
4
9
|
} from "#site-config/app/composables/useSiteConfig";
|
|
5
10
|
import { createSitePathResolver } from "#site-config/app/composables/utils";
|
|
6
|
-
import { SchemaOrgUnheadPlugin } from "@unhead/schema-org/vue";
|
|
7
|
-
import { resolveSitePath } from "nuxt-site-config/urls";
|
|
8
|
-
import { useRoute, useRuntimeConfig } from "nuxt/app";
|
|
9
|
-
import { camelCase } from "scule";
|
|
10
|
-
import { withTrailingSlash } from "ufo";
|
|
11
|
-
import { toValue, watch } from "vue";
|
|
12
11
|
import { useSchemaOrg } from "../composables/useSchemaOrg.js";
|
|
13
12
|
import { useSchemaOrgConfig } from "./config.js";
|
|
14
13
|
function resolvePathDirect(siteConfig, path, options) {
|
|
@@ -59,8 +58,9 @@ export function initPlugin(nuxtApp) {
|
|
|
59
58
|
});
|
|
60
59
|
}, { deep: true });
|
|
61
60
|
}
|
|
61
|
+
const SchemaOrgPlugin = schemaOrgVue.UnheadSchemaOrg ?? schemaOrgVue.SchemaOrgUnheadPlugin;
|
|
62
62
|
head.use(
|
|
63
|
-
|
|
63
|
+
SchemaOrgPlugin({}, async () => {
|
|
64
64
|
const meta = {};
|
|
65
65
|
await nuxtApp.hooks.callHook("schema-org:meta", meta);
|
|
66
66
|
return meta;
|
|
@@ -98,7 +98,12 @@ export function maybeAddIdentitySchemaOrg() {
|
|
|
98
98
|
`https://twitter.com/${id}`
|
|
99
99
|
];
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
const identityDefines = {
|
|
102
|
+
organization: schemaOrgVue.defineOrganization,
|
|
103
|
+
person: schemaOrgVue.definePerson,
|
|
104
|
+
localbusiness: schemaOrgVue.defineLocalBusiness
|
|
105
|
+
};
|
|
106
|
+
const defineIdentity = identityDefines[identityType?.toLowerCase()] || schemaOrgVue.defineOrganization;
|
|
107
|
+
useSchemaOrg([defineIdentity(identityPayload)]);
|
|
103
108
|
}
|
|
104
109
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-schema-org",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.1.1",
|
|
5
5
|
"description": "The quickest and easiest way to build Schema.org graphs for Nuxt.",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"dist"
|
|
48
48
|
],
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@unhead/vue": "^2.0.7",
|
|
51
|
-
"unhead": "^2.0.7",
|
|
50
|
+
"@unhead/vue": "^2.0.7 || ^3.0.0",
|
|
51
|
+
"unhead": "^2.0.7 || ^3.0.0",
|
|
52
52
|
"zod": ">=3"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
@@ -63,35 +63,38 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@nuxt/kit": "^4.4.
|
|
67
|
-
"@unhead/schema-org": "^
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"nuxtseo-shared": "^
|
|
72
|
-
"pkg-types": "^2.3.
|
|
66
|
+
"@nuxt/kit": "^4.4.7",
|
|
67
|
+
"@unhead/schema-org": "^3.1.3",
|
|
68
|
+
"@unhead/schema-org-v2": "npm:@unhead/schema-org@^2.1.15",
|
|
69
|
+
"defu": "^6.1.7",
|
|
70
|
+
"nuxt-site-config": "^4.0.8",
|
|
71
|
+
"nuxtseo-shared": "^5.1.3",
|
|
72
|
+
"pkg-types": "^2.3.1",
|
|
73
|
+
"ufo": "^1.6.4"
|
|
73
74
|
},
|
|
74
75
|
"devDependencies": {
|
|
75
|
-
"@antfu/eslint-config": "^
|
|
76
|
-
"@arethetypeswrong/cli": "^0.18.
|
|
77
|
-
"@iconify-json/lucide": "^1.2.
|
|
78
|
-
"@nuxt/content": "^3.
|
|
76
|
+
"@antfu/eslint-config": "^9.0.0",
|
|
77
|
+
"@arethetypeswrong/cli": "^0.18.3",
|
|
78
|
+
"@iconify-json/lucide": "^1.2.111",
|
|
79
|
+
"@nuxt/content": "^3.14.0",
|
|
79
80
|
"@nuxt/module-builder": "^1.0.2",
|
|
80
|
-
"@nuxt/schema": "^4.4.
|
|
81
|
-
"@nuxt/test-utils": "^4.0.
|
|
82
|
-
"@nuxt/ui": "^4.
|
|
83
|
-
"@nuxtjs/i18n": "^10.
|
|
84
|
-
"@nuxtjs/robots": "^6.0.
|
|
85
|
-
"@vue/test-utils": "^2.4.
|
|
86
|
-
"better-sqlite3": "^12.
|
|
87
|
-
"bumpp": "^11.0
|
|
81
|
+
"@nuxt/schema": "^4.4.7",
|
|
82
|
+
"@nuxt/test-utils": "^4.0.3",
|
|
83
|
+
"@nuxt/ui": "^4.8.2",
|
|
84
|
+
"@nuxtjs/i18n": "^10.4.0",
|
|
85
|
+
"@nuxtjs/robots": "^6.0.9",
|
|
86
|
+
"@vue/test-utils": "^2.4.11",
|
|
87
|
+
"better-sqlite3": "^12.10.0",
|
|
88
|
+
"bumpp": "^11.1.0",
|
|
88
89
|
"cheerio": "^1.2.0",
|
|
89
|
-
"eslint": "^10.1
|
|
90
|
-
"eslint-plugin-harlanzw": "^0.
|
|
91
|
-
"happy-dom": "^20.
|
|
92
|
-
"nuxt": "^4.4.
|
|
93
|
-
"
|
|
94
|
-
"
|
|
90
|
+
"eslint": "^10.4.1",
|
|
91
|
+
"eslint-plugin-harlanzw": "^0.17.0",
|
|
92
|
+
"happy-dom": "^20.10.2",
|
|
93
|
+
"nuxt": "^4.4.7",
|
|
94
|
+
"nuxtseo-layer-devtools": "^5.1.3",
|
|
95
|
+
"typescript": "^6.0.3",
|
|
96
|
+
"unbuild": "^3.6.1",
|
|
97
|
+
"vitest": "^4.1.8"
|
|
95
98
|
},
|
|
96
99
|
"build": {
|
|
97
100
|
"externals": [
|
|
@@ -109,6 +112,7 @@
|
|
|
109
112
|
"release": "pnpm build && bumpp -x \"npx changelogen --output=CHANGELOG.md\"",
|
|
110
113
|
"typecheck": "tsc --noEmit ",
|
|
111
114
|
"test": "nuxt prepare test/fixtures/i18n && nuxt prepare test/fixtures/i18n-domains && vitest",
|
|
115
|
+
"test:compat-v2": "node test/compat-v2/run.mjs",
|
|
112
116
|
"test:attw": "attw --pack"
|
|
113
117
|
}
|
|
114
118
|
}
|