no message
This commit is contained in:
parent
2ab09f342c
commit
ed63938718
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,7 +4,7 @@
|
|||||||
.nuxt
|
.nuxt
|
||||||
.nitro
|
.nitro
|
||||||
.cache
|
.cache
|
||||||
dist
|
/dist
|
||||||
|
|
||||||
# Node dependencies
|
# Node dependencies
|
||||||
/node_modules
|
/node_modules
|
||||||
|
133
.output/server/node_modules/@unhead/dom/dist/index.mjs
generated
vendored
Normal file
133
.output/server/node_modules/@unhead/dom/dist/index.mjs
generated
vendored
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
import { HasElementTags, hashTag, normaliseProps, tagDedupeKey, defineHeadPlugin } from '@unhead/shared';
|
||||||
|
|
||||||
|
async function elementToTag($el) {
|
||||||
|
const tag = {
|
||||||
|
tag: $el.tagName.toLowerCase(),
|
||||||
|
props: await normaliseProps(
|
||||||
|
$el.getAttributeNames().reduce((props, name) => ({ ...props, [name]: $el.getAttribute(name) }), {})
|
||||||
|
),
|
||||||
|
innerHTML: $el.innerHTML
|
||||||
|
};
|
||||||
|
tag._d = tagDedupeKey(tag);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
async function renderDOMHead(head, options = {}) {
|
||||||
|
const dom = options.document || head.resolvedOptions.document;
|
||||||
|
if (!dom)
|
||||||
|
return;
|
||||||
|
const beforeRenderCtx = { shouldRender: head.dirty, tags: [] };
|
||||||
|
await head.hooks.callHook("dom:beforeRender", beforeRenderCtx);
|
||||||
|
if (!beforeRenderCtx.shouldRender)
|
||||||
|
return;
|
||||||
|
const tags = (await head.resolveTags()).map((tag) => ({
|
||||||
|
tag,
|
||||||
|
id: HasElementTags.includes(tag.tag) ? hashTag(tag) : tag.tag,
|
||||||
|
shouldRender: true
|
||||||
|
}));
|
||||||
|
let state = head._dom;
|
||||||
|
if (!state) {
|
||||||
|
state = {
|
||||||
|
elMap: { htmlAttrs: dom.documentElement, bodyAttrs: dom.body }
|
||||||
|
};
|
||||||
|
for (const key of ["body", "head"]) {
|
||||||
|
const children = dom?.[key]?.children;
|
||||||
|
for (const c of [...children].filter((c2) => HasElementTags.includes(c2.tagName.toLowerCase())))
|
||||||
|
state.elMap[c.getAttribute("data-hid") || hashTag(await elementToTag(c))] = 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) {
|
||||||
|
["textContent", "innerHTML"].forEach((k) => {
|
||||||
|
tag[k] && tag[k] !== $el[k] && ($el[k] = tag[k]);
|
||||||
|
});
|
||||||
|
track(id, "el", () => {
|
||||||
|
state.elMap[id].remove();
|
||||||
|
delete state.elMap[id];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Object.entries(tag.props).forEach(([k, value]) => {
|
||||||
|
const ck = `attr:${k}`;
|
||||||
|
if (k === "class") {
|
||||||
|
for (const c of (value || "").split(" ").filter(Boolean)) {
|
||||||
|
isAttrTag && track(id, `${ck}:${c}`, () => $el.classList.remove(c));
|
||||||
|
!$el.classList.contains(c) && $el.classList.add(c);
|
||||||
|
}
|
||||||
|
} 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
|
||||||
|
HasElementTags.includes(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);
|
||||||
|
Object.values(state.pendingSideEffects).forEach((fn) => fn());
|
||||||
|
head._dom = state;
|
||||||
|
head.dirty = false;
|
||||||
|
await head.hooks.callHook("dom:rendered", { renders: tags });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function debouncedRenderDOMHead(head, options = {}) {
|
||||||
|
const fn = options.delayFn || ((fn2) => setTimeout(fn2, 10));
|
||||||
|
return head._domUpdatePromise = head._domUpdatePromise || new Promise((resolve) => fn(async () => {
|
||||||
|
await renderDOMHead(head, options);
|
||||||
|
delete head._domUpdatePromise;
|
||||||
|
resolve();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// @__NO_SIDE_EFFECTS__
|
||||||
|
function DomPlugin(options) {
|
||||||
|
return defineHeadPlugin((head) => {
|
||||||
|
const initialPayload = head.resolvedOptions.document?.head.querySelector('script[id="unhead:payload"]')?.innerHTML || false;
|
||||||
|
initialPayload && head.push(JSON.parse(initialPayload));
|
||||||
|
return {
|
||||||
|
mode: "client",
|
||||||
|
hooks: {
|
||||||
|
"entries:updated": function(head2) {
|
||||||
|
debouncedRenderDOMHead(head2, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export { DomPlugin, debouncedRenderDOMHead, renderDOMHead };
|
640
.output/server/node_modules/@unhead/shared/dist/index.mjs
generated
vendored
Normal file
640
.output/server/node_modules/@unhead/shared/dist/index.mjs
generated
vendored
Normal file
@ -0,0 +1,640 @@
|
|||||||
|
function asArray$1(value) {
|
||||||
|
return Array.isArray(value) ? value : [value];
|
||||||
|
}
|
||||||
|
|
||||||
|
const SelfClosingTags = ["meta", "link", "base"];
|
||||||
|
const TagsWithInnerContent = ["title", "titleTemplate", "script", "style", "noscript"];
|
||||||
|
const HasElementTags = [
|
||||||
|
"base",
|
||||||
|
"meta",
|
||||||
|
"link",
|
||||||
|
"style",
|
||||||
|
"script",
|
||||||
|
"noscript"
|
||||||
|
];
|
||||||
|
const ValidHeadTags = [
|
||||||
|
"title",
|
||||||
|
"titleTemplate",
|
||||||
|
"templateParams",
|
||||||
|
"base",
|
||||||
|
"htmlAttrs",
|
||||||
|
"bodyAttrs",
|
||||||
|
"meta",
|
||||||
|
"link",
|
||||||
|
"style",
|
||||||
|
"script",
|
||||||
|
"noscript"
|
||||||
|
];
|
||||||
|
const UniqueTags = ["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs", "templateParams"];
|
||||||
|
const TagConfigKeys = ["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) {
|
||||||
|
return tag._h || hashCode(tag._d ? tag._d : `${tag.tag}:${tag.textContent || tag.innerHTML || ""}:${Object.entries(tag.props).map(([key, value]) => `${key}:${String(value)}`).join(",")}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function tagDedupeKey(tag, fn) {
|
||||||
|
const { props, tag: tagName } = tag;
|
||||||
|
if (UniqueTags.includes(tagName))
|
||||||
|
return tagName;
|
||||||
|
if (tagName === "link" && props.rel === "canonical")
|
||||||
|
return "canonical";
|
||||||
|
if (props.charset)
|
||||||
|
return "charset";
|
||||||
|
const name = ["id"];
|
||||||
|
if (tagName === "meta")
|
||||||
|
name.push(...["name", "property", "http-equiv"]);
|
||||||
|
for (const n of name) {
|
||||||
|
if (typeof props[n] !== "undefined") {
|
||||||
|
const val = String(props[n]);
|
||||||
|
if (fn && !fn(val))
|
||||||
|
return false;
|
||||||
|
return `${tagName}:${n}:${val}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveTitleTemplate(template, title) {
|
||||||
|
if (template == null)
|
||||||
|
return title || null;
|
||||||
|
if (typeof template === "function")
|
||||||
|
return template(title);
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 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 (resolved)
|
||||||
|
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 || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
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 = [
|
||||||
|
"og",
|
||||||
|
"book",
|
||||||
|
"article",
|
||||||
|
"profile"
|
||||||
|
];
|
||||||
|
function resolveMetaKeyType(key) {
|
||||||
|
const fKey = fixKeyCase(key).split(":")[0];
|
||||||
|
if (openGraphNamespaces.includes(fKey))
|
||||||
|
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 fKey = updated.split("-")[0];
|
||||||
|
if (openGraphNamespaces.includes(fKey) || fKey === "twitter")
|
||||||
|
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, value] of Object.entries(input))
|
||||||
|
output[fixKeyCase(key)] = changeKeyCasingDeep(value);
|
||||||
|
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 = ["og:image", "og:video", "og:audio", "twitter:image"];
|
||||||
|
function sanitize(input) {
|
||||||
|
const out = {};
|
||||||
|
Object.entries(input).forEach(([k2, v]) => {
|
||||||
|
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.includes(fKey)) {
|
||||||
|
const input = {};
|
||||||
|
Object.entries(value).forEach(([k2, v2]) => {
|
||||||
|
input[`${key}${k2 === "url" ? "" : `${k2.charAt(0).toUpperCase()}${k2.slice(1)}`}`] = v2;
|
||||||
|
});
|
||||||
|
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 = {};
|
||||||
|
Object.entries(input).forEach(([key, value]) => {
|
||||||
|
if (!Array.isArray(value)) {
|
||||||
|
if (typeof value === "object" && value) {
|
||||||
|
if (ObjectArrayEntries.includes(fixKeyCase(key))) {
|
||||||
|
extras.push(...handleObjectEntry(key, value));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
primitives[key] = sanitize(value);
|
||||||
|
} else {
|
||||||
|
primitives[key] = value;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
value.forEach((v) => {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
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" && ["stylesheet", "canonical", "modulepreload", "prerender", "preload", "prefetch"].includes(val))
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function normaliseTag(tagName, input, e) {
|
||||||
|
const tag = {
|
||||||
|
tag: tagName,
|
||||||
|
props: await normaliseProps(
|
||||||
|
// explicitly check for an object
|
||||||
|
// @ts-expect-error untyped
|
||||||
|
typeof input === "object" && typeof input !== "function" && !(input instanceof Promise) ? { ...input } : { [["script", "noscript", "style"].includes(tagName) ? "innerHTML" : "textContent"]: input },
|
||||||
|
["templateParams", "titleTemplate"].includes(tagName)
|
||||||
|
)
|
||||||
|
};
|
||||||
|
TagConfigKeys.forEach((k) => {
|
||||||
|
const val = typeof tag.props[k] !== "undefined" ? tag.props[k] : e[k];
|
||||||
|
if (typeof val !== "undefined") {
|
||||||
|
if (!["innerHTML", "textContent", "children"].includes(k) || TagsWithInnerContent.includes(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 normaliseClassProp(v) {
|
||||||
|
if (typeof v === "object" && !Array.isArray(v)) {
|
||||||
|
v = Object.keys(v).filter((k) => v[k]);
|
||||||
|
}
|
||||||
|
return (Array.isArray(v) ? v.join(" ") : v).split(" ").filter((c) => c.trim()).filter(Boolean).join(" ");
|
||||||
|
}
|
||||||
|
async function normaliseProps(props, virtual) {
|
||||||
|
for (const k of Object.keys(props)) {
|
||||||
|
if (k === "class") {
|
||||||
|
props[k] = normaliseClassProp(props[k]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (props[k] instanceof Promise)
|
||||||
|
props[k] = await props[k];
|
||||||
|
if (!virtual && !TagConfigKeys.includes(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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
const TagEntityBits = 10;
|
||||||
|
async function normaliseEntryTags(e) {
|
||||||
|
const tagPromises = [];
|
||||||
|
Object.entries(e.resolvedInput).filter(([k, v]) => typeof v !== "undefined" && ValidHeadTags.includes(k)).forEach(([k, value]) => {
|
||||||
|
const v = asArray$1(value);
|
||||||
|
tagPromises.push(...v.map((props) => normaliseTag(k, props, e)).flat());
|
||||||
|
});
|
||||||
|
return (await Promise.all(tagPromises)).flat().filter(Boolean).map((t, i) => {
|
||||||
|
t._e = e._i;
|
||||||
|
e.mode && (t._m = e.mode);
|
||||||
|
t._p = (e._i << TagEntityBits) + i;
|
||||||
|
return t;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
let weight = 100;
|
||||||
|
const priority = tag.tagPriority;
|
||||||
|
if (typeof priority === "number")
|
||||||
|
return priority;
|
||||||
|
if (tag.tag === "meta") {
|
||||||
|
if (tag.props["http-equiv"] === "content-security-policy")
|
||||||
|
weight = -30;
|
||||||
|
if (tag.props.charset)
|
||||||
|
weight = -20;
|
||||||
|
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 (typeof priority === "string" && priority in TAG_ALIASES) {
|
||||||
|
return weight + TAG_ALIASES[priority];
|
||||||
|
}
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
const SortModifiers = [{ prefix: "before:", offset: -1 }, { prefix: "after:", offset: 1 }];
|
||||||
|
|
||||||
|
const NetworkEvents = ["onload", "onerror", "onabort", "onprogress", "onloadstart"];
|
||||||
|
|
||||||
|
const sepSub = "%separator";
|
||||||
|
function processTemplateParams(s, p, sep) {
|
||||||
|
if (typeof s !== "string" || !s.includes("%"))
|
||||||
|
return s;
|
||||||
|
function sub(token) {
|
||||||
|
let val;
|
||||||
|
if (["s", "pageTitle"].includes(token)) {
|
||||||
|
val = p.pageTitle;
|
||||||
|
} else if (token.includes(".")) {
|
||||||
|
val = token.split(".").reduce((acc, key) => acc ? acc[key] || void 0 : void 0, p);
|
||||||
|
} else {
|
||||||
|
val = p[token];
|
||||||
|
}
|
||||||
|
return typeof val !== "undefined" ? (val || "").replace(/"/g, '\\"') : false;
|
||||||
|
}
|
||||||
|
let decoded = s;
|
||||||
|
try {
|
||||||
|
decoded = decodeURI(s);
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
const tokens = (decoded.match(/%(\w+\.+\w+)|%(\w+)/g) || []).sort().reverse();
|
||||||
|
tokens.forEach((token) => {
|
||||||
|
const re = sub(token.slice(1));
|
||||||
|
if (typeof re === "string") {
|
||||||
|
s = s.replace(new RegExp(`\\${token}(\\W|$)`, "g"), (_, args) => `${re}${args}`).trim();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (s.includes(sepSub)) {
|
||||||
|
if (s.endsWith(sepSub))
|
||||||
|
s = s.slice(0, -sepSub.length).trim();
|
||||||
|
if (s.startsWith(sepSub))
|
||||||
|
s = s.slice(sepSub.length).trim();
|
||||||
|
s = s.replace(new RegExp(`\\${sepSub}\\s*\\${sepSub}`, "g"), sepSub);
|
||||||
|
s = processTemplateParams(s, { separator: sep }, sep);
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { HasElementTags, IsBrowser, NetworkEvents, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray$1 as asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseClassProp, normaliseEntryTags, normaliseProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, unpackMeta, whitelistSafeInput };
|
84
.output/server/node_modules/@unhead/ssr/dist/index.mjs
generated
vendored
Normal file
84
.output/server/node_modules/@unhead/ssr/dist/index.mjs
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import { TagsWithInnerContent, SelfClosingTags } from '@unhead/shared';
|
||||||
|
|
||||||
|
function encodeAttribute(value) {
|
||||||
|
return String(value).replace(/"/g, """);
|
||||||
|
}
|
||||||
|
function propsToString(props) {
|
||||||
|
const attrs = [];
|
||||||
|
for (const [key, value] of Object.entries(props)) {
|
||||||
|
if (value !== false && value !== null)
|
||||||
|
attrs.push(value === true ? key : `${key}="${encodeAttribute(value)}"`);
|
||||||
|
}
|
||||||
|
return `${attrs.length > 0 ? " " : ""}${attrs.join(" ")}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
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.includes(tag.tag))
|
||||||
|
return SelfClosingTags.includes(tag.tag) ? openTag : `${openTag}</${tag.tag}>`;
|
||||||
|
let content = String(tag.innerHTML || "");
|
||||||
|
if (tag.textContent)
|
||||||
|
content = escapeHtml(String(tag.textContent));
|
||||||
|
return SelfClosingTags.includes(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ssrRenderTags(tags) {
|
||||||
|
const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: [], bodyClose: [], bodyOpen: [] } };
|
||||||
|
for (const tag of tags) {
|
||||||
|
if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
|
||||||
|
schema[tag.tag] = { ...schema[tag.tag], ...tag.props };
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
schema.tags[tag.tagPosition || "head"].push(tagToString(tag));
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
headTags: schema.tags.head.join("\n"),
|
||||||
|
bodyTags: schema.tags.bodyClose.join("\n"),
|
||||||
|
bodyTagsOpen: schema.tags.bodyOpen.join("\n"),
|
||||||
|
htmlAttrs: propsToString(schema.htmlAttrs),
|
||||||
|
bodyAttrs: propsToString(schema.bodyAttrs)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function renderSSRHead(head) {
|
||||||
|
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);
|
||||||
|
const renderCtx = { tags: ctx.tags, html };
|
||||||
|
await head.hooks.callHook("ssr:rendered", renderCtx);
|
||||||
|
return renderCtx.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { escapeHtml, propsToString, renderSSRHead, ssrRenderTags, tagToString };
|
5505
.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js
generated
vendored
Normal file
5505
.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5374
.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js
generated
vendored
Normal file
5374
.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3047
.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
generated
vendored
Normal file
3047
.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2978
.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js
generated
vendored
Normal file
2978
.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1359
.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js
generated
vendored
Normal file
1359
.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1265
.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.js
generated
vendored
Normal file
1265
.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1186
.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js
generated
vendored
Normal file
1186
.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7901
.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js
generated
vendored
Normal file
7901
.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6233
.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js
generated
vendored
Normal file
6233
.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1503
.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.js
generated
vendored
Normal file
1503
.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1406
.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js
generated
vendored
Normal file
1406
.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1086
.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js
generated
vendored
Normal file
1086
.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
826
.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js
generated
vendored
Normal file
826
.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js
generated
vendored
Normal file
@ -0,0 +1,826 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
var Vue = require('vue');
|
||||||
|
var shared = require('@vue/shared');
|
||||||
|
var compilerSsr = require('@vue/compiler-ssr');
|
||||||
|
|
||||||
|
function _interopNamespaceDefault(e) {
|
||||||
|
var n = Object.create(null);
|
||||||
|
if (e) {
|
||||||
|
for (var k in e) {
|
||||||
|
n[k] = e[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n.default = e;
|
||||||
|
return Object.freeze(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
var Vue__namespace = /*#__PURE__*/_interopNamespaceDefault(Vue);
|
||||||
|
|
||||||
|
const shouldIgnoreProp = shared.makeMap(
|
||||||
|
`,key,ref,innerHTML,textContent,ref_key,ref_for`
|
||||||
|
);
|
||||||
|
function ssrRenderAttrs(props, tag) {
|
||||||
|
let ret = "";
|
||||||
|
for (const key in props) {
|
||||||
|
if (shouldIgnoreProp(key) || shared.isOn(key) || tag === "textarea" && key === "value") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const value = props[key];
|
||||||
|
if (key === "class") {
|
||||||
|
ret += ` class="${ssrRenderClass(value)}"`;
|
||||||
|
} else if (key === "style") {
|
||||||
|
ret += ` style="${ssrRenderStyle(value)}"`;
|
||||||
|
} else {
|
||||||
|
ret += ssrRenderDynamicAttr(key, value, tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
function ssrRenderDynamicAttr(key, value, tag) {
|
||||||
|
if (!isRenderableValue(value)) {
|
||||||
|
return ``;
|
||||||
|
}
|
||||||
|
const attrKey = tag && (tag.indexOf("-") > 0 || shared.isSVGTag(tag)) ? key : shared.propsToAttrMap[key] || key.toLowerCase();
|
||||||
|
if (shared.isBooleanAttr(attrKey)) {
|
||||||
|
return shared.includeBooleanAttr(value) ? ` ${attrKey}` : ``;
|
||||||
|
} else if (shared.isSSRSafeAttrName(attrKey)) {
|
||||||
|
return value === "" ? ` ${attrKey}` : ` ${attrKey}="${shared.escapeHtml(value)}"`;
|
||||||
|
} else {
|
||||||
|
console.warn(
|
||||||
|
`[@vue/server-renderer] Skipped rendering unsafe attribute name: ${attrKey}`
|
||||||
|
);
|
||||||
|
return ``;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function ssrRenderAttr(key, value) {
|
||||||
|
if (!isRenderableValue(value)) {
|
||||||
|
return ``;
|
||||||
|
}
|
||||||
|
return ` ${key}="${shared.escapeHtml(value)}"`;
|
||||||
|
}
|
||||||
|
function isRenderableValue(value) {
|
||||||
|
if (value == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const type = typeof value;
|
||||||
|
return type === "string" || type === "number" || type === "boolean";
|
||||||
|
}
|
||||||
|
function ssrRenderClass(raw) {
|
||||||
|
return shared.escapeHtml(shared.normalizeClass(raw));
|
||||||
|
}
|
||||||
|
function ssrRenderStyle(raw) {
|
||||||
|
if (!raw) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (shared.isString(raw)) {
|
||||||
|
return shared.escapeHtml(raw);
|
||||||
|
}
|
||||||
|
const styles = shared.normalizeStyle(raw);
|
||||||
|
return shared.escapeHtml(shared.stringifyStyle(styles));
|
||||||
|
}
|
||||||
|
|
||||||
|
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
|
||||||
|
return renderComponentVNode(
|
||||||
|
Vue.createVNode(comp, props, children),
|
||||||
|
parentComponent,
|
||||||
|
slotScopeId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
||||||
|
push(`<!--[-->`);
|
||||||
|
ssrRenderSlotInner(
|
||||||
|
slots,
|
||||||
|
slotName,
|
||||||
|
slotProps,
|
||||||
|
fallbackRenderFn,
|
||||||
|
push,
|
||||||
|
parentComponent,
|
||||||
|
slotScopeId
|
||||||
|
);
|
||||||
|
push(`<!--]-->`);
|
||||||
|
}
|
||||||
|
function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId, transition) {
|
||||||
|
const slotFn = slots[slotName];
|
||||||
|
if (slotFn) {
|
||||||
|
const slotBuffer = [];
|
||||||
|
const bufferedPush = (item) => {
|
||||||
|
slotBuffer.push(item);
|
||||||
|
};
|
||||||
|
const ret = slotFn(
|
||||||
|
slotProps,
|
||||||
|
bufferedPush,
|
||||||
|
parentComponent,
|
||||||
|
slotScopeId ? " " + slotScopeId : ""
|
||||||
|
);
|
||||||
|
if (shared.isArray(ret)) {
|
||||||
|
renderVNodeChildren(push, ret, parentComponent, slotScopeId);
|
||||||
|
} else {
|
||||||
|
let isEmptySlot = true;
|
||||||
|
if (transition) {
|
||||||
|
isEmptySlot = false;
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < slotBuffer.length; i++) {
|
||||||
|
if (!isComment(slotBuffer[i])) {
|
||||||
|
isEmptySlot = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isEmptySlot) {
|
||||||
|
if (fallbackRenderFn) {
|
||||||
|
fallbackRenderFn();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < slotBuffer.length; i++) {
|
||||||
|
push(slotBuffer[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (fallbackRenderFn) {
|
||||||
|
fallbackRenderFn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const commentTestRE = /^<!--.*-->$/s;
|
||||||
|
const commentRE = /<!--[^]*?-->/gm;
|
||||||
|
function isComment(item) {
|
||||||
|
if (typeof item !== "string" || !commentTestRE.test(item))
|
||||||
|
return false;
|
||||||
|
if (item.length <= 8)
|
||||||
|
return true;
|
||||||
|
return !item.replace(commentRE, "").trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
||||||
|
parentPush("<!--teleport start-->");
|
||||||
|
const context = parentComponent.appContext.provides[Vue.ssrContextKey];
|
||||||
|
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
||||||
|
const targetBuffer = teleportBuffers[target] || (teleportBuffers[target] = []);
|
||||||
|
const bufferIndex = targetBuffer.length;
|
||||||
|
let teleportContent;
|
||||||
|
if (disabled) {
|
||||||
|
contentRenderFn(parentPush);
|
||||||
|
teleportContent = `<!--teleport anchor-->`;
|
||||||
|
} else {
|
||||||
|
const { getBuffer, push } = createBuffer();
|
||||||
|
contentRenderFn(push);
|
||||||
|
push(`<!--teleport anchor-->`);
|
||||||
|
teleportContent = getBuffer();
|
||||||
|
}
|
||||||
|
targetBuffer.splice(bufferIndex, 0, teleportContent);
|
||||||
|
parentPush("<!--teleport end-->");
|
||||||
|
}
|
||||||
|
|
||||||
|
function ssrInterpolate(value) {
|
||||||
|
return shared.escapeHtml(shared.toDisplayString(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
function ssrRenderList(source, renderItem) {
|
||||||
|
if (shared.isArray(source) || shared.isString(source)) {
|
||||||
|
for (let i = 0, l = source.length; i < l; i++) {
|
||||||
|
renderItem(source[i], i);
|
||||||
|
}
|
||||||
|
} else if (typeof source === "number") {
|
||||||
|
for (let i = 0; i < source; i++) {
|
||||||
|
renderItem(i + 1, i);
|
||||||
|
}
|
||||||
|
} else if (shared.isObject(source)) {
|
||||||
|
if (source[Symbol.iterator]) {
|
||||||
|
const arr = Array.from(source);
|
||||||
|
for (let i = 0, l = arr.length; i < l; i++) {
|
||||||
|
renderItem(arr[i], i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const keys = Object.keys(source);
|
||||||
|
for (let i = 0, l = keys.length; i < l; i++) {
|
||||||
|
const key = keys[i];
|
||||||
|
renderItem(source[key], key, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function ssrRenderSuspense(push, { default: renderContent }) {
|
||||||
|
if (renderContent) {
|
||||||
|
renderContent();
|
||||||
|
} else {
|
||||||
|
push(`<!---->`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
||||||
|
if (typeof dir !== "function" && dir.getSSRProps) {
|
||||||
|
return dir.getSSRProps(
|
||||||
|
{
|
||||||
|
dir,
|
||||||
|
instance,
|
||||||
|
value,
|
||||||
|
oldValue: void 0,
|
||||||
|
arg,
|
||||||
|
modifiers
|
||||||
|
},
|
||||||
|
null
|
||||||
|
) || {};
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const ssrLooseEqual = shared.looseEqual;
|
||||||
|
function ssrLooseContain(arr, value) {
|
||||||
|
return shared.looseIndexOf(arr, value) > -1;
|
||||||
|
}
|
||||||
|
function ssrRenderDynamicModel(type, model, value) {
|
||||||
|
switch (type) {
|
||||||
|
case "radio":
|
||||||
|
return shared.looseEqual(model, value) ? " checked" : "";
|
||||||
|
case "checkbox":
|
||||||
|
return (shared.isArray(model) ? ssrLooseContain(model, value) : model) ? " checked" : "";
|
||||||
|
default:
|
||||||
|
return ssrRenderAttr("value", model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function ssrGetDynamicModelProps(existingProps = {}, model) {
|
||||||
|
const { type, value } = existingProps;
|
||||||
|
switch (type) {
|
||||||
|
case "radio":
|
||||||
|
return shared.looseEqual(model, value) ? { checked: true } : null;
|
||||||
|
case "checkbox":
|
||||||
|
return (shared.isArray(model) ? ssrLooseContain(model, value) : model) ? { checked: true } : null;
|
||||||
|
default:
|
||||||
|
return { value: model };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var helpers = /*#__PURE__*/Object.freeze({
|
||||||
|
__proto__: null,
|
||||||
|
ssrGetDirectiveProps: ssrGetDirectiveProps,
|
||||||
|
ssrGetDynamicModelProps: ssrGetDynamicModelProps,
|
||||||
|
ssrIncludeBooleanAttr: shared.includeBooleanAttr,
|
||||||
|
ssrInterpolate: ssrInterpolate,
|
||||||
|
ssrLooseContain: ssrLooseContain,
|
||||||
|
ssrLooseEqual: ssrLooseEqual,
|
||||||
|
ssrRenderAttr: ssrRenderAttr,
|
||||||
|
ssrRenderAttrs: ssrRenderAttrs,
|
||||||
|
ssrRenderClass: ssrRenderClass,
|
||||||
|
ssrRenderComponent: ssrRenderComponent,
|
||||||
|
ssrRenderDynamicAttr: ssrRenderDynamicAttr,
|
||||||
|
ssrRenderDynamicModel: ssrRenderDynamicModel,
|
||||||
|
ssrRenderList: ssrRenderList,
|
||||||
|
ssrRenderSlot: ssrRenderSlot,
|
||||||
|
ssrRenderSlotInner: ssrRenderSlotInner,
|
||||||
|
ssrRenderStyle: ssrRenderStyle,
|
||||||
|
ssrRenderSuspense: ssrRenderSuspense,
|
||||||
|
ssrRenderTeleport: ssrRenderTeleport,
|
||||||
|
ssrRenderVNode: renderVNode
|
||||||
|
});
|
||||||
|
|
||||||
|
const compileCache = /* @__PURE__ */ Object.create(null);
|
||||||
|
function ssrCompile(template, instance) {
|
||||||
|
const Component = instance.type;
|
||||||
|
const { isCustomElement, compilerOptions } = instance.appContext.config;
|
||||||
|
const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
||||||
|
const finalCompilerOptions = shared.extend(
|
||||||
|
shared.extend(
|
||||||
|
{
|
||||||
|
isCustomElement,
|
||||||
|
delimiters
|
||||||
|
},
|
||||||
|
compilerOptions
|
||||||
|
),
|
||||||
|
componentCompilerOptions
|
||||||
|
);
|
||||||
|
finalCompilerOptions.isCustomElement = finalCompilerOptions.isCustomElement || shared.NO;
|
||||||
|
finalCompilerOptions.isNativeTag = finalCompilerOptions.isNativeTag || shared.NO;
|
||||||
|
const cacheKey = JSON.stringify(
|
||||||
|
{
|
||||||
|
template,
|
||||||
|
compilerOptions: finalCompilerOptions
|
||||||
|
},
|
||||||
|
(key, value) => {
|
||||||
|
return shared.isFunction(value) ? value.toString() : value;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const cached = compileCache[cacheKey];
|
||||||
|
if (cached) {
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
finalCompilerOptions.onError = (err) => {
|
||||||
|
{
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const { code } = compilerSsr.compile(template, finalCompilerOptions);
|
||||||
|
const requireMap = {
|
||||||
|
vue: Vue__namespace,
|
||||||
|
"vue/server-renderer": helpers
|
||||||
|
};
|
||||||
|
const fakeRequire = (id) => requireMap[id];
|
||||||
|
return compileCache[cacheKey] = Function("require", code)(fakeRequire);
|
||||||
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
createComponentInstance,
|
||||||
|
setCurrentRenderingInstance,
|
||||||
|
setupComponent,
|
||||||
|
renderComponentRoot,
|
||||||
|
normalizeVNode
|
||||||
|
} = Vue.ssrUtils;
|
||||||
|
function createBuffer() {
|
||||||
|
let appendable = false;
|
||||||
|
const buffer = [];
|
||||||
|
return {
|
||||||
|
getBuffer() {
|
||||||
|
return buffer;
|
||||||
|
},
|
||||||
|
push(item) {
|
||||||
|
const isStringItem = shared.isString(item);
|
||||||
|
if (appendable && isStringItem) {
|
||||||
|
buffer[buffer.length - 1] += item;
|
||||||
|
} else {
|
||||||
|
buffer.push(item);
|
||||||
|
}
|
||||||
|
appendable = isStringItem;
|
||||||
|
if (shared.isPromise(item) || shared.isArray(item) && item.hasAsync) {
|
||||||
|
buffer.hasAsync = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
||||||
|
const instance = createComponentInstance(vnode, parentComponent, null);
|
||||||
|
const res = setupComponent(
|
||||||
|
instance,
|
||||||
|
true
|
||||||
|
/* isSSR */
|
||||||
|
);
|
||||||
|
const hasAsyncSetup = shared.isPromise(res);
|
||||||
|
const prefetches = instance.sp;
|
||||||
|
if (hasAsyncSetup || prefetches) {
|
||||||
|
let p = hasAsyncSetup ? res : Promise.resolve();
|
||||||
|
if (prefetches) {
|
||||||
|
p = p.then(
|
||||||
|
() => Promise.all(prefetches.map((prefetch) => prefetch.call(instance.proxy)))
|
||||||
|
).catch(() => {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return p.then(() => renderComponentSubTree(instance, slotScopeId));
|
||||||
|
} else {
|
||||||
|
return renderComponentSubTree(instance, slotScopeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function renderComponentSubTree(instance, slotScopeId) {
|
||||||
|
const comp = instance.type;
|
||||||
|
const { getBuffer, push } = createBuffer();
|
||||||
|
if (shared.isFunction(comp)) {
|
||||||
|
let root = renderComponentRoot(instance);
|
||||||
|
if (!comp.props) {
|
||||||
|
for (const key in instance.attrs) {
|
||||||
|
if (key.startsWith(`data-v-`)) {
|
||||||
|
(root.props || (root.props = {}))[key] = ``;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
renderVNode(push, instance.subTree = root, instance, slotScopeId);
|
||||||
|
} else {
|
||||||
|
if ((!instance.render || instance.render === shared.NOOP) && !instance.ssrRender && !comp.ssrRender && shared.isString(comp.template)) {
|
||||||
|
comp.ssrRender = ssrCompile(comp.template, instance);
|
||||||
|
}
|
||||||
|
for (const e of instance.scope.effects) {
|
||||||
|
if (e.computed)
|
||||||
|
e.computed._cacheable = true;
|
||||||
|
}
|
||||||
|
const ssrRender = instance.ssrRender || comp.ssrRender;
|
||||||
|
if (ssrRender) {
|
||||||
|
let attrs = instance.inheritAttrs !== false ? instance.attrs : void 0;
|
||||||
|
let hasCloned = false;
|
||||||
|
let cur = instance;
|
||||||
|
while (true) {
|
||||||
|
const scopeId = cur.vnode.scopeId;
|
||||||
|
if (scopeId) {
|
||||||
|
if (!hasCloned) {
|
||||||
|
attrs = { ...attrs };
|
||||||
|
hasCloned = true;
|
||||||
|
}
|
||||||
|
attrs[scopeId] = "";
|
||||||
|
}
|
||||||
|
const parent = cur.parent;
|
||||||
|
if (parent && parent.subTree && parent.subTree === cur.vnode) {
|
||||||
|
cur = parent;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (slotScopeId) {
|
||||||
|
if (!hasCloned)
|
||||||
|
attrs = { ...attrs };
|
||||||
|
attrs[slotScopeId.trim()] = "";
|
||||||
|
}
|
||||||
|
const prev = setCurrentRenderingInstance(instance);
|
||||||
|
try {
|
||||||
|
ssrRender(
|
||||||
|
instance.proxy,
|
||||||
|
push,
|
||||||
|
instance,
|
||||||
|
attrs,
|
||||||
|
// compiler-optimized bindings
|
||||||
|
instance.props,
|
||||||
|
instance.setupState,
|
||||||
|
instance.data,
|
||||||
|
instance.ctx
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
setCurrentRenderingInstance(prev);
|
||||||
|
}
|
||||||
|
} else if (instance.render && instance.render !== shared.NOOP) {
|
||||||
|
renderVNode(
|
||||||
|
push,
|
||||||
|
instance.subTree = renderComponentRoot(instance),
|
||||||
|
instance,
|
||||||
|
slotScopeId
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
const componentName = comp.name || comp.__file || `<Anonymous>`;
|
||||||
|
Vue.warn(`Component ${componentName} is missing template or render function.`);
|
||||||
|
push(`<!---->`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getBuffer();
|
||||||
|
}
|
||||||
|
function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
||||||
|
const { type, shapeFlag, children } = vnode;
|
||||||
|
switch (type) {
|
||||||
|
case Vue.Text:
|
||||||
|
push(shared.escapeHtml(children));
|
||||||
|
break;
|
||||||
|
case Vue.Comment:
|
||||||
|
push(
|
||||||
|
children ? `<!--${shared.escapeHtmlComment(children)}-->` : `<!---->`
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case Vue.Static:
|
||||||
|
push(children);
|
||||||
|
break;
|
||||||
|
case Vue.Fragment:
|
||||||
|
if (vnode.slotScopeIds) {
|
||||||
|
slotScopeId = (slotScopeId ? slotScopeId + " " : "") + vnode.slotScopeIds.join(" ");
|
||||||
|
}
|
||||||
|
push(`<!--[-->`);
|
||||||
|
renderVNodeChildren(
|
||||||
|
push,
|
||||||
|
children,
|
||||||
|
parentComponent,
|
||||||
|
slotScopeId
|
||||||
|
);
|
||||||
|
push(`<!--]-->`);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (shapeFlag & 1) {
|
||||||
|
renderElementVNode(push, vnode, parentComponent, slotScopeId);
|
||||||
|
} else if (shapeFlag & 6) {
|
||||||
|
push(renderComponentVNode(vnode, parentComponent, slotScopeId));
|
||||||
|
} else if (shapeFlag & 64) {
|
||||||
|
renderTeleportVNode(push, vnode, parentComponent, slotScopeId);
|
||||||
|
} else if (shapeFlag & 128) {
|
||||||
|
renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
|
||||||
|
} else {
|
||||||
|
Vue.warn(
|
||||||
|
"[@vue/server-renderer] Invalid VNode type:",
|
||||||
|
type,
|
||||||
|
`(${typeof type})`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
|
||||||
|
for (let i = 0; i < children.length; i++) {
|
||||||
|
renderVNode(push, normalizeVNode(children[i]), parentComponent, slotScopeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
|
||||||
|
const tag = vnode.type;
|
||||||
|
let { props, children, shapeFlag, scopeId, dirs } = vnode;
|
||||||
|
let openTag = `<${tag}`;
|
||||||
|
if (dirs) {
|
||||||
|
props = applySSRDirectives(vnode, props, dirs);
|
||||||
|
}
|
||||||
|
if (props) {
|
||||||
|
openTag += ssrRenderAttrs(props, tag);
|
||||||
|
}
|
||||||
|
if (scopeId) {
|
||||||
|
openTag += ` ${scopeId}`;
|
||||||
|
}
|
||||||
|
let curParent = parentComponent;
|
||||||
|
let curVnode = vnode;
|
||||||
|
while (curParent && curVnode === curParent.subTree) {
|
||||||
|
curVnode = curParent.vnode;
|
||||||
|
if (curVnode.scopeId) {
|
||||||
|
openTag += ` ${curVnode.scopeId}`;
|
||||||
|
}
|
||||||
|
curParent = curParent.parent;
|
||||||
|
}
|
||||||
|
if (slotScopeId) {
|
||||||
|
openTag += ` ${slotScopeId}`;
|
||||||
|
}
|
||||||
|
push(openTag + `>`);
|
||||||
|
if (!shared.isVoidTag(tag)) {
|
||||||
|
let hasChildrenOverride = false;
|
||||||
|
if (props) {
|
||||||
|
if (props.innerHTML) {
|
||||||
|
hasChildrenOverride = true;
|
||||||
|
push(props.innerHTML);
|
||||||
|
} else if (props.textContent) {
|
||||||
|
hasChildrenOverride = true;
|
||||||
|
push(shared.escapeHtml(props.textContent));
|
||||||
|
} else if (tag === "textarea" && props.value) {
|
||||||
|
hasChildrenOverride = true;
|
||||||
|
push(shared.escapeHtml(props.value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hasChildrenOverride) {
|
||||||
|
if (shapeFlag & 8) {
|
||||||
|
push(shared.escapeHtml(children));
|
||||||
|
} else if (shapeFlag & 16) {
|
||||||
|
renderVNodeChildren(
|
||||||
|
push,
|
||||||
|
children,
|
||||||
|
parentComponent,
|
||||||
|
slotScopeId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
push(`</${tag}>`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function applySSRDirectives(vnode, rawProps, dirs) {
|
||||||
|
const toMerge = [];
|
||||||
|
for (let i = 0; i < dirs.length; i++) {
|
||||||
|
const binding = dirs[i];
|
||||||
|
const {
|
||||||
|
dir: { getSSRProps }
|
||||||
|
} = binding;
|
||||||
|
if (getSSRProps) {
|
||||||
|
const props = getSSRProps(binding, vnode);
|
||||||
|
if (props)
|
||||||
|
toMerge.push(props);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Vue.mergeProps(rawProps || {}, ...toMerge);
|
||||||
|
}
|
||||||
|
function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
||||||
|
const target = vnode.props && vnode.props.to;
|
||||||
|
const disabled = vnode.props && vnode.props.disabled;
|
||||||
|
if (!target) {
|
||||||
|
if (!disabled) {
|
||||||
|
Vue.warn(`[@vue/server-renderer] Teleport is missing target prop.`);
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (!shared.isString(target)) {
|
||||||
|
Vue.warn(
|
||||||
|
`[@vue/server-renderer] Teleport target must be a query selector string.`
|
||||||
|
);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
ssrRenderTeleport(
|
||||||
|
push,
|
||||||
|
(push2) => {
|
||||||
|
renderVNodeChildren(
|
||||||
|
push2,
|
||||||
|
vnode.children,
|
||||||
|
parentComponent,
|
||||||
|
slotScopeId
|
||||||
|
);
|
||||||
|
},
|
||||||
|
target,
|
||||||
|
disabled || disabled === "",
|
||||||
|
parentComponent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { isVNode: isVNode$1 } = Vue.ssrUtils;
|
||||||
|
async function unrollBuffer$1(buffer) {
|
||||||
|
if (buffer.hasAsync) {
|
||||||
|
let ret = "";
|
||||||
|
for (let i = 0; i < buffer.length; i++) {
|
||||||
|
let item = buffer[i];
|
||||||
|
if (shared.isPromise(item)) {
|
||||||
|
item = await item;
|
||||||
|
}
|
||||||
|
if (shared.isString(item)) {
|
||||||
|
ret += item;
|
||||||
|
} else {
|
||||||
|
ret += await unrollBuffer$1(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
} else {
|
||||||
|
return unrollBufferSync$1(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function unrollBufferSync$1(buffer) {
|
||||||
|
let ret = "";
|
||||||
|
for (let i = 0; i < buffer.length; i++) {
|
||||||
|
let item = buffer[i];
|
||||||
|
if (shared.isString(item)) {
|
||||||
|
ret += item;
|
||||||
|
} else {
|
||||||
|
ret += unrollBufferSync$1(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
async function renderToString(input, context = {}) {
|
||||||
|
if (isVNode$1(input)) {
|
||||||
|
return renderToString(Vue.createApp({ render: () => input }), context);
|
||||||
|
}
|
||||||
|
const vnode = Vue.createVNode(input._component, input._props);
|
||||||
|
vnode.appContext = input._context;
|
||||||
|
input.provide(Vue.ssrContextKey, context);
|
||||||
|
const buffer = await renderComponentVNode(vnode);
|
||||||
|
const result = await unrollBuffer$1(buffer);
|
||||||
|
await resolveTeleports(context);
|
||||||
|
if (context.__watcherHandles) {
|
||||||
|
for (const unwatch of context.__watcherHandles) {
|
||||||
|
unwatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
async function resolveTeleports(context) {
|
||||||
|
if (context.__teleportBuffers) {
|
||||||
|
context.teleports = context.teleports || {};
|
||||||
|
for (const key in context.__teleportBuffers) {
|
||||||
|
context.teleports[key] = await unrollBuffer$1(
|
||||||
|
await Promise.all([context.__teleportBuffers[key]])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const { isVNode } = Vue.ssrUtils;
|
||||||
|
async function unrollBuffer(buffer, stream) {
|
||||||
|
if (buffer.hasAsync) {
|
||||||
|
for (let i = 0; i < buffer.length; i++) {
|
||||||
|
let item = buffer[i];
|
||||||
|
if (shared.isPromise(item)) {
|
||||||
|
item = await item;
|
||||||
|
}
|
||||||
|
if (shared.isString(item)) {
|
||||||
|
stream.push(item);
|
||||||
|
} else {
|
||||||
|
await unrollBuffer(item, stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unrollBufferSync(buffer, stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function unrollBufferSync(buffer, stream) {
|
||||||
|
for (let i = 0; i < buffer.length; i++) {
|
||||||
|
let item = buffer[i];
|
||||||
|
if (shared.isString(item)) {
|
||||||
|
stream.push(item);
|
||||||
|
} else {
|
||||||
|
unrollBufferSync(item, stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function renderToSimpleStream(input, context, stream) {
|
||||||
|
if (isVNode(input)) {
|
||||||
|
return renderToSimpleStream(
|
||||||
|
Vue.createApp({ render: () => input }),
|
||||||
|
context,
|
||||||
|
stream
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const vnode = Vue.createVNode(input._component, input._props);
|
||||||
|
vnode.appContext = input._context;
|
||||||
|
input.provide(Vue.ssrContextKey, context);
|
||||||
|
Promise.resolve(renderComponentVNode(vnode)).then((buffer) => unrollBuffer(buffer, stream)).then(() => resolveTeleports(context)).then(() => {
|
||||||
|
if (context.__watcherHandles) {
|
||||||
|
for (const unwatch of context.__watcherHandles) {
|
||||||
|
unwatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).then(() => stream.push(null)).catch((error) => {
|
||||||
|
stream.destroy(error);
|
||||||
|
});
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
function renderToStream(input, context = {}) {
|
||||||
|
console.warn(
|
||||||
|
`[@vue/server-renderer] renderToStream is deprecated - use renderToNodeStream instead.`
|
||||||
|
);
|
||||||
|
return renderToNodeStream(input, context);
|
||||||
|
}
|
||||||
|
function renderToNodeStream(input, context = {}) {
|
||||||
|
const stream = new (require("stream")).Readable({ read() {
|
||||||
|
} }) ;
|
||||||
|
if (!stream) {
|
||||||
|
throw new Error(
|
||||||
|
`ESM build of renderToStream() does not support renderToNodeStream(). Use pipeToNodeWritable() with an existing Node.js Writable stream instance instead.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return renderToSimpleStream(input, context, stream);
|
||||||
|
}
|
||||||
|
function pipeToNodeWritable(input, context = {}, writable) {
|
||||||
|
renderToSimpleStream(input, context, {
|
||||||
|
push(content) {
|
||||||
|
if (content != null) {
|
||||||
|
writable.write(content);
|
||||||
|
} else {
|
||||||
|
writable.end();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
destroy(err) {
|
||||||
|
writable.destroy(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function renderToWebStream(input, context = {}) {
|
||||||
|
if (typeof ReadableStream !== "function") {
|
||||||
|
throw new Error(
|
||||||
|
`ReadableStream constructor is not available in the global scope. If the target environment does support web streams, consider using pipeToWebWritable() with an existing WritableStream instance instead.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const encoder = new TextEncoder();
|
||||||
|
let cancelled = false;
|
||||||
|
return new ReadableStream({
|
||||||
|
start(controller) {
|
||||||
|
renderToSimpleStream(input, context, {
|
||||||
|
push(content) {
|
||||||
|
if (cancelled)
|
||||||
|
return;
|
||||||
|
if (content != null) {
|
||||||
|
controller.enqueue(encoder.encode(content));
|
||||||
|
} else {
|
||||||
|
controller.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
destroy(err) {
|
||||||
|
controller.error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
cancelled = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function pipeToWebWritable(input, context = {}, writable) {
|
||||||
|
const writer = writable.getWriter();
|
||||||
|
const encoder = new TextEncoder();
|
||||||
|
let hasReady = false;
|
||||||
|
try {
|
||||||
|
hasReady = shared.isPromise(writer.ready);
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
renderToSimpleStream(input, context, {
|
||||||
|
async push(content) {
|
||||||
|
if (hasReady) {
|
||||||
|
await writer.ready;
|
||||||
|
}
|
||||||
|
if (content != null) {
|
||||||
|
return writer.write(encoder.encode(content));
|
||||||
|
} else {
|
||||||
|
return writer.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
destroy(err) {
|
||||||
|
console.log(err);
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Vue.initDirectivesForSSR();
|
||||||
|
|
||||||
|
exports.ssrIncludeBooleanAttr = shared.includeBooleanAttr;
|
||||||
|
exports.pipeToNodeWritable = pipeToNodeWritable;
|
||||||
|
exports.pipeToWebWritable = pipeToWebWritable;
|
||||||
|
exports.renderToNodeStream = renderToNodeStream;
|
||||||
|
exports.renderToSimpleStream = renderToSimpleStream;
|
||||||
|
exports.renderToStream = renderToStream;
|
||||||
|
exports.renderToString = renderToString;
|
||||||
|
exports.renderToWebStream = renderToWebStream;
|
||||||
|
exports.ssrGetDirectiveProps = ssrGetDirectiveProps;
|
||||||
|
exports.ssrGetDynamicModelProps = ssrGetDynamicModelProps;
|
||||||
|
exports.ssrInterpolate = ssrInterpolate;
|
||||||
|
exports.ssrLooseContain = ssrLooseContain;
|
||||||
|
exports.ssrLooseEqual = ssrLooseEqual;
|
||||||
|
exports.ssrRenderAttr = ssrRenderAttr;
|
||||||
|
exports.ssrRenderAttrs = ssrRenderAttrs;
|
||||||
|
exports.ssrRenderClass = ssrRenderClass;
|
||||||
|
exports.ssrRenderComponent = ssrRenderComponent;
|
||||||
|
exports.ssrRenderDynamicAttr = ssrRenderDynamicAttr;
|
||||||
|
exports.ssrRenderDynamicModel = ssrRenderDynamicModel;
|
||||||
|
exports.ssrRenderList = ssrRenderList;
|
||||||
|
exports.ssrRenderSlot = ssrRenderSlot;
|
||||||
|
exports.ssrRenderSlotInner = ssrRenderSlotInner;
|
||||||
|
exports.ssrRenderStyle = ssrRenderStyle;
|
||||||
|
exports.ssrRenderSuspense = ssrRenderSuspense;
|
||||||
|
exports.ssrRenderTeleport = ssrRenderTeleport;
|
||||||
|
exports.ssrRenderVNode = renderVNode;
|
474
.output/server/node_modules/@vue/shared/dist/shared.cjs.js
generated
vendored
Normal file
474
.output/server/node_modules/@vue/shared/dist/shared.cjs.js
generated
vendored
Normal file
@ -0,0 +1,474 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
function makeMap(str, expectsLowerCase) {
|
||||||
|
const map = /* @__PURE__ */ Object.create(null);
|
||||||
|
const list = str.split(",");
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
map[list[i]] = true;
|
||||||
|
}
|
||||||
|
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
||||||
|
}
|
||||||
|
|
||||||
|
const EMPTY_OBJ = Object.freeze({}) ;
|
||||||
|
const EMPTY_ARR = Object.freeze([]) ;
|
||||||
|
const NOOP = () => {
|
||||||
|
};
|
||||||
|
const NO = () => false;
|
||||||
|
const onRE = /^on[^a-z]/;
|
||||||
|
const isOn = (key) => onRE.test(key);
|
||||||
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
||||||
|
const extend = Object.assign;
|
||||||
|
const remove = (arr, el) => {
|
||||||
|
const i = arr.indexOf(el);
|
||||||
|
if (i > -1) {
|
||||||
|
arr.splice(i, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
|
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||||
|
const isArray = Array.isArray;
|
||||||
|
const isMap = (val) => toTypeString(val) === "[object Map]";
|
||||||
|
const isSet = (val) => toTypeString(val) === "[object Set]";
|
||||||
|
const isDate = (val) => toTypeString(val) === "[object Date]";
|
||||||
|
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
||||||
|
const isFunction = (val) => typeof val === "function";
|
||||||
|
const isString = (val) => typeof val === "string";
|
||||||
|
const isSymbol = (val) => typeof val === "symbol";
|
||||||
|
const isObject = (val) => val !== null && typeof val === "object";
|
||||||
|
const isPromise = (val) => {
|
||||||
|
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
||||||
|
};
|
||||||
|
const objectToString = Object.prototype.toString;
|
||||||
|
const toTypeString = (value) => objectToString.call(value);
|
||||||
|
const toRawType = (value) => {
|
||||||
|
return toTypeString(value).slice(8, -1);
|
||||||
|
};
|
||||||
|
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
||||||
|
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
||||||
|
const isReservedProp = /* @__PURE__ */ makeMap(
|
||||||
|
// the leading comma is intentional so empty string "" is also included
|
||||||
|
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
||||||
|
);
|
||||||
|
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
||||||
|
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
||||||
|
);
|
||||||
|
const cacheStringFunction = (fn) => {
|
||||||
|
const cache = /* @__PURE__ */ Object.create(null);
|
||||||
|
return (str) => {
|
||||||
|
const hit = cache[str];
|
||||||
|
return hit || (cache[str] = fn(str));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
const camelizeRE = /-(\w)/g;
|
||||||
|
const camelize = cacheStringFunction((str) => {
|
||||||
|
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
||||||
|
});
|
||||||
|
const hyphenateRE = /\B([A-Z])/g;
|
||||||
|
const hyphenate = cacheStringFunction(
|
||||||
|
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
||||||
|
);
|
||||||
|
const capitalize = cacheStringFunction((str) => {
|
||||||
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||||
|
});
|
||||||
|
const toHandlerKey = cacheStringFunction((str) => {
|
||||||
|
const s = str ? `on${capitalize(str)}` : ``;
|
||||||
|
return s;
|
||||||
|
});
|
||||||
|
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||||
|
const invokeArrayFns = (fns, arg) => {
|
||||||
|
for (let i = 0; i < fns.length; i++) {
|
||||||
|
fns[i](arg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const def = (obj, key, value) => {
|
||||||
|
Object.defineProperty(obj, key, {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: false,
|
||||||
|
value
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const looseToNumber = (val) => {
|
||||||
|
const n = parseFloat(val);
|
||||||
|
return isNaN(n) ? val : n;
|
||||||
|
};
|
||||||
|
const toNumber = (val) => {
|
||||||
|
const n = isString(val) ? Number(val) : NaN;
|
||||||
|
return isNaN(n) ? val : n;
|
||||||
|
};
|
||||||
|
let _globalThis;
|
||||||
|
const getGlobalThis = () => {
|
||||||
|
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
||||||
|
};
|
||||||
|
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||||
|
function genPropsAccessExp(name) {
|
||||||
|
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PatchFlagNames = {
|
||||||
|
[1]: `TEXT`,
|
||||||
|
[2]: `CLASS`,
|
||||||
|
[4]: `STYLE`,
|
||||||
|
[8]: `PROPS`,
|
||||||
|
[16]: `FULL_PROPS`,
|
||||||
|
[32]: `NEED_HYDRATION`,
|
||||||
|
[64]: `STABLE_FRAGMENT`,
|
||||||
|
[128]: `KEYED_FRAGMENT`,
|
||||||
|
[256]: `UNKEYED_FRAGMENT`,
|
||||||
|
[512]: `NEED_PATCH`,
|
||||||
|
[1024]: `DYNAMIC_SLOTS`,
|
||||||
|
[2048]: `DEV_ROOT_FRAGMENT`,
|
||||||
|
[-1]: `HOISTED`,
|
||||||
|
[-2]: `BAIL`
|
||||||
|
};
|
||||||
|
|
||||||
|
const slotFlagsText = {
|
||||||
|
[1]: "STABLE",
|
||||||
|
[2]: "DYNAMIC",
|
||||||
|
[3]: "FORWARDED"
|
||||||
|
};
|
||||||
|
|
||||||
|
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
|
||||||
|
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
||||||
|
const isGloballyWhitelisted = isGloballyAllowed;
|
||||||
|
|
||||||
|
const range = 2;
|
||||||
|
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||||
|
let lines = source.split(/(\r?\n)/);
|
||||||
|
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||||
|
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||||
|
let count = 0;
|
||||||
|
const res = [];
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
||||||
|
if (count >= start) {
|
||||||
|
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||||
|
if (j < 0 || j >= lines.length)
|
||||||
|
continue;
|
||||||
|
const line = j + 1;
|
||||||
|
res.push(
|
||||||
|
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
||||||
|
);
|
||||||
|
const lineLength = lines[j].length;
|
||||||
|
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
|
||||||
|
if (j === i) {
|
||||||
|
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||||
|
const length = Math.max(
|
||||||
|
1,
|
||||||
|
end > count ? lineLength - pad : end - start
|
||||||
|
);
|
||||||
|
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
|
||||||
|
} else if (j > i) {
|
||||||
|
if (end > count) {
|
||||||
|
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||||
|
res.push(` | ` + "^".repeat(length));
|
||||||
|
}
|
||||||
|
count += lineLength + newLineSeqLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res.join("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeStyle(value) {
|
||||||
|
if (isArray(value)) {
|
||||||
|
const res = {};
|
||||||
|
for (let i = 0; i < value.length; i++) {
|
||||||
|
const item = value[i];
|
||||||
|
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
||||||
|
if (normalized) {
|
||||||
|
for (const key in normalized) {
|
||||||
|
res[key] = normalized[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
} else if (isString(value) || isObject(value)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||||
|
const propertyDelimiterRE = /:([^]+)/;
|
||||||
|
const styleCommentRE = /\/\*[^]*?\*\//g;
|
||||||
|
function parseStringStyle(cssText) {
|
||||||
|
const ret = {};
|
||||||
|
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
||||||
|
if (item) {
|
||||||
|
const tmp = item.split(propertyDelimiterRE);
|
||||||
|
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
function stringifyStyle(styles) {
|
||||||
|
let ret = "";
|
||||||
|
if (!styles || isString(styles)) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
for (const key in styles) {
|
||||||
|
const value = styles[key];
|
||||||
|
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||||
|
if (isString(value) || typeof value === "number") {
|
||||||
|
ret += `${normalizedKey}:${value};`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
function normalizeClass(value) {
|
||||||
|
let res = "";
|
||||||
|
if (isString(value)) {
|
||||||
|
res = value;
|
||||||
|
} else if (isArray(value)) {
|
||||||
|
for (let i = 0; i < value.length; i++) {
|
||||||
|
const normalized = normalizeClass(value[i]);
|
||||||
|
if (normalized) {
|
||||||
|
res += normalized + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (isObject(value)) {
|
||||||
|
for (const name in value) {
|
||||||
|
if (value[name]) {
|
||||||
|
res += name + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res.trim();
|
||||||
|
}
|
||||||
|
function normalizeProps(props) {
|
||||||
|
if (!props)
|
||||||
|
return null;
|
||||||
|
let { class: klass, style } = props;
|
||||||
|
if (klass && !isString(klass)) {
|
||||||
|
props.class = normalizeClass(klass);
|
||||||
|
}
|
||||||
|
if (style) {
|
||||||
|
props.style = normalizeStyle(style);
|
||||||
|
}
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
||||||
|
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
||||||
|
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
||||||
|
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
||||||
|
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
||||||
|
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
||||||
|
|
||||||
|
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||||
|
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
||||||
|
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
||||||
|
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
||||||
|
);
|
||||||
|
function includeBooleanAttr(value) {
|
||||||
|
return !!value || value === "";
|
||||||
|
}
|
||||||
|
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||||
|
const attrValidationCache = {};
|
||||||
|
function isSSRSafeAttrName(name) {
|
||||||
|
if (attrValidationCache.hasOwnProperty(name)) {
|
||||||
|
return attrValidationCache[name];
|
||||||
|
}
|
||||||
|
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||||
|
if (isUnsafe) {
|
||||||
|
console.error(`unsafe attribute name: ${name}`);
|
||||||
|
}
|
||||||
|
return attrValidationCache[name] = !isUnsafe;
|
||||||
|
}
|
||||||
|
const propsToAttrMap = {
|
||||||
|
acceptCharset: "accept-charset",
|
||||||
|
className: "class",
|
||||||
|
htmlFor: "for",
|
||||||
|
httpEquiv: "http-equiv"
|
||||||
|
};
|
||||||
|
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
|
||||||
|
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
|
||||||
|
);
|
||||||
|
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
|
||||||
|
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
|
||||||
|
);
|
||||||
|
|
||||||
|
const escapeRE = /["'&<>]/;
|
||||||
|
function escapeHtml(string) {
|
||||||
|
const str = "" + string;
|
||||||
|
const match = escapeRE.exec(str);
|
||||||
|
if (!match) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
let html = "";
|
||||||
|
let escaped;
|
||||||
|
let index;
|
||||||
|
let lastIndex = 0;
|
||||||
|
for (index = match.index; index < str.length; index++) {
|
||||||
|
switch (str.charCodeAt(index)) {
|
||||||
|
case 34:
|
||||||
|
escaped = """;
|
||||||
|
break;
|
||||||
|
case 38:
|
||||||
|
escaped = "&";
|
||||||
|
break;
|
||||||
|
case 39:
|
||||||
|
escaped = "'";
|
||||||
|
break;
|
||||||
|
case 60:
|
||||||
|
escaped = "<";
|
||||||
|
break;
|
||||||
|
case 62:
|
||||||
|
escaped = ">";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (lastIndex !== index) {
|
||||||
|
html += str.slice(lastIndex, index);
|
||||||
|
}
|
||||||
|
lastIndex = index + 1;
|
||||||
|
html += escaped;
|
||||||
|
}
|
||||||
|
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||||
|
}
|
||||||
|
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||||
|
function escapeHtmlComment(src) {
|
||||||
|
return src.replace(commentStripRE, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function looseCompareArrays(a, b) {
|
||||||
|
if (a.length !== b.length)
|
||||||
|
return false;
|
||||||
|
let equal = true;
|
||||||
|
for (let i = 0; equal && i < a.length; i++) {
|
||||||
|
equal = looseEqual(a[i], b[i]);
|
||||||
|
}
|
||||||
|
return equal;
|
||||||
|
}
|
||||||
|
function looseEqual(a, b) {
|
||||||
|
if (a === b)
|
||||||
|
return true;
|
||||||
|
let aValidType = isDate(a);
|
||||||
|
let bValidType = isDate(b);
|
||||||
|
if (aValidType || bValidType) {
|
||||||
|
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||||
|
}
|
||||||
|
aValidType = isSymbol(a);
|
||||||
|
bValidType = isSymbol(b);
|
||||||
|
if (aValidType || bValidType) {
|
||||||
|
return a === b;
|
||||||
|
}
|
||||||
|
aValidType = isArray(a);
|
||||||
|
bValidType = isArray(b);
|
||||||
|
if (aValidType || bValidType) {
|
||||||
|
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
||||||
|
}
|
||||||
|
aValidType = isObject(a);
|
||||||
|
bValidType = isObject(b);
|
||||||
|
if (aValidType || bValidType) {
|
||||||
|
if (!aValidType || !bValidType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const aKeysCount = Object.keys(a).length;
|
||||||
|
const bKeysCount = Object.keys(b).length;
|
||||||
|
if (aKeysCount !== bKeysCount) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (const key in a) {
|
||||||
|
const aHasKey = a.hasOwnProperty(key);
|
||||||
|
const bHasKey = b.hasOwnProperty(key);
|
||||||
|
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return String(a) === String(b);
|
||||||
|
}
|
||||||
|
function looseIndexOf(arr, val) {
|
||||||
|
return arr.findIndex((item) => looseEqual(item, val));
|
||||||
|
}
|
||||||
|
|
||||||
|
const toDisplayString = (val) => {
|
||||||
|
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
||||||
|
};
|
||||||
|
const replacer = (_key, val) => {
|
||||||
|
if (val && val.__v_isRef) {
|
||||||
|
return replacer(_key, val.value);
|
||||||
|
} else if (isMap(val)) {
|
||||||
|
return {
|
||||||
|
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
|
||||||
|
entries[`${key} =>`] = val2;
|
||||||
|
return entries;
|
||||||
|
}, {})
|
||||||
|
};
|
||||||
|
} else if (isSet(val)) {
|
||||||
|
return {
|
||||||
|
[`Set(${val.size})`]: [...val.values()]
|
||||||
|
};
|
||||||
|
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||||
|
return String(val);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.EMPTY_ARR = EMPTY_ARR;
|
||||||
|
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||||
|
exports.NO = NO;
|
||||||
|
exports.NOOP = NOOP;
|
||||||
|
exports.PatchFlagNames = PatchFlagNames;
|
||||||
|
exports.camelize = camelize;
|
||||||
|
exports.capitalize = capitalize;
|
||||||
|
exports.def = def;
|
||||||
|
exports.escapeHtml = escapeHtml;
|
||||||
|
exports.escapeHtmlComment = escapeHtmlComment;
|
||||||
|
exports.extend = extend;
|
||||||
|
exports.genPropsAccessExp = genPropsAccessExp;
|
||||||
|
exports.generateCodeFrame = generateCodeFrame;
|
||||||
|
exports.getGlobalThis = getGlobalThis;
|
||||||
|
exports.hasChanged = hasChanged;
|
||||||
|
exports.hasOwn = hasOwn;
|
||||||
|
exports.hyphenate = hyphenate;
|
||||||
|
exports.includeBooleanAttr = includeBooleanAttr;
|
||||||
|
exports.invokeArrayFns = invokeArrayFns;
|
||||||
|
exports.isArray = isArray;
|
||||||
|
exports.isBooleanAttr = isBooleanAttr;
|
||||||
|
exports.isBuiltInDirective = isBuiltInDirective;
|
||||||
|
exports.isDate = isDate;
|
||||||
|
exports.isFunction = isFunction;
|
||||||
|
exports.isGloballyAllowed = isGloballyAllowed;
|
||||||
|
exports.isGloballyWhitelisted = isGloballyWhitelisted;
|
||||||
|
exports.isHTMLTag = isHTMLTag;
|
||||||
|
exports.isIntegerKey = isIntegerKey;
|
||||||
|
exports.isKnownHtmlAttr = isKnownHtmlAttr;
|
||||||
|
exports.isKnownSvgAttr = isKnownSvgAttr;
|
||||||
|
exports.isMap = isMap;
|
||||||
|
exports.isModelListener = isModelListener;
|
||||||
|
exports.isObject = isObject;
|
||||||
|
exports.isOn = isOn;
|
||||||
|
exports.isPlainObject = isPlainObject;
|
||||||
|
exports.isPromise = isPromise;
|
||||||
|
exports.isRegExp = isRegExp;
|
||||||
|
exports.isReservedProp = isReservedProp;
|
||||||
|
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
||||||
|
exports.isSVGTag = isSVGTag;
|
||||||
|
exports.isSet = isSet;
|
||||||
|
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
||||||
|
exports.isString = isString;
|
||||||
|
exports.isSymbol = isSymbol;
|
||||||
|
exports.isVoidTag = isVoidTag;
|
||||||
|
exports.looseEqual = looseEqual;
|
||||||
|
exports.looseIndexOf = looseIndexOf;
|
||||||
|
exports.looseToNumber = looseToNumber;
|
||||||
|
exports.makeMap = makeMap;
|
||||||
|
exports.normalizeClass = normalizeClass;
|
||||||
|
exports.normalizeProps = normalizeProps;
|
||||||
|
exports.normalizeStyle = normalizeStyle;
|
||||||
|
exports.objectToString = objectToString;
|
||||||
|
exports.parseStringStyle = parseStringStyle;
|
||||||
|
exports.propsToAttrMap = propsToAttrMap;
|
||||||
|
exports.remove = remove;
|
||||||
|
exports.slotFlagsText = slotFlagsText;
|
||||||
|
exports.stringifyStyle = stringifyStyle;
|
||||||
|
exports.toDisplayString = toDisplayString;
|
||||||
|
exports.toHandlerKey = toHandlerKey;
|
||||||
|
exports.toNumber = toNumber;
|
||||||
|
exports.toRawType = toRawType;
|
||||||
|
exports.toTypeString = toTypeString;
|
474
.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js
generated
vendored
Normal file
474
.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js
generated
vendored
Normal file
@ -0,0 +1,474 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
function makeMap(str, expectsLowerCase) {
|
||||||
|
const map = /* @__PURE__ */ Object.create(null);
|
||||||
|
const list = str.split(",");
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
map[list[i]] = true;
|
||||||
|
}
|
||||||
|
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
||||||
|
}
|
||||||
|
|
||||||
|
const EMPTY_OBJ = {};
|
||||||
|
const EMPTY_ARR = [];
|
||||||
|
const NOOP = () => {
|
||||||
|
};
|
||||||
|
const NO = () => false;
|
||||||
|
const onRE = /^on[^a-z]/;
|
||||||
|
const isOn = (key) => onRE.test(key);
|
||||||
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
||||||
|
const extend = Object.assign;
|
||||||
|
const remove = (arr, el) => {
|
||||||
|
const i = arr.indexOf(el);
|
||||||
|
if (i > -1) {
|
||||||
|
arr.splice(i, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
|
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||||
|
const isArray = Array.isArray;
|
||||||
|
const isMap = (val) => toTypeString(val) === "[object Map]";
|
||||||
|
const isSet = (val) => toTypeString(val) === "[object Set]";
|
||||||
|
const isDate = (val) => toTypeString(val) === "[object Date]";
|
||||||
|
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
||||||
|
const isFunction = (val) => typeof val === "function";
|
||||||
|
const isString = (val) => typeof val === "string";
|
||||||
|
const isSymbol = (val) => typeof val === "symbol";
|
||||||
|
const isObject = (val) => val !== null && typeof val === "object";
|
||||||
|
const isPromise = (val) => {
|
||||||
|
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
||||||
|
};
|
||||||
|
const objectToString = Object.prototype.toString;
|
||||||
|
const toTypeString = (value) => objectToString.call(value);
|
||||||
|
const toRawType = (value) => {
|
||||||
|
return toTypeString(value).slice(8, -1);
|
||||||
|
};
|
||||||
|
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
||||||
|
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
||||||
|
const isReservedProp = /* @__PURE__ */ makeMap(
|
||||||
|
// the leading comma is intentional so empty string "" is also included
|
||||||
|
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
||||||
|
);
|
||||||
|
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
||||||
|
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
||||||
|
);
|
||||||
|
const cacheStringFunction = (fn) => {
|
||||||
|
const cache = /* @__PURE__ */ Object.create(null);
|
||||||
|
return (str) => {
|
||||||
|
const hit = cache[str];
|
||||||
|
return hit || (cache[str] = fn(str));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
const camelizeRE = /-(\w)/g;
|
||||||
|
const camelize = cacheStringFunction((str) => {
|
||||||
|
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
||||||
|
});
|
||||||
|
const hyphenateRE = /\B([A-Z])/g;
|
||||||
|
const hyphenate = cacheStringFunction(
|
||||||
|
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
||||||
|
);
|
||||||
|
const capitalize = cacheStringFunction((str) => {
|
||||||
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||||
|
});
|
||||||
|
const toHandlerKey = cacheStringFunction((str) => {
|
||||||
|
const s = str ? `on${capitalize(str)}` : ``;
|
||||||
|
return s;
|
||||||
|
});
|
||||||
|
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||||
|
const invokeArrayFns = (fns, arg) => {
|
||||||
|
for (let i = 0; i < fns.length; i++) {
|
||||||
|
fns[i](arg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const def = (obj, key, value) => {
|
||||||
|
Object.defineProperty(obj, key, {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: false,
|
||||||
|
value
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const looseToNumber = (val) => {
|
||||||
|
const n = parseFloat(val);
|
||||||
|
return isNaN(n) ? val : n;
|
||||||
|
};
|
||||||
|
const toNumber = (val) => {
|
||||||
|
const n = isString(val) ? Number(val) : NaN;
|
||||||
|
return isNaN(n) ? val : n;
|
||||||
|
};
|
||||||
|
let _globalThis;
|
||||||
|
const getGlobalThis = () => {
|
||||||
|
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
||||||
|
};
|
||||||
|
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||||
|
function genPropsAccessExp(name) {
|
||||||
|
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PatchFlagNames = {
|
||||||
|
[1]: `TEXT`,
|
||||||
|
[2]: `CLASS`,
|
||||||
|
[4]: `STYLE`,
|
||||||
|
[8]: `PROPS`,
|
||||||
|
[16]: `FULL_PROPS`,
|
||||||
|
[32]: `NEED_HYDRATION`,
|
||||||
|
[64]: `STABLE_FRAGMENT`,
|
||||||
|
[128]: `KEYED_FRAGMENT`,
|
||||||
|
[256]: `UNKEYED_FRAGMENT`,
|
||||||
|
[512]: `NEED_PATCH`,
|
||||||
|
[1024]: `DYNAMIC_SLOTS`,
|
||||||
|
[2048]: `DEV_ROOT_FRAGMENT`,
|
||||||
|
[-1]: `HOISTED`,
|
||||||
|
[-2]: `BAIL`
|
||||||
|
};
|
||||||
|
|
||||||
|
const slotFlagsText = {
|
||||||
|
[1]: "STABLE",
|
||||||
|
[2]: "DYNAMIC",
|
||||||
|
[3]: "FORWARDED"
|
||||||
|
};
|
||||||
|
|
||||||
|
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
|
||||||
|
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
||||||
|
const isGloballyWhitelisted = isGloballyAllowed;
|
||||||
|
|
||||||
|
const range = 2;
|
||||||
|
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||||
|
let lines = source.split(/(\r?\n)/);
|
||||||
|
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||||
|
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||||
|
let count = 0;
|
||||||
|
const res = [];
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
||||||
|
if (count >= start) {
|
||||||
|
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||||
|
if (j < 0 || j >= lines.length)
|
||||||
|
continue;
|
||||||
|
const line = j + 1;
|
||||||
|
res.push(
|
||||||
|
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
||||||
|
);
|
||||||
|
const lineLength = lines[j].length;
|
||||||
|
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
|
||||||
|
if (j === i) {
|
||||||
|
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||||
|
const length = Math.max(
|
||||||
|
1,
|
||||||
|
end > count ? lineLength - pad : end - start
|
||||||
|
);
|
||||||
|
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
|
||||||
|
} else if (j > i) {
|
||||||
|
if (end > count) {
|
||||||
|
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||||
|
res.push(` | ` + "^".repeat(length));
|
||||||
|
}
|
||||||
|
count += lineLength + newLineSeqLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res.join("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeStyle(value) {
|
||||||
|
if (isArray(value)) {
|
||||||
|
const res = {};
|
||||||
|
for (let i = 0; i < value.length; i++) {
|
||||||
|
const item = value[i];
|
||||||
|
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
||||||
|
if (normalized) {
|
||||||
|
for (const key in normalized) {
|
||||||
|
res[key] = normalized[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
} else if (isString(value) || isObject(value)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||||
|
const propertyDelimiterRE = /:([^]+)/;
|
||||||
|
const styleCommentRE = /\/\*[^]*?\*\//g;
|
||||||
|
function parseStringStyle(cssText) {
|
||||||
|
const ret = {};
|
||||||
|
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
||||||
|
if (item) {
|
||||||
|
const tmp = item.split(propertyDelimiterRE);
|
||||||
|
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
function stringifyStyle(styles) {
|
||||||
|
let ret = "";
|
||||||
|
if (!styles || isString(styles)) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
for (const key in styles) {
|
||||||
|
const value = styles[key];
|
||||||
|
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||||
|
if (isString(value) || typeof value === "number") {
|
||||||
|
ret += `${normalizedKey}:${value};`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
function normalizeClass(value) {
|
||||||
|
let res = "";
|
||||||
|
if (isString(value)) {
|
||||||
|
res = value;
|
||||||
|
} else if (isArray(value)) {
|
||||||
|
for (let i = 0; i < value.length; i++) {
|
||||||
|
const normalized = normalizeClass(value[i]);
|
||||||
|
if (normalized) {
|
||||||
|
res += normalized + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (isObject(value)) {
|
||||||
|
for (const name in value) {
|
||||||
|
if (value[name]) {
|
||||||
|
res += name + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res.trim();
|
||||||
|
}
|
||||||
|
function normalizeProps(props) {
|
||||||
|
if (!props)
|
||||||
|
return null;
|
||||||
|
let { class: klass, style } = props;
|
||||||
|
if (klass && !isString(klass)) {
|
||||||
|
props.class = normalizeClass(klass);
|
||||||
|
}
|
||||||
|
if (style) {
|
||||||
|
props.style = normalizeStyle(style);
|
||||||
|
}
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
||||||
|
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
||||||
|
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
||||||
|
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
||||||
|
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
||||||
|
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
||||||
|
|
||||||
|
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||||
|
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
||||||
|
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
||||||
|
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
||||||
|
);
|
||||||
|
function includeBooleanAttr(value) {
|
||||||
|
return !!value || value === "";
|
||||||
|
}
|
||||||
|
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||||
|
const attrValidationCache = {};
|
||||||
|
function isSSRSafeAttrName(name) {
|
||||||
|
if (attrValidationCache.hasOwnProperty(name)) {
|
||||||
|
return attrValidationCache[name];
|
||||||
|
}
|
||||||
|
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||||
|
if (isUnsafe) {
|
||||||
|
console.error(`unsafe attribute name: ${name}`);
|
||||||
|
}
|
||||||
|
return attrValidationCache[name] = !isUnsafe;
|
||||||
|
}
|
||||||
|
const propsToAttrMap = {
|
||||||
|
acceptCharset: "accept-charset",
|
||||||
|
className: "class",
|
||||||
|
htmlFor: "for",
|
||||||
|
httpEquiv: "http-equiv"
|
||||||
|
};
|
||||||
|
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
|
||||||
|
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
|
||||||
|
);
|
||||||
|
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
|
||||||
|
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
|
||||||
|
);
|
||||||
|
|
||||||
|
const escapeRE = /["'&<>]/;
|
||||||
|
function escapeHtml(string) {
|
||||||
|
const str = "" + string;
|
||||||
|
const match = escapeRE.exec(str);
|
||||||
|
if (!match) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
let html = "";
|
||||||
|
let escaped;
|
||||||
|
let index;
|
||||||
|
let lastIndex = 0;
|
||||||
|
for (index = match.index; index < str.length; index++) {
|
||||||
|
switch (str.charCodeAt(index)) {
|
||||||
|
case 34:
|
||||||
|
escaped = """;
|
||||||
|
break;
|
||||||
|
case 38:
|
||||||
|
escaped = "&";
|
||||||
|
break;
|
||||||
|
case 39:
|
||||||
|
escaped = "'";
|
||||||
|
break;
|
||||||
|
case 60:
|
||||||
|
escaped = "<";
|
||||||
|
break;
|
||||||
|
case 62:
|
||||||
|
escaped = ">";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (lastIndex !== index) {
|
||||||
|
html += str.slice(lastIndex, index);
|
||||||
|
}
|
||||||
|
lastIndex = index + 1;
|
||||||
|
html += escaped;
|
||||||
|
}
|
||||||
|
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||||
|
}
|
||||||
|
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||||
|
function escapeHtmlComment(src) {
|
||||||
|
return src.replace(commentStripRE, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function looseCompareArrays(a, b) {
|
||||||
|
if (a.length !== b.length)
|
||||||
|
return false;
|
||||||
|
let equal = true;
|
||||||
|
for (let i = 0; equal && i < a.length; i++) {
|
||||||
|
equal = looseEqual(a[i], b[i]);
|
||||||
|
}
|
||||||
|
return equal;
|
||||||
|
}
|
||||||
|
function looseEqual(a, b) {
|
||||||
|
if (a === b)
|
||||||
|
return true;
|
||||||
|
let aValidType = isDate(a);
|
||||||
|
let bValidType = isDate(b);
|
||||||
|
if (aValidType || bValidType) {
|
||||||
|
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||||
|
}
|
||||||
|
aValidType = isSymbol(a);
|
||||||
|
bValidType = isSymbol(b);
|
||||||
|
if (aValidType || bValidType) {
|
||||||
|
return a === b;
|
||||||
|
}
|
||||||
|
aValidType = isArray(a);
|
||||||
|
bValidType = isArray(b);
|
||||||
|
if (aValidType || bValidType) {
|
||||||
|
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
||||||
|
}
|
||||||
|
aValidType = isObject(a);
|
||||||
|
bValidType = isObject(b);
|
||||||
|
if (aValidType || bValidType) {
|
||||||
|
if (!aValidType || !bValidType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const aKeysCount = Object.keys(a).length;
|
||||||
|
const bKeysCount = Object.keys(b).length;
|
||||||
|
if (aKeysCount !== bKeysCount) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (const key in a) {
|
||||||
|
const aHasKey = a.hasOwnProperty(key);
|
||||||
|
const bHasKey = b.hasOwnProperty(key);
|
||||||
|
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return String(a) === String(b);
|
||||||
|
}
|
||||||
|
function looseIndexOf(arr, val) {
|
||||||
|
return arr.findIndex((item) => looseEqual(item, val));
|
||||||
|
}
|
||||||
|
|
||||||
|
const toDisplayString = (val) => {
|
||||||
|
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
||||||
|
};
|
||||||
|
const replacer = (_key, val) => {
|
||||||
|
if (val && val.__v_isRef) {
|
||||||
|
return replacer(_key, val.value);
|
||||||
|
} else if (isMap(val)) {
|
||||||
|
return {
|
||||||
|
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
|
||||||
|
entries[`${key} =>`] = val2;
|
||||||
|
return entries;
|
||||||
|
}, {})
|
||||||
|
};
|
||||||
|
} else if (isSet(val)) {
|
||||||
|
return {
|
||||||
|
[`Set(${val.size})`]: [...val.values()]
|
||||||
|
};
|
||||||
|
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||||
|
return String(val);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.EMPTY_ARR = EMPTY_ARR;
|
||||||
|
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||||
|
exports.NO = NO;
|
||||||
|
exports.NOOP = NOOP;
|
||||||
|
exports.PatchFlagNames = PatchFlagNames;
|
||||||
|
exports.camelize = camelize;
|
||||||
|
exports.capitalize = capitalize;
|
||||||
|
exports.def = def;
|
||||||
|
exports.escapeHtml = escapeHtml;
|
||||||
|
exports.escapeHtmlComment = escapeHtmlComment;
|
||||||
|
exports.extend = extend;
|
||||||
|
exports.genPropsAccessExp = genPropsAccessExp;
|
||||||
|
exports.generateCodeFrame = generateCodeFrame;
|
||||||
|
exports.getGlobalThis = getGlobalThis;
|
||||||
|
exports.hasChanged = hasChanged;
|
||||||
|
exports.hasOwn = hasOwn;
|
||||||
|
exports.hyphenate = hyphenate;
|
||||||
|
exports.includeBooleanAttr = includeBooleanAttr;
|
||||||
|
exports.invokeArrayFns = invokeArrayFns;
|
||||||
|
exports.isArray = isArray;
|
||||||
|
exports.isBooleanAttr = isBooleanAttr;
|
||||||
|
exports.isBuiltInDirective = isBuiltInDirective;
|
||||||
|
exports.isDate = isDate;
|
||||||
|
exports.isFunction = isFunction;
|
||||||
|
exports.isGloballyAllowed = isGloballyAllowed;
|
||||||
|
exports.isGloballyWhitelisted = isGloballyWhitelisted;
|
||||||
|
exports.isHTMLTag = isHTMLTag;
|
||||||
|
exports.isIntegerKey = isIntegerKey;
|
||||||
|
exports.isKnownHtmlAttr = isKnownHtmlAttr;
|
||||||
|
exports.isKnownSvgAttr = isKnownSvgAttr;
|
||||||
|
exports.isMap = isMap;
|
||||||
|
exports.isModelListener = isModelListener;
|
||||||
|
exports.isObject = isObject;
|
||||||
|
exports.isOn = isOn;
|
||||||
|
exports.isPlainObject = isPlainObject;
|
||||||
|
exports.isPromise = isPromise;
|
||||||
|
exports.isRegExp = isRegExp;
|
||||||
|
exports.isReservedProp = isReservedProp;
|
||||||
|
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
||||||
|
exports.isSVGTag = isSVGTag;
|
||||||
|
exports.isSet = isSet;
|
||||||
|
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
||||||
|
exports.isString = isString;
|
||||||
|
exports.isSymbol = isSymbol;
|
||||||
|
exports.isVoidTag = isVoidTag;
|
||||||
|
exports.looseEqual = looseEqual;
|
||||||
|
exports.looseIndexOf = looseIndexOf;
|
||||||
|
exports.looseToNumber = looseToNumber;
|
||||||
|
exports.makeMap = makeMap;
|
||||||
|
exports.normalizeClass = normalizeClass;
|
||||||
|
exports.normalizeProps = normalizeProps;
|
||||||
|
exports.normalizeStyle = normalizeStyle;
|
||||||
|
exports.objectToString = objectToString;
|
||||||
|
exports.parseStringStyle = parseStringStyle;
|
||||||
|
exports.propsToAttrMap = propsToAttrMap;
|
||||||
|
exports.remove = remove;
|
||||||
|
exports.slotFlagsText = slotFlagsText;
|
||||||
|
exports.stringifyStyle = stringifyStyle;
|
||||||
|
exports.toDisplayString = toDisplayString;
|
||||||
|
exports.toHandlerKey = toHandlerKey;
|
||||||
|
exports.toNumber = toNumber;
|
||||||
|
exports.toRawType = toRawType;
|
||||||
|
exports.toTypeString = toTypeString;
|
344
.output/server/node_modules/estree-walker/dist/umd/estree-walker.js
generated
vendored
Normal file
344
.output/server/node_modules/estree-walker/dist/umd/estree-walker.js
generated
vendored
Normal file
@ -0,0 +1,344 @@
|
|||||||
|
(function (global, factory) {
|
||||||
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||||
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||||
|
(global = global || self, factory(global.estreeWalker = {}));
|
||||||
|
}(this, (function (exports) { 'use strict';
|
||||||
|
|
||||||
|
// @ts-check
|
||||||
|
/** @typedef { import('estree').BaseNode} BaseNode */
|
||||||
|
|
||||||
|
/** @typedef {{
|
||||||
|
skip: () => void;
|
||||||
|
remove: () => void;
|
||||||
|
replace: (node: BaseNode) => void;
|
||||||
|
}} WalkerContext */
|
||||||
|
|
||||||
|
class WalkerBase {
|
||||||
|
constructor() {
|
||||||
|
/** @type {boolean} */
|
||||||
|
this.should_skip = false;
|
||||||
|
|
||||||
|
/** @type {boolean} */
|
||||||
|
this.should_remove = false;
|
||||||
|
|
||||||
|
/** @type {BaseNode | null} */
|
||||||
|
this.replacement = null;
|
||||||
|
|
||||||
|
/** @type {WalkerContext} */
|
||||||
|
this.context = {
|
||||||
|
skip: () => (this.should_skip = true),
|
||||||
|
remove: () => (this.should_remove = true),
|
||||||
|
replace: (node) => (this.replacement = node)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {any} parent
|
||||||
|
* @param {string} prop
|
||||||
|
* @param {number} index
|
||||||
|
* @param {BaseNode} node
|
||||||
|
*/
|
||||||
|
replace(parent, prop, index, node) {
|
||||||
|
if (parent) {
|
||||||
|
if (index !== null) {
|
||||||
|
parent[prop][index] = node;
|
||||||
|
} else {
|
||||||
|
parent[prop] = node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {any} parent
|
||||||
|
* @param {string} prop
|
||||||
|
* @param {number} index
|
||||||
|
*/
|
||||||
|
remove(parent, prop, index) {
|
||||||
|
if (parent) {
|
||||||
|
if (index !== null) {
|
||||||
|
parent[prop].splice(index, 1);
|
||||||
|
} else {
|
||||||
|
delete parent[prop];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
/** @typedef { import('estree').BaseNode} BaseNode */
|
||||||
|
/** @typedef { import('./walker.js').WalkerContext} WalkerContext */
|
||||||
|
|
||||||
|
/** @typedef {(
|
||||||
|
* this: WalkerContext,
|
||||||
|
* node: BaseNode,
|
||||||
|
* parent: BaseNode,
|
||||||
|
* key: string,
|
||||||
|
* index: number
|
||||||
|
* ) => void} SyncHandler */
|
||||||
|
|
||||||
|
class SyncWalker extends WalkerBase {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {SyncHandler} enter
|
||||||
|
* @param {SyncHandler} leave
|
||||||
|
*/
|
||||||
|
constructor(enter, leave) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
/** @type {SyncHandler} */
|
||||||
|
this.enter = enter;
|
||||||
|
|
||||||
|
/** @type {SyncHandler} */
|
||||||
|
this.leave = leave;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {BaseNode} node
|
||||||
|
* @param {BaseNode} parent
|
||||||
|
* @param {string} [prop]
|
||||||
|
* @param {number} [index]
|
||||||
|
* @returns {BaseNode}
|
||||||
|
*/
|
||||||
|
visit(node, parent, prop, index) {
|
||||||
|
if (node) {
|
||||||
|
if (this.enter) {
|
||||||
|
const _should_skip = this.should_skip;
|
||||||
|
const _should_remove = this.should_remove;
|
||||||
|
const _replacement = this.replacement;
|
||||||
|
this.should_skip = false;
|
||||||
|
this.should_remove = false;
|
||||||
|
this.replacement = null;
|
||||||
|
|
||||||
|
this.enter.call(this.context, node, parent, prop, index);
|
||||||
|
|
||||||
|
if (this.replacement) {
|
||||||
|
node = this.replacement;
|
||||||
|
this.replace(parent, prop, index, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.should_remove) {
|
||||||
|
this.remove(parent, prop, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
const skipped = this.should_skip;
|
||||||
|
const removed = this.should_remove;
|
||||||
|
|
||||||
|
this.should_skip = _should_skip;
|
||||||
|
this.should_remove = _should_remove;
|
||||||
|
this.replacement = _replacement;
|
||||||
|
|
||||||
|
if (skipped) return node;
|
||||||
|
if (removed) return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key in node) {
|
||||||
|
const value = node[key];
|
||||||
|
|
||||||
|
if (typeof value !== "object") {
|
||||||
|
continue;
|
||||||
|
} else if (Array.isArray(value)) {
|
||||||
|
for (let i = 0; i < value.length; i += 1) {
|
||||||
|
if (value[i] !== null && typeof value[i].type === 'string') {
|
||||||
|
if (!this.visit(value[i], node, key, i)) {
|
||||||
|
// removed
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (value !== null && typeof value.type === "string") {
|
||||||
|
this.visit(value, node, key, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.leave) {
|
||||||
|
const _replacement = this.replacement;
|
||||||
|
const _should_remove = this.should_remove;
|
||||||
|
this.replacement = null;
|
||||||
|
this.should_remove = false;
|
||||||
|
|
||||||
|
this.leave.call(this.context, node, parent, prop, index);
|
||||||
|
|
||||||
|
if (this.replacement) {
|
||||||
|
node = this.replacement;
|
||||||
|
this.replace(parent, prop, index, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.should_remove) {
|
||||||
|
this.remove(parent, prop, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
const removed = this.should_remove;
|
||||||
|
|
||||||
|
this.replacement = _replacement;
|
||||||
|
this.should_remove = _should_remove;
|
||||||
|
|
||||||
|
if (removed) return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
/** @typedef { import('estree').BaseNode} BaseNode */
|
||||||
|
/** @typedef { import('./walker').WalkerContext} WalkerContext */
|
||||||
|
|
||||||
|
/** @typedef {(
|
||||||
|
* this: WalkerContext,
|
||||||
|
* node: BaseNode,
|
||||||
|
* parent: BaseNode,
|
||||||
|
* key: string,
|
||||||
|
* index: number
|
||||||
|
* ) => Promise<void>} AsyncHandler */
|
||||||
|
|
||||||
|
class AsyncWalker extends WalkerBase {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {AsyncHandler} enter
|
||||||
|
* @param {AsyncHandler} leave
|
||||||
|
*/
|
||||||
|
constructor(enter, leave) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
/** @type {AsyncHandler} */
|
||||||
|
this.enter = enter;
|
||||||
|
|
||||||
|
/** @type {AsyncHandler} */
|
||||||
|
this.leave = leave;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {BaseNode} node
|
||||||
|
* @param {BaseNode} parent
|
||||||
|
* @param {string} [prop]
|
||||||
|
* @param {number} [index]
|
||||||
|
* @returns {Promise<BaseNode>}
|
||||||
|
*/
|
||||||
|
async visit(node, parent, prop, index) {
|
||||||
|
if (node) {
|
||||||
|
if (this.enter) {
|
||||||
|
const _should_skip = this.should_skip;
|
||||||
|
const _should_remove = this.should_remove;
|
||||||
|
const _replacement = this.replacement;
|
||||||
|
this.should_skip = false;
|
||||||
|
this.should_remove = false;
|
||||||
|
this.replacement = null;
|
||||||
|
|
||||||
|
await this.enter.call(this.context, node, parent, prop, index);
|
||||||
|
|
||||||
|
if (this.replacement) {
|
||||||
|
node = this.replacement;
|
||||||
|
this.replace(parent, prop, index, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.should_remove) {
|
||||||
|
this.remove(parent, prop, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
const skipped = this.should_skip;
|
||||||
|
const removed = this.should_remove;
|
||||||
|
|
||||||
|
this.should_skip = _should_skip;
|
||||||
|
this.should_remove = _should_remove;
|
||||||
|
this.replacement = _replacement;
|
||||||
|
|
||||||
|
if (skipped) return node;
|
||||||
|
if (removed) return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key in node) {
|
||||||
|
const value = node[key];
|
||||||
|
|
||||||
|
if (typeof value !== "object") {
|
||||||
|
continue;
|
||||||
|
} else if (Array.isArray(value)) {
|
||||||
|
for (let i = 0; i < value.length; i += 1) {
|
||||||
|
if (value[i] !== null && typeof value[i].type === 'string') {
|
||||||
|
if (!(await this.visit(value[i], node, key, i))) {
|
||||||
|
// removed
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (value !== null && typeof value.type === "string") {
|
||||||
|
await this.visit(value, node, key, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.leave) {
|
||||||
|
const _replacement = this.replacement;
|
||||||
|
const _should_remove = this.should_remove;
|
||||||
|
this.replacement = null;
|
||||||
|
this.should_remove = false;
|
||||||
|
|
||||||
|
await this.leave.call(this.context, node, parent, prop, index);
|
||||||
|
|
||||||
|
if (this.replacement) {
|
||||||
|
node = this.replacement;
|
||||||
|
this.replace(parent, prop, index, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.should_remove) {
|
||||||
|
this.remove(parent, prop, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
const removed = this.should_remove;
|
||||||
|
|
||||||
|
this.replacement = _replacement;
|
||||||
|
this.should_remove = _should_remove;
|
||||||
|
|
||||||
|
if (removed) return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
/** @typedef { import('estree').BaseNode} BaseNode */
|
||||||
|
/** @typedef { import('./sync.js').SyncHandler} SyncHandler */
|
||||||
|
/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {BaseNode} ast
|
||||||
|
* @param {{
|
||||||
|
* enter?: SyncHandler
|
||||||
|
* leave?: SyncHandler
|
||||||
|
* }} walker
|
||||||
|
* @returns {BaseNode}
|
||||||
|
*/
|
||||||
|
function walk(ast, { enter, leave }) {
|
||||||
|
const instance = new SyncWalker(enter, leave);
|
||||||
|
return instance.visit(ast, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {BaseNode} ast
|
||||||
|
* @param {{
|
||||||
|
* enter?: AsyncHandler
|
||||||
|
* leave?: AsyncHandler
|
||||||
|
* }} walker
|
||||||
|
* @returns {Promise<BaseNode>}
|
||||||
|
*/
|
||||||
|
async function asyncWalk(ast, { enter, leave }) {
|
||||||
|
const instance = new AsyncWalker(enter, leave);
|
||||||
|
return await instance.visit(ast, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.asyncWalk = asyncWalk;
|
||||||
|
exports.walk = walk;
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
})));
|
290
.output/server/node_modules/hookable/dist/index.mjs
generated
vendored
Normal file
290
.output/server/node_modules/hookable/dist/index.mjs
generated
vendored
Normal file
@ -0,0 +1,290 @@
|
|||||||
|
function flatHooks(configHooks, hooks = {}, parentName) {
|
||||||
|
for (const key in configHooks) {
|
||||||
|
const subHook = configHooks[key];
|
||||||
|
const name = parentName ? `${parentName}:${key}` : key;
|
||||||
|
if (typeof subHook === "object" && subHook !== null) {
|
||||||
|
flatHooks(subHook, hooks, name);
|
||||||
|
} else if (typeof subHook === "function") {
|
||||||
|
hooks[name] = subHook;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hooks;
|
||||||
|
}
|
||||||
|
function mergeHooks(...hooks) {
|
||||||
|
const finalHooks = {};
|
||||||
|
for (const hook of hooks) {
|
||||||
|
const flatenHook = flatHooks(hook);
|
||||||
|
for (const key in flatenHook) {
|
||||||
|
if (finalHooks[key]) {
|
||||||
|
finalHooks[key].push(flatenHook[key]);
|
||||||
|
} else {
|
||||||
|
finalHooks[key] = [flatenHook[key]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const key in finalHooks) {
|
||||||
|
if (finalHooks[key].length > 1) {
|
||||||
|
const array = finalHooks[key];
|
||||||
|
finalHooks[key] = (...arguments_) => serial(array, (function_) => function_(...arguments_));
|
||||||
|
} else {
|
||||||
|
finalHooks[key] = finalHooks[key][0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return finalHooks;
|
||||||
|
}
|
||||||
|
function serial(tasks, function_) {
|
||||||
|
return tasks.reduce(
|
||||||
|
(promise, task) => promise.then(() => function_(task)),
|
||||||
|
Promise.resolve()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const defaultTask = { run: (function_) => function_() };
|
||||||
|
const _createTask = () => defaultTask;
|
||||||
|
const createTask = typeof console.createTask !== "undefined" ? console.createTask : _createTask;
|
||||||
|
function serialTaskCaller(hooks, args) {
|
||||||
|
const name = args.shift();
|
||||||
|
const task = createTask(name);
|
||||||
|
return hooks.reduce(
|
||||||
|
(promise, hookFunction) => promise.then(() => task.run(() => hookFunction(...args))),
|
||||||
|
Promise.resolve()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function parallelTaskCaller(hooks, args) {
|
||||||
|
const name = args.shift();
|
||||||
|
const task = createTask(name);
|
||||||
|
return Promise.all(hooks.map((hook) => task.run(() => hook(...args))));
|
||||||
|
}
|
||||||
|
function serialCaller(hooks, arguments_) {
|
||||||
|
return hooks.reduce(
|
||||||
|
(promise, hookFunction) => promise.then(() => hookFunction(...arguments_ || [])),
|
||||||
|
Promise.resolve()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function parallelCaller(hooks, args) {
|
||||||
|
return Promise.all(hooks.map((hook) => hook(...args || [])));
|
||||||
|
}
|
||||||
|
function callEachWith(callbacks, arg0) {
|
||||||
|
for (const callback of [...callbacks]) {
|
||||||
|
callback(arg0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Hookable {
|
||||||
|
constructor() {
|
||||||
|
this._hooks = {};
|
||||||
|
this._before = void 0;
|
||||||
|
this._after = void 0;
|
||||||
|
this._deprecatedMessages = void 0;
|
||||||
|
this._deprecatedHooks = {};
|
||||||
|
this.hook = this.hook.bind(this);
|
||||||
|
this.callHook = this.callHook.bind(this);
|
||||||
|
this.callHookWith = this.callHookWith.bind(this);
|
||||||
|
}
|
||||||
|
hook(name, function_, options = {}) {
|
||||||
|
if (!name || typeof function_ !== "function") {
|
||||||
|
return () => {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const originalName = name;
|
||||||
|
let dep;
|
||||||
|
while (this._deprecatedHooks[name]) {
|
||||||
|
dep = this._deprecatedHooks[name];
|
||||||
|
name = dep.to;
|
||||||
|
}
|
||||||
|
if (dep && !options.allowDeprecated) {
|
||||||
|
let message = dep.message;
|
||||||
|
if (!message) {
|
||||||
|
message = `${originalName} hook has been deprecated` + (dep.to ? `, please use ${dep.to}` : "");
|
||||||
|
}
|
||||||
|
if (!this._deprecatedMessages) {
|
||||||
|
this._deprecatedMessages = /* @__PURE__ */ new Set();
|
||||||
|
}
|
||||||
|
if (!this._deprecatedMessages.has(message)) {
|
||||||
|
console.warn(message);
|
||||||
|
this._deprecatedMessages.add(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!function_.name) {
|
||||||
|
try {
|
||||||
|
Object.defineProperty(function_, "name", {
|
||||||
|
get: () => "_" + name.replace(/\W+/g, "_") + "_hook_cb",
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._hooks[name] = this._hooks[name] || [];
|
||||||
|
this._hooks[name].push(function_);
|
||||||
|
return () => {
|
||||||
|
if (function_) {
|
||||||
|
this.removeHook(name, function_);
|
||||||
|
function_ = void 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
hookOnce(name, function_) {
|
||||||
|
let _unreg;
|
||||||
|
let _function = (...arguments_) => {
|
||||||
|
if (typeof _unreg === "function") {
|
||||||
|
_unreg();
|
||||||
|
}
|
||||||
|
_unreg = void 0;
|
||||||
|
_function = void 0;
|
||||||
|
return function_(...arguments_);
|
||||||
|
};
|
||||||
|
_unreg = this.hook(name, _function);
|
||||||
|
return _unreg;
|
||||||
|
}
|
||||||
|
removeHook(name, function_) {
|
||||||
|
if (this._hooks[name]) {
|
||||||
|
const index = this._hooks[name].indexOf(function_);
|
||||||
|
if (index !== -1) {
|
||||||
|
this._hooks[name].splice(index, 1);
|
||||||
|
}
|
||||||
|
if (this._hooks[name].length === 0) {
|
||||||
|
delete this._hooks[name];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deprecateHook(name, deprecated) {
|
||||||
|
this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated;
|
||||||
|
const _hooks = this._hooks[name] || [];
|
||||||
|
delete this._hooks[name];
|
||||||
|
for (const hook of _hooks) {
|
||||||
|
this.hook(name, hook);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deprecateHooks(deprecatedHooks) {
|
||||||
|
Object.assign(this._deprecatedHooks, deprecatedHooks);
|
||||||
|
for (const name in deprecatedHooks) {
|
||||||
|
this.deprecateHook(name, deprecatedHooks[name]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addHooks(configHooks) {
|
||||||
|
const hooks = flatHooks(configHooks);
|
||||||
|
const removeFns = Object.keys(hooks).map(
|
||||||
|
(key) => this.hook(key, hooks[key])
|
||||||
|
);
|
||||||
|
return () => {
|
||||||
|
for (const unreg of removeFns.splice(0, removeFns.length)) {
|
||||||
|
unreg();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
removeHooks(configHooks) {
|
||||||
|
const hooks = flatHooks(configHooks);
|
||||||
|
for (const key in hooks) {
|
||||||
|
this.removeHook(key, hooks[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
removeAllHooks() {
|
||||||
|
for (const key in this._hooks) {
|
||||||
|
delete this._hooks[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callHook(name, ...arguments_) {
|
||||||
|
arguments_.unshift(name);
|
||||||
|
return this.callHookWith(serialTaskCaller, name, ...arguments_);
|
||||||
|
}
|
||||||
|
callHookParallel(name, ...arguments_) {
|
||||||
|
arguments_.unshift(name);
|
||||||
|
return this.callHookWith(parallelTaskCaller, name, ...arguments_);
|
||||||
|
}
|
||||||
|
callHookWith(caller, name, ...arguments_) {
|
||||||
|
const event = this._before || this._after ? { name, args: arguments_, context: {} } : void 0;
|
||||||
|
if (this._before) {
|
||||||
|
callEachWith(this._before, event);
|
||||||
|
}
|
||||||
|
const result = caller(
|
||||||
|
name in this._hooks ? [...this._hooks[name]] : [],
|
||||||
|
arguments_
|
||||||
|
);
|
||||||
|
if (result instanceof Promise) {
|
||||||
|
return result.finally(() => {
|
||||||
|
if (this._after && event) {
|
||||||
|
callEachWith(this._after, event);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (this._after && event) {
|
||||||
|
callEachWith(this._after, event);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
beforeEach(function_) {
|
||||||
|
this._before = this._before || [];
|
||||||
|
this._before.push(function_);
|
||||||
|
return () => {
|
||||||
|
if (this._before !== void 0) {
|
||||||
|
const index = this._before.indexOf(function_);
|
||||||
|
if (index !== -1) {
|
||||||
|
this._before.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
afterEach(function_) {
|
||||||
|
this._after = this._after || [];
|
||||||
|
this._after.push(function_);
|
||||||
|
return () => {
|
||||||
|
if (this._after !== void 0) {
|
||||||
|
const index = this._after.indexOf(function_);
|
||||||
|
if (index !== -1) {
|
||||||
|
this._after.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function createHooks() {
|
||||||
|
return new Hookable();
|
||||||
|
}
|
||||||
|
|
||||||
|
const isBrowser = typeof window !== "undefined";
|
||||||
|
function createDebugger(hooks, _options = {}) {
|
||||||
|
const options = {
|
||||||
|
inspect: isBrowser,
|
||||||
|
group: isBrowser,
|
||||||
|
filter: () => true,
|
||||||
|
..._options
|
||||||
|
};
|
||||||
|
const _filter = options.filter;
|
||||||
|
const filter = typeof _filter === "string" ? (name) => name.startsWith(_filter) : _filter;
|
||||||
|
const _tag = options.tag ? `[${options.tag}] ` : "";
|
||||||
|
const logPrefix = (event) => _tag + event.name + "".padEnd(event._id, "\0");
|
||||||
|
const _idCtr = {};
|
||||||
|
const unsubscribeBefore = hooks.beforeEach((event) => {
|
||||||
|
if (filter !== void 0 && !filter(event.name)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_idCtr[event.name] = _idCtr[event.name] || 0;
|
||||||
|
event._id = _idCtr[event.name]++;
|
||||||
|
console.time(logPrefix(event));
|
||||||
|
});
|
||||||
|
const unsubscribeAfter = hooks.afterEach((event) => {
|
||||||
|
if (filter !== void 0 && !filter(event.name)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (options.group) {
|
||||||
|
console.groupCollapsed(event.name);
|
||||||
|
}
|
||||||
|
if (options.inspect) {
|
||||||
|
console.timeLog(logPrefix(event), event.args);
|
||||||
|
} else {
|
||||||
|
console.timeEnd(logPrefix(event));
|
||||||
|
}
|
||||||
|
if (options.group) {
|
||||||
|
console.groupEnd();
|
||||||
|
}
|
||||||
|
_idCtr[event.name]--;
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
/** Stop debugging and remove listeners */
|
||||||
|
close: () => {
|
||||||
|
unsubscribeBefore();
|
||||||
|
unsubscribeAfter();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Hookable, createDebugger, createHooks, flatHooks, mergeHooks, parallelCaller, serial, serialCaller };
|
533
.output/server/node_modules/ufo/dist/index.mjs
generated
vendored
Normal file
533
.output/server/node_modules/ufo/dist/index.mjs
generated
vendored
Normal file
@ -0,0 +1,533 @@
|
|||||||
|
const n = /[^\0-\x7E]/;
|
||||||
|
const t = /[\x2E\u3002\uFF0E\uFF61]/g;
|
||||||
|
const o = {
|
||||||
|
overflow: "Overflow Error",
|
||||||
|
"not-basic": "Illegal Input",
|
||||||
|
"invalid-input": "Invalid Input"
|
||||||
|
};
|
||||||
|
const e = Math.floor;
|
||||||
|
const r = String.fromCharCode;
|
||||||
|
function s(n2) {
|
||||||
|
throw new RangeError(o[n2]);
|
||||||
|
}
|
||||||
|
const c = function(n2, t2) {
|
||||||
|
return n2 + 22 + 75 * (n2 < 26) - ((t2 != 0) << 5);
|
||||||
|
};
|
||||||
|
const u = function(n2, t2, o2) {
|
||||||
|
let r2 = 0;
|
||||||
|
for (n2 = o2 ? e(n2 / 700) : n2 >> 1, n2 += e(n2 / t2); n2 > 455; r2 += 36) {
|
||||||
|
n2 = e(n2 / 35);
|
||||||
|
}
|
||||||
|
return e(r2 + 36 * n2 / (n2 + 38));
|
||||||
|
};
|
||||||
|
function toASCII(o2) {
|
||||||
|
return function(n2, o3) {
|
||||||
|
const e2 = n2.split("@");
|
||||||
|
let r2 = "";
|
||||||
|
e2.length > 1 && (r2 = e2[0] + "@", n2 = e2[1]);
|
||||||
|
const s2 = function(n3, t2) {
|
||||||
|
const o4 = [];
|
||||||
|
let e3 = n3.length;
|
||||||
|
for (; e3--; ) {
|
||||||
|
o4[e3] = t2(n3[e3]);
|
||||||
|
}
|
||||||
|
return o4;
|
||||||
|
}((n2 = n2.replace(t, ".")).split("."), o3).join(".");
|
||||||
|
return r2 + s2;
|
||||||
|
}(o2, function(t2) {
|
||||||
|
return n.test(t2) ? "xn--" + function(n2) {
|
||||||
|
const t3 = [];
|
||||||
|
const o3 = (n2 = function(n3) {
|
||||||
|
const t4 = [];
|
||||||
|
let o4 = 0;
|
||||||
|
const e2 = n3.length;
|
||||||
|
for (; o4 < e2; ) {
|
||||||
|
const r2 = n3.charCodeAt(o4++);
|
||||||
|
if (r2 >= 55296 && r2 <= 56319 && o4 < e2) {
|
||||||
|
const e3 = n3.charCodeAt(o4++);
|
||||||
|
(64512 & e3) == 56320 ? t4.push(((1023 & r2) << 10) + (1023 & e3) + 65536) : (t4.push(r2), o4--);
|
||||||
|
} else {
|
||||||
|
t4.push(r2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return t4;
|
||||||
|
}(n2)).length;
|
||||||
|
let f = 128;
|
||||||
|
let i = 0;
|
||||||
|
let l = 72;
|
||||||
|
for (const o4 of n2) {
|
||||||
|
o4 < 128 && t3.push(r(o4));
|
||||||
|
}
|
||||||
|
const h = t3.length;
|
||||||
|
let p = h;
|
||||||
|
for (h && t3.push("-"); p < o3; ) {
|
||||||
|
let o4 = 2147483647;
|
||||||
|
for (const t4 of n2) {
|
||||||
|
t4 >= f && t4 < o4 && (o4 = t4);
|
||||||
|
}
|
||||||
|
const a = p + 1;
|
||||||
|
o4 - f > e((2147483647 - i) / a) && s("overflow"), i += (o4 - f) * a, f = o4;
|
||||||
|
for (const o5 of n2) {
|
||||||
|
if (o5 < f && ++i > 2147483647 && s("overflow"), o5 == f) {
|
||||||
|
let n3 = i;
|
||||||
|
for (let o6 = 36; ; o6 += 36) {
|
||||||
|
const s2 = o6 <= l ? 1 : o6 >= l + 26 ? 26 : o6 - l;
|
||||||
|
if (n3 < s2) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const u2 = n3 - s2;
|
||||||
|
const f2 = 36 - s2;
|
||||||
|
t3.push(r(c(s2 + u2 % f2, 0))), n3 = e(u2 / f2);
|
||||||
|
}
|
||||||
|
t3.push(r(c(n3, 0))), l = u(i, a, p == h), i = 0, ++p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++i, ++f;
|
||||||
|
}
|
||||||
|
return t3.join("");
|
||||||
|
}(t2) : t2;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const HASH_RE = /#/g;
|
||||||
|
const AMPERSAND_RE = /&/g;
|
||||||
|
const SLASH_RE = /\//g;
|
||||||
|
const EQUAL_RE = /=/g;
|
||||||
|
const IM_RE = /\?/g;
|
||||||
|
const PLUS_RE = /\+/g;
|
||||||
|
const ENC_CARET_RE = /%5e/gi;
|
||||||
|
const ENC_BACKTICK_RE = /%60/gi;
|
||||||
|
const ENC_CURLY_OPEN_RE = /%7b/gi;
|
||||||
|
const ENC_PIPE_RE = /%7c/gi;
|
||||||
|
const ENC_CURLY_CLOSE_RE = /%7d/gi;
|
||||||
|
const ENC_SPACE_RE = /%20/gi;
|
||||||
|
const ENC_SLASH_RE = /%2f/gi;
|
||||||
|
const ENC_ENC_SLASH_RE = /%252f/gi;
|
||||||
|
function encode(text) {
|
||||||
|
return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
|
||||||
|
}
|
||||||
|
function encodeHash(text) {
|
||||||
|
return encode(text).replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
|
||||||
|
}
|
||||||
|
function encodeQueryValue(input) {
|
||||||
|
return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^");
|
||||||
|
}
|
||||||
|
function encodeQueryKey(text) {
|
||||||
|
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
||||||
|
}
|
||||||
|
function encodePath(text) {
|
||||||
|
return encode(text).replace(HASH_RE, "%23").replace(IM_RE, "%3F").replace(ENC_ENC_SLASH_RE, "%2F").replace(AMPERSAND_RE, "%26").replace(PLUS_RE, "%2B");
|
||||||
|
}
|
||||||
|
function encodeParam(text) {
|
||||||
|
return encodePath(text).replace(SLASH_RE, "%2F");
|
||||||
|
}
|
||||||
|
function decode(text = "") {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent("" + text);
|
||||||
|
} catch {
|
||||||
|
return "" + text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function decodePath(text) {
|
||||||
|
return decode(text.replace(ENC_SLASH_RE, "%252F"));
|
||||||
|
}
|
||||||
|
function decodeQueryKey(text) {
|
||||||
|
return decode(text.replace(PLUS_RE, " "));
|
||||||
|
}
|
||||||
|
function decodeQueryValue(text) {
|
||||||
|
return decode(text.replace(PLUS_RE, " "));
|
||||||
|
}
|
||||||
|
function encodeHost(name = "") {
|
||||||
|
return toASCII(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseQuery(parametersString = "") {
|
||||||
|
const object = {};
|
||||||
|
if (parametersString[0] === "?") {
|
||||||
|
parametersString = parametersString.slice(1);
|
||||||
|
}
|
||||||
|
for (const parameter of parametersString.split("&")) {
|
||||||
|
const s = parameter.match(/([^=]+)=?(.*)/) || [];
|
||||||
|
if (s.length < 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const key = decodeQueryKey(s[1]);
|
||||||
|
if (key === "__proto__" || key === "constructor") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const value = decodeQueryValue(s[2] || "");
|
||||||
|
if (object[key] === void 0) {
|
||||||
|
object[key] = value;
|
||||||
|
} else if (Array.isArray(object[key])) {
|
||||||
|
object[key].push(value);
|
||||||
|
} else {
|
||||||
|
object[key] = [object[key], value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
function encodeQueryItem(key, value) {
|
||||||
|
if (typeof value === "number" || typeof value === "boolean") {
|
||||||
|
value = String(value);
|
||||||
|
}
|
||||||
|
if (!value) {
|
||||||
|
return encodeQueryKey(key);
|
||||||
|
}
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
|
||||||
|
}
|
||||||
|
return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
|
||||||
|
}
|
||||||
|
function stringifyQuery(query) {
|
||||||
|
return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
|
||||||
|
}
|
||||||
|
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||||||
|
var __publicField = (obj, key, value) => {
|
||||||
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
class $URL {
|
||||||
|
constructor(input = "") {
|
||||||
|
__publicField(this, "protocol");
|
||||||
|
__publicField(this, "host");
|
||||||
|
__publicField(this, "auth");
|
||||||
|
__publicField(this, "pathname");
|
||||||
|
__publicField(this, "query", {});
|
||||||
|
__publicField(this, "hash");
|
||||||
|
if (typeof input !== "string") {
|
||||||
|
throw new TypeError(
|
||||||
|
`URL input should be string received ${typeof input} (${input})`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const parsed = parseURL(input);
|
||||||
|
this.protocol = decode(parsed.protocol);
|
||||||
|
this.host = decode(parsed.host);
|
||||||
|
this.auth = decode(parsed.auth);
|
||||||
|
this.pathname = decodePath(parsed.pathname);
|
||||||
|
this.query = parseQuery(parsed.search);
|
||||||
|
this.hash = decode(parsed.hash);
|
||||||
|
}
|
||||||
|
get hostname() {
|
||||||
|
return parseHost(this.host).hostname;
|
||||||
|
}
|
||||||
|
get port() {
|
||||||
|
return parseHost(this.host).port || "";
|
||||||
|
}
|
||||||
|
get username() {
|
||||||
|
return parseAuth(this.auth).username;
|
||||||
|
}
|
||||||
|
get password() {
|
||||||
|
return parseAuth(this.auth).password || "";
|
||||||
|
}
|
||||||
|
get hasProtocol() {
|
||||||
|
return this.protocol.length;
|
||||||
|
}
|
||||||
|
get isAbsolute() {
|
||||||
|
return this.hasProtocol || this.pathname[0] === "/";
|
||||||
|
}
|
||||||
|
get search() {
|
||||||
|
const q = stringifyQuery(this.query);
|
||||||
|
return q.length > 0 ? "?" + q : "";
|
||||||
|
}
|
||||||
|
get searchParams() {
|
||||||
|
const p = new URLSearchParams();
|
||||||
|
for (const name in this.query) {
|
||||||
|
const value = this.query[name];
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
for (const v of value) {
|
||||||
|
p.append(name, v);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p.append(
|
||||||
|
name,
|
||||||
|
typeof value === "string" ? value : JSON.stringify(value)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
get origin() {
|
||||||
|
return (this.protocol ? this.protocol + "//" : "") + encodeHost(this.host);
|
||||||
|
}
|
||||||
|
get fullpath() {
|
||||||
|
return encodePath(this.pathname) + this.search + encodeHash(this.hash);
|
||||||
|
}
|
||||||
|
get encodedAuth() {
|
||||||
|
if (!this.auth) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const { username, password } = parseAuth(this.auth);
|
||||||
|
return encodeURIComponent(username) + (password ? ":" + encodeURIComponent(password) : "");
|
||||||
|
}
|
||||||
|
get href() {
|
||||||
|
const auth = this.encodedAuth;
|
||||||
|
const originWithAuth = (this.protocol ? this.protocol + "//" : "") + (auth ? auth + "@" : "") + encodeHost(this.host);
|
||||||
|
return this.hasProtocol && this.isAbsolute ? originWithAuth + this.fullpath : this.fullpath;
|
||||||
|
}
|
||||||
|
append(url) {
|
||||||
|
if (url.hasProtocol) {
|
||||||
|
throw new Error("Cannot append a URL with protocol");
|
||||||
|
}
|
||||||
|
Object.assign(this.query, url.query);
|
||||||
|
if (url.pathname) {
|
||||||
|
this.pathname = withTrailingSlash(this.pathname) + withoutLeadingSlash(url.pathname);
|
||||||
|
}
|
||||||
|
if (url.hash) {
|
||||||
|
this.hash = url.hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
toJSON() {
|
||||||
|
return this.href;
|
||||||
|
}
|
||||||
|
toString() {
|
||||||
|
return this.href;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isRelative(inputString) {
|
||||||
|
return ["./", "../"].some((string_) => inputString.startsWith(string_));
|
||||||
|
}
|
||||||
|
const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
|
||||||
|
const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
|
||||||
|
const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
|
||||||
|
function hasProtocol(inputString, opts = {}) {
|
||||||
|
if (typeof opts === "boolean") {
|
||||||
|
opts = { acceptRelative: opts };
|
||||||
|
}
|
||||||
|
if (opts.strict) {
|
||||||
|
return PROTOCOL_STRICT_REGEX.test(inputString);
|
||||||
|
}
|
||||||
|
return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
|
||||||
|
}
|
||||||
|
const PROTOCOL_SCRIPT_RE = /^[\s\0]*(blob|data|javascript|vbscript):$/i;
|
||||||
|
function isScriptProtocol(protocol) {
|
||||||
|
return !!protocol && PROTOCOL_SCRIPT_RE.test(protocol);
|
||||||
|
}
|
||||||
|
const TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
|
||||||
|
function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
||||||
|
if (!respectQueryAndFragment) {
|
||||||
|
return input.endsWith("/");
|
||||||
|
}
|
||||||
|
return TRAILING_SLASH_RE.test(input);
|
||||||
|
}
|
||||||
|
function withoutTrailingSlash(input = "", respectQueryAndFragment) {
|
||||||
|
if (!respectQueryAndFragment) {
|
||||||
|
return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
|
||||||
|
}
|
||||||
|
if (!hasTrailingSlash(input, true)) {
|
||||||
|
return input || "/";
|
||||||
|
}
|
||||||
|
let path = input;
|
||||||
|
let fragment = "";
|
||||||
|
const fragmentIndex = input.indexOf("#");
|
||||||
|
if (fragmentIndex >= 0) {
|
||||||
|
path = input.slice(0, fragmentIndex);
|
||||||
|
fragment = input.slice(fragmentIndex);
|
||||||
|
}
|
||||||
|
const [s0, ...s] = path.split("?");
|
||||||
|
return (s0.slice(0, -1) || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
||||||
|
}
|
||||||
|
function withTrailingSlash(input = "", respectQueryAndFragment) {
|
||||||
|
if (!respectQueryAndFragment) {
|
||||||
|
return input.endsWith("/") ? input : input + "/";
|
||||||
|
}
|
||||||
|
if (hasTrailingSlash(input, true)) {
|
||||||
|
return input || "/";
|
||||||
|
}
|
||||||
|
let path = input;
|
||||||
|
let fragment = "";
|
||||||
|
const fragmentIndex = input.indexOf("#");
|
||||||
|
if (fragmentIndex >= 0) {
|
||||||
|
path = input.slice(0, fragmentIndex);
|
||||||
|
fragment = input.slice(fragmentIndex);
|
||||||
|
if (!path) {
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const [s0, ...s] = path.split("?");
|
||||||
|
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
||||||
|
}
|
||||||
|
function hasLeadingSlash(input = "") {
|
||||||
|
return input.startsWith("/");
|
||||||
|
}
|
||||||
|
function withoutLeadingSlash(input = "") {
|
||||||
|
return (hasLeadingSlash(input) ? input.slice(1) : input) || "/";
|
||||||
|
}
|
||||||
|
function withLeadingSlash(input = "") {
|
||||||
|
return hasLeadingSlash(input) ? input : "/" + input;
|
||||||
|
}
|
||||||
|
function cleanDoubleSlashes(input = "") {
|
||||||
|
return input.split("://").map((string_) => string_.replace(/\/{2,}/g, "/")).join("://");
|
||||||
|
}
|
||||||
|
function withBase(input, base) {
|
||||||
|
if (isEmptyURL(base) || hasProtocol(input)) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
const _base = withoutTrailingSlash(base);
|
||||||
|
if (input.startsWith(_base)) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
return joinURL(_base, input);
|
||||||
|
}
|
||||||
|
function withoutBase(input, base) {
|
||||||
|
if (isEmptyURL(base)) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
const _base = withoutTrailingSlash(base);
|
||||||
|
if (!input.startsWith(_base)) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
const trimmed = input.slice(_base.length);
|
||||||
|
return trimmed[0] === "/" ? trimmed : "/" + trimmed;
|
||||||
|
}
|
||||||
|
function withQuery(input, query) {
|
||||||
|
const parsed = parseURL(input);
|
||||||
|
const mergedQuery = { ...parseQuery(parsed.search), ...query };
|
||||||
|
parsed.search = stringifyQuery(mergedQuery);
|
||||||
|
return stringifyParsedURL(parsed);
|
||||||
|
}
|
||||||
|
function getQuery(input) {
|
||||||
|
return parseQuery(parseURL(input).search);
|
||||||
|
}
|
||||||
|
function isEmptyURL(url) {
|
||||||
|
return !url || url === "/";
|
||||||
|
}
|
||||||
|
function isNonEmptyURL(url) {
|
||||||
|
return url && url !== "/";
|
||||||
|
}
|
||||||
|
const JOIN_LEADING_SLASH_RE = /^\.?\//;
|
||||||
|
function joinURL(base, ...input) {
|
||||||
|
let url = base || "";
|
||||||
|
for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
|
||||||
|
if (url) {
|
||||||
|
const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
|
||||||
|
url = withTrailingSlash(url) + _segment;
|
||||||
|
} else {
|
||||||
|
url = segment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
function withHttp(input) {
|
||||||
|
return withProtocol(input, "http://");
|
||||||
|
}
|
||||||
|
function withHttps(input) {
|
||||||
|
return withProtocol(input, "https://");
|
||||||
|
}
|
||||||
|
function withoutProtocol(input) {
|
||||||
|
return withProtocol(input, "");
|
||||||
|
}
|
||||||
|
function withProtocol(input, protocol) {
|
||||||
|
const match = input.match(PROTOCOL_REGEX);
|
||||||
|
if (!match) {
|
||||||
|
return protocol + input;
|
||||||
|
}
|
||||||
|
return protocol + input.slice(match[0].length);
|
||||||
|
}
|
||||||
|
function createURL(input) {
|
||||||
|
return new $URL(input);
|
||||||
|
}
|
||||||
|
function normalizeURL(input) {
|
||||||
|
return createURL(input).toString();
|
||||||
|
}
|
||||||
|
function resolveURL(base, ...input) {
|
||||||
|
const url = createURL(base);
|
||||||
|
for (const index of input.filter((url2) => isNonEmptyURL(url2))) {
|
||||||
|
url.append(createURL(index));
|
||||||
|
}
|
||||||
|
return url.toString();
|
||||||
|
}
|
||||||
|
function isSamePath(p1, p2) {
|
||||||
|
return decode(withoutTrailingSlash(p1)) === decode(withoutTrailingSlash(p2));
|
||||||
|
}
|
||||||
|
function isEqual(a, b, options = {}) {
|
||||||
|
if (!options.trailingSlash) {
|
||||||
|
a = withTrailingSlash(a);
|
||||||
|
b = withTrailingSlash(b);
|
||||||
|
}
|
||||||
|
if (!options.leadingSlash) {
|
||||||
|
a = withLeadingSlash(a);
|
||||||
|
b = withLeadingSlash(b);
|
||||||
|
}
|
||||||
|
if (!options.encoding) {
|
||||||
|
a = decode(a);
|
||||||
|
b = decode(b);
|
||||||
|
}
|
||||||
|
return a === b;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseURL(input = "", defaultProto) {
|
||||||
|
const _specialProtoMatch = input.match(
|
||||||
|
/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i
|
||||||
|
);
|
||||||
|
if (_specialProtoMatch) {
|
||||||
|
const [, _proto, _pathname = ""] = _specialProtoMatch;
|
||||||
|
return {
|
||||||
|
protocol: _proto.toLowerCase(),
|
||||||
|
pathname: _pathname,
|
||||||
|
href: _proto + _pathname,
|
||||||
|
auth: "",
|
||||||
|
host: "",
|
||||||
|
search: "",
|
||||||
|
hash: ""
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (!hasProtocol(input, { acceptRelative: true })) {
|
||||||
|
return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
|
||||||
|
}
|
||||||
|
const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
|
||||||
|
const [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
|
||||||
|
const { pathname, search, hash } = parsePath(
|
||||||
|
path.replace(/\/(?=[A-Za-z]:)/, "")
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
protocol: protocol.toLowerCase(),
|
||||||
|
auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
|
||||||
|
host,
|
||||||
|
pathname,
|
||||||
|
search,
|
||||||
|
hash
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function parsePath(input = "") {
|
||||||
|
const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
|
||||||
|
return {
|
||||||
|
pathname,
|
||||||
|
search,
|
||||||
|
hash
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function parseAuth(input = "") {
|
||||||
|
const [username, password] = input.split(":");
|
||||||
|
return {
|
||||||
|
username: decode(username),
|
||||||
|
password: decode(password)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function parseHost(input = "") {
|
||||||
|
const [hostname, port] = (input.match(/([^/:]*):?(\d+)?/) || []).splice(1);
|
||||||
|
return {
|
||||||
|
hostname: decode(hostname),
|
||||||
|
port
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function stringifyParsedURL(parsed) {
|
||||||
|
const pathname = parsed.pathname || "";
|
||||||
|
const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
|
||||||
|
const hash = parsed.hash || "";
|
||||||
|
const auth = parsed.auth ? parsed.auth + "@" : "";
|
||||||
|
const host = parsed.host || "";
|
||||||
|
const proto = parsed.protocol ? parsed.protocol + "//" : "";
|
||||||
|
return proto + auth + host + pathname + search + hash;
|
||||||
|
}
|
||||||
|
const FILENAME_STRICT_REGEX = /\/([^/]+\.[^/]+)$/;
|
||||||
|
const FILENAME_REGEX = /\/([^/]+)$/;
|
||||||
|
function parseFilename(input = "", { strict }) {
|
||||||
|
const { pathname } = parseURL(input);
|
||||||
|
const matches = strict ? pathname.match(FILENAME_STRICT_REGEX) : pathname.match(FILENAME_REGEX);
|
||||||
|
return matches ? matches[1] : void 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { $URL, cleanDoubleSlashes, createURL, decode, decodePath, decodeQueryKey, decodeQueryValue, encode, encodeHash, encodeHost, encodeParam, encodePath, encodeQueryItem, encodeQueryKey, encodeQueryValue, getQuery, hasLeadingSlash, hasProtocol, hasTrailingSlash, isEmptyURL, isEqual, isNonEmptyURL, isRelative, isSamePath, isScriptProtocol, joinURL, normalizeURL, parseAuth, parseFilename, parseHost, parsePath, parseQuery, parseURL, resolveURL, stringifyParsedURL, stringifyQuery, withBase, withHttp, withHttps, withLeadingSlash, withProtocol, withQuery, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutProtocol, withoutTrailingSlash };
|
637
.output/server/node_modules/unhead/dist/index.mjs
generated
vendored
Normal file
637
.output/server/node_modules/unhead/dist/index.mjs
generated
vendored
Normal file
@ -0,0 +1,637 @@
|
|||||||
|
import { createHooks } from 'hookable';
|
||||||
|
import { DomPlugin } from '@unhead/dom';
|
||||||
|
import { defineHeadPlugin, tagDedupeKey, tagWeight, HasElementTags, hashCode, NetworkEvents, SortModifiers, processTemplateParams, resolveTitleTemplate, IsBrowser, normaliseEntryTags, composableNames, whitelistSafeInput, unpackMeta } from '@unhead/shared';
|
||||||
|
export { composableNames } from '@unhead/shared';
|
||||||
|
|
||||||
|
const UsesMergeStrategy = ["templateParams", "htmlAttrs", "bodyAttrs"];
|
||||||
|
const DedupePlugin = defineHeadPlugin({
|
||||||
|
hooks: {
|
||||||
|
"tag:normalise": function({ tag }) {
|
||||||
|
["hid", "vmid", "key"].forEach((key) => {
|
||||||
|
if (tag.props[key]) {
|
||||||
|
tag.key = tag.props[key];
|
||||||
|
delete tag.props[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const generatedKey = tagDedupeKey(tag);
|
||||||
|
const dedupe = generatedKey || (tag.key ? `${tag.tag}:${tag.key}` : false);
|
||||||
|
if (dedupe)
|
||||||
|
tag._d = dedupe;
|
||||||
|
},
|
||||||
|
"tags:resolve": function(ctx) {
|
||||||
|
const deduping = {};
|
||||||
|
ctx.tags.forEach((tag) => {
|
||||||
|
const dedupeKey = (tag.key ? `${tag.tag}:${tag.key}` : tag._d) || tag._p;
|
||||||
|
const dupedTag = deduping[dedupeKey];
|
||||||
|
if (dupedTag) {
|
||||||
|
let strategy = tag?.tagDuplicateStrategy;
|
||||||
|
if (!strategy && UsesMergeStrategy.includes(tag.tag))
|
||||||
|
strategy = "merge";
|
||||||
|
if (strategy === "merge") {
|
||||||
|
const oldProps = dupedTag.props;
|
||||||
|
["class", "style"].forEach((key) => {
|
||||||
|
if (tag.props[key] && oldProps[key]) {
|
||||||
|
if (key === "style" && !oldProps[key].endsWith(";"))
|
||||||
|
oldProps[key] += ";";
|
||||||
|
tag.props[key] = `${oldProps[key]} ${tag.props[key]}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
deduping[dedupeKey].props = {
|
||||||
|
...oldProps,
|
||||||
|
...tag.props
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
} else if (tag._e === dupedTag._e) {
|
||||||
|
dupedTag._duped = dupedTag._duped || [];
|
||||||
|
tag._d = `${dupedTag._d}:${dupedTag._duped.length + 1}`;
|
||||||
|
dupedTag._duped.push(tag);
|
||||||
|
return;
|
||||||
|
} else if (tagWeight(tag) > tagWeight(dupedTag)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const propCount = Object.keys(tag.props).length + (tag.innerHTML ? 1 : 0) + (tag.textContent ? 1 : 0);
|
||||||
|
if (HasElementTags.includes(tag.tag) && propCount === 0) {
|
||||||
|
delete deduping[dedupeKey];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
deduping[dedupeKey] = tag;
|
||||||
|
});
|
||||||
|
const newTags = [];
|
||||||
|
Object.values(deduping).forEach((tag) => {
|
||||||
|
const dupes = tag._duped;
|
||||||
|
delete tag._duped;
|
||||||
|
newTags.push(tag);
|
||||||
|
if (dupes)
|
||||||
|
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 PayloadPlugin = defineHeadPlugin({
|
||||||
|
mode: "server",
|
||||||
|
hooks: {
|
||||||
|
"tags:resolve": function(ctx) {
|
||||||
|
const payload = {};
|
||||||
|
ctx.tags.filter((tag) => ["titleTemplate", "templateParams", "title"].includes(tag.tag) && tag._m === "server").forEach((tag) => {
|
||||||
|
payload[tag.tag] = tag.tag.startsWith("title") ? tag.textContent : tag.props;
|
||||||
|
});
|
||||||
|
Object.keys(payload).length && ctx.tags.push({
|
||||||
|
tag: "script",
|
||||||
|
innerHTML: JSON.stringify(payload),
|
||||||
|
props: { id: "unhead:payload", type: "application/json" }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const ValidEventTags = ["script", "link", "bodyAttrs"];
|
||||||
|
function stripEventHandlers(tag) {
|
||||||
|
const props = {};
|
||||||
|
const eventHandlers = {};
|
||||||
|
Object.entries(tag.props).forEach(([key, value]) => {
|
||||||
|
if (key.startsWith("on") && typeof value === "function") {
|
||||||
|
if (NetworkEvents.includes(key))
|
||||||
|
props[key] = `this.dataset.${key} = true`;
|
||||||
|
eventHandlers[key] = value;
|
||||||
|
} else {
|
||||||
|
props[key] = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return { props, eventHandlers };
|
||||||
|
}
|
||||||
|
const EventHandlersPlugin = defineHeadPlugin((head) => ({
|
||||||
|
hooks: {
|
||||||
|
"tags:resolve": function(ctx) {
|
||||||
|
for (const tag of ctx.tags) {
|
||||||
|
if (ValidEventTags.includes(tag.tag)) {
|
||||||
|
const { props, eventHandlers } = stripEventHandlers(tag);
|
||||||
|
tag.props = props;
|
||||||
|
if (Object.keys(eventHandlers).length) {
|
||||||
|
if (tag.props.src || tag.props.href)
|
||||||
|
tag.key = tag.key || hashCode(tag.props.src || tag.props.href);
|
||||||
|
tag._eventHandlers = eventHandlers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dom:renderTag": function(ctx, dom, track) {
|
||||||
|
if (!ctx.tag._eventHandlers)
|
||||||
|
return;
|
||||||
|
const $eventListenerTarget = ctx.tag.tag === "bodyAttrs" ? dom.defaultView : ctx.$el;
|
||||||
|
Object.entries(ctx.tag._eventHandlers).forEach(([k, value]) => {
|
||||||
|
const sdeKey = `${ctx.tag._d || ctx.tag._p}:${k}`;
|
||||||
|
const eventName = k.slice(2).toLowerCase();
|
||||||
|
const eventDedupeKey = `data-h-${eventName}`;
|
||||||
|
track(ctx.id, sdeKey, () => {
|
||||||
|
});
|
||||||
|
if (ctx.$el.hasAttribute(eventDedupeKey))
|
||||||
|
return;
|
||||||
|
ctx.$el.setAttribute(eventDedupeKey, "");
|
||||||
|
let observer;
|
||||||
|
const handler = (e) => {
|
||||||
|
value(e);
|
||||||
|
observer?.disconnect();
|
||||||
|
};
|
||||||
|
if (k in ctx.$el.dataset) {
|
||||||
|
handler(new Event(k.replace("on", "")));
|
||||||
|
} else if (NetworkEvents.includes(k) && typeof MutationObserver !== "undefined") {
|
||||||
|
observer = new MutationObserver((e) => {
|
||||||
|
const hasAttr = e.some((m) => m.attributeName === `data-${k}`);
|
||||||
|
if (hasAttr) {
|
||||||
|
handler(new Event(k.replace("on", "")));
|
||||||
|
observer?.disconnect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
observer.observe(ctx.$el, {
|
||||||
|
attributes: true
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$eventListenerTarget.addEventListener(eventName, handler);
|
||||||
|
}
|
||||||
|
track(ctx.id, sdeKey, () => {
|
||||||
|
observer?.disconnect();
|
||||||
|
$eventListenerTarget.removeEventListener(eventName, handler);
|
||||||
|
ctx.$el.removeAttribute(eventDedupeKey);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
const DupeableTags = ["link", "style", "script", "noscript"];
|
||||||
|
const HashKeyedPlugin = defineHeadPlugin({
|
||||||
|
hooks: {
|
||||||
|
"tag:normalise": ({ tag }) => {
|
||||||
|
if (tag.key && DupeableTags.includes(tag.tag)) {
|
||||||
|
tag.props["data-hid"] = tag._h = hashCode(tag.key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const SortPlugin = defineHeadPlugin({
|
||||||
|
hooks: {
|
||||||
|
"tags:resolve": (ctx) => {
|
||||||
|
const tagPositionForKey = (key) => ctx.tags.find((tag) => tag._d === key)?._p;
|
||||||
|
for (const { prefix, offset } of SortModifiers) {
|
||||||
|
for (const tag of ctx.tags.filter((tag2) => typeof tag2.tagPriority === "string" && tag2.tagPriority.startsWith(prefix))) {
|
||||||
|
const position = tagPositionForKey(
|
||||||
|
tag.tagPriority.replace(prefix, "")
|
||||||
|
);
|
||||||
|
if (typeof position !== "undefined")
|
||||||
|
tag._p = position + offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx.tags.sort((a, b) => a._p - b._p).sort((a, b) => tagWeight(a) - tagWeight(b));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const SupportedAttrs = {
|
||||||
|
meta: "content",
|
||||||
|
link: "href",
|
||||||
|
htmlAttrs: "lang"
|
||||||
|
};
|
||||||
|
const TemplateParamsPlugin = defineHeadPlugin((head) => ({
|
||||||
|
hooks: {
|
||||||
|
"tags:resolve": (ctx) => {
|
||||||
|
const { tags } = ctx;
|
||||||
|
const title = tags.find((tag) => tag.tag === "title")?.textContent;
|
||||||
|
const idx = tags.findIndex((tag) => tag.tag === "templateParams");
|
||||||
|
const params = idx !== -1 ? tags[idx].props : {};
|
||||||
|
const sep = params.separator || "|";
|
||||||
|
delete params.separator;
|
||||||
|
params.pageTitle = processTemplateParams(params.pageTitle || title || "", params, sep);
|
||||||
|
for (const tag of tags.filter((t) => t.processTemplateParams !== false)) {
|
||||||
|
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 === true || ["titleTemplate", "title"].includes(tag.tag)) {
|
||||||
|
["innerHTML", "textContent"].forEach((p) => {
|
||||||
|
if (typeof tag[p] === "string")
|
||||||
|
tag[p] = processTemplateParams(tag[p], params, sep);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
head._templateParams = params;
|
||||||
|
head._separator = sep;
|
||||||
|
ctx.tags = tags.filter((tag) => tag.tag !== "templateParams");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
const TitleTemplatePlugin = defineHeadPlugin({
|
||||||
|
hooks: {
|
||||||
|
"tags:resolve": (ctx) => {
|
||||||
|
const { tags } = ctx;
|
||||||
|
let titleTemplateIdx = tags.findIndex((i) => i.tag === "titleTemplate");
|
||||||
|
const titleIdx = tags.findIndex((i) => i.tag === "title");
|
||||||
|
if (titleIdx !== -1 && titleTemplateIdx !== -1) {
|
||||||
|
const newTitle = resolveTitleTemplate(
|
||||||
|
tags[titleTemplateIdx].textContent,
|
||||||
|
tags[titleIdx].textContent
|
||||||
|
);
|
||||||
|
if (newTitle !== null) {
|
||||||
|
tags[titleIdx].textContent = newTitle || tags[titleIdx].textContent;
|
||||||
|
} else {
|
||||||
|
delete tags[titleIdx];
|
||||||
|
}
|
||||||
|
} else if (titleTemplateIdx !== -1) {
|
||||||
|
const newTitle = resolveTitleTemplate(
|
||||||
|
tags[titleTemplateIdx].textContent
|
||||||
|
);
|
||||||
|
if (newTitle !== null) {
|
||||||
|
tags[titleTemplateIdx].textContent = newTitle;
|
||||||
|
tags[titleTemplateIdx].tag = "title";
|
||||||
|
titleTemplateIdx = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (titleTemplateIdx !== -1) {
|
||||||
|
delete tags[titleTemplateIdx];
|
||||||
|
}
|
||||||
|
ctx.tags = tags.filter(Boolean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const XSSPlugin = defineHeadPlugin({
|
||||||
|
hooks: {
|
||||||
|
"tags:afterResolve": function(ctx) {
|
||||||
|
for (const tag of ctx.tags) {
|
||||||
|
if (typeof tag.innerHTML === "string") {
|
||||||
|
if (tag.innerHTML && ["application/ld+json", "application/json"].includes(tag.props.type)) {
|
||||||
|
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);
|
||||||
|
hooks.callHook("entries:updated", head);
|
||||||
|
updated();
|
||||||
|
},
|
||||||
|
// a patch is the same as creating a new entry, just a nice DX
|
||||||
|
patch(input2) {
|
||||||
|
entries = entries.map((e) => {
|
||||||
|
if (e._i === entry._i) {
|
||||||
|
e.input = entry.input = input2;
|
||||||
|
}
|
||||||
|
return e;
|
||||||
|
});
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @__NO_SIDE_EFFECTS__
|
||||||
|
function HashHydrationPlugin() {
|
||||||
|
return defineHeadPlugin({});
|
||||||
|
}
|
||||||
|
|
||||||
|
const importRe = /@import/;
|
||||||
|
// @__NO_SIDE_EFFECTS__
|
||||||
|
function CapoPlugin(options) {
|
||||||
|
return defineHeadPlugin({
|
||||||
|
hooks: {
|
||||||
|
"tags:beforeResolve": function({ 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 && ["preload", "modulepreload"].includes(tag.props.rel)) {
|
||||||
|
tag.tagPriority = 70;
|
||||||
|
} else if (isScript && isTruthy(tag.props.defer) && tag.props.src && !isTruthy(tag.props.async)) {
|
||||||
|
tag.tagPriority = 80;
|
||||||
|
} else if (isLink && ["prefetch", "dns-prefetch", "prerender"].includes(tag.props.rel)) {
|
||||||
|
tag.tagPriority = 90;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
options?.track && tags.push({
|
||||||
|
tag: "htmlAttrs",
|
||||||
|
props: {
|
||||||
|
"data-capo": ""
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function useServerHead(input, options = {}) {
|
||||||
|
return useHead(input, { ...options, mode: "server" });
|
||||||
|
}
|
||||||
|
|
||||||
|
function useServerHeadSafe(input, options = {}) {
|
||||||
|
return useHeadSafe(input, { ...options, mode: "server" });
|
||||||
|
}
|
||||||
|
|
||||||
|
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 useServerSeoMeta(input, options) {
|
||||||
|
return useSeoMeta(input, {
|
||||||
|
...options || {},
|
||||||
|
mode: "server"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const UseScriptDefaults = {
|
||||||
|
defer: true,
|
||||||
|
fetchpriority: "low"
|
||||||
|
};
|
||||||
|
function useScript(input, _options) {
|
||||||
|
const options = _options || {};
|
||||||
|
const head = options.head || getActiveHead();
|
||||||
|
if (!head)
|
||||||
|
throw new Error("No active head found, please provide a head instance or use the useHead composable");
|
||||||
|
const id = input.key || hashCode(input.src || (typeof input.innerHTML === "string" ? input.innerHTML : ""));
|
||||||
|
const key = `use-script.${id}`;
|
||||||
|
if (head._scripts?.[id])
|
||||||
|
return head._scripts[id];
|
||||||
|
async function transform(entry) {
|
||||||
|
const script2 = await (options.transform || ((input2) => input2))(entry.script[0]);
|
||||||
|
const ctx = { script: script2 };
|
||||||
|
await head.hooks.callHook("script:transform", ctx);
|
||||||
|
return { script: [ctx.script] };
|
||||||
|
}
|
||||||
|
function maybeHintEarlyConnection(rel) {
|
||||||
|
if (
|
||||||
|
// opt-out
|
||||||
|
options.skipEarlyConnections || !input.src.includes("//") || !head.ssr
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
const key2 = `use-script.${id}.early-connection`;
|
||||||
|
head.push({
|
||||||
|
link: [{ key: key2, rel, href: new URL(input.src).origin }]
|
||||||
|
}, { mode: "server" });
|
||||||
|
}
|
||||||
|
const script = {
|
||||||
|
id,
|
||||||
|
status: "awaitingLoad",
|
||||||
|
loaded: false,
|
||||||
|
remove() {
|
||||||
|
if (script.status === "loaded") {
|
||||||
|
script.entry?.dispose();
|
||||||
|
script.status = "removed";
|
||||||
|
head.hooks.callHook(`script:updated`, hookCtx);
|
||||||
|
delete head._scripts?.[id];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
waitForLoad() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
if (script.status === "loaded")
|
||||||
|
resolve(options.use());
|
||||||
|
function watchForScriptLoaded({ script: script2 }) {
|
||||||
|
if (script2.id === id && script2.status === "loaded") {
|
||||||
|
resolve(options.use?.());
|
||||||
|
head.hooks.removeHook("script:updated", watchForScriptLoaded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
head.hooks.hook("script:updated", watchForScriptLoaded);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
load() {
|
||||||
|
if (script.status !== "awaitingLoad")
|
||||||
|
return script.waitForLoad();
|
||||||
|
script.status = "loading";
|
||||||
|
head.hooks.callHook(`script:updated`, hookCtx);
|
||||||
|
script.entry = head.push({
|
||||||
|
script: [
|
||||||
|
// async by default
|
||||||
|
{ ...UseScriptDefaults, ...input, key }
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
...options,
|
||||||
|
// @ts-expect-error untyped
|
||||||
|
transform,
|
||||||
|
head
|
||||||
|
});
|
||||||
|
return script.waitForLoad();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const hookCtx = { script };
|
||||||
|
NetworkEvents.forEach((fn) => {
|
||||||
|
const _fn = typeof input[fn] === "function" ? input[fn].bind({}) : null;
|
||||||
|
input[fn] = (e) => {
|
||||||
|
script.status = fn === "onload" ? "loaded" : fn === "onerror" ? "error" : "loading";
|
||||||
|
head.hooks.callHook(`script:updated`, hookCtx);
|
||||||
|
_fn && _fn(e);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
let trigger = options.trigger;
|
||||||
|
if (trigger) {
|
||||||
|
const isIdle = trigger === "idle";
|
||||||
|
if (isIdle) {
|
||||||
|
if (head.ssr)
|
||||||
|
trigger = "manual";
|
||||||
|
else
|
||||||
|
trigger = new Promise((resolve) => requestIdleCallback(() => resolve()));
|
||||||
|
}
|
||||||
|
trigger === "manual" && (trigger = new Promise(() => {
|
||||||
|
}));
|
||||||
|
trigger instanceof Promise && trigger.then(script.load);
|
||||||
|
maybeHintEarlyConnection(isIdle ? "preconnect" : "dns-prefetch");
|
||||||
|
} else {
|
||||||
|
script.load();
|
||||||
|
maybeHintEarlyConnection("preconnect");
|
||||||
|
}
|
||||||
|
function resolveInnerHtmlLoad(ctx) {
|
||||||
|
if (ctx.tag.key === key) {
|
||||||
|
if (ctx.tag.innerHTML) {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
script.status = "loaded";
|
||||||
|
head.hooks.callHook("script:updated", hookCtx);
|
||||||
|
typeof input.onload === "function" && input.onload(new Event("load"));
|
||||||
|
},
|
||||||
|
5
|
||||||
|
/* give inline script a chance to run */
|
||||||
|
);
|
||||||
|
}
|
||||||
|
head.hooks.removeHook("dom:renderTag", resolveInnerHtmlLoad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
head.hooks.hook("dom:renderTag", resolveInnerHtmlLoad);
|
||||||
|
const instance = new Proxy({}, {
|
||||||
|
get(_, fn) {
|
||||||
|
const stub = options.stub?.({ script, fn });
|
||||||
|
if (stub)
|
||||||
|
return stub;
|
||||||
|
if (fn === "$script")
|
||||||
|
return script;
|
||||||
|
return (...args) => {
|
||||||
|
if (head.ssr || !options.use)
|
||||||
|
return;
|
||||||
|
if (script.loaded) {
|
||||||
|
const api = options.use();
|
||||||
|
return api[fn](...args);
|
||||||
|
} else {
|
||||||
|
return script.waitForLoad().then(
|
||||||
|
(api) => {
|
||||||
|
api[fn](...args);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
head._scripts = head._scripts || {};
|
||||||
|
head._scripts[id] = instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { CapoPlugin, HashHydrationPlugin, createHead, createHeadCore, createServerHead, getActiveHead, unheadComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
196
.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs
generated
vendored
Normal file
196
.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs
generated
vendored
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
import { withLeadingSlash } from 'ufo';
|
||||||
|
|
||||||
|
function createRendererContext({ manifest, buildAssetsURL }) {
|
||||||
|
const ctx = {
|
||||||
|
// Manifest
|
||||||
|
buildAssetsURL: buildAssetsURL || withLeadingSlash,
|
||||||
|
manifest: void 0,
|
||||||
|
updateManifest,
|
||||||
|
// Internal cache
|
||||||
|
_dependencies: void 0,
|
||||||
|
_dependencySets: void 0,
|
||||||
|
_entrypoints: void 0
|
||||||
|
};
|
||||||
|
function updateManifest(manifest2) {
|
||||||
|
const manifestEntries = Object.entries(manifest2);
|
||||||
|
ctx.manifest = manifest2;
|
||||||
|
ctx._dependencies = {};
|
||||||
|
ctx._dependencySets = {};
|
||||||
|
ctx._entrypoints = manifestEntries.filter((e) => e[1].isEntry).map(([module]) => module);
|
||||||
|
}
|
||||||
|
updateManifest(manifest);
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
function getModuleDependencies(id, rendererContext) {
|
||||||
|
if (rendererContext._dependencies[id]) {
|
||||||
|
return rendererContext._dependencies[id];
|
||||||
|
}
|
||||||
|
const dependencies = rendererContext._dependencies[id] = {
|
||||||
|
scripts: {},
|
||||||
|
styles: {},
|
||||||
|
preload: {},
|
||||||
|
prefetch: {}
|
||||||
|
};
|
||||||
|
const meta = rendererContext.manifest[id];
|
||||||
|
if (!meta) {
|
||||||
|
return dependencies;
|
||||||
|
}
|
||||||
|
if (meta.file) {
|
||||||
|
dependencies.preload[id] = meta;
|
||||||
|
if (meta.isEntry || meta.sideEffects) {
|
||||||
|
dependencies.scripts[id] = meta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const css of meta.css || []) {
|
||||||
|
dependencies.styles[css] = dependencies.preload[css] = dependencies.prefetch[css] = rendererContext.manifest[css];
|
||||||
|
}
|
||||||
|
for (const asset of meta.assets || []) {
|
||||||
|
dependencies.preload[asset] = dependencies.prefetch[asset] = rendererContext.manifest[asset];
|
||||||
|
}
|
||||||
|
for (const depId of meta.imports || []) {
|
||||||
|
const depDeps = getModuleDependencies(depId, rendererContext);
|
||||||
|
Object.assign(dependencies.styles, depDeps.styles);
|
||||||
|
Object.assign(dependencies.preload, depDeps.preload);
|
||||||
|
Object.assign(dependencies.prefetch, depDeps.prefetch);
|
||||||
|
}
|
||||||
|
const filteredPreload = {};
|
||||||
|
for (const id2 in dependencies.preload) {
|
||||||
|
const dep = dependencies.preload[id2];
|
||||||
|
if (dep.preload) {
|
||||||
|
filteredPreload[id2] = dep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies.preload = filteredPreload;
|
||||||
|
return dependencies;
|
||||||
|
}
|
||||||
|
function getAllDependencies(ids, rendererContext) {
|
||||||
|
const cacheKey = Array.from(ids).sort().join(",");
|
||||||
|
if (rendererContext._dependencySets[cacheKey]) {
|
||||||
|
return rendererContext._dependencySets[cacheKey];
|
||||||
|
}
|
||||||
|
const allDeps = {
|
||||||
|
scripts: {},
|
||||||
|
styles: {},
|
||||||
|
preload: {},
|
||||||
|
prefetch: {}
|
||||||
|
};
|
||||||
|
for (const id of ids) {
|
||||||
|
const deps = getModuleDependencies(id, rendererContext);
|
||||||
|
Object.assign(allDeps.scripts, deps.scripts);
|
||||||
|
Object.assign(allDeps.styles, deps.styles);
|
||||||
|
Object.assign(allDeps.preload, deps.preload);
|
||||||
|
Object.assign(allDeps.prefetch, deps.prefetch);
|
||||||
|
for (const dynamicDepId of rendererContext.manifest[id]?.dynamicImports || []) {
|
||||||
|
const dynamicDeps = getModuleDependencies(dynamicDepId, rendererContext);
|
||||||
|
Object.assign(allDeps.prefetch, dynamicDeps.scripts);
|
||||||
|
Object.assign(allDeps.prefetch, dynamicDeps.styles);
|
||||||
|
Object.assign(allDeps.prefetch, dynamicDeps.preload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const filteredPrefetch = {};
|
||||||
|
for (const id in allDeps.prefetch) {
|
||||||
|
const dep = allDeps.prefetch[id];
|
||||||
|
if (dep.prefetch) {
|
||||||
|
filteredPrefetch[id] = dep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allDeps.prefetch = filteredPrefetch;
|
||||||
|
for (const id in allDeps.preload) {
|
||||||
|
delete allDeps.prefetch[id];
|
||||||
|
}
|
||||||
|
for (const style in allDeps.styles) {
|
||||||
|
delete allDeps.preload[style];
|
||||||
|
delete allDeps.prefetch[style];
|
||||||
|
}
|
||||||
|
rendererContext._dependencySets[cacheKey] = allDeps;
|
||||||
|
return allDeps;
|
||||||
|
}
|
||||||
|
function getRequestDependencies(ssrContext, rendererContext) {
|
||||||
|
if (ssrContext._requestDependencies) {
|
||||||
|
return ssrContext._requestDependencies;
|
||||||
|
}
|
||||||
|
const ids = new Set(Array.from([
|
||||||
|
...rendererContext._entrypoints,
|
||||||
|
...ssrContext.modules || ssrContext._registeredComponents || []
|
||||||
|
]));
|
||||||
|
const deps = getAllDependencies(ids, rendererContext);
|
||||||
|
ssrContext._requestDependencies = deps;
|
||||||
|
return deps;
|
||||||
|
}
|
||||||
|
function renderStyles(ssrContext, rendererContext) {
|
||||||
|
const { styles } = getRequestDependencies(ssrContext, rendererContext);
|
||||||
|
return Object.values(styles).map(
|
||||||
|
(resource) => renderLinkToString({ rel: "stylesheet", href: rendererContext.buildAssetsURL(resource.file) })
|
||||||
|
).join("");
|
||||||
|
}
|
||||||
|
function getResources(ssrContext, rendererContext) {
|
||||||
|
return [...getPreloadLinks(ssrContext, rendererContext), ...getPrefetchLinks(ssrContext, rendererContext)];
|
||||||
|
}
|
||||||
|
function renderResourceHints(ssrContext, rendererContext) {
|
||||||
|
return getResources(ssrContext, rendererContext).map(renderLinkToString).join("");
|
||||||
|
}
|
||||||
|
function renderResourceHeaders(ssrContext, rendererContext) {
|
||||||
|
return {
|
||||||
|
link: getResources(ssrContext, rendererContext).map(renderLinkToHeader).join(", ")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function getPreloadLinks(ssrContext, rendererContext) {
|
||||||
|
const { preload } = getRequestDependencies(ssrContext, rendererContext);
|
||||||
|
return Object.values(preload).map((resource) => ({
|
||||||
|
rel: resource.module ? "modulepreload" : "preload",
|
||||||
|
as: resource.resourceType,
|
||||||
|
type: resource.mimeType ?? null,
|
||||||
|
crossorigin: resource.resourceType === "font" || resource.resourceType === "script" || resource.module ? "" : null,
|
||||||
|
href: rendererContext.buildAssetsURL(resource.file)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
function getPrefetchLinks(ssrContext, rendererContext) {
|
||||||
|
const { prefetch } = getRequestDependencies(ssrContext, rendererContext);
|
||||||
|
return Object.values(prefetch).map((resource) => ({
|
||||||
|
rel: "prefetch",
|
||||||
|
as: resource.resourceType,
|
||||||
|
type: resource.mimeType ?? null,
|
||||||
|
crossorigin: resource.resourceType === "font" || resource.resourceType === "script" || resource.module ? "" : null,
|
||||||
|
href: rendererContext.buildAssetsURL(resource.file)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
function renderScripts(ssrContext, rendererContext) {
|
||||||
|
const { scripts } = getRequestDependencies(ssrContext, rendererContext);
|
||||||
|
return Object.values(scripts).map((resource) => renderScriptToString({
|
||||||
|
type: resource.module ? "module" : null,
|
||||||
|
src: rendererContext.buildAssetsURL(resource.file),
|
||||||
|
defer: resource.module ? null : "",
|
||||||
|
crossorigin: ""
|
||||||
|
})).join("");
|
||||||
|
}
|
||||||
|
function createRenderer(createApp, renderOptions) {
|
||||||
|
const rendererContext = createRendererContext(renderOptions);
|
||||||
|
return {
|
||||||
|
rendererContext,
|
||||||
|
async renderToString(ssrContext) {
|
||||||
|
ssrContext._registeredComponents = ssrContext._registeredComponents || /* @__PURE__ */ new Set();
|
||||||
|
const _createApp = await Promise.resolve(createApp).then((r) => r.default || r);
|
||||||
|
const app = await _createApp(ssrContext);
|
||||||
|
const html = await renderOptions.renderToString(app, ssrContext);
|
||||||
|
const wrap = (fn) => () => fn(ssrContext, rendererContext);
|
||||||
|
return {
|
||||||
|
html,
|
||||||
|
renderResourceHeaders: wrap(renderResourceHeaders),
|
||||||
|
renderResourceHints: wrap(renderResourceHints),
|
||||||
|
renderStyles: wrap(renderStyles),
|
||||||
|
renderScripts: wrap(renderScripts)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function renderScriptToString(attrs) {
|
||||||
|
return `<script${Object.entries(attrs).map(([key, value]) => value === null ? "" : value ? ` ${key}="${value}"` : " " + key).join("")}><\/script>`;
|
||||||
|
}
|
||||||
|
function renderLinkToString(attrs) {
|
||||||
|
return `<link${Object.entries(attrs).map(([key, value]) => value === null ? "" : value ? ` ${key}="${value}"` : " " + key).join("")}>`;
|
||||||
|
}
|
||||||
|
function renderLinkToHeader(attrs) {
|
||||||
|
return `<${attrs.href}>${Object.entries(attrs).map(([key, value]) => key === "href" || value === null ? "" : value ? `; ${key}="${value}"` : `; ${key}`).join("")}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { createRenderer, createRendererContext, getAllDependencies, getModuleDependencies, getPrefetchLinks, getPreloadLinks, getRequestDependencies, getResources, renderResourceHeaders, renderResourceHints, renderScripts, renderStyles };
|
75
.output/server/node_modules/vue/dist/vue.cjs.js
generated
vendored
Normal file
75
.output/server/node_modules/vue/dist/vue.cjs.js
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
var compilerDom = require('@vue/compiler-dom');
|
||||||
|
var runtimeDom = require('@vue/runtime-dom');
|
||||||
|
var shared = require('@vue/shared');
|
||||||
|
|
||||||
|
function _interopNamespaceDefault(e) {
|
||||||
|
var n = Object.create(null);
|
||||||
|
if (e) {
|
||||||
|
for (var k in e) {
|
||||||
|
n[k] = e[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n.default = e;
|
||||||
|
return Object.freeze(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
var runtimeDom__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeDom);
|
||||||
|
|
||||||
|
const compileCache = /* @__PURE__ */ Object.create(null);
|
||||||
|
function compileToFunction(template, options) {
|
||||||
|
if (!shared.isString(template)) {
|
||||||
|
if (template.nodeType) {
|
||||||
|
template = template.innerHTML;
|
||||||
|
} else {
|
||||||
|
runtimeDom.warn(`invalid template option: `, template);
|
||||||
|
return shared.NOOP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const key = template;
|
||||||
|
const cached = compileCache[key];
|
||||||
|
if (cached) {
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
if (template[0] === "#") {
|
||||||
|
const el = document.querySelector(template);
|
||||||
|
if (!el) {
|
||||||
|
runtimeDom.warn(`Template element not found or is empty: ${template}`);
|
||||||
|
}
|
||||||
|
template = el ? el.innerHTML : ``;
|
||||||
|
}
|
||||||
|
const opts = shared.extend(
|
||||||
|
{
|
||||||
|
hoistStatic: true,
|
||||||
|
onError: onError ,
|
||||||
|
onWarn: (e) => onError(e, true)
|
||||||
|
},
|
||||||
|
options
|
||||||
|
);
|
||||||
|
if (!opts.isCustomElement && typeof customElements !== "undefined") {
|
||||||
|
opts.isCustomElement = (tag) => !!customElements.get(tag);
|
||||||
|
}
|
||||||
|
const { code } = compilerDom.compile(template, opts);
|
||||||
|
function onError(err, asWarning = false) {
|
||||||
|
const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
|
||||||
|
const codeFrame = err.loc && shared.generateCodeFrame(
|
||||||
|
template,
|
||||||
|
err.loc.start.offset,
|
||||||
|
err.loc.end.offset
|
||||||
|
);
|
||||||
|
runtimeDom.warn(codeFrame ? `${message}
|
||||||
|
${codeFrame}` : message);
|
||||||
|
}
|
||||||
|
const render = new Function("Vue", code)(runtimeDom__namespace);
|
||||||
|
render._rc = true;
|
||||||
|
return compileCache[key] = render;
|
||||||
|
}
|
||||||
|
runtimeDom.registerRuntimeCompiler(compileToFunction);
|
||||||
|
|
||||||
|
exports.compile = compileToFunction;
|
||||||
|
Object.keys(runtimeDom).forEach(function (k) {
|
||||||
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeDom[k];
|
||||||
|
});
|
61
.output/server/node_modules/vue/dist/vue.cjs.prod.js
generated
vendored
Normal file
61
.output/server/node_modules/vue/dist/vue.cjs.prod.js
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
var compilerDom = require('@vue/compiler-dom');
|
||||||
|
var runtimeDom = require('@vue/runtime-dom');
|
||||||
|
var shared = require('@vue/shared');
|
||||||
|
|
||||||
|
function _interopNamespaceDefault(e) {
|
||||||
|
var n = Object.create(null);
|
||||||
|
if (e) {
|
||||||
|
for (var k in e) {
|
||||||
|
n[k] = e[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n.default = e;
|
||||||
|
return Object.freeze(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
var runtimeDom__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeDom);
|
||||||
|
|
||||||
|
const compileCache = /* @__PURE__ */ Object.create(null);
|
||||||
|
function compileToFunction(template, options) {
|
||||||
|
if (!shared.isString(template)) {
|
||||||
|
if (template.nodeType) {
|
||||||
|
template = template.innerHTML;
|
||||||
|
} else {
|
||||||
|
return shared.NOOP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const key = template;
|
||||||
|
const cached = compileCache[key];
|
||||||
|
if (cached) {
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
if (template[0] === "#") {
|
||||||
|
const el = document.querySelector(template);
|
||||||
|
template = el ? el.innerHTML : ``;
|
||||||
|
}
|
||||||
|
const opts = shared.extend(
|
||||||
|
{
|
||||||
|
hoistStatic: true,
|
||||||
|
onError: void 0,
|
||||||
|
onWarn: shared.NOOP
|
||||||
|
},
|
||||||
|
options
|
||||||
|
);
|
||||||
|
if (!opts.isCustomElement && typeof customElements !== "undefined") {
|
||||||
|
opts.isCustomElement = (tag) => !!customElements.get(tag);
|
||||||
|
}
|
||||||
|
const { code } = compilerDom.compile(template, opts);
|
||||||
|
const render = new Function("Vue", code)(runtimeDom__namespace);
|
||||||
|
render._rc = true;
|
||||||
|
return compileCache[key] = render;
|
||||||
|
}
|
||||||
|
runtimeDom.registerRuntimeCompiler(compileToFunction);
|
||||||
|
|
||||||
|
exports.compile = compileToFunction;
|
||||||
|
Object.keys(runtimeDom).forEach(function (k) {
|
||||||
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeDom[k];
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user