修改登录判断问题
This commit is contained in:
1
.output/server/node_modules/@popperjs/core/dist/index.mjs
generated
vendored
1
.output/server/node_modules/@popperjs/core/dist/index.mjs
generated
vendored
File diff suppressed because one or more lines are too long
129
.output/server/node_modules/@popperjs/core/package.json
generated
vendored
129
.output/server/node_modules/@popperjs/core/package.json
generated
vendored
File diff suppressed because one or more lines are too long
197
.output/server/node_modules/@unhead/dom/dist/index.mjs
generated
vendored
197
.output/server/node_modules/@unhead/dom/dist/index.mjs
generated
vendored
@@ -1,197 +0,0 @@
|
||||
import { HasElementTags, hashTag, normaliseProps, tagDedupeKey, defineHeadPlugin } from '@unhead/shared';
|
||||
|
||||
async function renderDOMHead(head, options = {}) {
|
||||
const dom = options.document || head.resolvedOptions.document;
|
||||
if (!dom || !head.dirty)
|
||||
return;
|
||||
const beforeRenderCtx = { shouldRender: true, tags: [] };
|
||||
await head.hooks.callHook("dom:beforeRender", beforeRenderCtx);
|
||||
if (!beforeRenderCtx.shouldRender)
|
||||
return;
|
||||
if (head._domUpdatePromise) {
|
||||
return head._domUpdatePromise;
|
||||
}
|
||||
head._domUpdatePromise = new Promise(async (resolve) => {
|
||||
const tags = (await head.resolveTags()).map((tag) => ({
|
||||
tag,
|
||||
id: HasElementTags.has(tag.tag) ? hashTag(tag) : tag.tag,
|
||||
shouldRender: true
|
||||
}));
|
||||
let state = head._dom;
|
||||
if (!state) {
|
||||
state = {
|
||||
elMap: { htmlAttrs: dom.documentElement, bodyAttrs: dom.body }
|
||||
};
|
||||
const takenDedupeKeys = /* @__PURE__ */ new Set();
|
||||
for (const key of ["body", "head"]) {
|
||||
const children = dom[key]?.children;
|
||||
for (const c of children) {
|
||||
const tag = c.tagName.toLowerCase();
|
||||
if (!HasElementTags.has(tag)) {
|
||||
continue;
|
||||
}
|
||||
const t = {
|
||||
tag,
|
||||
props: await normaliseProps(
|
||||
c.getAttributeNames().reduce((props, name) => ({ ...props, [name]: c.getAttribute(name) }), {})
|
||||
),
|
||||
innerHTML: c.innerHTML
|
||||
};
|
||||
const dedupeKey = tagDedupeKey(t);
|
||||
let d = dedupeKey;
|
||||
let i = 1;
|
||||
while (d && takenDedupeKeys.has(d))
|
||||
d = `${dedupeKey}:${i++}`;
|
||||
if (d) {
|
||||
t._d = d;
|
||||
takenDedupeKeys.add(d);
|
||||
}
|
||||
state.elMap[c.getAttribute("data-hid") || hashTag(t)] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
state.pendingSideEffects = { ...state.sideEffects };
|
||||
state.sideEffects = {};
|
||||
function track(id, scope, fn) {
|
||||
const k = `${id}:${scope}`;
|
||||
state.sideEffects[k] = fn;
|
||||
delete state.pendingSideEffects[k];
|
||||
}
|
||||
function trackCtx({ id, $el, tag }) {
|
||||
const isAttrTag = tag.tag.endsWith("Attrs");
|
||||
state.elMap[id] = $el;
|
||||
if (!isAttrTag) {
|
||||
if (tag.textContent && tag.textContent !== $el.textContent) {
|
||||
$el.textContent = tag.textContent;
|
||||
}
|
||||
if (tag.innerHTML && tag.innerHTML !== $el.innerHTML) {
|
||||
$el.innerHTML = tag.innerHTML;
|
||||
}
|
||||
track(id, "el", () => {
|
||||
state.elMap[id]?.remove();
|
||||
delete state.elMap[id];
|
||||
});
|
||||
}
|
||||
if (tag._eventHandlers) {
|
||||
for (const k in tag._eventHandlers) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag._eventHandlers, k)) {
|
||||
continue;
|
||||
}
|
||||
if ($el.getAttribute(`data-${k}`) !== "") {
|
||||
(tag.tag === "bodyAttrs" ? dom.defaultView : $el).addEventListener(
|
||||
// onload -> load
|
||||
k.substring(2),
|
||||
tag._eventHandlers[k].bind($el)
|
||||
);
|
||||
$el.setAttribute(`data-${k}`, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const k in tag.props) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.props, k)) {
|
||||
continue;
|
||||
}
|
||||
const value = tag.props[k];
|
||||
const ck = `attr:${k}`;
|
||||
if (k === "class") {
|
||||
if (!value) {
|
||||
continue;
|
||||
}
|
||||
for (const c of value.split(" ")) {
|
||||
isAttrTag && track(id, `${ck}:${c}`, () => $el.classList.remove(c));
|
||||
!$el.classList.contains(c) && $el.classList.add(c);
|
||||
}
|
||||
} else if (k === "style") {
|
||||
if (!value) {
|
||||
continue;
|
||||
}
|
||||
for (const c of value.split(";")) {
|
||||
const propIndex = c.indexOf(":");
|
||||
const k2 = c.substring(0, propIndex).trim();
|
||||
const v = c.substring(propIndex + 1).trim();
|
||||
track(id, `${ck}:${k2}`, () => {
|
||||
$el.style.removeProperty(k2);
|
||||
});
|
||||
$el.style.setProperty(k2, v);
|
||||
}
|
||||
} else {
|
||||
$el.getAttribute(k) !== value && $el.setAttribute(k, value === true ? "" : String(value));
|
||||
isAttrTag && track(id, ck, () => $el.removeAttribute(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
const pending = [];
|
||||
const frag = {
|
||||
bodyClose: void 0,
|
||||
bodyOpen: void 0,
|
||||
head: void 0
|
||||
};
|
||||
for (const ctx of tags) {
|
||||
const { tag, shouldRender, id } = ctx;
|
||||
if (!shouldRender)
|
||||
continue;
|
||||
if (tag.tag === "title") {
|
||||
dom.title = tag.textContent;
|
||||
continue;
|
||||
}
|
||||
ctx.$el = ctx.$el || state.elMap[id];
|
||||
if (ctx.$el) {
|
||||
trackCtx(ctx);
|
||||
} else if (HasElementTags.has(tag.tag)) {
|
||||
pending.push(ctx);
|
||||
}
|
||||
}
|
||||
for (const ctx of pending) {
|
||||
const pos = ctx.tag.tagPosition || "head";
|
||||
ctx.$el = dom.createElement(ctx.tag.tag);
|
||||
trackCtx(ctx);
|
||||
frag[pos] = frag[pos] || dom.createDocumentFragment();
|
||||
frag[pos].appendChild(ctx.$el);
|
||||
}
|
||||
for (const ctx of tags)
|
||||
await head.hooks.callHook("dom:renderTag", ctx, dom, track);
|
||||
frag.head && dom.head.appendChild(frag.head);
|
||||
frag.bodyOpen && dom.body.insertBefore(frag.bodyOpen, dom.body.firstChild);
|
||||
frag.bodyClose && dom.body.appendChild(frag.bodyClose);
|
||||
for (const k in state.pendingSideEffects) {
|
||||
state.pendingSideEffects[k]();
|
||||
}
|
||||
head._dom = state;
|
||||
await head.hooks.callHook("dom:rendered", { renders: tags });
|
||||
resolve();
|
||||
}).finally(() => {
|
||||
head._domUpdatePromise = void 0;
|
||||
head.dirty = false;
|
||||
});
|
||||
return head._domUpdatePromise;
|
||||
}
|
||||
|
||||
function debouncedRenderDOMHead(head, options = {}) {
|
||||
const fn = options.delayFn || ((fn2) => setTimeout(fn2, 10));
|
||||
return head._domDebouncedUpdatePromise = head._domDebouncedUpdatePromise || new Promise((resolve) => fn(() => {
|
||||
return renderDOMHead(head, options).then(() => {
|
||||
delete head._domDebouncedUpdatePromise;
|
||||
resolve();
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function DomPlugin(options) {
|
||||
return defineHeadPlugin((head) => {
|
||||
const initialPayload = head.resolvedOptions.document?.head.querySelector('script[id="unhead:payload"]')?.innerHTML || false;
|
||||
if (initialPayload) {
|
||||
head.push(JSON.parse(initialPayload));
|
||||
}
|
||||
return {
|
||||
mode: "client",
|
||||
hooks: {
|
||||
"entries:updated": (head2) => {
|
||||
debouncedRenderDOMHead(head2, options);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export { DomPlugin, debouncedRenderDOMHead, renderDOMHead };
|
||||
43
.output/server/node_modules/@unhead/dom/package.json
generated
vendored
43
.output/server/node_modules/@unhead/dom/package.json
generated
vendored
@@ -1,43 +0,0 @@
|
||||
{
|
||||
"name": "@unhead/dom",
|
||||
"type": "module",
|
||||
"version": "1.11.19",
|
||||
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/harlan-zw",
|
||||
"homepage": "https://unhead.unjs.io",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/unjs/unhead.git",
|
||||
"directory": "packages/dom"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/unjs/unhead/issues"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "dist/index.cjs",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@unhead/schema": "1.11.19",
|
||||
"@unhead/shared": "1.11.19"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild .",
|
||||
"stub": "unbuild . --stub",
|
||||
"export:sizes": "npx export-size . -r"
|
||||
},
|
||||
"__npminstall_done": true,
|
||||
"_from": "@unhead/dom@1.11.19",
|
||||
"_resolved": "https://registry.npmmirror.com/@unhead/dom/-/dom-1.11.19.tgz"
|
||||
}
|
||||
641
.output/server/node_modules/@unhead/shared/dist/index.mjs
generated
vendored
641
.output/server/node_modules/@unhead/shared/dist/index.mjs
generated
vendored
@@ -1,641 +0,0 @@
|
||||
import { unpackToString, unpackToArray, packArray } from 'packrup';
|
||||
|
||||
function asArray(value) {
|
||||
return Array.isArray(value) ? value : [value];
|
||||
}
|
||||
|
||||
const SelfClosingTags = /* @__PURE__ */ new Set(["meta", "link", "base"]);
|
||||
const TagsWithInnerContent = /* @__PURE__ */ new Set(["title", "titleTemplate", "script", "style", "noscript"]);
|
||||
const HasElementTags = /* @__PURE__ */ new Set([
|
||||
"base",
|
||||
"meta",
|
||||
"link",
|
||||
"style",
|
||||
"script",
|
||||
"noscript"
|
||||
]);
|
||||
const ValidHeadTags = /* @__PURE__ */ new Set([
|
||||
"title",
|
||||
"titleTemplate",
|
||||
"templateParams",
|
||||
"base",
|
||||
"htmlAttrs",
|
||||
"bodyAttrs",
|
||||
"meta",
|
||||
"link",
|
||||
"style",
|
||||
"script",
|
||||
"noscript"
|
||||
]);
|
||||
const UniqueTags = /* @__PURE__ */ new Set(["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs", "templateParams"]);
|
||||
const TagConfigKeys = /* @__PURE__ */ new Set(["tagPosition", "tagPriority", "tagDuplicateStrategy", "children", "innerHTML", "textContent", "processTemplateParams"]);
|
||||
const IsBrowser = typeof window !== "undefined";
|
||||
const composableNames = [
|
||||
"getActiveHead",
|
||||
"useHead",
|
||||
"useSeoMeta",
|
||||
"useHeadSafe",
|
||||
"useServerHead",
|
||||
"useServerSeoMeta",
|
||||
"useServerHeadSafe"
|
||||
];
|
||||
|
||||
function defineHeadPlugin(plugin) {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
function hashCode(s) {
|
||||
let h = 9;
|
||||
for (let i = 0; i < s.length; )
|
||||
h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9);
|
||||
return ((h ^ h >>> 9) + 65536).toString(16).substring(1, 8).toLowerCase();
|
||||
}
|
||||
function hashTag(tag) {
|
||||
if (tag._h) {
|
||||
return tag._h;
|
||||
}
|
||||
if (tag._d) {
|
||||
return hashCode(tag._d);
|
||||
}
|
||||
let content = `${tag.tag}:${tag.textContent || tag.innerHTML || ""}:`;
|
||||
for (const key in tag.props) {
|
||||
content += `${key}:${String(tag.props[key])},`;
|
||||
}
|
||||
return hashCode(content);
|
||||
}
|
||||
|
||||
const p = (p2) => ({ keyValue: p2, metaKey: "property" });
|
||||
const k = (p2) => ({ keyValue: p2 });
|
||||
const MetaPackingSchema = {
|
||||
appleItunesApp: {
|
||||
unpack: {
|
||||
entrySeparator: ", ",
|
||||
resolve({ key, value }) {
|
||||
return `${fixKeyCase(key)}=${value}`;
|
||||
}
|
||||
}
|
||||
},
|
||||
articleExpirationTime: p("article:expiration_time"),
|
||||
articleModifiedTime: p("article:modified_time"),
|
||||
articlePublishedTime: p("article:published_time"),
|
||||
bookReleaseDate: p("book:release_date"),
|
||||
charset: {
|
||||
metaKey: "charset"
|
||||
},
|
||||
contentSecurityPolicy: {
|
||||
unpack: {
|
||||
entrySeparator: "; ",
|
||||
resolve({ key, value }) {
|
||||
return `${fixKeyCase(key)} ${value}`;
|
||||
}
|
||||
},
|
||||
metaKey: "http-equiv"
|
||||
},
|
||||
contentType: {
|
||||
metaKey: "http-equiv"
|
||||
},
|
||||
defaultStyle: {
|
||||
metaKey: "http-equiv"
|
||||
},
|
||||
fbAppId: p("fb:app_id"),
|
||||
msapplicationConfig: k("msapplication-Config"),
|
||||
msapplicationTileColor: k("msapplication-TileColor"),
|
||||
msapplicationTileImage: k("msapplication-TileImage"),
|
||||
ogAudioSecureUrl: p("og:audio:secure_url"),
|
||||
ogAudioUrl: p("og:audio"),
|
||||
ogImageSecureUrl: p("og:image:secure_url"),
|
||||
ogImageUrl: p("og:image"),
|
||||
ogSiteName: p("og:site_name"),
|
||||
ogVideoSecureUrl: p("og:video:secure_url"),
|
||||
ogVideoUrl: p("og:video"),
|
||||
profileFirstName: p("profile:first_name"),
|
||||
profileLastName: p("profile:last_name"),
|
||||
profileUsername: p("profile:username"),
|
||||
refresh: {
|
||||
metaKey: "http-equiv",
|
||||
unpack: {
|
||||
entrySeparator: ";",
|
||||
resolve({ key, value }) {
|
||||
if (key === "seconds")
|
||||
return `${value}`;
|
||||
}
|
||||
}
|
||||
},
|
||||
robots: {
|
||||
unpack: {
|
||||
entrySeparator: ", ",
|
||||
resolve({ key, value }) {
|
||||
if (typeof value === "boolean")
|
||||
return `${fixKeyCase(key)}`;
|
||||
else
|
||||
return `${fixKeyCase(key)}:${value}`;
|
||||
}
|
||||
}
|
||||
},
|
||||
xUaCompatible: {
|
||||
metaKey: "http-equiv"
|
||||
}
|
||||
};
|
||||
const openGraphNamespaces = /* @__PURE__ */ new Set([
|
||||
"og",
|
||||
"book",
|
||||
"article",
|
||||
"profile"
|
||||
]);
|
||||
function resolveMetaKeyType(key) {
|
||||
const fKey = fixKeyCase(key);
|
||||
const prefixIndex = fKey.indexOf(":");
|
||||
if (openGraphNamespaces.has(fKey.substring(0, prefixIndex)))
|
||||
return "property";
|
||||
return MetaPackingSchema[key]?.metaKey || "name";
|
||||
}
|
||||
function resolveMetaKeyValue(key) {
|
||||
return MetaPackingSchema[key]?.keyValue || fixKeyCase(key);
|
||||
}
|
||||
function fixKeyCase(key) {
|
||||
const updated = key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
||||
const prefixIndex = updated.indexOf("-");
|
||||
const fKey = updated.substring(0, prefixIndex);
|
||||
if (fKey === "twitter" || openGraphNamespaces.has(fKey))
|
||||
return key.replace(/([A-Z])/g, ":$1").toLowerCase();
|
||||
return updated;
|
||||
}
|
||||
function changeKeyCasingDeep(input) {
|
||||
if (Array.isArray(input)) {
|
||||
return input.map((entry) => changeKeyCasingDeep(entry));
|
||||
}
|
||||
if (typeof input !== "object" || Array.isArray(input))
|
||||
return input;
|
||||
const output = {};
|
||||
for (const key in input) {
|
||||
if (!Object.prototype.hasOwnProperty.call(input, key)) {
|
||||
continue;
|
||||
}
|
||||
output[fixKeyCase(key)] = changeKeyCasingDeep(input[key]);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
function resolvePackedMetaObjectValue(value, key) {
|
||||
const definition = MetaPackingSchema[key];
|
||||
if (key === "refresh")
|
||||
return `${value.seconds};url=${value.url}`;
|
||||
return unpackToString(
|
||||
changeKeyCasingDeep(value),
|
||||
{
|
||||
keyValueSeparator: "=",
|
||||
entrySeparator: ", ",
|
||||
resolve({ value: value2, key: key2 }) {
|
||||
if (value2 === null)
|
||||
return "";
|
||||
if (typeof value2 === "boolean")
|
||||
return `${key2}`;
|
||||
},
|
||||
...definition?.unpack
|
||||
}
|
||||
);
|
||||
}
|
||||
const ObjectArrayEntries = /* @__PURE__ */ new Set(["og:image", "og:video", "og:audio", "twitter:image"]);
|
||||
function sanitize(input) {
|
||||
const out = {};
|
||||
for (const k2 in input) {
|
||||
if (!Object.prototype.hasOwnProperty.call(input, k2)) {
|
||||
continue;
|
||||
}
|
||||
const v = input[k2];
|
||||
if (String(v) !== "false" && k2)
|
||||
out[k2] = v;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function handleObjectEntry(key, v) {
|
||||
const value = sanitize(v);
|
||||
const fKey = fixKeyCase(key);
|
||||
const attr = resolveMetaKeyType(fKey);
|
||||
if (ObjectArrayEntries.has(fKey)) {
|
||||
const input = {};
|
||||
for (const k2 in value) {
|
||||
if (!Object.prototype.hasOwnProperty.call(value, k2)) {
|
||||
continue;
|
||||
}
|
||||
input[`${key}${k2 === "url" ? "" : `${k2[0].toUpperCase()}${k2.slice(1)}`}`] = value[k2];
|
||||
}
|
||||
return unpackMeta(input).sort((a, b) => (a[attr]?.length || 0) - (b[attr]?.length || 0));
|
||||
}
|
||||
return [{ [attr]: fKey, ...value }];
|
||||
}
|
||||
function unpackMeta(input) {
|
||||
const extras = [];
|
||||
const primitives = {};
|
||||
for (const key in input) {
|
||||
if (!Object.prototype.hasOwnProperty.call(input, key)) {
|
||||
continue;
|
||||
}
|
||||
const value = input[key];
|
||||
if (!Array.isArray(value)) {
|
||||
if (typeof value === "object" && value) {
|
||||
if (ObjectArrayEntries.has(fixKeyCase(key))) {
|
||||
extras.push(...handleObjectEntry(key, value));
|
||||
continue;
|
||||
}
|
||||
primitives[key] = sanitize(value);
|
||||
} else {
|
||||
primitives[key] = value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for (const v of value) {
|
||||
extras.push(...typeof v === "string" ? unpackMeta({ [key]: v }) : handleObjectEntry(key, v));
|
||||
}
|
||||
}
|
||||
const meta = unpackToArray(primitives, {
|
||||
key({ key }) {
|
||||
return resolveMetaKeyType(key);
|
||||
},
|
||||
value({ key }) {
|
||||
return key === "charset" ? "charset" : "content";
|
||||
},
|
||||
resolveKeyData({ key }) {
|
||||
return resolveMetaKeyValue(key);
|
||||
},
|
||||
resolveValueData({ value, key }) {
|
||||
if (value === null)
|
||||
return "_null";
|
||||
if (typeof value === "object")
|
||||
return resolvePackedMetaObjectValue(value, key);
|
||||
return typeof value === "number" ? value.toString() : value;
|
||||
}
|
||||
});
|
||||
return [...extras, ...meta].map((m) => {
|
||||
if (m.content === "_null")
|
||||
m.content = null;
|
||||
return m;
|
||||
});
|
||||
}
|
||||
function packMeta(inputs) {
|
||||
const mappedPackingSchema = Object.entries(MetaPackingSchema).map(([key, value]) => [key, value.keyValue]);
|
||||
return packArray(inputs, {
|
||||
key: ["name", "property", "httpEquiv", "http-equiv", "charset"],
|
||||
value: ["content", "charset"],
|
||||
resolveKey(k2) {
|
||||
let key = mappedPackingSchema.filter((sk) => sk[1] === k2)?.[0]?.[0] || k2;
|
||||
const replacer = (_, letter) => letter?.toUpperCase();
|
||||
key = key.replace(/:([a-z])/g, replacer).replace(/-([a-z])/g, replacer);
|
||||
return key;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function thenable(val, thenFn) {
|
||||
if (val instanceof Promise) {
|
||||
return val.then(thenFn);
|
||||
}
|
||||
return thenFn(val);
|
||||
}
|
||||
|
||||
function normaliseTag(tagName, input, e, normalizedProps) {
|
||||
const props = normalizedProps || normaliseProps(
|
||||
// explicitly check for an object
|
||||
// @ts-expect-error untyped
|
||||
typeof input === "object" && typeof input !== "function" && !(input instanceof Promise) ? { ...input } : { [tagName === "script" || tagName === "noscript" || tagName === "style" ? "innerHTML" : "textContent"]: input },
|
||||
tagName === "templateParams" || tagName === "titleTemplate"
|
||||
);
|
||||
if (props instanceof Promise) {
|
||||
return props.then((val) => normaliseTag(tagName, input, e, val));
|
||||
}
|
||||
const tag = {
|
||||
tag: tagName,
|
||||
props
|
||||
};
|
||||
for (const k of TagConfigKeys) {
|
||||
const val = tag.props[k] !== void 0 ? tag.props[k] : e[k];
|
||||
if (val !== void 0) {
|
||||
if (!(k === "innerHTML" || k === "textContent" || k === "children") || TagsWithInnerContent.has(tag.tag)) {
|
||||
tag[k === "children" ? "innerHTML" : k] = val;
|
||||
}
|
||||
delete tag.props[k];
|
||||
}
|
||||
}
|
||||
if (tag.props.body) {
|
||||
tag.tagPosition = "bodyClose";
|
||||
delete tag.props.body;
|
||||
}
|
||||
if (tag.tag === "script") {
|
||||
if (typeof tag.innerHTML === "object") {
|
||||
tag.innerHTML = JSON.stringify(tag.innerHTML);
|
||||
tag.props.type = tag.props.type || "application/json";
|
||||
}
|
||||
}
|
||||
return Array.isArray(tag.props.content) ? tag.props.content.map((v) => ({ ...tag, props: { ...tag.props, content: v } })) : tag;
|
||||
}
|
||||
function normaliseStyleClassProps(key, v) {
|
||||
const sep = key === "class" ? " " : ";";
|
||||
if (v && typeof v === "object" && !Array.isArray(v)) {
|
||||
v = Object.entries(v).filter(([, v2]) => v2).map(([k, v2]) => key === "style" ? `${k}:${v2}` : k);
|
||||
}
|
||||
return String(Array.isArray(v) ? v.join(sep) : v)?.split(sep).filter((c) => Boolean(c.trim())).join(sep);
|
||||
}
|
||||
function nestedNormaliseProps(props, virtual, keys, startIndex) {
|
||||
for (let i = startIndex; i < keys.length; i += 1) {
|
||||
const k = keys[i];
|
||||
if (k === "class" || k === "style") {
|
||||
props[k] = normaliseStyleClassProps(k, props[k]);
|
||||
continue;
|
||||
}
|
||||
if (props[k] instanceof Promise) {
|
||||
return props[k].then((val) => {
|
||||
props[k] = val;
|
||||
return nestedNormaliseProps(props, virtual, keys, i);
|
||||
});
|
||||
}
|
||||
if (!virtual && !TagConfigKeys.has(k)) {
|
||||
const v = String(props[k]);
|
||||
const isDataKey = k.startsWith("data-");
|
||||
if (v === "true" || v === "") {
|
||||
props[k] = isDataKey ? "true" : true;
|
||||
} else if (!props[k]) {
|
||||
if (isDataKey && v === "false")
|
||||
props[k] = "false";
|
||||
else
|
||||
delete props[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function normaliseProps(props, virtual = false) {
|
||||
const resolvedProps = nestedNormaliseProps(props, virtual, Object.keys(props), 0);
|
||||
if (resolvedProps instanceof Promise) {
|
||||
return resolvedProps.then(() => props);
|
||||
}
|
||||
return props;
|
||||
}
|
||||
const TagEntityBits = 10;
|
||||
function nestedNormaliseEntryTags(headTags, tagPromises, startIndex) {
|
||||
for (let i = startIndex; i < tagPromises.length; i += 1) {
|
||||
const tags = tagPromises[i];
|
||||
if (tags instanceof Promise) {
|
||||
return tags.then((val) => {
|
||||
tagPromises[i] = val;
|
||||
return nestedNormaliseEntryTags(headTags, tagPromises, i);
|
||||
});
|
||||
}
|
||||
if (Array.isArray(tags)) {
|
||||
headTags.push(...tags);
|
||||
} else {
|
||||
headTags.push(tags);
|
||||
}
|
||||
}
|
||||
}
|
||||
function normaliseEntryTags(e) {
|
||||
const tagPromises = [];
|
||||
const input = e.resolvedInput;
|
||||
for (const k in input) {
|
||||
if (!Object.prototype.hasOwnProperty.call(input, k)) {
|
||||
continue;
|
||||
}
|
||||
const v = input[k];
|
||||
if (v === void 0 || !ValidHeadTags.has(k)) {
|
||||
continue;
|
||||
}
|
||||
if (Array.isArray(v)) {
|
||||
for (const props of v) {
|
||||
tagPromises.push(normaliseTag(k, props, e));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
tagPromises.push(normaliseTag(k, v, e));
|
||||
}
|
||||
if (tagPromises.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const headTags = [];
|
||||
return thenable(nestedNormaliseEntryTags(headTags, tagPromises, 0), () => headTags.map((t, i) => {
|
||||
t._e = e._i;
|
||||
e.mode && (t._m = e.mode);
|
||||
t._p = (e._i << TagEntityBits) + i;
|
||||
return t;
|
||||
}));
|
||||
}
|
||||
|
||||
const WhitelistAttributes = {
|
||||
htmlAttrs: ["id", "class", "lang", "dir"],
|
||||
bodyAttrs: ["id", "class"],
|
||||
meta: ["id", "name", "property", "charset", "content"],
|
||||
noscript: ["id", "textContent"],
|
||||
script: ["id", "type", "textContent"],
|
||||
link: ["id", "color", "crossorigin", "fetchpriority", "href", "hreflang", "imagesrcset", "imagesizes", "integrity", "media", "referrerpolicy", "rel", "sizes", "type"]
|
||||
};
|
||||
function acceptDataAttrs(value) {
|
||||
const filtered = {};
|
||||
Object.keys(value || {}).filter((a) => a.startsWith("data-")).forEach((a) => {
|
||||
filtered[a] = value[a];
|
||||
});
|
||||
return filtered;
|
||||
}
|
||||
function whitelistSafeInput(input) {
|
||||
const filtered = {};
|
||||
Object.keys(input).forEach((key) => {
|
||||
const tagValue = input[key];
|
||||
if (!tagValue)
|
||||
return;
|
||||
switch (key) {
|
||||
// always safe
|
||||
case "title":
|
||||
case "titleTemplate":
|
||||
case "templateParams":
|
||||
filtered[key] = tagValue;
|
||||
break;
|
||||
case "htmlAttrs":
|
||||
case "bodyAttrs":
|
||||
filtered[key] = acceptDataAttrs(tagValue);
|
||||
WhitelistAttributes[key].forEach((a) => {
|
||||
if (tagValue[a])
|
||||
filtered[key][a] = tagValue[a];
|
||||
});
|
||||
break;
|
||||
// meta is safe, except for http-equiv
|
||||
case "meta":
|
||||
if (Array.isArray(tagValue)) {
|
||||
filtered[key] = tagValue.map((meta) => {
|
||||
const safeMeta = acceptDataAttrs(meta);
|
||||
WhitelistAttributes.meta.forEach((key2) => {
|
||||
if (meta[key2])
|
||||
safeMeta[key2] = meta[key2];
|
||||
});
|
||||
return safeMeta;
|
||||
}).filter((meta) => Object.keys(meta).length > 0);
|
||||
}
|
||||
break;
|
||||
// link tags we don't allow stylesheets, scripts, preloading, prerendering, prefetching, etc
|
||||
case "link":
|
||||
if (Array.isArray(tagValue)) {
|
||||
filtered[key] = tagValue.map((meta) => {
|
||||
const link = acceptDataAttrs(meta);
|
||||
WhitelistAttributes.link.forEach((key2) => {
|
||||
const val = meta[key2];
|
||||
if (key2 === "rel" && (val === "stylesheet" || val === "canonical" || val === "modulepreload" || val === "prerender" || val === "preload" || val === "prefetch"))
|
||||
return;
|
||||
if (key2 === "href") {
|
||||
if (val.includes("javascript:") || val.includes("data:"))
|
||||
return;
|
||||
link[key2] = val;
|
||||
} else if (val) {
|
||||
link[key2] = val;
|
||||
}
|
||||
});
|
||||
return link;
|
||||
}).filter((link) => Object.keys(link).length > 1 && !!link.rel);
|
||||
}
|
||||
break;
|
||||
case "noscript":
|
||||
if (Array.isArray(tagValue)) {
|
||||
filtered[key] = tagValue.map((meta) => {
|
||||
const noscript = acceptDataAttrs(meta);
|
||||
WhitelistAttributes.noscript.forEach((key2) => {
|
||||
if (meta[key2])
|
||||
noscript[key2] = meta[key2];
|
||||
});
|
||||
return noscript;
|
||||
}).filter((meta) => Object.keys(meta).length > 0);
|
||||
}
|
||||
break;
|
||||
// we only allow JSON in scripts
|
||||
case "script":
|
||||
if (Array.isArray(tagValue)) {
|
||||
filtered[key] = tagValue.map((script) => {
|
||||
const safeScript = acceptDataAttrs(script);
|
||||
WhitelistAttributes.script.forEach((s) => {
|
||||
if (script[s]) {
|
||||
if (s === "textContent") {
|
||||
try {
|
||||
const jsonVal = typeof script[s] === "string" ? JSON.parse(script[s]) : script[s];
|
||||
safeScript[s] = JSON.stringify(jsonVal, null, 0);
|
||||
} catch (e) {
|
||||
}
|
||||
} else {
|
||||
safeScript[s] = script[s];
|
||||
}
|
||||
}
|
||||
});
|
||||
return safeScript;
|
||||
}).filter((meta) => Object.keys(meta).length > 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
return filtered;
|
||||
}
|
||||
|
||||
const NetworkEvents = /* @__PURE__ */ new Set(["onload", "onerror", "onabort", "onprogress", "onloadstart"]);
|
||||
const ScriptNetworkEvents = /* @__PURE__ */ new Set(["onload", "onerror"]);
|
||||
|
||||
const TAG_WEIGHTS = {
|
||||
// tags
|
||||
base: -10,
|
||||
title: 10
|
||||
};
|
||||
const TAG_ALIASES = {
|
||||
// relative scores to their default values
|
||||
critical: -80,
|
||||
high: -10,
|
||||
low: 20
|
||||
};
|
||||
function tagWeight(tag) {
|
||||
const priority = tag.tagPriority;
|
||||
if (typeof priority === "number")
|
||||
return priority;
|
||||
let weight = 100;
|
||||
if (tag.tag === "meta") {
|
||||
if (tag.props["http-equiv"] === "content-security-policy")
|
||||
weight = -30;
|
||||
else if (tag.props.charset)
|
||||
weight = -20;
|
||||
else if (tag.props.name === "viewport")
|
||||
weight = -15;
|
||||
} else if (tag.tag === "link" && tag.props.rel === "preconnect") {
|
||||
weight = 20;
|
||||
} else if (tag.tag in TAG_WEIGHTS) {
|
||||
weight = TAG_WEIGHTS[tag.tag];
|
||||
}
|
||||
if (priority && priority in TAG_ALIASES) {
|
||||
return weight + TAG_ALIASES[priority];
|
||||
}
|
||||
return weight;
|
||||
}
|
||||
const SortModifiers = [{ prefix: "before:", offset: -1 }, { prefix: "after:", offset: 1 }];
|
||||
|
||||
const allowedMetaProperties = ["name", "property", "http-equiv"];
|
||||
function tagDedupeKey(tag) {
|
||||
const { props, tag: tagName } = tag;
|
||||
if (UniqueTags.has(tagName))
|
||||
return tagName;
|
||||
if (tagName === "link" && props.rel === "canonical")
|
||||
return "canonical";
|
||||
if (props.charset)
|
||||
return "charset";
|
||||
if (props.id) {
|
||||
return `${tagName}:id:${props.id}`;
|
||||
}
|
||||
for (const n of allowedMetaProperties) {
|
||||
if (props[n] !== void 0) {
|
||||
return `${tagName}:${n}:${props[n]}`;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const sepSub = "%separator";
|
||||
function sub(p, token, isJson = false) {
|
||||
let val;
|
||||
if (token === "s" || token === "pageTitle") {
|
||||
val = p.pageTitle;
|
||||
} else if (token.includes(".")) {
|
||||
const dotIndex = token.indexOf(".");
|
||||
val = p[token.substring(0, dotIndex)]?.[token.substring(dotIndex + 1)];
|
||||
} else {
|
||||
val = p[token];
|
||||
}
|
||||
if (val !== void 0) {
|
||||
return isJson ? (val || "").replace(/"/g, '\\"') : val || "";
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
const sepSubRe = new RegExp(`${sepSub}(?:\\s*${sepSub})*`, "g");
|
||||
function processTemplateParams(s, p, sep, isJson = false) {
|
||||
if (typeof s !== "string" || !s.includes("%"))
|
||||
return s;
|
||||
let decoded = s;
|
||||
try {
|
||||
decoded = decodeURI(s);
|
||||
} catch {
|
||||
}
|
||||
const tokens = decoded.match(/%\w+(?:\.\w+)?/g);
|
||||
if (!tokens) {
|
||||
return s;
|
||||
}
|
||||
const hasSepSub = s.includes(sepSub);
|
||||
s = s.replace(/%\w+(?:\.\w+)?/g, (token) => {
|
||||
if (token === sepSub || !tokens.includes(token)) {
|
||||
return token;
|
||||
}
|
||||
const re = sub(p, token.slice(1), isJson);
|
||||
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();
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
function resolveTitleTemplate(template, title) {
|
||||
if (template == null)
|
||||
return title || null;
|
||||
if (typeof template === "function")
|
||||
return template(title);
|
||||
return template;
|
||||
}
|
||||
|
||||
export { HasElementTags, IsBrowser, NetworkEvents, ScriptNetworkEvents, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseEntryTags, normaliseProps, normaliseStyleClassProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, thenable, unpackMeta, whitelistSafeInput };
|
||||
48
.output/server/node_modules/@unhead/shared/package.json
generated
vendored
48
.output/server/node_modules/@unhead/shared/package.json
generated
vendored
@@ -1,48 +0,0 @@
|
||||
{
|
||||
"name": "@unhead/shared",
|
||||
"type": "module",
|
||||
"version": "1.11.19",
|
||||
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/harlan-zw",
|
||||
"homepage": "https://unhead.unjs.io",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/unjs/unhead.git",
|
||||
"directory": "packages/schema"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/unjs/unhead/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"head",
|
||||
"meta tags",
|
||||
"types"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "dist/index.cjs",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"packrup": "^0.1.2",
|
||||
"@unhead/schema": "1.11.19"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild .",
|
||||
"stub": "unbuild . --stub",
|
||||
"export:sizes": "npx export-size . -r"
|
||||
},
|
||||
"__npminstall_done": true,
|
||||
"_from": "@unhead/shared@1.11.19",
|
||||
"_resolved": "https://registry.npmmirror.com/@unhead/shared/-/shared-1.11.19.tgz"
|
||||
}
|
||||
95
.output/server/node_modules/@unhead/ssr/dist/index.mjs
generated
vendored
95
.output/server/node_modules/@unhead/ssr/dist/index.mjs
generated
vendored
@@ -1,95 +0,0 @@
|
||||
import { TagsWithInnerContent, SelfClosingTags } from '@unhead/shared';
|
||||
|
||||
function encodeAttribute(value) {
|
||||
return String(value).replace(/"/g, """);
|
||||
}
|
||||
function propsToString(props) {
|
||||
let attrs = "";
|
||||
for (const key in props) {
|
||||
if (!Object.prototype.hasOwnProperty.call(props, key)) {
|
||||
continue;
|
||||
}
|
||||
const value = props[key];
|
||||
if (value !== false && value !== null) {
|
||||
attrs += value === true ? ` ${key}` : ` ${key}="${encodeAttribute(value)}"`;
|
||||
}
|
||||
}
|
||||
return attrs;
|
||||
}
|
||||
|
||||
function ssrRenderTags(tags, options) {
|
||||
const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: "", bodyClose: "", bodyOpen: "" } };
|
||||
const lineBreaks = !options?.omitLineBreaks ? "\n" : "";
|
||||
for (const tag of tags) {
|
||||
if (Object.keys(tag.props).length === 0 && !tag.innerHTML && !tag.textContent) {
|
||||
continue;
|
||||
}
|
||||
if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
|
||||
Object.assign(schema[tag.tag], tag.props);
|
||||
continue;
|
||||
}
|
||||
const s = tagToString(tag);
|
||||
const tagPosition = tag.tagPosition || "head";
|
||||
schema.tags[tagPosition] += schema.tags[tagPosition] ? `${lineBreaks}${s}` : s;
|
||||
}
|
||||
return {
|
||||
headTags: schema.tags.head,
|
||||
bodyTags: schema.tags.bodyClose,
|
||||
bodyTagsOpen: schema.tags.bodyOpen,
|
||||
htmlAttrs: propsToString(schema.htmlAttrs),
|
||||
bodyAttrs: propsToString(schema.bodyAttrs)
|
||||
};
|
||||
}
|
||||
|
||||
function escapeHtml(str) {
|
||||
return str.replace(/[&<>"'/]/g, (char) => {
|
||||
switch (char) {
|
||||
case "&":
|
||||
return "&";
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
case '"':
|
||||
return """;
|
||||
case "'":
|
||||
return "'";
|
||||
case "/":
|
||||
return "/";
|
||||
default:
|
||||
return char;
|
||||
}
|
||||
});
|
||||
}
|
||||
function tagToString(tag) {
|
||||
const attrs = propsToString(tag.props);
|
||||
const openTag = `<${tag.tag}${attrs}>`;
|
||||
if (!TagsWithInnerContent.has(tag.tag))
|
||||
return SelfClosingTags.has(tag.tag) ? openTag : `${openTag}</${tag.tag}>`;
|
||||
let content = String(tag.innerHTML || "");
|
||||
if (tag.textContent)
|
||||
content = escapeHtml(String(tag.textContent));
|
||||
return SelfClosingTags.has(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
|
||||
}
|
||||
|
||||
async function renderSSRHead(head, options) {
|
||||
const beforeRenderCtx = { shouldRender: true };
|
||||
await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
|
||||
if (!beforeRenderCtx.shouldRender) {
|
||||
return {
|
||||
headTags: "",
|
||||
bodyTags: "",
|
||||
bodyTagsOpen: "",
|
||||
htmlAttrs: "",
|
||||
bodyAttrs: ""
|
||||
};
|
||||
}
|
||||
const ctx = { tags: await head.resolveTags() };
|
||||
await head.hooks.callHook("ssr:render", ctx);
|
||||
const html = ssrRenderTags(ctx.tags, options);
|
||||
const renderCtx = { tags: ctx.tags, html };
|
||||
await head.hooks.callHook("ssr:rendered", renderCtx);
|
||||
return renderCtx.html;
|
||||
}
|
||||
|
||||
export { escapeHtml, propsToString, renderSSRHead, ssrRenderTags, tagToString };
|
||||
43
.output/server/node_modules/@unhead/ssr/package.json
generated
vendored
43
.output/server/node_modules/@unhead/ssr/package.json
generated
vendored
@@ -1,43 +0,0 @@
|
||||
{
|
||||
"name": "@unhead/ssr",
|
||||
"type": "module",
|
||||
"version": "1.11.19",
|
||||
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/harlan-zw",
|
||||
"homepage": "https://unhead.unjs.io",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/unjs/unhead.git",
|
||||
"directory": "packages/ssr"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/unjs/unhead/issues"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "dist/index.cjs",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@unhead/schema": "1.11.19",
|
||||
"@unhead/shared": "1.11.19"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild .",
|
||||
"stub": "unbuild . --stub",
|
||||
"export:sizes": "npx export-size . -r"
|
||||
},
|
||||
"__npminstall_done": true,
|
||||
"_from": "@unhead/ssr@1.11.19",
|
||||
"_resolved": "https://registry.npmmirror.com/@unhead/ssr/-/ssr-1.11.19.tgz"
|
||||
}
|
||||
2
.output/server/node_modules/axios/lib/adapters/http.js
generated
vendored
2
.output/server/node_modules/axios/lib/adapters/http.js
generated
vendored
@@ -228,7 +228,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
}
|
||||
|
||||
// Parse url
|
||||
const fullPath = buildFullPath(config.baseURL, config.url);
|
||||
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
||||
const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
|
||||
const protocol = parsed.protocol || supportedProtocols[0];
|
||||
|
||||
|
||||
11
.output/server/node_modules/axios/lib/core/Axios.js
generated
vendored
11
.output/server/node_modules/axios/lib/core/Axios.js
generated
vendored
@@ -97,6 +97,15 @@ class Axios {
|
||||
}
|
||||
}
|
||||
|
||||
// Set config.allowAbsoluteUrls
|
||||
if (config.allowAbsoluteUrls !== undefined) {
|
||||
// do nothing
|
||||
} else if (this.defaults.allowAbsoluteUrls !== undefined) {
|
||||
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
||||
} else {
|
||||
config.allowAbsoluteUrls = true;
|
||||
}
|
||||
|
||||
validator.assertOptions(config, {
|
||||
baseUrl: validators.spelling('baseURL'),
|
||||
withXsrfToken: validators.spelling('withXSRFToken')
|
||||
@@ -192,7 +201,7 @@ class Axios {
|
||||
|
||||
getUri(config) {
|
||||
config = mergeConfig(this.defaults, config);
|
||||
const fullPath = buildFullPath(config.baseURL, config.url);
|
||||
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
||||
return buildURL(fullPath, config.params, config.paramsSerializer);
|
||||
}
|
||||
}
|
||||
|
||||
5
.output/server/node_modules/axios/lib/core/buildFullPath.js
generated
vendored
5
.output/server/node_modules/axios/lib/core/buildFullPath.js
generated
vendored
@@ -13,8 +13,9 @@ import combineURLs from '../helpers/combineURLs.js';
|
||||
*
|
||||
* @returns {string} The combined full path
|
||||
*/
|
||||
export default function buildFullPath(baseURL, requestedURL) {
|
||||
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
||||
export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
||||
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
||||
if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
|
||||
return combineURLs(baseURL, requestedURL);
|
||||
}
|
||||
return requestedURL;
|
||||
|
||||
2
.output/server/node_modules/axios/lib/env/data.js
generated
vendored
2
.output/server/node_modules/axios/lib/env/data.js
generated
vendored
@@ -1 +1 @@
|
||||
export const VERSION = "1.7.9";
|
||||
export const VERSION = "1.8.2";
|
||||
5
.output/server/node_modules/axios/lib/helpers/formDataToStream.js
generated
vendored
5
.output/server/node_modules/axios/lib/helpers/formDataToStream.js
generated
vendored
@@ -2,8 +2,9 @@ import util from 'util';
|
||||
import {Readable} from 'stream';
|
||||
import utils from "../utils.js";
|
||||
import readBlob from "./readBlob.js";
|
||||
import platform from "../platform/index.js";
|
||||
|
||||
const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
|
||||
const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
|
||||
|
||||
const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util.TextEncoder();
|
||||
|
||||
@@ -63,7 +64,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
||||
const {
|
||||
tag = 'form-data-boundary',
|
||||
size = 25,
|
||||
boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
|
||||
boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
|
||||
} = options || {};
|
||||
|
||||
if(!utils.isFormData(form)) {
|
||||
|
||||
26
.output/server/node_modules/axios/lib/platform/node/index.js
generated
vendored
26
.output/server/node_modules/axios/lib/platform/node/index.js
generated
vendored
@@ -1,6 +1,30 @@
|
||||
import crypto from 'crypto';
|
||||
import URLSearchParams from './classes/URLSearchParams.js'
|
||||
import FormData from './classes/FormData.js'
|
||||
|
||||
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
|
||||
|
||||
const DIGIT = '0123456789';
|
||||
|
||||
const ALPHABET = {
|
||||
DIGIT,
|
||||
ALPHA,
|
||||
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
||||
}
|
||||
|
||||
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
||||
let str = '';
|
||||
const {length} = alphabet;
|
||||
const randomValues = new Uint32Array(size);
|
||||
crypto.randomFillSync(randomValues);
|
||||
for (let i = 0; i < size; i++) {
|
||||
str += alphabet[randomValues[i] % length];
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
isNode: true,
|
||||
classes: {
|
||||
@@ -8,5 +32,7 @@ export default {
|
||||
FormData,
|
||||
Blob: typeof Blob !== 'undefined' && Blob || null
|
||||
},
|
||||
ALPHABET,
|
||||
generateString,
|
||||
protocols: [ 'http', 'https', 'file', 'data' ]
|
||||
};
|
||||
|
||||
22
.output/server/node_modules/axios/lib/utils.js
generated
vendored
22
.output/server/node_modules/axios/lib/utils.js
generated
vendored
@@ -602,26 +602,6 @@ const toFiniteNumber = (value, defaultValue) => {
|
||||
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
||||
}
|
||||
|
||||
const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
|
||||
|
||||
const DIGIT = '0123456789';
|
||||
|
||||
const ALPHABET = {
|
||||
DIGIT,
|
||||
ALPHA,
|
||||
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
||||
}
|
||||
|
||||
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
||||
let str = '';
|
||||
const {length} = alphabet;
|
||||
while (size--) {
|
||||
str += alphabet[Math.random() * length|0]
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the thing is a FormData object, return true, otherwise return false.
|
||||
*
|
||||
@@ -749,8 +729,6 @@ export default {
|
||||
findKey,
|
||||
global: _global,
|
||||
isContextDefined,
|
||||
ALPHABET,
|
||||
generateString,
|
||||
isSpecCompliantForm,
|
||||
toJSONObject,
|
||||
isAsyncFn,
|
||||
|
||||
10
.output/server/node_modules/axios/package.json
generated
vendored
10
.output/server/node_modules/axios/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "axios",
|
||||
"version": "1.7.9",
|
||||
"version": "1.8.2",
|
||||
"description": "Promise based HTTP client for the browser and node.js",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
@@ -163,12 +163,12 @@
|
||||
"Dmitriy Mozgovoy (https://github.com/DigitalBrainJS)",
|
||||
"Jay (https://github.com/jasonsaayman)",
|
||||
"Emily Morehouse (https://github.com/emilyemorehouse)",
|
||||
"Justin Beckwith (https://github.com/JustinBeckwith)",
|
||||
"Rubén Norte (https://github.com/rubennorte)",
|
||||
"Justin Beckwith (https://github.com/JustinBeckwith)",
|
||||
"Martti Laine (https://github.com/codeclown)",
|
||||
"Xianming Zhong (https://github.com/chinesedfan)",
|
||||
"Remco Haszing (https://github.com/remcohaszing)",
|
||||
"Rikki Gibson (https://github.com/RikkiGibson)",
|
||||
"Remco Haszing (https://github.com/remcohaszing)",
|
||||
"Yasu Flores (https://github.com/yasuf)",
|
||||
"Ben Carp (https://github.com/carpben)"
|
||||
],
|
||||
@@ -217,6 +217,6 @@
|
||||
]
|
||||
},
|
||||
"__npminstall_done": true,
|
||||
"_from": "axios@1.7.9",
|
||||
"_resolved": "https://registry.npmmirror.com/axios/-/axios-1.7.9.tgz"
|
||||
"_from": "axios@1.8.2",
|
||||
"_resolved": "https://registry.npmmirror.com/axios/-/axios-1.8.2.tgz"
|
||||
}
|
||||
7
.output/server/node_modules/call-bound/index.js
generated
vendored
7
.output/server/node_modules/call-bound/index.js
generated
vendored
@@ -9,10 +9,11 @@ var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);
|
||||
|
||||
/** @type {import('.')} */
|
||||
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
||||
// eslint-disable-next-line no-extra-parens
|
||||
var intrinsic = /** @type {Parameters<typeof callBindBasic>[0][0]} */ (GetIntrinsic(name, !!allowMissing));
|
||||
/* eslint no-extra-parens: 0 */
|
||||
|
||||
var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing));
|
||||
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
||||
return callBindBasic([intrinsic]);
|
||||
return callBindBasic(/** @type {const} */ ([intrinsic]));
|
||||
}
|
||||
return intrinsic;
|
||||
};
|
||||
|
||||
24
.output/server/node_modules/call-bound/package.json
generated
vendored
24
.output/server/node_modules/call-bound/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "call-bound",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`.",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
@@ -51,28 +51,28 @@
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/call-bound#readme",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"get-intrinsic": "^1.2.6"
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"get-intrinsic": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "^0.17.1",
|
||||
"@arethetypeswrong/cli": "^0.17.4",
|
||||
"@ljharb/eslint-config": "^21.1.1",
|
||||
"@ljharb/tsconfig": "^0.2.2",
|
||||
"@ljharb/tsconfig": "^0.3.0",
|
||||
"@types/call-bind": "^1.0.5",
|
||||
"@types/get-intrinsic": "^1.2.3",
|
||||
"@types/tape": "^5.6.5",
|
||||
"@types/tape": "^5.8.1",
|
||||
"auto-changelog": "^2.5.0",
|
||||
"encoding": "^0.1.13",
|
||||
"es-value-fixtures": "^1.5.0",
|
||||
"es-value-fixtures": "^1.7.1",
|
||||
"eslint": "=8.8.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"for-each": "^0.3.3",
|
||||
"for-each": "^0.3.5",
|
||||
"gopd": "^1.2.0",
|
||||
"has-strict-mode": "^1.0.1",
|
||||
"has-strict-mode": "^1.1.0",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.1",
|
||||
"nyc": "^10.3.2",
|
||||
"object-inspect": "^1.13.3",
|
||||
"object-inspect": "^1.13.4",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.9.0",
|
||||
"typescript": "next"
|
||||
@@ -97,6 +97,6 @@
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"__npminstall_done": true,
|
||||
"_from": "call-bound@1.0.3",
|
||||
"_resolved": "https://registry.npmmirror.com/call-bound/-/call-bound-1.0.3.tgz"
|
||||
"_from": "call-bound@1.0.4",
|
||||
"_resolved": "https://registry.npmmirror.com/call-bound/-/call-bound-1.0.4.tgz"
|
||||
}
|
||||
1
.output/server/node_modules/get-intrinsic/index.js
generated
vendored
1
.output/server/node_modules/get-intrinsic/index.js
generated
vendored
@@ -90,6 +90,7 @@ var INTRINSICS = {
|
||||
'%Error%': $Error,
|
||||
'%eval%': eval, // eslint-disable-line no-eval
|
||||
'%EvalError%': $EvalError,
|
||||
'%Float16Array%': typeof Float16Array === 'undefined' ? undefined : Float16Array,
|
||||
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
|
||||
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
||||
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
|
||||
|
||||
20
.output/server/node_modules/get-intrinsic/package.json
generated
vendored
20
.output/server/node_modules/get-intrinsic/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "get-intrinsic",
|
||||
"version": "1.2.7",
|
||||
"version": "1.3.0",
|
||||
"description": "Get and robustly cache all JS language-level intrinsics at first require time",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
@@ -44,12 +44,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/get-intrinsic#readme",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.0.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.0",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
@@ -60,18 +60,18 @@
|
||||
"auto-changelog": "^2.5.0",
|
||||
"call-bound": "^1.0.3",
|
||||
"encoding": "^0.1.13",
|
||||
"es-abstract": "^1.23.8",
|
||||
"es-value-fixtures": "^1.5.0",
|
||||
"es-abstract": "^1.23.9",
|
||||
"es-value-fixtures": "^1.7.1",
|
||||
"eslint": "=8.8.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"for-each": "^0.3.3",
|
||||
"for-each": "^0.3.5",
|
||||
"make-async-function": "^1.0.0",
|
||||
"make-async-generator-function": "^1.0.0",
|
||||
"make-generator-function": "^2.0.0",
|
||||
"mock-property": "^1.1.0",
|
||||
"npmignore": "^0.3.1",
|
||||
"nyc": "^10.3.2",
|
||||
"object-inspect": "^1.13.3",
|
||||
"object-inspect": "^1.13.4",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.9.0"
|
||||
},
|
||||
@@ -95,6 +95,6 @@
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"__npminstall_done": true,
|
||||
"_from": "get-intrinsic@1.2.7",
|
||||
"_resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.2.7.tgz"
|
||||
"_from": "get-intrinsic@1.3.0",
|
||||
"_resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz"
|
||||
}
|
||||
1
.output/server/node_modules/node-mock-http/dist/_polyfill/buffer/node.mjs
generated
vendored
1
.output/server/node_modules/node-mock-http/dist/_polyfill/buffer/node.mjs
generated
vendored
@@ -1 +0,0 @@
|
||||
export{Buffer}from"node:buffer";
|
||||
1
.output/server/node_modules/node-mock-http/dist/_polyfill/events/node.mjs
generated
vendored
1
.output/server/node_modules/node-mock-http/dist/_polyfill/events/node.mjs
generated
vendored
@@ -1 +0,0 @@
|
||||
export{EventEmitter}from"node:events";
|
||||
1
.output/server/node_modules/node-mock-http/dist/index.mjs
generated
vendored
1
.output/server/node_modules/node-mock-http/dist/index.mjs
generated
vendored
File diff suppressed because one or more lines are too long
66
.output/server/node_modules/node-mock-http/package.json
generated
vendored
66
.output/server/node_modules/node-mock-http/package.json
generated
vendored
@@ -1,66 +0,0 @@
|
||||
{
|
||||
"name": "node-mock-http",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"repository": "unjs/node-mock-http",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
},
|
||||
"./_polyfill/buffer": {
|
||||
"import": {
|
||||
"node": "./dist/_polyfill/buffer/node.mjs",
|
||||
"default": "./dist/_polyfill/buffer/nodeless.mjs"
|
||||
},
|
||||
"require": {
|
||||
"node": "./dist/_polyfill/buffer/node.cjs",
|
||||
"default": "./dist/_polyfill/buffer/nodeless.cjs"
|
||||
}
|
||||
},
|
||||
"./_polyfill/events": {
|
||||
"import": {
|
||||
"node": "./dist/_polyfill/events/node.mjs",
|
||||
"default": "./dist/_polyfill/events/nodeless.mjs"
|
||||
},
|
||||
"require": {
|
||||
"node": "./dist/_polyfill/events/node.cjs",
|
||||
"default": "./dist/_polyfill/events/nodeless.cjs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "unbuild --minify",
|
||||
"dev": "vitest dev --coverage",
|
||||
"lint": "eslint . && prettier -c .",
|
||||
"lint:fix": "automd && eslint . --fix && prettier -w .",
|
||||
"prepack": "pnpm build",
|
||||
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
|
||||
"test": "pnpm lint && pnpm test:types && vitest run --coverage",
|
||||
"test:types": "tsc --noEmit --skipLibCheck"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.12.0",
|
||||
"@vitest/coverage-v8": "^3.0.4",
|
||||
"automd": "^0.3.12",
|
||||
"changelogen": "^0.5.7",
|
||||
"eslint": "^9.19.0",
|
||||
"eslint-config-unjs": "^0.4.2",
|
||||
"jiti": "^2.4.2",
|
||||
"prettier": "^3.4.2",
|
||||
"typescript": "^5.7.3",
|
||||
"unbuild": "^3.3.1",
|
||||
"vitest": "^3.0.4"
|
||||
},
|
||||
"packageManager": "pnpm@10.2.0",
|
||||
"__npminstall_done": true,
|
||||
"_from": "node-mock-http@1.0.0",
|
||||
"_resolved": "https://registry.npmmirror.com/node-mock-http/-/node-mock-http-1.0.0.tgz"
|
||||
}
|
||||
108
.output/server/node_modules/packrup/dist/index.mjs
generated
vendored
108
.output/server/node_modules/packrup/dist/index.mjs
generated
vendored
@@ -1,108 +0,0 @@
|
||||
function asArray(input) {
|
||||
return Array.isArray(input) ? input : [input];
|
||||
}
|
||||
const InternalKeySymbol = "_$key";
|
||||
function packObject(input, options) {
|
||||
const keys = Object.keys(input);
|
||||
let [k, v] = keys;
|
||||
options = options || {};
|
||||
options.key = options.key || k;
|
||||
options.value = options.value || v;
|
||||
options.resolveKey = options.resolveKey || ((k2) => k2);
|
||||
const resolveKey = (index) => {
|
||||
const arr = asArray(options[index]);
|
||||
return arr.find((k2) => {
|
||||
if (typeof k2 === "string" && k2.includes(".")) {
|
||||
return k2;
|
||||
}
|
||||
return k2 && keys.includes(k2);
|
||||
});
|
||||
};
|
||||
const resolveValue = (k2, input2) => {
|
||||
if (k2.includes(".")) {
|
||||
const paths = k2.split(".");
|
||||
let val = input2;
|
||||
for (const path of paths)
|
||||
val = val[path];
|
||||
return val;
|
||||
}
|
||||
return input2[k2];
|
||||
};
|
||||
k = resolveKey("key") || k;
|
||||
v = resolveKey("value") || v;
|
||||
const dedupeKeyPrefix = input.key ? `${InternalKeySymbol}${input.key}-` : "";
|
||||
let keyValue = resolveValue(k, input);
|
||||
keyValue = options.resolveKey(keyValue);
|
||||
return {
|
||||
[`${dedupeKeyPrefix}${keyValue}`]: resolveValue(v, input)
|
||||
};
|
||||
}
|
||||
|
||||
function packArray(input, options) {
|
||||
const packed = {};
|
||||
for (const i of input) {
|
||||
const packedObj = packObject(i, options);
|
||||
const pKey = Object.keys(packedObj)[0];
|
||||
const isDedupeKey = pKey.startsWith(InternalKeySymbol);
|
||||
if (!isDedupeKey && packed[pKey]) {
|
||||
packed[pKey] = Array.isArray(packed[pKey]) ? packed[pKey] : [packed[pKey]];
|
||||
packed[pKey].push(Object.values(packedObj)[0]);
|
||||
} else {
|
||||
packed[isDedupeKey ? pKey.split("-").slice(1).join("-") || pKey : pKey] = packedObj[pKey];
|
||||
}
|
||||
}
|
||||
return packed;
|
||||
}
|
||||
|
||||
function packString(input) {
|
||||
const output = {};
|
||||
input.split(" ").forEach(
|
||||
(item) => {
|
||||
const val = item.replace(/"/g, "").split("=");
|
||||
output[val[0]] = val[1];
|
||||
}
|
||||
);
|
||||
return output;
|
||||
}
|
||||
|
||||
function unpackToArray(input, options) {
|
||||
const unpacked = [];
|
||||
const kFn = options.resolveKeyData || ((ctx) => ctx.key);
|
||||
const vFn = options.resolveValueData || ((ctx) => ctx.value);
|
||||
for (const [k, v] of Object.entries(input)) {
|
||||
unpacked.push(...(Array.isArray(v) ? v : [v]).map((i) => {
|
||||
const ctx = { key: k, value: i };
|
||||
const val = vFn(ctx);
|
||||
if (typeof val === "object")
|
||||
return unpackToArray(val, options);
|
||||
if (Array.isArray(val))
|
||||
return val;
|
||||
return {
|
||||
[typeof options.key === "function" ? options.key(ctx) : options.key]: kFn(ctx),
|
||||
[typeof options.value === "function" ? options.value(ctx) : options.value]: val
|
||||
};
|
||||
}).flat());
|
||||
}
|
||||
return unpacked;
|
||||
}
|
||||
|
||||
function unpackToString(value, options) {
|
||||
return Object.entries(value).map(([key, value2]) => {
|
||||
if (typeof value2 === "object")
|
||||
value2 = unpackToString(value2, options);
|
||||
if (options.resolve) {
|
||||
const resolved = options.resolve({ key, value: value2 });
|
||||
if (typeof resolved !== "undefined")
|
||||
return resolved;
|
||||
}
|
||||
if (typeof value2 === "number")
|
||||
value2 = value2.toString();
|
||||
if (typeof value2 === "string" && options.wrapValue) {
|
||||
value2 = value2.replace(new RegExp(options.wrapValue, "g"), `\\${options.wrapValue}`);
|
||||
value2 = `${options.wrapValue}${value2}${options.wrapValue}`;
|
||||
}
|
||||
return `${key}${options.keyValueSeparator || ""}${value2}`;
|
||||
}).join(options.entrySeparator || "");
|
||||
}
|
||||
|
||||
export { InternalKeySymbol, packArray, packObject, packString, unpackToArray, unpackToString };
|
||||
61
.output/server/node_modules/packrup/package.json
generated
vendored
61
.output/server/node_modules/packrup/package.json
generated
vendored
@@ -1,61 +0,0 @@
|
||||
{
|
||||
"name": "packrup",
|
||||
"type": "module",
|
||||
"version": "0.1.2",
|
||||
"packageManager": "pnpm@8.15.4",
|
||||
"description": "Node Schema.org for Simple and Automated Google Rich Results",
|
||||
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/harlan-zw",
|
||||
"homepage": "https://github.com/harlan-zw/packrup#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/harlan-zw/packrup.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/harlan-zw/packrup/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"pack object",
|
||||
"pack string",
|
||||
"pack array"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "dist/index.cjs",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^2.8.0",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@vitest/ui": "^1.3.1",
|
||||
"bumpp": "^9.4.0",
|
||||
"eslint": "^8.57.0",
|
||||
"fs-extra": "^11.2.0",
|
||||
"jsdom": "^24.0.0",
|
||||
"typescript": "^5.4.2",
|
||||
"unbuild": "^2.0.0",
|
||||
"utility-types": "^3.11.0",
|
||||
"vitest": "^1.3.1"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"stub": "unbuild --stub",
|
||||
"test": "vitest",
|
||||
"export:sizes": "npx export-size . -r",
|
||||
"release": "pnpm build && bumpp && pnpm -r publish --no-git-checks",
|
||||
"lint": "eslint . --fix"
|
||||
},
|
||||
"__npminstall_done": true,
|
||||
"_from": "packrup@0.1.2",
|
||||
"_resolved": "https://registry.npmmirror.com/packrup/-/packrup-0.1.2.tgz"
|
||||
}
|
||||
36
.output/server/node_modules/supports-color/index.js
generated
vendored
36
.output/server/node_modules/supports-color/index.js
generated
vendored
@@ -31,17 +31,29 @@ if (
|
||||
}
|
||||
|
||||
function envForceColor() {
|
||||
if ('FORCE_COLOR' in env) {
|
||||
if (env.FORCE_COLOR === 'true') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (env.FORCE_COLOR === 'false') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
||||
if (!('FORCE_COLOR' in env)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (env.FORCE_COLOR === 'true') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (env.FORCE_COLOR === 'false') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (env.FORCE_COLOR.length === 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
||||
|
||||
if (![0, 1, 2, 3].includes(level)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
function translateLevel(level) {
|
||||
@@ -112,11 +124,11 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
||||
}
|
||||
|
||||
if ('CI' in env) {
|
||||
if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
|
||||
if (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
||||
if (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
26
.output/server/node_modules/supports-color/package.json
generated
vendored
26
.output/server/node_modules/supports-color/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "supports-color",
|
||||
"version": "9.4.0",
|
||||
"version": "10.0.0",
|
||||
"description": "Detect whether a terminal supports color",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/supports-color",
|
||||
@@ -12,15 +12,16 @@
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"types": "./index.d.ts",
|
||||
"node": "./index.js",
|
||||
"default": "./browser.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
},
|
||||
"scripts": {
|
||||
"//test": "xo && ava && tsd",
|
||||
"test": "tsd"
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
@@ -51,13 +52,16 @@
|
||||
"16m"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.3.2",
|
||||
"ava": "^5.3.1",
|
||||
"import-fresh": "^3.3.0",
|
||||
"tsd": "^0.18.0",
|
||||
"xo": "^0.54.2"
|
||||
"@types/node": "^22.10.2",
|
||||
"ava": "^6.2.0",
|
||||
"tsd": "^0.31.2",
|
||||
"xo": "^0.60.0"
|
||||
},
|
||||
"ava": {
|
||||
"serial": true,
|
||||
"workerThreads": false
|
||||
},
|
||||
"__npminstall_done": true,
|
||||
"_from": "supports-color@9.4.0",
|
||||
"_resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-9.4.0.tgz"
|
||||
"_from": "supports-color@10.0.0",
|
||||
"_resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-10.0.0.tgz"
|
||||
}
|
||||
757
.output/server/node_modules/unhead/dist/index.mjs
generated
vendored
757
.output/server/node_modules/unhead/dist/index.mjs
generated
vendored
@@ -1,748 +1,9 @@
|
||||
import { DomPlugin } from '@unhead/dom';
|
||||
import { defineHeadPlugin, tagDedupeKey, hashTag, tagWeight, HasElementTags, NetworkEvents, hashCode, SortModifiers, processTemplateParams, resolveTitleTemplate, IsBrowser, normaliseEntryTags, composableNames, whitelistSafeInput, ScriptNetworkEvents, unpackMeta } from '@unhead/shared';
|
||||
export { composableNames } from '@unhead/shared';
|
||||
import { createHooks } from 'hookable';
|
||||
|
||||
const UsesMergeStrategy = /* @__PURE__ */ new Set(["templateParams", "htmlAttrs", "bodyAttrs"]);
|
||||
const DedupePlugin = defineHeadPlugin({
|
||||
hooks: {
|
||||
"tag:normalise": ({ tag }) => {
|
||||
if (tag.props.hid) {
|
||||
tag.key = tag.props.hid;
|
||||
delete tag.props.hid;
|
||||
}
|
||||
if (tag.props.vmid) {
|
||||
tag.key = tag.props.vmid;
|
||||
delete tag.props.vmid;
|
||||
}
|
||||
if (tag.props.key) {
|
||||
tag.key = tag.props.key;
|
||||
delete tag.props.key;
|
||||
}
|
||||
const generatedKey = tagDedupeKey(tag);
|
||||
if (generatedKey && !generatedKey.startsWith("meta:og:") && !generatedKey.startsWith("meta:twitter:")) {
|
||||
delete tag.key;
|
||||
}
|
||||
const dedupe = generatedKey || (tag.key ? `${tag.tag}:${tag.key}` : false);
|
||||
if (dedupe)
|
||||
tag._d = dedupe;
|
||||
},
|
||||
"tags:resolve": (ctx) => {
|
||||
const deduping = /* @__PURE__ */ Object.create(null);
|
||||
for (const tag of ctx.tags) {
|
||||
const dedupeKey = (tag.key ? `${tag.tag}:${tag.key}` : tag._d) || hashTag(tag);
|
||||
const dupedTag = deduping[dedupeKey];
|
||||
if (dupedTag) {
|
||||
let strategy = tag?.tagDuplicateStrategy;
|
||||
if (!strategy && UsesMergeStrategy.has(tag.tag))
|
||||
strategy = "merge";
|
||||
if (strategy === "merge") {
|
||||
const oldProps = dupedTag.props;
|
||||
if (oldProps.style && tag.props.style) {
|
||||
if (oldProps.style[oldProps.style.length - 1] !== ";") {
|
||||
oldProps.style += ";";
|
||||
}
|
||||
tag.props.style = `${oldProps.style} ${tag.props.style}`;
|
||||
}
|
||||
if (oldProps.class && tag.props.class) {
|
||||
tag.props.class = `${oldProps.class} ${tag.props.class}`;
|
||||
} else if (oldProps.class) {
|
||||
tag.props.class = oldProps.class;
|
||||
}
|
||||
deduping[dedupeKey].props = {
|
||||
...oldProps,
|
||||
...tag.props
|
||||
};
|
||||
continue;
|
||||
} else if (tag._e === dupedTag._e) {
|
||||
dupedTag._duped = dupedTag._duped || [];
|
||||
tag._d = `${dupedTag._d}:${dupedTag._duped.length + 1}`;
|
||||
dupedTag._duped.push(tag);
|
||||
continue;
|
||||
} else if (tagWeight(tag) > tagWeight(dupedTag)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
const hasProps = tag.innerHTML || tag.textContent || Object.keys(tag.props).length !== 0;
|
||||
if (!hasProps && HasElementTags.has(tag.tag)) {
|
||||
delete deduping[dedupeKey];
|
||||
continue;
|
||||
}
|
||||
deduping[dedupeKey] = tag;
|
||||
}
|
||||
const newTags = [];
|
||||
for (const key in deduping) {
|
||||
const tag = deduping[key];
|
||||
const dupes = tag._duped;
|
||||
newTags.push(tag);
|
||||
if (dupes) {
|
||||
delete tag._duped;
|
||||
newTags.push(...dupes);
|
||||
}
|
||||
}
|
||||
ctx.tags = newTags;
|
||||
ctx.tags = ctx.tags.filter((t) => !(t.tag === "meta" && (t.props.name || t.props.property) && !t.props.content));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const ValidEventTags = /* @__PURE__ */ new Set(["script", "link", "bodyAttrs"]);
|
||||
const EventHandlersPlugin = defineHeadPlugin((head) => ({
|
||||
hooks: {
|
||||
"tags:resolve": (ctx) => {
|
||||
for (const tag of ctx.tags) {
|
||||
if (!ValidEventTags.has(tag.tag)) {
|
||||
continue;
|
||||
}
|
||||
const props = tag.props;
|
||||
for (const key in props) {
|
||||
if (key[0] !== "o" || key[1] !== "n") {
|
||||
continue;
|
||||
}
|
||||
if (!Object.prototype.hasOwnProperty.call(props, key)) {
|
||||
continue;
|
||||
}
|
||||
const value = props[key];
|
||||
if (typeof value !== "function") {
|
||||
continue;
|
||||
}
|
||||
if (head.ssr && NetworkEvents.has(key)) {
|
||||
props[key] = `this.dataset.${key}fired = true`;
|
||||
} else {
|
||||
delete props[key];
|
||||
}
|
||||
tag._eventHandlers = tag._eventHandlers || {};
|
||||
tag._eventHandlers[key] = value;
|
||||
}
|
||||
if (head.ssr && tag._eventHandlers && (tag.props.src || tag.props.href)) {
|
||||
tag.key = tag.key || hashCode(tag.props.src || tag.props.href);
|
||||
}
|
||||
}
|
||||
},
|
||||
"dom:renderTag": ({ $el, tag }) => {
|
||||
const dataset = $el?.dataset;
|
||||
if (!dataset) {
|
||||
return;
|
||||
}
|
||||
for (const k in dataset) {
|
||||
if (!k.endsWith("fired")) {
|
||||
continue;
|
||||
}
|
||||
const ek = k.slice(0, -5);
|
||||
if (!NetworkEvents.has(ek)) {
|
||||
continue;
|
||||
}
|
||||
tag._eventHandlers?.[ek]?.call($el, new Event(ek.substring(2)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
const DupeableTags = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]);
|
||||
const HashKeyedPlugin = defineHeadPlugin({
|
||||
hooks: {
|
||||
"tag:normalise": ({ tag }) => {
|
||||
if (tag.key && DupeableTags.has(tag.tag)) {
|
||||
tag.props["data-hid"] = tag._h = hashCode(tag.key);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const PayloadPlugin = defineHeadPlugin({
|
||||
mode: "server",
|
||||
hooks: {
|
||||
"tags:beforeResolve": (ctx) => {
|
||||
const payload = {};
|
||||
let hasPayload = false;
|
||||
for (const tag of ctx.tags) {
|
||||
if (tag._m !== "server" || tag.tag !== "titleTemplate" && tag.tag !== "templateParams" && tag.tag !== "title") {
|
||||
continue;
|
||||
}
|
||||
payload[tag.tag] = tag.tag === "title" || tag.tag === "titleTemplate" ? tag.textContent : tag.props;
|
||||
hasPayload = true;
|
||||
}
|
||||
if (hasPayload) {
|
||||
ctx.tags.push({
|
||||
tag: "script",
|
||||
innerHTML: JSON.stringify(payload),
|
||||
props: { id: "unhead:payload", type: "application/json" }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const SortPlugin = defineHeadPlugin({
|
||||
hooks: {
|
||||
"tags:resolve": (ctx) => {
|
||||
for (const tag of ctx.tags) {
|
||||
if (typeof tag.tagPriority !== "string") {
|
||||
continue;
|
||||
}
|
||||
for (const { prefix, offset } of SortModifiers) {
|
||||
if (!tag.tagPriority.startsWith(prefix)) {
|
||||
continue;
|
||||
}
|
||||
const key = tag.tagPriority.substring(prefix.length);
|
||||
const position = ctx.tags.find((tag2) => tag2._d === key)?._p;
|
||||
if (position !== void 0) {
|
||||
tag._p = position + offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ctx.tags.sort((a, b) => {
|
||||
const aWeight = tagWeight(a);
|
||||
const bWeight = tagWeight(b);
|
||||
if (aWeight < bWeight) {
|
||||
return -1;
|
||||
} else if (aWeight > bWeight) {
|
||||
return 1;
|
||||
}
|
||||
return a._p - b._p;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const SupportedAttrs = {
|
||||
meta: "content",
|
||||
link: "href",
|
||||
htmlAttrs: "lang"
|
||||
};
|
||||
const contentAttrs = ["innerHTML", "textContent"];
|
||||
const TemplateParamsPlugin = defineHeadPlugin((head) => ({
|
||||
hooks: {
|
||||
"tags:resolve": (ctx) => {
|
||||
const { tags } = ctx;
|
||||
let templateParams;
|
||||
for (let i = 0; i < tags.length; i += 1) {
|
||||
const tag = tags[i];
|
||||
if (tag.tag !== "templateParams") {
|
||||
continue;
|
||||
}
|
||||
templateParams = ctx.tags.splice(i, 1)[0].props;
|
||||
i -= 1;
|
||||
}
|
||||
const params = templateParams || {};
|
||||
const sep = params.separator || "|";
|
||||
delete params.separator;
|
||||
params.pageTitle = processTemplateParams(
|
||||
// find templateParams
|
||||
params.pageTitle || tags.find((tag) => tag.tag === "title")?.textContent || "",
|
||||
params,
|
||||
sep
|
||||
);
|
||||
for (const tag of tags) {
|
||||
if (tag.processTemplateParams === false) {
|
||||
continue;
|
||||
}
|
||||
const v = SupportedAttrs[tag.tag];
|
||||
if (v && typeof tag.props[v] === "string") {
|
||||
tag.props[v] = processTemplateParams(tag.props[v], params, sep);
|
||||
} else if (tag.processTemplateParams || tag.tag === "titleTemplate" || tag.tag === "title") {
|
||||
for (const p of contentAttrs) {
|
||||
if (typeof tag[p] === "string")
|
||||
tag[p] = processTemplateParams(tag[p], params, sep, tag.tag === "script" && tag.props.type.endsWith("json"));
|
||||
}
|
||||
}
|
||||
}
|
||||
head._templateParams = params;
|
||||
head._separator = sep;
|
||||
},
|
||||
"tags:afterResolve": ({ tags }) => {
|
||||
let title;
|
||||
for (let i = 0; i < tags.length; i += 1) {
|
||||
const tag = tags[i];
|
||||
if (tag.tag === "title" && tag.processTemplateParams !== false) {
|
||||
title = tag;
|
||||
}
|
||||
}
|
||||
if (title?.textContent) {
|
||||
title.textContent = processTemplateParams(title.textContent, head._templateParams, head._separator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
const TitleTemplatePlugin = defineHeadPlugin({
|
||||
hooks: {
|
||||
"tags:resolve": (ctx) => {
|
||||
const { tags } = ctx;
|
||||
let titleTag;
|
||||
let titleTemplateTag;
|
||||
for (let i = 0; i < tags.length; i += 1) {
|
||||
const tag = tags[i];
|
||||
if (tag.tag === "title") {
|
||||
titleTag = tag;
|
||||
} else if (tag.tag === "titleTemplate") {
|
||||
titleTemplateTag = tag;
|
||||
}
|
||||
}
|
||||
if (titleTemplateTag && titleTag) {
|
||||
const newTitle = resolveTitleTemplate(
|
||||
titleTemplateTag.textContent,
|
||||
titleTag.textContent
|
||||
);
|
||||
if (newTitle !== null) {
|
||||
titleTag.textContent = newTitle || titleTag.textContent;
|
||||
} else {
|
||||
ctx.tags.splice(ctx.tags.indexOf(titleTag), 1);
|
||||
}
|
||||
} else if (titleTemplateTag) {
|
||||
const newTitle = resolveTitleTemplate(
|
||||
titleTemplateTag.textContent
|
||||
);
|
||||
if (newTitle !== null) {
|
||||
titleTemplateTag.textContent = newTitle;
|
||||
titleTemplateTag.tag = "title";
|
||||
titleTemplateTag = void 0;
|
||||
}
|
||||
}
|
||||
if (titleTemplateTag) {
|
||||
ctx.tags.splice(ctx.tags.indexOf(titleTemplateTag), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const XSSPlugin = defineHeadPlugin({
|
||||
hooks: {
|
||||
"tags:afterResolve": (ctx) => {
|
||||
for (const tag of ctx.tags) {
|
||||
if (typeof tag.innerHTML === "string") {
|
||||
if (tag.innerHTML && (tag.props.type === "application/ld+json" || tag.props.type === "application/json")) {
|
||||
tag.innerHTML = tag.innerHTML.replace(/</g, "\\u003C");
|
||||
} else {
|
||||
tag.innerHTML = tag.innerHTML.replace(new RegExp(`</${tag.tag}`, "g"), `<\\/${tag.tag}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let activeHead;
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function createHead(options = {}) {
|
||||
const head = createHeadCore(options);
|
||||
head.use(DomPlugin());
|
||||
return activeHead = head;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function createServerHead(options = {}) {
|
||||
return activeHead = createHeadCore(options);
|
||||
}
|
||||
function filterMode(mode, ssr) {
|
||||
return !mode || mode === "server" && ssr || mode === "client" && !ssr;
|
||||
}
|
||||
function createHeadCore(options = {}) {
|
||||
const hooks = createHooks();
|
||||
hooks.addHooks(options.hooks || {});
|
||||
options.document = options.document || (IsBrowser ? document : void 0);
|
||||
const ssr = !options.document;
|
||||
const updated = () => {
|
||||
head.dirty = true;
|
||||
hooks.callHook("entries:updated", head);
|
||||
};
|
||||
let entryCount = 0;
|
||||
let entries = [];
|
||||
const plugins = [];
|
||||
const head = {
|
||||
plugins,
|
||||
dirty: false,
|
||||
resolvedOptions: options,
|
||||
hooks,
|
||||
headEntries() {
|
||||
return entries;
|
||||
},
|
||||
use(p) {
|
||||
const plugin = typeof p === "function" ? p(head) : p;
|
||||
if (!plugin.key || !plugins.some((p2) => p2.key === plugin.key)) {
|
||||
plugins.push(plugin);
|
||||
filterMode(plugin.mode, ssr) && hooks.addHooks(plugin.hooks || {});
|
||||
}
|
||||
},
|
||||
push(input, entryOptions) {
|
||||
delete entryOptions?.head;
|
||||
const entry = {
|
||||
_i: entryCount++,
|
||||
input,
|
||||
...entryOptions
|
||||
};
|
||||
if (filterMode(entry.mode, ssr)) {
|
||||
entries.push(entry);
|
||||
updated();
|
||||
}
|
||||
return {
|
||||
dispose() {
|
||||
entries = entries.filter((e) => e._i !== entry._i);
|
||||
updated();
|
||||
},
|
||||
// a patch is the same as creating a new entry, just a nice DX
|
||||
patch(input2) {
|
||||
for (const e of entries) {
|
||||
if (e._i === entry._i) {
|
||||
e.input = entry.input = input2;
|
||||
}
|
||||
}
|
||||
updated();
|
||||
}
|
||||
};
|
||||
},
|
||||
async resolveTags() {
|
||||
const resolveCtx = { tags: [], entries: [...entries] };
|
||||
await hooks.callHook("entries:resolve", resolveCtx);
|
||||
for (const entry of resolveCtx.entries) {
|
||||
const resolved = entry.resolvedInput || entry.input;
|
||||
entry.resolvedInput = await (entry.transform ? entry.transform(resolved) : resolved);
|
||||
if (entry.resolvedInput) {
|
||||
for (const tag of await normaliseEntryTags(entry)) {
|
||||
const tagCtx = { tag, entry, resolvedOptions: head.resolvedOptions };
|
||||
await hooks.callHook("tag:normalise", tagCtx);
|
||||
resolveCtx.tags.push(tagCtx.tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
await hooks.callHook("tags:beforeResolve", resolveCtx);
|
||||
await hooks.callHook("tags:resolve", resolveCtx);
|
||||
await hooks.callHook("tags:afterResolve", resolveCtx);
|
||||
return resolveCtx.tags;
|
||||
},
|
||||
ssr
|
||||
};
|
||||
[
|
||||
DedupePlugin,
|
||||
PayloadPlugin,
|
||||
EventHandlersPlugin,
|
||||
HashKeyedPlugin,
|
||||
SortPlugin,
|
||||
TemplateParamsPlugin,
|
||||
TitleTemplatePlugin,
|
||||
XSSPlugin,
|
||||
...options?.plugins || []
|
||||
].forEach((p) => head.use(p));
|
||||
head.hooks.callHook("init", head);
|
||||
return head;
|
||||
}
|
||||
|
||||
const unheadComposablesImports = [
|
||||
{
|
||||
from: "unhead",
|
||||
imports: composableNames
|
||||
}
|
||||
];
|
||||
|
||||
function getActiveHead() {
|
||||
return activeHead;
|
||||
}
|
||||
|
||||
function useHead(input, options = {}) {
|
||||
const head = options.head || getActiveHead();
|
||||
return head?.push(input, options);
|
||||
}
|
||||
|
||||
function useHeadSafe(input, options) {
|
||||
return useHead(input, {
|
||||
...options,
|
||||
transform: whitelistSafeInput
|
||||
});
|
||||
}
|
||||
|
||||
const ScriptProxyTarget = Symbol("ScriptProxyTarget");
|
||||
function scriptProxy() {
|
||||
}
|
||||
scriptProxy[ScriptProxyTarget] = true;
|
||||
function resolveScriptKey(input) {
|
||||
return input.key || hashCode(input.src || (typeof input.innerHTML === "string" ? input.innerHTML : ""));
|
||||
}
|
||||
function useScript(_input, _options) {
|
||||
const input = typeof _input === "string" ? { src: _input } : _input;
|
||||
const options = _options || {};
|
||||
const head = options.head || getActiveHead();
|
||||
if (!head)
|
||||
throw new Error("Missing Unhead context.");
|
||||
const id = resolveScriptKey(input);
|
||||
const prevScript = head._scripts?.[id];
|
||||
if (prevScript) {
|
||||
prevScript.setupTriggerHandler(options.trigger);
|
||||
return prevScript;
|
||||
}
|
||||
options.beforeInit?.();
|
||||
const syncStatus = (s) => {
|
||||
script.status = s;
|
||||
head.hooks.callHook(`script:updated`, hookCtx);
|
||||
};
|
||||
ScriptNetworkEvents.forEach((fn) => {
|
||||
const _fn = typeof input[fn] === "function" ? input[fn].bind(options.eventContext) : null;
|
||||
input[fn] = (e) => {
|
||||
syncStatus(fn === "onload" ? "loaded" : fn === "onerror" ? "error" : "loading");
|
||||
_fn?.(e);
|
||||
};
|
||||
});
|
||||
const _cbs = { loaded: [], error: [] };
|
||||
const _registerCb = (key, cb) => {
|
||||
if (_cbs[key]) {
|
||||
const i = _cbs[key].push(cb);
|
||||
return () => _cbs[key]?.splice(i - 1, 1);
|
||||
}
|
||||
cb(script.instance);
|
||||
return () => {
|
||||
};
|
||||
};
|
||||
const loadPromise = new Promise((resolve) => {
|
||||
if (head.ssr)
|
||||
return;
|
||||
const emit = (api) => requestAnimationFrame(() => resolve(api));
|
||||
const _ = head.hooks.hook("script:updated", ({ script: script2 }) => {
|
||||
const status = script2.status;
|
||||
if (script2.id === id && (status === "loaded" || status === "error")) {
|
||||
if (status === "loaded") {
|
||||
if (typeof options.use === "function") {
|
||||
const api = options.use();
|
||||
if (api) {
|
||||
emit(api);
|
||||
}
|
||||
} else {
|
||||
emit({});
|
||||
}
|
||||
} else if (status === "error") {
|
||||
resolve(false);
|
||||
}
|
||||
_();
|
||||
}
|
||||
});
|
||||
});
|
||||
const script = Object.assign(loadPromise, {
|
||||
instance: !head.ssr && options?.use?.() || null,
|
||||
proxy: null,
|
||||
id,
|
||||
status: "awaitingLoad",
|
||||
remove() {
|
||||
script._triggerAbortController?.abort();
|
||||
script._triggerPromises = [];
|
||||
if (script.entry) {
|
||||
script.entry.dispose();
|
||||
script.entry = void 0;
|
||||
syncStatus("removed");
|
||||
delete head._scripts?.[id];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
load(cb) {
|
||||
script._triggerAbortController?.abort();
|
||||
script._triggerPromises = [];
|
||||
if (!script.entry) {
|
||||
syncStatus("loading");
|
||||
const defaults = {
|
||||
defer: true,
|
||||
fetchpriority: "low"
|
||||
};
|
||||
if (input.src && (input.src.startsWith("http") || input.src.startsWith("//"))) {
|
||||
defaults.crossorigin = "anonymous";
|
||||
defaults.referrerpolicy = "no-referrer";
|
||||
}
|
||||
script.entry = head.push({
|
||||
script: [{ ...defaults, ...input, key: `script.${id}` }]
|
||||
}, options);
|
||||
}
|
||||
if (cb)
|
||||
_registerCb("loaded", cb);
|
||||
return loadPromise;
|
||||
},
|
||||
onLoaded(cb) {
|
||||
return _registerCb("loaded", cb);
|
||||
},
|
||||
onError(cb) {
|
||||
return _registerCb("error", cb);
|
||||
},
|
||||
setupTriggerHandler(trigger) {
|
||||
if (script.status !== "awaitingLoad") {
|
||||
return;
|
||||
}
|
||||
if ((typeof trigger === "undefined" || trigger === "client") && !head.ssr || trigger === "server") {
|
||||
script.load();
|
||||
} else if (trigger instanceof Promise) {
|
||||
if (head.ssr) {
|
||||
return;
|
||||
}
|
||||
if (!script._triggerAbortController) {
|
||||
script._triggerAbortController = new AbortController();
|
||||
script._triggerAbortPromise = new Promise((resolve) => {
|
||||
script._triggerAbortController.signal.addEventListener("abort", () => {
|
||||
script._triggerAbortController = null;
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
script._triggerPromises = script._triggerPromises || [];
|
||||
const idx = script._triggerPromises.push(Promise.race([
|
||||
trigger.then((v) => typeof v === "undefined" || v ? script.load : void 0),
|
||||
script._triggerAbortPromise
|
||||
]).catch(() => {
|
||||
}).then((res2) => {
|
||||
res2?.();
|
||||
}).finally(() => {
|
||||
script._triggerPromises?.splice(idx, 1);
|
||||
}));
|
||||
} else if (typeof trigger === "function") {
|
||||
trigger(script.load);
|
||||
}
|
||||
},
|
||||
_cbs
|
||||
});
|
||||
loadPromise.then((api) => {
|
||||
if (api !== false) {
|
||||
script.instance = api;
|
||||
_cbs.loaded?.forEach((cb) => cb(api));
|
||||
_cbs.loaded = null;
|
||||
} else {
|
||||
_cbs.error?.forEach((cb) => cb());
|
||||
_cbs.error = null;
|
||||
}
|
||||
});
|
||||
const hookCtx = { script };
|
||||
script.setupTriggerHandler(options.trigger);
|
||||
script.$script = script;
|
||||
const proxyChain = (instance, accessor, accessors) => {
|
||||
return new Proxy((!accessor ? instance : instance?.[accessor]) || scriptProxy, {
|
||||
get(_, k, r) {
|
||||
head.hooks.callHook("script:instance-fn", { script, fn: k, exists: k in _ });
|
||||
if (!accessor) {
|
||||
const stub = options.stub?.({ script, fn: k });
|
||||
if (stub)
|
||||
return stub;
|
||||
}
|
||||
if (_ && k in _ && typeof _[k] !== "undefined") {
|
||||
return Reflect.get(_, k, r);
|
||||
}
|
||||
if (k === Symbol.iterator) {
|
||||
return [][Symbol.iterator];
|
||||
}
|
||||
return proxyChain(accessor ? instance?.[accessor] : instance, k, accessors || [k]);
|
||||
},
|
||||
async apply(_, _this, args) {
|
||||
if (head.ssr && _[ScriptProxyTarget])
|
||||
return;
|
||||
let instance2;
|
||||
const access = (fn2) => {
|
||||
instance2 = fn2 || instance2;
|
||||
for (let i = 0; i < (accessors || []).length; i++) {
|
||||
const k = (accessors || [])[i];
|
||||
fn2 = fn2?.[k];
|
||||
}
|
||||
return fn2;
|
||||
};
|
||||
let fn = access(script.instance);
|
||||
if (!fn) {
|
||||
fn = await new Promise((resolve) => {
|
||||
script.onLoaded((api) => {
|
||||
resolve(access(api));
|
||||
});
|
||||
});
|
||||
}
|
||||
return typeof fn === "function" ? Reflect.apply(fn, instance2, args) : fn;
|
||||
}
|
||||
});
|
||||
};
|
||||
script.proxy = proxyChain(script.instance);
|
||||
const res = new Proxy(script, {
|
||||
get(_, k) {
|
||||
const target = k in script || String(k)[0] === "_" ? script : script.proxy;
|
||||
if (k === "then" || k === "catch") {
|
||||
return script[k].bind(script);
|
||||
}
|
||||
return Reflect.get(target, k, target);
|
||||
}
|
||||
});
|
||||
head._scripts = Object.assign(head._scripts || {}, { [id]: res });
|
||||
return res;
|
||||
}
|
||||
|
||||
function useSeoMeta(input, options) {
|
||||
const { title, titleTemplate, ...meta } = input;
|
||||
return useHead({
|
||||
title,
|
||||
titleTemplate,
|
||||
// we need to input the meta so the reactivity will be resolved
|
||||
// @ts-expect-error runtime type
|
||||
_flatMeta: meta
|
||||
}, {
|
||||
...options,
|
||||
transform(t) {
|
||||
const meta2 = unpackMeta({ ...t._flatMeta });
|
||||
delete t._flatMeta;
|
||||
return {
|
||||
// @ts-expect-error runtime type
|
||||
...t,
|
||||
meta: meta2
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function useServerHead(input, options = {}) {
|
||||
return useHead(input, { ...options, mode: "server" });
|
||||
}
|
||||
|
||||
function useServerHeadSafe(input, options = {}) {
|
||||
return useHeadSafe(input, { ...options, mode: "server" });
|
||||
}
|
||||
|
||||
function useServerSeoMeta(input, options) {
|
||||
return useSeoMeta(input, {
|
||||
...options,
|
||||
mode: "server"
|
||||
});
|
||||
}
|
||||
|
||||
const importRe = /@import/;
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function CapoPlugin(options) {
|
||||
return defineHeadPlugin({
|
||||
hooks: {
|
||||
"tags:beforeResolve": ({ tags }) => {
|
||||
for (const tag of tags) {
|
||||
if (tag.tagPosition && tag.tagPosition !== "head")
|
||||
continue;
|
||||
tag.tagPriority = tag.tagPriority || tagWeight(tag);
|
||||
if (tag.tagPriority !== 100)
|
||||
continue;
|
||||
const isTruthy = (val) => val === "" || val === true;
|
||||
const isScript = tag.tag === "script";
|
||||
const isLink = tag.tag === "link";
|
||||
if (isScript && isTruthy(tag.props.async)) {
|
||||
tag.tagPriority = 30;
|
||||
} else if (tag.tag === "style" && tag.innerHTML && importRe.test(tag.innerHTML)) {
|
||||
tag.tagPriority = 40;
|
||||
} else if (isScript && tag.props.src && !isTruthy(tag.props.defer) && !isTruthy(tag.props.async) && tag.props.type !== "module" && !tag.props.type?.endsWith("json")) {
|
||||
tag.tagPriority = 50;
|
||||
} else if (isLink && tag.props.rel === "stylesheet" || tag.tag === "style") {
|
||||
tag.tagPriority = 60;
|
||||
} else if (isLink && (tag.props.rel === "preload" || tag.props.rel === "modulepreload")) {
|
||||
tag.tagPriority = 70;
|
||||
} else if (isScript && isTruthy(tag.props.defer) && tag.props.src && !isTruthy(tag.props.async)) {
|
||||
tag.tagPriority = 80;
|
||||
} else if (isLink && (tag.props.rel === "prefetch" || tag.props.rel === "dns-prefetch" || tag.props.rel === "prerender")) {
|
||||
tag.tagPriority = 90;
|
||||
}
|
||||
}
|
||||
options?.track && tags.push({
|
||||
tag: "htmlAttrs",
|
||||
props: {
|
||||
"data-capo": ""
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function HashHydrationPlugin() {
|
||||
return defineHeadPlugin({});
|
||||
}
|
||||
|
||||
export { CapoPlugin, HashHydrationPlugin, createHead, createHeadCore, createServerHead, getActiveHead, resolveScriptKey, unheadComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
||||
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.B52g_5xR.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.BaPU1zLf.mjs';
|
||||
import './shared/unhead.DZbvapt-.mjs';
|
||||
|
||||
94
.output/server/node_modules/unhead/dist/plugins.mjs
generated
vendored
Normal file
94
.output/server/node_modules/unhead/dist/plugins.mjs
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
export { A as AliasSortingPlugin, D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin } from './shared/unhead.DnNYlT4k.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.kVuXtrDW.mjs';
|
||||
import './shared/unhead.DQc16pHI.mjs';
|
||||
import './shared/unhead.yem5I2v_.mjs';
|
||||
|
||||
function CanonicalPlugin(options) {
|
||||
return (head) => {
|
||||
function resolvePath(path) {
|
||||
if (options?.customResolver) {
|
||||
return options.customResolver(path);
|
||||
}
|
||||
let host = options.canonicalHost || (!head.ssr ? window.location.origin : "");
|
||||
if (!host.startsWith("http") && !host.startsWith("//")) {
|
||||
host = `https://${host}`;
|
||||
}
|
||||
host = new URL(host).origin;
|
||||
if (path.startsWith("http") || path.startsWith("//"))
|
||||
return path;
|
||||
try {
|
||||
return new URL(path, host).toString();
|
||||
} catch {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
return {
|
||||
key: "canonical",
|
||||
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);
|
||||
}
|
||||
} else if (tag.tag === "link" && tag.props.rel === "canonical") {
|
||||
tag.props.href = resolvePath(tag.props.href);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function InferSeoMetaPlugin(options = {}) {
|
||||
return defineHeadPlugin((head) => {
|
||||
head.push({
|
||||
meta: [
|
||||
{
|
||||
name: "twitter:card",
|
||||
content: options.twitterCard || "summary_large_image",
|
||||
tagPriority: "low"
|
||||
},
|
||||
{
|
||||
"property": "og:title",
|
||||
"tagPriority": "low",
|
||||
"data-infer": ""
|
||||
},
|
||||
{
|
||||
"property": "og:description",
|
||||
"tagPriority": "low",
|
||||
"data-infer": ""
|
||||
}
|
||||
]
|
||||
});
|
||||
return {
|
||||
key: "infer-seo-meta",
|
||||
hooks: {
|
||||
"tags:beforeResolve": ({ tagMap }) => {
|
||||
let title = head._title || "";
|
||||
const titleTemplate = head._titleTemplate;
|
||||
const ogTitle = tagMap.get("meta:og:title");
|
||||
if (typeof ogTitle?.props["data-infer"] !== "undefined") {
|
||||
if (titleTemplate) {
|
||||
title = typeof titleTemplate === "function" ? titleTemplate(title) : titleTemplate.replace("%s", title);
|
||||
}
|
||||
ogTitle.props.content = options.ogTitle ? options.ogTitle(title) : title || "";
|
||||
}
|
||||
const description = tagMap.get("meta:description")?.props?.content;
|
||||
const ogDescription = tagMap.get("meta:og:description");
|
||||
if (typeof ogDescription?.props["data-infer"] !== "undefined") {
|
||||
ogDescription.props.content = options.ogDescription ? options.ogDescription(description) : description || "";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export { CanonicalPlugin, InferSeoMetaPlugin, defineHeadPlugin };
|
||||
30
.output/server/node_modules/unhead/dist/scripts.mjs
generated
vendored
Normal file
30
.output/server/node_modules/unhead/dist/scripts.mjs
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
export { r as resolveScriptKey, u as useScript } from './shared/unhead.B578PsDV.mjs';
|
||||
import './shared/unhead.yem5I2v_.mjs';
|
||||
|
||||
function createSpyProxy(target, onApply) {
|
||||
const stack = [];
|
||||
let stackIdx = -1;
|
||||
const handler = (reuseStack = false) => ({
|
||||
get(_, prop, receiver) {
|
||||
if (!reuseStack) {
|
||||
stackIdx++;
|
||||
stack[stackIdx] = [];
|
||||
}
|
||||
const v = Reflect.get(_, prop, receiver);
|
||||
if (typeof v === "object" || typeof v === "function") {
|
||||
stack[stackIdx].push({ type: "get", key: prop });
|
||||
return new Proxy(v, handler(true));
|
||||
}
|
||||
stack[stackIdx].push({ type: "get", key: prop, value: v });
|
||||
return v;
|
||||
},
|
||||
apply(_, __, args) {
|
||||
stack[stackIdx].push({ type: "apply", key: "", args });
|
||||
onApply(stack);
|
||||
return Reflect.apply(_, __, args);
|
||||
}
|
||||
});
|
||||
return new Proxy(target, handler());
|
||||
}
|
||||
|
||||
export { createSpyProxy };
|
||||
214
.output/server/node_modules/unhead/dist/server.mjs
generated
vendored
Normal file
214
.output/server/node_modules/unhead/dist/server.mjs
generated
vendored
Normal file
@@ -0,0 +1,214 @@
|
||||
import { a as createUnhead } from './shared/unhead.B52g_5xR.mjs';
|
||||
import { T as TagsWithInnerContent, S as SelfClosingTags$1 } from './shared/unhead.yem5I2v_.mjs';
|
||||
import 'hookable';
|
||||
import './shared/unhead.BaPU1zLf.mjs';
|
||||
import './shared/unhead.DZbvapt-.mjs';
|
||||
|
||||
function createHead(options = {}) {
|
||||
const unhead = createUnhead({
|
||||
...options,
|
||||
// @ts-expect-error untyped
|
||||
document: false,
|
||||
propResolvers: [
|
||||
...options.propResolvers || [],
|
||||
(k, v) => {
|
||||
if (k && k.startsWith("on") && typeof v === "function") {
|
||||
return `this.dataset.${k}fired = true`;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
],
|
||||
init: [
|
||||
options.disableDefaults ? void 0 : {
|
||||
htmlAttrs: {
|
||||
lang: "en"
|
||||
},
|
||||
meta: [
|
||||
{
|
||||
charset: "utf-8"
|
||||
},
|
||||
{
|
||||
name: "viewport",
|
||||
content: "width=device-width, initial-scale=1"
|
||||
}
|
||||
]
|
||||
},
|
||||
...options.init || []
|
||||
]
|
||||
});
|
||||
unhead.use({
|
||||
key: "server",
|
||||
hooks: {
|
||||
"tags:resolve": function(ctx) {
|
||||
const title = ctx.tagMap.get("title");
|
||||
const titleTemplate = ctx.tagMap.get("titleTemplate");
|
||||
const templateParams = ctx.tagMap.get("templateParams");
|
||||
const payload = {
|
||||
title: title?.mode === "server" ? unhead._title : void 0,
|
||||
titleTemplate: titleTemplate?.mode === "server" ? unhead._titleTemplate : void 0,
|
||||
templateParams: templateParams?.mode === "server" ? unhead._templateParams : void 0
|
||||
};
|
||||
if (Object.values(payload).some(Boolean)) {
|
||||
ctx.tags.push({
|
||||
tag: "script",
|
||||
innerHTML: JSON.stringify(payload),
|
||||
props: { id: "unhead:payload", type: "application/json" }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return unhead;
|
||||
}
|
||||
|
||||
const Attrs = /(\w+)(?:=["']([^"']*)["'])?/g;
|
||||
const HtmlTag = /<html[^>]*>/;
|
||||
const BodyTag = /<body[^>]*>/;
|
||||
const HeadContent = /<head[^>]*>(.*?)<\/head>/s;
|
||||
const SelfClosingTags = /<(meta|link|base)[^>]*>/g;
|
||||
const ClosingTags = /<(title|script|style)[^>]*>[\s\S]*?<\/\1>/g;
|
||||
const NewLines = /(\n\s*)+/g;
|
||||
function extractAttributes(tag) {
|
||||
const inner = tag.match(/<([^>]*)>/)?.[1].split(" ").slice(1).join(" ");
|
||||
if (!inner)
|
||||
return {};
|
||||
const attrs = inner.match(Attrs);
|
||||
return attrs?.reduce((acc, attr) => {
|
||||
const sep = attr.indexOf("=");
|
||||
const key = sep > 0 ? attr.slice(0, sep) : attr;
|
||||
const val = sep > 0 ? attr.slice(sep + 1).slice(1, -1) : true;
|
||||
return { ...acc, [key]: val };
|
||||
}, {}) || {};
|
||||
}
|
||||
function extractUnheadInputFromHtml(html) {
|
||||
const input = {};
|
||||
input.htmlAttrs = extractAttributes(html.match(HtmlTag)?.[0] || "");
|
||||
html = html.replace(HtmlTag, "<html>");
|
||||
input.bodyAttrs = extractAttributes(html.match(BodyTag)?.[0] || "");
|
||||
html = html.replace(BodyTag, "<body>");
|
||||
const innerHead = html.match(HeadContent)?.[1] || "";
|
||||
innerHead.match(SelfClosingTags)?.forEach((s) => {
|
||||
html = html.replace(s, "");
|
||||
const tag = s.split(" ")[0].slice(1);
|
||||
input[tag] = input[tag] || [];
|
||||
input[tag].push(extractAttributes(s));
|
||||
});
|
||||
innerHead.match(ClosingTags)?.map((tag) => tag.trim()).filter(Boolean).forEach((tag) => {
|
||||
html = html.replace(tag, "");
|
||||
const type = tag.match(/<([a-z-]+)/)?.[1];
|
||||
const res = extractAttributes(tag);
|
||||
const innerContent = tag.match(/>([\s\S]*)</)?.[1];
|
||||
if (innerContent) {
|
||||
res[type !== "script" ? "textContent" : "innerHTML"] = innerContent;
|
||||
}
|
||||
if (type === "title") {
|
||||
input.title = res;
|
||||
} else {
|
||||
input[type] = input[type] || [];
|
||||
input[type].push(res);
|
||||
}
|
||||
});
|
||||
html = html.replace(NewLines, "\n");
|
||||
return { html, input };
|
||||
}
|
||||
|
||||
function encodeAttribute(value) {
|
||||
return String(value).replace(/"/g, """);
|
||||
}
|
||||
function propsToString(props) {
|
||||
let attrs = "";
|
||||
for (const key in props) {
|
||||
if (!Object.hasOwn(props, key))
|
||||
continue;
|
||||
let value = props[key];
|
||||
if ((key === "class" || key === "style") && typeof value !== "string") {
|
||||
value = key === "class" ? Array.from(value).join(" ") : Array.from(value).map(([k, v]) => `${k}:${v}`).join(";");
|
||||
}
|
||||
if (value !== false && value !== null) {
|
||||
attrs += value === true ? ` ${key}` : ` ${key}="${encodeAttribute(value)}"`;
|
||||
}
|
||||
}
|
||||
return attrs;
|
||||
}
|
||||
|
||||
function escapeHtml(str) {
|
||||
return str.replace(/[&<>"'/]/g, (char) => {
|
||||
switch (char) {
|
||||
case "&":
|
||||
return "&";
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
case '"':
|
||||
return """;
|
||||
case "'":
|
||||
return "'";
|
||||
case "/":
|
||||
return "/";
|
||||
default:
|
||||
return char;
|
||||
}
|
||||
});
|
||||
}
|
||||
function tagToString(tag) {
|
||||
const attrs = propsToString(tag.props);
|
||||
const openTag = `<${tag.tag}${attrs}>`;
|
||||
if (!TagsWithInnerContent.has(tag.tag))
|
||||
return SelfClosingTags$1.has(tag.tag) ? openTag : `${openTag}</${tag.tag}>`;
|
||||
let content = String(tag.innerHTML || "");
|
||||
if (tag.textContent)
|
||||
content = escapeHtml(String(tag.textContent));
|
||||
return SelfClosingTags$1.has(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
|
||||
}
|
||||
|
||||
function ssrRenderTags(tags, options) {
|
||||
const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: "", bodyClose: "", bodyOpen: "" } };
|
||||
const lineBreaks = !options?.omitLineBreaks ? "\n" : "";
|
||||
for (const tag of tags) {
|
||||
if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
|
||||
Object.assign(schema[tag.tag], tag.props);
|
||||
continue;
|
||||
}
|
||||
const s = tagToString(tag);
|
||||
const tagPosition = tag.tagPosition || "head";
|
||||
schema.tags[tagPosition] += schema.tags[tagPosition] ? `${lineBreaks}${s}` : s;
|
||||
}
|
||||
return {
|
||||
headTags: schema.tags.head,
|
||||
bodyTags: schema.tags.bodyClose,
|
||||
bodyTagsOpen: schema.tags.bodyOpen,
|
||||
htmlAttrs: propsToString(schema.htmlAttrs),
|
||||
bodyAttrs: propsToString(schema.bodyAttrs)
|
||||
};
|
||||
}
|
||||
|
||||
async function renderSSRHead(head, options) {
|
||||
const beforeRenderCtx = { shouldRender: true };
|
||||
await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
|
||||
if (!beforeRenderCtx.shouldRender) {
|
||||
return {
|
||||
headTags: "",
|
||||
bodyTags: "",
|
||||
bodyTagsOpen: "",
|
||||
htmlAttrs: "",
|
||||
bodyAttrs: ""
|
||||
};
|
||||
}
|
||||
const ctx = { tags: options?.resolvedTags || await head.resolveTags() };
|
||||
await head.hooks.callHook("ssr:render", ctx);
|
||||
const html = ssrRenderTags(ctx.tags, options);
|
||||
const renderCtx = { tags: ctx.tags, html };
|
||||
await head.hooks.callHook("ssr:rendered", renderCtx);
|
||||
return renderCtx.html;
|
||||
}
|
||||
|
||||
async function transformHtmlTemplate(head, html, options) {
|
||||
const { html: parsedHtml, input } = extractUnheadInputFromHtml(html);
|
||||
head.push(input, { _index: 0 });
|
||||
const headHtml = await renderSSRHead(head, options);
|
||||
return parsedHtml.replace("<html>", `<html${headHtml.htmlAttrs}>`).replace("<body>", `<body>${headHtml.bodyTagsOpen ? `
|
||||
${headHtml.bodyTagsOpen}` : ``}`).replace("<body>", `<body${headHtml.bodyAttrs}>`).replace("</head>", `${headHtml.headTags}</head>`).replace("</body>", `${headHtml.bodyTags}</body>`);
|
||||
}
|
||||
|
||||
export { createHead, escapeHtml, extractUnheadInputFromHtml, propsToString, renderSSRHead, ssrRenderTags, tagToString, transformHtmlTemplate };
|
||||
170
.output/server/node_modules/unhead/dist/shared/unhead.B52g_5xR.mjs
generated
vendored
Normal file
170
.output/server/node_modules/unhead/dist/shared/unhead.B52g_5xR.mjs
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
import { createHooks } from 'hookable';
|
||||
import { n as normalizeEntryToTags, d as dedupeKey, i as isMetaArrayDupeKey } from './unhead.BaPU1zLf.mjs';
|
||||
import { t as tagWeight, s as sortTags } from './unhead.DZbvapt-.mjs';
|
||||
import { c as UsesMergeStrategy, V as ValidHeadTags } from './unhead.yem5I2v_.mjs';
|
||||
|
||||
function registerPlugin(head, p) {
|
||||
const plugin = typeof p === "function" ? p(head) : p;
|
||||
const key = plugin.key || String(head.plugins.size + 1);
|
||||
const exists = head.plugins.get(key);
|
||||
if (!exists) {
|
||||
head.plugins.set(key, plugin);
|
||||
head.hooks.addHooks(plugin.hooks || {});
|
||||
}
|
||||
}
|
||||
function createHeadCore(resolvedOptions = {}) {
|
||||
return createUnhead(resolvedOptions);
|
||||
}
|
||||
function createUnhead(resolvedOptions = {}) {
|
||||
const hooks = createHooks();
|
||||
hooks.addHooks(resolvedOptions.hooks || {});
|
||||
const ssr = !resolvedOptions.document;
|
||||
const entries = /* @__PURE__ */ new Map();
|
||||
const plugins = /* @__PURE__ */ new Map();
|
||||
const normalizeQueue = [];
|
||||
const head = {
|
||||
_entryCount: 1,
|
||||
// 0 is reserved for internal use
|
||||
plugins,
|
||||
dirty: false,
|
||||
resolvedOptions,
|
||||
hooks,
|
||||
ssr,
|
||||
entries,
|
||||
headEntries() {
|
||||
return [...entries.values()];
|
||||
},
|
||||
use: (p) => registerPlugin(head, p),
|
||||
push(input, _options) {
|
||||
const options = { ..._options || {} };
|
||||
delete options.head;
|
||||
const _i = options._index ?? head._entryCount++;
|
||||
const inst = { _i, input, options };
|
||||
const _ = {
|
||||
_poll(rm = false) {
|
||||
head.dirty = true;
|
||||
!rm && normalizeQueue.push(_i);
|
||||
hooks.callHook("entries:updated", head);
|
||||
},
|
||||
dispose() {
|
||||
if (entries.delete(_i)) {
|
||||
_._poll(true);
|
||||
}
|
||||
},
|
||||
// a patch is the same as creating a new entry, just a nice DX
|
||||
patch(input2) {
|
||||
if (!options.mode || options.mode === "server" && ssr || options.mode === "client" && !ssr) {
|
||||
inst.input = input2;
|
||||
entries.set(_i, inst);
|
||||
_._poll();
|
||||
}
|
||||
}
|
||||
};
|
||||
_.patch(input);
|
||||
return _;
|
||||
},
|
||||
async resolveTags() {
|
||||
const ctx = {
|
||||
tagMap: /* @__PURE__ */ new Map(),
|
||||
tags: [],
|
||||
entries: [...head.entries.values()]
|
||||
};
|
||||
await hooks.callHook("entries:resolve", ctx);
|
||||
while (normalizeQueue.length) {
|
||||
const i = normalizeQueue.shift();
|
||||
const e = entries.get(i);
|
||||
if (e) {
|
||||
const normalizeCtx = {
|
||||
tags: normalizeEntryToTags(e.input, resolvedOptions.propResolvers || []).map((t) => Object.assign(t, e.options)),
|
||||
entry: e
|
||||
};
|
||||
await hooks.callHook("entries:normalize", normalizeCtx);
|
||||
e._tags = normalizeCtx.tags.map((t, i2) => {
|
||||
t._w = tagWeight(head, t);
|
||||
t._p = (e._i << 10) + i2;
|
||||
t._d = dedupeKey(t);
|
||||
return t;
|
||||
});
|
||||
}
|
||||
}
|
||||
let hasFlatMeta = false;
|
||||
ctx.entries.flatMap((e) => (e._tags || []).map((t) => ({ ...t, props: { ...t.props } }))).sort(sortTags).reduce((acc, next) => {
|
||||
const k = String(next._d || next._p);
|
||||
if (!acc.has(k))
|
||||
return acc.set(k, next);
|
||||
const prev = acc.get(k);
|
||||
const strategy = next?.tagDuplicateStrategy || (UsesMergeStrategy.has(next.tag) ? "merge" : null) || (next.key && next.key === prev.key ? "merge" : null);
|
||||
if (strategy === "merge") {
|
||||
const newProps = { ...prev.props };
|
||||
Object.entries(next.props).forEach(([p, v]) => (
|
||||
// @ts-expect-error untyped
|
||||
newProps[p] = p === "style" ? new Map([...prev.props.style || /* @__PURE__ */ new Map(), ...v]) : p === "class" ? /* @__PURE__ */ new Set([...prev.props.class || /* @__PURE__ */ new Set(), ...v]) : v
|
||||
));
|
||||
acc.set(k, { ...next, props: newProps });
|
||||
} else if (next._p >> 10 === prev._p >> 10 && isMetaArrayDupeKey(next._d)) {
|
||||
acc.set(k, Object.assign([...Array.isArray(prev) ? prev : [prev], next], next));
|
||||
hasFlatMeta = true;
|
||||
} else if (next._w === prev._w ? next._p > prev._p : next?._w < prev?._w) {
|
||||
acc.set(k, next);
|
||||
}
|
||||
return acc;
|
||||
}, ctx.tagMap);
|
||||
const title = ctx.tagMap.get("title");
|
||||
const titleTemplate = ctx.tagMap.get("titleTemplate");
|
||||
head._title = title?.textContent;
|
||||
if (titleTemplate) {
|
||||
const titleTemplateFn = titleTemplate?.textContent;
|
||||
head._titleTemplate = typeof titleTemplateFn === "string" ? titleTemplateFn : void 0;
|
||||
if (titleTemplateFn) {
|
||||
let newTitle = typeof titleTemplateFn === "function" ? titleTemplateFn(title?.textContent) : titleTemplateFn;
|
||||
if (typeof newTitle === "string" && !head.plugins.has("template-params")) {
|
||||
newTitle = newTitle.replace("%s", title?.textContent || "");
|
||||
}
|
||||
if (title) {
|
||||
newTitle === null ? ctx.tagMap.delete("title") : ctx.tagMap.set("title", { ...title, textContent: newTitle });
|
||||
} else {
|
||||
titleTemplate.tag = "title";
|
||||
titleTemplate.textContent = newTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
ctx.tags = Array.from(ctx.tagMap.values());
|
||||
if (hasFlatMeta) {
|
||||
ctx.tags = ctx.tags.flat().sort(sortTags);
|
||||
}
|
||||
await hooks.callHook("tags:beforeResolve", ctx);
|
||||
await hooks.callHook("tags:resolve", ctx);
|
||||
await hooks.callHook("tags:afterResolve", ctx);
|
||||
const finalTags = [];
|
||||
for (const t of ctx.tags) {
|
||||
const { innerHTML, tag, props } = t;
|
||||
if (!ValidHeadTags.has(tag)) {
|
||||
continue;
|
||||
}
|
||||
if (Object.keys(props).length === 0 && !t.innerHTML && !t.textContent) {
|
||||
continue;
|
||||
}
|
||||
if (tag === "meta" && !props.content && !props["http-equiv"] && !props.charset) {
|
||||
continue;
|
||||
}
|
||||
if (tag === "script" && innerHTML) {
|
||||
if (props.type?.endsWith("json")) {
|
||||
const v = typeof innerHTML === "string" ? innerHTML : JSON.stringify(innerHTML);
|
||||
t.innerHTML = v.replace(/</g, "\\u003C");
|
||||
} else if (typeof innerHTML === "string") {
|
||||
t.innerHTML = innerHTML.replace(new RegExp(`</${tag}`, "g"), `<\\/${tag}`);
|
||||
}
|
||||
t._d = dedupeKey(t);
|
||||
}
|
||||
finalTags.push(t);
|
||||
}
|
||||
return finalTags;
|
||||
}
|
||||
};
|
||||
(resolvedOptions?.plugins || []).forEach((p) => registerPlugin(head, p));
|
||||
head.hooks.callHook("init", head);
|
||||
resolvedOptions.init?.forEach((e) => e && head.push(e));
|
||||
return head;
|
||||
}
|
||||
|
||||
export { createUnhead as a, createHeadCore as c };
|
||||
266
.output/server/node_modules/unhead/dist/shared/unhead.B578PsDV.mjs
generated
vendored
Normal file
266
.output/server/node_modules/unhead/dist/shared/unhead.B578PsDV.mjs
generated
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
import { b as ScriptNetworkEvents } from './unhead.yem5I2v_.mjs';
|
||||
|
||||
function createNoopedRecordingProxy(instance = {}) {
|
||||
const stack = [];
|
||||
let stackIdx = -1;
|
||||
const handler = (reuseStack = false) => ({
|
||||
get(_, prop, receiver) {
|
||||
if (!reuseStack) {
|
||||
const v = Reflect.get(_, prop, receiver);
|
||||
if (typeof v !== "undefined") {
|
||||
return v;
|
||||
}
|
||||
stackIdx++;
|
||||
stack[stackIdx] = [];
|
||||
}
|
||||
stack[stackIdx].push({ type: "get", key: prop });
|
||||
return new Proxy(() => {
|
||||
}, handler(true));
|
||||
},
|
||||
apply(_, __, args) {
|
||||
stack[stackIdx].push({ type: "apply", key: "", args });
|
||||
return void 0;
|
||||
}
|
||||
});
|
||||
return {
|
||||
proxy: new Proxy(instance || {}, handler()),
|
||||
stack
|
||||
};
|
||||
}
|
||||
function createForwardingProxy(target) {
|
||||
const handler = {
|
||||
get(_, prop, receiver) {
|
||||
const v = Reflect.get(_, prop, receiver);
|
||||
if (typeof v === "object") {
|
||||
return new Proxy(v, handler);
|
||||
}
|
||||
return v;
|
||||
},
|
||||
apply(_, __, args) {
|
||||
Reflect.apply(_, __, args);
|
||||
return void 0;
|
||||
}
|
||||
};
|
||||
return new Proxy(target, handler);
|
||||
}
|
||||
function replayProxyRecordings(target, stack) {
|
||||
stack.forEach((recordings) => {
|
||||
let context = target;
|
||||
let prevContext = target;
|
||||
recordings.forEach(({ type, key, args }) => {
|
||||
if (type === "get") {
|
||||
prevContext = context;
|
||||
context = context[key];
|
||||
} else if (type === "apply") {
|
||||
context = context.call(prevContext, ...args);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function resolveScriptKey(input) {
|
||||
return input.key || input.src || (typeof input.innerHTML === "string" ? input.innerHTML : "");
|
||||
}
|
||||
const PreconnectServerModes = ["preconnect", "dns-prefetch"];
|
||||
function useScript(head, _input, _options) {
|
||||
const input = typeof _input === "string" ? { src: _input } : _input;
|
||||
const options = _options || {};
|
||||
const id = resolveScriptKey(input);
|
||||
const prevScript = head._scripts?.[id];
|
||||
if (prevScript) {
|
||||
prevScript.setupTriggerHandler(options.trigger);
|
||||
return prevScript;
|
||||
}
|
||||
options.beforeInit?.();
|
||||
const syncStatus = (s) => {
|
||||
script.status = s;
|
||||
head.hooks.callHook(`script:updated`, hookCtx);
|
||||
};
|
||||
ScriptNetworkEvents.forEach((fn) => {
|
||||
const k = fn;
|
||||
const _fn = typeof input[k] === "function" ? input[k].bind(options.eventContext) : null;
|
||||
input[k] = (e) => {
|
||||
syncStatus(fn === "onload" ? "loaded" : fn === "onerror" ? "error" : "loading");
|
||||
_fn?.(e);
|
||||
};
|
||||
});
|
||||
const _cbs = { loaded: [], error: [] };
|
||||
const _uniqueCbs = /* @__PURE__ */ new Set();
|
||||
const _registerCb = (key, cb, options2) => {
|
||||
if (head.ssr) {
|
||||
return;
|
||||
}
|
||||
if (options2?.key) {
|
||||
const key2 = `${options2?.key}:${options2.key}`;
|
||||
if (_uniqueCbs.has(key2)) {
|
||||
return;
|
||||
}
|
||||
_uniqueCbs.add(key2);
|
||||
}
|
||||
if (_cbs[key]) {
|
||||
const i = _cbs[key].push(cb);
|
||||
return () => _cbs[key]?.splice(i - 1, 1);
|
||||
}
|
||||
cb(script.instance);
|
||||
return () => {
|
||||
};
|
||||
};
|
||||
const loadPromise = new Promise((resolve) => {
|
||||
if (head.ssr)
|
||||
return;
|
||||
const emit = (api) => requestAnimationFrame(() => resolve(api));
|
||||
const _ = head.hooks.hook("script:updated", ({ script: script2 }) => {
|
||||
const status = script2.status;
|
||||
if (script2.id === id && (status === "loaded" || status === "error")) {
|
||||
if (status === "loaded") {
|
||||
if (typeof options.use === "function") {
|
||||
const api = options.use();
|
||||
if (api) {
|
||||
emit(api);
|
||||
}
|
||||
} else {
|
||||
emit({});
|
||||
}
|
||||
} else if (status === "error") {
|
||||
resolve(false);
|
||||
}
|
||||
_();
|
||||
}
|
||||
});
|
||||
});
|
||||
const script = {
|
||||
_loadPromise: loadPromise,
|
||||
instance: !head.ssr && options?.use?.() || null,
|
||||
proxy: null,
|
||||
id,
|
||||
status: "awaitingLoad",
|
||||
remove() {
|
||||
script._triggerAbortController?.abort();
|
||||
script._triggerPromises = [];
|
||||
script._warmupEl?.dispose();
|
||||
if (script.entry) {
|
||||
script.entry.dispose();
|
||||
script.entry = void 0;
|
||||
syncStatus("removed");
|
||||
delete head._scripts?.[id];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
warmup(rel) {
|
||||
const { src } = input;
|
||||
const isCrossOrigin = !src.startsWith("/") || src.startsWith("//");
|
||||
const isPreconnect = rel && PreconnectServerModes.includes(rel);
|
||||
let href = src;
|
||||
if (!rel || isPreconnect && !isCrossOrigin) {
|
||||
return;
|
||||
}
|
||||
if (isPreconnect) {
|
||||
const $url = new URL(src);
|
||||
href = `${$url.protocol}//${$url.host}`;
|
||||
}
|
||||
const link = {
|
||||
href,
|
||||
rel,
|
||||
crossorigin: typeof input.crossorigin !== "undefined" ? input.crossorigin : isCrossOrigin ? "anonymous" : void 0,
|
||||
referrerpolicy: typeof input.referrerpolicy !== "undefined" ? input.referrerpolicy : isCrossOrigin ? "no-referrer" : void 0,
|
||||
fetchpriority: typeof input.fetchpriority !== "undefined" ? input.fetchpriority : "low",
|
||||
integrity: input.integrity,
|
||||
as: rel === "preload" ? "script" : void 0
|
||||
};
|
||||
script._warmupEl = head.push({ link: [link] }, { head, tagPriority: "high" });
|
||||
return script._warmupEl;
|
||||
},
|
||||
load(cb) {
|
||||
script._triggerAbortController?.abort();
|
||||
script._triggerPromises = [];
|
||||
if (!script.entry) {
|
||||
syncStatus("loading");
|
||||
const defaults = {
|
||||
defer: true,
|
||||
fetchpriority: "low"
|
||||
};
|
||||
if (input.src && (input.src.startsWith("http") || input.src.startsWith("//"))) {
|
||||
defaults.crossorigin = "anonymous";
|
||||
defaults.referrerpolicy = "no-referrer";
|
||||
}
|
||||
script.entry = head.push({
|
||||
script: [{ ...defaults, ...input }]
|
||||
}, options);
|
||||
}
|
||||
if (cb)
|
||||
_registerCb("loaded", cb);
|
||||
return loadPromise;
|
||||
},
|
||||
onLoaded(cb, options2) {
|
||||
return _registerCb("loaded", cb, options2);
|
||||
},
|
||||
onError(cb, options2) {
|
||||
return _registerCb("error", cb, options2);
|
||||
},
|
||||
setupTriggerHandler(trigger) {
|
||||
if (script.status !== "awaitingLoad") {
|
||||
return;
|
||||
}
|
||||
if ((typeof trigger === "undefined" || trigger === "client") && !head.ssr || trigger === "server") {
|
||||
script.load();
|
||||
} else if (trigger instanceof Promise) {
|
||||
if (head.ssr) {
|
||||
return;
|
||||
}
|
||||
if (!script._triggerAbortController) {
|
||||
script._triggerAbortController = new AbortController();
|
||||
script._triggerAbortPromise = new Promise((resolve) => {
|
||||
script._triggerAbortController.signal.addEventListener("abort", () => {
|
||||
script._triggerAbortController = null;
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
script._triggerPromises = script._triggerPromises || [];
|
||||
const idx = script._triggerPromises.push(Promise.race([
|
||||
trigger.then((v) => typeof v === "undefined" || v ? script.load : void 0),
|
||||
script._triggerAbortPromise
|
||||
]).catch(() => {
|
||||
}).then((res) => {
|
||||
res?.();
|
||||
}).finally(() => {
|
||||
script._triggerPromises?.splice(idx, 1);
|
||||
}));
|
||||
} else if (typeof trigger === "function") {
|
||||
trigger(script.load);
|
||||
}
|
||||
},
|
||||
_cbs
|
||||
};
|
||||
loadPromise.then((api) => {
|
||||
if (api !== false) {
|
||||
script.instance = api;
|
||||
_cbs.loaded?.forEach((cb) => cb(api));
|
||||
_cbs.loaded = null;
|
||||
} else {
|
||||
_cbs.error?.forEach((cb) => cb());
|
||||
_cbs.error = null;
|
||||
}
|
||||
});
|
||||
const hookCtx = { script };
|
||||
script.setupTriggerHandler(options.trigger);
|
||||
if (options.use) {
|
||||
const { proxy, stack } = createNoopedRecordingProxy(head.ssr ? {} : options.use() || {});
|
||||
script.proxy = proxy;
|
||||
script.onLoaded((instance) => {
|
||||
replayProxyRecordings(instance, stack);
|
||||
script.proxy = createForwardingProxy(instance);
|
||||
});
|
||||
}
|
||||
if (!options.warmupStrategy && (typeof options.trigger === "undefined" || options.trigger === "client")) {
|
||||
options.warmupStrategy = "preload";
|
||||
}
|
||||
if (options.warmupStrategy) {
|
||||
script.warmup(options.warmupStrategy);
|
||||
}
|
||||
head._scripts = Object.assign(head._scripts || {}, { [id]: script });
|
||||
return script;
|
||||
}
|
||||
|
||||
export { resolveScriptKey as r, useScript as u };
|
||||
44
.output/server/node_modules/unhead/dist/shared/unhead.BPM0-cfG.mjs
generated
vendored
Normal file
44
.output/server/node_modules/unhead/dist/shared/unhead.BPM0-cfG.mjs
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { S as SafeInputPlugin, F as FlatMetaPlugin } from './unhead.CApf5sj3.mjs';
|
||||
|
||||
function useHead(unhead, input, options = {}) {
|
||||
return unhead.push(input || {}, options);
|
||||
}
|
||||
function useHeadSafe(unhead, input = {}, options = {}) {
|
||||
unhead.use(SafeInputPlugin);
|
||||
return useHead(unhead, input, Object.assign(options, { _safe: true }));
|
||||
}
|
||||
function useSeoMeta(unhead, input = {}, options) {
|
||||
unhead.use(FlatMetaPlugin);
|
||||
function normalize(input2) {
|
||||
if (input2._flatMeta) {
|
||||
return input2;
|
||||
}
|
||||
const { title, titleTemplate, ...meta } = input2 || {};
|
||||
return {
|
||||
title,
|
||||
titleTemplate,
|
||||
_flatMeta: meta
|
||||
};
|
||||
}
|
||||
const entry = unhead.push(normalize(input), options);
|
||||
const corePatch = entry.patch;
|
||||
if (!entry.__patched) {
|
||||
entry.patch = (input2) => corePatch(normalize(input2));
|
||||
entry.__patched = true;
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
function useServerHead(unhead, input = {}, options = {}) {
|
||||
options.mode = "server";
|
||||
return unhead.push(input, options);
|
||||
}
|
||||
function useServerHeadSafe(unhead, input = {}, options = {}) {
|
||||
options.mode = "server";
|
||||
return useHeadSafe(unhead, input, { ...options, mode: "server" });
|
||||
}
|
||||
function useServerSeoMeta(unhead, input = {}, options) {
|
||||
options.mode = "server";
|
||||
return useSeoMeta(unhead, input, { ...options, mode: "server" });
|
||||
}
|
||||
|
||||
export { useHeadSafe as a, useSeoMeta as b, useServerHead as c, useServerHeadSafe as d, useServerSeoMeta as e, useHead as u };
|
||||
177
.output/server/node_modules/unhead/dist/shared/unhead.BaPU1zLf.mjs
generated
vendored
Normal file
177
.output/server/node_modules/unhead/dist/shared/unhead.BaPU1zLf.mjs
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
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"];
|
||||
function isMetaArrayDupeKey(v) {
|
||||
const k = v.split(":")[1];
|
||||
return MetaTagsArrayable.has(k);
|
||||
}
|
||||
function dedupeKey(tag) {
|
||||
const { props, tag: name } = tag;
|
||||
if (UniqueTags.has(name))
|
||||
return name;
|
||||
if (name === "link" && props.rel === "canonical")
|
||||
return "canonical";
|
||||
if (props.charset)
|
||||
return "charset";
|
||||
if (tag.tag === "meta") {
|
||||
for (const n of allowedMetaProperties) {
|
||||
if (props[n] !== void 0) {
|
||||
return `${name}:${props[n]}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tag.key) {
|
||||
return `${name}:key:${tag.key}`;
|
||||
}
|
||||
if (props.id) {
|
||||
return `${name}:id:${props.id}`;
|
||||
}
|
||||
if (TagsWithInnerContent.has(name)) {
|
||||
const v = tag.textContent || tag.innerHTML;
|
||||
if (v) {
|
||||
return `${name}:content:${v}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
function hashTag(tag) {
|
||||
const dedupe = tag._h || tag._d;
|
||||
if (dedupe)
|
||||
return dedupe;
|
||||
const inner = tag.textContent || tag.innerHTML;
|
||||
if (inner)
|
||||
return inner;
|
||||
return `${tag.tag}:${Object.entries(tag.props).map(([k, v]) => `${k}:${String(v)}`).join(",")}`;
|
||||
}
|
||||
|
||||
function walkResolver(val, resolve, key) {
|
||||
const type = typeof val;
|
||||
if (type === "function") {
|
||||
if (!key || key !== "titleTemplate" && !(key[0] === "o" && key[1] === "n")) {
|
||||
val = val();
|
||||
}
|
||||
}
|
||||
let v;
|
||||
if (resolve) {
|
||||
v = resolve(key, val);
|
||||
}
|
||||
if (Array.isArray(v)) {
|
||||
return v.map((r) => walkResolver(r, resolve));
|
||||
}
|
||||
if (v?.constructor === Object) {
|
||||
const next = {};
|
||||
for (const key2 of Object.keys(v)) {
|
||||
next[key2] = walkResolver(v[key2], resolve, key2);
|
||||
}
|
||||
return next;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
function normalizeStyleClassProps(key, value) {
|
||||
const store = key === "style" ? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Set();
|
||||
function processValue(rawValue) {
|
||||
const value2 = rawValue.trim();
|
||||
if (!value2)
|
||||
return;
|
||||
if (key === "style") {
|
||||
const [k, ...v] = value2.split(":").map((s) => s.trim());
|
||||
if (k && v.length)
|
||||
store.set(k, v.join(":"));
|
||||
} else {
|
||||
value2.split(" ").filter(Boolean).forEach((c) => store.add(c));
|
||||
}
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
key === "style" ? value.split(";").forEach(processValue) : processValue(value);
|
||||
} else if (Array.isArray(value)) {
|
||||
value.forEach((item) => processValue(item));
|
||||
} else if (value && typeof value === "object") {
|
||||
Object.entries(value).forEach(([k, v]) => {
|
||||
if (v && v !== "false") {
|
||||
key === "style" ? store.set(k.trim(), v) : processValue(k);
|
||||
}
|
||||
});
|
||||
}
|
||||
return store;
|
||||
}
|
||||
function normalizeProps(tag, input) {
|
||||
tag.props = tag.props || {};
|
||||
if (!input) {
|
||||
return tag;
|
||||
}
|
||||
Object.entries(input).forEach(([key, value]) => {
|
||||
if (value === null) {
|
||||
tag.props[key] = null;
|
||||
return;
|
||||
}
|
||||
if (key === "class" || key === "style") {
|
||||
tag.props[key] = normalizeStyleClassProps(key, value);
|
||||
return;
|
||||
}
|
||||
if (TagConfigKeys.has(key)) {
|
||||
if (["textContent", "innerHTML"].includes(key) && typeof value === "object") {
|
||||
let type = input.type;
|
||||
if (!input.type) {
|
||||
type = "application/json";
|
||||
}
|
||||
if (!type?.endsWith("json") && type !== "speculationrules") {
|
||||
return;
|
||||
}
|
||||
input.type = type;
|
||||
tag.props.type = type;
|
||||
tag[key] = JSON.stringify(value);
|
||||
} else {
|
||||
tag[key] = value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const strValue = String(value);
|
||||
const isDataKey = key.startsWith("data-");
|
||||
if (strValue === "true" || strValue === "") {
|
||||
tag.props[key] = isDataKey ? "true" : true;
|
||||
} else if (!value && isDataKey && strValue === "false") {
|
||||
tag.props[key] = "false";
|
||||
} else if (value !== void 0) {
|
||||
tag.props[key] = value;
|
||||
}
|
||||
});
|
||||
return tag;
|
||||
}
|
||||
function normalizeTag(tagName, _input) {
|
||||
const input = typeof _input === "object" && typeof _input !== "function" ? _input : { [tagName === "script" || tagName === "noscript" || tagName === "style" ? "innerHTML" : "textContent"]: _input };
|
||||
const tag = normalizeProps({ tag: tagName, props: {} }, input);
|
||||
if (tag.key && DupeableTags.has(tag.tag)) {
|
||||
tag.props["data-hid"] = tag._h = tag.key;
|
||||
}
|
||||
if (tag.tag === "script" && typeof tag.innerHTML === "object") {
|
||||
tag.innerHTML = JSON.stringify(tag.innerHTML);
|
||||
tag.props.type = tag.props.type || "application/json";
|
||||
}
|
||||
return Array.isArray(tag.props.content) ? tag.props.content.map((v) => ({ ...tag, props: { ...tag.props, content: v } })) : tag;
|
||||
}
|
||||
function normalizeEntryToTags(input, propResolvers) {
|
||||
if (!input) {
|
||||
return [];
|
||||
}
|
||||
if (typeof input === "function") {
|
||||
input = input();
|
||||
}
|
||||
const resolvers = (key, val) => {
|
||||
for (let i = 0; i < propResolvers.length; i++) {
|
||||
val = propResolvers[i](key, val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
input = resolvers(void 0, input);
|
||||
const tags = [];
|
||||
input = walkResolver(input, resolvers);
|
||||
Object.entries(input || {}).forEach(([key, value]) => {
|
||||
if (value === void 0)
|
||||
return;
|
||||
for (const v of Array.isArray(value) ? value : [value])
|
||||
tags.push(normalizeTag(key, v));
|
||||
});
|
||||
return tags.flat();
|
||||
}
|
||||
|
||||
export { normalizeProps as a, dedupeKey as d, hashTag as h, isMetaArrayDupeKey as i, normalizeEntryToTags as n, walkResolver as w };
|
||||
148
.output/server/node_modules/unhead/dist/shared/unhead.CApf5sj3.mjs
generated
vendored
Normal file
148
.output/server/node_modules/unhead/dist/shared/unhead.CApf5sj3.mjs
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
import { u as unpackMeta } from './unhead.DQc16pHI.mjs';
|
||||
|
||||
function defineHeadPlugin(plugin) {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
const FlatMetaPlugin = /* @__PURE__ */ defineHeadPlugin({
|
||||
key: "flatMeta",
|
||||
hooks: {
|
||||
"entries:normalize": (ctx) => {
|
||||
const tagsToAdd = [];
|
||||
ctx.tags = ctx.tags.map((t) => {
|
||||
if (t.tag !== "_flatMeta") {
|
||||
return t;
|
||||
}
|
||||
tagsToAdd.push(unpackMeta(t.props).map((p) => ({
|
||||
...t,
|
||||
tag: "meta",
|
||||
props: p
|
||||
})));
|
||||
return false;
|
||||
}).filter(Boolean).concat(...tagsToAdd);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const WhitelistAttributes = {
|
||||
htmlAttrs: /* @__PURE__ */ new Set(["class", "style", "lang", "dir"]),
|
||||
bodyAttrs: /* @__PURE__ */ new Set(["class", "style"]),
|
||||
meta: /* @__PURE__ */ new Set(["name", "property", "charset", "content", "media"]),
|
||||
noscript: /* @__PURE__ */ new Set(["textContent"]),
|
||||
style: /* @__PURE__ */ new Set(["media", "textContent", "nonce", "title", "blocking"]),
|
||||
script: /* @__PURE__ */ new Set(["type", "textContent", "nonce", "blocking"]),
|
||||
link: /* @__PURE__ */ new Set(["color", "crossorigin", "fetchpriority", "href", "hreflang", "imagesrcset", "imagesizes", "integrity", "media", "referrerpolicy", "rel", "sizes", "type"])
|
||||
};
|
||||
function acceptDataAttrs(value) {
|
||||
return Object.fromEntries(
|
||||
Object.entries(value || {}).filter(([key]) => key === "id" || key.startsWith("data-"))
|
||||
);
|
||||
}
|
||||
function makeTagSafe(tag) {
|
||||
let next = {};
|
||||
const { tag: type, props: prev } = tag;
|
||||
switch (type) {
|
||||
// always safe
|
||||
case "title":
|
||||
case "titleTemplate":
|
||||
case "templateParams":
|
||||
next = prev;
|
||||
break;
|
||||
case "htmlAttrs":
|
||||
case "bodyAttrs":
|
||||
WhitelistAttributes[type].forEach((attr) => {
|
||||
if (prev[attr]) {
|
||||
next[attr] = prev[attr];
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "style":
|
||||
next = acceptDataAttrs(prev);
|
||||
WhitelistAttributes.style.forEach((key) => {
|
||||
if (prev[key]) {
|
||||
next[key] = prev[key];
|
||||
}
|
||||
});
|
||||
break;
|
||||
// meta is safe, except for http-equiv
|
||||
case "meta":
|
||||
WhitelistAttributes.meta.forEach((key) => {
|
||||
if (prev[key]) {
|
||||
next[key] = prev[key];
|
||||
}
|
||||
});
|
||||
break;
|
||||
// link tags we don't allow stylesheets, scripts, preloading, prerendering, prefetching, etc
|
||||
case "link":
|
||||
WhitelistAttributes.link.forEach((key) => {
|
||||
const val = prev[key];
|
||||
if (!val) {
|
||||
return;
|
||||
}
|
||||
if (key === "rel" && (val === "canonical" || val === "modulepreload" || val === "prerender" || val === "preload" || val === "prefetch")) {
|
||||
return;
|
||||
}
|
||||
if (key === "href") {
|
||||
if (val.includes("javascript:") || val.includes("data:")) {
|
||||
return;
|
||||
}
|
||||
next[key] = val;
|
||||
} else if (val) {
|
||||
next[key] = val;
|
||||
}
|
||||
});
|
||||
if (!next.href && !next.imagesrcset || !next.rel) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "noscript":
|
||||
WhitelistAttributes.noscript.forEach((key) => {
|
||||
if (prev[key]) {
|
||||
next[key] = prev[key];
|
||||
}
|
||||
});
|
||||
break;
|
||||
// we only allow JSON in scripts
|
||||
case "script":
|
||||
if (!tag.textContent || !prev.type?.endsWith("json")) {
|
||||
return false;
|
||||
}
|
||||
WhitelistAttributes.script.forEach((s) => {
|
||||
if (prev[s] === "textContent") {
|
||||
try {
|
||||
const jsonVal = typeof prev[s] === "string" ? JSON.parse(prev[s]) : prev[s];
|
||||
next[s] = JSON.stringify(jsonVal, null, 0);
|
||||
} catch {
|
||||
}
|
||||
} else if (prev[s]) {
|
||||
next[s] = prev[s];
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
if (!Object.keys(next).length && !tag.tag.endsWith("Attrs")) {
|
||||
return false;
|
||||
}
|
||||
tag.props = { ...acceptDataAttrs(prev), ...next };
|
||||
return tag;
|
||||
}
|
||||
const SafeInputPlugin = (
|
||||
/* @PURE */
|
||||
defineHeadPlugin({
|
||||
key: "safe",
|
||||
hooks: {
|
||||
"entries:normalize": (ctx) => {
|
||||
if (ctx.entry.options?._safe) {
|
||||
ctx.tags = ctx.tags.reduce((acc, tag) => {
|
||||
const safeTag = makeTagSafe(tag);
|
||||
if (safeTag)
|
||||
acc.push(safeTag);
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
export { FlatMetaPlugin as F, SafeInputPlugin as S, defineHeadPlugin as d };
|
||||
196
.output/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs
generated
vendored
Normal file
196
.output/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
import { M as MetaTagsArrayable } from './unhead.yem5I2v_.mjs';
|
||||
|
||||
const NAMESPACES = {
|
||||
META: /* @__PURE__ */ new Set(["twitter"]),
|
||||
OG: /* @__PURE__ */ new Set(["og", "book", "article", "profile", "fb"]),
|
||||
MEDIA: /* @__PURE__ */ new Set(["ogImage", "ogVideo", "ogAudio", "twitterImage"]),
|
||||
HTTP_EQUIV: /* @__PURE__ */ new Set(["contentType", "defaultStyle", "xUaCompatible"])
|
||||
};
|
||||
const META_ALIASES = {
|
||||
articleExpirationTime: "article:expiration_time",
|
||||
articleModifiedTime: "article:modified_time",
|
||||
articlePublishedTime: "article:published_time",
|
||||
bookReleaseDate: "book:release_date",
|
||||
fbAppId: "fb:app_id",
|
||||
ogAudioSecureUrl: "og:audio:secure_url",
|
||||
ogAudioUrl: "og:audio",
|
||||
ogImageSecureUrl: "og:image:secure_url",
|
||||
ogImageUrl: "og:image",
|
||||
ogSiteName: "og:site_name",
|
||||
ogVideoSecureUrl: "og:video:secure_url",
|
||||
ogVideoUrl: "og:video",
|
||||
profileFirstName: "profile:first_name",
|
||||
profileLastName: "profile:last_name",
|
||||
profileUsername: "profile:username",
|
||||
msapplicationConfig: "msapplication-Config",
|
||||
msapplicationTileColor: "msapplication-TileColor",
|
||||
msapplicationTileImage: "msapplication-TileImage"
|
||||
};
|
||||
const MetaPackingSchema = {
|
||||
appleItunesApp: {
|
||||
unpack: {
|
||||
entrySeparator: ", ",
|
||||
// @ts-expect-error untyped
|
||||
resolve: ({ key, value }) => `${fixKeyCase(key)}=${value}`
|
||||
}
|
||||
},
|
||||
refresh: {
|
||||
metaKey: "http-equiv",
|
||||
unpack: {
|
||||
entrySeparator: ";",
|
||||
// @ts-expect-error untyped
|
||||
resolve: ({ key, value }) => key === "seconds" ? `${value}` : void 0
|
||||
}
|
||||
},
|
||||
robots: {
|
||||
unpack: {
|
||||
entrySeparator: ", ",
|
||||
// @ts-expect-error untyped
|
||||
resolve: ({ key, value }) => typeof value === "boolean" ? fixKeyCase(key) : `${fixKeyCase(key)}:${value}`
|
||||
}
|
||||
},
|
||||
contentSecurityPolicy: {
|
||||
metaKey: "http-equiv",
|
||||
unpack: {
|
||||
entrySeparator: "; ",
|
||||
// @ts-expect-error untyped
|
||||
resolve: ({ key, value }) => `${fixKeyCase(key)} ${value}`
|
||||
}
|
||||
},
|
||||
charset: {}
|
||||
};
|
||||
function fixKeyCase(key) {
|
||||
const updated = key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
||||
const prefixIndex = updated.indexOf("-");
|
||||
return prefixIndex === -1 ? updated : NAMESPACES.META.has(updated.slice(0, prefixIndex)) || NAMESPACES.OG.has(updated.slice(0, prefixIndex)) ? key.replace(/([A-Z])/g, ":$1").toLowerCase() : updated;
|
||||
}
|
||||
function sanitizeObject(input) {
|
||||
return Object.fromEntries(Object.entries(input).filter(([k, v]) => String(v) !== "false" && k));
|
||||
}
|
||||
function transformObject(obj) {
|
||||
return Array.isArray(obj) ? obj.map(transformObject) : !obj || typeof obj !== "object" ? obj : Object.fromEntries(Object.entries(obj).map(([k, v]) => [fixKeyCase(k), transformObject(v)]));
|
||||
}
|
||||
function unpackToString(value, options = {}) {
|
||||
const { entrySeparator = "", keyValueSeparator = "", wrapValue, resolve } = options;
|
||||
return Object.entries(value).map(([key, val]) => {
|
||||
if (resolve) {
|
||||
const resolved = resolve({ key, value: val });
|
||||
if (resolved !== void 0)
|
||||
return resolved;
|
||||
}
|
||||
const processedVal = typeof val === "object" ? unpackToString(val, options) : typeof val === "number" ? val.toString() : typeof val === "string" && wrapValue ? `${wrapValue}${val.replace(new RegExp(wrapValue, "g"), `\\${wrapValue}`)}${wrapValue}` : val;
|
||||
return `${key}${keyValueSeparator}${processedVal}`;
|
||||
}).join(entrySeparator);
|
||||
}
|
||||
function handleObjectEntry(key, value) {
|
||||
const sanitizedValue = sanitizeObject(value);
|
||||
const fixedKey = fixKeyCase(key);
|
||||
const attr = resolveMetaKeyType(fixedKey);
|
||||
if (!MetaTagsArrayable.has(fixedKey)) {
|
||||
return [{ [attr]: fixedKey, ...sanitizedValue }];
|
||||
}
|
||||
const input = Object.fromEntries(
|
||||
Object.entries(sanitizedValue).map(([k, v]) => [`${key}${k === "url" ? "" : `${k[0].toUpperCase()}${k.slice(1)}`}`, v])
|
||||
);
|
||||
return unpackMeta(input || {}).sort((a, b) => (a[attr]?.length || 0) - (b[attr]?.length || 0));
|
||||
}
|
||||
function resolveMetaKeyType(key) {
|
||||
if (MetaPackingSchema[key]?.metaKey === "http-equiv" || NAMESPACES.HTTP_EQUIV.has(key)) {
|
||||
return "http-equiv";
|
||||
}
|
||||
const fixed = fixKeyCase(key);
|
||||
const colonIndex = fixed.indexOf(":");
|
||||
return colonIndex === -1 ? "name" : NAMESPACES.OG.has(fixed.slice(0, colonIndex)) ? "property" : "name";
|
||||
}
|
||||
function resolveMetaKeyValue(key) {
|
||||
return META_ALIASES[key] || fixKeyCase(key);
|
||||
}
|
||||
function resolvePackedMetaObjectValue(value, key) {
|
||||
if (key === "refresh")
|
||||
return `${value.seconds};url=${value.url}`;
|
||||
return unpackToString(transformObject(value), {
|
||||
keyValueSeparator: "=",
|
||||
entrySeparator: ", ",
|
||||
resolve: ({ value: value2, key: key2 }) => value2 === null ? "" : typeof value2 === "boolean" ? key2 : void 0,
|
||||
// @ts-expect-error untyped
|
||||
...MetaPackingSchema[key]?.unpack
|
||||
});
|
||||
}
|
||||
function unpackMeta(input) {
|
||||
const extras = [];
|
||||
const primitives = {};
|
||||
for (const [key, value] of Object.entries(input)) {
|
||||
if (Array.isArray(value)) {
|
||||
if (key === "themeColor") {
|
||||
value.forEach((v) => {
|
||||
if (typeof v === "object" && v !== null) {
|
||||
extras.push({ name: "theme-color", ...v });
|
||||
}
|
||||
});
|
||||
continue;
|
||||
}
|
||||
for (const v of value) {
|
||||
if (typeof v === "object" && v !== null) {
|
||||
const urlProps = [];
|
||||
const otherProps = [];
|
||||
for (const [propKey, propValue] of Object.entries(v)) {
|
||||
const metaKey = `${key}${propKey === "url" ? "" : `:${propKey}`}`;
|
||||
const meta2 = unpackMeta({ [metaKey]: propValue });
|
||||
(propKey === "url" ? urlProps : otherProps).push(...meta2);
|
||||
}
|
||||
extras.push(...urlProps, ...otherProps);
|
||||
} else {
|
||||
extras.push(...typeof v === "string" ? unpackMeta({ [key]: v }) : handleObjectEntry(key, v));
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (typeof value === "object" && value) {
|
||||
if (NAMESPACES.MEDIA.has(key)) {
|
||||
const prefix = key.startsWith("twitter") ? "twitter" : "og";
|
||||
const type = key.replace(/^(og|twitter)/, "").toLowerCase();
|
||||
const metaKey = prefix === "twitter" ? "name" : "property";
|
||||
if (value.url) {
|
||||
extras.push({
|
||||
[metaKey]: `${prefix}:${type}`,
|
||||
content: value.url
|
||||
});
|
||||
}
|
||||
if (value.secureUrl) {
|
||||
extras.push({
|
||||
[metaKey]: `${prefix}:${type}:secure_url`,
|
||||
content: value.secureUrl
|
||||
});
|
||||
}
|
||||
for (const [propKey, propValue] of Object.entries(value)) {
|
||||
if (propKey !== "url" && propKey !== "secureUrl") {
|
||||
extras.push({
|
||||
[metaKey]: `${prefix}:${type}:${propKey}`,
|
||||
// @ts-expect-error untyped
|
||||
content: propValue
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (MetaTagsArrayable.has(fixKeyCase(key))) {
|
||||
extras.push(...handleObjectEntry(key, value));
|
||||
} else {
|
||||
primitives[key] = sanitizeObject(value);
|
||||
}
|
||||
} else {
|
||||
primitives[key] = value;
|
||||
}
|
||||
}
|
||||
const meta = Object.entries(primitives).map(([key, value]) => {
|
||||
if (key === "charset")
|
||||
return { charset: value === null ? "_null" : value };
|
||||
const metaKey = resolveMetaKeyType(key);
|
||||
const keyValue = resolveMetaKeyValue(key);
|
||||
const processedValue = value === null ? "_null" : typeof value === "object" ? resolvePackedMetaObjectValue(value, key) : typeof value === "number" ? value.toString() : value;
|
||||
return metaKey === "http-equiv" ? { "http-equiv": keyValue, "content": processedValue } : { [metaKey]: keyValue, content: processedValue };
|
||||
});
|
||||
return [...extras, ...meta].map(
|
||||
(m) => !("content" in m) ? m : m.content === "_null" ? { ...m, content: null } : m
|
||||
);
|
||||
}
|
||||
|
||||
export { resolveMetaKeyValue as a, resolvePackedMetaObjectValue as b, resolveMetaKeyType as r, unpackMeta as u };
|
||||
70
.output/server/node_modules/unhead/dist/shared/unhead.DZbvapt-.mjs
generated
vendored
Normal file
70
.output/server/node_modules/unhead/dist/shared/unhead.DZbvapt-.mjs
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
const sortTags = (a, b) => a._w === b._w ? a._p - b._p : a._w - b._w;
|
||||
const TAG_WEIGHTS = {
|
||||
base: -10,
|
||||
title: 10
|
||||
};
|
||||
const TAG_ALIASES = {
|
||||
critical: -8,
|
||||
high: -1,
|
||||
low: 2
|
||||
};
|
||||
const WEIGHT_MAP = {
|
||||
meta: {
|
||||
"content-security-policy": -30,
|
||||
"charset": -20,
|
||||
"viewport": -15
|
||||
},
|
||||
link: {
|
||||
"preconnect": 20,
|
||||
"stylesheet": 60,
|
||||
"preload": 70,
|
||||
"modulepreload": 70,
|
||||
"prefetch": 90,
|
||||
"dns-prefetch": 90,
|
||||
"prerender": 90
|
||||
},
|
||||
script: {
|
||||
async: 30,
|
||||
defer: 80,
|
||||
sync: 50
|
||||
},
|
||||
style: {
|
||||
imported: 40,
|
||||
sync: 60
|
||||
}
|
||||
};
|
||||
const ImportStyleRe = /@import/;
|
||||
const isTruthy = (val) => val === "" || val === true;
|
||||
function tagWeight(head, tag) {
|
||||
if (typeof tag.tagPriority === "number")
|
||||
return tag.tagPriority;
|
||||
let weight = 100;
|
||||
const offset = TAG_ALIASES[tag.tagPriority] || 0;
|
||||
const weightMap = head.resolvedOptions.disableCapoSorting ? {
|
||||
link: {},
|
||||
script: {},
|
||||
style: {}
|
||||
} : WEIGHT_MAP;
|
||||
if (tag.tag in TAG_WEIGHTS) {
|
||||
weight = TAG_WEIGHTS[tag.tag];
|
||||
} else if (tag.tag === "meta") {
|
||||
const metaType = tag.props["http-equiv"] === "content-security-policy" ? "content-security-policy" : tag.props.charset ? "charset" : tag.props.name === "viewport" ? "viewport" : null;
|
||||
if (metaType)
|
||||
weight = WEIGHT_MAP.meta[metaType];
|
||||
} else if (tag.tag === "link" && tag.props.rel) {
|
||||
weight = weightMap.link[tag.props.rel];
|
||||
} else if (tag.tag === "script") {
|
||||
if (isTruthy(tag.props.async)) {
|
||||
weight = weightMap.script.async;
|
||||
} else if (tag.props.src && !isTruthy(tag.props.defer) && !isTruthy(tag.props.async) && tag.props.type !== "module" && !tag.props.type?.endsWith("json")) {
|
||||
weight = weightMap.script.sync;
|
||||
} else if (isTruthy(tag.props.defer) && tag.props.src && !isTruthy(tag.props.async)) {
|
||||
weight = weightMap.script.defer;
|
||||
}
|
||||
} else if (tag.tag === "style") {
|
||||
weight = tag.innerHTML && ImportStyleRe.test(tag.innerHTML) ? weightMap.style.imported : weightMap.style.sync;
|
||||
}
|
||||
return (weight || 100) + offset;
|
||||
}
|
||||
|
||||
export { sortTags as s, tagWeight as t };
|
||||
155
.output/server/node_modules/unhead/dist/shared/unhead.DnNYlT4k.mjs
generated
vendored
Normal file
155
.output/server/node_modules/unhead/dist/shared/unhead.DnNYlT4k.mjs
generated
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
import { d as defineHeadPlugin } from './unhead.CApf5sj3.mjs';
|
||||
import { s as sortTags } from './unhead.DZbvapt-.mjs';
|
||||
import { p as processTemplateParams } from './unhead.kVuXtrDW.mjs';
|
||||
|
||||
const formatKey = (k) => !k.includes(":key") ? k.split(":").join(":key:") : k;
|
||||
const AliasSortingPlugin = defineHeadPlugin({
|
||||
key: "aliasSorting",
|
||||
hooks: {
|
||||
"tags:resolve": (ctx) => {
|
||||
let m = false;
|
||||
for (const t of ctx.tags) {
|
||||
const p = t.tagPriority;
|
||||
if (!p)
|
||||
continue;
|
||||
const s = String(p);
|
||||
if (s.startsWith("before:")) {
|
||||
const k = formatKey(s.slice(7));
|
||||
const l = ctx.tagMap.get(k);
|
||||
if (l) {
|
||||
if (typeof l.tagPriority === "number")
|
||||
t.tagPriority = l.tagPriority;
|
||||
t._p = l._p - 1;
|
||||
m = true;
|
||||
}
|
||||
} else if (s.startsWith("after:")) {
|
||||
const k = formatKey(s.slice(6));
|
||||
const l = ctx.tagMap.get(k);
|
||||
if (l) {
|
||||
if (typeof l.tagPriority === "number")
|
||||
t.tagPriority = l.tagPriority;
|
||||
t._p = l._p + 1;
|
||||
m = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m)
|
||||
ctx.tags = ctx.tags.sort(sortTags);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const DeprecationsPlugin = /* @__PURE__ */ defineHeadPlugin({
|
||||
key: "deprecations",
|
||||
hooks: {
|
||||
"entries:normalize": ({ tags }) => {
|
||||
for (const tag of tags) {
|
||||
if (tag.props.children) {
|
||||
tag.innerHTML = tag.props.children;
|
||||
delete tag.props.children;
|
||||
}
|
||||
if (tag.props.hid) {
|
||||
tag.key = tag.props.hid;
|
||||
delete tag.props.hid;
|
||||
}
|
||||
if (tag.props.vmid) {
|
||||
tag.key = tag.props.vmid;
|
||||
delete tag.props.vmid;
|
||||
}
|
||||
if (tag.props.body) {
|
||||
tag.tagPosition = "bodyClose";
|
||||
delete tag.props.body;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
async function walkPromises(v) {
|
||||
const type = typeof v;
|
||||
if (type === "function") {
|
||||
return v;
|
||||
}
|
||||
if (v instanceof Promise) {
|
||||
return await v;
|
||||
}
|
||||
if (Array.isArray(v)) {
|
||||
return await Promise.all(v.map((r) => walkPromises(r)));
|
||||
}
|
||||
if (v?.constructor === Object) {
|
||||
const next = {};
|
||||
for (const key of Object.keys(v)) {
|
||||
next[key] = await walkPromises(v[key]);
|
||||
}
|
||||
return next;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
const PromisesPlugin = /* @__PURE__ */ defineHeadPlugin({
|
||||
key: "promises",
|
||||
hooks: {
|
||||
"entries:resolve": async (ctx) => {
|
||||
const promises = [];
|
||||
for (const k in ctx.entries) {
|
||||
if (!ctx.entries[k]._promisesProcessed) {
|
||||
promises.push(
|
||||
walkPromises(ctx.entries[k].input).then((val) => {
|
||||
ctx.entries[k].input = val;
|
||||
ctx.entries[k]._promisesProcessed = true;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
await Promise.all(promises);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const SupportedAttrs = {
|
||||
meta: "content",
|
||||
link: "href",
|
||||
htmlAttrs: "lang"
|
||||
};
|
||||
const contentAttrs = ["innerHTML", "textContent"];
|
||||
const TemplateParamsPlugin = /* @__PURE__ */ defineHeadPlugin((head) => {
|
||||
return {
|
||||
key: "template-params",
|
||||
hooks: {
|
||||
"tags:resolve": ({ tagMap, tags }) => {
|
||||
const params = tagMap.get("templateParams")?.props || {};
|
||||
const sep = params.separator || "|";
|
||||
delete params.separator;
|
||||
params.pageTitle = processTemplateParams(
|
||||
// find templateParams
|
||||
params.pageTitle || head._title || "",
|
||||
params,
|
||||
sep
|
||||
);
|
||||
for (const tag of tags) {
|
||||
if (tag.processTemplateParams === false) {
|
||||
continue;
|
||||
}
|
||||
const v = SupportedAttrs[tag.tag];
|
||||
if (v && typeof tag.props[v] === "string") {
|
||||
tag.props[v] = processTemplateParams(tag.props[v], params, sep);
|
||||
} else if (tag.processTemplateParams || tag.tag === "titleTemplate" || tag.tag === "title") {
|
||||
for (const p of contentAttrs) {
|
||||
if (typeof tag[p] === "string")
|
||||
tag[p] = processTemplateParams(tag[p], params, sep, tag.tag === "script" && tag.props.type.endsWith("json"));
|
||||
}
|
||||
}
|
||||
}
|
||||
head._templateParams = params;
|
||||
head._separator = sep;
|
||||
},
|
||||
"tags:afterResolve": ({ tagMap }) => {
|
||||
const title = tagMap.get("title");
|
||||
if (title?.textContent && title.processTemplateParams !== false) {
|
||||
title.textContent = processTemplateParams(title.textContent, head._templateParams, head._separator);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
export { AliasSortingPlugin as A, DeprecationsPlugin as D, PromisesPlugin as P, TemplateParamsPlugin as T };
|
||||
48
.output/server/node_modules/unhead/dist/shared/unhead.kVuXtrDW.mjs
generated
vendored
Normal file
48
.output/server/node_modules/unhead/dist/shared/unhead.kVuXtrDW.mjs
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
const SepSub = "%separator";
|
||||
const SepSubRE = new RegExp(`${SepSub}(?:\\s*${SepSub})*`, "g");
|
||||
function sub(p, token, isJson = false) {
|
||||
let val;
|
||||
if (token === "s" || token === "pageTitle") {
|
||||
val = p.pageTitle;
|
||||
} else if (token.includes(".")) {
|
||||
const dotIndex = token.indexOf(".");
|
||||
val = p[token.substring(0, dotIndex)]?.[token.substring(dotIndex + 1)];
|
||||
} else {
|
||||
val = p[token];
|
||||
}
|
||||
if (val !== void 0) {
|
||||
return isJson ? (val || "").replace(/</g, "\\u003C").replace(/"/g, '\\"') : val || "";
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
function processTemplateParams(s, p, sep, isJson = false) {
|
||||
if (typeof s !== "string" || !s.includes("%"))
|
||||
return s;
|
||||
let decoded = s;
|
||||
try {
|
||||
decoded = decodeURI(s);
|
||||
} catch {
|
||||
}
|
||||
const tokens = decoded.match(/%\w+(?:\.\w+)?/g);
|
||||
if (!tokens) {
|
||||
return s;
|
||||
}
|
||||
const hasSepSub = s.includes(SepSub);
|
||||
s = s.replace(/%\w+(?:\.\w+)?/g, (token) => {
|
||||
if (token === SepSub || !tokens.includes(token)) {
|
||||
return token;
|
||||
}
|
||||
const re = sub(p, token.slice(1), isJson);
|
||||
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();
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
export { processTemplateParams as p };
|
||||
38
.output/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs
generated
vendored
Normal file
38
.output/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
const SelfClosingTags = /* @__PURE__ */ new Set(["meta", "link", "base"]);
|
||||
const DupeableTags = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]);
|
||||
const TagsWithInnerContent = /* @__PURE__ */ new Set(["title", "titleTemplate", "script", "style", "noscript"]);
|
||||
const HasElementTags = /* @__PURE__ */ new Set([
|
||||
"base",
|
||||
"meta",
|
||||
"link",
|
||||
"style",
|
||||
"script",
|
||||
"noscript"
|
||||
]);
|
||||
const ValidHeadTags = /* @__PURE__ */ new Set([
|
||||
"title",
|
||||
"base",
|
||||
"htmlAttrs",
|
||||
"bodyAttrs",
|
||||
"meta",
|
||||
"link",
|
||||
"style",
|
||||
"script",
|
||||
"noscript"
|
||||
]);
|
||||
const UniqueTags = /* @__PURE__ */ new Set(["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs", "templateParams"]);
|
||||
const TagConfigKeys = /* @__PURE__ */ new Set(["key", "tagPosition", "tagPriority", "tagDuplicateStrategy", "innerHTML", "textContent", "processTemplateParams"]);
|
||||
const ScriptNetworkEvents = /* @__PURE__ */ new Set(["onload", "onerror"]);
|
||||
const UsesMergeStrategy = /* @__PURE__ */ new Set(["templateParams", "htmlAttrs", "bodyAttrs"]);
|
||||
const MetaTagsArrayable = /* @__PURE__ */ new Set([
|
||||
"theme-color",
|
||||
"google-site-verification",
|
||||
"og",
|
||||
"article",
|
||||
"book",
|
||||
"profile",
|
||||
"twitter",
|
||||
"author"
|
||||
]);
|
||||
|
||||
export { DupeableTags as D, HasElementTags as H, MetaTagsArrayable as M, SelfClosingTags as S, TagsWithInnerContent as T, UniqueTags as U, ValidHeadTags as V, TagConfigKeys as a, ScriptNetworkEvents as b, UsesMergeStrategy as c };
|
||||
5
.output/server/node_modules/unhead/dist/utils.mjs
generated
vendored
Normal file
5
.output/server/node_modules/unhead/dist/utils.mjs
generated
vendored
Normal file
@@ -0,0 +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.BaPU1zLf.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.kVuXtrDW.mjs';
|
||||
81
.output/server/node_modules/unhead/package.json
generated
vendored
81
.output/server/node_modules/unhead/package.json
generated
vendored
@@ -1,12 +1,17 @@
|
||||
{
|
||||
"name": "unhead",
|
||||
"type": "module",
|
||||
"version": "1.11.19",
|
||||
"version": "2.0.0-rc.10",
|
||||
"description": "Full-stack <head> manager built for any framework.",
|
||||
"author": {
|
||||
"name": "Harlan Wilton",
|
||||
"email": "harlan@harlanzw.com",
|
||||
"url": "https://harlanzw.com/"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"tag": "next"
|
||||
},
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/harlan-zw",
|
||||
"homepage": "https://unhead.unjs.io",
|
||||
@@ -22,28 +27,78 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"./plugins": {
|
||||
"types": "./dist/plugins.d.ts",
|
||||
"default": "./dist/plugins.mjs"
|
||||
},
|
||||
"./server": {
|
||||
"types": "./dist/server.d.ts",
|
||||
"default": "./dist/server.mjs"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./dist/client.d.ts",
|
||||
"default": "./dist/client.mjs"
|
||||
},
|
||||
"./legacy": {
|
||||
"types": "./dist/legacy.d.ts",
|
||||
"default": "./dist/legacy.mjs"
|
||||
},
|
||||
"./utils": {
|
||||
"types": "./dist/utils.d.ts",
|
||||
"default": "./dist/utils.mjs"
|
||||
},
|
||||
"./types": {
|
||||
"types": "./dist/types.d.ts",
|
||||
"default": "./dist/types.mjs"
|
||||
},
|
||||
"./scripts": {
|
||||
"types": "./dist/scripts.d.ts",
|
||||
"default": "./dist/scripts.mjs"
|
||||
}
|
||||
},
|
||||
"main": "dist/index.cjs",
|
||||
"main": "dist/index.mjs",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"optionalPlugins": {
|
||||
"*": {
|
||||
"plugins": [
|
||||
"dist/plugins"
|
||||
],
|
||||
"server": [
|
||||
"dist/server"
|
||||
],
|
||||
"client": [
|
||||
"dist/client"
|
||||
],
|
||||
"legacy": [
|
||||
"dist/legacy"
|
||||
],
|
||||
"types": [
|
||||
"dist/types"
|
||||
],
|
||||
"utils": [
|
||||
"dist/utils"
|
||||
],
|
||||
"scripts": [
|
||||
"dist/scripts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"*.d.ts",
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"hookable": "^5.5.3",
|
||||
"@unhead/schema": "1.11.19",
|
||||
"@unhead/shared": "1.11.19",
|
||||
"@unhead/dom": "1.11.19"
|
||||
"hookable": "^5.5.3"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild .",
|
||||
"stub": "unbuild . --stub",
|
||||
"export:sizes": "npx export-size . -r"
|
||||
"build": "unbuild",
|
||||
"stub": "unbuild --stub",
|
||||
"test:attw": "attw --pack"
|
||||
},
|
||||
"__npminstall_done": true,
|
||||
"_from": "unhead@1.11.19",
|
||||
"_resolved": "https://registry.npmmirror.com/unhead/-/unhead-1.11.19.tgz"
|
||||
"_from": "unhead@2.0.0-rc.10",
|
||||
"_resolved": "https://registry.npmmirror.com/unhead/-/unhead-2.0.0-rc.10.tgz"
|
||||
}
|
||||
Reference in New Issue
Block a user