unhead 2.1.11 → 2.1.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/client.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { a as createUnhead } from './shared/unhead.D_nrZZPH.mjs';
1
+ import { a as createUnhead } from './shared/unhead.Ct24BOby.mjs';
2
2
  import { H as HasElementTags } from './shared/unhead.yem5I2v_.mjs';
3
- import { i as isMetaArrayDupeKey, a as normalizeProps, d as dedupeKey, h as hashTag } from './shared/unhead.fVVqDC1O.mjs';
3
+ import { i as isMetaArrayDupeKey, a as normalizeProps, d as dedupeKey, h as hashTag } from './shared/unhead.B5FWS6X0.mjs';
4
4
  import 'hookable';
5
5
  import './shared/unhead.CbpEuj3y.mjs';
6
6
 
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- export { u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/unhead.DwlZTAdp.mjs';
2
- export { c as createHeadCore, a as createUnhead } from './shared/unhead.D_nrZZPH.mjs';
1
+ export { u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/unhead._ybhDo-G.mjs';
2
+ export { c as createHeadCore, a as createUnhead } from './shared/unhead.Ct24BOby.mjs';
3
3
  export { u as useScript } from './shared/unhead.BnoAbrHA.mjs';
4
- import './shared/unhead.DxVOmucZ.mjs';
4
+ import './shared/unhead.0eF0fa-Y.mjs';
5
5
  import './shared/unhead.DQc16pHI.mjs';
6
6
  import './shared/unhead.yem5I2v_.mjs';
7
7
  import 'hookable';
8
- import './shared/unhead.fVVqDC1O.mjs';
8
+ import './shared/unhead.B5FWS6X0.mjs';
9
9
  import './shared/unhead.CbpEuj3y.mjs';
package/dist/legacy.mjs CHANGED
@@ -1,12 +1,12 @@
1
- import { a as createUnhead } from './shared/unhead.D_nrZZPH.mjs';
2
- import { D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin, A as AliasSortingPlugin } from './shared/unhead.Bx2DpYJy.mjs';
3
- export { u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/unhead.DwlZTAdp.mjs';
1
+ import { a as createUnhead } from './shared/unhead.Ct24BOby.mjs';
2
+ import { D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin, A as AliasSortingPlugin } from './shared/unhead.Chhckluj.mjs';
3
+ export { u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/unhead._ybhDo-G.mjs';
4
4
  export { u as useScript } from './shared/unhead.BnoAbrHA.mjs';
5
5
  import 'hookable';
6
- import './shared/unhead.fVVqDC1O.mjs';
6
+ import './shared/unhead.B5FWS6X0.mjs';
7
7
  import './shared/unhead.yem5I2v_.mjs';
8
8
  import './shared/unhead.CbpEuj3y.mjs';
9
- import './shared/unhead.DxVOmucZ.mjs';
9
+ import './shared/unhead.0eF0fa-Y.mjs';
10
10
  import './shared/unhead.DQc16pHI.mjs';
11
11
  import './shared/unhead.BYvz9V1x.mjs';
12
12
 
package/dist/plugins.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export { A as AliasSortingPlugin, D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin } from './shared/unhead.Bx2DpYJy.mjs';
2
- import { d as defineHeadPlugin } from './shared/unhead.DxVOmucZ.mjs';
3
- export { F as FlatMetaPlugin, S as SafeInputPlugin } from './shared/unhead.DxVOmucZ.mjs';
1
+ export { A as AliasSortingPlugin, D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin } from './shared/unhead.Chhckluj.mjs';
2
+ import { d as defineHeadPlugin } from './shared/unhead.0eF0fa-Y.mjs';
3
+ export { F as FlatMetaPlugin, S as SafeInputPlugin } from './shared/unhead.0eF0fa-Y.mjs';
4
4
  import './shared/unhead.CbpEuj3y.mjs';
5
5
  import './shared/unhead.BYvz9V1x.mjs';
6
6
  import './shared/unhead.DQc16pHI.mjs';
package/dist/server.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { a as createUnhead } from './shared/unhead.D_nrZZPH.mjs';
1
+ import { a as createUnhead } from './shared/unhead.Ct24BOby.mjs';
2
2
  import { T as TagsWithInnerContent, S as SelfClosingTags } from './shared/unhead.yem5I2v_.mjs';
3
3
  import { parseHtmlForUnheadExtraction, applyHeadToHtml, parseHtmlForIndexes } from './parser.mjs';
4
4
  import 'hookable';
5
- import './shared/unhead.fVVqDC1O.mjs';
5
+ import './shared/unhead.B5FWS6X0.mjs';
6
6
  import './shared/unhead.CbpEuj3y.mjs';
7
7
 
8
8
  // @__NO_SIDE_EFFECTS__
@@ -100,7 +100,7 @@ function stripProtoKeys(obj) {
100
100
  if (obj && typeof obj === "object") {
101
101
  const clean = {};
102
102
  for (const key of Object.keys(obj)) {
103
- if (key === "__proto__" || key === "constructor")
103
+ if (key === "__proto__" || key === "constructor" || key === "prototype")
104
104
  continue;
105
105
  clean[key] = stripProtoKeys(obj[key]);
106
106
  }
@@ -1,4 +1,4 @@
1
- import { U as UniqueTags, T as TagsWithInnerContent, M as MetaTagsArrayable, a as TagConfigKeys, D as DupeableTags } from './unhead.yem5I2v_.mjs';
1
+ import { U as UniqueTags, T as TagsWithInnerContent, M as MetaTagsArrayable, H as HasElementTags, a as TagConfigKeys, D as DupeableTags } from './unhead.yem5I2v_.mjs';
2
2
 
3
3
  const allowedMetaProperties = ["name", "property", "http-equiv"];
4
4
  const StandardSingleMetaTags = /* @__PURE__ */ new Set([
@@ -124,17 +124,20 @@ function normalizeProps(tag, input) {
124
124
  tag.props = input;
125
125
  return tag;
126
126
  }
127
- Object.entries(input).forEach(([key, value]) => {
127
+ const isHtmlTag = HasElementTags.has(tag.tag) || tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs";
128
+ Object.entries(input).forEach(([prop, value]) => {
129
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype")
130
+ return;
128
131
  if (value === null) {
129
- tag.props[key] = null;
132
+ tag.props[prop] = null;
130
133
  return;
131
134
  }
132
- if (key === "class" || key === "style") {
133
- tag.props[key] = normalizeStyleClassProps(key, value);
135
+ if (prop === "class" || prop === "style") {
136
+ tag.props[prop] = normalizeStyleClassProps(prop, value);
134
137
  return;
135
138
  }
136
- if (TagConfigKeys.has(key)) {
137
- if (["textContent", "innerHTML"].includes(key) && typeof value === "object") {
139
+ if (TagConfigKeys.has(prop)) {
140
+ if ((prop === "textContent" || prop === "innerHTML") && typeof value === "object") {
138
141
  let type = input.type;
139
142
  if (!input.type) {
140
143
  type = "application/json";
@@ -144,14 +147,15 @@ function normalizeProps(tag, input) {
144
147
  }
145
148
  input.type = type;
146
149
  tag.props.type = type;
147
- tag[key] = JSON.stringify(value);
150
+ tag[prop] = JSON.stringify(value);
148
151
  } else {
149
- tag[key] = value;
152
+ tag[prop] = value;
150
153
  }
151
154
  return;
152
155
  }
156
+ const isDataKey = prop.startsWith("data-");
157
+ const key = isHtmlTag && !isDataKey ? prop.toLowerCase() : prop;
153
158
  const strValue = String(value);
154
- const isDataKey = key.startsWith("data-");
155
159
  const isMetaContentKey = tag.tag === "meta" && key === "content";
156
160
  if (strValue === "true" || strValue === "") {
157
161
  tag.props[key] = isDataKey || isMetaContentKey ? strValue : true;
@@ -1,4 +1,4 @@
1
- import { d as defineHeadPlugin } from './unhead.DxVOmucZ.mjs';
1
+ import { d as defineHeadPlugin } from './unhead.0eF0fa-Y.mjs';
2
2
  import { s as sortTags } from './unhead.CbpEuj3y.mjs';
3
3
  import { p as processTemplateParams } from './unhead.BYvz9V1x.mjs';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { createHooks } from 'hookable';
2
- import { n as normalizeEntryToTags, d as dedupeKey, h as hashTag, i as isMetaArrayDupeKey } from './unhead.fVVqDC1O.mjs';
2
+ import { n as normalizeEntryToTags, d as dedupeKey, h as hashTag, i as isMetaArrayDupeKey } from './unhead.B5FWS6X0.mjs';
3
3
  import { t as tagWeight, s as sortTags } from './unhead.CbpEuj3y.mjs';
4
4
  import { c as UsesMergeStrategy, V as ValidHeadTags } from './unhead.yem5I2v_.mjs';
5
5
 
@@ -1,4 +1,4 @@
1
- import { S as SafeInputPlugin, F as FlatMetaPlugin } from './unhead.DxVOmucZ.mjs';
1
+ import { S as SafeInputPlugin, F as FlatMetaPlugin } from './unhead.0eF0fa-Y.mjs';
2
2
 
3
3
  function useHead(unhead, input, options = {}) {
4
4
  return unhead.push(input || {}, options);
package/dist/utils.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  export { D as DupeableTags, H as HasElementTags, M as MetaTagsArrayable, b as ScriptNetworkEvents, S as SelfClosingTags, a as TagConfigKeys, T as TagsWithInnerContent, U as UniqueTags, c as UsesMergeStrategy, V as ValidHeadTags } from './shared/unhead.yem5I2v_.mjs';
2
- export { d as dedupeKey, h as hashTag, i as isMetaArrayDupeKey, n as normalizeEntryToTags, a as normalizeProps, w as walkResolver } from './shared/unhead.fVVqDC1O.mjs';
2
+ export { d as dedupeKey, h as hashTag, i as isMetaArrayDupeKey, n as normalizeEntryToTags, a as normalizeProps, w as walkResolver } from './shared/unhead.B5FWS6X0.mjs';
3
3
  export { r as resolveMetaKeyType, a as resolveMetaKeyValue, b as resolvePackedMetaObjectValue, u as unpackMeta } from './shared/unhead.DQc16pHI.mjs';
4
4
  export { s as sortTags, t as tagWeight } from './shared/unhead.CbpEuj3y.mjs';
5
5
  export { p as processTemplateParams } from './shared/unhead.BYvz9V1x.mjs';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unhead",
3
3
  "type": "module",
4
- "version": "2.1.11",
4
+ "version": "2.1.12",
5
5
  "description": "Full-stack <head> manager built for any framework.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",