nuxt4, and some changes on packages
This commit is contained in:
+2
-2
@@ -1,9 +1,9 @@
|
||||
export { u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/unhead.BPM0-cfG.mjs';
|
||||
export { c as createHeadCore, a as createUnhead } from './shared/unhead.CXyUfY4l.mjs';
|
||||
export { c as createHeadCore, a as createUnhead } from './shared/unhead.DH45uomy.mjs';
|
||||
export { u as useScript } from './shared/unhead.B578PsDV.mjs';
|
||||
import './shared/unhead.CApf5sj3.mjs';
|
||||
import './shared/unhead.DQc16pHI.mjs';
|
||||
import './shared/unhead.yem5I2v_.mjs';
|
||||
import 'hookable';
|
||||
import './shared/unhead.ytfIU1HR.mjs';
|
||||
import './shared/unhead.BpRRHAhY.mjs';
|
||||
import './shared/unhead.DZbvapt-.mjs';
|
||||
|
||||
+14
-8
@@ -1,11 +1,21 @@
|
||||
export { A as AliasSortingPlugin, D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin } from './shared/unhead.DeCxexjU.mjs';
|
||||
export { A as AliasSortingPlugin, D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin } from './shared/unhead.Djo8ep_Y.mjs';
|
||||
import { d as defineHeadPlugin } from './shared/unhead.CApf5sj3.mjs';
|
||||
export { F as FlatMetaPlugin, S as SafeInputPlugin } from './shared/unhead.CApf5sj3.mjs';
|
||||
import './shared/unhead.DZbvapt-.mjs';
|
||||
import './shared/unhead.C13swrCa.mjs';
|
||||
import './shared/unhead.BYvz9V1x.mjs';
|
||||
import './shared/unhead.DQc16pHI.mjs';
|
||||
import './shared/unhead.yem5I2v_.mjs';
|
||||
|
||||
const META_TRANSFORMABLE_URL = [
|
||||
"og:url",
|
||||
"og:image",
|
||||
"og:image:secure_url",
|
||||
"twitter:image",
|
||||
"twitter:image:src",
|
||||
"og:video",
|
||||
"og:video:secure_url",
|
||||
"og:see_also"
|
||||
];
|
||||
function CanonicalPlugin(options) {
|
||||
return (head) => {
|
||||
let host = options.canonicalHost || (!head.ssr ? window.location.origin : "");
|
||||
@@ -30,12 +40,8 @@ function CanonicalPlugin(options) {
|
||||
hooks: {
|
||||
"tags:resolve": (ctx) => {
|
||||
for (const tag of ctx.tags) {
|
||||
if (tag.tag === "meta") {
|
||||
if (tag.props.property?.startsWith("og:image") || tag.props.name?.startsWith("twitter:image")) {
|
||||
tag.props.content = resolvePath(tag.props.content);
|
||||
} else if (tag.props?.property === "og:url") {
|
||||
tag.props.content = resolvePath(tag.props.content);
|
||||
}
|
||||
if (tag.tag === "meta" && (META_TRANSFORMABLE_URL.includes(tag.props?.property) || META_TRANSFORMABLE_URL.includes(tag.props?.name))) {
|
||||
tag.props.content = resolvePath(tag.props.content);
|
||||
} else if (tag.tag === "link" && tag.props.rel === "canonical") {
|
||||
tag.props.href = resolvePath(tag.props.href);
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { a as createUnhead } from './shared/unhead.CXyUfY4l.mjs';
|
||||
import { a as createUnhead } from './shared/unhead.DH45uomy.mjs';
|
||||
import { T as TagsWithInnerContent, S as SelfClosingTags$1 } from './shared/unhead.yem5I2v_.mjs';
|
||||
import 'hookable';
|
||||
import './shared/unhead.ytfIU1HR.mjs';
|
||||
import './shared/unhead.BpRRHAhY.mjs';
|
||||
import './shared/unhead.DZbvapt-.mjs';
|
||||
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
@@ -67,7 +67,7 @@ function createHead(options = {}) {
|
||||
return unhead;
|
||||
}
|
||||
|
||||
const Attrs = /(\w+)(?:=["']([^"']*)["'])?/g;
|
||||
const Attrs = /(\w+-?\w+)(?:=["']([^"']*)["'])?/g;
|
||||
const HtmlTag = /<html[^>]*>/;
|
||||
const BodyTag = /<body[^>]*>/;
|
||||
const HeadContent = /<head[^>]*>(.*?)<\/head>/s;
|
||||
|
||||
Generated
Vendored
+1
-6
@@ -1,5 +1,4 @@
|
||||
const SepSub = "%separator";
|
||||
const SepSubRE = new RegExp(`${SepSub}(?:\\s*${SepSub})*`, "g");
|
||||
function sub(p, token, isJson = false) {
|
||||
let val;
|
||||
if (token === "s" || token === "pageTitle") {
|
||||
@@ -36,11 +35,7 @@ function processTemplateParams(s, p, sep, isJson = false) {
|
||||
return re !== void 0 ? re : token;
|
||||
}).trim();
|
||||
if (hasSepSub) {
|
||||
if (s.endsWith(SepSub))
|
||||
s = s.slice(0, -SepSub.length);
|
||||
if (s.startsWith(SepSub))
|
||||
s = s.slice(SepSub.length);
|
||||
s = s.replace(SepSubRE, sep || "").trim();
|
||||
s = s.split(SepSub).map((part) => part.trim()).filter((part) => part !== "").join(sep ? ` ${sep} ` : " ");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
Generated
Vendored
+16
-1
@@ -1,6 +1,12 @@
|
||||
import { U as UniqueTags, T as TagsWithInnerContent, M as MetaTagsArrayable, a as TagConfigKeys, D as DupeableTags } from './unhead.yem5I2v_.mjs';
|
||||
|
||||
const allowedMetaProperties = ["name", "property", "http-equiv"];
|
||||
const StandardSingleMetaTags = /* @__PURE__ */ new Set([
|
||||
"viewport",
|
||||
"description",
|
||||
"keywords",
|
||||
"robots"
|
||||
]);
|
||||
function isMetaArrayDupeKey(v) {
|
||||
const parts = v.split(":");
|
||||
if (!parts.length)
|
||||
@@ -18,7 +24,12 @@ function dedupeKey(tag) {
|
||||
if (tag.tag === "meta") {
|
||||
for (const n of allowedMetaProperties) {
|
||||
if (props[n] !== void 0) {
|
||||
return `${name}:${props[n]}`;
|
||||
const propValue = props[n];
|
||||
const isStructured = propValue.includes(":");
|
||||
const isStandardSingle = StandardSingleMetaTags.has(propValue);
|
||||
const shouldAlwaysDedupe = isStructured || isStandardSingle;
|
||||
const keyPart = !shouldAlwaysDedupe && tag.key ? `:key:${tag.key}` : "";
|
||||
return `${name}:${propValue}${keyPart}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,6 +112,10 @@ function normalizeProps(tag, input) {
|
||||
if (!input) {
|
||||
return tag;
|
||||
}
|
||||
if (tag.tag === "templateParams") {
|
||||
tag.props = input;
|
||||
return tag;
|
||||
}
|
||||
Object.entries(input).forEach(([key, value]) => {
|
||||
if (value === null) {
|
||||
tag.props[key] = null;
|
||||
Generated
Vendored
+14
-6
@@ -1,5 +1,5 @@
|
||||
import { createHooks } from 'hookable';
|
||||
import { n as normalizeEntryToTags, d as dedupeKey, i as isMetaArrayDupeKey } from './unhead.ytfIU1HR.mjs';
|
||||
import { n as normalizeEntryToTags, d as dedupeKey, i as isMetaArrayDupeKey } from './unhead.BpRRHAhY.mjs';
|
||||
import { t as tagWeight, s as sortTags } from './unhead.DZbvapt-.mjs';
|
||||
import { c as UsesMergeStrategy, V as ValidHeadTags } from './unhead.yem5I2v_.mjs';
|
||||
|
||||
@@ -23,7 +23,7 @@ function createUnhead(resolvedOptions = {}) {
|
||||
const ssr = !resolvedOptions.document;
|
||||
const entries = /* @__PURE__ */ new Map();
|
||||
const plugins = /* @__PURE__ */ new Map();
|
||||
const normalizeQueue = [];
|
||||
const normalizeQueue = /* @__PURE__ */ new Set();
|
||||
const head = {
|
||||
_entryCount: 1,
|
||||
// 0 is reserved for internal use
|
||||
@@ -45,12 +45,12 @@ function createUnhead(resolvedOptions = {}) {
|
||||
const _ = {
|
||||
_poll(rm = false) {
|
||||
head.dirty = true;
|
||||
!rm && normalizeQueue.push(_i);
|
||||
!rm && normalizeQueue.add(_i);
|
||||
hooks.callHook("entries:updated", head);
|
||||
},
|
||||
dispose() {
|
||||
if (entries.delete(_i)) {
|
||||
_._poll(true);
|
||||
head.invalidate();
|
||||
}
|
||||
},
|
||||
// a patch is the same as creating a new entry, just a nice DX
|
||||
@@ -72,8 +72,9 @@ function createUnhead(resolvedOptions = {}) {
|
||||
entries: [...head.entries.values()]
|
||||
};
|
||||
await hooks.callHook("entries:resolve", ctx);
|
||||
while (normalizeQueue.length) {
|
||||
const i = normalizeQueue.shift();
|
||||
while (normalizeQueue.size) {
|
||||
const i = normalizeQueue.values().next().value;
|
||||
normalizeQueue.delete(i);
|
||||
const e = entries.get(i);
|
||||
if (e) {
|
||||
const normalizeCtx = {
|
||||
@@ -161,6 +162,13 @@ function createUnhead(resolvedOptions = {}) {
|
||||
finalTags.push(t);
|
||||
}
|
||||
return finalTags;
|
||||
},
|
||||
invalidate() {
|
||||
for (const entry of entries.values()) {
|
||||
normalizeQueue.add(entry._i);
|
||||
}
|
||||
head.dirty = true;
|
||||
hooks.callHook("entries:updated", head);
|
||||
}
|
||||
};
|
||||
(resolvedOptions?.plugins || []).forEach((p) => registerPlugin(head, p));
|
||||
Generated
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { d as defineHeadPlugin } from './unhead.CApf5sj3.mjs';
|
||||
import { s as sortTags } from './unhead.DZbvapt-.mjs';
|
||||
import { p as processTemplateParams } from './unhead.C13swrCa.mjs';
|
||||
import { p as processTemplateParams } from './unhead.BYvz9V1x.mjs';
|
||||
|
||||
const formatKey = (k) => !k.includes(":key") ? k.split(":").join(":key:") : k;
|
||||
const AliasSortingPlugin = defineHeadPlugin({
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
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';
|
||||
export { d as dedupeKey, h as hashTag, i as isMetaArrayDupeKey, n as normalizeEntryToTags, a as normalizeProps, w as walkResolver } from './shared/unhead.ytfIU1HR.mjs';
|
||||
export { d as dedupeKey, h as hashTag, i as isMetaArrayDupeKey, n as normalizeEntryToTags, a as normalizeProps, w as walkResolver } from './shared/unhead.BpRRHAhY.mjs';
|
||||
export { r as resolveMetaKeyType, a as resolveMetaKeyValue, b as resolvePackedMetaObjectValue, u as unpackMeta } from './shared/unhead.DQc16pHI.mjs';
|
||||
export { s as sortTags, t as tagWeight } from './shared/unhead.DZbvapt-.mjs';
|
||||
export { p as processTemplateParams } from './shared/unhead.C13swrCa.mjs';
|
||||
export { p as processTemplateParams } from './shared/unhead.BYvz9V1x.mjs';
|
||||
|
||||
Reference in New Issue
Block a user