@unhead/schema-org 1.11.11 → 1.11.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/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const plugin = require('./shared/schema-org.6b89a24a.cjs');
3
+ const plugin = require('./shared/schema-org.bad51ab7.cjs');
4
4
  const unhead = require('unhead');
5
5
  require('ufo');
6
6
  require('ohash');
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { U as UnheadSchemaOrg } from './shared/schema-org.bd452034.mjs';
2
- export { H as HowToId, a1 as PluginSchemaOrg, P as PrimaryArticleId, k as PrimaryBookId, m as PrimaryBreadcrumbId, s as PrimaryEventId, X as PrimaryWebPageId, _ as PrimaryWebSiteId, M as ProductId, R as RecipeId, a2 as SchemaOrgUnheadPlugin, L as addressResolver, g as aggregateOfferResolver, h as aggregateRatingResolver, i as articleResolver, j as bookEditionResolver, l as bookResolver, o as breadcrumbResolver, p as commentResolver, q as courseResolver, c as createSchemaOrgGraph, f as dedupeNodes, d as defineSchemaOrgResolver, t as eventResolver, w as foodEstablishmentResolver, x as howToResolver, z as howToStepDirectionResolver, y as howToStepResolver, A as imageResolver, B as itemListResolver, C as jobPostingResolver, D as listItemResolver, E as localBusinessResolver, F as movieResolver, n as normaliseNodes, G as offerResolver, I as openingHoursResolver, J as organizationResolver, K as personResolver, u as placeResolver, N as productResolver, O as questionResolver, Q as ratingResolver, Z as readActionResolver, S as recipeResolver, r as resolveMeta, a as resolveNode, b as resolveNodeId, e as resolveRelation, T as reviewResolver, a0 as searchActionResolver, V as softwareAppResolver, W as videoResolver, v as virtualLocationResolver, Y as webPageResolver, $ as webSiteResolver } from './shared/schema-org.bd452034.mjs';
1
+ import { U as UnheadSchemaOrg } from './shared/schema-org.5caec424.mjs';
2
+ export { H as HowToId, a1 as PluginSchemaOrg, P as PrimaryArticleId, k as PrimaryBookId, m as PrimaryBreadcrumbId, s as PrimaryEventId, X as PrimaryWebPageId, _ as PrimaryWebSiteId, M as ProductId, R as RecipeId, a2 as SchemaOrgUnheadPlugin, L as addressResolver, g as aggregateOfferResolver, h as aggregateRatingResolver, i as articleResolver, j as bookEditionResolver, l as bookResolver, o as breadcrumbResolver, p as commentResolver, q as courseResolver, c as createSchemaOrgGraph, f as dedupeNodes, d as defineSchemaOrgResolver, t as eventResolver, w as foodEstablishmentResolver, x as howToResolver, z as howToStepDirectionResolver, y as howToStepResolver, A as imageResolver, B as itemListResolver, C as jobPostingResolver, D as listItemResolver, E as localBusinessResolver, F as movieResolver, n as normaliseNodes, G as offerResolver, I as openingHoursResolver, J as organizationResolver, K as personResolver, u as placeResolver, N as productResolver, O as questionResolver, Q as ratingResolver, Z as readActionResolver, S as recipeResolver, r as resolveMeta, a as resolveNode, b as resolveNodeId, e as resolveRelation, T as reviewResolver, a0 as searchActionResolver, V as softwareAppResolver, W as videoResolver, v as virtualLocationResolver, Y as webPageResolver, $ as webSiteResolver } from './shared/schema-org.5caec424.mjs';
3
3
  import { getActiveHead, useHead } from 'unhead';
4
4
  import 'ufo';
5
5
  import 'ohash';
@@ -1430,6 +1430,7 @@ function createDefu(merger) {
1430
1430
  arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
1431
1431
  );
1432
1432
  }
1433
+ const defu = createDefu();
1433
1434
 
1434
1435
  function groupBy(array, predicate) {
1435
1436
  return array.reduce((acc, value, index, array2) => {
@@ -1616,6 +1617,7 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
1616
1617
  for (const k in ctx.tags) {
1617
1618
  const tag = ctx.tags[k];
1618
1619
  if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
1620
+ delete tag.props.nodes;
1619
1621
  const resolvedGraph = graph.resolveGraph({ ...await meta?.() || {}, ...config, ...resolvedMeta });
1620
1622
  if (!resolvedGraph.length) {
1621
1623
  tag.props = {};
@@ -1630,10 +1632,26 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
1630
1632
  return processTemplateParams(value, head._templateParams, head._separator);
1631
1633
  return value;
1632
1634
  }, minify ? 0 : 2);
1633
- delete tag.props.nodes;
1634
1635
  return;
1635
1636
  }
1636
1637
  }
1638
+ },
1639
+ "tags:afterResolve": (ctx) => {
1640
+ let firstNodeKey;
1641
+ for (const k in ctx.tags) {
1642
+ const tag = ctx.tags[k];
1643
+ if (tag.props.type === "application/ld+json" && tag.props.nodes || tag.key === "schema-org-graph") {
1644
+ delete tag.props.nodes;
1645
+ if (typeof firstNodeKey === "undefined") {
1646
+ firstNodeKey = k;
1647
+ continue;
1648
+ }
1649
+ ctx.tags[firstNodeKey].props = defu(ctx.tags[firstNodeKey].props, tag.props);
1650
+ delete ctx.tags[firstNodeKey].props.nodes;
1651
+ ctx.tags[k] = false;
1652
+ }
1653
+ }
1654
+ ctx.tags = ctx.tags.filter(Boolean);
1637
1655
  }
