@unhead/schema-org 1.11.11 → 1.11.12

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.f5bc531c.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.ac0c24a5.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.ac0c24a5.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) => {
@@ -1572,6 +1573,7 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
1572
1573
  },
1573
1574
  "tag:normalise": async ({ tag }) => {
1574
1575
  if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
1576
+ console.log("tag", tag);
1575
1577
  const { loadResolver } = await Promise.resolve().then(function () { return resolver; });
1576
1578
  const nodes = await tag.props.nodes;
1577
1579
  for (const node of Array.isArray(nodes) ? nodes : [nodes]) {
@@ -1616,6 +1618,7 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
1616
1618
  for (const k in ctx.tags) {
1617
1619
  const tag = ctx.tags[k];
1618
1620
  if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
1621
+ delete tag.props.nodes;
1619
1622
  const resolvedGraph = graph.resolveGraph({ ...await meta?.() || {}, ...config, ...resolvedMeta });
1620
1623
  if (!resolvedGraph.length) {
1621
1624
  tag.props = {};
@@ -1630,10 +1633,25 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
1630
1633
  return processTemplateParams(value, head._templateParams, head._separator);
1631
1634
  return value;
1632
1635
  }, minify ? 0 : 2);
1633
- delete tag.props.nodes;
1634
1636
  return;
1635
1637
  }
1636
1638
  }
1639
+ },
1640
+ "tags:afterResolve": (ctx) => {
1641
+ let firstNodeKey;
1642
+ for (const k in ctx.tags) {
1643
+ const tag = ctx.tags[k];
1644
+ if (tag.props.type === "application/ld+json" && tag.props.nodes || tag.key === "schema-org-graph") {
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) => {
@@ -1574,6 +1575,7 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
1574
1575
  },
1575
1576
  "tag:normalise": async ({ tag }) => {
1576
1577
  if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
1578
+ console.log("tag", tag);
1577
1579
  const { loadResolver } = await Promise.resolve().then(function () { return resolver; });
1578
1580
  const nodes = await tag.props.nodes;
1579
1581
  for (const node of Array.isArray(nodes) ? nodes : [nodes]) {
@@ -1618,6 +1620,7 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
1618
1620
  for (const k in ctx.tags) {
1619
1621
  const tag = ctx.tags[k];
1620
1622
  if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
1623
+ delete tag.props.nodes;
1621
1624
  const resolvedGraph = graph.resolveGraph({ ...await meta?.() || {}, ...config, ...resolvedMeta });
1622
1625
  if (!resolvedGraph.length) {
1623
1626
  tag.props = {};
@@ -1632,10 +1635,25 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
1632
1635
  return processTemplateParams(value, head._templateParams, head._separator);
1633
1636
  return value;
1634
1637
  }, minify ? 0 : 2);
1635
- delete tag.props.nodes;
1636
1638
  return;
1637
1639
  }
1638
1640
  }
1641
+ },
1642
+ "tags:afterResolve": (ctx) => {
1643
+ let firstNodeKey;
1644
+ for (const k in ctx.tags) {
1645
+ const tag = ctx.tags[k];
1646
+ if (tag.props.type === "application/ld+json" && tag.props.nodes || tag.key === "schema-org-graph") {
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.f5bc531c.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.ac0c24a5.mjs';
2
+ export { a1 as PluginSchemaOrg, a2 as SchemaOrgUnheadPlugin } from './shared/schema-org.ac0c24a5.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.12",
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.12",
71
+ "@unhead/shared": "1.11.12",
72
+ "@unhead/vue": "1.11.12",
73
+ "unhead": "1.11.12"
65
74
  },
66
75
  "scripts": {
67
76
  "build": "unbuild .",