@unhead/schema-org 2.0.0-alpha.8 → 2.0.0-beta.0

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.
@@ -1,5 +1,6 @@
1
- import { hashCode, defineHeadPlugin, processTemplateParams } from '@unhead/shared';
2
1
  import { createDefu, defu } from 'defu';
2
+ import { defineHeadPlugin, TemplateParamsPlugin } from 'unhead/plugins';
3
+ import { processTemplateParams } from 'unhead/utils';
3
4
  import { hasProtocol, withBase, withoutTrailingSlash, hasTrailingSlash, withTrailingSlash, joinURL } from 'ufo';
4
5
  import { hash } from 'ohash';
5
6
 
@@ -103,11 +104,17 @@ function stripEmptyProperties(obj) {
103
104
  stripEmptyProperties(obj[k]);
104
105
  return;
105
106
  }
106
- if (obj[k] === "" || obj[k] === null || obj[k] === undefined)
107
+ if (obj[k] === "" || obj[k] === null || obj[k] === void 0)
107
108
  delete obj[k];
108
109
  }
109
110
  return obj;
110
111
  }
112
+ function hashCode(s) {
113
+ let h = 9;
114
+ for (let i = 0; i < s.length; )
115
+ h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9);
116
+ return ((h ^ h >>> 9) + 65536).toString(16).substring(1, 8).toLowerCase();
117
+ }
111
118
 
