@unhead/schema-org 1.8.8 → 1.8.10

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Harlan Wilton <harlan@harlanzw.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- #
1
+ #
2
2
 
3
3
  Schema.org for Vue. Supports typed and automated Google Rich Results
4
4
 
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const plugin = require('./shared/schema-org.da628d24.cjs');
3
+ const plugin = require('./shared/schema-org.c57a2b9d.cjs');
4
4
  const unhead = require('unhead');
5
5
  require('@unhead/shared');
6
6
  require('ufo');
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { U as UnheadSchemaOrg } from './shared/schema-org.bb03b192.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, a as dedupeNodes, d as defineSchemaOrgResolver, t as eventResolver, w as foodEstablishmentResolver, x as howToResolver, z as howToStepDirectionResolver, y as howToStepResolver, B as imageResolver, A 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, b as resolveNode, e as resolveNodeId, f as resolveRelation, V as reviewResolver, a0 as searchActionResolver, T as softwareAppResolver, W as videoResolver, v as virtualLocationResolver, Y as webPageResolver, $ as webSiteResolver } from './shared/schema-org.bb03b192.mjs';
1
+ import { U as UnheadSchemaOrg } from './shared/schema-org.2bb4d7a1.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, a as dedupeNodes, d as defineSchemaOrgResolver, t as eventResolver, w as foodEstablishmentResolver, x as howToResolver, z as howToStepDirectionResolver, y as howToStepResolver, B as imageResolver, A 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, b as resolveNode, e as resolveNodeId, f as resolveRelation, V as reviewResolver, a0 as searchActionResolver, T as softwareAppResolver, W as videoResolver, v as virtualLocationResolver, Y as webPageResolver, $ as webSiteResolver } from './shared/schema-org.2bb4d7a1.mjs';
3
3
  import { getActiveHead, useHead } from 'unhead';
4
4
  import '@unhead/shared';
5
5
  import 'ufo';
@@ -18,12 +18,23 @@ function resolvableDateToDate(val) {
18
18
  }
19
19
  return typeof val === "string" ? val : val.toString();
20
20
  }
