@unhead/shared 1.7.4 → 1.8.0-beta.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/index.cjs CHANGED
@@ -322,13 +322,7 @@ function handleObjectEntry(key, v) {
322
322
  Object.entries(value).forEach(([k2, v2]) => {
323
323
  input[`${key}${k2 === "url" ? "" : `${k2.charAt(0).toUpperCase()}${k2.slice(1)}`}`] = v2;
324
324
  });
325
- const unpacked = unpackMeta(input).sort(
326
- (a, b) => (
327
- // @ts-expect-error untyped
328
- (a[attr]?.length || 0) - (b[attr]?.length || 0)
329
- )
330
- );
331
- return unpacked;
325
+ return unpackMeta(input).sort((a, b) => (a[attr]?.length || 0) - (b[attr]?.length || 0));
332
326
  }
333
327
  return [{ [attr]: fKey, ...value }];
334
328
  }
@@ -611,6 +605,8 @@ function tagWeight(tag) {
611
605
  }
612
606
  const SortModifiers = [{ prefix: "before:", offset: -1 }, { prefix: "after:", offset: 1 }];
613
607
 
608
+ const NetworkEvents = ["onload", "onerror", "onabort", "onprogress", "onloadstart"];
609
+
614
610
  const sepSub = "%separator";
615
611
  function processTemplateParams(s, p, sep) {
616
612
  if (typeof s !== "string" || !s.includes("%"))
@@ -651,6 +647,7 @@ function processTemplateParams(s, p, sep) {
651
647
 
652
648
  exports.HasElementTags = HasElementTags;
653
649
  exports.IsBrowser = IsBrowser;
650
+ exports.NetworkEvents = NetworkEvents;
654
651
  exports.SelfClosingTags = SelfClosingTags;
655
652
  exports.SortModifiers = SortModifiers;
656
653
  exports.TAG_ALIASES = TAG_ALIASES;
package/dist/index.d.cts CHANGED
@@ -58,6 +58,8 @@ declare const SortModifiers: {
58
58
  offset: number;
59
59
  }[];
60
60
 
61
+ declare const NetworkEvents: string[];
62
+
61
63
  declare function processTemplateParams(s: string, p: TemplateParams, sep: string): string;
62
64
 
63
- export { type Arrayable, HasElementTags, IsBrowser, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseClassProp, normaliseEntryTags, normaliseProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, unpackMeta, whitelistSafeInput };
65
+ export { type Arrayable, HasElementTags, IsBrowser, NetworkEvents, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseClassProp, normaliseEntryTags, normaliseProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, unpackMeta, whitelistSafeInput };
package/dist/index.d.mts CHANGED
@@ -58,6 +58,8 @@ declare const SortModifiers: {
58
58
  offset: number;
59
59
  }[];
60
60
 
61
+ declare const NetworkEvents: string[];
62
+
61
63
  declare function processTemplateParams(s: string, p: TemplateParams, sep: string): string;
62
64
 
63
- export { type Arrayable, HasElementTags, IsBrowser, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseClassProp, normaliseEntryTags, normaliseProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, unpackMeta, whitelistSafeInput };
65
+ export { type Arrayable, HasElementTags, IsBrowser, NetworkEvents, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseClassProp, normaliseEntryTags, normaliseProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, unpackMeta, whitelistSafeInput };
package/dist/index.d.ts CHANGED
@@ -58,6 +58,8 @@ declare const SortModifiers: {
58
58
  offset: number;
59
59
  }[];
60
60
 
61
+ declare const NetworkEvents: string[];
62
+
61
63
  declare function processTemplateParams(s: string, p: TemplateParams, sep: string): string;
62
64
 
63
- export { type Arrayable, HasElementTags, IsBrowser, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseClassProp, normaliseEntryTags, normaliseProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, unpackMeta, whitelistSafeInput };
65
+ export { type Arrayable, HasElementTags, IsBrowser, NetworkEvents, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseClassProp, normaliseEntryTags, normaliseProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, unpackMeta, whitelistSafeInput };
package/dist/index.mjs CHANGED
@@ -320,13 +320,7 @@ function handleObjectEntry(key, v) {
320
320
  Object.entries(value).forEach(([k2, v2]) => {
321
321
  input[`${key}${k2 === "url" ? "" : `${k2.charAt(0).toUpperCase()}${k2.slice(1)}`}`] = v2;
322
322
  });
323
- const unpacked = unpackMeta(input).sort(
324
- (a, b) => (
325
- // @ts-expect-error untyped
326
- (a[attr]?.length || 0) - (b[attr]?.length || 0)
327
- )
328
- );
329
- return unpacked;
323
+ return unpackMeta(input).sort((a, b) => (a[attr]?.length || 0) - (b[attr]?.length || 0));
330
324
  }
331
325
  return [{ [attr]: fKey, ...value }];
332
326
  }
@@ -609,6 +603,8 @@ function tagWeight(tag) {
609
603
  }
610
604
  const SortModifiers = [{ prefix: "before:", offset: -1 }, { prefix: "after:", offset: 1 }];
611
605
 
606
+ const NetworkEvents = ["onload", "onerror", "onabort", "onprogress", "onloadstart"];
607
+
612
608
  const sepSub = "%separator";
613
609
  function processTemplateParams(s, p, sep) {
614
610
  if (typeof s !== "string" || !s.includes("%"))
@@ -647,4 +643,4 @@ function processTemplateParams(s, p, sep) {
647
643
  return s;
648
644
  }
649
645
 
650
- export { HasElementTags, IsBrowser, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray$1 as asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseClassProp, normaliseEntryTags, normaliseProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, unpackMeta, whitelistSafeInput };
646
+ export { HasElementTags, IsBrowser, NetworkEvents, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray$1 as asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseClassProp, normaliseEntryTags, normaliseProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, unpackMeta, whitelistSafeInput };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/shared",
3
3
  "type": "module",
4
- "version": "1.7.4",
4
+ "version": "1.8.0-beta.1",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -34,7 +34,7 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "@unhead/schema": "1.7.4"
37
+ "@unhead/schema": "1.8.0-beta.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "packrup": "^0.1.0"