112
119
  const quantitativeValueResolver = defineSchemaOrgResolver({
113
120
  cast(node) {
@@ -1006,7 +1013,7 @@ const productResolver = defineSchemaOrgResolver({
1006
1013
  ],
1007
1014
  idPrefix: ["url", ProductId],
1008
1015
  resolve(node, ctx) {
1009
- setIfEmpty(node, "sku", hash(node.name));
1016
+ setIfEmpty(node, "sku", hashCode(node.name));
1010
1017
  node.aggregateOffer = resolveRelation(node.aggregateOffer, ctx, aggregateOfferResolver);
1011
1018
  node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
1012
1019
  node.offers = resolveRelation(node.offers, ctx, offerResolver);
@@ -1262,7 +1269,7 @@ function resolveNodeId(node, ctx, resolver, resolveAsRoot = false) {
1262
1269
  if (node["@id"] && node["@id"].startsWith("http"))
1263
1270
  return node;
1264
1271
  const prefix = resolver ? (Array.isArray(resolver.idPrefix) ? resolver.idPrefix[0] : resolver.idPrefix) || "url" : "url";
1265
- const rootId = node["@id"] || (resolver ? Array.isArray(resolver.idPrefix) ? resolver.idPrefix?.[1] : undefined : "");
1272
+ const rootId = node["@id"] || (resolver ? Array.isArray(resolver.idPrefix) ? resolver.idPrefix?.[1] : void 0 : "");
1266
1273
  if (!node["@id"] && resolveAsRoot && rootId) {
1267
1274
  node["@id"] = prefixId(ctx.meta[prefix], rootId);
1268
1275
  return node;
@@ -1458,96 +1465,232 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
1458
1465
  config = resolveMeta({ ...config });
1459
1466
  let graph;
1460
1467
  let resolvedMeta = {};
1461
- return defineHeadPlugin((head) => ({
1462
- key: "schema-org",
1463
- hooks: {
1464
- "entries:resolve": () => {
1465
- graph = createSchemaOrgGraph();
1466
- },
1467
- "tag:normalise": async ({ tag }) => {
1468
- if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
1469
- const { loadResolver } = await Promise.resolve().then(function () { return resolver; });
1470
- const nodes = await tag.props.nodes;
1471
- for (const node of Array.isArray(nodes) ? nodes : [nodes]) {
1472
- if (typeof node !== "object" || Object.keys(node).length === 0) {
1473
- continue;
1468
+ return defineHeadPlugin((head) => {
1469
+ head.use(TemplateParamsPlugin);
1470
+ return {
1471
+ key: "schema-org",
1472
+ hooks: {
1473
+ "entries:normalize": async ({ tags }) => {
1474
+ graph = graph || createSchemaOrgGraph();
1475
+ for (const tag of tags) {
1476
+ if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
1477
+ const { loadResolver } = await Promise.resolve().then(function () { return resolver; });
1478
+ const nodes = await tag.props.nodes;
1479
+ for (const node of Array.isArray(nodes) ? nodes : [nodes]) {
1480
+ if (typeof node !== "object" || Object.keys(node).length === 0) {
1481
+ continue;
1482
+ }
1483
+ const newNode = {
1484
+ ...node,
1485
+ _dedupeStrategy: tag.tagDuplicateStrategy,
1486
+ _resolver: loadResolver(await node._resolver)
1487
+ };
1488
+ graph.push(newNode);
1489
+ }
1490
+ tag.tagPosition = tag.tagPosition || config.tagPosition === "head" ? "head" : "bodyClose";
1474
1491
  }
1475
- const newNode = {
1476
- ...node,
1477
- _dedupeStrategy: tag.tagDuplicateStrategy,
1478
- _resolver: loadResolver(await node._resolver)
1479
- };
1480
- graph.push(newNode);
1481
- }
1482
- tag.tagPosition = tag.tagPosition || config.tagPosition === "head" ? "head" : "bodyClose";
1483
- }
1484
- if (tag.tag === "htmlAttrs" && tag.props.lang) {
1485
- resolvedMeta.inLanguage = tag.props.lang;
1486
- } else if (tag.tag === "title") {
1487
- resolvedMeta.title = tag.textContent;
1488
- } else if (tag.tag === "meta" && tag.props.name === "description") {
1489
- resolvedMeta.description = tag.props.content;
1490
- } else if (tag.tag === "link" && tag.props.rel === "canonical") {
1491
- resolvedMeta.url = tag.props.href;
1492
- if (resolvedMeta.url && !resolvedMeta.host) {
1493
- try {
1494
- resolvedMeta.host = new URL(resolvedMeta.url).origin;
1495
- } catch {
1492
+ if (tag.tag === "htmlAttrs" && tag.props.lang) {
1493
+ resolvedMeta.inLanguage = tag.props.lang;
1494
+ } else if (tag.tag === "title") {
1495
+ resolvedMeta.title = tag.textContent;
1496
+ } else if (tag.tag === "meta" && tag.props.name === "description") {
1497
+ resolvedMeta.description = tag.props.content;
1498
+ } else if (tag.tag === "link" && tag.props.rel === "canonical") {
1499
+ resolvedMeta.url = tag.props.href;
1500
+ if (resolvedMeta.url && !resolvedMeta.host) {
1501
+ try {
1502
+ resolvedMeta.host = new URL(resolvedMeta.url).origin;
1503
+ } catch {
1504
+ }
1505
+ }
1506
+ } else if (tag.tag === "meta" && tag.props.property === "og:image") {
1507
+ resolvedMeta.image = tag.props.content;
1508
+ } else if (tag.tag === "templateParams" && tag.props.schemaOrg) {
1509
+ resolvedMeta = {
1510
+ ...resolvedMeta,
1511
+ // @ts-expect-error untyped
1512
+ ...tag.props.schemaOrg
1513
+ };
1514
+ delete tag.props.schemaOrg;
1496
1515
  }
1497
1516
  }
1498
- } else if (tag.tag === "meta" && tag.props.property === "og:image") {
1499
- resolvedMeta.image = tag.props.content;
1500
- } else if (tag.tag === "templateParams" && tag.props.schemaOrg) {
1501
- resolvedMeta = {
1502
- ...resolvedMeta,
1503
- // @ts-expect-error untyped
1504
- ...tag.props.schemaOrg
1505
- };
1506
- delete tag.props.schemaOrg;
1507
- }
1508
- },
1509
- "tags:resolve": async (ctx) => {
1510
- for (const k in ctx.tags) {
1511
- const tag = ctx.tags[k];
1512
- if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
1513
- delete tag.props.nodes;
1514
- const resolvedGraph = graph.resolveGraph({ ...await meta?.() || {}, ...config, ...resolvedMeta });
1515
- if (!resolvedGraph.length) {
1516
- tag.props = {};
1517
+ },
1518
+ "tags:resolve": async (ctx) => {
1519
+ for (const k in ctx.tags) {
1520
+ const tag = ctx.tags[k];
1521
+ if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
1522
+ delete tag.props.nodes;
1523
+ const resolvedGraph = graph.resolveGraph({ ...await meta?.() || {}, ...config, ...resolvedMeta });
1524
+ if (!resolvedGraph.length) {
1525
+ tag.props = {};
1526
+ return;
1527
+ }
1528
+ const minify = options?.minify || process.env.NODE_ENV === "production";
1529
+ tag.innerHTML = JSON.stringify({
1530
+ "@context": "https://schema.org",
1531
+ "@graph": resolvedGraph
1532
+ }, (_, value) => {
1533
+ if (typeof value !== "object")
1534
+ return processTemplateParams(value, head._templateParams, head._separator);
1535
+ return value;
1536
+ }, minify ? 0 : 2);
1517
1537
  return;
1518
1538
  }
1519
- const minify = options?.minify || process.env.NODE_ENV === "production";
1520
- tag.innerHTML = JSON.stringify({
1521
- "@context": "https://schema.org",
1522
- "@graph": resolvedGraph
1523
- }, (_, value) => {
1524
- if (typeof value !== "object")
1525
- return processTemplateParams(value, head._templateParams, head._separator);
1526
- return value;
1527
- }, minify ? 0 : 2);
1528
- return;
1529
1539
  }
1530
- }
1531
- },
1532
- "tags:afterResolve": (ctx) => {
1533
- let firstNodeKey;
1534
- for (const k in ctx.tags) {
1535
- const tag = ctx.tags[k];
1536
- if (tag.props.type === "application/ld+json" && tag.props.nodes || tag.key === "schema-org-graph") {
1537
- delete tag.props.nodes;
1538
- if (typeof firstNodeKey === "undefined") {
1539
- firstNodeKey = k;
1540
- continue;
1540
+ },
1541
+ "tags:afterResolve": (ctx) => {
1542
+ let firstNodeKey;
1543
+ for (const k in ctx.tags) {
1544
+ const tag = ctx.tags[k];
1545
+ if (tag.props.type === "application/ld+json" && tag.props.nodes || tag.key === "schema-org-graph") {
1546
+ delete tag.props.nodes;
1547
+ if (typeof firstNodeKey === "undefined") {
1548
+ firstNodeKey = k;
1549
+ continue;
1550
+ }
1551
+ ctx.tags[firstNodeKey].props = defu(ctx.tags[firstNodeKey].props, tag.props);
1552
+ delete ctx.tags[firstNodeKey].props.nodes;
1553
+ ctx.tags[k] = false;
1541
1554
  }
1542
- ctx.tags[firstNodeKey].props = defu(ctx.tags[firstNodeKey].props, tag.props);
1543
- delete ctx.tags[firstNodeKey].props.nodes;
1544
- ctx.tags[k] = false;
1545
1555
  }
1556
+ ctx.tags = ctx.tags.filter(Boolean);
1546
1557
  }
1547
- ctx.tags = ctx.tags.filter(Boolean);
1548
1558
  }
1549
- }
1550
- }));
1559
+ };
1560
+ });
1561
+ }
1562
+
1563
+ function provideResolver(input, resolver) {
1564
+ if (!input)
1565
+ input = {};
1566
+ input._resolver = resolver;
1567
+ return input;
1568
+ }
1569
+ function defineAddress(input) {
1570
+ return provideResolver(input, "address");
1571
+ }
1572
+ function defineAggregateOffer(input) {
1573
+ return provideResolver(input, "aggregateOffer");
1574
+ }
1575
+ function defineAggregateRating(input) {
1576
+ return provideResolver(input, "aggregateRating");
1577
+ }
1578
+ function defineArticle(input) {
1579
+ return provideResolver(input, "article");
1580
+ }
1581
+ function defineBreadcrumb(input) {
1582
+ return provideResolver(input, "breadcrumb");
1583
+ }
1584
+ function defineComment(input) {
1585
+ return provideResolver(input, "comment");
1586
+ }
1587
+ function defineEvent(input) {
1588
+ return provideResolver(input, "event");
1589
+ }
1590
+ function defineFoodEstablishment(input) {
1591
+ return provideResolver(input, "foodEstablishment");
1592
+ }
1593
+ function defineVirtualLocation(input) {
1594
+ return provideResolver(input, "virtualLocation");
1595
+ }
1596
+ function definePlace(input) {
1597
+ return provideResolver(input, "place");
1598
+ }
1599
+ function defineHowTo(input) {
1600
+ return provideResolver(input, "howTo");
1601
+ }
1602
+ function defineHowToStep(input) {
1603
+ return provideResolver(input, "howToStep");
1604
+ }
1605
+ function defineImage(input) {
1606
+ return provideResolver(input, "image");
1607
+ }
1608
+ function defineJobPosting(input) {
1609
+ return provideResolver(input, "jobPosting");
1610
+ }
1611
+ function defineLocalBusiness(input) {
1612
+ return provideResolver(input, "localBusiness");
1613
+ }
1614
+ function defineOffer(input) {
1615
+ return provideResolver(input, "offer");
1616
+ }
1617
+ function defineOpeningHours(input) {
1618
+ return provideResolver(input, "openingHours");
1619
+ }
1620
+ function defineOrganization(input) {
1621
+ return provideResolver(input, "organization");
1622
+ }
1623
+ function definePerson(input) {
1624
+ return provideResolver(input, "person");
1625
+ }
1626
+ function defineProduct(input) {
1627
+ return provideResolver(input, "product");
1628
+ }
1629
+ function defineQuestion(input) {
1630
+ return provideResolver(input, "question");
1631
+ }
1632
+ function defineRecipe(input) {
1633
+ return provideResolver(input, "recipe");
1634
+ }
1635
+ function defineReview(input) {
1636
+ return provideResolver(input, "review");
1637
+ }
1638
+ function defineVideo(input) {
1639
+ return provideResolver(input, "video");
1640
+ }
1641
+ function defineWebPage(input) {
1642
+ return provideResolver(input, "webPage");
1643
+ }
1644
+ function defineWebSite(input) {
1645
+ return provideResolver(input, "webSite");
1646
+ }
1647
+ function defineBook(input) {
1648
+ return provideResolver(input, "book");
1649
+ }
1650
+ function defineCourse(input) {
1651
+ return provideResolver(input, "course");
1652
+ }
1653
+ function defineItemList(input) {
1654
+ return provideResolver(input, "itemList");
1655
+ }
1656
+ function defineListItem(input) {
1657
+ return provideResolver(input, "listItem");
1658
+ }
1659
+ function defineMovie(input) {
1660
+ return provideResolver(input, "movie");
1661
+ }
1662
+ function defineSearchAction(input) {
1663
+ return provideResolver(input, "searchAction");
1664
+ }
1665
+ function defineReadAction(input) {
1666
+ return provideResolver(input, "readAction");
1667
+ }
1668
+ function defineSoftwareApp(input) {
1669
+ return provideResolver(input, "softwareApp");
1670
+ }
1671
+ function defineBookEdition(input) {
1672
+ return provideResolver(input, "bookEdition");
1673
+ }
1674
+ function normalizeSchemaOrgInput(input) {
1675
+ if (input.script) {
1676
+ return input;
1677
+ }
1678
+ return {
1679
+ script: [
1680
+ {
1681
+ type: "application/ld+json",
1682
+ key: "schema-org-graph",
1683
+ nodes: input
1684
+ }
1685
+ ]
1686
+ };
1687
+ }
1688
+ function useSchemaOrg(unhead, input = [], options = {}) {
1689
+ unhead.use(UnheadSchemaOrg());
1690
+ const entry = unhead.push(normalizeSchemaOrgInput(input), options);
1691
+ const corePatch = entry.patch;
1692
+ entry.patch = (input2) => corePatch(normalizeSchemaOrgInput(input2));
1693
+ return entry;
1551
1694
  }
1552
1695
 
1553
- export { webSiteResolver as $, imageResolver as A, itemListResolver as B, jobPostingResolver as C, listItemResolver as D, localBusinessResolver as E, movieResolver as F, offerResolver as G, HowToId as H, openingHoursResolver as I, organizationResolver as J, personResolver as K, addressResolver as L, ProductId as M, productResolver as N, questionResolver as O, PrimaryArticleId as P, ratingResolver as Q, RecipeId as R, recipeResolver as S, reviewResolver as T, UnheadSchemaOrg as U, softwareAppResolver as V, videoResolver as W, PrimaryWebPageId as X, webPageResolver as Y, readActionResolver as Z, PrimaryWebSiteId as _, resolveNode as a, searchActionResolver as a0, PluginSchemaOrg as a1, SchemaOrgUnheadPlugin as a2, resolveNodeId as b, createSchemaOrgGraph as c, defineSchemaOrgResolver as d, resolveRelation as e, dedupeNodes as f, aggregateOfferResolver as g, aggregateRatingResolver as h, articleResolver as i, bookEditionResolver as j, PrimaryBookId as k, bookResolver as l, PrimaryBreadcrumbId as m, normaliseNodes as n, breadcrumbResolver as o, commentResolver as p, courseResolver as q, resolveMeta as r, PrimaryEventId as s, eventResolver as t, placeResolver as u, virtualLocationResolver as v, foodEstablishmentResolver as w, howToResolver as x, howToStepResolver as y, howToStepDirectionResolver as z };
1696
+ export { searchActionResolver as $, imageResolver as A, itemListResolver as B, jobPostingResolver as C, listItemResolver as D, localBusinessResolver as E, movieResolver as F, offerResolver as G, HowToId as H, openingHoursResolver as I, organizationResolver as J, personResolver as K, addressResolver as L, ProductId as M, productResolver as N, questionResolver as O, PrimaryArticleId as P, ratingResolver as Q, RecipeId as R, recipeResolver as S, reviewResolver as T, softwareAppResolver as U, videoResolver as V, PrimaryWebPageId as W, webPageResolver as X, readActionResolver as Y, PrimaryWebSiteId as Z, webSiteResolver as _, resolveNode as a, UnheadSchemaOrg as a0, PluginSchemaOrg as a1, SchemaOrgUnheadPlugin as a2, defineAddress as a3, defineAggregateOffer as a4, defineAggregateRating as a5, defineArticle as a6, defineBreadcrumb as a7, defineComment as a8, defineEvent as a9, defineSoftwareApp as aA, defineBookEdition as aB, normalizeSchemaOrgInput as aC, useSchemaOrg as aD, defineFoodEstablishment as aa, defineVirtualLocation as ab, definePlace as ac, defineHowTo as ad, defineHowToStep as ae, defineImage as af, defineJobPosting as ag, defineLocalBusiness as ah, defineOffer as ai, defineOpeningHours as aj, defineOrganization as ak, definePerson as al, defineProduct as am, defineQuestion as an, defineRecipe as ao, defineReview as ap, defineVideo as aq, defineWebPage as ar, defineWebSite as as, defineBook as at, defineCourse as au, defineItemList as av, defineListItem as aw, defineMovie as ax, defineSearchAction as ay, defineReadAction as az, resolveNodeId as b, createSchemaOrgGraph as c, defineSchemaOrgResolver as d, resolveRelation as e, dedupeNodes as f, aggregateOfferResolver as g, aggregateRatingResolver as h, articleResolver as i, bookEditionResolver as j, PrimaryBookId as k, bookResolver as l, PrimaryBreadcrumbId as m, normaliseNodes as n, breadcrumbResolver as o, commentResolver as p, courseResolver as q, resolveMeta as r, PrimaryEventId as s, eventResolver as t, placeResolver as u, virtualLocationResolver as v, foodEstablishmentResolver as w, howToResolver as x, howToStepResolver as y, howToStepDirectionResolver as z };
@@ -0,0 +1,43 @@
1
+ import { Unhead, HeadEntryOptions, ActiveHeadEntry } from 'unhead/types';
2
+ import { ay as PostalAddress, e as AggregateOffer, h as AggregateRating, k as Article, t as BreadcrumbList, w as Comment, F as Event, Q as FoodEstablishment, L as VirtualLocation, J as Place, X as HowTo, $ as HowToStep, a4 as ImageObject, aa as JobPosting, ag as LocalBusiness, am as Offer, ap as OpeningHoursSpecification, as as Organization, av as Person, aB as Product, aF as Question, aL as Recipe, aQ as Review, aW as VideoObject, aZ as WebPage, b4 as WebSite, m as Book, z as Course, a7 as ItemList, ad as ListItem, aj as Movie, b8 as SearchAction, b1 as ReadAction, aT as SoftwareApp, o as BookEdition, A as Arrayable, T as Thing } from './schema-org.C9XO8kJo.js';
3
+
4
+ declare function defineAddress<T extends Record<string, any>>(input?: PostalAddress & T): PostalAddress & T;
5
+ declare function defineAggregateOffer<T extends Record<string, any>>(input?: AggregateOffer & T): AggregateOffer & T;
6
+ declare function defineAggregateRating<T extends Record<string, any>>(input?: AggregateRating & T): AggregateRating & T;
7
+ declare function defineArticle<T extends Record<string, any>>(input?: Article & T): Article & T;
8
+ declare function defineBreadcrumb<T extends Record<string, any>>(input?: BreadcrumbList & T): BreadcrumbList & T;
9
+ declare function defineComment<T extends Record<string, any>>(input?: Comment & T): Comment & T;
10
+ declare function defineEvent<T extends Record<string, any>>(input?: Event & T): Event & T;
11
+ declare function defineFoodEstablishment<T extends Record<string, any>>(input?: FoodEstablishment & T): FoodEstablishment & T;
12
+ declare function defineVirtualLocation<T extends Record<string, any>>(input?: VirtualLocation & T): VirtualLocation & T;
13
+ declare function definePlace<T extends Record<string, any>>(input?: Place & T): Place & T;
14
+ declare function defineHowTo<T extends Record<string, any>>(input?: HowTo & T): HowTo & T;
15
+ declare function defineHowToStep<T extends Record<string, any>>(input?: HowToStep & T): HowToStep & T;
16
+ declare function defineImage<T extends Record<string, any>>(input?: ImageObject & T): ImageObject & T;
17
+ declare function defineJobPosting<T extends Record<string, any>>(input?: JobPosting & T): JobPosting & T;
18
+ declare function defineLocalBusiness<T extends Record<string, any>>(input?: LocalBusiness & T): LocalBusiness & T;
19
+ declare function defineOffer<T extends Record<string, any>>(input?: Offer & T): Offer & T;
20
+ declare function defineOpeningHours<T extends Record<string, any>>(input?: OpeningHoursSpecification & T): OpeningHoursSpecification & T;
21
+ declare function defineOrganization<T extends Record<string, any>>(input?: Organization & T): Organization & T;
22
+ declare function definePerson<T extends Record<string, any>>(input?: Person & T): Person & T;
23
+ declare function defineProduct<T extends Record<string, any>>(input?: Product & T): Product & T;
24
+ declare function defineQuestion<T extends Record<string, any>>(input?: Question & T): Question & T;
25
+ declare function defineRecipe<T extends Record<string, any>>(input?: Recipe & T): Recipe & T;
26
+ declare function defineReview<T extends Record<string, any>>(input?: Review & T): Review & T;
27
+ declare function defineVideo<T extends Record<string, any>>(input?: VideoObject & T): VideoObject & T;
28
+ declare function defineWebPage<T extends Record<string, any>>(input?: WebPage & T): WebPage & T;
29
+ declare function defineWebSite<T extends Record<string, any>>(input?: WebSite & T): WebSite & T;
30
+ declare function defineBook<T extends Record<string, any>>(input?: Book & T): Book & T;
31
+ declare function defineCourse<T extends Record<string, any>>(input?: Course & T): Course & T;
32
+ declare function defineItemList<T extends Record<string, any>>(input?: ItemList & T): ItemList & T;
33
+ declare function defineListItem<T extends Record<string, any>>(input?: ListItem & T): ListItem & T;
34
+ declare function defineMovie<T extends Record<string, any>>(input?: Movie & T): Movie & T;
35
+ declare function defineSearchAction<T extends Record<string, any>>(input?: SearchAction & T): SearchAction & T;
36
+ declare function defineReadAction<T extends Record<string, any>>(input?: ReadAction & T): ReadAction & T;
37
+ declare function defineSoftwareApp<T extends Record<string, any>>(input?: SoftwareApp & T): SoftwareApp & T;
38
+ declare function defineBookEdition<T extends Record<string, any>>(input?: BookEdition & T): BookEdition & T;
39
+ type UseSchemaOrgInput = Arrayable<Thing | Record<string, any>>;
40
+ declare function normalizeSchemaOrgInput<T extends UseSchemaOrgInput>(input: T): T;
41
+ declare function useSchemaOrg(unhead: Unhead<any>, input?: UseSchemaOrgInput, options?: HeadEntryOptions): ActiveHeadEntry<UseSchemaOrgInput>;
42
+
43
+ export { defineBook as A, defineCourse as B, defineItemList as C, defineListItem as D, defineMovie as E, defineSearchAction as F, defineReadAction as G, defineSoftwareApp as H, defineBookEdition as I, normalizeSchemaOrgInput as J, useSchemaOrg as K, type UseSchemaOrgInput as U, defineAggregateOffer as a, defineAggregateRating as b, defineArticle as c, defineAddress as d, defineBreadcrumb as e, defineComment as f, defineEvent as g, defineFoodEstablishment as h, defineVirtualLocation as i, definePlace as j, defineHowTo as k, defineHowToStep as l, defineImage as m, defineJobPosting as n, defineLocalBusiness as o, defineOffer as p, defineOpeningHours as q, defineOrganization as r, definePerson as s, defineProduct as t, defineQuestion as u, defineRecipe as v, defineReview as w, defineVideo as x, defineWebPage as y, defineWebSite as z };
@@ -0,0 +1,40 @@
1
+ const schemaAutoImports = [
2
+ "defineAddress",
3
+ "defineAggregateOffer",
4
+ "defineAggregateRating",
5
+ "defineArticle",
6
+ "defineBook",
7
+ "defineBookEdition",
8
+ "defineBreadcrumb",
9
+ "defineComment",
10
+ "defineCourse",
11
+ "defineEvent",
12
+ "defineFoodEstablishment",
13
+ "defineHowTo",
14
+ "defineHowToStep",
15
+ "defineImage",
16
+ "defineItemList",
17
+ "defineJobPosting",
18
+ "defineListItem",
19
+ "defineLocalBusiness",
20
+ "defineMovie",
21
+ "defineOffer",
22
+ "defineOpeningHours",
23
+ "defineOrganization",
24
+ "definePerson",
25
+ "definePlace",
26
+ "defineProduct",
27
+ "defineQuestion",
28
+ "defineReadAction",
29
+ "defineRecipe",
30
+ "defineReview",
31
+ "defineSearchAction",
32
+ "defineSoftwareApp",
33
+ "defineVideo",
34
+ "defineVirtualLocation",
35
+ "defineWebPage",
36
+ "defineWebSite",
37
+ "useSchemaOrg"
38
+ ];
39
+
40
+ export { schemaAutoImports as s };
@@ -0,0 +1,13 @@
1
+ import { HeadEntryOptions, ActiveHeadEntry } from 'unhead/types';
2
+ import { U as UseSchemaOrgInput } from './shared/schema-org.BDzDgQHq.mjs';
3
+ export { c as defineArticle, A as defineBook, e as defineBreadcrumb, f as defineComment, B as defineCourse, g as defineEvent, h as defineFoodEstablishment, k as defineHowTo, m as defineImage, C as defineItemList, n as defineJobPosting, o as defineLocalBusiness, E as defineMovie, r as defineOrganization, s as definePerson, t as defineProduct, u as defineQuestion, v as defineRecipe, w as defineReview, H as defineSoftwareApp, x as defineVideo, y as defineWebPage, z as defineWebSite } from './shared/schema-org.BDzDgQHq.mjs';
4
+ export { M as MetaInput, bf as UserConfig } from './shared/schema-org.C9XO8kJo.mjs';
5
+
6
+ declare const schemaOrgAutoImports: {
7
+ from: string;
8
+ imports: string[];
9
+ }[];
10
+
11
+ declare function useSchemaOrg(input?: UseSchemaOrgInput, options?: HeadEntryOptions): ActiveHeadEntry<UseSchemaOrgInput>;
12
+
13
+ export { schemaOrgAutoImports, useSchemaOrg };
@@ -0,0 +1,13 @@
1
+ import { HeadEntryOptions, ActiveHeadEntry } from 'unhead/types';
2
+ import { U as UseSchemaOrgInput } from './shared/schema-org.DC9JJOX5.js';
3
+ export { c as defineArticle, A as defineBook, e as defineBreadcrumb, f as defineComment, B as defineCourse, g as defineEvent, h as defineFoodEstablishment, k as defineHowTo, m as defineImage, C as defineItemList, n as defineJobPosting, o as defineLocalBusiness, E as defineMovie, r as defineOrganization, s as definePerson, t as defineProduct, u as defineQuestion, v as defineRecipe, w as defineReview, H as defineSoftwareApp, x as defineVideo, y as defineWebPage, z as defineWebSite } from './shared/schema-org.DC9JJOX5.js';
4
+ export { M as MetaInput, bf as UserConfig } from './shared/schema-org.C9XO8kJo.js';
5
+
6
+ declare const schemaOrgAutoImports: {
7
+ from: string;
8
+ imports: string[];
9
+ }[];
10
+
11
+ declare function useSchemaOrg(input?: UseSchemaOrgInput, options?: HeadEntryOptions): ActiveHeadEntry<UseSchemaOrgInput>;
12
+
13
+ export { schemaOrgAutoImports, useSchemaOrg };
@@ -0,0 +1,29 @@
1
+ import { useUnhead, useHead } from '@unhead/solid-js';
2
+ import { s as schemaAutoImports } from './shared/schema-org.q010LqYD.mjs';
3
+ import { a0 as UnheadSchemaOrg, aC as normalizeSchemaOrgInput } from './shared/schema-org.CZClK-9x.mjs';
4
+ export { a6 as defineArticle, at as defineBook, a7 as defineBreadcrumb, a8 as defineComment, au as defineCourse, a9 as defineEvent, aa as defineFoodEstablishment, ad as defineHowTo, af as defineImage, av as defineItemList, ag as defineJobPosting, ah as defineLocalBusiness, ax as defineMovie, ak as defineOrganization, al as definePerson, am as defineProduct, an as defineQuestion, ao as defineRecipe, ap as defineReview, aA as defineSoftwareApp, aq as defineVideo, ar as defineWebPage, as as defineWebSite } from './shared/schema-org.CZClK-9x.mjs';
5
+ import 'defu';
6
+ import 'unhead/plugins';
7
+ import 'unhead/utils';
8
+ import 'ufo';
9
+ import 'ohash';
10
+
11
+ const schemaOrgAutoImports = [
12
+ {
13
+ from: "@unhead/schema-org/solid-js",
14
+ imports: schemaAutoImports
15
+ }
16
+ ];
17
+ function useSchemaOrg(input = [], options = {}) {
18
+ const unhead = options.head || useUnhead();
19
+ unhead.use(UnheadSchemaOrg());
20
+ const entry = useHead(normalizeSchemaOrgInput(input), options);
21
+ const corePatch = entry.patch;
22
+ if (!entry.__patched) {
23
+ entry.patch = (input2) => corePatch(normalizeSchemaOrgInput(input2));
24
+ entry.__patched = true;
25
+ }
26
+ return entry;
27
+ }
28
+
29
+ export { schemaOrgAutoImports, useSchemaOrg };
@@ -0,0 +1,13 @@
1
+ import { HeadEntryOptions, ActiveHeadEntry } from 'unhead/types';
2
+ import { U as UseSchemaOrgInput } from './shared/schema-org.BDzDgQHq.mjs';
3
+ export { c as defineArticle, A as defineBook, e as defineBreadcrumb, f as defineComment, B as defineCourse, g as defineEvent, h as defineFoodEstablishment, k as defineHowTo, m as defineImage, C as defineItemList, n as defineJobPosting, o as defineLocalBusiness, E as defineMovie, r as defineOrganization, s as definePerson, t as defineProduct, u as defineQuestion, v as defineRecipe, w as defineReview, H as defineSoftwareApp, x as defineVideo, y as defineWebPage, z as defineWebSite } from './shared/schema-org.BDzDgQHq.mjs';
4
+ export { M as MetaInput, bf as UserConfig } from './shared/schema-org.C9XO8kJo.mjs';
5
+
6
+ declare function useSchemaOrg(input?: UseSchemaOrgInput, options?: HeadEntryOptions): ActiveHeadEntry<UseSchemaOrgInput>;
7
+
8
+ declare const schemaOrgAutoImports: {
9
+ from: string;
10
+ imports: string[];
11
+ }[];
12
+
13
+ export { schemaOrgAutoImports, useSchemaOrg };
@@ -0,0 +1,13 @@
1
+ import { HeadEntryOptions, ActiveHeadEntry } from 'unhead/types';
2
+ import { U as UseSchemaOrgInput } from './shared/schema-org.DC9JJOX5.js';
3
+ export { c as defineArticle, A as defineBook, e as defineBreadcrumb, f as defineComment, B as defineCourse, g as defineEvent, h as defineFoodEstablishment, k as defineHowTo, m as defineImage, C as defineItemList, n as defineJobPosting, o as defineLocalBusiness, E as defineMovie, r as defineOrganization, s as definePerson, t as defineProduct, u as defineQuestion, v as defineRecipe, w as defineReview, H as defineSoftwareApp, x as defineVideo, y as defineWebPage, z as defineWebSite } from './shared/schema-org.DC9JJOX5.js';
4
+ export { M as MetaInput, bf as UserConfig } from './shared/schema-org.C9XO8kJo.js';
5
+
6
+ declare function useSchemaOrg(input?: UseSchemaOrgInput, options?: HeadEntryOptions): ActiveHeadEntry<UseSchemaOrgInput>;
7
+
8
+ declare const schemaOrgAutoImports: {
9
+ from: string;
10
+ imports: string[];
11
+ }[];
12
+
13
+ export { schemaOrgAutoImports, useSchemaOrg };
@@ -0,0 +1,26 @@
1
+ import { useUnhead, useHead } from '@unhead/svelte';
2
+ import { s as schemaAutoImports } from './shared/schema-org.q010LqYD.mjs';
3
+ import { a0 as UnheadSchemaOrg, aC as normalizeSchemaOrgInput } from './shared/schema-org.CZClK-9x.mjs';
4
+ export { a6 as defineArticle, at as defineBook, a7 as defineBreadcrumb, a8 as defineComment, au as defineCourse, a9 as defineEvent, aa as defineFoodEstablishment, ad as defineHowTo, af as defineImage, av as defineItemList, ag as defineJobPosting, ah as defineLocalBusiness, ax as defineMovie, ak as defineOrganization, al as definePerson, am as defineProduct, an as defineQuestion, ao as defineRecipe, ap as defineReview, aA as defineSoftwareApp, aq as defineVideo, ar as defineWebPage, as as defineWebSite } from './shared/schema-org.CZClK-9x.mjs';
5
+ import 'defu';
6
+ import 'unhead/plugins';
7
+ import 'unhead/utils';
8
+ import 'ufo';
9
+ import 'ohash';
10
+
11
+ function useSchemaOrg(input = [], options = {}) {
12
+ const unhead = options.head || useUnhead();
13
+ unhead.use(UnheadSchemaOrg());
14
+ const entry = useHead(normalizeSchemaOrgInput(input), options);
15
+ const corePatch = entry.patch;
16
+ entry.patch = (input2) => corePatch(normalizeSchemaOrgInput(input2));
17
+ return entry;
18
+ }
19
+ const schemaOrgAutoImports = [
20
+ {
21
+ from: "@unhead/schema-org/svelte",
22
+ imports: schemaAutoImports
23
+ }
24
+ ];
25
+
26
+ export { schemaOrgAutoImports, useSchemaOrg };
package/dist/vue.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { P as PostalAddress, c as AggregateOffer, d as AggregateRating, e as Article, B as BreadcrumbList, C as Comment, E as Event, F as FoodEstablishment, V as VirtualLocation, f as Place, H as HowTo, g as HowToStep, I as ImageObject, J as JobPosting, L as LocalBusiness, O as Offer, h as OpeningHoursSpecification, i as Organization, j as Person, k as Product, Q as Question, l as Recipe, m as Review, n as VideoObject, W as WebPage, o as WebSite, p as Book, q as Course, r as ItemList, s as ListItem, t as Movie, u as SearchAction, v as ReadAction, w as SoftwareApp, x as BookEdition, A as Arrayable, T as Thing } from './shared/schema-org.D_ha4uKf.mjs';
2
- export { M as MetaInput, bc as PluginSchemaOrg, bd as SchemaOrgUnheadPlugin, bj as UserConfig } from './shared/schema-org.D_ha4uKf.mjs';
1
+ export { a as PluginSchemaOrg, S as SchemaOrgUnheadPlugin } from './shared/schema-org.BGcOuybr.mjs';
3
2
  import { ComponentResolver } from 'unplugin-vue-components';
4
3
  import { defineComponent } from 'vue';
5
- import * as _unhead_vue from '@unhead/vue';
6
- import { ResolvableProperties } from '@unhead/vue';
7
- import '@unhead/schema';
4
+ import { ResolvableProperties, UseHeadOptions } from '@unhead/vue';
5
+ import { ActiveHeadEntry } from 'unhead/types';
6
+ import { ay as PostalAddress, e as AggregateOffer, h as AggregateRating, k as Article, t as BreadcrumbList, w as Comment, F as Event, Q as FoodEstablishment, L as VirtualLocation, J as Place, X as HowTo, $ as HowToStep, a4 as ImageObject, aa as JobPosting, ag as LocalBusiness, am as Offer, ap as OpeningHoursSpecification, as as Organization, av as Person, aB as Product, aF as Question, aL as Recipe, aQ as Review, aW as VideoObject, aZ as WebPage, b4 as WebSite, m as Book, z as Course, a7 as ItemList, ad as ListItem, aj as Movie, b8 as SearchAction, b1 as ReadAction, aT as SoftwareApp, o as BookEdition, A as Arrayable, T as Thing } from './shared/schema-org.C9XO8kJo.mjs';
7
+ export { M as MetaInput, bf as UserConfig } from './shared/schema-org.C9XO8kJo.mjs';
8
8
 
9
9
  interface SchemaOrgResolverOptions {
10
10
  /**
@@ -14,7 +14,6 @@ interface SchemaOrgResolverOptions {
14
14
  */
15
15
  prefix?: string;
16
16
  }
17
- declare const schemaAutoImports: string[];
18
17
  declare const schemaOrgAutoImports: {
19
18
  from: string;
20
19
  imports: string[];
@@ -83,10 +82,6 @@ declare function defineReadAction<T extends Record<string, any>>(input?: Resolva
83
82
  declare function defineSoftwareApp<T extends Record<string, any>>(input?: ResolvableProperties<SoftwareApp & T>): ResolvableProperties<SoftwareApp & T>;
84
83
  declare function defineBookEdition<T extends Record<string, any>>(input?: ResolvableProperties<BookEdition & T>): ResolvableProperties<BookEdition & T>;
85
84
  type UseSchemaOrgInput = Arrayable<ResolvableProperties<Thing | Record<string, any>>>;
86
- declare function useSchemaOrg(input: UseSchemaOrgInput): _unhead_vue.ActiveHeadEntry<_unhead_vue.UseHeadInput<{
87
- script: {
88
- nodes: UseSchemaOrgInput;
89
- };
90
- }>>;
85
+ declare function useSchemaOrg(input?: UseSchemaOrgInput, options?: UseHeadOptions): ActiveHeadEntry<UseSchemaOrgInput>;
91
86
 
92
- export { SchemaOrgArticle, SchemaOrgBook, SchemaOrgBreadcrumb, SchemaOrgComment, SchemaOrgCourse, SchemaOrgEvent, SchemaOrgFoodEstablishment, SchemaOrgHowTo, SchemaOrgImage, SchemaOrgItemList, SchemaOrgJobPosting, SchemaOrgLocalBusiness, SchemaOrgMovie, SchemaOrgOrganization, SchemaOrgPerson, SchemaOrgProduct, SchemaOrgQuestion, SchemaOrgRecipe, SchemaOrgResolver, type SchemaOrgResolverOptions, SchemaOrgReview, SchemaOrgSoftwareApp, SchemaOrgVideo, SchemaOrgWebPage, SchemaOrgWebSite, type UseSchemaOrgInput, defineAddress, defineAggregateOffer, defineAggregateRating, defineArticle, defineBook, defineBookEdition, defineBreadcrumb, defineComment, defineCourse, defineEvent, defineFoodEstablishment, defineHowTo, defineHowToStep, defineImage, defineItemList, defineJobPosting, defineListItem, defineLocalBusiness, defineMovie, defineOffer, defineOpeningHours, defineOrganization, definePerson, definePlace, defineProduct, defineQuestion, defineReadAction, defineRecipe, defineReview, defineSchemaOrgComponent, defineSearchAction, defineSoftwareApp, defineVideo, defineVirtualLocation, defineWebPage, defineWebSite, schemaAutoImports, schemaOrgAutoImports, schemaOrgComponents, useSchemaOrg };
87
+ export { SchemaOrgArticle, SchemaOrgBook, SchemaOrgBreadcrumb, SchemaOrgComment, SchemaOrgCourse, SchemaOrgEvent, SchemaOrgFoodEstablishment, SchemaOrgHowTo, SchemaOrgImage, SchemaOrgItemList, SchemaOrgJobPosting, SchemaOrgLocalBusiness, SchemaOrgMovie, SchemaOrgOrganization, SchemaOrgPerson, SchemaOrgProduct, SchemaOrgQuestion, SchemaOrgRecipe, SchemaOrgResolver, type SchemaOrgResolverOptions, SchemaOrgReview, SchemaOrgSoftwareApp, SchemaOrgVideo, SchemaOrgWebPage, SchemaOrgWebSite, type UseSchemaOrgInput, defineAddress, defineAggregateOffer, defineAggregateRating, defineArticle, defineBook, defineBookEdition, defineBreadcrumb, defineComment, defineCourse, defineEvent, defineFoodEstablishment, defineHowTo, defineHowToStep, defineImage, defineItemList, defineJobPosting, defineListItem, defineLocalBusiness, defineMovie, defineOffer, defineOpeningHours, defineOrganization, definePerson, definePlace, defineProduct, defineQuestion, defineReadAction, defineRecipe, defineReview, defineSchemaOrgComponent, defineSearchAction, defineSoftwareApp, defineVideo, defineVirtualLocation, defineWebPage, defineWebSite, schemaOrgAutoImports, schemaOrgComponents, useSchemaOrg };