1638
1656
  }
1639
1657
  }));
@@ -1432,6 +1432,7 @@ function createDefu(merger) {
1432
1432
  arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
1433
1433
  );
1434
1434
  }
1435
+ const defu = createDefu();
1435
1436
 
1436
1437
  function groupBy(array, predicate) {
1437
1438
  return array.reduce((acc, value, index, array2) => {
@@ -1618,6 +1619,7 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
1618
1619
  for (const k in ctx.tags) {
1619
1620
  const tag = ctx.tags[k];
1620
1621
  if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
1622
+ delete tag.props.nodes;
1621
1623
  const resolvedGraph = graph.resolveGraph({ ...await meta?.() || {}, ...config, ...resolvedMeta });
1622
1624
  if (!resolvedGraph.length) {
1623
1625
  tag.props = {};
@@ -1632,10 +1634,26 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
1632
1634
  return processTemplateParams(value, head._templateParams, head._separator);
1633
1635
  return value;
1634
1636
  }, minify ? 0 : 2);
1635
- delete tag.props.nodes;
1636
1637
  return;
1637
1638
  }
1638
1639
  }
1640
+ },
1641
+ "tags:afterResolve": (ctx) => {
1642
+ let firstNodeKey;
1643
+ for (const k in ctx.tags) {
1644
+ const tag = ctx.tags[k];
1645
+ if (tag.props.type === "application/ld+json" && tag.props.nodes || tag.key === "schema-org-graph") {
1646
+ delete tag.props.nodes;
1647
+ if (typeof firstNodeKey === "undefined") {
1648
+ firstNodeKey = k;
1649
+ continue;
1650
+ }
1651
+ ctx.tags[firstNodeKey].props = defu(ctx.tags[firstNodeKey].props, tag.props);
1652
+ delete ctx.tags[firstNodeKey].props.nodes;
1653
+ ctx.tags[k] = false;
1654
+ }
1655
+ }
1656
+ ctx.tags = ctx.tags.filter(Boolean);
1639
1657
  }
1640
1658
  }
1641
1659
  }));
package/dist/vue.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const plugin = require('./shared/schema-org.6b89a24a.cjs');
3
+ const plugin = require('./shared/schema-org.bad51ab7.cjs');
4
4
  const vue = require('vue');
5
5
  const vue$1 = require('@unhead/vue');
6
6
  require('ufo');
package/dist/vue.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { U as UnheadSchemaOrg } from './shared/schema-org.bd452034.mjs';
2
- export { a1 as PluginSchemaOrg, a2 as SchemaOrgUnheadPlugin } from './shared/schema-org.bd452034.mjs';
1
+ import { U as UnheadSchemaOrg } from './shared/schema-org.5caec424.mjs';
2
+ export { a1 as PluginSchemaOrg, a2 as SchemaOrgUnheadPlugin } from './shared/schema-org.5caec424.mjs';
3
3
  import { defineComponent, ref, computed, unref, h } from 'vue';
4
4
  import { injectHead, useHead } from '@unhead/vue';
5
5
  import 'ufo';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/schema-org",
3
3
  "type": "module",
4
- "version": "1.11.11",
4
+ "version": "1.11.13",
5
5
  "description": "Unhead Schema.org for Simple and Automated Google Rich Results",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
@@ -47,6 +47,15 @@
47
47
  "dist",
48
48
  "vue.d.ts"
49
49
  ],
50
+ "peerDependencies": {
51
+ "@unhead/vue": "^1.11.11",
52
+ "unhead": "^1.11.11"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "@unhead/vue": {
56
+ "optional": true
57
+ }
58
+ },
50
59
  "dependencies": {
51
60
  "ohash": "^1.1.4",
52
61
  "ufo": "^1.5.4"
@@ -58,10 +67,10 @@
58
67
  },
59
68
  "devDependencies": {
60
69
  "unplugin-vue-components": "^0.27.4",
61
- "@unhead/schema": "1.11.11",
62
- "@unhead/vue": "1.11.11",
63
- "unhead": "1.11.11",
64
- "@unhead/shared": "1.11.11"
70
+ "@unhead/schema": "1.11.13",
71
+ "@unhead/shared": "1.11.13",
72
+ "@unhead/vue": "1.11.13",
73
+ "unhead": "1.11.13"
65
74
  },
66
75
  "scripts": {
67
76
  "build": "unbuild .",