21
+ const IS_VALID_W3C_DATE = [
22
+ /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,
23
+ /^\d{4}-[01]\d-[0-3]\d$/,
24
+ /^\d{4}-[01]\d$/,
25
+ /^\d{4}$/
26
+ ];
27
+ function isValidW3CDate(d) {
28
+ return IS_VALID_W3C_DATE.some((r) => r.test(d));
29
+ }
21
30
  function resolvableDateToIso(val) {
22
31
  if (!val)
23
32
  return val;
24
33
  try {
25
34
  if (val instanceof Date)
26
35
  return val.toISOString();
36
+ else if (isValidW3CDate(val))
37
+ return val;
27
38
  else
28
39
  return new Date(Date.parse(val)).toISOString();
29
40
  } catch (e) {
@@ -1844,8 +1855,25 @@ function resolveRelation(input, ctx, fallbackResolver, options = {}) {
1844
1855
  return ids;
1845
1856
  }
1846
1857
 
1858
+ function isPlainObject(value) {
1859
+ if (value === null || typeof value !== "object") {
1860
+ return false;
1861
+ }
1862
+ const prototype = Object.getPrototypeOf(value);
1863
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
1864
+ return false;
1865
+ }
1866
+ if (Symbol.iterator in value) {
1867
+ return false;
1868
+ }
1869
+ if (Symbol.toStringTag in value) {
1870
+ return Object.prototype.toString.call(value) === "[object Module]";
1871
+ }
1872
+ return true;
1873
+ }
1874
+
1847
1875
  function _defu(baseObject, defaults, namespace = ".", merger) {
1848
- if (!_isPlainObject(defaults)) {
1876
+ if (!isPlainObject(defaults)) {
1849
1877
  return _defu(baseObject, {}, namespace, merger);
1850
1878
  }
1851
1879
  const object = Object.assign({}, defaults);
@@ -1862,7 +1890,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
1862
1890
  }
1863
1891
  if (Array.isArray(value) && Array.isArray(object[key])) {
1864
1892
  object[key] = [...value, ...object[key]];
1865
- } else if (_isPlainObject(value) && _isPlainObject(object[key])) {
1893
+ } else if (isPlainObject(value) && isPlainObject(object[key])) {
1866
1894
  object[key] = _defu(
1867
1895
  value,
1868
1896
  object[key],
@@ -1875,13 +1903,6 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
1875
1903
  }
1876
1904
  return object;
1877
1905
  }
1878
- function _isPlainObject(value) {
1879
- if (value === null || typeof value !== "object") {
1880
- return false;
1881
- }
1882
- const prototype = Object.getPrototypeOf(value);
1883
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
1884
- }
1885
1906
  function createDefu(merger) {
1886
1907
  return (...arguments_) => (
1887
1908
  // eslint-disable-next-line unicorn/no-array-reduce
@@ -20,12 +20,23 @@ function resolvableDateToDate(val) {
20
20
  }
21
21
  return typeof val === "string" ? val : val.toString();
22
22
  }
23
+ const IS_VALID_W3C_DATE = [
24
+ /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,
25
+ /^\d{4}-[01]\d-[0-3]\d$/,
26
+ /^\d{4}-[01]\d$/,
27
+ /^\d{4}$/
28
+ ];
29
+ function isValidW3CDate(d) {
30
+ return IS_VALID_W3C_DATE.some((r) => r.test(d));
31
+ }
23
32
  function resolvableDateToIso(val) {
24
33
  if (!val)
25
34
  return val;
26
35
  try {
27
36
  if (val instanceof Date)
28
37
  return val.toISOString();
38
+ else if (isValidW3CDate(val))
39
+ return val;
29
40
  else
30
41
  return new Date(Date.parse(val)).toISOString();
31
42
  } catch (e) {
@@ -1846,8 +1857,25 @@ function resolveRelation(input, ctx, fallbackResolver, options = {}) {
1846
1857
  return ids;
1847
1858
  }
1848
1859
 
1860
+ function isPlainObject(value) {
1861
+ if (value === null || typeof value !== "object") {
1862
+ return false;
1863
+ }
1864
+ const prototype = Object.getPrototypeOf(value);
1865
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
1866
+ return false;
1867
+ }
1868
+ if (Symbol.iterator in value) {
1869
+ return false;
1870
+ }
1871
+ if (Symbol.toStringTag in value) {
1872
+ return Object.prototype.toString.call(value) === "[object Module]";
1873
+ }
1874
+ return true;
1875
+ }
1876
+
1849
1877
  function _defu(baseObject, defaults, namespace = ".", merger) {
1850
- if (!_isPlainObject(defaults)) {
1878
+ if (!isPlainObject(defaults)) {
1851
1879
  return _defu(baseObject, {}, namespace, merger);
1852
1880
  }
1853
1881
  const object = Object.assign({}, defaults);
@@ -1864,7 +1892,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
1864
1892
  }
1865
1893
  if (Array.isArray(value) && Array.isArray(object[key])) {
1866
1894
  object[key] = [...value, ...object[key]];
1867
- } else if (_isPlainObject(value) && _isPlainObject(object[key])) {
1895
+ } else if (isPlainObject(value) && isPlainObject(object[key])) {
1868
1896
  object[key] = _defu(
1869
1897
  value,
1870
1898
  object[key],
@@ -1877,13 +1905,6 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
1877
1905
  }
1878
1906
  return object;
1879
1907
  }
1880
- function _isPlainObject(value) {
1881
- if (value === null || typeof value !== "object") {
1882
- return false;
1883
- }
1884
- const prototype = Object.getPrototypeOf(value);
1885
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
1886
- }
1887
1908
  function createDefu(merger) {
1888
1909
  return (...arguments_) => (
1889
1910
  // eslint-disable-next-line unicorn/no-array-reduce
package/dist/vue.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const plugin = require('./shared/schema-org.da628d24.cjs');
3
+ const plugin = require('./shared/schema-org.c57a2b9d.cjs');
4
4
  const vue = require('@unhead/vue');
5
5
  const vue$1 = require('vue');
6
6
  require('@unhead/shared');
package/dist/vue.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { U as UnheadSchemaOrg } from './shared/schema-org.bb03b192.mjs';
2
- export { a1 as PluginSchemaOrg, a2 as SchemaOrgUnheadPlugin } from './shared/schema-org.bb03b192.mjs';
1
+ import { U as UnheadSchemaOrg } from './shared/schema-org.2bb4d7a1.mjs';
2
+ export { a1 as PluginSchemaOrg, a2 as SchemaOrgUnheadPlugin } from './shared/schema-org.2bb4d7a1.mjs';
3
3
  import { injectHead, useHead } from '@unhead/vue';
4
4
  import { defineComponent, ref, computed, unref, h } from 'vue';
5
5
  import '@unhead/shared';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unhead/schema-org",
3
- "version": "1.8.8",
3
+ "version": "1.8.10",
4
4
  "description": "Unhead Schema.org for Simple and Automated Google Rich Results",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
@@ -39,19 +39,19 @@
39
39
  "dist"
40
40
  ],
41
41
  "peerDependencies": {
42
- "unhead": ">=1.8.3",
43
- "@unhead/shared": "1.8.8"
42
+ "unhead": ">=1.8.9",
43
+ "@unhead/shared": "1.8.10"
44
44
  },
45
45
  "dependencies": {
46
46
  "ufo": "^1.3.2"
47
47
  },
48
48
  "devDependencies": {
49
- "unplugin-vue-components": "^0.25.2",
50
- "vue": "^3.3.8",
51
- "@unhead/schema": "1.8.8",
52
- "@unhead/shared": "1.8.8",
53
- "@unhead/vue": "1.8.8",
54
- "unhead": "1.8.8"
49
+ "unplugin-vue-components": "^0.26.0",
50
+ "vue": "^3.4.14",
51
+ "@unhead/vue": "1.8.10",
52
+ "@unhead/shared": "1.8.10",
53
+ "unhead": "1.8.10",
54
+ "@unhead/schema": "1.8.10"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "unbuild .",